Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0x2Ec3275f7aCe4044e499823F511cd58250be8E3d
Balance 0 ETH
Nonce 1
Code Size 7898 bytes
Indexed Transactions 0 (1 on-chain, 0.9% indexed)
External Etherscan · Sourcify

Contract Bytecode

7898 bytes
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80633950935111610097578063a457c2d711610066578063a457c2d714610278578063a9059cbb146102a8578063db006a75146102d8578063dd62ed3e146102f4576100f5565b806339509351146101f0578063591ba34f1461022057806370a082311461022a57806395d89b411461025a576100f5565b806318160ddd116100d357806318160ddd1461016657806323ac43841461018457806323b872dd146101a2578063313ce567146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806311dc99b314610148575b600080fd5b610102610324565b60405161010f9190611671565b60405180910390f35b610132600480360381019061012d91906112be565b6103b6565b60405161013f919061163b565b60405180910390f35b6101506103d4565b60405161015d9190611656565b60405180910390f35b61016e6103fa565b60405161017b9190611833565b60405180910390f35b61018c610404565b6040516101999190611833565b60405180910390f35b6101bc60048036038101906101b7919061126f565b61040a565b6040516101c9919061163b565b60405180910390f35b6101da61050b565b6040516101e7919061184e565b60405180910390f35b61020a600480360381019061020591906112be565b61051a565b604051610217919061163b565b60405180910390f35b6102286105c6565b005b610244600480360381019061023f919061120a565b61069e565b6040516102519190611833565b60405180910390f35b6102626106e6565b60405161026f9190611671565b60405180910390f35b610292600480360381019061028d91906112be565b610778565b60405161029f919061163b565b60405180910390f35b6102c260048036038101906102bd91906112be565b61086c565b6040516102cf919061163b565b60405180910390f35b6102f260048036038101906102ed9190611323565b61088a565b005b61030e60048036038101906103099190611233565b610adc565b60405161031b9190611833565b60405180910390f35b606060038054610333906119bb565b80601f016020809104026020016040519081016040528092919081815260200182805461035f906119bb565b80156103ac5780601f10610381576101008083540402835291602001916103ac565b820191906000526020600020905b81548152906001019060200180831161038f57829003601f168201915b5050505050905090565b60006103ca6103c3610b63565b8484610b6b565b6001905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600254905090565b60065481565b6000610417848484610d36565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610462610b63565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156104e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d990611753565b60405180910390fd5b6104ff856104ee610b63565b85846104fa91906118db565b610b6b565b60019150509392505050565b6000610515610fb5565b905090565b60006105bc610527610b63565b848460016000610535610b63565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105b79190611885565b610b6b565b6001905092915050565b600654421161060a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060190611733565b60405180910390fd5b61069c303073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161064791906115c0565b60206040518083038186803b15801561065f57600080fd5b505afa158015610673573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610697919061134c565b610fdd565b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546106f5906119bb565b80601f0160208091040260200160405190810160405280929190818152602001828054610721906119bb565b801561076e5780601f106107435761010080835404028352916020019161076e565b820191906000526020600020905b81548152906001019060200180831161075157829003601f168201915b5050505050905090565b60008060016000610787610b63565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610844576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083b90611813565b60405180910390fd5b61086161084f610b63565b85858461085c91906118db565b610b6b565b600191505092915050565b6000610880610879610b63565b8484610d36565b6001905092915050565b6006544211156108cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c690611773565b60405180910390fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b815260040161092e939291906115db565b602060405180830381600087803b15801561094857600080fd5b505af115801561095c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098091906112fa565b6109bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b6906117f3565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b81526004016109fa929190611612565b602060405180830381600087803b158015610a1457600080fd5b505af1158015610a28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4c91906112fa565b610a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a82906116f3565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167f222838db2794d11532d940e8dec38ae307ed0b63cd97c233322e221f998767a682604051610ad19190611833565b60405180910390a250565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd2906117d3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c42906116d3565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610d299190611833565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610da6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9d906117b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0d90611693565b60405180910390fd5b610e218383836111b1565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610ea7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9e90611713565b60405180910390fd5b8181610eb391906118db565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f439190611885565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610fa79190611833565b60405180910390a350505050565b60007f0000000000000000000000000000000000000000000000000000000000000008905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561104d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104490611793565b60405180910390fd5b611059826000836111b1565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156110df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d6906116b3565b60405180910390fd5b81816110eb91906118db565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816002600082825461113f91906118db565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111a49190611833565b60405180910390a3505050565b505050565b6000813590506111c581611e5f565b92915050565b6000815190506111da81611e76565b92915050565b6000813590506111ef81611e8d565b92915050565b60008151905061120481611e8d565b92915050565b60006020828403121561121c57600080fd5b600061122a848285016111b6565b91505092915050565b6000806040838503121561124657600080fd5b6000611254858286016111b6565b9250506020611265858286016111b6565b9150509250929050565b60008060006060848603121561128457600080fd5b6000611292868287016111b6565b93505060206112a3868287016111b6565b92505060406112b4868287016111e0565b9150509250925092565b600080604083850312156112d157600080fd5b60006112df858286016111b6565b92505060206112f0858286016111e0565b9150509250929050565b60006020828403121561130c57600080fd5b600061131a848285016111cb565b91505092915050565b60006020828403121561133557600080fd5b6000611343848285016111e0565b91505092915050565b60006020828403121561135e57600080fd5b600061136c848285016111f5565b91505092915050565b61137e8161190f565b82525050565b61138d81611921565b82525050565b61139c81611964565b82525050565b60006113ad82611869565b6113b78185611874565b93506113c7818560208601611988565b6113d081611a4b565b840191505092915050565b60006113e8602383611874565b91506113f382611a5c565b604082019050919050565b600061140b602283611874565b915061141682611aab565b604082019050919050565b600061142e602283611874565b915061143982611afa565b604082019050919050565b6000611451602d83611874565b915061145c82611b49565b604082019050919050565b6000611474602683611874565b915061147f82611b98565b604082019050919050565b6000611497602183611874565b91506114a282611be7565b604082019050919050565b60006114ba602883611874565b91506114c582611c36565b604082019050919050565b60006114dd601d83611874565b91506114e882611c85565b602082019050919050565b6000611500602183611874565b915061150b82611cae565b604082019050919050565b6000611523602583611874565b915061152e82611cfd565b604082019050919050565b6000611546602483611874565b915061155182611d4c565b604082019050919050565b6000611569604183611874565b915061157482611d9b565b606082019050919050565b600061158c602583611874565b915061159782611e10565b604082019050919050565b6115ab8161194d565b82525050565b6115ba81611957565b82525050565b60006020820190506115d56000830184611375565b92915050565b60006060820190506115f06000830186611375565b6115fd6020830185611375565b61160a60408301846115a2565b949350505050565b60006040820190506116276000830185611375565b61163460208301846115a2565b9392505050565b60006020820190506116506000830184611384565b92915050565b600060208201905061166b6000830184611393565b92915050565b6000602082019050818103600083015261168b81846113a2565b905092915050565b600060208201905081810360008301526116ac816113db565b9050919050565b600060208201905081810360008301526116cc816113fe565b9050919050565b600060208201905081810360008301526116ec81611421565b9050919050565b6000602082019050818103600083015261170c81611444565b9050919050565b6000602082019050818103600083015261172c81611467565b9050919050565b6000602082019050818103600083015261174c8161148a565b9050919050565b6000602082019050818103600083015261176c816114ad565b9050919050565b6000602082019050818103600083015261178c816114d0565b9050919050565b600060208201905081810360008301526117ac816114f3565b9050919050565b600060208201905081810360008301526117cc81611516565b9050919050565b600060208201905081810360008301526117ec81611539565b9050919050565b6000602082019050818103600083015261180c8161155c565b9050919050565b6000602082019050818103600083015261182c8161157f565b9050919050565b600060208201905061184860008301846115a2565b92915050565b600060208201905061186360008301846115b1565b92915050565b600081519050919050565b600082825260208201905092915050565b60006118908261194d565b915061189b8361194d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156118d0576118cf6119ed565b5b828201905092915050565b60006118e68261194d565b91506118f18361194d565b925082821015611904576119036119ed565b5b828203905092915050565b600061191a8261192d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061196f82611976565b9050919050565b60006119818261192d565b9050919050565b60005b838110156119a657808201518184015260208101905061198b565b838111156119b5576000848401525b50505050565b600060028204905060018216806119d357607f821691505b602082108114156119e7576119e6611a1c565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f7478206661696c656420647572696e6720617474656d70746564207472616e7360008201527f66657220746f2073656e64657200000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f72656465656d61626c6520706572696f6420686173206e6f742065787069726560008201527f6400000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f72656465656d61626c6520706572696f64206861732065787069726564000000600082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f7478206661696c656420647572696e6720617474656d70746564207472616e7360008201527f6665722066726f6d20737761707061626c6520746f6b656e20636f6e7472616360208201527f7400000000000000000000000000000000000000000000000000000000000000604082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b611e688161190f565b8114611e7357600080fd5b50565b611e7f81611921565b8114611e8a57600080fd5b50565b611e968161194d565b8114611ea157600080fd5b5056fea264697066735822122037b8ef37358a656b237ef0ddf283acda2828075e607c0d63d752cd1d38274da264736f6c63430008020033

