Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0xfe57eFbD46efB42FBAF70f4dbf80FDA5a17397ff
Balance 0 ETH
Nonce 1
Code Size 5177 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

5177 bytes
0x608060405260043610610134575f3560e01c80636ddd1713116100a857806395d89b411161006d57806395d89b41146104b2578063a9059cbb146104c6578063d8e70000146104e5578063dd62ed3e14610504578063e01af92c14610523578063e086e5ec14610542575f5ffd5b80636ddd17131461040057806370a08231146104195780637302d3421461044d5780638da5cb5b14610461578063910b947214610493575f5ffd5b806323b872dd116100f957806323b872dd1461033d5780632527bae31461035c578063313ce567146103705780634eeb2e901461038b5780634f220ef4146103c25780636b66cd3c146103e1575f5ffd5b806306fdde0314610282578063088b1317146102ac578063095ea7b3146102d957806315c203d91461030857806318160ddd14610329575f5ffd5b3661027e57345f0361018d5760405162461bcd60e51b815260206004820152601a60248201527f4d7573742073656e642045544820746f206d696e7420474f415400000000000060448201526064015b60405180910390fd5b5f620f4240600654346101a091906111d1565b6101aa91906111e8565b9050805f036101f15760405162461bcd60e51b81526020600482015260136024820152724d696e7420616d6f756e7420746f6f206c6f7760681b6044820152606401610184565b305f9081526020819052604090205481811061021757610212303384610556565b610241565b801561022857610228303383610556565b5f6102338284611207565b905061023f33826105b8565b505b604080513481526020810184905233917f32450201470baa6a3981fa5a527142c5dbaf9e1bd7239355b6f2223c699f222a910160405180910390a2005b5f5ffd5b34801561028d575f5ffd5b506102966105f0565b6040516102a3919061121a565b60405180910390f35b3480156102b7575f5ffd5b506102cb6102c636600461124f565b610680565b6040519081526020016102a3565b3480156102e4575f5ffd5b506102f86102f3366004611281565b610692565b60405190151581526020016102a3565b348015610313575f5ffd5b5061032761032236600461124f565b6106a9565b005b348015610334575f5ffd5b506002546102cb565b348015610348575f5ffd5b506102f86103573660046112a9565b610785565b348015610367575f5ffd5b506006546102cb565b34801561037b575f5ffd5b50604051601281526020016102a3565b348015610396575f5ffd5b506005546103aa906001600160a01b031681565b6040516001600160a01b0390911681526020016102a3565b3480156103cd575f5ffd5b506103276103dc36600461124f565b6107a8565b3480156103ec575f5ffd5b506103276103fb3660046112e3565b610a73565b34801561040b575f5ffd5b506007546102f89060ff1681565b348015610424575f5ffd5b506102cb6104333660046112e3565b6001600160a01b03165f9081526020819052604090205490565b348015610458575f5ffd5b506102cb605581565b34801561046c575f5ffd5b507f000000000000000000000000b9ff3c9562b757eee13aaf92b2ee23a5e9bfee276103aa565b34801561049e575f5ffd5b506103276104ad36600461124f565b610add565b3480156104bd575f5ffd5b50610296610d62565b3480156104d1575f5ffd5b506102f86104e0366004611281565b610d71565b3480156104f0575f5ffd5b506102cb6104ff36600461124f565b610d7e565b34801561050f575f5ffd5b506102cb61051e366004611303565b610d8a565b34801561052e575f5ffd5b5061032761053d366004611344565b610db4565b34801561054d575f5ffd5b50610327610e0f565b6001600160a01b03831661057f57604051634b637e8f60e11b81525f6004820152602401610184565b6001600160a01b0382166105a85760405163ec442f0560e01b81525f6004820152602401610184565b6105b3838383610f54565b505050565b6001600160a01b0382166105e15760405163ec442f0560e01b81525f6004820152602401610184565b6105ec5f8383610f54565b5050565b6060600380546105ff9061135f565b80601f016020809104026020016040519081016040528092919081815260200182805461062b9061135f565b80156106765780601f1061064d57610100808354040283529160200191610676565b820191905f5260205f20905b81548152906001019060200180831161065957829003601f168201915b5050505050905090565b5f61068c6055836111d1565b92915050565b5f3361069f81858561107a565b5060019392505050565b336001600160a01b037f000000000000000000000000b9ff3c9562b757eee13aaf92b2ee23a5e9bfee2716146106f15760405162461bcd60e51b815260040161018490611397565b5f81116107405760405162461bcd60e51b815260206004820152601e60248201527f52617465206d7573742062652067726561746572207468616e207a65726f00006044820152606401610184565b600680549082905560408051828152602081018490527f7aaf6e876013942206286cfff5091af2fa84c63a6f07b849acdc1e7eb91780c0910160405180910390a15050565b5f33610792858285611087565b61079d858585610556565b506001949350505050565b60075460ff166107ea5760405162461bcd60e51b815260206004820152600d60248201526c14ddd85c08191a5cd8589b1959609a1b6044820152606401610184565b5f811161082e5760405162461bcd60e51b81526020600482015260126024820152710416d6f756e74206d757374206265203e20360741b6044820152606401610184565b806108393330610d8a565b10156108765760405162461bcd60e51b815260206004820152600c60248201526b139bdd08185c1c1c9bdd995960a21b6044820152606401610184565b610881333083610785565b6108c45760405162461bcd60e51b815260206004820152601460248201527313515055081d1c985b9cd9995c8819985a5b195960621b6044820152606401610184565b5f6108d06055836111e8565b6005546040516370a0823160e01b81523060048201529192505f916001600160a01b03909116906370a0823190602401602060405180830381865afa15801561091b573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061093f91906113be565b9050818110156109bf576005546001600160a01b031663449a52f8306109658486611207565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044015f604051808303815f87803b1580156109a8575f5ffd5b505af11580156109ba573d5f5f3e3d5ffd5b505050505b60055460405163a9059cbb60e01b8152336004820152602481018490526001600160a01b039091169063a9059cbb906044016020604051808303815f875af1158015610a0d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a3191906113d5565b50604080518481526020810184905233917fb3815b5a8d3b29cfb2df4ae54f50951c672a72abe2b8d8e34a60db8ac53812af91015b60405180910390a2505050565b336001600160a01b037f000000000000000000000000b9ff3c9562b757eee13aaf92b2ee23a5e9bfee271614610abb5760405162461bcd60e51b815260040161018490611397565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b60075460ff16610b1f5760405162461bcd60e51b815260206004820152600d60248201526c14ddd85c08191a5cd8589b1959609a1b6044820152606401610184565b5f8111610b635760405162461bcd60e51b81526020600482015260126024820152710416d6f756e74206d757374206265203e20360741b6044820152606401610184565b600554604051636eb1769f60e11b815233600482015230602482015282916001600160a01b03169063dd62ed3e90604401602060405180830381865afa158015610baf573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bd391906113be565b1015610c105760405162461bcd60e51b815260206004820152600c60248201526b139bdd08185c1c1c9bdd995960a21b6044820152606401610184565b6005546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd906064016020604051808303815f875af1158015610c64573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c8891906113d5565b610ccb5760405162461bcd60e51b815260206004820152601460248201527311d3d055081d1c985b9cd9995c8819985a5b195960621b6044820152606401610184565b5f610cd76055836111d1565b305f90815260208190526040902054909150818110610d0057610cfb303384610556565b610d2a565b8015610d1157610d11303383610556565b5f610d1c8284611207565b9050610d2833826105b8565b505b604080518481526020810184905233917f0fc7b62c4ea3974c83eb006f8f17ae47b25ac86c526403f94afb0fd116a327059101610a66565b6060600480546105ff9061135f565b5f3361069f818585610556565b5f61068c6055836111e8565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b336001600160a01b037f000000000000000000000000b9ff3c9562b757eee13aaf92b2ee23a5e9bfee271614610dfc5760405162461bcd60e51b815260040161018490611397565b6007805460ff1916911515919091179055565b336001600160a01b037f000000000000000000000000b9ff3c9562b757eee13aaf92b2ee23a5e9bfee271614610e575760405162461bcd60e51b815260040161018490611397565b4780610e9a5760405162461bcd60e51b81526020600482015260126024820152714e6f2045544820746f20776974686472617760701b6044820152606401610184565b6040516001600160a01b037f000000000000000000000000b9ff3c9562b757eee13aaf92b2ee23a5e9bfee27169082156108fc029083905f818181858888f19350505050158015610eed573d5f5f3e3d5ffd5b507f000000000000000000000000b9ff3c9562b757eee13aaf92b2ee23a5e9bfee276001600160a01b03167f94b2de810873337ed265c5f8cf98c9cffefa06b8607f9a2f1fbaebdfbcfbef1c82604051610f4991815260200190565b60405180910390a250565b6001600160a01b038316610f7e578060025f828254610f7391906113f0565b90915550610fee9050565b6001600160a01b0383165f9081526020819052604090205481811015610fd05760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610184565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b03821661100a57600280548290039055611028565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161106d91815260200190565b60405180910390a3505050565b6105b383838360016110eb565b5f6110928484610d8a565b90505f198110156110e557818110156110d757604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610184565b6110e584848484035f6110eb565b50505050565b6001600160a01b0384166111145760405163e602df0560e01b81525f6004820152602401610184565b6001600160a01b03831661113d57604051634a1406b160e11b81525f6004820152602401610184565b6001600160a01b038085165f90815260016020908152604080832093871683529290522082905580156110e557826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516111af91815260200190565b60405180910390a350505050565b634e487b7160e01b5f52601160045260245ffd5b808202811582820484141761068c5761068c6111bd565b5f8261120257634e487b7160e01b5f52601260045260245ffd5b500490565b8181038181111561068c5761068c6111bd565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b5f6020828403121561125f575f5ffd5b5035919050565b80356001600160a01b038116811461127c575f5ffd5b919050565b5f5f60408385031215611292575f5ffd5b61129b83611266565b946020939093013593505050565b5f5f5f606084860312156112bb575f5ffd5b6112c484611266565b92506112d260208501611266565b929592945050506040919091013590565b5f602082840312156112f3575f5ffd5b6112fc82611266565b9392505050565b5f5f60408385031215611314575f5ffd5b61131d83611266565b915061132b60208401611266565b90509250929050565b8015158114611341575f5ffd5b50565b5f60208284031215611354575f5ffd5b81356112fc81611334565b600181811c9082168061137357607f821691505b60208210810361139157634e487b7160e01b5f52602260045260245ffd5b50919050565b6020808252600d908201526c2737ba103a34329037bbb732b960991b604082015260600190565b5f602082840312156113ce575f5ffd5b5051919050565b5f602082840312156113e5575f5ffd5b81516112fc81611334565b8082018082111561068c5761068c6111bd56fea26469706673582212205f3fa545aa975a20d64048ed059ead96754daec44a7539dff98332689f05576e64736f6c634300081d0033

