Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x54D9Db1c37956e35666dDa36BF46B79E490CFC39
Balance 0 ETH
Nonce 1
Code Size 5141 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

5141 bytes
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063adfc500b11610097578063d4cc2dd311610066578063d4cc2dd31461023c578063f2fde38b1461024f578063f73fae7114610262578063fe7b00071461028957600080fd5b8063adfc500b146101d6578063b81b8630146101e9578063c884ef8314610209578063cffc8e641461022957600080fd5b806350e23d00116100d357806350e23d0014610151578063715018a61461019d5780638da5cb5b146101a55780639076c166146101c357600080fd5b8063078fa339146100fa5780631ff64acd146101345780634e71d92d14610149575b600080fd5b6101217f00000000000000000000000000000000000000000000000000000000683b941481565b6040519081526020015b60405180910390f35b6101476101423660046111aa565b61029c565b005b6101476104b0565b6101787f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f81565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161012b565b610147610672565b60005473ffffffffffffffffffffffffffffffffffffffff16610178565b6101476101d1366004611273565b610686565b6101476101e4366004611273565b61075a565b6101216101f736600461129d565b60016020526000908152604090205481565b61012161021736600461129d565b60026020526000908152604090205481565b610147610237366004611273565b610821565b61014761024a36600461129d565b610967565b61014761025d36600461129d565b610a56565b6101217f00000000000000000000000000000000000000000000000000000000683b941e81565b61012161029736600461129d565b610aba565b6102a4610cd7565b8051825114610360576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604160248201527f54656d706c655465616d5061796d656e74733a2061646472657373657320616e60448201527f6420616d6f756e7473206d757374206265207468652073616d65206c656e677460648201527f6800000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000805b83518110156104aa578173ffffffffffffffffffffffffffffffffffffffff16848281518110610396576103966112b8565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1603610441576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f54656d706c655465616d5061796d656e74733a20416464726573732063616e6e60448201527f6f742062652030783000000000000000000000000000000000000000000000006064820152608401610357565b828181518110610453576104536112b8565b602002602001015160016000868481518110610471576104716112b8565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff16825281019190915260400160002055600101610364565b50505050565b3360008181526001602052604090205461054b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f54656d706c655465616d5061796d656e74733a204d656d626572206e6f74206660448201527f6f756e64000000000000000000000000000000000000000000000000000000006064820152608401610357565b600061055633610aba565b9050600081116105e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54656d706c655465616d5061796d656e74733a204d656d62657220686173206e60448201527f6f2054454d504c4520746f20636c61696d0000000000000000000000000000006064820152608401610357565b3360009081526002602052604081208054839290610607908490611316565b9091555061063890507f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f3383610d2a565b60405181815233907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a906020015b60405180910390a25050565b61067a610cd7565b6106846000610dbc565b565b61068e610cd7565b73ffffffffffffffffffffffffffffffffffffffff8216610731576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f54656d706c655465616d5061796d656e74733a20416464726573732063616e6e60448201527f6f742062652030783000000000000000000000000000000000000000000000006064820152608401610357565b73ffffffffffffffffffffffffffffffffffffffff909116600090815260016020526040902055565b610762610cd7565b600081116107f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54656d706c655465616d5061796d656e74733a20416d6f756e74206d7573742060448201527f62652067726561746572207468616e20300000000000000000000000000000006064820152608401610357565b61081d7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f8383610d2a565b5050565b610829610cd7565b600081116108b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54656d706c655465616d5061796d656e74733a20416d6f756e74206d7573742060448201527f62652067726561746572207468616e20300000000000000000000000000000006064820152608401610357565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040812080548392906108ee908490611316565b9091555061091f90507f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f8383610d2a565b8173ffffffffffffffffffffffffffffffffffffffff167fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a8260405161066691815260200190565b61096f610cd7565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600160205260409020548190610a22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f54656d706c655465616d5061796d656e74733a204d656d626572206e6f74206660448201527f6f756e64000000000000000000000000000000000000000000000000000000006064820152608401610357565b5073ffffffffffffffffffffffffffffffffffffffff16600090815260026020908152604080832054600190925290912055565b610a5e610cd7565b73ffffffffffffffffffffffffffffffffffffffff8116610aae576040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260006004820152602401610357565b610ab781610dbc565b50565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600160205260408120548290610b6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f54656d706c655465616d5061796d656e74733a204d656d626572206e6f74206660448201527f6f756e64000000000000000000000000000000000000000000000000000000006064820152608401610357565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040812054610bdd7f00000000000000000000000000000000000000000000000000000000683b94147f00000000000000000000000000000000000000000000000000000000683b941e611329565b610c077f00000000000000000000000000000000000000000000000000000000683b941442611329565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260016020526040902054610c37919061133c565b610c419190611353565b610c4b9190611329565b73ffffffffffffffffffffffffffffffffffffffff851660009081526001602090815260408083205460029092529091205491925090610c8b9083611316565b1115610cd05773ffffffffffffffffffffffffffffffffffffffff8416600090815260026020908152604080832054600190925290912054610ccd9190611329565b90505b9392505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610684576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610357565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610db7908490610e31565b505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610e5373ffffffffffffffffffffffffffffffffffffffff841683610ec7565b90508051600014158015610e78575080806020019051810190610e76919061138e565b155b15610db7576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610357565b6060610ed583836000610ede565b90505b92915050565b606081471015610f1c576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401610357565b6000808573ffffffffffffffffffffffffffffffffffffffff168486604051610f4591906113b0565b60006040518083038185875af1925050503d8060008114610f82576040519150601f19603f3d011682016040523d82523d6000602084013e610f87565b606091505b5091509150610f97868383610fa1565b9695505050505050565b606082610fb657610fb182611030565b610cd0565b8151158015610fda575073ffffffffffffffffffffffffffffffffffffffff84163b155b15611029576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610357565b5080610cd0565b8051156110405780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156110e8576110e8611072565b604052919050565b600067ffffffffffffffff82111561110a5761110a611072565b5060051b60200190565b803573ffffffffffffffffffffffffffffffffffffffff8116811461113857600080fd5b919050565b600082601f83011261114e57600080fd5b813561116161115c826110f0565b6110a1565b8082825260208201915060208360051b86010192508583111561118357600080fd5b602085015b838110156111a0578035835260209283019201611188565b5095945050505050565b600080604083850312156111bd57600080fd5b823567ffffffffffffffff8111156111d457600080fd5b8301601f810185136111e557600080fd5b80356111f361115c826110f0565b8082825260208201915060208360051b85010192508783111561121557600080fd5b6020840193505b8284101561123e5761122d84611114565b82526020938401939091019061121c565b9450505050602083013567ffffffffffffffff81111561125d57600080fd5b6112698582860161113d565b9150509250929050565b6000806040838503121561128657600080fd5b61128f83611114565b946020939093013593505050565b6000602082840312156112af57600080fd5b610ed582611114565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610ed857610ed86112e7565b81810381811115610ed857610ed86112e7565b8082028115828204841417610ed857610ed86112e7565b600082611389577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156113a057600080fd5b81518015158114610cd057600080fd5b6000825160005b818110156113d157602081860181015185830152016113b7565b50600092019182525091905056fea26469706673582212209a942304de7de6a230432ebd9e7b56e0fb46e1c4d4c561ce114674416f014bf564736f6c634300081c0033