Verified Source Code Partial Match

Compiler: v0.8.2+commit.661d1103 EVM: istanbul Optimization: No
PrivilegeERC20.sol 515 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
  /**
    * @dev Returns the amount of tokens in existence.
    */
  function totalSupply() external view returns (uint256);

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

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

  /**
    * @dev Returns the remaining number of tokens that `spender` will be
    * allowed to spend on behalf of `owner` through {transferFrom}. This is
    * zero by default.
    *
    * This value changes when {approve} or {transferFrom} are called.
    */
  function allowance(address owner, address spender) external view returns (uint256);

  /**
    * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
    *
    * Returns a boolean value indicating whether the operation succeeded.
    *
    * IMPORTANT: Beware that changing an allowance with this method brings the risk
    * that someone may use both the old and the new allowance by unfortunate
    * transaction ordering. One possible solution to mitigate this race
    * condition is to first reduce the spender's allowance to 0 and set the
    * desired value afterwards:
    * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
    *
    * Emits an {Approval} event.
    */
  function approve(address spender, uint256 amount) external returns (bool);

  /**
    * @dev Moves `amount` tokens from `sender` to `recipient` using the
    * allowance mechanism. `amount` is then deducted from the caller's
    * allowance.
    *
    * Returns a boolean value indicating whether the operation succeeded.
    *
    * Emits a {Transfer} event.
    */
  function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

  /**
    * @dev Emitted when `value` tokens are moved from one account (`from`) to
    * another (`to`).
    *
    * Note that `value` may be zero.
    */
  event Transfer(address indexed from, address indexed to, uint256 value);

  /**
    * @dev Emitted when the allowance of a `spender` for an `owner` is set by
    * a call to {approve}. `value` is the new allowance.
    */
  event Approval(address indexed owner, address indexed spender, uint256 value);
}

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

