Source Code
Multichain Info
N/A
Latest 25 from a total of 68 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Cleanup My NF Ts | 32762681 | 2 days ago | IN | 0 APE | 0.20053416 | ||||
| Stake NF Ts | 32731176 | 2 days ago | IN | 0 APE | 0.01312165 | ||||
| Claim All Reward... | 32642203 | 4 days ago | IN | 0.2 APE | 0.01742313 | ||||
| Stake NF Ts | 32642185 | 4 days ago | IN | 0 APE | 0.02062827 | ||||
| Stake NF Ts | 32578474 | 6 days ago | IN | 0 APE | 0.04318415 | ||||
| Claim All Reward... | 32576927 | 6 days ago | IN | 0.2 APE | 0.09679863 | ||||
| Cleanup My NF Ts | 32576919 | 6 days ago | IN | 0 APE | 0.04121832 | ||||
| Cleanup My NF Ts | 32575187 | 6 days ago | IN | 0 APE | 0.21237837 | ||||
| Stake NF Ts | 32573251 | 6 days ago | IN | 0 APE | 0.01138287 | ||||
| Claim All Reward... | 32568942 | 6 days ago | IN | 0.2 APE | 0.01602866 | ||||
| Claim All Reward... | 32540148 | 7 days ago | IN | 0.2 APE | 0.02732256 | ||||
| Claim All Reward... | 32497984 | 8 days ago | IN | 0.2 APE | 0.01568436 | ||||
| Stake NF Ts | 32494731 | 8 days ago | IN | 0 APE | 0.01138287 | ||||
| Cleanup My NF Ts | 32494119 | 8 days ago | IN | 0 APE | 0.183146 | ||||
| Stake NF Ts | 32474352 | 9 days ago | IN | 0 APE | 0.0188895 | ||||
| Cleanup My NF Ts | 32432380 | 10 days ago | IN | 0 APE | 0.25753477 | ||||
| Claim All Reward... | 32394253 | 11 days ago | IN | 0.2 APE | 0.01950621 | ||||
| Stake NF Ts | 32394249 | 11 days ago | IN | 0 APE | 0.0281349 | ||||
| Claim All Reward... | 32251029 | 15 days ago | IN | 0.2 APE | 0.12774822 | ||||
| Stake NF Ts | 32250752 | 15 days ago | IN | 0 APE | 0.04950496 | ||||
| Claim All Reward... | 32228330 | 15 days ago | IN | 0.2 APE | 0.15039053 | ||||
| Stake NF Ts | 32197268 | 16 days ago | IN | 0 APE | 1.5840123 | ||||
| Stake NF Ts | 32192093 | 16 days ago | IN | 0 APE | 0.00405887 | ||||
| Stake NF Ts | 32192072 | 16 days ago | IN | 0 APE | 0.01312165 | ||||
| Claim All Reward... | 32182209 | 17 days ago | IN | 0.2 APE | 0.01602866 |
Latest 12 internal transactions
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 32642203 | 4 days ago | 0.2 APE | ||||
| 32576927 | 6 days ago | 0.2 APE | ||||
| 32568942 | 6 days ago | 0.2 APE | ||||
| 32540148 | 7 days ago | 0.2 APE | ||||
| 32497984 | 8 days ago | 0.2 APE | ||||
| 32394253 | 11 days ago | 0.2 APE | ||||
| 32251029 | 15 days ago | 0.2 APE | ||||
| 32228330 | 15 days ago | 0.2 APE | ||||
| 32182209 | 17 days ago | 0.2 APE | ||||
| 32172422 | 17 days ago | 0.2 APE | ||||
| 31957899 | 22 days ago | 0.2 APE | ||||
| 31843890 | 25 days ago | 0.2 APE |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
GSASoftStake
Compiler Version
v0.8.30+commit.73712a01
Contract Source Code (Solidity)
/**
*Submitted for verification at apescan.io on 2025-12-28
*/
/// @author OutlawDevs
// .----------------. .----------------. .----------------.
// | .--------------. || .--------------. || .--------------. |
// | | ______ | || | _______ | || | __ | |
// | | .' ___ | | || | / ___ | | || | / \ | |
// | | / .' \_| | || | | (__ \_| | || | / /\ \ | |
// | | | | ____ | || | '.___`-. | || | / ____ \ | |
// | | \ `.___] _| | || | |`\____) | | || | _/ / \ \_ | |
// | | `._____.' | || | |_______.' | || ||____| |____|| |
// | | | || | | || | | |
// | '--------------' || '--------------' || '--------------' |
// '----------------' '----------------' '----------------'
// File: @openzeppelin/contracts/security/ReentrancyGuard.sol
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
// File: @openzeppelin/contracts/security/Pausable.sol
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
/**
* @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.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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);
}
}
// File: @openzeppelin/contracts/utils/math/SafeMath.sol
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}
// File: @openzeppelin/contracts/interfaces/IERC20.sol
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)
pragma solidity >=0.4.16;
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @openzeppelin/contracts/interfaces/IERC165.sol
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)
pragma solidity >=0.4.16;
// File: @openzeppelin/contracts/interfaces/IERC1363.sol
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)
pragma solidity >=0.6.2;
/**
* @title IERC1363
* @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
*
* Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
* after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
*/
interface IERC1363 is IERC20, IERC165 {
/*
* Note: the ERC-165 identifier for this interface is 0xb0202a11.
* 0xb0202a11 ===
* bytes4(keccak256('transferAndCall(address,uint256)')) ^
* bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
* bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
* bytes4(keccak256('approveAndCall(address,uint256)')) ^
* bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
*/
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
* and then calls {IERC1363Receiver-onTransferReceived} on `to`.
* @param from The address which you want to send tokens from.
* @param to The address which you want to transfer to.
* @param value The amount of tokens to be transferred.
* @param data Additional data with no specified format, sent in call to `to`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value) external returns (bool);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
* @param data Additional data with no specified format, sent in call to `spender`.
* @return A boolean value indicating whether the operation succeeded unless throwing.
*/
function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}
// File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
/**
* @title SafeERC20
* @dev Wrappers around ERC-20 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 {
/**
* @dev An operation with an ERC-20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
}
/**
* @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
*/
function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*
* IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
* smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
* this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
* that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*
* NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
* only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
* set here.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
safeTransfer(token, to, value);
} else if (!token.transferAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
* has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* Reverts if the returned value is other than `true`.
*/
function transferFromAndCallRelaxed(
IERC1363 token,
address from,
address to,
uint256 value,
bytes memory data
) internal {
if (to.code.length == 0) {
safeTransferFrom(token, from, to, value);
} else if (!token.transferFromAndCall(from, to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
* code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
* targeting contracts.
*
* NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
* Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
* once without retrying, and relies on the returned value to be true.
*
* Reverts if the returned value is other than `true`.
*/
function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
if (to.code.length == 0) {
forceApprove(token, to, value);
} else if (!token.approveAndCall(to, value, data)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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).
*
* This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
// bubble errors
if iszero(success) {
let ptr := mload(0x40)
returndatacopy(ptr, 0, returndatasize())
revert(ptr, returndatasize())
}
returnSize := returndatasize()
returnValue := mload(0)
}
if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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).
*
* This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
returnSize := returndatasize()
returnValue := mload(0)
}
return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721.sol)
pragma solidity >=0.6.2;
/**
* @dev Required interface of an ERC-721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC-721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or
* {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the address zero.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
// File: @openzeppelin/contracts/utils/Comparators.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Comparators.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides a set of functions to compare values.
*
* _Available since v5.1._
*/
library Comparators {
function lt(uint256 a, uint256 b) internal pure returns (bool) {
return a < b;
}
function gt(uint256 a, uint256 b) internal pure returns (bool) {
return a > b;
}
}
// File: @openzeppelin/contracts/utils/SlotDerivation.sol
// OpenZeppelin Contracts (last updated v5.3.0) (utils/SlotDerivation.sol)
// This file was procedurally generated from scripts/generate/templates/SlotDerivation.js.
pragma solidity ^0.8.20;
/**
* @dev Library for computing storage (and transient storage) locations from namespaces and deriving slots
* corresponding to standard patterns. The derivation method for array and mapping matches the storage layout used by
* the solidity language / compiler.
*
* See https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays[Solidity docs for mappings and dynamic arrays.].
*
* Example usage:
* ```solidity
* contract Example {
* // Add the library methods
* using StorageSlot for bytes32;
* using SlotDerivation for bytes32;
*
* // Declare a namespace
* string private constant _NAMESPACE = "<namespace>"; // eg. OpenZeppelin.Slot
*
* function setValueInNamespace(uint256 key, address newValue) internal {
* _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value = newValue;
* }
*
* function getValueInNamespace(uint256 key) internal view returns (address) {
* return _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value;
* }
* }
* ```
*
* TIP: Consider using this library along with {StorageSlot}.
*
* NOTE: This library provides a way to manipulate storage locations in a non-standard way. Tooling for checking
* upgrade safety will ignore the slots accessed through this library.
*
* _Available since v5.1._
*/
library SlotDerivation {
/**
* @dev Derive an ERC-7201 slot from a string (namespace).
*/
function erc7201Slot(string memory namespace) internal pure returns (bytes32 slot) {
assembly ("memory-safe") {
mstore(0x00, sub(keccak256(add(namespace, 0x20), mload(namespace)), 1))
slot := and(keccak256(0x00, 0x20), not(0xff))
}
}
/**
* @dev Add an offset to a slot to get the n-th element of a structure or an array.
*/
function offset(bytes32 slot, uint256 pos) internal pure returns (bytes32 result) {
unchecked {
return bytes32(uint256(slot) + pos);
}
}
/**
* @dev Derive the location of the first element in an array from the slot where the length is stored.
*/
function deriveArray(bytes32 slot) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, slot)
result := keccak256(0x00, 0x20)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, address key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, and(key, shr(96, not(0))))
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, bool key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, iszero(iszero(key)))
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, bytes32 key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, key)
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, uint256 key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, key)
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, int256 key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
mstore(0x00, key)
mstore(0x20, slot)
result := keccak256(0x00, 0x40)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, string memory key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
let length := mload(key)
let begin := add(key, 0x20)
let end := add(begin, length)
let cache := mload(end)
mstore(end, slot)
result := keccak256(begin, add(length, 0x20))
mstore(end, cache)
}
}
/**
* @dev Derive the location of a mapping element from the key.
*/
function deriveMapping(bytes32 slot, bytes memory key) internal pure returns (bytes32 result) {
assembly ("memory-safe") {
let length := mload(key)
let begin := add(key, 0x20)
let end := add(begin, length)
let cache := mload(end)
mstore(end, slot)
result := keccak256(begin, add(length, 0x20))
mstore(end, cache)
}
}
}
// File: @openzeppelin/contracts/utils/StorageSlot.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC-1967 implementation slot:
* ```solidity
* contract ERC1967 {
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct Int256Slot {
int256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Int256Slot` with member `value` located at `slot`.
*/
function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
/**
* @dev Returns a `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
}
// File: @openzeppelin/contracts/utils/Panic.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)
pragma solidity ^0.8.20;
/**
* @dev Helper library for emitting standardized panic codes.
*
* ```solidity
* contract Example {
* using Panic for uint256;
*
* // Use any of the declared internal constants
* function foo() { Panic.GENERIC.panic(); }
*
* // Alternatively
* function foo() { Panic.panic(Panic.GENERIC); }
* }
* ```
*
* Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].
*
* _Available since v5.1._
*/
// slither-disable-next-line unused-state
library Panic {
/// @dev generic / unspecified error
uint256 internal constant GENERIC = 0x00;
/// @dev used by the assert() builtin
uint256 internal constant ASSERT = 0x01;
/// @dev arithmetic underflow or overflow
uint256 internal constant UNDER_OVERFLOW = 0x11;
/// @dev division or modulo by zero
uint256 internal constant DIVISION_BY_ZERO = 0x12;
/// @dev enum conversion error
uint256 internal constant ENUM_CONVERSION_ERROR = 0x21;
/// @dev invalid encoding in storage
uint256 internal constant STORAGE_ENCODING_ERROR = 0x22;
/// @dev empty array pop
uint256 internal constant EMPTY_ARRAY_POP = 0x31;
/// @dev array out of bounds access
uint256 internal constant ARRAY_OUT_OF_BOUNDS = 0x32;
/// @dev resource error (too large allocation or too large array)
uint256 internal constant RESOURCE_ERROR = 0x41;
/// @dev calling invalid internal function
uint256 internal constant INVALID_INTERNAL_FUNCTION = 0x51;
/// @dev Reverts with a panic code. Recommended to use with
/// the internal constants with predefined codes.
function panic(uint256 code) internal pure {
assembly ("memory-safe") {
mstore(0x00, 0x4e487b71)
mstore(0x20, code)
revert(0x1c, 0x24)
}
}
}
// File: @openzeppelin/contracts/utils/math/SafeCast.sol
// OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.20;
/**
* @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeCast {
/**
* @dev Value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);
/**
* @dev An int value doesn't fit in an uint of `bits` size.
*/
error SafeCastOverflowedIntToUint(int256 value);
/**
* @dev Value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);
/**
* @dev An uint value doesn't fit in an int of `bits` size.
*/
error SafeCastOverflowedUintToInt(uint256 value);
/**
* @dev Returns the downcasted uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*/
function toUint248(uint256 value) internal pure returns (uint248) {
if (value > type(uint248).max) {
revert SafeCastOverflowedUintDowncast(248, value);
}
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*/
function toUint240(uint256 value) internal pure returns (uint240) {
if (value > type(uint240).max) {
revert SafeCastOverflowedUintDowncast(240, value);
}
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*/
function toUint232(uint256 value) internal pure returns (uint232) {
if (value > type(uint232).max) {
revert SafeCastOverflowedUintDowncast(232, value);
}
return uint232(value);
}
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toUint224(uint256 value) internal pure returns (uint224) {
if (value > type(uint224).max) {
revert SafeCastOverflowedUintDowncast(224, value);
}
return uint224(value);
}
/**
* @dev Returns the downcasted uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*/
function toUint216(uint256 value) internal pure returns (uint216) {
if (value > type(uint216).max) {
revert SafeCastOverflowedUintDowncast(216, value);
}
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*/
function toUint208(uint256 value) internal pure returns (uint208) {
if (value > type(uint208).max) {
revert SafeCastOverflowedUintDowncast(208, value);
}
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*/
function toUint200(uint256 value) internal pure returns (uint200) {
if (value > type(uint200).max) {
revert SafeCastOverflowedUintDowncast(200, value);
}
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*/
function toUint192(uint256 value) internal pure returns (uint192) {
if (value > type(uint192).max) {
revert SafeCastOverflowedUintDowncast(192, value);
}
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*/
function toUint184(uint256 value) internal pure returns (uint184) {
if (value > type(uint184).max) {
revert SafeCastOverflowedUintDowncast(184, value);
}
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*/
function toUint176(uint256 value) internal pure returns (uint176) {
if (value > type(uint176).max) {
revert SafeCastOverflowedUintDowncast(176, value);
}
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*/
function toUint168(uint256 value) internal pure returns (uint168) {
if (value > type(uint168).max) {
revert SafeCastOverflowedUintDowncast(168, value);
}
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*/
function toUint160(uint256 value) internal pure returns (uint160) {
if (value > type(uint160).max) {
revert SafeCastOverflowedUintDowncast(160, value);
}
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*/
function toUint152(uint256 value) internal pure returns (uint152) {
if (value > type(uint152).max) {
revert SafeCastOverflowedUintDowncast(152, value);
}
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*/
function toUint144(uint256 value) internal pure returns (uint144) {
if (value > type(uint144).max) {
revert SafeCastOverflowedUintDowncast(144, value);
}
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*/
function toUint136(uint256 value) internal pure returns (uint136) {
if (value > type(uint136).max) {
revert SafeCastOverflowedUintDowncast(136, value);
}
return uint136(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toUint128(uint256 value) internal pure returns (uint128) {
if (value > type(uint128).max) {
revert SafeCastOverflowedUintDowncast(128, value);
}
return uint128(value);
}
/**
* @dev Returns the downcasted uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*/
function toUint120(uint256 value) internal pure returns (uint120) {
if (value > type(uint120).max) {
revert SafeCastOverflowedUintDowncast(120, value);
}
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*/
function toUint112(uint256 value) internal pure returns (uint112) {
if (value > type(uint112).max) {
revert SafeCastOverflowedUintDowncast(112, value);
}
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*/
function toUint104(uint256 value) internal pure returns (uint104) {
if (value > type(uint104).max) {
revert SafeCastOverflowedUintDowncast(104, value);
}
return uint104(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toUint96(uint256 value) internal pure returns (uint96) {
if (value > type(uint96).max) {
revert SafeCastOverflowedUintDowncast(96, value);
}
return uint96(value);
}
/**
* @dev Returns the downcasted uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toUint88(uint256 value) internal pure returns (uint88) {
if (value > type(uint88).max) {
revert SafeCastOverflowedUintDowncast(88, value);
}
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toUint80(uint256 value) internal pure returns (uint80) {
if (value > type(uint80).max) {
revert SafeCastOverflowedUintDowncast(80, value);
}
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*/
function toUint72(uint256 value) internal pure returns (uint72) {
if (value > type(uint72).max) {
revert SafeCastOverflowedUintDowncast(72, value);
}
return uint72(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toUint64(uint256 value) internal pure returns (uint64) {
if (value > type(uint64).max) {
revert SafeCastOverflowedUintDowncast(64, value);
}
return uint64(value);
}
/**
* @dev Returns the downcasted uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*/
function toUint56(uint256 value) internal pure returns (uint56) {
if (value > type(uint56).max) {
revert SafeCastOverflowedUintDowncast(56, value);
}
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*/
function toUint48(uint256 value) internal pure returns (uint48) {
if (value > type(uint48).max) {
revert SafeCastOverflowedUintDowncast(48, value);
}
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*/
function toUint40(uint256 value) internal pure returns (uint40) {
if (value > type(uint40).max) {
revert SafeCastOverflowedUintDowncast(40, value);
}
return uint40(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toUint32(uint256 value) internal pure returns (uint32) {
if (value > type(uint32).max) {
revert SafeCastOverflowedUintDowncast(32, value);
}
return uint32(value);
}
/**
* @dev Returns the downcasted uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*/
function toUint24(uint256 value) internal pure returns (uint24) {
if (value > type(uint24).max) {
revert SafeCastOverflowedUintDowncast(24, value);
}
return uint24(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toUint16(uint256 value) internal pure returns (uint16) {
if (value > type(uint16).max) {
revert SafeCastOverflowedUintDowncast(16, value);
}
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*/
function toUint8(uint256 value) internal pure returns (uint8) {
if (value > type(uint8).max) {
revert SafeCastOverflowedUintDowncast(8, value);
}
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
if (value < 0) {
revert SafeCastOverflowedIntToUint(value);
}
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(248, value);
}
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(240, value);
}
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(232, value);
}
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(224, value);
}
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(216, value);
}
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(208, value);
}
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(200, value);
}
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(192, value);
}
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(184, value);
}
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(176, value);
}
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(168, value);
}
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(160, value);
}
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(152, value);
}
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(144, value);
}
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(136, value);
}
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(128, value);
}
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(120, value);
}
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(112, value);
}
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(104, value);
}
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(96, value);
}
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(88, value);
}
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(80, value);
}
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(72, value);
}
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(64, value);
}
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(56, value);
}
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(48, value);
}
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(40, value);
}
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(32, value);
}
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(24, value);
}
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(16, value);
}
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
if (downcasted != value) {
revert SafeCastOverflowedIntDowncast(8, value);
}
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
if (value > uint256(type(int256).max)) {
revert SafeCastOverflowedUintToInt(value);
}
return int256(value);
}
/**
* @dev Cast a boolean (false or true) to a uint256 (0 or 1) with no jump.
*/
function toUint(bool b) internal pure returns (uint256 u) {
assembly ("memory-safe") {
u := iszero(iszero(b))
}
}
}
// File: @openzeppelin/contracts/utils/math/Math.sol
// OpenZeppelin Contracts (last updated v5.3.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Floor, // Toward negative infinity
Ceil, // Toward positive infinity
Trunc, // Toward zero
Expand // Away from zero
}
/**
* @dev Return the 512-bit addition of two uint256.
*
* The result is stored in two 256 variables such that sum = high * 2²⁵⁶ + low.
*/
function add512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
assembly ("memory-safe") {
low := add(a, b)
high := lt(low, a)
}
}
/**
* @dev Return the 512-bit multiplication of two uint256.
*
* The result is stored in two 256 variables such that product = high * 2²⁵⁶ + low.
*/
function mul512(uint256 a, uint256 b) internal pure returns (uint256 high, uint256 low) {
// 512-bit multiply [high low] = x * y. Compute the product mod 2²⁵⁶ and mod 2²⁵⁶ - 1, then use
// the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = high * 2²⁵⁶ + low.
assembly ("memory-safe") {
let mm := mulmod(a, b, not(0))
low := mul(a, b)
high := sub(sub(mm, low), lt(mm, low))
}
}
/**
* @dev Returns the addition of two unsigned integers, with a success flag (no overflow).
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a + b;
success = c >= a;
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with a success flag (no overflow).
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a - b;
success = c <= a;
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with a success flag (no overflow).
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
uint256 c = a * b;
assembly ("memory-safe") {
// Only true when the multiplication doesn't overflow
// (c / a == b) || (a == 0)
success := or(eq(div(c, a), b), iszero(a))
}
// equivalent to: success ? c : 0
result = c * SafeCast.toUint(success);
}
}
/**
* @dev Returns the division of two unsigned integers, with a success flag (no division by zero).
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
success = b > 0;
assembly ("memory-safe") {
// The `DIV` opcode returns zero when the denominator is 0.
result := div(a, b)
}
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a success flag (no division by zero).
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
unchecked {
success = b > 0;
assembly ("memory-safe") {
// The `MOD` opcode returns zero when the denominator is 0.
result := mod(a, b)
}
}
}
/**
* @dev Unsigned saturating addition, bounds to `2²⁵⁶ - 1` instead of overflowing.
*/
function saturatingAdd(uint256 a, uint256 b) internal pure returns (uint256) {
(bool success, uint256 result) = tryAdd(a, b);
return ternary(success, result, type(uint256).max);
}
/**
* @dev Unsigned saturating subtraction, bounds to zero instead of overflowing.
*/
function saturatingSub(uint256 a, uint256 b) internal pure returns (uint256) {
(, uint256 result) = trySub(a, b);
return result;
}
/**
* @dev Unsigned saturating multiplication, bounds to `2²⁵⁶ - 1` instead of overflowing.
*/
function saturatingMul(uint256 a, uint256 b) internal pure returns (uint256) {
(bool success, uint256 result) = tryMul(a, b);
return ternary(success, result, type(uint256).max);
}
/**
* @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
*
* IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
* However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
* one branch when needed, making this function more expensive.
*/
function ternary(bool condition, uint256 a, uint256 b) internal pure returns (uint256) {
unchecked {
// branchless ternary works because:
// b ^ (a ^ b) == a
// b ^ 0 == b
return b ^ ((a ^ b) * SafeCast.toUint(condition));
}
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(a > b, a, b);
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return ternary(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 towards infinity instead
* of rounding towards zero.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
if (b == 0) {
// Guarantee the same behavior as in a regular Solidity division.
Panic.panic(Panic.DIVISION_BY_ZERO);
}
// The following calculation ensures accurate ceiling division without overflow.
// Since a is non-zero, (a - 1) / b will not overflow.
// The largest possible result occurs when (a - 1) / b is type(uint256).max,
// but the largest value we can obtain is type(uint256).max - 1, which happens
// when a = type(uint256).max and b = 1.
unchecked {
return SafeCast.toUint(a > 0) * ((a - 1) / b + 1);
}
}
/**
* @dev Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
* denominator == 0.
*
* 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 {
(uint256 high, uint256 low) = mul512(x, y);
// Handle non-overflow cases, 256 by 256 division.
if (high == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return low / denominator;
}
// Make sure the result is less than 2²⁵⁶. Also prevents denominator == 0.
if (denominator <= high) {
Panic.panic(ternary(denominator == 0, Panic.DIVISION_BY_ZERO, Panic.UNDER_OVERFLOW));
}
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [high low].
uint256 remainder;
assembly ("memory-safe") {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
high := sub(high, gt(remainder, low))
low := sub(low, 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.
uint256 twos = denominator & (0 - denominator);
assembly ("memory-safe") {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [high low] by twos.
low := div(low, twos)
// Flip twos such that it is 2²⁵⁶ / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from high into low.
low |= high * twos;
// Invert denominator mod 2²⁵⁶. Now that denominator is an odd number, it has an inverse modulo 2²⁵⁶ such
// that denominator * inv ≡ 1 mod 2²⁵⁶. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv ≡ 1 mod 2⁴.
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⁸
inverse *= 2 - denominator * inverse; // inverse mod 2¹⁶
inverse *= 2 - denominator * inverse; // inverse mod 2³²
inverse *= 2 - denominator * inverse; // inverse mod 2⁶⁴
inverse *= 2 - denominator * inverse; // inverse mod 2¹²⁸
inverse *= 2 - denominator * inverse; // inverse mod 2²⁵⁶
// 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²⁵⁶. Since the preconditions guarantee that the outcome is
// less than 2²⁵⁶, this is the final result. We don't need to compute the high bits of the result and high
// is no longer required.
result = low * inverse;
return result;
}
}
/**
* @dev 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) {
return mulDiv(x, y, denominator) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0);
}
/**
* @dev Calculates floor(x * y >> n) with full precision. Throws if result overflows a uint256.
*/
function mulShr(uint256 x, uint256 y, uint8 n) internal pure returns (uint256 result) {
unchecked {
(uint256 high, uint256 low) = mul512(x, y);
if (high >= 1 << n) {
Panic.panic(Panic.UNDER_OVERFLOW);
}
return (high << (256 - n)) | (low >> n);
}
}
/**
* @dev Calculates x * y >> n with full precision, following the selected rounding direction.
*/
function mulShr(uint256 x, uint256 y, uint8 n, Rounding rounding) internal pure returns (uint256) {
return mulShr(x, y, n) + SafeCast.toUint(unsignedRoundsUp(rounding) && mulmod(x, y, 1 << n) > 0);
}
/**
* @dev Calculate the modular multiplicative inverse of a number in Z/nZ.
*
* If n is a prime, then Z/nZ is a field. In that case all elements are inversible, except 0.
* If n is not a prime, then Z/nZ is not a field, and some elements might not be inversible.
*
* If the input value is not inversible, 0 is returned.
*
* NOTE: If you know for sure that n is (big) a prime, it may be cheaper to use Fermat's little theorem and get the
* inverse using `Math.modExp(a, n - 2, n)`. See {invModPrime}.
*/
function invMod(uint256 a, uint256 n) internal pure returns (uint256) {
unchecked {
if (n == 0) return 0;
// The inverse modulo is calculated using the Extended Euclidean Algorithm (iterative version)
// Used to compute integers x and y such that: ax + ny = gcd(a, n).
// When the gcd is 1, then the inverse of a modulo n exists and it's x.
// ax + ny = 1
// ax = 1 + (-y)n
// ax ≡ 1 (mod n) # x is the inverse of a modulo n
// If the remainder is 0 the gcd is n right away.
uint256 remainder = a % n;
uint256 gcd = n;
// Therefore the initial coefficients are:
// ax + ny = gcd(a, n) = n
// 0a + 1n = n
int256 x = 0;
int256 y = 1;
while (remainder != 0) {
uint256 quotient = gcd / remainder;
(gcd, remainder) = (
// The old remainder is the next gcd to try.
remainder,
// Compute the next remainder.
// Can't overflow given that (a % gcd) * (gcd // (a % gcd)) <= gcd
// where gcd is at most n (capped to type(uint256).max)
gcd - remainder * quotient
);
(x, y) = (
// Increment the coefficient of a.
y,
// Decrement the coefficient of n.
// Can overflow, but the result is casted to uint256 so that the
// next value of y is "wrapped around" to a value between 0 and n - 1.
x - y * int256(quotient)
);
}
if (gcd != 1) return 0; // No inverse exists.
return ternary(x < 0, n - uint256(-x), uint256(x)); // Wrap the result if it's negative.
}
}
/**
* @dev Variant of {invMod}. More efficient, but only works if `p` is known to be a prime greater than `2`.
*
* From https://en.wikipedia.org/wiki/Fermat%27s_little_theorem[Fermat's little theorem], we know that if p is
* prime, then `a**(p-1) ≡ 1 mod p`. As a consequence, we have `a * a**(p-2) ≡ 1 mod p`, which means that
* `a**(p-2)` is the modular multiplicative inverse of a in Fp.
*
* NOTE: this function does NOT check that `p` is a prime greater than `2`.
*/
function invModPrime(uint256 a, uint256 p) internal view returns (uint256) {
unchecked {
return Math.modExp(a, p - 2, p);
}
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m)
*
* Requirements:
* - modulus can't be zero
* - underlying staticcall to precompile must succeed
*
* IMPORTANT: The result is only valid if the underlying call succeeds. When using this function, make
* sure the chain you're using it on supports the precompiled contract for modular exponentiation
* at address 0x05 as specified in https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise,
* the underlying function will succeed given the lack of a revert, but the result may be incorrectly
* interpreted as 0.
*/
function modExp(uint256 b, uint256 e, uint256 m) internal view returns (uint256) {
(bool success, uint256 result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Returns the modular exponentiation of the specified base, exponent and modulus (b ** e % m).
* It includes a success flag indicating if the operation succeeded. Operation will be marked as failed if trying
* to operate modulo 0 or if the underlying precompile reverted.
*
* IMPORTANT: The result is only valid if the success flag is true. When using this function, make sure the chain
* you're using it on supports the precompiled contract for modular exponentiation at address 0x05 as specified in
* https://eips.ethereum.org/EIPS/eip-198[EIP-198]. Otherwise, the underlying function will succeed given the lack
* of a revert, but the result may be incorrectly interpreted as 0.
*/
function tryModExp(uint256 b, uint256 e, uint256 m) internal view returns (bool success, uint256 result) {
if (m == 0) return (false, 0);
assembly ("memory-safe") {
let ptr := mload(0x40)
// | Offset | Content | Content (Hex) |
// |-----------|------------|--------------------------------------------------------------------|
// | 0x00:0x1f | size of b | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x20:0x3f | size of e | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x40:0x5f | size of m | 0x0000000000000000000000000000000000000000000000000000000000000020 |
// | 0x60:0x7f | value of b | 0x<.............................................................b> |
// | 0x80:0x9f | value of e | 0x<.............................................................e> |
// | 0xa0:0xbf | value of m | 0x<.............................................................m> |
mstore(ptr, 0x20)
mstore(add(ptr, 0x20), 0x20)
mstore(add(ptr, 0x40), 0x20)
mstore(add(ptr, 0x60), b)
mstore(add(ptr, 0x80), e)
mstore(add(ptr, 0xa0), m)
// Given the result < m, it's guaranteed to fit in 32 bytes,
// so we can use the memory scratch space located at offset 0.
success := staticcall(gas(), 0x05, ptr, 0xc0, 0x00, 0x20)
result := mload(0x00)
}
}
/**
* @dev Variant of {modExp} that supports inputs of arbitrary length.
*/
function modExp(bytes memory b, bytes memory e, bytes memory m) internal view returns (bytes memory) {
(bool success, bytes memory result) = tryModExp(b, e, m);
if (!success) {
Panic.panic(Panic.DIVISION_BY_ZERO);
}
return result;
}
/**
* @dev Variant of {tryModExp} that supports inputs of arbitrary length.
*/
function tryModExp(
bytes memory b,
bytes memory e,
bytes memory m
) internal view returns (bool success, bytes memory result) {
if (_zeroBytes(m)) return (false, new bytes(0));
uint256 mLen = m.length;
// Encode call args in result and move the free memory pointer
result = abi.encodePacked(b.length, e.length, mLen, b, e, m);
assembly ("memory-safe") {
let dataPtr := add(result, 0x20)
// Write result on top of args to avoid allocating extra memory.
success := staticcall(gas(), 0x05, dataPtr, mload(result), dataPtr, mLen)
// Overwrite the length.
// result.length > returndatasize() is guaranteed because returndatasize() == m.length
mstore(result, mLen)
// Set the memory pointer after the returned data.
mstore(0x40, add(dataPtr, mLen))
}
}
/**
* @dev Returns whether the provided byte array is zero.
*/
function _zeroBytes(bytes memory byteArray) private pure returns (bool) {
for (uint256 i = 0; i < byteArray.length; ++i) {
if (byteArray[i] != 0) {
return false;
}
}
return true;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
* towards zero.
*
* This method is based on Newton's method for computing square roots; the algorithm is restricted to only
* using integer operations.
*/
function sqrt(uint256 a) internal pure returns (uint256) {
unchecked {
// Take care of easy edge cases when a == 0 or a == 1
if (a <= 1) {
return a;
}
// In this function, we use Newton's method to get a root of `f(x) := x² - a`. It involves building a
// sequence x_n that converges toward sqrt(a). For each iteration x_n, we also define the error between
// the current value as `ε_n = | x_n - sqrt(a) |`.
//
// For our first estimation, we consider `e` the smallest power of 2 which is bigger than the square root
// of the target. (i.e. `2**(e-1) ≤ sqrt(a) < 2**e`). We know that `e ≤ 128` because `(2¹²⁸)² = 2²⁵⁶` is
// bigger than any uint256.
//
// By noticing that
// `2**(e-1) ≤ sqrt(a) < 2**e → (2**(e-1))² ≤ a < (2**e)² → 2**(2*e-2) ≤ a < 2**(2*e)`
// we can deduce that `e - 1` is `log2(a) / 2`. We can thus compute `x_n = 2**(e-1)` using a method similar
// to the msb function.
uint256 aa = a;
uint256 xn = 1;
if (aa >= (1 << 128)) {
aa >>= 128;
xn <<= 64;
}
if (aa >= (1 << 64)) {
aa >>= 64;
xn <<= 32;
}
if (aa >= (1 << 32)) {
aa >>= 32;
xn <<= 16;
}
if (aa >= (1 << 16)) {
aa >>= 16;
xn <<= 8;
}
if (aa >= (1 << 8)) {
aa >>= 8;
xn <<= 4;
}
if (aa >= (1 << 4)) {
aa >>= 4;
xn <<= 2;
}
if (aa >= (1 << 2)) {
xn <<= 1;
}
// We now have x_n such that `x_n = 2**(e-1) ≤ sqrt(a) < 2**e = 2 * x_n`. This implies ε_n ≤ 2**(e-1).
//
// We can refine our estimation by noticing that the middle of that interval minimizes the error.
// If we move x_n to equal 2**(e-1) + 2**(e-2), then we reduce the error to ε_n ≤ 2**(e-2).
// This is going to be our x_0 (and ε_0)
xn = (3 * xn) >> 1; // ε_0 := | x_0 - sqrt(a) | ≤ 2**(e-2)
// From here, Newton's method give us:
// x_{n+1} = (x_n + a / x_n) / 2
//
// One should note that:
// x_{n+1}² - a = ((x_n + a / x_n) / 2)² - a
// = ((x_n² + a) / (2 * x_n))² - a
// = (x_n⁴ + 2 * a * x_n² + a²) / (4 * x_n²) - a
// = (x_n⁴ + 2 * a * x_n² + a² - 4 * a * x_n²) / (4 * x_n²)
// = (x_n⁴ - 2 * a * x_n² + a²) / (4 * x_n²)
// = (x_n² - a)² / (2 * x_n)²
// = ((x_n² - a) / (2 * x_n))²
// ≥ 0
// Which proves that for all n ≥ 1, sqrt(a) ≤ x_n
//
// This gives us the proof of quadratic convergence of the sequence:
// ε_{n+1} = | x_{n+1} - sqrt(a) |
// = | (x_n + a / x_n) / 2 - sqrt(a) |
// = | (x_n² + a - 2*x_n*sqrt(a)) / (2 * x_n) |
// = | (x_n - sqrt(a))² / (2 * x_n) |
// = | ε_n² / (2 * x_n) |
// = ε_n² / | (2 * x_n) |
//
// For the first iteration, we have a special case where x_0 is known:
// ε_1 = ε_0² / | (2 * x_0) |
// ≤ (2**(e-2))² / (2 * (2**(e-1) + 2**(e-2)))
// ≤ 2**(2*e-4) / (3 * 2**(e-1))
// ≤ 2**(e-3) / 3
// ≤ 2**(e-3-log2(3))
// ≤ 2**(e-4.5)
//
// For the following iterations, we use the fact that, 2**(e-1) ≤ sqrt(a) ≤ x_n:
// ε_{n+1} = ε_n² / | (2 * x_n) |
// ≤ (2**(e-k))² / (2 * 2**(e-1))
// ≤ 2**(2*e-2*k) / 2**e
// ≤ 2**(e-2*k)
xn = (xn + a / xn) >> 1; // ε_1 := | x_1 - sqrt(a) | ≤ 2**(e-4.5) -- special case, see above
xn = (xn + a / xn) >> 1; // ε_2 := | x_2 - sqrt(a) | ≤ 2**(e-9) -- general case with k = 4.5
xn = (xn + a / xn) >> 1; // ε_3 := | x_3 - sqrt(a) | ≤ 2**(e-18) -- general case with k = 9
xn = (xn + a / xn) >> 1; // ε_4 := | x_4 - sqrt(a) | ≤ 2**(e-36) -- general case with k = 18
xn = (xn + a / xn) >> 1; // ε_5 := | x_5 - sqrt(a) | ≤ 2**(e-72) -- general case with k = 36
xn = (xn + a / xn) >> 1; // ε_6 := | x_6 - sqrt(a) | ≤ 2**(e-144) -- general case with k = 72
// Because e ≤ 128 (as discussed during the first estimation phase), we know have reached a precision
// ε_6 ≤ 2**(e-144) < 1. Given we're operating on integers, then we can ensure that xn is now either
// sqrt(a) or sqrt(a) + 1.
return xn - SafeCast.toUint(xn > a / xn);
}
}
/**
* @dev 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && result * result < a);
}
}
/**
* @dev Return the log in base 2 of a positive value rounded towards zero.
* Returns 0 if given 0.
*/
function log2(uint256 x) internal pure returns (uint256 r) {
// If value has upper 128 bits set, log2 result is at least 128
r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
// If upper 64 bits of 128-bit half set, add 64 to result
r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
// If upper 32 bits of 64-bit half set, add 32 to result
r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
// If upper 16 bits of 32-bit half set, add 16 to result
r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
// If upper 8 bits of 16-bit half set, add 8 to result
r |= SafeCast.toUint((x >> r) > 0xff) << 3;
// If upper 4 bits of 8-bit half set, add 4 to result
r |= SafeCast.toUint((x >> r) > 0xf) << 2;
// Shifts value right by the current result and use it as an index into this lookup table:
//
// | x (4 bits) | index | table[index] = MSB position |
// |------------|---------|-----------------------------|
// | 0000 | 0 | table[0] = 0 |
// | 0001 | 1 | table[1] = 0 |
// | 0010 | 2 | table[2] = 1 |
// | 0011 | 3 | table[3] = 1 |
// | 0100 | 4 | table[4] = 2 |
// | 0101 | 5 | table[5] = 2 |
// | 0110 | 6 | table[6] = 2 |
// | 0111 | 7 | table[7] = 2 |
// | 1000 | 8 | table[8] = 3 |
// | 1001 | 9 | table[9] = 3 |
// | 1010 | 10 | table[10] = 3 |
// | 1011 | 11 | table[11] = 3 |
// | 1100 | 12 | table[12] = 3 |
// | 1101 | 13 | table[13] = 3 |
// | 1110 | 14 | table[14] = 3 |
// | 1111 | 15 | table[15] = 3 |
//
// The lookup table is represented as a 32-byte value with the MSB positions for 0-15 in the last 16 bytes.
assembly ("memory-safe") {
r := or(r, byte(shr(r, x), 0x0000010102020202030303030303030300000000000000000000000000000000))
}
}
/**
* @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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << result < value);
}
}
/**
* @dev Return the log in base 10 of a positive value rounded towards zero.
* 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 10 ** result < value);
}
}
/**
* @dev Return the log in base 256 of a positive value rounded towards zero.
* 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 x) internal pure returns (uint256 r) {
// If value has upper 128 bits set, log2 result is at least 128
r = SafeCast.toUint(x > 0xffffffffffffffffffffffffffffffff) << 7;
// If upper 64 bits of 128-bit half set, add 64 to result
r |= SafeCast.toUint((x >> r) > 0xffffffffffffffff) << 6;
// If upper 32 bits of 64-bit half set, add 32 to result
r |= SafeCast.toUint((x >> r) > 0xffffffff) << 5;
// If upper 16 bits of 32-bit half set, add 16 to result
r |= SafeCast.toUint((x >> r) > 0xffff) << 4;
// Add 1 if upper 8 bits of 16-bit half set, and divide accumulated result by 8
return (r >> 3) | SafeCast.toUint((x >> r) > 0xff);
}
/**
* @dev Return the log in base 256, 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 + SafeCast.toUint(unsignedRoundsUp(rounding) && 1 << (result << 3) < value);
}
}
/**
* @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
*/
function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
return uint8(rounding) % 2 == 1;
}
}
// File: @openzeppelin/contracts/utils/Arrays.sol
// OpenZeppelin Contracts (last updated v5.4.0) (utils/Arrays.sol)
// This file was procedurally generated from scripts/generate/templates/Arrays.js.
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to array types.
*/
library Arrays {
using SlotDerivation for bytes32;
using StorageSlot for bytes32;
/**
* @dev Sort an array of uint256 (in memory) following the provided comparator function.
*
* This function does the sorting "in place", meaning that it overrides the input. The object is returned for
* convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
*
* NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
* array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
* when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
* consume more gas than is available in a block, leading to potential DoS.
*
* IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
*/
function sort(
uint256[] memory array,
function(uint256, uint256) pure returns (bool) comp
) internal pure returns (uint256[] memory) {
_quickSort(_begin(array), _end(array), comp);
return array;
}
/**
* @dev Variant of {sort} that sorts an array of uint256 in increasing order.
*/
function sort(uint256[] memory array) internal pure returns (uint256[] memory) {
sort(array, Comparators.lt);
return array;
}
/**
* @dev Sort an array of address (in memory) following the provided comparator function.
*
* This function does the sorting "in place", meaning that it overrides the input. The object is returned for
* convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
*
* NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
* array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
* when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
* consume more gas than is available in a block, leading to potential DoS.
*
* IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
*/
function sort(
address[] memory array,
function(address, address) pure returns (bool) comp
) internal pure returns (address[] memory) {
sort(_castToUint256Array(array), _castToUint256Comp(comp));
return array;
}
/**
* @dev Variant of {sort} that sorts an array of address in increasing order.
*/
function sort(address[] memory array) internal pure returns (address[] memory) {
sort(_castToUint256Array(array), Comparators.lt);
return array;
}
/**
* @dev Sort an array of bytes32 (in memory) following the provided comparator function.
*
* This function does the sorting "in place", meaning that it overrides the input. The object is returned for
* convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
*
* NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
* array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
* when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
* consume more gas than is available in a block, leading to potential DoS.
*
* IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
*/
function sort(
bytes32[] memory array,
function(bytes32, bytes32) pure returns (bool) comp
) internal pure returns (bytes32[] memory) {
sort(_castToUint256Array(array), _castToUint256Comp(comp));
return array;
}
/**
* @dev Variant of {sort} that sorts an array of bytes32 in increasing order.
*/
function sort(bytes32[] memory array) internal pure returns (bytes32[] memory) {
sort(_castToUint256Array(array), Comparators.lt);
return array;
}
/**
* @dev Performs a quick sort of a segment of memory. The segment sorted starts at `begin` (inclusive), and stops
* at end (exclusive). Sorting follows the `comp` comparator.
*
* Invariant: `begin <= end`. This is the case when initially called by {sort} and is preserved in subcalls.
*
* IMPORTANT: Memory locations between `begin` and `end` are not validated/zeroed. This function should
* be used only if the limits are within a memory array.
*/
function _quickSort(uint256 begin, uint256 end, function(uint256, uint256) pure returns (bool) comp) private pure {
unchecked {
if (end - begin < 0x40) return;
// Use first element as pivot
uint256 pivot = _mload(begin);
// Position where the pivot should be at the end of the loop
uint256 pos = begin;
for (uint256 it = begin + 0x20; it < end; it += 0x20) {
if (comp(_mload(it), pivot)) {
// If the value stored at the iterator's position comes before the pivot, we increment the
// position of the pivot and move the value there.
pos += 0x20;
_swap(pos, it);
}
}
_swap(begin, pos); // Swap pivot into place
_quickSort(begin, pos, comp); // Sort the left side of the pivot
_quickSort(pos + 0x20, end, comp); // Sort the right side of the pivot
}
}
/**
* @dev Pointer to the memory location of the first element of `array`.
*/
function _begin(uint256[] memory array) private pure returns (uint256 ptr) {
assembly ("memory-safe") {
ptr := add(array, 0x20)
}
}
/**
* @dev Pointer to the memory location of the first memory word (32bytes) after `array`. This is the memory word
* that comes just after the last element of the array.
*/
function _end(uint256[] memory array) private pure returns (uint256 ptr) {
unchecked {
return _begin(array) + array.length * 0x20;
}
}
/**
* @dev Load memory word (as a uint256) at location `ptr`.
*/
function _mload(uint256 ptr) private pure returns (uint256 value) {
assembly {
value := mload(ptr)
}
}
/**
* @dev Swaps the elements memory location `ptr1` and `ptr2`.
*/
function _swap(uint256 ptr1, uint256 ptr2) private pure {
assembly {
let value1 := mload(ptr1)
let value2 := mload(ptr2)
mstore(ptr1, value2)
mstore(ptr2, value1)
}
}
/// @dev Helper: low level cast address memory array to uint256 memory array
function _castToUint256Array(address[] memory input) private pure returns (uint256[] memory output) {
assembly {
output := input
}
}
/// @dev Helper: low level cast bytes32 memory array to uint256 memory array
function _castToUint256Array(bytes32[] memory input) private pure returns (uint256[] memory output) {
assembly {
output := input
}
}
/// @dev Helper: low level cast address comp function to uint256 comp function
function _castToUint256Comp(
function(address, address) pure returns (bool) input
) private pure returns (function(uint256, uint256) pure returns (bool) output) {
assembly {
output := input
}
}
/// @dev Helper: low level cast bytes32 comp function to uint256 comp function
function _castToUint256Comp(
function(bytes32, bytes32) pure returns (bool) input
) private pure returns (function(uint256, uint256) pure returns (bool) output) {
assembly {
output := input
}
}
/**
* @dev Searches a sorted `array` and returns the first index that contains
* a value greater or equal to `element`. If no such index exists (i.e. all
* values in the array are strictly less than `element`), the array length is
* returned. Time complexity O(log n).
*
* NOTE: The `array` is expected to be sorted in ascending order, and to
* contain no repeated elements.
*
* IMPORTANT: Deprecated. This implementation behaves as {lowerBound} but lacks
* support for repeated elements in the array. The {lowerBound} function should
* be used instead.
*/
function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value > element) {
high = mid;
} else {
low = mid + 1;
}
}
// At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
if (low > 0 && unsafeAccess(array, low - 1).value == element) {
return low - 1;
} else {
return low;
}
}
/**
* @dev Searches an `array` sorted in ascending order and returns the first
* index that contains a value greater or equal than `element`. If no such index
* exists (i.e. all values in the array are strictly less than `element`), the array
* length is returned. Time complexity O(log n).
*
* See C++'s https://en.cppreference.com/w/cpp/algorithm/lower_bound[lower_bound].
*/
function lowerBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value < element) {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
} else {
high = mid;
}
}
return low;
}
/**
* @dev Searches an `array` sorted in ascending order and returns the first
* index that contains a value strictly greater than `element`. If no such index
* exists (i.e. all values in the array are strictly less than `element`), the array
* length is returned. Time complexity O(log n).
*
* See C++'s https://en.cppreference.com/w/cpp/algorithm/upper_bound[upper_bound].
*/
function upperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeAccess(array, mid).value > element) {
high = mid;
} else {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
}
}
return low;
}
/**
* @dev Same as {lowerBound}, but with an array in memory.
*/
function lowerBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeMemoryAccess(array, mid) < element) {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
} else {
high = mid;
}
}
return low;
}
/**
* @dev Same as {upperBound}, but with an array in memory.
*/
function upperBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) {
uint256 low = 0;
uint256 high = array.length;
if (high == 0) {
return 0;
}
while (low < high) {
uint256 mid = Math.average(low, high);
// Note that mid will always be strictly less than high (i.e. it will be a valid array index)
// because Math.average rounds towards zero (it does integer division with truncation).
if (unsafeMemoryAccess(array, mid) > element) {
high = mid;
} else {
// this cannot overflow because mid < high
unchecked {
low = mid + 1;
}
}
}
return low;
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getAddressSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getBytes32Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getUint256Slot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(bytes[] storage arr, uint256 pos) internal pure returns (StorageSlot.BytesSlot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getBytesSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeAccess(string[] storage arr, uint256 pos) internal pure returns (StorageSlot.StringSlot storage) {
bytes32 slot;
assembly ("memory-safe") {
slot := arr.slot
}
return slot.deriveArray().offset(pos).getStringSlot();
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(bytes32[] memory arr, uint256 pos) internal pure returns (bytes32 res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(bytes[] memory arr, uint256 pos) internal pure returns (bytes memory res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
*
* WARNING: Only use if you are certain `pos` is lower than the array length.
*/
function unsafeMemoryAccess(string[] memory arr, uint256 pos) internal pure returns (string memory res) {
assembly {
res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(address[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(bytes32[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(uint256[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(bytes[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
/**
* @dev Helper to set the length of a dynamic array. Directly writing to `.length` is forbidden.
*
* WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
*/
function unsafeSetLength(string[] storage array, uint256 len) internal {
assembly ("memory-safe") {
sstore(array.slot, len)
}
}
}
// File: @openzeppelin/contracts/utils/structs/EnumerableSet.sol
// OpenZeppelin Contracts (last updated v5.4.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.20;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
* - Set can be cleared (all elements removed) in O(n).
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* The following types are supported:
*
* - `bytes32` (`Bytes32Set`) since v3.3.0
* - `address` (`AddressSet`) since v3.3.0
* - `uint256` (`UintSet`) since v3.3.0
* - `string` (`StringSet`) since v5.4.0
* - `bytes` (`BytesSet`) since v5.4.0
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position is the index of the value in the `values` array plus 1.
// Position 0 is used to mean a value is not in the set.
mapping(bytes32 value => uint256) _positions;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._positions[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We cache the value's position to prevent multiple reads from the same storage slot
uint256 position = set._positions[value];
if (position != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 valueIndex = position - 1;
uint256 lastIndex = set._values.length - 1;
if (valueIndex != lastIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the lastValue to the index where the value to delete is
set._values[valueIndex] = lastValue;
// Update the tracked position of the lastValue (that was just moved)
set._positions[lastValue] = position;
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the tracked position for the deleted slot
delete set._positions[value];
return true;
} else {
return false;
}
}
/**
* @dev Removes all the values from a set. O(n).
*
* WARNING: This function has an unbounded cost that scales with set size. Developers should keep in mind that
* using it may render the function uncallable if the set grows to the point where clearing it consumes too much
* gas to fit in a block.
*/
function _clear(Set storage set) private {
uint256 len = _length(set);
for (uint256 i = 0; i < len; ++i) {
delete set._positions[set._values[i]];
}
Arrays.unsafeSetLength(set._values, 0);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._positions[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
/**
* @dev Return a slice of the set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set, uint256 start, uint256 end) private view returns (bytes32[] memory) {
unchecked {
end = Math.min(end, _length(set));
start = Math.min(start, end);
uint256 len = end - start;
bytes32[] memory result = new bytes32[](len);
for (uint256 i = 0; i < len; ++i) {
result[i] = Arrays.unsafeAccess(set._values, start + i).value;
}
return result;
}
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Removes all the values from a set. O(n).
*
* WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the
* function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.
*/
function clear(Bytes32Set storage set) internal {
_clear(set._inner);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
assembly ("memory-safe") {
result := store
}
return result;
}
/**
* @dev Return a slice of the set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set, uint256 start, uint256 end) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner, start, end);
bytes32[] memory result;
assembly ("memory-safe") {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes all the values from a set. O(n).
*
* WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the
* function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.
*/
function clear(AddressSet storage set) internal {
_clear(set._inner);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
assembly ("memory-safe") {
result := store
}
return result;
}
/**
* @dev Return a slice of the set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set, uint256 start, uint256 end) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner, start, end);
address[] memory result;
assembly ("memory-safe") {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Removes all the values from a set. O(n).
*
* WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the
* function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.
*/
function clear(UintSet storage set) internal {
_clear(set._inner);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
assembly ("memory-safe") {
result := store
}
return result;
}
/**
* @dev Return a slice of the set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set, uint256 start, uint256 end) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner, start, end);
uint256[] memory result;
assembly ("memory-safe") {
result := store
}
return result;
}
struct StringSet {
// Storage of set values
string[] _values;
// Position is the index of the value in the `values` array plus 1.
// Position 0 is used to mean a value is not in the set.
mapping(string value => uint256) _positions;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(StringSet storage set, string memory value) internal returns (bool) {
if (!contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._positions[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(StringSet storage set, string memory value) internal returns (bool) {
// We cache the value's position to prevent multiple reads from the same storage slot
uint256 position = set._positions[value];
if (position != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 valueIndex = position - 1;
uint256 lastIndex = set._values.length - 1;
if (valueIndex != lastIndex) {
string memory lastValue = set._values[lastIndex];
// Move the lastValue to the index where the value to delete is
set._values[valueIndex] = lastValue;
// Update the tracked position of the lastValue (that was just moved)
set._positions[lastValue] = position;
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the tracked position for the deleted slot
delete set._positions[value];
return true;
} else {
return false;
}
}
/**
* @dev Removes all the values from a set. O(n).
*
* WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the
* function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.
*/
function clear(StringSet storage set) internal {
uint256 len = length(set);
for (uint256 i = 0; i < len; ++i) {
delete set._positions[set._values[i]];
}
Arrays.unsafeSetLength(set._values, 0);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(StringSet storage set, string memory value) internal view returns (bool) {
return set._positions[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(StringSet storage set) internal view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(StringSet storage set, uint256 index) internal view returns (string memory) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(StringSet storage set) internal view returns (string[] memory) {
return set._values;
}
/**
* @dev Return a slice of the set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(StringSet storage set, uint256 start, uint256 end) internal view returns (string[] memory) {
unchecked {
end = Math.min(end, length(set));
start = Math.min(start, end);
uint256 len = end - start;
string[] memory result = new string[](len);
for (uint256 i = 0; i < len; ++i) {
result[i] = Arrays.unsafeAccess(set._values, start + i).value;
}
return result;
}
}
struct BytesSet {
// Storage of set values
bytes[] _values;
// Position is the index of the value in the `values` array plus 1.
// Position 0 is used to mean a value is not in the set.
mapping(bytes value => uint256) _positions;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(BytesSet storage set, bytes memory value) internal returns (bool) {
if (!contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._positions[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(BytesSet storage set, bytes memory value) internal returns (bool) {
// We cache the value's position to prevent multiple reads from the same storage slot
uint256 position = set._positions[value];
if (position != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 valueIndex = position - 1;
uint256 lastIndex = set._values.length - 1;
if (valueIndex != lastIndex) {
bytes memory lastValue = set._values[lastIndex];
// Move the lastValue to the index where the value to delete is
set._values[valueIndex] = lastValue;
// Update the tracked position of the lastValue (that was just moved)
set._positions[lastValue] = position;
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the tracked position for the deleted slot
delete set._positions[value];
return true;
} else {
return false;
}
}
/**
* @dev Removes all the values from a set. O(n).
*
* WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the
* function uncallable if the set grows to the point where clearing it consumes too much gas to fit in a block.
*/
function clear(BytesSet storage set) internal {
uint256 len = length(set);
for (uint256 i = 0; i < len; ++i) {
delete set._positions[set._values[i]];
}
Arrays.unsafeSetLength(set._values, 0);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(BytesSet storage set, bytes memory value) internal view returns (bool) {
return set._positions[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(BytesSet storage set) internal view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(BytesSet storage set, uint256 index) internal view returns (bytes memory) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(BytesSet storage set) internal view returns (bytes[] memory) {
return set._values;
}
/**
* @dev Return a slice of the set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(BytesSet storage set, uint256 start, uint256 end) internal view returns (bytes[] memory) {
unchecked {
end = Math.min(end, length(set));
start = Math.min(start, end);
uint256 len = end - start;
bytes[] memory result = new bytes[](len);
for (uint256 i = 0; i < len; ++i) {
result[i] = Arrays.unsafeAccess(set._values, start + i).value;
}
return result;
}
}
}
// File: CryptoCatsSoftStaking.sol
pragma solidity ^0.8.4;
contract GSASoftStake is ReentrancyGuard, Pausable, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using EnumerableSet for EnumerableSet.UintSet;
address public rewardToken;
address public collection;
address public payee;
uint256 public claimFee = 0.2 ether;
uint256 public rewardsPerUnitTime;
uint256 public timeUnit;
mapping(address => EnumerableSet.UintSet) private _stakedNFTs;
mapping(address => mapping(uint256 => uint256)) public nftStakingStartTime;
mapping(uint256 => bool) public claimed;
mapping(address => uint256) public lastClaimTime;
event NFTStaked(address indexed user, uint256 indexed tokenId, uint256 timestamp);
event NFTUnstaked(address indexed user, uint256 indexed tokenId, uint256 timestamp);
event ClaimFeeUpdated(uint256 newFee);
event RewardsPerUnitTimeUpdated(uint256 newRewardsPerUnitTime);
event TimeUnitUpdated(uint256 newTimeUnit);
event AllRewardsClaimed(address indexed user, uint256 totalRewards, uint256 feePaid);
constructor(
address _rewardToken,
address _collection,
address _payee,
uint256 _rewardsPerUnitTime,
uint256 _timeUnit
) Ownable(msg.sender) {
rewardToken = _rewardToken;
collection = _collection;
payee = _payee;
rewardsPerUnitTime = _rewardsPerUnitTime;
timeUnit = _timeUnit;
}
function isStillNFTOwner(address user, uint256 tokenId) public view returns (bool) {
try IERC721(collection).ownerOf(tokenId) returns (address owner) {
return owner == user;
} catch {
return false;
}
}
function stakeNFTs(uint256[] calldata tokenIds) external whenNotPaused {
IERC721 nftContract = IERC721(collection);
for (uint256 i = 0; i < tokenIds.length; i++) {
uint256 tokenId = tokenIds[i];
require(nftContract.ownerOf(tokenId) == msg.sender, "Not NFT owner");
if (nftStakingStartTime[msg.sender][tokenId] == 0) {
nftStakingStartTime[msg.sender][tokenId] = block.timestamp;
_stakedNFTs[msg.sender].add(tokenId);
emit NFTStaked(msg.sender, tokenId, block.timestamp);
}
}
}
function unstakeNFTs(uint256[] calldata tokenIds) external whenNotPaused {
for (uint256 i = 0; i < tokenIds.length; i++) {
uint256 tokenId = tokenIds[i];
require(nftStakingStartTime[msg.sender][tokenId] > 0, "NFT not staked");
nftStakingStartTime[msg.sender][tokenId] = 0;
_stakedNFTs[msg.sender].remove(tokenId);
emit NFTUnstaked(msg.sender, tokenId, block.timestamp);
}
}
function calculateRewardsForNFT(address user, uint256 tokenId) public view returns (uint256) {
if (!isStillNFTOwner(user, tokenId)) {
return 0;
}
uint256 stakingStartTime = nftStakingStartTime[user][tokenId];
if (stakingStartTime == 0) return 0;
uint256 stakingDuration = block.timestamp.sub(stakingStartTime);
uint256 rewardUnits = stakingDuration.div(timeUnit);
return rewardUnits.mul(rewardsPerUnitTime);
}
function calculateTotalRewards(address user) public view returns (uint256 totalRewards) {
uint256[] memory stakedNFTs = getStakedNFTs(user);
for (uint256 i = 0; i < stakedNFTs.length; i++) {
uint256 tokenId = stakedNFTs[i];
if (isStillNFTOwner(user, tokenId)) {
totalRewards = totalRewards.add(calculateRewardsForNFT(user, tokenId));
}
}
return totalRewards;
}
function getStakedNFTs(address user) public view returns (uint256[] memory) {
return _stakedNFTs[user].values();
}
function getStakedNFTsCount(address user) public view returns (uint256) {
return _stakedNFTs[user].length();
}
function getValidStakedNFTsCount(address user) public view returns (uint256) {
uint256[] memory stakedNFTs = getStakedNFTs(user);
uint256 validCount = 0;
for (uint256 i = 0; i < stakedNFTs.length; i++) {
if (isStillNFTOwner(user, stakedNFTs[i])) {
validCount++;
}
}
return validCount;
}
function cleanupStakedNFTs(address user) public {
uint256[] memory stakedNFTs = getStakedNFTs(user);
for (uint256 i = 0; i < stakedNFTs.length; i++) {
uint256 tokenId = stakedNFTs[i];
if (!isStillNFTOwner(user, tokenId)) {
nftStakingStartTime[user][tokenId] = 0;
_stakedNFTs[user].remove(tokenId);
emit NFTUnstaked(user, tokenId, block.timestamp);
}
}
}
function claimAllRewards() external payable nonReentrant whenNotPaused {
require(msg.value >= claimFee, "SoftStaking: claim fee required");
cleanupStakedNFTs(msg.sender);
uint256 totalRewards = calculateTotalRewards(msg.sender);
require(totalRewards > 0, "No rewards to claim");
IERC20(rewardToken).safeTransfer(msg.sender, totalRewards);
uint256[] memory stakedNFTs = getStakedNFTs(msg.sender);
for (uint256 i = 0; i < stakedNFTs.length; i++) {
uint256 tokenId = stakedNFTs[i];
if (isStillNFTOwner(msg.sender, tokenId)) {
nftStakingStartTime[msg.sender][tokenId] = block.timestamp;
}
}
payable(payee).transfer(msg.value);
lastClaimTime[msg.sender] = block.timestamp;
emit AllRewardsClaimed(msg.sender, totalRewards, msg.value);
}
function cleanupMyNFTs() external {
cleanupStakedNFTs(msg.sender);
}
function setRewardsPerUnitTime(uint256 _rewardsPerUnitTime) external onlyOwner {
require(_rewardsPerUnitTime > 0, "SoftStaking: rewards per unit time must be greater than 0");
rewardsPerUnitTime = _rewardsPerUnitTime;
emit RewardsPerUnitTimeUpdated(_rewardsPerUnitTime);
}
function setTimeUnit(uint256 _timeUnit) external onlyOwner {
require(_timeUnit > 0, "SoftStaking: time unit must be greater than 0");
timeUnit = _timeUnit;
emit TimeUnitUpdated(_timeUnit);
}
function setRewardToken(address _rewardToken) external onlyOwner {
rewardToken = _rewardToken;
}
function setClaimFee(uint256 _newFee) external onlyOwner {
claimFee = _newFee;
emit ClaimFeeUpdated(_newFee);
}
function setPayee(address _payee) external onlyOwner {
payee = _payee;
}
function pause() external onlyOwner {
_pause();
}
function unpause() external onlyOwner {
_unpause();
}
function withdraw(address _token, uint256 _amount) external onlyOwner {
IERC20(_token).safeTransfer(msg.sender, _amount);
}
function withdrawETH(uint256 _amount) external onlyOwner {
payable(owner()).transfer(_amount);
}
function isClaimed(uint256 batchId) external view returns (bool) {
return claimed[batchId];
}
function getUserClaimInfo(address user) external view returns (uint256 lastClaim) {
return lastClaimTime[user];
}
function getRewardsConfig() external view returns (uint256 currentRewardsPerUnitTime, uint256 currentTimeUnit) {
return (rewardsPerUnitTime, timeUnit);
}
function getUserStakingInfo(address user) external view returns (
uint256 stakedNFTsCount,
uint256 totalRewards,
uint256 lastClaim
) {
return (
getStakedNFTsCount(user),
calculateTotalRewards(user),
lastClaimTime[user]
);
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_collection","type":"address"},{"internalType":"address","name":"_payee","type":"address"},{"internalType":"uint256","name":"_rewardsPerUnitTime","type":"uint256"},{"internalType":"uint256","name":"_timeUnit","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalRewards","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feePaid","type":"uint256"}],"name":"AllRewardsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newFee","type":"uint256"}],"name":"ClaimFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"NFTStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"NFTUnstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newRewardsPerUnitTime","type":"uint256"}],"name":"RewardsPerUnitTimeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newTimeUnit","type":"uint256"}],"name":"TimeUnitUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"calculateRewardsForNFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"calculateTotalRewards","outputs":[{"internalType":"uint256","name":"totalRewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimAllRewards","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"claimFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"claimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cleanupMyNFTs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"cleanupStakedNFTs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collection","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardsConfig","outputs":[{"internalType":"uint256","name":"currentRewardsPerUnitTime","type":"uint256"},{"internalType":"uint256","name":"currentTimeUnit","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getStakedNFTs","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getStakedNFTsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserClaimInfo","outputs":[{"internalType":"uint256","name":"lastClaim","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserStakingInfo","outputs":[{"internalType":"uint256","name":"stakedNFTsCount","type":"uint256"},{"internalType":"uint256","name":"totalRewards","type":"uint256"},{"internalType":"uint256","name":"lastClaim","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getValidStakedNFTsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"name":"isClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isStillNFTOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastClaimTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"nftStakingStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"payee","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsPerUnitTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newFee","type":"uint256"}],"name":"setClaimFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_payee","type":"address"}],"name":"setPayee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardToken","type":"address"}],"name":"setRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardsPerUnitTime","type":"uint256"}],"name":"setRewardsPerUnitTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_timeUnit","type":"uint256"}],"name":"setTimeUnit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"stakeNFTs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timeUnit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"unstakeNFTs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60806040526702c68af0bb14000060055534801561001b575f5ffd5b50604051612d8d380380612d8d833981810160405281019061003d9190610309565b3360015f819055505f60015f6101000a81548160ff0219169083151502179055505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036100ce575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016100c5919061038f565b60405180910390fd5b6100dd816101b660201b60201c565b508460025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508360035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508260045f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816006819055508060078190555050505050506103a8565b5f60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816001806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6102a58261027c565b9050919050565b6102b58161029b565b81146102bf575f5ffd5b50565b5f815190506102d0816102ac565b92915050565b5f819050919050565b6102e8816102d6565b81146102f2575f5ffd5b50565b5f81519050610303816102df565b92915050565b5f5f5f5f5f60a0868803121561032257610321610278565b5b5f61032f888289016102c2565b9550506020610340888289016102c2565b9450506040610351888289016102c2565b9350506060610362888289016102f5565b9250506080610373888289016102f5565b9150509295509295909350565b6103898161029b565b82525050565b5f6020820190506103a25f830184610380565b92915050565b6129d8806103b55f395ff3fe608060405260043610610219575f3560e01c80637de1e53611610122578063b77cf9c6116100aa578063ee75defd1161006e578063ee75defd146107a6578063f14210a6146107e2578063f2fde38b1461080a578063f3fef3a314610832578063f7c618c11461085a57610219565b8063b77cf9c6146106a0578063c3432ce2146106dc578063cdb039cd14610718578063cf030c3c14610740578063dbe7e3bd1461076a57610219565b80638cfd0e9a116100f15780638cfd0e9a146105be5780638da5cb5b146105e657806399d32fc4146106105780639e34070f1461063a578063ae90b2131461067657610219565b80637de1e5361461051857806380933608146105425780638456cb59146105805780638aee81271461059657610219565b806340fd4af6116101a55780636360106f116101745780636360106f146104265780636f70d2121461044e57806370c8a3711461048a578063715018a6146104c657806374fb1511146104dc57610219565b806340fd4af61461036d578063410459ad146103a95780635c3af1ba146103d15780635c975abb146103fc57610219565b806323ef2580116101ec57806323ef2580146102c75780632e75ab50146102ef57806337c362c5146103175780633c6a7f9b1461032d5780633f4ba83a1461035757610219565b80630a6f826d1461021d5780630b83a727146102595780630f48a4821461026357806316d17e251461028b575b5f5ffd5b348015610228575f5ffd5b50610243600480360381019061023e919061203d565b610884565b6040516102509190612080565b60405180910390f35b6102616108d1565b005b34801561026e575f5ffd5b50610289600480360381019061028491906120fa565b610b74565b005b348015610296575f5ffd5b506102b160048036038101906102ac919061216f565b610e0b565b6040516102be9190612080565b60405180910390f35b3480156102d2575f5ffd5b506102ed60048036038101906102e891906121ad565b610ed1565b005b3480156102fa575f5ffd5b50610315600480360381019061031091906121ad565b610f5c565b005b348015610322575f5ffd5b5061032b610fa5565b005b348015610338575f5ffd5b50610341610fb0565b60405161034e9190612080565b60405180910390f35b348015610362575f5ffd5b5061036b610fb6565b005b348015610378575f5ffd5b50610393600480360381019061038e919061216f565b610fc8565b6040516103a09190612080565b60405180910390f35b3480156103b4575f5ffd5b506103cf60048036038101906103ca919061203d565b610fe8565b005b3480156103dc575f5ffd5b506103e5611033565b6040516103f39291906121d8565b60405180910390f35b348015610407575f5ffd5b50610410611043565b60405161041d9190612219565b60405180910390f35b348015610431575f5ffd5b5061044c600480360381019061044791906121ad565b611058565b005b348015610459575f5ffd5b50610474600480360381019061046f919061203d565b6110e3565b60405161048191906122e9565b60405180910390f35b348015610495575f5ffd5b506104b060048036038101906104ab919061203d565b611131565b6040516104bd9190612080565b60405180910390f35b3480156104d1575f5ffd5b506104da6111ad565b005b3480156104e7575f5ffd5b5061050260048036038101906104fd919061216f565b6111c0565b60405161050f9190612219565b60405180910390f35b348015610523575f5ffd5b5061052c61129a565b6040516105399190612318565b60405180910390f35b34801561054d575f5ffd5b506105686004803603810190610563919061203d565b6112bf565b60405161057793929190612331565b60405180910390f35b34801561058b575f5ffd5b5061059461131f565b005b3480156105a1575f5ffd5b506105bc60048036038101906105b7919061203d565b611331565b005b3480156105c9575f5ffd5b506105e460048036038101906105df919061203d565b61137c565b005b3480156105f1575f5ffd5b506105fa6114c6565b6040516106079190612318565b60405180910390f35b34801561061b575f5ffd5b506106246114ed565b6040516106319190612080565b60405180910390f35b348015610645575f5ffd5b50610660600480360381019061065b91906121ad565b6114f3565b60405161066d9190612219565b60405180910390f35b348015610681575f5ffd5b5061068a611519565b6040516106979190612318565b60405180910390f35b3480156106ab575f5ffd5b506106c660048036038101906106c1919061203d565b61153e565b6040516106d39190612080565b60405180910390f35b3480156106e7575f5ffd5b5061070260048036038101906106fd919061203d565b611553565b60405161070f9190612080565b60405180910390f35b348015610723575f5ffd5b5061073e600480360381019061073991906120fa565b6115c2565b005b34801561074b575f5ffd5b50610754611788565b6040516107619190612080565b60405180910390f35b348015610775575f5ffd5b50610790600480360381019061078b91906121ad565b61178e565b60405161079d9190612219565b60405180910390f35b3480156107b1575f5ffd5b506107cc60048036038101906107c7919061203d565b6117ab565b6040516107d99190612080565b60405180910390f35b3480156107ed575f5ffd5b50610808600480360381019061080391906121ad565b6117f1565b005b348015610815575f5ffd5b50610830600480360381019061082b919061203d565b611847565b005b34801561083d575f5ffd5b506108586004803603810190610853919061216f565b6118cb565b005b348015610865575f5ffd5b5061086e611902565b60405161087b9190612318565b60405180910390f35b5f6108ca60085f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20611927565b9050919050565b6108d961193a565b6108e1611987565b600554341015610926576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091d906123c0565b60405180910390fd5b61092f3361137c565b5f61093933611131565b90505f811161097d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097490612428565b60405180910390fd5b6109c9338260025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166119d19092919063ffffffff16565b5f6109d3336110e3565b90505f5f90505b8151811015610a70575f8282815181106109f7576109f6612446565b5b60200260200101519050610a0b33826111c0565b15610a62574260095f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f20819055505b5080806001019150506109da565b5060045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3490811502906040515f60405180830381858888f19350505050158015610ad5573d5f5f3e3d5ffd5b5042600b5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055503373ffffffffffffffffffffffffffffffffffffffff167f319c0eb8ab757d7ee57e1b1491e73802e6cb5d83e658195ca2893b4ede42fa418334604051610b609291906121d8565b60405180910390a25050610b72611a50565b565b610b7c611987565b5f60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505f5f90505b83839050811015610e05575f848483818110610bc557610bc4612446565b5b9050602002013590503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b8152600401610c1e9190612080565b602060405180830381865afa158015610c39573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c5d9190612487565b73ffffffffffffffffffffffffffffffffffffffff1614610cb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caa906124fc565b60405180910390fd5b5f60095f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f205403610df7574260095f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f2081905550610da68160085f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20611a5990919063ffffffff16565b50803373ffffffffffffffffffffffffffffffffffffffff167f36b3725f1783bad4ff05b7f4c077c3aa68eeb23a4d054ba189db4d01ac278d3942604051610dee9190612080565b60405180910390a35b508080600101915050610ba6565b50505050565b5f610e1683836111c0565b610e22575f9050610ecb565b5f60095f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8481526020019081526020015f205490505f8103610e82575f915050610ecb565b5f610e968242611a7090919063ffffffff16565b90505f610eae60075483611a8590919063ffffffff16565b9050610ec560065482611a9a90919063ffffffff16565b93505050505b92915050565b610ed9611aaf565b5f8111610f1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f129061258a565b60405180910390fd5b806006819055507f0a8808bd305233df45947ae5ad84c81adedf20f410215919235cbe4a1c62f50281604051610f519190612080565b60405180910390a150565b610f64611aaf565b806005819055507f64374f1a975abb9bc8e8857d704b9ead41989ff599d90c1e8f7d34bc2ebea92a81604051610f9a9190612080565b60405180910390a150565b610fae3361137c565b565b60075481565b610fbe611aaf565b610fc6611b36565b565b6009602052815f5260405f20602052805f5260405f205f91509150505481565b610ff0611aaf565b8060045f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f5f600654600754915091509091565b5f60015f9054906101000a900460ff16905090565b611060611aaf565b5f81116110a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109990612618565b60405180910390fd5b806007819055507f2d651dfbca176d0c67ca9b08ffa05ad3be789aeb4583bbc9a0c35ead0128e7cd816040516110d89190612080565b60405180910390a150565b606061112a60085f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20611b97565b9050919050565b5f5f61113c836110e3565b90505f5f90505b81518110156111a6575f8282815181106111605761115f612446565b5b6020026020010151905061117485826111c0565b15611198576111956111868683610e0b565b85611bb690919063ffffffff16565b93505b508080600101915050611143565b5050919050565b6111b5611aaf565b6111be5f611bcb565b565b5f60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b815260040161121b9190612080565b602060405180830381865afa92505050801561125557506040513d601f19601f820116820180604052508101906112529190612487565b60015b611261575f9050611294565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16149150505b92915050565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f5f5f6112cb84610884565b6112d485611131565b600b5f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549250925092509193909250565b611327611aaf565b61132f611c8d565b565b611339611aaf565b8060025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f611386826110e3565b90505f5f90505b81518110156114c1575f8282815181106113aa576113a9612446565b5b602002602001015190506113be84826111c0565b6114b3575f60095f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f20819055506114628160085f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20611cee90919063ffffffff16565b50808473ffffffffffffffffffffffffffffffffffffffff167fc486b9458a8637650d84d262414833a5a457bc91ae86b7da110386c8c3fa255b426040516114aa9190612080565b60405180910390a35b50808060010191505061138d565b505050565b5f60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60055481565b5f600a5f8381526020019081526020015f205f9054906101000a900460ff169050919050565b60045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b602052805f5260405f205f915090505481565b5f5f61155e836110e3565b90505f5f90505f5f90505b82518110156115b7576115968584838151811061158957611588612446565b5b60200260200101516111c0565b156115aa5781806115a690612663565b9250505b8080600101915050611569565b508092505050919050565b6115ca611987565b5f5f90505b82829050811015611783575f8383838181106115ee576115ed612446565b5b9050602002013590505f60095f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f205411611685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167c906126f4565b60405180910390fd5b5f60095f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f20819055506117258160085f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20611cee90919063ffffffff16565b50803373ffffffffffffffffffffffffffffffffffffffff167fc486b9458a8637650d84d262414833a5a457bc91ae86b7da110386c8c3fa255b4260405161176d9190612080565b60405180910390a35080806001019150506115cf565b505050565b60065481565b600a602052805f5260405f205f915054906101000a900460ff1681565b5f600b5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6117f9611aaf565b6118016114c6565b73ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f19350505050158015611843573d5f5f3e3d5ffd5b5050565b61184f611aaf565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036118bf575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016118b69190612318565b60405180910390fd5b6118c881611bcb565b50565b6118d3611aaf565b6118fe33828473ffffffffffffffffffffffffffffffffffffffff166119d19092919063ffffffff16565b5050565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f611933825f01611d05565b9050919050565b60025f540361197e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119759061275c565b60405180910390fd5b60025f81905550565b61198f611043565b156119cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119c6906127c4565b60405180910390fd5b565b611a4b838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8585604051602401611a049291906127e2565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611d14565b505050565b60015f81905550565b5f611a68835f01835f1b611daf565b905092915050565b5f8183611a7d9190612809565b905092915050565b5f8183611a929190612869565b905092915050565b5f8183611aa79190612899565b905092915050565b611ab7611e16565b73ffffffffffffffffffffffffffffffffffffffff16611ad56114c6565b73ffffffffffffffffffffffffffffffffffffffff1614611b3457611af8611e16565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611b2b9190612318565b60405180910390fd5b565b611b3e611e1d565b5f60015f6101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611b80611e16565b604051611b8d9190612318565b60405180910390a1565b60605f611ba5835f01611e66565b905060608190508092505050919050565b5f8183611bc391906128da565b905092915050565b5f60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816001806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b611c95611987565b6001805f6101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611cd7611e16565b604051611ce49190612318565b60405180910390a1565b5f611cfd835f01835f1b611ebf565b905092915050565b5f815f01805490509050919050565b5f5f60205f8451602086015f885af180611d33576040513d5f823e3d81fd5b3d92505f519150505f8214611d4c576001811415611d67565b5f8473ffffffffffffffffffffffffffffffffffffffff163b145b15611da957836040517f5274afe7000000000000000000000000000000000000000000000000000000008152600401611da09190612318565b60405180910390fd5b50505050565b5f611dba8383611fbb565b611e0c57825f0182908060018154018082558091505060019003905f5260205f20015f9091909190915055825f0180549050836001015f8481526020019081526020015f208190555060019050611e10565b5f90505b92915050565b5f33905090565b611e25611043565b611e64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e5b90612957565b60405180910390fd5b565b6060815f01805480602002602001604051908101604052809291908181526020018280548015611eb357602002820191905f5260205f20905b815481526020019060010190808311611e9f575b50505050509050919050565b5f5f836001015f8481526020019081526020015f205490505f8114611fb0575f600182611eec9190612809565b90505f6001865f0180549050611f029190612809565b9050808214611f68575f865f018281548110611f2157611f20612446565b5b905f5260205f200154905080875f018481548110611f4257611f41612446565b5b905f5260205f20018190555083876001015f8381526020019081526020015f2081905550505b855f01805480611f7b57611f7a612975565b5b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050611fb5565b5f9150505b92915050565b5f5f836001015f8481526020019081526020015f20541415905092915050565b5f5ffd5b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61200c82611fe3565b9050919050565b61201c81612002565b8114612026575f5ffd5b50565b5f8135905061203781612013565b92915050565b5f6020828403121561205257612051611fdb565b5b5f61205f84828501612029565b91505092915050565b5f819050919050565b61207a81612068565b82525050565b5f6020820190506120935f830184612071565b92915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126120ba576120b9612099565b5b8235905067ffffffffffffffff8111156120d7576120d661209d565b5b6020830191508360208202830111156120f3576120f26120a1565b5b9250929050565b5f5f602083850312156121105761210f611fdb565b5b5f83013567ffffffffffffffff81111561212d5761212c611fdf565b5b612139858286016120a5565b92509250509250929050565b61214e81612068565b8114612158575f5ffd5b50565b5f8135905061216981612145565b92915050565b5f5f6040838503121561218557612184611fdb565b5b5f61219285828601612029565b92505060206121a38582860161215b565b9150509250929050565b5f602082840312156121c2576121c1611fdb565b5b5f6121cf8482850161215b565b91505092915050565b5f6040820190506121eb5f830185612071565b6121f86020830184612071565b9392505050565b5f8115159050919050565b612213816121ff565b82525050565b5f60208201905061222c5f83018461220a565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61226481612068565b82525050565b5f612275838361225b565b60208301905092915050565b5f602082019050919050565b5f61229782612232565b6122a1818561223c565b93506122ac8361224c565b805f5b838110156122dc5781516122c3888261226a565b97506122ce83612281565b9250506001810190506122af565b5085935050505092915050565b5f6020820190508181035f830152612301818461228d565b905092915050565b61231281612002565b82525050565b5f60208201905061232b5f830184612309565b92915050565b5f6060820190506123445f830186612071565b6123516020830185612071565b61235e6040830184612071565b949350505050565b5f82825260208201905092915050565b7f536f66745374616b696e673a20636c61696d20666565207265717569726564005f82015250565b5f6123aa601f83612366565b91506123b582612376565b602082019050919050565b5f6020820190508181035f8301526123d78161239e565b9050919050565b7f4e6f207265776172647320746f20636c61696d000000000000000000000000005f82015250565b5f612412601383612366565b915061241d826123de565b602082019050919050565b5f6020820190508181035f83015261243f81612406565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f8151905061248181612013565b92915050565b5f6020828403121561249c5761249b611fdb565b5b5f6124a984828501612473565b91505092915050565b7f4e6f74204e4654206f776e6572000000000000000000000000000000000000005f82015250565b5f6124e6600d83612366565b91506124f1826124b2565b602082019050919050565b5f6020820190508181035f830152612513816124da565b9050919050565b7f536f66745374616b696e673a20726577617264732070657220756e69742074695f8201527f6d65206d7573742062652067726561746572207468616e203000000000000000602082015250565b5f612574603983612366565b915061257f8261251a565b604082019050919050565b5f6020820190508181035f8301526125a181612568565b9050919050565b7f536f66745374616b696e673a2074696d6520756e6974206d75737420626520675f8201527f726561746572207468616e203000000000000000000000000000000000000000602082015250565b5f612602602d83612366565b915061260d826125a8565b604082019050919050565b5f6020820190508181035f83015261262f816125f6565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61266d82612068565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361269f5761269e612636565b5b600182019050919050565b7f4e4654206e6f74207374616b65640000000000000000000000000000000000005f82015250565b5f6126de600e83612366565b91506126e9826126aa565b602082019050919050565b5f6020820190508181035f83015261270b816126d2565b9050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c005f82015250565b5f612746601f83612366565b915061275182612712565b602082019050919050565b5f6020820190508181035f8301526127738161273a565b9050919050565b7f5061757361626c653a20706175736564000000000000000000000000000000005f82015250565b5f6127ae601083612366565b91506127b98261277a565b602082019050919050565b5f6020820190508181035f8301526127db816127a2565b9050919050565b5f6040820190506127f55f830185612309565b6128026020830184612071565b9392505050565b5f61281382612068565b915061281e83612068565b925082820390508181111561283657612835612636565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61287382612068565b915061287e83612068565b92508261288e5761288d61283c565b5b828204905092915050565b5f6128a382612068565b91506128ae83612068565b92508282026128bc81612068565b915082820484148315176128d3576128d2612636565b5b5092915050565b5f6128e482612068565b91506128ef83612068565b925082820190508082111561290757612906612636565b5b92915050565b7f5061757361626c653a206e6f74207061757365640000000000000000000000005f82015250565b5f612941601483612366565b915061294c8261290d565b602082019050919050565b5f6020820190508181035f83015261296e81612935565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603160045260245ffdfea26469706673582212205de05a0a0f7f287a4b69b428a3c3c761260e624a4ce802616fa6463683b1759e64736f6c634300081e0033000000000000000000000000c3882d10e49ac4e9888d0c594db723fc9ce954680000000000000000000000001aa6f12114d91a849499a7ea24b28913227c34550000000000000000000000003f13c3185f8acd4f70529bd6483edf1aa558718600000000000000000000000000000000000000000000000000291e8f1dc8ea800000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x608060405260043610610219575f3560e01c80637de1e53611610122578063b77cf9c6116100aa578063ee75defd1161006e578063ee75defd146107a6578063f14210a6146107e2578063f2fde38b1461080a578063f3fef3a314610832578063f7c618c11461085a57610219565b8063b77cf9c6146106a0578063c3432ce2146106dc578063cdb039cd14610718578063cf030c3c14610740578063dbe7e3bd1461076a57610219565b80638cfd0e9a116100f15780638cfd0e9a146105be5780638da5cb5b146105e657806399d32fc4146106105780639e34070f1461063a578063ae90b2131461067657610219565b80637de1e5361461051857806380933608146105425780638456cb59146105805780638aee81271461059657610219565b806340fd4af6116101a55780636360106f116101745780636360106f146104265780636f70d2121461044e57806370c8a3711461048a578063715018a6146104c657806374fb1511146104dc57610219565b806340fd4af61461036d578063410459ad146103a95780635c3af1ba146103d15780635c975abb146103fc57610219565b806323ef2580116101ec57806323ef2580146102c75780632e75ab50146102ef57806337c362c5146103175780633c6a7f9b1461032d5780633f4ba83a1461035757610219565b80630a6f826d1461021d5780630b83a727146102595780630f48a4821461026357806316d17e251461028b575b5f5ffd5b348015610228575f5ffd5b50610243600480360381019061023e919061203d565b610884565b6040516102509190612080565b60405180910390f35b6102616108d1565b005b34801561026e575f5ffd5b50610289600480360381019061028491906120fa565b610b74565b005b348015610296575f5ffd5b506102b160048036038101906102ac919061216f565b610e0b565b6040516102be9190612080565b60405180910390f35b3480156102d2575f5ffd5b506102ed60048036038101906102e891906121ad565b610ed1565b005b3480156102fa575f5ffd5b50610315600480360381019061031091906121ad565b610f5c565b005b348015610322575f5ffd5b5061032b610fa5565b005b348015610338575f5ffd5b50610341610fb0565b60405161034e9190612080565b60405180910390f35b348015610362575f5ffd5b5061036b610fb6565b005b348015610378575f5ffd5b50610393600480360381019061038e919061216f565b610fc8565b6040516103a09190612080565b60405180910390f35b3480156103b4575f5ffd5b506103cf60048036038101906103ca919061203d565b610fe8565b005b3480156103dc575f5ffd5b506103e5611033565b6040516103f39291906121d8565b60405180910390f35b348015610407575f5ffd5b50610410611043565b60405161041d9190612219565b60405180910390f35b348015610431575f5ffd5b5061044c600480360381019061044791906121ad565b611058565b005b348015610459575f5ffd5b50610474600480360381019061046f919061203d565b6110e3565b60405161048191906122e9565b60405180910390f35b348015610495575f5ffd5b506104b060048036038101906104ab919061203d565b611131565b6040516104bd9190612080565b60405180910390f35b3480156104d1575f5ffd5b506104da6111ad565b005b3480156104e7575f5ffd5b5061050260048036038101906104fd919061216f565b6111c0565b60405161050f9190612219565b60405180910390f35b348015610523575f5ffd5b5061052c61129a565b6040516105399190612318565b60405180910390f35b34801561054d575f5ffd5b506105686004803603810190610563919061203d565b6112bf565b60405161057793929190612331565b60405180910390f35b34801561058b575f5ffd5b5061059461131f565b005b3480156105a1575f5ffd5b506105bc60048036038101906105b7919061203d565b611331565b005b3480156105c9575f5ffd5b506105e460048036038101906105df919061203d565b61137c565b005b3480156105f1575f5ffd5b506105fa6114c6565b6040516106079190612318565b60405180910390f35b34801561061b575f5ffd5b506106246114ed565b6040516106319190612080565b60405180910390f35b348015610645575f5ffd5b50610660600480360381019061065b91906121ad565b6114f3565b60405161066d9190612219565b60405180910390f35b348015610681575f5ffd5b5061068a611519565b6040516106979190612318565b60405180910390f35b3480156106ab575f5ffd5b506106c660048036038101906106c1919061203d565b61153e565b6040516106d39190612080565b60405180910390f35b3480156106e7575f5ffd5b5061070260048036038101906106fd919061203d565b611553565b60405161070f9190612080565b60405180910390f35b348015610723575f5ffd5b5061073e600480360381019061073991906120fa565b6115c2565b005b34801561074b575f5ffd5b50610754611788565b6040516107619190612080565b60405180910390f35b348015610775575f5ffd5b50610790600480360381019061078b91906121ad565b61178e565b60405161079d9190612219565b60405180910390f35b3480156107b1575f5ffd5b506107cc60048036038101906107c7919061203d565b6117ab565b6040516107d99190612080565b60405180910390f35b3480156107ed575f5ffd5b50610808600480360381019061080391906121ad565b6117f1565b005b348015610815575f5ffd5b50610830600480360381019061082b919061203d565b611847565b005b34801561083d575f5ffd5b506108586004803603810190610853919061216f565b6118cb565b005b348015610865575f5ffd5b5061086e611902565b60405161087b9190612318565b60405180910390f35b5f6108ca60085f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20611927565b9050919050565b6108d961193a565b6108e1611987565b600554341015610926576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091d906123c0565b60405180910390fd5b61092f3361137c565b5f61093933611131565b90505f811161097d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097490612428565b60405180910390fd5b6109c9338260025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166119d19092919063ffffffff16565b5f6109d3336110e3565b90505f5f90505b8151811015610a70575f8282815181106109f7576109f6612446565b5b60200260200101519050610a0b33826111c0565b15610a62574260095f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f20819055505b5080806001019150506109da565b5060045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3490811502906040515f60405180830381858888f19350505050158015610ad5573d5f5f3e3d5ffd5b5042600b5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055503373ffffffffffffffffffffffffffffffffffffffff167f319c0eb8ab757d7ee57e1b1491e73802e6cb5d83e658195ca2893b4ede42fa418334604051610b609291906121d8565b60405180910390a25050610b72611a50565b565b610b7c611987565b5f60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505f5f90505b83839050811015610e05575f848483818110610bc557610bc4612446565b5b9050602002013590503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b8152600401610c1e9190612080565b602060405180830381865afa158015610c39573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c5d9190612487565b73ffffffffffffffffffffffffffffffffffffffff1614610cb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caa906124fc565b60405180910390fd5b5f60095f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f205403610df7574260095f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f2081905550610da68160085f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20611a5990919063ffffffff16565b50803373ffffffffffffffffffffffffffffffffffffffff167f36b3725f1783bad4ff05b7f4c077c3aa68eeb23a4d054ba189db4d01ac278d3942604051610dee9190612080565b60405180910390a35b508080600101915050610ba6565b50505050565b5f610e1683836111c0565b610e22575f9050610ecb565b5f60095f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8481526020019081526020015f205490505f8103610e82575f915050610ecb565b5f610e968242611a7090919063ffffffff16565b90505f610eae60075483611a8590919063ffffffff16565b9050610ec560065482611a9a90919063ffffffff16565b93505050505b92915050565b610ed9611aaf565b5f8111610f1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f129061258a565b60405180910390fd5b806006819055507f0a8808bd305233df45947ae5ad84c81adedf20f410215919235cbe4a1c62f50281604051610f519190612080565b60405180910390a150565b610f64611aaf565b806005819055507f64374f1a975abb9bc8e8857d704b9ead41989ff599d90c1e8f7d34bc2ebea92a81604051610f9a9190612080565b60405180910390a150565b610fae3361137c565b565b60075481565b610fbe611aaf565b610fc6611b36565b565b6009602052815f5260405f20602052805f5260405f205f91509150505481565b610ff0611aaf565b8060045f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f5f600654600754915091509091565b5f60015f9054906101000a900460ff16905090565b611060611aaf565b5f81116110a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109990612618565b60405180910390fd5b806007819055507f2d651dfbca176d0c67ca9b08ffa05ad3be789aeb4583bbc9a0c35ead0128e7cd816040516110d89190612080565b60405180910390a150565b606061112a60085f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20611b97565b9050919050565b5f5f61113c836110e3565b90505f5f90505b81518110156111a6575f8282815181106111605761115f612446565b5b6020026020010151905061117485826111c0565b15611198576111956111868683610e0b565b85611bb690919063ffffffff16565b93505b508080600101915050611143565b5050919050565b6111b5611aaf565b6111be5f611bcb565b565b5f60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b815260040161121b9190612080565b602060405180830381865afa92505050801561125557506040513d601f19601f820116820180604052508101906112529190612487565b60015b611261575f9050611294565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16149150505b92915050565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f5f5f6112cb84610884565b6112d485611131565b600b5f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549250925092509193909250565b611327611aaf565b61132f611c8d565b565b611339611aaf565b8060025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f611386826110e3565b90505f5f90505b81518110156114c1575f8282815181106113aa576113a9612446565b5b602002602001015190506113be84826111c0565b6114b3575f60095f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f20819055506114628160085f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20611cee90919063ffffffff16565b50808473ffffffffffffffffffffffffffffffffffffffff167fc486b9458a8637650d84d262414833a5a457bc91ae86b7da110386c8c3fa255b426040516114aa9190612080565b60405180910390a35b50808060010191505061138d565b505050565b5f60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60055481565b5f600a5f8381526020019081526020015f205f9054906101000a900460ff169050919050565b60045f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b602052805f5260405f205f915090505481565b5f5f61155e836110e3565b90505f5f90505f5f90505b82518110156115b7576115968584838151811061158957611588612446565b5b60200260200101516111c0565b156115aa5781806115a690612663565b9250505b8080600101915050611569565b508092505050919050565b6115ca611987565b5f5f90505b82829050811015611783575f8383838181106115ee576115ed612446565b5b9050602002013590505f60095f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f205411611685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167c906126f4565b60405180910390fd5b5f60095f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8381526020019081526020015f20819055506117258160085f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20611cee90919063ffffffff16565b50803373ffffffffffffffffffffffffffffffffffffffff167fc486b9458a8637650d84d262414833a5a457bc91ae86b7da110386c8c3fa255b4260405161176d9190612080565b60405180910390a35080806001019150506115cf565b505050565b60065481565b600a602052805f5260405f205f915054906101000a900460ff1681565b5f600b5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6117f9611aaf565b6118016114c6565b73ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f19350505050158015611843573d5f5f3e3d5ffd5b5050565b61184f611aaf565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036118bf575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016118b69190612318565b60405180910390fd5b6118c881611bcb565b50565b6118d3611aaf565b6118fe33828473ffffffffffffffffffffffffffffffffffffffff166119d19092919063ffffffff16565b5050565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f611933825f01611d05565b9050919050565b60025f540361197e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119759061275c565b60405180910390fd5b60025f81905550565b61198f611043565b156119cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119c6906127c4565b60405180910390fd5b565b611a4b838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8585604051602401611a049291906127e2565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611d14565b505050565b60015f81905550565b5f611a68835f01835f1b611daf565b905092915050565b5f8183611a7d9190612809565b905092915050565b5f8183611a929190612869565b905092915050565b5f8183611aa79190612899565b905092915050565b611ab7611e16565b73ffffffffffffffffffffffffffffffffffffffff16611ad56114c6565b73ffffffffffffffffffffffffffffffffffffffff1614611b3457611af8611e16565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401611b2b9190612318565b60405180910390fd5b565b611b3e611e1d565b5f60015f6101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611b80611e16565b604051611b8d9190612318565b60405180910390a1565b60605f611ba5835f01611e66565b905060608190508092505050919050565b5f8183611bc391906128da565b905092915050565b5f60018054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816001806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b611c95611987565b6001805f6101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611cd7611e16565b604051611ce49190612318565b60405180910390a1565b5f611cfd835f01835f1b611ebf565b905092915050565b5f815f01805490509050919050565b5f5f60205f8451602086015f885af180611d33576040513d5f823e3d81fd5b3d92505f519150505f8214611d4c576001811415611d67565b5f8473ffffffffffffffffffffffffffffffffffffffff163b145b15611da957836040517f5274afe7000000000000000000000000000000000000000000000000000000008152600401611da09190612318565b60405180910390fd5b50505050565b5f611dba8383611fbb565b611e0c57825f0182908060018154018082558091505060019003905f5260205f20015f9091909190915055825f0180549050836001015f8481526020019081526020015f208190555060019050611e10565b5f90505b92915050565b5f33905090565b611e25611043565b611e64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e5b90612957565b60405180910390fd5b565b6060815f01805480602002602001604051908101604052809291908181526020018280548015611eb357602002820191905f5260205f20905b815481526020019060010190808311611e9f575b50505050509050919050565b5f5f836001015f8481526020019081526020015f205490505f8114611fb0575f600182611eec9190612809565b90505f6001865f0180549050611f029190612809565b9050808214611f68575f865f018281548110611f2157611f20612446565b5b905f5260205f200154905080875f018481548110611f4257611f41612446565b5b905f5260205f20018190555083876001015f8381526020019081526020015f2081905550505b855f01805480611f7b57611f7a612975565b5b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050611fb5565b5f9150505b92915050565b5f5f836001015f8481526020019081526020015f20541415905092915050565b5f5ffd5b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61200c82611fe3565b9050919050565b61201c81612002565b8114612026575f5ffd5b50565b5f8135905061203781612013565b92915050565b5f6020828403121561205257612051611fdb565b5b5f61205f84828501612029565b91505092915050565b5f819050919050565b61207a81612068565b82525050565b5f6020820190506120935f830184612071565b92915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126120ba576120b9612099565b5b8235905067ffffffffffffffff8111156120d7576120d661209d565b5b6020830191508360208202830111156120f3576120f26120a1565b5b9250929050565b5f5f602083850312156121105761210f611fdb565b5b5f83013567ffffffffffffffff81111561212d5761212c611fdf565b5b612139858286016120a5565b92509250509250929050565b61214e81612068565b8114612158575f5ffd5b50565b5f8135905061216981612145565b92915050565b5f5f6040838503121561218557612184611fdb565b5b5f61219285828601612029565b92505060206121a38582860161215b565b9150509250929050565b5f602082840312156121c2576121c1611fdb565b5b5f6121cf8482850161215b565b91505092915050565b5f6040820190506121eb5f830185612071565b6121f86020830184612071565b9392505050565b5f8115159050919050565b612213816121ff565b82525050565b5f60208201905061222c5f83018461220a565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61226481612068565b82525050565b5f612275838361225b565b60208301905092915050565b5f602082019050919050565b5f61229782612232565b6122a1818561223c565b93506122ac8361224c565b805f5b838110156122dc5781516122c3888261226a565b97506122ce83612281565b9250506001810190506122af565b5085935050505092915050565b5f6020820190508181035f830152612301818461228d565b905092915050565b61231281612002565b82525050565b5f60208201905061232b5f830184612309565b92915050565b5f6060820190506123445f830186612071565b6123516020830185612071565b61235e6040830184612071565b949350505050565b5f82825260208201905092915050565b7f536f66745374616b696e673a20636c61696d20666565207265717569726564005f82015250565b5f6123aa601f83612366565b91506123b582612376565b602082019050919050565b5f6020820190508181035f8301526123d78161239e565b9050919050565b7f4e6f207265776172647320746f20636c61696d000000000000000000000000005f82015250565b5f612412601383612366565b915061241d826123de565b602082019050919050565b5f6020820190508181035f83015261243f81612406565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f8151905061248181612013565b92915050565b5f6020828403121561249c5761249b611fdb565b5b5f6124a984828501612473565b91505092915050565b7f4e6f74204e4654206f776e6572000000000000000000000000000000000000005f82015250565b5f6124e6600d83612366565b91506124f1826124b2565b602082019050919050565b5f6020820190508181035f830152612513816124da565b9050919050565b7f536f66745374616b696e673a20726577617264732070657220756e69742074695f8201527f6d65206d7573742062652067726561746572207468616e203000000000000000602082015250565b5f612574603983612366565b915061257f8261251a565b604082019050919050565b5f6020820190508181035f8301526125a181612568565b9050919050565b7f536f66745374616b696e673a2074696d6520756e6974206d75737420626520675f8201527f726561746572207468616e203000000000000000000000000000000000000000602082015250565b5f612602602d83612366565b915061260d826125a8565b604082019050919050565b5f6020820190508181035f83015261262f816125f6565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61266d82612068565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361269f5761269e612636565b5b600182019050919050565b7f4e4654206e6f74207374616b65640000000000000000000000000000000000005f82015250565b5f6126de600e83612366565b91506126e9826126aa565b602082019050919050565b5f6020820190508181035f83015261270b816126d2565b9050919050565b7f5265656e7472616e637947756172643a207265656e7472616e742063616c6c005f82015250565b5f612746601f83612366565b915061275182612712565b602082019050919050565b5f6020820190508181035f8301526127738161273a565b9050919050565b7f5061757361626c653a20706175736564000000000000000000000000000000005f82015250565b5f6127ae601083612366565b91506127b98261277a565b602082019050919050565b5f6020820190508181035f8301526127db816127a2565b9050919050565b5f6040820190506127f55f830185612309565b6128026020830184612071565b9392505050565b5f61281382612068565b915061281e83612068565b925082820390508181111561283657612835612636565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61287382612068565b915061287e83612068565b92508261288e5761288d61283c565b5b828204905092915050565b5f6128a382612068565b91506128ae83612068565b92508282026128bc81612068565b915082820484148315176128d3576128d2612636565b5b5092915050565b5f6128e482612068565b91506128ef83612068565b925082820190508082111561290757612906612636565b5b92915050565b7f5061757361626c653a206e6f74207061757365640000000000000000000000005f82015250565b5f612941601483612366565b915061294c8261290d565b602082019050919050565b5f6020820190508181035f83015261296e81612935565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603160045260245ffdfea26469706673582212205de05a0a0f7f287a4b69b428a3c3c761260e624a4ce802616fa6463683b1759e64736f6c634300081e0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c3882d10e49ac4e9888d0c594db723fc9ce954680000000000000000000000001aa6f12114d91a849499a7ea24b28913227c34550000000000000000000000003f13c3185f8acd4f70529bd6483edf1aa558718600000000000000000000000000000000000000000000000000291e8f1dc8ea800000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _rewardToken (address): 0xC3882D10e49Ac4E9888D0C594DB723fC9cE95468
Arg [1] : _collection (address): 0x1AA6F12114D91a849499A7ea24b28913227c3455
Arg [2] : _payee (address): 0x3F13c3185f8acd4F70529Bd6483edF1Aa5587186
Arg [3] : _rewardsPerUnitTime (uint256): 11574074074000000
Arg [4] : _timeUnit (uint256): 1
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000c3882d10e49ac4e9888d0c594db723fc9ce95468
Arg [1] : 0000000000000000000000001aa6f12114d91a849499a7ea24b28913227c3455
Arg [2] : 0000000000000000000000003f13c3185f8acd4f70529bd6483edf1aa5587186
Arg [3] : 00000000000000000000000000000000000000000000000000291e8f1dc8ea80
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode Sourcemap
174840:8177:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;178883:124;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;179917:952;;;:::i;:::-;;176575:648;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;177728:522;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;180967:304;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;181627:134;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;180877:82;;;;;;;;;;;;;:::i;:::-;;175203:23;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;181934:67;;;;;;;;;;;;;:::i;:::-;;175303:74;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;181769:86;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;182522:167;;;;;;;;;;;;;:::i;:::-;;;;;;;;:::i;:::-;;;;;;;;6674:86;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;181279:222;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;178747:128;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;178258:481;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;10001:103;;;;;;;;;;;;;:::i;:::-;;176308:259;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;175060:25;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;182697:317;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;;:::i;:::-;;;;;;;;181863:63;;;;;;;;;;;;;:::i;:::-;;181509:110;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;179422:487;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;9326:87;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;175121:35;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;182272:107;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;175092:20;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;175432:48;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;179015:399;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;177231:489;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;175163:33;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;175384:39;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;182387:127;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;182154:110;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;10259:220;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;182009:137;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;175027:26;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;178883:124;178946:7;178973:26;:11;:17;178985:4;178973:17;;;;;;;;;;;;;;;:24;:26::i;:::-;178966:33;;178883:124;;;:::o;179917:952::-;3090:21;:19;:21::i;:::-;6279:19:::1;:17;:19::i;:::-;180020:8:::2;;180007:9;:21;;179999:65;;;;;;;;;;;;:::i;:::-;;;;;;;;;180085:29;180103:10;180085:17;:29::i;:::-;180135:20;180158:33;180180:10;180158:21;:33::i;:::-;180135:56;;180225:1;180210:12;:16;180202:48;;;;;;;;;;;;:::i;:::-;;;;;;;;;180271:58;180304:10;180316:12;180278:11;;;;;;;;;;;180271:32;;;;:58;;;;;:::i;:::-;180350:27;180380:25;180394:10;180380:13;:25::i;:::-;180350:55;;180421:9;180433:1;180421:13;;180416:257;180440:10;:17;180436:1;:21;180416:257;;;180479:15;180497:10;180508:1;180497:13;;;;;;;;:::i;:::-;;;;;;;;180479:31;;180531:36;180547:10;180559:7;180531:15;:36::i;:::-;180527:135;;;180631:15;180588:19;:31;180608:10;180588:31;;;;;;;;;;;;;;;:40;180620:7;180588:40;;;;;;;;;;;:58;;;;180527:135;180464:209;180459:3;;;;;;;180416:257;;;;180701:5;;;;;;;;;;;180693:23;;:34;180717:9;180693:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;180776:15;180748:13;:25;180762:10;180748:25;;;;;;;;;;;;;;;:43;;;;180825:10;180807:54;;;180837:12;180851:9;180807:54;;;;;;;:::i;:::-;;;;;;;;179988:881;;3134:20:::0;:18;:20::i;:::-;179917:952::o;176575:648::-;6279:19;:17;:19::i;:::-;176657::::1;176687:10;;;;;;;;;;;176657:41;;176724:9;176736:1;176724:13;;176719:497;176743:8;;:15;;176739:1;:19;176719:497;;;176780:15;176798:8;;176807:1;176798:11;;;;;;;:::i;:::-;;;;;;;;176780:29;;176878:10;176846:42;;:11;:19;;;176866:7;176846:28;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:42;;;176838:68;;;;;;;;;;;;:::i;:::-;;;;;;;;;176983:1;176939:19;:31;176959:10;176939:31;;;;;;;;;;;;;;;:40;176971:7;176939:40;;;;;;;;;;;;:45:::0;176935:270:::1;;177048:15;177005:19;:31;177025:10;177005:31;;;;;;;;;;;;;;;:40;177037:7;177005:40;;;;;;;;;;;:58;;;;177082:36;177110:7;177082:11;:23;177094:10;177082:23;;;;;;;;;;;;;;;:27;;:36;;;;:::i;:::-;;177164:7;177152:10;177142:47;;;177173:15;177142:47;;;;;;:::i;:::-;;;;;;;;176935:270;176765:451;176760:3;;;;;;;176719:497;;;;176646:577;176575:648:::0;;:::o;177728:522::-;177812:7;177839:30;177855:4;177861:7;177839:15;:30::i;:::-;177834:72;;177893:1;177886:8;;;;177834:72;177926:24;177953:19;:25;177973:4;177953:25;;;;;;;;;;;;;;;:34;177979:7;177953:34;;;;;;;;;;;;177926:61;;178022:1;178002:16;:21;177998:35;;178032:1;178025:8;;;;;177998:35;178054:23;178080:37;178100:16;178080:15;:19;;:37;;;;:::i;:::-;178054:63;;178128:19;178150:29;178170:8;;178150:15;:19;;:29;;;;:::i;:::-;178128:51;;178207:35;178223:18;;178207:11;:15;;:35;;;;:::i;:::-;178200:42;;;;;177728:522;;;;;:::o;180967:304::-;9212:13;:11;:13::i;:::-;181087:1:::1;181065:19;:23;181057:93;;;;;;;;;;;;:::i;:::-;;;;;;;;;181182:19;181161:18;:40;;;;181217:46;181243:19;181217:46;;;;;;:::i;:::-;;;;;;;;180967:304:::0;:::o;181627:134::-;9212:13;:11;:13::i;:::-;181706:7:::1;181695:8;:18;;;;181729:24;181745:7;181729:24;;;;;;:::i;:::-;;;;;;;;181627:134:::0;:::o;180877:82::-;180922:29;180940:10;180922:17;:29::i;:::-;180877:82::o;175203:23::-;;;;:::o;181934:67::-;9212:13;:11;:13::i;:::-;181983:10:::1;:8;:10::i;:::-;181934:67::o:0;175303:74::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;181769:86::-;9212:13;:11;:13::i;:::-;181841:6:::1;181833:5;;:14;;;;;;;;;;;;;;;;;;181769:86:::0;:::o;182522:167::-;182573:33;182608:23;182652:18;;182672:8;;182644:37;;;;182522:167;;:::o;6674:86::-;6721:4;6745:7;;;;;;;;;;;6738:14;;6674:86;:::o;181279:222::-;9212:13;:11;:13::i;:::-;181369:1:::1;181357:9;:13;181349:71;;;;;;;;;;;;:::i;:::-;;;;;;;;;181442:9;181431:8;:20;;;;181467:26;181483:9;181467:26;;;;;;:::i;:::-;;;;;;;;181279:222:::0;:::o;178747:128::-;178805:16;178841:26;:11;:17;178853:4;178841:17;;;;;;;;;;;;;;;:24;:26::i;:::-;178834:33;;178747:128;;;:::o;178258:481::-;178324:20;178357:27;178387:19;178401:4;178387:13;:19::i;:::-;178357:49;;178432:9;178444:1;178432:13;;178427:275;178451:10;:17;178447:1;:21;178427:275;;;178490:15;178508:10;178519:1;178508:13;;;;;;;;:::i;:::-;;;;;;;;178490:31;;178554:30;178570:4;178576:7;178554:15;:30::i;:::-;178550:141;;;178620:55;178637:37;178660:4;178666:7;178637:22;:37::i;:::-;178620:12;:16;;:55;;;;:::i;:::-;178605:70;;178550:141;178475:227;178470:3;;;;;;;178427:275;;;;178712:19;178258:481;;;:::o;10001:103::-;9212:13;:11;:13::i;:::-;10066:30:::1;10093:1;10066:18;:30::i;:::-;10001:103::o:0;176308:259::-;176385:4;176414:10;;;;;;;;;;;176406:27;;;176434:7;176406:36;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;176402:158;;176543:5;176536:12;;;;176402:158;176498:4;176489:13;;:5;:13;;;176482:20;;;176308:259;;;;;:::o;175060:25::-;;;;;;;;;;;;;:::o;182697:317::-;182772:23;182806:20;182837:17;182895:24;182914:4;182895:18;:24::i;:::-;182934:27;182956:4;182934:21;:27::i;:::-;182976:13;:19;182990:4;182976:19;;;;;;;;;;;;;;;;182873:133;;;;;;182697:317;;;;;:::o;181863:63::-;9212:13;:11;:13::i;:::-;181910:8:::1;:6;:8::i;:::-;181863:63::o:0;181509:110::-;9212:13;:11;:13::i;:::-;181599:12:::1;181585:11;;:26;;;;;;;;;;;;;;;;;;181509:110:::0;:::o;179422:487::-;179481:27;179511:19;179525:4;179511:13;:19::i;:::-;179481:49;;179556:9;179568:1;179556:13;;179551:351;179575:10;:17;179571:1;:21;179551:351;;;179614:15;179632:10;179643:1;179632:13;;;;;;;;:::i;:::-;;;;;;;;179614:31;;179665:30;179681:4;179687:7;179665:15;:30::i;:::-;179660:231;;179755:1;179718:19;:25;179738:4;179718:25;;;;;;;;;;;;;;;:34;179744:7;179718:34;;;;;;;;;;;:38;;;;179775:33;179800:7;179775:11;:17;179787:4;179775:17;;;;;;;;;;;;;;;:24;;:33;;;;:::i;:::-;;179850:7;179844:4;179832:43;;;179859:15;179832:43;;;;;;:::i;:::-;;;;;;;;179660:231;179599:303;179594:3;;;;;;;179551:351;;;;179470:439;179422:487;:::o;9326:87::-;9372:7;9399:6;;;;;;;;;;9392:13;;9326:87;:::o;175121:35::-;;;;:::o;182272:107::-;182331:4;182355:7;:16;182363:7;182355:16;;;;;;;;;;;;;;;;;;;;;182348:23;;182272:107;;;:::o;175092:20::-;;;;;;;;;;;;;:::o;175432:48::-;;;;;;;;;;;;;;;;;:::o;179015:399::-;179083:7;179103:27;179133:19;179147:4;179133:13;:19::i;:::-;179103:49;;179163:18;179184:1;179163:22;;179211:9;179223:1;179211:13;;179206:163;179230:10;:17;179226:1;:21;179206:163;;;179273:36;179289:4;179295:10;179306:1;179295:13;;;;;;;;:::i;:::-;;;;;;;;179273:15;:36::i;:::-;179269:89;;;179330:12;;;;;:::i;:::-;;;;179269:89;179249:3;;;;;;;179206:163;;;;179396:10;179389:17;;;;179015:399;;;:::o;177231:489::-;6279:19;:17;:19::i;:::-;177320:9:::1;177332:1;177320:13;;177315:398;177339:8;;:15;;177335:1;:19;177315:398;;;177376:15;177394:8;;177403:1;177394:11;;;;;;;:::i;:::-;;;;;;;;177376:29;;177485:1;177442:19;:31;177462:10;177442:31;;;;;;;;;;;;;;;:40;177474:7;177442:40;;;;;;;;;;;;:44;177434:71;;;;;;;;;;;;:::i;:::-;;;;;;;;;177577:1;177534:19;:31;177554:10;177534:31;;;;;;;;;;;;;;;:40;177566:7;177534:40;;;;;;;;;;;:44;;;;177593:39;177624:7;177593:11;:23;177605:10;177593:23;;;;;;;;;;;;;;;:30;;:39;;;;:::i;:::-;;177676:7;177664:10;177652:49;;;177685:15;177652:49;;;;;;:::i;:::-;;;;;;;;177361:352;177356:3;;;;;;;177315:398;;;;177231:489:::0;;:::o;175163:33::-;;;;:::o;175384:39::-;;;;;;;;;;;;;;;;;;;;;;:::o;182387:127::-;182450:17;182487:13;:19;182501:4;182487:19;;;;;;;;;;;;;;;;182480:26;;182387:127;;;:::o;182154:110::-;9212:13;:11;:13::i;:::-;182230:7:::1;:5;:7::i;:::-;182222:25;;:34;182248:7;182222:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;182154:110:::0;:::o;10259:220::-;9212:13;:11;:13::i;:::-;10364:1:::1;10344:22;;:8;:22;;::::0;10340:93:::1;;10418:1;10390:31;;;;;;;;;;;:::i;:::-;;;;;;;;10340:93;10443:28;10462:8;10443:18;:28::i;:::-;10259:220:::0;:::o;182009:137::-;9212:13;:11;:13::i;:::-;182090:48:::1;182118:10;182130:7;182097:6;182090:27;;;;:48;;;;;:::i;:::-;182009:137:::0;;:::o;175027:26::-;;;;;;;;;;;;;:::o;161055:114::-;161115:7;161142:19;161150:3;:10;;161142:7;:19::i;:::-;161135:26;;161055:114;;;:::o;3170:293::-;2572:1;3304:7;;:19;3296:63;;;;;;;;;;;;:::i;:::-;;;;;;;;;2572:1;3437:7;:18;;;;3170:293::o;6833:108::-;6904:8;:6;:8::i;:::-;6903:9;6895:38;;;;;;;;;;;;:::i;:::-;;;;;;;;;6833:108::o;27621:162::-;27704:71;27724:5;27746;:14;;;27763:2;27767:5;27731:43;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27704:19;:71::i;:::-;27621:162;;;:::o;3471:213::-;2528:1;3654:7;:22;;;;3471:213::o;159889:131::-;159956:4;159980:32;159985:3;:10;;160005:5;159997:14;;159980:4;:32::i;:::-;159973:39;;159889:131;;;;:::o;14094:98::-;14152:7;14183:1;14179;:5;;;;:::i;:::-;14172:12;;14094:98;;;;:::o;14850:::-;14908:7;14939:1;14935;:5;;;;:::i;:::-;14928:12;;14850:98;;;;:::o;14451:::-;14509:7;14540:1;14536;:5;;;;:::i;:::-;14529:12;;14451:98;;;;:::o;9491:166::-;9562:12;:10;:12::i;:::-;9551:23;;:7;:5;:7::i;:::-;:23;;;9547:103;;9625:12;:10;:12::i;:::-;9598:40;;;;;;;;;;;:::i;:::-;;;;;;;;9547:103;9491:166::o;7529:120::-;6538:16;:14;:16::i;:::-;7598:5:::1;7588:7;;:15;;;;;;;;;;;;;;;;;;7619:22;7628:12;:10;:12::i;:::-;7619:22;;;;;;:::i;:::-;;;;;;;;7529:120::o:0;162210:279::-;162270:16;162299:22;162324:19;162332:3;:10;;162324:7;:19::i;:::-;162299:44;;162354:23;162440:5;162430:15;;162475:6;162468:13;;;;162210:279;;;:::o;13713:98::-;13771:7;13802:1;13798;:5;;;;:::i;:::-;13791:12;;13713:98;;;;:::o;10639:191::-;10713:16;10732:6;;;;;;;;;;10713:25;;10758:8;10749:6;;:17;;;;;;;;;;;;;;;;;;10813:8;10782:40;;10803:8;10782:40;;;;;;;;;;;;10702:128;10639:191;:::o;7270:118::-;6279:19;:17;:19::i;:::-;7340:4:::1;7330:7:::0;::::1;:14;;;;;;;;;;;;;;;;;;7360:20;7367:12;:10;:12::i;:::-;7360:20;;;;;;:::i;:::-;;;;;;;;7270:118::o:0;160196:137::-;160266:4;160290:35;160298:3;:10;;160318:5;160310:14;;160290:7;:35::i;:::-;160283:42;;160196:137;;;;:::o;149799:109::-;149855:7;149882:3;:11;;:18;;;;149875:25;;149799:109;;;:::o;34912:738::-;34993:18;35022:19;35162:4;35159:1;35152:4;35146:11;35139:4;35133;35129:15;35126:1;35119:5;35112;35107:60;35221:7;35211:180;;35266:4;35260:11;35312:16;35309:1;35304:3;35289:40;35359:16;35354:3;35347:29;35211:180;35419:16;35405:30;;35470:1;35464:8;35449:23;;35077:406;35513:1;35499:10;:15;:68;;35566:1;35551:11;:16;;35499:68;;;35547:1;35525:5;35517:26;;;:31;35499:68;35495:148;;;35624:5;35591:40;;;;;;;;;;;:::i;:::-;;;;;;;;35495:148;34982:668;;34912:738;;:::o;146908:416::-;146971:4;146993:21;147003:3;147008:5;146993:9;:21::i;:::-;146988:329;;147031:3;:11;;147048:5;147031:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;147216:3;:11;;:18;;;;147192:3;:14;;:21;147207:5;147192:21;;;;;;;;;;;:42;;;;147256:4;147249:11;;;;146988:329;147300:5;147293:12;;146908:416;;;;;:::o;4680:98::-;4733:7;4760:10;4753:17;;4680:98;:::o;7018:108::-;7085:8;:6;:8::i;:::-;7077:41;;;;;;;;;;;;:::i;:::-;;;;;;;;;7018:108::o;150932:111::-;150988:16;151024:3;:11;;151017:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;150932:111;;;:::o;147500:1400::-;147566:4;147678:16;147697:3;:14;;:21;147712:5;147697:21;;;;;;;;;;;;147678:40;;147747:1;147735:8;:13;147731:1162;;148108:18;148140:1;148129:8;:12;;;;:::i;:::-;148108:33;;148156:17;148197:1;148176:3;:11;;:18;;;;:22;;;;:::i;:::-;148156:42;;148233:9;148219:10;:23;148215:385;;148263:17;148283:3;:11;;148295:9;148283:22;;;;;;;;:::i;:::-;;;;;;;;;;148263:42;;148433:9;148407:3;:11;;148419:10;148407:23;;;;;;;;:::i;:::-;;;;;;;;;:35;;;;148576:8;148548:3;:14;;:25;148563:9;148548:25;;;;;;;;;;;:36;;;;148244:356;148215:385;148681:3;:11;;:17;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;148787:3;:14;;:21;148802:5;148787:21;;;;;;;;;;;148780:28;;;148832:4;148825:11;;;;;;;147731:1162;148876:5;148869:12;;;147500:1400;;;;;:::o;149582:131::-;149655:4;149704:1;149679:3;:14;;:21;149694:5;149679:21;;;;;;;;;;;;:26;;149672:33;;149582:131;;;;:::o;88:117:1:-;197:1;194;187:12;211:117;320:1;317;310:12;334:126;371:7;411:42;404:5;400:54;389:65;;334:126;;;:::o;466:96::-;503:7;532:24;550:5;532:24;:::i;:::-;521:35;;466:96;;;:::o;568:122::-;641:24;659:5;641:24;:::i;:::-;634:5;631:35;621:63;;680:1;677;670:12;621:63;568:122;:::o;696:139::-;742:5;780:6;767:20;758:29;;796:33;823:5;796:33;:::i;:::-;696:139;;;;:::o;841:329::-;900:6;949:2;937:9;928:7;924:23;920:32;917:119;;;955:79;;:::i;:::-;917:119;1075:1;1100:53;1145:7;1136:6;1125:9;1121:22;1100:53;:::i;:::-;1090:63;;1046:117;841:329;;;;:::o;1176:77::-;1213:7;1242:5;1231:16;;1176:77;;;:::o;1259:118::-;1346:24;1364:5;1346:24;:::i;:::-;1341:3;1334:37;1259:118;;:::o;1383:222::-;1476:4;1514:2;1503:9;1499:18;1491:26;;1527:71;1595:1;1584:9;1580:17;1571:6;1527:71;:::i;:::-;1383:222;;;;:::o;1611:117::-;1720:1;1717;1710:12;1734:117;1843:1;1840;1833:12;1857:117;1966:1;1963;1956:12;1997:568;2070:8;2080:6;2130:3;2123:4;2115:6;2111:17;2107:27;2097:122;;2138:79;;:::i;:::-;2097:122;2251:6;2238:20;2228:30;;2281:18;2273:6;2270:30;2267:117;;;2303:79;;:::i;:::-;2267:117;2417:4;2409:6;2405:17;2393:29;;2471:3;2463:4;2455:6;2451:17;2441:8;2437:32;2434:41;2431:128;;;2478:79;;:::i;:::-;2431:128;1997:568;;;;;:::o;2571:559::-;2657:6;2665;2714:2;2702:9;2693:7;2689:23;2685:32;2682:119;;;2720:79;;:::i;:::-;2682:119;2868:1;2857:9;2853:17;2840:31;2898:18;2890:6;2887:30;2884:117;;;2920:79;;:::i;:::-;2884:117;3033:80;3105:7;3096:6;3085:9;3081:22;3033:80;:::i;:::-;3015:98;;;;2811:312;2571:559;;;;;:::o;3136:122::-;3209:24;3227:5;3209:24;:::i;:::-;3202:5;3199:35;3189:63;;3248:1;3245;3238:12;3189:63;3136:122;:::o;3264:139::-;3310:5;3348:6;3335:20;3326:29;;3364:33;3391:5;3364:33;:::i;:::-;3264:139;;;;:::o;3409:474::-;3477:6;3485;3534:2;3522:9;3513:7;3509:23;3505:32;3502:119;;;3540:79;;:::i;:::-;3502:119;3660:1;3685:53;3730:7;3721:6;3710:9;3706:22;3685:53;:::i;:::-;3675:63;;3631:117;3787:2;3813:53;3858:7;3849:6;3838:9;3834:22;3813:53;:::i;:::-;3803:63;;3758:118;3409:474;;;;;:::o;3889:329::-;3948:6;3997:2;3985:9;3976:7;3972:23;3968:32;3965:119;;;4003:79;;:::i;:::-;3965:119;4123:1;4148:53;4193:7;4184:6;4173:9;4169:22;4148:53;:::i;:::-;4138:63;;4094:117;3889:329;;;;:::o;4224:332::-;4345:4;4383:2;4372:9;4368:18;4360:26;;4396:71;4464:1;4453:9;4449:17;4440:6;4396:71;:::i;:::-;4477:72;4545:2;4534:9;4530:18;4521:6;4477:72;:::i;:::-;4224:332;;;;;:::o;4562:90::-;4596:7;4639:5;4632:13;4625:21;4614:32;;4562:90;;;:::o;4658:109::-;4739:21;4754:5;4739:21;:::i;:::-;4734:3;4727:34;4658:109;;:::o;4773:210::-;4860:4;4898:2;4887:9;4883:18;4875:26;;4911:65;4973:1;4962:9;4958:17;4949:6;4911:65;:::i;:::-;4773:210;;;;:::o;4989:114::-;5056:6;5090:5;5084:12;5074:22;;4989:114;;;:::o;5109:184::-;5208:11;5242:6;5237:3;5230:19;5282:4;5277:3;5273:14;5258:29;;5109:184;;;;:::o;5299:132::-;5366:4;5389:3;5381:11;;5419:4;5414:3;5410:14;5402:22;;5299:132;;;:::o;5437:108::-;5514:24;5532:5;5514:24;:::i;:::-;5509:3;5502:37;5437:108;;:::o;5551:179::-;5620:10;5641:46;5683:3;5675:6;5641:46;:::i;:::-;5719:4;5714:3;5710:14;5696:28;;5551:179;;;;:::o;5736:113::-;5806:4;5838;5833:3;5829:14;5821:22;;5736:113;;;:::o;5885:732::-;6004:3;6033:54;6081:5;6033:54;:::i;:::-;6103:86;6182:6;6177:3;6103:86;:::i;:::-;6096:93;;6213:56;6263:5;6213:56;:::i;:::-;6292:7;6323:1;6308:284;6333:6;6330:1;6327:13;6308:284;;;6409:6;6403:13;6436:63;6495:3;6480:13;6436:63;:::i;:::-;6429:70;;6522:60;6575:6;6522:60;:::i;:::-;6512:70;;6368:224;6355:1;6352;6348:9;6343:14;;6308:284;;;6312:14;6608:3;6601:10;;6009:608;;;5885:732;;;;:::o;6623:373::-;6766:4;6804:2;6793:9;6789:18;6781:26;;6853:9;6847:4;6843:20;6839:1;6828:9;6824:17;6817:47;6881:108;6984:4;6975:6;6881:108;:::i;:::-;6873:116;;6623:373;;;;:::o;7002:118::-;7089:24;7107:5;7089:24;:::i;:::-;7084:3;7077:37;7002:118;;:::o;7126:222::-;7219:4;7257:2;7246:9;7242:18;7234:26;;7270:71;7338:1;7327:9;7323:17;7314:6;7270:71;:::i;:::-;7126:222;;;;:::o;7354:442::-;7503:4;7541:2;7530:9;7526:18;7518:26;;7554:71;7622:1;7611:9;7607:17;7598:6;7554:71;:::i;:::-;7635:72;7703:2;7692:9;7688:18;7679:6;7635:72;:::i;:::-;7717;7785:2;7774:9;7770:18;7761:6;7717:72;:::i;:::-;7354:442;;;;;;:::o;7802:169::-;7886:11;7920:6;7915:3;7908:19;7960:4;7955:3;7951:14;7936:29;;7802:169;;;;:::o;7977:181::-;8117:33;8113:1;8105:6;8101:14;8094:57;7977:181;:::o;8164:366::-;8306:3;8327:67;8391:2;8386:3;8327:67;:::i;:::-;8320:74;;8403:93;8492:3;8403:93;:::i;:::-;8521:2;8516:3;8512:12;8505:19;;8164:366;;;:::o;8536:419::-;8702:4;8740:2;8729:9;8725:18;8717:26;;8789:9;8783:4;8779:20;8775:1;8764:9;8760:17;8753:47;8817:131;8943:4;8817:131;:::i;:::-;8809:139;;8536:419;;;:::o;8961:169::-;9101:21;9097:1;9089:6;9085:14;9078:45;8961:169;:::o;9136:366::-;9278:3;9299:67;9363:2;9358:3;9299:67;:::i;:::-;9292:74;;9375:93;9464:3;9375:93;:::i;:::-;9493:2;9488:3;9484:12;9477:19;;9136:366;;;:::o;9508:419::-;9674:4;9712:2;9701:9;9697:18;9689:26;;9761:9;9755:4;9751:20;9747:1;9736:9;9732:17;9725:47;9789:131;9915:4;9789:131;:::i;:::-;9781:139;;9508:419;;;:::o;9933:180::-;9981:77;9978:1;9971:88;10078:4;10075:1;10068:15;10102:4;10099:1;10092:15;10119:143;10176:5;10207:6;10201:13;10192:22;;10223:33;10250:5;10223:33;:::i;:::-;10119:143;;;;:::o;10268:351::-;10338:6;10387:2;10375:9;10366:7;10362:23;10358:32;10355:119;;;10393:79;;:::i;:::-;10355:119;10513:1;10538:64;10594:7;10585:6;10574:9;10570:22;10538:64;:::i;:::-;10528:74;;10484:128;10268:351;;;;:::o;10625:163::-;10765:15;10761:1;10753:6;10749:14;10742:39;10625:163;:::o;10794:366::-;10936:3;10957:67;11021:2;11016:3;10957:67;:::i;:::-;10950:74;;11033:93;11122:3;11033:93;:::i;:::-;11151:2;11146:3;11142:12;11135:19;;10794:366;;;:::o;11166:419::-;11332:4;11370:2;11359:9;11355:18;11347:26;;11419:9;11413:4;11409:20;11405:1;11394:9;11390:17;11383:47;11447:131;11573:4;11447:131;:::i;:::-;11439:139;;11166:419;;;:::o;11591:244::-;11731:34;11727:1;11719:6;11715:14;11708:58;11800:27;11795:2;11787:6;11783:15;11776:52;11591:244;:::o;11841:366::-;11983:3;12004:67;12068:2;12063:3;12004:67;:::i;:::-;11997:74;;12080:93;12169:3;12080:93;:::i;:::-;12198:2;12193:3;12189:12;12182:19;;11841:366;;;:::o;12213:419::-;12379:4;12417:2;12406:9;12402:18;12394:26;;12466:9;12460:4;12456:20;12452:1;12441:9;12437:17;12430:47;12494:131;12620:4;12494:131;:::i;:::-;12486:139;;12213:419;;;:::o;12638:232::-;12778:34;12774:1;12766:6;12762:14;12755:58;12847:15;12842:2;12834:6;12830:15;12823:40;12638:232;:::o;12876:366::-;13018:3;13039:67;13103:2;13098:3;13039:67;:::i;:::-;13032:74;;13115:93;13204:3;13115:93;:::i;:::-;13233:2;13228:3;13224:12;13217:19;;12876:366;;;:::o;13248:419::-;13414:4;13452:2;13441:9;13437:18;13429:26;;13501:9;13495:4;13491:20;13487:1;13476:9;13472:17;13465:47;13529:131;13655:4;13529:131;:::i;:::-;13521:139;;13248:419;;;:::o;13673:180::-;13721:77;13718:1;13711:88;13818:4;13815:1;13808:15;13842:4;13839:1;13832:15;13859:233;13898:3;13921:24;13939:5;13921:24;:::i;:::-;13912:33;;13967:66;13960:5;13957:77;13954:103;;14037:18;;:::i;:::-;13954:103;14084:1;14077:5;14073:13;14066:20;;13859:233;;;:::o;14098:164::-;14238:16;14234:1;14226:6;14222:14;14215:40;14098:164;:::o;14268:366::-;14410:3;14431:67;14495:2;14490:3;14431:67;:::i;:::-;14424:74;;14507:93;14596:3;14507:93;:::i;:::-;14625:2;14620:3;14616:12;14609:19;;14268:366;;;:::o;14640:419::-;14806:4;14844:2;14833:9;14829:18;14821:26;;14893:9;14887:4;14883:20;14879:1;14868:9;14864:17;14857:47;14921:131;15047:4;14921:131;:::i;:::-;14913:139;;14640:419;;;:::o;15065:181::-;15205:33;15201:1;15193:6;15189:14;15182:57;15065:181;:::o;15252:366::-;15394:3;15415:67;15479:2;15474:3;15415:67;:::i;:::-;15408:74;;15491:93;15580:3;15491:93;:::i;:::-;15609:2;15604:3;15600:12;15593:19;;15252:366;;;:::o;15624:419::-;15790:4;15828:2;15817:9;15813:18;15805:26;;15877:9;15871:4;15867:20;15863:1;15852:9;15848:17;15841:47;15905:131;16031:4;15905:131;:::i;:::-;15897:139;;15624:419;;;:::o;16049:166::-;16189:18;16185:1;16177:6;16173:14;16166:42;16049:166;:::o;16221:366::-;16363:3;16384:67;16448:2;16443:3;16384:67;:::i;:::-;16377:74;;16460:93;16549:3;16460:93;:::i;:::-;16578:2;16573:3;16569:12;16562:19;;16221:366;;;:::o;16593:419::-;16759:4;16797:2;16786:9;16782:18;16774:26;;16846:9;16840:4;16836:20;16832:1;16821:9;16817:17;16810:47;16874:131;17000:4;16874:131;:::i;:::-;16866:139;;16593:419;;;:::o;17018:332::-;17139:4;17177:2;17166:9;17162:18;17154:26;;17190:71;17258:1;17247:9;17243:17;17234:6;17190:71;:::i;:::-;17271:72;17339:2;17328:9;17324:18;17315:6;17271:72;:::i;:::-;17018:332;;;;;:::o;17356:194::-;17396:4;17416:20;17434:1;17416:20;:::i;:::-;17411:25;;17450:20;17468:1;17450:20;:::i;:::-;17445:25;;17494:1;17491;17487:9;17479:17;;17518:1;17512:4;17509:11;17506:37;;;17523:18;;:::i;:::-;17506:37;17356:194;;;;:::o;17556:180::-;17604:77;17601:1;17594:88;17701:4;17698:1;17691:15;17725:4;17722:1;17715:15;17742:185;17782:1;17799:20;17817:1;17799:20;:::i;:::-;17794:25;;17833:20;17851:1;17833:20;:::i;:::-;17828:25;;17872:1;17862:35;;17877:18;;:::i;:::-;17862:35;17919:1;17916;17912:9;17907:14;;17742:185;;;;:::o;17933:410::-;17973:7;17996:20;18014:1;17996:20;:::i;:::-;17991:25;;18030:20;18048:1;18030:20;:::i;:::-;18025:25;;18085:1;18082;18078:9;18107:30;18125:11;18107:30;:::i;:::-;18096:41;;18286:1;18277:7;18273:15;18270:1;18267:22;18247:1;18240:9;18220:83;18197:139;;18316:18;;:::i;:::-;18197:139;17981:362;17933:410;;;;:::o;18349:191::-;18389:3;18408:20;18426:1;18408:20;:::i;:::-;18403:25;;18442:20;18460:1;18442:20;:::i;:::-;18437:25;;18485:1;18482;18478:9;18471:16;;18506:3;18503:1;18500:10;18497:36;;;18513:18;;:::i;:::-;18497:36;18349:191;;;;:::o;18546:170::-;18686:22;18682:1;18674:6;18670:14;18663:46;18546:170;:::o;18722:366::-;18864:3;18885:67;18949:2;18944:3;18885:67;:::i;:::-;18878:74;;18961:93;19050:3;18961:93;:::i;:::-;19079:2;19074:3;19070:12;19063:19;;18722:366;;;:::o;19094:419::-;19260:4;19298:2;19287:9;19283:18;19275:26;;19347:9;19341:4;19337:20;19333:1;19322:9;19318:17;19311:47;19375:131;19501:4;19375:131;:::i;:::-;19367:139;;19094:419;;;:::o;19519:180::-;19567:77;19564:1;19557:88;19664:4;19661:1;19654:15;19688:4;19685:1;19678:15
Swarm Source
ipfs://5de05a0a0f7f287a4b69b428a3c3c761260e624a4ce802616fa6463683b1759e
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.