ERC-20
Overview
Max Total Supply
3,695,314,081.169219791539188746 wSPA
Holders
93
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
0.002398 wSPAValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
SperaxTokenL1
Compiler Version
v0.6.12+commit.27d51765
Contract Source Code (Solidity Multiple files format)
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./ERC20.sol"; import "./SafeERC20.sol"; import "./Ownable.sol"; import "./L1CustomGateway.sol"; import "./L1GatewayRouter.sol"; import "./ICustomToken.sol"; import "./ISperaxToken.sol"; contract SperaxTokenL1 is ERC20, Ownable, ICustomToken { using SafeERC20 for IERC20; address public spaAddress; address public bridge; address public router; bool private shouldRegisterGateway; event ArbitrumGatewayRouterChanged(address newBridge, address newRouter); event SPAaddressUpdated(address oldSPA, address newSPA); modifier onlyGateway() { require(_msgSender() == bridge, "ONLY_GATEWAY"); _; } constructor(string memory name_, string memory symbol_, address _spaAddress, address _bridge, address _router) ERC20(name_, symbol_) public { spaAddress = _spaAddress; bridge = _bridge; router = _router; } function transferFrom(address sender, address recipient, uint256 amount) public override(ERC20, ICustomToken) returns (bool) { return ERC20.transferFrom(sender, recipient, amount); } function balanceOf(address account) public view override(ERC20, ICustomToken) returns (uint256) { return ERC20.balanceOf(account); } /** * @dev mint SperaxTokenL1 */ function mint(uint256 amount) external { ISperaxToken(spaAddress).burnFrom(_msgSender(), amount); _mint(_msgSender(), amount); } /** * @dev burn SperaxTokenL1 */ function burn(uint256 amount) external { ISperaxToken(spaAddress).mintForUSDs(_msgSender(), amount); _burn(_msgSender(), amount); } /** * @dev mint SPA when user withdraw from Arbitrum L2 */ function bridgeMint(address account, uint256 amount) onlyGateway external { ISperaxToken(spaAddress).mintForUSDs(account, amount); } // Arbitrum /// @dev we only set shouldRegisterGateway to true when in `registerTokenOnL2` function isArbitrumEnabled() external view override returns (uint8) { require(shouldRegisterGateway, "NOT_EXPECTED_CALL"); return uint8(0xa4b1); } /** * @notice change the arbitrum bridge and router address * @dev normally this function should not be called * @param newBridge the new bridge address * @param newRouter the new router address */ function changeArbToken(address newBridge, address newRouter) external onlyOwner { bridge = newBridge; router = newRouter; emit ArbitrumGatewayRouterChanged(bridge, router); } function changeSpaAddress(address newSPA) external onlyOwner { emit SPAaddressUpdated(spaAddress, newSPA); spaAddress = newSPA; } function registerTokenOnL2( address l2CustomTokenAddress, uint256 maxSubmissionCostForCustomBridge, uint256 maxSubmissionCostForRouter, uint256 maxGas, uint256 gasPriceBid, uint256 valueForGateway, uint256 valueForRouter, address creditBackAddress ) external payable onlyOwner override { // we temporarily set `shouldRegisterGateway` to true for the callback in registerTokenToL2 to succeed bool prev = shouldRegisterGateway; shouldRegisterGateway = true; L1CustomGateway(bridge).registerTokenToL2{value:valueForGateway}( l2CustomTokenAddress, maxGas, gasPriceBid, maxSubmissionCostForCustomBridge, creditBackAddress ); L1GatewayRouter(router).setGateway{value:valueForRouter}( bridge, maxGas, gasPriceBid, maxSubmissionCostForRouter, creditBackAddress ); shouldRegisterGateway = prev; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 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"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (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"); // solhint-disable-next-line avoid-low-level-calls (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"); // solhint-disable-next-line avoid-low-level-calls (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"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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 // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2019-2021, Offchain Labs, Inc. * * 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.6.11; library AddressAliasHelper { uint160 constant offset = uint160(0x1111000000000000000000000000000000001111); /// @notice Utility function that converts the address in the L1 that submitted a tx to /// the inbox to the msg.sender viewed in the L2 /// @param l1Address the address in the L1 that triggered the tx to L2 /// @return l2Address L2 address as viewed in msg.sender function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) { l2Address = address(uint160(l1Address) + offset); } /// @notice Utility function that converts the msg.sender viewed in the L2 to the /// address in the L1 that submitted a tx to the inbox /// @param l2Address L2 address as viewed in msg.sender /// @return l1Address the address in the L1 that triggered the tx to L2 function undoL1ToL2Alias(address l2Address) internal pure returns (address l1Address) { l1Address = address(uint160(l2Address) - offset); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.4.21 <0.7.0; /** * @title Precompiled contract that exists in every Arbitrum chain at address(100), 0x0000000000000000000000000000000000000064. Exposes a variety of system-level functionality. */ interface ArbSys { /** * @notice Get internal version number identifying an ArbOS build * @return version number as int */ function arbOSVersion() external pure returns (uint); function arbChainID() external view returns(uint); /** * @notice Get Arbitrum block number (distinct from L1 block number; Arbitrum genesis block has block number 0) * @return block number as int */ function arbBlockNumber() external view returns (uint); /** * @notice Send given amount of Eth to dest from sender. * This is a convenience function, which is equivalent to calling sendTxToL1 with empty calldataForL1. * @param destination recipient address on L1 * @return unique identifier for this L2-to-L1 transaction. */ function withdrawEth(address destination) external payable returns(uint); /** * @notice Send a transaction to L1 * @param destination recipient address on L1 * @param calldataForL1 (optional) calldata for L1 contract call * @return a unique identifier for this L2-to-L1 transaction. */ function sendTxToL1(address destination, bytes calldata calldataForL1) external payable returns(uint); /** * @notice get the number of transactions issued by the given external account or the account sequence number of the given contract * @param account target account * @return the number of transactions issued by the given external account or the account sequence number of the given contract */ function getTransactionCount(address account) external view returns(uint256); /** * @notice get the value of target L2 storage slot * This function is only callable from address 0 to prevent contracts from being able to call it * @param account target account * @param index target index of storage slot * @return stotage value for the given account at the given index */ function getStorageAt(address account, uint256 index) external view returns (uint256); /** * @notice check if current call is coming from l1 * @return true if the caller of this was called directly from L1 */ function isTopLevelCall() external view returns (bool); /** * @notice check if the caller (of this caller of this) is an aliased L1 contract address * @return true iff the caller's address is an alias for an L1 contract address */ function wasMyCallersAddressAliased() external view returns (bool); /** * @notice return the address of the caller (of this caller of this), without applying L1 contract address aliasing * @return address of the caller's caller, without applying L1 contract address aliasing */ function myCallersAddressWithoutAliasing() external view returns (address); /** * @notice map L1 sender contract address to its L2 alias * @param sender sender address * @param dest destination address * @return aliased sender address */ function mapL1SenderContractAddressToL2Alias(address sender, address dest) external pure returns(address); /** * @notice get the caller's amount of available storage gas * @return amount of storage gas available to the caller */ function getStorageGasAvailable() external returns(uint); event L2ToL1Transaction(address caller, address indexed destination, uint indexed uniqueId, uint indexed batchNumber, uint indexInBatch, uint arbBlockNum, uint ethBlockNum, uint timestamp, uint callvalue, bytes data); }
// SPDX-License-Identifier: MIT /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity ^0.6.11; /* solhint-disable no-inline-assembly */ library BytesLib { function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= (_start + 20), "Read out of bounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= (_start + 1), "Read out of bounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= (_start + 32), "Read out of bounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= (_start + 32), "Read out of bounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } } /* solhint-enable no-inline-assembly */
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <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 GSN 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 payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Helper to make usage of the `CREATE2` EVM opcode easier and safer. * `CREATE2` can be used to compute in advance the address where a smart * contract will be deployed, which allows for interesting new mechanisms known * as 'counterfactual interactions'. * * See the https://eips.ethereum.org/EIPS/eip-1014#motivation[EIP] for more * information. */ library Create2 { /** * @dev Deploys a contract using `CREATE2`. The address where the contract * will be deployed can be known in advance via {computeAddress}. * * The bytecode for a contract can be obtained from Solidity with * `type(contractName).creationCode`. * * Requirements: * * - `bytecode` must not be empty. * - `salt` must have not been used for `bytecode` already. * - the factory must have a balance of at least `amount`. * - if `amount` is non-zero, `bytecode` must have a `payable` constructor. */ function deploy(uint256 amount, bytes32 salt, bytes memory bytecode) internal returns (address) { address addr; require(address(this).balance >= amount, "Create2: insufficient balance"); require(bytecode.length != 0, "Create2: bytecode length is zero"); // solhint-disable-next-line no-inline-assembly assembly { addr := create2(amount, add(bytecode, 0x20), mload(bytecode), salt) } require(addr != address(0), "Create2: Failed on deploy"); return addr; } /** * @dev Returns the address where a contract will be stored if deployed via {deploy}. Any change in the * `bytecodeHash` or `salt` will result in a new destination address. */ function computeAddress(bytes32 salt, bytes32 bytecodeHash) internal view returns (address) { return computeAddress(salt, bytecodeHash, address(this)); } /** * @dev Returns the address where a contract will be stored if deployed via {deploy} from a contract located at * `deployer`. If `deployer` is this contract's address, returns the same value as {computeAddress}. */ function computeAddress(bytes32 salt, bytes32 bytecodeHash, address deployer) internal pure returns (address) { bytes32 _data = keccak256( abi.encodePacked(bytes1(0xff), deployer, salt, bytecodeHash) ); return address(uint160(uint256(_data))); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./Context.sol"; import "./IERC20.sol"; import "./SafeMath.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal virtual { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2021, Offchain Labs, Inc. * * 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.6.11; /// @notice this library manages encoding and decoding of gateway communication library GatewayMessageHandler { // these are for communication from L1 to L2 gateway function encodeToL2GatewayMsg(bytes memory gatewayData, bytes memory callHookData) internal pure returns (bytes memory res) { res = abi.encode(gatewayData, callHookData); } function parseFromL1GatewayMsg(bytes calldata _data) internal pure returns (bytes memory gatewayData, bytes memory callHookData) { // abi decode may revert, but the encoding is done by L1 gateway, so we trust it (gatewayData, callHookData) = abi.decode(_data, (bytes, bytes)); } // these are for communication from L2 to L1 gateway function encodeFromL2GatewayMsg(uint256 exitNum, bytes memory callHookData) internal pure returns (bytes memory res) { res = abi.encode(exitNum, callHookData); } function parseToL1GatewayMsg(bytes calldata _data) internal pure returns (uint256 exitNum, bytes memory callHookData) { // abi decode may revert, but the encoding is done by L1 gateway, so we trust it (exitNum, callHookData) = abi.decode(_data, (uint256, bytes)); } // these are for communication from router to gateway function encodeFromRouterToGateway(address _from, bytes calldata _data) internal pure returns (bytes memory res) { // abi decode may revert, but the encoding is done by L1 gateway, so we trust it return abi.encode(_from, _data); } function parseFromRouterToGateway(bytes calldata _data) internal pure returns (address, bytes memory res) { // abi decode may revert, but the encoding is done by L1 gateway, so we trust it return abi.decode(_data, (address, bytes)); } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; import "./ProxyUtil.sol"; import "./Address.sol"; import "./TokenGateway.sol"; import "./GatewayMessageHandler.sol"; /** * @title Common interface for L1 and L2 Gateway Routers */ abstract contract GatewayRouter is TokenGateway { using Address for address; address internal constant ZERO_ADDR = address(0); address internal constant DISABLED = address(1); mapping(address => address) public l1TokenToGateway; address public defaultGateway; event TransferRouted( address indexed token, address indexed _userFrom, address indexed _userTo, address gateway ); event GatewaySet(address indexed l1Token, address indexed gateway); event DefaultGatewayUpdated(address newDefaultGateway); function postUpgradeInit() external { // it is assumed the L2 Arbitrum Gateway contract is behind a Proxy controlled by a proxy admin // this function can only be called by the proxy admin contract address proxyAdmin = ProxyUtil.getProxyAdmin(); require(msg.sender == proxyAdmin, "NOT_FROM_ADMIN"); // this has no other logic since the current upgrade doesn't require this logic } function _initialize( address _counterpartGateway, address _router, address _defaultGateway ) internal { // if you are a router, you can't have a router require(_router == address(0), "BAD_ROUTER"); TokenGateway._initialize(_counterpartGateway, _router); // default gateway can have 0 address defaultGateway = _defaultGateway; } function finalizeInboundTransfer( address, /* _token */ address, /* _from */ address, /* _to */ uint256, /* _amount */ bytes calldata /* _data */ ) external payable virtual override { revert("ONLY_OUTBOUND_ROUTER"); } function outboundTransfer( address _token, address _to, uint256 _amount, uint256 _maxGas, uint256 _gasPriceBid, bytes calldata _data ) public payable virtual override returns (bytes memory) { address gateway = getGateway(_token); bytes memory gatewayData = GatewayMessageHandler.encodeFromRouterToGateway( msg.sender, _data ); emit TransferRouted(_token, msg.sender, _to, gateway); return ITokenGateway(gateway).outboundTransfer{ value: msg.value }( _token, _to, _amount, _maxGas, _gasPriceBid, gatewayData ); } function getOutboundCalldata( address _token, address _from, address _to, uint256 _amount, bytes memory _data ) public view virtual override returns (bytes memory) { address gateway = getGateway(_token); return TokenGateway(gateway).getOutboundCalldata(_token, _from, _to, _amount, _data); } function getGateway(address _token) public view virtual returns (address gateway) { gateway = l1TokenToGateway[_token]; if (gateway == ZERO_ADDR) { // if no gateway value set, use default gateway gateway = defaultGateway; } if (gateway == DISABLED || !gateway.isContract()) { // not a valid gateway return ZERO_ADDR; } return gateway; } function calculateL2TokenAddress(address l1ERC20) public view virtual override returns (address) { address gateway = getGateway(l1ERC20); if (gateway == ZERO_ADDR) { return ZERO_ADDR; } return TokenGateway(gateway).calculateL2TokenAddress(l1ERC20); } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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. */ /** * @title Minimum expected interface for L2 token that interacts with the L2 token bridge (this is the interface necessary * for a custom token that interacts with the bridge, see TestArbCustomToken.sol for an example implementation). */ pragma solidity ^0.6.11; interface IArbToken { /** * @notice should increase token supply by amount, and should (probably) only be callable by the L1 bridge. */ function bridgeMint(address account, uint256 amount) external; /** * @notice should decrease token supply by amount, and should (probably) only be callable by the L1 bridge. */ function bridgeBurn(address account, uint256 amount) external; /** * @return address of layer 1 token */ function l1Address() external view returns (address); }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2021, Offchain Labs, Inc. * * 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.6.11; interface IBridge { event MessageDelivered( uint256 indexed messageIndex, bytes32 indexed beforeInboxAcc, address inbox, uint8 kind, address sender, bytes32 messageDataHash ); event BridgeCallTriggered( address indexed outbox, address indexed destAddr, uint256 amount, bytes data ); event InboxToggle(address indexed inbox, bool enabled); event OutboxToggle(address indexed outbox, bool enabled); function deliverMessageToInbox( uint8 kind, address sender, bytes32 messageDataHash ) external payable returns (uint256); function executeCall( address destAddr, uint256 amount, bytes calldata data ) external returns (bool success, bytes memory returnData); // These are only callable by the admin function setInbox(address inbox, bool enabled) external; function setOutbox(address inbox, bool enabled) external; // View functions function activeOutbox() external view returns (address); function allowedInboxes(address inbox) external view returns (bool); function allowedOutboxes(address outbox) external view returns (bool); function inboxAccs(uint256 index) external view returns (bytes32); function messageCount() external view returns (uint256); }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; // import "./ITokenGateway.sol"; interface ICustomGateway { function l1ToL2Token(address _l1Token) external view returns (address _l2Token); event TokenSet(address indexed l1Address, address indexed l2Address); }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; interface ArbitrumEnabledToken { /// @notice should return `0xa4b1` if token is enabled for arbitrum gateways function isArbitrumEnabled() external view returns (uint8); } /** * @title Minimum expected interface for L1 custom token (see TestCustomTokenL1.sol for an example implementation) */ interface ICustomToken is ArbitrumEnabledToken { /** * @notice Should make an external call to EthERC20Bridge.registerCustomL2Token */ function registerTokenOnL2( address l2CustomTokenAddress, uint256 maxSubmissionCostForCustomBridge, uint256 maxSubmissionCostForRouter, uint256 maxGas, uint256 gasPriceBid, uint256 valueForGateway, uint256 valueForRouter, address creditBackAddress ) external payable; function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); function balanceOf(address account) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2021, Offchain Labs, Inc. * * 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.6.11; import "./IBridge.sol"; import "./IMessageProvider.sol"; interface IInbox is IMessageProvider { function sendL2Message(bytes calldata messageData) external returns (uint256); function sendUnsignedTransaction( uint256 maxGas, uint256 gasPriceBid, uint256 nonce, address destAddr, uint256 amount, bytes calldata data ) external returns (uint256); function sendContractTransaction( uint256 maxGas, uint256 gasPriceBid, address destAddr, uint256 amount, bytes calldata data ) external returns (uint256); function sendL1FundedUnsignedTransaction( uint256 maxGas, uint256 gasPriceBid, uint256 nonce, address destAddr, bytes calldata data ) external payable returns (uint256); function sendL1FundedContractTransaction( uint256 maxGas, uint256 gasPriceBid, address destAddr, bytes calldata data ) external payable returns (uint256); function createRetryableTicket( address destAddr, uint256 arbTxCallValue, uint256 maxSubmissionCost, address submissionRefundAddress, address valueRefundAddress, uint256 maxGas, uint256 gasPriceBid, bytes calldata data ) external payable returns (uint256); function depositEth(uint256 maxSubmissionCost) external payable returns (uint256); function bridge() external view returns (IBridge); function pauseCreateRetryables() external; function unpauseCreateRetryables() external; function startRewriteAddress() external; function stopRewriteAddress() external; }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2021, Offchain Labs, Inc. * * 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.6.11; interface IMessageProvider { event InboxMessageDelivered(uint256 indexed messageNum, bytes data); event InboxMessageDeliveredFromOrigin(uint256 indexed messageNum); }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2021, Offchain Labs, Inc. * * 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.6.11; interface IOutbox { event OutboxEntryCreated( uint256 indexed batchNum, uint256 outboxEntryIndex, bytes32 outputRoot, uint256 numInBatch ); event OutBoxTransactionExecuted( address indexed destAddr, address indexed l2Sender, uint256 indexed outboxEntryIndex, uint256 transactionIndex ); function l2ToL1Sender() external view returns (address); function l2ToL1Block() external view returns (uint256); function l2ToL1EthBlock() external view returns (uint256); function l2ToL1Timestamp() external view returns (uint256); function l2ToL1BatchNum() external view returns (uint256); function l2ToL1OutputId() external view returns (bytes32); function processOutgoingMessages(bytes calldata sendsData, uint256[] calldata sendLengths) external; function outboxEntryExists(uint256 batchNum) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ISperaxToken { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function burnFrom(address account, uint256 amount) external; function mintForUSDs(address account, uint256 amount) external; }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; interface ITokenGateway { /// @notice event deprecated in favor of DepositInitiated and WithdrawalInitiated // event OutboundTransferInitiated( // address token, // address indexed _from, // address indexed _to, // uint256 indexed _transferId, // uint256 _amount, // bytes _data // ); /// @notice event deprecated in favor of DepositFinalized and WithdrawalFinalized // event InboundTransferFinalized( // address token, // address indexed _from, // address indexed _to, // uint256 indexed _transferId, // uint256 _amount, // bytes _data // ); function outboundTransfer( address _token, address _to, uint256 _amount, uint256 _maxGas, uint256 _gasPriceBid, bytes calldata _data ) external payable returns (bytes memory); function finalizeInboundTransfer( address _token, address _from, address _to, uint256 _amount, bytes calldata _data ) external payable; /** * @notice Calculate the address used when bridging an ERC20 token * @dev the L1 and L2 address oracles may not always be in sync. * For example, a custom token may have been registered but not deploy or the contract self destructed. * @param l1ERC20 address of L1 token * @return L2 address of a bridged ERC20 token */ function calculateL2TokenAddress(address l1ERC20) external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "./IERC20Upgradeable.sol"; interface ITransferAndCall is IERC20Upgradeable { function transferAndCall( address to, uint256 value, bytes memory data ) external returns (bool success); event Transfer(address indexed from, address indexed to, uint256 value, bytes data); } /** * @notice note that implementation of ITransferAndCallReceiver is not expected to return a success bool */ interface ITransferAndCallReceiver { function onTokenTransfer( address _sender, uint256 _value, bytes memory _data ) external; }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; import "./ITransferAndCall.sol"; import "./L1ArbitrumGateway.sol"; interface ITradeableExitReceiver { function onExitTransfer( address sender, uint256 exitNum, bytes calldata data ) external returns (bool); } abstract contract L1ArbitrumExtendedGateway is L1ArbitrumGateway { struct ExitData { bool isExit; address _newTo; bytes _newData; } mapping(bytes32 => ExitData) public redirectedExits; function _initialize( address _l2Counterpart, address _router, address _inbox ) internal virtual override { L1ArbitrumGateway._initialize(_l2Counterpart, _router, _inbox); } event WithdrawRedirected( address indexed from, address indexed to, uint256 indexed exitNum, bytes newData, bytes data, bool madeExternalCall ); /** * @notice Allows a user to redirect their right to claim a withdrawal to another address. * @dev This method also allows you to make an arbitrary call after the transfer. * This does not validate if the exit was already triggered. It is assumed the `_exitNum` is * validated off-chain to ensure this was not yet triggered. * @param _exitNum Sequentially increasing exit counter determined by the L2 bridge * @param _initialDestination address the L2 withdrawal call initially set as the destination. * @param _newDestination address the L1 will now call instead of the previously set destination * @param _newData data to be used in inboundEscrowAndCall * @param _data optional data for external call upon transfering the exit */ function transferExitAndCall( uint256 _exitNum, address _initialDestination, address _newDestination, bytes calldata _newData, bytes calldata _data ) external { // the initial data doesn't make a difference when transfering you exit // since the L2 bridge gives a unique exit ID to each exit (address expectedSender, ) = getExternalCall(_exitNum, _initialDestination, ""); // if you want to transfer your exit, you must be the current destination require(msg.sender == expectedSender, "NOT_EXPECTED_SENDER"); // the inboundEscrowAndCall functionality has been disabled, so no data is allowed require(_newData.length == 0, "NO_DATA_ALLOWED"); setRedirectedExit(_exitNum, _initialDestination, _newDestination, _newData); if (_data.length > 0) { require(_newDestination.isContract(), "TO_NOT_CONTRACT"); bool success = ITradeableExitReceiver(_newDestination).onExitTransfer( expectedSender, _exitNum, _data ); require(success, "TRANSFER_HOOK_FAIL"); } emit WithdrawRedirected( expectedSender, _newDestination, _exitNum, _newData, _data, _data.length > 0 ); } /// @notice this does not verify if the external call was already done function getExternalCall( uint256 _exitNum, address _initialDestination, bytes memory _initialData ) public view virtual override returns (address target, bytes memory data) { // this function is virtual so that subclasses can override it with custom logic where necessary bytes32 withdrawData = encodeWithdrawal(_exitNum, _initialDestination); ExitData storage exit = redirectedExits[withdrawData]; // here we don't authenticate `_initialData`. we could hash it into `withdrawData` but would increase gas costs // this is safe because if the exit isn't overriden, the _initialData coming from L2 is trusted // but if the exit is traded, all we care about is the latest user calldata if (exit.isExit) { return (exit._newTo, exit._newData); } else { return (_initialDestination, _initialData); } } function setRedirectedExit( uint256 _exitNum, address _initialDestination, address _newDestination, bytes memory _newData ) internal { bytes32 withdrawData = encodeWithdrawal(_exitNum, _initialDestination); redirectedExits[withdrawData] = ExitData(true, _newDestination, _newData); } function encodeWithdrawal(uint256 _exitNum, address _initialDestination) public pure returns (bytes32) { // here we assume the L2 bridge gives a unique exitNum to each exit return keccak256(abi.encode(_exitNum, _initialDestination)); } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; import "./ERC20.sol"; import "./SafeERC20.sol"; import "./Create2.sol"; import "./Address.sol"; import "./SafeMath.sol"; import "./IInbox.sol"; import "./ProxyUtil.sol"; import "./L1ArbitrumMessenger.sol"; import "./GatewayMessageHandler.sol"; import "./TokenGateway.sol"; import "./ITransferAndCall.sol"; /** * @title Common interface for gatways on L1 messaging to Arbitrum. */ abstract contract L1ArbitrumGateway is L1ArbitrumMessenger, TokenGateway { using SafeERC20 for IERC20; using Address for address; address public inbox; event DepositInitiated( address l1Token, address indexed _from, address indexed _to, uint256 indexed _sequenceNumber, uint256 _amount ); event WithdrawalFinalized( address l1Token, address indexed _from, address indexed _to, uint256 indexed _exitNum, uint256 _amount ); modifier onlyCounterpartGateway() override { address _inbox = inbox; // a message coming from the counterpart gateway was executed by the bridge address bridge = address(super.getBridge(_inbox)); require(msg.sender == bridge, "NOT_FROM_BRIDGE"); // and the outbox reports that the L2 address of the sender is the counterpart gateway address l2ToL1Sender = super.getL2ToL1Sender(_inbox); require(l2ToL1Sender == counterpartGateway, "ONLY_COUNTERPART_GATEWAY"); _; } function postUpgradeInit() external { // it is assumed the L1 Arbitrum Gateway contract is behind a Proxy controlled by a proxy admin // this function can only be called by the proxy admin contract address proxyAdmin = ProxyUtil.getProxyAdmin(); require(msg.sender == proxyAdmin, "NOT_FROM_ADMIN"); // this has no other logic since the current upgrade doesn't require this logic } function _initialize( address _l2Counterpart, address _router, address _inbox ) internal virtual { TokenGateway._initialize(_l2Counterpart, _router); // L1 gateway must have a router require(_router != address(0), "BAD_ROUTER"); require(_inbox != address(0), "BAD_INBOX"); inbox = _inbox; } /** * @notice Finalizes a withdrawal via Outbox message; callable only by L2Gateway.outboundTransfer * @param _token L1 address of token being withdrawn from * @param _from initiator of withdrawal * @param _to address the L2 withdrawal call set as the destination. * @param _amount Token amount being withdrawn * @param _data encoded exitNum (Sequentially increasing exit counter determined by the L2Gateway) and additinal hook data */ function finalizeInboundTransfer( address _token, address _from, address _to, uint256 _amount, bytes calldata _data ) external payable override onlyCounterpartGateway { (uint256 exitNum, bytes memory callHookData) = GatewayMessageHandler.parseToL1GatewayMsg( _data ); if (callHookData.length != 0) { // callHookData should always be 0 since inboundEscrowAndCall is disabled callHookData = bytes(""); } // we ignore the returned data since the callHook feature is now disabled (_to, ) = getExternalCall(exitNum, _to, callHookData); inboundEscrowTransfer(_token, _to, _amount); emit WithdrawalFinalized(_token, _from, _to, exitNum, _amount); } function getExternalCall( uint256, /* _exitNum */ address _initialDestination, bytes memory _initialData ) public view virtual returns (address target, bytes memory data) { // this method is virtual so the destination of a call can be changed // using tradeable exits in a subclass (L1ArbitrumExtendedGateway) target = _initialDestination; data = _initialData; } function inboundEscrowTransfer( address _l1Token, address _dest, uint256 _amount ) internal virtual { // this method is virtual since different subclasses can handle escrow differently IERC20(_l1Token).safeTransfer(_dest, _amount); } function createOutboundTx( address _from, uint256, /* _tokenAmount */ uint256 _maxGas, uint256 _gasPriceBid, uint256 _maxSubmissionCost, bytes memory _outboundCalldata ) internal virtual returns (uint256) { // We make this function virtual since outboundTransfer logic is the same for many gateways // but sometimes (ie weth) you construct the outgoing message differently. // msg.value is sent, but 0 is set to the L2 call value // the eth sent is used to pay for the tx's gas return sendTxToL2( inbox, counterpartGateway, _from, msg.value, // we forward the L1 call value to the inbox 0, // l2 call value 0 by default L2GasParams({ _maxSubmissionCost: _maxSubmissionCost, _maxGas: _maxGas, _gasPriceBid: _gasPriceBid }), _outboundCalldata ); } /** * @notice Deposit ERC20 token from Ethereum into Arbitrum. If L2 side hasn't been deployed yet, includes name/symbol/decimals data for initial L2 deploy. Initiate by GatewayRouter. * @param _l1Token L1 address of ERC20 * @param _to account to be credited with the tokens in the L2 (can be the user's L2 account or a contract) * @param _amount Token Amount * @param _maxGas Max gas deducted from user's L2 balance to cover L2 execution * @param _gasPriceBid Gas price for L2 execution * @param _data encoded data from router and user * @return res abi encoded inbox sequence number */ // * @param maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee function outboundTransfer( address _l1Token, address _to, uint256 _amount, uint256 _maxGas, uint256 _gasPriceBid, bytes calldata _data ) public payable virtual override returns (bytes memory res) { require(isRouter(msg.sender), "NOT_FROM_ROUTER"); // This function is set as public and virtual so that subclasses can override // it and add custom validation for callers (ie only whitelisted users) address _from; uint256 seqNum; bytes memory extraData; { uint256 _maxSubmissionCost; if (super.isRouter(msg.sender)) { // router encoded (_from, extraData) = GatewayMessageHandler.parseFromRouterToGateway(_data); } else { _from = msg.sender; extraData = _data; } // user encoded (_maxSubmissionCost, extraData) = abi.decode(extraData, (uint256, bytes)); // the inboundEscrowAndCall functionality has been disabled, so no data is allowed require(extraData.length == 0, "EXTRA_DATA_DISABLED"); require(_l1Token.isContract(), "L1_NOT_CONTRACT"); address l2Token = calculateL2TokenAddress(_l1Token); require(l2Token != address(0), "NO_L2_TOKEN_SET"); _amount = outboundEscrowTransfer(_l1Token, _from, _amount); // we override the res field to save on the stack res = getOutboundCalldata(_l1Token, _from, _to, _amount, extraData); seqNum = createOutboundTx( _from, _amount, _maxGas, _gasPriceBid, _maxSubmissionCost, res ); } emit DepositInitiated(_l1Token, _from, _to, seqNum, _amount); return abi.encode(seqNum); } function outboundEscrowTransfer( address _l1Token, address _from, uint256 _amount ) internal virtual returns (uint256 amountReceived) { // this method is virtual since different subclasses can handle escrow differently // user funds are escrowed on the gateway using this function uint256 prevBalance = IERC20(_l1Token).balanceOf(address(this)); IERC20(_l1Token).safeTransferFrom(_from, address(this), _amount); uint256 postBalance = IERC20(_l1Token).balanceOf(address(this)); return SafeMath.sub(postBalance, prevBalance); } function getOutboundCalldata( address _l1Token, address _from, address _to, uint256 _amount, bytes memory _data ) public view virtual override returns (bytes memory outboundCalldata) { // this function is public so users can query how much calldata will be sent to the L2 // before execution // it is virtual since different gateway subclasses can build this calldata differently // ( ie the standard ERC20 gateway queries for a tokens name/symbol/decimals ) bytes memory emptyBytes = ""; outboundCalldata = abi.encodeWithSelector( TokenGateway.finalizeInboundTransfer.selector, _l1Token, _from, _to, _amount, GatewayMessageHandler.encodeToL2GatewayMsg(emptyBytes, _data) ); return outboundCalldata; } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; import "./IInbox.sol"; import "./IOutbox.sol"; /// @notice L1 utility contract to assist with L1 <=> L2 interactions /// @dev this is an abstract contract instead of library so the functions can be easily overriden when testing abstract contract L1ArbitrumMessenger { event TxToL2(address indexed _from, address indexed _to, uint256 indexed _seqNum, bytes _data); struct L2GasParams { uint256 _maxSubmissionCost; uint256 _maxGas; uint256 _gasPriceBid; } function sendTxToL2( address _inbox, address _to, address _user, uint256 _l1CallValue, uint256 _l2CallValue, L2GasParams memory _l2GasParams, bytes memory _data ) internal virtual returns (uint256) { // alternative function entry point when struggling with the stack size return sendTxToL2( _inbox, _to, _user, _l1CallValue, _l2CallValue, _l2GasParams._maxSubmissionCost, _l2GasParams._maxGas, _l2GasParams._gasPriceBid, _data ); } function sendTxToL2( address _inbox, address _to, address _user, uint256 _l1CallValue, uint256 _l2CallValue, uint256 _maxSubmissionCost, uint256 _maxGas, uint256 _gasPriceBid, bytes memory _data ) internal virtual returns (uint256) { uint256 seqNum = IInbox(_inbox).createRetryableTicket{ value: _l1CallValue }( _to, _l2CallValue, _maxSubmissionCost, _user, _user, _maxGas, _gasPriceBid, _data ); emit TxToL2(_user, _to, seqNum, _data); return seqNum; } function getBridge(address _inbox) internal view virtual returns (IBridge) { return IInbox(_inbox).bridge(); } /// @dev the l2ToL1Sender behaves as the tx.origin, the msg.sender should be validated to protect against reentrancies function getL2ToL1Sender(address _inbox) internal view virtual returns (address) { IOutbox outbox = IOutbox(getBridge(_inbox).activeOutbox()); address l2ToL1Sender = outbox.l2ToL1Sender(); require(l2ToL1Sender != address(0), "NO_SENDER"); return l2ToL1Sender; } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; import { ArbitrumEnabledToken } from "./ICustomToken.sol"; import "./L1ArbitrumExtendedGateway.sol"; import "./L2CustomGateway.sol"; import "./ICustomGateway.sol"; import "./Address.sol"; import "./Whitelist.sol"; /** * @title Gatway for "custom" bridging functionality * @notice Handles some (but not all!) custom Gateway needs. */ contract L1CustomGateway is L1ArbitrumExtendedGateway, ICustomGateway { using Address for address; // stores addresses of L2 tokens to be used mapping(address => address) public override l1ToL2Token; // owner is able to force add custom mappings address public owner; // whitelist not used anymore address public whitelist; function initialize( address _l1Counterpart, address _l1Router, address _inbox, address _owner ) public { L1ArbitrumExtendedGateway._initialize(_l1Counterpart, _l1Router, _inbox); owner = _owner; // disable whitelist by default whitelist = address(0); } /** * @notice Calculate the address used when bridging an ERC20 token * @dev the L1 and L2 address oracles may not always be in sync. * For example, a custom token may have been registered but not deploy or the contract self destructed. * @param l1ERC20 address of L1 token * @return L2 address of a bridged ERC20 token */ function calculateL2TokenAddress(address l1ERC20) public view override returns (address) { return l1ToL2Token[l1ERC20]; } /** * @notice Allows L1 Token contract to trustlessly register its custom L2 counterpart. (other registerTokenToL2 method allows excess eth recovery from _maxSubmissionCost and is recommended) * @param _l2Address counterpart address of L1 token * @param _maxGas max gas for L2 retryable exrecution * @param _gasPriceBid gas price for L2 retryable ticket * @param _maxSubmissionCost base submission cost L2 retryable tick3et * @return Retryable ticket ID */ function registerTokenToL2( address _l2Address, uint256 _maxGas, uint256 _gasPriceBid, uint256 _maxSubmissionCost ) external payable returns (uint256) { return registerTokenToL2(_l2Address, _maxGas, _gasPriceBid, _maxSubmissionCost, msg.sender); } /** * @notice Allows L1 Token contract to trustlessly register its custom L2 counterpart. * param _l2Address counterpart address of L1 token * param _maxGas max gas for L2 retryable exrecution * param _gasPriceBid gas price for L2 retryable ticket * param _maxSubmissionCost base submission cost L2 retryable tick3et * param _creditBackAddress address for crediting back overpayment of _maxSubmissionCost * return Retryable ticket ID */ function registerTokenToL2( address _l2Address, uint256 _maxGas, uint256 _gasPriceBid, uint256 _maxSubmissionCost, address _creditBackAddress ) public payable returns (uint256) { require( ArbitrumEnabledToken(msg.sender).isArbitrumEnabled() == uint8(0xa4b1), "NOT_ARB_ENABLED" ); address currL2Addr = l1ToL2Token[msg.sender]; if (currL2Addr != address(0)) { // if token is already set, don't allow it to set a different L2 address require(currL2Addr == _l2Address, "NO_UPDATE_TO_DIFFERENT_ADDR"); } l1ToL2Token[msg.sender] = _l2Address; address[] memory l1Addresses = new address[](1); address[] memory l2Addresses = new address[](1); l1Addresses[0] = msg.sender; l2Addresses[0] = _l2Address; emit TokenSet(l1Addresses[0], l2Addresses[0]); bytes memory _data = abi.encodeWithSelector( L2CustomGateway.registerTokenFromL1.selector, l1Addresses, l2Addresses ); return sendTxToL2( inbox, counterpartGateway, _creditBackAddress, msg.value, 0, _maxSubmissionCost, _maxGas, _gasPriceBid, _data ); } /** * @notice Allows owner to force register a custom L1/L2 token pair. * @dev _l1Addresses[i] counterpart is assumed to be _l2Addresses[i] * @param _l1Addresses array of L1 addresses * @param _l2Addresses array of L2 addresses * @param _maxGas max gas for L2 retryable exrecution * @param _gasPriceBid gas price for L2 retryable ticket * @param _maxSubmissionCost base submission cost L2 retryable tick3et * @return Retryable ticket ID */ function forceRegisterTokenToL2( address[] calldata _l1Addresses, address[] calldata _l2Addresses, uint256 _maxGas, uint256 _gasPriceBid, uint256 _maxSubmissionCost ) external payable returns (uint256) { require(msg.sender == owner, "ONLY_OWNER"); require(_l1Addresses.length == _l2Addresses.length, "INVALID_LENGTHS"); for (uint256 i = 0; i < _l1Addresses.length; i++) { // here we assume the owner checked both addresses offchain before force registering // require(address(_l1Addresses[i]).isContract(), "MUST_BE_CONTRACT"); l1ToL2Token[_l1Addresses[i]] = _l2Addresses[i]; emit TokenSet(_l1Addresses[i], _l2Addresses[i]); } bytes memory _data = abi.encodeWithSelector( L2CustomGateway.registerTokenFromL1.selector, _l1Addresses, _l2Addresses ); return sendTxToL2( inbox, counterpartGateway, msg.sender, msg.value, 0, _maxSubmissionCost, _maxGas, _gasPriceBid, _data ); } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; import "./Whitelist.sol"; import { ArbitrumEnabledToken } from "../ICustomToken.sol"; import "./L1ArbitrumMessenger.sol"; import "./GatewayRouter.sol"; import "./L2GatewayRouter.sol"; /** * @title Handles deposits from Erhereum into Arbitrum. Tokens are routered to their appropriate L1 gateway (Router itself also conforms to the Gateway itnerface). * @notice Router also serves as an L1-L2 token address oracle. */ contract L1GatewayRouter is WhitelistConsumer, L1ArbitrumMessenger, GatewayRouter { address public owner; address public inbox; modifier onlyOwner() { require(msg.sender == owner, "ONLY_OWNER"); _; } function initialize( address _owner, address _defaultGateway, address _whitelist, address _counterpartGateway, address _inbox ) public { GatewayRouter._initialize(_counterpartGateway, address(0), _defaultGateway); owner = _owner; WhitelistConsumer.whitelist = _whitelist; inbox = _inbox; } function setDefaultGateway( address newL1DefaultGateway, uint256 _maxGas, uint256 _gasPriceBid, uint256 _maxSubmissionCost ) external payable onlyOwner returns (uint256) { defaultGateway = newL1DefaultGateway; emit DefaultGatewayUpdated(newL1DefaultGateway); address l2NewDefaultGateway; if (newL1DefaultGateway != address(0)) { l2NewDefaultGateway = TokenGateway(newL1DefaultGateway).counterpartGateway(); } bytes memory data = abi.encodeWithSelector( L2GatewayRouter.setDefaultGateway.selector, l2NewDefaultGateway ); return sendTxToL2( inbox, counterpartGateway, msg.sender, msg.value, 0, L2GasParams({ _maxSubmissionCost: _maxSubmissionCost, _maxGas: _maxGas, _gasPriceBid: _gasPriceBid }), data ); } function setOwner(address newOwner) external onlyOwner { require(newOwner != address(0), "INVALID_OWNER"); // set newOwner to address(1) to disable owner and keep `initialize` safe owner = newOwner; } function _setGateways( address[] memory _token, address[] memory _gateway, uint256 _maxGas, uint256 _gasPriceBid, uint256 _maxSubmissionCost, address _creditBackAddress ) internal returns (uint256) { require(_token.length == _gateway.length, "WRONG_LENGTH"); for (uint256 i = 0; i < _token.length; i++) { l1TokenToGateway[_token[i]] = _gateway[i]; emit GatewaySet(_token[i], _gateway[i]); // overwrite memory so the L2 router receives the L2 address of each gateway if (_gateway[i] != address(0)) { // if we are assigning a gateway to the token, the address oracle of the gateway // must return something other than the 0 address // this check helps avoid misconfiguring gateways require( TokenGateway(_gateway[i]).calculateL2TokenAddress(_token[i]) != address(0), "TOKEN_NOT_HANDLED_BY_GATEWAY" ); _gateway[i] = TokenGateway(_gateway[i]).counterpartGateway(); } } bytes memory data = abi.encodeWithSelector( L2GatewayRouter.setGateway.selector, _token, _gateway ); return sendTxToL2( inbox, counterpartGateway, _creditBackAddress, msg.value, 0, L2GasParams({ _maxSubmissionCost: _maxSubmissionCost, _maxGas: _maxGas, _gasPriceBid: _gasPriceBid }), data ); } /** * @notice Allows L1 Token contract to trustlessly register its gateway. (other setGateway method allows excess eth recovery from _maxSubmissionCost and is recommended) * @param _gateway l1 gateway address * @param _maxGas max gas for L2 retryable exrecution * @param _gasPriceBid gas price for L2 retryable ticket * @param _maxSubmissionCost base submission cost L2 retryable tick3et * @return Retryable ticket ID */ function setGateway( address _gateway, uint256 _maxGas, uint256 _gasPriceBid, uint256 _maxSubmissionCost ) external payable returns (uint256) { return setGateway(_gateway, _maxGas, _gasPriceBid, _maxSubmissionCost, msg.sender); } /** * @notice Allows L1 Token contract to trustlessly register its gateway. * param _gateway l1 gateway address * param _maxGas max gas for L2 retryable exrecution * param _gasPriceBid gas price for L2 retryable ticket * param _maxSubmissionCost base submission cost L2 retryable tick3et * param _creditBackAddress address for crediting back overpayment of _maxSubmissionCost * return Retryable ticket ID */ function setGateway( address _gateway, uint256 _maxGas, uint256 _gasPriceBid, uint256 _maxSubmissionCost, address _creditBackAddress ) public payable returns (uint256) { require( ArbitrumEnabledToken(msg.sender).isArbitrumEnabled() == uint8(0xa4b1), "NOT_ARB_ENABLED" ); require(_gateway.isContract(), "NOT_TO_CONTRACT"); address currGateway = l1TokenToGateway[msg.sender]; if (currGateway != address(0)) { // if gateway is already set, don't allow it to set a different gateway require(currGateway == _gateway, "NO_UPDATE_TO_DIFFERENT_ADDR"); } address[] memory _tokenArr = new address[](1); _tokenArr[0] = address(msg.sender); address[] memory _gatewayArr = new address[](1); _gatewayArr[0] = _gateway; return _setGateways( _tokenArr, _gatewayArr, _maxGas, _gasPriceBid, _maxSubmissionCost, _creditBackAddress ); } function setGateways( address[] memory _token, address[] memory _gateway, uint256 _maxGas, uint256 _gasPriceBid, uint256 _maxSubmissionCost ) external payable onlyOwner returns (uint256) { // it is assumed that token and gateway are both contracts // require(_token[i].isContract() && _gateway[i].isContract(), "NOT_CONTRACT"); return _setGateways(_token, _gateway, _maxGas, _gasPriceBid, _maxSubmissionCost, msg.sender); } function outboundTransfer( address _token, address _to, uint256 _amount, uint256 _maxGas, uint256 _gasPriceBid, bytes calldata _data ) public payable override onlyWhitelisted returns (bytes memory) { // when sending a L1 to L2 transaction, we expect the user to send // eth in flight in order to pay for L2 gas costs // this check prevents users from misconfiguring the msg.value (uint256 _maxSubmissionCost, ) = abi.decode(_data, (uint256, bytes)); // here we don't use SafeMath since this validation is to prevent users // from shooting themselves on the foot. uint256 expectedEth = _maxSubmissionCost + (_maxGas * _gasPriceBid); require(_maxSubmissionCost > 0, "NO_SUBMISSION_COST"); require(msg.value == expectedEth, "WRONG_ETH_VALUE"); // will revert if msg.sender is not whitelisted return super.outboundTransfer(_token, _to, _amount, _maxGas, _gasPriceBid, _data); } modifier onlyCounterpartGateway() override { // don't expect messages from L2 router revert("ONLY_COUNTERPART_GATEWAY"); _; } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; import "./Address.sol"; import "./BytesLib.sol"; import "./ProxyUtil.sol"; import "./AddressAliasHelper.sol"; import "./IArbToken.sol"; import "./L2ArbitrumMessenger.sol"; import "./GatewayMessageHandler.sol"; import "./TokenGateway.sol"; /** * @title Common interface for gatways on Arbitrum messaging to L1. */ abstract contract L2ArbitrumGateway is L2ArbitrumMessenger, TokenGateway { using Address for address; uint256 public exitNum; event DepositFinalized( address indexed l1Token, address indexed _from, address indexed _to, uint256 _amount ); event WithdrawalInitiated( address l1Token, address indexed _from, address indexed _to, uint256 indexed _l2ToL1Id, uint256 _exitNum, uint256 _amount ); modifier onlyCounterpartGateway() override { require( msg.sender == counterpartGateway || AddressAliasHelper.undoL1ToL2Alias(msg.sender) == counterpartGateway, "ONLY_COUNTERPART_GATEWAY" ); _; } function postUpgradeInit() external { // it is assumed the L2 Arbitrum Gateway contract is behind a Proxy controlled by a proxy admin // this function can only be called by the proxy admin contract address proxyAdmin = ProxyUtil.getProxyAdmin(); require(msg.sender == proxyAdmin, "NOT_FROM_ADMIN"); // this has no other logic since the current upgrade doesn't require this logic } function _initialize(address _l1Counterpart, address _router) internal virtual override { TokenGateway._initialize(_l1Counterpart, _router); // L1 gateway must have a router require(_router != address(0), "BAD_ROUTER"); } function createOutboundTx( address _from, uint256, /* _tokenAmount */ bytes memory _outboundCalldata ) internal virtual returns (uint256) { // We make this function virtual since outboundTransfer logic is the same for many gateways // but sometimes (ie weth) you construct the outgoing message differently. // exitNum incremented after being included in _outboundCalldata exitNum++; return sendTxToL1( // default to sending no callvalue to the L1 0, _from, counterpartGateway, _outboundCalldata ); } function getOutboundCalldata( address _token, address _from, address _to, uint256 _amount, bytes memory _data ) public view override returns (bytes memory outboundCalldata) { outboundCalldata = abi.encodeWithSelector( TokenGateway.finalizeInboundTransfer.selector, _token, _from, _to, _amount, GatewayMessageHandler.encodeFromL2GatewayMsg(exitNum, _data) ); return outboundCalldata; } function outboundTransfer( address _l1Token, address _to, uint256 _amount, bytes calldata _data ) public payable virtual returns (bytes memory) { return outboundTransfer(_l1Token, _to, _amount, 0, 0, _data); } /** * @notice Initiates a token withdrawal from Arbitrum to Ethereum * @param _l1Token l1 address of token * @param _to destination address * @param _amount amount of tokens withdrawn * @return res encoded unique identifier for withdrawal */ function outboundTransfer( address _l1Token, address _to, uint256 _amount, uint256, /* _maxGas */ uint256, /* _gasPriceBid */ bytes calldata _data ) public payable virtual override returns (bytes memory res) { // This function is set as public and virtual so that subclasses can override // it and add custom validation for callers (ie only whitelisted users) // the function is marked as payable to conform to the inheritance setup // this particular code path shouldn't have a msg.value > 0 // TODO: remove this invariant for execution markets require(msg.value == 0, "NO_VALUE"); address _from; bytes memory _extraData; { if (isRouter(msg.sender)) { (_from, _extraData) = GatewayMessageHandler.parseFromRouterToGateway(_data); } else { _from = msg.sender; _extraData = _data; } } // the inboundEscrowAndCall functionality has been disabled, so no data is allowed require(_extraData.length == 0, "EXTRA_DATA_DISABLED"); uint256 id; { address l2Token = calculateL2TokenAddress(_l1Token); require(l2Token.isContract(), "TOKEN_NOT_DEPLOYED"); require(IArbToken(l2Token).l1Address() == _l1Token, "NOT_EXPECTED_L1_TOKEN"); _amount = outboundEscrowTransfer(l2Token, _from, _amount); id = triggerWithdrawal(_l1Token, _from, _to, _amount, _extraData); } return abi.encode(id); } function triggerWithdrawal( address _l1Token, address _from, address _to, uint256 _amount, bytes memory _data ) internal returns (uint256) { // exit number used for tradeable exits uint256 currExitNum = exitNum; // unique id used to identify the L2 to L1 tx uint256 id = createOutboundTx( _from, _amount, getOutboundCalldata(_l1Token, _from, _to, _amount, _data) ); emit WithdrawalInitiated(_l1Token, _from, _to, id, currExitNum, _amount); return id; } function outboundEscrowTransfer( address _l2Token, address _from, uint256 _amount ) internal virtual returns (uint256 amountBurnt) { // this method is virtual since different subclasses can handle escrow differently // user funds are escrowed on the gateway using this function // burns L2 tokens in order to release escrowed L1 tokens IArbToken(_l2Token).bridgeBurn(_from, _amount); // by default we assume that the amount we send to bridgeBurn is the amount burnt // this might not be the case for every token return _amount; } function inboundEscrowTransfer( address _l2Address, address _dest, uint256 _amount ) internal virtual { // this method is virtual since different subclasses can handle escrow differently IArbToken(_l2Address).bridgeMint(_dest, _amount); } /** * @notice Mint on L2 upon L1 deposit. * If token not yet deployed and symbol/name/decimal data is included, deploys StandardArbERC20 * @dev Callable only by the L1ERC20Gateway.outboundTransfer method. For initial deployments of a token the L1 L1ERC20Gateway * is expected to include the deployData. If not a L1 withdrawal is automatically triggered for the user * @param _token L1 address of ERC20 * @param _from account that initiated the deposit in the L1 * @param _to account to be credited with the tokens in the L2 (can be the user's L2 account or a contract) * @param _amount token amount to be minted to the user * @param _data encoded symbol/name/decimal data for deploy, in addition to any additional callhook data */ function finalizeInboundTransfer( address _token, address _from, address _to, uint256 _amount, bytes calldata _data ) external payable override onlyCounterpartGateway { (bytes memory gatewayData, bytes memory callHookData) = GatewayMessageHandler .parseFromL1GatewayMsg(_data); if (callHookData.length != 0) { // callHookData should always be 0 since inboundEscrowAndCall is disabled callHookData = bytes(""); } address expectedAddress = calculateL2TokenAddress(_token); if (!expectedAddress.isContract()) { bool shouldHalt = handleNoContract( _token, expectedAddress, _from, _to, _amount, gatewayData ); if (shouldHalt) return; } // ignores gatewayData if token already deployed { // validate if L1 address supplied matches that of the expected L2 address (bool success, bytes memory _l1AddressData) = expectedAddress.staticcall( abi.encodeWithSelector(IArbToken.l1Address.selector) ); bool shouldWithdraw; if (!success || _l1AddressData.length < 32) { shouldWithdraw = true; } else { // we do this in the else branch since we want to avoid reverts // and `toAddress` reverts if _l1AddressData has a short length // `_l1AddressData` should be 12 bytes of padding then 20 bytes for the address address expectedL1Address = BytesLib.toAddress(_l1AddressData, 12); if (expectedL1Address != _token) { shouldWithdraw = true; } } if (shouldWithdraw) { // we don't need the return value from triggerWithdrawal since this is forcing // a withdrawal back to the L1 instead of composing with a L2 dapp triggerWithdrawal(_token, address(this), _from, _amount, ""); return; } } inboundEscrowTransfer(expectedAddress, _to, _amount); emit DepositFinalized(_token, _from, _to, _amount); return; } // returns if function should halt after function handleNoContract( address _l1Token, address expectedL2Address, address _from, address _to, uint256 _amount, bytes memory gatewayData ) internal virtual returns (bool shouldHalt); }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; import "./ArbSys.sol"; /// @notice L2 utility contract to assist with L1 <=> L2 interactions /// @dev this is an abstract contract instead of library so the functions can be easily overriden when testing abstract contract L2ArbitrumMessenger { address internal constant ARB_SYS_ADDRESS = address(100); event TxToL1(address indexed _from, address indexed _to, uint256 indexed _id, bytes _data); function sendTxToL1( uint256 _l1CallValue, address _from, address _to, bytes memory _data ) internal virtual returns (uint256) { uint256 _id = ArbSys(ARB_SYS_ADDRESS).sendTxToL1{ value: _l1CallValue }(_to, _data); emit TxToL1(_from, _to, _id, _data); return _id; } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; import "./L2ArbitrumGateway.sol"; import "./ICustomGateway.sol"; import "./SafeMath.sol"; import "./ERC20.sol"; contract L2CustomGateway is L2ArbitrumGateway, ICustomGateway { // stores addresses of L2 tokens to be used mapping(address => address) public override l1ToL2Token; function initialize(address _l1Counterpart, address _router) public { L2ArbitrumGateway._initialize(_l1Counterpart, _router); } /** * @notice internal utility function used to handle when no contract is deployed at expected address */ function handleNoContract( address _l1Token, address, /* expectedL2Address */ address _from, address, /* _to */ uint256 _amount, bytes memory /* gatewayData */ ) internal override returns (bool shouldHalt) { // it is assumed that the custom token is deployed in the L2 before deposits are made // trigger withdrawal // we don't need the return value from triggerWithdrawal since this is forcing a withdrawal back to the L1 // instead of composing with a L2 dapp triggerWithdrawal(_l1Token, address(this), _from, _amount, ""); return true; } function outboundEscrowTransfer( address _l2Token, address _from, uint256 _amount ) internal override returns (uint256 amountBurnt) { uint256 prevBalance = IERC20(_l2Token).balanceOf(_from); // in the custom gateway, we do the same behaviour as the superclass, but actually check // for the balances of tokens to ensure that inflationary / deflationary changes in the amount // are taken into account // we ignore the return value since we actually query the token before and after to calculate // the amount of tokens that were burnt super.outboundEscrowTransfer(_l2Token, _from, _amount); uint256 postBalance = IERC20(_l2Token).balanceOf(_from); return SafeMath.sub(prevBalance, postBalance); } /** * @notice Calculate the address used when bridging an ERC20 token * @dev the L1 and L2 address oracles may not always be in sync. * For example, a custom token may have been registered but not deploy or the contract self destructed. * @param l1ERC20 address of L1 token * @return L2 address of a bridged ERC20 token */ function calculateL2TokenAddress(address l1ERC20) public view override returns (address) { return l1ToL2Token[l1ERC20]; } function registerTokenFromL1(address[] calldata l1Address, address[] calldata l2Address) external onlyCounterpartGateway { // we assume both arrays are the same length, safe since its encoded by the L1 for (uint256 i = 0; i < l1Address.length; i++) { // here we don't check if l2Address is a contract and instead deal with that behaviour // in `handleNoContract` this way we keep the l1 and l2 address oracles in sync l1ToL2Token[l1Address[i]] = l2Address[i]; emit TokenSet(l1Address[i], l2Address[i]); } } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; import "./GatewayRouter.sol"; import "./L1GatewayRouter.sol"; import "./L2ArbitrumMessenger.sol"; import "./AddressAliasHelper.sol"; /** * @title Handles withdrawals from Ethereum into Arbitrum. Tokens are routered to their appropriate L2 gateway (Router itself also conforms to the Gateway interface). * @notice Router also serves as an L2-L1 token address oracle. */ contract L2GatewayRouter is GatewayRouter, L2ArbitrumMessenger { modifier onlyCounterpartGateway() override { require( msg.sender == counterpartGateway || AddressAliasHelper.undoL1ToL2Alias(msg.sender) == counterpartGateway, "ONLY_COUNTERPART_GATEWAY" ); _; } function initialize(address _counterpartGateway, address _defaultGateway) public { GatewayRouter._initialize(_counterpartGateway, address(0), _defaultGateway); } function setGateway(address[] memory _l1Token, address[] memory _gateway) external onlyCounterpartGateway { // counterpart gateway (L1 router) should never allow wrong lengths assert(_l1Token.length == _gateway.length); for (uint256 i = 0; i < _l1Token.length; i++) { l1TokenToGateway[_l1Token[i]] = _gateway[i]; emit GatewaySet(_l1Token[i], _gateway[i]); } } function outboundTransfer( address _l1Token, address _to, uint256 _amount, bytes calldata _data ) public payable returns (bytes memory) { return outboundTransfer(_l1Token, _to, _amount, 0, 0, _data); } function setDefaultGateway(address newL2DefaultGateway) external onlyCounterpartGateway { defaultGateway = newL2DefaultGateway; emit DefaultGatewayUpdated(newL2DefaultGateway); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2021, Offchain Labs, Inc. * * 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.6.11; library ProxyUtil { function getProxyAdmin() internal view returns (address admin) { // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.0/contracts/proxy/TransparentUpgradeableProxy.sol#L48 // Storage slot with the admin of the proxy contract. // This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is bytes32 slot = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; assembly { admin := sload(slot) } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20.sol"; import "./SafeMath.sol"; import "./Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { 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) { 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) { // 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) { 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) { 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) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); 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) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @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. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); 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) { require(b > 0, "SafeMath: modulo by zero"); 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) { 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. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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) { 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) { require(b > 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; import "./ITokenGateway.sol"; import "./Address.sol"; abstract contract TokenGateway is ITokenGateway { using Address for address; address public counterpartGateway; address public router; modifier onlyCounterpartGateway() virtual { // this method is overriden in gateways that require special logic for validation // ie L2 to L1 messages need to be validated against the outbox require(msg.sender == counterpartGateway, "ONLY_COUNTERPART_GATEWAY"); _; } function _initialize(address _counterpartGateway, address _router) internal virtual { // This initializes internal variables of the abstract contract it can be chained together with other functions. // It is virtual so subclasses can override or wrap around this logic. // An example where this is useful is different subclasses that validate the router address differently require(_counterpartGateway != address(0), "INVALID_COUNTERPART"); require(counterpartGateway == address(0), "ALREADY_INIT"); counterpartGateway = _counterpartGateway; router = _router; } function isRouter(address _target) internal view returns (bool isTargetRouter) { return _target == router; } /** * @notice Calculate the address used when bridging an ERC20 token * @dev the L1 and L2 address oracles may not always be in sync. * For example, a custom token may have been registered but not deploy or the contract self destructed. * @param l1ERC20 address of L1 token * @return L2 address of a bridged ERC20 token */ function calculateL2TokenAddress(address l1ERC20) public view virtual override returns (address); function outboundTransfer( address _token, address _to, uint256 _amount, uint256 _maxGas, uint256 _gasPriceBid, bytes calldata _data ) external payable virtual override returns (bytes memory); function getOutboundCalldata( address _token, address _from, address _to, uint256 _amount, bytes memory _data ) public view virtual returns (bytes memory); function finalizeInboundTransfer( address _token, address _from, address _to, uint256 _amount, bytes calldata _data ) external payable virtual override; }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2021, Offchain Labs, Inc. * * 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.6.11; abstract contract WhitelistConsumer { address public whitelist; event WhitelistSourceUpdated(address newSource); modifier onlyWhitelisted() { if (whitelist != address(0)) { require(Whitelist(whitelist).isAllowed(msg.sender), "NOT_WHITELISTED"); } _; } function updateWhitelistSource(address newSource) external { require(msg.sender == whitelist, "NOT_FROM_LIST"); whitelist = newSource; emit WhitelistSourceUpdated(newSource); } } contract Whitelist { address public owner; mapping(address => bool) public isAllowed; event OwnerUpdated(address newOwner); event WhitelistUpgraded(address newWhitelist, address[] targets); constructor() public { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner, "ONLY_OWNER"); _; } function setOwner(address newOwner) external onlyOwner { owner = newOwner; emit OwnerUpdated(newOwner); } function setWhitelist(address[] memory user, bool[] memory val) external onlyOwner { require(user.length == val.length, "INVALID_INPUT"); for (uint256 i = 0; i < user.length; i++) { isAllowed[user[i]] = val[i]; } } // set new whitelist to address(0) to disable whitelist function triggerConsumers(address newWhitelist, address[] memory targets) external onlyOwner { for (uint256 i = 0; i < targets.length; i++) { WhitelistConsumer(targets[i]).updateWhitelistSource(newWhitelist); } emit WhitelistUpgraded(newWhitelist, targets); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"_spaAddress","type":"address"},{"internalType":"address","name":"_bridge","type":"address"},{"internalType":"address","name":"_router","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":false,"internalType":"address","name":"newBridge","type":"address"},{"indexed":false,"internalType":"address","name":"newRouter","type":"address"}],"name":"ArbitrumGatewayRouterChanged","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":false,"internalType":"address","name":"oldSPA","type":"address"},{"indexed":false,"internalType":"address","name":"newSPA","type":"address"}],"name":"SPAaddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"bridgeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newBridge","type":"address"},{"internalType":"address","name":"newRouter","type":"address"}],"name":"changeArbToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSPA","type":"address"}],"name":"changeSpaAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isArbitrumEnabled","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"l2CustomTokenAddress","type":"address"},{"internalType":"uint256","name":"maxSubmissionCostForCustomBridge","type":"uint256"},{"internalType":"uint256","name":"maxSubmissionCostForRouter","type":"uint256"},{"internalType":"uint256","name":"maxGas","type":"uint256"},{"internalType":"uint256","name":"gasPriceBid","type":"uint256"},{"internalType":"uint256","name":"valueForGateway","type":"uint256"},{"internalType":"uint256","name":"valueForRouter","type":"uint256"},{"internalType":"address","name":"creditBackAddress","type":"address"}],"name":"registerTokenOnL2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"spaAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162001b3e38038062001b3e833981810160405260a08110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b9083019060208201858111156200006e57600080fd5b82516401000000008111828201881017156200008957600080fd5b82525081516020918201929091019080838360005b83811015620000b85781810151838201526020016200009e565b50505050905090810190601f168015620000e65780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200010a57600080fd5b9083019060208201858111156200012057600080fd5b82516401000000008111828201881017156200013b57600080fd5b82525081516020918201929091019080838360005b838110156200016a57818101518382015260200162000150565b50505050905090810190601f168015620001985780820380516001836020036101000a031916815260200191505b50604090815260208281015191830151606090930151875192955092935086918691620001cb916003918501906200029d565b508051620001e19060049060208401906200029d565b50506005805460ff19166012179055506000620001fd62000299565b60058054610100600160a81b0319166101006001600160a01b03841690810291909117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600680546001600160a01b039485166001600160a01b03199182161790915560078054938516938216939093179092556008805491909316911617905550620003399050565b3390565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620002e057805160ff191683800117855562000310565b8280016001018555821562000310579182015b8281111562000310578251825591602001919060010190620002f3565b506200031e92915062000322565b5090565b5b808211156200031e576000815560010162000323565b6117f580620003496000396000f3fe60806040526004361061014b5760003560e01c80638c2a993e116100b6578063a457c2d71161006f578063a457c2d7146104fd578063a9059cbb14610536578063dd62ed3e1461056f578063e78cea92146105aa578063f2fde38b146105bf578063f887ea40146105f25761014b565b80638c2a993e146104205780638d9fd91f146104595780638da5cb5b146104945780638e5f5ad1146104a957806395d89b41146104be578063a0712d68146104d35761014b565b8063395093511161010857806339509351146102ed57806342966c681461032657806363600eb71461035257806365a1ff8f146103a557806370a08231146103d8578063715018a61461040b5761014b565b806306fdde0314610150578063095ea7b3146101da57806318160ddd1461022757806323b872dd1461024e578063313ce5671461029157806333b9632a146102bc575b600080fd5b34801561015c57600080fd5b50610165610607565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561019f578181015183820152602001610187565b50505050905090810190601f1680156101cc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e657600080fd5b50610213600480360360408110156101fd57600080fd5b506001600160a01b03813516906020013561069d565b604080519115158252519081900360200190f35b34801561023357600080fd5b5061023c6106ba565b60408051918252519081900360200190f35b34801561025a57600080fd5b506102136004803603606081101561027157600080fd5b506001600160a01b038135811691602081013590911690604001356106c0565b34801561029d57600080fd5b506102a66106d5565b6040805160ff9092168252519081900360200190f35b3480156102c857600080fd5b506102d16106de565b604080516001600160a01b039092168252519081900360200190f35b3480156102f957600080fd5b506102136004803603604081101561031057600080fd5b506001600160a01b0381351690602001356106ed565b34801561033257600080fd5b506103506004803603602081101561034957600080fd5b5035610740565b005b610350600480360361010081101561036957600080fd5b506001600160a01b03813581169160208101359160408201359160608101359160808201359160a08101359160c08201359160e00135166107cc565b3480156103b157600080fd5b50610350600480360360208110156103c857600080fd5b50356001600160a01b03166109a9565b3480156103e457600080fd5b5061023c600480360360208110156103fb57600080fd5b50356001600160a01b0316610a75565b34801561041757600080fd5b50610350610a86565b34801561042c57600080fd5b506103506004803603604081101561044357600080fd5b506001600160a01b038135169060200135610b38565b34801561046557600080fd5b506103506004803603604081101561047c57600080fd5b506001600160a01b0381358116916020013516610c07565b3480156104a057600080fd5b506102d1610cda565b3480156104b557600080fd5b506102a6610cee565b3480156104ca57600080fd5b50610165610d4a565b3480156104df57600080fd5b50610350600480360360208110156104f657600080fd5b5035610dab565b34801561050957600080fd5b506102136004803603604081101561052057600080fd5b506001600160a01b038135169060200135610e34565b34801561054257600080fd5b506102136004803603604081101561055957600080fd5b506001600160a01b038135169060200135610e9c565b34801561057b57600080fd5b5061023c6004803603604081101561059257600080fd5b506001600160a01b0381358116916020013516610eb0565b3480156105b657600080fd5b506102d1610edb565b3480156105cb57600080fd5b50610350600480360360208110156105e257600080fd5b50356001600160a01b0316610eea565b3480156105fe57600080fd5b506102d1610ff8565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106935780601f1061066857610100808354040283529160200191610693565b820191906000526020600020905b81548152906001019060200180831161067657829003601f168201915b5050505050905090565b60006106b16106aa611007565b848461100b565b50600192915050565b60025490565b60006106cd8484846110f7565b949350505050565b60055460ff1690565b6006546001600160a01b031681565b60006106b16106fa611007565b8461073b856001600061070b611007565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490611179565b61100b565b6006546001600160a01b031663edb561c3610759611007565b836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156107a057600080fd5b505af11580156107b4573d6000803e3d6000fd5b505050506107c96107c3611007565b826111da565b50565b6107d4611007565b6001600160a01b03166107e5610cda565b6001600160a01b03161461082e576040805162461bcd60e51b81526020600482018190526024820152600080516020611711833981519152604482015290519081900360640190fd5b60088054600160a01b60ff60a01b19821681179092556007546040805163651a36a560e11b81526001600160a01b038d81166004830152602482018b9052604482018a9052606482018d9052868116608483015291519490930460ff169391169163ca346d4a91879160a48082019260209290919082900301818588803b1580156108b857600080fd5b505af11580156108cc573d6000803e3d6000fd5b50505050506040513d60208110156108e357600080fd5b505060085460075460408051632d67b72d60e01b81526001600160a01b039283166004820152602481018a905260448101899052606481018b9052858316608482015290519190921691632d67b72d91869160a48082019260209290919082900301818588803b15801561095657600080fd5b505af115801561096a573d6000803e3d6000fd5b50505050506040513d602081101561098157600080fd5b505060088054911515600160a01b0260ff60a01b199092169190911790555050505050505050565b6109b1611007565b6001600160a01b03166109c2610cda565b6001600160a01b031614610a0b576040805162461bcd60e51b81526020600482018190526024820152600080516020611711833981519152604482015290519081900360640190fd5b600654604080516001600160a01b039283168152918316602083015280517fa406f33015291ef695e68f5723cbac880b3954dc16d8a2d389c80e0052de1c8a9281900390910190a1600680546001600160a01b0319166001600160a01b0392909216919091179055565b6000610a80826112d6565b92915050565b610a8e611007565b6001600160a01b0316610a9f610cda565b6001600160a01b031614610ae8576040805162461bcd60e51b81526020600482018190526024820152600080516020611711833981519152604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b6007546001600160a01b0316610b4c611007565b6001600160a01b031614610b96576040805162461bcd60e51b815260206004820152600c60248201526b4f4e4c595f4741544557415960a01b604482015290519081900360640190fd5b6006546040805163edb561c360e01b81526001600160a01b038581166004830152602482018590529151919092169163edb561c391604480830192600092919082900301818387803b158015610beb57600080fd5b505af1158015610bff573d6000803e3d6000fd5b505050505050565b610c0f611007565b6001600160a01b0316610c20610cda565b6001600160a01b031614610c69576040805162461bcd60e51b81526020600482018190526024820152600080516020611711833981519152604482015290519081900360640190fd5b600780546001600160a01b038085166001600160a01b0319928316179283905560088054858316931692909217918290556040805193821684529116602083015280517f7ae81782064ab8dd8fc6bb668cbd82500e4484947d5761b6756dae2e982e89089281900390910190a15050565b60055461010090046001600160a01b031690565b600854600090600160a01b900460ff16610d43576040805162461bcd60e51b81526020600482015260116024820152701393d517d156141150d5115117d0d05313607a1b604482015290519081900360640190fd5b5061a4b190565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106935780601f1061066857610100808354040283529160200191610693565b6006546001600160a01b03166379cc6790610dc4611007565b836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610e0b57600080fd5b505af1158015610e1f573d6000803e3d6000fd5b505050506107c9610e2e611007565b826112f1565b60006106b1610e41611007565b8461073b8560405180606001604052806025815260200161179b6025913960016000610e6b611007565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906113e1565b60006106b1610ea9611007565b8484611478565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6007546001600160a01b031681565b610ef2611007565b6001600160a01b0316610f03610cda565b6001600160a01b031614610f4c576040805162461bcd60e51b81526020600482018190526024820152600080516020611711833981519152604482015290519081900360640190fd5b6001600160a01b038116610f915760405162461bcd60e51b815260040180806020018281038252602681526020018061167b6026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6008546001600160a01b031681565b3390565b6001600160a01b0383166110505760405162461bcd60e51b81526004018080602001828103825260248152602001806117776024913960400191505060405180910390fd5b6001600160a01b0382166110955760405162461bcd60e51b81526004018080602001828103825260228152602001806116a16022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000611104848484611478565b61116f84611110611007565b61073b856040518060600160405280602881526020016116e9602891396001600160a01b038a1660009081526001602052604081209061114e611007565b6001600160a01b0316815260208101919091526040016000205491906113e1565b5060019392505050565b6000828201838110156111d3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6001600160a01b03821661121f5760405162461bcd60e51b81526004018080602001828103825260218152602001806117316021913960400191505060405180910390fd5b61122b826000836115d3565b61126881604051806060016040528060228152602001611659602291396001600160a01b03851660009081526020819052604090205491906113e1565b6001600160a01b03831660009081526020819052604090205560025461128e90826115d8565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6001600160a01b031660009081526020819052604090205490565b6001600160a01b03821661134c576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b611358600083836115d3565b6002546113659082611179565b6002556001600160a01b03821660009081526020819052604090205461138b9082611179565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600081848411156114705760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561143557818101518382015260200161141d565b50505050905090810190601f1680156114625780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0383166114bd5760405162461bcd60e51b81526004018080602001828103825260258152602001806117526025913960400191505060405180910390fd5b6001600160a01b0382166115025760405162461bcd60e51b81526004018080602001828103825260238152602001806116366023913960400191505060405180910390fd5b61150d8383836115d3565b61154a816040518060600160405280602681526020016116c3602691396001600160a01b03861660009081526020819052604090205491906113e1565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546115799082611179565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b505050565b60008282111561162f576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212201a2dec6c80ff40327210472f1d376fbd0d7cbdffe7cc025a219a5fb70d6eaf0d64736f6c634300060c003300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000b4a3b0faf0ab53df58001804dda5bfc6a3d59008000000000000000000000000cee284f754e854890e311e3280b767f80797180d00000000000000000000000072ce9c846789fdb6fc1f34ac4ad25dd9ef7031ef000000000000000000000000000000000000000000000000000000000000000e577261707065642053706572617800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000047753504100000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x60806040526004361061014b5760003560e01c80638c2a993e116100b6578063a457c2d71161006f578063a457c2d7146104fd578063a9059cbb14610536578063dd62ed3e1461056f578063e78cea92146105aa578063f2fde38b146105bf578063f887ea40146105f25761014b565b80638c2a993e146104205780638d9fd91f146104595780638da5cb5b146104945780638e5f5ad1146104a957806395d89b41146104be578063a0712d68146104d35761014b565b8063395093511161010857806339509351146102ed57806342966c681461032657806363600eb71461035257806365a1ff8f146103a557806370a08231146103d8578063715018a61461040b5761014b565b806306fdde0314610150578063095ea7b3146101da57806318160ddd1461022757806323b872dd1461024e578063313ce5671461029157806333b9632a146102bc575b600080fd5b34801561015c57600080fd5b50610165610607565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561019f578181015183820152602001610187565b50505050905090810190601f1680156101cc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e657600080fd5b50610213600480360360408110156101fd57600080fd5b506001600160a01b03813516906020013561069d565b604080519115158252519081900360200190f35b34801561023357600080fd5b5061023c6106ba565b60408051918252519081900360200190f35b34801561025a57600080fd5b506102136004803603606081101561027157600080fd5b506001600160a01b038135811691602081013590911690604001356106c0565b34801561029d57600080fd5b506102a66106d5565b6040805160ff9092168252519081900360200190f35b3480156102c857600080fd5b506102d16106de565b604080516001600160a01b039092168252519081900360200190f35b3480156102f957600080fd5b506102136004803603604081101561031057600080fd5b506001600160a01b0381351690602001356106ed565b34801561033257600080fd5b506103506004803603602081101561034957600080fd5b5035610740565b005b610350600480360361010081101561036957600080fd5b506001600160a01b03813581169160208101359160408201359160608101359160808201359160a08101359160c08201359160e00135166107cc565b3480156103b157600080fd5b50610350600480360360208110156103c857600080fd5b50356001600160a01b03166109a9565b3480156103e457600080fd5b5061023c600480360360208110156103fb57600080fd5b50356001600160a01b0316610a75565b34801561041757600080fd5b50610350610a86565b34801561042c57600080fd5b506103506004803603604081101561044357600080fd5b506001600160a01b038135169060200135610b38565b34801561046557600080fd5b506103506004803603604081101561047c57600080fd5b506001600160a01b0381358116916020013516610c07565b3480156104a057600080fd5b506102d1610cda565b3480156104b557600080fd5b506102a6610cee565b3480156104ca57600080fd5b50610165610d4a565b3480156104df57600080fd5b50610350600480360360208110156104f657600080fd5b5035610dab565b34801561050957600080fd5b506102136004803603604081101561052057600080fd5b506001600160a01b038135169060200135610e34565b34801561054257600080fd5b506102136004803603604081101561055957600080fd5b506001600160a01b038135169060200135610e9c565b34801561057b57600080fd5b5061023c6004803603604081101561059257600080fd5b506001600160a01b0381358116916020013516610eb0565b3480156105b657600080fd5b506102d1610edb565b3480156105cb57600080fd5b50610350600480360360208110156105e257600080fd5b50356001600160a01b0316610eea565b3480156105fe57600080fd5b506102d1610ff8565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106935780601f1061066857610100808354040283529160200191610693565b820191906000526020600020905b81548152906001019060200180831161067657829003601f168201915b5050505050905090565b60006106b16106aa611007565b848461100b565b50600192915050565b60025490565b60006106cd8484846110f7565b949350505050565b60055460ff1690565b6006546001600160a01b031681565b60006106b16106fa611007565b8461073b856001600061070b611007565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490611179565b61100b565b6006546001600160a01b031663edb561c3610759611007565b836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156107a057600080fd5b505af11580156107b4573d6000803e3d6000fd5b505050506107c96107c3611007565b826111da565b50565b6107d4611007565b6001600160a01b03166107e5610cda565b6001600160a01b03161461082e576040805162461bcd60e51b81526020600482018190526024820152600080516020611711833981519152604482015290519081900360640190fd5b60088054600160a01b60ff60a01b19821681179092556007546040805163651a36a560e11b81526001600160a01b038d81166004830152602482018b9052604482018a9052606482018d9052868116608483015291519490930460ff169391169163ca346d4a91879160a48082019260209290919082900301818588803b1580156108b857600080fd5b505af11580156108cc573d6000803e3d6000fd5b50505050506040513d60208110156108e357600080fd5b505060085460075460408051632d67b72d60e01b81526001600160a01b039283166004820152602481018a905260448101899052606481018b9052858316608482015290519190921691632d67b72d91869160a48082019260209290919082900301818588803b15801561095657600080fd5b505af115801561096a573d6000803e3d6000fd5b50505050506040513d602081101561098157600080fd5b505060088054911515600160a01b0260ff60a01b199092169190911790555050505050505050565b6109b1611007565b6001600160a01b03166109c2610cda565b6001600160a01b031614610a0b576040805162461bcd60e51b81526020600482018190526024820152600080516020611711833981519152604482015290519081900360640190fd5b600654604080516001600160a01b039283168152918316602083015280517fa406f33015291ef695e68f5723cbac880b3954dc16d8a2d389c80e0052de1c8a9281900390910190a1600680546001600160a01b0319166001600160a01b0392909216919091179055565b6000610a80826112d6565b92915050565b610a8e611007565b6001600160a01b0316610a9f610cda565b6001600160a01b031614610ae8576040805162461bcd60e51b81526020600482018190526024820152600080516020611711833981519152604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b6007546001600160a01b0316610b4c611007565b6001600160a01b031614610b96576040805162461bcd60e51b815260206004820152600c60248201526b4f4e4c595f4741544557415960a01b604482015290519081900360640190fd5b6006546040805163edb561c360e01b81526001600160a01b038581166004830152602482018590529151919092169163edb561c391604480830192600092919082900301818387803b158015610beb57600080fd5b505af1158015610bff573d6000803e3d6000fd5b505050505050565b610c0f611007565b6001600160a01b0316610c20610cda565b6001600160a01b031614610c69576040805162461bcd60e51b81526020600482018190526024820152600080516020611711833981519152604482015290519081900360640190fd5b600780546001600160a01b038085166001600160a01b0319928316179283905560088054858316931692909217918290556040805193821684529116602083015280517f7ae81782064ab8dd8fc6bb668cbd82500e4484947d5761b6756dae2e982e89089281900390910190a15050565b60055461010090046001600160a01b031690565b600854600090600160a01b900460ff16610d43576040805162461bcd60e51b81526020600482015260116024820152701393d517d156141150d5115117d0d05313607a1b604482015290519081900360640190fd5b5061a4b190565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106935780601f1061066857610100808354040283529160200191610693565b6006546001600160a01b03166379cc6790610dc4611007565b836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610e0b57600080fd5b505af1158015610e1f573d6000803e3d6000fd5b505050506107c9610e2e611007565b826112f1565b60006106b1610e41611007565b8461073b8560405180606001604052806025815260200161179b6025913960016000610e6b611007565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906113e1565b60006106b1610ea9611007565b8484611478565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6007546001600160a01b031681565b610ef2611007565b6001600160a01b0316610f03610cda565b6001600160a01b031614610f4c576040805162461bcd60e51b81526020600482018190526024820152600080516020611711833981519152604482015290519081900360640190fd5b6001600160a01b038116610f915760405162461bcd60e51b815260040180806020018281038252602681526020018061167b6026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6008546001600160a01b031681565b3390565b6001600160a01b0383166110505760405162461bcd60e51b81526004018080602001828103825260248152602001806117776024913960400191505060405180910390fd5b6001600160a01b0382166110955760405162461bcd60e51b81526004018080602001828103825260228152602001806116a16022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000611104848484611478565b61116f84611110611007565b61073b856040518060600160405280602881526020016116e9602891396001600160a01b038a1660009081526001602052604081209061114e611007565b6001600160a01b0316815260208101919091526040016000205491906113e1565b5060019392505050565b6000828201838110156111d3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6001600160a01b03821661121f5760405162461bcd60e51b81526004018080602001828103825260218152602001806117316021913960400191505060405180910390fd5b61122b826000836115d3565b61126881604051806060016040528060228152602001611659602291396001600160a01b03851660009081526020819052604090205491906113e1565b6001600160a01b03831660009081526020819052604090205560025461128e90826115d8565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6001600160a01b031660009081526020819052604090205490565b6001600160a01b03821661134c576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b611358600083836115d3565b6002546113659082611179565b6002556001600160a01b03821660009081526020819052604090205461138b9082611179565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600081848411156114705760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561143557818101518382015260200161141d565b50505050905090810190601f1680156114625780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0383166114bd5760405162461bcd60e51b81526004018080602001828103825260258152602001806117526025913960400191505060405180910390fd5b6001600160a01b0382166115025760405162461bcd60e51b81526004018080602001828103825260238152602001806116366023913960400191505060405180910390fd5b61150d8383836115d3565b61154a816040518060600160405280602681526020016116c3602691396001600160a01b03861660009081526020819052604090205491906113e1565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546115799082611179565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b505050565b60008282111561162f576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212201a2dec6c80ff40327210472f1d376fbd0d7cbdffe7cc025a219a5fb70d6eaf0d64736f6c634300060c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000b4a3b0faf0ab53df58001804dda5bfc6a3d59008000000000000000000000000cee284f754e854890e311e3280b767f80797180d00000000000000000000000072ce9c846789fdb6fc1f34ac4ad25dd9ef7031ef000000000000000000000000000000000000000000000000000000000000000e577261707065642053706572617800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000047753504100000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : name_ (string): Wrapped Sperax
Arg [1] : symbol_ (string): wSPA
Arg [2] : _spaAddress (address): 0xB4A3B0Faf0Ab53df58001804DdA5Bfc6a3D59008
Arg [3] : _bridge (address): 0xcEe284F754E854890e311e3280b767F80797180d
Arg [4] : _router (address): 0x72Ce9c846789fdB6fC1f34aC4AD25Dd9ef7031ef
-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [2] : 000000000000000000000000b4a3b0faf0ab53df58001804dda5bfc6a3d59008
Arg [3] : 000000000000000000000000cee284f754e854890e311e3280b767f80797180d
Arg [4] : 00000000000000000000000072ce9c846789fdb6fc1f34ac4ad25dd9ef7031ef
Arg [5] : 000000000000000000000000000000000000000000000000000000000000000e
Arg [6] : 5772617070656420537065726178000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [8] : 7753504100000000000000000000000000000000000000000000000000000000
Deployed Bytecode Sourcemap
253:3589:34:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2149:89:6;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4225:166;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;4225:166:6;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;3216:106;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;954:194:34;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;954:194:34;;;;;;;;;;;;;;;;;:::i;3067:89:6:-;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;346:25:34;;;;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;346:25:34;;;;;;;;;;;;;;5570:215:6;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;5570:215:6;;;;;;;;:::i;1552:151:34:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1552:151:34;;:::i;:::-;;2794:1046;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;2794:1046:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;2639:149::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2639:149:34;-1:-1:-1;;;;;2639:149:34;;:::i;1154:144::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1154:144:34;-1:-1:-1;;;;;1154:144:34;;:::i;1710:145:30:-;;;;;;;;;;;;;:::i;1782:144:34:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;1782:144:34;;;;;;;;:::i;2430:203::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;2430:203:34;;;;;;;;;;:::i;1078:85:30:-;;;;;;;;;;;;;:::i;2031:166:34:-;;;;;;;;;;;;;:::i;2351:93:6:-;;;;;;;;;;;;;:::i;1351:148:34:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1351:148:34;;:::i;6272:266:6:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;6272:266:6;;;;;;;;:::i;3708:172::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;3708:172:6;;;;;;;;:::i;3938:149::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;3938:149:6;;;;;;;;;;:::i;377:21:34:-;;;;;;;;;;;;;:::i;2004:240:30:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2004:240:30;-1:-1:-1;;;;;2004:240:30;;:::i;404:21:34:-;;;;;;;;;;;;;:::i;2149:89:6:-;2226:5;2219:12;;;;;;;;-1:-1:-1;;2219:12:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2194:13;;2219:12;;2226:5;;2219:12;;2226:5;2219:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2149:89;:::o;4225:166::-;4308:4;4324:39;4333:12;:10;:12::i;:::-;4347:7;4356:6;4324:8;:39::i;:::-;-1:-1:-1;4380:4:6;4225:166;;;;:::o;3216:106::-;3303:12;;3216:106;:::o;954:194:34:-;1073:4;1096:45;1115:6;1123:9;1134:6;1096:18;:45::i;:::-;1089:52;954:194;-1:-1:-1;;;;954:194:34:o;3067:89:6:-;3140:9;;;;3067:89;:::o;346:25:34:-;;;-1:-1:-1;;;;;346:25:34;;:::o;5570:215:6:-;5658:4;5674:83;5683:12;:10;:12::i;:::-;5697:7;5706:50;5745:10;5706:11;:25;5718:12;:10;:12::i;:::-;-1:-1:-1;;;;;5706:25:6;;;;;;;;;;;;;;;;;-1:-1:-1;5706:25:6;;;:34;;;;;;;;;;;:38;:50::i;:::-;5674:8;:83::i;1552:151:34:-;1614:10;;-1:-1:-1;;;;;1614:10:34;1601:36;1638:12;:10;:12::i;:::-;1652:6;1601:58;;;;;;;;;;;;;-1:-1:-1;;;;;1601:58:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1669:27;1675:12;:10;:12::i;:::-;1689:6;1669:5;:27::i;:::-;1552:151;:::o;2794:1046::-;1301:12:30;:10;:12::i;:::-;-1:-1:-1;;;;;1290:23:30;:7;:5;:7::i;:::-;-1:-1:-1;;;;;1290:23:30;;1282:68;;;;;-1:-1:-1;;;1282:68:30;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1282:68:30;;;;;;;;;;;;;;;3281:21:34::1;::::0;;-1:-1:-1;;;;;;;3312:28:34;::::1;::::0;::::1;::::0;;;3367:6:::1;::::0;3351:230:::1;::::0;;-1:-1:-1;;;3351:230:34;;-1:-1:-1;;;;;3351:230:34;;::::1;;::::0;::::1;::::0;;;;;;;;;;;;;;;;;;;;;::::1;::::0;;;;;;3281:21;;;::::1;;;::::0;3367:6;::::1;::::0;3351:41:::1;::::0;3399:15;;3351:230;;;;;::::1;::::0;;;;;;;;;3399:15;3367:6;3351:230;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;;3608:6:34::1;::::0;3662::::1;::::0;3592:202:::1;::::0;;-1:-1:-1;;;3592:202:34;;-1:-1:-1;;;;;3662:6:34;;::::1;3592:202;::::0;::::1;::::0;;;;;;;;;;;;;;;;;;;;;::::1;::::0;;;;;;3608:6;;;::::1;::::0;3592:34:::1;::::0;3633:14;;3592:202;;;;;3351:230:::1;::::0;3592:202;;;;;;;;3633:14;3608:6;3592:202;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;;3805:21:34::1;:28:::0;;;::::1;;-1:-1:-1::0;;;3805:28:34::1;-1:-1:-1::0;;;;3805:28:34;;::::1;::::0;;;::::1;::::0;;-1:-1:-1;;;;;;;;2794:1046:34:o;2639:149::-;1301:12:30;:10;:12::i;:::-;-1:-1:-1;;;;;1290:23:30;:7;:5;:7::i;:::-;-1:-1:-1;;;;;1290:23:30;;1282:68;;;;;-1:-1:-1;;;1282:68:30;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1282:68:30;;;;;;;;;;;;;;;2733:10:34::1;::::0;2715:37:::1;::::0;;-1:-1:-1;;;;;2733:10:34;;::::1;2715:37:::0;;;;::::1;;::::0;::::1;::::0;;;::::1;::::0;;;;;;;;::::1;2762:10;:19:::0;;-1:-1:-1;;;;;;2762:19:34::1;-1:-1:-1::0;;;;;2762:19:34;;;::::1;::::0;;;::::1;::::0;;2639:149::o;1154:144::-;1241:7;1267:24;1283:7;1267:15;:24::i;:::-;1260:31;1154:144;-1:-1:-1;;1154:144:34:o;1710:145:30:-;1301:12;:10;:12::i;:::-;-1:-1:-1;;;;;1290:23:30;:7;:5;:7::i;:::-;-1:-1:-1;;;;;1290:23:30;;1282:68;;;;;-1:-1:-1;;;1282:68:30;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1282:68:30;;;;;;;;;;;;;;;1800:6:::1;::::0;1779:40:::1;::::0;1816:1:::1;::::0;1800:6:::1;::::0;::::1;-1:-1:-1::0;;;;;1800:6:30::1;::::0;1779:40:::1;::::0;1816:1;;1779:40:::1;1829:6;:19:::0;;-1:-1:-1;;;;;;1829:19:30::1;::::0;;1710:145::o;1782:144:34:-;668:6;;-1:-1:-1;;;;;668:6:34;652:12;:10;:12::i;:::-;-1:-1:-1;;;;;652:22:34;;644:47;;;;;-1:-1:-1;;;644:47:34;;;;;;;;;;;;-1:-1:-1;;;644:47:34;;;;;;;;;;;;;;;1879:10:::1;::::0;1866:53:::1;::::0;;-1:-1:-1;;;1866:53:34;;-1:-1:-1;;;;;1866:53:34;;::::1;;::::0;::::1;::::0;;;;;;;;;1879:10;;;::::1;::::0;1866:36:::1;::::0;:53;;;;;1879:10:::1;::::0;1866:53;;;;;;;1879:10;;1866:53;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;1782:144:::0;;:::o;2430:203::-;1301:12:30;:10;:12::i;:::-;-1:-1:-1;;;;;1290:23:30;:7;:5;:7::i;:::-;-1:-1:-1;;;;;1290:23:30;;1282:68;;;;;-1:-1:-1;;;1282:68:30;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1282:68:30;;;;;;;;;;;;;;;2521:6:34::1;:18:::0;;-1:-1:-1;;;;;2521:18:34;;::::1;-1:-1:-1::0;;;;;;2521:18:34;;::::1;;::::0;;;;2549:6:::1;:18:::0;;;;::::1;::::0;::::1;::::0;;;::::1;::::0;;;;2582:44:::1;::::0;;2611:6;;::::1;2582:44:::0;;2619:6;::::1;2582:44;::::0;::::1;::::0;;;::::1;::::0;;;;;;;;::::1;2430:203:::0;;:::o;1078:85:30:-;1150:6;;;;;-1:-1:-1;;;;;1150:6:30;;1078:85::o;2031:166:34:-;2117:21;;2092:5;;-1:-1:-1;;;2117:21:34;;;;2109:51;;;;;-1:-1:-1;;;2109:51:34;;;;;;;;;;;;-1:-1:-1;;;2109:51:34;;;;;;;;;;;;;;;-1:-1:-1;2183:6:34;2031:166;:::o;2351:93:6:-;2430:7;2423:14;;;;;;;;-1:-1:-1;;2423:14:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2398:13;;2423:14;;2430:7;;2423:14;;2430:7;2423:14;;;;;;;;;;;;;;;;;;;;;;;;1351:148:34;1413:10;;-1:-1:-1;;;;;1413:10:34;1400:33;1434:12;:10;:12::i;:::-;1448:6;1400:55;;;;;;;;;;;;;-1:-1:-1;;;;;1400:55:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1465:27;1471:12;:10;:12::i;:::-;1485:6;1465:5;:27::i;6272:266:6:-;6365:4;6381:129;6390:12;:10;:12::i;:::-;6404:7;6413:96;6452:15;6413:96;;;;;;;;;;;;;;;;;:11;:25;6425:12;:10;:12::i;:::-;-1:-1:-1;;;;;6413:25:6;;;;;;;;;;;;;;;;;-1:-1:-1;6413:25:6;;;:34;;;;;;;;;;;:96;:38;:96::i;3708:172::-;3794:4;3810:42;3820:12;:10;:12::i;:::-;3834:9;3845:6;3810:9;:42::i;3938:149::-;-1:-1:-1;;;;;4053:18:6;;;4027:7;4053:18;;;:11;:18;;;;;;;;:27;;;;;;;;;;;;;3938:149::o;377:21:34:-;;;-1:-1:-1;;;;;377:21:34;;:::o;2004:240:30:-;1301:12;:10;:12::i;:::-;-1:-1:-1;;;;;1290:23:30;:7;:5;:7::i;:::-;-1:-1:-1;;;;;1290:23:30;;1282:68;;;;;-1:-1:-1;;;1282:68:30;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1282:68:30;;;;;;;;;;;;;;;-1:-1:-1;;;;;2092:22:30;::::1;2084:73;;;;-1:-1:-1::0;;;2084:73:30::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2193:6;::::0;2172:38:::1;::::0;-1:-1:-1;;;;;2172:38:30;;::::1;::::0;2193:6:::1;::::0;::::1;;::::0;2172:38:::1;::::0;;;::::1;2220:6;:17:::0;;-1:-1:-1;;;;;2220:17:30;;::::1;;;-1:-1:-1::0;;;;;;2220:17:30;;::::1;::::0;;;::::1;::::0;;2004:240::o;404:21:34:-;;;-1:-1:-1;;;;;404:21:34;;:::o;598:104:4:-;685:10;598:104;:::o;9336:340:6:-;-1:-1:-1;;;;;9437:19:6;;9429:68;;;;-1:-1:-1;;;9429:68:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;9515:21:6;;9507:68;;;;-1:-1:-1;;;9507:68:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;9586:18:6;;;;;;;:11;:18;;;;;;;;:27;;;;;;;;;;;;;:36;;;9637:32;;;;;;;;;;;;;;;;;9336:340;;;:::o;4858:317::-;4964:4;4980:36;4990:6;4998:9;5009:6;4980:9;:36::i;:::-;5026:121;5035:6;5043:12;:10;:12::i;:::-;5057:89;5095:6;5057:89;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;5057:19:6;;;;;;:11;:19;;;;;;5077:12;:10;:12::i;:::-;-1:-1:-1;;;;;5057:33:6;;;;;;;;;;;;-1:-1:-1;5057:33:6;;;:89;:37;:89::i;5026:121::-;-1:-1:-1;5164:4:6;4858:317;;;;;:::o;2690:175:33:-;2748:7;2779:5;;;2802:6;;;;2794:46;;;;;-1:-1:-1;;;2794:46:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;2857:1;2690:175;-1:-1:-1;;;2690:175:33:o;8503:410:6:-;-1:-1:-1;;;;;8586:21:6;;8578:67;;;;-1:-1:-1;;;8578:67:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8656:49;8677:7;8694:1;8698:6;8656:20;:49::i;:::-;8737:68;8760:6;8737:68;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;8737:18:6;;:9;:18;;;;;;;;;;;;:68;:22;:68::i;:::-;-1:-1:-1;;;;;8716:18:6;;:9;:18;;;;;;;;;;:89;8830:12;;:24;;8847:6;8830:16;:24::i;:::-;8815:12;:39;8869:37;;;;;;;;8895:1;;-1:-1:-1;;;;;8869:37:6;;;;;;;;;;;;8503:410;;:::o;3380:125::-;-1:-1:-1;;;;;3480:18:6;3454:7;3480:18;;;;;;;;;;;;3380:125::o;7813:370::-;-1:-1:-1;;;;;7896:21:6;;7888:65;;;;;-1:-1:-1;;;7888:65:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;7964:49;7993:1;7997:7;8006:6;7964:20;:49::i;:::-;8039:12;;:24;;8056:6;8039:16;:24::i;:::-;8024:12;:39;-1:-1:-1;;;;;8094:18:6;;:9;:18;;;;;;;;;;;:30;;8117:6;8094:22;:30::i;:::-;-1:-1:-1;;;;;8073:18:6;;:9;:18;;;;;;;;;;;:51;;;;8139:37;;;;;;;8073:18;;:9;;8139:37;;;;;;;;;;7813:370;;:::o;5432:163:33:-;5518:7;5553:12;5545:6;;;;5537:29;;;;-1:-1:-1;;;5537:29:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;5583:5:33;;;5432:163::o;7012:530:6:-;-1:-1:-1;;;;;7117:20:6;;7109:70;;;;-1:-1:-1;;;7109:70:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;7197:23:6;;7189:71;;;;-1:-1:-1;;;7189:71:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7271:47;7292:6;7300:9;7311:6;7271:20;:47::i;:::-;7349:71;7371:6;7349:71;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;7349:17:6;;:9;:17;;;;;;;;;;;;:71;:21;:71::i;:::-;-1:-1:-1;;;;;7329:17:6;;;:9;:17;;;;;;;;;;;:91;;;;7453:20;;;;;;;:32;;7478:6;7453:24;:32::i;:::-;-1:-1:-1;;;;;7430:20:6;;;:9;:20;;;;;;;;;;;;:55;;;;7500:35;;;;;;;7430:20;;7500:35;;;;;;;;;;;;;7012:530;;;:::o;10682:92::-;;;;:::o;3136:155:33:-;3194:7;3226:1;3221;:6;;3213:49;;;;;-1:-1:-1;;;3213:49:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3279:5:33;;;3136:155::o
Swarm Source
ipfs://1a2dec6c80ff40327210472f1d376fbd0d7cbdffe7cc025a219a5fb70d6eaf0d
Loading...
Loading
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.