/*
 * @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) {
    this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
    return msg.data;
  }
}

/**
 * @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 guidelines: functions revert instead
 * of 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 defaut 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");
    _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");
    _approve(_msgSender(), spender, currentAllowance - subtractedValue);

    return true;
  }

  /**
    * @dev Moves tokens `amount` from `sender` to `recipient`.
    *
    * This is 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");
    _balances[sender] = senderBalance - amount;
    _balances[recipient] += amount;

    emit Transfer(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:
    *
    * - `to` 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);
  }

  /**
    * @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");
    _balances[account] = accountBalance - amount;
    _totalSupply -= amount;

    emit Transfer(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 to 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 { }
}

/**
 * @title ERC20Decimals
 * @dev Implementation of the ERC20Decimals. Extension of {ERC20} that adds decimals storage slot.
 */
abstract contract ERC20Decimals is ERC20 {
  uint8 immutable private _decimals;

  /**
    * @dev Sets the value of the `decimals`. This value is immutable, it can only be
    * set once during construction.
    */
  constructor (uint8 decimals_) {
    _decimals = decimals_;
  }

  function decimals() public view virtual override returns (uint8) {
    return _decimals;
  }
}

/**
 * @title PrivilegeERC20
 * @dev Implementation of the PRVG ("Privilege") ERC20 token contract
 * with facilities for redeeming the configured ERC20 token for an
 * equivalent amount of PRVG "Privilege" token.
 *
 * All 150,000,000 UBT can be approved and redeemed by calling `redeem(uint256 amount)`
 * prior to July 4, 2022 when the redeemable period expires. Any PRVG
 * which remain unredeemed by the outstanding circulating supply of UBT as
 * of July 4, 2022 will be burned.
 *
 * PRVG is required to make use of the permissionless provide.network.
 */
