Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0x48827c79872A6Ffd439C96818AFbC8a317B2F717
Balance 0 ETH
Nonce 1
Code Size 8583 bytes
Indexed Transactions 0 (1 on-chain, 0.9% indexed)
External Etherscan · Sourcify

Contract Bytecode

8583 bytes
0x60806040526004361061012e5760003560e01c80638da5cb5b116100ab578063a7bb58031161006f578063a7bb5803146103cf578063cb1468791461040e578063d0d41fe114610437578063e35c72a814610460578063f2fde38b1461049d578063fa540801146104c657610135565b80638da5cb5b146102c25780639723fb6d146102ed57806397aba7f91461032a5780639cb2c63e146103675780639d76ea58146103a457610135565b8063527913b1116100f2578063527913b11461021057806358979bfe1461023b578063626be56714610264578063648ece851461028f578063715018a6146102ab57610135565b8063022914a71461013a5780632f48ab7d146101785780633ad10ef6146101a35780633ccfd60b146101ce5780633e413bee146101e557610135565b3661013557005b600080fd5b34801561014657600080fd5b50610161600480360381019061015c9190611359565b610503565b60405161016f92919061139f565b60405180910390f35b34801561018457600080fd5b5061018d610527565b60405161019a91906113d7565b60405180910390f35b3480156101af57600080fd5b506101b861054d565b6040516101c591906113d7565b60405180910390f35b3480156101da57600080fd5b506101e3610573565b005b3480156101f157600080fd5b506101fa61063e565b60405161020791906113d7565b60405180910390f35b34801561021c57600080fd5b50610225610664565b60405161023291906113f2565b60405180910390f35b34801561024757600080fd5b50610262600480360381019061025d9190611359565b61066a565b005b34801561027057600080fd5b5061027961072a565b60405161028691906113f2565b60405180910390f35b6102a960048036038101906102a4919061149e565b610730565b005b3480156102b757600080fd5b506102c06109e0565b005b3480156102ce57600080fd5b506102d7610a68565b6040516102e491906113d7565b60405180910390f35b3480156102f957600080fd5b50610314600480360381019061030f9190611574565b610a91565b60405161032191906115bc565b60405180910390f35b34801561033657600080fd5b50610351600480360381019061034c919061174e565b610ab1565b60405161035e91906113d7565b60405180910390f35b34801561037357600080fd5b5061038e600480360381019061038991906117aa565b610b20565b60405161039b9190611846565b60405180910390f35b3480156103b057600080fd5b506103b9610b5f565b6040516103c691906113d7565b60405180910390f35b3480156103db57600080fd5b506103f660048036038101906103f19190611861565b610b85565b604051610405939291906118c6565b60405180910390f35b34801561041a57600080fd5b5061043560048036038101906104309190611359565b610bed565b005b34801561044357600080fd5b5061045e60048036038101906104599190611359565b610cad565b005b34801561046c57600080fd5b50610487600480360381019061048291906118fd565b610d6d565b60405161049491906115bc565b60405180910390f35b3480156104a957600080fd5b506104c460048036038101906104bf9190611359565b610dd5565b005b3480156104d257600080fd5b506104ed60048036038101906104e891906119cf565b610ecc565b6040516104fa9190611846565b60405180910390f35b60066020528060005260406000206000915090508060000154908060010154905082565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61057b610efc565b73ffffffffffffffffffffffffffffffffffffffff16610599610a68565b73ffffffffffffffffffffffffffffffffffffffff16146105ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105e690611a59565b60405180910390fd5b60004711610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062990611ac5565b60405180910390fd5b61063c3347610f04565b565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60085481565b610672610efc565b73ffffffffffffffffffffffffffffffffffffffff16610690610a68565b73ffffffffffffffffffffffffffffffffffffffff16146106e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106dd90611a59565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60075481565b61078b61073b610a68565b33888b8b8a8a89898080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610d6d565b80156107bb5750600015156005600086815260200190815260200160002060009054906101000a900460ff161515145b6107fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f190611b31565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146108345782610836565b335b925086600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600082825461088a9190611b80565b9250508190555084600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282546108e39190611b80565b9250508190555084600760008282546108fc9190611b80565b9250508190555086600860008282546109159190611b80565b9250508190555061092888878786611004565b60016005600086815260200190815260200160002060006101000a81548160ff0219169083151502179055508873ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f746b684d2e8096d01e8e457c9ac5f3365f1940bfe560e06d71b163ee8da5aeb98a8960006040516109cd93929190611c1b565b60405180910390a4505050505050505050565b6109e8610efc565b73ffffffffffffffffffffffffffffffffffffffff16610a06610a68565b73ffffffffffffffffffffffffffffffffffffffff1614610a5c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5390611a59565b60405180910390fd5b610a66600061106d565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60056020528060005260406000206000915054906101000a900460ff1681565b600080600080610ac085610b85565b92509250925060018682858560405160008152602001604052604051610ae99493929190611c52565b6020604051602081039080840390855afa158015610b0b573d6000803e3d6000fd5b50505060206040510351935050505092915050565b6000868686868686604051602001610b3d96959493929190611d00565b6040516020818303038152906040528051906020012090509695505050505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060006041845114610bce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc590611dbc565b60405180910390fd5b6020840151925060408401519150606084015160001a90509193909250565b610bf5610efc565b73ffffffffffffffffffffffffffffffffffffffff16610c13610a68565b73ffffffffffffffffffffffffffffffffffffffff1614610c69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6090611a59565b60405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610cb5610efc565b73ffffffffffffffffffffffffffffffffffffffff16610cd3610a68565b73ffffffffffffffffffffffffffffffffffffffff1614610d29576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2090611a59565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080610d7e898989898989610b20565b90506000610d8b82610ecc565b90508a73ffffffffffffffffffffffffffffffffffffffff16610dae8286610ab1565b73ffffffffffffffffffffffffffffffffffffffff16149250505098975050505050505050565b610ddd610efc565b73ffffffffffffffffffffffffffffffffffffffff16610dfb610a68565b73ffffffffffffffffffffffffffffffffffffffff1614610e51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4890611a59565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610ec0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb790611e4e565b60405180910390fd5b610ec98161106d565b50565b600081604051602001610edf9190611ee6565b604051602081830303815290604052805190602001209050919050565b600033905090565b60008273ffffffffffffffffffffffffffffffffffffffff1682600067ffffffffffffffff811115610f3957610f38611623565b5b6040519080825280601f01601f191660200182016040528015610f6b5781602001600182028036833780820191505090505b50604051610f799190611f86565b60006040518083038185875af1925050503d8060008114610fb6576040519150601f19603f3d011682016040523d82523d6000602084013e610fbb565b606091505b5050905080610fff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff69061200f565b60405180910390fd5b505050565b611032848433600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611131565b611067600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611060610a68565b83856111ae565b50505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60018303611148576111438185610f04565b6111a8565b6111a76002841461117b57600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661119f565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff165b8383876111ae565b5b50505050565b6000808573ffffffffffffffffffffffffffffffffffffffff166323b872dd8686866040516024016111e29392919061202f565b6040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516112309190611f86565b6000604051808303816000865af19150503d806000811461126d576040519150601f19603f3d011682016040523d82523d6000602084013e611272565b606091505b50915091508180156112a0575060008151148061129f57508080602001905181019061129e9190612092565b5b5b6112df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d690612131565b60405180910390fd5b505050505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611326826112fb565b9050919050565b6113368161131b565b811461134157600080fd5b50565b6000813590506113538161132d565b92915050565b60006020828403121561136f5761136e6112f1565b5b600061137d84828501611344565b91505092915050565b6000819050919050565b61139981611386565b82525050565b60006040820190506113b46000830185611390565b6113c16020830184611390565b9392505050565b6113d18161131b565b82525050565b60006020820190506113ec60008301846113c8565b92915050565b60006020820190506114076000830184611390565b92915050565b61141681611386565b811461142157600080fd5b50565b6000813590506114338161140d565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261145e5761145d611439565b5b8235905067ffffffffffffffff81111561147b5761147a61143e565b5b60208301915083600182028301111561149757611496611443565b5b9250929050565b60008060008060008060008060006101008a8c0312156114c1576114c06112f1565b5b60006114cf8c828d01611344565b99505060206114e08c828d01611424565b98505060406114f18c828d01611424565b97505060606115028c828d01611424565b96505060806115138c828d01611424565b95505060a06115248c828d01611424565b94505060c06115358c828d01611344565b93505060e08a013567ffffffffffffffff811115611556576115556112f6565b5b6115628c828d01611448565b92509250509295985092959850929598565b60006020828403121561158a576115896112f1565b5b600061159884828501611424565b91505092915050565b60008115159050919050565b6115b6816115a1565b82525050565b60006020820190506115d160008301846115ad565b92915050565b6000819050919050565b6115ea816115d7565b81146115f557600080fd5b50565b600081359050611607816115e1565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61165b82611612565b810181811067ffffffffffffffff8211171561167a57611679611623565b5b80604052505050565b600061168d6112e7565b90506116998282611652565b919050565b600067ffffffffffffffff8211156116b9576116b8611623565b5b6116c282611612565b9050602081019050919050565b82818337600083830152505050565b60006116f16116ec8461169e565b611683565b90508281526020810184848401111561170d5761170c61160d565b5b6117188482856116cf565b509392505050565b600082601f83011261173557611734611439565b5b81356117458482602086016116de565b91505092915050565b60008060408385031215611765576117646112f1565b5b6000611773858286016115f8565b925050602083013567ffffffffffffffff811115611794576117936112f6565b5b6117a085828601611720565b9150509250929050565b60008060008060008060c087890312156117c7576117c66112f1565b5b60006117d589828a01611344565b96505060206117e689828a01611424565b95505060406117f789828a01611424565b945050606061180889828a01611424565b935050608061181989828a01611424565b92505060a061182a89828a01611424565b9150509295509295509295565b611840816115d7565b82525050565b600060208201905061185b6000830184611837565b92915050565b600060208284031215611877576118766112f1565b5b600082013567ffffffffffffffff811115611895576118946112f6565b5b6118a184828501611720565b91505092915050565b600060ff82169050919050565b6118c0816118aa565b82525050565b60006060820190506118db6000830186611837565b6118e86020830185611837565b6118f560408301846118b7565b949350505050565b600080600080600080600080610100898b03121561191e5761191d6112f1565b5b600061192c8b828c01611344565b985050602061193d8b828c01611344565b975050604061194e8b828c01611424565b965050606061195f8b828c01611424565b95505060806119708b828c01611424565b94505060a06119818b828c01611424565b93505060c06119928b828c01611424565b92505060e089013567ffffffffffffffff8111156119b3576119b26112f6565b5b6119bf8b828c01611720565b9150509295985092959890939650565b6000602082840312156119e5576119e46112f1565b5b60006119f3848285016115f8565b91505092915050565b600082825260208201905092915050565b7f596f7520617265206e6f7420746865206f776e65720000000000000000000000600082015250565b6000611a436015836119fc565b9150611a4e82611a0d565b602082019050919050565b60006020820190508181036000830152611a7281611a36565b9050919050565b7f496e76616c696420616d6f756e74000000000000000000000000000000000000600082015250565b6000611aaf600e836119fc565b9150611aba82611a79565b602082019050919050565b60006020820190508181036000830152611ade81611aa2565b9050919050565b7f496e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b6000611b1b6011836119fc565b9150611b2682611ae5565b602082019050919050565b60006020820190508181036000830152611b4a81611b0e565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611b8b82611386565b9150611b9683611386565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611bcb57611bca611b51565b5b828201905092915050565b6000819050919050565b6000819050919050565b6000611c05611c00611bfb84611bd6565b611be0565b611386565b9050919050565b611c1581611bea565b82525050565b6000606082019050611c306000830186611390565b611c3d6020830185611390565b611c4a6040830184611c0c565b949350505050565b6000608082019050611c676000830187611837565b611c7460208301866118b7565b611c816040830185611837565b611c8e6060830184611837565b95945050505050565b60008160601b9050919050565b6000611caf82611c97565b9050919050565b6000611cc182611ca4565b9050919050565b611cd9611cd48261131b565b611cb6565b82525050565b6000819050919050565b611cfa611cf582611386565b611cdf565b82525050565b6000611d0c8289611cc8565b601482019150611d1c8288611ce9565b602082019150611d2c8287611ce9565b602082019150611d3c8286611ce9565b602082019150611d4c8285611ce9565b602082019150611d5c8284611ce9565b602082019150819050979650505050505050565b7f696e76616c6964207369676e6174757265206c656e6774680000000000000000600082015250565b6000611da66018836119fc565b9150611db182611d70565b602082019050919050565b60006020820190508181036000830152611dd581611d99565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000611e386026836119fc565b9150611e4382611ddc565b604082019050919050565b60006020820190508181036000830152611e6781611e2b565b9050919050565b600081905092915050565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b6000611eaf601c83611e6e565b9150611eba82611e79565b601c82019050919050565b6000819050919050565b611ee0611edb826115d7565b611ec5565b82525050565b6000611ef182611ea2565b9150611efd8284611ecf565b60208201915081905092915050565b600081519050919050565b600081905092915050565b60005b83811015611f40578082015181840152602081019050611f25565b83811115611f4f576000848401525b50505050565b6000611f6082611f0c565b611f6a8185611f17565b9350611f7a818560208601611f22565b80840191505092915050565b6000611f928284611f55565b915081905092915050565b7f5472616e7366657248656c7065723a204554485f5452414e534645525f46414960008201527f4c45440000000000000000000000000000000000000000000000000000000000602082015250565b6000611ff96023836119fc565b915061200482611f9d565b604082019050919050565b6000602082019050818103600083015261202881611fec565b9050919050565b600060608201905061204460008301866113c8565b61205160208301856113c8565b61205e6040830184611390565b949350505050565b61206f816115a1565b811461207a57600080fd5b50565b60008151905061208c81612066565b92915050565b6000602082840312156120a8576120a76112f1565b5b60006120b68482850161207d565b91505092915050565b7f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f464160008201527f494c454400000000000000000000000000000000000000000000000000000000602082015250565b600061211b6024836119fc565b9150612126826120bf565b604082019050919050565b6000602082019050818103600083015261214a8161210e565b905091905056fea2646970667358221220112ea6b26fb7d2acdfbe1d3dc092f0b4e2cd01a814fcf070703b5a402c56ca4f64736f6c634300080d0033

