Source Code
Latest 16 from a total of 16 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Claim | 3137168 | 1050 days ago | IN | 0 GLMR | 0.0119572 | ||||
| Claim | 3137150 | 1050 days ago | IN | 0 GLMR | 0.01542972 | ||||
| Withdraw | 3135665 | 1050 days ago | IN | 0 GLMR | 0.00692473 | ||||
| Withdraw | 3135643 | 1050 days ago | IN | 0 GLMR | 0.00670184 | ||||
| Withdraw | 3135633 | 1050 days ago | IN | 0 GLMR | 0.00741071 | ||||
| Claim | 3112196 | 1054 days ago | IN | 0 GLMR | 0.01613535 | ||||
| Withdraw | 3112163 | 1054 days ago | IN | 0 GLMR | 0.00740625 | ||||
| Create | 3112154 | 1054 days ago | IN | 0 GLMR | 0.01535674 | ||||
| Create | 3087796 | 1058 days ago | IN | 0 GLMR | 0.01535796 | ||||
| Create | 3087288 | 1058 days ago | IN | 0 GLMR | 0.01274697 | ||||
| Withdraw | 3087267 | 1058 days ago | IN | 0 GLMR | 0.00843871 | ||||
| Create | 3085856 | 1058 days ago | IN | 0 GLMR | 0.01448465 | ||||
| Create | 3033148 | 1065 days ago | IN | 0 GLMR | 0.0132362 | ||||
| Claim | 3030748 | 1066 days ago | IN | 0 GLMR | 0.01765257 | ||||
| Create | 3029517 | 1066 days ago | IN | 0 GLMR | 0.01323417 | ||||
| Create | 3024944 | 1067 days ago | IN | 0 GLMR | 0.01670547 |
View more zero value Internal Transactions in Advanced View mode
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ERC20AirPoolController
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.17;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "../../Core.sol";
import "./IERC20AirPoolController.sol";
import "../../Datastructures.sol";
import "../../Claimable.sol";
contract ERC20AirPoolController is
IERC20AirPoolController,
Claimable,
Core,
ReentrancyGuard
{
using SafeMath for uint256;
using Counters for Counters.Counter;
struct Pool {
bool active;
address token;
uint256 totalLiquidity;
uint256 totalClaimed;
address owner;
PoolType poolType;
}
mapping(bytes32 => Pool) private pools;
constructor(address owner_, address _ca)
Core(owner_, _ca)
ReentrancyGuard()
{}
receive() external payable {}
fallback() external payable {}
function create(
address creator,
address poolToken,
uint256 initialLiquidity,
Datastructures.CertificateInfo calldata certificate
) external override nonReentrant whenNotPaused returns (bytes32 poolId) {
require(initialLiquidity > 0, "ERC20APC:invalid-liquidity");
uint256 nonce = _useNonce(creator);
poolId = keccak256(abi.encode(address(this), creator, nonce));
bytes memory encodedMessage = abi.encode(
poolId,
creator,
poolToken,
initialLiquidity,
certificate.deadline,
nonce,
_thisHash()
);
_validateCertificate(encodedMessage, certificate);
Pool storage pool = pools[poolId];
pool.token = poolToken;
pool.poolType = PoolType.LOCKED_TOKEN;
pool.owner = creator;
pool.active = true;
pool.totalLiquidity = initialLiquidity;
SafeERC20.safeTransferFrom(
IERC20(poolToken),
creator,
address(this),
initialLiquidity
);
emit Create(
nonce,
creator,
poolId,
poolToken,
initialLiquidity,
PoolType.LOCKED_TOKEN
);
}
function createNative(
address creator,
Datastructures.CertificateInfo calldata certificate
) external payable override whenNotPaused returns (bytes32 poolId) {
uint256 nonce = _useNonce(creator);
poolId = keccak256(abi.encode(creator, nonce));
bytes memory encodedMessage = abi.encode(
poolId,
creator,
msg.value,
certificate.deadline,
nonce,
_thisHash()
);
_validateCertificate(encodedMessage, certificate);
Pool storage pool = pools[poolId];
pool.poolType = PoolType.LOCKED_NATIVE;
pool.totalLiquidity = msg.value;
pool.owner = creator;
pool.active = true;
emit Create(
nonce,
creator,
poolId,
address(0),
msg.value,
PoolType.LOCKED_NATIVE
);
}
function deposit(
address user,
bytes32 poolId,
uint256 amount,
Datastructures.CertificateInfo calldata certificate
) external payable override nonReentrant whenNotPaused {
require(amount > 0, "ERC20APC:invalid-amount");
Pool storage pool = pools[poolId];
require(pool.active, "ERC20APC:inactive-pool");
if (pool.poolType == PoolType.LOCKED_NATIVE) {
require(msg.value == amount, "ERC20APC:invalid-amount");
}
uint256 nonce = _useNonce(user);
bytes memory encodedMessage = abi.encode(
user,
poolId,
amount,
certificate.deadline,
nonce,
_thisHash()
);
_validateCertificate(encodedMessage, certificate);
pool.totalLiquidity = pool.totalLiquidity.add(amount);
if (pool.poolType == PoolType.LOCKED_TOKEN) {
SafeERC20.safeTransferFrom(
IERC20(pool.token),
user,
address(this),
amount
);
}
emit Deposit(nonce, user, poolId, amount);
}
function withdraw(
address user,
bytes32 poolId,
uint256 amount,
Datastructures.CertificateInfo calldata certificate
) external override whenNotPaused nonReentrant {
Pool storage pool = pools[poolId];
require(pool.active, "ERC20APC:invalid-or-inactive-pool");
require(amount <= pool.totalLiquidity, "ERC20APC:insufficient-fund");
require(pool.owner == user, "ERC20APC:not-authorized");
uint256 nonce = _useNonce(user);
bytes memory encodedMessage = abi.encode(
user,
poolId,
amount,
certificate.deadline,
nonce,
_thisHash()
);
_validateCertificate(encodedMessage, certificate);
pool.totalLiquidity = pool.totalLiquidity.sub(amount);
if (pool.poolType == PoolType.LOCKED_TOKEN) {
bool success = IERC20(pool.token).transfer(user, amount);
require(success, "ERC20APC:transfer-failed");
} else if (pool.poolType == PoolType.LOCKED_NATIVE) {
payable(user).transfer(amount);
}
emit Withdraw(nonce, user, poolId, amount);
}
function claim(
address payable user,
bytes32 poolId,
bytes32 claimId,
uint256 amount,
bytes32 window,
uint256 windowLimit,
Datastructures.CertificateInfo calldata certificate
) external override whenNotPaused nonReentrant {
require(user != address(0), "ERC20APC:invalid-address");
Pool storage pool = pools[poolId];
require(pool.active, "ERC20APC:invalid-or-inactive-pool");
uint256 windowLiquidity = _updateClaim(
amount,
window,
windowLimit,
claimId
);
require(
windowLiquidity <= pool.totalLiquidity,
"ERC20APC:insufficient-fund"
);
uint256 nonce = _useNonce(user);
bytes memory encodedMessage = abi.encode(
user,
claimId,
poolId,
amount,
window,
windowLimit,
certificate.deadline,
nonce,
_thisHash()
);
_validateCertificate(encodedMessage, certificate);
pool.totalLiquidity = pool.totalLiquidity.sub(amount);
pool.totalClaimed = pool.totalClaimed.add(amount);
if (pool.poolType == PoolType.LOCKED_TOKEN) {
bool success = IERC20(pool.token).transfer(user, amount);
require(success, "ERC20APC:claim-failed");
} else if (pool.poolType == PoolType.LOCKED_NATIVE) {
user.transfer(amount);
}
emit Claim(claimId, user, poolId, amount);
}
function claimBatch(
address payable user,
bytes32 poolId,
bytes32[] calldata claimIds,
uint256 amount,
bytes32 window,
uint256 windowLimit,
Datastructures.CertificateInfo calldata certificate
) external override whenNotPaused nonReentrant {
require(user != address(0), "Invalid user address");
Pool storage pool = pools[poolId];
require(pool.active, "ERC20APC:invalid-or-inactive-pool");
uint256 windowLiquidity = _updateBatchClaim(
amount,
window,
windowLimit,
claimIds
);
require(
windowLiquidity <= pool.totalLiquidity,
"ERC20APC:insufficient-fund"
);
uint256 nonce = _useNonce(user);
bytes memory encodedMessage = abi.encode(
user,
claimIds,
poolId,
amount,
window,
windowLimit,
certificate.deadline,
nonce,
_thisHash()
);
_validateCertificate(encodedMessage, certificate);
pool.totalLiquidity = pool.totalLiquidity.sub(amount);
pool.totalClaimed = pool.totalClaimed.add(amount);
if (pool.poolType == PoolType.LOCKED_TOKEN) {
bool success = IERC20(pool.token).transfer(user, amount);
require(success, "ERC20APC:claim-failed");
} else if (pool.poolType == PoolType.LOCKED_NATIVE) {
user.transfer(amount);
}
emit ClaimBatch(user, poolId, claimIds, amount);
}
function getPoolInfo(bytes32 poolId)
external
view
override
returns (
bool,
address,
uint256,
uint256,
address
)
{
Pool storage pool = pools[poolId];
return (
pool.active,
pool.token,
pool.totalLiquidity,
pool.totalClaimed,
pool.owner
);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @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());
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
/**
* @dev A contract for managing claims within a window and
* ensuring that each claim can only be made once.
*/
abstract contract Claimable {
using SafeMath for uint256;
// Mapping from claim ID to a boolean indicating whether the claim has been made or not.
mapping(bytes32 => bool) public hasClaimed;
// Mapping from a window ID to the total amount claimed within that window.
mapping(bytes32 => uint256) public windowClaimed;
/**
* @dev Internal function to update the window claimed amount when the amount does not exceed the window limit.
* @param amount The amount being claimed.
* @param window The ID of the window being claimed within.
* @param windowLimit The maximum amount that can be claimed within the window.
* @return windowLiquidity The remaining amount that can be claimed within the window.
*/
function _updateWindow(
uint256 amount,
bytes32 window,
uint256 windowLimit
) internal returns (uint256 windowLiquidity) {
require(amount > 0, "Claimable:invalid-amount");
windowLiquidity = windowLimit - windowClaimed[window];
require(amount <= windowLiquidity, "Claimable:insufficient-fund");
windowClaimed[window] = windowClaimed[window].add(amount);
}
/**
* @dev Internal function to update the window claimed amount and the claim ID has not been used before.
* @param amount The amount being claimed.
* @param window The ID of the window being claimed within.
* @param windowLimit The maximum amount that can be claimed within the window.
* @param claimId The ID of the claim being made.
* @return windowLiquidity The remaining amount that can be claimed within the window.
*/
function _updateClaim(
uint256 amount,
bytes32 window,
uint256 windowLimit,
bytes32 claimId
) internal returns (uint256 windowLiquidity) {
windowLiquidity = _updateWindow(amount, window, windowLimit);
require(!hasClaimed[claimId], "Claimable:already-claimed");
hasClaimed[claimId] = true;
}
/**
* @dev Internal function to update the window claimed amount and multiple claim IDs have not been used before.
* @param amount The amount being claimed.
* @param window The ID of the window being claimed within.
* @param windowLimit The maximum amount that can be claimed within the window.
* @param claimIds An array of claim IDs being made.
* @return windowLiquidity The remaining amount that can be claimed within the window.
*/
function _updateBatchClaim(
uint256 amount,
bytes32 window,
uint256 windowLimit,
bytes32[] calldata claimIds
) internal returns (uint256 windowLiquidity) {
windowLiquidity = _updateWindow(amount, window, windowLimit);
for (uint256 i = 0; i < claimIds.length; i++) {
require(!hasClaimed[claimIds[i]], "Claimable:already-claimed");
hasClaimed[claimIds[i]] = true;
}
}
/**
* @dev Get the claimed status for multiple claims
* @param ids IDs of the claims to check
* @return batchClaimed Array of claimed status for each ID provided
*/
function getBatchClaimed(bytes32[] calldata ids)
external
view
returns (bool[] memory)
{
bool[] memory batchClaimed = new bool[](ids.length);
for (uint256 i = 0; i < ids.length; ++i) {
batchClaimed[i] = hasClaimed[ids[i]];
}
return batchClaimed;
}
/**
* @dev Get the amount claimed for multiple windows
* @param ids IDs of the windows to check
* @return batchWindowsClaimed Array of claimed amounts for each window ID provided
*/
function getBatchWindowClaimed(bytes32[] calldata ids)
external
view
returns (uint256[] memory)
{
uint256[] memory batchWindowsClaimed = new uint256[](ids.length);
for (uint256 i = 0; i < ids.length; ++i) {
batchWindowsClaimed[i] = windowClaimed[ids[i]];
}
return batchWindowsClaimed;
}
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.17;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./Datastructures.sol";
import "./Ownable.sol";
abstract contract Core is Ownable, Pausable {
using Counters for Counters.Counter;
event UpdateCA(address indexed old, address indexed newCa);
address public certificationAuthority;
bytes32 private immutable _THIS_HASH;
mapping(address => Counters.Counter) private nonces;
constructor(address owner_, address ca) Ownable(owner_) {
certificationAuthority = ca;
_THIS_HASH = keccak256(abi.encode(block.chainid, address(this)));
}
function pause() external onlyOwner {
_pause();
}
function unpause() external onlyOwner {
_unpause();
}
function updateCA(address ca) external onlyOwner {
require(ca != address(0), "Core:ca-must-be-non-zero-address");
emit UpdateCA(certificationAuthority, ca);
certificationAuthority = ca;
}
/**
* @dev Returns the current nonce for `ca`. This value must be
* included whenever a signature is generated.
*
* Every successful call to {create, withdraw, withdrawRemaining, claim} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function getNonce(address user) public view virtual returns (uint256) {
return nonces[user].current();
}
function _blockTimestamp() internal view virtual returns (uint256) {
return block.timestamp;
}
/**
* @dev "Consume a nonce": return the current value and increment.
*
*/
function _useNonce(address user) internal virtual returns (uint256 current) {
Counters.Counter storage nonce = nonces[user];
current = nonce.current();
nonce.increment();
}
function _validateCertificate(
bytes memory _message,
Datastructures.CertificateInfo calldata certificate
) internal view virtual {
require(
_blockTimestamp() <= certificate.deadline,
"Core:expired-certificate"
);
bytes32 hash = ECDSA.toEthSignedMessageHash(_message);
address signer = ECDSA.recover(
hash,
certificate.v,
certificate.r,
certificate.s
);
require(certificationAuthority == signer, "Core:invalid-certificate");
}
function _thisHash() internal view returns (bytes32) {
return _THIS_HASH;
}
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.17;
library Datastructures {
struct CertificateInfo {
uint256 deadline;
uint8 v;
bytes32 r;
bytes32 s;
}
}//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.17;
import "../../Datastructures.sol";
interface IERC20AirPoolController {
enum PoolType {
LOCKED_NATIVE,
LOCKED_TOKEN
}
event Create(
uint256 indexed nonce,
address indexed user,
bytes32 indexed poolId,
address poolToken,
uint256 liquidity,
PoolType poolType
);
event Deposit(
uint256 indexed nonce,
address indexed user,
bytes32 indexed poolId,
uint256 amount
);
event Withdraw(
uint256 indexed nonce,
address indexed user,
bytes32 indexed poolId,
uint256 amount
);
event Claim(
bytes32 indexed claimId,
address indexed user,
bytes32 indexed poolId,
uint256 amount
);
event ClaimBatch(
address indexed user,
bytes32 indexed poolId,
bytes32[] claimIds,
uint256 amount
);
function create(
address creator,
address poolToken,
uint256 initialLiquidity,
Datastructures.CertificateInfo calldata certificate
) external returns (bytes32 poolId);
function createNative(address creator, Datastructures.CertificateInfo calldata certificate)
external
payable
returns (bytes32 poolId);
function deposit(
address user,
bytes32 poolId,
uint256 amount,
Datastructures.CertificateInfo calldata certificate
) external payable;
function withdraw(
address user,
bytes32 poolId,
uint256 amount,
Datastructures.CertificateInfo calldata certificate
) external;
function claim(
address payable user,
bytes32 poolId,
bytes32 claimId,
uint256 amount,
bytes32 window,
uint256 windowLimit,
Datastructures.CertificateInfo calldata certificate
) external;
function claimBatch(
address payable user,
bytes32 poolId,
bytes32[] calldata claimIds,
uint256 amount,
bytes32 window,
uint256 windowLimit,
Datastructures.CertificateInfo calldata certificate
) external;
function getPoolInfo(bytes32 poolId)
external
view
returns (
bool,
address,
uint256,
uint256,
address
);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "@openzeppelin/contracts/utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor(address owner_) {
_transferOwnership(owner_);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable:caller-must-be-owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable:new-owner-must-be-non-zero-address"
);
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"bytecodeHash": "none"
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"address","name":"_ca","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"claimId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":false,"internalType":"bytes32[]","name":"claimIds","type":"bytes32[]"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":false,"internalType":"address","name":"poolToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"liquidity","type":"uint256"},{"indexed":false,"internalType":"enum IERC20AirPoolController.PoolType","name":"poolType","type":"uint8"}],"name":"Create","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","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":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"old","type":"address"},{"indexed":true,"internalType":"address","name":"newCa","type":"address"}],"name":"UpdateCA","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"bytes32","name":"poolId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"certificationAuthority","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"user","type":"address"},{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"bytes32","name":"claimId","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"window","type":"bytes32"},{"internalType":"uint256","name":"windowLimit","type":"uint256"},{"components":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct Datastructures.CertificateInfo","name":"certificate","type":"tuple"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"user","type":"address"},{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"bytes32[]","name":"claimIds","type":"bytes32[]"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"window","type":"bytes32"},{"internalType":"uint256","name":"windowLimit","type":"uint256"},{"components":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct Datastructures.CertificateInfo","name":"certificate","type":"tuple"}],"name":"claimBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creator","type":"address"},{"internalType":"address","name":"poolToken","type":"address"},{"internalType":"uint256","name":"initialLiquidity","type":"uint256"},{"components":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct Datastructures.CertificateInfo","name":"certificate","type":"tuple"}],"name":"create","outputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creator","type":"address"},{"components":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct Datastructures.CertificateInfo","name":"certificate","type":"tuple"}],"name":"createNative","outputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"components":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct Datastructures.CertificateInfo","name":"certificate","type":"tuple"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"ids","type":"bytes32[]"}],"name":"getBatchClaimed","outputs":[{"internalType":"bool[]","name":"","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"ids","type":"bytes32[]"}],"name":"getBatchWindowClaimed","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"poolId","type":"bytes32"}],"name":"getPoolInfo","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"hasClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","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":"address","name":"ca","type":"address"}],"name":"updateCA","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"windowClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes32","name":"poolId","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"components":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct Datastructures.CertificateInfo","name":"certificate","type":"tuple"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60a06040523480156200001157600080fd5b5060405162002a9938038062002a9983398101604081905262000034916200011a565b8181816200004281620000ab565b506002805460ff60a01b19169055600380546001600160a01b0319166001600160a01b03831617905560408051466020820152309181019190915260600160408051601f1981840301815291905280516020909101206080525050600160055550620001529050565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200011557600080fd5b919050565b600080604083850312156200012e57600080fd5b6200013983620000fd565b91506200014960208401620000fd565b90509250929050565b6080516129086200019160003960008181610579015281816109cf01528181610dd901528181610f7501528181611147015261145a01526129086000f3fe6080604052600436106101175760003560e01c80638da5cb5b1161009a578063f2fde38b11610061578063f2fde38b146103a4578063f409ebf8146103c4578063f641f9a3146103e4578063f7e34d74146103f7578063fd3a53e61461041757005b80638da5cb5b146102d5578063a032d20a14610307578063a2d92d6614610327578063a894c45714610347578063e2e498d91461037757005b80633f4ba83a116100de5780633f4ba83a14610258578063486dc8f81461026d5780635c975abb14610280578063715018a6146102ab5780638456cb59146102c057005b806309f2c0191461012057806314b65122146101b05780631897446b146101eb5780631da399311461020b5780632d0335ab1461023857005b3661011e57005b005b34801561012c57600080fd5b5061017961013b366004612247565b600090815260066020526040902080546001820154600283015460039093015460ff8316946101009093046001600160a01b03908116949293911690565b6040805195151586526001600160a01b039485166020870152850192909252606084015216608082015260a0015b60405180910390f35b3480156101bc57600080fd5b506101dd6101cb366004612247565b60016020526000908152604090205481565b6040519081526020016101a7565b3480156101f757600080fd5b5061011e610206366004612287565b610437565b34801561021757600080fd5b5061022b61022636600461233a565b610790565b6040516101a7919061237c565b34801561024457600080fd5b506101dd6102533660046123c0565b610847565b34801561026457600080fd5b5061011e610865565b61011e61027b3660046123dd565b610877565b34801561028c57600080fd5b50600254600160a01b900460ff165b60405190151581526020016101a7565b3480156102b757600080fd5b5061011e610ae9565b3480156102cc57600080fd5b5061011e610afb565b3480156102e157600080fd5b506002546001600160a01b03165b6040516001600160a01b0390911681526020016101a7565b34801561031357600080fd5b5061011e6103223660046123c0565b610b0b565b34801561033357600080fd5b506003546102ef906001600160a01b031681565b34801561035357600080fd5b5061029b610362366004612247565b60006020819052908152604090205460ff1681565b34801561038357600080fd5b5061039761039236600461233a565b610bc5565b6040516101a79190612426565b3480156103b057600080fd5b5061011e6103bf3660046123c0565b610c83565b3480156103d057600080fd5b506101dd6103df366004612460565b610d00565b6101dd6103f23660046124a7565b610f0a565b34801561040357600080fd5b5061011e6104123660046123dd565b61104f565b34801561042357600080fd5b5061011e6104323660046124dd565b61135f565b61043f61167d565b60026005540361046a5760405162461bcd60e51b81526004016104619061256b565b60405180910390fd5b60026005556001600160a01b0387166104c55760405162461bcd60e51b815260206004820152601860248201527f45524332304150433a696e76616c69642d6164647265737300000000000000006044820152606401610461565b6000868152600660205260409020805460ff166104f45760405162461bcd60e51b8152600401610461906125a2565b60006105028686868a6116ca565b905081600101548111156105285760405162461bcd60e51b8152600401610461906125e3565b60006105338a611756565b604080516001600160a01b038d1660208201528082018b9052606081018c9052608081018a905260a0810189905260c08101889052863560e082015261010081018390527f000000000000000000000000000000000000000000000000000000000000000061012080830191909152825180830390910181526101409091019091529091506105c2818661177e565b60018401546105d19089611867565b600185015560028401546105e5908961187a565b600285015560016003850154600160a01b900460ff16600181111561060c5761060c61261a565b036106da57835460405163a9059cbb60e01b81526001600160a01b038d81166004830152602482018b90526000926101009004169063a9059cbb906044016020604051808303816000875af1158015610669573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068d9190612630565b9050806106d45760405162461bcd60e51b8152602060048201526015602482015274115490cc8c105410ce98db185a5b4b59985a5b1959605a1b6044820152606401610461565b50610739565b60006003850154600160a01b900460ff1660018111156106fc576106fc61261a565b03610739576040516001600160a01b038c169089156108fc02908a906000818181858888f19350505050158015610737573d6000803e3d6000fd5b505b898b6001600160a01b03168a7f7da7b281692448fd2864ebd0a32e9631f0286ae687f6c7a2a9e3396614e88f068b60405161077691815260200190565b60405180910390a450506001600555505050505050505050565b606060008267ffffffffffffffff8111156107ad576107ad612652565b6040519080825280602002602001820160405280156107d6578160200160208202803683370190505b50905060005b8381101561083d57600160008686848181106107fa576107fa612668565b9050602002013581526020019081526020016000205482828151811061082257610822612668565b602090810291909101015261083681612694565b90506107dc565b5090505b92915050565b6001600160a01b038116600090815260046020526040812054610841565b61086d611886565b6108756118e0565b565b6002600554036108995760405162461bcd60e51b81526004016104619061256b565b60026005556108a661167d565b600082116108f05760405162461bcd60e51b8152602060048201526017602482015276115490cc8c105410ce9a5b9d985b1a590b585b5bdd5b9d604a1b6044820152606401610461565b6000838152600660205260409020805460ff166109485760405162461bcd60e51b8152602060048201526016602482015275115490cc8c105410ce9a5b9858dd1a5d994b5c1bdbdb60521b6044820152606401610461565b60006003820154600160a01b900460ff16600181111561096a5761096a61261a565b036109b8578234146109b85760405162461bcd60e51b8152602060048201526017602482015276115490cc8c105410ce9a5b9d985b1a590b585b5bdd5b9d604a1b6044820152606401610461565b60006109c386611756565b905060008686868635857f0000000000000000000000000000000000000000000000000000000000000000604080516001600160a01b0390971660208801528601949094526060850192909252608084015260a083015260c082015260e0016040516020818303038152906040529050610a3d818561177e565b6001830154610a4c908661187a565b6001808501919091556003840154600160a01b900460ff166001811115610a7557610a7561261a565b03610a96578254610a969061010090046001600160a01b0316883088611935565b85876001600160a01b0316837f40d7d4b0da5c24ebe0b7510edba09d15d0a4737dc07e8ac3f53bbbbda97649f488604051610ad391815260200190565b60405180910390a4505060016005555050505050565b610af1611886565b610875600061198f565b610b03611886565b6108756119e1565b610b13611886565b6001600160a01b038116610b695760405162461bcd60e51b815260206004820181905260248201527f436f72653a63612d6d7573742d62652d6e6f6e2d7a65726f2d616464726573736044820152606401610461565b6003546040516001600160a01b038084169216907f80db520797a74a3fc61723e79b460b431b2cb614e41b3a8bea1cf760de40873890600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b606060008267ffffffffffffffff811115610be257610be2612652565b604051908082528060200260200182016040528015610c0b578160200160208202803683370190505b50905060005b8381101561083d57600080868684818110610c2e57610c2e612668565b90506020020135815260200190815260200160002060009054906101000a900460ff16828281518110610c6357610c63612668565b91151560209283029190910190910152610c7c81612694565b9050610c11565b610c8b611886565b6001600160a01b038116610cf45760405162461bcd60e51b815260206004820152602a60248201527f4f776e61626c653a6e65772d6f776e65722d6d7573742d62652d6e6f6e2d7a65604482015269726f2d6164647265737360b01b6064820152608401610461565b610cfd8161198f565b50565b6000600260055403610d245760405162461bcd60e51b81526004016104619061256b565b6002600555610d3161167d565b60008311610d815760405162461bcd60e51b815260206004820152601a60248201527f45524332304150433a696e76616c69642d6c69717569646974790000000000006044820152606401610461565b6000610d8c86611756565b604080513060208201526001600160a01b038916918101919091526060810182905290915060800160408051601f19818403018152919052805160209091012091506000828787878735867f00000000000000000000000000000000000000000000000000000000000000006040805160208101989098526001600160a01b0396871690880152949093166060860152608085019190915260a084015260c083015260e0820152610100016040516020818303038152906040529050610e52818561177e565b600083815260066020526040902080546003820180546001600160a01b038b81166001600160a81b031992831617600160a01b1790925560ff19918a166101000291909116911617600190811782558101869055610eb287893089611935565b83886001600160a01b0316847f52a80716b68a4d0cd6402251d12eab77556f6577492d82648a7eecf6238d187b8a8a6001604051610ef2939291906126ad565b60405180910390a45050600160055550949350505050565b6000610f1461167d565b6000610f1f84611756565b604080516001600160a01b038716602080830182905282840185905283518084038501815260608401855280519101206080830181905260a08301919091523460c0830152863560e083015261010082018490527f00000000000000000000000000000000000000000000000000000000000000006101208084019190915283518084039091018152610140909201909252909350909150610fc1818561177e565b6000838152600660205260408082206003810180543460018085018290556001600160a01b038c166001600160a81b03199093168317909355835460ff191690921783559251919387939287927f52a80716b68a4d0cd6402251d12eab77556f6577492d82648a7eecf6238d187b9261103e9290919082906126ad565b60405180910390a450505092915050565b61105761167d565b6002600554036110795760405162461bcd60e51b81526004016104619061256b565b60026005556000838152600660205260409020805460ff166110ad5760405162461bcd60e51b8152600401610461906125a2565b80600101548311156110d15760405162461bcd60e51b8152600401610461906125e3565b60038101546001600160a01b038681169116146111305760405162461bcd60e51b815260206004820152601760248201527f45524332304150433a6e6f742d617574686f72697a65640000000000000000006044820152606401610461565b600061113b86611756565b905060008686868635857f0000000000000000000000000000000000000000000000000000000000000000604080516001600160a01b0390971660208801528601949094526060850192909252608084015260a083015260c082015260e00160405160208183030381529060405290506111b5818561177e565b60018301546111c49086611867565b6001808501919091556003840154600160a01b900460ff1660018111156111ed576111ed61261a565b036112c357825460405163a9059cbb60e01b81526001600160a01b038981166004830152602482018890526000926101009004169063a9059cbb906044016020604051808303816000875af115801561124a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126e9190612630565b9050806112bd5760405162461bcd60e51b815260206004820152601860248201527f45524332304150433a7472616e736665722d6661696c656400000000000000006044820152606401610461565b50611322565b60006003840154600160a01b900460ff1660018111156112e5576112e561261a565b03611322576040516001600160a01b0388169086156108fc029087906000818181858888f19350505050158015611320573d6000803e3d6000fd5b505b85876001600160a01b0316837fb88765ea7b7573e6e04f49506468d675ab2efa5f465d1b134349783dde8293a088604051610ad391815260200190565b61136761167d565b6002600554036113895760405162461bcd60e51b81526004016104619061256b565b60026005556001600160a01b0388166113db5760405162461bcd60e51b8152602060048201526014602482015273496e76616c69642075736572206164647265737360601b6044820152606401610461565b6000878152600660205260409020805460ff1661140a5760405162461bcd60e51b8152600401610461906125a2565b60006114198686868b8b611a24565b9050816001015481111561143f5760405162461bcd60e51b8152600401610461906125e3565b600061144a8b611756565b905060008b8a8a8d8b8b8b8b35897f00000000000000000000000000000000000000000000000000000000000000006040516020016114929a99989796959493929190612722565b60405160208183030381529060405290506114ad818661177e565b60018401546114bc9089611867565b600185015560028401546114d0908961187a565b600285015560016003850154600160a01b900460ff1660018111156114f7576114f761261a565b036115c557835460405163a9059cbb60e01b81526001600160a01b038e81166004830152602482018b90526000926101009004169063a9059cbb906044016020604051808303816000875af1158015611554573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115789190612630565b9050806115bf5760405162461bcd60e51b8152602060048201526015602482015274115490cc8c105410ce98db185a5b4b59985a5b1959605a1b6044820152606401610461565b50611624565b60006003850154600160a01b900460ff1660018111156115e7576115e761261a565b03611624576040516001600160a01b038d169089156108fc02908a906000818181858888f19350505050158015611622573d6000803e3d6000fd5b505b8a8c6001600160a01b03167f109b5bbf07114bfacb0633325df1c0dbcd6c6f0cc202f7b0cf0318a51293056e8c8c8c60405161166293929190612782565b60405180910390a35050600160055550505050505050505050565b600254600160a01b900460ff16156108755760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610461565b60006116d7858585611b19565b60008381526020819052604090205490915060ff16156117355760405162461bcd60e51b815260206004820152601960248201527810db185a5b58589b194e985b1c9958591e4b58db185a5b5959603a1b6044820152606401610461565b600091825260208290526040909120805460ff191660011790559392505050565b6001600160a01b03811660009081526004602052604090208054600181018255905b50919050565b80354211156117cf5760405162461bcd60e51b815260206004820152601860248201527f436f72653a657870697265642d636572746966696361746500000000000000006044820152606401610461565b60006117da83611c07565b90506000611801826117f260408601602087016127a6565b85604001358660600135611c42565b6003549091506001600160a01b038083169116146118615760405162461bcd60e51b815260206004820152601860248201527f436f72653a696e76616c69642d636572746966696361746500000000000000006044820152606401610461565b50505050565b600061187382846127c9565b9392505050565b600061187382846127dc565b6002546001600160a01b031633146108755760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a63616c6c65722d6d7573742d62652d6f776e6572000000006044820152606401610461565b6118e8611c60565b6002805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611861908590611cb0565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6119e961167d565b6002805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586119183390565b6000611a31868686611b19565b905060005b82811015611b0f57600080858584818110611a5357611a53612668565b602090810292909201358352508101919091526040016000205460ff1615611ab95760405162461bcd60e51b815260206004820152601960248201527810db185a5b58589b194e985b1c9958591e4b58db185a5b5959603a1b6044820152606401610461565b6001600080868685818110611ad057611ad0612668565b90506020020135815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611b0790612694565b915050611a36565b5095945050505050565b6000808411611b6a5760405162461bcd60e51b815260206004820152601860248201527f436c61696d61626c653a696e76616c69642d616d6f756e7400000000000000006044820152606401610461565b600083815260016020526040902054611b8390836127c9565b905080841115611bd55760405162461bcd60e51b815260206004820152601b60248201527f436c61696d61626c653a696e73756666696369656e742d66756e6400000000006044820152606401610461565b600083815260016020526040902054611bee908561187a565b6000938452600160205260409093209290925550919050565b6000611c138251611d87565b82604051602001611c25929190612813565b604051602081830303815290604052805190602001209050919050565b6000806000611c5387878787611e90565b91509150611b0f81611f7d565b600254600160a01b900460ff166108755760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610461565b6000611d05826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121339092919063ffffffff16565b805190915015611d825780806020019051810190611d239190612630565b611d825760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610461565b505050565b606081600003611dae5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611dd85780611dc281612694565b9150611dd19050600a83612884565b9150611db2565b60008167ffffffffffffffff811115611df357611df3612652565b6040519080825280601f01601f191660200182016040528015611e1d576020820181803683370190505b5090505b8415611e8857611e326001836127c9565b9150611e3f600a86612898565b611e4a9060306127dc565b60f81b818381518110611e5f57611e5f612668565b60200101906001600160f81b031916908160001a905350611e81600a86612884565b9450611e21565b949350505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611ec75750600090506003611f74565b8460ff16601b14158015611edf57508460ff16601c14155b15611ef05750600090506004611f74565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611f44573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611f6d57600060019250925050611f74565b9150600090505b94509492505050565b6000816004811115611f9157611f9161261a565b03611f995750565b6001816004811115611fad57611fad61261a565b03611ffa5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610461565b600281600481111561200e5761200e61261a565b0361205b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610461565b600381600481111561206f5761206f61261a565b036120c75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610461565b60048160048111156120db576120db61261a565b03610cfd5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610461565b6060611e888484600085856001600160a01b0385163b6121955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610461565b600080866001600160a01b031685876040516121b191906128ac565b60006040518083038185875af1925050503d80600081146121ee576040519150601f19603f3d011682016040523d82523d6000602084013e6121f3565b606091505b509150915061220382828661220e565b979650505050505050565b6060831561221d575081611873565b82511561222d5782518084602001fd5b8160405162461bcd60e51b815260040161046191906128c8565b60006020828403121561225957600080fd5b5035919050565b6001600160a01b0381168114610cfd57600080fd5b60006080828403121561177857600080fd5b6000806000806000806000610140888a0312156122a357600080fd5b87356122ae81612260565b96506020880135955060408801359450606088013593506080880135925060a088013591506122e08960c08a01612275565b905092959891949750929550565b60008083601f84011261230057600080fd5b50813567ffffffffffffffff81111561231857600080fd5b6020830191508360208260051b850101111561233357600080fd5b9250929050565b6000806020838503121561234d57600080fd5b823567ffffffffffffffff81111561236457600080fd5b612370858286016122ee565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156123b457835183529284019291840191600101612398565b50909695505050505050565b6000602082840312156123d257600080fd5b813561187381612260565b60008060008060e085870312156123f357600080fd5b84356123fe81612260565b9350602085013592506040850135915061241b8660608701612275565b905092959194509250565b6020808252825182820181905260009190848201906040850190845b818110156123b4578351151583529284019291840191600101612442565b60008060008060e0858703121561247657600080fd5b843561248181612260565b9350602085013561249181612260565b92506040850135915061241b8660608701612275565b60008060a083850312156124ba57600080fd5b82356124c581612260565b91506124d48460208501612275565b90509250929050565b600080600080600080600080610140898b0312156124fa57600080fd5b883561250581612260565b975060208901359650604089013567ffffffffffffffff81111561252857600080fd5b6125348b828c016122ee565b909750955050606089013593506080890135925060a0890135915061255c8a60c08b01612275565b90509295985092959890939650565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526021908201527f45524332304150433a696e76616c69642d6f722d696e6163746976652d706f6f6040820152601b60fa1b606082015260800190565b6020808252601a908201527f45524332304150433a696e73756666696369656e742d66756e64000000000000604082015260600190565b634e487b7160e01b600052602160045260246000fd5b60006020828403121561264257600080fd5b8151801515811461187357600080fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016126a6576126a661267e565b5060010190565b6001600160a01b03841681526020810183905260608101600283106126e257634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b81835260006001600160fb1b0383111561270957600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b038b168152610120602082018190526000906127488382018c8e6126f0565b604084019a909a5250506060810196909652608086019490945260a085019290925260c084015260e0830152610100909101529392505050565b6040815260006127966040830185876126f0565b9050826020830152949350505050565b6000602082840312156127b857600080fd5b813560ff8116811461187357600080fd5b818103818111156108415761084161267e565b808201808211156108415761084161267e565b60005b8381101561280a5781810151838201526020016127f2565b50506000910152565b7f19457468657265756d205369676e6564204d6573736167653a0a00000000000081526000835161284b81601a8501602088016127ef565b83519083019061286281601a8401602088016127ef565b01601a01949350505050565b634e487b7160e01b600052601260045260246000fd5b6000826128935761289361286e565b500490565b6000826128a7576128a761286e565b500690565b600082516128be8184602087016127ef565b9190910192915050565b60208152600082518060208401526128e78160408501602087016127ef565b601f01601f1916919091016040019291505056fea164736f6c6343000811000a000000000000000000000000685acfc099e2a0bc75aa833949291be794d317300000000000000000000000007d3f6c020da258fa8b6cef65c83293653e40cfc8
Deployed Bytecode
0x6080604052600436106101175760003560e01c80638da5cb5b1161009a578063f2fde38b11610061578063f2fde38b146103a4578063f409ebf8146103c4578063f641f9a3146103e4578063f7e34d74146103f7578063fd3a53e61461041757005b80638da5cb5b146102d5578063a032d20a14610307578063a2d92d6614610327578063a894c45714610347578063e2e498d91461037757005b80633f4ba83a116100de5780633f4ba83a14610258578063486dc8f81461026d5780635c975abb14610280578063715018a6146102ab5780638456cb59146102c057005b806309f2c0191461012057806314b65122146101b05780631897446b146101eb5780631da399311461020b5780632d0335ab1461023857005b3661011e57005b005b34801561012c57600080fd5b5061017961013b366004612247565b600090815260066020526040902080546001820154600283015460039093015460ff8316946101009093046001600160a01b03908116949293911690565b6040805195151586526001600160a01b039485166020870152850192909252606084015216608082015260a0015b60405180910390f35b3480156101bc57600080fd5b506101dd6101cb366004612247565b60016020526000908152604090205481565b6040519081526020016101a7565b3480156101f757600080fd5b5061011e610206366004612287565b610437565b34801561021757600080fd5b5061022b61022636600461233a565b610790565b6040516101a7919061237c565b34801561024457600080fd5b506101dd6102533660046123c0565b610847565b34801561026457600080fd5b5061011e610865565b61011e61027b3660046123dd565b610877565b34801561028c57600080fd5b50600254600160a01b900460ff165b60405190151581526020016101a7565b3480156102b757600080fd5b5061011e610ae9565b3480156102cc57600080fd5b5061011e610afb565b3480156102e157600080fd5b506002546001600160a01b03165b6040516001600160a01b0390911681526020016101a7565b34801561031357600080fd5b5061011e6103223660046123c0565b610b0b565b34801561033357600080fd5b506003546102ef906001600160a01b031681565b34801561035357600080fd5b5061029b610362366004612247565b60006020819052908152604090205460ff1681565b34801561038357600080fd5b5061039761039236600461233a565b610bc5565b6040516101a79190612426565b3480156103b057600080fd5b5061011e6103bf3660046123c0565b610c83565b3480156103d057600080fd5b506101dd6103df366004612460565b610d00565b6101dd6103f23660046124a7565b610f0a565b34801561040357600080fd5b5061011e6104123660046123dd565b61104f565b34801561042357600080fd5b5061011e6104323660046124dd565b61135f565b61043f61167d565b60026005540361046a5760405162461bcd60e51b81526004016104619061256b565b60405180910390fd5b60026005556001600160a01b0387166104c55760405162461bcd60e51b815260206004820152601860248201527f45524332304150433a696e76616c69642d6164647265737300000000000000006044820152606401610461565b6000868152600660205260409020805460ff166104f45760405162461bcd60e51b8152600401610461906125a2565b60006105028686868a6116ca565b905081600101548111156105285760405162461bcd60e51b8152600401610461906125e3565b60006105338a611756565b604080516001600160a01b038d1660208201528082018b9052606081018c9052608081018a905260a0810189905260c08101889052863560e082015261010081018390527f3b618488a2efec774bd770bc5d7cb5adccfee04d69d0d0359c3165aabe98b1c261012080830191909152825180830390910181526101409091019091529091506105c2818661177e565b60018401546105d19089611867565b600185015560028401546105e5908961187a565b600285015560016003850154600160a01b900460ff16600181111561060c5761060c61261a565b036106da57835460405163a9059cbb60e01b81526001600160a01b038d81166004830152602482018b90526000926101009004169063a9059cbb906044016020604051808303816000875af1158015610669573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068d9190612630565b9050806106d45760405162461bcd60e51b8152602060048201526015602482015274115490cc8c105410ce98db185a5b4b59985a5b1959605a1b6044820152606401610461565b50610739565b60006003850154600160a01b900460ff1660018111156106fc576106fc61261a565b03610739576040516001600160a01b038c169089156108fc02908a906000818181858888f19350505050158015610737573d6000803e3d6000fd5b505b898b6001600160a01b03168a7f7da7b281692448fd2864ebd0a32e9631f0286ae687f6c7a2a9e3396614e88f068b60405161077691815260200190565b60405180910390a450506001600555505050505050505050565b606060008267ffffffffffffffff8111156107ad576107ad612652565b6040519080825280602002602001820160405280156107d6578160200160208202803683370190505b50905060005b8381101561083d57600160008686848181106107fa576107fa612668565b9050602002013581526020019081526020016000205482828151811061082257610822612668565b602090810291909101015261083681612694565b90506107dc565b5090505b92915050565b6001600160a01b038116600090815260046020526040812054610841565b61086d611886565b6108756118e0565b565b6002600554036108995760405162461bcd60e51b81526004016104619061256b565b60026005556108a661167d565b600082116108f05760405162461bcd60e51b8152602060048201526017602482015276115490cc8c105410ce9a5b9d985b1a590b585b5bdd5b9d604a1b6044820152606401610461565b6000838152600660205260409020805460ff166109485760405162461bcd60e51b8152602060048201526016602482015275115490cc8c105410ce9a5b9858dd1a5d994b5c1bdbdb60521b6044820152606401610461565b60006003820154600160a01b900460ff16600181111561096a5761096a61261a565b036109b8578234146109b85760405162461bcd60e51b8152602060048201526017602482015276115490cc8c105410ce9a5b9d985b1a590b585b5bdd5b9d604a1b6044820152606401610461565b60006109c386611756565b905060008686868635857f3b618488a2efec774bd770bc5d7cb5adccfee04d69d0d0359c3165aabe98b1c2604080516001600160a01b0390971660208801528601949094526060850192909252608084015260a083015260c082015260e0016040516020818303038152906040529050610a3d818561177e565b6001830154610a4c908661187a565b6001808501919091556003840154600160a01b900460ff166001811115610a7557610a7561261a565b03610a96578254610a969061010090046001600160a01b0316883088611935565b85876001600160a01b0316837f40d7d4b0da5c24ebe0b7510edba09d15d0a4737dc07e8ac3f53bbbbda97649f488604051610ad391815260200190565b60405180910390a4505060016005555050505050565b610af1611886565b610875600061198f565b610b03611886565b6108756119e1565b610b13611886565b6001600160a01b038116610b695760405162461bcd60e51b815260206004820181905260248201527f436f72653a63612d6d7573742d62652d6e6f6e2d7a65726f2d616464726573736044820152606401610461565b6003546040516001600160a01b038084169216907f80db520797a74a3fc61723e79b460b431b2cb614e41b3a8bea1cf760de40873890600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b606060008267ffffffffffffffff811115610be257610be2612652565b604051908082528060200260200182016040528015610c0b578160200160208202803683370190505b50905060005b8381101561083d57600080868684818110610c2e57610c2e612668565b90506020020135815260200190815260200160002060009054906101000a900460ff16828281518110610c6357610c63612668565b91151560209283029190910190910152610c7c81612694565b9050610c11565b610c8b611886565b6001600160a01b038116610cf45760405162461bcd60e51b815260206004820152602a60248201527f4f776e61626c653a6e65772d6f776e65722d6d7573742d62652d6e6f6e2d7a65604482015269726f2d6164647265737360b01b6064820152608401610461565b610cfd8161198f565b50565b6000600260055403610d245760405162461bcd60e51b81526004016104619061256b565b6002600555610d3161167d565b60008311610d815760405162461bcd60e51b815260206004820152601a60248201527f45524332304150433a696e76616c69642d6c69717569646974790000000000006044820152606401610461565b6000610d8c86611756565b604080513060208201526001600160a01b038916918101919091526060810182905290915060800160408051601f19818403018152919052805160209091012091506000828787878735867f3b618488a2efec774bd770bc5d7cb5adccfee04d69d0d0359c3165aabe98b1c26040805160208101989098526001600160a01b0396871690880152949093166060860152608085019190915260a084015260c083015260e0820152610100016040516020818303038152906040529050610e52818561177e565b600083815260066020526040902080546003820180546001600160a01b038b81166001600160a81b031992831617600160a01b1790925560ff19918a166101000291909116911617600190811782558101869055610eb287893089611935565b83886001600160a01b0316847f52a80716b68a4d0cd6402251d12eab77556f6577492d82648a7eecf6238d187b8a8a6001604051610ef2939291906126ad565b60405180910390a45050600160055550949350505050565b6000610f1461167d565b6000610f1f84611756565b604080516001600160a01b038716602080830182905282840185905283518084038501815260608401855280519101206080830181905260a08301919091523460c0830152863560e083015261010082018490527f3b618488a2efec774bd770bc5d7cb5adccfee04d69d0d0359c3165aabe98b1c26101208084019190915283518084039091018152610140909201909252909350909150610fc1818561177e565b6000838152600660205260408082206003810180543460018085018290556001600160a01b038c166001600160a81b03199093168317909355835460ff191690921783559251919387939287927f52a80716b68a4d0cd6402251d12eab77556f6577492d82648a7eecf6238d187b9261103e9290919082906126ad565b60405180910390a450505092915050565b61105761167d565b6002600554036110795760405162461bcd60e51b81526004016104619061256b565b60026005556000838152600660205260409020805460ff166110ad5760405162461bcd60e51b8152600401610461906125a2565b80600101548311156110d15760405162461bcd60e51b8152600401610461906125e3565b60038101546001600160a01b038681169116146111305760405162461bcd60e51b815260206004820152601760248201527f45524332304150433a6e6f742d617574686f72697a65640000000000000000006044820152606401610461565b600061113b86611756565b905060008686868635857f3b618488a2efec774bd770bc5d7cb5adccfee04d69d0d0359c3165aabe98b1c2604080516001600160a01b0390971660208801528601949094526060850192909252608084015260a083015260c082015260e00160405160208183030381529060405290506111b5818561177e565b60018301546111c49086611867565b6001808501919091556003840154600160a01b900460ff1660018111156111ed576111ed61261a565b036112c357825460405163a9059cbb60e01b81526001600160a01b038981166004830152602482018890526000926101009004169063a9059cbb906044016020604051808303816000875af115801561124a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126e9190612630565b9050806112bd5760405162461bcd60e51b815260206004820152601860248201527f45524332304150433a7472616e736665722d6661696c656400000000000000006044820152606401610461565b50611322565b60006003840154600160a01b900460ff1660018111156112e5576112e561261a565b03611322576040516001600160a01b0388169086156108fc029087906000818181858888f19350505050158015611320573d6000803e3d6000fd5b505b85876001600160a01b0316837fb88765ea7b7573e6e04f49506468d675ab2efa5f465d1b134349783dde8293a088604051610ad391815260200190565b61136761167d565b6002600554036113895760405162461bcd60e51b81526004016104619061256b565b60026005556001600160a01b0388166113db5760405162461bcd60e51b8152602060048201526014602482015273496e76616c69642075736572206164647265737360601b6044820152606401610461565b6000878152600660205260409020805460ff1661140a5760405162461bcd60e51b8152600401610461906125a2565b60006114198686868b8b611a24565b9050816001015481111561143f5760405162461bcd60e51b8152600401610461906125e3565b600061144a8b611756565b905060008b8a8a8d8b8b8b8b35897f3b618488a2efec774bd770bc5d7cb5adccfee04d69d0d0359c3165aabe98b1c26040516020016114929a99989796959493929190612722565b60405160208183030381529060405290506114ad818661177e565b60018401546114bc9089611867565b600185015560028401546114d0908961187a565b600285015560016003850154600160a01b900460ff1660018111156114f7576114f761261a565b036115c557835460405163a9059cbb60e01b81526001600160a01b038e81166004830152602482018b90526000926101009004169063a9059cbb906044016020604051808303816000875af1158015611554573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115789190612630565b9050806115bf5760405162461bcd60e51b8152602060048201526015602482015274115490cc8c105410ce98db185a5b4b59985a5b1959605a1b6044820152606401610461565b50611624565b60006003850154600160a01b900460ff1660018111156115e7576115e761261a565b03611624576040516001600160a01b038d169089156108fc02908a906000818181858888f19350505050158015611622573d6000803e3d6000fd5b505b8a8c6001600160a01b03167f109b5bbf07114bfacb0633325df1c0dbcd6c6f0cc202f7b0cf0318a51293056e8c8c8c60405161166293929190612782565b60405180910390a35050600160055550505050505050505050565b600254600160a01b900460ff16156108755760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610461565b60006116d7858585611b19565b60008381526020819052604090205490915060ff16156117355760405162461bcd60e51b815260206004820152601960248201527810db185a5b58589b194e985b1c9958591e4b58db185a5b5959603a1b6044820152606401610461565b600091825260208290526040909120805460ff191660011790559392505050565b6001600160a01b03811660009081526004602052604090208054600181018255905b50919050565b80354211156117cf5760405162461bcd60e51b815260206004820152601860248201527f436f72653a657870697265642d636572746966696361746500000000000000006044820152606401610461565b60006117da83611c07565b90506000611801826117f260408601602087016127a6565b85604001358660600135611c42565b6003549091506001600160a01b038083169116146118615760405162461bcd60e51b815260206004820152601860248201527f436f72653a696e76616c69642d636572746966696361746500000000000000006044820152606401610461565b50505050565b600061187382846127c9565b9392505050565b600061187382846127dc565b6002546001600160a01b031633146108755760405162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a63616c6c65722d6d7573742d62652d6f776e6572000000006044820152606401610461565b6118e8611c60565b6002805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611861908590611cb0565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6119e961167d565b6002805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586119183390565b6000611a31868686611b19565b905060005b82811015611b0f57600080858584818110611a5357611a53612668565b602090810292909201358352508101919091526040016000205460ff1615611ab95760405162461bcd60e51b815260206004820152601960248201527810db185a5b58589b194e985b1c9958591e4b58db185a5b5959603a1b6044820152606401610461565b6001600080868685818110611ad057611ad0612668565b90506020020135815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611b0790612694565b915050611a36565b5095945050505050565b6000808411611b6a5760405162461bcd60e51b815260206004820152601860248201527f436c61696d61626c653a696e76616c69642d616d6f756e7400000000000000006044820152606401610461565b600083815260016020526040902054611b8390836127c9565b905080841115611bd55760405162461bcd60e51b815260206004820152601b60248201527f436c61696d61626c653a696e73756666696369656e742d66756e6400000000006044820152606401610461565b600083815260016020526040902054611bee908561187a565b6000938452600160205260409093209290925550919050565b6000611c138251611d87565b82604051602001611c25929190612813565b604051602081830303815290604052805190602001209050919050565b6000806000611c5387878787611e90565b91509150611b0f81611f7d565b600254600160a01b900460ff166108755760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610461565b6000611d05826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121339092919063ffffffff16565b805190915015611d825780806020019051810190611d239190612630565b611d825760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610461565b505050565b606081600003611dae5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611dd85780611dc281612694565b9150611dd19050600a83612884565b9150611db2565b60008167ffffffffffffffff811115611df357611df3612652565b6040519080825280601f01601f191660200182016040528015611e1d576020820181803683370190505b5090505b8415611e8857611e326001836127c9565b9150611e3f600a86612898565b611e4a9060306127dc565b60f81b818381518110611e5f57611e5f612668565b60200101906001600160f81b031916908160001a905350611e81600a86612884565b9450611e21565b949350505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611ec75750600090506003611f74565b8460ff16601b14158015611edf57508460ff16601c14155b15611ef05750600090506004611f74565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611f44573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611f6d57600060019250925050611f74565b9150600090505b94509492505050565b6000816004811115611f9157611f9161261a565b03611f995750565b6001816004811115611fad57611fad61261a565b03611ffa5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610461565b600281600481111561200e5761200e61261a565b0361205b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610461565b600381600481111561206f5761206f61261a565b036120c75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610461565b60048160048111156120db576120db61261a565b03610cfd5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610461565b6060611e888484600085856001600160a01b0385163b6121955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610461565b600080866001600160a01b031685876040516121b191906128ac565b60006040518083038185875af1925050503d80600081146121ee576040519150601f19603f3d011682016040523d82523d6000602084013e6121f3565b606091505b509150915061220382828661220e565b979650505050505050565b6060831561221d575081611873565b82511561222d5782518084602001fd5b8160405162461bcd60e51b815260040161046191906128c8565b60006020828403121561225957600080fd5b5035919050565b6001600160a01b0381168114610cfd57600080fd5b60006080828403121561177857600080fd5b6000806000806000806000610140888a0312156122a357600080fd5b87356122ae81612260565b96506020880135955060408801359450606088013593506080880135925060a088013591506122e08960c08a01612275565b905092959891949750929550565b60008083601f84011261230057600080fd5b50813567ffffffffffffffff81111561231857600080fd5b6020830191508360208260051b850101111561233357600080fd5b9250929050565b6000806020838503121561234d57600080fd5b823567ffffffffffffffff81111561236457600080fd5b612370858286016122ee565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156123b457835183529284019291840191600101612398565b50909695505050505050565b6000602082840312156123d257600080fd5b813561187381612260565b60008060008060e085870312156123f357600080fd5b84356123fe81612260565b9350602085013592506040850135915061241b8660608701612275565b905092959194509250565b6020808252825182820181905260009190848201906040850190845b818110156123b4578351151583529284019291840191600101612442565b60008060008060e0858703121561247657600080fd5b843561248181612260565b9350602085013561249181612260565b92506040850135915061241b8660608701612275565b60008060a083850312156124ba57600080fd5b82356124c581612260565b91506124d48460208501612275565b90509250929050565b600080600080600080600080610140898b0312156124fa57600080fd5b883561250581612260565b975060208901359650604089013567ffffffffffffffff81111561252857600080fd5b6125348b828c016122ee565b909750955050606089013593506080890135925060a0890135915061255c8a60c08b01612275565b90509295985092959890939650565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526021908201527f45524332304150433a696e76616c69642d6f722d696e6163746976652d706f6f6040820152601b60fa1b606082015260800190565b6020808252601a908201527f45524332304150433a696e73756666696369656e742d66756e64000000000000604082015260600190565b634e487b7160e01b600052602160045260246000fd5b60006020828403121561264257600080fd5b8151801515811461187357600080fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016126a6576126a661267e565b5060010190565b6001600160a01b03841681526020810183905260608101600283106126e257634e487b7160e01b600052602160045260246000fd5b826040830152949350505050565b81835260006001600160fb1b0383111561270957600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b038b168152610120602082018190526000906127488382018c8e6126f0565b604084019a909a5250506060810196909652608086019490945260a085019290925260c084015260e0830152610100909101529392505050565b6040815260006127966040830185876126f0565b9050826020830152949350505050565b6000602082840312156127b857600080fd5b813560ff8116811461187357600080fd5b818103818111156108415761084161267e565b808201808211156108415761084161267e565b60005b8381101561280a5781810151838201526020016127f2565b50506000910152565b7f19457468657265756d205369676e6564204d6573736167653a0a00000000000081526000835161284b81601a8501602088016127ef565b83519083019061286281601a8401602088016127ef565b01601a01949350505050565b634e487b7160e01b600052601260045260246000fd5b6000826128935761289361286e565b500490565b6000826128a7576128a761286e565b500690565b600082516128be8184602087016127ef565b9190910192915050565b60208152600082518060208401526128e78160408501602087016127ef565b601f01601f1916919091016040019291505056fea164736f6c6343000811000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000685acfc099e2a0bc75aa833949291be794d317300000000000000000000000007d3f6c020da258fa8b6cef65c83293653e40cfc8
-----Decoded View---------------
Arg [0] : owner_ (address): 0x685aCfc099E2a0bc75Aa833949291Be794D31730
Arg [1] : _ca (address): 0x7D3f6c020DA258fa8B6CEf65C83293653e40Cfc8
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000685acfc099e2a0bc75aa833949291be794d31730
Arg [1] : 0000000000000000000000007d3f6c020da258fa8b6cef65c83293653e40cfc8
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in GLMR
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.