Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
L1CustomGateway
Compiler Version
v0.6.11+commit.5ef660b1
Optimization Enabled:
Yes with 100 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// 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 "../../arbitrum/gateway/L2CustomGateway.sol"; import "../../libraries/gateway/ICustomGateway.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "arb-bridge-eth/contracts/libraries/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; // start of inline reentrancy guard // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.2/contracts/utils/ReentrancyGuard.sol uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; _status = _NOT_ENTERED; } modifier onlyOwner() { require(msg.sender == owner, "ONLY_OWNER"); _; } function outboundTransferCustomRefund( address _l1Token, address _refundTo, address _to, uint256 _amount, uint256 _maxGas, uint256 _gasPriceBid, bytes calldata _data ) public payable override nonReentrant returns (bytes memory res) { return super.outboundTransferCustomRefund( _l1Token, _refundTo, _to, _amount, _maxGas, _gasPriceBid, _data ); } function finalizeInboundTransfer( address _token, address _from, address _to, uint256 _amount, bytes calldata _data ) public payable override nonReentrant { // the superclass checks onlyCounterpartGateway super.finalizeInboundTransfer(_token, _from, _to, _amount, _data); } function initialize( address _l1Counterpart, address _l1Router, address _inbox, address _owner ) public { L1ArbitrumGateway._initialize(_l1Counterpart, _l1Router, _inbox); owner = _owner; // disable whitelist by default whitelist = address(0); // reentrancy guard _status = _NOT_ENTERED; } /** * @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 ); } function setOwner(address newOwner) external onlyOwner { require(newOwner != address(0), "INVALID_OWNER"); owner = newOwner; } /** * @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 onlyOwner returns (uint256) { 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. */ // solhint-disable-next-line compiler-version pragma solidity >=0.6.9 <0.9.0; 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 maxGasForCustomBridge, uint256 maxGasForRouter, 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); } interface L1MintableToken is ICustomToken { function bridgeMint(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; import "../../libraries/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; 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 "./L2ArbitrumGateway.sol"; import "../../libraries/gateway/ICustomGateway.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/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. */ // solhint-disable-next-line compiler-version pragma solidity >=0.6.9 <0.9.0; // 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: 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 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); } }
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >0.6.0 <0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC20/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 "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Create2.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "arb-bridge-eth/contracts/bridge/interfaces/IInbox.sol"; import "arb-bridge-eth/contracts/libraries/ProxyUtil.sol"; import "../L1ArbitrumMessenger.sol"; import "../../libraries/gateway/GatewayMessageHandler.sol"; import "../../libraries/gateway/TokenGateway.sol"; import "./IL1ArbitrumGateway.sol"; import "../../libraries/ITransferAndCall.sol"; import "../../libraries/ERC165.sol"; /** * @title Common interface for gatways on L1 messaging to Arbitrum. */ abstract contract L1ArbitrumGateway is L1ArbitrumMessenger, TokenGateway, ERC165, IL1ArbitrumGateway { using SafeERC20 for IERC20; using Address for address; address public override 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 { 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 ) public payable virtual override onlyCounterpartGateway { // this function is marked as virtual so superclasses can override it to add modifiers (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); } /** * @dev Only excess gas is refunded to the _refundTo account, l2 call value is always returned to the _to account */ function createOutboundTxCustomRefund( address _refundTo, 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 sendTxToL2CustomRefund( inbox, counterpartGateway, _refundTo, _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 DEPRECATED - look at createOutboundTxCustomRefund instead */ function createOutboundTx( address _from, uint256 _tokenAmount, uint256 _maxGas, uint256 _gasPriceBid, uint256 _maxSubmissionCost, bytes memory _outboundCalldata ) internal returns (uint256) { return createOutboundTxCustomRefund( _from, _from, _tokenAmount, _maxGas, _gasPriceBid, _maxSubmissionCost, _outboundCalldata ); } /** * @notice DEPRECATED - look at outboundTransferCustomRefund instead */ function outboundTransfer( address _l1Token, address _to, uint256 _amount, uint256 _maxGas, uint256 _gasPriceBid, bytes calldata _data ) public payable override returns (bytes memory res) { return outboundTransferCustomRefund(_l1Token, _to, _to, _amount, _maxGas, _gasPriceBid, _data); } /** * @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. * @dev L2 address alias will not be applied to the following types of addresses on L1: * - 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 * @param _l1Token L1 address of ERC20 * @param _refundTo Account, or its L2 alias if it have code in L1, to be credited with excess gas refund in L2 * @param _to Account to be credited with the tokens in the L2 (can be the user's L2 account or a contract), not subject to L2 aliasing This account, or its L2 alias if it have code in L1, will also be able to cancel the retryable ticket and receive callvalue refund * @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 outboundTransferCustomRefund( address _l1Token, address _refundTo, 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 = createOutboundTxCustomRefund( _refundTo, _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( ITokenGateway.finalizeInboundTransfer.selector, _l1Token, _from, _to, _amount, GatewayMessageHandler.encodeToL2GatewayMsg(emptyBytes, _data) ); return outboundCalldata; } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { // registering interfaces that is added after arb-bridge-peripherals >1.0.11 // using function selector instead of single function interfaces to reduce bloat return interfaceId == this.outboundTransferCustomRefund.selector || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @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: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/Context.sol"; import "./IERC20.sol"; import "../../math/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: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/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 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; /** * @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 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. */ // solhint-disable-next-line compiler-version pragma solidity >=0.6.9 <0.9.0; 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 unsafeCreateRetryableTicket( 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; 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: 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 "arb-bridge-eth/contracts/bridge/interfaces/IInbox.sol"; import "arb-bridge-eth/contracts/bridge/interfaces/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 sendTxToL2CustomRefund( address _inbox, address _to, address _refundTo, address _user, uint256 _l1CallValue, uint256 _l2CallValue, L2GasParams memory _l2GasParams, bytes memory _data ) internal returns (uint256) { // alternative function entry point when struggling with the stack size return sendTxToL2CustomRefund( _inbox, _to, _refundTo, _user, _l1CallValue, _l2CallValue, _l2GasParams._maxSubmissionCost, _l2GasParams._maxGas, _l2GasParams._gasPriceBid, _data ); } function sendTxToL2( address _inbox, address _to, address _user, uint256 _l1CallValue, uint256 _l2CallValue, L2GasParams memory _l2GasParams, bytes memory _data ) internal 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 sendTxToL2CustomRefund( address _inbox, address _to, address _refundTo, address _user, uint256 _l1CallValue, uint256 _l2CallValue, uint256 _maxSubmissionCost, uint256 _maxGas, uint256 _gasPriceBid, bytes memory _data ) internal returns (uint256) { uint256 seqNum = IInbox(_inbox).createRetryableTicket{ value: _l1CallValue }( _to, _l2CallValue, _maxSubmissionCost, _refundTo, // only refund excess fee to the custom address _user, // user can cancel the retryable and receive call value refund _maxGas, _gasPriceBid, _data ); emit TxToL2(_user, _to, seqNum, _data); return seqNum; } function sendTxToL2( address _inbox, address _to, address _user, uint256 _l1CallValue, uint256 _l2CallValue, uint256 _maxSubmissionCost, uint256 _maxGas, uint256 _gasPriceBid, bytes memory _data ) internal returns (uint256) { return sendTxToL2CustomRefund( _inbox, _to, _user, _user, _l1CallValue, _l2CallValue, _maxSubmissionCost, _maxGas, _gasPriceBid, _data ); } function getBridge(address _inbox) internal view 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 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 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 "./ITokenGateway.sol"; import "@openzeppelin/contracts/utils/Address.sol"; abstract contract TokenGateway is ITokenGateway { using Address for address; address public counterpartGateway; address public router; // This modifier is overriden in gateways to validate the message sender // For L1 to L2 messages need to be validated against the aliased counterpartGateway // For L2 to L1 messages need to be validated against the bridge and L2ToL1Sender // prettier-ignore modifier onlyCounterpartGateway() virtual; 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); }
// 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. */ // solhint-disable-next-line compiler-version pragma solidity >=0.6.9 <0.9.0; import "../../libraries/gateway/ITokenGateway.sol"; import "../../libraries/IERC165.sol"; /** * @title Common interface for gatways on L1 messaging to Arbitrum. */ interface IL1ArbitrumGateway is ITokenGateway, IERC165 { function inbox() external view returns (address); /** * @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. * @dev L2 address alias will not be applied to the following types of addresses on L1: * - 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 * @param _l1Token L1 address of ERC20 * @param _refundTo Account, or its L2 alias if it have code in L1, to be credited with excess gas refund in L2 * @param _to Account to be credited with the tokens in the L2 (can be the user's L2 account or a contract), not subject to L2 aliasing This account, or its L2 alias if it have code in L1, will also be able to cancel the retryable ticket and receive callvalue refund * @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 outboundTransferCustomRefund( address _l1Token, address _refundTo, address _to, uint256 _amount, uint256 _maxGas, uint256 _gasPriceBid, bytes calldata _data ) external payable returns (bytes memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) // With pragma modification to support ^0.6.11 // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.6/contracts/utils/introspection/ERC165.sol pragma solidity ^0.6.11; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT 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 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: 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. */ // solhint-disable-next-line compiler-version pragma solidity >=0.6.9 <0.9.0; 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 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. */ // solhint-disable-next-line compiler-version pragma solidity >=0.6.9 <0.9.0; 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. */ // solhint-disable-next-line compiler-version pragma solidity >=0.6.9 <0.9.0; 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: 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. */ // solhint-disable-next-line compiler-version pragma solidity >=0.6.9 <0.9.0; 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); function getOutboundCalldata( address _token, address _from, address _to, uint256 _amount, bytes memory _data ) external view returns (bytes memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) // With pragma modification to allow interface compatibility with >=0.6.9 <0.9.0 // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.6/contracts/utils/introspection/IERC165.sol // solhint-disable-next-line compiler-version pragma solidity >=0.6.9 <0.9.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: 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 "@openzeppelin/contracts/utils/Address.sol"; import "arb-bridge-eth/contracts/libraries/BytesLib.sol"; import "arb-bridge-eth/contracts/libraries/ProxyUtil.sol"; import "arb-bridge-eth/contracts/libraries/AddressAliasHelper.sol"; import "../IArbToken.sol"; import "../L2ArbitrumMessenger.sol"; import "../../libraries/gateway/GatewayMessageHandler.sol"; import "../../libraries/gateway/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 == AddressAliasHelper.applyL1ToL2Alias(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 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( ITokenGateway.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 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 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: 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: 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 /* * 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). */ // solhint-disable-next-line compiler-version pragma solidity >=0.6.9 <0.9.0; 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 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 "arbos-precompiles/arbos/builtin/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 returns (uint256) { uint256 _id = ArbSys(ARB_SYS_ADDRESS).sendTxToL1{ value: _l1CallValue }(_to, _data); emit TxToL1(_from, _to, _id, _data); return _id; } }
pragma solidity >=0.6.9 <0.9.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 (uint256); function arbChainID() external view returns (uint256); /** * @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 (uint256); /** * @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 (uint256); /** * @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 (uint256); /** * @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 view returns (uint256); event L2ToL1Transaction( address caller, address indexed destination, uint256 indexed uniqueId, uint256 indexed batchNumber, uint256 indexInBatch, uint256 arbBlockNum, uint256 ethBlockNum, uint256 timestamp, uint256 callvalue, bytes data ); }
{ "optimizer": { "enabled": true, "runs": 100 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"l1Token","type":"address"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"uint256","name":"_sequenceNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"DepositInitiated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"l1Address","type":"address"},{"indexed":true,"internalType":"address","name":"l2Address","type":"address"}],"name":"TokenSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"uint256","name":"_seqNum","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"_data","type":"bytes"}],"name":"TxToL2","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"exitNum","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newData","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"bool","name":"madeExternalCall","type":"bool"}],"name":"WithdrawRedirected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"l1Token","type":"address"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":true,"internalType":"uint256","name":"_exitNum","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"WithdrawalFinalized","type":"event"},{"inputs":[{"internalType":"address","name":"l1ERC20","type":"address"}],"name":"calculateL2TokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"counterpartGateway","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_exitNum","type":"uint256"},{"internalType":"address","name":"_initialDestination","type":"address"}],"name":"encodeWithdrawal","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"finalizeInboundTransfer","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_l1Addresses","type":"address[]"},{"internalType":"address[]","name":"_l2Addresses","type":"address[]"},{"internalType":"uint256","name":"_maxGas","type":"uint256"},{"internalType":"uint256","name":"_gasPriceBid","type":"uint256"},{"internalType":"uint256","name":"_maxSubmissionCost","type":"uint256"}],"name":"forceRegisterTokenToL2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_exitNum","type":"uint256"},{"internalType":"address","name":"_initialDestination","type":"address"},{"internalType":"bytes","name":"_initialData","type":"bytes"}],"name":"getExternalCall","outputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_l1Token","type":"address"},{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"getOutboundCalldata","outputs":[{"internalType":"bytes","name":"outboundCalldata","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inbox","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_l1Counterpart","type":"address"},{"internalType":"address","name":"_l1Router","type":"address"},{"internalType":"address","name":"_inbox","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"l1ToL2Token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_l1Token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_maxGas","type":"uint256"},{"internalType":"uint256","name":"_gasPriceBid","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"outboundTransfer","outputs":[{"internalType":"bytes","name":"res","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_l1Token","type":"address"},{"internalType":"address","name":"_refundTo","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_maxGas","type":"uint256"},{"internalType":"uint256","name":"_gasPriceBid","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"outboundTransferCustomRefund","outputs":[{"internalType":"bytes","name":"res","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"postUpgradeInit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"redirectedExits","outputs":[{"internalType":"bool","name":"isExit","type":"bool"},{"internalType":"address","name":"_newTo","type":"address"},{"internalType":"bytes","name":"_newData","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_l2Address","type":"address"},{"internalType":"uint256","name":"_maxGas","type":"uint256"},{"internalType":"uint256","name":"_gasPriceBid","type":"uint256"},{"internalType":"uint256","name":"_maxSubmissionCost","type":"uint256"},{"internalType":"address","name":"_creditBackAddress","type":"address"}],"name":"registerTokenToL2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_l2Address","type":"address"},{"internalType":"uint256","name":"_maxGas","type":"uint256"},{"internalType":"uint256","name":"_gasPriceBid","type":"uint256"},{"internalType":"uint256","name":"_maxSubmissionCost","type":"uint256"}],"name":"registerTokenToL2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_exitNum","type":"uint256"},{"internalType":"address","name":"_initialDestination","type":"address"},{"internalType":"address","name":"_newDestination","type":"address"},{"internalType":"bytes","name":"_newData","type":"bytes"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"transferExitAndCall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"whitelist","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50612d5e806100206000396000f3fe6080604052600436106101355760003560e01c8063a0c76a96116100ab578063d2ce7d651161006f578063d2ce7d651461081b578063f26bdead146108b5578063f68a9082146108ed578063f887ea4014610a44578063f8c8765e14610a59578063fb0e722b14610aa457610135565b8063a0c76a961461051c578063a7e28d48146105f5578063bcf2e6eb14610628578063bd5f3e7d146106ee578063ca346d4a146107d957610135565b80632e567b36116100fd5780632e567b36146102fd5780634fb1a07b146103935780638a2dc014146104aa5780638da5cb5b146104dd57806393e59dc1146104f257806395fcea781461050757610135565b806301ffc9a71461013a578063020a60581461018257806313af4035146101cd5780631d3a689f146102025780632db09c1c146102cc575b600080fd5b34801561014657600080fd5b5061016e6004803603602081101561015d57600080fd5b50356001600160e01b031916610ab9565b604080519115158252519081900360200190f35b34801561018e57600080fd5b506101bb600480360360408110156101a557600080fd5b50803590602001356001600160a01b0316610ae4565b60408051918252519081900360200190f35b3480156101d957600080fd5b50610200600480360360208110156101f057600080fd5b50356001600160a01b0316610b19565b005b6101bb600480360360a081101561021857600080fd5b810190602081018135600160201b81111561023257600080fd5b82018360208201111561024457600080fd5b803590602001918460208302840111600160201b8311171561026557600080fd5b919390929091602081019035600160201b81111561028257600080fd5b82018360208201111561029457600080fd5b803590602001918460208302840111600160201b831117156102b557600080fd5b919350915080359060208101359060400135610bd2565b3480156102d857600080fd5b506102e1610e53565b604080516001600160a01b039092168252519081900360200190f35b610200600480360360a081101561031357600080fd5b6001600160a01b03823581169260208101358216926040820135909216916060820135919081019060a081016080820135600160201b81111561035557600080fd5b82018360208201111561036757600080fd5b803590602001918460018302840111600160201b8311171561038857600080fd5b509092509050610e62565b610435600480360360e08110156103a957600080fd5b6001600160a01b038235811692602081013582169260408201359092169160608201359160808101359160a0820135919081019060e0810160c0820135600160201b8111156103f757600080fd5b82018360208201111561040957600080fd5b803590602001918460018302840111600160201b8311171561042a57600080fd5b509092509050610eda565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561046f578181015183820152602001610457565b50505050905090810190601f16801561049c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104b657600080fd5b506102e1600480360360208110156104cd57600080fd5b50356001600160a01b0316610f5b565b3480156104e957600080fd5b506102e1610f76565b3480156104fe57600080fd5b506102e1610f85565b34801561051357600080fd5b50610200610f94565b34801561052857600080fd5b50610435600480360360a081101561053f57600080fd5b6001600160a01b03823581169260208101358216926040820135909216916060820135919081019060a081016080820135600160201b81111561058157600080fd5b82018360208201111561059357600080fd5b803590602001918460018302840111600160201b831117156105b457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610ff1945050505050565b34801561060157600080fd5b506102e16004803603602081101561061857600080fd5b50356001600160a01b03166110f8565b34801561063457600080fd5b506106526004803603602081101561064b57600080fd5b5035611116565b6040518084151515158152602001836001600160a01b03166001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b838110156106b1578181015183820152602001610699565b50505050905090810190601f1680156106de5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b3480156106fa57600080fd5b50610200600480360360a081101561071157600080fd5b8135916001600160a01b03602082013581169260408301359091169190810190608081016060820135600160201b81111561074b57600080fd5b82018360208201111561075d57600080fd5b803590602001918460018302840111600160201b8311171561077e57600080fd5b919390929091602081019035600160201b81111561079b57600080fd5b8201836020820111156107ad57600080fd5b803590602001918460018302840111600160201b831117156107ce57600080fd5b5090925090506111cd565b6101bb600480360360a08110156107ef57600080fd5b506001600160a01b038135811691602081013591604082013591606081013591608090910135166114eb565b610435600480360360c081101561083157600080fd5b6001600160a01b0382358116926020810135909116916040820135916060810135916080820135919081019060c0810160a0820135600160201b81111561087757600080fd5b82018360208201111561088957600080fd5b803590602001918460018302840111600160201b831117156108aa57600080fd5b509092509050611869565b6101bb600480360360808110156108cb57600080fd5b506001600160a01b038135169060208101359060408101359060600135611887565b3480156108f957600080fd5b506109b36004803603606081101561091057600080fd5b8135916001600160a01b0360208201351691810190606081016040820135600160201b81111561093f57600080fd5b82018360208201111561095157600080fd5b803590602001918460018302840111600160201b8311171561097257600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061189f945050505050565b60405180836001600160a01b03166001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610a085781810151838201526020016109f0565b50505050905090810190601f168015610a355780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b348015610a5057600080fd5b506102e161198a565b348015610a6557600080fd5b5061020060048036036080811015610a7c57600080fd5b506001600160a01b038135811691602081013582169160408201358116916060013516611999565b348015610ab057600080fd5b506102e16119d5565b60006001600160e01b03198216634fb1a07b60e01b1480610ade5750610ade826119e4565b92915050565b604080516020808201949094526001600160a01b03929092168282015280518083038201815260609092019052805191012090565b6005546001600160a01b03163314610b65576040805162461bcd60e51b815260206004820152600a60248201526927a7262cafa7aba722a960b11b604482015290519081900360640190fd5b6001600160a01b038116610bb0576040805162461bcd60e51b815260206004820152600d60248201526c24a72b20a624a22fa7aba722a960991b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6005546000906001600160a01b03163314610c21576040805162461bcd60e51b815260206004820152600a60248201526927a7262cafa7aba722a960b11b604482015290519081900360640190fd5b868514610c67576040805162461bcd60e51b815260206004820152600f60248201526e494e56414c49445f4c454e4754485360881b604482015290519081900360640190fd5b60005b87811015610d7057868682818110610c7e57fe5b905060200201356001600160a01b0316600460008b8b85818110610c9e57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550868682818110610cfe57fe5b905060200201356001600160a01b03166001600160a01b0316898983818110610d2357fe5b905060200201356001600160a01b03166001600160a01b03167f0dd664a155dd89526bb019e22b00291bb7ca9d07ba3ec4a1a76b410da9797ceb60405160405180910390a3600101610c6a565b50606063d4f5532f60e01b898989896040516024018080602001806020018381038352878782818152602001925060200280828437600083820152601f01601f19169091018481038352858152602090810191508690860280828437600083820181905260408051601f909301601f199081169095018381039095018352939093526020810180516001600160e01b03166001600160e01b0319909c169b909b17909a52506002548154999a50610e46996001600160a01b03918216995016965033955034945092508a91508c90508b896119fd565b9998505050505050505050565b6000546001600160a01b031681565b60026007541415610eba576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600755610ecd868686868686611a11565b5050600160075550505050565b606060026007541415610f34576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600755610f498989898989898989611b9c565b60016007559998505050505050505050565b6004602052600090815260409020546001600160a01b031681565b6005546001600160a01b031681565b6006546001600160a01b031681565b6000610f9e611ed9565b9050336001600160a01b03821614610fee576040805162461bcd60e51b815260206004820152600e60248201526d2727aa2fa32927a6afa0a226a4a760911b604482015290519081900360640190fd5b50565b60408051602081019091526000815260609063172b3d9b60e11b878787876110198689611efe565b6040516001600160a01b0380871660248301908152868216604484015290851660648301526084820184905260a060a48301908152835160c484015283519192909160e490910190602085019080838360005b8381101561108457818101518382015260200161106c565b50505050905090810190601f1680156110b15780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909a1699909917909852509597505050505050505095945050505050565b6001600160a01b039081166000908152600460205260409020541690565b600360209081526000918252604091829020805460018083018054865160026101009483161585026000190190921691909104601f810187900487028201870190975286815260ff841696929093046001600160a01b0316949091908301828280156111c35780601f10611198576101008083540402835291602001916111c3565b820191906000526020600020905b8154815290600101906020018083116111a657829003601f168201915b5050505050905083565b60006111e988886040518060200160405280600081525061189f565b509050336001600160a01b0382161461123f576040805162461bcd60e51b81526020600482015260136024820152722727aa2fa2ac2822a1aa22a22fa9a2a72222a960691b604482015290519081900360640190fd5b8315611284576040805162461bcd60e51b815260206004820152600f60248201526e1393d7d110551057d0531313d5d151608a1b604482015290519081900360640190fd5b6112c688888888888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611ff092505050565b811561142e576112de866001600160a01b0316612081565b611321576040805162461bcd60e51b815260206004820152600f60248201526e1513d7d393d517d0d3d395149050d5608a1b604482015290519081900360640190fd5b6000866001600160a01b031663592e2070838b87876040518563ffffffff1660e01b815260040180856001600160a01b03166001600160a01b03168152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050602060405180830381600087803b1580156113b757600080fd5b505af11580156113cb573d6000803e3d6000fd5b505050506040513d60208110156113e157600080fd5b505190508061142c576040805162461bcd60e51b81526020600482015260126024820152711514905394d1915497d213d3d2d7d190525360721b604482015290519081900360640190fd5b505b87866001600160a01b0316826001600160a01b03167f56735ccb9dc7d2222ce4177fc3aea44c33882e2a2c73e0fb1c6b93c9c13a04d48888888860008b8b905011604051808060200180602001841515151581526020018381038352888882818152602001925080828437600083820152601f01601f191690910184810383528681526020019050868680828437600083820152604051601f909101601f1916909201829003995090975050505050505050a45050505050505050565b600061a4b160ff16336001600160a01b0316638e5f5ad16040518163ffffffff1660e01b815260040160206040518083038186803b15801561152c57600080fd5b505afa158015611540573d6000803e3d6000fd5b505050506040513d602081101561155657600080fd5b505160ff161461159f576040805162461bcd60e51b815260206004820152600f60248201526e1393d517d0549097d1539050931151608a1b604482015290519081900360640190fd5b336000908152600460205260409020546001600160a01b0316801561162457866001600160a01b0316816001600160a01b031614611624576040805162461bcd60e51b815260206004820152601b60248201527f4e4f5f5550444154455f544f5f444946464552454e545f414444520000000000604482015290519081900360640190fd5b336000908152600460205260409081902080546001600160a01b038a166001600160a01b031990911617905580516001808252818301909252606091816020016020820280368337505060408051600180825281830190925292935060609291506020808301908036833701905050905033826000815181106116a357fe5b60200260200101906001600160a01b031690816001600160a01b03168152505088816000815181106116d157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050806000815181106116fe57fe5b60200260200101516001600160a01b03168260008151811061171c57fe5b60200260200101516001600160a01b03167f0dd664a155dd89526bb019e22b00291bb7ca9d07ba3ec4a1a76b410da9797ceb60405160405180910390a3606063d4f5532f60e01b8383604051602401808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156117ac578181015183820152602001611794565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156117eb5781810151838201526020016117d3565b505060408051601f199690940184810396909601845294909452506020810180516001600160e01b03166001600160e01b0319909a169990991790985250506002546000805497985061185b976001600160a01b03928316975090911694508c935034925090508c8f8f896119fd565b9a9950505050505050505050565b606061187b8888898989898989610eda565b98975050505050505050565b600061189685858585336114eb565b95945050505050565b6000606060006118af8686610ae4565b600081815260036020526040902080549192509060ff16156119795780546001808301805460408051602060026101009685161587026000190190941693909304601f8101849004840282018401909252818152939094046001600160a01b03169391929183918301828280156119675780601f1061193c57610100808354040283529160200191611967565b820191906000526020600020905b81548152906001019060200180831161194a57829003601f168201915b50505050509050935093505050611982565b85859350935050505b935093915050565b6001546001600160a01b031681565b6119a4848484612087565b600580546001600160a01b039092166001600160a01b03199283161790556006805490911690555050600160075550565b6002546001600160a01b031681565b6001600160e01b031981166301ffc9a760e01b14919050565b600061185b8a8a8a8b8b8b8b8b8b8b612144565b6002546001600160a01b03166000611a2882612358565b9050336001600160a01b03821614611a79576040805162461bcd60e51b815260206004820152600f60248201526e4e4f545f46524f4d5f42524944474560881b604482015290519081900360640190fd5b6000611a84836123c5565b6000549091506001600160a01b03808316911614611ae4576040805162461bcd60e51b81526020600482015260186024820152774f4e4c595f434f554e544552504152545f4741544557415960401b604482015290519081900360640190fd5b60006060611af287876124f7565b915091508051600014611b1057506040805160208101909152600081525b611b1b828a8361189f565b509850611b298b8a8a6125a4565b81896001600160a01b03168b6001600160a01b03167f891afe029c75c4f8c5855fc3480598bc5a53739344f6ae575bdb7ea2a79f56b38e8c60405180836001600160a01b03166001600160a01b031681526020018281526020019250505060405180910390a45050505050505050505050565b6060611ba7336125c3565b611bea576040805162461bcd60e51b815260206004820152600f60248201526e2727aa2fa32927a6afa927aaaa22a960891b604482015290519081900360640190fd5b60008060606000611bfa336125c3565b15611c1357611c0987876125d7565b9094509150611c50565b33935086868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294505050505b818060200190516040811015611c6557600080fd5b815160208301805160405192949293830192919084600160201b821115611c8b57600080fd5b908301906020820185811115611ca057600080fd5b8251600160201b811182820188101715611cb957600080fd5b82525081516020918201929091019080838360005b83811015611ce6578181015183820152602001611cce565b50505050905090810190601f168015611d135780820380516001836020036101000a031916815260200191505b5060405250508151919450919250159050611d6b576040805162461bcd60e51b8152602060048201526013602482015272115615149057d110551057d11254d050931151606a1b604482015290519081900360640190fd5b611d7d8d6001600160a01b0316612081565b611dc0576040805162461bcd60e51b815260206004820152600f60248201526e130c57d393d517d0d3d395149050d5608a1b604482015290519081900360640190fd5b6000611dcb8e6110f8565b90506001600160a01b038116611e1a576040805162461bcd60e51b815260206004820152600f60248201526e1393d7d30c97d513d2d15397d4d155608a1b604482015290519081900360640190fd5b611e258e868d612615565b9a50611e348e868e8e87610ff1565b9550611e458d868d8d8d878c612735565b93505050818a6001600160a01b0316846001600160a01b03167fb8910b9960c443aac3240b98585384e3a6f109fbf6969e264c3f183d69aba7e18f8d60405180836001600160a01b03166001600160a01b031681526020018281526020019250505060405180910390a4506040805160208082019390935281518082039093018352810190529a9950505050505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b60608282604051602001808060200180602001838103835285818151815260200191508051906020019080838360005b83811015611f46578181015183820152602001611f2e565b50505050905090810190601f168015611f735780820380516001836020036101000a031916815260200191505b50838103825284518152845160209182019186019080838360005b83811015611fa6578181015183820152602001611f8e565b50505050905090810190601f168015611fd35780820380516001836020036101000a031916815260200191505b5060408051601f1981840301815291905298975050505050505050565b6000611ffc8585610ae4565b6040805160608101825260018082526001600160a01b0387811660208085019182528486018981526000888152600383529690962085518154935160ff1990941690151517610100600160a81b0319166101009390941692909202929092178155935180519596509294612077939285019290910190612c3d565b5050505050505050565b3b151590565b612091838361277a565b6001600160a01b0382166120d9576040805162461bcd60e51b815260206004820152600a6024820152692120a22fa927aaaa22a960b11b604482015290519081900360640190fd5b6001600160a01b038116612120576040805162461bcd60e51b81526020600482015260096024820152680848288be929c849eb60bb1b604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b03929092169190911790555050565b6000808b6001600160a01b031663679b6ded898d8a8a8f8f8c8c8c6040518a63ffffffff1660e01b815260040180896001600160a01b03166001600160a01b03168152602001888152602001878152602001866001600160a01b03166001600160a01b03168152602001856001600160a01b03166001600160a01b0316815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561220b5781810151838201526020016121f3565b50505050905090810190601f1680156122385780820380516001836020036101000a031916815260200191505b5099505050505050505050506020604051808303818588803b15801561225d57600080fd5b505af1158015612271573d6000803e3d6000fd5b50505050506040513d602081101561228857600080fd5b81019080805190602001909291905050509050808b6001600160a01b03168a6001600160a01b03167fc1d1490cf25c3b40d600dfb27c7680340ed1ab901b7e8f3551280968a3b372b0866040518080602001828103825283818151815260200191508051906020019080838360005b8381101561230f5781810151838201526020016122f7565b50505050905090810190601f16801561233c5780820380516001836020036101000a031916815260200191505b509250505060405180910390a49b9a5050505050505050505050565b6000816001600160a01b031663e78cea926040518163ffffffff1660e01b815260040160206040518083038186803b15801561239357600080fd5b505afa1580156123a7573d6000803e3d6000fd5b505050506040513d60208110156123bd57600080fd5b505192915050565b6000806123d183612358565b6001600160a01b031663ab5d89436040518163ffffffff1660e01b815260040160206040518083038186803b15801561240957600080fd5b505afa15801561241d573d6000803e3d6000fd5b505050506040513d602081101561243357600080fd5b505160408051634032458160e11b815290519192506000916001600160a01b038416916380648b02916004808301926020929190829003018186803b15801561247b57600080fd5b505afa15801561248f573d6000803e3d6000fd5b505050506040513d60208110156124a557600080fd5b505190506001600160a01b0381166124f0576040805162461bcd60e51b81526020600482015260096024820152682727afa9a2a72222a960b91b604482015290519081900360640190fd5b9392505050565b600060608383604081101561250b57600080fd5b81359190810190604081016020820135600160201b81111561252c57600080fd5b82018360208201111561253e57600080fd5b803590602001918460018302840111600160201b8311171561255f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250969b929a509198505050505050505050565b6125be6001600160a01b038416838363ffffffff61284616565b505050565b6001546001600160a01b0390811691161490565b60006060838360408110156125eb57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561252c57600080fd5b604080516370a0823160e01b8152306004820152905160009182916001600160a01b038716916370a08231916024808301926020929190829003018186803b15801561266057600080fd5b505afa158015612674573d6000803e3d6000fd5b505050506040513d602081101561268a57600080fd5b505190506126a96001600160a01b03861685308663ffffffff61289816565b604080516370a0823160e01b815230600482015290516000916001600160a01b038816916370a0823191602480820192602092909190829003018186803b1580156126f357600080fd5b505afa158015612707573d6000803e3d6000fd5b505050506040513d602081101561271d57600080fd5b5051905061272b81836128f8565b9695505050505050565b600254600080546040805160608101825286815260208101899052908101879052919261187b926001600160a01b0391821692909116908b908b903490879089612955565b6001600160a01b0382166127cb576040805162461bcd60e51b81526020600482015260136024820152721253959053125117d0d3d55395115494105495606a1b604482015290519081900360640190fd5b6000546001600160a01b031615612818576040805162461bcd60e51b815260206004820152600c60248201526b1053149150511657d253925560a21b604482015290519081900360640190fd5b600080546001600160a01b039384166001600160a01b03199182161790915560018054929093169116179055565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526125be908490612975565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526128f2908590612975565b50505050565b60008282111561294f576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000610e4689898989898989600001518a602001518b604001518b612144565b60606129ca826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a269092919063ffffffff16565b8051909150156125be578080602001905160208110156129e957600080fd5b50516125be5760405162461bcd60e51b815260040180806020018281038252602a815260200180612cff602a913960400191505060405180910390fd5b6060612a358484600085612a3d565b949350505050565b606082471015612a7e5760405162461bcd60e51b8152600401808060200182810382526026815260200180612cd96026913960400191505060405180910390fd5b612a8785612081565b612ad8576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612b175780518252601f199092019160209182019101612af8565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612b79576040519150601f19603f3d011682016040523d82523d6000602084013e612b7e565b606091505b5091509150612b8e828286612b99565b979650505050505050565b60608315612ba85750816124f0565b825115612bb85782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612c02578181015183820152602001612bea565b50505050905090810190601f168015612c2f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612c7e57805160ff1916838001178555612cab565b82800160010185558215612cab579182015b82811115612cab578251825591602001919060010190612c90565b50612cb7929150612cbb565b5090565b612cd591905b80821115612cb75760008155600101612cc1565b9056fe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220ce5cca7bb6c206ec5b0fa47ec2923604c70b11ddd5b5a887df2cf7d9ac89a6b664736f6c634300060b0033
Deployed Bytecode
0x6080604052600436106101355760003560e01c8063a0c76a96116100ab578063d2ce7d651161006f578063d2ce7d651461081b578063f26bdead146108b5578063f68a9082146108ed578063f887ea4014610a44578063f8c8765e14610a59578063fb0e722b14610aa457610135565b8063a0c76a961461051c578063a7e28d48146105f5578063bcf2e6eb14610628578063bd5f3e7d146106ee578063ca346d4a146107d957610135565b80632e567b36116100fd5780632e567b36146102fd5780634fb1a07b146103935780638a2dc014146104aa5780638da5cb5b146104dd57806393e59dc1146104f257806395fcea781461050757610135565b806301ffc9a71461013a578063020a60581461018257806313af4035146101cd5780631d3a689f146102025780632db09c1c146102cc575b600080fd5b34801561014657600080fd5b5061016e6004803603602081101561015d57600080fd5b50356001600160e01b031916610ab9565b604080519115158252519081900360200190f35b34801561018e57600080fd5b506101bb600480360360408110156101a557600080fd5b50803590602001356001600160a01b0316610ae4565b60408051918252519081900360200190f35b3480156101d957600080fd5b50610200600480360360208110156101f057600080fd5b50356001600160a01b0316610b19565b005b6101bb600480360360a081101561021857600080fd5b810190602081018135600160201b81111561023257600080fd5b82018360208201111561024457600080fd5b803590602001918460208302840111600160201b8311171561026557600080fd5b919390929091602081019035600160201b81111561028257600080fd5b82018360208201111561029457600080fd5b803590602001918460208302840111600160201b831117156102b557600080fd5b919350915080359060208101359060400135610bd2565b3480156102d857600080fd5b506102e1610e53565b604080516001600160a01b039092168252519081900360200190f35b610200600480360360a081101561031357600080fd5b6001600160a01b03823581169260208101358216926040820135909216916060820135919081019060a081016080820135600160201b81111561035557600080fd5b82018360208201111561036757600080fd5b803590602001918460018302840111600160201b8311171561038857600080fd5b509092509050610e62565b610435600480360360e08110156103a957600080fd5b6001600160a01b038235811692602081013582169260408201359092169160608201359160808101359160a0820135919081019060e0810160c0820135600160201b8111156103f757600080fd5b82018360208201111561040957600080fd5b803590602001918460018302840111600160201b8311171561042a57600080fd5b509092509050610eda565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561046f578181015183820152602001610457565b50505050905090810190601f16801561049c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104b657600080fd5b506102e1600480360360208110156104cd57600080fd5b50356001600160a01b0316610f5b565b3480156104e957600080fd5b506102e1610f76565b3480156104fe57600080fd5b506102e1610f85565b34801561051357600080fd5b50610200610f94565b34801561052857600080fd5b50610435600480360360a081101561053f57600080fd5b6001600160a01b03823581169260208101358216926040820135909216916060820135919081019060a081016080820135600160201b81111561058157600080fd5b82018360208201111561059357600080fd5b803590602001918460018302840111600160201b831117156105b457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610ff1945050505050565b34801561060157600080fd5b506102e16004803603602081101561061857600080fd5b50356001600160a01b03166110f8565b34801561063457600080fd5b506106526004803603602081101561064b57600080fd5b5035611116565b6040518084151515158152602001836001600160a01b03166001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b838110156106b1578181015183820152602001610699565b50505050905090810190601f1680156106de5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b3480156106fa57600080fd5b50610200600480360360a081101561071157600080fd5b8135916001600160a01b03602082013581169260408301359091169190810190608081016060820135600160201b81111561074b57600080fd5b82018360208201111561075d57600080fd5b803590602001918460018302840111600160201b8311171561077e57600080fd5b919390929091602081019035600160201b81111561079b57600080fd5b8201836020820111156107ad57600080fd5b803590602001918460018302840111600160201b831117156107ce57600080fd5b5090925090506111cd565b6101bb600480360360a08110156107ef57600080fd5b506001600160a01b038135811691602081013591604082013591606081013591608090910135166114eb565b610435600480360360c081101561083157600080fd5b6001600160a01b0382358116926020810135909116916040820135916060810135916080820135919081019060c0810160a0820135600160201b81111561087757600080fd5b82018360208201111561088957600080fd5b803590602001918460018302840111600160201b831117156108aa57600080fd5b509092509050611869565b6101bb600480360360808110156108cb57600080fd5b506001600160a01b038135169060208101359060408101359060600135611887565b3480156108f957600080fd5b506109b36004803603606081101561091057600080fd5b8135916001600160a01b0360208201351691810190606081016040820135600160201b81111561093f57600080fd5b82018360208201111561095157600080fd5b803590602001918460018302840111600160201b8311171561097257600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061189f945050505050565b60405180836001600160a01b03166001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610a085781810151838201526020016109f0565b50505050905090810190601f168015610a355780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b348015610a5057600080fd5b506102e161198a565b348015610a6557600080fd5b5061020060048036036080811015610a7c57600080fd5b506001600160a01b038135811691602081013582169160408201358116916060013516611999565b348015610ab057600080fd5b506102e16119d5565b60006001600160e01b03198216634fb1a07b60e01b1480610ade5750610ade826119e4565b92915050565b604080516020808201949094526001600160a01b03929092168282015280518083038201815260609092019052805191012090565b6005546001600160a01b03163314610b65576040805162461bcd60e51b815260206004820152600a60248201526927a7262cafa7aba722a960b11b604482015290519081900360640190fd5b6001600160a01b038116610bb0576040805162461bcd60e51b815260206004820152600d60248201526c24a72b20a624a22fa7aba722a960991b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6005546000906001600160a01b03163314610c21576040805162461bcd60e51b815260206004820152600a60248201526927a7262cafa7aba722a960b11b604482015290519081900360640190fd5b868514610c67576040805162461bcd60e51b815260206004820152600f60248201526e494e56414c49445f4c454e4754485360881b604482015290519081900360640190fd5b60005b87811015610d7057868682818110610c7e57fe5b905060200201356001600160a01b0316600460008b8b85818110610c9e57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550868682818110610cfe57fe5b905060200201356001600160a01b03166001600160a01b0316898983818110610d2357fe5b905060200201356001600160a01b03166001600160a01b03167f0dd664a155dd89526bb019e22b00291bb7ca9d07ba3ec4a1a76b410da9797ceb60405160405180910390a3600101610c6a565b50606063d4f5532f60e01b898989896040516024018080602001806020018381038352878782818152602001925060200280828437600083820152601f01601f19169091018481038352858152602090810191508690860280828437600083820181905260408051601f909301601f199081169095018381039095018352939093526020810180516001600160e01b03166001600160e01b0319909c169b909b17909a52506002548154999a50610e46996001600160a01b03918216995016965033955034945092508a91508c90508b896119fd565b9998505050505050505050565b6000546001600160a01b031681565b60026007541415610eba576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600755610ecd868686868686611a11565b5050600160075550505050565b606060026007541415610f34576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600755610f498989898989898989611b9c565b60016007559998505050505050505050565b6004602052600090815260409020546001600160a01b031681565b6005546001600160a01b031681565b6006546001600160a01b031681565b6000610f9e611ed9565b9050336001600160a01b03821614610fee576040805162461bcd60e51b815260206004820152600e60248201526d2727aa2fa32927a6afa0a226a4a760911b604482015290519081900360640190fd5b50565b60408051602081019091526000815260609063172b3d9b60e11b878787876110198689611efe565b6040516001600160a01b0380871660248301908152868216604484015290851660648301526084820184905260a060a48301908152835160c484015283519192909160e490910190602085019080838360005b8381101561108457818101518382015260200161106c565b50505050905090810190601f1680156110b15780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909a1699909917909852509597505050505050505095945050505050565b6001600160a01b039081166000908152600460205260409020541690565b600360209081526000918252604091829020805460018083018054865160026101009483161585026000190190921691909104601f810187900487028201870190975286815260ff841696929093046001600160a01b0316949091908301828280156111c35780601f10611198576101008083540402835291602001916111c3565b820191906000526020600020905b8154815290600101906020018083116111a657829003601f168201915b5050505050905083565b60006111e988886040518060200160405280600081525061189f565b509050336001600160a01b0382161461123f576040805162461bcd60e51b81526020600482015260136024820152722727aa2fa2ac2822a1aa22a22fa9a2a72222a960691b604482015290519081900360640190fd5b8315611284576040805162461bcd60e51b815260206004820152600f60248201526e1393d7d110551057d0531313d5d151608a1b604482015290519081900360640190fd5b6112c688888888888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611ff092505050565b811561142e576112de866001600160a01b0316612081565b611321576040805162461bcd60e51b815260206004820152600f60248201526e1513d7d393d517d0d3d395149050d5608a1b604482015290519081900360640190fd5b6000866001600160a01b031663592e2070838b87876040518563ffffffff1660e01b815260040180856001600160a01b03166001600160a01b03168152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050602060405180830381600087803b1580156113b757600080fd5b505af11580156113cb573d6000803e3d6000fd5b505050506040513d60208110156113e157600080fd5b505190508061142c576040805162461bcd60e51b81526020600482015260126024820152711514905394d1915497d213d3d2d7d190525360721b604482015290519081900360640190fd5b505b87866001600160a01b0316826001600160a01b03167f56735ccb9dc7d2222ce4177fc3aea44c33882e2a2c73e0fb1c6b93c9c13a04d48888888860008b8b905011604051808060200180602001841515151581526020018381038352888882818152602001925080828437600083820152601f01601f191690910184810383528681526020019050868680828437600083820152604051601f909101601f1916909201829003995090975050505050505050a45050505050505050565b600061a4b160ff16336001600160a01b0316638e5f5ad16040518163ffffffff1660e01b815260040160206040518083038186803b15801561152c57600080fd5b505afa158015611540573d6000803e3d6000fd5b505050506040513d602081101561155657600080fd5b505160ff161461159f576040805162461bcd60e51b815260206004820152600f60248201526e1393d517d0549097d1539050931151608a1b604482015290519081900360640190fd5b336000908152600460205260409020546001600160a01b0316801561162457866001600160a01b0316816001600160a01b031614611624576040805162461bcd60e51b815260206004820152601b60248201527f4e4f5f5550444154455f544f5f444946464552454e545f414444520000000000604482015290519081900360640190fd5b336000908152600460205260409081902080546001600160a01b038a166001600160a01b031990911617905580516001808252818301909252606091816020016020820280368337505060408051600180825281830190925292935060609291506020808301908036833701905050905033826000815181106116a357fe5b60200260200101906001600160a01b031690816001600160a01b03168152505088816000815181106116d157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050806000815181106116fe57fe5b60200260200101516001600160a01b03168260008151811061171c57fe5b60200260200101516001600160a01b03167f0dd664a155dd89526bb019e22b00291bb7ca9d07ba3ec4a1a76b410da9797ceb60405160405180910390a3606063d4f5532f60e01b8383604051602401808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156117ac578181015183820152602001611794565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156117eb5781810151838201526020016117d3565b505060408051601f199690940184810396909601845294909452506020810180516001600160e01b03166001600160e01b0319909a169990991790985250506002546000805497985061185b976001600160a01b03928316975090911694508c935034925090508c8f8f896119fd565b9a9950505050505050505050565b606061187b8888898989898989610eda565b98975050505050505050565b600061189685858585336114eb565b95945050505050565b6000606060006118af8686610ae4565b600081815260036020526040902080549192509060ff16156119795780546001808301805460408051602060026101009685161587026000190190941693909304601f8101849004840282018401909252818152939094046001600160a01b03169391929183918301828280156119675780601f1061193c57610100808354040283529160200191611967565b820191906000526020600020905b81548152906001019060200180831161194a57829003601f168201915b50505050509050935093505050611982565b85859350935050505b935093915050565b6001546001600160a01b031681565b6119a4848484612087565b600580546001600160a01b039092166001600160a01b03199283161790556006805490911690555050600160075550565b6002546001600160a01b031681565b6001600160e01b031981166301ffc9a760e01b14919050565b600061185b8a8a8a8b8b8b8b8b8b8b612144565b6002546001600160a01b03166000611a2882612358565b9050336001600160a01b03821614611a79576040805162461bcd60e51b815260206004820152600f60248201526e4e4f545f46524f4d5f42524944474560881b604482015290519081900360640190fd5b6000611a84836123c5565b6000549091506001600160a01b03808316911614611ae4576040805162461bcd60e51b81526020600482015260186024820152774f4e4c595f434f554e544552504152545f4741544557415960401b604482015290519081900360640190fd5b60006060611af287876124f7565b915091508051600014611b1057506040805160208101909152600081525b611b1b828a8361189f565b509850611b298b8a8a6125a4565b81896001600160a01b03168b6001600160a01b03167f891afe029c75c4f8c5855fc3480598bc5a53739344f6ae575bdb7ea2a79f56b38e8c60405180836001600160a01b03166001600160a01b031681526020018281526020019250505060405180910390a45050505050505050505050565b6060611ba7336125c3565b611bea576040805162461bcd60e51b815260206004820152600f60248201526e2727aa2fa32927a6afa927aaaa22a960891b604482015290519081900360640190fd5b60008060606000611bfa336125c3565b15611c1357611c0987876125d7565b9094509150611c50565b33935086868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294505050505b818060200190516040811015611c6557600080fd5b815160208301805160405192949293830192919084600160201b821115611c8b57600080fd5b908301906020820185811115611ca057600080fd5b8251600160201b811182820188101715611cb957600080fd5b82525081516020918201929091019080838360005b83811015611ce6578181015183820152602001611cce565b50505050905090810190601f168015611d135780820380516001836020036101000a031916815260200191505b5060405250508151919450919250159050611d6b576040805162461bcd60e51b8152602060048201526013602482015272115615149057d110551057d11254d050931151606a1b604482015290519081900360640190fd5b611d7d8d6001600160a01b0316612081565b611dc0576040805162461bcd60e51b815260206004820152600f60248201526e130c57d393d517d0d3d395149050d5608a1b604482015290519081900360640190fd5b6000611dcb8e6110f8565b90506001600160a01b038116611e1a576040805162461bcd60e51b815260206004820152600f60248201526e1393d7d30c97d513d2d15397d4d155608a1b604482015290519081900360640190fd5b611e258e868d612615565b9a50611e348e868e8e87610ff1565b9550611e458d868d8d8d878c612735565b93505050818a6001600160a01b0316846001600160a01b03167fb8910b9960c443aac3240b98585384e3a6f109fbf6969e264c3f183d69aba7e18f8d60405180836001600160a01b03166001600160a01b031681526020018281526020019250505060405180910390a4506040805160208082019390935281518082039093018352810190529a9950505050505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b60608282604051602001808060200180602001838103835285818151815260200191508051906020019080838360005b83811015611f46578181015183820152602001611f2e565b50505050905090810190601f168015611f735780820380516001836020036101000a031916815260200191505b50838103825284518152845160209182019186019080838360005b83811015611fa6578181015183820152602001611f8e565b50505050905090810190601f168015611fd35780820380516001836020036101000a031916815260200191505b5060408051601f1981840301815291905298975050505050505050565b6000611ffc8585610ae4565b6040805160608101825260018082526001600160a01b0387811660208085019182528486018981526000888152600383529690962085518154935160ff1990941690151517610100600160a81b0319166101009390941692909202929092178155935180519596509294612077939285019290910190612c3d565b5050505050505050565b3b151590565b612091838361277a565b6001600160a01b0382166120d9576040805162461bcd60e51b815260206004820152600a6024820152692120a22fa927aaaa22a960b11b604482015290519081900360640190fd5b6001600160a01b038116612120576040805162461bcd60e51b81526020600482015260096024820152680848288be929c849eb60bb1b604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b03929092169190911790555050565b6000808b6001600160a01b031663679b6ded898d8a8a8f8f8c8c8c6040518a63ffffffff1660e01b815260040180896001600160a01b03166001600160a01b03168152602001888152602001878152602001866001600160a01b03166001600160a01b03168152602001856001600160a01b03166001600160a01b0316815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561220b5781810151838201526020016121f3565b50505050905090810190601f1680156122385780820380516001836020036101000a031916815260200191505b5099505050505050505050506020604051808303818588803b15801561225d57600080fd5b505af1158015612271573d6000803e3d6000fd5b50505050506040513d602081101561228857600080fd5b81019080805190602001909291905050509050808b6001600160a01b03168a6001600160a01b03167fc1d1490cf25c3b40d600dfb27c7680340ed1ab901b7e8f3551280968a3b372b0866040518080602001828103825283818151815260200191508051906020019080838360005b8381101561230f5781810151838201526020016122f7565b50505050905090810190601f16801561233c5780820380516001836020036101000a031916815260200191505b509250505060405180910390a49b9a5050505050505050505050565b6000816001600160a01b031663e78cea926040518163ffffffff1660e01b815260040160206040518083038186803b15801561239357600080fd5b505afa1580156123a7573d6000803e3d6000fd5b505050506040513d60208110156123bd57600080fd5b505192915050565b6000806123d183612358565b6001600160a01b031663ab5d89436040518163ffffffff1660e01b815260040160206040518083038186803b15801561240957600080fd5b505afa15801561241d573d6000803e3d6000fd5b505050506040513d602081101561243357600080fd5b505160408051634032458160e11b815290519192506000916001600160a01b038416916380648b02916004808301926020929190829003018186803b15801561247b57600080fd5b505afa15801561248f573d6000803e3d6000fd5b505050506040513d60208110156124a557600080fd5b505190506001600160a01b0381166124f0576040805162461bcd60e51b81526020600482015260096024820152682727afa9a2a72222a960b91b604482015290519081900360640190fd5b9392505050565b600060608383604081101561250b57600080fd5b81359190810190604081016020820135600160201b81111561252c57600080fd5b82018360208201111561253e57600080fd5b803590602001918460018302840111600160201b8311171561255f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250969b929a509198505050505050505050565b6125be6001600160a01b038416838363ffffffff61284616565b505050565b6001546001600160a01b0390811691161490565b60006060838360408110156125eb57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561252c57600080fd5b604080516370a0823160e01b8152306004820152905160009182916001600160a01b038716916370a08231916024808301926020929190829003018186803b15801561266057600080fd5b505afa158015612674573d6000803e3d6000fd5b505050506040513d602081101561268a57600080fd5b505190506126a96001600160a01b03861685308663ffffffff61289816565b604080516370a0823160e01b815230600482015290516000916001600160a01b038816916370a0823191602480820192602092909190829003018186803b1580156126f357600080fd5b505afa158015612707573d6000803e3d6000fd5b505050506040513d602081101561271d57600080fd5b5051905061272b81836128f8565b9695505050505050565b600254600080546040805160608101825286815260208101899052908101879052919261187b926001600160a01b0391821692909116908b908b903490879089612955565b6001600160a01b0382166127cb576040805162461bcd60e51b81526020600482015260136024820152721253959053125117d0d3d55395115494105495606a1b604482015290519081900360640190fd5b6000546001600160a01b031615612818576040805162461bcd60e51b815260206004820152600c60248201526b1053149150511657d253925560a21b604482015290519081900360640190fd5b600080546001600160a01b039384166001600160a01b03199182161790915560018054929093169116179055565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526125be908490612975565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526128f2908590612975565b50505050565b60008282111561294f576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000610e4689898989898989600001518a602001518b604001518b612144565b60606129ca826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a269092919063ffffffff16565b8051909150156125be578080602001905160208110156129e957600080fd5b50516125be5760405162461bcd60e51b815260040180806020018281038252602a815260200180612cff602a913960400191505060405180910390fd5b6060612a358484600085612a3d565b949350505050565b606082471015612a7e5760405162461bcd60e51b8152600401808060200182810382526026815260200180612cd96026913960400191505060405180910390fd5b612a8785612081565b612ad8576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612b175780518252601f199092019160209182019101612af8565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612b79576040519150601f19603f3d011682016040523d82523d6000602084013e612b7e565b606091505b5091509150612b8e828286612b99565b979650505050505050565b60608315612ba85750816124f0565b825115612bb85782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612c02578181015183820152602001612bea565b50505050905090810190601f168015612c2f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612c7e57805160ff1916838001178555612cab565b82800160010185558215612cab579182015b82811115612cab578251825591602001919060010190612c90565b50612cb7929150612cbb565b5090565b612cd591905b80821115612cb75760008155600101612cc1565b9056fe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220ce5cca7bb6c206ec5b0fa47ec2923604c70b11ddd5b5a887df2cf7d9ac89a6b664736f6c634300060b0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.