Verified Source Code Partial Match

Compiler: v0.8.13+commit.abaa5c0e EVM: london Optimization: No
FlexafinaIdo.sol 363 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.13;

// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

interface IBEP20 {
    /**
     * @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 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;
    }
}

// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(
        address indexed previousOwner,
        address indexed newOwner
    );

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "You are not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(
            newOwner != address(0),
            "Ownable: new owner is the zero address"
        );
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

contract VerifySignature {
    function getMessageHash(
        address _to,
        uint256 _payment,
        uint256 _amount,
        uint256 _usdAmount,
        uint256 _amountOut,
        uint256 _nonce
    ) public pure returns (bytes32) {
        return
            keccak256(
                abi.encodePacked(
                    _to,
                    _payment,
                    _amount,
                    _usdAmount,
                    _amountOut,
                    _nonce
                )
            );
    }

    function getEthSignedMessageHash(
        bytes32 _messageHash
    ) public pure returns (bytes32) {
        /*
        Signature is produced by signing a keccak256 hash with the following format:
        "\x19Ethereum Signed Message\n" + len(msg) + msg
        */
        return
            keccak256(
                abi.encodePacked(
                    "\x19Ethereum Signed Message:\n32",
                    _messageHash
                )
            );
    }

    function verify(
        address _signer,
        address _to,
        uint256 _payment,
        uint256 _amount,
        uint256 _usdAmount,
        uint256 _amountOut,
        uint256 _nonce,
        bytes memory signature
    ) public pure returns (bool) {
        bytes32 messageHash = getMessageHash(
            _to,
            _payment,
            _amount,
            _usdAmount,
            _amountOut,
            _nonce
        );
        bytes32 ethSignedMessageHash = getEthSignedMessageHash(messageHash);

        return recoverSigner(ethSignedMessageHash, signature) == _signer;
    }

    function recoverSigner(
        bytes32 _ethSignedMessageHash,
        bytes memory _signature
    ) public pure returns (address) {
        (bytes32 r, bytes32 s, uint8 v) = splitSignature(_signature);

        return ecrecover(_ethSignedMessageHash, v, r, s);
    }

    function splitSignature(
        bytes memory sig
    ) public pure returns (bytes32 r, bytes32 s, uint8 v) {
        require(sig.length == 65, "invalid signature length");

        assembly {
            /*
            First 32 bytes stores the length of the signature

            add(sig, 32) = pointer of sig + 32
            effectively, skips first 32 bytes of signature

            mload(p) loads next 32 bytes starting at the memory address p into memory
            */

            // first 32 bytes, after the length prefix
            r := mload(add(sig, 32))
            // second 32 bytes
            s := mload(add(sig, 64))
            // final byte (first byte of the next 32 bytes)
            v := byte(0, mload(add(sig, 96)))
        }

        // implicitly return (r, s, v)
    }
}