Verified Source Code Full Match

Compiler: v0.8.28+commit.7893614a EVM: paris Optimization: Yes (999999 runs)
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _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);
    }
}
IERC20Permit.sol 90 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}
SafeERC20.sol 118 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}
Address.sol 159 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
TempleTeamPayments.sol 97 lines
//SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract TempleTeamPayments is Ownable {
    uint256 public immutable roundStartDate;
    uint256 public immutable roundEndDate;
    IERC20 public immutable TEMPLE;

    mapping(address => uint256) public allocation;
    mapping(address => uint256) public claimed;

    event Claimed(address indexed member, uint256 amount);

    constructor(IERC20 _TEMPLE, uint256 paymentPeriodInSeconds, uint256 startTimestamp) Ownable(msg.sender) {
        roundStartDate = startTimestamp;
        roundEndDate = startTimestamp + paymentPeriodInSeconds;
        TEMPLE = _TEMPLE;
    }

    modifier addressExists(address _address) {
        require(allocation[_address] > 0, "TempleTeamPayments: Member not found");
        _;
    }

    function setAllocations(
        address[] memory _addresses,
        uint256[] memory _amounts
    ) external onlyOwner {
        require(
            _addresses.length == _amounts.length,
            "TempleTeamPayments: addresses and amounts must be the same length"
        );
        address addressZero = address(0);
        for (uint256 i = 0; i < _addresses.length; i++) {
            require(_addresses[i] != addressZero, "TempleTeamPayments: Address cannot be 0x0");
            allocation[_addresses[i]] = _amounts[i];
        }
    }

    function setAllocation(address _address, uint256 _amount) external onlyOwner {
        require(_address != address(0), "TempleTeamPayments: Address cannot be 0x0");
        allocation[_address] = _amount;
    }

    function pauseMember(address _address)
        external
        onlyOwner
        addressExists(_address)
    {
        allocation[_address] = claimed[_address];
    }

    function calculateClaimable(address _address)
        public
        view
        addressExists(_address)
        returns (uint256)
    {
        // allocation * portion_of_round_elapsed - total_claimed
        uint256 claimableAmount = (allocation[_address] *
            (block.timestamp - roundStartDate)) /
            (roundEndDate - roundStartDate) -
            claimed[_address];
        if (claimableAmount + claimed[_address] > allocation[_address]) {
            claimableAmount = allocation[_address] - claimed[_address];
        }
        return claimableAmount;
    }

    function claim() external addressExists(msg.sender) {
        uint256 claimable = calculateClaimable(msg.sender);
        require(claimable > 0, "TempleTeamPayments: Member has no TEMPLE to claim");

        claimed[msg.sender] += claimable;
        SafeERC20.safeTransfer(TEMPLE, msg.sender, claimable);
        emit Claimed(msg.sender, claimable);
    }

    function adhocPayment(address _to, uint256 _amount) external onlyOwner {
        require(_amount > 0, "TempleTeamPayments: Amount must be greater than 0");
        claimed[_to] += _amount;
        SafeERC20.safeTransfer(TEMPLE, _to, _amount);
        emit Claimed(_to, _amount);
    }

    function withdrawTempleBalance(address _to, uint256 _amount)
        external
        onlyOwner
    {
        require(_amount > 0, "TempleTeamPayments: Amount must be greater than 0");
        SafeERC20.safeTransfer(TEMPLE, _to, _amount);
    }
}

Read Contract

TEMPLE 0x50e23d00 → address
allocation 0xb81b8630 → uint256
calculateClaimable 0xfe7b0007 → uint256
claimed 0xc884ef83 → uint256
owner 0x8da5cb5b → address
roundEndDate 0xf73fae71 → uint256
roundStartDate 0x078fa339 → uint256

Write Contract 8 functions

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

adhocPayment 0xcffc8e64
address _to
uint256 _amount
claim 0x4e71d92d
No parameters
pauseMember 0xd4cc2dd3
address _address
renounceOwnership 0x715018a6
No parameters
setAllocation 0x9076c166
address _address
uint256 _amount
setAllocations 0x1ff64acd
address[] _addresses
uint256[] _amounts
transferOwnership 0xf2fde38b
address newOwner
withdrawTempleBalance 0xadfc500b
address _to
uint256 _amount

Token Balances (1)

View Transfers →
DAI 34000

Recent Transactions

No transactions found for this address