Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xaE6e307c3Fe9E922E5674DBD7F830Ed49c014c6B
Balance 0 ETH
Nonce 1
Code Size 3903 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

3903 bytes
0x608060405234801561001057600080fd5b50600436106101375760003560e01c80637ecebe00116100b8578063d33219b41161007c578063d33219b4146102bf578063d505accf146102ea578063dd62ed3e146102fd578063e3ee160e14610328578063e94a01021461033b578063ed24911d1461036957600080fd5b80637ecebe001461025057806395d89b411461013c578063a0cc6a6814610270578063a9059cbb14610297578063c46fa2af146102aa57600080fd5b8063313ce567116100ff578063313ce567146101ea5780633408e4701461020457806340c10f191461020a57806342966c681461021d57806370a082311461023057600080fd5b806306fdde031461013c578063095ea7b31461017657806318160ddd1461019957806323b872dd146101b057806330adf81f146101c3575b600080fd5b61016060405180604001604052806005815260200164435245444960d81b81525081565b60405161016d9190610c86565b60405180910390f35b610189610184366004610cf7565b610371565b604051901515815260200161016d565b6101a260015481565b60405190815260200161016d565b6101896101be366004610d21565b610387565b6101a27f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b6101f2601281565b60405160ff909116815260200161016d565b466101a2565b610189610218366004610cf7565b6103f9565b61018961022b366004610d5d565b610458565b6101a261023e366004610d76565b60026020526000908152604090205481565b6101a261025e366004610d76565b60046020526000908152604090205481565b6101a27f7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a226781565b6101896102a5366004610cf7565b61046c565b6102bd6102b8366004610d76565b610479565b005b6000546102d2906001600160a01b031681565b6040516001600160a01b03909116815260200161016d565b6102bd6102f8366004610da9565b6104d4565b6101a261030b366004610e13565b600360209081526000928352604080842090915290825290205481565b6102bd610336366004610e46565b6105e9565b610189610349366004610cf7565b600560209081526000928352604080842090915290825290205460ff1681565b6101a26107e3565b600061037e338484610889565b50600192915050565b6001600160a01b038316600090815260036020908152604080832033845290915281205460001981146103e3576103be8382610eda565b6001600160a01b03861660009081526003602090815260408083203384529091529020555b6103ee8585856108eb565b506001949350505050565b600080546001600160a01b0316331461044e5760405162461bcd60e51b815260206004820152601260248201527143524544493a4e4f545f54494d454c4f434b60701b60448201526064015b60405180910390fd5b61037e8383610a00565b60006104643383610a92565b506001919050565b600061037e3384846108eb565b6000546001600160a01b031633146104c85760405162461bcd60e51b815260206004820152601260248201527143524544493a4e4f545f54494d454c4f434b60701b6044820152606401610445565b6104d181610b1e565b50565b428410156105195760405162461bcd60e51b815260206004820152601260248201527110d49151124e9055551217d156141254915160721b6044820152606401610445565b6001600160a01b0387811660008181526004602081815260408084205481517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981850152808301879052968d166060880152608087018c905260a0870181905260c08088018c90528251808903909101815260e0909701909152855195820195909520939092529052906105ae906001610ef1565b6001600160a01b0389166000908152600460205260409020556105d48882868686610b66565b6105df888888610889565b5050505050505050565b8542116106385760405162461bcd60e51b815260206004820152601860248201527f43524544493a415554485f4e4f545f5945545f56414c494400000000000000006044820152606401610445565b84421061067c5760405162461bcd60e51b815260206004820152601260248201527110d49151124e9055551217d156141254915160721b6044820152606401610445565b6001600160a01b038916600090815260056020908152604080832087845290915290205460ff16156106f05760405162461bcd60e51b815260206004820152601760248201527f43524544493a415554485f414c52454144595f555345440000000000000000006044820152606401610445565b604080517f7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a22676020808301919091526001600160a01b038c8116838501528b166060830152608082018a905260a0820189905260c0820188905260e08083018890528351808403909101815261010090920190925280519101206107768a82868686610b66565b6001600160a01b038a166000818152600560209081526040808320898452909152808220805460ff19166001179055518792917f98de503528ee59b575ef0c0a2576a82497bfc029a5685b209e9ec333479b10a591a36107d78a8a8a6108eb565b50505050505050505050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7f3c5eac0879bc46be0fe2a2701e57d8e6edcaa427c79074f4513eb9572ff505077fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc646604080516020810195909552840192909252606083015260808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038216301480159061090c57506001600160a01b03821615155b6109585760405162461bcd60e51b815260206004820152601f60248201527f43524544493a52454345495645525f49535f544f4b454e5f4f525f5a45524f006044820152606401610445565b6001600160a01b03831660009081526002602052604090205461097c908290610eda565b6001600160a01b0380851660009081526002602052604080822093909355908416815220546109ac908290610ef1565b6001600160a01b0380841660008181526002602052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906108de9085815260200190565b80600154610a0e9190610ef1565b6001556001600160a01b038216600090815260026020526040902054610a35908290610ef1565b6001600160a01b0383166000818152600260205260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610a869085815260200190565b60405180910390a35050565b6001600160a01b038216600090815260026020526040902054610ab6908290610eda565b6001600160a01b038316600090815260026020526040902055600154610add908290610eda565b6001556040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610a86565b600080546001600160a01b0319166001600160a01b038316908117825560405190917fc046b9e8f0cd9b70a3b838962e9c229277fbb7abee68ea0fad4acf2898ed2ca991a250565b6000610b706107e3565b60405161190160f01b602082015260228101919091526042810186905260620160408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa158015610bfb573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590610c315750866001600160a01b0316816001600160a01b0316145b610c7d5760405162461bcd60e51b815260206004820152601760248201527f43524544493a494e56414c49445f5349474e41545552450000000000000000006044820152606401610445565b50505050505050565b600060208083528351808285015260005b81811015610cb357858101830151858201604001528201610c97565b81811115610cc5576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610cf257600080fd5b919050565b60008060408385031215610d0a57600080fd5b610d1383610cdb565b946020939093013593505050565b600080600060608486031215610d3657600080fd5b610d3f84610cdb565b9250610d4d60208501610cdb565b9150604084013590509250925092565b600060208284031215610d6f57600080fd5b5035919050565b600060208284031215610d8857600080fd5b610d9182610cdb565b9392505050565b803560ff81168114610cf257600080fd5b600080600080600080600060e0888a031215610dc457600080fd5b610dcd88610cdb565b9650610ddb60208901610cdb565b95506040880135945060608801359350610df760808901610d98565b925060a0880135915060c0880135905092959891949750929550565b60008060408385031215610e2657600080fd5b610e2f83610cdb565b9150610e3d60208401610cdb565b90509250929050565b60008060008060008060008060006101208a8c031215610e6557600080fd5b610e6e8a610cdb565b9850610e7c60208b01610cdb565b975060408a0135965060608a0135955060808a0135945060a08a01359350610ea660c08b01610d98565b925060e08a013591506101008a013590509295985092959850929598565b634e487b7160e01b600052601160045260246000fd5b600082821015610eec57610eec610ec4565b500390565b60008219821115610f0457610f04610ec4565b50019056fea2646970667358221220d5c79857ded01c5b06d9ee300348324db417c47309c8fb32bea7b7fdd0b80a2164736f6c634300080a0033

