Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
Distributor
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0-only /* Distributor.sol - SKALE Manager Copyright (C) 2019-Present SKALE Labs @author Dmytro Stebaiev SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SKALE Manager is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. */ pragma solidity 0.8.11; import "@openzeppelin/contracts/utils/introspection/IERC1820Registry.sol"; import "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@skalenetwork/skale-manager-interfaces/delegation/IDistributor.sol"; import "@skalenetwork/skale-manager-interfaces/delegation/IValidatorService.sol"; import "@skalenetwork/skale-manager-interfaces/delegation/IDelegationController.sol"; import "@skalenetwork/skale-manager-interfaces/delegation/ITimeHelpers.sol"; import "../Permissions.sol"; import "../ConstantsHolder.sol"; import "../utils/MathUtils.sol"; /** * @title Distributor * @dev This contract handles all distribution functions of bounty and fee * payments. */ contract Distributor is Permissions, IERC777Recipient, IDistributor { using MathUtils for uint; IERC1820Registry private _erc1820; // validatorId => month => token mapping (uint => mapping (uint => uint)) private _bountyPaid; // validatorId => month => token mapping (uint => mapping (uint => uint)) private _feePaid; // holder => validatorId => month mapping (address => mapping (uint => uint)) private _firstUnwithdrawnMonth; // validatorId => month mapping (uint => uint) private _firstUnwithdrawnMonthForValidator; /** * @dev Return and update the amount of earned bounty from a validator. */ function getAndUpdateEarnedBountyAmount(uint validatorId) external override returns (uint earned, uint endMonth) { return getAndUpdateEarnedBountyAmountOf(msg.sender, validatorId); } /** * @dev Allows msg.sender to withdraw earned bounty. Bounties are locked * until launchTimestamp and BOUNTY_LOCKUP_MONTHS have both passed. * * Emits a {WithdrawBounty} event. * * Requirements: * * - Bounty must be unlocked. */ function withdrawBounty(uint validatorId, address to) external override { ITimeHelpers timeHelpers = ITimeHelpers(contractManager.getContract("TimeHelpers")); ConstantsHolder constantsHolder = ConstantsHolder(contractManager.getContract("ConstantsHolder")); require(block.timestamp >= timeHelpers.addMonths( constantsHolder.launchTimestamp(), constantsHolder.BOUNTY_LOCKUP_MONTHS() ), "Bounty is locked"); uint bounty; uint endMonth; (bounty, endMonth) = getAndUpdateEarnedBountyAmountOf(msg.sender, validatorId); _firstUnwithdrawnMonth[msg.sender][validatorId] = endMonth; IERC20 skaleToken = IERC20(contractManager.getContract("SkaleToken")); require(skaleToken.transfer(to, bounty), "Failed to transfer tokens"); emit WithdrawBounty( msg.sender, validatorId, to, bounty ); } /** * @dev Allows `msg.sender` to withdraw earned validator fees. Fees are * locked until launchTimestamp and BOUNTY_LOCKUP_MONTHS both have passed. * * Emits a {WithdrawFee} event. * * Requirements: * * - Fee must be unlocked. */ function withdrawFee(address to) external override { IValidatorService validatorService = IValidatorService(contractManager.getContract("ValidatorService")); IERC20 skaleToken = IERC20(contractManager.getContract("SkaleToken")); ITimeHelpers timeHelpers = ITimeHelpers(contractManager.getContract("TimeHelpers")); ConstantsHolder constantsHolder = ConstantsHolder(contractManager.getContract("ConstantsHolder")); require(block.timestamp >= timeHelpers.addMonths( constantsHolder.launchTimestamp(), constantsHolder.BOUNTY_LOCKUP_MONTHS() ), "Fee is locked"); // check Validator Exist inside getValidatorId uint validatorId = validatorService.getValidatorId(msg.sender); uint fee; uint endMonth; (fee, endMonth) = getEarnedFeeAmountOf(validatorId); _firstUnwithdrawnMonthForValidator[validatorId] = endMonth; require(skaleToken.transfer(to, fee), "Failed to transfer tokens"); emit WithdrawFee( validatorId, to, fee ); } function tokensReceived( address, address, address to, uint256 amount, bytes calldata userData, bytes calldata ) external override allow("SkaleToken") { require(to == address(this), "Receiver is incorrect"); require(userData.length == 32, "Data length is incorrect"); uint validatorId = abi.decode(userData, (uint)); _distributeBounty(amount, validatorId); } /** * @dev Return the amount of earned validator fees of `msg.sender`. */ function getEarnedFeeAmount() external view override returns (uint earned, uint endMonth) { IValidatorService validatorService = IValidatorService(contractManager.getContract("ValidatorService")); return getEarnedFeeAmountOf(validatorService.getValidatorId(msg.sender)); } function initialize(address contractsAddress) public override initializer { Permissions.initialize(contractsAddress); _erc1820 = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24); _erc1820.setInterfaceImplementer(address(this), keccak256("ERC777TokensRecipient"), address(this)); } /** * @dev Return and update the amount of earned bounties. */ function getAndUpdateEarnedBountyAmountOf(address wallet, uint validatorId) public override returns (uint earned, uint endMonth) { IDelegationController delegationController = IDelegationController( contractManager.getContract("DelegationController")); ITimeHelpers timeHelpers = ITimeHelpers(contractManager.getContract("TimeHelpers")); uint currentMonth = timeHelpers.getCurrentMonth(); uint startMonth = _firstUnwithdrawnMonth[wallet][validatorId]; if (startMonth == 0) { startMonth = delegationController.getFirstDelegationMonth(wallet, validatorId); if (startMonth == 0) { return (0, 0); } } earned = 0; endMonth = currentMonth; if (endMonth > startMonth + 12) { endMonth = startMonth + 12; } for (uint i = startMonth; i < endMonth; ++i) { uint effectiveDelegatedToValidator = delegationController.getAndUpdateEffectiveDelegatedToValidator(validatorId, i); if (effectiveDelegatedToValidator.muchGreater(0)) { earned = earned + _bountyPaid[validatorId][i] * delegationController.getAndUpdateEffectiveDelegatedByHolderToValidator(wallet, validatorId, i) / effectiveDelegatedToValidator; } } } /** * @dev Return the amount of earned fees by validator ID. */ function getEarnedFeeAmountOf(uint validatorId) public view override returns (uint earned, uint endMonth) { ITimeHelpers timeHelpers = ITimeHelpers(contractManager.getContract("TimeHelpers")); uint currentMonth = timeHelpers.getCurrentMonth(); uint startMonth = _firstUnwithdrawnMonthForValidator[validatorId]; if (startMonth == 0) { return (0, 0); } earned = 0; endMonth = currentMonth; if (endMonth > startMonth + 12) { endMonth = startMonth + 12; } for (uint i = startMonth; i < endMonth; ++i) { earned = earned + _feePaid[validatorId][i]; } } // private /** * @dev Distributes bounties to delegators. * * Emits a {BountyWasPaid} event. */ function _distributeBounty(uint amount, uint validatorId) private { ITimeHelpers timeHelpers = ITimeHelpers(contractManager.getContract("TimeHelpers")); IValidatorService validatorService = IValidatorService(contractManager.getContract("ValidatorService")); uint currentMonth = timeHelpers.getCurrentMonth(); uint feeRate = validatorService.getValidator(validatorId).feeRate; uint fee = amount * feeRate / 1000; uint bounty = amount - fee; _bountyPaid[validatorId][currentMonth] = _bountyPaid[validatorId][currentMonth] + bounty; _feePaid[validatorId][currentMonth] = _feePaid[validatorId][currentMonth] + fee; if (_firstUnwithdrawnMonthForValidator[validatorId] == 0) { _firstUnwithdrawnMonthForValidator[validatorId] = currentMonth; } emit BountyWasPaid(validatorId, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC1820Registry.sol) pragma solidity ^0.8.0; /** * @dev Interface of the global ERC1820 Registry, as defined in the * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register * implementers for interfaces in this registry, as well as query support. * * Implementers may be shared by multiple accounts, and can also implement more * than a single interface for each account. Contracts can implement interfaces * for themselves, but externally-owned accounts (EOA) must delegate this to a * contract. * * {IERC165} interfaces can also be queried via the registry. * * For an in-depth explanation and source code analysis, see the EIP text. */ interface IERC1820Registry { /** * @dev Sets `newManager` as the manager for `account`. A manager of an * account is able to set interface implementers for it. * * By default, each account is its own manager. Passing a value of `0x0` in * `newManager` will reset the manager to this initial state. * * Emits a {ManagerChanged} event. * * Requirements: * * - the caller must be the current manager for `account`. */ function setManager(address account, address newManager) external; /** * @dev Returns the manager for `account`. * * See {setManager}. */ function getManager(address account) external view returns (address); /** * @dev Sets the `implementer` contract as ``account``'s implementer for * `interfaceHash`. * * `account` being the zero address is an alias for the caller's address. * The zero address can also be used in `implementer` to remove an old one. * * See {interfaceHash} to learn how these are created. * * Emits an {InterfaceImplementerSet} event. * * Requirements: * * - the caller must be the current manager for `account`. * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not * end in 28 zeroes). * - `implementer` must implement {IERC1820Implementer} and return true when * queried for support, unless `implementer` is the caller. See * {IERC1820Implementer-canImplementInterfaceForAddress}. */ function setInterfaceImplementer( address account, bytes32 _interfaceHash, address implementer ) external; /** * @dev Returns the implementer of `interfaceHash` for `account`. If no such * implementer is registered, returns the zero address. * * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28 * zeroes), `account` will be queried for support of it. * * `account` being the zero address is an alias for the caller's address. */ function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address); /** * @dev Returns the interface hash for an `interfaceName`, as defined in the * corresponding * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP]. */ function interfaceHash(string calldata interfaceName) external pure returns (bytes32); /** * @notice Updates the cache with whether the contract implements an ERC165 interface or not. * @param account Address of the contract for which to update the cache. * @param interfaceId ERC165 interface for which to update the cache. */ function updateERC165Cache(address account, bytes4 interfaceId) external; /** * @notice Checks whether a contract implements an ERC165 interface or not. * If the result is not cached a direct lookup on the contract address is performed. * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling * {updateERC165Cache} with the contract address. * @param account Address of the contract to check. * @param interfaceId ERC165 interface to check. * @return True if `account` implements `interfaceId`, false otherwise. */ function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool); /** * @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache. * @param account Address of the contract to check. * @param interfaceId ERC165 interface to check. * @return True if `account` implements `interfaceId`, false otherwise. */ function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool); event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer); event ManagerChanged(address indexed account, address indexed newManager); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP. * * Accounts can be notified of {IERC777} tokens being sent to them by having a * contract implement this interface (contract holders can be their own * implementer) and registering it on the * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry]. * * See {IERC1820Registry} and {ERC1820Implementer}. */ interface IERC777Recipient { /** * @dev Called by an {IERC777} token contract whenever tokens are being * moved or created into a registered account (`to`). The type of operation * is conveyed by `from` being the zero address or not. * * This call occurs _after_ the token contract's state is updated, so * {IERC777-balanceOf}, etc., can be used to query the post-operation state. * * This function may revert to prevent the operation from being executed. */ function tokensReceived( address operator, address from, address to, uint256 amount, bytes calldata userData, bytes calldata operatorData ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: AGPL-3.0-only /* IDistributor.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Artem Payvin SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SKALE Manager is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. */ pragma solidity >=0.6.10 <0.9.0; interface IDistributor { /** * @dev Emitted when bounty is withdrawn. */ event WithdrawBounty( address holder, uint validatorId, address destination, uint amount ); /** * @dev Emitted when a validator fee is withdrawn. */ event WithdrawFee( uint validatorId, address destination, uint amount ); /** * @dev Emitted when bounty is distributed. */ event BountyWasPaid( uint validatorId, uint amount ); function getAndUpdateEarnedBountyAmount(uint validatorId) external returns (uint earned, uint endMonth); function withdrawBounty(uint validatorId, address to) external; function withdrawFee(address to) external; function getAndUpdateEarnedBountyAmountOf(address wallet, uint validatorId) external returns (uint earned, uint endMonth); function getEarnedFeeAmount() external view returns (uint earned, uint endMonth); function getEarnedFeeAmountOf(uint validatorId) external view returns (uint earned, uint endMonth); }
// SPDX-License-Identifier: AGPL-3.0-only /* IValidatorService.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Artem Payvin SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SKALE Manager is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. */ pragma solidity >=0.6.10 <0.9.0; interface IValidatorService { struct Validator { string name; address validatorAddress; address requestedAddress; string description; uint feeRate; uint registrationTime; uint minimumDelegationAmount; bool acceptNewRequests; } /** * @dev Emitted when a validator registers. */ event ValidatorRegistered( uint validatorId ); /** * @dev Emitted when a validator address changes. */ event ValidatorAddressChanged( uint validatorId, address newAddress ); /** * @dev Emitted when a validator is enabled. */ event ValidatorWasEnabled( uint validatorId ); /** * @dev Emitted when a validator is disabled. */ event ValidatorWasDisabled( uint validatorId ); /** * @dev Emitted when a node address is linked to a validator. */ event NodeAddressWasAdded( uint validatorId, address nodeAddress ); /** * @dev Emitted when a node address is unlinked from a validator. */ event NodeAddressWasRemoved( uint validatorId, address nodeAddress ); /** * @dev Emitted when whitelist disabled. */ event WhitelistDisabled(bool status); /** * @dev Emitted when validator requested new address. */ event RequestNewAddress(uint indexed validatorId, address previousAddress, address newAddress); /** * @dev Emitted when validator set new minimum delegation amount. */ event SetMinimumDelegationAmount(uint indexed validatorId, uint previousMDA, uint newMDA); /** * @dev Emitted when validator set new name. */ event SetValidatorName(uint indexed validatorId, string previousName, string newName); /** * @dev Emitted when validator set new description. */ event SetValidatorDescription(uint indexed validatorId, string previousDescription, string newDescription); /** * @dev Emitted when validator start or stop accepting new delegation requests. */ event AcceptingNewRequests(uint indexed validatorId, bool status); function registerValidator( string calldata name, string calldata description, uint feeRate, uint minimumDelegationAmount ) external returns (uint validatorId); function enableValidator(uint validatorId) external; function disableValidator(uint validatorId) external; function disableWhitelist() external; function requestForNewAddress(address newValidatorAddress) external; function confirmNewAddress(uint validatorId) external; function linkNodeAddress(address nodeAddress, bytes calldata sig) external; function unlinkNodeAddress(address nodeAddress) external; function setValidatorMDA(uint minimumDelegationAmount) external; function setValidatorName(string calldata newName) external; function setValidatorDescription(string calldata newDescription) external; function startAcceptingNewRequests() external; function stopAcceptingNewRequests() external; function removeNodeAddress(uint validatorId, address nodeAddress) external; function getAndUpdateBondAmount(uint validatorId) external returns (uint); function getMyNodesAddresses() external view returns (address[] memory); function getTrustedValidators() external view returns (uint[] memory); function checkValidatorAddressToId(address validatorAddress, uint validatorId) external view returns (bool); function getValidatorIdByNodeAddress(address nodeAddress) external view returns (uint validatorId); function checkValidatorCanReceiveDelegation(uint validatorId, uint amount) external view; function getNodeAddresses(uint validatorId) external view returns (address[] memory); function validatorExists(uint validatorId) external view returns (bool); function validatorAddressExists(address validatorAddress) external view returns (bool); function checkIfValidatorAddressExists(address validatorAddress) external view; function getValidator(uint validatorId) external view returns (Validator memory); function getValidatorId(address validatorAddress) external view returns (uint); function isAcceptingNewRequests(uint validatorId) external view returns (bool); function isAuthorizedValidator(uint validatorId) external view returns (bool); }
// SPDX-License-Identifier: AGPL-3.0-only /* IDelegationController.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Artem Payvin SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SKALE Manager is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. */ pragma solidity >=0.6.10 <0.9.0; interface IDelegationController { enum State { PROPOSED, ACCEPTED, CANCELED, REJECTED, DELEGATED, UNDELEGATION_REQUESTED, COMPLETED } struct Delegation { address holder; // address of token owner uint validatorId; uint amount; uint delegationPeriod; uint created; // time of delegation creation uint started; // month when a delegation becomes active uint finished; // first month after a delegation ends string info; } /** * @dev Emitted when validator was confiscated. */ event Confiscated( uint indexed validatorId, uint amount ); /** * @dev Emitted when validator was confiscated. */ event SlashesProcessed( address indexed holder, uint limit ); /** * @dev Emitted when a delegation is proposed to a validator. */ event DelegationProposed( uint delegationId ); /** * @dev Emitted when a delegation is accepted by a validator. */ event DelegationAccepted( uint delegationId ); /** * @dev Emitted when a delegation is cancelled by the delegator. */ event DelegationRequestCanceledByUser( uint delegationId ); /** * @dev Emitted when a delegation is requested to undelegate. */ event UndelegationRequested( uint delegationId ); function getAndUpdateDelegatedToValidatorNow(uint validatorId) external returns (uint); function getAndUpdateDelegatedAmount(address holder) external returns (uint); function getAndUpdateEffectiveDelegatedByHolderToValidator(address holder, uint validatorId, uint month) external returns (uint effectiveDelegated); function delegate( uint validatorId, uint amount, uint delegationPeriod, string calldata info ) external; function cancelPendingDelegation(uint delegationId) external; function acceptPendingDelegation(uint delegationId) external; function requestUndelegation(uint delegationId) external; function confiscate(uint validatorId, uint amount) external; function getAndUpdateEffectiveDelegatedToValidator(uint validatorId, uint month) external returns (uint); function getAndUpdateDelegatedByHolderToValidatorNow(address holder, uint validatorId) external returns (uint); function processSlashes(address holder, uint limit) external; function processAllSlashes(address holder) external; function getEffectiveDelegatedValuesByValidator(uint validatorId) external view returns (uint[] memory); function getEffectiveDelegatedToValidator(uint validatorId, uint month) external view returns (uint); function getDelegatedToValidator(uint validatorId, uint month) external view returns (uint); function getDelegation(uint delegationId) external view returns (Delegation memory); function getFirstDelegationMonth(address holder, uint validatorId) external view returns(uint); function getDelegationsByValidatorLength(uint validatorId) external view returns (uint); function getDelegationsByHolderLength(address holder) external view returns (uint); function getState(uint delegationId) external view returns (State state); function getLockedInPendingDelegations(address holder) external view returns (uint); function hasUnprocessedSlashes(address holder) external view returns (bool); }
// SPDX-License-Identifier: AGPL-3.0-only /* ITimeHelpers.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Artem Payvin SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SKALE Manager is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. */ pragma solidity >=0.6.10 <0.9.0; interface ITimeHelpers { function calculateProofOfUseLockEndTime(uint month, uint lockUpPeriodDays) external view returns (uint timestamp); function getCurrentMonth() external view returns (uint); function timestampToYear(uint timestamp) external view returns (uint); function timestampToMonth(uint timestamp) external view returns (uint); function monthToTimestamp(uint month) external view returns (uint timestamp); function addDays(uint fromTimestamp, uint n) external pure returns (uint); function addMonths(uint fromTimestamp, uint n) external pure returns (uint); function addYears(uint fromTimestamp, uint n) external pure returns (uint); }
// SPDX-License-Identifier: AGPL-3.0-only /* Permissions.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Artem Payvin SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SKALE Manager is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. */ pragma solidity 0.8.11; import "@skalenetwork/skale-manager-interfaces/IContractManager.sol"; import "@skalenetwork/skale-manager-interfaces/IPermissions.sol"; import "./thirdparty/openzeppelin/AccessControlUpgradeableLegacy.sol"; /** * @title Permissions * @dev Contract is connected module for Upgradeable approach, knows ContractManager */ contract Permissions is AccessControlUpgradeableLegacy, IPermissions { using AddressUpgradeable for address; IContractManager public contractManager; /** * @dev Modifier to make a function callable only when caller is the Owner. * * Requirements: * * - The caller must be the owner. */ modifier onlyOwner() { require(_isOwner(), "Caller is not the owner"); _; } /** * @dev Modifier to make a function callable only when caller is an Admin. * * Requirements: * * - The caller must be an admin. */ modifier onlyAdmin() { require(_isAdmin(msg.sender), "Caller is not an admin"); _; } /** * @dev Modifier to make a function callable only when caller is the Owner * or `contractName` contract. * * Requirements: * * - The caller must be the owner or `contractName`. */ modifier allow(string memory contractName) { require( contractManager.getContract(contractName) == msg.sender || _isOwner(), "Message sender is invalid"); _; } /** * @dev Modifier to make a function callable only when caller is the Owner * or `contractName1` or `contractName2` contract. * * Requirements: * * - The caller must be the owner, `contractName1`, or `contractName2`. */ modifier allowTwo(string memory contractName1, string memory contractName2) { require( contractManager.getContract(contractName1) == msg.sender || contractManager.getContract(contractName2) == msg.sender || _isOwner(), "Message sender is invalid"); _; } /** * @dev Modifier to make a function callable only when caller is the Owner * or `contractName1`, `contractName2`, or `contractName3` contract. * * Requirements: * * - The caller must be the owner, `contractName1`, `contractName2`, or * `contractName3`. */ modifier allowThree(string memory contractName1, string memory contractName2, string memory contractName3) { require( contractManager.getContract(contractName1) == msg.sender || contractManager.getContract(contractName2) == msg.sender || contractManager.getContract(contractName3) == msg.sender || _isOwner(), "Message sender is invalid"); _; } function initialize(address contractManagerAddress) public virtual override initializer { AccessControlUpgradeableLegacy.__AccessControl_init(); _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setContractManager(contractManagerAddress); } function _isOwner() internal view returns (bool) { return hasRole(DEFAULT_ADMIN_ROLE, msg.sender); } function _isAdmin(address account) internal view returns (bool) { address skaleManagerAddress = contractManager.contracts(keccak256(abi.encodePacked("SkaleManager"))); if (skaleManagerAddress != address(0)) { AccessControlUpgradeableLegacy skaleManager = AccessControlUpgradeableLegacy(skaleManagerAddress); return skaleManager.hasRole(keccak256("ADMIN_ROLE"), account) || _isOwner(); } else { return _isOwner(); } } function _setContractManager(address contractManagerAddress) private { require(contractManagerAddress != address(0), "ContractManager address is not set"); require(contractManagerAddress.isContract(), "Address is not contract"); contractManager = IContractManager(contractManagerAddress); } }
// SPDX-License-Identifier: AGPL-3.0-only /* ConstantsHolder.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Artem Payvin SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SKALE Manager is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. */ pragma solidity 0.8.11; import "@skalenetwork/skale-manager-interfaces/IConstantsHolder.sol"; import "./Permissions.sol"; /** * @title ConstantsHolder * @dev Contract contains constants and common variables for the SKALE Network. */ contract ConstantsHolder is Permissions, IConstantsHolder { // initial price for creating Node (100 SKL) uint public constant NODE_DEPOSIT = 100 * 1e18; uint8 public constant TOTAL_SPACE_ON_NODE = 128; // part of Node for Small Skale-chain (1/128 of Node) uint8 public constant SMALL_DIVISOR = 128; // part of Node for Medium Skale-chain (1/32 of Node) uint8 public constant MEDIUM_DIVISOR = 32; // part of Node for Large Skale-chain (full Node) uint8 public constant LARGE_DIVISOR = 1; // part of Node for Medium Test Skale-chain (1/4 of Node) uint8 public constant MEDIUM_TEST_DIVISOR = 4; // typically number of Nodes for Skale-chain (16 Nodes) uint public constant NUMBER_OF_NODES_FOR_SCHAIN = 16; // number of Nodes for Test Skale-chain (2 Nodes) uint public constant NUMBER_OF_NODES_FOR_TEST_SCHAIN = 2; // number of Nodes for Test Skale-chain (4 Nodes) uint public constant NUMBER_OF_NODES_FOR_MEDIUM_TEST_SCHAIN = 4; // number of seconds in one year uint32 public constant SECONDS_TO_YEAR = 31622400; // initial number of monitors uint public constant NUMBER_OF_MONITORS = 24; uint public constant OPTIMAL_LOAD_PERCENTAGE = 80; uint public constant ADJUSTMENT_SPEED = 1000; uint public constant COOLDOWN_TIME = 60; uint public constant MIN_PRICE = 10**6; uint public constant MSR_REDUCING_COEFFICIENT = 2; uint public constant DOWNTIME_THRESHOLD_PART = 30; uint public constant BOUNTY_LOCKUP_MONTHS = 2; uint public constant ALRIGHT_DELTA = 134161; uint public constant BROADCAST_DELTA = 177490; uint public constant COMPLAINT_BAD_DATA_DELTA = 80995; uint public constant PRE_RESPONSE_DELTA = 100061; uint public constant COMPLAINT_DELTA = 104611; uint public constant RESPONSE_DELTA = 49132; // MSR - Minimum staking requirement uint public msr; // Reward period - 30 days (each 30 days Node would be granted for bounty) uint32 public rewardPeriod; // Allowable latency - 150000 ms by default uint32 public allowableLatency; /** * Delta period - 1 hour (1 hour before Reward period became Monitors need * to send Verdicts and 1 hour after Reward period became Node need to come * and get Bounty) */ uint32 public deltaPeriod; /** * Check time - 2 minutes (every 2 minutes monitors should check metrics * from checked nodes) */ uint public checkTime; //Need to add minimal allowed parameters for verdicts uint public launchTimestamp; uint public rotationDelay; uint public proofOfUseLockUpPeriodDays; uint public proofOfUseDelegationPercentage; uint public limitValidatorsPerDelegator; uint256 public firstDelegationsMonth; // deprecated // date when schains will be allowed for creation uint public schainCreationTimeStamp; uint public minimalSchainLifetime; uint public complaintTimeLimit; bytes32 public constant CONSTANTS_HOLDER_MANAGER_ROLE = keccak256("CONSTANTS_HOLDER_MANAGER_ROLE"); modifier onlyConstantsHolderManager() { require(hasRole(CONSTANTS_HOLDER_MANAGER_ROLE, msg.sender), "CONSTANTS_HOLDER_MANAGER_ROLE is required"); _; } /** * @dev Allows the Owner to set new reward and delta periods * This function is only for tests. */ function setPeriods(uint32 newRewardPeriod, uint32 newDeltaPeriod) external override onlyConstantsHolderManager { require( newRewardPeriod >= newDeltaPeriod && newRewardPeriod - newDeltaPeriod >= checkTime, "Incorrect Periods" ); emit ConstantUpdated( keccak256(abi.encodePacked("RewardPeriod")), uint(rewardPeriod), uint(newRewardPeriod) ); rewardPeriod = newRewardPeriod; emit ConstantUpdated( keccak256(abi.encodePacked("DeltaPeriod")), uint(deltaPeriod), uint(newDeltaPeriod) ); deltaPeriod = newDeltaPeriod; } /** * @dev Allows the Owner to set the new check time. * This function is only for tests. */ function setCheckTime(uint newCheckTime) external override onlyConstantsHolderManager { require(rewardPeriod - deltaPeriod >= checkTime, "Incorrect check time"); emit ConstantUpdated( keccak256(abi.encodePacked("CheckTime")), uint(checkTime), uint(newCheckTime) ); checkTime = newCheckTime; } /** * @dev Allows the Owner to set the allowable latency in milliseconds. * This function is only for testing purposes. */ function setLatency(uint32 newAllowableLatency) external override onlyConstantsHolderManager { emit ConstantUpdated( keccak256(abi.encodePacked("AllowableLatency")), uint(allowableLatency), uint(newAllowableLatency) ); allowableLatency = newAllowableLatency; } /** * @dev Allows the Owner to set the minimum stake requirement. */ function setMSR(uint newMSR) external override onlyConstantsHolderManager { emit ConstantUpdated( keccak256(abi.encodePacked("MSR")), uint(msr), uint(newMSR) ); msr = newMSR; } /** * @dev Allows the Owner to set the launch timestamp. */ function setLaunchTimestamp(uint timestamp) external override onlyConstantsHolderManager { require( block.timestamp < launchTimestamp, "Cannot set network launch timestamp because network is already launched" ); emit ConstantUpdated( keccak256(abi.encodePacked("LaunchTimestamp")), uint(launchTimestamp), uint(timestamp) ); launchTimestamp = timestamp; } /** * @dev Allows the Owner to set the node rotation delay. */ function setRotationDelay(uint newDelay) external override onlyConstantsHolderManager { emit ConstantUpdated( keccak256(abi.encodePacked("RotationDelay")), uint(rotationDelay), uint(newDelay) ); rotationDelay = newDelay; } /** * @dev Allows the Owner to set the proof-of-use lockup period. */ function setProofOfUseLockUpPeriod(uint periodDays) external override onlyConstantsHolderManager { emit ConstantUpdated( keccak256(abi.encodePacked("ProofOfUseLockUpPeriodDays")), uint(proofOfUseLockUpPeriodDays), uint(periodDays) ); proofOfUseLockUpPeriodDays = periodDays; } /** * @dev Allows the Owner to set the proof-of-use delegation percentage * requirement. */ function setProofOfUseDelegationPercentage(uint percentage) external override onlyConstantsHolderManager { require(percentage <= 100, "Percentage value is incorrect"); emit ConstantUpdated( keccak256(abi.encodePacked("ProofOfUseDelegationPercentage")), uint(proofOfUseDelegationPercentage), uint(percentage) ); proofOfUseDelegationPercentage = percentage; } /** * @dev Allows the Owner to set the maximum number of validators that a * single delegator can delegate to. */ function setLimitValidatorsPerDelegator(uint newLimit) external override onlyConstantsHolderManager { emit ConstantUpdated( keccak256(abi.encodePacked("LimitValidatorsPerDelegator")), uint(limitValidatorsPerDelegator), uint(newLimit) ); limitValidatorsPerDelegator = newLimit; } function setSchainCreationTimeStamp(uint timestamp) external override onlyConstantsHolderManager { emit ConstantUpdated( keccak256(abi.encodePacked("SchainCreationTimeStamp")), uint(schainCreationTimeStamp), uint(timestamp) ); schainCreationTimeStamp = timestamp; } function setMinimalSchainLifetime(uint lifetime) external override onlyConstantsHolderManager { emit ConstantUpdated( keccak256(abi.encodePacked("MinimalSchainLifetime")), uint(minimalSchainLifetime), uint(lifetime) ); minimalSchainLifetime = lifetime; } function setComplaintTimeLimit(uint timeLimit) external override onlyConstantsHolderManager { emit ConstantUpdated( keccak256(abi.encodePacked("ComplaintTimeLimit")), uint(complaintTimeLimit), uint(timeLimit) ); complaintTimeLimit = timeLimit; } function initialize(address contractsAddress) public override initializer { Permissions.initialize(contractsAddress); msr = 0; rewardPeriod = 2592000; allowableLatency = 150000; deltaPeriod = 3600; checkTime = 300; launchTimestamp = type(uint).max; rotationDelay = 12 hours; proofOfUseLockUpPeriodDays = 90; proofOfUseDelegationPercentage = 50; limitValidatorsPerDelegator = 20; firstDelegationsMonth = 0; complaintTimeLimit = 1800; } }
// SPDX-License-Identifier: AGPL-3.0-only /* MathUtils.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Dmytro Stebaiev SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SKALE Manager is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. */ pragma solidity 0.8.11; library MathUtils { uint constant private _EPS = 1e6; event UnderflowError( uint a, uint b ); function boundedSub(uint256 a, uint256 b) internal returns (uint256) { if (a >= b) { return a - b; } else { emit UnderflowError(a, b); return 0; } } function boundedSubWithoutEvent(uint256 a, uint256 b) internal pure returns (uint256) { if (a >= b) { return a - b; } else { return 0; } } function muchGreater(uint256 a, uint256 b) internal pure returns (bool) { assert(type(uint).max - _EPS > b); return a > b + _EPS; } function approximatelyEqual(uint256 a, uint256 b) internal pure returns (bool) { if (a > b) { return a - b < _EPS; } else { return b - a < _EPS; } } }
// SPDX-License-Identifier: AGPL-3.0-only /* IContractManager.sol - SKALE Manager Interfaces Copyright (C) 2021-Present SKALE Labs @author Dmytro Stebaeiv SKALE Manager Interfaces is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SKALE Manager Interfaces is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with SKALE Manager Interfaces. If not, see <https://www.gnu.org/licenses/>. */ pragma solidity >=0.6.10 <0.9.0; interface IContractManager { /** * @dev Emitted when contract is upgraded. */ event ContractUpgraded(string contractsName, address contractsAddress); function initialize() external; function setContractsAddress(string calldata contractsName, address newContractsAddress) external; function contracts(bytes32 nameHash) external view returns (address); function getDelegationPeriodManager() external view returns (address); function getBounty() external view returns (address); function getValidatorService() external view returns (address); function getTimeHelpers() external view returns (address); function getConstantsHolder() external view returns (address); function getSkaleToken() external view returns (address); function getTokenState() external view returns (address); function getPunisher() external view returns (address); function getContract(string calldata name) external view returns (address); }
// SPDX-License-Identifier: AGPL-3.0-only /* IPermissions.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Artem Payvin SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SKALE Manager is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. */ pragma solidity >=0.6.10 <0.9.0; interface IPermissions { function initialize(address contractManagerAddress) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; import "@skalenetwork/skale-manager-interfaces/thirdparty/openzeppelin/IAccessControlUpgradeableLegacy.sol"; import "./InitializableWithGap.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * 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, _msgSender())); * ... * } * ``` * * 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}. */ abstract contract AccessControlUpgradeableLegacy is InitializableWithGap, ContextUpgradeable, IAccessControlUpgradeableLegacy { function __AccessControl_init() internal initializer { __Context_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; struct RoleData { EnumerableSetUpgradeable.AddressSet members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members.contains(account); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view override returns (uint256) { return _roles[role].members.length(); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view override returns (address) { return _roles[role].members.at(index); } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _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 granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (_roles[role].members.add(account)) { emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { __Context_init_unchained(); } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; }
// SPDX-License-Identifier: AGPL-3.0-only /* IAccessControlUpgradeableLegacy.sol - SKALE Manager Copyright (C) 2018-Present SKALE Labs @author Artem Payvin SKALE Manager is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SKALE Manager is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. */ pragma solidity >=0.6.10 <0.9.0; interface IAccessControlUpgradeableLegacy { /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_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); function grantRole(bytes32 role, address account) external; function revokeRole(bytes32 role, address account) external; function renounceRole(bytes32 role, address account) external; function hasRole(bytes32 role, address account) external view returns (bool); function getRoleMemberCount(bytes32 role) external view returns (uint256); function getRoleMember(bytes32 role, uint256 index) external view returns (address); function getRoleAdmin(bytes32 role) external view returns (bytes32); }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.7; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; contract InitializableWithGap is Initializable { uint256[50] private ______gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: AGPL-3.0-only /* IConstantsHolder.sol - SKALE Manager Interfaces Copyright (C) 2021-Present SKALE Labs @author Artem Payvin SKALE Manager Interfaces is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SKALE Manager Interfaces is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with SKALE Manager Interfaces. If not, see <https://www.gnu.org/licenses/>. */ pragma solidity >=0.6.10 <0.9.0; interface IConstantsHolder { /** * @dev Emitted when constants updated. */ event ConstantUpdated( bytes32 indexed constantHash, uint previousValue, uint newValue ); function setPeriods(uint32 newRewardPeriod, uint32 newDeltaPeriod) external; function setCheckTime(uint newCheckTime) external; function setLatency(uint32 newAllowableLatency) external; function setMSR(uint newMSR) external; function setLaunchTimestamp(uint timestamp) external; function setRotationDelay(uint newDelay) external; function setProofOfUseLockUpPeriod(uint periodDays) external; function setProofOfUseDelegationPercentage(uint percentage) external; function setLimitValidatorsPerDelegator(uint newLimit) external; function setSchainCreationTimeStamp(uint timestamp) external; function setMinimalSchainLifetime(uint lifetime) external; function setComplaintTimeLimit(uint timeLimit) external; function msr() external view returns (uint); function launchTimestamp() external view returns (uint); function rotationDelay() external view returns (uint); function limitValidatorsPerDelegator() external view returns (uint); function schainCreationTimeStamp() external view returns (uint); function minimalSchainLifetime() external view returns (uint); function complaintTimeLimit() external view returns (uint); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"validatorId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BountyWasPaid","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":"holder","type":"address"},{"indexed":false,"internalType":"uint256","name":"validatorId","type":"uint256"},{"indexed":false,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawBounty","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"validatorId","type":"uint256"},{"indexed":false,"internalType":"address","name":"destination","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawFee","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractManager","outputs":[{"internalType":"contract IContractManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"validatorId","type":"uint256"}],"name":"getAndUpdateEarnedBountyAmount","outputs":[{"internalType":"uint256","name":"earned","type":"uint256"},{"internalType":"uint256","name":"endMonth","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"validatorId","type":"uint256"}],"name":"getAndUpdateEarnedBountyAmountOf","outputs":[{"internalType":"uint256","name":"earned","type":"uint256"},{"internalType":"uint256","name":"endMonth","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getEarnedFeeAmount","outputs":[{"internalType":"uint256","name":"earned","type":"uint256"},{"internalType":"uint256","name":"endMonth","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"validatorId","type":"uint256"}],"name":"getEarnedFeeAmountOf","outputs":[{"internalType":"uint256","name":"earned","type":"uint256"},{"internalType":"uint256","name":"endMonth","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"contractsAddress","type":"address"}],"name":"initialize","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":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"tokensReceived","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"validatorId","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawBounty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"withdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061252c806100206000396000f3fe608060405234801561001057600080fd5b506004361061010a5760003560e01c806376d07f6b116100a2578063af6967bb11610071578063af6967bb1461023f578063b39e12cf14610252578063c4d66de814610265578063ca15c87314610278578063d547741f1461028b57600080fd5b806376d07f6b146101d65780639010d07c146101e957806391d1485414610214578063a217fddf1461023757600080fd5b80632f2ff15d116100de5780632f2ff15d14610195578063312ddd2d146101a857806336568abe146101b057806366d9fab6146101c357600080fd5b806223de291461010f5780631ac3ddeb14610124578063248a9ca3146101375780632906264a1461016d575b600080fd5b61012261011d366004611f8b565b61029e565b005b61012261013236600461203c565b610461565b61015a610145366004612060565b60009081526065602052604090206002015490565b6040519081526020015b60405180910390f35b61018061017b366004612060565b61097e565b60408051928352602083019190915201610164565b6101226101a3366004612079565b610aef565b610180610b7d565b6101226101be366004612079565b610c69565b6101806101d13660046120a9565b610ce3565b6101226101e4366004612079565b611098565b6101fc6101f73660046120d5565b6114e3565b6040516001600160a01b039091168152602001610164565b610227610222366004612079565b611504565b6040519015158152602001610164565b61015a600081565b61018061024d366004612060565b61151c565b6097546101fc906001600160a01b031681565b61012261027336600461203c565b611532565b61015a610286366004612060565b611651565b610122610299366004612079565b611668565b604080518082018252600a81526929b5b0b632aa37b5b2b760b11b60208201526097549151633581777360e01b8152909133916001600160a01b03909116906335817773906102f1908590600401612127565b602060405180830381865afa15801561030e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610332919061216a565b6001600160a01b0316148061034a575061034a6116e9565b61039b5760405162461bcd60e51b815260206004820152601960248201527f4d6573736167652073656e64657220697320696e76616c69640000000000000060448201526064015b60405180910390fd5b6001600160a01b03871630146103eb5760405162461bcd60e51b8152602060048201526015602482015274149958d95a5d995c881a5cc81a5b98dbdc9c9958dd605a1b6044820152606401610392565b6020841461043b5760405162461bcd60e51b815260206004820152601860248201527f44617461206c656e67746820697320696e636f727265637400000000000000006044820152606401610392565b600061044985870187612060565b905061045587826116fa565b50505050505050505050565b609754604051633581777360e01b81526000916001600160a01b03169063358177739061049090600401612187565b602060405180830381865afa1580156104ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d1919061216a565b609754604051633581777360e01b815260206004820152600a60248201526929b5b0b632aa37b5b2b760b11b60448201529192506000916001600160a01b0390911690633581777390606401602060405180830381865afa15801561053a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055e919061216a565b609754604051633581777360e01b81529192506000916001600160a01b0390911690633581777390610592906004016121b1565b602060405180830381865afa1580156105af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d3919061216a565b609754604051633581777360e01b815260206004820152600f60248201526e21b7b739ba30b73a39a437b63232b960891b60448201529192506000916001600160a01b0390911690633581777390606401602060405180830381865afa158015610641573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610665919061216a565b9050816001600160a01b0316634355644d826001600160a01b03166365cf7c9b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d891906121d6565b836001600160a01b031663d62d5bb86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610716573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073a91906121d6565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401602060405180830381865afa15801561077b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079f91906121d6565b4210156107de5760405162461bcd60e51b815260206004820152600d60248201526c119959481a5cc81b1bd8dad959609a1b6044820152606401610392565b604051630ba7341960e11b81523360048201526000906001600160a01b0386169063174e683290602401602060405180830381865afa158015610825573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084991906121d6565b90506000806108578361097e565b6000858152609c6020526040908190208290555163a9059cbb60e01b81526001600160a01b038b81166004830152602482018490529294509092509087169063a9059cbb906044016020604051808303816000875af11580156108be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e291906121ff565b61092a5760405162461bcd60e51b81526020600482015260196024820152784661696c656420746f207472616e7366657220746f6b656e7360381b6044820152606401610392565b604080518481526001600160a01b038a1660208201529081018390527fd6dedabc1e5ce29aec4ffd8504fa7c09b9c9c2f53b0e745f0b6a9b1e5c19f0dd906060015b60405180910390a15050505050505050565b609754604051633581777360e01b8152600091829182916001600160a01b0316906335817773906109b1906004016121b1565b602060405180830381865afa1580156109ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f2919061216a565b90506000816001600160a01b031663ddd1b67e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5891906121d6565b6000868152609c602052604090205490915080610a7d57506000958695509350505050565b6000945081935080600c610a919190612230565b841115610aa657610aa381600c612230565b93505b805b84811015610ae6576000878152609a60209081526040808320848452909152902054610ad49087612230565b9550610adf81612248565b9050610aa8565b50505050915091565b600082815260656020526040902060020154610b0b9033611504565b610b6f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b6064820152608401610392565b610b7982826119b8565b5050565b609754604051633581777360e01b8152600091829182916001600160a01b031690633581777390610bb090600401612187565b602060405180830381865afa158015610bcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf1919061216a565b604051630ba7341960e11b8152336004820152909150610c60906001600160a01b0383169063174e683290602401602060405180830381865afa158015610c3c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017b91906121d6565b92509250509091565b6001600160a01b0381163314610cd95760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610392565b610b798282611a11565b609754604051633581777360e01b81526020600482015260146024820152732232b632b3b0ba34b7b721b7b73a3937b63632b960611b6044820152600091829182916001600160a01b031690633581777390606401602060405180830381865afa158015610d55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d79919061216a565b609754604051633581777360e01b81529192506000916001600160a01b0390911690633581777390610dad906004016121b1565b602060405180830381865afa158015610dca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dee919061216a565b90506000816001600160a01b031663ddd1b67e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5491906121d6565b6001600160a01b0388166000908152609b602090815260408083208a845290915290205490915080610f0857604051634b2a7f8b60e11b81526001600160a01b03898116600483015260248201899052851690639654ff1690604401602060405180830381865afa158015610ecd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef191906121d6565b905080610f08576000809550955050505050611091565b6000955081945080600c610f1c9190612230565b851115610f3157610f2e81600c612230565b94505b805b8581101561108b57604051630416880b60e41b815260048101899052602481018290526000906001600160a01b0387169063416880b0906044016020604051808303816000875af1158015610f8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb091906121d6565b9050610fbd816000611a6a565b1561107a576040516301c037ff60e31b81526001600160a01b038b81166004830152602482018b905260448201849052829190881690630e01bff8906064016020604051808303816000875af115801561101b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103f91906121d6565b60008b81526099602090815260408083208784529091529020546110639190612263565b61106d9190612282565b6110779089612230565b97505b5061108481612248565b9050610f33565b50505050505b9250929050565b609754604051633581777360e01b81526000916001600160a01b0316906335817773906110c7906004016121b1565b602060405180830381865afa1580156110e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611108919061216a565b609754604051633581777360e01b815260206004820152600f60248201526e21b7b739ba30b73a39a437b63232b960891b60448201529192506000916001600160a01b0390911690633581777390606401602060405180830381865afa158015611176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119a919061216a565b9050816001600160a01b0316634355644d826001600160a01b03166365cf7c9b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061120d91906121d6565b836001600160a01b031663d62d5bb86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561124b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126f91906121d6565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401602060405180830381865afa1580156112b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d491906121d6565b4210156113165760405162461bcd60e51b815260206004820152601060248201526f109bdd5b9d1e481a5cc81b1bd8dad95960821b6044820152606401610392565b6000806113233387610ce3565b336000908152609b602090815260408083208b845282528083208490556097549051633581777360e01b81526004810192909252600a60248301526929b5b0b632aa37b5b2b760b11b6044830152939550919350916001600160a01b031690633581777390606401602060405180830381865afa1580156113a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cc919061216a565b60405163a9059cbb60e01b81526001600160a01b038881166004830152602482018690529192509082169063a9059cbb906044016020604051808303816000875af115801561141f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144391906121ff565b61148b5760405162461bcd60e51b81526020600482015260196024820152784661696c656420746f207472616e7366657220746f6b656e7360381b6044820152606401610392565b60408051338152602081018990526001600160a01b038816818301526060810185905290517fa2d778d83fa0634d6e6efcba5c032aca209cb96bb1a612e84986b948cd75f38f9181900360800190a150505050505050565b60008281526065602052604081206114fb9083611a9f565b90505b92915050565b60008281526065602052604081206114fb9083611aab565b6000806115293384610ce3565b91509150915091565b600054610100900460ff1661154d5760005460ff1615611551565b303b155b61156d5760405162461bcd60e51b8152600401610392906122a4565b600054610100900460ff1615801561158f576000805461ffff19166101011790555b61159882611acd565b609880546001600160a01b031916731820a4b7618bde71dce8cdc73aab6c95905fad249081179091556040516329965a1d60e01b815230600482018190527fb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b602483015260448201526329965a1d90606401600060405180830381600087803b15801561162457600080fd5b505af1158015611638573d6000803e3d6000fd5b505050508015610b79576000805461ff00191690555050565b60008181526065602052604081206114fe90611b5b565b6000828152606560205260409020600201546116849033611504565b610cd95760405162461bcd60e51b815260206004820152603060248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526f2061646d696e20746f207265766f6b6560801b6064820152608401610392565b60006116f58133611504565b905090565b609754604051633581777360e01b81526000916001600160a01b031690633581777390611729906004016121b1565b602060405180830381865afa158015611746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176a919061216a565b609754604051633581777360e01b81529192506000916001600160a01b039091169063358177739061179e90600401612187565b602060405180830381865afa1580156117bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117df919061216a565b90506000826001600160a01b031663ddd1b67e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611821573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184591906121d6565b60405163b5d8962760e01b8152600481018690529091506000906001600160a01b0384169063b5d8962790602401600060405180830381865afa158015611890573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118b891908101906123ba565b60800151905060006103e86118cd8389612263565b6118d79190612282565b905060006118e5828961249d565b600088815260996020908152604080832088845290915290205490915061190d908290612230565b6000888152609960209081526040808320888452825280832093909355898252609a815282822087835290522054611946908390612230565b6000888152609a60209081526040808320888452825280832093909355898252609c90522054611982576000878152609c602052604090208490555b60408051888152602081018a90527f92ba628f701eb8dddfffbfa9748da1d157c46a4ff477ebd022d3e729249bf1bf910161096c565b60008281526065602052604090206119d09082611b65565b15610b795760405133906001600160a01b0383169084907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d90600090a45050565b6000828152606560205260409020611a299082611b7a565b15610b795760405133906001600160a01b0383169084907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b90600090a45050565b600081611a7c620f424060001961249d565b11611a8957611a896124b4565b611a96620f424083612230565b90921192915050565b60006114fb8383611b8f565b6001600160a01b038116600090815260018301602052604081205415156114fb565b600054610100900460ff16611ae85760005460ff1615611aec565b303b155b611b085760405162461bcd60e51b8152600401610392906122a4565b600054610100900460ff16158015611b2a576000805461ffff19166101011790555b611b32611bb9565b611b3d600033610b6f565b611b4682611c3b565b8015610b79576000805461ff00191690555050565b60006114fe825490565b60006114fb836001600160a01b038416611d15565b60006114fb836001600160a01b038416611d64565b6000826000018281548110611ba657611ba66124ca565b9060005260206000200154905092915050565b600054610100900460ff16611bd45760005460ff1615611bd8565b303b155b611bf45760405162461bcd60e51b8152600401610392906122a4565b600054610100900460ff16158015611c16576000805461ffff19166101011790555b611c1e611e57565b611c26611ec4565b8015611c38576000805461ff00191690555b50565b6001600160a01b038116611c9c5760405162461bcd60e51b815260206004820152602260248201527f436f6e74726163744d616e616765722061646472657373206973206e6f742073604482015261195d60f21b6064820152608401610392565b6001600160a01b0381163b611cf35760405162461bcd60e51b815260206004820152601760248201527f41646472657373206973206e6f7420636f6e74726163740000000000000000006044820152606401610392565b609780546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600183016020526040812054611d5c575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556114fe565b5060006114fe565b60008181526001830160205260408120548015611e4d576000611d8860018361249d565b8554909150600090611d9c9060019061249d565b9050818114611e01576000866000018281548110611dbc57611dbc6124ca565b9060005260206000200154905080876000018481548110611ddf57611ddf6124ca565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611e1257611e126124e0565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506114fe565b60009150506114fe565b600054610100900460ff16611ec25760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610392565b565b600054610100900460ff16611edf5760005460ff1615611ee3565b303b155b611eff5760405162461bcd60e51b8152600401610392906122a4565b600054610100900460ff16158015611c26576000805461ffff19166101011790558015611c38576000805461ff001916905550565b6001600160a01b0381168114611c3857600080fd5b60008083601f840112611f5b57600080fd5b50813567ffffffffffffffff811115611f7357600080fd5b60208301915083602082850101111561109157600080fd5b60008060008060008060008060c0898b031215611fa757600080fd5b8835611fb281611f34565b97506020890135611fc281611f34565b96506040890135611fd281611f34565b955060608901359450608089013567ffffffffffffffff80821115611ff657600080fd5b6120028c838d01611f49565b909650945060a08b013591508082111561201b57600080fd5b506120288b828c01611f49565b999c989b5096995094979396929594505050565b60006020828403121561204e57600080fd5b813561205981611f34565b9392505050565b60006020828403121561207257600080fd5b5035919050565b6000806040838503121561208c57600080fd5b82359150602083013561209e81611f34565b809150509250929050565b600080604083850312156120bc57600080fd5b82356120c781611f34565b946020939093013593505050565b600080604083850312156120e857600080fd5b50508035926020909101359150565b60005b838110156121125781810151838201526020016120fa565b83811115612121576000848401525b50505050565b60208152600082518060208401526121468160408501602087016120f7565b601f01601f19169190910160400192915050565b805161216581611f34565b919050565b60006020828403121561217c57600080fd5b815161205981611f34565b60208082526010908201526f56616c696461746f725365727669636560801b604082015260600190565b6020808252600b908201526a54696d6548656c7065727360a81b604082015260600190565b6000602082840312156121e857600080fd5b5051919050565b8051801515811461216557600080fd5b60006020828403121561221157600080fd5b6114fb826121ef565b634e487b7160e01b600052601160045260246000fd5b600082198211156122435761224361221a565b500190565b600060001982141561225c5761225c61221a565b5060010190565b600081600019048311821515161561227d5761227d61221a565b500290565b60008261229f57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b604051610100810167ffffffffffffffff8111828210171561232c5761232c6122f2565b60405290565b600082601f83011261234357600080fd5b815167ffffffffffffffff8082111561235e5761235e6122f2565b604051601f8301601f19908116603f01168101908282118183101715612386576123866122f2565b8160405283815286602085880101111561239f57600080fd5b6123b08460208301602089016120f7565b9695505050505050565b6000602082840312156123cc57600080fd5b815167ffffffffffffffff808211156123e457600080fd5b9083019061010082860312156123f957600080fd5b612401612308565b82518281111561241057600080fd5b61241c87828601612332565b82525061242b6020840161215a565b602082015261243c6040840161215a565b604082015260608301518281111561245357600080fd5b61245f87828601612332565b6060830152506080830151608082015260a083015160a082015260c083015160c082015261248f60e084016121ef565b60e082015295945050505050565b6000828210156124af576124af61221a565b500390565b634e487b7160e01b600052600160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fdfea2646970667358221220e1eb3f44f4648dceb7a5d1c256abd550ab4c0e12e3142ed4bacbbc316e11e12264736f6c634300080b0033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061010a5760003560e01c806376d07f6b116100a2578063af6967bb11610071578063af6967bb1461023f578063b39e12cf14610252578063c4d66de814610265578063ca15c87314610278578063d547741f1461028b57600080fd5b806376d07f6b146101d65780639010d07c146101e957806391d1485414610214578063a217fddf1461023757600080fd5b80632f2ff15d116100de5780632f2ff15d14610195578063312ddd2d146101a857806336568abe146101b057806366d9fab6146101c357600080fd5b806223de291461010f5780631ac3ddeb14610124578063248a9ca3146101375780632906264a1461016d575b600080fd5b61012261011d366004611f8b565b61029e565b005b61012261013236600461203c565b610461565b61015a610145366004612060565b60009081526065602052604090206002015490565b6040519081526020015b60405180910390f35b61018061017b366004612060565b61097e565b60408051928352602083019190915201610164565b6101226101a3366004612079565b610aef565b610180610b7d565b6101226101be366004612079565b610c69565b6101806101d13660046120a9565b610ce3565b6101226101e4366004612079565b611098565b6101fc6101f73660046120d5565b6114e3565b6040516001600160a01b039091168152602001610164565b610227610222366004612079565b611504565b6040519015158152602001610164565b61015a600081565b61018061024d366004612060565b61151c565b6097546101fc906001600160a01b031681565b61012261027336600461203c565b611532565b61015a610286366004612060565b611651565b610122610299366004612079565b611668565b604080518082018252600a81526929b5b0b632aa37b5b2b760b11b60208201526097549151633581777360e01b8152909133916001600160a01b03909116906335817773906102f1908590600401612127565b602060405180830381865afa15801561030e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610332919061216a565b6001600160a01b0316148061034a575061034a6116e9565b61039b5760405162461bcd60e51b815260206004820152601960248201527f4d6573736167652073656e64657220697320696e76616c69640000000000000060448201526064015b60405180910390fd5b6001600160a01b03871630146103eb5760405162461bcd60e51b8152602060048201526015602482015274149958d95a5d995c881a5cc81a5b98dbdc9c9958dd605a1b6044820152606401610392565b6020841461043b5760405162461bcd60e51b815260206004820152601860248201527f44617461206c656e67746820697320696e636f727265637400000000000000006044820152606401610392565b600061044985870187612060565b905061045587826116fa565b50505050505050505050565b609754604051633581777360e01b81526000916001600160a01b03169063358177739061049090600401612187565b602060405180830381865afa1580156104ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104d1919061216a565b609754604051633581777360e01b815260206004820152600a60248201526929b5b0b632aa37b5b2b760b11b60448201529192506000916001600160a01b0390911690633581777390606401602060405180830381865afa15801561053a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055e919061216a565b609754604051633581777360e01b81529192506000916001600160a01b0390911690633581777390610592906004016121b1565b602060405180830381865afa1580156105af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d3919061216a565b609754604051633581777360e01b815260206004820152600f60248201526e21b7b739ba30b73a39a437b63232b960891b60448201529192506000916001600160a01b0390911690633581777390606401602060405180830381865afa158015610641573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610665919061216a565b9050816001600160a01b0316634355644d826001600160a01b03166365cf7c9b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d891906121d6565b836001600160a01b031663d62d5bb86040518163ffffffff1660e01b8152600401602060405180830381865afa158015610716573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073a91906121d6565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401602060405180830381865afa15801561077b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079f91906121d6565b4210156107de5760405162461bcd60e51b815260206004820152600d60248201526c119959481a5cc81b1bd8dad959609a1b6044820152606401610392565b604051630ba7341960e11b81523360048201526000906001600160a01b0386169063174e683290602401602060405180830381865afa158015610825573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084991906121d6565b90506000806108578361097e565b6000858152609c6020526040908190208290555163a9059cbb60e01b81526001600160a01b038b81166004830152602482018490529294509092509087169063a9059cbb906044016020604051808303816000875af11580156108be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e291906121ff565b61092a5760405162461bcd60e51b81526020600482015260196024820152784661696c656420746f207472616e7366657220746f6b656e7360381b6044820152606401610392565b604080518481526001600160a01b038a1660208201529081018390527fd6dedabc1e5ce29aec4ffd8504fa7c09b9c9c2f53b0e745f0b6a9b1e5c19f0dd906060015b60405180910390a15050505050505050565b609754604051633581777360e01b8152600091829182916001600160a01b0316906335817773906109b1906004016121b1565b602060405180830381865afa1580156109ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f2919061216a565b90506000816001600160a01b031663ddd1b67e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5891906121d6565b6000868152609c602052604090205490915080610a7d57506000958695509350505050565b6000945081935080600c610a919190612230565b841115610aa657610aa381600c612230565b93505b805b84811015610ae6576000878152609a60209081526040808320848452909152902054610ad49087612230565b9550610adf81612248565b9050610aa8565b50505050915091565b600082815260656020526040902060020154610b0b9033611504565b610b6f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526e0818591b5a5b881d1bc819dc985b9d608a1b6064820152608401610392565b610b7982826119b8565b5050565b609754604051633581777360e01b8152600091829182916001600160a01b031690633581777390610bb090600401612187565b602060405180830381865afa158015610bcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf1919061216a565b604051630ba7341960e11b8152336004820152909150610c60906001600160a01b0383169063174e683290602401602060405180830381865afa158015610c3c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017b91906121d6565b92509250509091565b6001600160a01b0381163314610cd95760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610392565b610b798282611a11565b609754604051633581777360e01b81526020600482015260146024820152732232b632b3b0ba34b7b721b7b73a3937b63632b960611b6044820152600091829182916001600160a01b031690633581777390606401602060405180830381865afa158015610d55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d79919061216a565b609754604051633581777360e01b81529192506000916001600160a01b0390911690633581777390610dad906004016121b1565b602060405180830381865afa158015610dca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dee919061216a565b90506000816001600160a01b031663ddd1b67e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5491906121d6565b6001600160a01b0388166000908152609b602090815260408083208a845290915290205490915080610f0857604051634b2a7f8b60e11b81526001600160a01b03898116600483015260248201899052851690639654ff1690604401602060405180830381865afa158015610ecd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef191906121d6565b905080610f08576000809550955050505050611091565b6000955081945080600c610f1c9190612230565b851115610f3157610f2e81600c612230565b94505b805b8581101561108b57604051630416880b60e41b815260048101899052602481018290526000906001600160a01b0387169063416880b0906044016020604051808303816000875af1158015610f8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb091906121d6565b9050610fbd816000611a6a565b1561107a576040516301c037ff60e31b81526001600160a01b038b81166004830152602482018b905260448201849052829190881690630e01bff8906064016020604051808303816000875af115801561101b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103f91906121d6565b60008b81526099602090815260408083208784529091529020546110639190612263565b61106d9190612282565b6110779089612230565b97505b5061108481612248565b9050610f33565b50505050505b9250929050565b609754604051633581777360e01b81526000916001600160a01b0316906335817773906110c7906004016121b1565b602060405180830381865afa1580156110e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611108919061216a565b609754604051633581777360e01b815260206004820152600f60248201526e21b7b739ba30b73a39a437b63232b960891b60448201529192506000916001600160a01b0390911690633581777390606401602060405180830381865afa158015611176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119a919061216a565b9050816001600160a01b0316634355644d826001600160a01b03166365cf7c9b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061120d91906121d6565b836001600160a01b031663d62d5bb86040518163ffffffff1660e01b8152600401602060405180830381865afa15801561124b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126f91906121d6565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401602060405180830381865afa1580156112b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d491906121d6565b4210156113165760405162461bcd60e51b815260206004820152601060248201526f109bdd5b9d1e481a5cc81b1bd8dad95960821b6044820152606401610392565b6000806113233387610ce3565b336000908152609b602090815260408083208b845282528083208490556097549051633581777360e01b81526004810192909252600a60248301526929b5b0b632aa37b5b2b760b11b6044830152939550919350916001600160a01b031690633581777390606401602060405180830381865afa1580156113a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cc919061216a565b60405163a9059cbb60e01b81526001600160a01b038881166004830152602482018690529192509082169063a9059cbb906044016020604051808303816000875af115801561141f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144391906121ff565b61148b5760405162461bcd60e51b81526020600482015260196024820152784661696c656420746f207472616e7366657220746f6b656e7360381b6044820152606401610392565b60408051338152602081018990526001600160a01b038816818301526060810185905290517fa2d778d83fa0634d6e6efcba5c032aca209cb96bb1a612e84986b948cd75f38f9181900360800190a150505050505050565b60008281526065602052604081206114fb9083611a9f565b90505b92915050565b60008281526065602052604081206114fb9083611aab565b6000806115293384610ce3565b91509150915091565b600054610100900460ff1661154d5760005460ff1615611551565b303b155b61156d5760405162461bcd60e51b8152600401610392906122a4565b600054610100900460ff1615801561158f576000805461ffff19166101011790555b61159882611acd565b609880546001600160a01b031916731820a4b7618bde71dce8cdc73aab6c95905fad249081179091556040516329965a1d60e01b815230600482018190527fb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b602483015260448201526329965a1d90606401600060405180830381600087803b15801561162457600080fd5b505af1158015611638573d6000803e3d6000fd5b505050508015610b79576000805461ff00191690555050565b60008181526065602052604081206114fe90611b5b565b6000828152606560205260409020600201546116849033611504565b610cd95760405162461bcd60e51b815260206004820152603060248201527f416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e60448201526f2061646d696e20746f207265766f6b6560801b6064820152608401610392565b60006116f58133611504565b905090565b609754604051633581777360e01b81526000916001600160a01b031690633581777390611729906004016121b1565b602060405180830381865afa158015611746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176a919061216a565b609754604051633581777360e01b81529192506000916001600160a01b039091169063358177739061179e90600401612187565b602060405180830381865afa1580156117bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117df919061216a565b90506000826001600160a01b031663ddd1b67e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611821573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184591906121d6565b60405163b5d8962760e01b8152600481018690529091506000906001600160a01b0384169063b5d8962790602401600060405180830381865afa158015611890573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118b891908101906123ba565b60800151905060006103e86118cd8389612263565b6118d79190612282565b905060006118e5828961249d565b600088815260996020908152604080832088845290915290205490915061190d908290612230565b6000888152609960209081526040808320888452825280832093909355898252609a815282822087835290522054611946908390612230565b6000888152609a60209081526040808320888452825280832093909355898252609c90522054611982576000878152609c602052604090208490555b60408051888152602081018a90527f92ba628f701eb8dddfffbfa9748da1d157c46a4ff477ebd022d3e729249bf1bf910161096c565b60008281526065602052604090206119d09082611b65565b15610b795760405133906001600160a01b0383169084907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d90600090a45050565b6000828152606560205260409020611a299082611b7a565b15610b795760405133906001600160a01b0383169084907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b90600090a45050565b600081611a7c620f424060001961249d565b11611a8957611a896124b4565b611a96620f424083612230565b90921192915050565b60006114fb8383611b8f565b6001600160a01b038116600090815260018301602052604081205415156114fb565b600054610100900460ff16611ae85760005460ff1615611aec565b303b155b611b085760405162461bcd60e51b8152600401610392906122a4565b600054610100900460ff16158015611b2a576000805461ffff19166101011790555b611b32611bb9565b611b3d600033610b6f565b611b4682611c3b565b8015610b79576000805461ff00191690555050565b60006114fe825490565b60006114fb836001600160a01b038416611d15565b60006114fb836001600160a01b038416611d64565b6000826000018281548110611ba657611ba66124ca565b9060005260206000200154905092915050565b600054610100900460ff16611bd45760005460ff1615611bd8565b303b155b611bf45760405162461bcd60e51b8152600401610392906122a4565b600054610100900460ff16158015611c16576000805461ffff19166101011790555b611c1e611e57565b611c26611ec4565b8015611c38576000805461ff00191690555b50565b6001600160a01b038116611c9c5760405162461bcd60e51b815260206004820152602260248201527f436f6e74726163744d616e616765722061646472657373206973206e6f742073604482015261195d60f21b6064820152608401610392565b6001600160a01b0381163b611cf35760405162461bcd60e51b815260206004820152601760248201527f41646472657373206973206e6f7420636f6e74726163740000000000000000006044820152606401610392565b609780546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600183016020526040812054611d5c575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556114fe565b5060006114fe565b60008181526001830160205260408120548015611e4d576000611d8860018361249d565b8554909150600090611d9c9060019061249d565b9050818114611e01576000866000018281548110611dbc57611dbc6124ca565b9060005260206000200154905080876000018481548110611ddf57611ddf6124ca565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611e1257611e126124e0565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506114fe565b60009150506114fe565b600054610100900460ff16611ec25760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610392565b565b600054610100900460ff16611edf5760005460ff1615611ee3565b303b155b611eff5760405162461bcd60e51b8152600401610392906122a4565b600054610100900460ff16158015611c26576000805461ffff19166101011790558015611c38576000805461ff001916905550565b6001600160a01b0381168114611c3857600080fd5b60008083601f840112611f5b57600080fd5b50813567ffffffffffffffff811115611f7357600080fd5b60208301915083602082850101111561109157600080fd5b60008060008060008060008060c0898b031215611fa757600080fd5b8835611fb281611f34565b97506020890135611fc281611f34565b96506040890135611fd281611f34565b955060608901359450608089013567ffffffffffffffff80821115611ff657600080fd5b6120028c838d01611f49565b909650945060a08b013591508082111561201b57600080fd5b506120288b828c01611f49565b999c989b5096995094979396929594505050565b60006020828403121561204e57600080fd5b813561205981611f34565b9392505050565b60006020828403121561207257600080fd5b5035919050565b6000806040838503121561208c57600080fd5b82359150602083013561209e81611f34565b809150509250929050565b600080604083850312156120bc57600080fd5b82356120c781611f34565b946020939093013593505050565b600080604083850312156120e857600080fd5b50508035926020909101359150565b60005b838110156121125781810151838201526020016120fa565b83811115612121576000848401525b50505050565b60208152600082518060208401526121468160408501602087016120f7565b601f01601f19169190910160400192915050565b805161216581611f34565b919050565b60006020828403121561217c57600080fd5b815161205981611f34565b60208082526010908201526f56616c696461746f725365727669636560801b604082015260600190565b6020808252600b908201526a54696d6548656c7065727360a81b604082015260600190565b6000602082840312156121e857600080fd5b5051919050565b8051801515811461216557600080fd5b60006020828403121561221157600080fd5b6114fb826121ef565b634e487b7160e01b600052601160045260246000fd5b600082198211156122435761224361221a565b500190565b600060001982141561225c5761225c61221a565b5060010190565b600081600019048311821515161561227d5761227d61221a565b500290565b60008261229f57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b604051610100810167ffffffffffffffff8111828210171561232c5761232c6122f2565b60405290565b600082601f83011261234357600080fd5b815167ffffffffffffffff8082111561235e5761235e6122f2565b604051601f8301601f19908116603f01168101908282118183101715612386576123866122f2565b8160405283815286602085880101111561239f57600080fd5b6123b08460208301602089016120f7565b9695505050505050565b6000602082840312156123cc57600080fd5b815167ffffffffffffffff808211156123e457600080fd5b9083019061010082860312156123f957600080fd5b612401612308565b82518281111561241057600080fd5b61241c87828601612332565b82525061242b6020840161215a565b602082015261243c6040840161215a565b604082015260608301518281111561245357600080fd5b61245f87828601612332565b6060830152506080830151608082015260a083015160a082015260c083015160c082015261248f60e084016121ef565b60e082015295945050505050565b6000828210156124af576124af61221a565b500390565b634e487b7160e01b600052600160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fdfea2646970667358221220e1eb3f44f4648dceb7a5d1c256abd550ab4c0e12e3142ed4bacbbc316e11e12264736f6c634300080b0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.