Overview
Max Total Supply
673,953.951217880992298718 EURe
Holders
1,639 ( 0.550%)
Market
Price
$1.10 @ 3.048896 MATIC (+1.54%)
Onchain Market Cap
$741,349.35
Circulating Supply Market Cap
$0.00
Other Info
Token Contract (WITH 18 Decimals)
Balance
0.85 EUReValue
$0.94 ( ~2.6054 MATIC) [0.0001%]Loading...
Loading
Loading...
Loading
Loading...
Loading
Contract Name:
PolygonPosEUR
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion, Audited
Contract Source Code (Solidity Standard Json-Input format)Audit Report
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; import "./PolygonPosTokenFrontend.sol"; contract PolygonPosEUR is PolygonPosTokenFrontend { constructor(address childChainManagerProxy) PolygonPosTokenFrontend("Monerium EUR emoney", "EURe", "EUR", childChainManagerProxy) { } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC20Basic.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { function safeTransfer( ERC20Basic _token, address _to, uint256 _value ) internal { require(_token.transfer(_to, _value)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ abstract contract ERC20Basic { function totalSupply() public virtual view returns (uint256); function balanceOf(address _who) public virtual view returns (uint256); function transfer(address _to, uint256 _value) public virtual returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); }
/* SPDX-License-Identifier: MIT */ pragma solidity 0.8.11; /** * @title Roles * @author Francisco Giordano (@frangio) * @dev Library for managing addresses assigned to a Role. * See RBAC.sol for example usage. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an address access to this role */ function add(Role storage _role, address _addr) internal { _role.bearer[_addr] = true; } /** * @dev remove an address' access to this role */ function remove(Role storage _role, address _addr) internal { _role.bearer[_addr] = false; } /** * @dev check if an address has this role * // reverts */ function check(Role storage _role, address _addr) internal view { require(has(_role, _addr)); } /** * @dev check if an address has this role * @return bool */ function has(Role storage _role, address _addr) internal view returns (bool) { return _role.bearer[_addr]; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor(){ owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public virtual onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./HasNoEther.sol"; import "./HasNoTokens.sol"; import "./HasNoContracts.sol"; /** * @title Base contract for contracts that should not own things. * @author Remco Bloemen <remco@2π.com> * @dev Solves a class of errors where a contract accidentally becomes owner of Ether, Tokens or * Owned contracts. See respective base contracts for details. */ contract NoOwner is HasNoEther, HasNoTokens, HasNoContracts { }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./CanReclaimToken.sol"; /** * @title Contracts that should not own Tokens * @author Remco Bloemen <remco@2π.com> * @dev This blocks incoming ERC223 tokens to prevent accidental loss of tokens. * Should tokens (any ERC20Basic compatible) end up in the contract, it allows the * owner to reclaim the tokens. */ contract HasNoTokens is CanReclaimToken { /** * @dev Reject all ERC223 compatible tokens * @param _from address The address that is transferring the tokens * @param _value uint256 the amount of the specified token * @param _data Bytes The data passed from the caller. */ function tokenFallback( address _from, uint256 _value, bytes calldata _data ) external pure { _from; _value; _data; revert(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import "./Ownable.sol"; /** * @title Contracts that should not own Ether * @author Remco Bloemen <remco@2π.com> * @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up * in the contract, it will allow the owner to reclaim this Ether. * @notice Ether can still be sent to this contract by: * calling functions labeled `payable` * `selfdestruct(contract_address)` * mining directly to the contract address */ contract HasNoEther is Ownable { /** * @dev Constructor that rejects incoming Ether * The `payable` flag is added so we can access `msg.value` without compiler warning. If we * leave out payable, then Solidity will allow inheriting contracts to implement a payable * constructor. By doing it this way we prevent a payable constructor from working. Alternatively * we could use assembly to access msg.value. */ constructor() payable { require(msg.value == 0); } /** * @dev Disallows direct send by setting a default function without the `payable` flag. */ fallback() external { } /** * @dev Transfer all Ether held by the contract to the owner. */ function reclaimEther() external onlyOwner { payable(owner).transfer(address(this).balance); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Ownable.sol"; /** * @title Contracts that should not own Contracts * @author Remco Bloemen <remco@2π.com> * @dev Should contracts (anything Ownable) end up being owned by this contract, it allows the owner * of this contract to reclaim ownership of the contracts. */ contract HasNoContracts is Ownable { /** * @dev Reclaim ownership of Ownable contracts * @param _contractAddr The address of the Ownable to be reclaimed. */ function reclaimContract(address _contractAddr) external onlyOwner { Ownable contractInst = Ownable(_contractAddr); contractInst.transferOwnership(owner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Ownable.sol"; /** * @title Claimable * @dev Extension for the Ownable contract, where the ownership needs to be claimed. * This allows the new owner to accept the transfer. */ abstract contract Claimable is Ownable { address public pendingOwner; /** * @dev Modifier throws if called by any account other than the pendingOwner. */ modifier onlyPendingOwner() { require(msg.sender == pendingOwner); _; } /** * @dev Allows the current owner to set the pendingOwner address. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public virtual override onlyOwner { pendingOwner = newOwner; } /** * @dev Allows the pendingOwner address to finalize the transfer. */ function claimOwnership() public onlyPendingOwner { emit OwnershipTransferred(owner, pendingOwner); owner = pendingOwner; pendingOwner = address(0); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Ownable.sol"; import "../token/ERC20/ERC20Basic.sol"; import "../token/ERC20/SafeERC20.sol"; /** * @title Contracts that should be able to recover tokens * @author SylTi * @dev This allow a contract to recover any ERC20 token received in a contract by transferring the balance to the contract owner. * This will prevent any accidental loss of tokens. */ contract CanReclaimToken is Ownable { using SafeERC20 for ERC20Basic; /** * @dev Reclaim all ERC20Basic compatible tokens * @param _token ERC20Basic The address of the token contract */ function reclaimToken(ERC20Basic _token) external onlyOwner { uint256 balance = _token.balanceOf(address(this)); _token.safeTransfer(owner, balance); } }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /* * @title TokenStorageLib * @dev Implementation of an[external storage for tokens. */ library TokenStorageLib { using SafeMath for uint; struct TokenStorage { mapping (address => uint) balances; mapping (address => mapping (address => uint)) allowed; uint totalSupply; } /** * @dev Increases balance of an address. * @param self Token storage to operate on. * @param to Address to increase. * @param amount Number of units to add. */ function addBalance(TokenStorage storage self, address to, uint amount) external { self.totalSupply = self.totalSupply.add(amount); self.balances[to] = self.balances[to].add(amount); } /** * @dev Decreases balance of an address. * @param self Token storage to operate on. * @param from Address to decrease. * @param amount Number of units to subtract. */ function subBalance(TokenStorage storage self, address from, uint amount) external { self.totalSupply = self.totalSupply.sub(amount); self.balances[from] = self.balances[from].sub(amount); } /** * @dev Sets the allowance for a spender. * @param self Token storage to operate on. * @param owner Address of the owner of the tokens to spend. * @param spender Address of the spender. * @param amount Qunatity of allowance. */ function setAllowed(TokenStorage storage self, address owner, address spender, uint amount) external { self.allowed[owner][spender] = amount; } /** * @dev Returns the supply of tokens. * @param self Token storage to operate on. * @return Total supply. */ function getSupply(TokenStorage storage self) external view returns (uint) { return self.totalSupply; } /** * @dev Returns the balance of an address. * @param self Token storage to operate on. * @param who Address to lookup. * @return Number of units. */ function getBalance(TokenStorage storage self, address who) external view returns (uint) { return self.balances[who]; } /** * @dev Returns the allowance for a spender. * @param self Token storage to operate on. * @param owner Address of the owner of the tokens to spend. * @param spender Address of the spender. * @return Number of units. */ function getAllowed(TokenStorage storage self, address owner, address spender) external view returns (uint) { return self.allowed[owner][spender]; } }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; import "./ownership/Claimable.sol"; import "./ownership/CanReclaimToken.sol"; import "./ownership/NoOwner.sol"; import "./TokenStorageLib.sol"; /** * @title TokenStorage * @dev External storage for tokens. * The storage is implemented in a separate contract to maintain state * between token upgrades. */ contract TokenStorage is Claimable, CanReclaimToken, NoOwner { using TokenStorageLib for TokenStorageLib.TokenStorage; TokenStorageLib.TokenStorage internal tokenStorage; /** * @dev Increases balance of an address. * @param to Address to increase. * @param amount Number of units to add. */ function addBalance(address to, uint amount) external onlyOwner { tokenStorage.addBalance(to, amount); } /** * @dev Decreases balance of an address. * @param from Address to decrease. * @param amount Number of units to subtract. */ function subBalance(address from, uint amount) external onlyOwner { tokenStorage.subBalance(from, amount); } /** * @dev Sets the allowance for a spender. * @param owner Address of the owner of the tokens to spend. * @param spender Address of the spender. * @param amount Qunatity of allowance. */ function setAllowed(address owner, address spender, uint amount) external onlyOwner { tokenStorage.setAllowed(owner, spender, amount); } /** * @dev Returns the supply of tokens. * @return Total supply. */ function getSupply() external view returns (uint) { return tokenStorage.getSupply(); } /** * @dev Returns the balance of an address. * @param who Address to lookup. * @return Number of units. */ function getBalance(address who) external view returns (uint) { return tokenStorage.getBalance(who); } /** * @dev Returns the allowance for a spender. * @param owner Address of the owner of the tokens to spend. * @param spender Address of the spender. * @return Number of units. */ function getAllowed(address owner, address spender) external view returns (uint) { return tokenStorage.getAllowed(owner, spender); } /** * @dev Explicit override of transferOwnership from Claimable and Ownable * @param newOwner Address to transfer ownership to. */ function transferOwnership(address newOwner) public override(Claimable, Ownable){ Claimable.transferOwnership(newOwner); } }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; import "./ownership/Claimable.sol"; import "./ownership/CanReclaimToken.sol"; import "./ownership/NoOwner.sol"; import "./IERC20.sol"; import "./SmartController.sol"; import "./IPolygonPosRootToken.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; /** * @title TokenFrontend * @dev This contract implements a token forwarder. * The token frontend is [ERC20 and ERC677] compliant and forwards * standard methods to a controller. The primary function is to allow * for a statically deployed contract for users to interact with while * simultaneously allow the controllers to be upgraded when bugs are * discovered or new functionality needs to be added. */ abstract contract TokenFrontend is Claimable, CanReclaimToken, NoOwner, IERC20, IPolygonPosRootToken, AccessControl { bytes32 public constant PREDICATE_ROLE = keccak256("PREDICATE_ROLE"); SmartController internal controller; string public name; string public symbol; bytes3 public ticker; /** * @dev Emitted when tokens are transferred. * @param from Sender address. * @param to Recipient address. * @param amount Number of tokens transferred. * @param data Additional data passed to the recipient's tokenFallback method. */ event Transfer(address indexed from, address indexed to, uint amount, bytes data); /** * @dev Emitted when updating the controller. * @param ticker Three letter ticker representing the currency. * @param old Address of the old controller. * @param current Address of the new controller. */ event Controller(bytes3 indexed ticker, address indexed old, address indexed current); /** * @dev Contract constructor. * @notice The contract is an abstract contract as a result of the internal modifier. * @param name_ Token name. * @param symbol_ Token symbol. * @param ticker_ 3 letter currency ticker. */ constructor(string memory name_, string memory symbol_, bytes3 ticker_) { name = name_; symbol = symbol_; ticker = ticker_; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); } /** * @dev Sets a new controller. * @param address_ Address of the controller. */ function setController(address address_) external onlyOwner { require(address_ != address(0x0), "controller address cannot be the null address"); emit Controller(ticker, address(controller), address_); controller = SmartController(address_); require(controller.getFrontend() == address(this), "controller frontend does not point back"); require(controller.ticker() == ticker, "ticker does not match controller ticket"); } /** * @dev Transfers tokens [ERC20]. * @param to Recipient address. * @param amount Number of tokens to transfer. */ function transfer(address to, uint amount) external returns (bool ok) { ok = controller.transfer_withCaller(msg.sender, to, amount); emit Transfer(msg.sender, to, amount); } /** * @dev Transfers tokens from a specific address [ERC20]. * The address owner has to approve the spender beforehand. * @param from Address to debet the tokens from. * @param to Recipient address. * @param amount Number of tokens to transfer. */ function transferFrom(address from, address to, uint amount) external returns (bool ok) { ok = controller.transferFrom_withCaller(msg.sender, from, to, amount); emit Transfer(from, to, amount); } /** * @dev Approves a spender [ERC20]. * Note that using the approve/transferFrom presents a possible * security vulnerability described in: * https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/edit#heading=h.quou09mcbpzw * Use transferAndCall to mitigate. * @param spender The address of the future spender. * @param amount The allowance of the spender. */ function approve(address spender, uint amount) external returns (bool ok) { ok = controller.approve_withCaller(msg.sender, spender, amount); emit Approval(msg.sender, spender, amount); } /** * @dev Transfers tokens and subsequently calls a method on the recipient [ERC677]. * If the recipient is a non-contract address this method behaves just like transfer. * @param to Recipient address. * @param amount Number of tokens to transfer. * @param data Additional data passed to the recipient's tokenFallback method. */ function transferAndCall(address to, uint256 amount, bytes calldata data) external returns (bool ok) { ok = controller.transferAndCall_withCaller(msg.sender, to, amount, data); emit Transfer(msg.sender, to, amount); emit Transfer(msg.sender, to, amount, data); } /** * @dev Mints new tokens. * @param to Address to credit the tokens. * @param amount Number of tokens to mint. */ function mintTo(address to, uint amount) external returns (bool ok) { ok = controller.mintTo_withCaller(msg.sender, to, amount); emit Transfer(address(0x0), to, amount); } /** * @notice Polygon Bridge Mechanism. Called when token is withdrawn from child chain. * @dev Should be callable only by Matic's Predicate contract. * Should handle deposit by minting the required amount for user. * @param to Address to credit the tokens. * @param amount Number of tokens to mint. */ function mint(address to, uint amount) override external returns (bool ok) { require(hasRole(PREDICATE_ROLE, msg.sender), "caller is not PREDICATE"); ok = this.mintTo(to, amount); } /** * @dev Burns tokens from token owner. * This removfes the burned tokens from circulation. * @param from Address of the token owner. * @param amount Number of tokens to burn. * @param h Hash which the token owner signed. * @param v Signature component. * @param r Signature component. * @param s Sigature component. */ function burnFrom(address from, uint amount, bytes32 h, uint8 v, bytes32 r, bytes32 s) external returns (bool ok) { ok = controller.burnFrom_withCaller(msg.sender, from, amount, h, v, r, s); emit Transfer(from, address(0x0), amount); } /** * @dev Recovers tokens from an address and reissues them to another address. * In case a user loses its private key the tokens can be recovered by burning * the tokens from that address and reissuing to a new address. * To recover tokens the contract owner needs to provide a signature * proving that the token owner has authorized the owner to do so. * @param from Address to burn tokens from. * @param to Address to mint tokens to. * @param h Hash which the token owner signed. * @param v Signature component. * @param r Signature component. * @param s Sigature component. * @return amount Amount recovered. */ function recover(address from, address to, bytes32 h, uint8 v, bytes32 r, bytes32 s) external returns (uint amount) { amount = controller.recover_withCaller(msg.sender, from, to, h ,v, r, s); emit Transfer(from, to, amount); } /** * @dev Gets the current controller. * @return Address of the controller. */ function getController() external view returns (address) { return address(controller); } /** * @dev Returns the total supply. * @return Number of tokens. */ function totalSupply() external view returns (uint) { return controller.totalSupply(); } /** * @dev Returns the number tokens associated with an address. * @param who Address to lookup. * @return Balance of address. */ function balanceOf(address who) external view returns (uint) { return controller.balanceOf(who); } /** * @dev Returns the allowance for a spender * @param owner The address of the owner of the tokens. * @param spender The address of the spender. * @return Number of tokens the spender is allowed to spend. */ function allowance(address owner, address spender) external view returns (uint) { return controller.allowance(owner, spender); } /** * @dev Returns the number of decimals in one token. * @return Number of decimals. */ function decimals() external view returns (uint) { return controller.decimals(); } /** * @dev Explicit override of transferOwnership from Claimable and Ownable * @param newOwner Address to transfer ownership to. */ function transferOwnership(address newOwner) public override(Claimable, Ownable) { Claimable.transferOwnership(newOwner); } }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity ^0.8.11; import "./ownership/Roles.sol"; /** * @title SystemRole * @dev SystemRole accounts have been approved to perform operational actions (e.g. mint and burn). * @notice addSystemAccount and removeSystemAccount are unprotected by default, i.e. anyone can call them. * @notice Contracts inheriting SystemRole *should* authorize the caller by overriding them. * @notice The contract is an abstract contract. */ abstract contract SystemRole { using Roles for Roles.Role; Roles.Role private systemAccounts; /** * @dev Emitted when system account is added. * @param account is a new system account. */ event SystemAccountAdded(address indexed account); /** * @dev Emitted when system account is removed. * @param account is the old system account. */ event SystemAccountRemoved(address indexed account); /** * @dev Modifier which prevents non-system accounts from calling protected functions. */ modifier onlySystemAccounts() { require(isSystemAccount(msg.sender)); _; } /** * @dev Modifier which prevents non-system accounts from being passed to the guard. * @param account The account to check. */ modifier onlySystemAccount(address account) { require( isSystemAccount(account), "must be a system account" ); _; } /** * @dev Checks whether an address is a system account. * @param account the address to check. * @return true if system account. */ function isSystemAccount(address account) public view returns (bool) { return systemAccounts.has(account); } /** * @dev Assigns the system role to an account. * @notice This method is unprotected and should be authorized in the child contract. */ function addSystemAccount(address account) public virtual { systemAccounts.add(account); emit SystemAccountAdded(account); } /** * @dev Removes the system role from an account. * @notice This method is unprotected and should be authorized in the child contract. */ function removeSystemAccount(address account) public virtual { systemAccounts.remove(account); emit SystemAccountRemoved(account); } }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; import "./ownership/Claimable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "./TokenStorage.sol"; import "./IERC20.sol"; import "./ERC20Lib.sol"; import "./ERC677Lib.sol"; /** * @title StandardController * @dev This is the base contract which delegates token methods [ERC20 and ERC677] * to their respective library implementations. * The controller is primarily intended to be interacted with via a token frontend. */ contract StandardController is Pausable, Claimable { using ERC20Lib for TokenStorage; using ERC677Lib for TokenStorage; TokenStorage internal token; address internal frontend; string public name; string public symbol; uint public decimals = 18; /** * @dev Emitted when updating the frontend. * @param old Address of the old frontend. * @param current Address of the new frontend. */ event Frontend(address indexed old, address indexed current); /** * @dev Emitted when updating the storage. * @param old Address of the old storage. * @param current Address of the new storage. */ event Storage(address indexed old, address indexed current); /** * @dev Modifier which prevents the function from being called by unauthorized parties. * The caller must either be the sender or the function must be * called via the frontend, otherwise the call is reverted. * @param caller The address of the passed-in caller. Used to preserve the original caller. */ modifier guarded(address caller) { require( msg.sender == caller || msg.sender == frontend, "either caller must be sender or calling via frontend" ); _; } /** * @dev Contract constructor. * @param storage_ Address of the token storage for the controller. * @param initialSupply The amount of tokens to mint upon creation. * @param frontend_ Address of the authorized frontend. */ constructor(address storage_, uint initialSupply, address frontend_) { require( storage_ == address(0x0) || initialSupply == 0, "either a token storage must be initialized or no initial supply" ); if (storage_ == address(0x0)) { token = new TokenStorage(); token.addBalance(msg.sender, initialSupply); } else { token = TokenStorage(storage_); } frontend = frontend_; } /** * @dev Prevents tokens to be sent to well known blackholes by throwing on known blackholes. * @param to The address of the intended recipient. */ function avoidBlackholes(address to) internal view { require(to != address(0x0), "must not send to 0x0"); require(to != address(this), "must not send to controller"); require(to != address(token), "must not send to token storage"); require(to != frontend, "must not send to frontend"); } /** * @dev Returns the current frontend. * @return Address of the frontend. */ function getFrontend() external view returns (address) { return frontend; } /** * @dev Returns the current storage. * @return Address of the storage. */ function getStorage() external view returns (address) { return address(token); } /** * @dev Sets a new frontend. * @param frontend_ Address of the new frontend. */ function setFrontend(address frontend_) public onlyOwner { emit Frontend(frontend, frontend_); frontend = frontend_; } /** * @dev Sets a new storage. * @param storage_ Address of the new storage. */ function setStorage(address storage_) external onlyOwner { emit Storage(address(token), storage_); token = TokenStorage(storage_); } /** * @dev Transfers the ownership of the storage. * @param newOwner Address of the new storage owner. */ function transferStorageOwnership(address newOwner) public onlyOwner { token.transferOwnership(newOwner); } /** * @dev Claims the ownership of the storage. */ function claimStorageOwnership() public onlyOwner { token.claimOwnership(); } /** * @dev Transfers tokens [ERC20]. * @param caller Address of the caller passed through the frontend. * @param to Recipient address. * @param amount Number of tokens to transfer. */ function transfer_withCaller(address caller, address to, uint amount) public virtual guarded(caller) whenNotPaused returns (bool ok) { avoidBlackholes(to); return token.transfer(caller, to, amount); } /** * @dev Transfers tokens from a specific address [ERC20]. * The address owner has to approve the spender beforehand. * @param caller Address of the caller passed through the frontend. * @param from Address to debet the tokens from. * @param to Recipient address. * @param amount Number of tokens to transfer. */ function transferFrom_withCaller(address caller, address from, address to, uint amount) public virtual guarded(caller) whenNotPaused returns (bool ok) { avoidBlackholes(to); return token.transferFrom(caller, from, to, amount); } /** * @dev Approves a spender [ERC20]. * Note that using the approve/transferFrom presents a possible * security vulnerability described in: * https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/edit#heading=h.quou09mcbpzw * Use transferAndCall to mitigate. * @param caller Address of the caller passed through the frontend. * @param spender The address of the future spender. * @param amount The allowance of the spender. */ function approve_withCaller(address caller, address spender, uint amount) public guarded(caller) whenNotPaused returns (bool ok) { return token.approve(caller, spender, amount); } /** * @dev Transfers tokens and subsequently calls a method on the recipient [ERC677]. * If the recipient is a non-contract address this method behaves just like transfer. * @param caller Address of the caller passed through the frontend. * @param to Recipient address. * @param amount Number of tokens to transfer. * @param data Additional data passed to the recipient's tokenFallback method. */ function transferAndCall_withCaller( address caller, address to, uint256 amount, bytes calldata data ) public virtual guarded(caller) whenNotPaused returns (bool ok) { avoidBlackholes(to); return token.transferAndCall(caller, to, amount, data); } /** * @dev Returns the total supply. * @return Number of tokens. */ function totalSupply() external view returns (uint) { return token.getSupply(); } /** * @dev Returns the number tokens associated with an address. * @param who Address to lookup. * @return Balance of address. */ function balanceOf(address who) external view returns (uint) { return token.getBalance(who); } /** * @dev Returns the allowance for a spender * @param owner The address of the owner of the tokens. * @param spender The address of the spender. * @return Number of tokens the spender is allowed to spend. */ function allowance(address owner, address spender) external view returns (uint) { return token.allowance(owner, spender); } /** * @dev Pause the function protected by Pausable modifier. */ function pause() public onlyOwner { _pause(); } /** * @dev Unpause the function protected by Pausable modifier. */ function unpause() public onlyOwner { _unpause(); } }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; import "./ERC20Lib.sol"; import "./MintableTokenLib.sol"; import "./IValidator.sol"; /** * @title SmartTokenLib * @dev This library provides functionality which is required from a regulatory perspective. */ library SmartTokenLib { using ERC20Lib for TokenStorage; using MintableTokenLib for TokenStorage; struct SmartStorage { IValidator validator; } /** * @dev Emitted when the contract owner recovers tokens. * @param from Sender address. * @param to Recipient address. * @param amount Number of tokens. */ event Recovered(address indexed from, address indexed to, uint amount); /** * @dev Emitted when updating the validator. * @param old Address of the old validator. * @param current Address of the new validator. */ event Validator(address indexed old, address indexed current); /** * @dev Sets a new validator. * @param self Smart storage to operate on. * @param validator Address of validator. */ function setValidator(SmartStorage storage self, address validator) external { emit Validator(address(self.validator), validator); self.validator = IValidator(validator); } /** * @dev Approves or rejects a transfer request. * The request is forwarded to a validator which implements * the actual business logic. * @param self Smart storage to operate on. * @param from Sender address. * @param to Recipient address. * @param amount Number of tokens. */ function validate(SmartStorage storage self, address from, address to, uint amount) external returns (bool valid) { return self.validator.validate(from, to, amount); } /** * @dev Recovers tokens from an address and reissues them to another address. * In case a user loses its private key the tokens can be recovered by burning * the tokens from that address and reissuing to a new address. * To recover tokens the contract owner needs to provide a signature * proving that the token owner has authorized the owner to do so. * @param from Address to burn tokens from. * @param to Address to mint tokens to. * @param h Hash which the token owner signed. * @param v Signature component. * @param r Signature component. * @param s Sigature component. * @return Amount recovered. */ function recover( TokenStorage token, address from, address to, bytes32 h, uint8 v, bytes32 r, bytes32 s ) external returns (uint) { require( ecrecover(h, v, r, s) == from, "signature/hash does not recover from address" ); uint amount = token.balanceOf(from); token.burn(from, amount); token.mint(to, amount); emit Recovered(from, to, amount); return amount; } /** * @dev Gets the current validator. * @param self Smart storage to operate on. * @return Address of validator. */ function getValidator(SmartStorage storage self) external view returns (address) { return address(self.validator); } }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; import "./SmartTokenLib.sol"; import "./MintableController.sol"; import "./IValidator.sol"; /** * @title SmartController * @dev This contract adds "smart" functionality which is required from a regulatory perspective. */ contract SmartController is MintableController { using SmartTokenLib for SmartTokenLib.SmartStorage; SmartTokenLib.SmartStorage internal smartToken; bytes3 public ticker; uint constant public INITIAL_SUPPLY = 0; /** * @dev Contract constructor. * @param storage_ Address of the token storage for the controller. * @param validator Address of validator. * @param ticker_ 3 letter currency ticker. * @param frontend_ Address of the authorized frontend. */ constructor(address storage_, address validator, bytes3 ticker_, address frontend_) MintableController(storage_, INITIAL_SUPPLY, frontend_) { require(validator != address(0x0), "validator cannot be the null address"); smartToken.setValidator(validator); ticker = ticker_; } /** * @dev Sets a new validator. * @param validator Address of validator. */ function setValidator(address validator) external onlySystemAccounts { smartToken.setValidator(validator); } /** * @dev Recovers tokens from an address and reissues them to another address. * In case a user loses its private key the tokens can be recovered by burning * the tokens from that address and reissuing to a new address. * To recover tokens the contract owner needs to provide a signature * proving that the token owner has authorized the owner to do so. * @param caller Address of the caller passed through the frontend. * @param from Address to burn tokens from. * @param to Address to mint tokens to. * @param h Hash which the token owner signed. * @param v Signature component. * @param r Signature component. * @param s Sigature component. * @return Amount recovered. */ function recover_withCaller(address caller, address from, address to, bytes32 h, uint8 v, bytes32 r, bytes32 s) external guarded(caller) onlySystemAccount(caller) returns (uint) { avoidBlackholes(to); return SmartTokenLib.recover(token, from, to, h, v, r, s); } /** * @dev Transfers tokens [ERC20]. * The caller, to address and amount are validated before executing method. * Prior to transfering tokens the validator needs to approve. * @notice Overrides method in a parent. * @param caller Address of the caller passed through the frontend. * @param to Recipient address. * @param amount Number of tokens to transfer. */ function transfer_withCaller(address caller, address to, uint amount) public override guarded(caller) whenNotPaused returns (bool) { require(smartToken.validate(caller, to, amount), "transfer request not valid"); return super.transfer_withCaller(caller, to, amount); } /** * @dev Transfers tokens from a specific address [ERC20]. * The address owner has to approve the spender beforehand. * The from address, to address and amount are validated before executing method. * @notice Overrides method in a parent. * Prior to transfering tokens the validator needs to approve. * @param caller Address of the caller passed through the frontend. * @param from Address to debet the tokens from. * @param to Recipient address. * @param amount Number of tokens to transfer. */ function transferFrom_withCaller(address caller, address from, address to, uint amount) public override guarded(caller) whenNotPaused returns (bool) { require(smartToken.validate(from, to, amount), "transferFrom request not valid"); return super.transferFrom_withCaller(caller, from, to, amount); } /** * @dev Transfers tokens and subsequently calls a method on the recipient [ERC677]. * If the recipient is a non-contract address this method behaves just like transfer. * The caller, to address and amount are validated before executing method. * @notice Overrides method in a parent. * @param caller Address of the caller passed through the frontend. * @param to Recipient address. * @param amount Number of tokens to transfer. * @param data Additional data passed to the recipient's tokenFallback method. */ function transferAndCall_withCaller( address caller, address to, uint256 amount, bytes calldata data ) public override guarded(caller) whenNotPaused returns (bool) { require(smartToken.validate(caller, to, amount), "transferAndCall request not valid"); return super.transferAndCall_withCaller(caller, to, amount, data); } /** * @dev Gets the current validator. * @return Address of validator. */ function getValidator() external view returns (address) { return smartToken.getValidator(); } }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; import "./TokenFrontend.sol"; import "./IPolygonPosChildToken.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; /** * @title PolygonPosTokenFrontend * @notice This contract is to be deployed on Matic Polygon network. * @dev This contract implements a token forwarder. * The token frontend is [ERC20 and ERC677] compliant and forwards * standard methods to a controller. The primary function is to allow * for a statically deployed contract for users to interact with while * simultaneously allow the controllers to be upgraded when bugs are * discovered or new functionality needs to be added. * This token implement function for the Matic Polygon Brige. */ abstract contract PolygonPosTokenFrontend is TokenFrontend, IPolygonPosChildToken { bytes32 public constant DEPOSITOR_ROLE = keccak256("DEPOSITOR_ROLE"); /** * @dev Contract constructor. * @notice The contract is an abstract contract as a result of the internal modifier. * @param name_ Token name. * @param symbol_ Token symbol. * @param ticker_ 3 letter currency ticker. * @param childChainManager_ Address of Polygon Pos's child chain manager proxy. */ constructor(string memory name_, string memory symbol_, bytes3 ticker_, address childChainManager_) TokenFrontend(name_, symbol_, ticker_) { _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setupRole(DEPOSITOR_ROLE, childChainManager_); } /** * @notice Polygon Bridge Mechanism. Called when token is deposited on root chain * @dev Should be callable only by ChildChainManager * Should handle deposit by minting the required amount for user * @param user user address for whom deposit is being done * @param depositData abi encoded amount */ function deposit(address user, bytes calldata depositData) override external { require(hasRole(DEPOSITOR_ROLE, msg.sender), "caller is not a DEPOSITOR"); uint256 amount = abi.decode(depositData, (uint256)); this.mintTo(user, amount); } /** * @notice Polygon Bridge Mechanism. Called when user wants to withdraw tokens back to root chain * @dev Should burn user's tokens. This transaction will be verified when exiting on root chain * @param amount amount of tokens to withdraw */ function withdraw(uint256 amount) override external { controller.burnFrom(msg.sender, amount); emit Transfer(msg.sender, address(0x0), amount); } }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./ERC20Lib.sol"; import "./TokenStorage.sol"; /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120 * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ library MintableTokenLib { using SafeMath for uint; /** * @dev Mints new tokens. * @param db Token storage to operate on. * @param to The address that will recieve the minted tokens. * @param amount The amount of tokens to mint. */ function mint( TokenStorage db, address to, uint amount ) external returns (bool) { db.addBalance(to, amount); return true; } /** * @dev Burns tokens. * @param db Token storage to operate on. * @param from The address holding tokens. * @param amount The amount of tokens to burn. */ function burn( TokenStorage db, address from, uint amount ) public returns (bool) { db.subBalance(from, amount); return true; } /** * @dev Burns tokens from a specific address. * To burn the tokens the caller needs to provide a signature * proving that the caller is authorized by the token owner to do so. * @param db Token storage to operate on. * @param from The address holding tokens. * @param amount The amount of tokens to burn. * @param h Hash which the token owner signed. * @param v Signature component. * @param r Signature component. * @param s Sigature component. */ function burn( TokenStorage db, address from, uint amount, bytes32 h, uint8 v, bytes32 r, bytes32 s ) external returns (bool) { require( ecrecover(h, v, r, s) == from, "signature/hash does not match" ); return burn(db, from, amount); } }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; import "./StandardController.sol"; import "./MintableTokenLib.sol"; import "./SystemRole.sol"; /** * @title MintableController * @dev This contracts implements functionality allowing for minting and burning of tokens. */ contract MintableController is SystemRole, StandardController { using MintableTokenLib for TokenStorage; /** * @dev Contract constructor. * @param storage_ Address of the token storage for the controller. * @param initialSupply The amount of tokens to mint upon creation. * @param frontend_ Address of the authorized frontend. */ constructor(address storage_, uint initialSupply, address frontend_) StandardController(storage_, initialSupply, frontend_) { } /** * @dev Assigns the system role to an account. */ function addSystemAccount(address account) public override onlyOwner { super.addSystemAccount(account); } /** * @dev Removes the system role from an account. */ function removeSystemAccount(address account) public override onlyOwner { super.removeSystemAccount(account); } /** * @dev Mints new tokens. * @param caller Address of the caller passed through the frontend. * @param to Address to credit the tokens. * @param amount Number of tokens to mint. */ function mintTo_withCaller(address caller, address to, uint amount) public guarded(caller) onlySystemAccount(caller) returns (bool) { avoidBlackholes(to); return token.mint(to, amount); } /** * @dev Burns tokens from token owner. * This removes the burned tokens from circulation. * @param caller Address of the caller passed through the frontend. * @param from Address of the token owner. * @param amount Number of tokens to burn. * @param h Hash which the token owner signed. * @param v Signature component. * @param r Signature component. * @param s Sigature component. */ function burnFrom_withCaller(address caller, address from, uint amount, bytes32 h, uint8 v, bytes32 r, bytes32 s) public guarded(caller) onlySystemAccount(caller) returns (bool) { return token.burn(from, amount, h, v, r, s); } /** * @dev Burns tokens from token owner. * This removes the burned tokens from circulation. * @param from Address of the token owner. * @param amount Number of tokens to burn. */ function burnFrom(address from, uint amount) public guarded(msg.sender) onlySystemAccount(msg.sender) returns (bool) { return token.burn(from, amount); } }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; /** * @title IValidator * @dev Contracts implementing this interface validate token transfers. */ interface IValidator { /** * @dev Emitted when a validator makes a decision. * @param from Sender address. * @param to Recipient address. * @param amount Number of tokens. * @param valid True if transfer approved, false if rejected. */ event Decision(address indexed from, address indexed to, uint amount, bool valid); /** * @dev Validates token transfer. * If the sender is on the blacklist the transfer is denied. * @param from Sender address. * @param to Recipient address. * @param amount Number of tokens. */ function validate(address from, address to, uint amount) external returns (bool valid); }
/* SPDX-License-Identifier: apache-2.0 */ pragma solidity ^0.8.0; /** * @title IPolygonPosRootToken * @dev This interface define the mandatory method enabling polygon bridging mechanism. * @notice This interface should be inherited to deploy on ethereum. */ interface IPolygonPosRootToken { function mint(address user, uint256 amount) external returns(bool); }
/* SPDX-License-Identifier: apache-2.0 */ pragma solidity ^0.8.0; /** * @title IPolygonPosChildToken * @dev This interface define the mandatory method enabling polygon bridging mechanism. * @notice This interface should be inherited to deploy on polygon POS network. */ interface IPolygonPosChildToken { function deposit(address user, bytes calldata depositData) external; function withdraw(uint256 amount) external; }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; /** * @title IERC677Recipient * @dev Contracts implementing this interface can participate in [ERC677]. */ interface IERC677Recipient { /** * @dev Receives notification from [ERC677] transferAndCall. * @param from Sender address. * @param amount Number of tokens. * @param data Additional data. */ function onTokenTransfer(address from, uint256 amount, bytes calldata data) external returns (bool); }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see `ERC20Detailed`. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through `transferFrom`. This is * zero by default. * * This value changes when `approve` or `transferFrom` are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * > Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an `Approval` event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a `Transfer` event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to `approve`. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; import "@openzeppelin/contracts/utils/Address.sol"; import "./IERC677Recipient.sol"; import "./TokenStorage.sol"; import "./ERC20Lib.sol"; /** * @title ERC677 * @dev ERC677 token functionality. * https://github.com/ethereum/EIPs/issues/677 */ library ERC677Lib { using ERC20Lib for TokenStorage; using Address for address; /** * @dev Transfers tokens and subsequently calls a method on the recipient [ERC677]. * If the recipient is a non-contract address this method behaves just like transfer. * @notice db.transfer either returns true or reverts. * @param db Token storage to operate on. * @param caller Address of the caller passed through the frontend. * @param to Recipient address. * @param amount Number of tokens to transfer. * @param data Additional data passed to the recipient's tokenFallback method. */ function transferAndCall( TokenStorage db, address caller, address to, uint256 amount, bytes calldata data ) external returns (bool) { require( db.transfer(caller, to, amount), "unable to transfer" ); if (to.isContract()) { IERC677Recipient recipient = IERC677Recipient(to); require( recipient.onTokenTransfer(caller, amount, data), "token handler returns false" ); } return true; } }
/* SPDX-License-Identifier: apache-2.0 */ /** * Copyright 2019 Monerium ehf. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity 0.8.11; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./TokenStorage.sol"; /** * @title ERC20Lib * @dev Standard ERC20 token functionality. * https://github.com/ethereum/EIPs/issues/20 */ library ERC20Lib { using SafeMath for uint; /** * @dev Transfers tokens [ERC20]. * @param db Token storage to operate on. * @param caller Address of the caller passed through the frontend. * @param to Recipient address. * @param amount Number of tokens to transfer. */ function transfer(TokenStorage db, address caller, address to, uint amount) external returns (bool success) { db.subBalance(caller, amount); db.addBalance(to, amount); return true; } /** * @dev Transfers tokens from a specific address [ERC20]. * The address owner has to approve the spender beforehand. * @param db Token storage to operate on. * @param caller Address of the caller passed through the frontend. * @param from Address to debet the tokens from. * @param to Recipient address. * @param amount Number of tokens to transfer. */ function transferFrom( TokenStorage db, address caller, address from, address to, uint amount ) external returns (bool success) { uint allowance_ = db.getAllowed(from, caller); db.subBalance(from, amount); db.addBalance(to, amount); db.setAllowed(from, caller, allowance_.sub(amount)); return true; } /** * @dev Approves a spender [ERC20]. * Note that using the approve/transferFrom presents a possible * security vulnerability described in: * https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/edit#heading=h.quou09mcbpzw * Use transferAndCall to mitigate. * @param db Token storage to operate on. * @param caller Address of the caller passed through the frontend. * @param spender The address of the future spender. * @param amount The allowance of the spender. */ function approve(TokenStorage db, address caller, address spender, uint amount) public returns (bool success) { db.setAllowed(caller, spender, amount); return true; } /** * @dev Returns the number tokens associated with an address. * @param db Token storage to operate on. * @param who Address to lookup. * @return balance Balance of address. */ function balanceOf(TokenStorage db, address who) external view returns (uint balance) { return db.getBalance(who); } /** * @dev Returns the allowance for a spender * @param db Token storage to operate on. * @param owner The address of the owner of the tokens. * @param spender The address of the spender. * @return remaining Number of tokens the spender is allowed to spend. */ function allowance(TokenStorage db, address owner, address spender) external view returns (uint remaining) { return db.getAllowed(owner, spender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// 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 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/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @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] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// 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 (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_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.5.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, _msgSender()); _; } /** * @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 `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(uint160(account), 20), " 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. */ 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. */ 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`. */ 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. * * [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. */ 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. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 1000 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- Ackee Blockchain- Aug 22nd, 2023 - Security Audit Report
[{"inputs":[{"internalType":"address","name":"childChainManagerProxy","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"bytes3","name":"ticker","type":"bytes3"},{"indexed":true,"internalType":"address","name":"old","type":"address"},{"indexed":true,"internalType":"address","name":"current","type":"address"}],"name":"Controller","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","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":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"Transfer","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"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPOSITOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PREDICATE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","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":"ok","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"who","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"h","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"burnFrom","outputs":[{"internalType":"bool","name":"ok","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes","name":"depositData","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getController","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"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":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[{"internalType":"bool","name":"ok","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mintTo","outputs":[{"internalType":"bool","name":"ok","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_contractAddr","type":"address"}],"name":"reclaimContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reclaimEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ERC20Basic","name":"_token","type":"address"}],"name":"reclaimToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes32","name":"h","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"recover","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","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":"address","name":"address_","type":"address"}],"name":"setController","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":"ticker","outputs":[{"internalType":"bytes3","name":"","type":"bytes3"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"tokenFallback","outputs":[],"stateMutability":"pure","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":"ok","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"transferAndCall","outputs":[{"internalType":"bool","name":"ok","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":"ok","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506040516200262f3803806200262f83398101604081905262000034916200029b565b604080518082018252601381527f4d6f6e657269756d2045555220656d6f6e657900000000000000000000000000602080830191909152825180840190935260048352634555526560e01b90830152600080546001600160a01b03191633179055906222aaa960e91b838383833415620000ad57600080fd5b8251620000c2906004906020860190620001f5565b508151620000d8906005906020850190620001f5565b506006805462ffffff191660e883901c179055620000f860003362000141565b506200010a9150600090503362000141565b620001367f8f4f2da22e8ac8f11e15f9fc141cddbb5deea8800186560abb6e68c5496619a98262000141565b50505050506200030a565b6200014d828262000151565b5050565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff166200014d5760008281526002602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620001b13390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b8280546200020390620002cd565b90600052602060002090601f01602090048101928262000227576000855562000272565b82601f106200024257805160ff191683800117855562000272565b8280016001018555821562000272579182015b828111156200027257825182559160200191906001019062000255565b506200028092915062000284565b5090565b5b8082111562000280576000815560010162000285565b600060208284031215620002ae57600080fd5b81516001600160a01b0381168114620002c657600080fd5b9392505050565b600181811c90821680620002e257607f821691505b602082108114156200030457634e487b7160e01b600052602260045260246000fd5b50919050565b612315806200031a6000396000f3fe608060405234801561001057600080fd5b50600436106102535760003560e01c80636eb4c6091161014b578063a217fddf116100cc578063d547741f11610086578063e30c39781161006e578063e30c397814610522578063e72db5fd14610535578063f2fde38b1461055c57005b8063d547741f146104fc578063dd62ed3e1461050f57005b8063a9059cbb116100b4578063a9059cbb146104c3578063c0ee0b8a146104d6578063cf2c52cb146104e957005b8063a217fddf14610494578063a3b0b5a31461049c57005b80638da5cb5b1161011d57806392eefe9b1161010557806392eefe9b1461047157806395d89b41146104845780639f727c271461048c57005b80638da5cb5b1461042557806391d148541461043857005b80636eb4c609146103d157806370a08231146103e4578063715018a6146103f75780638ba47bdd146103ff57005b80632f2ff15d116101d55780633823caec116101a757806340c10f191161018f57806340c10f19146103a3578063449a52f8146103b65780634e71e0c8146103c957005b80633823caec1461037d5780634000aea01461039057005b80632f2ff15d1461032a5780633018205f1461033d578063313ce5671461036257806336568abe1461036a57005b806318160ddd11610226578063248a9ca31161020e578063248a9ca3146102e15780632aed7f3f146103045780632e1a7d4d1461031757005b806318160ddd146102b857806323b872dd146102ce57005b806301ffc9a71461025557806306fdde031461027d578063095ea7b31461029257806317ffc320146102a5575b005b610268610263366004611d19565b61056f565b60405190151581526020015b60405180910390f35b610285610608565b6040516102749190611d8b565b6102686102a0366004611dd3565b610696565b6102536102b3366004611dff565b610782565b6102c0610825565b604051908152602001610274565b6102686102dc366004611e1c565b6108b1565b6102c06102ef366004611e5d565b60009081526002602052604090206001015490565b610253610312366004611dff565b6109a6565b610253610325366004611e5d565b610a3a565b610253610338366004611e76565b610b04565b6003546001600160a01b03165b6040516001600160a01b039091168152602001610274565b6102c0610b2f565b610253610378366004611e76565b610b92565b61026861038b366004611ebc565b610c1f565b61026861039e366004611f5f565b610d2e565b6102686103b1366004611dd3565b610e69565b6102686103c4366004611dd3565b610f5f565b61025361103e565b6102c06103df366004611fbb565b6110c6565b6102c06103f2366004611dff565b6111c3565b610253611232565b60065461040c9060e81b81565b6040516001600160e81b03199091168152602001610274565b60005461034a906001600160a01b031681565b610268610446366004611e76565b60009182526002602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61025361047f366004611dff565b61129e565b6102856115b6565b6102536115c3565b6102c0600081565b6102c07f8f4f2da22e8ac8f11e15f9fc141cddbb5deea8800186560abb6e68c5496619a981565b6102686104d1366004611dd3565b611614565b6102536104e4366004611f5f565b600080fd5b6102536104f7366004612004565b6116f2565b61025361050a366004611e76565b6117f9565b6102c061051d366004612059565b61181f565b60015461034a906001600160a01b031681565b6102c07f12ff340d0cd9c652c747ca35727e68c547d0f0bfa7758d2e77f75acef481b4f281565b61025361056a366004611dff565b6118af565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061060257507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6004805461061590612087565b80601f016020809104026020016040519081016040528092919081815260200182805461064190612087565b801561068e5780601f106106635761010080835404028352916020019161068e565b820191906000526020600020905b81548152906001019060200180831161067157829003601f168201915b505050505081565b6003546040517f774d54090000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03848116602483015260448201849052600092169063774d5409906064016020604051808303816000875af1158015610709573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072d91906120c2565b9050826001600160a01b0316336001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161077491815260200190565b60405180910390a392915050565b6000546001600160a01b0316331461079957600080fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156107e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080491906120e4565b600054909150610821906001600160a01b038481169116836118b8565b5050565b600354604080517f18160ddd00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015610888573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ac91906120e4565b905090565b6003546040517fe974fee90000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b038581166024830152848116604483015260648201849052600092169063e974fee9906084016020604051808303816000875af115801561092c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095091906120c2565b9050826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161099791815260200190565b60405180910390a39392505050565b6000546001600160a01b031633146109bd57600080fd5b6000546040517ff2fde38b0000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152829182169063f2fde38b90602401600060405180830381600087803b158015610a1e57600080fd5b505af1158015610a32573d6000803e3d6000fd5b505050505050565b6003546040517f79cc6790000000000000000000000000000000000000000000000000000000008152336004820152602481018390526001600160a01b03909116906379cc6790906044016020604051808303816000875af1158015610aa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac891906120c2565b5060405181815260009033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350565b600082815260026020526040902060010154610b20813361194d565b610b2a83836119cd565b505050565b600354604080517f313ce56700000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015610888573d6000803e3d6000fd5b6001600160a01b0381163314610c155760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6108218282611a6f565b6003546040517f4eb007540000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b038881166024830152604482018890526064820187905260ff8616608483015260a4820185905260c482018490526000921690634eb007549060e4016020604051808303816000875af1158015610cb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd491906120c2565b905060006001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef88604051610d1c91815260200190565b60405180910390a39695505050505050565b6003546040517f9e7f43ca0000000000000000000000000000000000000000000000000000000081526000916001600160a01b031690639e7f43ca90610d809033908990899089908990600401612126565b6020604051808303816000875af1158015610d9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc391906120c2565b9050846001600160a01b0316336001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051610e0a91815260200190565b60405180910390a3846001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16868686604051610e5993929190612164565b60405180910390a3949350505050565b3360009081527f01fe8a47b306d7a52efb17b73cdfe0b3311b7856a8f6b264a0f03659201b1e9e602052604081205460ff16610ee75760405162461bcd60e51b815260206004820152601760248201527f63616c6c6572206973206e6f74205052454449434154450000000000000000006044820152606401610c0c565b6040516308934a5f60e31b81526001600160a01b038416600482015260248101839052309063449a52f8906044016020604051808303816000875af1158015610f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5891906120c2565b9392505050565b6003546040517f322ec0fb0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03848116602483015260448201849052600092169063322ec0fb906064016020604051808303816000875af1158015610fd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff691906120c2565b9050826001600160a01b031660006001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161077491815260200190565b6001546001600160a01b0316331461105557600080fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600180546000805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b03841617909155169055565b6003546040517f3cd1570f0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03888116602483015287811660448301526064820187905260ff8616608483015260a4820185905260c482018490526000921690633cd1570f9060e4016020604051808303816000875af1158015611158573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117c91906120e4565b9050856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610d1c91815260200190565b6003546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a0823190602401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060291906120e4565b6000546001600160a01b0316331461124957600080fd5b600080546040516001600160a01b03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b031633146112b557600080fd5b6001600160a01b0381166113315760405162461bcd60e51b815260206004820152602d60248201527f636f6e74726f6c6c657220616464726573732063616e6e6f742062652074686560448201527f206e756c6c2061646472657373000000000000000000000000000000000000006064820152608401610c0c565b6003546006546040516001600160a01b0384811693169160e81b6001600160e81b031916907f2ce3a3a1c097de2b147145a1e6f236b569e75e7310e3b0b436d5dea8f60e35dc90600090a46003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316908117909155604080517e3074ff0000000000000000000000000000000000000000000000000000000081529051309291623074ff9160048083019260209291908290030181865afa1580156113fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141f9190612187565b6001600160a01b03161461149b5760405162461bcd60e51b815260206004820152602760248201527f636f6e74726f6c6c65722066726f6e74656e6420646f6573206e6f7420706f6960448201527f6e74206261636b000000000000000000000000000000000000000000000000006064820152608401610c0c565b600654600354604080517f8ba47bdd000000000000000000000000000000000000000000000000000000008152905160e89390931b6001600160e81b031916926001600160a01b0390921691638ba47bdd916004808201926020929091908290030181865afa158015611512573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061153691906121a4565b6001600160e81b031916146115b35760405162461bcd60e51b815260206004820152602760248201527f7469636b657220646f6573206e6f74206d6174636820636f6e74726f6c6c657260448201527f207469636b6574000000000000000000000000000000000000000000000000006064820152608401610c0c565b50565b6005805461061590612087565b6000546001600160a01b031633146115da57600080fd5b600080546040516001600160a01b03909116914780156108fc02929091818181858888f193505050501580156115b3573d6000803e3d6000fd5b6003546040517fe174fd940000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03848116602483015260448201849052600092169063e174fd94906064016020604051808303816000875af1158015611687573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ab91906120c2565b9050826001600160a01b0316336001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161077491815260200190565b3360009081527f9cd58e85166b00f2c5084ab3c52b6a5cfc82b0f8dcb5209201f73c0cff91daff602052604090205460ff166117705760405162461bcd60e51b815260206004820152601960248201527f63616c6c6572206973206e6f742061204445504f5349544f52000000000000006044820152606401610c0c565b600061177e82840184611e5d565b6040516308934a5f60e31b81526001600160a01b038616600482015260248101829052909150309063449a52f8906044016020604051808303816000875af11580156117ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f291906120c2565b5050505050565b600082815260026020526040902060010154611815813361194d565b610b2a8383611a6f565b6003546040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528381166024830152600092169063dd62ed3e90604401602060405180830381865afa15801561188b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5891906120e4565b6115b381611af2565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611920573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194491906120c2565b610b2a57600080fd5b60008281526002602090815260408083206001600160a01b038516845290915290205460ff166108215761198b816001600160a01b03166014611b38565b611996836020611b38565b6040516020016119a79291906121ce565b60408051601f198184030181529082905262461bcd60e51b8252610c0c91600401611d8b565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff166108215760008281526002602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611a2b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff16156108215760008281526002602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000546001600160a01b03163314611b0957600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60606000611b47836002612265565b611b52906002612284565b67ffffffffffffffff811115611b6a57611b6a61229c565b6040519080825280601f01601f191660200182016040528015611b94576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611bcb57611bcb6122b2565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611c1657611c166122b2565b60200101906001600160f81b031916908160001a9053506000611c3a846002612265565b611c45906001612284565b90505b6001811115611cca577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611c8657611c866122b2565b1a60f81b828281518110611c9c57611c9c6122b2565b60200101906001600160f81b031916908160001a90535060049490941c93611cc3816122c8565b9050611c48565b508315610f585760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c0c565b600060208284031215611d2b57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610f5857600080fd5b60005b83811015611d76578181015183820152602001611d5e565b83811115611d85576000848401525b50505050565b6020815260008251806020840152611daa816040850160208701611d5b565b601f01601f19169190910160400192915050565b6001600160a01b03811681146115b357600080fd5b60008060408385031215611de657600080fd5b8235611df181611dbe565b946020939093013593505050565b600060208284031215611e1157600080fd5b8135610f5881611dbe565b600080600060608486031215611e3157600080fd5b8335611e3c81611dbe565b92506020840135611e4c81611dbe565b929592945050506040919091013590565b600060208284031215611e6f57600080fd5b5035919050565b60008060408385031215611e8957600080fd5b823591506020830135611e9b81611dbe565b809150509250929050565b803560ff81168114611eb757600080fd5b919050565b60008060008060008060c08789031215611ed557600080fd5b8635611ee081611dbe565b95506020870135945060408701359350611efc60608801611ea6565b92506080870135915060a087013590509295509295509295565b60008083601f840112611f2857600080fd5b50813567ffffffffffffffff811115611f4057600080fd5b602083019150836020828501011115611f5857600080fd5b9250929050565b60008060008060608587031215611f7557600080fd5b8435611f8081611dbe565b935060208501359250604085013567ffffffffffffffff811115611fa357600080fd5b611faf87828801611f16565b95989497509550505050565b60008060008060008060c08789031215611fd457600080fd5b8635611fdf81611dbe565b95506020870135611fef81611dbe565b945060408701359350611efc60608801611ea6565b60008060006040848603121561201957600080fd5b833561202481611dbe565b9250602084013567ffffffffffffffff81111561204057600080fd5b61204c86828701611f16565b9497909650939450505050565b6000806040838503121561206c57600080fd5b823561207781611dbe565b91506020830135611e9b81611dbe565b600181811c9082168061209b57607f821691505b602082108114156120bc57634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156120d457600080fd5b81518015158114610f5857600080fd5b6000602082840312156120f657600080fd5b5051919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60006001600160a01b038088168352808716602084015250846040830152608060608301526121596080830184866120fd565b979650505050505050565b83815260406020820152600061217e6040830184866120fd565b95945050505050565b60006020828403121561219957600080fd5b8151610f5881611dbe565b6000602082840312156121b657600080fd5b81516001600160e81b031981168114610f5857600080fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612206816017850160208801611d5b565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612243816028840160208801611d5b565b01602801949350505050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561227f5761227f61224f565b500290565b600082198211156122975761229761224f565b500190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816122d7576122d761224f565b50600019019056fea264697066735822122000bcfad411fd04150a9a6768b53dedf1312766814a43adabf431192de0a6baf064736f6c634300080b0033000000000000000000000000a6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102535760003560e01c80636eb4c6091161014b578063a217fddf116100cc578063d547741f11610086578063e30c39781161006e578063e30c397814610522578063e72db5fd14610535578063f2fde38b1461055c57005b8063d547741f146104fc578063dd62ed3e1461050f57005b8063a9059cbb116100b4578063a9059cbb146104c3578063c0ee0b8a146104d6578063cf2c52cb146104e957005b8063a217fddf14610494578063a3b0b5a31461049c57005b80638da5cb5b1161011d57806392eefe9b1161010557806392eefe9b1461047157806395d89b41146104845780639f727c271461048c57005b80638da5cb5b1461042557806391d148541461043857005b80636eb4c609146103d157806370a08231146103e4578063715018a6146103f75780638ba47bdd146103ff57005b80632f2ff15d116101d55780633823caec116101a757806340c10f191161018f57806340c10f19146103a3578063449a52f8146103b65780634e71e0c8146103c957005b80633823caec1461037d5780634000aea01461039057005b80632f2ff15d1461032a5780633018205f1461033d578063313ce5671461036257806336568abe1461036a57005b806318160ddd11610226578063248a9ca31161020e578063248a9ca3146102e15780632aed7f3f146103045780632e1a7d4d1461031757005b806318160ddd146102b857806323b872dd146102ce57005b806301ffc9a71461025557806306fdde031461027d578063095ea7b31461029257806317ffc320146102a5575b005b610268610263366004611d19565b61056f565b60405190151581526020015b60405180910390f35b610285610608565b6040516102749190611d8b565b6102686102a0366004611dd3565b610696565b6102536102b3366004611dff565b610782565b6102c0610825565b604051908152602001610274565b6102686102dc366004611e1c565b6108b1565b6102c06102ef366004611e5d565b60009081526002602052604090206001015490565b610253610312366004611dff565b6109a6565b610253610325366004611e5d565b610a3a565b610253610338366004611e76565b610b04565b6003546001600160a01b03165b6040516001600160a01b039091168152602001610274565b6102c0610b2f565b610253610378366004611e76565b610b92565b61026861038b366004611ebc565b610c1f565b61026861039e366004611f5f565b610d2e565b6102686103b1366004611dd3565b610e69565b6102686103c4366004611dd3565b610f5f565b61025361103e565b6102c06103df366004611fbb565b6110c6565b6102c06103f2366004611dff565b6111c3565b610253611232565b60065461040c9060e81b81565b6040516001600160e81b03199091168152602001610274565b60005461034a906001600160a01b031681565b610268610446366004611e76565b60009182526002602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61025361047f366004611dff565b61129e565b6102856115b6565b6102536115c3565b6102c0600081565b6102c07f8f4f2da22e8ac8f11e15f9fc141cddbb5deea8800186560abb6e68c5496619a981565b6102686104d1366004611dd3565b611614565b6102536104e4366004611f5f565b600080fd5b6102536104f7366004612004565b6116f2565b61025361050a366004611e76565b6117f9565b6102c061051d366004612059565b61181f565b60015461034a906001600160a01b031681565b6102c07f12ff340d0cd9c652c747ca35727e68c547d0f0bfa7758d2e77f75acef481b4f281565b61025361056a366004611dff565b6118af565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061060257507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6004805461061590612087565b80601f016020809104026020016040519081016040528092919081815260200182805461064190612087565b801561068e5780601f106106635761010080835404028352916020019161068e565b820191906000526020600020905b81548152906001019060200180831161067157829003601f168201915b505050505081565b6003546040517f774d54090000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03848116602483015260448201849052600092169063774d5409906064016020604051808303816000875af1158015610709573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072d91906120c2565b9050826001600160a01b0316336001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161077491815260200190565b60405180910390a392915050565b6000546001600160a01b0316331461079957600080fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156107e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080491906120e4565b600054909150610821906001600160a01b038481169116836118b8565b5050565b600354604080517f18160ddd00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015610888573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ac91906120e4565b905090565b6003546040517fe974fee90000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b038581166024830152848116604483015260648201849052600092169063e974fee9906084016020604051808303816000875af115801561092c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095091906120c2565b9050826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161099791815260200190565b60405180910390a39392505050565b6000546001600160a01b031633146109bd57600080fd5b6000546040517ff2fde38b0000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152829182169063f2fde38b90602401600060405180830381600087803b158015610a1e57600080fd5b505af1158015610a32573d6000803e3d6000fd5b505050505050565b6003546040517f79cc6790000000000000000000000000000000000000000000000000000000008152336004820152602481018390526001600160a01b03909116906379cc6790906044016020604051808303816000875af1158015610aa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac891906120c2565b5060405181815260009033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350565b600082815260026020526040902060010154610b20813361194d565b610b2a83836119cd565b505050565b600354604080517f313ce56700000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163313ce5679160048083019260209291908290030181865afa158015610888573d6000803e3d6000fd5b6001600160a01b0381163314610c155760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6108218282611a6f565b6003546040517f4eb007540000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b038881166024830152604482018890526064820187905260ff8616608483015260a4820185905260c482018490526000921690634eb007549060e4016020604051808303816000875af1158015610cb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd491906120c2565b905060006001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef88604051610d1c91815260200190565b60405180910390a39695505050505050565b6003546040517f9e7f43ca0000000000000000000000000000000000000000000000000000000081526000916001600160a01b031690639e7f43ca90610d809033908990899089908990600401612126565b6020604051808303816000875af1158015610d9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc391906120c2565b9050846001600160a01b0316336001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051610e0a91815260200190565b60405180910390a3846001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16868686604051610e5993929190612164565b60405180910390a3949350505050565b3360009081527f01fe8a47b306d7a52efb17b73cdfe0b3311b7856a8f6b264a0f03659201b1e9e602052604081205460ff16610ee75760405162461bcd60e51b815260206004820152601760248201527f63616c6c6572206973206e6f74205052454449434154450000000000000000006044820152606401610c0c565b6040516308934a5f60e31b81526001600160a01b038416600482015260248101839052309063449a52f8906044016020604051808303816000875af1158015610f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5891906120c2565b9392505050565b6003546040517f322ec0fb0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03848116602483015260448201849052600092169063322ec0fb906064016020604051808303816000875af1158015610fd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff691906120c2565b9050826001600160a01b031660006001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161077491815260200190565b6001546001600160a01b0316331461105557600080fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600180546000805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b03841617909155169055565b6003546040517f3cd1570f0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03888116602483015287811660448301526064820187905260ff8616608483015260a4820185905260c482018490526000921690633cd1570f9060e4016020604051808303816000875af1158015611158573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117c91906120e4565b9050856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610d1c91815260200190565b6003546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a0823190602401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060291906120e4565b6000546001600160a01b0316331461124957600080fd5b600080546040516001600160a01b03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b031633146112b557600080fd5b6001600160a01b0381166113315760405162461bcd60e51b815260206004820152602d60248201527f636f6e74726f6c6c657220616464726573732063616e6e6f742062652074686560448201527f206e756c6c2061646472657373000000000000000000000000000000000000006064820152608401610c0c565b6003546006546040516001600160a01b0384811693169160e81b6001600160e81b031916907f2ce3a3a1c097de2b147145a1e6f236b569e75e7310e3b0b436d5dea8f60e35dc90600090a46003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316908117909155604080517e3074ff0000000000000000000000000000000000000000000000000000000081529051309291623074ff9160048083019260209291908290030181865afa1580156113fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141f9190612187565b6001600160a01b03161461149b5760405162461bcd60e51b815260206004820152602760248201527f636f6e74726f6c6c65722066726f6e74656e6420646f6573206e6f7420706f6960448201527f6e74206261636b000000000000000000000000000000000000000000000000006064820152608401610c0c565b600654600354604080517f8ba47bdd000000000000000000000000000000000000000000000000000000008152905160e89390931b6001600160e81b031916926001600160a01b0390921691638ba47bdd916004808201926020929091908290030181865afa158015611512573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061153691906121a4565b6001600160e81b031916146115b35760405162461bcd60e51b815260206004820152602760248201527f7469636b657220646f6573206e6f74206d6174636820636f6e74726f6c6c657260448201527f207469636b6574000000000000000000000000000000000000000000000000006064820152608401610c0c565b50565b6005805461061590612087565b6000546001600160a01b031633146115da57600080fd5b600080546040516001600160a01b03909116914780156108fc02929091818181858888f193505050501580156115b3573d6000803e3d6000fd5b6003546040517fe174fd940000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03848116602483015260448201849052600092169063e174fd94906064016020604051808303816000875af1158015611687573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ab91906120c2565b9050826001600160a01b0316336001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161077491815260200190565b3360009081527f9cd58e85166b00f2c5084ab3c52b6a5cfc82b0f8dcb5209201f73c0cff91daff602052604090205460ff166117705760405162461bcd60e51b815260206004820152601960248201527f63616c6c6572206973206e6f742061204445504f5349544f52000000000000006044820152606401610c0c565b600061177e82840184611e5d565b6040516308934a5f60e31b81526001600160a01b038616600482015260248101829052909150309063449a52f8906044016020604051808303816000875af11580156117ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f291906120c2565b5050505050565b600082815260026020526040902060010154611815813361194d565b610b2a8383611a6f565b6003546040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528381166024830152600092169063dd62ed3e90604401602060405180830381865afa15801561188b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5891906120e4565b6115b381611af2565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015611920573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194491906120c2565b610b2a57600080fd5b60008281526002602090815260408083206001600160a01b038516845290915290205460ff166108215761198b816001600160a01b03166014611b38565b611996836020611b38565b6040516020016119a79291906121ce565b60408051601f198184030181529082905262461bcd60e51b8252610c0c91600401611d8b565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff166108215760008281526002602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611a2b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff16156108215760008281526002602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000546001600160a01b03163314611b0957600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60606000611b47836002612265565b611b52906002612284565b67ffffffffffffffff811115611b6a57611b6a61229c565b6040519080825280601f01601f191660200182016040528015611b94576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611bcb57611bcb6122b2565b60200101906001600160f81b031916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611c1657611c166122b2565b60200101906001600160f81b031916908160001a9053506000611c3a846002612265565b611c45906001612284565b90505b6001811115611cca577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611c8657611c866122b2565b1a60f81b828281518110611c9c57611c9c6122b2565b60200101906001600160f81b031916908160001a90535060049490941c93611cc3816122c8565b9050611c48565b508315610f585760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c0c565b600060208284031215611d2b57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610f5857600080fd5b60005b83811015611d76578181015183820152602001611d5e565b83811115611d85576000848401525b50505050565b6020815260008251806020840152611daa816040850160208701611d5b565b601f01601f19169190910160400192915050565b6001600160a01b03811681146115b357600080fd5b60008060408385031215611de657600080fd5b8235611df181611dbe565b946020939093013593505050565b600060208284031215611e1157600080fd5b8135610f5881611dbe565b600080600060608486031215611e3157600080fd5b8335611e3c81611dbe565b92506020840135611e4c81611dbe565b929592945050506040919091013590565b600060208284031215611e6f57600080fd5b5035919050565b60008060408385031215611e8957600080fd5b823591506020830135611e9b81611dbe565b809150509250929050565b803560ff81168114611eb757600080fd5b919050565b60008060008060008060c08789031215611ed557600080fd5b8635611ee081611dbe565b95506020870135945060408701359350611efc60608801611ea6565b92506080870135915060a087013590509295509295509295565b60008083601f840112611f2857600080fd5b50813567ffffffffffffffff811115611f4057600080fd5b602083019150836020828501011115611f5857600080fd5b9250929050565b60008060008060608587031215611f7557600080fd5b8435611f8081611dbe565b935060208501359250604085013567ffffffffffffffff811115611fa357600080fd5b611faf87828801611f16565b95989497509550505050565b60008060008060008060c08789031215611fd457600080fd5b8635611fdf81611dbe565b95506020870135611fef81611dbe565b945060408701359350611efc60608801611ea6565b60008060006040848603121561201957600080fd5b833561202481611dbe565b9250602084013567ffffffffffffffff81111561204057600080fd5b61204c86828701611f16565b9497909650939450505050565b6000806040838503121561206c57600080fd5b823561207781611dbe565b91506020830135611e9b81611dbe565b600181811c9082168061209b57607f821691505b602082108114156120bc57634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156120d457600080fd5b81518015158114610f5857600080fd5b6000602082840312156120f657600080fd5b5051919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60006001600160a01b038088168352808716602084015250846040830152608060608301526121596080830184866120fd565b979650505050505050565b83815260406020820152600061217e6040830184866120fd565b95945050505050565b60006020828403121561219957600080fd5b8151610f5881611dbe565b6000602082840312156121b657600080fd5b81516001600160e81b031981168114610f5857600080fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612206816017850160208801611d5b565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612243816028840160208801611d5b565b01602801949350505050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561227f5761227f61224f565b500290565b600082198211156122975761229761224f565b500190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816122d7576122d761224f565b50600019019056fea264697066735822122000bcfad411fd04150a9a6768b53dedf1312766814a43adabf431192de0a6baf064736f6c634300080b0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa
-----Decoded View---------------
Arg [0] : childChainManagerProxy (address): 0xA6FA4fB5f76172d178d61B04b0ecd319C5d1C0aa
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000a6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa
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.