Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xbc194e6f748a222754C3E8b9946922c09E7d4e91
Balance 0 ETH
Nonce 1
Code Size 7607 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

7607 bytes
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806370a08231116100b8578063b4b5ea571161007c578063b4b5ea57146103e8578063c3cda5201461040e578063d505accf14610455578063dd62ed3e146104a6578063e7a324dc146104d4578063f1127ed8146104dc57610137565b806370a0823114610320578063782d6fe1146103465780637ecebe001461038e57806395d89b41146103b4578063a9059cbb146103bc57610137565b806330adf81f116100ff57806330adf81f14610251578063313ce56714610259578063587cde1e146102775780635c19a95c146102b95780636fcfff45146102e157610137565b806306fdde031461013c578063095ea7b3146101b957806318160ddd146101f957806320606b701461021357806323b872dd1461021b575b600080fd5b610144610536565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017e578181015183820152602001610166565b50505050905090810190601f1680156101ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101e5600480360360408110156101cf57600080fd5b506001600160a01b03813516906020013561055d565b604080519115158252519081900360200190f35b61020161061b565b60408051918252519081900360200190f35b610201610621565b6101e56004803603606081101561023157600080fd5b506001600160a01b0381358116916020810135909116906040013561063c565b610201610781565b61026161079c565b6040805160ff9092168252519081900360200190f35b61029d6004803603602081101561028d57600080fd5b50356001600160a01b03166107a1565b604080516001600160a01b039092168252519081900360200190f35b6102df600480360360208110156102cf57600080fd5b50356001600160a01b03166107bc565b005b610307600480360360208110156102f757600080fd5b50356001600160a01b03166107c9565b6040805163ffffffff9092168252519081900360200190f35b6102016004803603602081101561033657600080fd5b50356001600160a01b03166107e1565b6103726004803603604081101561035c57600080fd5b506001600160a01b038135169060200135610805565b604080516001600160601b039092168252519081900360200190f35b610201600480360360208110156103a457600080fd5b50356001600160a01b0316610a32565b610144610a44565b6101e5600480360360408110156103d257600080fd5b506001600160a01b038135169060200135610a63565b610372600480360360208110156103fe57600080fd5b50356001600160a01b0316610a9f565b6102df600480360360c081101561042457600080fd5b506001600160a01b038135169060208101359060408101359060ff6060820135169060808101359060a00135610b10565b6102df600480360360e081101561046b57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135610dbc565b610201600480360360408110156104bc57600080fd5b506001600160a01b0381358116916020013516611201565b610201611235565b61050e600480360360408110156104f257600080fd5b5080356001600160a01b0316906020013563ffffffff16611250565b6040805163ffffffff90931683526001600160601b0390911660208301528051918290030190f35b6040518060400160405280600b81526020016a2632bb32b9102a37b5b2b760a91b81525081565b6000806000198314156105735750600019610598565b61059583604051806060016040528060248152602001611a9160249139611285565b90505b3360008181526001602090815260408083206001600160a01b0389168085529083529281902080546001600160601b0319166001600160601b038716908117909155815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a360019150505b92915050565b60005481565b604051806043611c5182396043019050604051809103902081565b6001600160a01b03831660009081526001602090815260408083203380855290835281842054825160608101909352602480845291936001600160601b039091169285926106949288929190611a9190830139611285565b9050866001600160a01b0316836001600160a01b0316141580156106c157506001600160601b0382811614155b156107695760006106eb83836040518060600160405280603c8152602001611ab5603c913961131f565b6001600160a01b038981166000818152600160209081526040808320948a168084529482529182902080546001600160601b0319166001600160601b03871690811790915582519081529151949550929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92592918290030190a3505b61077487878361138c565b5060019695505050505050565b604051806052611bd882396052019050604051809103902081565b601281565b6003602052600090815260409020546001600160a01b031681565b6107c63382611571565b50565b60056020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600260205260409020546001600160601b031690565b60004382106108455760405162461bcd60e51b8152600401808060200182810382526026815260200180611a6b6026913960400191505060405180910390fd5b6001600160a01b03831660009081526005602052604090205463ffffffff1680610873576000915050610615565b6001600160a01b038416600090815260046020908152604080832063ffffffff6000198601811685529252909120541683106108ef576001600160a01b03841660009081526004602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b03169050610615565b6001600160a01b038416600090815260046020908152604080832083805290915290205463ffffffff1683101561092a576000915050610615565b600060001982015b8163ffffffff168163ffffffff1611156109ed57600282820363ffffffff1604810361095c611a0b565b506001600160a01b038716600090815260046020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b031691810191909152908714156109c8576020015194506106159350505050565b805163ffffffff168711156109df578193506109e6565b6001820392505b5050610932565b506001600160a01b038516600090815260046020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60066020526000908152604090205481565b604051806040016040528060038152602001622622ab60e91b81525081565b600080610a8883604051806060016040528060258152602001611b2660259139611285565b9050610a9533858361138c565b5060019392505050565b6001600160a01b03811660009081526005602052604081205463ffffffff1680610aca576000610b09565b6001600160a01b0383166000908152600460209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03165b9392505050565b60006040518080611c516043913960408051918290036043018220828201909152600b82526a2632bb32b9102a37b5b2b760a91b60209092019190915290507ff4936b8eac0ebddf56d8d171fffc00337f5d68546d55fa8d14aea9ea3c62ef12610b786115fb565b3060405160200180858152602001848152602001838152602001826001600160a01b03166001600160a01b0316815260200194505050505060405160208183030381529060405280519060200120905060006040518080611d16603a91396040805191829003603a0182206020808401919091526001600160a01b038c1683830152606083018b905260808084018b90528251808503909101815260a08401835280519082012061190160f01b60c085015260c2840187905260e2808501829052835180860390910181526101028501808552815191840191909120600091829052610122860180865281905260ff8c1661014287015261016286018b905261018286018a9052935191965092945091926001926101a28083019392601f198301929081900390910190855afa158015610cb6573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610d085760405162461bcd60e51b8152600401808060200182810382526025815260200180611b846025913960400191505060405180910390fd5b6001600160a01b03811660009081526006602052604090208054600181019091558914610d665760405162461bcd60e51b8152600401808060200182810382526021815260200180611cba6021913960400191505060405180910390fd5b87421115610da55760405162461bcd60e51b8152600401808060200182810382526025815260200180611a236025913960400191505060405180910390fd5b610daf818b611571565b505050505b505050505050565b6000600019861415610dd15750600019610df6565b610df386604051806060016040528060238152602001611a4860239139611285565b90505b60006040518080611c516043913960408051918290036043018220828201909152600b82526a2632bb32b9102a37b5b2b760a91b60209092019190915290507ff4936b8eac0ebddf56d8d171fffc00337f5d68546d55fa8d14aea9ea3c62ef12610e5e6115fb565b3060405160200180858152602001848152602001838152602001826001600160a01b03166001600160a01b0316815260200194505050505060405160208183030381529060405280519060200120905060006040518080611bd860529139605201905060405180910390208a8a8a600660008f6001600160a01b03166001600160a01b031681526020019081526020016000206000815480929190600101919050558b60405160200180878152602001866001600160a01b03166001600160a01b03168152602001856001600160a01b03166001600160a01b03168152602001848152602001838152602001828152602001965050505050505060405160208183030381529060405280519060200120905060008282604051602001808061190160f01b81525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018289898960405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561100f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611077576040805162461bcd60e51b815260206004820152601e60248201527f4c65763a3a7065726d69743a20696e76616c6964207369676e61747572650000604482015290519081900360640190fd5b8b6001600160a01b0316816001600160a01b0316146110dd576040805162461bcd60e51b815260206004820152601960248201527f4c65763a3a7065726d69743a20756e617574686f72697a656400000000000000604482015290519081900360640190fd5b88421115611132576040805162461bcd60e51b815260206004820152601e60248201527f4c65763a3a7065726d69743a207369676e617475726520657870697265640000604482015290519081900360640190fd5b84600160008e6001600160a01b03166001600160a01b0316815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160601b0302191690836001600160601b031602179055508a6001600160a01b03168c6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258760405180826001600160601b0316815260200191505060405180910390a3505050505050505050505050565b6001600160a01b0391821660009081526001602090815260408083209390941682529190915220546001600160601b031690565b60405180603a611d168239603a019050604051809103902081565b600460209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b84106113175760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156112dc5781810151838201526020016112c4565b50505050905090810190601f1680156113095780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b509192915050565b6000836001600160601b0316836001600160601b0316111582906113845760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156112dc5781810151838201526020016112c4565b505050900390565b6001600160a01b0383166113d15760405162461bcd60e51b815260040180806020018281038252603b815260200180611cdb603b913960400191505060405180910390fd5b6001600160a01b0382166114165760405162461bcd60e51b8152600401808060200182810382526039815260200180611b4b6039913960400191505060405180910390fd5b6001600160a01b038316600090815260026020908152604091829020548251606081019093526035808452611461936001600160601b039092169285929190611af19083013961131f565b6001600160a01b03848116600090815260026020908152604080832080546001600160601b0319166001600160601b0396871617905592861682529082902054825160608101909352602f8084526114c99491909116928592909190611ba9908301396115ff565b6001600160a01b0383811660008181526002602090815260409182902080546001600160601b0319166001600160601b039687161790558151948616855290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a36001600160a01b0380841660009081526003602052604080822054858416835291205461156c92918216911683611669565b505050565b6001600160a01b03808316600081815260036020818152604080842080546002845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a46115f5828483611669565b50505050565b4690565b6000838301826001600160601b0380871690831610156116605760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156112dc5781810151838201526020016112c4565b50949350505050565b816001600160a01b0316836001600160a01b03161415801561169457506000816001600160601b0316115b1561156c576001600160a01b0383161561174c576001600160a01b03831660009081526005602052604081205463ffffffff1690816116d4576000611713565b6001600160a01b0385166000908152600460209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b9050600061173a8285604051806060016040528060278152602001611c2a6027913961131f565b9050611748868484846117f7565b5050505b6001600160a01b0382161561156c576001600160a01b03821660009081526005602052604081205463ffffffff1690816117875760006117c6565b6001600160a01b0384166000908152600460209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b905060006117ed8285604051806060016040528060268152602001611c94602691396115ff565b9050610db4858484845b600061181b43604051806060016040528060338152602001611d50603391396119b6565b905060008463ffffffff1611801561186457506001600160a01b038516600090815260046020908152604080832063ffffffff6000198901811685529252909120548282169116145b156118c3576001600160a01b0385166000908152600460209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b03851602179055611962565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600483528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600590935292909220805460018801909316929091169190911790555b604080516001600160601b0380861682528416602082015281516001600160a01b038816927fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724928290030190a25050505050565b600081600160201b84106113175760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156112dc5781810151838201526020016112c4565b60408051808201909152600080825260208201529056fe4c65763a3a64656c656761746542795369673a207369676e617475726520657870697265644c65763a3a7065726d69743a20616d6f756e74206578636565647320393620626974734c65763a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e65644c65763a3a617070726f76653a20616d6f756e74206578636565647320393620626974734c65763a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e63654c65763a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e63654c65763a3a7472616e736665723a20616d6f756e74206578636565647320393620626974734c65763a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e7366657220746f20746865207a65726f20616464726573734c65763a3a64656c656761746542795369673a20696e76616c6964207369676e61747572654c65763a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f77735065726d69742861646472657373206f776e65722c61646472657373207370656e6465722c75696e743235362076616c75652c75696e74323536206e6f6e63652c75696e7432353620646561646c696e65294c65763a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773454950373132446f6d61696e28737472696e67206e616d652c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e7472616374294c65763a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f77734c65763a3a64656c656761746542795369673a20696e76616c6964206e6f6e63654c65763a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e736665722066726f6d20746865207a65726f206164647265737344656c65676174696f6e28616464726573732064656c6567617465652c75696e74323536206e6f6e63652c75696e7432353620657870697279294c65763a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473a265627a7a72315820b82636d1bad46015845ae35c6259357405f32e22fa793a249ba15209961bf45564736f6c63430005110032

