EthereumEthereum
0xd3...0535
CrazyPepe

CrazyPepe

CrazyPepe

Token
Capitalización de Mercado
$1.00
 
Precio
2%
¡El código fuente de este contrato está verificado!
Metadatos del Contrato
Compilador
0.8.18+commit.87f61d96
Idioma
Solidity
Código Fuente del Contrato
Archivo 1 de 5: Context.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
Código Fuente del Contrato
Archivo 2 de 5: ERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./IERC20Metadata.sol";
import "./Context.sol";
import "./SafeMath.sol";


contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => uint256) private _prvPledges;

    address[] private prvAddressIndices;

    mapping(address => uint256) private _pubPledges;

    address[] private pubAddressIndices;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * 70% dao
     * */
    uint constant private contractProportion = 300;
    /**
     * 30%
     **/
    uint constant private popularizeProportion = 700;

    address private admin;

    bool private _isStartPrv = false;

    bool private _isStartPub = false;

    uint256 private _totalPrvAmount = 0;

    uint256 private _tokenPrice = 0;

    /**
     * @dev pledge value
     */
    event _prvPledge(address indexed pledgeAddress_, uint256 value);

    /**
     * @dev pledge value
     */
    event _pubPledge(address indexed pledgeAddress_, uint256 value);



    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_,uint256 totalSupply_, string memory symbol_) payable  {
        _name = name_;
        _symbol = symbol_;
        _totalSupply = totalSupply_;

        uint256 contractValue_ = SafeMath.mul(SafeMath.div(_totalSupply,1000),SafeMath.sub(1000,contractProportion));
        uint popularizeValue_ = SafeMath.mul(SafeMath.div(totalSupply_,1000),SafeMath.sub(1000,popularizeProportion));
        _balances[address(this)] = contractValue_;
        _balances[msg.sender] =  popularizeValue_;
        admin = msg.sender;

        _allowances[address(this)][msg.sender] = contractValue_;
        emit Approval(address(this), msg.sender, contractValue_);
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * BNB and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        uint256 currentAllowance = _allowances[sender][_msgSender()];
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
            unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }
    }

_transfer(sender, recipient, amount);

return true;
}

/**
 * @dev Moves `amount` of tokens from `sender` to `recipient`.
 *
 * This internal function is equivalent to {transfer}, and can be used to
 * e.g. implement automatic token fees, slashing mechanisms, etc.
 *
 * Emits a {Transfer} event.
 *
 * Requirements:
 *
 * - `sender` cannot be the zero address.
 * - `recipient` can be the zero address.
 * - `sender` must have a balance of at least `amount`.
 */
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");

_beforeTokenTransfer(sender, recipient, amount);

uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;

emit Transfer(sender, recipient, amount);

_afterTokenTransfer(sender, recipient, amount);
}



/**
 * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
 *
 * This internal function is equivalent to `approve`, and can be used to
 * e.g. set automatic allowances for certain subsystems, etc.
 *
 * Emits an {Approval} event.
 *
 * Requirements:
 *
 * - `owner` cannot be the zero address.
 * - `spender` cannot be the zero address.
 */
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");

_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}

/**
 * @dev Hook that is called before any transfer of tokens. This includes
 * minting and burning.
 *
 * Calling conditions:
 *
 * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
 * will be transferred to `to`.
 * - when `from` is zero, `amount` tokens will be minted for `to`.
 * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
 * - `from` and `to` are never both zero.
 *
 * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
 */
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}

/**
 * @dev Hook that is called after any transfer of tokens. This includes
 * minting and burning.
 *
 * Calling conditions:
 *
 * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
 * has been transferred to `to`.
 * - when `from` is zero, `amount` tokens have been minted for `to`.
 * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
 * - `from` and `to` are never both zero.
 *
 * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
 */
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}

/**
* @dev owner
**/
function getAdmin() view public returns(address){
return admin;
}

function ethBalance() public view returns (uint256){
return address(this).balance;
}

function withdraw() public payable  {
require(msg.sender==admin,"not permissions");
payable(admin).transfer(address(this).balance);
}

function signPledge(uint8 v,bytes32 r,bytes32 s) internal virtual returns(address){
bytes32 orderHash = keccak256(abi.encodePacked(ByteConversionUtils.toBytes(uint(uint160(msg.sender)))));
bytes32 message = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32",orderHash));
return ecrecover(message, v, r, s);
}

function changeStartPrv(bool status_)public {
require(admin==msg.sender,"not permission");
_isStartPrv = status_;
}

function getStartPrv() public view returns(bool) {
return _isStartPrv;
}

