Overview
S Balance
S Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Deploy Token | 10567657 | 3 days ago | IN | 0 S | 0.04300928 |
Latest 3 internal transactions
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
10567657 | 3 days ago | Contract Creation | 0 S | |||
9999982 | 5 days ago | Contract Creation | 0 S | |||
9999982 | 5 days ago | Contract Creation | 0 S |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
BackedFactory
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 10 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
/** * SPDX-License-Identifier: MIT * * Copyright (c) 2021-2022 Backed Finance AG * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ pragma solidity 0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import "./BackedTokenImplementation.sol"; /** * @dev * TransparentUpgradeableProxy contract, renamed as BackedTokenProxy. */ contract BackedTokenProxy is TransparentUpgradeableProxy { constructor(address _logic, address admin_, bytes memory _data) payable TransparentUpgradeableProxy( _logic, admin_, _data) {} } /** * @dev * * Factory contract, used for creating new, upgradable tokens. * * The contract contains one role: * - An owner, which can deploy new tokens * */ contract BackedFactory is Ownable { ProxyAdmin public proxyAdmin; BackedTokenImplementation public tokenImplementation; event NewToken(address indexed newToken, string name, string symbol); /** * @param proxyAdminOwner The address of the account that will be set as owner of the deployed ProxyAdmin */ constructor (address proxyAdminOwner) { require(proxyAdminOwner != address(0), "Factory: address should not be 0"); tokenImplementation = new BackedTokenImplementation(); proxyAdmin = new ProxyAdmin(); proxyAdmin.transferOwnership(proxyAdminOwner); } /** * @dev Deploy and configures new instance of BackedFi Token. Callable only by the factory owner * * Emits a { NewToken } event * * @param name The name that the newly created token will have * @param symbol The symbol that the newly created token will have * @param tokenOwner The address of the account to which the owner role will be assigned * @param minter The address of the account to which the minter role will be assigned * @param burner The address of the account to which the burner role will be assigned * @param pauser The address of the account to which the pauser role will be assigned */ function deployToken(string memory name, string memory symbol, address tokenOwner, address minter, address burner, address pauser, address sanctionsList) external onlyOwner returns (address) { require(tokenOwner != address(0) && minter != address(0) && burner != address(0) && pauser != address(0), "Factory: address should not be 0"); bytes32 salt = keccak256(abi.encodePacked(name, symbol)); BackedTokenProxy newProxy = new BackedTokenProxy{salt : salt}( address(tokenImplementation), address(proxyAdmin), abi.encodeWithSelector(BackedTokenImplementation(address(0)).initialize.selector, name, symbol) ); BackedTokenImplementation newToken = BackedTokenImplementation(address(newProxy)); newToken.setMinter(minter); newToken.setBurner(burner); newToken.setPauser(pauser); newToken.setSanctionsList(sanctionsList); newToken.transferOwnership(tokenOwner); emit NewToken(address(newToken), name, symbol); return (address(newToken)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^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 proxied contracts do not make use of 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 {ERC1967Proxy-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. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ 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() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20Upgradeable.sol"; import "./extensions/IERC20MetadataUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../proxy/utils/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 Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[45] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^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 `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); /** * @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 // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/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 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 onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../StringsUpgradeable.sol"; /** * @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 { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. 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. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @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) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // 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 (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): 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. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * 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)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol) pragma solidity ^0.8.0; import "../Proxy.sol"; import "./ERC1967Upgrade.sol"; /** * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an * implementation address that can be changed. This address is stored in storage in the location specified by * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the * implementation behind the proxy. */ contract ERC1967Proxy is Proxy, ERC1967Upgrade { /** * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`. * * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded * function call, and allows initializating the storage of the proxy like a Solidity constructor. */ constructor(address _logic, bytes memory _data) payable { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); _upgradeToAndCall(_logic, _data, false); } /** * @dev Returns the current implementation address. */ function _implementation() internal view virtual override returns (address impl) { return ERC1967Upgrade._getImplementation(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeacon.sol"; import "../../interfaces/draft-IERC1822.sol"; import "../../utils/Address.sol"; import "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967Upgrade { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol) pragma solidity ^0.8.0; import "./TransparentUpgradeableProxy.sol"; import "../../access/Ownable.sol"; /** * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}. */ contract ProxyAdmin is Ownable { /** * @dev Returns the current implementation of `proxy`. * * Requirements: * * - This contract must be the admin of `proxy`. */ function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) { // We need to manually run the static call since the getter cannot be flagged as view // bytes4(keccak256("implementation()")) == 0x5c60da1b (bool success, bytes memory returndata) = address(proxy).staticcall(hex"5c60da1b"); require(success); return abi.decode(returndata, (address)); } /** * @dev Returns the current admin of `proxy`. * * Requirements: * * - This contract must be the admin of `proxy`. */ function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) { // We need to manually run the static call since the getter cannot be flagged as view // bytes4(keccak256("admin()")) == 0xf851a440 (bool success, bytes memory returndata) = address(proxy).staticcall(hex"f851a440"); require(success); return abi.decode(returndata, (address)); } /** * @dev Changes the admin of `proxy` to `newAdmin`. * * Requirements: * * - This contract must be the current admin of `proxy`. */ function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner { proxy.changeAdmin(newAdmin); } /** * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}. * * Requirements: * * - This contract must be the admin of `proxy`. */ function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner { proxy.upgradeTo(implementation); } /** * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See * {TransparentUpgradeableProxy-upgradeToAndCall}. * * Requirements: * * - This contract must be the admin of `proxy`. */ function upgradeAndCall( TransparentUpgradeableProxy proxy, address implementation, bytes memory data ) public payable virtual onlyOwner { proxy.upgradeToAndCall{value: msg.value}(implementation, data); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol) pragma solidity ^0.8.0; import "../ERC1967/ERC1967Proxy.sol"; /** * @dev This contract implements a proxy that is upgradeable by an admin. * * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector * clashing], which can potentially be used in an attack, this contract uses the * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two * things that go hand in hand: * * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if * that call matches one of the admin functions exposed by the proxy itself. * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the * implementation. If the admin tries to call a function on the implementation it will fail with an error that says * "admin cannot fallback to proxy target". * * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due * to sudden errors when trying to call a function from the proxy implementation. * * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy. */ contract TransparentUpgradeableProxy is ERC1967Proxy { /** * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}. */ constructor( address _logic, address admin_, bytes memory _data ) payable ERC1967Proxy(_logic, _data) { assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1)); _changeAdmin(admin_); } /** * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin. */ modifier ifAdmin() { if (msg.sender == _getAdmin()) { _; } else { _fallback(); } } /** * @dev Returns the current admin. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function admin() external ifAdmin returns (address admin_) { admin_ = _getAdmin(); } /** * @dev Returns the current implementation. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` */ function implementation() external ifAdmin returns (address implementation_) { implementation_ = _implementation(); } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. * * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}. */ function changeAdmin(address newAdmin) external virtual ifAdmin { _changeAdmin(newAdmin); } /** * @dev Upgrade the implementation of the proxy. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}. */ function upgradeTo(address newImplementation) external ifAdmin { _upgradeToAndCall(newImplementation, bytes(""), false); } /** * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the * proxied contract. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}. */ function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin { _upgradeToAndCall(newImplementation, data, true); } /** * @dev Returns the current admin. */ function _admin() internal view virtual returns (address) { return _getAdmin(); } /** * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}. */ function _beforeFallback() internal virtual override { require(msg.sender != _getAdmin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target"); super._beforeFallback(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
/** * SPDX-License-Identifier: MIT * * Copyright (c) 2021-2022 Backed Finance AG * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /** * Disclaimer and Terms of Use * * These ERC-20 tokens have not been registered under the U.S. Securities Act of 1933, as * amended or with any securities regulatory authority of any State or other jurisdiction * of the United States and (i) may not be offered, sold or delivered within the United States * to, or for the account or benefit of U.S. Persons, and (ii) may be offered, sold or otherwise * delivered at any time only to transferees that are Non-United States Persons (as defined by * the U.S. Commodities Futures Trading Commission). * For more information and restrictions please refer to the issuer's [Website](https://www.backedassets.fi/legal-documentation) */ pragma solidity 0.8.9; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "./ERC20PermitDelegateTransfer.sol"; import "./SanctionsList.sol"; /** * @dev * * This token contract is following the ERC20 standard. * It inherits ERC20PermitDelegateTransfer.sol, which extends the basic ERC20 to also allow permit and delegateTransfer EIP-712 functionality. * Enforces Sanctions List via the Chainalysis standard interface. * The contract contains three roles: * - A minter, that can mint new tokens. * - A burner, that can burn its own tokens, or contract's tokens. * - A pauser, that can pause or restore all transfers in the contract. * - An owner, that can set the three above, and also the sanctionsList pointer. * The owner can also set who can use the EIP-712 functionality, either specific accounts via a whitelist, or everyone. * */ contract BackedTokenImplementation is OwnableUpgradeable, ERC20PermitDelegateTransfer { // Roles: address public minter; address public burner; address public pauser; // EIP-712 Delegate Functionality: bool public delegateMode; mapping(address => bool) public delegateWhitelist; // Pause: bool public isPaused; // SanctionsList: SanctionsList public sanctionsList; // Events: event NewMinter(address indexed newMinter); event NewBurner(address indexed newBurner); event NewPauser(address indexed newPauser); event NewSanctionsList(address indexed newSanctionsList); event DelegateWhitelistChange(address indexed whitelistAddress, bool status); event DelegateModeChange(bool delegateMode); event PauseModeChange(bool pauseMode); modifier allowedDelegate { require(delegateMode || delegateWhitelist[_msgSender()], "BackedToken: Unauthorized delegate"); _; } // constructor, call initializer to lock the implementation instance. constructor () { initialize("Backed Token Implementation", "BTI"); } function initialize(string memory name_, string memory symbol_) public initializer { __ERC20_init(name_, symbol_); __Ownable_init(); _buildDomainSeparator(); } /** * @dev Update allowance with a signed permit. Allowed only if * the sender is whitelisted, or the delegateMode is set to true * * @param owner Token owner's address (Authorizer) * @param spender Spender's address * @param value Amount of allowance * @param deadline Expiration time, seconds since the epoch * @param v v part of the signature * @param r r part of the signature * @param s s part of the signature */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public override allowedDelegate { super.permit(owner, spender, value, deadline, v, r, s); } /** * @dev Perform an intended transfer on one account's behalf, from another account, * who actually pays fees for the transaction. Allowed only if the sender * is whitelisted, or the delegateMode is set to true * * @param owner The account that provided the signature and from which the tokens will be taken * @param to The account that will receive the tokens * @param value The amount of tokens to transfer * @param deadline Expiration time, seconds since the epoch * @param v v part of the signature * @param r r part of the signature * @param s s part of the signature */ function delegatedTransfer( address owner, address to, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public override allowedDelegate { super.delegatedTransfer(owner, to, value, deadline, v, r, s); } /** * @dev Function to mint tokens. Allowed only for minter * * @param account The address that will receive the minted tokens * @param amount The amount of tokens to mint */ function mint(address account, uint256 amount) virtual external { require(_msgSender() == minter, "BackedToken: Only minter"); _mint(account, amount); } /** * @dev Function to burn tokens. Allowed only for burner. The burned tokens * must be from the burner (msg.sender), or from the contract itself * * @param account The account from which the tokens will be burned * @param amount The amount of tokens to be burned */ function burn(address account, uint256 amount) external { require(_msgSender() == burner, "BackedToken: Only burner"); require(account == _msgSender() || account == address(this), "BackedToken: Cannot burn account"); _burn(account, amount); } /** * @dev Function to set the pause in order to block or restore all * transfers. Allowed only for pauser * * Emits a { PauseModeChange } event * * @param newPauseMode The new pause mode */ function setPause(bool newPauseMode) external { require(_msgSender() == pauser, "BackedToken: Only pauser"); isPaused = newPauseMode; emit PauseModeChange(newPauseMode); } /** * @dev Function to change the contract minter. Allowed only for owner * * Emits a { NewMinter } event * * @param newMinter The address of the new minter */ function setMinter(address newMinter) external onlyOwner { minter = newMinter; emit NewMinter(newMinter); } /** * @dev Function to change the contract burner. Allowed only for owner * * Emits a { NewBurner } event * * @param newBurner The address of the new burner */ function setBurner(address newBurner) external onlyOwner { burner = newBurner; emit NewBurner(newBurner); } /** * @dev Function to change the contract pauser. Allowed only for owner * * Emits a { NewPauser } event * * @param newPauser The address of the new pauser */ function setPauser(address newPauser) external onlyOwner { pauser = newPauser; emit NewPauser(newPauser); } /** * @dev Function to change the contract Senctions List. Allowed only for owner * * Emits a { NewSanctionsList } event * * @param newSanctionsList The address of the new Senctions List following the Chainalysis standard */ function setSanctionsList(address newSanctionsList) external onlyOwner { // Check the proposed sanctions list contract has the right interface: require(!SanctionsList(newSanctionsList).isSanctioned(address(this)), "BackedToken: Wrong List interface"); sanctionsList = SanctionsList(newSanctionsList); emit NewSanctionsList(newSanctionsList); } /** * @dev EIP-712 Function to change the delegate status of account. * Allowed only for owner * * Emits a { DelegateWhitelistChange } event * * @param whitelistAddress The address for which to change the delegate status * @param status The new delegate status */ function setDelegateWhitelist(address whitelistAddress, bool status) external onlyOwner { delegateWhitelist[whitelistAddress] = status; emit DelegateWhitelistChange(whitelistAddress, status); } /** * @dev EIP-712 Function to change the contract delegate mode. Allowed * only for owner * * Emits a { DelegateModeChange } event * * @param _delegateMode The new delegate mode for the contract */ function setDelegateMode(bool _delegateMode) external onlyOwner { delegateMode = _delegateMode; emit DelegateModeChange(_delegateMode); } // Implement the pause and SanctionsList functionality before transfer: function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { // Check not paused: require(!isPaused, "BackedToken: token transfer while paused"); // Check Sanctions List, but do not prevent minting burning: if (from != address(0) && to != address(0)) { require(!sanctionsList.isSanctioned(from), "BackedToken: sender is sanctioned"); require(!sanctionsList.isSanctioned(to), "BackedToken: receiver is sanctioned"); } super._beforeTokenTransfer(from, to, amount); } // Implement the SanctionsList functionality for spender: function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual override { require(!sanctionsList.isSanctioned(spender), "BackedToken: spender is sanctioned"); super._spendAllowance(owner, spender, amount); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
/** * SPDX-License-Identifier: MIT * * Copyright (c) 2021-2022 Backed Finance AG * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ pragma solidity 0.8.9; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol"; /** * @dev * * This contract is a based (copy-paste with changes) on OpenZeppelin's draft-ERC20Permit.sol (token/ERC20/extensions/draft-ERC20Permit.sol). * * The changes are: * - Adding also delegated transfer functionality, that is similar to permit, but doing the actual transfer and not approval. * - Cutting some of the generalities to make the contacts more straight forward for this case (e.g. removing the counters library). * */ contract ERC20PermitDelegateTransfer is ERC20Upgradeable { mapping(address => uint256) public nonces; // Calculating the Permit typehash: bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // Calculating the Delegated Transfer typehash: bytes32 public constant DELEGATED_TRANSFER_TYPEHASH = keccak256("DELEGATED_TRANSFER(address owner,address to,uint256 value,uint256 nonce,uint256 deadline)"); // Immutable variable for Domain Separator: // solhint-disable-next-line var-name-mixedcase bytes32 public DOMAIN_SEPARATOR; // A version number: string internal constant VERSION = "1"; /** * @dev Permit, approve via a sign message, using erc712. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); _checkOwner(owner, structHash, v, r, s); _approve(owner, spender, value); } /** * @dev Delegated Transfer, transfer via a sign message, using erc712. */ function delegatedTransfer( address owner, address to, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(DELEGATED_TRANSFER_TYPEHASH, owner, to, value, _useNonce(owner), deadline)); _checkOwner(owner, structHash, v, r, s); _transfer(owner, to, value); } /** * @dev "Consume a nonce": return the current value and increment. */ function _useNonce(address owner) internal virtual returns (uint256 current) { current = nonces[owner]; nonces[owner]++; } function _checkOwner(address owner, bytes32 structHash, uint8 v, bytes32 r, bytes32 s) internal view { bytes32 hash = ECDSAUpgradeable.toTypedDataHash(DOMAIN_SEPARATOR, structHash); address signer = ECDSAUpgradeable.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); } function _buildDomainSeparator() internal { DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name())), keccak256(bytes(VERSION)), block.chainid, address(this) ) ); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
pragma solidity 0.8.9; /** * SPDX-License-Identifier: MIT * * Copyright (c) 2021-2022 Backed Finance AG * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ interface SanctionsList { function isSanctioned(address addr) external view returns (bool); }
{ "optimizer": { "enabled": true, "runs": 10 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"proxyAdminOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newToken","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"symbol","type":"string"}],"name":"NewToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"tokenOwner","type":"address"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"address","name":"burner","type":"address"},{"internalType":"address","name":"pauser","type":"address"},{"internalType":"address","name":"sanctionsList","type":"address"}],"name":"deployToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxyAdmin","outputs":[{"internalType":"contract ProxyAdmin","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenImplementation","outputs":[{"internalType":"contract BackedTokenImplementation","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5060405162004c6938038062004c69833981016040819052610031916101e8565b61003a3361017c565b6001600160a01b0381166100945760405162461bcd60e51b815260206004820181905260248201527f466163746f72793a20616464726573732073686f756c64206e6f742062652030604482015260640160405180910390fd5b6040516100a0906101cc565b604051809103906000f0801580156100bc573d6000803e3d6000fd5b50600280546001600160a01b0319166001600160a01b03929092169190911790556040516100e9906101da565b604051809103906000f080158015610105573d6000803e3d6000fd5b50600180546001600160a01b0319166001600160a01b0392831690811790915560405163f2fde38b60e01b815291831660048301529063f2fde38b90602401600060405180830381600087803b15801561015e57600080fd5b505af1158015610172573d6000803e3d6000fd5b5050505050610218565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6129c48062001ae883390190565b6107bd80620044ac83390190565b6000602082840312156101fa57600080fd5b81516001600160a01b038116811461021157600080fd5b9392505050565b6118c080620002286000396000f3fe60806040523480156200001157600080fd5b50600436106200006a5760003560e01c80632f3a3d5d146200006f5780633e47158c146200009b578063715018a614620000af5780638da5cb5b14620000bb57806396fc1c1114620000c5578063f2fde38b14620000dc575b600080fd5b60025462000083906001600160a01b031681565b6040516200009291906200063b565b60405180910390f35b60015462000083906001600160a01b031681565b620000b9620000f3565b005b620000836200013e565b62000083620000d636600462000716565b6200014d565b620000b9620000ed366004620007dd565b62000534565b33620000fe6200013e565b6001600160a01b031614620001305760405162461bcd60e51b8152600401620001279062000802565b60405180910390fd5b6200013c6000620005dd565b565b6000546001600160a01b031690565b6000336200015a6200013e565b6001600160a01b031614620001835760405162461bcd60e51b8152600401620001279062000802565b6001600160a01b03861615801590620001a457506001600160a01b03851615155b8015620001b957506001600160a01b03841615155b8015620001ce57506001600160a01b03831615155b6200021c5760405162461bcd60e51b815260206004820181905260248201527f466163746f72793a20616464726573732073686f756c64206e6f742062652030604482015260640162000127565b60008888604051602001620002339291906200086a565b60408051601f1981840301815290829052805160209091012060025460015491935060009284926001600160a01b0392831692169063266c45bb60e11b9062000283908f908f90602401620008cb565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051620002c2906200062d565b620002d093929190620008fd565b8190604051809103906000f5905080158015620002f1573d6000803e3d6000fd5b50604051637e51dad560e11b815290915081906001600160a01b0382169063fca3b5aa9062000325908b906004016200063b565b600060405180830381600087803b1580156200034057600080fd5b505af115801562000355573d6000803e3d6000fd5b50506040516354cb6b6760e11b81526001600160a01b038416925063a996d6ce915062000387908a906004016200063b565b600060405180830381600087803b158015620003a257600080fd5b505af1158015620003b7573d6000803e3d6000fd5b50506040516316c457a560e11b81526001600160a01b0384169250632d88af4a9150620003e99089906004016200063b565b600060405180830381600087803b1580156200040457600080fd5b505af115801562000419573d6000803e3d6000fd5b50506040516349dc5e8d60e01b81526001600160a01b03841692506349dc5e8d91506200044b9088906004016200063b565b600060405180830381600087803b1580156200046657600080fd5b505af11580156200047b573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b038416925063f2fde38b9150620004ad908c906004016200063b565b600060405180830381600087803b158015620004c857600080fd5b505af1158015620004dd573d6000803e3d6000fd5b50505050806001600160a01b03167fc3d0a20a44bb0f367823c0b8747497ad98c62f65bc0a1ddf9d6db910ad9fbd418c8c6040516200051e929190620008cb565b60405180910390a29a9950505050505050505050565b336200053f6200013e565b6001600160a01b031614620005685760405162461bcd60e51b8152600401620001279062000802565b6001600160a01b038116620005cf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000127565b620005da81620005dd565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610f5f806200092c83390190565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200067757600080fd5b81356001600160401b03808211156200069457620006946200064f565b604051601f8301601f19908116603f01168101908282118183101715620006bf57620006bf6200064f565b81604052838152866020858801011115620006d957600080fd5b836020870160208301376000602085830101528094505050505092915050565b80356001600160a01b03811681146200071157600080fd5b919050565b600080600080600080600060e0888a0312156200073257600080fd5b87356001600160401b03808211156200074a57600080fd5b620007588b838c0162000665565b985060208a01359150808211156200076f57600080fd5b506200077e8a828b0162000665565b9650506200078f60408901620006f9565b94506200079f60608901620006f9565b9350620007af60808901620006f9565b9250620007bf60a08901620006f9565b9150620007cf60c08901620006f9565b905092959891949750929550565b600060208284031215620007f057600080fd5b620007fb82620006f9565b9392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60005b83811015620008545781810151838201526020016200083a565b8381111562000864576000848401525b50505050565b600083516200087e81846020880162000837565b8351908301906200089481836020880162000837565b01949350505050565b60008151808452620008b781602086016020860162000837565b601f01601f19169290920160200192915050565b604081526000620008e060408301856200089d565b8281036020840152620008f481856200089d565b95945050505050565b6001600160a01b03848116825283166020820152606060408201819052600090620008f4908301846200089d56fe608060405260405162000f5f38038062000f5f83398101604081905262000026916200051f565b82828282816200005860017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005ff565b60008051602062000f188339815191521462000078576200007862000625565b6200008682826000620000ed565b50620000b6905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005ff565b60008051602062000ef883398151915214620000d657620000d662000625565b620000e1826200012a565b5050505050506200068e565b620000f88362000185565b600082511180620001065750805b156200012557620001238383620001c760201b620002601760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f62000155620001f6565b604080516001600160a01b03928316815291841660208301520160405180910390a162000182816200022f565b50565b6200019081620002e4565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001ef838360405180606001604052806027815260200162000f386027913962000387565b9392505050565b60006200022060008051602062000ef883398151915260001b6200046d60201b620002081760201c565b546001600160a01b0316919050565b6001600160a01b0381166200029a5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002c360008051602062000ef883398151915260001b6200046d60201b620002081760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002fa816200047060201b6200028c1760201c565b6200035e5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840162000291565b80620002c360008051602062000f1883398151915260001b6200046d60201b620002081760201c565b60606001600160a01b0384163b620003f15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840162000291565b600080856001600160a01b0316856040516200040e91906200063b565b600060405180830381855af49150503d80600081146200044b576040519150601f19603f3d011682016040523d82523d6000602084013e62000450565b606091505b509092509050620004638282866200047f565b9695505050505050565b90565b6001600160a01b03163b151590565b6060831562000490575081620001ef565b825115620004a15782518084602001fd5b8160405162461bcd60e51b815260040162000291919062000659565b80516001600160a01b0381168114620004d557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200050d578181015183820152602001620004f3565b83811115620001235750506000910152565b6000806000606084860312156200053557600080fd5b6200054084620004bd565b92506200055060208501620004bd565b60408501519092506001600160401b03808211156200056e57600080fd5b818601915086601f8301126200058357600080fd5b815181811115620005985762000598620004da565b604051601f8201601f19908116603f01168101908382118183101715620005c357620005c3620004da565b81604052828152896020848701011115620005dd57600080fd5b620005f0836020830160208801620004f0565b80955050505050509250925092565b6000828210156200062057634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b600082516200064f818460208701620004f0565b9190910192915050565b60208152600082518060208401526200067a816040850160208701620004f0565b601f01601f19169190910160400192915050565b61085a806200069e6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106a5565b610118565b61005b6100933660046106c0565b61015f565b3480156100a457600080fd5b506100ad6101d0565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106a5565b61020b565b3480156100f557600080fd5b506100ad610235565b61010661029b565b61011661011161033a565b610344565b565b610120610368565b6001600160a01b0316336001600160a01b031614156101575761015481604051806020016040528060008152506000610389565b50565b6101546100fe565b610167610368565b6001600160a01b0316336001600160a01b031614156101c8576101c38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610389915050565b505050565b6101c36100fe565b60006101da610368565b6001600160a01b0316336001600160a01b03161415610200576101fb61033a565b905090565b6102086100fe565b90565b610213610368565b6001600160a01b0316336001600160a01b0316141561015757610154816103b4565b600061023f610368565b6001600160a01b0316336001600160a01b03161415610200576101fb610368565b606061028583836040518060600160405280602781526020016107fe60279139610408565b9392505050565b6001600160a01b03163b151590565b6102a3610368565b6001600160a01b0316336001600160a01b031614156101165760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b60006101fb6104e3565b3660008037600080366000845af43d6000803e808015610363573d6000f35b3d6000fd5b60006000805160206107be8339815191525b546001600160a01b0316919050565b610392836104f9565b60008251118061039f5750805b156101c3576103ae8383610260565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103dd610368565b604080516001600160a01b03928316815291841660208301520160405180910390a161015481610539565b60606104138461028c565b61046e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610331565b600080856001600160a01b031685604051610489919061076e565b600060405180830381855af49150503d80600081146104c4576040519150601f19603f3d011682016040523d82523d6000602084013e6104c9565b606091505b50915091506104d98282866105d0565b9695505050505050565b60006000805160206107de83398151915261037a565b61050281610609565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b03811661059e5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610331565b806000805160206107be8339815191525b80546001600160a01b0319166001600160a01b039290921691909117905550565b606083156105df575081610285565b8251156105ef5782518084602001fd5b8160405162461bcd60e51b8152600401610331919061078a565b6106128161028c565b6106745760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610331565b806000805160206107de8339815191526105af565b80356001600160a01b03811681146106a057600080fd5b919050565b6000602082840312156106b757600080fd5b61028582610689565b6000806000604084860312156106d557600080fd5b6106de84610689565b925060208401356001600160401b03808211156106fa57600080fd5b818601915086601f83011261070e57600080fd5b81358181111561071d57600080fd5b87602082850101111561072f57600080fd5b6020830194508093505050509250925092565b60005b8381101561075d578181015183820152602001610745565b838111156103ae5750506000910152565b60008251610780818460208701610742565b9190910192915050565b60208152600082518060208401526107a9816040850160208701610742565b601f01601f1916919091016040019291505056feb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220694e092fe08ffc1f86eb541c6a52a2af6e6ed5d9931bff00c4b07970e133142664736f6c63430008090033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212205a6f00bd8663d1492bc05e0491c99a6696bba346db4f008cc33328846e701f5a64736f6c6343000809003360806040523480156200001157600080fd5b50620000746040518060400160405280601b81526020017f4261636b656420546f6b656e20496d706c656d656e746174696f6e00000000008152506040518060400160405280600381526020016242544960e81b8152506200007a60201b60201c565b62000551565b600054610100900460ff16620000975760005460ff1615620000a1565b620000a162000165565b6200010a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b600054610100900460ff161580156200012d576000805461ffff19166101011790555b62000139838362000183565b62000143620001bd565b6200014d620001f3565b801562000160576000805461ff00191690555b505050565b60006200017d306200029e60201b62000ebe1760201c565b15905090565b600054610100900460ff16620001ad5760405162461bcd60e51b81526004016200010190620004c9565b620001b98282620002ad565b5050565b600054610100900460ff16620001e75760405162461bcd60e51b81526004016200010190620004c9565b620001f162000302565b565b7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6200021e62000337565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160408051601f198184030181529190528051602090910120609855565b6001600160a01b03163b151590565b600054610100900460ff16620002d75760405162461bcd60e51b81526004016200010190620004c9565b8151620002ec90606890602085019062000423565b5080516200016090606990602084019062000423565b600054610100900460ff166200032c5760405162461bcd60e51b81526004016200010190620004c9565b620001f133620003d1565b606060688054620003489062000514565b80601f0160208091040260200160405190810160405280929190818152602001828054620003769062000514565b8015620003c75780601f106200039b57610100808354040283529160200191620003c7565b820191906000526020600020905b815481529060010190602001808311620003a957829003601f168201915b5050505050905090565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620004319062000514565b90600052602060002090601f016020900481019282620004555760008555620004a0565b82601f106200047057805160ff1916838001178555620004a0565b82800160010185558215620004a0579182015b82811115620004a057825182559160200191906001019062000483565b50620004ae929150620004b2565b5090565b5b80821115620004ae5760008155600101620004b3565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600181811c908216806200052957607f821691505b602082108114156200054b57634e487b7160e01b600052602260045260246000fd5b50919050565b61246380620005616000396000f3fe608060405234801561001057600080fd5b50600436106101b75760003560e01c806306fdde03146101bc57806307546172146101da578063095ea7b3146101fa57806318160ddd1461021d57806323b872dd1461022f57806327810b6e146102425780632cc5ecd5146102555780632d88af4a1461027857806330adf81f1461028d578063313ce567146102a25780633644e515146102b157806339509351146102ba57806340c10f19146102cd57806349dc5e8d146102e05780634cd88b76146102f35780635c575ef31461030657806370a082311461031a578063715018a6146103435780637ecebe001461034b5780637f1205871461036b5780638da5cb5b1461038057806395d89b41146103885780639dc29fac146103905780639fd0506d146103a3578063a15f84da146103b6578063a457c2d7146103c9578063a9059cbb146103dc578063a996d6ce146103ef578063aea77ac314610402578063b187bd2614610415578063b6ca6e1214610422578063bedb86fb14610435578063d505accf14610448578063dd62ed3e1461045b578063ec571c6a1461046e578063f2fde38b14610486578063fca3b5aa14610499575b600080fd5b6101c46104ac565b6040516101d19190611eb8565b60405180910390f35b60cb546101ed906001600160a01b031681565b6040516101d19190611f0d565b61020d610208366004611f3d565b61053e565b60405190151581526020016101d1565b6067545b6040519081526020016101d1565b61020d61023d366004611f67565b610556565b60cc546101ed906001600160a01b031681565b61020d610263366004611fa3565b60ce6020526000908152604090205460ff1681565b61028b610286366004611fa3565b61057a565b005b61022160008051602061240e83398151915281565b604051601281526020016101d1565b61022160985481565b61020d6102c8366004611f3d565b6105fc565b61028b6102db366004611f3d565b61063b565b61028b6102ee366004611fa3565b6106a7565b61028b610301366004612067565b6107fb565b60cd5461020d90600160a01b900460ff1681565b610221610328366004611fa3565b6001600160a01b031660009081526065602052604090205490565b61028b6108d4565b610221610359366004611fa3565b60976020526000908152604090205481565b6102216000805160206123ce83398151915281565b6101ed61090f565b6101c461091e565b61028b61039e366004611f3d565b61092d565b60cd546101ed906001600160a01b031681565b61028b6103c43660046120d8565b610a00565b61020d6103d7366004611f3d565b610a87565b61020d6103ea366004611f3d565b610b19565b61028b6103fd366004611fa3565b610b27565b61028b6104103660046120f5565b610ba0565b60cf5461020d9060ff1681565b61028b610430366004612168565b610bfb565b61028b6104433660046120d8565b610c89565b61028b6104563660046120f5565b610d28565b61022161046936600461219f565b610d7a565b60cf546101ed9061010090046001600160a01b031681565b61028b610494366004611fa3565b610da5565b61028b6104a7366004611fa3565b610e45565b6060606880546104bb906121d2565b80601f01602080910402602001604051908101604052809291908181526020018280546104e7906121d2565b80156105345780601f1061050957610100808354040283529160200191610534565b820191906000526020600020905b81548152906001019060200180831161051757829003601f168201915b5050505050905090565b60003361054c818585610ecd565b5060019392505050565b600033610564858285610ff1565b61056f8585856110d8565b506001949350505050565b3361058361090f565b6001600160a01b0316146105b25760405162461bcd60e51b81526004016105a99061220d565b60405180910390fd5b60cd80546001600160a01b0319166001600160a01b0383169081179091556040517f4f68150eb56c53cc9373649e35bc37dd235a0c86e10aa23b8a835378136ac6a090600090a250565b3360008181526066602090815260408083206001600160a01b038716845290915281205490919061054c9082908690610636908790612258565b610ecd565b60cb546001600160a01b0316336001600160a01b0316146106995760405162461bcd60e51b81526020600482015260186024820152772130b1b5b2b22a37b5b2b71d1027b7363c9036b4b73a32b960411b60448201526064016105a9565b6106a382826112a1565b5050565b336106b061090f565b6001600160a01b0316146106d65760405162461bcd60e51b81526004016105a99061220d565b60405163df592f7d60e01b81526001600160a01b0382169063df592f7d90610702903090600401611f0d565b60206040518083038186803b15801561071a57600080fd5b505afa15801561072e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107529190612270565b156107a95760405162461bcd60e51b815260206004820152602160248201527f4261636b6564546f6b656e3a2057726f6e67204c69737420696e7465726661636044820152606560f81b60648201526084016105a9565b60cf8054610100600160a81b0319166101006001600160a01b038416908102919091179091556040517feff538eaa91b9b5384df4354f3841681487784258ac4b209182aef0755f9e0be90600090a250565b600054610100900460ff166108165760005460ff161561081e565b61081e61137a565b6108815760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016105a9565b600054610100900460ff161580156108a3576000805461ffff19166101011790555b6108ad838361138b565b6108b56113bc565b6108bd6113eb565b80156108cf576000805461ff00191690555b505050565b336108dd61090f565b6001600160a01b0316146109035760405162461bcd60e51b81526004016105a99061220d565b61090d6000611494565b565b6033546001600160a01b031690565b6060606980546104bb906121d2565b60cc546001600160a01b0316336001600160a01b03161461098b5760405162461bcd60e51b81526020600482015260186024820152772130b1b5b2b22a37b5b2b71d1027b7363c90313ab93732b960411b60448201526064016105a9565b6001600160a01b0382163314806109aa57506001600160a01b03821630145b6109f65760405162461bcd60e51b815260206004820181905260248201527f4261636b6564546f6b656e3a2043616e6e6f74206275726e206163636f756e7460448201526064016105a9565b6106a382826114e6565b33610a0961090f565b6001600160a01b031614610a2f5760405162461bcd60e51b81526004016105a99061220d565b60cd8054821515600160a01b0260ff60a01b199091161790556040517f238422c0d720060023911dceeb8ba506952801637ad007844edcd4416364fecf90610a7c90831515815260200190565b60405180910390a150565b3360008181526066602090815260408083206001600160a01b038716845290915281205490919083811015610b0c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016105a9565b61056f8286868403610ecd565b60003361054c8185856110d8565b33610b3061090f565b6001600160a01b031614610b565760405162461bcd60e51b81526004016105a99061220d565b60cc80546001600160a01b0319166001600160a01b0383169081179091556040517f5bb1db06eeb30d85c1e53ae2285b460ce83e4318c623bd1ca51df912f64c45a490600090a250565b60cd54600160a01b900460ff1680610bc7575033600090815260ce602052604090205460ff165b610be35760405162461bcd60e51b81526004016105a99061228d565b610bf28787878787878761162e565b50505050505050565b33610c0461090f565b6001600160a01b031614610c2a5760405162461bcd60e51b81526004016105a99061220d565b6001600160a01b038216600081815260ce6020908152604091829020805460ff191685151590811790915591519182527f7459b9d2544fdaf790226b129ff473f8c8ce56bfc10bc3bdbe1c71b9d426a546910160405180910390a25050565b60cd546001600160a01b0316336001600160a01b031614610ce75760405162461bcd60e51b81526020600482015260186024820152772130b1b5b2b22a37b5b2b71d1027b7363c903830bab9b2b960411b60448201526064016105a9565b60cf805460ff19168215159081179091556040519081527fb9bcdd890b4d4c213bab99cf96dc1adb9ede36bb2a54610c91a86de844b05fb890602001610a7c565b60cd54600160a01b900460ff1680610d4f575033600090815260ce602052604090205460ff165b610d6b5760405162461bcd60e51b81526004016105a99061228d565b610bf2878787878787876116bb565b6001600160a01b03918216600090815260666020908152604080832093909416825291909152205490565b33610dae61090f565b6001600160a01b031614610dd45760405162461bcd60e51b81526004016105a99061220d565b6001600160a01b038116610e395760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105a9565b610e4281611494565b50565b33610e4e61090f565b6001600160a01b031614610e745760405162461bcd60e51b81526004016105a99061220d565b60cb80546001600160a01b0319166001600160a01b0383169081179091556040517f6adffd5c93085d835dac6f3b40adf7c242ca4b3284048d20c3d8a501748dc97390600090a250565b6001600160a01b03163b151590565b6001600160a01b038316610f2f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105a9565b6001600160a01b038216610f905760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105a9565b6001600160a01b0383811660008181526066602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60cf5460405163df592f7d60e01b81526101009091046001600160a01b03169063df592f7d90611025908590600401611f0d565b60206040518083038186803b15801561103d57600080fd5b505afa158015611051573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110759190612270565b156110cd5760405162461bcd60e51b815260206004820152602260248201527f4261636b6564546f6b656e3a207370656e6465722069732073616e6374696f6e604482015261195960f21b60648201526084016105a9565b6108cf83838361173e565b6001600160a01b03831661113c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105a9565b6001600160a01b03821661119e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105a9565b6111a98383836117b2565b6001600160a01b038316600090815260656020526040902054818110156112215760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105a9565b6001600160a01b03808516600090815260656020526040808220858503905591851681529081208054849290611258908490612258565b92505081905550826001600160a01b0316846001600160a01b03166000805160206123ee8339815191528460405161129291815260200190565b60405180910390a35b50505050565b6001600160a01b0382166112f75760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105a9565b611303600083836117b2565b80606760008282546113159190612258565b90915550506001600160a01b03821660009081526065602052604081208054839290611342908490612258565b90915550506040518181526001600160a01b038316906000906000805160206123ee8339815191529060200160405180910390a35050565b600061138530610ebe565b15905090565b600054610100900460ff166113b25760405162461bcd60e51b81526004016105a9906122cf565b6106a382826119f3565b600054610100900460ff166113e35760405162461bcd60e51b81526004016105a9906122cf565b61090d611a41565b7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6114146104ac565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160408051601f198184030181529190528051602090910120609855565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166115465760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016105a9565b611552826000836117b2565b6001600160a01b038216600090815260656020526040902054818110156115c65760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016105a9565b6001600160a01b03831660009081526065602052604081208383039055606780548492906115f590849061231a565b90915550506040518281526000906001600160a01b038516906000805160206123ee8339815191529060200160405180910390a3505050565b8342111561164e5760405162461bcd60e51b81526004016105a990612331565b60006000805160206123ce83398151915288888861166b8c611a71565b8960405160200161168196959493929190612368565b6040516020818303038152906040528051906020012090506116a68882868686611aa2565b6116b18888886110d8565b5050505050505050565b834211156116db5760405162461bcd60e51b81526004016105a990612331565b600060008051602061240e8339815191528888886116f88c611a71565b8960405160200161170e96959493929190612368565b6040516020818303038152906040528051906020012090506117338882868686611aa2565b6116b1888888610ecd565b600061174a8484610d7a565b9050600019811461129b57818110156117a55760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016105a9565b61129b8484848403610ecd565b60cf5460ff16156118165760405162461bcd60e51b815260206004820152602860248201527f4261636b6564546f6b656e3a20746f6b656e207472616e73666572207768696c60448201526719481c185d5cd95960c21b60648201526084016105a9565b6001600160a01b0383161580159061183657506001600160a01b03821615155b156108cf5760cf5460405163df592f7d60e01b81526101009091046001600160a01b03169063df592f7d9061186f908690600401611f0d565b60206040518083038186803b15801561188757600080fd5b505afa15801561189b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118bf9190612270565b156119165760405162461bcd60e51b815260206004820152602160248201527f4261636b6564546f6b656e3a2073656e6465722069732073616e6374696f6e656044820152601960fa1b60648201526084016105a9565b60cf5460405163df592f7d60e01b81526101009091046001600160a01b03169063df592f7d9061194a908590600401611f0d565b60206040518083038186803b15801561196257600080fd5b505afa158015611976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199a9190612270565b156108cf5760405162461bcd60e51b815260206004820152602360248201527f4261636b6564546f6b656e3a2072656365697665722069732073616e6374696f6044820152621b995960ea1b60648201526084016105a9565b600054610100900460ff16611a1a5760405162461bcd60e51b81526004016105a9906122cf565b8151611a2d906068906020850190611e1f565b5080516108cf906069906020840190611e1f565b600054610100900460ff16611a685760405162461bcd60e51b81526004016105a9906122cf565b61090d33611494565b6001600160a01b0381166000908152609760205260408120805491829190611a988361239c565b9190505550919050565b6000611aeb6098548660405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b90506000611afb82868686611b5e565b9050866001600160a01b0316816001600160a01b031614610bf25760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016105a9565b6000806000611b6f87878787611b86565b91509150611b7c81611c69565b5095945050505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115611bb35750600090506003611c60565b8460ff16601b14158015611bcb57508460ff16601c14155b15611bdc5750600090506004611c60565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611c30573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611c5957600060019250925050611c60565b9150600090505b94509492505050565b6000816004811115611c7d57611c7d6123b7565b1415611c865750565b6001816004811115611c9a57611c9a6123b7565b1415611ce35760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016105a9565b6002816004811115611cf757611cf76123b7565b1415611d455760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016105a9565b6003816004811115611d5957611d596123b7565b1415611db25760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016105a9565b6004816004811115611dc657611dc66123b7565b1415610e425760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016105a9565b828054611e2b906121d2565b90600052602060002090601f016020900481019282611e4d5760008555611e93565b82601f10611e6657805160ff1916838001178555611e93565b82800160010185558215611e93579182015b82811115611e93578251825591602001919060010190611e78565b50611e9f929150611ea3565b5090565b5b80821115611e9f5760008155600101611ea4565b600060208083528351808285015260005b81811015611ee557858101830151858201604001528201611ec9565b81811115611ef7576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0391909116815260200190565b80356001600160a01b0381168114611f3857600080fd5b919050565b60008060408385031215611f5057600080fd5b611f5983611f21565b946020939093013593505050565b600080600060608486031215611f7c57600080fd5b611f8584611f21565b9250611f9360208501611f21565b9150604084013590509250925092565b600060208284031215611fb557600080fd5b611fbe82611f21565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112611fec57600080fd5b81356001600160401b038082111561200657612006611fc5565b604051601f8301601f19908116603f0116810190828211818310171561202e5761202e611fc5565b8160405283815286602085880101111561204757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561207a57600080fd5b82356001600160401b038082111561209157600080fd5b61209d86838701611fdb565b935060208501359150808211156120b357600080fd5b506120c085828601611fdb565b9150509250929050565b8015158114610e4257600080fd5b6000602082840312156120ea57600080fd5b8135611fbe816120ca565b600080600080600080600060e0888a03121561211057600080fd5b61211988611f21565b965061212760208901611f21565b95506040880135945060608801359350608088013560ff8116811461214b57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561217b57600080fd5b61218483611f21565b91506020830135612194816120ca565b809150509250929050565b600080604083850312156121b257600080fd5b6121bb83611f21565b91506121c960208401611f21565b90509250929050565b600181811c908216806121e657607f821691505b6020821081141561220757634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000821982111561226b5761226b612242565b500190565b60006020828403121561228257600080fd5b8151611fbe816120ca565b60208082526022908201527f4261636b6564546f6b656e3a20556e617574686f72697a65642064656c656761604082015261746560f01b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008282101561232c5761232c612242565b500390565b6020808252601d908201527f45524332305065726d69743a206578706972656420646561646c696e65000000604082015260600190565b9586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b60006000198214156123b0576123b0612242565b5060010190565b634e487b7160e01b600052602160045260246000fdfe4eba51a08f56c21035fcbda11b779f91748d3ae295b24c3e032d1eeff84edc2eddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9a2646970667358221220bd206ab6b38ec3a3ba1a4e1546b97ca73ee33cdcd02cc821d5bc0902fda7c62d64736f6c63430008090033608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61073f8061007e6000396000f3fe60806040526004361061006b5760003560e01c8063204e1c7a14610070578063715018a6146100a65780637eff275e146100bd5780638da5cb5b146100dd5780639623609d146100f257806399a88ec414610105578063f2fde38b14610125578063f3b7dead14610145575b600080fd5b34801561007c57600080fd5b5061009061008b3660046104f6565b610165565b60405161009d919061051a565b60405180910390f35b3480156100b257600080fd5b506100bb6101f6565b005b3480156100c957600080fd5b506100bb6100d836600461052e565b61023a565b3480156100e957600080fd5b506100906102cb565b6100bb61010036600461057d565b6102da565b34801561011157600080fd5b506100bb61012036600461052e565b610370565b34801561013157600080fd5b506100bb6101403660046104f6565b6103cb565b34801561015157600080fd5b506100906101603660046104f6565b61046b565b6000806000836001600160a01b031660405161018b90635c60da1b60e01b815260040190565b600060405180830381855afa9150503d80600081146101c6576040519150601f19603f3d011682016040523d82523d6000602084013e6101cb565b606091505b5091509150816101da57600080fd5b808060200190518101906101ee9190610652565b949350505050565b336101ff6102cb565b6001600160a01b03161461022e5760405162461bcd60e51b81526004016102259061066f565b60405180910390fd5b6102386000610491565b565b336102436102cb565b6001600160a01b0316146102695760405162461bcd60e51b81526004016102259061066f565b6040516308f2839760e41b81526001600160a01b03831690638f2839709061029590849060040161051a565b600060405180830381600087803b1580156102af57600080fd5b505af11580156102c3573d6000803e3d6000fd5b505050505050565b6000546001600160a01b031690565b336102e36102cb565b6001600160a01b0316146103095760405162461bcd60e51b81526004016102259061066f565b60405163278f794360e11b81526001600160a01b03841690634f1ef28690349061033990869086906004016106a4565b6000604051808303818588803b15801561035257600080fd5b505af1158015610366573d6000803e3d6000fd5b5050505050505050565b336103796102cb565b6001600160a01b03161461039f5760405162461bcd60e51b81526004016102259061066f565b604051631b2ce7f360e11b81526001600160a01b03831690633659cfe69061029590849060040161051a565b336103d46102cb565b6001600160a01b0316146103fa5760405162461bcd60e51b81526004016102259061066f565b6001600160a01b03811661045f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610225565b61046881610491565b50565b6000806000836001600160a01b031660405161018b906303e1469160e61b815260040190565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461046857600080fd5b60006020828403121561050857600080fd5b8135610513816104e1565b9392505050565b6001600160a01b0391909116815260200190565b6000806040838503121561054157600080fd5b823561054c816104e1565b9150602083013561055c816104e1565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060006060848603121561059257600080fd5b833561059d816104e1565b925060208401356105ad816104e1565b915060408401356001600160401b03808211156105c957600080fd5b818601915086601f8301126105dd57600080fd5b8135818111156105ef576105ef610567565b604051601f8201601f19908116603f0116810190838211818310171561061757610617610567565b8160405282815289602084870101111561063057600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561066457600080fd5b8151610513816104e1565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60018060a01b038316815260006020604081840152835180604085015260005b818110156106e0578581018301518582016060015282016106c4565b818111156106f2576000606083870101525b50601f01601f19169290920160600194935050505056fea264697066735822122070d0c93b6baf64dd12c3358cdb190d1a870fbe0a99f8468f6102e4f9bbd87b8864736f6c63430008090033000000000000000000000000e0769afdae719046fd2342403d77d1eaf0740596
Deployed Bytecode
0x60806040523480156200001157600080fd5b50600436106200006a5760003560e01c80632f3a3d5d146200006f5780633e47158c146200009b578063715018a614620000af5780638da5cb5b14620000bb57806396fc1c1114620000c5578063f2fde38b14620000dc575b600080fd5b60025462000083906001600160a01b031681565b6040516200009291906200063b565b60405180910390f35b60015462000083906001600160a01b031681565b620000b9620000f3565b005b620000836200013e565b62000083620000d636600462000716565b6200014d565b620000b9620000ed366004620007dd565b62000534565b33620000fe6200013e565b6001600160a01b031614620001305760405162461bcd60e51b8152600401620001279062000802565b60405180910390fd5b6200013c6000620005dd565b565b6000546001600160a01b031690565b6000336200015a6200013e565b6001600160a01b031614620001835760405162461bcd60e51b8152600401620001279062000802565b6001600160a01b03861615801590620001a457506001600160a01b03851615155b8015620001b957506001600160a01b03841615155b8015620001ce57506001600160a01b03831615155b6200021c5760405162461bcd60e51b815260206004820181905260248201527f466163746f72793a20616464726573732073686f756c64206e6f742062652030604482015260640162000127565b60008888604051602001620002339291906200086a565b60408051601f1981840301815290829052805160209091012060025460015491935060009284926001600160a01b0392831692169063266c45bb60e11b9062000283908f908f90602401620008cb565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051620002c2906200062d565b620002d093929190620008fd565b8190604051809103906000f5905080158015620002f1573d6000803e3d6000fd5b50604051637e51dad560e11b815290915081906001600160a01b0382169063fca3b5aa9062000325908b906004016200063b565b600060405180830381600087803b1580156200034057600080fd5b505af115801562000355573d6000803e3d6000fd5b50506040516354cb6b6760e11b81526001600160a01b038416925063a996d6ce915062000387908a906004016200063b565b600060405180830381600087803b158015620003a257600080fd5b505af1158015620003b7573d6000803e3d6000fd5b50506040516316c457a560e11b81526001600160a01b0384169250632d88af4a9150620003e99089906004016200063b565b600060405180830381600087803b1580156200040457600080fd5b505af115801562000419573d6000803e3d6000fd5b50506040516349dc5e8d60e01b81526001600160a01b03841692506349dc5e8d91506200044b9088906004016200063b565b600060405180830381600087803b1580156200046657600080fd5b505af11580156200047b573d6000803e3d6000fd5b505060405163f2fde38b60e01b81526001600160a01b038416925063f2fde38b9150620004ad908c906004016200063b565b600060405180830381600087803b158015620004c857600080fd5b505af1158015620004dd573d6000803e3d6000fd5b50505050806001600160a01b03167fc3d0a20a44bb0f367823c0b8747497ad98c62f65bc0a1ddf9d6db910ad9fbd418c8c6040516200051e929190620008cb565b60405180910390a29a9950505050505050505050565b336200053f6200013e565b6001600160a01b031614620005685760405162461bcd60e51b8152600401620001279062000802565b6001600160a01b038116620005cf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000127565b620005da81620005dd565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610f5f806200092c83390190565b6001600160a01b0391909116815260200190565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200067757600080fd5b81356001600160401b03808211156200069457620006946200064f565b604051601f8301601f19908116603f01168101908282118183101715620006bf57620006bf6200064f565b81604052838152866020858801011115620006d957600080fd5b836020870160208301376000602085830101528094505050505092915050565b80356001600160a01b03811681146200071157600080fd5b919050565b600080600080600080600060e0888a0312156200073257600080fd5b87356001600160401b03808211156200074a57600080fd5b620007588b838c0162000665565b985060208a01359150808211156200076f57600080fd5b506200077e8a828b0162000665565b9650506200078f60408901620006f9565b94506200079f60608901620006f9565b9350620007af60808901620006f9565b9250620007bf60a08901620006f9565b9150620007cf60c08901620006f9565b905092959891949750929550565b600060208284031215620007f057600080fd5b620007fb82620006f9565b9392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60005b83811015620008545781810151838201526020016200083a565b8381111562000864576000848401525b50505050565b600083516200087e81846020880162000837565b8351908301906200089481836020880162000837565b01949350505050565b60008151808452620008b781602086016020860162000837565b601f01601f19169290920160200192915050565b604081526000620008e060408301856200089d565b8281036020840152620008f481856200089d565b95945050505050565b6001600160a01b03848116825283166020820152606060408201819052600090620008f4908301846200089d56fe608060405260405162000f5f38038062000f5f83398101604081905262000026916200051f565b82828282816200005860017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005ff565b60008051602062000f188339815191521462000078576200007862000625565b6200008682826000620000ed565b50620000b6905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005ff565b60008051602062000ef883398151915214620000d657620000d662000625565b620000e1826200012a565b5050505050506200068e565b620000f88362000185565b600082511180620001065750805b156200012557620001238383620001c760201b620002601760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f62000155620001f6565b604080516001600160a01b03928316815291841660208301520160405180910390a162000182816200022f565b50565b6200019081620002e4565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001ef838360405180606001604052806027815260200162000f386027913962000387565b9392505050565b60006200022060008051602062000ef883398151915260001b6200046d60201b620002081760201c565b546001600160a01b0316919050565b6001600160a01b0381166200029a5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002c360008051602062000ef883398151915260001b6200046d60201b620002081760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002fa816200047060201b6200028c1760201c565b6200035e5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840162000291565b80620002c360008051602062000f1883398151915260001b6200046d60201b620002081760201c565b60606001600160a01b0384163b620003f15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840162000291565b600080856001600160a01b0316856040516200040e91906200063b565b600060405180830381855af49150503d80600081146200044b576040519150601f19603f3d011682016040523d82523d6000602084013e62000450565b606091505b509092509050620004638282866200047f565b9695505050505050565b90565b6001600160a01b03163b151590565b6060831562000490575081620001ef565b825115620004a15782518084602001fd5b8160405162461bcd60e51b815260040162000291919062000659565b80516001600160a01b0381168114620004d557600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200050d578181015183820152602001620004f3565b83811115620001235750506000910152565b6000806000606084860312156200053557600080fd5b6200054084620004bd565b92506200055060208501620004bd565b60408501519092506001600160401b03808211156200056e57600080fd5b818601915086601f8301126200058357600080fd5b815181811115620005985762000598620004da565b604051601f8201601f19908116603f01168101908382118183101715620005c357620005c3620004da565b81604052828152896020848701011115620005dd57600080fd5b620005f0836020830160208801620004f0565b80955050505050509250925092565b6000828210156200062057634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b600082516200064f818460208701620004f0565b9190910192915050565b60208152600082518060208401526200067a816040850160208701620004f0565b601f01601f19169190910160400192915050565b61085a806200069e6000396000f3fe60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106a5565b610118565b61005b6100933660046106c0565b61015f565b3480156100a457600080fd5b506100ad6101d0565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106a5565b61020b565b3480156100f557600080fd5b506100ad610235565b61010661029b565b61011661011161033a565b610344565b565b610120610368565b6001600160a01b0316336001600160a01b031614156101575761015481604051806020016040528060008152506000610389565b50565b6101546100fe565b610167610368565b6001600160a01b0316336001600160a01b031614156101c8576101c38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610389915050565b505050565b6101c36100fe565b60006101da610368565b6001600160a01b0316336001600160a01b03161415610200576101fb61033a565b905090565b6102086100fe565b90565b610213610368565b6001600160a01b0316336001600160a01b0316141561015757610154816103b4565b600061023f610368565b6001600160a01b0316336001600160a01b03161415610200576101fb610368565b606061028583836040518060600160405280602781526020016107fe60279139610408565b9392505050565b6001600160a01b03163b151590565b6102a3610368565b6001600160a01b0316336001600160a01b031614156101165760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b60006101fb6104e3565b3660008037600080366000845af43d6000803e808015610363573d6000f35b3d6000fd5b60006000805160206107be8339815191525b546001600160a01b0316919050565b610392836104f9565b60008251118061039f5750805b156101c3576103ae8383610260565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103dd610368565b604080516001600160a01b03928316815291841660208301520160405180910390a161015481610539565b60606104138461028c565b61046e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610331565b600080856001600160a01b031685604051610489919061076e565b600060405180830381855af49150503d80600081146104c4576040519150601f19603f3d011682016040523d82523d6000602084013e6104c9565b606091505b50915091506104d98282866105d0565b9695505050505050565b60006000805160206107de83398151915261037a565b61050281610609565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b03811661059e5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610331565b806000805160206107be8339815191525b80546001600160a01b0319166001600160a01b039290921691909117905550565b606083156105df575081610285565b8251156105ef5782518084602001fd5b8160405162461bcd60e51b8152600401610331919061078a565b6106128161028c565b6106745760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610331565b806000805160206107de8339815191526105af565b80356001600160a01b03811681146106a057600080fd5b919050565b6000602082840312156106b757600080fd5b61028582610689565b6000806000604084860312156106d557600080fd5b6106de84610689565b925060208401356001600160401b03808211156106fa57600080fd5b818601915086601f83011261070e57600080fd5b81358181111561071d57600080fd5b87602082850101111561072f57600080fd5b6020830194508093505050509250925092565b60005b8381101561075d578181015183820152602001610745565b838111156103ae5750506000910152565b60008251610780818460208701610742565b9190910192915050565b60208152600082518060208401526107a9816040850160208701610742565b601f01601f1916919091016040019291505056feb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220694e092fe08ffc1f86eb541c6a52a2af6e6ed5d9931bff00c4b07970e133142664736f6c63430008090033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212205a6f00bd8663d1492bc05e0491c99a6696bba346db4f008cc33328846e701f5a64736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000e0769afdae719046fd2342403d77d1eaf0740596
-----Decoded View---------------
Arg [0] : proxyAdminOwner (address): 0xE0769AfDae719046fd2342403d77d1EAF0740596
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000e0769afdae719046fd2342403d77d1eaf0740596
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
[ 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.