Source Code
Latest 25 from a total of 14,115 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Claim | 192691103 | 681 days ago | IN | 0 ETH | 0.00000343 | ||||
| Claim | 192407331 | 682 days ago | IN | 0 ETH | 0.00000526 | ||||
| Claim | 192407077 | 682 days ago | IN | 0 ETH | 0.00000612 | ||||
| Claim | 192406285 | 682 days ago | IN | 0 ETH | 0.00000985 | ||||
| Claim | 188952504 | 692 days ago | IN | 0 ETH | 0.0001448 | ||||
| Claim | 188951111 | 693 days ago | IN | 0 ETH | 0.0001677 | ||||
| Claim | 188446711 | 694 days ago | IN | 0 ETH | 0.00017657 | ||||
| Claim | 187423853 | 697 days ago | IN | 0 ETH | 0.00027121 | ||||
| Claim | 185879872 | 702 days ago | IN | 0 ETH | 0.00013844 | ||||
| Claim | 185601845 | 703 days ago | IN | 0 ETH | 0.00014093 | ||||
| Claim | 185437834 | 703 days ago | IN | 0 ETH | 0.00026326 | ||||
| Claim | 185437200 | 703 days ago | IN | 0 ETH | 0.00026261 | ||||
| Claim | 185341374 | 703 days ago | IN | 0 ETH | 0.00020868 | ||||
| Claim | 185341319 | 703 days ago | IN | 0 ETH | 0.000203 | ||||
| Claim | 185160168 | 704 days ago | IN | 0 ETH | 0.00012003 | ||||
| Claim | 184817999 | 705 days ago | IN | 0 ETH | 0.00011034 | ||||
| Claim | 184817377 | 705 days ago | IN | 0 ETH | 0.00011171 | ||||
| Claim | 184816487 | 705 days ago | IN | 0 ETH | 0.00010021 | ||||
| Claim | 184780061 | 705 days ago | IN | 0 ETH | 0.00018692 | ||||
| Claim | 184778983 | 705 days ago | IN | 0 ETH | 0.00017335 | ||||
| Claim | 184778810 | 705 days ago | IN | 0 ETH | 0.00017472 | ||||
| Claim | 184778344 | 705 days ago | IN | 0 ETH | 0.0001741 | ||||
| Claim | 184778270 | 705 days ago | IN | 0 ETH | 0.00017684 | ||||
| Claim | 184642326 | 706 days ago | IN | 0 ETH | 0.000095 | ||||
| Claim | 184605528 | 706 days ago | IN | 0 ETH | 0.00007912 |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
SsovV3StakingRewards
Compiler Version
v0.8.16+commit.07a7930e
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.16;
// Interfaces
import {IERC20 as OZERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ISsovV3} from "../core/ISsovV3.sol";
// Libraries
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
// Contracts
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
import {ContractWhitelist} from "../helpers/ContractWhitelist.sol";
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
/***
* Deposit SSOV V3 deposit positions (ERC721) to earn rewards.
* Rewards earned are based on strike of the position.
*/
interface IERC20 is OZERC20 {
function decimals() external view returns (uint256);
}
contract SsovV3StakingRewards is
AccessControl,
ContractWhitelist,
Pausable,
ReentrancyGuard
{
using SafeERC20 for IERC20;
/* ========== STATE VARIABLES ========== */
bytes32 public constant MANAGER_ROLE =
keccak256(abi.encodePacked("MANAGER_ROLE"));
struct RewardInfo {
uint256 rewardAmount;
uint256 periodFinish;
uint256 rewardRate;
uint256 rewardRateStored;
uint256 lastUpdateTime;
uint256 totalSupply;
uint256 decimalsPrecision;
IERC20 rewardToken;
}
struct StakedPosition {
uint256[] rewardRateStored;
uint256[] rewardsPaid;
uint256 stakeAmount;
bool staked;
}
/**
* @notice Staked positions of users.
* @dev hash(ssov, positionId, epoch) => SsovUserPosition
*/
mapping(bytes32 => StakedPosition) private stakedPositions;
/**
* @notice Rewards related data for each ssov
* @dev hash(ssov, strike, epoch) => RewardInfo
*/
mapping(bytes32 => RewardInfo[]) private ssovRewardStrikeInfo;
constructor() {
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
_setupRole(MANAGER_ROLE, msg.sender);
}
/* ========== PUBLIC METHODS ========== */
/// @notice Allows to stake the staking token into the contract for rewards
/// @param _ssov Address of the SSOV of the deposit position
/// @param _id ID of the deposit position
function stake(
address _ssov,
uint _id
) external whenNotPaused nonReentrant {
_isEligibleSender();
ISsovV3 ssov = ISsovV3(_ssov);
if (ssov.ownerOf(_id) != msg.sender) revert NotOwnerOfWritePosition();
uint256 currentEpoch = ssov.currentEpoch();
(uint256 epoch, uint256 strike, uint256 amount, , ) = ssov
.writePosition(_id);
if (epoch != currentEpoch) revert NotCurrentEpoch();
if (ssov.getEpochData(epoch).expiry <= block.timestamp) {
revert SsovEpochExpired();
}
bytes32 _positionId = getId(_ssov, _id, epoch);
bytes32 _rewardInfoId = getId(_ssov, strike, epoch);
if (stakedPositions[_positionId].staked) {
revert SsovPositionAlreadyStaked();
}
_updateUserPositionAndRewards(_rewardInfoId, _positionId, amount);
emit SsovPositionStaked(_ssov, _id, amount);
}
/**
* @notice Claim rewards of a staked position.
* @param _ssov Address of the ssov vault
* @param _id ID of the write position.
* @param _receiver Address of the reward tokens receiver.
*/
function claim(
address _ssov,
uint256 _id,
address _receiver
) external whenNotPaused nonReentrant {
_isEligibleSender();
_claim(_id, _ssov, _receiver);
}
/**
* @notice Claim rewards for multiple staked positions.
* @param _positionIds IDs of the write positions staked.
* @param _ssov Address of the SSOV.
* @param _receiver Address of the receiver.
*/
function multiClaim(
uint256[] calldata _positionIds,
address _ssov,
address _receiver
) external whenNotPaused nonReentrant {
for (uint256 i; i < _positionIds.length; ) {
_claim(_positionIds[i], _ssov, _receiver);
unchecked {
++i;
}
}
}
/* ========== VIEW FUNCTIONS ========== */
/**
* @notice Returns information about rewards.
* @param id ID from ssovRewardStrikeInfo mapping.
* @return _rewardInfo Information about the rewards.
*/
function getSsovEpochStrikeRewardsInfo(
bytes32 id
) public view returns (RewardInfo[] memory _rewardInfo) {
_rewardInfo = new RewardInfo[](ssovRewardStrikeInfo[id].length);
_rewardInfo = ssovRewardStrikeInfo[id];
return _rewardInfo;
}
/**
* @notice Returns information about rewards.
* @param _ssov Address of the ssov.
* @param _strike Strike of the ssov.
* @param _epoch Epoch of the ssov.
* @return _rewardInfo Information about the rewards.
*/
function getSsovEpochStrikeRewardsInfo(
address _ssov,
uint256 _strike,
uint256 _epoch
) external view returns (RewardInfo[] memory _rewardInfo) {
bytes32 rewardsInfoId = getId(_ssov, _strike, _epoch);
return getSsovEpochStrikeRewardsInfo(rewardsInfoId);
}
/**
*
* @notice Get user staked position information.
* @param id ID of the staked position from stakedPositions mapping.
* @return _stakedPosition Information about the staked position.
*/
function getUserStakedPosition(
bytes32 id
) external view returns (StakedPosition memory _stakedPosition) {
_stakedPosition = stakedPositions[id];
}
/**
* @param _ssov Address of the SSOV
* @param _uint1 Strike | ssov position ID
* @param _uint2 Epoch
*/
function getId(
address _ssov,
uint256 _uint1,
uint256 _uint2
) public pure returns (bytes32) {
return keccak256(abi.encodePacked(_ssov, _uint1, _uint2));
}
/**
* @notice Get rewards earned by a write position.
* @param _ssov Address of the ssov.
* @return rewardTokens Array of reward tokens.
* @return rewardAmounts Array of reward amounts.
*/
function earned(
address _ssov,
uint256 _positionId
)
external
view
returns (address[] memory rewardTokens, uint256[] memory rewardAmounts)
{
(uint epoch, uint256 strike, , , ) = ISsovV3(_ssov).writePosition(
_positionId
);
bytes32 stakedPositionId = getId(_ssov, _positionId, epoch);
if (stakedPositions[stakedPositionId].staked) {
bytes32 rewardsInfoId = getId(_ssov, strike, epoch);
uint256 len = ssovRewardStrikeInfo[rewardsInfoId].length;
rewardTokens = new address[](len);
rewardAmounts = new uint256[](len);
IERC20 rewardToken;
uint256 rewardAmount;
for (uint256 i; i < len; ) {
(, rewardAmount, , rewardToken) = earned(
rewardsInfoId,
stakedPositionId,
i
);
rewardTokens[i] = address(rewardToken);
rewardAmounts[i] = rewardAmount;
unchecked {
++i;
}
}
}
}
/**
* @notice Get Amount of rewards and reward tokens earned.
* @return rewardRate New rate of reward distribution.
* @return earnedRewards Amount of earned reward tokens.
* @return lastApplicableTime Last applicable time updated.
* @return rewardToken Address of the reward token.
*/
function earned(
bytes32 _rewardsInfoId,
bytes32 _positionId,
uint256 _index
)
public
view
returns (
uint256 rewardRate,
uint256 earnedRewards,
uint256 lastApplicableTime,
IERC20 rewardToken
)
{
StakedPosition memory _stakedPosition = stakedPositions[_positionId];
RewardInfo memory _rewardInfo = ssovRewardStrikeInfo[_rewardsInfoId][
_index
];
uint256 rewardsCollected = _getRewardsCollected(_rewardInfo);
rewardRate =
(rewardsCollected * _rewardInfo.decimalsPrecision) /
_rewardInfo.totalSupply;
rewardRate = _rewardInfo.rewardRateStored + rewardRate;
earnedRewards =
((
((rewardRate - _stakedPosition.rewardRateStored[_index]) *
_stakedPosition.stakeAmount)
) / _rewardInfo.decimalsPrecision) -
_stakedPosition.rewardsPaid[_index];
rewardToken = _rewardInfo.rewardToken;
lastApplicableTime = Math.min(
_rewardInfo.periodFinish,
block.timestamp
);
}
/* ========== RESTRICTED FUNCTIONS ========== */
/**
* @notice Add rewards for an ssov for given strike and current epoch.
* @param _ssov Address of the ssov.
* @param _strike Strike to set rewards for.
* @param _rewardToken Address of the reward token.
* @param _rewardAmount Amount of reward token to set.
*/
function addRewards(
address _ssov,
uint256 _strike,
address _rewardToken,
uint256 _rewardAmount
) public onlyRole(MANAGER_ROLE) {
if (_rewardToken == address(0)) {
revert ZeroAddress();
}
ISsovV3 ssov = ISsovV3(_ssov);
IERC20 rewardToken = IERC20(_rewardToken);
uint256 epoch = ssov.currentEpoch();
bytes32 id = getId(_ssov, _strike, epoch);
RewardInfo memory _rewardInfo;
_rewardInfo.periodFinish = ssov.getEpochData(epoch).expiry;
if (_rewardInfo.periodFinish <= block.timestamp) {
revert SsovEpochExpired();
}
_rewardInfo.rewardAmount = _rewardAmount;
_rewardInfo.rewardToken = rewardToken;
_rewardInfo.lastUpdateTime = block.timestamp;
_rewardInfo.rewardRate =
_rewardAmount /
(_rewardInfo.periodFinish - block.timestamp);
_rewardInfo.decimalsPrecision =
10 ** _rewardInfo.rewardToken.decimals();
ssovRewardStrikeInfo[id].push(_rewardInfo);
rewardToken.safeTransferFrom(msg.sender, address(this), _rewardAmount);
emit SsovStrikeRewardsSet(_ssov, _strike, epoch, _rewardInfo);
}
/**
* @notice Add rewards for multiple strikes of an ssov.
* @param _ssov Address of the ssov.
* @param _strikes Strikes to set rewards for.
* @param _rewardToken Address of the reward token.
* @param _rewardAmount Amount of reward token to set.
*/
function addSingleRewardsForMultipleStrikes(
address _ssov,
uint256[] calldata _strikes,
address _rewardToken,
uint256 _rewardAmount
) external onlyRole(MANAGER_ROLE) {
for (uint256 i; i < _strikes.length; ) {
addRewards(_ssov, _strikes[i], _rewardToken, _rewardAmount);
unchecked {
++i;
}
}
}
/**
* @notice Add rewards of multiple amounts for multiple
* strikes of an ssov.
* @param _ssov Address of the ssov.
* @param _strikes Strikes to set rewards for.
* @param _rewardToken Address of the reward token.
* @param _rewardAmounts Amounts of reward token to set.
*/
function addMultipleRewardsForMultipleStrikes(
address _ssov,
uint256[] calldata _strikes,
address _rewardToken,
uint256[] calldata _rewardAmounts
) external onlyRole(MANAGER_ROLE) {
for (uint256 i; i < _strikes.length; ) {
addRewards(_ssov, _strikes[i], _rewardToken, _rewardAmounts[i]);
unchecked {
++i;
}
}
}
/// @notice Transfers all funds to msg.sender
/// @dev Can only be called by the owner
/// @param tokens The list of erc20 tokens to withdraw
/// @param transferNative Whether should transfer the native currency
function emergencyWithdraw(
address[] calldata tokens,
bool transferNative
) external whenPaused onlyRole(DEFAULT_ADMIN_ROLE) returns (bool) {
if (transferNative) payable(msg.sender).transfer(address(this).balance);
IERC20 token;
for (uint256 i = 0; i < tokens.length; i++) {
token = IERC20(tokens[i]);
token.safeTransfer(msg.sender, token.balanceOf(address(this)));
}
emit EmergencyWithdraw(msg.sender);
return true;
}
/// @notice Adds to the contract whitelist
/// @dev Can only be called by the owner
/// @param _contract the contract to be added to the whitelist
function addToContractWhitelist(
address _contract
) external onlyRole(DEFAULT_ADMIN_ROLE) {
_addToContractWhitelist(_contract);
}
/// @notice Removes from the contract whitelist
/// @dev Can only be called by the owner
/// @param _contract the contract to be removed from the whitelist
function removeFromContractWhitelist(
address _contract
) external onlyRole(DEFAULT_ADMIN_ROLE) {
_removeFromContractWhitelist(_contract);
}
/// @notice Pauses the contract
/// @dev Can only be called by the owner
function pause() external onlyRole(DEFAULT_ADMIN_ROLE) {
_pause();
}
/// @notice Unpauses the contract
/// @dev Can only be called by the owner
function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) {
_unpause();
}
/* ========== PRIVATE FUNCTIONS ========== */
function _claim(uint256 _id, address _ssov, address _receiver) private {
if (_receiver == address(0)) {
revert ZeroAddress();
}
(uint epoch, uint256 strike, , , ) = ISsovV3(_ssov).writePosition(_id);
bytes32 positionId = getId(_ssov, _id, epoch);
bytes32 rewardsInfoId = getId(_ssov, strike, epoch);
if (!stakedPositions[positionId].staked) {
revert NotStaked();
}
if (ISsovV3(_ssov).ownerOf(_id) != msg.sender) {
revert NotOwnerOfWritePosition();
}
uint256 len = ssovRewardStrikeInfo[rewardsInfoId].length;
if (len == 0) {
revert RewardsNotSet();
}
uint256 rewardRate;
uint256 earnedRewards;
uint256 lastApplicableTime;
IERC20 rewardToken;
for (uint256 i; i < len; ) {
(
rewardRate,
earnedRewards,
lastApplicableTime,
rewardToken
) = earned(rewardsInfoId, positionId, i);
ssovRewardStrikeInfo[rewardsInfoId][i]
.rewardRateStored = rewardRate;
ssovRewardStrikeInfo[rewardsInfoId][i]
.lastUpdateTime = lastApplicableTime;
stakedPositions[positionId].rewardsPaid[i] += earnedRewards;
rewardToken.safeTransfer(_receiver, earnedRewards);
emit Claimed(earnedRewards, _id, _ssov, address(rewardToken));
unchecked {
++i;
}
}
if (ISsovV3(_ssov).getEpochData(epoch).expiry <= block.timestamp) {
delete stakedPositions[positionId];
}
}
function _updateUserPositionAndRewards(
bytes32 _rewardsInfoId,
bytes32 _positionId,
uint256 _amount
) private {
uint256 len = ssovRewardStrikeInfo[_rewardsInfoId].length;
if (len == 0) {
revert RewardsNotSet();
}
StakedPosition memory _stakedPosition;
RewardInfo memory _rewardInfo;
uint256 rewardsCollected;
_stakedPosition.staked = true;
_stakedPosition.rewardRateStored = new uint256[](len);
_stakedPosition.rewardsPaid = new uint256[](len);
_stakedPosition.stakeAmount = _amount;
uint256 rewardRate;
for (uint256 i; i < len; ) {
_rewardInfo = ssovRewardStrikeInfo[_rewardsInfoId][i];
rewardsCollected = _getRewardsCollected(_rewardInfo);
if (_rewardInfo.totalSupply != 0) {
rewardRate =
(rewardsCollected * _rewardInfo.decimalsPrecision) /
_rewardInfo.totalSupply;
_stakedPosition.rewardRateStored[i] =
rewardRate +
_rewardInfo.rewardRateStored;
_rewardInfo.rewardRateStored = _stakedPosition.rewardRateStored[
i
];
_rewardInfo.lastUpdateTime = Math.min(
block.timestamp,
_rewardInfo.periodFinish
);
}
_rewardInfo.totalSupply += _amount;
ssovRewardStrikeInfo[_rewardsInfoId][i] = _rewardInfo;
unchecked {
++i;
}
}
stakedPositions[_positionId] = _stakedPosition;
}
function _getRewardsCollected(
RewardInfo memory _rewardInfo
) private view returns (uint256 rewardsCollected) {
rewardsCollected =
_rewardInfo.rewardRate *
(Math.min(_rewardInfo.periodFinish, block.timestamp) -
_rewardInfo.lastUpdateTime);
}
/* ========== EVENTS ========== */
event SsovStrikeRewardsSet(
address ssov,
uint256 strike,
uint256 epoch,
RewardInfo rewardInfo
);
event SsovPositionStaked(address ssov, uint256 id, uint256 amount);
event EmergencyWithdraw(address sender);
event Staked(
address indexed user,
uint256 positionId,
address ssov,
uint256 strike,
uint256 amount
);
event Claimed(
uint256 rewardAmount,
uint256 positionId,
address ssov,
address rewardToken
);
/* ========== ERRORS ========== */
error SsovPositionAlreadyStaked();
error NotOwnerOfWritePosition();
error NotCurrentEpoch();
error InvalidArrayLengths();
error SsovEpochExpired();
error RewardsNotSet();
error NotStaked();
error FullRewardsClaimed();
error RewardsAlreadySet();
error ZeroAddress();
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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);
_;
}
/**
* @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 virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @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 virtual {
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 virtual 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.
*
* May emit a {RoleGranted} event.
*/
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.
*
* May emit a {RoleRevoked} event.
*/
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`.
*
* May emit a {RoleRevoked} event.
*/
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.
*
* May emit a {RoleGranted} event.
*
* [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.
*
* May emit a {RoleGranted} event.
*/
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.
*
* May emit a {RoleRevoked} event.
*/
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.1 (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 (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (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`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the 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 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 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 the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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.1 (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 (last updated v4.7.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`.
// We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.
// This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.
// Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a
// good first aproximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1;
uint256 x = a;
if (x >> 128 > 0) {
x >>= 128;
result <<= 64;
}
if (x >> 64 > 0) {
x >>= 64;
result <<= 32;
}
if (x >> 32 > 0) {
x >>= 32;
result <<= 16;
}
if (x >> 16 > 0) {
x >>= 16;
result <<= 8;
}
if (x >> 8 > 0) {
x >>= 8;
result <<= 4;
}
if (x >> 4 > 0) {
x >>= 4;
result <<= 2;
}
if (x >> 2 > 0) {
result <<= 1;
}
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
uint256 result = sqrt(a);
if (rounding == Rounding.Up && result * result < a) {
result += 1;
}
return result;
}
}//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
// Interfaces
import {IERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import {IERC20} from "../external/interfaces/IERC20.sol";
// Structs
import {Addresses, EpochData, EpochStrikeData, VaultCheckpoint} from "./SsovV3Structs.sol";
/// @title SSOV V3 interface
interface ISsovV3 is IERC721Enumerable {
function isPut() external view returns (bool);
function currentEpoch() external view returns (uint256);
function collateralPrecision() external view returns (uint256);
function addresses() external view returns (Addresses memory);
function collateralToken() external view returns (IERC20);
function deposit(
uint256 strikeIndex,
uint256 amount,
address to
) external returns (uint256 tokenId);
function purchase(
uint256 strikeIndex,
uint256 amount,
address to
) external returns (uint256 premium, uint256 totalFee);
function settle(
uint256 strikeIndex,
uint256 amount,
uint256 epoch,
address to
) external returns (uint256 pnl);
function withdraw(uint256 tokenId, address to)
external
returns (
uint256 collateralTokenWithdrawAmount,
uint256[] memory rewardTokenWithdrawAmounts
);
function getUnderlyingPrice() external view returns (uint256);
function getCollateralPrice() external view returns (uint256);
function getVolatility(uint256 _strike) external view returns (uint256);
function calculatePremium(
uint256 _strike,
uint256 _amount,
uint256 _expiry
) external view returns (uint256 premium);
function calculatePnl(
uint256 price,
uint256 strike,
uint256 amount,
uint256 collateralExchangeRate
) external view returns (uint256);
function calculatePurchaseFees(uint256 strike, uint256 amount)
external
view
returns (uint256);
function calculateSettlementFees(uint256 pnl)
external
view
returns (uint256);
function getEpochTimes(uint256 epoch)
external
view
returns (uint256 start, uint256 end);
function writePosition(uint256 tokenId)
external
view
returns (
uint256 epoch,
uint256 strike,
uint256 collateralAmount,
uint256 checkpointIndex,
uint256[] memory rewardDistributionRatios
);
function getEpochData(uint256 epoch)
external
view
returns (EpochData memory);
function getEpochStrikeData(uint256 epoch, uint256 strike)
external
view
returns (EpochStrikeData memory);
function getEpochStrikeCheckpointsLength(uint256 epoch, uint256 strike)
external
view
returns (uint256);
function checkpoints(
uint256 epoch,
uint256 strike,
uint256 index
) external view returns (VaultCheckpoint memory);
}//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
struct Addresses {
address feeStrategy;
address stakingStrategy;
address optionPricing;
address priceOracle;
address volatilityOracle;
address feeDistributor;
address optionsTokenImplementation;
}
struct EpochData {
bool expired;
uint256 startTime;
uint256 expiry;
uint256 settlementPrice;
uint256 totalCollateralBalance; // Premium + Deposits from all strikes
uint256 collateralExchangeRate; // Exchange rate for collateral to underlying (Only applicable to CALL options)
uint256 settlementCollateralExchangeRate; // Exchange rate for collateral to underlying on settlement (Only applicable to CALL options)
uint256[] strikes;
uint256[] totalRewardsCollected;
uint256[] rewardDistributionRatios;
address[] rewardTokensToDistribute;
}
struct EpochStrikeData {
address strikeToken;
uint256 totalCollateral;
uint256 activeCollateral;
uint256 totalPremiums;
uint256 checkpointPointer;
uint256[] rewardStoredForPremiums;
uint256[] rewardDistributionRatiosForPremiums;
}
struct VaultCheckpoint {
uint256 activeCollateral;
uint256 totalCollateral;
uint256 accruedPremium;
}
struct WritePosition {
uint256 epoch;
uint256 strike;
uint256 collateralAmount;
uint256 checkpointIndex;
uint256[] rewardDistributionRatios;
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
* NOTE: Modified to include symbols and decimals.
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/// @title ContractWhitelist
/// @author witherblock
/// @notice A helper contract that lets you add a list of whitelisted contracts that should be able to interact with restricited functions
abstract contract ContractWhitelist {
/// @dev contract => whitelisted or not
mapping(address => bool) public whitelistedContracts;
/*==== SETTERS ====*/
/// @dev add to the contract whitelist
/// @param _contract the address of the contract to add to the contract whitelist
function _addToContractWhitelist(address _contract) internal {
require(isContract(_contract), "Address must be a contract");
require(
!whitelistedContracts[_contract],
"Contract already whitelisted"
);
whitelistedContracts[_contract] = true;
emit AddToContractWhitelist(_contract);
}
/// @dev remove from the contract whitelist
/// @param _contract the address of the contract to remove from the contract whitelist
function _removeFromContractWhitelist(address _contract) internal {
require(whitelistedContracts[_contract], "Contract not whitelisted");
whitelistedContracts[_contract] = false;
emit RemoveFromContractWhitelist(_contract);
}
// modifier is eligible sender modifier
function _isEligibleSender() internal view {
// the below condition checks whether the caller is a contract or not
if (msg.sender != tx.origin)
require(
whitelistedContracts[msg.sender],
"Contract must be whitelisted"
);
}
/*==== VIEWS ====*/
/// @dev checks for contract or eoa addresses
/// @param addr the address to check
/// @return bool whether the passed address is a contract address
function isContract(address addr) public view returns (bool) {
uint256 size;
assembly {
size := extcodesize(addr)
}
return size > 0;
}
/*==== EVENTS ====*/
event AddToContractWhitelist(address indexed _contract);
event RemoveFromContractWhitelist(address indexed _contract);
}{
"evmVersion": "london",
"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":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"FullRewardsClaimed","type":"error"},{"inputs":[],"name":"InvalidArrayLengths","type":"error"},{"inputs":[],"name":"NotCurrentEpoch","type":"error"},{"inputs":[],"name":"NotOwnerOfWritePosition","type":"error"},{"inputs":[],"name":"NotStaked","type":"error"},{"inputs":[],"name":"RewardsAlreadySet","type":"error"},{"inputs":[],"name":"RewardsNotSet","type":"error"},{"inputs":[],"name":"SsovEpochExpired","type":"error"},{"inputs":[],"name":"SsovPositionAlreadyStaked","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_contract","type":"address"}],"name":"AddToContractWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"positionId","type":"uint256"},{"indexed":false,"internalType":"address","name":"ssov","type":"address"},{"indexed":false,"internalType":"address","name":"rewardToken","type":"address"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_contract","type":"address"}],"name":"RemoveFromContractWhitelist","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":false,"internalType":"address","name":"ssov","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SsovPositionStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"ssov","type":"address"},{"indexed":false,"internalType":"uint256","name":"strike","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"epoch","type":"uint256"},{"components":[{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"uint256","name":"periodFinish","type":"uint256"},{"internalType":"uint256","name":"rewardRate","type":"uint256"},{"internalType":"uint256","name":"rewardRateStored","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTime","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"decimalsPrecision","type":"uint256"},{"internalType":"contract IERC20","name":"rewardToken","type":"address"}],"indexed":false,"internalType":"struct SsovV3StakingRewards.RewardInfo","name":"rewardInfo","type":"tuple"}],"name":"SsovStrikeRewardsSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"positionId","type":"uint256"},{"indexed":false,"internalType":"address","name":"ssov","type":"address"},{"indexed":false,"internalType":"uint256","name":"strike","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ssov","type":"address"},{"internalType":"uint256[]","name":"_strikes","type":"uint256[]"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"uint256[]","name":"_rewardAmounts","type":"uint256[]"}],"name":"addMultipleRewardsForMultipleStrikes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ssov","type":"address"},{"internalType":"uint256","name":"_strike","type":"uint256"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_rewardAmount","type":"uint256"}],"name":"addRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ssov","type":"address"},{"internalType":"uint256[]","name":"_strikes","type":"uint256[]"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_rewardAmount","type":"uint256"}],"name":"addSingleRewardsForMultipleStrikes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"addToContractWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ssov","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_rewardsInfoId","type":"bytes32"},{"internalType":"bytes32","name":"_positionId","type":"bytes32"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"earned","outputs":[{"internalType":"uint256","name":"rewardRate","type":"uint256"},{"internalType":"uint256","name":"earnedRewards","type":"uint256"},{"internalType":"uint256","name":"lastApplicableTime","type":"uint256"},{"internalType":"contract IERC20","name":"rewardToken","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ssov","type":"address"},{"internalType":"uint256","name":"_positionId","type":"uint256"}],"name":"earned","outputs":[{"internalType":"address[]","name":"rewardTokens","type":"address[]"},{"internalType":"uint256[]","name":"rewardAmounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"bool","name":"transferNative","type":"bool"}],"name":"emergencyWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ssov","type":"address"},{"internalType":"uint256","name":"_uint1","type":"uint256"},{"internalType":"uint256","name":"_uint2","type":"uint256"}],"name":"getId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ssov","type":"address"},{"internalType":"uint256","name":"_strike","type":"uint256"},{"internalType":"uint256","name":"_epoch","type":"uint256"}],"name":"getSsovEpochStrikeRewardsInfo","outputs":[{"components":[{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"uint256","name":"periodFinish","type":"uint256"},{"internalType":"uint256","name":"rewardRate","type":"uint256"},{"internalType":"uint256","name":"rewardRateStored","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTime","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"decimalsPrecision","type":"uint256"},{"internalType":"contract IERC20","name":"rewardToken","type":"address"}],"internalType":"struct SsovV3StakingRewards.RewardInfo[]","name":"_rewardInfo","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"getSsovEpochStrikeRewardsInfo","outputs":[{"components":[{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"uint256","name":"periodFinish","type":"uint256"},{"internalType":"uint256","name":"rewardRate","type":"uint256"},{"internalType":"uint256","name":"rewardRateStored","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTime","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"decimalsPrecision","type":"uint256"},{"internalType":"contract IERC20","name":"rewardToken","type":"address"}],"internalType":"struct SsovV3StakingRewards.RewardInfo[]","name":"_rewardInfo","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"id","type":"bytes32"}],"name":"getUserStakedPosition","outputs":[{"components":[{"internalType":"uint256[]","name":"rewardRateStored","type":"uint256[]"},{"internalType":"uint256[]","name":"rewardsPaid","type":"uint256[]"},{"internalType":"uint256","name":"stakeAmount","type":"uint256"},{"internalType":"bool","name":"staked","type":"bool"}],"internalType":"struct SsovV3StakingRewards.StakedPosition","name":"_stakedPosition","type":"tuple"}],"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":"addr","type":"address"}],"name":"isContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_positionIds","type":"uint256[]"},{"internalType":"address","name":"_ssov","type":"address"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"multiClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"removeFromContractWhitelist","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":[{"internalType":"address","name":"_ssov","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedContracts","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b506002805460ff1916905560016003556200002e60003362000077565b6040516b4d414e414745525f524f4c4560a01b60208201526200007190602c0160405160208183030381529060405280519060200120336200007760201b60201c565b62000127565b62000083828262000087565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000083576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620000e33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61336180620001376000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c80638456cb59116100f9578063adc9772e11610097578063c3d9ed3911610071578063c3d9ed39146103ff578063d3d0291c14610412578063d547741f14610425578063ec87621c1461043857600080fd5b8063adc9772e146103c6578063b4a70f90146103d9578063c3106663146103ec57600080fd5b80639e96a260116100d35780639e96a260146103855780639f0977ff14610398578063a217fddf146103ab578063acc3a006146103b357600080fd5b80638456cb59146103575780638618cb071461035f57806391d148541461037257600080fd5b8063391feebb116101665780633f4ba83a116101405780633f4ba83a1461031157806354518b94146103195780635c975abb146103395780637c4b52cb1461034457600080fd5b8063391feebb146102915780633d5dac89146102b45780633e491d47146102f057600080fd5b80632377da3a116101a25780632377da3a14610225578063248a9ca3146102385780632f2ff15d1461026957806336568abe1461027e57600080fd5b806301ffc9a7146101c957806311534e31146101f15780631627905514610211575b600080fd5b6101dc6101d7366004612767565b61046f565b60405190151581526020015b60405180910390f35b6102046101ff3660046127a6565b6104a6565b6040516101e89190612831565b6101dc61021f366004612880565b3b151590565b61020461023336600461289d565b6104cb565b61025b61024636600461289d565b60009081526020819052604090206001015490565b6040519081526020016101e8565b61027c6102773660046128b6565b6105f4565b005b61027c61028c3660046128b6565b61061e565b6101dc61029f366004612880565b60016020526000908152604090205460ff1681565b6102c76102c23660046128e6565b6106a1565b604080519485526020850193909352918301526001600160a01b031660608201526080016101e8565b6103036102fe366004612912565b6108ed565b6040516101e8929190612979565b61027c610acb565b61032c61032736600461289d565b610ae1565b6040516101e891906129d9565b60025460ff166101dc565b6101dc610352366004612a8e565b610bef565b61027c610d3f565b61027c61036d366004612ae4565b610d52565b6101dc6103803660046128b6565b611063565b61027c610393366004612b2c565b61108c565b61027c6103a6366004612b63565b6110d8565b61025b600081565b61027c6103c1366004612880565b611149565b61027c6103d4366004612912565b61115d565b61027c6103e7366004612bca565b611476565b61025b6103fa3660046127a6565b611509565b61027c61040d366004612880565b611558565b61027c610420366004612c60565b61156c565b61027c6104333660046128b6565b6115e6565b61025b6040516b4d414e414745525f524f4c4560a01b6020820152602c016040516020818303038152906040528051906020012081565b60006001600160e01b03198216637965db0b60e01b14806104a057506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060006104b5858585611509565b90506104c0816104cb565b9150505b9392505050565b6000818152600560205260409020546060906001600160401b038111156104f4576104f4612ccf565b60405190808252806020026020018201604052801561052d57816020015b61051a61269b565b8152602001906001900390816105125790505b50905060056000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156105e957600084815260209081902060408051610100810182526008860290920180548352600180820154848601526002820154928401929092526003810154606084015260048101546080840152600581015460a0840152600681015460c0840152600701546001600160a01b031660e08301529083529092019101610563565b505050509050919050565b60008281526020819052604090206001015461060f8161160b565b6106198383611615565b505050565b6001600160a01b03811633146106935760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61069d8282611699565b5050565b60008281526004602090815260408083208151815460a0948102820185019093526080810183815285948594859485949390928492849184018282801561070757602002820191906000526020600020905b8154815260200190600101908083116106f3575b505050505081526020016001820180548060200260200160405190810160405280929190818152602001828054801561075f57602002820191906000526020600020905b81548152602001906001019080831161074b575b5050509183525050600282015460208083019190915260039092015460ff16151560409182015260008b81526005909252812080549293509091889081106107a9576107a9612ce5565b6000918252602080832060408051610100810182526008909402909101805484526001810154928401929092526002820154908301526003810154606083015260048101546080830152600581015460a0830152600681015460c0830152600701546001600160a01b031660e08201529150610824826116fe565b90508160a001518260c001518261083b9190612d11565b6108459190612d30565b96508682606001516108579190612d52565b96508260200151888151811061086f5761086f612ce5565b60200260200101518260c00151846040015185600001518b8151811061089757610897612ce5565b60200260200101518a6108aa9190612d65565b6108b49190612d11565b6108be9190612d30565b6108c89190612d65565b95508160e0015193506108df82602001514261172c565b945050505093509350935093565b606080600080856001600160a01b031663a624ec63866040518263ffffffff1660e01b815260040161092191815260200190565b600060405180830381865afa15801561093e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109669190810190612e5f565b50505091509150600061097a878785611509565b60008181526004602052604090206003015490915060ff1615610ac15760006109a4888486611509565b600081815260056020526040902054909150806001600160401b038111156109ce576109ce612ccf565b6040519080825280602002602001820160405280156109f7578160200160208202803683370190505b509650806001600160401b03811115610a1257610a12612ccf565b604051908082528060200260200182016040528015610a3b578160200160208202803683370190505b50955060008060005b83811015610abb57610a578587836106a1565b8d519096509194508592508c918491508110610a7557610a75612ce5565b60200260200101906001600160a01b031690816001600160a01b03168152505081898281518110610aa857610aa8612ce5565b6020908102919091010152600101610a44565b50505050505b5050509250929050565b6000610ad68161160b565b610ade611742565b50565b610b0e60405180608001604052806060815260200160608152602001600081526020016000151581525090565b6000828152600460209081526040918290208251815460a093810282018401909452608081018481529093919284928491840182828015610b6e57602002820191906000526020600020905b815481526020019060010190808311610b5a575b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015610bc657602002820191906000526020600020905b815481526020019060010190808311610bb2575b50505091835250506002820154602082015260039091015460ff16151560409091015292915050565b6000610bf9611794565b6000610c048161160b565b8215610c385760405133904780156108fc02916000818181858888f19350505050158015610c36573d6000803e3d6000fd5b505b6000805b85811015610cff57868682818110610c5657610c56612ce5565b9050602002016020810190610c6b9190612880565b6040516370a0823160e01b8152306004820152909250610ced9033906001600160a01b038516906370a0823190602401602060405180830381865afa158015610cb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdc9190612ec2565b6001600160a01b03851691906117df565b80610cf781612edb565b915050610c3c565b506040513381527f5e7b34819cd91b239220bec92fcfd3c10da2214ba13e4e2b1f6c9cfdbd68a9a29060200160405180910390a150600195945050505050565b6000610d4a8161160b565b610ade611842565b6040516b4d414e414745525f524f4c4560a01b6020820152602c0160405160208183030381529060405280519060200120610d8c8161160b565b6001600160a01b038316610db35760405163d92e233d60e01b815260040160405180910390fd5b600085905060008490506000826001600160a01b031663766718086040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e219190612ec2565b90506000610e30898984611509565b9050610e3a61269b565b6040516342cf3e9960e11b8152600481018490526001600160a01b0386169063859e7d3290602401600060405180830381865afa158015610e7f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ea79190810190612f68565b60400151602082018190524210610ed157604051630f67808360e01b815260040160405180910390fd5b8681526001600160a01b03841660e082015242608082018190526020820151610efa9190612d65565b610f049088612d30565b8160400181815250508060e001516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f739190612ec2565b610f7e90600a61317a565b60c08201908152600083815260056020818152604080842080546001808201835591865294839020875160089096020194855591860151918401919091558401516002830155606084015160038301556080840151600483015560a0840151908201559051600682015560e0820151600790910180546001600160a01b0319166001600160a01b0392831617905561101a90851633308a61187f565b7fa4ac734167c34e86ff603fa0800735c95cc7dc732d120899a38932737295d28f8a8a858460405161104f9493929190613186565b60405180910390a150505050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6110946118bd565b6002600354036110b65760405162461bcd60e51b815260040161068a906131bb565b60026003556110c3611903565b6110ce828483611969565b5050600160035550565b6110e06118bd565b6002600354036111025760405162461bcd60e51b815260040161068a906131bb565b600260035560005b8381101561113d5761113585858381811061112757611127612ce5565b905060200201358484611969565b60010161110a565b50506001600355505050565b60006111548161160b565b61069d82611d28565b6111656118bd565b6002600354036111875760405162461bcd60e51b815260040161068a906131bb565b6002600355611194611903565b6040516331a9108f60e11b815260048101829052829033906001600160a01b03831690636352211e90602401602060405180830381865afa1580156111dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061120191906131f2565b6001600160a01b03161461122857604051632ac7b57160e21b815260040160405180910390fd5b6000816001600160a01b031663766718086040518163ffffffff1660e01b8152600401602060405180830381865afa158015611268573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128c9190612ec2565b90506000806000846001600160a01b031663a624ec63876040518263ffffffff1660e01b81526004016112c191815260200190565b600060405180830381865afa1580156112de573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113069190810190612e5f565b505092509250925083831461132e57604051636ea8a2eb60e11b815260040160405180910390fd5b6040516342cf3e9960e11b81526004810184905242906001600160a01b0387169063859e7d3290602401600060405180830381865afa158015611375573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261139d9190810190612f68565b60400151116113bf57604051630f67808360e01b815260040160405180910390fd5b60006113cc888886611509565b905060006113db898587611509565b60008381526004602052604090206003015490915060ff1615611411576040516389d351b560e01b815260040160405180910390fd5b61141c818385611e2e565b604080516001600160a01b038b168152602081018a90529081018490527ffc9e282e32af519d40f3848e43fa35f3624518c97323a52c9455399b7c22f26c9060600160405180910390a15050600160035550505050505050565b6040516b4d414e414745525f524f4c4560a01b6020820152602c01604051602081830303815290604052805190602001206114b08161160b565b60005b858110156114ff576114f7888888848181106114d1576114d1612ce5565b90506020020135878787868181106114eb576114eb612ce5565b90506020020135610d52565b6001016114b3565b5050505050505050565b6040516bffffffffffffffffffffffff19606085901b16602082015260348101839052605481018290526000906074016040516020818303038152906040528051906020012090509392505050565b60006115638161160b565b61069d82612198565b6040516b4d414e414745525f524f4c4560a01b6020820152602c01604051602081830303815290604052805190602001206115a68161160b565b60005b848110156115dd576115d5878787848181106115c7576115c7612ce5565b905060200201358686610d52565b6001016115a9565b50505050505050565b6000828152602081905260409020600101546116018161160b565b6106198383611699565b610ade8133612249565b61161f8282611063565b61069d576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556116553390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6116a38282611063565b1561069d576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000816080015161171383602001514261172c565b61171d9190612d65565b82604001516104a09190612d11565b600081831061173b57816104c4565b5090919050565b61174a611794565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60025460ff166117dd5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161068a565b565b6040516001600160a01b03831660248201526044810182905261061990849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526122ad565b61184a6118bd565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586117773390565b6040516001600160a01b03808516602483015283166044820152606481018290526118b79085906323b872dd60e01b9060840161180b565b50505050565b60025460ff16156117dd5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161068a565b3332146117dd573360009081526001602052604090205460ff166117dd5760405162461bcd60e51b815260206004820152601c60248201527f436f6e7472616374206d7573742062652077686974656c697374656400000000604482015260640161068a565b6001600160a01b0381166119905760405163d92e233d60e01b815260040160405180910390fd5b60405163a624ec6360e01b81526004810184905260009081906001600160a01b0385169063a624ec6390602401600060405180830381865afa1580156119da573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611a029190810190612e5f565b505050915091506000611a16858785611509565b90506000611a25868486611509565b60008381526004602052604090206003015490915060ff16611a59576040516273e5c360e31b815260040160405180910390fd5b6040516331a9108f60e11b81526004810188905233906001600160a01b03881690636352211e90602401602060405180830381865afa158015611aa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ac491906131f2565b6001600160a01b031614611aeb57604051632ac7b57160e21b815260040160405180910390fd5b60008181526005602052604081205490819003611b1b5760405163132fb52160e11b815260040160405180910390fd5b60008060008060005b85811015611c6657611b378789836106a1565b60008b815260056020526040902080549499509297509095509350869183908110611b6457611b64612ce5565b90600052602060002090600802016003018190555082600560008981526020019081526020016000208281548110611b9e57611b9e612ce5565b90600052602060002090600802016004018190555083600460008a81526020019081526020016000206001018281548110611bdb57611bdb612ce5565b906000526020600020016000828254611bf49190612d52565b90915550611c0e90506001600160a01b0383168c866117df565b60408051858152602081018f90526001600160a01b038e8116828401528416606082015290517f90314c06e8c15ef8e1ca994924db9011d45144e01e6a5816a24420caf87a04a19181900360800190a1600101611b24565b506040516342cf3e9960e11b8152600481018a905242906001600160a01b038d169063859e7d3290602401600060405180830381865afa158015611cae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611cd69190810190612f68565b6040015111611d1a57600087815260046020526040812090611cf882826126e9565b611d066001830160006126e9565b5060006002820155600301805460ff191690555b505050505050505050505050565b803b611d765760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206d757374206265206120636f6e7472616374000000000000604482015260640161068a565b6001600160a01b03811660009081526001602052604090205460ff1615611ddf5760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c72656164792077686974656c697374656400000000604482015260640161068a565b6001600160a01b0381166000818152600160208190526040808320805460ff1916909217909155517ffbd3cde7ff522a917e485c8ed2a6e87590887ab399f5ac312307903f498543079190a250565b60008381526005602052604081205490819003611e5e5760405163132fb52160e11b815260040160405180910390fd5b611e8b60405180608001604052806060815260200160608152602001600081526020016000151581525090565b611e9361269b565b600160608301526000836001600160401b03811115611eb457611eb4612ccf565b604051908082528060200260200182016040528015611edd578160200160208202803683370190505b508352836001600160401b03811115611ef857611ef8612ccf565b604051908082528060200260200182016040528015611f21578160200160208202803683370190505b506020840152604083018590526000805b8581101561212a576000898152600560205260409020805482908110611f5a57611f5a612ce5565b600091825260209182902060408051610100810182526008909302909101805483526001810154938301939093526002830154908201526003820154606082015260048201546080820152600582015460a0820152600682015460c08201526007909101546001600160a01b031660e08201529350611fd8846116fe565b92508360a0015160001461206e5760a084015160c0850151611ffa9085612d11565b6120049190612d30565b91508360600151826120169190612d52565b855180518390811061202a5761202a612ce5565b6020908102919091010152845180518290811061204957612049612ce5565b602002602001015184606001818152505061206842856020015161172c565b60808501525b868460a0018181516120809190612d52565b90525060008981526005602052604090208054859190839081106120a6576120a6612ce5565b60009182526020918290208351600892909202019081559082015160018083019190915560408301516002830155606083015160038301556080830151600483015560a0830151600583015560c0830151600683015560e090920151600790910180546001600160a01b0319166001600160a01b0390921691909117905501611f32565b506000878152600460209081526040909120855180518793612150928492910190612707565b5060208281015180516121699260018501920190612707565b50604082015160028201556060909101516003909101805460ff19169115159190911790555050505050505050565b6001600160a01b03811660009081526001602052604090205460ff166122005760405162461bcd60e51b815260206004820152601860248201527f436f6e7472616374206e6f742077686974656c69737465640000000000000000604482015260640161068a565b6001600160a01b038116600081815260016020526040808220805460ff19169055517f8e81447740597754af5db3e176253a36f7981a9549f48ace3f0cb233913f9d859190a250565b6122538282611063565b61069d5761226b816001600160a01b0316601461237f565b61227683602061237f565b604051602001612287929190613233565b60408051601f198184030181529082905262461bcd60e51b825261068a916004016132a8565b6000612302826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661251a9092919063ffffffff16565b805190915015610619578080602001905181019061232091906132db565b6106195760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161068a565b6060600061238e836002612d11565b612399906002612d52565b6001600160401b038111156123b0576123b0612ccf565b6040519080825280601f01601f1916602001820160405280156123da576020820181803683370190505b509050600360fc1b816000815181106123f5576123f5612ce5565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061242457612424612ce5565b60200101906001600160f81b031916908160001a9053506000612448846002612d11565b612453906001612d52565b90505b60018111156124cb576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061248757612487612ce5565b1a60f81b82828151811061249d5761249d612ce5565b60200101906001600160f81b031916908160001a90535060049490941c936124c4816132f8565b9050612456565b5083156104c45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161068a565b60606125298484600085612531565b949350505050565b6060824710156125925760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161068a565b6001600160a01b0385163b6125e95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161068a565b600080866001600160a01b03168587604051612605919061330f565b60006040518083038185875af1925050503d8060008114612642576040519150601f19603f3d011682016040523d82523d6000602084013e612647565b606091505b5091509150612657828286612662565b979650505050505050565b606083156126715750816104c4565b8251156126815782518084602001fd5b8160405162461bcd60e51b815260040161068a91906132a8565b6040518061010001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b5080546000825590600052602060002090810190610ade9190612752565b828054828255906000526020600020908101928215612742579160200282015b82811115612742578251825591602001919060010190612727565b5061274e929150612752565b5090565b5b8082111561274e5760008155600101612753565b60006020828403121561277957600080fd5b81356001600160e01b0319811681146104c457600080fd5b6001600160a01b0381168114610ade57600080fd5b6000806000606084860312156127bb57600080fd5b83356127c681612791565b95602085013595506040909401359392505050565b805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c083015260018060a01b0360e08201511660e08301525050565b6020808252825182820181905260009190848201906040850190845b81811015612874576128608385516127db565b92840192610100929092019160010161284d565b50909695505050505050565b60006020828403121561289257600080fd5b81356104c481612791565b6000602082840312156128af57600080fd5b5035919050565b600080604083850312156128c957600080fd5b8235915060208301356128db81612791565b809150509250929050565b6000806000606084860312156128fb57600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561292557600080fd5b823561293081612791565b946020939093013593505050565b600081518084526020808501945080840160005b8381101561296e57815187529582019590820190600101612952565b509495945050505050565b604080825283519082018190526000906020906060840190828701845b828110156129bb5781516001600160a01b031684529284019290840190600101612996565b505050838103828501526129cf818661293e565b9695505050505050565b6020815260008251608060208401526129f560a084018261293e565b90506020840151601f19848303016040850152612a12828261293e565b915050604084015160608401526060840151151560808401528091505092915050565b60008083601f840112612a4757600080fd5b5081356001600160401b03811115612a5e57600080fd5b6020830191508360208260051b8501011115612a7957600080fd5b9250929050565b8015158114610ade57600080fd5b600080600060408486031215612aa357600080fd5b83356001600160401b03811115612ab957600080fd5b612ac586828701612a35565b9094509250506020840135612ad981612a80565b809150509250925092565b60008060008060808587031215612afa57600080fd5b8435612b0581612791565b9350602085013592506040850135612b1c81612791565b9396929550929360600135925050565b600080600060608486031215612b4157600080fd5b8335612b4c81612791565b9250602084013591506040840135612ad981612791565b60008060008060608587031215612b7957600080fd5b84356001600160401b03811115612b8f57600080fd5b612b9b87828801612a35565b9095509350506020850135612baf81612791565b91506040850135612bbf81612791565b939692955090935050565b60008060008060008060808789031215612be357600080fd5b8635612bee81612791565b955060208701356001600160401b0380821115612c0a57600080fd5b612c168a838b01612a35565b909750955060408901359150612c2b82612791565b90935060608801359080821115612c4157600080fd5b50612c4e89828a01612a35565b979a9699509497509295939492505050565b600080600080600060808688031215612c7857600080fd5b8535612c8381612791565b945060208601356001600160401b03811115612c9e57600080fd5b612caa88828901612a35565b9095509350506040860135612cbe81612791565b949793965091946060013592915050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612d2b57612d2b612cfb565b500290565b600082612d4d57634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156104a0576104a0612cfb565b818103818111156104a0576104a0612cfb565b60405161016081016001600160401b0381118282101715612d9b57612d9b612ccf565b60405290565b604051601f8201601f191681016001600160401b0381118282101715612dc957612dc9612ccf565b604052919050565b60006001600160401b03821115612dea57612dea612ccf565b5060051b60200190565b600082601f830112612e0557600080fd5b81516020612e1a612e1583612dd1565b612da1565b82815260059290921b84018101918181019086841115612e3957600080fd5b8286015b84811015612e545780518352918301918301612e3d565b509695505050505050565b600080600080600060a08688031215612e7757600080fd5b8551945060208601519350604086015192506060860151915060808601516001600160401b03811115612ea957600080fd5b612eb588828901612df4565b9150509295509295909350565b600060208284031215612ed457600080fd5b5051919050565b600060018201612eed57612eed612cfb565b5060010190565b8051612eff81612a80565b919050565b600082601f830112612f1557600080fd5b81516020612f25612e1583612dd1565b82815260059290921b84018101918181019086841115612f4457600080fd5b8286015b84811015612e54578051612f5b81612791565b8352918301918301612f48565b600060208284031215612f7a57600080fd5b81516001600160401b0380821115612f9157600080fd5b908301906101608286031215612fa657600080fd5b612fae612d78565b612fb783612ef4565b81526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e08301518281111561300757600080fd5b61301387828601612df4565b60e083015250610100808401518381111561302d57600080fd5b61303988828701612df4565b828401525050610120808401518381111561305357600080fd5b61305f88828701612df4565b828401525050610140808401518381111561307957600080fd5b61308588828701612f04565b918301919091525095945050505050565b600181815b808511156130d15781600019048211156130b7576130b7612cfb565b808516156130c457918102915b93841c939080029061309b565b509250929050565b6000826130e8575060016104a0565b816130f5575060006104a0565b816001811461310b576002811461311557613131565b60019150506104a0565b60ff84111561312657613126612cfb565b50506001821b6104a0565b5060208310610133831016604e8410600b8410161715613154575081810a6104a0565b61315e8383613096565b806000190482111561317257613172612cfb565b029392505050565b60006104c483836130d9565b6001600160a01b0385168152602081018490526040810183905261016081016131b260608301846127db565b95945050505050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561320457600080fd5b81516104c481612791565b60005b8381101561322a578181015183820152602001613212565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161326b81601785016020880161320f565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161329c81602884016020880161320f565b01602801949350505050565b60208152600082518060208401526132c781604085016020870161320f565b601f01601f19169190910160400192915050565b6000602082840312156132ed57600080fd5b81516104c481612a80565b60008161330757613307612cfb565b506000190190565b6000825161332181846020870161320f565b919091019291505056fea26469706673582212201477dc3183297a1cb2175e9c4f1dfc649d6b17ef7e8a9e5a8bdc0fa17ab51fae64736f6c63430008100033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80638456cb59116100f9578063adc9772e11610097578063c3d9ed3911610071578063c3d9ed39146103ff578063d3d0291c14610412578063d547741f14610425578063ec87621c1461043857600080fd5b8063adc9772e146103c6578063b4a70f90146103d9578063c3106663146103ec57600080fd5b80639e96a260116100d35780639e96a260146103855780639f0977ff14610398578063a217fddf146103ab578063acc3a006146103b357600080fd5b80638456cb59146103575780638618cb071461035f57806391d148541461037257600080fd5b8063391feebb116101665780633f4ba83a116101405780633f4ba83a1461031157806354518b94146103195780635c975abb146103395780637c4b52cb1461034457600080fd5b8063391feebb146102915780633d5dac89146102b45780633e491d47146102f057600080fd5b80632377da3a116101a25780632377da3a14610225578063248a9ca3146102385780632f2ff15d1461026957806336568abe1461027e57600080fd5b806301ffc9a7146101c957806311534e31146101f15780631627905514610211575b600080fd5b6101dc6101d7366004612767565b61046f565b60405190151581526020015b60405180910390f35b6102046101ff3660046127a6565b6104a6565b6040516101e89190612831565b6101dc61021f366004612880565b3b151590565b61020461023336600461289d565b6104cb565b61025b61024636600461289d565b60009081526020819052604090206001015490565b6040519081526020016101e8565b61027c6102773660046128b6565b6105f4565b005b61027c61028c3660046128b6565b61061e565b6101dc61029f366004612880565b60016020526000908152604090205460ff1681565b6102c76102c23660046128e6565b6106a1565b604080519485526020850193909352918301526001600160a01b031660608201526080016101e8565b6103036102fe366004612912565b6108ed565b6040516101e8929190612979565b61027c610acb565b61032c61032736600461289d565b610ae1565b6040516101e891906129d9565b60025460ff166101dc565b6101dc610352366004612a8e565b610bef565b61027c610d3f565b61027c61036d366004612ae4565b610d52565b6101dc6103803660046128b6565b611063565b61027c610393366004612b2c565b61108c565b61027c6103a6366004612b63565b6110d8565b61025b600081565b61027c6103c1366004612880565b611149565b61027c6103d4366004612912565b61115d565b61027c6103e7366004612bca565b611476565b61025b6103fa3660046127a6565b611509565b61027c61040d366004612880565b611558565b61027c610420366004612c60565b61156c565b61027c6104333660046128b6565b6115e6565b61025b6040516b4d414e414745525f524f4c4560a01b6020820152602c016040516020818303038152906040528051906020012081565b60006001600160e01b03198216637965db0b60e01b14806104a057506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060006104b5858585611509565b90506104c0816104cb565b9150505b9392505050565b6000818152600560205260409020546060906001600160401b038111156104f4576104f4612ccf565b60405190808252806020026020018201604052801561052d57816020015b61051a61269b565b8152602001906001900390816105125790505b50905060056000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156105e957600084815260209081902060408051610100810182526008860290920180548352600180820154848601526002820154928401929092526003810154606084015260048101546080840152600581015460a0840152600681015460c0840152600701546001600160a01b031660e08301529083529092019101610563565b505050509050919050565b60008281526020819052604090206001015461060f8161160b565b6106198383611615565b505050565b6001600160a01b03811633146106935760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61069d8282611699565b5050565b60008281526004602090815260408083208151815460a0948102820185019093526080810183815285948594859485949390928492849184018282801561070757602002820191906000526020600020905b8154815260200190600101908083116106f3575b505050505081526020016001820180548060200260200160405190810160405280929190818152602001828054801561075f57602002820191906000526020600020905b81548152602001906001019080831161074b575b5050509183525050600282015460208083019190915260039092015460ff16151560409182015260008b81526005909252812080549293509091889081106107a9576107a9612ce5565b6000918252602080832060408051610100810182526008909402909101805484526001810154928401929092526002820154908301526003810154606083015260048101546080830152600581015460a0830152600681015460c0830152600701546001600160a01b031660e08201529150610824826116fe565b90508160a001518260c001518261083b9190612d11565b6108459190612d30565b96508682606001516108579190612d52565b96508260200151888151811061086f5761086f612ce5565b60200260200101518260c00151846040015185600001518b8151811061089757610897612ce5565b60200260200101518a6108aa9190612d65565b6108b49190612d11565b6108be9190612d30565b6108c89190612d65565b95508160e0015193506108df82602001514261172c565b945050505093509350935093565b606080600080856001600160a01b031663a624ec63866040518263ffffffff1660e01b815260040161092191815260200190565b600060405180830381865afa15801561093e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526109669190810190612e5f565b50505091509150600061097a878785611509565b60008181526004602052604090206003015490915060ff1615610ac15760006109a4888486611509565b600081815260056020526040902054909150806001600160401b038111156109ce576109ce612ccf565b6040519080825280602002602001820160405280156109f7578160200160208202803683370190505b509650806001600160401b03811115610a1257610a12612ccf565b604051908082528060200260200182016040528015610a3b578160200160208202803683370190505b50955060008060005b83811015610abb57610a578587836106a1565b8d519096509194508592508c918491508110610a7557610a75612ce5565b60200260200101906001600160a01b031690816001600160a01b03168152505081898281518110610aa857610aa8612ce5565b6020908102919091010152600101610a44565b50505050505b5050509250929050565b6000610ad68161160b565b610ade611742565b50565b610b0e60405180608001604052806060815260200160608152602001600081526020016000151581525090565b6000828152600460209081526040918290208251815460a093810282018401909452608081018481529093919284928491840182828015610b6e57602002820191906000526020600020905b815481526020019060010190808311610b5a575b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015610bc657602002820191906000526020600020905b815481526020019060010190808311610bb2575b50505091835250506002820154602082015260039091015460ff16151560409091015292915050565b6000610bf9611794565b6000610c048161160b565b8215610c385760405133904780156108fc02916000818181858888f19350505050158015610c36573d6000803e3d6000fd5b505b6000805b85811015610cff57868682818110610c5657610c56612ce5565b9050602002016020810190610c6b9190612880565b6040516370a0823160e01b8152306004820152909250610ced9033906001600160a01b038516906370a0823190602401602060405180830381865afa158015610cb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdc9190612ec2565b6001600160a01b03851691906117df565b80610cf781612edb565b915050610c3c565b506040513381527f5e7b34819cd91b239220bec92fcfd3c10da2214ba13e4e2b1f6c9cfdbd68a9a29060200160405180910390a150600195945050505050565b6000610d4a8161160b565b610ade611842565b6040516b4d414e414745525f524f4c4560a01b6020820152602c0160405160208183030381529060405280519060200120610d8c8161160b565b6001600160a01b038316610db35760405163d92e233d60e01b815260040160405180910390fd5b600085905060008490506000826001600160a01b031663766718086040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dfd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e219190612ec2565b90506000610e30898984611509565b9050610e3a61269b565b6040516342cf3e9960e11b8152600481018490526001600160a01b0386169063859e7d3290602401600060405180830381865afa158015610e7f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ea79190810190612f68565b60400151602082018190524210610ed157604051630f67808360e01b815260040160405180910390fd5b8681526001600160a01b03841660e082015242608082018190526020820151610efa9190612d65565b610f049088612d30565b8160400181815250508060e001516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f739190612ec2565b610f7e90600a61317a565b60c08201908152600083815260056020818152604080842080546001808201835591865294839020875160089096020194855591860151918401919091558401516002830155606084015160038301556080840151600483015560a0840151908201559051600682015560e0820151600790910180546001600160a01b0319166001600160a01b0392831617905561101a90851633308a61187f565b7fa4ac734167c34e86ff603fa0800735c95cc7dc732d120899a38932737295d28f8a8a858460405161104f9493929190613186565b60405180910390a150505050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6110946118bd565b6002600354036110b65760405162461bcd60e51b815260040161068a906131bb565b60026003556110c3611903565b6110ce828483611969565b5050600160035550565b6110e06118bd565b6002600354036111025760405162461bcd60e51b815260040161068a906131bb565b600260035560005b8381101561113d5761113585858381811061112757611127612ce5565b905060200201358484611969565b60010161110a565b50506001600355505050565b60006111548161160b565b61069d82611d28565b6111656118bd565b6002600354036111875760405162461bcd60e51b815260040161068a906131bb565b6002600355611194611903565b6040516331a9108f60e11b815260048101829052829033906001600160a01b03831690636352211e90602401602060405180830381865afa1580156111dd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061120191906131f2565b6001600160a01b03161461122857604051632ac7b57160e21b815260040160405180910390fd5b6000816001600160a01b031663766718086040518163ffffffff1660e01b8152600401602060405180830381865afa158015611268573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128c9190612ec2565b90506000806000846001600160a01b031663a624ec63876040518263ffffffff1660e01b81526004016112c191815260200190565b600060405180830381865afa1580156112de573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113069190810190612e5f565b505092509250925083831461132e57604051636ea8a2eb60e11b815260040160405180910390fd5b6040516342cf3e9960e11b81526004810184905242906001600160a01b0387169063859e7d3290602401600060405180830381865afa158015611375573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261139d9190810190612f68565b60400151116113bf57604051630f67808360e01b815260040160405180910390fd5b60006113cc888886611509565b905060006113db898587611509565b60008381526004602052604090206003015490915060ff1615611411576040516389d351b560e01b815260040160405180910390fd5b61141c818385611e2e565b604080516001600160a01b038b168152602081018a90529081018490527ffc9e282e32af519d40f3848e43fa35f3624518c97323a52c9455399b7c22f26c9060600160405180910390a15050600160035550505050505050565b6040516b4d414e414745525f524f4c4560a01b6020820152602c01604051602081830303815290604052805190602001206114b08161160b565b60005b858110156114ff576114f7888888848181106114d1576114d1612ce5565b90506020020135878787868181106114eb576114eb612ce5565b90506020020135610d52565b6001016114b3565b5050505050505050565b6040516bffffffffffffffffffffffff19606085901b16602082015260348101839052605481018290526000906074016040516020818303038152906040528051906020012090509392505050565b60006115638161160b565b61069d82612198565b6040516b4d414e414745525f524f4c4560a01b6020820152602c01604051602081830303815290604052805190602001206115a68161160b565b60005b848110156115dd576115d5878787848181106115c7576115c7612ce5565b905060200201358686610d52565b6001016115a9565b50505050505050565b6000828152602081905260409020600101546116018161160b565b6106198383611699565b610ade8133612249565b61161f8282611063565b61069d576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556116553390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6116a38282611063565b1561069d576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000816080015161171383602001514261172c565b61171d9190612d65565b82604001516104a09190612d11565b600081831061173b57816104c4565b5090919050565b61174a611794565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60025460ff166117dd5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161068a565b565b6040516001600160a01b03831660248201526044810182905261061990849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526122ad565b61184a6118bd565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586117773390565b6040516001600160a01b03808516602483015283166044820152606481018290526118b79085906323b872dd60e01b9060840161180b565b50505050565b60025460ff16156117dd5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161068a565b3332146117dd573360009081526001602052604090205460ff166117dd5760405162461bcd60e51b815260206004820152601c60248201527f436f6e7472616374206d7573742062652077686974656c697374656400000000604482015260640161068a565b6001600160a01b0381166119905760405163d92e233d60e01b815260040160405180910390fd5b60405163a624ec6360e01b81526004810184905260009081906001600160a01b0385169063a624ec6390602401600060405180830381865afa1580156119da573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611a029190810190612e5f565b505050915091506000611a16858785611509565b90506000611a25868486611509565b60008381526004602052604090206003015490915060ff16611a59576040516273e5c360e31b815260040160405180910390fd5b6040516331a9108f60e11b81526004810188905233906001600160a01b03881690636352211e90602401602060405180830381865afa158015611aa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ac491906131f2565b6001600160a01b031614611aeb57604051632ac7b57160e21b815260040160405180910390fd5b60008181526005602052604081205490819003611b1b5760405163132fb52160e11b815260040160405180910390fd5b60008060008060005b85811015611c6657611b378789836106a1565b60008b815260056020526040902080549499509297509095509350869183908110611b6457611b64612ce5565b90600052602060002090600802016003018190555082600560008981526020019081526020016000208281548110611b9e57611b9e612ce5565b90600052602060002090600802016004018190555083600460008a81526020019081526020016000206001018281548110611bdb57611bdb612ce5565b906000526020600020016000828254611bf49190612d52565b90915550611c0e90506001600160a01b0383168c866117df565b60408051858152602081018f90526001600160a01b038e8116828401528416606082015290517f90314c06e8c15ef8e1ca994924db9011d45144e01e6a5816a24420caf87a04a19181900360800190a1600101611b24565b506040516342cf3e9960e11b8152600481018a905242906001600160a01b038d169063859e7d3290602401600060405180830381865afa158015611cae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611cd69190810190612f68565b6040015111611d1a57600087815260046020526040812090611cf882826126e9565b611d066001830160006126e9565b5060006002820155600301805460ff191690555b505050505050505050505050565b803b611d765760405162461bcd60e51b815260206004820152601a60248201527f41646472657373206d757374206265206120636f6e7472616374000000000000604482015260640161068a565b6001600160a01b03811660009081526001602052604090205460ff1615611ddf5760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c72656164792077686974656c697374656400000000604482015260640161068a565b6001600160a01b0381166000818152600160208190526040808320805460ff1916909217909155517ffbd3cde7ff522a917e485c8ed2a6e87590887ab399f5ac312307903f498543079190a250565b60008381526005602052604081205490819003611e5e5760405163132fb52160e11b815260040160405180910390fd5b611e8b60405180608001604052806060815260200160608152602001600081526020016000151581525090565b611e9361269b565b600160608301526000836001600160401b03811115611eb457611eb4612ccf565b604051908082528060200260200182016040528015611edd578160200160208202803683370190505b508352836001600160401b03811115611ef857611ef8612ccf565b604051908082528060200260200182016040528015611f21578160200160208202803683370190505b506020840152604083018590526000805b8581101561212a576000898152600560205260409020805482908110611f5a57611f5a612ce5565b600091825260209182902060408051610100810182526008909302909101805483526001810154938301939093526002830154908201526003820154606082015260048201546080820152600582015460a0820152600682015460c08201526007909101546001600160a01b031660e08201529350611fd8846116fe565b92508360a0015160001461206e5760a084015160c0850151611ffa9085612d11565b6120049190612d30565b91508360600151826120169190612d52565b855180518390811061202a5761202a612ce5565b6020908102919091010152845180518290811061204957612049612ce5565b602002602001015184606001818152505061206842856020015161172c565b60808501525b868460a0018181516120809190612d52565b90525060008981526005602052604090208054859190839081106120a6576120a6612ce5565b60009182526020918290208351600892909202019081559082015160018083019190915560408301516002830155606083015160038301556080830151600483015560a0830151600583015560c0830151600683015560e090920151600790910180546001600160a01b0319166001600160a01b0390921691909117905501611f32565b506000878152600460209081526040909120855180518793612150928492910190612707565b5060208281015180516121699260018501920190612707565b50604082015160028201556060909101516003909101805460ff19169115159190911790555050505050505050565b6001600160a01b03811660009081526001602052604090205460ff166122005760405162461bcd60e51b815260206004820152601860248201527f436f6e7472616374206e6f742077686974656c69737465640000000000000000604482015260640161068a565b6001600160a01b038116600081815260016020526040808220805460ff19169055517f8e81447740597754af5db3e176253a36f7981a9549f48ace3f0cb233913f9d859190a250565b6122538282611063565b61069d5761226b816001600160a01b0316601461237f565b61227683602061237f565b604051602001612287929190613233565b60408051601f198184030181529082905262461bcd60e51b825261068a916004016132a8565b6000612302826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661251a9092919063ffffffff16565b805190915015610619578080602001905181019061232091906132db565b6106195760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161068a565b6060600061238e836002612d11565b612399906002612d52565b6001600160401b038111156123b0576123b0612ccf565b6040519080825280601f01601f1916602001820160405280156123da576020820181803683370190505b509050600360fc1b816000815181106123f5576123f5612ce5565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061242457612424612ce5565b60200101906001600160f81b031916908160001a9053506000612448846002612d11565b612453906001612d52565b90505b60018111156124cb576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061248757612487612ce5565b1a60f81b82828151811061249d5761249d612ce5565b60200101906001600160f81b031916908160001a90535060049490941c936124c4816132f8565b9050612456565b5083156104c45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161068a565b60606125298484600085612531565b949350505050565b6060824710156125925760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161068a565b6001600160a01b0385163b6125e95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161068a565b600080866001600160a01b03168587604051612605919061330f565b60006040518083038185875af1925050503d8060008114612642576040519150601f19603f3d011682016040523d82523d6000602084013e612647565b606091505b5091509150612657828286612662565b979650505050505050565b606083156126715750816104c4565b8251156126815782518084602001fd5b8160405162461bcd60e51b815260040161068a91906132a8565b6040518061010001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b5080546000825590600052602060002090810190610ade9190612752565b828054828255906000526020600020908101928215612742579160200282015b82811115612742578251825591602001919060010190612727565b5061274e929150612752565b5090565b5b8082111561274e5760008155600101612753565b60006020828403121561277957600080fd5b81356001600160e01b0319811681146104c457600080fd5b6001600160a01b0381168114610ade57600080fd5b6000806000606084860312156127bb57600080fd5b83356127c681612791565b95602085013595506040909401359392505050565b805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c083015260018060a01b0360e08201511660e08301525050565b6020808252825182820181905260009190848201906040850190845b81811015612874576128608385516127db565b92840192610100929092019160010161284d565b50909695505050505050565b60006020828403121561289257600080fd5b81356104c481612791565b6000602082840312156128af57600080fd5b5035919050565b600080604083850312156128c957600080fd5b8235915060208301356128db81612791565b809150509250929050565b6000806000606084860312156128fb57600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561292557600080fd5b823561293081612791565b946020939093013593505050565b600081518084526020808501945080840160005b8381101561296e57815187529582019590820190600101612952565b509495945050505050565b604080825283519082018190526000906020906060840190828701845b828110156129bb5781516001600160a01b031684529284019290840190600101612996565b505050838103828501526129cf818661293e565b9695505050505050565b6020815260008251608060208401526129f560a084018261293e565b90506020840151601f19848303016040850152612a12828261293e565b915050604084015160608401526060840151151560808401528091505092915050565b60008083601f840112612a4757600080fd5b5081356001600160401b03811115612a5e57600080fd5b6020830191508360208260051b8501011115612a7957600080fd5b9250929050565b8015158114610ade57600080fd5b600080600060408486031215612aa357600080fd5b83356001600160401b03811115612ab957600080fd5b612ac586828701612a35565b9094509250506020840135612ad981612a80565b809150509250925092565b60008060008060808587031215612afa57600080fd5b8435612b0581612791565b9350602085013592506040850135612b1c81612791565b9396929550929360600135925050565b600080600060608486031215612b4157600080fd5b8335612b4c81612791565b9250602084013591506040840135612ad981612791565b60008060008060608587031215612b7957600080fd5b84356001600160401b03811115612b8f57600080fd5b612b9b87828801612a35565b9095509350506020850135612baf81612791565b91506040850135612bbf81612791565b939692955090935050565b60008060008060008060808789031215612be357600080fd5b8635612bee81612791565b955060208701356001600160401b0380821115612c0a57600080fd5b612c168a838b01612a35565b909750955060408901359150612c2b82612791565b90935060608801359080821115612c4157600080fd5b50612c4e89828a01612a35565b979a9699509497509295939492505050565b600080600080600060808688031215612c7857600080fd5b8535612c8381612791565b945060208601356001600160401b03811115612c9e57600080fd5b612caa88828901612a35565b9095509350506040860135612cbe81612791565b949793965091946060013592915050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612d2b57612d2b612cfb565b500290565b600082612d4d57634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156104a0576104a0612cfb565b818103818111156104a0576104a0612cfb565b60405161016081016001600160401b0381118282101715612d9b57612d9b612ccf565b60405290565b604051601f8201601f191681016001600160401b0381118282101715612dc957612dc9612ccf565b604052919050565b60006001600160401b03821115612dea57612dea612ccf565b5060051b60200190565b600082601f830112612e0557600080fd5b81516020612e1a612e1583612dd1565b612da1565b82815260059290921b84018101918181019086841115612e3957600080fd5b8286015b84811015612e545780518352918301918301612e3d565b509695505050505050565b600080600080600060a08688031215612e7757600080fd5b8551945060208601519350604086015192506060860151915060808601516001600160401b03811115612ea957600080fd5b612eb588828901612df4565b9150509295509295909350565b600060208284031215612ed457600080fd5b5051919050565b600060018201612eed57612eed612cfb565b5060010190565b8051612eff81612a80565b919050565b600082601f830112612f1557600080fd5b81516020612f25612e1583612dd1565b82815260059290921b84018101918181019086841115612f4457600080fd5b8286015b84811015612e54578051612f5b81612791565b8352918301918301612f48565b600060208284031215612f7a57600080fd5b81516001600160401b0380821115612f9157600080fd5b908301906101608286031215612fa657600080fd5b612fae612d78565b612fb783612ef4565b81526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e08301518281111561300757600080fd5b61301387828601612df4565b60e083015250610100808401518381111561302d57600080fd5b61303988828701612df4565b828401525050610120808401518381111561305357600080fd5b61305f88828701612df4565b828401525050610140808401518381111561307957600080fd5b61308588828701612f04565b918301919091525095945050505050565b600181815b808511156130d15781600019048211156130b7576130b7612cfb565b808516156130c457918102915b93841c939080029061309b565b509250929050565b6000826130e8575060016104a0565b816130f5575060006104a0565b816001811461310b576002811461311557613131565b60019150506104a0565b60ff84111561312657613126612cfb565b50506001821b6104a0565b5060208310610133831016604e8410600b8410161715613154575081810a6104a0565b61315e8383613096565b806000190482111561317257613172612cfb565b029392505050565b60006104c483836130d9565b6001600160a01b0385168152602081018490526040810183905261016081016131b260608301846127db565b95945050505050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561320457600080fd5b81516104c481612791565b60005b8381101561322a578181015183820152602001613212565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161326b81601785016020880161320f565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161329c81602884016020880161320f565b01602801949350505050565b60208152600082518060208401526132c781604085016020870161320f565b601f01601f19169190910160400192915050565b6000602082840312156132ed57600080fd5b81516104c481612a80565b60008161330757613307612cfb565b506000190190565b6000825161332181846020870161320f565b919091019291505056fea26469706673582212201477dc3183297a1cb2175e9c4f1dfc649d6b17ef7e8a9e5a8bdc0fa17ab51fae64736f6c63430008100033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$50.23
Net Worth in ETH
0.021044
Token Allocations
ARB
100.00%
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ARB | 100.00% | $0.138518 | 362.6032 | $50.23 |
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.