Verified Source Code Partial Match

Compiler: v0.8.29+commit.ab55807c EVM: cancun Optimization: Yes (200 runs)
MEAT.sol 744 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.29;
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol


// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)


/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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);
}

// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol


// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)



/**
 * @dev Interface for the optional metadata functions from the ERC-20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

// File: @openzeppelin/contracts/utils/Context.sol


// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)


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

// File: @openzeppelin/contracts/interfaces/draft-IERC6093.sol


// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)

/**
 * @dev Standard ERC-20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC-721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC-1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

// File: @openzeppelin/contracts/token/ERC20/ERC20.sol


// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/ERC20.sol)






/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC-20
 * applications.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * Both values are immutable: they can only be set once during construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

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

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Skips emitting an {Approval} event indicating an allowance update. This is not
     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner`'s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     *
     * ```solidity
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner`'s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance < type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}

// File: contracts/interfaces/IGOAT.sol




interface IGOAT is IERC20 {
    function mintTo(address to, uint256 amount) external;
}
// File: contracts/MEAT.sol






/// @title MEAT Token - Monetary Exchange for Agriculture Token
/// @notice This contract handles minting MEAT via ETH, swapping MEAT and GOAT, and value flow between transaction and store-of-value assets.
contract MEAT is ERC20 { IGOAT public GOAT; address private immutable _owner;

uint256 private _rate = 1_000_000_000_000;
uint256 public constant GtM_SwapRate = 85;
bool public swapEnabled = true;

event DepositRateChanged(uint256 oldRate, uint256 newRate);
event MintedWithETH(address indexed user, uint256 ethReceived, uint256 meatMinted);
event ETHWithdrawn(address indexed to, uint256 amount);
event SwappedGOATForMEAT(address indexed user, uint256 goatIn, uint256 meatOut);
event SwappedMEATForGOAT(address indexed user, uint256 meatIn, uint256 goatOut);

modifier onlyOwner() {
    require(msg.sender == _owner, "Not the owner");
    _;
}
constructor(address goatAddress) ERC20("Monetary Exchange for Argicultural Transactions", "MEAT") {
    GOAT = IGOAT(goatAddress);
    _owner = msg.sender;
}
/// @notice Allows user to mint MEAT by sending ETH
receive() external payable {
    require(msg.value != 0, "Must send ETH to mint GOAT");
    uint256 meatAmount = msg.value * _rate / 1e6;
    require(meatAmount != 0, "Mint amount too low");
    uint256 contractBalance = balanceOf(address(this));
    if (contractBalance >= meatAmount) {
        _transfer(address(this), msg.sender, meatAmount);
    } else {
        if (contractBalance > 0) {
            _transfer(address(this), msg.sender, contractBalance);
        }
        uint256 mintAmount = meatAmount - contractBalance;
        _mint(msg.sender, mintAmount);
    }
    emit MintedWithETH(msg.sender, msg.value, meatAmount);
}
/// @notice Withdraws ETH from the contract by owner
function withdrawETH() external onlyOwner {
    uint256 balance = address(this).balance;
    require(balance > 0, "No ETH to withdraw");
    payable(_owner).transfer(balance);
    emit ETHWithdrawn(_owner, balance);
}

/// @notice Allows owner to change deposit rate
function changeDepositRate(uint256 newRate) external onlyOwner {
    require(newRate > 0, "Rate must be greater than zero");
    uint256 oldRate = _rate;
    _rate = newRate;
    emit DepositRateChanged(oldRate, newRate);
}
/// @notice Returns the current deposit rate
function DepositRate() external view returns (uint256) {
    return _rate;
}
/// @notice Swaps GOAT tokens for MEAT tokens
function swapGOATForMEAT(uint256 goatAmount) external {
    require(swapEnabled, "Swap disabled");
    require(goatAmount > 0, "Amount must be > 0");
    require(GOAT.allowance(msg.sender, address(this)) >= goatAmount, "Not approved");
    require(GOAT.transferFrom(msg.sender, address(this), goatAmount), "GOAT transfer failed");
    uint256 meatAmount = goatAmount * GtM_SwapRate;
    uint256 contractBalance = balanceOf(address(this));
    if (contractBalance >= meatAmount) {
        _transfer(address(this), msg.sender, meatAmount);
    } else {
        if (contractBalance > 0) {
            _transfer(address(this), msg.sender, contractBalance);
        }
        uint256 remaining = meatAmount - contractBalance;
        _mint(msg.sender, remaining);
    }    
    emit SwappedGOATForMEAT(msg.sender, goatAmount, meatAmount);
}
/// @notice Swaps MEAT tokens for GOAT tokens with mint fallback if needed
function swapMEATForGOAT(uint256 meatAmount) external {
    require(swapEnabled, "Swap disabled");
    require(meatAmount > 0, "Amount must be > 0");
    require(allowance(msg.sender, address(this)) >= meatAmount, "Not approved");
    require(transferFrom(msg.sender, address(this), meatAmount), "MEAT transfer failed");
    uint256 goatAmount = meatAmount / GtM_SwapRate;
    uint256 goatBalance = GOAT.balanceOf(address(this));
    if (goatBalance < goatAmount) {
        GOAT.mintTo(address(this), goatAmount - goatBalance);
    }
    GOAT.transfer(msg.sender, goatAmount);
    emit SwappedMEATForGOAT(msg.sender, meatAmount, goatAmount);
}
/// @notice Enables or disables the swap functionality
function setSwapEnabled(bool status) external onlyOwner {
    swapEnabled = status;
}
/// @notice Sets the GOAT token address
function setGOATAddress(address goatAddress) external onlyOwner {
    GOAT = IGOAT(goatAddress);
}
/// @notice Returns the contract owner
function owner() external view returns (address) {
    return _owner;
}
/// @notice Converts GOAT token amount to equivalent MEAT tokens
function getEquivalentMEAT(uint256 goatAmount) external pure returns (uint256) {
    return goatAmount * GtM_SwapRate;
}
/// @notice Converts MEAT token amount to equivalent GOAT tokens using integer division
/// @param meatAmount The amount of MEAT tokens to convert in wei
/// @return GOAT token amount in wei
function getEquivalentGOAT(uint256 meatAmount) external pure returns (uint256) {
    return meatAmount / GtM_SwapRate;
}
}

Read Contract

DepositRate 0x2527bae3 → uint256
GOAT 0x4eeb2e90 → address
GtM_SwapRate 0x7302d342 → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
getEquivalentGOAT 0xd8e70000 → uint256
getEquivalentMEAT 0x088b1317 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
swapEnabled 0x6ddd1713 → bool
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256

Write Contract 9 functions

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

approve 0x095ea7b3
address spender
uint256 value
returns: bool
changeDepositRate 0x15c203d9
uint256 newRate
setGOATAddress 0x6b66cd3c
address goatAddress
setSwapEnabled 0xe01af92c
bool status
swapGOATForMEAT 0x910b9472
uint256 goatAmount
swapMEATForGOAT 0x4f220ef4
uint256 meatAmount
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
withdrawETH 0xe086e5ec
No parameters

Recent Transactions

No transactions found for this address