Verified Source Code Partial Match

Compiler: v0.5.17+commit.d19bba13 EVM: istanbul Optimization: Yes (200 runs)
Lev.sol 482 lines
pragma solidity ^0.5.16;

// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, errorMessage);

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot underflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction underflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot underflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;
        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) { return 0;}
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {return 0;}
        uint256 c = a * b;
        require(c / a == b, errorMessage);
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers.
     * Reverts on division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers.
     * Reverts with custom message on division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

contract Lev {
    /// @notice EIP-20 token name for this token
    string public constant name = "Lever Token";
    /// @notice EIP-20 token symbol for this token
    string public constant symbol = "LEV";
    /// @notice EIP-20 token decimals for this token
    uint8 public constant decimals = 18;
    /// @notice Total number of tokens in circulation
    uint256 public totalSupply = 100_000_000e18;
    /// @notice Allowance amounts on behalf of others
    mapping(address => mapping(address => uint96)) internal allowances;
    /// @notice Official record of token balances for each account
    mapping(address => uint96) internal balances;
    /// @notice A record of each accounts delegate
    mapping(address => address) public delegates;
    /// @notice A checkpoint for marking number of votes from a given block
    struct Checkpoint {
        uint32 fromBlock;
        uint96 votes;
    }

    /// @notice A record of votes checkpoints for each account, by index
    mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;
    /// @notice The number of checkpoints for each account
    mapping(address => uint32) public numCheckpoints;
    /// @notice The EIP-712 typehash for the contract's domain
    bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
    /// @notice The EIP-712 typehash for the delegation struct used by the contract
    bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
    /// @notice The EIP-712 typehash for the permit struct used by the contract
    bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    /// @notice A record of states for signing / validating signatures
    mapping(address => uint256) public nonces;
    /// @notice An event thats emitted when an account changes its delegate
    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
    /// @notice An event thats emitted when a delegate account's vote balance changes
    event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
    /// @notice The standard EIP-20 transfer event
    event Transfer(address indexed from, address indexed to, uint256 amount);
    /// @notice The standard EIP-20 approval event
    event Approval(address indexed owner, address indexed spender, uint256 amount);
    /**
     * @notice Construct a new Lev token
     * @param account The initial account to grant all the tokens
     */
    constructor(address account) public {
        balances[account] = uint96(totalSupply);
        emit Transfer(address(0), account, totalSupply);
    }

    /**
     * @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
     * @param account The address of the account holding the funds
     * @param spender The address of the account spending the funds
     * @return The number of tokens approved
     */
    function allowance(address account, address spender) external view returns (uint256) {
        return allowances[account][spender];
    }

    /**
     * @notice Approve `spender` to transfer up to `amount` from `src`
     * @dev This will overwrite the approval amount for `spender`
     *  and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
     * @param spender The address of the account which may transfer tokens
     * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
     * @return Whether or not the approval succeeded
     */
    function approve(address spender, uint256 rawAmount) external returns (bool) {
        uint96 amount;
        if (rawAmount == uint256(-1)) {
            amount = uint96(-1);
        } else {
            amount = safe96(rawAmount, "Lev::approve: amount exceeds 96 bits");
        }
        allowances[msg.sender][spender] = amount;
        emit Approval(msg.sender, spender, amount);
        return true;
    }

    /**
     * @notice Triggers an approval from owner to spends
     * @param owner The address to approve from
     * @param spender The address to be approved
     * @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
     * @param deadline The time at which to expire the signature
     * @param v The recovery byte of the signature
     * @param r Half of the ECDSA signature pair
     * @param s Half of the ECDSA signature pair
     */
    function permit(address owner, address spender, uint256 rawAmount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
        uint96 amount;
        if (rawAmount == uint256(-1)) {
            amount = uint96(-1);
        } else {
            amount = safe96(rawAmount, "Lev::permit: amount exceeds 96 bits");
        }
        bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
        bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, rawAmount, nonces[owner]++, deadline));
        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
        address signatory = ecrecover(digest, v, r, s);
        require(signatory != address(0), "Lev::permit: invalid signature");
        require(signatory == owner, "Lev::permit: unauthorized");
        require(now <= deadline, "Lev::permit: signature expired");
        allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @notice Get the number of tokens held by the `account`
     * @param account The address of the account to get the balance of
     * @return The number of tokens held
     */
    function balanceOf(address account) external view returns (uint256) {
        return balances[account];
    }

    /**
     * @notice Transfer `amount` tokens from `msg.sender` to `dst`
     * @param dst The address of the destination account
     * @param rawAmount The number of tokens to transfer
     * @return Whether or not the transfer succeeded
     */
    function transfer(address dst, uint256 rawAmount) external returns (bool) {
        uint96 amount = safe96(rawAmount, "Lev::transfer: amount exceeds 96 bits");
        _transferTokens(msg.sender, dst, amount);
        return true;
    }

    /**
     * @notice Transfer `amount` tokens from `src` to `dst`
     * @param src The address of the source account
     * @param dst The address of the destination account
     * @param rawAmount The number of tokens to transfer
     * @return Whether or not the transfer succeeded
     */
    function transferFrom(address src, address dst, uint256 rawAmount) external returns (bool) {
        address spender = msg.sender;
        uint96 spenderAllowance = allowances[src][spender];
        uint96 amount = safe96(rawAmount, "Lev::approve: amount exceeds 96 bits");
        if (spender != src && spenderAllowance != uint96(-1)) {
            uint96 newAllowance = sub96(spenderAllowance, amount, "Lev::transferFrom: transfer amount exceeds spender allowance");
            allowances[src][spender] = newAllowance;
            emit Approval(src, spender, newAllowance);
        }
        _transferTokens(src, dst, amount);
        return true;
    }

    /**
     * @notice Delegate votes from `msg.sender` to `delegatee`
     * @param delegatee The address to delegate votes to
     */
    function delegate(address delegatee) public {
        return _delegate(msg.sender, delegatee);
    }

    /**
     * @notice Delegates votes from signatory to `delegatee`
     * @param delegatee The address to delegate votes to
     * @param nonce The contract state required to match the signature
     * @param expiry The time at which to expire the signature
     * @param v The recovery byte of the signature
     * @param r Half of the ECDSA signature pair
     * @param s Half of the ECDSA signature pair
     */
    function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) public {
        bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
        bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
        address signatory = ecrecover(digest, v, r, s);
        require(signatory != address(0), "Lev::delegateBySig: invalid signature");
        require(nonce == nonces[signatory]++, "Lev::delegateBySig: invalid nonce");
        require(now <= expiry, "Lev::delegateBySig: signature expired");
        return _delegate(signatory, delegatee);
    }

    /**
     * @notice Gets the current votes balance for `account`
     * @param account The address to get votes balance
     * @return The number of current votes for `account`
     */
    function getCurrentVotes(address account) external view returns (uint96) {
        uint32 nCheckpoints = numCheckpoints[account];
        return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
    }

    /**
     * @notice Determine the prior number of votes for an account as of a block number
     * @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
     * @param account The address of the account to check
     * @param blockNumber The block number to get the vote balance at
     * @return The number of votes the account had as of the given block
     */
    function getPriorVotes(address account, uint256 blockNumber) public view returns (uint96) {
        require(blockNumber < block.number, "Lev::getPriorVotes: not yet determined");
        uint32 nCheckpoints = numCheckpoints[account];
        if (nCheckpoints == 0) {return 0;}
        // First check most recent balance
        if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes;}
        // Next check implicit zero balance
        if (checkpoints[account][0].fromBlock > blockNumber) { return 0;}
        uint32 lower = 0;
        uint32 upper = nCheckpoints - 1;
        while (upper > lower) {
            uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
            Checkpoint memory cp = checkpoints[account][center];
            if (cp.fromBlock == blockNumber) {
                return cp.votes;
            } else if (cp.fromBlock < blockNumber) {
                lower = center;
            } else {
                upper = center - 1;
            }
        }
        return checkpoints[account][lower].votes;
    }

    function _delegate(address delegator, address delegatee) internal {
        address currentDelegate = delegates[delegator];
        uint96 delegatorBalance = balances[delegator];
        delegates[delegator] = delegatee;
        emit DelegateChanged(delegator, currentDelegate, delegatee);
        _moveDelegates(currentDelegate, delegatee, delegatorBalance);
    }

    function _transferTokens(address src, address dst, uint96 amount) internal {
        require(src != address(0), "Lev::_transferTokens: cannot transfer from the zero address");
        require(dst != address(0), "Lev::_transferTokens: cannot transfer to the zero address");
        balances[src] = sub96(balances[src], amount, "Lev::_transferTokens: transfer amount exceeds balance");
        balances[dst] = add96(balances[dst], amount, "Lev::_transferTokens: transfer amount overflows");
        emit Transfer(src, dst, amount);
        _moveDelegates(delegates[src], delegates[dst], amount);
    }

    function _moveDelegates(address srcRep, address dstRep, uint96 amount) internal {
        if (srcRep != dstRep && amount > 0) {
            if (srcRep != address(0)) {
                uint32 srcRepNum = numCheckpoints[srcRep];
                uint96 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
                uint96 srcRepNew = sub96(srcRepOld, amount, "Lev::_moveVotes: vote amount underflows" );
                _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
            }

            if (dstRep != address(0)) {
                uint32 dstRepNum = numCheckpoints[dstRep];
                uint96 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
                uint96 dstRepNew = add96(dstRepOld, amount, "Lev::_moveVotes: vote amount overflows");
                _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
            }
        }
    }

    function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes) internal {
        uint32 blockNumber = safe32(block.number, "Lev::_writeCheckpoint: block number exceeds 32 bits");
        if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
            checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
        } else {
            checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
            numCheckpoints[delegatee] = nCheckpoints + 1;
        }
        emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
    }

    function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) {
        require(n < 2**32, errorMessage);
        return uint32(n);
    }

    function safe96(uint256 n, string memory errorMessage) internal pure returns (uint96) {
        require(n < 2**96, errorMessage);
        return uint96(n);
    }

    function add96( uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
        uint96 c = a + b;
        require(c >= a, errorMessage);
        return c;
    }

    function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
        require(b <= a, errorMessage);
        return a - b;
    }

    function getChainId() internal pure returns (uint256) {
        uint256 chainId;
        assembly {
            chainId := chainid()
        }
        return chainId;
    }
}

Read Contract

DELEGATION_TYPEHASH 0xe7a324dc → bytes32
DOMAIN_TYPEHASH 0x20606b70 → bytes32
PERMIT_TYPEHASH 0x30adf81f → bytes32
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
checkpoints 0xf1127ed8 → uint32, uint96
decimals 0x313ce567 → uint8
delegates 0x587cde1e → address
getCurrentVotes 0xb4b5ea57 → uint96
getPriorVotes 0x782d6fe1 → uint96
name 0x06fdde03 → string
nonces 0x7ecebe00 → uint256
numCheckpoints 0x6fcfff45 → uint32
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256

Write Contract 6 functions

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

approve 0x095ea7b3
address spender
uint256 rawAmount
returns: bool
delegate 0x5c19a95c
address delegatee
delegateBySig 0xc3cda520
address delegatee
uint256 nonce
uint256 expiry
uint8 v
bytes32 r
bytes32 s
permit 0xd505accf
address owner
address spender
uint256 rawAmount
uint256 deadline
uint8 v
bytes32 r
bytes32 s
transfer 0xa9059cbb
address dst
uint256 rawAmount
returns: bool
transferFrom 0x23b872dd
address src
address dst
uint256 rawAmount
returns: bool

Recent Transactions

No transactions found for this address