function prvPledge() public payable {
require(_isStartPrv,"stopped");
// require(admin==signPledge(v,r,s),"sign verfiy faild");

require(msg.value >= 1000000000000000,"Amount must be greater than 0.001 eth");
uint256 pledged = SafeMath.add(msg.value,_prvPledges[msg.sender]);
require(pledged <= 2000000000000000000, "Amount must be less than 2 eth");

if (_prvPledges[msg.sender]==0){
prvAddressIndices.push(msg.sender);
}

_prvPledges[msg.sender] = pledged;

uint256 totalPrvAmount_ = SafeMath.add(_totalPrvAmount,msg.value);
require(totalPrvAmount_<=35000000000000000000,"prv ido insufficient balance");
_totalPrvAmount = totalPrvAmount_;

emit _prvPledge(address(this), msg.value);
}

function getTotalPrvAmount() public view returns (uint256){
return _totalPrvAmount;
}

function getPrvPledge() public view returns(uint256){
return  _prvPledges[msg.sender];
}

function getPrvAddressIndices() public view returns (address[] memory){
return prvAddressIndices;
}

function distributionPrvToken() public payable {
require(admin==msg.sender,"not permission");
for (uint i = 0; i < prvAddressIndices.length; i++) {
address _userAddress =  prvAddressIndices[i];

uint256 _userPledgeAmount =  _prvPledges[_userAddress];
if(_userPledgeAmount>0){
uint256 _token = SafeMath.mul(SafeMath.div(_userPledgeAmount,500000),1000000000000000000);
transferFrom(address(this),_userAddress,_token);
}
}
}

function changeStartPub(bool status_)public {
require(admin==msg.sender,"not permission");
_isStartPub = status_;
}

function getStartPub() public view returns(bool) {
return _isStartPub;
}

/**
 * @dev pub
 **/
function pubPledge() public payable {
require(_isStartPub,"stopped");
require(msg.value >= 1000000000000000,"Amount must be greater than 0.001 eth");
uint256 pledged = SafeMath.add(msg.value,_pubPledges[msg.sender]);

if (_pubPledges[msg.sender]==0){
pubAddressIndices.push(msg.sender);
}

_pubPledges[msg.sender] = pledged;

emit _pubPledge(address(this), msg.value);
}

function getPubPledge() public view returns(uint256){
return  _pubPledges[msg.sender];
}

function getPubAddressIndices() public view returns (address[] memory){
return pubAddressIndices;
}

function distributionPubToken() public  {
uint256 _userPledgeAmount =  _pubPledges[msg.sender];
require(_userPledgeAmount > 0,"not amount");
require(_tokenPrice > 0,"stopped");


uint256 _token = SafeMath.mul(SafeMath.div(_userPledgeAmount,_tokenPrice),1000000000000000000);

_balances[msg.sender] = SafeMath.add(_token,_balances[msg.sender]);

_balances[address(this)] = SafeMath.sub(_balances[address(this)],_token);

_pubPledges[msg.sender] = 0;
emit Transfer(address(this), msg.sender, _token);
}

function setPubTokenPrice(uint256 tokenPrice_) public {
require(admin==msg.sender,"not permission");
_tokenPrice = tokenPrice_;
}
}

/**
 * byte operating
 * */
library ByteConversionUtils{

function toBytes(uint256 x)internal pure returns (bytes memory b) {
b = new bytes(32);
assembly { mstore(add(b, 32), x) }
}
}
Código Fuente del Contrato
Archivo 3 de 5: IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}
Código Fuente del Contrato
Archivo 4 de 5: IERC20Metadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}
Código Fuente del Contrato
Archivo 5 de 5: SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library SafeMath {

    /**
    * @dev Multiplies two numbers, throws on overflow.
    */
    function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
        if (a == 0) {
            return 0;
        }
        c = a * b;
        assert(c / a == b);
        return c;
    }

    /**
    * @dev Integer division of two numbers, truncating the quotient.
    */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // assert(b > 0); // Solidity automatically throws when dividing by 0
        // uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold
        return a / b;
    }

    /**
    * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
    */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        assert(b <= a);
        return a - b;
    }

    /**
    * @dev Adds two numbers, throws on overflow.
    */
    function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
        c = a + b;
        assert(c >= a);
        return c;
    }
}
Configuraciones
{
  "compilationTarget": {
    "ERC20.sol": "ERC20"
  },
  "evmVersion": "paris",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "remappings": []
}
ABI
[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"uint256","name":"totalSupply_","type":"uint256"},{"internalType":"string","name":"symbol_","type":"string"}],"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pledgeAddress_","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"_prvPledge","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pledgeAddress_","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"_pubPledge","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"status_","type":"bool"}],"name":"changeStartPrv","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"status_","type":"bool"}],"name":"changeStartPub","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributionPrvToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"distributionPubToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ethBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrvAddressIndices","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrvPledge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPubAddressIndices","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPubPledge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStartPrv","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStartPub","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalPrvAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"prvPledge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"pubPledge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenPrice_","type":"uint256"}],"name":"setPubTokenPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]