Polygon Sponsored slots available. Book your slot here!
ERC-20
DeFi
Overview
Max Total Supply
13,655,809.767668399041583316 oRETRO
Holders
1,207 (0.00%)
Total Transfers
-
Market
Price
$0.00 @ 0.000000 POL
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Loading...
Loading
Loading...
Loading
Loading...
Loading
Contract Name:
OptionTokenV2
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 100 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.8.13; import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {IRetro} from "./interfaces/IRetro.sol"; import {IVotingEscrow} from "./interfaces/IVotingEscrow.sol"; import {IUniswapV3Twap} from "./interfaces/IUniswapV3Twap.sol"; import {IOptionFeeDistributor} from "./interfaces/IOptionFeeDistributor.sol"; /// @title Option Token /// @notice Option token representing the right to purchase the underlying token /// at TWAP reduced rate. Similar to call options but with a variable strike /// price that's always at a certain discount to the market price. /// @dev Assumes the underlying token and the payment token both use 18 decimals and revert on // failure to transfer. contract OptionTokenV2 is ERC20, AccessControl { /// ----------------------------------------------------------------------- /// Constants /// ----------------------------------------------------------------------- uint256 public constant MAX_DISCOUNT = 100; // 100% uint256 public constant MIN_DISCOUNT = 0; // 0% uint256 public constant MAX_TWAP_SECONDS = 86400; // 2 days uint256 public constant FULL_LOCK = 2 * 365 * 86400; // 2 years /// ----------------------------------------------------------------------- /// Roles /// ----------------------------------------------------------------------- /// @dev The identifier of the role which maintains other roles and settings bytes32 public constant ADMIN_ROLE = keccak256("ADMIN"); /// @dev The identifier of the role which is allowed to mint options token bytes32 public constant MINTER_ROLE = keccak256("MINTER"); /// @dev The identifier of the role which allows accounts to pause execrcising options /// in case of emergency bytes32 public constant PAUSER_ROLE = keccak256("PAUSER"); /// ----------------------------------------------------------------------- /// Errors /// ----------------------------------------------------------------------- error OptionToken_PastDeadline(); error OptionToken_NoAdminRole(); error OptionToken_NoMinterRole(); error OptionToken_NoPauserRole(); error OptionToken_SlippageTooHigh(); error OptionToken_InvalidDiscount(); error OptionToken_Paused(); error OptionToken_InvalidTwapSeconds(); error OptionToken_IncorrectPairToken(); /// ----------------------------------------------------------------------- /// Events /// ----------------------------------------------------------------------- event Exercise( address indexed sender, address indexed recipient, uint256 amount, uint256 paymentAmount ); event ExerciseVe( address indexed sender, address indexed recipient, uint256 amount, uint256 paymentAmount, uint256 nftId ); event SetTwapOracleAndPaymentToken( IUniswapV3Twap indexed _twapOracle, address indexed _paymentToken ); event SetFeeDistributor(IOptionFeeDistributor indexed newFeeDistributor); event SetDiscount(uint256 discount); event SetVeDiscount(uint256 veDiscount); event PauseStateChanged(bool isPaused); event SetTwapSeconds(uint32 twapSeconds); /// ----------------------------------------------------------------------- /// Immutable parameters /// ----------------------------------------------------------------------- /// @notice The token paid by the options token holder during redemption ERC20 public paymentToken; /// @notice The underlying token purchased during redemption ERC20 public immutable underlyingToken; /// @notice The voting escrow for locking FLOW to veFLOR address public votingEscrow; /// ----------------------------------------------------------------------- /// Storage variables /// ----------------------------------------------------------------------- /// @notice The oracle contract that provides the current TWAP price to purchase /// the underlying token while exercising options (the strike price) IUniswapV3Twap public twapOracle; /// @notice The contract that receives the payment tokens when options are exercised IOptionFeeDistributor public feeDistributor; /// @notice the discount given during exercising. 30 = user pays 30% uint256 public discount; /// @notice the further discount for locking to veFLOW uint256 public veDiscount; /// @notice controls the duration of the twap used to calculate the strike price // each point represents 30 minutes. 4 points = 2 hours uint32 public twapSeconds = 60 * 30 * 4; /// @notice Is excersizing options currently paused bool public isPaused; /// ----------------------------------------------------------------------- /// Modifiers /// ----------------------------------------------------------------------- /// @dev A modifier which checks that the caller has the admin role. modifier onlyAdmin() { if (!hasRole(ADMIN_ROLE, msg.sender)) revert OptionToken_NoAdminRole(); _; } /// @dev A modifier which checks that the caller has the admin role. modifier onlyMinter() { if ( !hasRole(ADMIN_ROLE, msg.sender) && !hasRole(MINTER_ROLE, msg.sender) ) revert OptionToken_NoMinterRole(); _; } /// @dev A modifier which checks that the caller has the pause role. modifier onlyPauser() { if (!hasRole(PAUSER_ROLE, msg.sender)) revert OptionToken_NoPauserRole(); _; } /// ----------------------------------------------------------------------- /// Constructor /// ----------------------------------------------------------------------- constructor( string memory _name, string memory _symbol, address _admin, ERC20 _paymentToken, ERC20 _underlyingToken, IUniswapV3Twap _twapOracle, IOptionFeeDistributor _feeDistributor, uint256 _discount, uint256 _veDiscount, address _votingEscrow ) ERC20(_name, _symbol) { _grantRole(ADMIN_ROLE, _admin); _grantRole(PAUSER_ROLE, _admin); _setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE); _setRoleAdmin(MINTER_ROLE, ADMIN_ROLE); _setRoleAdmin(PAUSER_ROLE, ADMIN_ROLE); paymentToken = _paymentToken; underlyingToken = _underlyingToken; twapOracle = _twapOracle; feeDistributor = _feeDistributor; discount = _discount; veDiscount = _veDiscount; votingEscrow = _votingEscrow; paymentToken.approve(address(_feeDistributor), type(uint256).max); emit SetTwapOracleAndPaymentToken(_twapOracle, address(_paymentToken)); emit SetFeeDistributor(_feeDistributor); emit SetDiscount(_discount); emit SetVeDiscount(_veDiscount); } /// ----------------------------------------------------------------------- /// External functions /// ----------------------------------------------------------------------- /// @notice Exercises options tokens to purchase the underlying tokens. /// @dev The oracle may revert if it cannot give a secure result. /// @param _amount The amount of options tokens to exercise /// @param _maxPaymentAmount The maximum acceptable amount to pay. Used for slippage protection. /// @param _recipient The recipient of the purchased underlying tokens /// @return The amount paid to the fee distributor to purchase the underlying tokens function exercise( uint256 _amount, uint256 _maxPaymentAmount, address _recipient ) external returns (uint256) { return _exercise(_amount, _maxPaymentAmount, _recipient); } /// @notice Exercises options tokens to purchase the underlying tokens. /// @dev The oracle may revert if it cannot give a secure result. /// @param _amount The amount of options tokens to exercise /// @param _maxPaymentAmount The maximum acceptable amount to pay. Used for slippage protection. /// @param _recipient The recipient of the purchased underlying tokens /// @param _deadline The Unix timestamp (in seconds) after which the call will revert /// @return The amount paid to the fee distributor to purchase the underlying tokens function exercise( uint256 _amount, uint256 _maxPaymentAmount, address _recipient, uint256 _deadline ) external returns (uint256) { if (block.timestamp > _deadline) revert OptionToken_PastDeadline(); return _exercise(_amount, _maxPaymentAmount, _recipient); } /// @notice Exercises options tokens to purchase the underlying tokens. /// @dev The oracle may revert if it cannot give a secure result. /// @param _amount The amount of options tokens to exercise /// @param _maxPaymentAmount The maximum acceptable amount to pay. Used for slippage protection. /// @param _recipient The recipient of the purchased underlying tokens /// @param _deadline The Unix timestamp (in seconds) after which the call will revert /// @return The amount paid to the fee distributor to purchase the underlying tokens function exerciseVe( uint256 _amount, uint256 _maxPaymentAmount, address _recipient, uint256 _deadline ) external returns (uint256, uint256) { if (block.timestamp > _deadline) revert OptionToken_PastDeadline(); return _exerciseVe(_amount, _maxPaymentAmount, _recipient); } /// ----------------------------------------------------------------------- /// Public functions /// ----------------------------------------------------------------------- /// @notice Returns the discounted price in paymentTokens for a given amount of options tokens /// @param _amount The amount of options tokens to exercise /// @return The amount of payment tokens to pay to purchase the underlying tokens function getDiscountedPrice(uint256 _amount) public view returns (uint256) { return (getTimeWeightedAveragePrice(_amount) * discount) / 100; } /// @notice Returns the discounted price in paymentTokens for a given amount of options tokens redeemed to veFLOW /// @param _amount The amount of options tokens to exercise /// @return The amount of payment tokens to pay to purchase the underlying tokens function getVeDiscountedPrice( uint256 _amount ) public view returns (uint256) { return (getTimeWeightedAveragePrice(_amount) * veDiscount) / 100; } /// @notice Returns the average price in payment tokens over period defined in twapSeconds for a given amount of underlying tokens /// @param _amount The amount of underlying tokens to purchase /// @return The amount of payment tokens function getTimeWeightedAveragePrice( uint256 _amount ) public view returns (uint256) { return twapOracle.estimateAmountOut( address(underlyingToken), uint128(_amount), twapSeconds ); } /// ----------------------------------------------------------------------- /// Admin functions /// ----------------------------------------------------------------------- function addGaugeFactory(address _gaugeFactory) public onlyAdmin { _grantRole(ADMIN_ROLE, _gaugeFactory); } /// @notice Sets the twap oracle contract address. /// @param _twapOracle The new twap oracle contract address function setTwapOracleAndPaymentToken( IUniswapV3Twap _twapOracle, address _paymentToken ) external onlyAdmin { if ( !((_twapOracle.token0() == _paymentToken && _twapOracle.token1() == address(underlyingToken)) || (_twapOracle.token0() == address(underlyingToken) && _twapOracle.token1() == _paymentToken)) ) revert OptionToken_IncorrectPairToken(); twapOracle = _twapOracle; paymentToken = ERC20(_paymentToken); paymentToken.approve(address(feeDistributor), type(uint256).max); emit SetTwapOracleAndPaymentToken(_twapOracle, _paymentToken); } /// @notice Sets the fee distributor. Only callable by the admin. /// @param _feeDistributor The new fee distributor. function setFeeDistributor( IOptionFeeDistributor _feeDistributor ) external onlyAdmin { feeDistributor = _feeDistributor; paymentToken.approve(address(_feeDistributor), type(uint256).max); emit SetFeeDistributor(_feeDistributor); } /// @notice Sets the discount amount. Only callable by the admin. /// @param _discount The new discount amount. function setDiscount(uint256 _discount) external onlyAdmin { if (_discount > MAX_DISCOUNT || _discount == MIN_DISCOUNT) revert OptionToken_InvalidDiscount(); discount = _discount; emit SetDiscount(_discount); } /// @notice Sets the further discount amount for locking. Only callable by the admin. /// @param _veDiscount The new discount amount. function setVeDiscount(uint256 _veDiscount) external onlyAdmin { if (_veDiscount > MAX_DISCOUNT || _veDiscount == MIN_DISCOUNT) revert OptionToken_InvalidDiscount(); veDiscount = _veDiscount; emit SetVeDiscount(_veDiscount); } /// @notice Sets the twap seconds to control the length of our twap /// @param _twapSeconds The new twap points. function setTwapSeconds(uint32 _twapSeconds) external onlyAdmin { if (_twapSeconds > MAX_TWAP_SECONDS || _twapSeconds == 0) revert OptionToken_InvalidTwapSeconds(); twapSeconds = _twapSeconds; emit SetTwapSeconds(_twapSeconds); } /// @notice Called by the admin to mint options tokens. Admin must grant token approval. /// @param _to The address that will receive the minted options tokens /// @param _amount The amount of options tokens that will be minted function mint(address _to, uint256 _amount) external onlyMinter { // transfer underlying tokens from the caller underlyingToken.transferFrom(msg.sender, address(this), _amount); // BLOTR reverts on failure // mint options tokens _mint(_to, _amount); } /// @notice Called by the admin to burn options tokens and transfer underlying tokens to the caller. /// @param _amount The amount of options tokens that will be burned and underlying tokens transferred to the caller function burn(uint256 _amount) external onlyAdmin { // transfer underlying tokens to the caller underlyingToken.transfer(msg.sender, _amount); // BLOTR reverts on failure // burn option tokens _burn(msg.sender, _amount); } /// @notice called by the admin to re-enable option exercising from a paused state. function unPause() external onlyAdmin { if (!isPaused) return; isPaused = false; emit PauseStateChanged(false); } /// ----------------------------------------------------------------------- /// Pauser functions /// ----------------------------------------------------------------------- function pause() external onlyPauser { if (isPaused) return; isPaused = true; emit PauseStateChanged(true); } /// ----------------------------------------------------------------------- /// Internal functions /// ----------------------------------------------------------------------- function _exercise( uint256 _amount, uint256 _maxPaymentAmount, address _recipient ) internal returns (uint256 paymentAmount) { if (isPaused) revert OptionToken_Paused(); // burn callers tokens _burn(msg.sender, _amount); paymentAmount = getDiscountedPrice(_amount); if (paymentAmount > _maxPaymentAmount) revert OptionToken_SlippageTooHigh(); // transfer payment tokens from msg.sender to the fee distributor paymentToken.transferFrom(msg.sender, address(this), paymentAmount); feeDistributor.distribute(address(paymentToken), paymentAmount); // send underlying tokens to recipient underlyingToken.transfer(_recipient, _amount); // will revert on failure emit Exercise(msg.sender, _recipient, _amount, paymentAmount); } function _exerciseVe( uint256 _amount, uint256 _maxPaymentAmount, address _recipient ) internal returns (uint256 paymentAmount, uint256 nftId) { if (isPaused) revert OptionToken_Paused(); // burn callers tokens _burn(msg.sender, _amount); paymentAmount = getVeDiscountedPrice(_amount); if (paymentAmount > _maxPaymentAmount) revert OptionToken_SlippageTooHigh(); // transfer payment tokens from msg.sender to the fee distributor paymentToken.transferFrom(msg.sender, address(this), paymentAmount); feeDistributor.distribute(address(paymentToken), paymentAmount); // lock underlying tokens to veFLOW underlyingToken.approve(votingEscrow, _amount); nftId = IVotingEscrow(votingEscrow).create_lock_for( _amount, FULL_LOCK, _recipient ); emit ExerciseVe(msg.sender, _recipient, _amount, paymentAmount, nftId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * 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: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, 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}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, 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}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, 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) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, 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) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, 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; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _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; // Overflow not possible: amount <= accountBalance <= totalSupply. _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 Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - 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 {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the 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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
interface IOptionFeeDistributor { function distribute(address token, uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; interface IRetro { function totalSupply() external view returns (uint); function balanceOf(address) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address, uint) external returns (bool); function transferFrom(address,address,uint) external returns (bool); function mint(address, uint) external returns (bool); function minter() external returns (address); function setMinter(address) external; }
// SPDX-License-Identifier: MIT interface IUniswapV3Twap { function token0() external view returns (address); function token1() external view returns (address); function pool() external view returns (address); function estimateAmountOut( address tokenIn, uint128 amountIn, uint32 secondsAgo ) external view returns (uint amountOut); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; interface IVotingEscrow { struct Point { int128 bias; int128 slope; // # -dweight / dt uint256 ts; uint256 blk; // block } struct LockedBalance { int128 amount; uint end; } function create_lock_for(uint _value, uint _lock_duration, address _to) external returns (uint); function locked(uint id) external view returns(LockedBalance memory); function tokenOfOwnerByIndex(address _owner, uint _tokenIndex) external view returns (uint); function token() external view returns (address); function team() external returns (address); function epoch() external view returns (uint); function point_history(uint loc) external view returns (Point memory); function user_point_history(uint tokenId, uint loc) external view returns (Point memory); function user_point_epoch(uint tokenId) external view returns (uint); function ownerOf(uint) external view returns (address); function isApprovedOrOwner(address, uint) external view returns (bool); function transferFrom(address, address, uint) external; function voted(uint) external view returns (bool); function attachments(uint) external view returns (uint); function voting(uint tokenId) external; function abstain(uint tokenId) external; function attach(uint tokenId) external; function detach(uint tokenId) external; function checkpoint() external; function deposit_for(uint tokenId, uint value) external; function balanceOfNFT(uint _id) external view returns (uint); function balanceOf(address _owner) external view returns (uint); function totalSupply() external view returns (uint); function supply() external view returns (uint); function balanceOfNFTAt(uint _tokenId, uint _t) external view returns (uint); function decimals() external view returns(uint8); }
{ "optimizer": { "enabled": true, "runs": 100 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_admin","type":"address"},{"internalType":"contract ERC20","name":"_paymentToken","type":"address"},{"internalType":"contract ERC20","name":"_underlyingToken","type":"address"},{"internalType":"contract IUniswapV3Twap","name":"_twapOracle","type":"address"},{"internalType":"contract IOptionFeeDistributor","name":"_feeDistributor","type":"address"},{"internalType":"uint256","name":"_discount","type":"uint256"},{"internalType":"uint256","name":"_veDiscount","type":"uint256"},{"internalType":"address","name":"_votingEscrow","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"OptionToken_IncorrectPairToken","type":"error"},{"inputs":[],"name":"OptionToken_InvalidDiscount","type":"error"},{"inputs":[],"name":"OptionToken_InvalidTwapSeconds","type":"error"},{"inputs":[],"name":"OptionToken_NoAdminRole","type":"error"},{"inputs":[],"name":"OptionToken_NoMinterRole","type":"error"},{"inputs":[],"name":"OptionToken_NoPauserRole","type":"error"},{"inputs":[],"name":"OptionToken_PastDeadline","type":"error"},{"inputs":[],"name":"OptionToken_Paused","type":"error"},{"inputs":[],"name":"OptionToken_SlippageTooHigh","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paymentAmount","type":"uint256"}],"name":"Exercise","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"paymentAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"ExerciseVe","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"PauseStateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"discount","type":"uint256"}],"name":"SetDiscount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IOptionFeeDistributor","name":"newFeeDistributor","type":"address"}],"name":"SetFeeDistributor","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IUniswapV3Twap","name":"_twapOracle","type":"address"},{"indexed":true,"internalType":"address","name":"_paymentToken","type":"address"}],"name":"SetTwapOracleAndPaymentToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"twapSeconds","type":"uint32"}],"name":"SetTwapSeconds","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"veDiscount","type":"uint256"}],"name":"SetVeDiscount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FULL_LOCK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DISCOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TWAP_SECONDS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DISCOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_gaugeFactory","type":"address"}],"name":"addGaugeFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"discount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_maxPaymentAmount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"exercise","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_maxPaymentAmount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"exercise","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_maxPaymentAmount","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"exerciseVe","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeDistributor","outputs":[{"internalType":"contract IOptionFeeDistributor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"getDiscountedPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"getTimeWeightedAveragePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"getVeDiscountedPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paymentToken","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_discount","type":"uint256"}],"name":"setDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOptionFeeDistributor","name":"_feeDistributor","type":"address"}],"name":"setFeeDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IUniswapV3Twap","name":"_twapOracle","type":"address"},{"internalType":"address","name":"_paymentToken","type":"address"}],"name":"setTwapOracleAndPaymentToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_twapSeconds","type":"uint32"}],"name":"setTwapSeconds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_veDiscount","type":"uint256"}],"name":"setVeDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"twapOracle","outputs":[{"internalType":"contract IUniswapV3Twap","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"twapSeconds","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlyingToken","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"veDiscount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"votingEscrow","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a0604052600c805463ffffffff1916611c201790553480156200002257600080fd5b5060405162002d6c38038062002d6c83398101604081905262000045916200058a565b89518a908a906200005e906003906020850190620003fa565b50805162000074906004906020840190620003fa565b5050506200009860008051602062002d4c833981519152896200030a60201b60201c565b620000c47f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c896200030a565b620000df60008051602062002d4c83398151915280620003af565b6200011a7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc960008051602062002d4c833981519152620003af565b620001557f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c60008051602062002d4c833981519152620003af565b600680546001600160a01b03199081166001600160a01b038a8116918217909355888316608052600880548316898516179055600980548316888516908117909155600a879055600b869055600780549093169385169390931790915560405163095ea7b360e01b8152600481019290925260001960248301529063095ea7b3906044016020604051808303816000875af1158015620001f9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200021f919062000679565b50866001600160a01b0316856001600160a01b03167f7f370f2de1cd2717bdbbc346dcc22685e89a2910ae17352a0a57b75b817c3c2c60405160405180910390a36040516001600160a01b038516907f9e9a9a4a82acd1b28aab6bf1d43aad70ae6d290549c0d6183e2e91ebcdf5744190600090a26040518381527ff247e4dd947ab13ba6c46412e403447a26e67109ba13945a20e3170e9acef8839060200160405180910390a16040518281527f88bde7c07a2800f63dadeaab0c0dca2f3792c92736de0f8e6f89954bb0f3c7df9060200160405180910390a150505050505050505050620006e0565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff16620003ab5760008281526005602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200036a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600082815260056020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b8280546200040890620006a4565b90600052602060002090601f0160209004810192826200042c576000855562000477565b82601f106200044757805160ff191683800117855562000477565b8280016001018555821562000477579182015b82811115620004775782518255916020019190600101906200045a565b506200048592915062000489565b5090565b5b808211156200048557600081556001016200048a565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620004c857600080fd5b81516001600160401b0380821115620004e557620004e5620004a0565b604051601f8301601f19908116603f01168101908282118183101715620005105762000510620004a0565b816040528381526020925086838588010111156200052d57600080fd5b600091505b8382101562000551578582018301518183018401529082019062000532565b83821115620005635760008385830101525b9695505050505050565b80516001600160a01b03811681146200058557600080fd5b919050565b6000806000806000806000806000806101408b8d031215620005ab57600080fd5b8a516001600160401b0380821115620005c357600080fd5b620005d18e838f01620004b6565b9b5060208d0151915080821115620005e857600080fd5b50620005f78d828e01620004b6565b9950506200060860408c016200056d565b97506200061860608c016200056d565b96506200062860808c016200056d565b95506200063860a08c016200056d565b94506200064860c08c016200056d565b935060e08b015192506101008b01519150620006686101208c016200056d565b90509295989b9194979a5092959850565b6000602082840312156200068c57600080fd5b815180151581146200069d57600080fd5b9392505050565b600181811c90821680620006b957607f821691505b602082108103620006da57634e487b7160e01b600052602260045260246000fd5b50919050565b60805161261f6200072d6000396000818161038301528181610a4001528181610b13015281816110c00152818161115d0152818161138901528181611bf40152611ea4015261261f6000f3fe608060405234801561001057600080fd5b50600436106102b65760003560e01c80636e180f6a11610172578063b187bd26116100d9578063dd62ed3e11610092578063dd62ed3e14610637578063de87db2f1461064a578063e1dbffb31461065d578063e349556914610670578063e63ab1e914610678578063e8772bb21461069f578063f7b188a5146106b257600080fd5b8063b187bd26146105b0578063ccfc2e8d146105c4578063d5391393146105d7578063d547741f146105fe578063d6379b7214610611578063dabd27191461062457600080fd5b806391d148541161012b57806391d148541461055c57806395d89b411461056f578063a1d50c3a14610577578063a217fddf146103ba578063a457c2d71461058a578063a9059cbb1461059d57600080fd5b80636e180f6a146104e657806370a08231146104f957806375b238fc146105225780638447120b146105375780638456cb59146105415780639043292a1461054957600080fd5b8063313ce5671161022157806342966c68116101da57806342966c68146104565780634b85f96c146104695780634f2bfe5b1461048e57806351217cbe146104a157806354cb0384146104aa57806362994c05146104b55780636b6f4a9d146104dd57600080fd5b8063313ce567146103e8578063339ccade146103f757806336568abe1461040a57806338f121521461041d578063395093511461043057806340c10f191461044357600080fd5b8063248a9ca311610273578063248a9ca31461035b5780632495a5991461037e578063293c5d43146103a55780632ac8a92c146103ba5780632f2ff15d146103c25780633013ce29146103d557600080fd5b806301ffc9a7146102bb57806306fdde03146102e3578063095ea7b3146102f85780630d43e8ad1461030b57806318160ddd1461033657806323b872dd14610348575b600080fd5b6102ce6102c936600461217c565b6106ba565b60405190151581526020015b60405180910390f35b6102eb6106f1565b6040516102da91906121d2565b6102ce61030636600461221a565b610783565b60095461031e906001600160a01b031681565b6040516001600160a01b0390911681526020016102da565b6002545b6040519081526020016102da565b6102ce610356366004612246565b61079b565b61033a610369366004612287565b60009081526005602052604090206001015490565b61031e7f000000000000000000000000000000000000000000000000000000000000000081565b6103b86103b33660046122a0565b6107bf565b005b61033a600081565b6103b86103d03660046122c6565b61087c565b60065461031e906001600160a01b031681565b604051601281526020016102da565b61033a610405366004612287565b6108a6565b6103b86104183660046122c6565b6108ca565b6103b861042b3660046122f6565b61094d565b6102ce61043e36600461221a565b61099d565b6103b861045136600461221a565b6109bf565b6103b8610464366004612287565b610ac7565b600c546104799063ffffffff1681565b60405163ffffffff90911681526020016102da565b60075461031e906001600160a01b031681565b61033a600b5481565b61033a6303c2670081565b6104c86104c3366004612313565b610b98565b604080519283526020830191909152016102da565b61033a600a5481565b61033a6104f4366004612287565b610bd4565b61033a6105073660046122f6565b6001600160a01b031660009081526020819052604090205490565b61033a6000805160206125aa83398151915281565b61033a6201518081565b6103b8610be4565b60085461031e906001600160a01b031681565b6102ce61056a3660046122c6565b610c88565b6102eb610cb3565b61033a610585366004612313565b610cc2565b6102ce61059836600461221a565b610cf9565b6102ce6105ab36600461221a565b610d74565b600c546102ce90600160201b900460ff1681565b6103b86105d23660046122f6565b610d82565b61033a7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b6103b861060c3660046122c6565b610e7d565b61033a61061f366004612352565b610ea2565b6103b8610632366004612287565b610eb7565b61033a61064536600461238b565b610f4c565b6103b8610658366004612287565b610f77565b6103b861066b36600461238b565b61100c565b61033a606481565b61033a7f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c81565b61033a6106ad366004612287565b61136c565b6103b861141d565b60006001600160e01b03198216637965db0b60e01b14806106eb57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060038054610700906123b9565b80601f016020809104026020016040519081016040528092919081815260200182805461072c906123b9565b80156107795780601f1061074e57610100808354040283529160200191610779565b820191906000526020600020905b81548152906001019060200180831161075c57829003601f168201915b5050505050905090565b6000336107918185856114a3565b5060019392505050565b6000336107a98582856115c7565b6107b4858585611641565b506001949350505050565b6107d76000805160206125aa83398151915233610c88565b6107f45760405163f982dd0f60e01b815260040160405180910390fd5b620151808163ffffffff16118061080f575063ffffffff8116155b1561082d57604051634b3cbe9f60e01b815260040160405180910390fd5b600c805463ffffffff191663ffffffff83169081179091556040519081527f9e10c351c733c6502669ada15411f45b7ca0f96b4df8709801405cae172f56bf906020015b60405180910390a150565b600082815260056020526040902060010154610897816117d3565b6108a183836117dd565b505050565b60006064600a546108b68461136c565b6108c09190612409565b6106eb9190612428565b6001600160a01b038116331461093f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6109498282611863565b5050565b6109656000805160206125aa83398151915233610c88565b6109825760405163f982dd0f60e01b815260040160405180910390fd5b61099a6000805160206125aa833981519152826117dd565b50565b6000336107918185856109b08383610f4c565b6109ba919061244a565b6114a3565b6109d76000805160206125aa83398151915233610c88565b158015610a0b5750610a097ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc933610c88565b155b15610a2957604051634fcb6d0160e01b815260040160405180910390fd5b6040516323b872dd60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90610a7990339030908690600401612462565b6020604051808303816000875af1158015610a98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abc9190612486565b5061094982826118ca565b610adf6000805160206125aa83398151915233610c88565b610afc5760405163f982dd0f60e01b815260040160405180910390fd5b60405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90610b4a90339085906004016124a8565b6020604051808303816000875af1158015610b69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8d9190612486565b5061099a3382611977565b60008082421115610bbc57604051632d56313160e11b815260040160405180910390fd5b610bc7868686611a97565b9150915094509492505050565b60006064600b546108b68461136c565b610c0e7f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c33610c88565b610c2b576040516316390a3f60e31b815260040160405180910390fd5b600c54600160201b900460ff16610c8657600c805464ff000000001916600160201b179055604051600181527f4543baa938cb97f5073ec206ad35638cdb1f4db8f677d31579b2f6fe7d18c14a906020015b60405180910390a15b565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060048054610700906123b9565b600081421115610ce557604051632d56313160e11b815260040160405180910390fd5b610cf0858585611d4c565b95945050505050565b60003381610d078286610f4c565b905083811015610d675760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610936565b6107b482868684036114a3565b600033610791818585611641565b610d9a6000805160206125aa83398151915233610c88565b610db75760405163f982dd0f60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b038381169190911790915560065460405163095ea7b360e01b815291169063095ea7b390610e02908490600019906004016124a8565b6020604051808303816000875af1158015610e21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e459190612486565b506040516001600160a01b038216907f9e9a9a4a82acd1b28aab6bf1d43aad70ae6d290549c0d6183e2e91ebcdf5744190600090a250565b600082815260056020526040902060010154610e98816117d3565b6108a18383611863565b6000610eaf848484611d4c565b949350505050565b610ecf6000805160206125aa83398151915233610c88565b610eec5760405163f982dd0f60e01b815260040160405180910390fd5b6064811180610ef9575080155b15610f17576040516304a5f22d60e41b815260040160405180910390fd5b600a8190556040518181527ff247e4dd947ab13ba6c46412e403447a26e67109ba13945a20e3170e9acef88390602001610871565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610f8f6000805160206125aa83398151915233610c88565b610fac5760405163f982dd0f60e01b815260040160405180910390fd5b6064811180610fb9575080155b15610fd7576040516304a5f22d60e41b815260040160405180910390fd5b600b8190556040518181527f88bde7c07a2800f63dadeaab0c0dca2f3792c92736de0f8e6f89954bb0f3c7df90602001610871565b6110246000805160206125aa83398151915233610c88565b6110415760405163f982dd0f60e01b815260040160405180910390fd5b806001600160a01b0316826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611089573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ad91906124c1565b6001600160a01b031614801561115557507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611126573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114a91906124c1565b6001600160a01b0316145b8061126f57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e791906124c1565b6001600160a01b031614801561126f5750806001600160a01b0316826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611240573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126491906124c1565b6001600160a01b0316145b61128c5760405163a818b0ad60e01b815260040160405180910390fd5b600880546001600160a01b038085166001600160a01b0319928316179092556006805484841692168217905560095460405163095ea7b360e01b8152919263095ea7b3926112e49290911690600019906004016124a8565b6020604051808303816000875af1158015611303573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113279190612486565b50806001600160a01b0316826001600160a01b03167f7f370f2de1cd2717bdbbc346dcc22685e89a2910ae17352a0a57b75b817c3c2c60405160405180910390a35050565b600854600c54604051638f2e819960e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301526001600160801b038516602483015263ffffffff90921660448201526000929190911690638f2e819990606401602060405180830381865afa1580156113f9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106eb91906124de565b6114356000805160206125aa83398151915233610c88565b6114525760405163f982dd0f60e01b815260040160405180910390fd5b600c54600160201b900460ff1615610c8657600c805464ff0000000019169055604051600081527f4543baa938cb97f5073ec206ad35638cdb1f4db8f677d31579b2f6fe7d18c14a90602001610c7d565b6001600160a01b0383166115055760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610936565b6001600160a01b0382166115665760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610936565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006115d38484610f4c565b9050600019811461163b578181101561162e5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610936565b61163b84848484036114a3565b50505050565b6001600160a01b0383166116a55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610936565b6001600160a01b0382166117075760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610936565b6001600160a01b0383166000908152602081905260409020548181101561177f5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610936565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290926000805160206125ca833981519152910160405180910390a361163b565b61099a8133611f6e565b6117e78282610c88565b6109495760008281526005602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561181f3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61186d8282610c88565b156109495760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0382166119205760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610936565b8060026000828254611932919061244a565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481526000805160206125ca833981519152910160405180910390a35050565b6001600160a01b0382166119d75760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610936565b6001600160a01b03821660009081526020819052604090205481811015611a4b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610936565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192916000805160206125ca833981519152910160405180910390a3505050565b600c546000908190600160201b900460ff1615611ac65760405162b4aa3760e01b815260040160405180910390fd5b611ad03386611977565b611ad985610bd4565b915083821115611afc576040516323a4850d60e21b815260040160405180910390fd5b6006546040516323b872dd60e01b81526001600160a01b03909116906323b872dd90611b3090339030908790600401612462565b6020604051808303816000875af1158015611b4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b739190612486565b50600954600654604051631f72642160e31b81526001600160a01b039283169263fb93210892611baa9291169086906004016124a8565b600060405180830381600087803b158015611bc457600080fd5b505af1158015611bd8573d6000803e3d6000fd5b505060075460405163095ea7b360e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116945063095ea7b39350611c2e92169089906004016124a8565b6020604051808303816000875af1158015611c4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c719190612486565b5060075460405163d4e54c3b60e01b8152600481018790526303c2670060248201526001600160a01b0385811660448301529091169063d4e54c3b906064016020604051808303816000875af1158015611ccf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf391906124de565b60408051878152602081018590529081018290529091506001600160a01b0384169033907f74b7132649649ee4ac2519ff0bb963ce812aaa4c8a0ad0f73c9ac1149fa6e3f49060600160405180910390a3935093915050565b600c54600090600160201b900460ff1615611d795760405162b4aa3760e01b815260040160405180910390fd5b611d833385611977565b611d8c846108a6565b905082811115611daf576040516323a4850d60e21b815260040160405180910390fd5b6006546040516323b872dd60e01b81526001600160a01b03909116906323b872dd90611de390339030908690600401612462565b6020604051808303816000875af1158015611e02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e269190612486565b50600954600654604051631f72642160e31b81526001600160a01b039283169263fb93210892611e5d9291169085906004016124a8565b600060405180830381600087803b158015611e7757600080fd5b505af1158015611e8b573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016925063a9059cbb9150611edd90859088906004016124a8565b6020604051808303816000875af1158015611efc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f209190612486565b5060408051858152602081018390526001600160a01b0384169133917fb1c971764663d561c0ec2baf395a55f33f0a79fabb35bbad580247ba2959523d910160405180910390a39392505050565b611f788282610c88565b61094957611f8581611fc7565b611f90836020611fd9565b604051602001611fa19291906124f7565b60408051601f198184030181529082905262461bcd60e51b8252610936916004016121d2565b60606106eb6001600160a01b03831660145b60606000611fe8836002612409565b611ff390600261244a565b67ffffffffffffffff81111561200b5761200b612566565b6040519080825280601f01601f191660200182016040528015612035576020820181803683370190505b509050600360fc1b816000815181106120505761205061257c565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061207f5761207f61257c565b60200101906001600160f81b031916908160001a90535060006120a3846002612409565b6120ae90600161244a565b90505b6001811115612126576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106120e2576120e261257c565b1a60f81b8282815181106120f8576120f861257c565b60200101906001600160f81b031916908160001a90535060049490941c9361211f81612592565b90506120b1565b5083156121755760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610936565b9392505050565b60006020828403121561218e57600080fd5b81356001600160e01b03198116811461217557600080fd5b60005b838110156121c15781810151838201526020016121a9565b8381111561163b5750506000910152565b60208152600082518060208401526121f18160408501602087016121a6565b601f01601f19169190910160400192915050565b6001600160a01b038116811461099a57600080fd5b6000806040838503121561222d57600080fd5b823561223881612205565b946020939093013593505050565b60008060006060848603121561225b57600080fd5b833561226681612205565b9250602084013561227681612205565b929592945050506040919091013590565b60006020828403121561229957600080fd5b5035919050565b6000602082840312156122b257600080fd5b813563ffffffff8116811461217557600080fd5b600080604083850312156122d957600080fd5b8235915060208301356122eb81612205565b809150509250929050565b60006020828403121561230857600080fd5b813561217581612205565b6000806000806080858703121561232957600080fd5b8435935060208501359250604085013561234281612205565b9396929550929360600135925050565b60008060006060848603121561236757600080fd5b8335925060208401359150604084013561238081612205565b809150509250925092565b6000806040838503121561239e57600080fd5b82356123a981612205565b915060208301356122eb81612205565b600181811c908216806123cd57607f821691505b6020821081036123ed57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612423576124236123f3565b500290565b60008261244557634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561245d5761245d6123f3565b500190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006020828403121561249857600080fd5b8151801515811461217557600080fd5b6001600160a01b03929092168252602082015260400190565b6000602082840312156124d357600080fd5b815161217581612205565b6000602082840312156124f057600080fd5b5051919050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516125298160178501602088016121a6565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161255a8160288401602088016121a6565b01602801949350505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816125a1576125a16123f3565b50600019019056fedf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220a14d3a2aa55faddb768bb3c9d8e7ba358e18b6909fc89456abcad339186e096364736f6c634300080d0033df8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4200000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000180000000000000000000000000c8949dbaf261365083a4b46ab683bae1c92732030000000000000000000000005d066d022ede10efa2717ed3d79f22f949f8c175000000000000000000000000bfa35599c7aebb0dace9b5aa3ca5f2a79624d8eb00000000000000000000000098e989356282fe847493ad636391dca0189961b20000000000000000000000005d798ef47e1260491501e4baa70c36b183fbddda00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b419ce2ea99f356bae0cac47282b9409e38200fa00000000000000000000000000000000000000000000000000000000000000134f7074696f6e20746f2062757920524554524f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000066f524554524f0000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102b65760003560e01c80636e180f6a11610172578063b187bd26116100d9578063dd62ed3e11610092578063dd62ed3e14610637578063de87db2f1461064a578063e1dbffb31461065d578063e349556914610670578063e63ab1e914610678578063e8772bb21461069f578063f7b188a5146106b257600080fd5b8063b187bd26146105b0578063ccfc2e8d146105c4578063d5391393146105d7578063d547741f146105fe578063d6379b7214610611578063dabd27191461062457600080fd5b806391d148541161012b57806391d148541461055c57806395d89b411461056f578063a1d50c3a14610577578063a217fddf146103ba578063a457c2d71461058a578063a9059cbb1461059d57600080fd5b80636e180f6a146104e657806370a08231146104f957806375b238fc146105225780638447120b146105375780638456cb59146105415780639043292a1461054957600080fd5b8063313ce5671161022157806342966c68116101da57806342966c68146104565780634b85f96c146104695780634f2bfe5b1461048e57806351217cbe146104a157806354cb0384146104aa57806362994c05146104b55780636b6f4a9d146104dd57600080fd5b8063313ce567146103e8578063339ccade146103f757806336568abe1461040a57806338f121521461041d578063395093511461043057806340c10f191461044357600080fd5b8063248a9ca311610273578063248a9ca31461035b5780632495a5991461037e578063293c5d43146103a55780632ac8a92c146103ba5780632f2ff15d146103c25780633013ce29146103d557600080fd5b806301ffc9a7146102bb57806306fdde03146102e3578063095ea7b3146102f85780630d43e8ad1461030b57806318160ddd1461033657806323b872dd14610348575b600080fd5b6102ce6102c936600461217c565b6106ba565b60405190151581526020015b60405180910390f35b6102eb6106f1565b6040516102da91906121d2565b6102ce61030636600461221a565b610783565b60095461031e906001600160a01b031681565b6040516001600160a01b0390911681526020016102da565b6002545b6040519081526020016102da565b6102ce610356366004612246565b61079b565b61033a610369366004612287565b60009081526005602052604090206001015490565b61031e7f000000000000000000000000bfa35599c7aebb0dace9b5aa3ca5f2a79624d8eb81565b6103b86103b33660046122a0565b6107bf565b005b61033a600081565b6103b86103d03660046122c6565b61087c565b60065461031e906001600160a01b031681565b604051601281526020016102da565b61033a610405366004612287565b6108a6565b6103b86104183660046122c6565b6108ca565b6103b861042b3660046122f6565b61094d565b6102ce61043e36600461221a565b61099d565b6103b861045136600461221a565b6109bf565b6103b8610464366004612287565b610ac7565b600c546104799063ffffffff1681565b60405163ffffffff90911681526020016102da565b60075461031e906001600160a01b031681565b61033a600b5481565b61033a6303c2670081565b6104c86104c3366004612313565b610b98565b604080519283526020830191909152016102da565b61033a600a5481565b61033a6104f4366004612287565b610bd4565b61033a6105073660046122f6565b6001600160a01b031660009081526020819052604090205490565b61033a6000805160206125aa83398151915281565b61033a6201518081565b6103b8610be4565b60085461031e906001600160a01b031681565b6102ce61056a3660046122c6565b610c88565b6102eb610cb3565b61033a610585366004612313565b610cc2565b6102ce61059836600461221a565b610cf9565b6102ce6105ab36600461221a565b610d74565b600c546102ce90600160201b900460ff1681565b6103b86105d23660046122f6565b610d82565b61033a7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b6103b861060c3660046122c6565b610e7d565b61033a61061f366004612352565b610ea2565b6103b8610632366004612287565b610eb7565b61033a61064536600461238b565b610f4c565b6103b8610658366004612287565b610f77565b6103b861066b36600461238b565b61100c565b61033a606481565b61033a7f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c81565b61033a6106ad366004612287565b61136c565b6103b861141d565b60006001600160e01b03198216637965db0b60e01b14806106eb57506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060038054610700906123b9565b80601f016020809104026020016040519081016040528092919081815260200182805461072c906123b9565b80156107795780601f1061074e57610100808354040283529160200191610779565b820191906000526020600020905b81548152906001019060200180831161075c57829003601f168201915b5050505050905090565b6000336107918185856114a3565b5060019392505050565b6000336107a98582856115c7565b6107b4858585611641565b506001949350505050565b6107d76000805160206125aa83398151915233610c88565b6107f45760405163f982dd0f60e01b815260040160405180910390fd5b620151808163ffffffff16118061080f575063ffffffff8116155b1561082d57604051634b3cbe9f60e01b815260040160405180910390fd5b600c805463ffffffff191663ffffffff83169081179091556040519081527f9e10c351c733c6502669ada15411f45b7ca0f96b4df8709801405cae172f56bf906020015b60405180910390a150565b600082815260056020526040902060010154610897816117d3565b6108a183836117dd565b505050565b60006064600a546108b68461136c565b6108c09190612409565b6106eb9190612428565b6001600160a01b038116331461093f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6109498282611863565b5050565b6109656000805160206125aa83398151915233610c88565b6109825760405163f982dd0f60e01b815260040160405180910390fd5b61099a6000805160206125aa833981519152826117dd565b50565b6000336107918185856109b08383610f4c565b6109ba919061244a565b6114a3565b6109d76000805160206125aa83398151915233610c88565b158015610a0b5750610a097ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc933610c88565b155b15610a2957604051634fcb6d0160e01b815260040160405180910390fd5b6040516323b872dd60e01b81526001600160a01b037f000000000000000000000000bfa35599c7aebb0dace9b5aa3ca5f2a79624d8eb16906323b872dd90610a7990339030908690600401612462565b6020604051808303816000875af1158015610a98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abc9190612486565b5061094982826118ca565b610adf6000805160206125aa83398151915233610c88565b610afc5760405163f982dd0f60e01b815260040160405180910390fd5b60405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000bfa35599c7aebb0dace9b5aa3ca5f2a79624d8eb169063a9059cbb90610b4a90339085906004016124a8565b6020604051808303816000875af1158015610b69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8d9190612486565b5061099a3382611977565b60008082421115610bbc57604051632d56313160e11b815260040160405180910390fd5b610bc7868686611a97565b9150915094509492505050565b60006064600b546108b68461136c565b610c0e7f539440820030c4994db4e31b6b800deafd503688728f932addfe7a410515c14c33610c88565b610c2b576040516316390a3f60e31b815260040160405180910390fd5b600c54600160201b900460ff16610c8657600c805464ff000000001916600160201b179055604051600181527f4543baa938cb97f5073ec206ad35638cdb1f4db8f677d31579b2f6fe7d18c14a906020015b60405180910390a15b565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060048054610700906123b9565b600081421115610ce557604051632d56313160e11b815260040160405180910390fd5b610cf0858585611d4c565b95945050505050565b60003381610d078286610f4c565b905083811015610d675760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610936565b6107b482868684036114a3565b600033610791818585611641565b610d9a6000805160206125aa83398151915233610c88565b610db75760405163f982dd0f60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b038381169190911790915560065460405163095ea7b360e01b815291169063095ea7b390610e02908490600019906004016124a8565b6020604051808303816000875af1158015610e21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e459190612486565b506040516001600160a01b038216907f9e9a9a4a82acd1b28aab6bf1d43aad70ae6d290549c0d6183e2e91ebcdf5744190600090a250565b600082815260056020526040902060010154610e98816117d3565b6108a18383611863565b6000610eaf848484611d4c565b949350505050565b610ecf6000805160206125aa83398151915233610c88565b610eec5760405163f982dd0f60e01b815260040160405180910390fd5b6064811180610ef9575080155b15610f17576040516304a5f22d60e41b815260040160405180910390fd5b600a8190556040518181527ff247e4dd947ab13ba6c46412e403447a26e67109ba13945a20e3170e9acef88390602001610871565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610f8f6000805160206125aa83398151915233610c88565b610fac5760405163f982dd0f60e01b815260040160405180910390fd5b6064811180610fb9575080155b15610fd7576040516304a5f22d60e41b815260040160405180910390fd5b600b8190556040518181527f88bde7c07a2800f63dadeaab0c0dca2f3792c92736de0f8e6f89954bb0f3c7df90602001610871565b6110246000805160206125aa83398151915233610c88565b6110415760405163f982dd0f60e01b815260040160405180910390fd5b806001600160a01b0316826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611089573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ad91906124c1565b6001600160a01b031614801561115557507f000000000000000000000000bfa35599c7aebb0dace9b5aa3ca5f2a79624d8eb6001600160a01b0316826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611126573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114a91906124c1565b6001600160a01b0316145b8061126f57507f000000000000000000000000bfa35599c7aebb0dace9b5aa3ca5f2a79624d8eb6001600160a01b0316826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111e791906124c1565b6001600160a01b031614801561126f5750806001600160a01b0316826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611240573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126491906124c1565b6001600160a01b0316145b61128c5760405163a818b0ad60e01b815260040160405180910390fd5b600880546001600160a01b038085166001600160a01b0319928316179092556006805484841692168217905560095460405163095ea7b360e01b8152919263095ea7b3926112e49290911690600019906004016124a8565b6020604051808303816000875af1158015611303573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113279190612486565b50806001600160a01b0316826001600160a01b03167f7f370f2de1cd2717bdbbc346dcc22685e89a2910ae17352a0a57b75b817c3c2c60405160405180910390a35050565b600854600c54604051638f2e819960e01b81526001600160a01b037f000000000000000000000000bfa35599c7aebb0dace9b5aa3ca5f2a79624d8eb811660048301526001600160801b038516602483015263ffffffff90921660448201526000929190911690638f2e819990606401602060405180830381865afa1580156113f9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106eb91906124de565b6114356000805160206125aa83398151915233610c88565b6114525760405163f982dd0f60e01b815260040160405180910390fd5b600c54600160201b900460ff1615610c8657600c805464ff0000000019169055604051600081527f4543baa938cb97f5073ec206ad35638cdb1f4db8f677d31579b2f6fe7d18c14a90602001610c7d565b6001600160a01b0383166115055760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610936565b6001600160a01b0382166115665760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610936565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006115d38484610f4c565b9050600019811461163b578181101561162e5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610936565b61163b84848484036114a3565b50505050565b6001600160a01b0383166116a55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610936565b6001600160a01b0382166117075760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610936565b6001600160a01b0383166000908152602081905260409020548181101561177f5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610936565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290926000805160206125ca833981519152910160405180910390a361163b565b61099a8133611f6e565b6117e78282610c88565b6109495760008281526005602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561181f3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61186d8282610c88565b156109495760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0382166119205760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610936565b8060026000828254611932919061244a565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481526000805160206125ca833981519152910160405180910390a35050565b6001600160a01b0382166119d75760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610936565b6001600160a01b03821660009081526020819052604090205481811015611a4b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610936565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192916000805160206125ca833981519152910160405180910390a3505050565b600c546000908190600160201b900460ff1615611ac65760405162b4aa3760e01b815260040160405180910390fd5b611ad03386611977565b611ad985610bd4565b915083821115611afc576040516323a4850d60e21b815260040160405180910390fd5b6006546040516323b872dd60e01b81526001600160a01b03909116906323b872dd90611b3090339030908790600401612462565b6020604051808303816000875af1158015611b4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b739190612486565b50600954600654604051631f72642160e31b81526001600160a01b039283169263fb93210892611baa9291169086906004016124a8565b600060405180830381600087803b158015611bc457600080fd5b505af1158015611bd8573d6000803e3d6000fd5b505060075460405163095ea7b360e01b81526001600160a01b037f000000000000000000000000bfa35599c7aebb0dace9b5aa3ca5f2a79624d8eb8116945063095ea7b39350611c2e92169089906004016124a8565b6020604051808303816000875af1158015611c4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c719190612486565b5060075460405163d4e54c3b60e01b8152600481018790526303c2670060248201526001600160a01b0385811660448301529091169063d4e54c3b906064016020604051808303816000875af1158015611ccf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf391906124de565b60408051878152602081018590529081018290529091506001600160a01b0384169033907f74b7132649649ee4ac2519ff0bb963ce812aaa4c8a0ad0f73c9ac1149fa6e3f49060600160405180910390a3935093915050565b600c54600090600160201b900460ff1615611d795760405162b4aa3760e01b815260040160405180910390fd5b611d833385611977565b611d8c846108a6565b905082811115611daf576040516323a4850d60e21b815260040160405180910390fd5b6006546040516323b872dd60e01b81526001600160a01b03909116906323b872dd90611de390339030908690600401612462565b6020604051808303816000875af1158015611e02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e269190612486565b50600954600654604051631f72642160e31b81526001600160a01b039283169263fb93210892611e5d9291169085906004016124a8565b600060405180830381600087803b158015611e7757600080fd5b505af1158015611e8b573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000bfa35599c7aebb0dace9b5aa3ca5f2a79624d8eb16925063a9059cbb9150611edd90859088906004016124a8565b6020604051808303816000875af1158015611efc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f209190612486565b5060408051858152602081018390526001600160a01b0384169133917fb1c971764663d561c0ec2baf395a55f33f0a79fabb35bbad580247ba2959523d910160405180910390a39392505050565b611f788282610c88565b61094957611f8581611fc7565b611f90836020611fd9565b604051602001611fa19291906124f7565b60408051601f198184030181529082905262461bcd60e51b8252610936916004016121d2565b60606106eb6001600160a01b03831660145b60606000611fe8836002612409565b611ff390600261244a565b67ffffffffffffffff81111561200b5761200b612566565b6040519080825280601f01601f191660200182016040528015612035576020820181803683370190505b509050600360fc1b816000815181106120505761205061257c565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061207f5761207f61257c565b60200101906001600160f81b031916908160001a90535060006120a3846002612409565b6120ae90600161244a565b90505b6001811115612126576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106120e2576120e261257c565b1a60f81b8282815181106120f8576120f861257c565b60200101906001600160f81b031916908160001a90535060049490941c9361211f81612592565b90506120b1565b5083156121755760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610936565b9392505050565b60006020828403121561218e57600080fd5b81356001600160e01b03198116811461217557600080fd5b60005b838110156121c15781810151838201526020016121a9565b8381111561163b5750506000910152565b60208152600082518060208401526121f18160408501602087016121a6565b601f01601f19169190910160400192915050565b6001600160a01b038116811461099a57600080fd5b6000806040838503121561222d57600080fd5b823561223881612205565b946020939093013593505050565b60008060006060848603121561225b57600080fd5b833561226681612205565b9250602084013561227681612205565b929592945050506040919091013590565b60006020828403121561229957600080fd5b5035919050565b6000602082840312156122b257600080fd5b813563ffffffff8116811461217557600080fd5b600080604083850312156122d957600080fd5b8235915060208301356122eb81612205565b809150509250929050565b60006020828403121561230857600080fd5b813561217581612205565b6000806000806080858703121561232957600080fd5b8435935060208501359250604085013561234281612205565b9396929550929360600135925050565b60008060006060848603121561236757600080fd5b8335925060208401359150604084013561238081612205565b809150509250925092565b6000806040838503121561239e57600080fd5b82356123a981612205565b915060208301356122eb81612205565b600181811c908216806123cd57607f821691505b6020821081036123ed57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612423576124236123f3565b500290565b60008261244557634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561245d5761245d6123f3565b500190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006020828403121561249857600080fd5b8151801515811461217557600080fd5b6001600160a01b03929092168252602082015260400190565b6000602082840312156124d357600080fd5b815161217581612205565b6000602082840312156124f057600080fd5b5051919050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516125298160178501602088016121a6565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161255a8160288401602088016121a6565b01602801949350505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816125a1576125a16123f3565b50600019019056fedf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220a14d3a2aa55faddb768bb3c9d8e7ba358e18b6909fc89456abcad339186e096364736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000180000000000000000000000000c8949dbaf261365083a4b46ab683bae1c92732030000000000000000000000005d066d022ede10efa2717ed3d79f22f949f8c175000000000000000000000000bfa35599c7aebb0dace9b5aa3ca5f2a79624d8eb00000000000000000000000098e989356282fe847493ad636391dca0189961b20000000000000000000000005d798ef47e1260491501e4baa70c36b183fbddda00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b419ce2ea99f356bae0cac47282b9409e38200fa00000000000000000000000000000000000000000000000000000000000000134f7074696f6e20746f2062757920524554524f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000066f524554524f0000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): Option to buy RETRO
Arg [1] : _symbol (string): oRETRO
Arg [2] : _admin (address): 0xc8949dbaf261365083a4b46ab683BaE1C9273203
Arg [3] : _paymentToken (address): 0x5D066D022EDE10eFa2717eD3D79f22F949F8C175
Arg [4] : _underlyingToken (address): 0xBFA35599c7AEbb0dAcE9b5aa3ca5f2a79624D8Eb
Arg [5] : _twapOracle (address): 0x98E989356282fe847493ad636391DCA0189961B2
Arg [6] : _feeDistributor (address): 0x5D798ef47e1260491501E4bAA70c36b183fBdddA
Arg [7] : _discount (uint256): 50
Arg [8] : _veDiscount (uint256): 0
Arg [9] : _votingEscrow (address): 0xB419cE2ea99f356BaE0caC47282B9409E38200fa
-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [2] : 000000000000000000000000c8949dbaf261365083a4b46ab683bae1c9273203
Arg [3] : 0000000000000000000000005d066d022ede10efa2717ed3d79f22f949f8c175
Arg [4] : 000000000000000000000000bfa35599c7aebb0dace9b5aa3ca5f2a79624d8eb
Arg [5] : 00000000000000000000000098e989356282fe847493ad636391dca0189961b2
Arg [6] : 0000000000000000000000005d798ef47e1260491501e4baa70c36b183fbddda
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000032
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [9] : 000000000000000000000000b419ce2ea99f356bae0cac47282b9409e38200fa
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000013
Arg [11] : 4f7074696f6e20746f2062757920524554524f00000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [13] : 6f524554524f0000000000000000000000000000000000000000000000000000
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.