Contract
0x7Cd98120D44964cCB670F26DC5E3fdE23f345E23
10
Contract Overview
My Name Tag:
Not Available
[ Download CSV Export ]
Latest 1 internal transaction
Parent Txn Hash | Block | From | To | Value | |||
---|---|---|---|---|---|---|---|
0x574599ee35954ba88cc77f956ac554ca62932d8285e880f26675daef11589e8e | 100524875 | 174 days 15 hrs ago | 0x7cd98120d44964ccb670f26dc5e3fde23f345e23 | Contract Creation | 0 ETH |
[ Download CSV Export ]
Contract Name:
LiquidStake
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 800 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (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 Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { 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.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.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.openzeppelin.com/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 ERC20 is Context, IERC20, IERC20Metadata { 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. */ constructor(string memory name_, string memory symbol_) { _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, allowance(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 = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * 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; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _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; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _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; // Overflow not possible: amount <= accountBalance <= totalSupply. _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 Updates `owner` s allowance for `spender` based on spent `amount`. * * 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 {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/extensions/draft-ERC20Permit.sol) pragma solidity ^0.8.0; import "./draft-IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/cryptography/EIP712.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @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.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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 /// @solidity memory-safe-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/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.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 ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } 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"); } } /** * @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) { 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. /// @solidity memory-safe-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 { 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 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", Strings.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 (last updated v4.8.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; contract FlashCollateralToken is ERC20, ERC20Burnable, ERC20Permit, Ownable { uint8 private immutable dec; constructor(string memory _tokenName, string memory _tokenSymbol, uint8 _decimals) ERC20(_tokenName, _tokenSymbol) ERC20Permit(_tokenName) { dec = _decimals; } function mint(address to, uint256 amount) public onlyOwner { _mint(to, amount); } function burnOwner(address _from, uint256 amount) public onlyOwner { _burn(_from, amount); } function decimals() public view override returns (uint8) { return dec; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.4; interface IFlashNFT { function approve(address to, uint256 tokenId) external; function balanceOf(address owner) external view returns (uint256); function burn(uint256 _tokenId) external returns (bool); function contractURI() external pure returns (string memory); function exists(uint256 _tokenId) external view returns (bool); function getApproved(uint256 tokenId) external view returns (address); function isApprovedForAll(address owner, address operator) external view returns (bool); function mint(address _recipientAddress) external returns (uint256); function name() external view returns (string memory); function owner() external view returns (address); function ownerOf(uint256 tokenId) external view returns (address); function renounceOwnership() external; function safeTransferFrom( address from, address to, uint256 tokenId ) external; function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata _data ) external; function setApprovalForAll(address operator, bool approved) external; function supportsInterface(bytes4 interfaceId) external view returns (bool); function symbol() external view returns (string memory); function tokenURI(uint256 tokenId) external view returns (string memory); function totalSupply() external view returns (uint256); function transferFrom( address from, address to, uint256 tokenId ) external; function transferOwnership(address newOwner) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.4; interface IFlashProtocol { event StrategyRegistered( address indexed _strategyAddress, address indexed _principalTokenAddress, address indexed _fTokenAddress ); event Staked(uint256 _stakeId); event Unstaked(uint256 _stakeId, uint256 _tokensReturned, uint256 _fTokensBurned, bool _stakeFinished); event NFTIssued(uint256 _stakeId, uint256 nftId); struct StakeStruct { address stakerAddress; // Address of staker address strategyAddress; // Address of strategy being used uint256 stakeStartTs; // Unix timestamp of when stake started uint256 stakeDuration; // Time in seconds from start time until stake ends uint256 stakedAmount; // The amount of tokens staked bool active; // Stake has been removed/unstaked uint256 nftId; // NFT id if set uint256 fTokensToUser; // How many fERC20 tokens were minted uint256 fTokensFee; // How many fERC20 tokens were taken as fee uint256 totalFTokenBurned; uint256 totalStakedWithdrawn; } function flashNFTAddress() external view returns (address); function flashStake( address _strategyAddress, uint256 _tokenAmount, uint256 _stakeDuration, uint256 _minimumReceived, address _yieldTo, bool _mintNFT ) external; function getStakeInfo(uint256 _id, bool _isNFT) external view returns (StakeStruct memory _stake); function issueNFT(uint256 _stakeId) external returns (uint256 _nftId); function owner() external view returns (address); function registerStrategy( address _strategyAddress, address _principalTokenAddress, string calldata _fTokenName, string calldata _fTokenSymbol ) external; function renounceOwnership() external; function setMintFeeInfo(address _feeRecipient, uint96 _feePercentageBasis) external; function stake( address _strategyAddress, uint256 _tokenAmount, uint256 _stakeDuration, address _fTokensTo, bool _issueNFT ) external returns (StakeStruct memory _stake); function transferOwnership(address newOwner) external; function unstake( uint256 _id, bool _isNFT, uint256 _fTokenToBurn ) external returns (uint256 _principalReturned, uint256 _fTokensBurned); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; interface IFlashStrategy { event BurnedFToken(address indexed _address, uint256 _tokenAmount, uint256 _yieldReturned); // This is how principal will be deposited into the contract // The Flash protocol allows the strategy to specify how much // should be registered. This allows the strategy to manipulate (eg take fee) // on the principal if the strategy requires function depositPrincipal(uint256 _tokenAmount) external returns (uint256); // This is how principal will be returned from the contract function withdrawPrincipal(uint256 _tokenAmount) external; // Responsible for instant upfront yield. Takes fERC20 tokens specific to this // strategy. The strategy is responsible for returning some amount of principal tokens function burnFToken( uint256 _tokenAmount, uint256 _minimumReturned, address _yieldTo ) external returns (uint256); // This should return the current total of all principal within the contract function getPrincipalBalance() external view returns (uint256); // This should return the current total of all yield generated to date (including bootstrapped tokens) function getYieldBalance() external view returns (uint256); // This should return the principal token address (eg DAI) function getPrincipalAddress() external view returns (address); // View function which quotes how many principal tokens would be returned if x // fERC20 tokens are burned function quoteMintFToken(uint256 _tokenAmount, uint256 duration) external view returns (uint256); // View function which quotes how many principal tokens would be returned if x // fERC20 tokens are burned // IMPORTANT NOTE: This should utilise bootstrap tokens if they exist // bootstrapped tokens are any principal tokens that exist within the smart contract function quoteBurnFToken(uint256 _tokenAmount) external view returns (uint256); // The function to set the fERC20 address within the strategy function setFTokenAddress(address _fTokenAddress) external; // This should return what the maximum stake duration is function getMaxStakeDuration() external view returns (uint256); function getFTokenAddress() external view returns (address); }
// SPDX-License-Identifier: BUSL-1.1 // Licensor: Flashstake DAO // Licensed Works: (this contract, source below) // Change Date: The earlier of 2027-05-23 or a date specified by Flashstake DAO publicly // Change License: GNU General Public License v2.0 or later pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/Flashstake/IFlashNFT.sol"; import "./interfaces/Flashstake/IFlashStrategy.sol"; import "./interfaces/Flashstake/IFlashProtocol.sol"; import "./FlashCollateralToken.sol"; contract LiquidStake is Ownable { using SafeERC20 for IERC20Metadata; // Immutable/constant variables address immutable public flashProtocolAddress; address immutable public flashNFTAddress; address constant public auctionExchangeToken = 0xc628534100180582E43271448098cb2c185795BD; uint256 constant public auctionDuration = 604838; // 7 days and 38 seconds uint256 constant public auctionStartBid = 1500000 * (10**18); // 1.5M uint256 constant public auctionDecayPerSecond = 248 * (10**16); // (2.48) uint256 constant public flashtronautDiscountBp = 9000; // 9000 = 90% of original price (10% discount) // Dynamic variables mapping(address => address) public strategyFCTokenAddresses; mapping(uint256 => address) public originalDepositorAddress; mapping(uint256 => uint256) public originalDepositTimestamp; // Owner controlled address public auctionTokensDestination; address public flashtronautNFTAddress; // Events event AuctionTokensDestinationUpdated(address _newAuctionTokensDestination); event PositionDeposit(uint256 _nftId); event PositionWithdraw(uint256 _nftId); event PositionPartialWithdraw(uint256 _nftId, uint256 _fTokensBurned, uint256 _fcTokensBurned); event AuctionPurchase(uint256 _nftId, uint256 _flashtronautNftId, uint256 _fcTokensBurned, uint256 _premiumPaid); constructor(address _flashProtocolAddress) { flashProtocolAddress = _flashProtocolAddress; flashNFTAddress = IFlashProtocol(_flashProtocolAddress).flashNFTAddress(); } /// @notice Allows user to deposit FlashNFT to mint fcTokens /// @dev this can be called by anyone function depositPosition(uint256 _nftId, address _fcTokensTo) public returns(address, uint256) { IFlashNFT(flashNFTAddress).transferFrom(msg.sender, address(this), _nftId); IFlashProtocol.StakeStruct memory stakeInfo = IFlashProtocol(flashProtocolAddress).getStakeInfo(_nftId, true); address flashFCToken = strategyFCTokenAddresses[stakeInfo.strategyAddress]; require(flashFCToken != address(0), "STRATEGY NOT INIT"); originalDepositorAddress[_nftId] = msg.sender; originalDepositTimestamp[_nftId] = block.timestamp; uint256 remainingPrincipal = stakeInfo.stakedAmount - stakeInfo.totalStakedWithdrawn; FlashCollateralToken(flashFCToken).mint(_fcTokensTo, remainingPrincipal); emit PositionDeposit(_nftId); return (flashFCToken, remainingPrincipal); } /// @notice Allows original depositor to pay back fcToken in return for FlashNFT /// @dev this can be called by anyone but only original depositor can withdraw FlashNFT function withdrawPositionOwner(uint256 _nftId, address _nftTo) external { IFlashProtocol.StakeStruct memory stakeInfo = IFlashProtocol(flashProtocolAddress).getStakeInfo(_nftId, true); address flashFCToken = strategyFCTokenAddresses[stakeInfo.strategyAddress]; require(flashFCToken != address(0), "STRATEGY NOT INIT"); require(originalDepositorAddress[_nftId] == msg.sender, "ONLY ORIGINAL DEPOSITOR"); uint256 remainingPrincipal = stakeInfo.stakedAmount - stakeInfo.totalStakedWithdrawn; FlashCollateralToken(flashFCToken).burnOwner(msg.sender, remainingPrincipal); IFlashNFT(flashNFTAddress).transferFrom(address(this), _nftTo, _nftId); emit PositionWithdraw(_nftId); } /// @notice Allows original depositor to pay back fcToken and fTokens to partially withdraw principal from FlashNFT /// @dev this can be called by anyone but only original depositor can partial withdraw from FlashNFT function partialWithdrawOwner(uint256 _nftId, uint256 _fTokensToBurn, address _withdrawTo) external returns (uint256) { IFlashProtocol.StakeStruct memory stakeInfo = IFlashProtocol(flashProtocolAddress).getStakeInfo(_nftId, true); address flashFCToken = strategyFCTokenAddresses[stakeInfo.strategyAddress]; require(flashFCToken != address(0), "STRATEGY NOT INIT"); require(originalDepositorAddress[_nftId] == msg.sender, "ONLY ORIGINAL DEPOSITOR"); address flashFTokenAddress = IFlashStrategy(stakeInfo.strategyAddress).getFTokenAddress(); IERC20Metadata(flashFTokenAddress).safeTransferFrom(msg.sender, address(this), _fTokensToBurn); IERC20Metadata(flashFTokenAddress).approve(flashProtocolAddress, _fTokensToBurn); IFlashProtocol(flashProtocolAddress).unstake(_nftId, true, _fTokensToBurn); address principalTokenAddress = IFlashStrategy(stakeInfo.strategyAddress).getPrincipalAddress(); uint256 principalBalance = IERC20Metadata(principalTokenAddress).balanceOf(address(this)); FlashCollateralToken(flashFCToken).burnOwner(msg.sender, principalBalance); IERC20Metadata(principalTokenAddress).safeTransfer(_withdrawTo, principalBalance); uint256 remainingFTokenBalance = IERC20Metadata(flashFTokenAddress).balanceOf(address(this)); IERC20Metadata(flashFTokenAddress).safeTransfer(msg.sender, remainingFTokenBalance); emit PositionPartialWithdraw(_nftId, (_fTokensToBurn - remainingFTokenBalance), principalBalance); return principalBalance; } /// @notice Deploys a fcToken for a given strategy address /// @dev this can be called by anyone. Should be called once per strategy address function initialiseStrategy(address _fsAddress) external returns(address) { require(strategyFCTokenAddresses[_fsAddress] == address(0), "STRATEGY ALREADY INIT"); string memory principalSymbol = IERC20Metadata(IFlashStrategy(_fsAddress).getPrincipalAddress()).symbol(); uint8 principalDecimals = IERC20Metadata(IFlashStrategy(_fsAddress).getPrincipalAddress()).decimals(); string memory tokenName = string(abi.encodePacked("Flashstake Collateral ", principalSymbol)); string memory tokenSymbol = string(abi.encodePacked("fc-", principalSymbol)); FlashCollateralToken flashFCToken = new FlashCollateralToken(tokenName, tokenSymbol, principalDecimals); strategyFCTokenAddresses[_fsAddress] = address(flashFCToken); return strategyFCTokenAddresses[_fsAddress]; } /// @notice Computes and returns current auction cost, returns fcTokensRequired and currentPremium /// @dev this can be called by anyone function getCurrentAuctionCost(uint256 _nftId, uint256 _flashtronautNftId) public view returns(uint256 fcTokensRequired, uint256 currentPremium) { IFlashProtocol.StakeStruct memory stakeInfo = IFlashProtocol(flashProtocolAddress).getStakeInfo(_nftId, true); fcTokensRequired = stakeInfo.stakedAmount - stakeInfo.totalStakedWithdrawn; uint256 startOfAuctionTs = stakeInfo.stakeStartTs + stakeInfo.stakeDuration; if(originalDepositTimestamp[_nftId] > startOfAuctionTs) { startOfAuctionTs = originalDepositTimestamp[_nftId]; } require(block.timestamp >= startOfAuctionTs, "AUCTION NOT STARTED"); uint256 endOfAuctionTs = startOfAuctionTs + auctionDuration; if(block.timestamp > endOfAuctionTs) { return (fcTokensRequired, currentPremium); } currentPremium = auctionStartBid - ((block.timestamp - startOfAuctionTs) * auctionDecayPerSecond); if(_flashtronautNftId > 0) { require(msg.sender == IFlashNFT(flashtronautNFTAddress).ownerOf(_flashtronautNftId), "MISSING FLASHTRONAUT"); // Compute discount currentPremium = (currentPremium * flashtronautDiscountBp) / 10000; } } /// @notice Purchases FlashNFT by burning fcTokens from User /// @dev this can be called by anyone function auctionPurchase(uint256 _nftId, uint256 _flashtronautNftId) external { (uint256 fcTokensRequired, uint256 premium) = getCurrentAuctionCost(_nftId, _flashtronautNftId); IFlashProtocol.StakeStruct memory stakeInfo = IFlashProtocol(flashProtocolAddress).getStakeInfo(_nftId, true); address flashFCToken = strategyFCTokenAddresses[stakeInfo.strategyAddress]; require(flashFCToken != address(0), "STRATEGY NOT INIT"); IERC20Metadata(auctionExchangeToken).safeTransferFrom(msg.sender, auctionTokensDestination, premium); FlashCollateralToken(flashFCToken).burnOwner(msg.sender, fcTokensRequired); IFlashNFT(flashNFTAddress).transferFrom(address(this), msg.sender, _nftId); emit AuctionPurchase(_nftId, _flashtronautNftId, fcTokensRequired, premium); } // ================================= // Owner Functions // ================================= /// @notice Sets the destination address for where auction premiums are sent /// @dev this can only be called by the Owner function setAuctionTokensDestination(address _newAuctionTokensDestination) external onlyOwner { auctionTokensDestination = _newAuctionTokensDestination; emit AuctionTokensDestinationUpdated(_newAuctionTokensDestination); } /// @notice Sets the Flashtronaut NFT address (which give auction discounts) /// @dev this can only be called by the Owner function setFlashtronautNFTAddress(address _newFlashtronautNFTAddress) external onlyOwner { flashtronautNFTAddress = _newFlashtronautNFTAddress; } // ================================= // Helper/Frontend View Functions // ================================= /// @notice Returns the number of fcTokens minted /// @dev this can be called by anyone function quoteFCTokens(uint256 _nftId) external view returns(uint256 _fcTokensMinted) { IFlashProtocol.StakeStruct memory stakeInfo = IFlashProtocol(flashProtocolAddress).getStakeInfo(_nftId, true); return stakeInfo.stakedAmount - stakeInfo.totalStakedWithdrawn; } /// @notice Returns whether the auction has started along with the timestamp when the auction starts /// @dev this can be called by anyone function getAuctionStartDetails(uint256 _nftId) external view returns(bool _started, uint256 _startTimestamp) { IFlashProtocol.StakeStruct memory stakeInfo = IFlashProtocol(flashProtocolAddress).getStakeInfo(_nftId, true); require(IFlashNFT(flashNFTAddress).ownerOf(_nftId) == address(this), "POSITION NOT AVAILABLE"); _startTimestamp = stakeInfo.stakeStartTs + stakeInfo.stakeDuration; if(originalDepositTimestamp[_nftId] > _startTimestamp) { _startTimestamp = originalDepositTimestamp[_nftId]; } _started = false; if(block.timestamp > _startTimestamp) { _started = true; } } }
{ "metadata": { "bytecodeHash": "none" }, "optimizer": { "enabled": true, "runs": 800 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"_flashProtocolAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_nftId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_flashtronautNftId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_fcTokensBurned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_premiumPaid","type":"uint256"}],"name":"AuctionPurchase","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_newAuctionTokensDestination","type":"address"}],"name":"AuctionTokensDestinationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_nftId","type":"uint256"}],"name":"PositionDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_nftId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_fTokensBurned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_fcTokensBurned","type":"uint256"}],"name":"PositionPartialWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_nftId","type":"uint256"}],"name":"PositionWithdraw","type":"event"},{"inputs":[],"name":"auctionDecayPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionExchangeToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"},{"internalType":"uint256","name":"_flashtronautNftId","type":"uint256"}],"name":"auctionPurchase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"auctionStartBid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionTokensDestination","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"},{"internalType":"address","name":"_fcTokensTo","type":"address"}],"name":"depositPosition","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flashNFTAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flashProtocolAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flashtronautDiscountBp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flashtronautNFTAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"}],"name":"getAuctionStartDetails","outputs":[{"internalType":"bool","name":"_started","type":"bool"},{"internalType":"uint256","name":"_startTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"},{"internalType":"uint256","name":"_flashtronautNftId","type":"uint256"}],"name":"getCurrentAuctionCost","outputs":[{"internalType":"uint256","name":"fcTokensRequired","type":"uint256"},{"internalType":"uint256","name":"currentPremium","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_fsAddress","type":"address"}],"name":"initialiseStrategy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"originalDepositTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"originalDepositorAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"},{"internalType":"uint256","name":"_fTokensToBurn","type":"uint256"},{"internalType":"address","name":"_withdrawTo","type":"address"}],"name":"partialWithdrawOwner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"}],"name":"quoteFCTokens","outputs":[{"internalType":"uint256","name":"_fcTokensMinted","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newAuctionTokensDestination","type":"address"}],"name":"setAuctionTokensDestination","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newFlashtronautNFTAddress","type":"address"}],"name":"setFlashtronautNFTAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"strategyFCTokenAddresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"},{"internalType":"address","name":"_nftTo","type":"address"}],"name":"withdrawPositionOwner","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60c06040523480156200001157600080fd5b5060405162003e5838038062003e58833981016040819052620000349162000113565b6200003f33620000c3565b6001600160a01b038116608081905260408051631ae8718760e21b81529051636ba1c61c916004808201926020929091908290030181865afa1580156200008a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000b0919062000113565b6001600160a01b031660a0525062000145565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156200012657600080fd5b81516001600160a01b03811681146200013e57600080fd5b9392505050565b60805160a051613c92620001c660003960008181610305015281816104d5015281816107e40152818161168701526118ec0152600081816102dd01528181610551015281816107520152818161095901528181610b3301528181610bd7015281816111f8015281816114980152818161176301526119ce0152613c926000f3fe60806040523480156200001157600080fd5b5060043610620001c55760003560e01c80637a9bed111162000101578063a4b25ac911620000a3578063ecea4382116200007a578063ecea43821462000457578063ed3961421462000461578063f269912a1462000478578063f2fde38b146200048f57600080fd5b8063a4b25ac914620003f1578063b0cc377f1462000414578063de16edd8146200044057600080fd5b80638da5cb5b11620000d85780638da5cb5b146200039f578063a1adeef014620003b1578063a21d124414620003c457600080fd5b80637a9bed111462000345578063878f51ac146200035c57806389970481146200038857600080fd5b806341348e39116200016b5780636ba1c61c11620001425780636ba1c61c14620002ff578063715018a614620003275780637299cb33146200033157600080fd5b806341348e3914620002a757806364ddce8714620002c05780636667d6e814620002d757600080fd5b80632d6d2e1711620001a05780632d6d2e17146200025457806332005701146200028357806334b3ff0f146200029357600080fd5b80630cbf54c814620001ca5780631176c18614620001e85780631d36d0b8146200021f575b600080fd5b620001d562093aa681565b6040519081526020015b60405180910390f35b620001ff620001f936600462001f40565b620004a6565b604080516001600160a01b039093168352602083019190915201620001df565b6200023b73c628534100180582e43271448098cb2c185795bd81565b6040516001600160a01b039091168152602001620001df565b6200026b6200026536600462001f73565b62000727565b604080519215158352602083019190915201620001df565b620001d567226abadc42f8000081565b6004546200023b906001600160a01b031681565b620002be620002b836600462001f8d565b62000904565b005b620001d5620002d136600462001fad565b62000930565b6200023b7f000000000000000000000000000000000000000000000000000000000000000081565b6200023b7f000000000000000000000000000000000000000000000000000000000000000081565b620002be62000e88565b6005546200023b906001600160a01b031681565b6200023b6200035636600462001f8d565b62000ea0565b6200023b6200036d36600462001f8d565b6001602052600090815260409020546001600160a01b031681565b620002be6200039936600462001f8d565b6200116f565b6000546001600160a01b03166200023b565b620001d56a013da329b633647180000081565b620003db620003d536600462001fe9565b620011cd565b60408051928352602083019190915201620001df565b620001d56200040236600462001f73565b60036020526000908152604090205481565b6200023b6200042536600462001f73565b6002602052600090815260409020546001600160a01b031681565b620002be6200045136600462001f40565b62001479565b620001d561232881565b620002be6200047236600462001fe9565b62001728565b620001d56200048936600462001f73565b620019a5565b620002be620004a036600462001f8d565b62001a5d565b6040516323b872dd60e01b81523360048201523060248201526044810183905260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906323b872dd90606401600060405180830381600087803b1580156200051a57600080fd5b505af11580156200052f573d6000803e3d6000fd5b50506040516241614f60e81b81526004810187905260016024820152600092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691506341614f009060440161016060405180830381865afa158015620005a3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005c9919062002072565b6020808201516001600160a01b03908116600090815260019092526040909120549192501680620006355760405162461bcd60e51b815260206004820152601160248201527014d51490551151d6481393d50812539255607a1b60448201526064015b60405180910390fd5b600086815260026020908152604080832080546001600160a01b0319163317905560039091528120429055610140830151608084015162000677919062002135565b6040516340c10f1960e01b81526001600160a01b03888116600483015260248201839052919250908316906340c10f1990604401600060405180830381600087803b158015620006c657600080fd5b505af1158015620006db573d6000803e3d6000fd5b505050507f2665a7eb7a83f5fb98376e6b342304798c72a903e56cb1750520455e3b4459c9876040516200071191815260200190565b60405180910390a19093509150505b9250929050565b6040516241614f60e81b81526004810182905260016024820152600090819081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906341614f009060440161016060405180830381865afa1580156200079b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007c1919062002072565b6040516331a9108f60e11b81526004810186905290915030906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690636352211e90602401602060405180830381865afa1580156200082c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000852919062002151565b6001600160a01b031614620008aa5760405162461bcd60e51b815260206004820152601660248201527f504f534954494f4e204e4f5420415641494c41424c450000000000000000000060448201526064016200062c565b80606001518160400151620008c0919062002171565b600085815260036020526040902054909250821015620008ec5760008481526003602052604090205491505b6000925081421115620008fe57600192505b50915091565b6200090e62001af3565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6040516241614f60e81b8152600481018490526001602482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906341614f009060440161016060405180830381865afa158015620009a2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620009c8919062002072565b6020808201516001600160a01b0390811660009081526001909252604090912054919250168062000a305760405162461bcd60e51b815260206004820152601160248201527014d51490551151d6481393d50812539255607a1b60448201526064016200062c565b6000868152600260205260409020546001600160a01b0316331462000a985760405162461bcd60e51b815260206004820152601760248201527f4f4e4c59204f524947494e414c204445504f5349544f5200000000000000000060448201526064016200062c565b600082602001516001600160a01b031663272d28ca6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000add573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b03919062002151565b905062000b1c6001600160a01b03821633308962001b4f565b60405163095ea7b360e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301526024820188905282169063095ea7b3906044016020604051808303816000875af115801562000b8c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000bb2919062002187565b50604051635b64f39160e01b81526004810188905260016024820152604481018790527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635b64f3919060640160408051808303816000875af115801562000c28573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c4e9190620021a5565b5050600083602001516001600160a01b03166345ed7f336040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000c95573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000cbb919062002151565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a0823190602401602060405180830381865afa15801562000d06573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000d2c9190620021ca565b60405163b6c0525560e01b8152336004820152602481018290529091506001600160a01b0385169063b6c0525590604401600060405180830381600087803b15801562000d7857600080fd5b505af115801562000d8d573d6000803e3d6000fd5b5062000da8925050506001600160a01b038316888362001bef565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa15801562000df0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000e169190620021ca565b905062000e2e6001600160a01b038516338362001bef565b7f38e825fd7de12f3c23b38d9c8b0ff0bdc318aaf1067078474dbba99756244b3b8a62000e5c838c62002135565b604080519283526020830191909152810184905260600160405180910390a15098975050505050505050565b62000e9262001af3565b62000e9e600062001c26565b565b6001600160a01b038181166000908152600160205260408120549091161562000f0c5760405162461bcd60e51b815260206004820152601560248201527f535452415445475920414c524541445920494e4954000000000000000000000060448201526064016200062c565b6000826001600160a01b03166345ed7f336040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000f4d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f73919062002151565b6001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa15801562000fb1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000fdb91908101906200220a565b90506000836001600160a01b03166345ed7f336040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200101e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001044919062002151565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562001082573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010a89190620022b8565b9050600082604051602001620010bf9190620022dd565b6040516020818303038152906040529050600083604051602001620010e5919062002324565b60405160208183030381529060405290506000828285604051620011099062001f1c565b62001117939291906200237f565b604051809103906000f08015801562001134573d6000803e3d6000fd5b506001600160a01b0397881660009081526001602052604090208054989091166001600160a01b031990981688179055509495945050505050565b6200117962001af3565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527f38929a13dde85f15575ac122dde51d5f70fd99b5802a694822d55c66d142c7d69060200160405180910390a150565b6040516241614f60e81b81526004810183905260016024820152600090819081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906341614f009060440161016060405180830381865afa15801562001241573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001267919062002072565b9050806101400151816080015162001280919062002135565b92506000816060015182604001516200129a919062002171565b600087815260036020526040902054909150811015620012c557506000858152600360205260409020545b80421015620013175760405162461bcd60e51b815260206004820152601360248201527f41554354494f4e204e4f5420535441525445440000000000000000000000000060448201526064016200062c565b60006200132862093aa68362002171565b9050804211156200133c5750505062000720565b67226abadc42f8000062001351834262002135565b6200135d9190620023bc565b62001374906a013da329b633647180000062002135565b935085156200146f576005546040516331a9108f60e11b8152600481018890526001600160a01b0390911690636352211e90602401602060405180830381865afa158015620013c7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620013ed919062002151565b6001600160a01b0316336001600160a01b0316146200144f5760405162461bcd60e51b815260206004820152601460248201527f4d495353494e4720464c41534854524f4e41555400000000000000000000000060448201526064016200062c565b6127106200146061232886620023bc565b6200146c9190620023d6565b93505b5050509250929050565b6040516241614f60e81b815260048101839052600160248201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906341614f009060440161016060405180830381865afa158015620014e9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200150f919062002072565b6020808201516001600160a01b03908116600090815260019092526040909120549192501680620015775760405162461bcd60e51b815260206004820152601160248201527014d51490551151d6481393d50812539255607a1b60448201526064016200062c565b6000848152600260205260409020546001600160a01b03163314620015df5760405162461bcd60e51b815260206004820152601760248201527f4f4e4c59204f524947494e414c204445504f5349544f5200000000000000000060448201526064016200062c565b60008261014001518360800151620015f8919062002135565b60405163b6c0525560e01b8152336004820152602481018290529091506001600160a01b0383169063b6c0525590604401600060405180830381600087803b1580156200164457600080fd5b505af115801562001659573d6000803e3d6000fd5b50506040516323b872dd60e01b81523060048201526001600160a01b038781166024830152604482018990527f00000000000000000000000000000000000000000000000000000000000000001692506323b872dd9150606401600060405180830381600087803b158015620016ce57600080fd5b505af1158015620016e3573d6000803e3d6000fd5b505050507f6ef1810b53b76f7fc00cb848f3792baa7b007d2143759f6d23f318a0f2fb1934856040516200171991815260200190565b60405180910390a15050505050565b600080620017378484620011cd565b6040516241614f60e81b8152600481018790526001602482015291935091506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906341614f009060440161016060405180830381865afa158015620017ac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620017d2919062002072565b6020808201516001600160a01b039081166000908152600190925260409091205491925016806200183a5760405162461bcd60e51b815260206004820152601160248201527014d51490551151d6481393d50812539255607a1b60448201526064016200062c565b6004546200186a9073c628534100180582e43271448098cb2c185795bd9033906001600160a01b03168662001b4f565b60405163b6c0525560e01b8152336004820152602481018590526001600160a01b0382169063b6c0525590604401600060405180830381600087803b158015620018b357600080fd5b505af1158015620018c8573d6000803e3d6000fd5b50506040516323b872dd60e01b8152306004820152336024820152604481018990527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031692506323b872dd9150606401600060405180830381600087803b1580156200193b57600080fd5b505af115801562001950573d6000803e3d6000fd5b50506040805189815260208101899052908101879052606081018690527f96745a7a5c0ef9aea6a0ba6665c5f28736e3f563a338be460c5f42990a44e5b99250608001905060405180910390a1505050505050565b6040516241614f60e81b8152600481018290526001602482015260009081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906341614f009060440161016060405180830381865afa15801562001a17573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a3d919062002072565b9050806101400151816080015162001a56919062002135565b9392505050565b62001a6762001af3565b6001600160a01b03811662001ae55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016200062c565b62001af08162001c26565b50565b6000546001600160a01b0316331462000e9e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016200062c565b6040516001600160a01b038085166024830152831660448201526064810182905262001be99085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262001c76565b50505050565b6040516001600160a01b03831660248201526044810182905262001c2190849063a9059cbb60e01b9060640162001b84565b505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600062001ccd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031662001d629092919063ffffffff16565b80519091501562001c21578080602001905181019062001cee919062002187565b62001c215760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016200062c565b606062001d73848460008562001d7b565b949350505050565b60608247101562001df55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016200062c565b600080866001600160a01b0316858760405162001e139190620023f9565b60006040518083038185875af1925050503d806000811462001e52576040519150601f19603f3d011682016040523d82523d6000602084013e62001e57565b606091505b509150915062001e6a8783838762001e75565b979650505050505050565b6060831562001ee957825160000362001ee1576001600160a01b0385163b62001ee15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016200062c565b508162001d73565b62001d73838381511562001f005781518083602001fd5b8060405162461bcd60e51b81526004016200062c919062002417565b611859806200242d83390190565b6001600160a01b038116811462001af057600080fd5b6000806040838503121562001f5457600080fd5b82359150602083013562001f688162001f2a565b809150509250929050565b60006020828403121562001f8657600080fd5b5035919050565b60006020828403121562001fa057600080fd5b813562001a568162001f2a565b60008060006060848603121562001fc357600080fd5b8335925060208401359150604084013562001fde8162001f2a565b809150509250925092565b6000806040838503121562001ffd57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051610160810167ffffffffffffffff811182821017156200204957620020496200200c565b60405290565b80516200205c8162001f2a565b919050565b805180151581146200205c57600080fd5b600061016082840312156200208657600080fd5b6200209062002022565b6200209b836200204f565b8152620020ab602084016200204f565b6020820152604083015160408201526060830151606082015260808301516080820152620020dc60a0840162002061565b60a082015260c0838101519082015260e0808401519082015261010080840151908201526101208084015190820152610140928301519281019290925250919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156200214b576200214b6200211f565b92915050565b6000602082840312156200216457600080fd5b815162001a568162001f2a565b808201808211156200214b576200214b6200211f565b6000602082840312156200219a57600080fd5b62001a568262002061565b60008060408385031215620021b957600080fd5b505080516020909101519092909150565b600060208284031215620021dd57600080fd5b5051919050565b60005b8381101562002201578181015183820152602001620021e7565b50506000910152565b6000602082840312156200221d57600080fd5b815167ffffffffffffffff808211156200223657600080fd5b818401915084601f8301126200224b57600080fd5b8151818111156200226057620022606200200c565b604051601f8201601f19908116603f011681019083821181831017156200228b576200228b6200200c565b81604052828152876020848701011115620022a557600080fd5b62001e6a836020830160208801620021e4565b600060208284031215620022cb57600080fd5b815160ff8116811462001a5657600080fd5b7f466c6173687374616b6520436f6c6c61746572616c200000000000000000000081526000825162002317816016850160208701620021e4565b9190910160160192915050565b6266632d60e81b81526000825162002344816003850160208701620021e4565b9190910160030192915050565b600081518084526200236b816020860160208601620021e4565b601f01601f19169290920160200192915050565b60608152600062002394606083018662002351565b8281036020840152620023a8818662002351565b91505060ff83166040830152949350505050565b80820281158282048414176200214b576200214b6200211f565b600082620023f457634e487b7160e01b600052601260045260246000fd5b500490565b600082516200240d818460208701620021e4565b9190910192915050565b60208152600062001a5660208301846200235156fe6101606040523480156200001257600080fd5b506040516200185938038062001859833981016040819052620000359162000236565b6040805180820190915260018152603160f81b602082015283908190818560036200006183826200034a565b5060046200007082826200034a565b5050825160209384012082519284019290922060e08390526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818901819052818301979097526060810194909452608080850193909352308483018190528151808603909301835260c09485019091528151919096012090529290925261012052506200010f9050336200011f565b60ff166101405250620004169050565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200019957600080fd5b81516001600160401b0380821115620001b657620001b662000171565b604051601f8301601f19908116603f01168101908282118183101715620001e157620001e162000171565b81604052838152602092508683858801011115620001fe57600080fd5b600091505b8382101562000222578582018301518183018401529082019062000203565b600093810190920192909252949350505050565b6000806000606084860312156200024c57600080fd5b83516001600160401b03808211156200026457600080fd5b620002728783880162000187565b945060208601519150808211156200028957600080fd5b50620002988682870162000187565b925050604084015160ff81168114620002b057600080fd5b809150509250925092565b600181811c90821680620002d057607f821691505b602082108103620002f157634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200034557600081815260208120601f850160051c81016020861015620003205750805b601f850160051c820191505b8181101562000341578281556001016200032c565b5050505b505050565b81516001600160401b0381111562000366576200036662000171565b6200037e81620003778454620002bb565b84620002f7565b602080601f831160018114620003b657600084156200039d5750858301515b600019600386901b1c1916600185901b17855562000341565b600085815260208120601f198616915b82811015620003e757888601518255948401946001909101908401620003c6565b5085821015620004065787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516101005161012051610140516113e86200047160003960006101e901526000610bc901526000610c1801526000610bf301526000610b4c01526000610b7601526000610ba001526113e86000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c8063715018a6116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf14610309578063dd62ed3e1461031c578063f2fde38b1461035557600080fd5b8063a457c2d7146102d0578063a9059cbb146102e3578063b6c05255146102f657600080fd5b80637ecebe00116100bd5780637ecebe001461029a5780638da5cb5b146102ad57806395d89b41146102c857600080fd5b8063715018a61461027f57806379cc67901461028757600080fd5b80633644e5151161012f57806340c10f191161011457806340c10f191461022e57806342966c681461024357806370a082311461025657600080fd5b80633644e51514610213578063395093511461021b57600080fd5b806318160ddd1161016057806318160ddd146101bd57806323b872dd146101cf578063313ce567146101e257600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610368565b60405161019191906111bf565b60405180910390f35b6101ad6101a8366004611229565b6103fa565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101ad6101dd366004611253565b610414565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610438565b6101ad610229366004611229565b610447565b61024161023c366004611229565b610486565b005b61024161025136600461128f565b61049c565b6101c16102643660046112a8565b6001600160a01b031660009081526020819052604090205490565b6102416104a9565b610241610295366004611229565b6104bd565b6101c16102a83660046112a8565b6104d2565b6007546040516001600160a01b039091168152602001610191565b6101846104f0565b6101ad6102de366004611229565b6104ff565b6101ad6102f1366004611229565b6105ae565b610241610304366004611229565b6105bc565b6102416103173660046112ca565b6105c4565b6101c161032a36600461133d565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6102416103633660046112a8565b610728565b60606003805461037790611370565b80601f01602080910402602001604051908101604052809291908181526020018280546103a390611370565b80156103f05780601f106103c5576101008083540402835291602001916103f0565b820191906000526020600020905b8154815290600101906020018083116103d357829003601f168201915b5050505050905090565b6000336104088185856107b5565b60019150505b92915050565b6000336104228582856108da565b61042d85858561096c565b506001949350505050565b6000610442610b3f565b905090565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061040890829086906104819087906113a4565b6107b5565b61048e610c66565b6104988282610cc0565b5050565b6104a63382610d7f565b50565b6104b1610c66565b6104bb6000610ea9565b565b6104c88233836108da565b6104988282610d7f565b6001600160a01b03811660009081526005602052604081205461040e565b60606004805461037790611370565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156105a15760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61042d82868684036107b5565b60003361040881858561096c565b6104c8610c66565b834211156106145760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610598565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886106438c610f13565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050600061069e82610f3b565b905060006106ae82878787610f89565b9050896001600160a01b0316816001600160a01b0316146107115760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610598565b61071c8a8a8a6107b5565b50505050505050505050565b610730610c66565b6001600160a01b0381166107ac5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610598565b6104a681610ea9565b6001600160a01b0383166108175760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610598565b6001600160a01b0382166108785760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610598565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811461096657818110156109595760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610598565b61096684848484036107b5565b50505050565b6001600160a01b0383166109e85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610598565b6001600160a01b038216610a4a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610598565b6001600160a01b03831660009081526020819052604090205481811015610ad95760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610598565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610966565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015610b9857507f000000000000000000000000000000000000000000000000000000000000000046145b15610bc257507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6007546001600160a01b031633146104bb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610598565b6001600160a01b038216610d165760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610598565b8060026000828254610d2891906113a4565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b038216610ddf5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610598565b6001600160a01b03821660009081526020819052604090205481811015610e535760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610598565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91016108cd565b600780546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03811660009081526005602052604090208054600181018255905b50919050565b600061040e610f48610b3f565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000610f9a87878787610fb1565b91509150610fa781611075565b5095945050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610fe8575060009050600361106c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561103c573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166110655760006001925092505061106c565b9150600090505b94509492505050565b6000816004811115611089576110896113c5565b036110915750565b60018160048111156110a5576110a56113c5565b036110f25760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610598565b6002816004811115611106576111066113c5565b036111535760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610598565b6003816004811115611167576111676113c5565b036104a65760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610598565b600060208083528351808285015260005b818110156111ec578581018301518582016040015282016111d0565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461122457600080fd5b919050565b6000806040838503121561123c57600080fd5b6112458361120d565b946020939093013593505050565b60008060006060848603121561126857600080fd5b6112718461120d565b925061127f6020850161120d565b9150604084013590509250925092565b6000602082840312156112a157600080fd5b5035919050565b6000602082840312156112ba57600080fd5b6112c38261120d565b9392505050565b600080600080600080600060e0888a0312156112e557600080fd5b6112ee8861120d565b96506112fc6020890161120d565b95506040880135945060608801359350608088013560ff8116811461132057600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561135057600080fd5b6113598361120d565b91506113676020840161120d565b90509250929050565b600181811c9082168061138457607f821691505b602082108103610f3557634e487b7160e01b600052602260045260246000fd5b8082018082111561040e57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fdfea164736f6c6343000811000aa164736f6c6343000811000a00000000000000000000000078b2d65dd1d3d9fb2972d7ef467261ca101ec2b9
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000078b2d65dd1d3d9fb2972d7ef467261ca101ec2b9
-----Decoded View---------------
Arg [0] : _flashProtocolAddress (address): 0x78b2d65dd1d3d9Fb2972d7Ef467261Ca101EC2B9
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000078b2d65dd1d3d9fb2972d7ef467261ca101ec2b9
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.