Source Code
Latest 25 from a total of 84 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw | 17364653 | 989 days ago | IN | 0 ETH | 0.00315824 | ||||
| Get Reward | 17364648 | 989 days ago | IN | 0 ETH | 0.00675446 | ||||
| Get Reward | 17065581 | 1031 days ago | IN | 0 ETH | 0.00491615 | ||||
| Withdraw | 17065548 | 1031 days ago | IN | 0 ETH | 0.00307983 | ||||
| Get Reward | 17056883 | 1033 days ago | IN | 0 ETH | 0.00475804 | ||||
| Withdraw | 17056862 | 1033 days ago | IN | 0 ETH | 0.00270583 | ||||
| Get Reward | 16995467 | 1041 days ago | IN | 0 ETH | 0.00334523 | ||||
| Withdraw | 16995401 | 1041 days ago | IN | 0 ETH | 0.00224832 | ||||
| Withdraw | 16992669 | 1042 days ago | IN | 0 ETH | 0.00201088 | ||||
| Get Reward | 16992658 | 1042 days ago | IN | 0 ETH | 0.00393389 | ||||
| Get Reward | 16991210 | 1042 days ago | IN | 0 ETH | 0.00528132 | ||||
| Withdraw | 16991181 | 1042 days ago | IN | 0 ETH | 0.00368764 | ||||
| Withdraw | 16989911 | 1042 days ago | IN | 0 ETH | 0.0036348 | ||||
| Get Reward | 16988634 | 1042 days ago | IN | 0 ETH | 0.00439939 | ||||
| Get Reward | 16974460 | 1044 days ago | IN | 0 ETH | 0.00312527 | ||||
| Withdraw | 16974455 | 1044 days ago | IN | 0 ETH | 0.00202816 | ||||
| Get Reward | 16968645 | 1045 days ago | IN | 0 ETH | 0.00316172 | ||||
| Withdraw | 16956572 | 1047 days ago | IN | 0 ETH | 0.0017621 | ||||
| Get Reward | 16956554 | 1047 days ago | IN | 0 ETH | 0.00365851 | ||||
| Get Reward | 16950942 | 1048 days ago | IN | 0 ETH | 0.00306116 | ||||
| Withdraw | 16950923 | 1048 days ago | IN | 0 ETH | 0.00232402 | ||||
| Get Reward | 16935427 | 1050 days ago | IN | 0 ETH | 0.00460541 | ||||
| Withdraw | 16928187 | 1051 days ago | IN | 0 ETH | 0.00255302 | ||||
| Get Reward | 16928185 | 1051 days ago | IN | 0 ETH | 0.00506819 | ||||
| Get Reward | 16927238 | 1051 days ago | IN | 0 ETH | 0.00595923 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
FarmWrapper
Compiler Version
v0.8.9+commit.e5eed63a
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../libraries/ExceptionsLibrary.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "../interfaces/vaults/IERC20RootVault.sol";
import "../interfaces/utils/ILpCallback.sol";
import "../interfaces/external/synthetix/IFarmingPool.sol";
import "./BatchCall.sol";
import "./FarmingPool.sol";
import "./DefaultAccessControl.sol";
contract FarmWrapper is FarmingPool, DefaultAccessControl {
using SafeERC20 for IERC20;
using SafeERC20 for IERC20RootVault;
struct StrategyInfo {
address strategy;
bool needToCallCallback;
IFarmingPool farm;
}
mapping(address => StrategyInfo) public depositInfo;
constructor(
address owner,
address rewardsDistribution,
address rewardsToken,
address stakingToken,
address admin
) FarmingPool(owner, rewardsDistribution, rewardsToken, stakingToken) DefaultAccessControl(admin) {}
// ------------------- EXTERNAL, MUTATING -------------------
function depositAndStake(
IERC20RootVault vault,
uint256[] calldata tokenAmounts,
uint256 minLpTokens,
bytes calldata vaultOptions
) external returns (uint256[] memory actualTokenAmounts) {
StrategyInfo memory strategyInfo = depositInfo[address(vault)];
require(strategyInfo.strategy != address(0), ExceptionsLibrary.ADDRESS_ZERO);
address[] memory tokens = vault.vaultTokens();
require(tokens.length == tokenAmounts.length, ExceptionsLibrary.INVALID_LENGTH);
for (uint256 i = 0; i < tokens.length; ++i) {
IERC20(tokens[i]).safeTransferFrom(msg.sender, address(this), tokenAmounts[i]);
IERC20(tokens[i]).safeIncreaseAllowance(address(vault), tokenAmounts[i]);
}
uint256 oldBalance = vault.balanceOf(address(this));
actualTokenAmounts = vault.deposit(tokenAmounts, minLpTokens, vaultOptions);
uint256 lpReceived = vault.balanceOf(address(this)) - oldBalance;
vault.safeTransfer(msg.sender, lpReceived);
{
bytes memory data = abi.encodePacked(IFarmingPool.stake.selector, abi.encode(lpReceived));
Address.functionDelegateCall(address(strategyInfo.farm), data);
}
if (strategyInfo.needToCallCallback) {
ILpCallback(strategyInfo.strategy).depositCallback();
}
for (uint256 i = 0; i < tokens.length; ++i) {
IERC20(tokens[i]).safeApprove(address(vault), 0);
if (tokenAmounts[i] > actualTokenAmounts[i]) {
IERC20(tokens[i]).safeTransfer(msg.sender, tokenAmounts[i] - actualTokenAmounts[i]);
}
}
emit Deposit(msg.sender, address(vault), tokens, actualTokenAmounts, lpReceived);
}
function addNewStrategy(
address vault,
address strategy,
bool needToCallCallback,
IFarmingPool farm
) external {
_requireAdmin();
depositInfo[vault] = StrategyInfo({strategy: strategy, needToCallCallback: needToCallCallback, farm: farm});
}
/// @notice Emitted when liquidity is deposited
/// @param from The source address for the liquidity
/// @param tokens ERC20 tokens deposited
/// @param actualTokenAmounts Token amounts deposited
/// @param lpTokenMinted LP tokens received by the liquidity provider
event Deposit(
address indexed from,
address indexed to,
address[] tokens,
uint256[] actualTokenAmounts,
uint256 lpTokenMinted
);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role, _msgSender());
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(uint160(account), 20),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
using EnumerableSet for EnumerableSet.AddressSet;
mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) public view override returns (address) {
return _roleMembers[role].at(index);
}
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) public view override returns (uint256) {
return _roleMembers[role].length();
}
/**
* @dev Overload {_grantRole} to track enumerable memberships
*/
function _grantRole(bytes32 role, address account) internal virtual override {
super._grantRole(role, account);
_roleMembers[role].add(account);
}
/**
* @dev Overload {_revokeRole} to track enumerable memberships
*/
function _revokeRole(bytes32 role, address account) internal virtual override {
super._revokeRole(role, account);
_roleMembers[role].remove(account);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerable is IAccessControl {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// 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.0 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.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));
}
}
/**
* @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 v4.4.0 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @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
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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.0 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.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 substraction 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 v4.4.0 (utils/structs/EnumerableSet.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
return _values(set._inner);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "./utils/IDefaultAccessControl.sol";
import "./IUnitPricesGovernance.sol";
interface IProtocolGovernance is IDefaultAccessControl, IUnitPricesGovernance {
/// @notice CommonLibrary protocol params.
/// @param maxTokensPerVault Max different token addresses that could be managed by the vault
/// @param governanceDelay The delay (in secs) that must pass before setting new pending params to commiting them
/// @param protocolTreasury The address that collects protocolFees, if protocolFee is not zero
/// @param forceAllowMask If a permission bit is set in this mask it forces all addresses to have this permission as true
/// @param withdrawLimit Withdraw limit (in unit prices, i.e. usd)
struct Params {
uint256 maxTokensPerVault;
uint256 governanceDelay;
address protocolTreasury;
uint256 forceAllowMask;
uint256 withdrawLimit;
}
// ------------------- EXTERNAL, VIEW -------------------
/// @notice Timestamp after which staged granted permissions for the given address can be committed.
/// @param target The given address
/// @return Zero if there are no staged permission grants, timestamp otherwise
function stagedPermissionGrantsTimestamps(address target) external view returns (uint256);
/// @notice Staged granted permission bitmask for the given address.
/// @param target The given address
/// @return Bitmask
function stagedPermissionGrantsMasks(address target) external view returns (uint256);
/// @notice Permission bitmask for the given address.
/// @param target The given address
/// @return Bitmask
function permissionMasks(address target) external view returns (uint256);
/// @notice Timestamp after which staged pending protocol parameters can be committed
/// @return Zero if there are no staged parameters, timestamp otherwise.
function stagedParamsTimestamp() external view returns (uint256);
/// @notice Staged pending protocol parameters.
function stagedParams() external view returns (Params memory);
/// @notice Current protocol parameters.
function params() external view returns (Params memory);
/// @notice Addresses for which non-zero permissions are set.
function permissionAddresses() external view returns (address[] memory);
/// @notice Permission addresses staged for commit.
function stagedPermissionGrantsAddresses() external view returns (address[] memory);
/// @notice Return all addresses where rawPermissionMask bit for permissionId is set to 1.
/// @param permissionId Id of the permission to check.
/// @return A list of dirty addresses.
function addressesByPermission(uint8 permissionId) external view returns (address[] memory);
/// @notice Checks if address has permission or given permission is force allowed for any address.
/// @param addr Address to check
/// @param permissionId Permission to check
function hasPermission(address addr, uint8 permissionId) external view returns (bool);
/// @notice Checks if address has all permissions.
/// @param target Address to check
/// @param permissionIds A list of permissions to check
function hasAllPermissions(address target, uint8[] calldata permissionIds) external view returns (bool);
/// @notice Max different ERC20 token addresses that could be managed by the protocol.
function maxTokensPerVault() external view returns (uint256);
/// @notice The delay for committing any governance params.
function governanceDelay() external view returns (uint256);
/// @notice The address of the protocol treasury.
function protocolTreasury() external view returns (address);
/// @notice Permissions mask which defines if ordinary permission should be reverted.
/// This bitmask is xored with ordinary mask.
function forceAllowMask() external view returns (uint256);
/// @notice Withdraw limit per token per block.
/// @param token Address of the token
/// @return Withdraw limit per token per block
function withdrawLimit(address token) external view returns (uint256);
/// @notice Addresses that has staged validators.
function stagedValidatorsAddresses() external view returns (address[] memory);
/// @notice Timestamp after which staged granted permissions for the given address can be committed.
/// @param target The given address
/// @return Zero if there are no staged permission grants, timestamp otherwise
function stagedValidatorsTimestamps(address target) external view returns (uint256);
/// @notice Staged validator for the given address.
/// @param target The given address
/// @return Validator
function stagedValidators(address target) external view returns (address);
/// @notice Addresses that has validators.
function validatorsAddresses() external view returns (address[] memory);
/// @notice Address that has validators.
/// @param i The number of address
/// @return Validator address
function validatorsAddress(uint256 i) external view returns (address);
/// @notice Validator for the given address.
/// @param target The given address
/// @return Validator
function validators(address target) external view returns (address);
// ------------------- EXTERNAL, MUTATING, GOVERNANCE, IMMEDIATE -------------------
/// @notice Rollback all staged validators.
function rollbackStagedValidators() external;
/// @notice Revoke validator instantly from the given address.
/// @param target The given address
function revokeValidator(address target) external;
/// @notice Stages a new validator for the given address
/// @param target The given address
/// @param validator The validator for the given address
function stageValidator(address target, address validator) external;
/// @notice Commits validator for the given address.
/// @dev Reverts if governance delay has not passed yet.
/// @param target The given address.
function commitValidator(address target) external;
/// @notice Commites all staged validators for which governance delay passed
/// @return Addresses for which validators were committed
function commitAllValidatorsSurpassedDelay() external returns (address[] memory);
/// @notice Rollback all staged granted permission grant.
function rollbackStagedPermissionGrants() external;
/// @notice Commits permission grants for the given address.
/// @dev Reverts if governance delay has not passed yet.
/// @param target The given address.
function commitPermissionGrants(address target) external;
/// @notice Commites all staged permission grants for which governance delay passed.
/// @return An array of addresses for which permission grants were committed.
function commitAllPermissionGrantsSurpassedDelay() external returns (address[] memory);
/// @notice Revoke permission instantly from the given address.
/// @param target The given address.
/// @param permissionIds A list of permission ids to revoke.
function revokePermissions(address target, uint8[] memory permissionIds) external;
/// @notice Commits staged protocol params.
/// Reverts if governance delay has not passed yet.
function commitParams() external;
// ------------------- EXTERNAL, MUTATING, GOVERNANCE, DELAY -------------------
/// @notice Sets new pending params that could have been committed after governance delay expires.
/// @param newParams New protocol parameters to set.
function stageParams(Params memory newParams) external;
/// @notice Stage granted permissions that could have been committed after governance delay expires.
/// Resets commit delay and permissions if there are already staged permissions for this address.
/// @param target Target address
/// @param permissionIds A list of permission ids to grant
function stagePermissionGrants(address target, uint8[] memory permissionIds) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import "./utils/IDefaultAccessControl.sol";
interface IUnitPricesGovernance is IDefaultAccessControl, IERC165 {
// ------------------- EXTERNAL, VIEW -------------------
/// @notice Estimated amount of token worth 1 USD staged for commit.
/// @param token Address of the token
/// @return The amount of token
function stagedUnitPrices(address token) external view returns (uint256);
/// @notice Timestamp after which staged unit prices for the given token can be committed.
/// @param token Address of the token
/// @return Timestamp
function stagedUnitPricesTimestamps(address token) external view returns (uint256);
/// @notice Estimated amount of token worth 1 USD.
/// @param token Address of the token
/// @return The amount of token
function unitPrices(address token) external view returns (uint256);
// ------------------- EXTERNAL, MUTATING -------------------
/// @notice Stage estimated amount of token worth 1 USD staged for commit.
/// @param token Address of the token
/// @param value The amount of token
function stageUnitPrice(address token, uint256 value) external;
/// @notice Reset staged value
/// @param token Address of the token
function rollbackUnitPrice(address token) external;
/// @notice Commit staged unit price
/// @param token Address of the token
function commitUnitPrice(address token) external;
}// SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "./IProtocolGovernance.sol";
interface IVaultRegistry is IERC721 {
/// @notice Get Vault for the giver NFT ID.
/// @param nftId NFT ID
/// @return vault Address of the Vault contract
function vaultForNft(uint256 nftId) external view returns (address vault);
/// @notice Get NFT ID for given Vault contract address.
/// @param vault Address of the Vault contract
/// @return nftId NFT ID
function nftForVault(address vault) external view returns (uint256 nftId);
/// @notice Checks if the nft is locked for all transfers
/// @param nft NFT to check for lock
/// @return `true` if locked, false otherwise
function isLocked(uint256 nft) external view returns (bool);
/// @notice Register new Vault and mint NFT.
/// @param vault address of the vault
/// @param owner owner of the NFT
/// @return nft Nft minted for the given Vault
function registerVault(address vault, address owner) external returns (uint256 nft);
/// @notice Number of Vaults registered.
function vaultsCount() external view returns (uint256);
/// @notice All Vaults registered.
function vaults() external view returns (address[] memory);
/// @notice Address of the ProtocolGovernance.
function protocolGovernance() external view returns (IProtocolGovernance);
/// @notice Address of the staged ProtocolGovernance.
function stagedProtocolGovernance() external view returns (IProtocolGovernance);
/// @notice Minimal timestamp when staged ProtocolGovernance can be applied.
function stagedProtocolGovernanceTimestamp() external view returns (uint256);
/// @notice Stage new ProtocolGovernance.
/// @param newProtocolGovernance new ProtocolGovernance
function stageProtocolGovernance(IProtocolGovernance newProtocolGovernance) external;
/// @notice Commit new ProtocolGovernance.
function commitStagedProtocolGovernance() external;
/// @notice Lock NFT for transfers
/// @dev Use this method when vault structure is set up and should become immutable. Can be called by owner.
/// @param nft - NFT to lock
function lockNft(uint256 nft) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
// https://docs.synthetix.io/contracts/source/interfaces/istakingrewards
interface IFarmingPool {
// Views
function balanceOf(address account) external view returns (uint256);
function earned(address account) external view returns (uint256);
function getRewardForDuration() external view returns (uint256);
function lastTimeRewardApplicable() external view returns (uint256);
function rewardPerToken() external view returns (uint256);
function totalSupply() external view returns (uint256);
// Mutative
function getReward() external;
function stake(uint256 amount) external;
function withdraw(uint256 amount) external;
function setRewardsDuration(uint256 duration) external;
function notifyRewardAmount(uint256 amount) external;
function exit() external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
// https://docs.synthetix.io/contracts/source/contracts/owned
contract Owned {
address public owner;
address public nominatedOwner;
constructor(address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) external onlyOwner {
nominatedOwner = _owner;
emit OwnerNominated(_owner);
}
function acceptOwnership() external {
require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
emit OwnerChanged(owner, nominatedOwner);
owner = nominatedOwner;
nominatedOwner = address(0);
}
modifier onlyOwner {
_onlyOwner();
_;
}
function _onlyOwner() private view {
require(msg.sender == owner, "Only the contract owner may perform this action");
}
event OwnerNominated(address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
// Inheritance
import "./Owned.sol";
// https://docs.synthetix.io/contracts/source/contracts/pausable
abstract contract Pausable is Owned {
uint public lastPauseTime;
bool public paused;
constructor() internal {
// This contract is abstract, and thus cannot be instantiated directly
require(owner != address(0), "Owner must be set");
// Paused will be false, and lastPauseTime will be 0 upon initialisation
}
/**
* @notice Change the paused state of the contract
* @dev Only the contract owner may call this.
*/
function setPaused(bool _paused) external onlyOwner {
// Ensure we're actually changing the state before we do anything
if (_paused == paused) {
return;
}
// Set our paused state.
paused = _paused;
// If applicable, set the last pause time.
if (paused) {
lastPauseTime = block.timestamp;
}
// Let everyone know that our pause state has changed.
emit PauseChanged(paused);
}
event PauseChanged(bool isPaused);
modifier notPaused {
require(!paused, "This action cannot be performed while the contract is paused");
_;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
// Inheritance
import "./Owned.sol";
// https://docs.synthetix.io/contracts/source/contracts/rewardsdistributionrecipient
abstract contract RewardsDistributionRecipient is Owned {
address public rewardsDistribution;
modifier onlyRewardsDistribution() {
require(msg.sender == rewardsDistribution, "Caller is not RewardsDistribution contract");
_;
}
function setRewardsDistribution(address _rewardsDistribution) external onlyOwner {
rewardsDistribution = _rewardsDistribution;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
interface IOracle {
/// @notice Oracle price for tokens as a Q64.96 value.
/// @notice Returns pricing information based on the indexes of non-zero bits in safetyIndicesSet.
/// @notice It is possible that not all indices will have their respective prices returned.
/// @dev The price is token1 / token0 i.e. how many weis of token1 required for 1 wei of token0.
/// The safety indexes are:
///
/// 1 - unsafe, this is typically a spot price that can be easily manipulated,
///
/// 2 - 4 - more or less safe, this is typically a uniV3 oracle, where the safety is defined by the timespan of the average price
///
/// 5 - safe - this is typically a chailink oracle
/// @param token0 Reference to token0
/// @param token1 Reference to token1
/// @param safetyIndicesSet Bitmask of safety indices that are allowed for the return prices. For set of safety indexes = { 1 }, safetyIndicesSet = 0x2
/// @return pricesX96 Prices that satisfy safetyIndex and tokens
/// @return safetyIndices Safety indices for those prices
function priceX96(
address token0,
address token1,
uint256 safetyIndicesSet
) external view returns (uint256[] memory pricesX96, uint256[] memory safetyIndices);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/access/IAccessControlEnumerable.sol";
interface IDefaultAccessControl is IAccessControlEnumerable {
/// @notice Checks that the address is contract admin.
/// @param who Address to check
/// @return `true` if who is admin, `false` otherwise
function isAdmin(address who) external view returns (bool);
/// @notice Checks that the address is contract admin.
/// @param who Address to check
/// @return `true` if who is operator, `false` otherwise
function isOperator(address who) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "../oracles/IOracle.sol";
interface IERC20RootVaultHelper {
function getTvlToken0(
uint256[] calldata tvls,
address[] calldata tokens,
IOracle oracle
) external view returns (uint256 tvl0);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
interface ILpCallback {
/// @notice Function, that ERC20RootVault calling after deposit
function depositCallback() external;
/// @notice Function, that ERC20RootVault calling after deposit
function depositCallback(bytes memory) external;
/// @notice Function, that ERC20RootVault calling after withdraw
function withdrawCallback(bytes memory) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "./IVault.sol";
import "./IVaultRoot.sol";
interface IAggregateVault is IVault, IVaultRoot {}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./IAggregateVault.sol";
import "../utils/IERC20RootVaultHelper.sol";
interface IERC20RootVault is IAggregateVault, IERC20 {
/// @notice Initialized a new contract.
/// @dev Can only be initialized by vault governance
/// @param nft_ NFT of the vault in the VaultRegistry
/// @param vaultTokens_ ERC20 tokens that will be managed by this Vault
/// @param strategy_ The address that will have approvals for subvaultNfts
/// @param subvaultNfts_ The NFTs of the subvaults that will be aggregated by this ERC20RootVault
function initialize(
uint256 nft_,
address[] memory vaultTokens_,
address strategy_,
uint256[] memory subvaultNfts_,
IERC20RootVaultHelper helper_
) external;
/// @notice The timestamp of last charging of fees
function lastFeeCharge() external view returns (uint64);
/// @notice The timestamp of last updating totalWithdrawnAmounts array
function totalWithdrawnAmountsTimestamp() external view returns (uint64);
/// @notice Returns value from totalWithdrawnAmounts array by _index
/// @param _index The index at which the value will be returned
function totalWithdrawnAmounts(uint256 _index) external view returns (uint256);
/// @notice LP parameter that controls the charge in performance fees
function lpPriceHighWaterMarkD18() external view returns (uint256);
/// @notice List of addresses of depositors from which interaction with private vaults is allowed
function depositorsAllowlist() external view returns (address[] memory);
/// @notice Add new depositors in the depositorsAllowlist
/// @param depositors Array of new depositors
/// @dev The action can be done only by user with admins, owners or by approved rights
function addDepositorsToAllowlist(address[] calldata depositors) external;
/// @notice Remove depositors from the depositorsAllowlist
/// @param depositors Array of depositors for remove
/// @dev The action can be done only by user with admins, owners or by approved rights
function removeDepositorsFromAllowlist(address[] calldata depositors) external;
/// @notice The function of depositing the amount of tokens in exchange
/// @param tokenAmounts Array of amounts of tokens for deposit
/// @param minLpTokens Minimal value of LP tokens
/// @param vaultOptions Options of vaults
/// @return actualTokenAmounts Arrays of actual token amounts after deposit
function deposit(
uint256[] memory tokenAmounts,
uint256 minLpTokens,
bytes memory vaultOptions
) external returns (uint256[] memory actualTokenAmounts);
/// @notice The function of withdrawing the amount of tokens in exchange
/// @param to Address to which the withdrawal will be sent
/// @param lpTokenAmount LP token amount, that requested for withdraw
/// @param minTokenAmounts Array of minmal remining wtoken amounts after withdrawal
/// @param vaultsOptions Options of vaults
/// @return actualTokenAmounts Arrays of actual token amounts after withdrawal
function withdraw(
address to,
uint256 lpTokenAmount,
uint256[] memory minTokenAmounts,
bytes[] memory vaultsOptions
) external returns (uint256[] memory actualTokenAmounts);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "./IVaultGovernance.sol";
interface IVault is IERC165 {
/// @notice Checks if the vault is initialized
function initialized() external view returns (bool);
/// @notice VaultRegistry NFT for this vault
function nft() external view returns (uint256);
/// @notice Address of the Vault Governance for this contract.
function vaultGovernance() external view returns (IVaultGovernance);
/// @notice ERC20 tokens under Vault management.
function vaultTokens() external view returns (address[] memory);
/// @notice Checks if a token is vault token
/// @param token Address of the token to check
/// @return `true` if this token is managed by Vault
function isVaultToken(address token) external view returns (bool);
/// @notice Total value locked for this contract.
/// @dev Generally it is the underlying token value of this contract in some
/// other DeFi protocol. For example, for USDC Yearn Vault this would be total USDC balance that could be withdrawn for Yearn to this contract.
/// The tvl itself is estimated in some range. Sometimes the range is exact, sometimes it's not
/// @return minTokenAmounts Lower bound for total available balances estimation (nth tokenAmount corresponds to nth token in vaultTokens)
/// @return maxTokenAmounts Upper bound for total available balances estimation (nth tokenAmount corresponds to nth token in vaultTokens)
function tvl() external view returns (uint256[] memory minTokenAmounts, uint256[] memory maxTokenAmounts);
/// @notice Existential amounts for each token
function pullExistentials() external view returns (uint256[] memory);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "../IProtocolGovernance.sol";
import "../IVaultRegistry.sol";
import "./IVault.sol";
interface IVaultGovernance {
/// @notice Internal references of the contract.
/// @param protocolGovernance Reference to Protocol Governance
/// @param registry Reference to Vault Registry
struct InternalParams {
IProtocolGovernance protocolGovernance;
IVaultRegistry registry;
IVault singleton;
}
// ------------------- EXTERNAL, VIEW -------------------
/// @notice Timestamp in unix time seconds after which staged Delayed Strategy Params could be committed.
/// @param nft Nft of the vault
function delayedStrategyParamsTimestamp(uint256 nft) external view returns (uint256);
/// @notice Timestamp in unix time seconds after which staged Delayed Protocol Params could be committed.
function delayedProtocolParamsTimestamp() external view returns (uint256);
/// @notice Timestamp in unix time seconds after which staged Delayed Protocol Params Per Vault could be committed.
/// @param nft Nft of the vault
function delayedProtocolPerVaultParamsTimestamp(uint256 nft) external view returns (uint256);
/// @notice Timestamp in unix time seconds after which staged Internal Params could be committed.
function internalParamsTimestamp() external view returns (uint256);
/// @notice Internal Params of the contract.
function internalParams() external view returns (InternalParams memory);
/// @notice Staged new Internal Params.
/// @dev The Internal Params could be committed after internalParamsTimestamp
function stagedInternalParams() external view returns (InternalParams memory);
// ------------------- EXTERNAL, MUTATING -------------------
/// @notice Stage new Internal Params.
/// @param newParams New Internal Params
function stageInternalParams(InternalParams memory newParams) external;
/// @notice Commit staged Internal Params.
function commitInternalParams() external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
interface IVaultRoot {
/// @notice Checks if subvault is present
/// @param nft_ index of subvault for check
/// @return `true` if subvault present, `false` otherwise
function hasSubvault(uint256 nft_) external view returns (bool);
/// @notice Get subvault by index
/// @param index Index of subvault
/// @return address Address of the contract
function subvaultAt(uint256 index) external view returns (address);
/// @notice Get index of subvault by nft
/// @param nft_ Nft for getting subvault
/// @return index Index of subvault
function subvaultOneBasedIndex(uint256 nft_) external view returns (uint256);
/// @notice Get all subvalutNfts in the current Vault
/// @return subvaultNfts Subvaults of NTFs
function subvaultNfts() external view returns (uint256[] memory);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
/// @notice Exceptions stores project`s smart-contracts exceptions
library ExceptionsLibrary {
string constant ADDRESS_ZERO = "AZ";
string constant VALUE_ZERO = "VZ";
string constant EMPTY_LIST = "EMPL";
string constant NOT_FOUND = "NF";
string constant INIT = "INIT";
string constant DUPLICATE = "DUP";
string constant NULL = "NULL";
string constant TIMESTAMP = "TS";
string constant FORBIDDEN = "FRB";
string constant ALLOWLIST = "ALL";
string constant LIMIT_OVERFLOW = "LIMO";
string constant LIMIT_UNDERFLOW = "LIMU";
string constant INVALID_VALUE = "INV";
string constant INVARIANT = "INVA";
string constant INVALID_TARGET = "INVTR";
string constant INVALID_TOKEN = "INVTO";
string constant INVALID_INTERFACE = "INVI";
string constant INVALID_SELECTOR = "INVS";
string constant INVALID_STATE = "INVST";
string constant INVALID_LENGTH = "INVL";
string constant LOCK = "LCKD";
string constant DISABLED = "DIS";
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.9;
import "@openzeppelin/contracts/utils/Address.sol";
import "../libraries/ExceptionsLibrary.sol";
contract BatchCall {
function batchcall(address[] calldata targets, bytes[] calldata data) external returns (bytes[] memory results) {
require(targets.length == data.length, ExceptionsLibrary.INVALID_LENGTH);
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
results[i] = Address.functionDelegateCall(targets[i], data[i]);
}
return results;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.9;
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "../interfaces/utils/IDefaultAccessControl.sol";
import "../libraries/ExceptionsLibrary.sol";
/// @notice This is a default access control with 3 roles:
///
/// - ADMIN: allowed to do anything
/// - ADMIN_DELEGATE: allowed to do anything except assigning ADMIN and ADMIN_DELEGATE roles
/// - OPERATOR: low-privileged role, generally keeper or some other bot
contract DefaultAccessControl is IDefaultAccessControl, AccessControlEnumerable {
bytes32 public constant OPERATOR = keccak256("operator");
bytes32 public constant ADMIN_ROLE = keccak256("admin");
bytes32 public constant ADMIN_DELEGATE_ROLE = keccak256("admin_delegate");
/// @notice Creates a new contract.
/// @param admin Admin of the contract
constructor(address admin) {
require(admin != address(0), ExceptionsLibrary.ADDRESS_ZERO);
_setupRole(OPERATOR, admin);
_setupRole(ADMIN_ROLE, admin);
_setRoleAdmin(ADMIN_ROLE, ADMIN_ROLE);
_setRoleAdmin(ADMIN_DELEGATE_ROLE, ADMIN_ROLE);
_setRoleAdmin(OPERATOR, ADMIN_DELEGATE_ROLE);
}
// ------------------------- EXTERNAL, VIEW ------------------------------
/// @notice Checks if the address is ADMIN or ADMIN_DELEGATE.
/// @param sender Adddress to check
/// @return `true` if sender is an admin, `false` otherwise
function isAdmin(address sender) public view returns (bool) {
return hasRole(ADMIN_ROLE, sender) || hasRole(ADMIN_DELEGATE_ROLE, sender);
}
/// @notice Checks if the address is OPERATOR.
/// @param sender Adddress to check
/// @return `true` if sender is an admin, `false` otherwise
function isOperator(address sender) public view returns (bool) {
return hasRole(OPERATOR, sender);
}
// ------------------------- INTERNAL, VIEW ------------------------------
function _requireAdmin() internal view {
require(isAdmin(msg.sender), ExceptionsLibrary.FORBIDDEN);
}
function _requireAtLeastOperator() internal view {
require(isAdmin(msg.sender) || isOperator(msg.sender), ExceptionsLibrary.FORBIDDEN);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import '@openzeppelin/contracts/utils/math/SafeMath.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
// Inheritance
import "../interfaces/external/synthetix/IFarmingPool.sol";
import "../interfaces/external/synthetix/helpers/RewardsDistributionRecipient.sol";
import "../interfaces/external/synthetix/helpers/Pausable.sol";
// https://docs.synthetix.io/contracts/source/contracts/stakingrewards
contract FarmingPool is IFarmingPool, RewardsDistributionRecipient, ReentrancyGuard, Pausable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
/* ========== STATE VARIABLES ========== */
IERC20 public rewardsToken;
IERC20 public stakingToken;
uint256 public periodFinish = 0;
uint256 public rewardRate = 0;
uint256 public rewardsDuration = 7 days;
uint256 public lastUpdateTime;
uint256 public rewardPerTokenStored;
mapping(address => uint256) public userRewardPerTokenPaid;
mapping(address => uint256) public rewards;
uint256 private _totalSupply;
mapping(address => uint256) private _balances;
/* ========== CONSTRUCTOR ========== */
constructor(
address _owner,
address _rewardsDistribution,
address _rewardsToken,
address _stakingToken
) public Owned(_owner) {
rewardsToken = IERC20(_rewardsToken);
stakingToken = IERC20(_stakingToken);
rewardsDistribution = _rewardsDistribution;
}
/* ========== VIEWS ========== */
function totalSupply() external view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
function lastTimeRewardApplicable() public view returns (uint256) {
return block.timestamp < periodFinish ? block.timestamp : periodFinish;
}
function rewardPerToken() public view returns (uint256) {
if (_totalSupply == 0) {
return rewardPerTokenStored;
}
return
rewardPerTokenStored.add(
lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRate).mul(1e18).div(_totalSupply)
);
}
function earned(address account) public view returns (uint256) {
return _balances[account].mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e18).add(rewards[account]);
}
function getRewardForDuration() external view returns (uint256) {
return rewardRate.mul(rewardsDuration);
}
/* ========== MUTATIVE FUNCTIONS ========== */
function stake(uint256 amount) external nonReentrant notPaused updateReward(msg.sender) {
require(amount > 0, "Cannot stake 0");
_totalSupply = _totalSupply.add(amount);
_balances[msg.sender] = _balances[msg.sender].add(amount);
stakingToken.safeTransferFrom(msg.sender, address(this), amount);
emit Staked(msg.sender, amount);
}
function withdraw(uint256 amount) public nonReentrant updateReward(msg.sender) {
require(amount > 0, "Cannot withdraw 0");
_totalSupply = _totalSupply.sub(amount);
_balances[msg.sender] = _balances[msg.sender].sub(amount);
stakingToken.safeTransfer(msg.sender, amount);
emit Withdrawn(msg.sender, amount);
}
function getReward() public nonReentrant updateReward(msg.sender) {
uint256 reward = rewards[msg.sender];
if (reward > 0) {
rewards[msg.sender] = 0;
rewardsToken.safeTransfer(msg.sender, reward);
emit RewardPaid(msg.sender, reward);
}
}
function exit() external {
withdraw(_balances[msg.sender]);
getReward();
}
/* ========== RESTRICTED FUNCTIONS ========== */
function notifyRewardAmount(uint256 reward) external onlyRewardsDistribution updateReward(address(0)) {
if (block.timestamp >= periodFinish) {
rewardRate = reward.div(rewardsDuration);
} else {
uint256 remaining = periodFinish.sub(block.timestamp);
uint256 leftover = remaining.mul(rewardRate);
rewardRate = reward.add(leftover).div(rewardsDuration);
}
// Ensure the provided reward amount is not more than the balance in the contract.
// This keeps the reward rate in the right range, preventing overflows due to
// very high values of rewardRate in the earned and rewardsPerToken functions;
// Reward + leftover must be less than 2^256 / 10^18 to avoid overflow.
uint balance = rewardsToken.balanceOf(address(this));
require(rewardRate <= balance.div(rewardsDuration), "Provided reward too high");
lastUpdateTime = block.timestamp;
periodFinish = block.timestamp.add(rewardsDuration);
emit RewardAdded(reward);
}
// Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders
function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner {
require(tokenAddress != address(stakingToken), "Cannot withdraw the staking token");
IERC20(tokenAddress).safeTransfer(owner, tokenAmount);
emit Recovered(tokenAddress, tokenAmount);
}
function setRewardsDuration(uint256 _rewardsDuration) external onlyOwner {
require(
block.timestamp > periodFinish,
"Previous rewards period must be complete before changing the duration for the new period"
);
rewardsDuration = _rewardsDuration;
emit RewardsDurationUpdated(rewardsDuration);
}
/* ========== MODIFIERS ========== */
modifier updateReward(address account) {
rewardPerTokenStored = rewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
if (account != address(0)) {
rewards[account] = earned(account);
userRewardPerTokenPaid[account] = rewardPerTokenStored;
}
_;
}
/* ========== EVENTS ========== */
event RewardAdded(uint256 reward);
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
event RewardsDurationUpdated(uint256 newDuration);
event Recovered(address token, uint256 amount);
}{
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"rewardsDistribution","type":"address"},{"internalType":"address","name":"rewardsToken","type":"address"},{"internalType":"address","name":"stakingToken","type":"address"},{"internalType":"address","name":"admin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"actualTokenAmounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"lpTokenMinted","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"PauseChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newDuration","type":"uint256"}],"name":"RewardsDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"ADMIN_DELEGATE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"strategy","type":"address"},{"internalType":"bool","name":"needToCallCallback","type":"bool"},{"internalType":"contract IFarmingPool","name":"farm","type":"address"}],"name":"addNewStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20RootVault","name":"vault","type":"address"},{"internalType":"uint256[]","name":"tokenAmounts","type":"uint256[]"},{"internalType":"uint256","name":"minLpTokens","type":"uint256"},{"internalType":"bytes","name":"vaultOptions","type":"bytes"}],"name":"depositAndStake","outputs":[{"internalType":"uint256[]","name":"actualTokenAmounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"depositInfo","outputs":[{"internalType":"address","name":"strategy","type":"address"},{"internalType":"bool","name":"needToCallCallback","type":"bool"},{"internalType":"contract IFarmingPool","name":"farm","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getRewardForDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastPauseTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsDistribution","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsDistribution","type":"address"}],"name":"setRewardsDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardsDuration","type":"uint256"}],"name":"setRewardsDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60806040526000600755600060085562093a806009553480156200002257600080fd5b50604051620033653803806200336583398101604081905262000045916200047e565b8085858585836001600160a01b038116620000a75760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f7420626520300000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b03831690811782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a15060016003556000546001600160a01b0316620001525760405162461bcd60e51b815260206004820152601160248201527013dddb995c881b5d5cdd081899481cd95d607a1b60448201526064016200009e565b600580546001600160a01b0393841661010002610100600160a81b0319909116179055600680549183166001600160a01b03199283161790556002805493831693909116929092178255604080518082019091529182526120ad60f11b60208301529091508216620001d95760405162461bcd60e51b81526004016200009e9190620004ee565b50620001f56000805160206200334583398151915282620002ad565b620002106000805160206200332583398151915282620002ad565b6200022b6000805160206200332583398151915280620002bd565b620002667fc171260023d22a25a00a2789664c9334017843b831138c8ef03cc8897e5873d760008051602062003325833981519152620002bd565b620002a1600080516020620033458339815191527fc171260023d22a25a00a2789664c9334017843b831138c8ef03cc8897e5873d7620002bd565b50505050505062000546565b620002b9828262000308565b5050565b600082815260106020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6200031f82826200034b60201b62001a151760201c565b60008281526011602090815260409091206200034691839062001a9b620003ef821b17901c565b505050565b60008281526010602090815260408083206001600160a01b038516845290915290205460ff16620002b95760008281526010602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620003ab3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600062000406836001600160a01b0384166200040f565b90505b92915050565b6000818152600183016020526040812054620004585750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000409565b50600062000409565b80516001600160a01b03811681146200047957600080fd5b919050565b600080600080600060a086880312156200049757600080fd5b620004a28662000461565b9450620004b26020870162000461565b9350620004c26040870162000461565b9250620004d26060870162000461565b9150620004e26080870162000461565b90509295509295909350565b600060208083528351808285015260005b818110156200051d57858101830151858201604001528201620004ff565b8181111562000530576000604083870101525b50601f01601f1916929092016040019392505050565b612dcf80620005566000396000f3fe608060405234801561001057600080fd5b506004361061029f5760003560e01c80637589aaca11610167578063983d2737116100ce578063cd3daf9d11610087578063cd3daf9d1461066e578063d1af0c7d14610676578063d547741f1461068e578063df136d65146106a1578063e9fad8ee146106aa578063ebe2b12b146106b257600080fd5b8063983d2737146105fd578063a217fddf14610624578063a694fc3a1461062c578063c8f33c911461063f578063ca15c87314610648578063cc1a378f1461065b57600080fd5b80638980f11f116101205780638980f11f146105885780638b8763471461059b5780638da5cb5b146105bb5780639010d07c146105ce57806391b4ded9146105e157806391d14854146105ea57600080fd5b80637589aaca1461051557806375b238fc1461053557806377410f1e1461055c57806379ba50971461056f5780637b0a47ee1461057757806380faa57d1461058057600080fd5b80632f2ff15d1161020b57806353a47bb7116101c457806353a47bb71461043d5780635c975abb14610450578063634459891461045d5780636d70f7ae146104c657806370a08231146104d957806372f702f31461050257600080fd5b80632f2ff15d146103c857806336568abe146103db578063386a9525146103ee5780633c6b16ab146103f75780633d18b9121461040a5780633fc6df6e1461041257600080fd5b806318160ddd1161025d57806318160ddd1461035c57806319762143146103645780631c1f78eb14610377578063248a9ca31461037f57806324d7806c146103a25780632e1a7d4d146103b557600080fd5b80628cc262146102a457806301ffc9a7146102ca5780630700037d146102ed5780630952ff541461030d5780631627540c1461033457806316c38b3c14610349575b600080fd5b6102b76102b23660046125ea565b6106bb565b6040519081526020015b60405180910390f35b6102dd6102d8366004612607565b610739565b60405190151581526020016102c1565b6102b76102fb3660046125ea565b600d6020526000908152604090205481565b6102b77fc171260023d22a25a00a2789664c9334017843b831138c8ef03cc8897e5873d781565b6103476103423660046125ea565b61075e565b005b61034761035736600461263f565b6107bb565b600e546102b7565b6103476103723660046125ea565b610831565b6102b761085b565b6102b761038d36600461265c565b60009081526010602052604090206001015490565b6102dd6103b03660046125ea565b610879565b6103476103c336600461265c565b6108d5565b6103476103d6366004612675565b610a3a565b6103476103e9366004612675565b610a65565b6102b760095481565b61034761040536600461265c565b610ae3565b610347610d45565b600254610425906001600160a01b031681565b6040516001600160a01b0390911681526020016102c1565b600154610425906001600160a01b031681565b6005546102dd9060ff1681565b61049c61046b3660046125ea565b601260205260009081526040902080546001909101546001600160a01b0380831692600160a01b900460ff16911683565b604080516001600160a01b03948516815292151560208401529216918101919091526060016102c1565b6102dd6104d43660046125ea565b610e46565b6102b76104e73660046125ea565b6001600160a01b03166000908152600f602052604090205490565b600654610425906001600160a01b031681565b6105286105233660046126ee565b610e72565b6040516102c191906127e6565b6102b77ff23ec0bb4210edd5cba85afd05127efcd2fc6a781bfed49188da1081670b22d881565b61034761056a3660046127f9565b611429565b6103476114ae565b6102b760085481565b6102b7611598565b610347610596366004612855565b6115af565b6102b76105a93660046125ea565b600c6020526000908152604090205481565b600054610425906001600160a01b031681565b6104256105dc366004612881565b61167f565b6102b760045481565b6102dd6105f8366004612675565b61169e565b6102b77f46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f62281565b6102b7600081565b61034761063a36600461265c565b6116c9565b6102b7600a5481565b6102b761065636600461265c565b61188f565b61034761066936600461265c565b6118a6565b6102b7611980565b6005546104259061010090046001600160a01b031681565b61034761069c366004612675565b6119cc565b6102b7600b5481565b6103476119f2565b6102b760075481565b6001600160a01b0381166000908152600d6020908152604080832054600c909252822054610733919061072d90670de0b6b3a7640000906107279061070890610702611980565b90611ab0565b6001600160a01b0388166000908152600f602052604090205490611abc565b90611ac8565b90611ad4565b92915050565b60006001600160e01b03198216635a05180f60e01b1480610733575061073382611ae0565b610766611b15565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020015b60405180910390a150565b6107c3611b15565b60055460ff16151581151514156107d75750565b6005805460ff191682151590811790915560ff16156107f557426004555b60055460405160ff909116151581527f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec5906020016107b0565b50565b610839611b15565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000610874600954600854611abc90919063ffffffff16565b905090565b60006108a57ff23ec0bb4210edd5cba85afd05127efcd2fc6a781bfed49188da1081670b22d88361169e565b8061073357506107337fc171260023d22a25a00a2789664c9334017843b831138c8ef03cc8897e5873d78361169e565b600260035414156109015760405162461bcd60e51b81526004016108f8906128a3565b60405180910390fd5b60026003553361090f611980565b600b5561091a611598565b600a556001600160a01b0381161561096157610935816106bb565b6001600160a01b0382166000908152600d6020908152604080832093909355600b54600c909152919020555b600082116109a55760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b60448201526064016108f8565b600e546109b29083611ab0565b600e55336000908152600f60205260409020546109cf9083611ab0565b336000818152600f60205260409020919091556006546109fb916001600160a01b039091169084611b87565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a250506001600355565b600082815260106020526040902060010154610a568133611bea565b610a608383611c4e565b505050565b6001600160a01b0381163314610ad55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016108f8565b610adf8282611c70565b5050565b6002546001600160a01b03163314610b505760405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6044820152691b8818dbdb9d1c9858dd60b21b60648201526084016108f8565b6000610b5a611980565b600b55610b65611598565b600a556001600160a01b03811615610bac57610b80816106bb565b6001600160a01b0382166000908152600d6020908152604080832093909355600b54600c909152919020555b6007544210610bcb57600954610bc3908390611ac8565b600855610c0e565b600754600090610bdb9042611ab0565b90506000610bf460085483611abc90919063ffffffff16565b600954909150610c08906107278684611ad4565b60085550505b6005546040516370a0823160e01b815230600482015260009161010090046001600160a01b0316906370a082319060240160206040518083038186803b158015610c5757600080fd5b505afa158015610c6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8f91906128da565b9050610ca660095482611ac890919063ffffffff16565b6008541115610cf75760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f2068696768000000000000000060448201526064016108f8565b42600a819055600954610d0a9190611ad4565b6007556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b60026003541415610d685760405162461bcd60e51b81526004016108f8906128a3565b600260035533610d76611980565b600b55610d81611598565b600a556001600160a01b03811615610dc857610d9c816106bb565b6001600160a01b0382166000908152600d6020908152604080832093909355600b54600c909152919020555b336000908152600d60205260409020548015610e3d57336000818152600d6020526040812055600554610e0b916101009091046001600160a01b03169083611b87565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048690602001610a29565b50506001600355565b60006107337f46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f6228361169e565b6001600160a01b038681166000908152601260209081526040918290208251606080820185528254808716808452600160a01b90910460ff16151583860152600190930154909516818501528351808501909452600284526120ad60f11b92840192909252909190610ef75760405162461bcd60e51b81526004016108f8919061291f565b506000886001600160a01b031663697222336040518163ffffffff1660e01b815260040160006040518083038186803b158015610f3357600080fd5b505afa158015610f47573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f6f91908101906129bd565b80516040805180820190915260048152631253959360e21b60208201529192508814610fae5760405162461bcd60e51b81526004016108f8919061291f565b5060005b815181101561106b5761100c33308b8b85818110610fd257610fd2612a51565b90506020020135858581518110610feb57610feb612a51565b60200260200101516001600160a01b0316611c92909392919063ffffffff16565b61105b8a8a8a8481811061102257611022612a51565b9050602002013584848151811061103b5761103b612a51565b60200260200101516001600160a01b0316611cd09092919063ffffffff16565b61106481612a7d565b9050610fb2565b506040516370a0823160e01b81523060048201526000906001600160a01b038b16906370a082319060240160206040518083038186803b1580156110ae57600080fd5b505afa1580156110c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e691906128da565b604051631528fd1d60e21b81529091506001600160a01b038b16906354a3f4749061111d908c908c908c908c908c90600401612a98565b600060405180830381600087803b15801561113757600080fd5b505af115801561114b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111739190810190612b08565b6040516370a0823160e01b815230600482015290945060009082906001600160a01b038d16906370a082319060240160206040518083038186803b1580156111ba57600080fd5b505afa1580156111ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f291906128da565b6111fc9190612b8e565b90506112126001600160a01b038c163383611b87565b604080516020810183905260009163534a7e1d60e11b910160408051601f19818403018152908290526112489291602001612ba5565b6040516020818303038152906040529050611267856040015182611d91565b50508360200151156112cb5783600001516001600160a01b031663e521826f6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156112b257600080fd5b505af11580156112c6573d6000803e3d6000fd5b505050505b60005b83518110156113cb5761130f8c60008684815181106112ef576112ef612a51565b60200260200101516001600160a01b0316611db69092919063ffffffff16565b85818151811061132157611321612a51565b60200260200101518b8b8381811061133b5761133b612a51565b9050602002013511156113bb576113bb3387838151811061135e5761135e612a51565b60200260200101518d8d8581811061137857611378612a51565b905060200201356113899190612b8e565b86848151811061139b5761139b612a51565b60200260200101516001600160a01b0316611b879092919063ffffffff16565b6113c481612a7d565b90506112ce565b508a6001600160a01b0316336001600160a01b03167fcca721777a6ecfefca61eb6abe93dd4f6bc3798df0cf7aacedffc26fbd7521c085888560405161141393929190612bd6565b60405180910390a3505050509695505050505050565b611431611eda565b604080516060810182526001600160a01b03948516815292151560208085019182529285168483019081529585166000908152601290935291209151825491511515600160a01b026001600160a81b031990921690841617178155915160019092018054929091166001600160a01b031992909216919091179055565b6001546001600160a01b031633146115265760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b60648201526084016108f8565b600054600154604080516001600160a01b0393841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b600060075442106115aa575060075490565b504290565b6115b7611b15565b6006546001600160a01b038381169116141561161f5760405162461bcd60e51b815260206004820152602160248201527f43616e6e6f7420776974686472617720746865207374616b696e6720746f6b656044820152603760f91b60648201526084016108f8565b600054611639906001600160a01b03848116911683611b87565b604080516001600160a01b0384168152602081018390527f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28910160405180910390a15050565b60008281526011602052604081206116979083611f1d565b9392505050565b60009182526010602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600260035414156116ec5760405162461bcd60e51b81526004016108f8906128a3565b600260035560055460ff161561176a5760405162461bcd60e51b815260206004820152603c60248201527f5468697320616374696f6e2063616e6e6f7420626520706572666f726d65642060448201527f7768696c652074686520636f6e7472616374206973207061757365640000000060648201526084016108f8565b33611773611980565b600b5561177e611598565b600a556001600160a01b038116156117c557611799816106bb565b6001600160a01b0382166000908152600d6020908152604080832093909355600b54600c909152919020555b600082116118065760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b60448201526064016108f8565b600e546118139083611ad4565b600e55336000908152600f60205260409020546118309083611ad4565b336000818152600f602052604090209190915560065461185d916001600160a01b03909116903085611c92565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90602001610a29565b600081815260116020526040812061073390611f29565b6118ae611b15565b600754421161194b5760405162461bcd60e51b815260206004820152605860248201527f50726576696f7573207265776172647320706572696f64206d7573742062652060448201527f636f6d706c657465206265666f7265206368616e67696e67207468652064757260648201527f6174696f6e20666f7220746865206e657720706572696f640000000000000000608482015260a4016108f8565b60098190556040518181527ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d3906020016107b0565b6000600e54600014156119945750600b5490565b6108746119c3600e54610727670de0b6b3a76400006119bd6008546119bd600a54610702611598565b90611abc565b600b5490611ad4565b6000828152601060205260409020600101546119e88133611bea565b610a608383611c70565b336000908152600f6020526040902054611a0b906108d5565b611a13610d45565b565b611a1f828261169e565b610adf5760008281526010602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611a573390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611697836001600160a01b038416611f33565b60006116978284612b8e565b60006116978284612c3e565b60006116978284612c5d565b60006116978284612c7f565b60006001600160e01b03198216637965db0b60e01b148061073357506301ffc9a760e01b6001600160e01b0319831614610733565b6000546001600160a01b03163314611a135760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b60648201526084016108f8565b6040516001600160a01b038316602482015260448101829052610a6090849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611f82565b611bf4828261169e565b610adf57611c0c816001600160a01b03166014612054565b611c17836020612054565b604051602001611c28929190612c97565b60408051601f198184030181529082905262461bcd60e51b82526108f89160040161291f565b611c588282611a15565b6000828152601160205260409020610a609082611a9b565b611c7a82826121f0565b6000828152601160205260409020610a609082612257565b6040516001600160a01b0380851660248301528316604482015260648101829052611cca9085906323b872dd60e01b90608401611bb3565b50505050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b158015611d1c57600080fd5b505afa158015611d30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d5491906128da565b611d5e9190612c7f565b6040516001600160a01b038516602482015260448101829052909150611cca90859063095ea7b360e01b90606401611bb3565b60606116978383604051806060016040528060278152602001612d736027913961226c565b801580611e3f5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015611e0557600080fd5b505afa158015611e19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3d91906128da565b155b611eaa5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016108f8565b6040516001600160a01b038316602482015260448101829052610a6090849063095ea7b360e01b90606401611bb3565b611ee333610879565b6040518060400160405280600381526020016223292160e91b8152509061082e5760405162461bcd60e51b81526004016108f8919061291f565b60006116978383612340565b6000610733825490565b6000818152600183016020526040812054611f7a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610733565b506000610733565b6000611fd7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661236a9092919063ffffffff16565b805190915015610a605780806020019051810190611ff59190612d0c565b610a605760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108f8565b60606000612063836002612c3e565b61206e906002612c7f565b67ffffffffffffffff81111561208657612086612952565b6040519080825280601f01601f1916602001820160405280156120b0576020820181803683370190505b509050600360fc1b816000815181106120cb576120cb612a51565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106120fa576120fa612a51565b60200101906001600160f81b031916908160001a905350600061211e846002612c3e565b612129906001612c7f565b90505b60018111156121a1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061215d5761215d612a51565b1a60f81b82828151811061217357612173612a51565b60200101906001600160f81b031916908160001a90535060049490941c9361219a81612d29565b905061212c565b5083156116975760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108f8565b6121fa828261169e565b15610adf5760008281526010602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611697836001600160a01b038416612381565b6060833b6122cb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016108f8565b600080856001600160a01b0316856040516122e69190612d40565b600060405180830381855af49150503d8060008114612321576040519150601f19603f3d011682016040523d82523d6000602084013e612326565b606091505b5091509150612336828286612474565b9695505050505050565b600082600001828154811061235757612357612a51565b9060005260206000200154905092915050565b606061237984846000856124ad565b949350505050565b6000818152600183016020526040812054801561246a5760006123a5600183612b8e565b85549091506000906123b990600190612b8e565b905081811461241e5760008660000182815481106123d9576123d9612a51565b90600052602060002001549050808760000184815481106123fc576123fc612a51565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061242f5761242f612d5c565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610733565b6000915050610733565b60608315612483575081611697565b8251156124935782518084602001fd5b8160405162461bcd60e51b81526004016108f8919061291f565b60608247101561250e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108f8565b843b61255c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108f8565b600080866001600160a01b031685876040516125789190612d40565b60006040518083038185875af1925050503d80600081146125b5576040519150601f19603f3d011682016040523d82523d6000602084013e6125ba565b606091505b50915091506125ca828286612474565b979650505050505050565b6001600160a01b038116811461082e57600080fd5b6000602082840312156125fc57600080fd5b8135611697816125d5565b60006020828403121561261957600080fd5b81356001600160e01b03198116811461169757600080fd5b801515811461082e57600080fd5b60006020828403121561265157600080fd5b813561169781612631565b60006020828403121561266e57600080fd5b5035919050565b6000806040838503121561268857600080fd5b82359150602083013561269a816125d5565b809150509250929050565b60008083601f8401126126b757600080fd5b50813567ffffffffffffffff8111156126cf57600080fd5b6020830191508360208285010111156126e757600080fd5b9250929050565b6000806000806000806080878903121561270757600080fd5b8635612712816125d5565b9550602087013567ffffffffffffffff8082111561272f57600080fd5b818901915089601f83011261274357600080fd5b81358181111561275257600080fd5b8a60208260051b850101111561276757600080fd5b6020830197508096505060408901359450606089013591508082111561278c57600080fd5b5061279989828a016126a5565b979a9699509497509295939492505050565b600081518084526020808501945080840160005b838110156127db578151875295820195908201906001016127bf565b509495945050505050565b60208152600061169760208301846127ab565b6000806000806080858703121561280f57600080fd5b843561281a816125d5565b9350602085013561282a816125d5565b9250604085013561283a81612631565b9150606085013561284a816125d5565b939692955090935050565b6000806040838503121561286857600080fd5b8235612873816125d5565b946020939093013593505050565b6000806040838503121561289457600080fd5b50508035926020909101359150565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000602082840312156128ec57600080fd5b5051919050565b60005b8381101561290e5781810151838201526020016128f6565b83811115611cca5750506000910152565b602081526000825180602084015261293e8160408501602087016128f3565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561299157612991612952565b604052919050565b600067ffffffffffffffff8211156129b3576129b3612952565b5060051b60200190565b600060208083850312156129d057600080fd5b825167ffffffffffffffff8111156129e757600080fd5b8301601f810185136129f857600080fd5b8051612a0b612a0682612999565b612968565b81815260059190911b82018301908381019087831115612a2a57600080fd5b928401925b828410156125ca578351612a42816125d5565b82529284019290840190612a2f565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415612a9157612a91612a67565b5060010190565b6060808252810185905260006001600160fb1b03861115612ab857600080fd5b8560051b80886080850137602083018690528201828103608090810160408501528101849052838560a0830137600060a0858301015260a0601f19601f8601168201019150509695505050505050565b60006020808385031215612b1b57600080fd5b825167ffffffffffffffff811115612b3257600080fd5b8301601f81018513612b4357600080fd5b8051612b51612a0682612999565b81815260059190911b82018301908381019087831115612b7057600080fd5b928401925b828410156125ca57835182529284019290840190612b75565b600082821015612ba057612ba0612a67565b500390565b6001600160e01b0319831681528151600090612bc88160048501602087016128f3565b919091016004019392505050565b606080825284519082018190526000906020906080840190828801845b82811015612c185781516001600160a01b031684529284019290840190600101612bf3565b50505083810382850152612c2c81876127ab565b92505050826040830152949350505050565b6000816000190483118215151615612c5857612c58612a67565b500290565b600082612c7a57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115612c9257612c92612a67565b500190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612ccf8160178501602088016128f3565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612d008160288401602088016128f3565b01602801949350505050565b600060208284031215612d1e57600080fd5b815161169781612631565b600081612d3857612d38612a67565b506000190190565b60008251612d528184602087016128f3565b9190910192915050565b634e487b7160e01b600052603160045260246000fdfe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212200518772f77a0830560682460c04c6f6badb491799102d46ead02bc888e20e70864736f6c63430008090033f23ec0bb4210edd5cba85afd05127efcd2fc6a781bfed49188da1081670b22d846a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f622000000000000000000000000a4cdf852e5cd999e8a03ba8b58360eda4afc3027000000000000000000000000a4cdf852e5cd999e8a03ba8b58360eda4afc30270000000000000000000000005a98fcbea516cf06857215779fd812ca3bef1b320000000000000000000000006a2dd3b817f0364e7603e781dda9c62f62c440e1000000000000000000000000a4cdf852e5cd999e8a03ba8b58360eda4afc3027
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061029f5760003560e01c80637589aaca11610167578063983d2737116100ce578063cd3daf9d11610087578063cd3daf9d1461066e578063d1af0c7d14610676578063d547741f1461068e578063df136d65146106a1578063e9fad8ee146106aa578063ebe2b12b146106b257600080fd5b8063983d2737146105fd578063a217fddf14610624578063a694fc3a1461062c578063c8f33c911461063f578063ca15c87314610648578063cc1a378f1461065b57600080fd5b80638980f11f116101205780638980f11f146105885780638b8763471461059b5780638da5cb5b146105bb5780639010d07c146105ce57806391b4ded9146105e157806391d14854146105ea57600080fd5b80637589aaca1461051557806375b238fc1461053557806377410f1e1461055c57806379ba50971461056f5780637b0a47ee1461057757806380faa57d1461058057600080fd5b80632f2ff15d1161020b57806353a47bb7116101c457806353a47bb71461043d5780635c975abb14610450578063634459891461045d5780636d70f7ae146104c657806370a08231146104d957806372f702f31461050257600080fd5b80632f2ff15d146103c857806336568abe146103db578063386a9525146103ee5780633c6b16ab146103f75780633d18b9121461040a5780633fc6df6e1461041257600080fd5b806318160ddd1161025d57806318160ddd1461035c57806319762143146103645780631c1f78eb14610377578063248a9ca31461037f57806324d7806c146103a25780632e1a7d4d146103b557600080fd5b80628cc262146102a457806301ffc9a7146102ca5780630700037d146102ed5780630952ff541461030d5780631627540c1461033457806316c38b3c14610349575b600080fd5b6102b76102b23660046125ea565b6106bb565b6040519081526020015b60405180910390f35b6102dd6102d8366004612607565b610739565b60405190151581526020016102c1565b6102b76102fb3660046125ea565b600d6020526000908152604090205481565b6102b77fc171260023d22a25a00a2789664c9334017843b831138c8ef03cc8897e5873d781565b6103476103423660046125ea565b61075e565b005b61034761035736600461263f565b6107bb565b600e546102b7565b6103476103723660046125ea565b610831565b6102b761085b565b6102b761038d36600461265c565b60009081526010602052604090206001015490565b6102dd6103b03660046125ea565b610879565b6103476103c336600461265c565b6108d5565b6103476103d6366004612675565b610a3a565b6103476103e9366004612675565b610a65565b6102b760095481565b61034761040536600461265c565b610ae3565b610347610d45565b600254610425906001600160a01b031681565b6040516001600160a01b0390911681526020016102c1565b600154610425906001600160a01b031681565b6005546102dd9060ff1681565b61049c61046b3660046125ea565b601260205260009081526040902080546001909101546001600160a01b0380831692600160a01b900460ff16911683565b604080516001600160a01b03948516815292151560208401529216918101919091526060016102c1565b6102dd6104d43660046125ea565b610e46565b6102b76104e73660046125ea565b6001600160a01b03166000908152600f602052604090205490565b600654610425906001600160a01b031681565b6105286105233660046126ee565b610e72565b6040516102c191906127e6565b6102b77ff23ec0bb4210edd5cba85afd05127efcd2fc6a781bfed49188da1081670b22d881565b61034761056a3660046127f9565b611429565b6103476114ae565b6102b760085481565b6102b7611598565b610347610596366004612855565b6115af565b6102b76105a93660046125ea565b600c6020526000908152604090205481565b600054610425906001600160a01b031681565b6104256105dc366004612881565b61167f565b6102b760045481565b6102dd6105f8366004612675565b61169e565b6102b77f46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f62281565b6102b7600081565b61034761063a36600461265c565b6116c9565b6102b7600a5481565b6102b761065636600461265c565b61188f565b61034761066936600461265c565b6118a6565b6102b7611980565b6005546104259061010090046001600160a01b031681565b61034761069c366004612675565b6119cc565b6102b7600b5481565b6103476119f2565b6102b760075481565b6001600160a01b0381166000908152600d6020908152604080832054600c909252822054610733919061072d90670de0b6b3a7640000906107279061070890610702611980565b90611ab0565b6001600160a01b0388166000908152600f602052604090205490611abc565b90611ac8565b90611ad4565b92915050565b60006001600160e01b03198216635a05180f60e01b1480610733575061073382611ae0565b610766611b15565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020015b60405180910390a150565b6107c3611b15565b60055460ff16151581151514156107d75750565b6005805460ff191682151590811790915560ff16156107f557426004555b60055460405160ff909116151581527f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec5906020016107b0565b50565b610839611b15565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000610874600954600854611abc90919063ffffffff16565b905090565b60006108a57ff23ec0bb4210edd5cba85afd05127efcd2fc6a781bfed49188da1081670b22d88361169e565b8061073357506107337fc171260023d22a25a00a2789664c9334017843b831138c8ef03cc8897e5873d78361169e565b600260035414156109015760405162461bcd60e51b81526004016108f8906128a3565b60405180910390fd5b60026003553361090f611980565b600b5561091a611598565b600a556001600160a01b0381161561096157610935816106bb565b6001600160a01b0382166000908152600d6020908152604080832093909355600b54600c909152919020555b600082116109a55760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b60448201526064016108f8565b600e546109b29083611ab0565b600e55336000908152600f60205260409020546109cf9083611ab0565b336000818152600f60205260409020919091556006546109fb916001600160a01b039091169084611b87565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a250506001600355565b600082815260106020526040902060010154610a568133611bea565b610a608383611c4e565b505050565b6001600160a01b0381163314610ad55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016108f8565b610adf8282611c70565b5050565b6002546001600160a01b03163314610b505760405162461bcd60e51b815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f6044820152691b8818dbdb9d1c9858dd60b21b60648201526084016108f8565b6000610b5a611980565b600b55610b65611598565b600a556001600160a01b03811615610bac57610b80816106bb565b6001600160a01b0382166000908152600d6020908152604080832093909355600b54600c909152919020555b6007544210610bcb57600954610bc3908390611ac8565b600855610c0e565b600754600090610bdb9042611ab0565b90506000610bf460085483611abc90919063ffffffff16565b600954909150610c08906107278684611ad4565b60085550505b6005546040516370a0823160e01b815230600482015260009161010090046001600160a01b0316906370a082319060240160206040518083038186803b158015610c5757600080fd5b505afa158015610c6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8f91906128da565b9050610ca660095482611ac890919063ffffffff16565b6008541115610cf75760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f2068696768000000000000000060448201526064016108f8565b42600a819055600954610d0a9190611ad4565b6007556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b60026003541415610d685760405162461bcd60e51b81526004016108f8906128a3565b600260035533610d76611980565b600b55610d81611598565b600a556001600160a01b03811615610dc857610d9c816106bb565b6001600160a01b0382166000908152600d6020908152604080832093909355600b54600c909152919020555b336000908152600d60205260409020548015610e3d57336000818152600d6020526040812055600554610e0b916101009091046001600160a01b03169083611b87565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048690602001610a29565b50506001600355565b60006107337f46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f6228361169e565b6001600160a01b038681166000908152601260209081526040918290208251606080820185528254808716808452600160a01b90910460ff16151583860152600190930154909516818501528351808501909452600284526120ad60f11b92840192909252909190610ef75760405162461bcd60e51b81526004016108f8919061291f565b506000886001600160a01b031663697222336040518163ffffffff1660e01b815260040160006040518083038186803b158015610f3357600080fd5b505afa158015610f47573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f6f91908101906129bd565b80516040805180820190915260048152631253959360e21b60208201529192508814610fae5760405162461bcd60e51b81526004016108f8919061291f565b5060005b815181101561106b5761100c33308b8b85818110610fd257610fd2612a51565b90506020020135858581518110610feb57610feb612a51565b60200260200101516001600160a01b0316611c92909392919063ffffffff16565b61105b8a8a8a8481811061102257611022612a51565b9050602002013584848151811061103b5761103b612a51565b60200260200101516001600160a01b0316611cd09092919063ffffffff16565b61106481612a7d565b9050610fb2565b506040516370a0823160e01b81523060048201526000906001600160a01b038b16906370a082319060240160206040518083038186803b1580156110ae57600080fd5b505afa1580156110c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e691906128da565b604051631528fd1d60e21b81529091506001600160a01b038b16906354a3f4749061111d908c908c908c908c908c90600401612a98565b600060405180830381600087803b15801561113757600080fd5b505af115801561114b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111739190810190612b08565b6040516370a0823160e01b815230600482015290945060009082906001600160a01b038d16906370a082319060240160206040518083038186803b1580156111ba57600080fd5b505afa1580156111ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f291906128da565b6111fc9190612b8e565b90506112126001600160a01b038c163383611b87565b604080516020810183905260009163534a7e1d60e11b910160408051601f19818403018152908290526112489291602001612ba5565b6040516020818303038152906040529050611267856040015182611d91565b50508360200151156112cb5783600001516001600160a01b031663e521826f6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156112b257600080fd5b505af11580156112c6573d6000803e3d6000fd5b505050505b60005b83518110156113cb5761130f8c60008684815181106112ef576112ef612a51565b60200260200101516001600160a01b0316611db69092919063ffffffff16565b85818151811061132157611321612a51565b60200260200101518b8b8381811061133b5761133b612a51565b9050602002013511156113bb576113bb3387838151811061135e5761135e612a51565b60200260200101518d8d8581811061137857611378612a51565b905060200201356113899190612b8e565b86848151811061139b5761139b612a51565b60200260200101516001600160a01b0316611b879092919063ffffffff16565b6113c481612a7d565b90506112ce565b508a6001600160a01b0316336001600160a01b03167fcca721777a6ecfefca61eb6abe93dd4f6bc3798df0cf7aacedffc26fbd7521c085888560405161141393929190612bd6565b60405180910390a3505050509695505050505050565b611431611eda565b604080516060810182526001600160a01b03948516815292151560208085019182529285168483019081529585166000908152601290935291209151825491511515600160a01b026001600160a81b031990921690841617178155915160019092018054929091166001600160a01b031992909216919091179055565b6001546001600160a01b031633146115265760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b60648201526084016108f8565b600054600154604080516001600160a01b0393841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b600060075442106115aa575060075490565b504290565b6115b7611b15565b6006546001600160a01b038381169116141561161f5760405162461bcd60e51b815260206004820152602160248201527f43616e6e6f7420776974686472617720746865207374616b696e6720746f6b656044820152603760f91b60648201526084016108f8565b600054611639906001600160a01b03848116911683611b87565b604080516001600160a01b0384168152602081018390527f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28910160405180910390a15050565b60008281526011602052604081206116979083611f1d565b9392505050565b60009182526010602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600260035414156116ec5760405162461bcd60e51b81526004016108f8906128a3565b600260035560055460ff161561176a5760405162461bcd60e51b815260206004820152603c60248201527f5468697320616374696f6e2063616e6e6f7420626520706572666f726d65642060448201527f7768696c652074686520636f6e7472616374206973207061757365640000000060648201526084016108f8565b33611773611980565b600b5561177e611598565b600a556001600160a01b038116156117c557611799816106bb565b6001600160a01b0382166000908152600d6020908152604080832093909355600b54600c909152919020555b600082116118065760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b60448201526064016108f8565b600e546118139083611ad4565b600e55336000908152600f60205260409020546118309083611ad4565b336000818152600f602052604090209190915560065461185d916001600160a01b03909116903085611c92565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90602001610a29565b600081815260116020526040812061073390611f29565b6118ae611b15565b600754421161194b5760405162461bcd60e51b815260206004820152605860248201527f50726576696f7573207265776172647320706572696f64206d7573742062652060448201527f636f6d706c657465206265666f7265206368616e67696e67207468652064757260648201527f6174696f6e20666f7220746865206e657720706572696f640000000000000000608482015260a4016108f8565b60098190556040518181527ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d3906020016107b0565b6000600e54600014156119945750600b5490565b6108746119c3600e54610727670de0b6b3a76400006119bd6008546119bd600a54610702611598565b90611abc565b600b5490611ad4565b6000828152601060205260409020600101546119e88133611bea565b610a608383611c70565b336000908152600f6020526040902054611a0b906108d5565b611a13610d45565b565b611a1f828261169e565b610adf5760008281526010602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611a573390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611697836001600160a01b038416611f33565b60006116978284612b8e565b60006116978284612c3e565b60006116978284612c5d565b60006116978284612c7f565b60006001600160e01b03198216637965db0b60e01b148061073357506301ffc9a760e01b6001600160e01b0319831614610733565b6000546001600160a01b03163314611a135760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b60648201526084016108f8565b6040516001600160a01b038316602482015260448101829052610a6090849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611f82565b611bf4828261169e565b610adf57611c0c816001600160a01b03166014612054565b611c17836020612054565b604051602001611c28929190612c97565b60408051601f198184030181529082905262461bcd60e51b82526108f89160040161291f565b611c588282611a15565b6000828152601160205260409020610a609082611a9b565b611c7a82826121f0565b6000828152601160205260409020610a609082612257565b6040516001600160a01b0380851660248301528316604482015260648101829052611cca9085906323b872dd60e01b90608401611bb3565b50505050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b158015611d1c57600080fd5b505afa158015611d30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d5491906128da565b611d5e9190612c7f565b6040516001600160a01b038516602482015260448101829052909150611cca90859063095ea7b360e01b90606401611bb3565b60606116978383604051806060016040528060278152602001612d736027913961226c565b801580611e3f5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015611e0557600080fd5b505afa158015611e19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3d91906128da565b155b611eaa5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016108f8565b6040516001600160a01b038316602482015260448101829052610a6090849063095ea7b360e01b90606401611bb3565b611ee333610879565b6040518060400160405280600381526020016223292160e91b8152509061082e5760405162461bcd60e51b81526004016108f8919061291f565b60006116978383612340565b6000610733825490565b6000818152600183016020526040812054611f7a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610733565b506000610733565b6000611fd7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661236a9092919063ffffffff16565b805190915015610a605780806020019051810190611ff59190612d0c565b610a605760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108f8565b60606000612063836002612c3e565b61206e906002612c7f565b67ffffffffffffffff81111561208657612086612952565b6040519080825280601f01601f1916602001820160405280156120b0576020820181803683370190505b509050600360fc1b816000815181106120cb576120cb612a51565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106120fa576120fa612a51565b60200101906001600160f81b031916908160001a905350600061211e846002612c3e565b612129906001612c7f565b90505b60018111156121a1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061215d5761215d612a51565b1a60f81b82828151811061217357612173612a51565b60200101906001600160f81b031916908160001a90535060049490941c9361219a81612d29565b905061212c565b5083156116975760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108f8565b6121fa828261169e565b15610adf5760008281526010602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611697836001600160a01b038416612381565b6060833b6122cb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016108f8565b600080856001600160a01b0316856040516122e69190612d40565b600060405180830381855af49150503d8060008114612321576040519150601f19603f3d011682016040523d82523d6000602084013e612326565b606091505b5091509150612336828286612474565b9695505050505050565b600082600001828154811061235757612357612a51565b9060005260206000200154905092915050565b606061237984846000856124ad565b949350505050565b6000818152600183016020526040812054801561246a5760006123a5600183612b8e565b85549091506000906123b990600190612b8e565b905081811461241e5760008660000182815481106123d9576123d9612a51565b90600052602060002001549050808760000184815481106123fc576123fc612a51565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061242f5761242f612d5c565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610733565b6000915050610733565b60608315612483575081611697565b8251156124935782518084602001fd5b8160405162461bcd60e51b81526004016108f8919061291f565b60608247101561250e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108f8565b843b61255c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108f8565b600080866001600160a01b031685876040516125789190612d40565b60006040518083038185875af1925050503d80600081146125b5576040519150601f19603f3d011682016040523d82523d6000602084013e6125ba565b606091505b50915091506125ca828286612474565b979650505050505050565b6001600160a01b038116811461082e57600080fd5b6000602082840312156125fc57600080fd5b8135611697816125d5565b60006020828403121561261957600080fd5b81356001600160e01b03198116811461169757600080fd5b801515811461082e57600080fd5b60006020828403121561265157600080fd5b813561169781612631565b60006020828403121561266e57600080fd5b5035919050565b6000806040838503121561268857600080fd5b82359150602083013561269a816125d5565b809150509250929050565b60008083601f8401126126b757600080fd5b50813567ffffffffffffffff8111156126cf57600080fd5b6020830191508360208285010111156126e757600080fd5b9250929050565b6000806000806000806080878903121561270757600080fd5b8635612712816125d5565b9550602087013567ffffffffffffffff8082111561272f57600080fd5b818901915089601f83011261274357600080fd5b81358181111561275257600080fd5b8a60208260051b850101111561276757600080fd5b6020830197508096505060408901359450606089013591508082111561278c57600080fd5b5061279989828a016126a5565b979a9699509497509295939492505050565b600081518084526020808501945080840160005b838110156127db578151875295820195908201906001016127bf565b509495945050505050565b60208152600061169760208301846127ab565b6000806000806080858703121561280f57600080fd5b843561281a816125d5565b9350602085013561282a816125d5565b9250604085013561283a81612631565b9150606085013561284a816125d5565b939692955090935050565b6000806040838503121561286857600080fd5b8235612873816125d5565b946020939093013593505050565b6000806040838503121561289457600080fd5b50508035926020909101359150565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000602082840312156128ec57600080fd5b5051919050565b60005b8381101561290e5781810151838201526020016128f6565b83811115611cca5750506000910152565b602081526000825180602084015261293e8160408501602087016128f3565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561299157612991612952565b604052919050565b600067ffffffffffffffff8211156129b3576129b3612952565b5060051b60200190565b600060208083850312156129d057600080fd5b825167ffffffffffffffff8111156129e757600080fd5b8301601f810185136129f857600080fd5b8051612a0b612a0682612999565b612968565b81815260059190911b82018301908381019087831115612a2a57600080fd5b928401925b828410156125ca578351612a42816125d5565b82529284019290840190612a2f565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415612a9157612a91612a67565b5060010190565b6060808252810185905260006001600160fb1b03861115612ab857600080fd5b8560051b80886080850137602083018690528201828103608090810160408501528101849052838560a0830137600060a0858301015260a0601f19601f8601168201019150509695505050505050565b60006020808385031215612b1b57600080fd5b825167ffffffffffffffff811115612b3257600080fd5b8301601f81018513612b4357600080fd5b8051612b51612a0682612999565b81815260059190911b82018301908381019087831115612b7057600080fd5b928401925b828410156125ca57835182529284019290840190612b75565b600082821015612ba057612ba0612a67565b500390565b6001600160e01b0319831681528151600090612bc88160048501602087016128f3565b919091016004019392505050565b606080825284519082018190526000906020906080840190828801845b82811015612c185781516001600160a01b031684529284019290840190600101612bf3565b50505083810382850152612c2c81876127ab565b92505050826040830152949350505050565b6000816000190483118215151615612c5857612c58612a67565b500290565b600082612c7a57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115612c9257612c92612a67565b500190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612ccf8160178501602088016128f3565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612d008160288401602088016128f3565b01602801949350505050565b600060208284031215612d1e57600080fd5b815161169781612631565b600081612d3857612d38612a67565b506000190190565b60008251612d528184602087016128f3565b9190910192915050565b634e487b7160e01b600052603160045260246000fdfe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212200518772f77a0830560682460c04c6f6badb491799102d46ead02bc888e20e70864736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a4cdf852e5cd999e8a03ba8b58360eda4afc3027000000000000000000000000a4cdf852e5cd999e8a03ba8b58360eda4afc30270000000000000000000000005a98fcbea516cf06857215779fd812ca3bef1b320000000000000000000000006a2dd3b817f0364e7603e781dda9c62f62c440e1000000000000000000000000a4cdf852e5cd999e8a03ba8b58360eda4afc3027
-----Decoded View---------------
Arg [0] : owner (address): 0xA4cDf852e5CD999e8A03BA8B58360eDA4aFc3027
Arg [1] : rewardsDistribution (address): 0xA4cDf852e5CD999e8A03BA8B58360eDA4aFc3027
Arg [2] : rewardsToken (address): 0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32
Arg [3] : stakingToken (address): 0x6A2Dd3B817F0364e7603e781dDA9c62f62c440E1
Arg [4] : admin (address): 0xA4cDf852e5CD999e8A03BA8B58360eDA4aFc3027
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000a4cdf852e5cd999e8a03ba8b58360eda4afc3027
Arg [1] : 000000000000000000000000a4cdf852e5cd999e8a03ba8b58360eda4afc3027
Arg [2] : 0000000000000000000000005a98fcbea516cf06857215779fd812ca3bef1b32
Arg [3] : 0000000000000000000000006a2dd3b817f0364e7603e781dda9c62f62c440e1
Arg [4] : 000000000000000000000000a4cdf852e5cd999e8a03ba8b58360eda4afc3027
Loading...
Loading
Loading...
Loading
Net Worth in USD
$6.36
Net Worth in ETH
0.00322
Token Allocations
LDO
100.00%
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ETH | 100.00% | $0.337984 | 18.8265 | $6.36 |
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.