Contract Address Details

0x54EC26791c7f431369f6da4b68a76cFae726dde2

Contract Name
ELISTPurchase
Creator
0x202172–8bc512 at 0x83cec8–520f40
Balance
0 EWT ( )
Tokens
Fetching tokens...
Transactions
35 Transactions
Transfers
36 Transfers
Gas Used
1,746,439
Last Balance Update
33675257
Contract name:
ELISTPurchase




Optimization enabled
false
Compiler version
v0.6.12+commit.27d51765




EVM Version
default




Verified at
2022-04-09T17:37:07.705335Z

Constructor Arguments

000000000000000000000000202172c39e74ad79a55cff807fc0652dcc8bc5120000000000000000000000007c6ddcc3dd33290feb0c32023fa3e3cd0bbdd36f

Arg [0] (address) : 0x202172c39e74ad79a55cff807fc0652dcc8bc512
Arg [1] (address) : 0x7c6ddcc3dd33290feb0c32023fa3e3cd0bbdd36f

              

Contract source code

// File: contracts/ELISTPurchase.sol

pragma solidity 0.6.12;

interface ERC20 {
    function totalSupply() external view returns (uint256);

    function balanceOf(address account) external view returns (uint256);

    function transfer(address recipient, uint256 amount)
        external
        returns (bool);

    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    function approve(address spender, uint256 amount) external returns (bool);

    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
}

contract ELISTPurchase {
    ERC20 public token;

    uint256 public total_sold;

    uint256 public rate;

    bool public state;

    address payable public governance;

    event Purchase(address indexed user, uint256 amount);
    event StateChange(address indexed user, bool state);

    constructor(address payable _governance, ERC20 _token) public {
        governance = _governance;
        token = _token;
        total_sold = 0;
        rate = 17; 
        state = true;
    }

    receive() external payable {
        purchase();
    }

    function purchase() public payable {
        require(state == true, "Service is not Available");

        uint256 weiAmount = msg.value;

        require(token.balanceOf(address(this)) > 0, "There are no more ELIST");

        uint256 tokens = 0;

        tokens = weiAmount * rate;
        require(
            token.balanceOf(address(this)) - tokens >= 0,
            "There are no more ELIST"
        );

        governance.transfer(weiAmount);
        require(token.transfer(msg.sender, tokens), "ELIST Transfer not successful");

        emit Purchase(msg.sender, weiAmount);
    }

    function changeState() public {
        require(msg.sender == governance, "Not Allowed");
        state = !state;

        emit StateChange(msg.sender, state);
    }

    function withdrawUnsoldTokens(uint256 _tokens)
        public
        returns (bool success)
    {
        require(msg.sender == governance, "!governance");

        require(token.transfer(governance, _tokens), "Transfer not successful");

        return true;
    }
}
        

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_governance","internalType":"address payable"},{"type":"address","name":"_token","internalType":"contract ERC20"}]},{"type":"event","name":"Purchase","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"StateChange","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"bool","name":"state","internalType":"bool","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"changeState","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address payable"}],"name":"governance","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[],"name":"purchase","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rate","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"state","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ERC20"}],"name":"token","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"total_sold","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"success","internalType":"bool"}],"name":"withdrawUnsoldTokens","inputs":[{"type":"uint256","name":"_tokens","internalType":"uint256"}]},{"type":"receive","stateMutability":"payable"}]
            

Deployed ByteCode

0x60806040526004361061007f5760003560e01c80638412e6671161004e5780638412e6671461015a578063c19d93fb14610171578063f42334381461019e578063fc0c546a146101c95761008e565b80632c4e722e1461009357806345f085a6146100be5780635aa6e6751461010f57806364edfbf0146101505761008e565b3661008e5761008c61020a565b005b600080fd5b34801561009f57600080fd5b506100a861070c565b6040518082815260200191505060405180910390f35b3480156100ca57600080fd5b506100f7600480360360208110156100e157600080fd5b8101908080359060200190929190505050610712565b60405180821515815260200191505060405180910390f35b34801561011b57600080fd5b50610124610940565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61015861020a565b005b34801561016657600080fd5b5061016f610966565b005b34801561017d57600080fd5b50610186610ab4565b60405180821515815260200191505060405180910390f35b3480156101aa57600080fd5b506101b3610ac7565b6040518082815260200191505060405180910390f35b3480156101d557600080fd5b506101de610acd565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60011515600360009054906101000a900460ff16151514610293576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f53657276696365206973206e6f7420417661696c61626c65000000000000000081525060200191505060405180910390fd5b600034905060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561032257600080fd5b505afa158015610336573d6000803e3d6000fd5b505050506040513d602081101561034c57600080fd5b8101908080519060200190929190505050116103d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f546865726520617265206e6f206d6f726520454c49535400000000000000000081525060200191505060405180910390fd5b60006002548202905060008160008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561046357600080fd5b505afa158015610477573d6000803e3d6000fd5b505050506040513d602081101561048d57600080fd5b8101908080519060200190929190505050031015610513576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f546865726520617265206e6f206d6f726520454c49535400000000000000000081525060200191505060405180910390fd5b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f1935050505015801561057b573d6000803e3d6000fd5b5060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561060d57600080fd5b505af1158015610621573d6000803e3d6000fd5b505050506040513d602081101561063757600080fd5b81019080805190602001909291905050506106ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f454c495354205472616e73666572206e6f74207375636365737366756c00000081525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167f2499a5330ab0979cc612135e7883ebc3cd5c9f7a8508f042540c34723348f632836040518082815260200191505060405180910390a25050565b60025481565b6000600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561088a57600080fd5b505af115801561089e573d6000803e3d6000fd5b505050506040513d60208110156108b457600080fd5b8101908080519060200190929190505050610937576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f5472616e73666572206e6f74207375636365737366756c00000000000000000081525060200191505060405180910390fd5b60019050919050565b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a29576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f7420416c6c6f77656400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600360009054906101000a900460ff1615600360006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167f8ca0b4452613fa6cd3575207b354b2500821c6f2f21ea2462df873480fb3c2e3600360009054906101000a900460ff1660405180821515815260200191505060405180910390a2565b600360009054906101000a900460ff1681565b60015481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea264697066735822122015fd1389a9c05c3e114a8c27fe63a5149fca6aefdf89e24be3ba3c6896e5817464736f6c634300060c0033