library TransferHelper {
    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, "TransferHelper: ETH_TRANSFER_FAILED");
    }

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0x23b872dd, from, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "TransferHelper: TRANSFER_FROM_FAILED"
        );
    }
}

contract FlexafinaIdo is Ownable, VerifySignature {
    receive() external payable {}

    event Buy(
        address indexed sender,
        address indexed recipient,
        uint256 amount,
        uint256 tokenAmount,
        uint256 refTokenAmount,
        address indexed ref
    );

    address public devAddress = 0x94CA966dC93e1b1b57f9a9325d74565D54B5a362;

    address public usdt = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
    address public usdc = address(0);

    address public tokenAddress = 0xc67cBf584532f39fe8dAb727854387623C59B3A8;

    mapping(uint256 => bool) public usedNonce;

    struct Owner {
        uint256 tokenAmount;
        uint256 usdAmount;
    }

    mapping(address => Owner) public owners;

    uint256 public totalToken;
    uint256 public totalUsd;

    constructor() {}

    function withdraw() public onlyOwner {
        require(address(this).balance > 0, "Invalid amount");
        TransferHelper.safeTransferETH(msg.sender, address(this).balance);
    }

    function setDevAddress(address _devAddress) public onlyOwner {
        devAddress = _devAddress;
    }

    function setUsdt(address _usdt) public onlyOwner {
        usdt = _usdt;
    }

    function setUsdc(address _usdc) public onlyOwner {
        usdc = _usdc;
    }

    function safeTransfer(
        uint256 _amount,
        uint256 _payment,
        address _sender,
        address _receiver
    ) internal {
        if (_payment == 1) {
            TransferHelper.safeTransferETH(_receiver, _amount);
        } else {
            TransferHelper.safeTransferFrom(
                _payment == 2 ? usdt : usdc,
                _sender,
                _receiver,
                _amount
            );
        }
    }

    function transfer(
        // address _ref,
        uint256 _amount,
        uint256 _payment
        , uint256 _amountOut,
        address _recipient
    ) internal {
        // tranfer token usdt vs eth to wallet
        safeTransfer(_amount, _payment, msg.sender, devAddress);

        // // transfer token to _recipient
        TransferHelper.safeTransferFrom(
            tokenAddress,
            owner(),
            _recipient,
            _amountOut
        );
    }

    function buyFlexa(
        address _ref,
        uint256 _amount,
        uint256 _usdAmount,
        uint256 _payment,
        uint256 _amountOut,
        uint256 _nonce,
        address _recipient,
        bytes calldata _signature
    ) public payable {
        require(
            verify(
                owner(),
                msg.sender,
                _payment,
                _amount,
                _usdAmount,
                _amountOut,
                _nonce,
                _signature
            ) && usedNonce[_nonce] == false,
            "Invalid signature"
        );

        _recipient = _recipient == address(0) ? msg.sender : _recipient;

        owners[_recipient].usdAmount += _usdAmount;
        owners[_recipient].tokenAmount += _amountOut;

        totalToken += _amountOut;
        totalUsd += _usdAmount;

        transfer(_amount, _payment,_amountOut,_recipient);
        usedNonce[_nonce] = true; 

        emit Buy(msg.sender, _recipient, _usdAmount, _amountOut, 0, _ref);
    }
}

Read Contract

devAddress 0x3ad10ef6 → address
getEthSignedMessageHash 0xfa540801 → bytes32
getMessageHash 0x9cb2c63e → bytes32
owner 0x8da5cb5b → address
owners 0x022914a7 → uint256, uint256
recoverSigner 0x97aba7f9 → address
splitSignature 0xa7bb5803 → bytes32, bytes32, uint8
tokenAddress 0x9d76ea58 → address
totalToken 0x626be567 → uint256
totalUsd 0x527913b1 → uint256
usdc 0x3e413bee → address
usdt 0x2f48ab7d → address
usedNonce 0x9723fb6d → bool
verify 0xe35c72a8 → bool

Write Contract 7 functions

These functions modify contract state and require a wallet transaction to execute.

buyFlexa 0x648ece85
address _ref
uint256 _amount
uint256 _usdAmount
uint256 _payment
uint256 _amountOut
uint256 _nonce
address _recipient
bytes _signature
renounceOwnership 0x715018a6
No parameters
setDevAddress 0xd0d41fe1
address _devAddress
setUsdc 0xcb146879
address _usdc
setUsdt 0x58979bfe
address _usdt
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters

Recent Transactions

This address has 1 on-chain transactions, but only 0.9% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →