Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0x3864b787e498BF89eDFf0ED6258393D4CF462855
Balance 0 ETH
Nonce 1
Code Size 6699 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

6699 bytes
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c806370a082311161010f578063a457c2d7116100a2578063dd62ed3e11610071578063dd62ed3e1461042f578063e3c998fe14610468578063e574439a14610491578063f2fde38b1461049957600080fd5b8063a457c2d7146103f9578063a9059cbb1461040c578063c9ecc9dd1461041f578063d1058e591461042757600080fd5b80639325f7d8116100de5780639325f7d8146103aa578063957aa58c146103ca57806395d89b41146103de5780639dc29fac146103e657600080fd5b806370a0823114610355578063715018a61461037e57806379cc6790146103865780638da5cb5b1461039957600080fd5b806333ced87a116101875780633c6c2eaa116101565780633c6c2eaa146102fe57806340a3d2461461031157806342966c68146103195780634da6a5561461032c57600080fd5b806333ced87a1461029d57806335322f37146102d0578063362a3fad146102d857806339509351146102eb57600080fd5b806323b872dd116101c357806323b872dd1461025457806328d3d88214610267578063313ce5671461027c57806332cb6b0c1461028b57600080fd5b806306fdde03146101f5578063095ea7b31461021357806315b972f91461023657806318160ddd1461024c575b600080fd5b6101fd6104ac565b60405161020a919061187c565b60405180910390f35b610226610221366004611787565b61053e565b604051901515815260200161020a565b61023e600a81565b60405190815260200161020a565b60025461023e565b61022661026236600461174c565b610554565b61027a6102753660046117b0565b610603565b005b6040516012815260200161020a565b61023e6aa56fa5b99019a5c800000081565b6102b8739712228ceeda1e2ddde52cd5100b88986d1cb49c81565b6040516001600160a01b03909116815260200161020a565b61027a610755565b61023e6102e6366004611700565b610937565b6102266102f9366004611787565b610a03565b61027a61030c3660046117b0565b610a3f565b61027a610bde565b61027a610327366004611820565b610c29565b61023e61033a366004611700565b6001600160a01b031660009081526008602052604090205490565b61023e610363366004611700565b6001600160a01b031660009081526020819052604090205490565b61027a610c36565b61027a610394366004611787565b610c6c565b6005546001600160a01b03166102b8565b6103bd6103b8366004611700565b610ced565b60405161020a9190611838565b60055461022690600160a01b900460ff1681565b6101fd610d59565b61027a6103f4366004611787565b610d68565b610226610407366004611787565b610dc6565b61022661041a366004611787565b610e5f565b61023e603281565b61027a610e6c565b61023e61043d36600461171a565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6102b8610476366004611820565b6000908152600760205260409020546001600160a01b031690565b61023e600581565b61027a6104a7366004611700565b610f6c565b6060600380546104bb90611989565b80601f01602080910402602001604051908101604052809291908181526020018280546104e790611989565b80156105345780601f1061050957610100808354040283529160200191610534565b820191906000526020600020905b81548152906001019060200180831161051757829003601f168201915b5050505050905090565b600061054b338484611004565b50600192915050565b6000610561848484611128565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156105eb5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6105f88533858403611004565b506001949350505050565b600554600160a01b900460ff166106475760405162461bcd60e51b81526020600482015260086024820152674e4f545f4c49564560c01b60448201526064016105e2565b60005b8181101561075057600083838381811061067457634e487b7160e01b600052603260045260246000fd5b6040516323b872dd60e01b815233600482015230602482015260209091029290920135604483018190529250739712228ceeda1e2ddde52cd5100b88986d1cb49c916323b872dd9150606401600060405180830381600087803b1580156106da57600080fd5b505af11580156106ee573d6000803e3d6000fd5b505033600081815260086020908152604080832080546001810182559084528284200187905595825260068152858220429055600790529390932080546001600160a01b03191690931790925550819050610748816119c4565b91505061064a565b505050565b33600090815260086020526040812054116107a05760405162461bcd60e51b815260206004820152600b60248201526a1393d39157d4d51052d15160aa1b60448201526064016105e2565b336000908152600860205260408120545b80156108f9573360009081526008602052604081206107d160018461195b565b815481106107ef57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546040516323b872dd60e01b815230600482015233602482015260448101829052909150739712228ceeda1e2ddde52cd5100b88986d1cb49c906323b872dd90606401600060405180830381600087803b15801561085757600080fd5b505af115801561086b573d6000803e3d6000fd5b50505050610878816112f6565b6108829084611904565b336000908152600860205260409020805491945090806108b257634e487b7160e01b600052603160045260246000fd5b60008281526020808220830160001990810183905590920190925591815260079091526040902080546001600160a01b0319169055806108f181611972565b9150506107b1565b50600061090560025490565b61091a906aa56fa5b99019a5c800000061195b565b90506109333382841161092d578361136e565b8261136e565b5050565b6001600160a01b038116600090815260086020908152604080832080548251818502810185019093528083528493849392919083018282801561099957602002820191906000526020600020905b815481526020019060010190808311610985575b5050505050905060005b81518110156109fa576109dc8282815181106109cf57634e487b7160e01b600052603260045260246000fd5b60200260200101516112f6565b6109e69084611904565b9250806109f2816119c4565b9150506109a3565b50909392505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161054b918590610a3a908690611904565b611004565b6000805b82811015610ba4576000848483818110610a6d57634e487b7160e01b600052603260045260246000fd5b6020908102929092013560008181526007909352604090922054919250506001600160a01b03163314610ad65760405162461bcd60e51b81526020600482015260116024820152702722a2a229afaa27afa122afa7aba722a960791b60448201526064016105e2565b6040516323b872dd60e01b815230600482015233602482015260448101829052739712228ceeda1e2ddde52cd5100b88986d1cb49c906323b872dd90606401600060405180830381600087803b158015610b2f57600080fd5b505af1158015610b43573d6000803e3d6000fd5b50505050610b50816112f6565b610b5a9084611904565b336000908152600860205260409020909350610b76908261144d565b600090815260076020526040902080546001600160a01b031916905580610b9c816119c4565b915050610a43565b506000610bb060025490565b610bc5906aa56fa5b99019a5c800000061195b565b9050610bd83382841161092d578361136e565b50505050565b6005546001600160a01b03163314610c085760405162461bcd60e51b81526004016105e2906118cf565b6005805460ff60a01b198116600160a01b9182900460ff1615909102179055565b610c333382611544565b50565b6005546001600160a01b03163314610c605760405162461bcd60e51b81526004016105e2906118cf565b610c6a6000611692565b565b6000610c78833361043d565b905081811015610cd65760405162461bcd60e51b8152602060048201526024808201527f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f77604482015263616e636560e01b60648201526084016105e2565b610ce38333848403611004565b6107508383611544565b6001600160a01b038116600090815260086020908152604091829020805483518184028101840190945280845260609392830182828015610d4d57602002820191906000526020600020905b815481526020019060010190808311610d39575b50505050509050919050565b6060600480546104bb90611989565b33739712228ceeda1e2ddde52cd5100b88986d1cb49c14610dbc5760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b60448201526064016105e2565b6109338282611544565b3360009081526001602090815260408083206001600160a01b038616845290915281205482811015610e485760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016105e2565b610e553385858403611004565b5060019392505050565b600061054b338484611128565b33600090815260086020908152604080832080548251818502810185019093528083528493830182828015610ec057602002820191906000526020600020905b815481526020019060010190808311610eac575b5050505050905060005b8151811015610f38576000828281518110610ef557634e487b7160e01b600052603260045260246000fd5b60200260200101519050610f08816112f6565b610f129085611904565b600091825260066020526040909120429055925080610f30816119c4565b915050610eca565b506000610f4460025490565b610f59906aa56fa5b99019a5c800000061195b565b90506107503382851161092d578461136e565b6005546001600160a01b03163314610f965760405162461bcd60e51b81526004016105e2906118cf565b6001600160a01b038116610ffb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105e2565b610c3381611692565b6001600160a01b0383166110665760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105e2565b6001600160a01b0382166110c75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105e2565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661118c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105e2565b6001600160a01b0382166111ee5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105e2565b6001600160a01b038316600090815260208190526040902054818110156112665760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105e2565b6001600160a01b0380851660009081526020819052604080822085850390559185168152908120805484929061129d908490611904565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516112e991815260200190565b60405180910390a3610bd8565b6000806115e183101561130b5750600a611321565b61177183101561131d57506032611321565b5060055b60008381526006602052604090205462015180908290611341904261195b565b61134b919061193c565b611355919061191c565b61136790670de0b6b3a764000061193c565b9392505050565b6001600160a01b0382166113c45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105e2565b80600260008282546113d69190611904565b90915550506001600160a01b03821660009081526020819052604081208054839290611403908490611904565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b815460005b81811015610bd8578284828154811061147b57634e487b7160e01b600052603260045260246000fd5b90600052602060002001541415611532578161149681611972565b925050818110156114f9578382815481106114c157634e487b7160e01b600052603260045260246000fd5b90600052602060002001548482815481106114ec57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001555b8380548061151757634e487b7160e01b600052603160045260246000fd5b60019003818190600052602060002001600090559055610bd8565b8061153c816119c4565b915050611452565b6001600160a01b0382166115a45760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016105e2565b6001600160a01b038216600090815260208190526040902054818110156116185760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016105e2565b6001600160a01b038316600090815260208190526040812083830390556002805484929061164790849061195b565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80356001600160a01b03811681146116fb57600080fd5b919050565b600060208284031215611711578081fd5b611367826116e4565b6000806040838503121561172c578081fd5b611735836116e4565b9150611743602084016116e4565b90509250929050565b600080600060608486031215611760578081fd5b611769846116e4565b9250611777602085016116e4565b9150604084013590509250925092565b60008060408385031215611799578182fd5b6117a2836116e4565b946020939093013593505050565b600080602083850312156117c2578182fd5b823567ffffffffffffffff808211156117d9578384fd5b818501915085601f8301126117ec578384fd5b8135818111156117fa578485fd5b8660208260051b850101111561180e578485fd5b60209290920196919550909350505050565b600060208284031215611831578081fd5b5035919050565b6020808252825182820181905260009190848201906040850190845b8181101561187057835183529284019291840191600101611854565b50909695505050505050565b6000602080835283518082850152825b818110156118a85785810183015185820160400152820161188c565b818111156118b95783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115611917576119176119df565b500190565b60008261193757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611956576119566119df565b500290565b60008282101561196d5761196d6119df565b500390565b600081611981576119816119df565b506000190190565b600181811c9082168061199d57607f821691505b602082108114156119be57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156119d8576119d86119df565b5060010190565b634e487b7160e01b600052601160045260246000fdfea264697066735822122030a181277b161a83c2b3395b6097bc9f1e14d0261e93601c200d8da4c97a63ae64736f6c63430008040033

Verified Source Code Partial Match

Compiler: v0.8.4+commit.c7e474f2 EVM: istanbul Optimization: Yes (200 runs)
AWOO.sol 769 lines
// File: @openzeppelin/contracts/utils/Context.sol



pragma solidity ^0.8.0;

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

// File: @openzeppelin/contracts/access/Ownable.sol



pragma solidity ^0.8.0;


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

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

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

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

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

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

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

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

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



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);
}

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



pragma solidity ^0.8.0;


/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
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/token/ERC20/ERC20.sol



pragma solidity ^0.8.0;




/**
 * @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}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * 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 ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these 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 override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override 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 value {ERC20} uses, unless this function is
     * 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 override returns (uint8) {
        return 18;
    }

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        unchecked {
            _approve(sender, _msgSender(), currentAllowance - amount);
        }

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(_msgSender(), spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * 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.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[sender] = senderBalance - amount;
        }
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);

        _afterTokenTransfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` 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.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

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



pragma solidity ^0.8.0;



/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        uint256 currentAllowance = allowance(account, _msgSender());
        require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
        unchecked {
            _approve(account, _msgSender(), currentAllowance - amount);
        }
        _burn(account, amount);
    }
}

// File: contracts/wulfzstaking.sol


pragma solidity ^0.8.4;



interface IWulfzNFT {
    function transferFrom(address _from, address _to, uint256 _tokenId) external;
}

contract AWOO is ERC20Burnable, Ownable {
    uint256 public constant MAX_SUPPLY = 200000000 * 1 ether;
    uint256 public constant ALPHA_EMISSION_RATE = 50; // 50 per day
    uint256 public constant WULFZ_EMISSION_RATE = 10; // 10 per day
    uint256 public constant PUPZ_EMISSION_RATE = 5; // 5 per day
    address public constant WULFZ_ADDRESS = 0x9712228cEeDA1E2dDdE52Cd5100B88986d1Cb49c;
    bool public live = false;

    mapping(uint256 => uint256) internal wulfzTimeStaked;
    mapping(uint256 => address) internal wulfzStaker;
    mapping(address => uint256[]) internal stakerToWulfz;
        
    IWulfzNFT private constant _wulfzContract = IWulfzNFT(WULFZ_ADDRESS);

    constructor() ERC20("AWOO", "AWOO") {
        _mint(msg.sender, 2100 * 1 ether);
    }

    modifier stakingEnabled {
        require(live, "NOT_LIVE");
        _;
    }

    function getStakedWulfz(address staker) public view returns (uint256[] memory) {
        return stakerToWulfz[staker];
    }
    
    function getStakedAmount(address staker) public view returns (uint256) {
        return stakerToWulfz[staker].length;
    }

    function getStaker(uint256 tokenId) public view returns (address) {
        return wulfzStaker[tokenId];
    }

    function getAllRewards(address staker) public view returns (uint256) {
        uint256 totalRewards = 0;

        uint256[] memory wulfzTokens = stakerToWulfz[staker];
        for (uint256 i = 0; i < wulfzTokens.length; i++) {
            totalRewards += getReward(wulfzTokens[i]);
        }

        return totalRewards;
    }

    function stakeWulfzById(uint256[] calldata tokenIds) external stakingEnabled {
        for (uint256 i = 0; i < tokenIds.length; i++) {
            uint256 id = tokenIds[i];
            _wulfzContract.transferFrom(msg.sender, address(this), id);

            stakerToWulfz[msg.sender].push(id);
            wulfzTimeStaked[id] = block.timestamp;
            wulfzStaker[id] = msg.sender;
        }
    }

    function unstakeWulfzByIds(uint256[] calldata tokenIds) external {
        uint256 totalRewards = 0;

        for (uint256 i = 0; i < tokenIds.length; i++) {
            uint256 id = tokenIds[i];
            require(wulfzStaker[id] == msg.sender, "NEEDS_TO_BE_OWNER");

            _wulfzContract.transferFrom(address(this), msg.sender, id);
            totalRewards += getReward(id);

            removeTokenIdFromArray(stakerToWulfz[msg.sender], id);
            wulfzStaker[id] = address(0);
        }

        uint256 remaining = MAX_SUPPLY - totalSupply();
        _mint(msg.sender, totalRewards > remaining ? remaining : totalRewards);
    }

    function unstakeAll() external {
        require(getStakedAmount(msg.sender) > 0, "NONE_STAKED");
        uint256 totalRewards = 0;

        for (uint256 i = stakerToWulfz[msg.sender].length; i > 0; i--) {
            uint256 id = stakerToWulfz[msg.sender][i - 1];

            _wulfzContract.transferFrom(address(this), msg.sender, id);
            totalRewards += getReward(id);

            stakerToWulfz[msg.sender].pop();
            wulfzStaker[id] = address(0);
        }

        uint256 remaining = MAX_SUPPLY - totalSupply();
        _mint(msg.sender, totalRewards > remaining ? remaining : totalRewards);
    }

    function claimAll() external {
        uint256 totalRewards = 0;

        uint256[] memory wulfzTokens = stakerToWulfz[msg.sender];
        for (uint256 i = 0; i < wulfzTokens.length; i++) {
            uint256 id = wulfzTokens[i];

            totalRewards += getReward(id);
            wulfzTimeStaked[id] = block.timestamp;
        }

        uint256 remaining = MAX_SUPPLY - totalSupply();
        _mint(msg.sender, totalRewards > remaining ? remaining : totalRewards);
    }

    function burn(address from, uint256 amount) external {
        require(msg.sender == WULFZ_ADDRESS, "NOT_AUTHORIZED");

        _burn(from, amount);
    }
    
    function toggle() external onlyOwner {
        live = !live;
    }

    function getReward(uint256 tokenId) internal view returns(uint256) {
        uint256 EMISSION_RATE;
        if (tokenId < 5601) {
            EMISSION_RATE = WULFZ_EMISSION_RATE;
        } else if (tokenId < 6001) {
            EMISSION_RATE = ALPHA_EMISSION_RATE;
        } else {
            EMISSION_RATE = PUPZ_EMISSION_RATE;
        }

        return (block.timestamp - wulfzTimeStaked[tokenId]) * EMISSION_RATE / 86400 * 1 ether;
    }

    function removeTokenIdFromArray(uint256[] storage array, uint256 tokenId) internal {
        uint256 length = array.length;
        for (uint256 i = 0; i < length; i++) {
            if (array[i] == tokenId) {
                length--;
                if (i < length) {
                    array[i] = array[length];
                }
                array.pop();
                break;
            }
        }
    }
}

Read Contract

ALPHA_EMISSION_RATE 0xc9ecc9dd → uint256
MAX_SUPPLY 0x32cb6b0c → uint256
PUPZ_EMISSION_RATE 0xe574439a → uint256
WULFZ_ADDRESS 0x33ced87a → address
WULFZ_EMISSION_RATE 0x15b972f9 → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
getAllRewards 0x362a3fad → uint256
getStakedAmount 0x4da6a556 → uint256
getStakedWulfz 0x9325f7d8 → uint256[]
getStaker 0xe3c998fe → address
live 0x957aa58c → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256

Write Contract 15 functions

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

approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burn 0x42966c68
uint256 amount
burn 0x9dc29fac
address from
uint256 amount
burnFrom 0x79cc6790
address account
uint256 amount
claimAll 0xd1058e59
No parameters
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
renounceOwnership 0x715018a6
No parameters
stakeWulfzById 0x28d3d882
uint256[] tokenIds
toggle 0x40a3d246
No parameters
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
unstakeAll 0x35322f37
No parameters
unstakeWulfzByIds 0x3c6c2eaa
uint256[] tokenIds

Recent Transactions

No transactions found for this address