Verified Source Code Partial Match

Compiler: v0.8.10+commit.fc410830 EVM: london Optimization: Yes (200 runs)
IERC20.sol 81 lines
// 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
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * 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);
}
CredefiToken.sol 197 lines
// SPDX-License-Identifier:MIT
pragma solidity 0.8.10;

import "./IERC20.sol";

contract CredefiToken is IERC20 {
    // bytes32 private constant EIP712DOMAIN_HASH =
    // keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
    bytes32 private constant EIP712DOMAIN_HASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f;

    // bytes32 private constant NAME_HASH = keccak256("Credi")
    bytes32 private constant NAME_HASH = 0x3c5eac0879bc46be0fe2a2701e57d8e6edcaa427c79074f4513eb9572ff50507;

    // bytes32 private constant VERSION_HASH = keccak256("1")
    bytes32 private constant VERSION_HASH = 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6;

    // bytes32 public constant PERMIT_TYPEHASH =
    // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;

    // bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH =
    // keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)");
    bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH =
        0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;

    string public constant name = "CREDI";
    string public constant symbol = "CREDI";
    uint8 public constant decimals = 18;

    address public timelock;
    uint256 public override totalSupply;

    mapping(address => uint256) public override balanceOf;
    mapping(address => mapping(address => uint256)) public override allowance;

    // ERC-2612, ERC-3009 state
    mapping(address => uint256) public nonces;
    mapping(address => mapping(bytes32 => bool)) public authorizationState;

    event AuthorizationUsed(address indexed authorizer, bytes32 indexed nonce);
    event TimelockUpdated(address indexed timelock);

    modifier onlyTimelock() {
        require(msg.sender == address(timelock), "CREDI:NOT_TIMELOCK");
        _;
    }

    constructor(address _timelock) {
        _changeTimelock(_timelock);
    }

    function changeTimelock(address _timelock) external onlyTimelock {
        _changeTimelock(_timelock);
    }

    function mint(address to, uint256 value) external onlyTimelock returns (bool) {
        _mint(to, value);
        return true;
    }

    function burn(uint256 value) external returns (bool) {
        _burn(msg.sender, value);
        return true;
    }

    function approve(address spender, uint256 value) external override returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transfer(address to, uint256 value) external override returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external override returns (bool) {
        uint256 fromAllowance = allowance[from][msg.sender];
        if (fromAllowance != type(uint256).max) {
            // Allowance is implicitly checked with Solidity's underflow protection
            allowance[from][msg.sender] = fromAllowance - value;
        }
        _transfer(from, to, value);
        return true;
    }

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external {
        require(deadline >= block.timestamp, "CREDI:AUTH_EXPIRED");

        bytes32 encodeData = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner], deadline));
        nonces[owner] = nonces[owner] + 1;
        _validateSignedData(owner, encodeData, v, r, s);

        _approve(owner, spender, value);
    }

    function transferWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external {
        require(block.timestamp > validAfter, "CREDI:AUTH_NOT_YET_VALID");
        require(block.timestamp < validBefore, "CREDI:AUTH_EXPIRED");
        require(!authorizationState[from][nonce], "CREDI:AUTH_ALREADY_USED");

        bytes32 encodeData = keccak256(
            abi.encode(TRANSFER_WITH_AUTHORIZATION_TYPEHASH, from, to, value, validAfter, validBefore, nonce)
        );
        _validateSignedData(from, encodeData, v, r, s);

        authorizationState[from][nonce] = true;
        emit AuthorizationUsed(from, nonce);

        _transfer(from, to, value);
    }

    function getChainId() public view returns (uint256 chainId) {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            chainId := chainid()
        }
    }

    function getDomainSeparator() public view returns (bytes32) {
        return keccak256(abi.encode(EIP712DOMAIN_HASH, NAME_HASH, VERSION_HASH, getChainId(), address(this)));
    }

    function _changeTimelock(address _timelock) internal {
        timelock = _timelock;
        emit TimelockUpdated(_timelock);
    }

    function _validateSignedData(
        address signer,
        bytes32 encodeData,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal view {
        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", getDomainSeparator(), encodeData));
        address recoveredAddress = ecrecover(digest, v, r, s);
        // Explicitly disallow authorizations for address(0) as ecrecover returns address(0) on malformed messages
        require(recoveredAddress != address(0) && recoveredAddress == signer, "CREDI:INVALID_SIGNATURE");
    }

    function _mint(address to, uint256 value) internal {
        totalSupply = totalSupply + value;
        balanceOf[to] = balanceOf[to] + value;
        emit Transfer(address(0), to, value);
    }

    function _burn(address from, uint256 value) internal {
        // Balance is implicitly checked with Solidity's underflow protection
        balanceOf[from] = balanceOf[from] - value;
        totalSupply = totalSupply - value;
        emit Transfer(from, address(0), value);
    }

    function _approve(
        address owner,
        address spender,
        uint256 value
    ) private {
        allowance[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _transfer(
        address from,
        address to,
        uint256 value
    ) private {
        require(to != address(this) && to != address(0), "CREDI:RECEIVER_IS_TOKEN_OR_ZERO");

        // Balance is implicitly checked with Solidity's underflow protection
        balanceOf[from] = balanceOf[from] - value;
        balanceOf[to] = balanceOf[to] + value;
        emit Transfer(from, to, value);
    }
}

Read Contract

PERMIT_TYPEHASH 0x30adf81f → bytes32
TRANSFER_WITH_AUTHORIZATION_TYPEHASH 0xa0cc6a68 → bytes32
allowance 0xdd62ed3e → uint256
authorizationState 0xe94a0102 → bool
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
getChainId 0x3408e470 → uint256
getDomainSeparator 0xed24911d → bytes32
name 0x06fdde03 → string
nonces 0x7ecebe00 → uint256
symbol 0x95d89b41 → string
timelock 0xd33219b4 → address
totalSupply 0x18160ddd → uint256

Write Contract 8 functions

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

approve 0x095ea7b3
address spender
uint256 value
returns: bool
burn 0x42966c68
uint256 value
returns: bool
changeTimelock 0xc46fa2af
address _timelock
mint 0x40c10f19
address to
uint256 value
returns: bool
permit 0xd505accf
address owner
address spender
uint256 value
uint256 deadline
uint8 v
bytes32 r
bytes32 s
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
transferWithAuthorization 0xe3ee160e
address from
address to
uint256 value
uint256 validAfter
uint256 validBefore
bytes32 nonce
uint8 v
bytes32 r
bytes32 s

Recent Transactions

No transactions found for this address