Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Approve | 124215141 | 66 days ago | IN | 0 ETH | 0.00000461 |
Loading...
Loading
Contract Name:
StandardArbERC20
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 "../libraries/Cloneable.sol"; import "../libraries/L2GatewayToken.sol"; import "../libraries/BytesParser.sol"; import "./IArbToken.sol"; /** * @title Standard (i.e., non-custom) contract deployed by L2Gateway.sol as L2 ERC20. Includes standard ERC20 interface plus additional methods for deposits/withdraws */ contract StandardArbERC20 is IArbToken, L2GatewayToken, Cloneable { struct ERC20Getters { bool ignoreDecimals; bool ignoreName; bool ignoreSymbol; } ERC20Getters private availableGetters; /** * @notice initialize the token * @dev the L2 bridge assumes this does not fail or revert * @param _l1Address L1 address of ERC20 * @param _data encoded symbol/name/decimal data for initial deploy */ function bridgeInit(address _l1Address, bytes memory _data) public virtual { (bytes memory name_, bytes memory symbol_, bytes memory decimals_) = abi.decode( _data, (bytes, bytes, bytes) ); // what if decode reverts? shouldn't as this is encoded by L1 contract /* * if parsing fails, the type's default value gets assigned * the parsing can fail for different reasons: * 1. method not available in L1 (empty input) * 2. data type is encoded differently in the L1 (trying to abi decode the wrong data type) * currently (1) returns a parser fails and (2) reverts as there is no `abi.tryDecode` * https://github.com/ethereum/solidity/issues/10381 */ (bool parseNameSuccess, string memory parsedName) = BytesParser.toString(name_); (bool parseSymbolSuccess, string memory parsedSymbol) = BytesParser.toString(symbol_); (bool parseDecimalSuccess, uint8 parsedDecimals) = BytesParser.toUint8(decimals_); L2GatewayToken._initialize( parsedName, parsedSymbol, parsedDecimals, msg.sender, // _l2Gateway, _l1Address // _l1Counterpart ); // here we assume that (2) would have reverted, so if the parser failed its because the getter isn't available in the L1. // instead of storing on a struct, we could instead set a magic number, at something like `type(uint8).max` or random string // to be more general we instead use an extra storage slot availableGetters = ERC20Getters({ ignoreName: !parseNameSuccess, ignoreSymbol: !parseSymbolSuccess, ignoreDecimals: !parseDecimalSuccess }); } function decimals() public view override returns (uint8) { // no revert message just as in the L1 if you called and the function is not implemented if (availableGetters.ignoreDecimals) revert(); return super.decimals(); } function name() public view override returns (string memory) { // no revert message just as in the L1 if you called and the function is not implemented if (availableGetters.ignoreName) revert(); return super.name(); } function symbol() public view override returns (string memory) { // no revert message just as in the L1 if you called and the function is not implemented if (availableGetters.ignoreSymbol) revert(); return super.symbol(); } }
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2019-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 "./ICloneable.sol"; contract Cloneable is ICloneable { string private constant NOT_CLONE = "NOT_CLONE"; bool private isMasterCopy; constructor() public { isMasterCopy = true; } function isMaster() external view override returns (bool) { return isMasterCopy; } function safeSelfDestruct(address payable dest) internal { require(!isMasterCopy, NOT_CLONE); selfdestruct(dest); } }
// 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 "./aeERC20.sol"; import "./BytesParser.sol"; import "../arbitrum/IArbToken.sol"; /** * @title Standard (i.e., non-custom) contract used as a base for different L2 Gateways */ abstract contract L2GatewayToken is aeERC20, IArbToken { address public l2Gateway; address public override l1Address; modifier onlyGateway() { require(msg.sender == l2Gateway, "ONLY_GATEWAY"); _; } /** * @notice initialize the token * @dev the L2 bridge assumes this does not fail or revert * @param name_ ERC20 token name * @param symbol_ ERC20 token symbol * @param decimals_ ERC20 decimals * @param l2Gateway_ L2 gateway this token communicates with * @param l1Counterpart_ L1 address of ERC20 */ function _initialize( string memory name_, string memory symbol_, uint8 decimals_, address l2Gateway_, address l1Counterpart_ ) internal virtual { require(l2Gateway_ != address(0), "INVALID_GATEWAY"); require(l2Gateway == address(0), "ALREADY_INIT"); l2Gateway = l2Gateway_; l1Address = l1Counterpart_; aeERC20._initialize(name_, symbol_, decimals_); } /** * @notice Mint tokens on L2. Callable path is L1Gateway depositToken (which handles L1 escrow), which triggers L2Gateway, which calls this * @param account recipient of tokens * @param amount amount of tokens minted */ function bridgeMint(address account, uint256 amount) external virtual override onlyGateway { _mint(account, amount); } /** * @notice Burn tokens on L2. * @dev only the token bridge can call this * @param account owner of tokens * @param amount amount of tokens burnt */ function bridgeBurn(address account, uint256 amount) external virtual override onlyGateway { _burn(account, amount); } }
// 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 "./BytesLib.sol"; library BytesParser { using BytesLib for bytes; function toUint8(bytes memory input) internal pure returns (bool success, uint8 res) { if (input.length != 32) { return (false, 0); } // TODO: try catch to handle error uint256 inputNum = abi.decode(input, (uint256)); if (inputNum > type(uint8).max) { return (false, 0); } res = uint8(inputNum); success = true; } function toString(bytes memory input) internal pure returns (bool success, string memory res) { if (input.length == 0) { success = false; // return default value of string } else if (input.length == 32) { // TODO: can validate anything other than length and being null terminated? if (input[31] != bytes1(0x00)) return (false, res); else success = true; // here we assume its a null terminated Bytes32 string // https://github.com/ethereum/solidity/blob/5852972ec148bc041909400affc778dee66d384d/test/libsolidity/semanticTests/externalContracts/_stringutils/stringutils.sol#L89 // https://github.com/Arachnid/solidity-stringutils uint256 len = 32; while (len > 0 && input[len - 1] == bytes1(0x00)) { len--; } bytes memory inputTruncated = new bytes(len); for (uint8 i = 0; i < len; i++) { inputTruncated[i] = input[i]; } // we can't just do `res := input` because of the null values in the end // TODO: can we instead use a bitwise AND? build it dynamically with the length assembly { res := inputTruncated } } else { // TODO: try catch to handle error success = true; res = abi.decode(input, (string)); } } }
// 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 2019, 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 ICloneable { function isMaster() 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-upgradeable/drafts/ERC20PermitUpgradeable.sol"; import "./TransferAndCallToken.sol"; /// @title Arbitrum extended ERC20 /// @notice The recommended ERC20 implementation for Layer 2 tokens /// @dev This implements the ERC20 standard with transferAndCall extenstion/affordances contract aeERC20 is ERC20PermitUpgradeable, TransferAndCallToken { using AddressUpgradeable for address; constructor() public initializer { // this is expected to be used as the logic contract behind a proxy // override the constructor if you don't wish to use the initialize method } function _initialize( string memory name_, string memory symbol_, uint8 decimals_ ) internal initializer { __ERC20Permit_init(name_); __ERC20_init(name_, symbol_); _setupDecimals(decimals_); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.5 <0.8.0; import "../token/ERC20/ERC20Upgradeable.sol"; import "./IERC20PermitUpgradeable.sol"; import "../cryptography/ECDSAUpgradeable.sol"; import "../utils/CountersUpgradeable.sol"; import "./EIP712Upgradeable.sol"; import "../proxy/Initializable.sol"; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable { using CountersUpgradeable for CountersUpgradeable.Counter; mapping (address => CountersUpgradeable.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ function __ERC20Permit_init(string memory name) internal initializer { __Context_init_unchained(); __EIP712_init_unchained(name, "1"); __ERC20Permit_init_unchained(name); } function __ERC20Permit_init_unchained(string memory name) internal initializer { _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); } /** * @dev See {IERC20Permit-permit}. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual override { // solhint-disable-next-line not-rely-on-time require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256( abi.encode( _PERMIT_TYPEHASH, owner, spender, value, _nonces[owner].current(), deadline ) ); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSAUpgradeable.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _nonces[owner].increment(); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >0.6.0 <0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "./ITransferAndCall.sol"; // Implementation from https://github.com/smartcontractkit/LinkToken/blob/master/contracts/v0.6/TransferAndCallToken.sol /** * @notice based on Implementation from https://github.com/smartcontractkit/LinkToken/blob/master/contracts/v0.6/ERC677Token.sol * The implementation doesn't return a bool on onTokenTransfer. This is similar to the proposed 677 standard, but still incompatible - thus we don't refer to it as such. */ abstract contract TransferAndCallToken is ERC20Upgradeable, ITransferAndCall { /** * @dev transfer token to a contract address with additional data if the recipient is a contact. * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data The extra data to be passed to the receiving contract. */ function transferAndCall( address _to, uint256 _value, bytes memory _data ) public virtual override returns (bool success) { super.transfer(_to, _value); emit Transfer(msg.sender, _to, _value, _data); if (isContract(_to)) { contractFallback(_to, _value, _data); } return true; } // PRIVATE function contractFallback( address _to, uint256 _value, bytes memory _data ) private { ITransferAndCallReceiver receiver = ITransferAndCallReceiver(_to); receiver.onTokenTransfer(msg.sender, _value, _data); } function isContract(address _addr) private view returns (bool hasCode) { uint256 length; assembly { length := extcodesize(_addr) } return length > 0; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/ContextUpgradeable.sol"; import "./IERC20Upgradeable.sol"; import "../../math/SafeMathUpgradeable.sol"; import "../../proxy/Initializable.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 ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable { using SafeMathUpgradeable 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. */ function __ERC20_init(string memory name_, string memory symbol_) internal initializer { __Context_init_unchained(); __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer { _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 { } uint256[44] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20PermitUpgradeable { /** * @dev Sets `value` as the allowance of `spender` over `owner`'s tokens, * given `owner`'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for `permit`, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSAUpgradeable { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Check the signature length if (signature.length != 65) { revert("ECDSA: invalid signature length"); } // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return recover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover-bytes32-bytes-} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value"); require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value"); // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); require(signer != address(0), "ECDSA: invalid signature"); return signer; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * replicates the behavior of the * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`] * JSON-RPC method. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../math/SafeMathUpgradeable.sol"; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library CountersUpgradeable { using SafeMathUpgradeable for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { // The {SafeMath} overflow check can be skipped here, see the comment at the top counter._value += 1; } function decrement(Counter storage counter) internal { counter._value = counter._value.sub(1); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../proxy/Initializable.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712Upgradeable is Initializable { /* solhint-disable var-name-mixedcase */ bytes32 private _HASHED_NAME; bytes32 private _HASHED_VERSION; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ function __EIP712_init(string memory name, string memory version) internal initializer { __EIP712_init_unchained(name, version); } function __EIP712_init_unchained(string memory name, string memory version) internal initializer { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash()); } function _buildDomainSeparator(bytes32 typeHash, bytes32 name, bytes32 version) private view returns (bytes32) { return keccak256( abi.encode( typeHash, name, version, _getChainId(), address(this) ) ); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", _domainSeparatorV4(), structHash)); } function _getChainId() private view returns (uint256 chainId) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 // solhint-disable-next-line no-inline-assembly assembly { chainId := chainid() } } /** * @dev The hash of the name parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712NameHash() internal virtual view returns (bytes32) { return _HASHED_NAME; } /** * @dev The hash of the version parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712VersionHash() internal virtual view returns (bytes32) { return _HASHED_VERSION; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <0.8.0; import "../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../proxy/Initializable.sol"; /* * @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 ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } 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; } uint256[50] private __gap; }
// 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; /** * @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 SafeMathUpgradeable { /** * @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: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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); } 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: 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: 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 */
{ "optimizer": { "enabled": true, "runs": 100 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"bridgeBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_l1Address","type":"address"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"bridgeInit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"bridgeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isMaster","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l1Address","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l2Gateway","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"transferAndCall","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50600054610100900460ff1680620000375750620000376001600160e01b03620000dc16565b8062000046575060005460ff16155b620000835760405162461bcd60e51b815260040180806020018281038252602e815260200180620024ea602e913960400191505060405180910390fd5b600054610100900460ff16158015620000af576000805460ff1961ff0019909116610100171660011790555b8015620000c2576000805461ff00191690555b5060cd805460ff60a01b1916600160a01b17905562000100565b6000620000f430620000fa60201b62000e2d1760201c565b15905090565b3b151590565b6123da80620001106000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c806370a08231116100b857806395d89b411161007c57806395d89b41146104da578063a457c2d7146104e2578063a9059cbb1461050e578063c2eeeebd1461053a578063d505accf14610542578063dd62ed3e1461059357610137565b806370a082311461041257806374f4f547146104385780637ecebe00146104645780638c2a993e1461048a5780638fa74a0e146104b657610137565b8063313ce567116100ff578063313ce567146102ff5780633644e5151461031d57806339509351146103255780634000aea0146103515780636f791d291461040a57610137565b806306fdde031461013c578063095ea7b3146101b957806318160ddd146101f9578063189db7d21461021357806323b872dd146102c9575b600080fd5b6101446105c1565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017e578181015183820152602001610166565b50505050905090810190601f1680156101ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101e5600480360360408110156101cf57600080fd5b506001600160a01b0381351690602001356105e7565b604080519115158252519081900360200190f35b610201610604565b60408051918252519081900360200190f35b6102c76004803603604081101561022957600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561025357600080fd5b82018360208201111561026557600080fd5b803590602001918460018302840111600160201b8311171561028657600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061060a945050505050565b005b6101e5600480360360608110156102df57600080fd5b506001600160a01b038135811691602081013590911690604001356108c2565b61030761094f565b6040805160ff9092168252519081900360200190f35b61020161096a565b6101e56004803603604081101561033b57600080fd5b506001600160a01b038135169060200135610974565b6101e56004803603606081101561036757600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561039657600080fd5b8201836020820111156103a857600080fd5b803590602001918460018302840111600160201b831117156103c957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506109c8945050505050565b6101e5610aa3565b6102016004803603602081101561042857600080fd5b50356001600160a01b0316610ab3565b6102c76004803603604081101561044e57600080fd5b506001600160a01b038135169060200135610ace565b6102016004803603602081101561047a57600080fd5b50356001600160a01b0316610b2a565b6102c7600480360360408110156104a057600080fd5b506001600160a01b038135169060200135610b51565b6104be610ba9565b604080516001600160a01b039092168252519081900360200190f35b610144610bb8565b6101e5600480360360408110156104f857600080fd5b506001600160a01b038135169060200135610bd9565b6101e56004803603604081101561052457600080fd5b506001600160a01b038135169060200135610c47565b6104be610c5b565b6102c7600480360360e081101561055857600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135610c6a565b610201600480360360408110156105a957600080fd5b506001600160a01b0381358116916020013516610e02565b60ce54606090610100900460ff16156105d957600080fd5b6105e1610e33565b90505b90565b60006105fb6105f4610ec9565b8484610ecd565b50600192915050565b60355490565b606080606083806020019051606081101561062457600080fd5b8101908080516040519392919084600160201b82111561064357600080fd5b90830190602082018581111561065857600080fd5b8251600160201b81118282018810171561067157600080fd5b82525081516020918201929091019080838360005b8381101561069e578181015183820152602001610686565b50505050905090810190601f1680156106cb5780820380516001836020036101000a031916815260200191505b5060405260200180516040519392919084600160201b8211156106ed57600080fd5b90830190602082018581111561070257600080fd5b8251600160201b81118282018810171561071b57600080fd5b82525081516020918201929091019080838360005b83811015610748578181015183820152602001610730565b50505050905090810190601f1680156107755780820380516001836020036101000a031916815260200191505b5060405260200180516040519392919084600160201b82111561079757600080fd5b9083019060208201858111156107ac57600080fd5b8251600160201b8111828201881017156107c557600080fd5b82525081516020918201929091019080838360005b838110156107f25781810151838201526020016107da565b50505050905090810190601f16801561081f5780820380516001836020036101000a031916815260200191505b506040525050509250925092506000606061083985610fb9565b915091506000606061084a86610fb9565b9150915060008061085a876111c5565b9150915061086b858483338f611218565b506040805160608101825291158083529515602083018190529315910181905260ce805460ff191690951761ff0019166101009093029290921762ff00001916620100009092029190911790925550505050505050565b60006108cf8484846112f4565b610945846108db610ec9565b610940856040518060600160405280602881526020016122ce602891396001600160a01b038a16600090815260346020526040812090610919610ec9565b6001600160a01b03168152602081019190915260400160002054919063ffffffff61144b16565b610ecd565b5060019392505050565b60ce5460009060ff161561096257600080fd5b6105e16114e2565b60006105e16114eb565b60006105fb610981610ec9565b846109408560346000610992610ec9565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff61151e16565b60006109d48484610c47565b50836001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610a4f578181015183820152602001610a37565b50505050905090810190601f168015610a7c5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3610a9384610e2d565b156109455761094584848461157f565b60cd54600160a01b900460ff1690565b6001600160a01b031660009081526033602052604090205490565b60cc546001600160a01b03163314610b1c576040805162461bcd60e51b815260206004820152600c60248201526b4f4e4c595f4741544557415960a01b604482015290519081900360640190fd5b610b268282611659565b5050565b6001600160a01b0381166000908152609960205260408120610b4b9061174f565b92915050565b60cc546001600160a01b03163314610b9f576040805162461bcd60e51b815260206004820152600c60248201526b4f4e4c595f4741544557415960a01b604482015290519081900360640190fd5b610b268282611753565b60cc546001600160a01b031681565b60ce5460609062010000900460ff1615610bd157600080fd5b6105e161183f565b60006105fb610be6610ec9565b84610940856040518060600160405280602581526020016123806025913960346000610c10610ec9565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff61144b16565b60006105fb610c54610ec9565b84846112f4565b60cd546001600160a01b031681565b83421115610cbf576040805162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015290519081900360640190fd5b6000609a54888888610cf4609960008e6001600160a01b03166001600160a01b0316815260200190815260200160002061174f565b604080516020808201979097526001600160a01b0395861681830152939094166060840152608083019190915260a082015260c08082018990528251808303909101815260e0909101909152805191012090506000610d52826118a0565b90506000610d62828787876118ec565b9050896001600160a01b0316816001600160a01b031614610dca576040805162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015290519081900360640190fd5b6001600160a01b038a166000908152609960205260409020610deb90611a57565b610df68a8a8a610ecd565b50505050505050505050565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b3b151590565b60368054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ebf5780601f10610e9457610100808354040283529160200191610ebf565b820191906000526020600020905b815481529060010190602001808311610ea257829003601f168201915b5050505050905090565b3390565b6001600160a01b038316610f125760405162461bcd60e51b815260040180806020018281038252602481526020018061235c6024913960400191505060405180910390fd5b6001600160a01b038216610f575760405162461bcd60e51b81526004018080602001828103825260228152602001806121706022913960400191505060405180910390fd5b6001600160a01b03808416600081815260346020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60006060825160001415610fd057600091506111c0565b8251602014156110f65782516000908490601f908110610fec57fe5b01602001516001600160f81b0319161461100957600091506111c0565b6001915060205b600081118015611041575083516000908590600019840190811061103057fe5b01602001516001600160f81b031916145b1561104f5760001901611010565b60608167ffffffffffffffff8111801561106857600080fd5b506040519080825280601f01601f191660200182016040528015611093576020820181803683370190505b50905060005b828160ff1610156110ec57858160ff16815181106110b357fe5b602001015160f81c60f81b828260ff16815181106110cd57fe5b60200101906001600160f81b031916908160001a905350600101611099565b5091506111c09050565b6001915082806020019051602081101561110f57600080fd5b8101908080516040519392919084600160201b82111561112e57600080fd5b90830190602082018581111561114357600080fd5b8251600160201b81118282018810171561115c57600080fd5b82525081516020918201929091019080838360005b83811015611189578181015183820152602001611171565b50505050905090810190601f1680156111b65780820380516001836020036101000a031916815260200191505b5060405250505090505b915091565b60008082516020146111dc575060009050806111c0565b60008380602001905160208110156111f357600080fd5b5051905060ff81111561120d5750600091508190506111c0565b600192509050915091565b6001600160a01b038216611265576040805162461bcd60e51b815260206004820152600f60248201526e494e56414c49445f4741544557415960881b604482015290519081900360640190fd5b60cc546001600160a01b0316156112b2576040805162461bcd60e51b815260206004820152600c60248201526b1053149150511657d253925560a21b604482015290519081900360640190fd5b60cc80546001600160a01b038085166001600160a01b03199283161790925560cd8054928416929091169190911790556112ed858585611a60565b5050505050565b6001600160a01b0383166113395760405162461bcd60e51b81526004018080602001828103825260258152602001806123376025913960400191505060405180910390fd5b6001600160a01b03821661137e5760405162461bcd60e51b815260040180806020018281038252602381526020018061212b6023913960400191505060405180910390fd5b611389838383611b21565b6113cc81604051806060016040528060268152602001612192602691396001600160a01b038616600090815260336020526040902054919063ffffffff61144b16565b6001600160a01b038085166000908152603360205260408082209390935590841681522054611401908263ffffffff61151e16565b6001600160a01b0380841660008181526033602090815260409182902094909455805185815290519193928716926000805160206122f683398151915292918290030190a3505050565b600081848411156114da5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561149f578181015183820152602001611487565b50505050905090810190601f1680156114cc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60385460ff1690565b60006105e1604051808061227c6052913960520190506040518091039020611511611b26565b611519611b2c565b611b32565b600082820183811015611578576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b604051635260769b60e11b815233600482018181526024830185905260606044840190815284516064850152845187946001600160a01b0386169463a4c0ed369490938993899360840190602085019080838360005b838110156115ed5781810151838201526020016115d5565b50505050905090810190601f16801561161a5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561163b57600080fd5b505af115801561164f573d6000803e3d6000fd5b5050505050505050565b6001600160a01b03821661169e5760405162461bcd60e51b81526004018080602001828103825260218152602001806123166021913960400191505060405180910390fd5b6116aa82600083611b21565b6116ed8160405180606001604052806022815260200161214e602291396001600160a01b038516600090815260336020526040902054919063ffffffff61144b16565b6001600160a01b038316600090815260336020526040902055603554611719908263ffffffff611b8816565b6035556040805182815290516000916001600160a01b038516916000805160206122f68339815191529181900360200190a35050565b5490565b6001600160a01b0382166117ae576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6117ba60008383611b21565b6035546117cd908263ffffffff61151e16565b6035556001600160a01b0382166000908152603360205260409020546117f9908263ffffffff61151e16565b6001600160a01b03831660008181526033602090815260408083209490945583518581529351929391926000805160206122f68339815191529281900390910190a35050565b60378054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ebf5780601f10610e9457610100808354040283529160200191610ebf565b60006118aa6114eb565b82604051602001808061190160f01b81525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050919050565b60006fa2a8918ca85bafe22016d0b997e4df60600160ff1b038211156119435760405162461bcd60e51b81526004018080602001828103825260228152602001806121b86022913960400191505060405180910390fd5b8360ff16601b148061195857508360ff16601c145b6119935760405162461bcd60e51b815260040180806020018281038252602281526020018061225a6022913960400191505060405180910390fd5b604080516000808252602080830180855289905260ff88168385015260608301879052608083018690529251909260019260a080820193601f1981019281900390910190855afa1580156119eb573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611a4e576040805162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b604482015290519081900360640190fd5b95945050505050565b80546001019055565b600054610100900460ff1680611a795750611a79611be5565b80611a87575060005460ff16155b611ac25760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015611aed576000805460ff1961ff0019909116610100171660011790555b611af684611bf6565b611b008484611ccc565b611b0982611d81565b8015611b1b576000805461ff00191690555b50505050565b505050565b60655490565b60665490565b6000838383611b3f611d97565b6040805160208082019690965280820194909452606084019290925260808301523060a0808401919091528151808403909101815260c090920190528051910120949350505050565b600082821115611bdf576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000611bf030610e2d565b15905090565b600054610100900460ff1680611c0f5750611c0f611be5565b80611c1d575060005460ff16155b611c585760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015611c83576000805460ff1961ff0019909116610100171660011790555b611c8b611d9b565b611cae82604051806040016040528060018152602001603160f81b815250611e3d565b611cb782611efd565b8015610b26576000805461ff00191690555050565b600054610100900460ff1680611ce55750611ce5611be5565b80611cf3575060005460ff16155b611d2e5760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015611d59576000805460ff1961ff0019909116610100171660011790555b611d61611d9b565b611d6b8383611fba565b8015611b21576000805461ff0019169055505050565b6038805460ff191660ff92909216919091179055565b4690565b600054610100900460ff1680611db45750611db4611be5565b80611dc2575060005460ff16155b611dfd5760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015611e28576000805460ff1961ff0019909116610100171660011790555b8015611e3a576000805461ff00191690555b50565b600054610100900460ff1680611e565750611e56611be5565b80611e64575060005460ff16155b611e9f5760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015611eca576000805460ff1961ff0019909116610100171660011790555b82516020808501919091208351918401919091206065919091556066558015611b21576000805461ff0019169055505050565b600054610100900460ff1680611f165750611f16611be5565b80611f24575060005460ff16155b611f5f5760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015611f8a576000805460ff1961ff0019909116610100171660011790555b6040518060526121da8239604051908190036052019020609a55508015610b26576000805461ff00191690555050565b600054610100900460ff1680611fd35750611fd3611be5565b80611fe1575060005460ff16155b61201c5760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015612047576000805460ff1961ff0019909116610100171660011790555b825161205a906036906020860190612092565b50815161206e906037906020850190612092565b506038805460ff191660121790558015611b21576000805461ff0019169055505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106120d357805160ff1916838001178555612100565b82800160010185558215612100579182015b828111156121005782518255916020019190600101906120e5565b5061210c929150612110565b5090565b6105e491905b8082111561210c576000815560010161211656fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545434453413a20696e76616c6964207369676e6174757265202773272076616c75655065726d69742861646472657373206f776e65722c61646472657373207370656e6465722c75696e743235362076616c75652c75696e74323536206e6f6e63652c75696e7432353620646561646c696e6529496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a656445434453413a20696e76616c6964207369676e6174757265202776272076616c7565454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e74726163742945524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220ea2924740b351201ebdaa8333830d981501de38ede15792d380977599edbaa2764736f6c634300060b0033496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806370a08231116100b857806395d89b411161007c57806395d89b41146104da578063a457c2d7146104e2578063a9059cbb1461050e578063c2eeeebd1461053a578063d505accf14610542578063dd62ed3e1461059357610137565b806370a082311461041257806374f4f547146104385780637ecebe00146104645780638c2a993e1461048a5780638fa74a0e146104b657610137565b8063313ce567116100ff578063313ce567146102ff5780633644e5151461031d57806339509351146103255780634000aea0146103515780636f791d291461040a57610137565b806306fdde031461013c578063095ea7b3146101b957806318160ddd146101f9578063189db7d21461021357806323b872dd146102c9575b600080fd5b6101446105c1565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017e578181015183820152602001610166565b50505050905090810190601f1680156101ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101e5600480360360408110156101cf57600080fd5b506001600160a01b0381351690602001356105e7565b604080519115158252519081900360200190f35b610201610604565b60408051918252519081900360200190f35b6102c76004803603604081101561022957600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561025357600080fd5b82018360208201111561026557600080fd5b803590602001918460018302840111600160201b8311171561028657600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061060a945050505050565b005b6101e5600480360360608110156102df57600080fd5b506001600160a01b038135811691602081013590911690604001356108c2565b61030761094f565b6040805160ff9092168252519081900360200190f35b61020161096a565b6101e56004803603604081101561033b57600080fd5b506001600160a01b038135169060200135610974565b6101e56004803603606081101561036757600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561039657600080fd5b8201836020820111156103a857600080fd5b803590602001918460018302840111600160201b831117156103c957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506109c8945050505050565b6101e5610aa3565b6102016004803603602081101561042857600080fd5b50356001600160a01b0316610ab3565b6102c76004803603604081101561044e57600080fd5b506001600160a01b038135169060200135610ace565b6102016004803603602081101561047a57600080fd5b50356001600160a01b0316610b2a565b6102c7600480360360408110156104a057600080fd5b506001600160a01b038135169060200135610b51565b6104be610ba9565b604080516001600160a01b039092168252519081900360200190f35b610144610bb8565b6101e5600480360360408110156104f857600080fd5b506001600160a01b038135169060200135610bd9565b6101e56004803603604081101561052457600080fd5b506001600160a01b038135169060200135610c47565b6104be610c5b565b6102c7600480360360e081101561055857600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135610c6a565b610201600480360360408110156105a957600080fd5b506001600160a01b0381358116916020013516610e02565b60ce54606090610100900460ff16156105d957600080fd5b6105e1610e33565b90505b90565b60006105fb6105f4610ec9565b8484610ecd565b50600192915050565b60355490565b606080606083806020019051606081101561062457600080fd5b8101908080516040519392919084600160201b82111561064357600080fd5b90830190602082018581111561065857600080fd5b8251600160201b81118282018810171561067157600080fd5b82525081516020918201929091019080838360005b8381101561069e578181015183820152602001610686565b50505050905090810190601f1680156106cb5780820380516001836020036101000a031916815260200191505b5060405260200180516040519392919084600160201b8211156106ed57600080fd5b90830190602082018581111561070257600080fd5b8251600160201b81118282018810171561071b57600080fd5b82525081516020918201929091019080838360005b83811015610748578181015183820152602001610730565b50505050905090810190601f1680156107755780820380516001836020036101000a031916815260200191505b5060405260200180516040519392919084600160201b82111561079757600080fd5b9083019060208201858111156107ac57600080fd5b8251600160201b8111828201881017156107c557600080fd5b82525081516020918201929091019080838360005b838110156107f25781810151838201526020016107da565b50505050905090810190601f16801561081f5780820380516001836020036101000a031916815260200191505b506040525050509250925092506000606061083985610fb9565b915091506000606061084a86610fb9565b9150915060008061085a876111c5565b9150915061086b858483338f611218565b506040805160608101825291158083529515602083018190529315910181905260ce805460ff191690951761ff0019166101009093029290921762ff00001916620100009092029190911790925550505050505050565b60006108cf8484846112f4565b610945846108db610ec9565b610940856040518060600160405280602881526020016122ce602891396001600160a01b038a16600090815260346020526040812090610919610ec9565b6001600160a01b03168152602081019190915260400160002054919063ffffffff61144b16565b610ecd565b5060019392505050565b60ce5460009060ff161561096257600080fd5b6105e16114e2565b60006105e16114eb565b60006105fb610981610ec9565b846109408560346000610992610ec9565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff61151e16565b60006109d48484610c47565b50836001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610a4f578181015183820152602001610a37565b50505050905090810190601f168015610a7c5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3610a9384610e2d565b156109455761094584848461157f565b60cd54600160a01b900460ff1690565b6001600160a01b031660009081526033602052604090205490565b60cc546001600160a01b03163314610b1c576040805162461bcd60e51b815260206004820152600c60248201526b4f4e4c595f4741544557415960a01b604482015290519081900360640190fd5b610b268282611659565b5050565b6001600160a01b0381166000908152609960205260408120610b4b9061174f565b92915050565b60cc546001600160a01b03163314610b9f576040805162461bcd60e51b815260206004820152600c60248201526b4f4e4c595f4741544557415960a01b604482015290519081900360640190fd5b610b268282611753565b60cc546001600160a01b031681565b60ce5460609062010000900460ff1615610bd157600080fd5b6105e161183f565b60006105fb610be6610ec9565b84610940856040518060600160405280602581526020016123806025913960346000610c10610ec9565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff61144b16565b60006105fb610c54610ec9565b84846112f4565b60cd546001600160a01b031681565b83421115610cbf576040805162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015290519081900360640190fd5b6000609a54888888610cf4609960008e6001600160a01b03166001600160a01b0316815260200190815260200160002061174f565b604080516020808201979097526001600160a01b0395861681830152939094166060840152608083019190915260a082015260c08082018990528251808303909101815260e0909101909152805191012090506000610d52826118a0565b90506000610d62828787876118ec565b9050896001600160a01b0316816001600160a01b031614610dca576040805162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015290519081900360640190fd5b6001600160a01b038a166000908152609960205260409020610deb90611a57565b610df68a8a8a610ecd565b50505050505050505050565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b3b151590565b60368054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ebf5780601f10610e9457610100808354040283529160200191610ebf565b820191906000526020600020905b815481529060010190602001808311610ea257829003601f168201915b5050505050905090565b3390565b6001600160a01b038316610f125760405162461bcd60e51b815260040180806020018281038252602481526020018061235c6024913960400191505060405180910390fd5b6001600160a01b038216610f575760405162461bcd60e51b81526004018080602001828103825260228152602001806121706022913960400191505060405180910390fd5b6001600160a01b03808416600081815260346020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60006060825160001415610fd057600091506111c0565b8251602014156110f65782516000908490601f908110610fec57fe5b01602001516001600160f81b0319161461100957600091506111c0565b6001915060205b600081118015611041575083516000908590600019840190811061103057fe5b01602001516001600160f81b031916145b1561104f5760001901611010565b60608167ffffffffffffffff8111801561106857600080fd5b506040519080825280601f01601f191660200182016040528015611093576020820181803683370190505b50905060005b828160ff1610156110ec57858160ff16815181106110b357fe5b602001015160f81c60f81b828260ff16815181106110cd57fe5b60200101906001600160f81b031916908160001a905350600101611099565b5091506111c09050565b6001915082806020019051602081101561110f57600080fd5b8101908080516040519392919084600160201b82111561112e57600080fd5b90830190602082018581111561114357600080fd5b8251600160201b81118282018810171561115c57600080fd5b82525081516020918201929091019080838360005b83811015611189578181015183820152602001611171565b50505050905090810190601f1680156111b65780820380516001836020036101000a031916815260200191505b5060405250505090505b915091565b60008082516020146111dc575060009050806111c0565b60008380602001905160208110156111f357600080fd5b5051905060ff81111561120d5750600091508190506111c0565b600192509050915091565b6001600160a01b038216611265576040805162461bcd60e51b815260206004820152600f60248201526e494e56414c49445f4741544557415960881b604482015290519081900360640190fd5b60cc546001600160a01b0316156112b2576040805162461bcd60e51b815260206004820152600c60248201526b1053149150511657d253925560a21b604482015290519081900360640190fd5b60cc80546001600160a01b038085166001600160a01b03199283161790925560cd8054928416929091169190911790556112ed858585611a60565b5050505050565b6001600160a01b0383166113395760405162461bcd60e51b81526004018080602001828103825260258152602001806123376025913960400191505060405180910390fd5b6001600160a01b03821661137e5760405162461bcd60e51b815260040180806020018281038252602381526020018061212b6023913960400191505060405180910390fd5b611389838383611b21565b6113cc81604051806060016040528060268152602001612192602691396001600160a01b038616600090815260336020526040902054919063ffffffff61144b16565b6001600160a01b038085166000908152603360205260408082209390935590841681522054611401908263ffffffff61151e16565b6001600160a01b0380841660008181526033602090815260409182902094909455805185815290519193928716926000805160206122f683398151915292918290030190a3505050565b600081848411156114da5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561149f578181015183820152602001611487565b50505050905090810190601f1680156114cc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60385460ff1690565b60006105e1604051808061227c6052913960520190506040518091039020611511611b26565b611519611b2c565b611b32565b600082820183811015611578576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b604051635260769b60e11b815233600482018181526024830185905260606044840190815284516064850152845187946001600160a01b0386169463a4c0ed369490938993899360840190602085019080838360005b838110156115ed5781810151838201526020016115d5565b50505050905090810190601f16801561161a5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561163b57600080fd5b505af115801561164f573d6000803e3d6000fd5b5050505050505050565b6001600160a01b03821661169e5760405162461bcd60e51b81526004018080602001828103825260218152602001806123166021913960400191505060405180910390fd5b6116aa82600083611b21565b6116ed8160405180606001604052806022815260200161214e602291396001600160a01b038516600090815260336020526040902054919063ffffffff61144b16565b6001600160a01b038316600090815260336020526040902055603554611719908263ffffffff611b8816565b6035556040805182815290516000916001600160a01b038516916000805160206122f68339815191529181900360200190a35050565b5490565b6001600160a01b0382166117ae576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6117ba60008383611b21565b6035546117cd908263ffffffff61151e16565b6035556001600160a01b0382166000908152603360205260409020546117f9908263ffffffff61151e16565b6001600160a01b03831660008181526033602090815260408083209490945583518581529351929391926000805160206122f68339815191529281900390910190a35050565b60378054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610ebf5780601f10610e9457610100808354040283529160200191610ebf565b60006118aa6114eb565b82604051602001808061190160f01b81525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050919050565b60006fa2a8918ca85bafe22016d0b997e4df60600160ff1b038211156119435760405162461bcd60e51b81526004018080602001828103825260228152602001806121b86022913960400191505060405180910390fd5b8360ff16601b148061195857508360ff16601c145b6119935760405162461bcd60e51b815260040180806020018281038252602281526020018061225a6022913960400191505060405180910390fd5b604080516000808252602080830180855289905260ff88168385015260608301879052608083018690529251909260019260a080820193601f1981019281900390910190855afa1580156119eb573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611a4e576040805162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b604482015290519081900360640190fd5b95945050505050565b80546001019055565b600054610100900460ff1680611a795750611a79611be5565b80611a87575060005460ff16155b611ac25760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015611aed576000805460ff1961ff0019909116610100171660011790555b611af684611bf6565b611b008484611ccc565b611b0982611d81565b8015611b1b576000805461ff00191690555b50505050565b505050565b60655490565b60665490565b6000838383611b3f611d97565b6040805160208082019690965280820194909452606084019290925260808301523060a0808401919091528151808403909101815260c090920190528051910120949350505050565b600082821115611bdf576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000611bf030610e2d565b15905090565b600054610100900460ff1680611c0f5750611c0f611be5565b80611c1d575060005460ff16155b611c585760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015611c83576000805460ff1961ff0019909116610100171660011790555b611c8b611d9b565b611cae82604051806040016040528060018152602001603160f81b815250611e3d565b611cb782611efd565b8015610b26576000805461ff00191690555050565b600054610100900460ff1680611ce55750611ce5611be5565b80611cf3575060005460ff16155b611d2e5760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015611d59576000805460ff1961ff0019909116610100171660011790555b611d61611d9b565b611d6b8383611fba565b8015611b21576000805461ff0019169055505050565b6038805460ff191660ff92909216919091179055565b4690565b600054610100900460ff1680611db45750611db4611be5565b80611dc2575060005460ff16155b611dfd5760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015611e28576000805460ff1961ff0019909116610100171660011790555b8015611e3a576000805461ff00191690555b50565b600054610100900460ff1680611e565750611e56611be5565b80611e64575060005460ff16155b611e9f5760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015611eca576000805460ff1961ff0019909116610100171660011790555b82516020808501919091208351918401919091206065919091556066558015611b21576000805461ff0019169055505050565b600054610100900460ff1680611f165750611f16611be5565b80611f24575060005460ff16155b611f5f5760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015611f8a576000805460ff1961ff0019909116610100171660011790555b6040518060526121da8239604051908190036052019020609a55508015610b26576000805461ff00191690555050565b600054610100900460ff1680611fd35750611fd3611be5565b80611fe1575060005460ff16155b61201c5760405162461bcd60e51b815260040180806020018281038252602e81526020018061222c602e913960400191505060405180910390fd5b600054610100900460ff16158015612047576000805460ff1961ff0019909116610100171660011790555b825161205a906036906020860190612092565b50815161206e906037906020850190612092565b506038805460ff191660121790558015611b21576000805461ff0019169055505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106120d357805160ff1916838001178555612100565b82800160010185558215612100579182015b828111156121005782518255916020019190600101906120e5565b5061210c929150612110565b5090565b6105e491905b8082111561210c576000815560010161211656fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545434453413a20696e76616c6964207369676e6174757265202773272076616c75655065726d69742861646472657373206f776e65722c61646472657373207370656e6465722c75696e743235362076616c75652c75696e74323536206e6f6e63652c75696e7432353620646561646c696e6529496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a656445434453413a20696e76616c6964207369676e6174757265202776272076616c7565454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e74726163742945524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220ea2924740b351201ebdaa8333830d981501de38ede15792d380977599edbaa2764736f6c634300060b0033
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.