contract PrivilegeERC20 is ERC20Decimals {

  /**
   * @dev Emitted when `amount` of redeemable ERC20 tokens are exchanged
   * for the equivalent number of ERC20 tokens allocated as part of the
   * underlying `totalSupply` of this token contract.
   */
  event Redeem(address indexed sender, uint256 amount);

  // ERC20 token address of the redeemable token
  IERC20 public redeemableToken;

  // Expiry timestamp at which no further ERC20 token redemptions will be processed and the
  // unclaimed balance of the underlying `totalSupply` of this token contract will be burned
  uint256 public redemptionExpiryTimestamp;

  constructor (address _redeemableToken, uint256 _expiry)
    ERC20("Privilege", "PRVG")
    ERC20Decimals(8)
  {
    redeemableToken = IERC20(_redeemableToken);

    require(_expiry > block.timestamp + 2592000 seconds); // 1 month minimum redemption period
    redemptionExpiryTimestamp = _expiry;

    uint256 _totalSupply = 20000000000000000;
    _mint(address(this), redeemableToken.totalSupply());
    _mint(msg.sender, _totalSupply - redeemableToken.totalSupply());
  }

  /// @dev require the contract call to occur after the redeemable period
  modifier afterRedeemablePeriod() {
    require(block.timestamp > redemptionExpiryTimestamp, "redeemable period has not expired");
    _;
  }

  /// @dev require the contract call to occur during the redeemable period
  modifier duringRedeemablePeriod() {
    require(block.timestamp <= redemptionExpiryTimestamp, "redeemable period has expired");
    _;
  }

  /**
   * @dev Burn the unclaimed portion of the `totalSupply` of the underlying
   * token contract after the redeemable period has ended
   */
  function burnUnredeemed() external afterRedeemablePeriod {
    _burn(address(this), this.balanceOf(address(this)));
  }

  function decimals() public view virtual override returns (uint8) {
    return super.decimals();
  }

  /**
   * @dev Redeem the given `amount` of redeemable ERC20 tokens 1:1 for
   * PRVG and "burn" the redeemable token by transferring and forever
   * locking it up in this underlying token contract.
   */
  function redeem(uint256 amount) external duringRedeemablePeriod {
    require(redeemableToken.transferFrom(msg.sender, address(this), amount), "tx failed during attempted transfer from swappable token contract");
    require(this.transfer(msg.sender, amount), "tx failed during attempted transfer to sender");
    emit Redeem(msg.sender, amount);
  }
}

Read Contract

allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
name 0x06fdde03 → string
redeemableToken 0x11dc99b3 → address
redemptionExpiryTimestamp 0x23ac4384 → uint256
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256

Write Contract 7 functions

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

approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burnUnredeemed 0x591ba34f
No parameters
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
redeem 0xdb006a75
uint256 amount
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool

Recent Transactions

This address has 1 on-chain transactions, but only 0.9% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →