Feature Tip: Add private address tag to any address under My Name Tag !
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 152 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw User To... | 19704956 | 259 days ago | IN | 0 ETH | 0.00142824 | ||||
Withdraw User To... | 19648177 | 267 days ago | IN | 0 ETH | 0.00347989 | ||||
Withdraw User To... | 19611920 | 272 days ago | IN | 0 ETH | 0.0044087 | ||||
Withdraw User To... | 17849665 | 519 days ago | IN | 0 ETH | 0.00394313 | ||||
Withdraw User To... | 17849662 | 519 days ago | IN | 0 ETH | 0.00449507 | ||||
Withdraw User To... | 17813595 | 524 days ago | IN | 0 ETH | 0.00418853 | ||||
Withdraw User To... | 17813581 | 524 days ago | IN | 0 ETH | 0.00357661 | ||||
Withdraw User To... | 17803500 | 526 days ago | IN | 0 ETH | 0.00199234 | ||||
Withdraw User To... | 17799445 | 526 days ago | IN | 0 ETH | 0.00403847 | ||||
Withdraw User To... | 17734300 | 536 days ago | IN | 0 ETH | 0.00359255 | ||||
Withdraw User To... | 17721909 | 537 days ago | IN | 0 ETH | 0.00446697 | ||||
Withdraw User To... | 17689068 | 542 days ago | IN | 0 ETH | 0.00333994 | ||||
Withdraw User To... | 17665106 | 545 days ago | IN | 0 ETH | 0.00347246 | ||||
Withdraw User To... | 17649322 | 548 days ago | IN | 0 ETH | 0.00366992 | ||||
Withdraw User To... | 17646631 | 548 days ago | IN | 0 ETH | 0.00203429 | ||||
Withdraw User To... | 17646623 | 548 days ago | IN | 0 ETH | 0.00197007 | ||||
Withdraw User To... | 17642968 | 548 days ago | IN | 0 ETH | 0.00447382 | ||||
Withdraw User To... | 17642363 | 549 days ago | IN | 0 ETH | 0.00462254 | ||||
Withdraw User To... | 17642307 | 549 days ago | IN | 0 ETH | 0.00417064 | ||||
Withdraw User To... | 17642268 | 549 days ago | IN | 0 ETH | 0.00464243 | ||||
Withdraw User To... | 17637091 | 549 days ago | IN | 0 ETH | 0.00442294 | ||||
Withdraw User To... | 17629953 | 550 days ago | IN | 0 ETH | 0.00842054 | ||||
Withdraw User To... | 17625345 | 551 days ago | IN | 0 ETH | 0.00597882 | ||||
Withdraw User To... | 17623438 | 551 days ago | IN | 0 ETH | 0.00732752 | ||||
Withdraw User To... | 17621132 | 551 days ago | IN | 0 ETH | 0.00306498 |
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
16294745 | 738 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x091ee4d4...EA6310241 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
SLA
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.9; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import './interfaces/ISLARegistry.sol'; import './interfaces/IStakeRegistry.sol'; import './interfaces/IPeriodRegistry.sol'; import './interfaces/ISLORegistry.sol'; import './Staking.sol'; /** @title Service Level Agreement Contract */ contract SLA is Staking { enum Status { NotVerified, Respected, NotRespected } struct PeriodSLI { uint256 timestamp; uint256 sli; Status status; } string public ipfsHash; ISLARegistry private _slaRegistry; ISLORegistry private immutable _sloRegistry; uint256 public immutable creationBlockNumber; uint128 public immutable initialPeriodId; uint128 public immutable finalPeriodId; IPeriodRegistry.PeriodType public immutable periodType; /// @dev extra data for customized workflows uint256[] public severity; uint256[] public penalty; bool public terminateContract = false; uint256 public nextVerifiablePeriod; /// @dev periodId=>PeriodSLI mapping mapping(uint256 => PeriodSLI) public periodSLIs; /// @notice An event that is emitted when creating a new SLI event SLICreated(uint256 timestamp, uint256 sli, uint256 periodId); /// @notice An event that is emitted when staking in User or Provider Pool event Stake( address indexed tokenAddress, uint256 indexed periodId, address indexed caller, uint256 amount, Position position ); /// @notice An event that is emitted when withdrawing from Provider Pool event ProviderWithdraw( address indexed tokenAddress, uint256 indexed periodId, address indexed caller, uint256 amount ); /// @notice An event that is emitted when withdrawing from User Pool event UserWithdraw( address indexed tokenAddress, uint256 indexed periodId, address indexed caller, uint256 amount ); /// @notice An event that is emitted when toggles termination event ToggleTermination(bool termination); /// @dev Modifier ensuring that certain function can only be called by Messenger modifier onlyMessenger() { require(msg.sender == messengerAddress, 'not messenger'); _; } /** * @notice Constructor */ constructor( address _owner, bool _whitelisted, IPeriodRegistry.PeriodType _periodType, address _messengerAddress, uint128 _initialPeriodId, uint128 _finalPeriodId, uint128 _slaID, string memory _ipfsHash, uint256[] memory _severity, uint256[] memory _penalty, uint64 _leverage ) Staking( ISLARegistry(msg.sender), _whitelisted, _slaID, _leverage, _owner, _messengerAddress ) { transferOwnership(_owner); ipfsHash = _ipfsHash; _slaRegistry = ISLARegistry(msg.sender); _sloRegistry = ISLORegistry(_slaRegistry.sloRegistry()); creationBlockNumber = block.number; initialPeriodId = _initialPeriodId; finalPeriodId = _finalPeriodId; periodType = _periodType; severity = _severity; penalty = _penalty; nextVerifiablePeriod = _initialPeriodId; } /** * @notice External function that registers new SLI * @param _sli sli value to register * @param _periodId period id of new sli */ function registerSLI(uint256 _sli, uint256 _periodId) external onlyMessenger { require(_periodId == nextVerifiablePeriod, 'invalid period id'); emit SLICreated(block.timestamp, _sli, _periodId); nextVerifiablePeriod = _periodId + 1; PeriodSLI storage periodSLI = periodSLIs[_periodId]; periodSLI.sli = _sli; periodSLI.timestamp = block.timestamp; uint256 deviation = _sloRegistry.getDeviation( _sli, address(this), severity, penalty ); if (_sloRegistry.isRespected(_sli, address(this))) { periodSLI.status = Status.Respected; _setProviderReward(_periodId, deviation); } else { periodSLI.status = Status.NotRespected; _setUserReward(_periodId, deviation); } } /** @notice External view function to see if a period id is allowed or not @param _periodId period id to check @return bool allowed or not */ function isAllowedPeriod(uint256 _periodId) external view returns (bool) { return _periodId >= initialPeriodId && _periodId <= finalPeriodId; } /** * @notice Public view function to check if the contract is finished * @dev finish condition = should pass last verified period and final period should not be verified. * @return Bool whether finished or not */ function contractFinished() public view returns (bool) { (, uint256 endOfLastValidPeriod) = _periodRegistry.getPeriodStartAndEnd( periodType, finalPeriodId ); return ((block.timestamp >= endOfLastValidPeriod && periodSLIs[finalPeriodId].status != Status.NotVerified) || terminateContract); } /** * @notice External function to stake tokens in User or Provider Pools * @param _amount amount to withdraw * @param _tokenAddress token address to withdraw * @param _position User or Provider pool */ function stakeTokens( uint256 _amount, address _tokenAddress, Position _position ) external { require(!contractFinished(), 'This SLA has finished.'); require(_amount > 0, 'Stake must be greater than 0.'); _stake(_tokenAddress, nextVerifiablePeriod, _amount, _position); emit Stake( _tokenAddress, nextVerifiablePeriod, msg.sender, _amount, _position ); IStakeRegistry(_slaRegistry.stakeRegistry()).registerStakedSla( msg.sender ); } /** * @notice External function to withdraw staked tokens from Provider Pool * @param _amount amount to withdraw * @param _tokenAddress token address to withdraw */ function withdrawProviderTokens(uint256 _amount, address _tokenAddress) external { _withdrawProviderTokens( _amount, _tokenAddress, nextVerifiablePeriod, contractFinished() ); emit ProviderWithdraw( _tokenAddress, nextVerifiablePeriod, msg.sender, _amount ); } /** * @notice External function to withdraw staked tokens from User Pool * @param _amount amount to withdraw * @param _tokenAddress token address to withdraw */ function withdrawUserTokens(uint256 _amount, address _tokenAddress) external { _withdrawUserTokens( _amount, _tokenAddress, nextVerifiablePeriod, contractFinished() ); emit UserWithdraw( _tokenAddress, nextVerifiablePeriod, msg.sender, _amount ); } function toggleTermination() external onlyOwner { (, uint256 endOfLastValidPeriod) = _periodRegistry.getPeriodStartAndEnd( periodType, finalPeriodId ); require( block.timestamp >= endOfLastValidPeriod, 'This SLA has not finished.' ); terminateContract = !terminateContract; emit ToggleTermination(terminateContract); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.9; interface ISLARegistry { function sloRegistry() external view returns (address); function periodRegistry() external view returns (address); function messengerRegistry() external view returns (address); function stakeRegistry() external view returns (address); function isRegisteredSLA(address _slaAddress) external view returns (bool); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.9; interface IStakeRegistry { function registerStakedSla(address _owner) external returns (bool); function setSLARegistry() external; function lockDSLAValue( address slaOwner_, address sla_, uint256 periodIdsLength_ ) external; function getStakingParameters() external view returns ( uint256 DSLAburnRate, uint256 dslaDepositByPeriod, uint256 dslaPlatformReward, uint256 dslaMessengerReward, uint256 dslaUserReward, uint256 dslaBurnedByVerification, uint256 maxTokenLength, uint64 maxLeverage, bool burnDSLA ); function DSLATokenAddress() external view returns (address); function isAllowedToken(address tokenAddress_) external view returns (bool); function periodIsVerified(address _sla, uint256 _periodId) external view returns (bool); function returnLockedValue(address sla_) external; function distributeVerificationRewards( address _sla, address _verificationRewardReceiver, uint256 _periodId ) external; function createDToken( string calldata _name, string calldata _symbol, uint8 decimals ) external returns (address); function owner() external view returns (address); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.9; interface IPeriodRegistry { enum PeriodType { Hourly, Daily, Weekly, BiWeekly, Monthly, Yearly } function getPeriodStartAndEnd(PeriodType _periodType, uint256 _periodId) external view returns (uint256, uint256); function isValidPeriod(PeriodType _periodType, uint256 _periodId) external view returns (bool); function isInitializedPeriod(PeriodType _periodType) external view returns (bool); function periodHasStarted(PeriodType _periodType, uint256 _periodId) external view returns (bool); function periodIsFinished(PeriodType _periodType, uint256 _periodId) external view returns (bool); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.9; interface ISLORegistry { function getDeviation( uint256 _sli, address _slaAddress, uint256[] calldata _severity, uint256[] calldata _penalty ) external view returns (uint256); function isRespected(uint256 _value, address _slaAddress) external view returns (bool); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.9; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import './interfaces/IStakeRegistry.sol'; import './interfaces/ISLARegistry.sol'; import './interfaces/IPeriodRegistry.sol'; import './interfaces/IMessenger.sol'; import './interfaces/IERC20Query.sol'; import './dToken.sol'; /** * @title Staking * @notice Staking of user and provider pool rewards */ contract Staking is Ownable, ReentrancyGuard { using SafeERC20 for IERC20; /// @notice Position of staking /// @dev OK => Provider Pool (LONG), KO => User Pool (SHORT) enum Position { OK, KO } /// @dev StakeRegistry contract IStakeRegistry private _stakeRegistry; /// @dev SLARegistry contract IPeriodRegistry internal immutable _periodRegistry; /// @dev DSLA token address to burn fees address private immutable _dslaTokenAddress; /// @dev messenger address address public immutable messengerAddress; /// @dev current SLA id uint128 public immutable slaID; /// @dev (tokenAddress=>uint256) total pooled token balance mapping(address => uint256) public providersPool; /// @dev (userAddress=>uint256) provider staking activity mapping(address => uint256) public lastProviderStake; /// @dev (tokenAddress=>uint256) user staking mapping(address => uint256) public usersPool; /// @dev (userAddress=>uint256) user staking activity mapping(address => uint256) public lastUserStake; ///@dev (tokenAddress=>dTokenAddress) to keep track of dToken for users mapping(address => dToken) public duTokenRegistry; ///@dev (tokenAddress=>dTokenAddress) to keep track of dToken for provider mapping(address => dToken) public dpTokenRegistry; /// @dev (slaOwner=>bool) mapping(address => bool) public registeredStakers; /// @dev number of stakers uint256 public stakersNum; /// @dev array with the allowed tokens addresses for the current SLA address[] public allowedTokens; /// @dev corresponds to the burn rate of DSLA tokens, but divided by 1000 i.e burn percentage = burnRate/1000 % uint256 public immutable DSLAburnRate; /// @dev boolean to declare if contract is whitelisted bool public immutable whitelistedContract; /// @dev (userAddress=bool) to declare whitelisted addresses mapping(address => bool) public whitelist; uint64 public immutable leverage; /// @dev claiming fees when a user claim tokens, base 10000 uint16 private constant ownerRewardsRate = 30; // 0.3%, base 10000 uint16 private constant protocolRewardsRate = 15; // 0.15%, base 10000 uint16 private constant rewardsCapRate = 2500; // 25%, base 10000 modifier onlyAllowedToken(address _token) { require(isAllowedToken(_token), 'This token is not allowed.'); _; } modifier onlyWhitelisted() { if (whitelistedContract) { require(whitelist[msg.sender], 'not whitelisted'); } _; } /// @notice An event that emitted when generating provider rewards event ProviderRewardGenerated( uint256 indexed periodId, address indexed tokenAddress, uint256 rewardPercentage, uint256 rewardPercentagePrecision, uint256 rewardAmount ); /// @notice An event that emitted when generating user rewards event UserCompensationGenerated( uint256 indexed periodId, address indexed tokenAddress, uint256 userStake, uint256 leverage, uint256 compensation ); /// @notice An event that emitted when owner adds new dTokens event DTokensCreated( address indexed tokenAddress, address indexed dpTokenAddress, string dpTokenName, string dpTokenSymbol, address indexed duTokenAddress, string duTokenName, string duTokenSymbol ); /** * @notice Constructor * @param slaRegistry_ SLARegistry address * @param whitelistedContract_ Declare if contract is whitelisted * @param slaID_ ID of SLA * @param leverage_ Leverage of reward * @param contractOwner_ SLA Owner address * @param messengerAddress_ Messenger Address */ constructor( ISLARegistry slaRegistry_, bool whitelistedContract_, uint128 slaID_, uint64 leverage_, address contractOwner_, address messengerAddress_ ) { require(contractOwner_ != address(0x0), 'invalid owner address'); require(messengerAddress_ != address(0x0), 'invalid messenger address'); _stakeRegistry = IStakeRegistry(slaRegistry_.stakeRegistry()); _periodRegistry = IPeriodRegistry(slaRegistry_.periodRegistry()); whitelistedContract = whitelistedContract_; ( uint256 _DSLAburnRate, , , , , , , uint64 _maxLeverage, ) = _stakeRegistry.getStakingParameters(); _dslaTokenAddress = _stakeRegistry.DSLATokenAddress(); DSLAburnRate = _DSLAburnRate; whitelist[contractOwner_] = true; slaID = slaID_; require( leverage_ <= _maxLeverage && leverage_ >= 1, 'incorrect leverage' ); leverage = leverage_; messengerAddress = messengerAddress_; } /** * @notice Add multiple addresses to whitelist * @dev only owner can call this function * @param _userAddresses Addresses to whitelist */ function addUsersToWhitelist(address[] memory _userAddresses) public onlyOwner { for (uint256 index = 0; index < _userAddresses.length; index++) { if (!whitelist[_userAddresses[index]]) { whitelist[_userAddresses[index]] = true; } } } /** * @notice Remove multiple addresses from whitelist * @dev only owner can call this function * @param _userAddresses Addresses to remove */ function removeUsersFromWhitelist(address[] calldata _userAddresses) external onlyOwner { for (uint256 index = 0; index < _userAddresses.length; index++) { if (whitelist[_userAddresses[index]]) { whitelist[_userAddresses[index]] = false; } } } /** * @notice Add token to allowedTokens list * @dev It creates dpToken(Provider) and duToken(User) that represents the position. only owner can call this function * @param _tokenAddress Token address to allow */ function addAllowedTokens(address _tokenAddress) external onlyOwner { (, , , , , , uint256 maxTokenLength, , ) = _stakeRegistry .getStakingParameters(); require( !isAllowedToken(_tokenAddress), 'This token has been allowed already.' ); require( _stakeRegistry.isAllowedToken(_tokenAddress), 'This token is not allowed.' ); allowedTokens.push(_tokenAddress); require(maxTokenLength >= allowedTokens.length, 'max token length'); string memory duTokenName = IMessenger(messengerAddress).spName(); string memory duTokenSymbol = IMessenger(messengerAddress) .spSymbolSlaId(slaID); string memory dpTokenName = IMessenger(messengerAddress).lpName(); string memory dpTokenSymbol = IMessenger(messengerAddress) .lpSymbolSlaId(slaID); uint8 decimals = IERC20Query(_tokenAddress).decimals(); dToken duToken = dToken( _stakeRegistry.createDToken(duTokenName, duTokenSymbol, decimals) ); dToken dpToken = dToken( _stakeRegistry.createDToken(dpTokenName, dpTokenSymbol, decimals) ); dpTokenRegistry[_tokenAddress] = dpToken; duTokenRegistry[_tokenAddress] = duToken; emit DTokensCreated( _tokenAddress, address(dpToken), dpTokenName, dpTokenSymbol, address(duToken), duTokenName, duTokenSymbol ); } /** * @notice Stake allowed assets in User or Provider pools until next period * @param _tokenAddress Address of token to stake * @param _nextVerifiablePeriod Next verifiable PeriodId * @param _amount Amount of tokens to stake * @param _position Staking position, OK or KO */ function _stake( address _tokenAddress, uint256 _nextVerifiablePeriod, uint256 _amount, Position _position ) internal onlyAllowedToken(_tokenAddress) onlyWhitelisted nonReentrant { IERC20(_tokenAddress).safeTransferFrom( msg.sender, address(this), _amount ); // DSLA-SP proofs of SLA Position if (_position == Position.KO) { require( (usersPool[_tokenAddress] + _amount) * leverage <= providersPool[_tokenAddress], 'Stake exceeds leveraged cap.' ); dToken duToken = duTokenRegistry[_tokenAddress]; uint256 p0 = duToken.totalSupply(); // If there are no minted tokens, then mint them 1:1 if (p0 == 0) { duToken.mint(msg.sender, _amount); } else { // mint dTokens proportionally duToken.mint( msg.sender, (_amount * p0) / usersPool[_tokenAddress] ); } usersPool[_tokenAddress] += _amount; lastUserStake[msg.sender] = _nextVerifiablePeriod; } // DSLA-LP proofs of SLA Position if (_position == Position.OK) { dToken dpToken = dpTokenRegistry[_tokenAddress]; uint256 p0 = dpToken.totalSupply(); if (p0 == 0) { dpToken.mint(msg.sender, _amount); } else { // mint dTokens proportionally dpToken.mint( msg.sender, (_amount * p0) / providersPool[_tokenAddress] ); } providersPool[_tokenAddress] += _amount; lastProviderStake[msg.sender] = _nextVerifiablePeriod; } if (!registeredStakers[msg.sender]) { registeredStakers[msg.sender] = true; stakersNum++; } } /** * @notice Set rewards of provider pool for specific periodId * @param _periodId Period ID to set rewards * @param _rewardPercentage Percentage to allocate for rewards, base 10000 */ function _setProviderReward(uint256 _periodId, uint256 _rewardPercentage) internal { uint256 _precision = 10000; for (uint256 index = 0; index < allowedTokens.length; index++) { address tokenAddress = allowedTokens[index]; uint256 reward = (providersPool[tokenAddress] * _rewardPercentage) / (leverage * _precision); // Reward must be less than 25% of usersPool to ensure payout at all time if ( reward > (usersPool[tokenAddress] * rewardsCapRate) / _precision ) { reward = (usersPool[tokenAddress] * _rewardPercentage) / _precision; } usersPool[tokenAddress] -= reward; providersPool[tokenAddress] += reward; emit ProviderRewardGenerated( _periodId, tokenAddress, _rewardPercentage, _precision, reward ); } } /** * @notice Set rewards of user pool for specific periodId * @param _periodId Period ID to set rewards * @param _rewardPercentage Percentage to allocate for rewards, base 10000 */ function _setUserReward(uint256 _periodId, uint256 _rewardPercentage) internal { uint256 _precision = 10000; for (uint256 index = 0; index < allowedTokens.length; index++) { address tokenAddress = allowedTokens[index]; uint256 compensation = (usersPool[tokenAddress] * leverage * _rewardPercentage) / _precision; // Compensation must be less than 25% of providersPool to ensure payout at all time if ( compensation > (providersPool[tokenAddress] * rewardsCapRate) / _precision ) { compensation = (providersPool[tokenAddress] * _rewardPercentage) / _precision; } providersPool[tokenAddress] -= compensation; usersPool[tokenAddress] += compensation; emit UserCompensationGenerated( _periodId, tokenAddress, usersPool[tokenAddress], leverage, compensation ); } } /** * @notice Withdraw staked tokens from Provider Pool * @param _amount Amount to withdraw * @param _tokenAddress Token address to withdraw * @param _nextVerifiablePeriod Next verifiable period id of current period * @param _contractFinished Present if SLA is terminated or finished */ function _withdrawProviderTokens( uint256 _amount, address _tokenAddress, uint256 _nextVerifiablePeriod, bool _contractFinished ) internal onlyAllowedToken(_tokenAddress) nonReentrant { if (!_contractFinished) { require( lastProviderStake[msg.sender] < _nextVerifiablePeriod, 'Provider lock-up until the next verification.' ); // Allow provider withdrawal as long as the provider pool exceeds the leveraged user pool require( providersPool[_tokenAddress] - _amount >= usersPool[_tokenAddress] * leverage, 'Withdrawal exceeds leveraged cap.' ); } dToken dpToken = dpTokenRegistry[_tokenAddress]; // Burn duTokens in a way that doesn't affect the Provider Pool / DSLA-SP Pool average // t0/p0 = (t0-_amount)/(p0-burnedDPTokens) dpToken.burnFrom( msg.sender, (_amount * dpToken.totalSupply()) / providersPool[_tokenAddress] ); providersPool[_tokenAddress] -= _amount; uint256 outstandingAmount = _distributeClaimingRewards( _amount, _tokenAddress ); IERC20(_tokenAddress).safeTransfer(msg.sender, outstandingAmount); } /** * @notice Withdraw staked tokens from User Pool * @param _amount Amount to withdraw * @param _tokenAddress Token address to withdraw * @param _nextVerifiablePeriod Next verifiable period id of current period * @param _contractFinished Present if SLA is terminated or finished */ function _withdrawUserTokens( uint256 _amount, address _tokenAddress, uint256 _nextVerifiablePeriod, bool _contractFinished ) internal onlyAllowedToken(_tokenAddress) nonReentrant { if (!_contractFinished) { require( lastUserStake[msg.sender] < _nextVerifiablePeriod, 'User lock-up until the next verification.' ); } dToken duToken = duTokenRegistry[_tokenAddress]; // Burn duTokens in a way that doesn't affect the User Pool / DSLA-SP Pool average // t0/p0 = (t0-_amount)/(p0-burnedDUTokens) duToken.burnFrom( msg.sender, (_amount * duToken.totalSupply()) / usersPool[_tokenAddress] ); usersPool[_tokenAddress] -= _amount; uint256 outstandingAmount = _distributeClaimingRewards( _amount, _tokenAddress ); IERC20(_tokenAddress).safeTransfer(msg.sender, outstandingAmount); } /** * @notice Distribute rewards to owner and protocol when user claims * @param _amount Amount to withdraw * @param _tokenAddress Token address to withdraw * @return outstandingAmount */ function _distributeClaimingRewards(uint256 _amount, address _tokenAddress) internal returns (uint256) { uint256 slaOwnerRewards = (_amount * ownerRewardsRate) / 10000; uint256 protocolRewards = (_amount * protocolRewardsRate) / 10000; IERC20(_tokenAddress).safeTransfer(owner(), slaOwnerRewards); IERC20(_tokenAddress).safeTransfer( _stakeRegistry.owner(), protocolRewards ); return _amount - slaOwnerRewards - protocolRewards; } /** * @notice Get number of allowed tokens * @return Number of allowed tokens */ function getAllowedTokensLength() external view returns (uint256) { return allowedTokens.length; } /** * @notice External view function that returns the number of stakers * @return Number of stakers */ function getStakersLength() external view returns (uint256) { return stakersNum; } /** * @notice Check if the token is allowed or not * @param _tokenAddress Token address to check allowance * @return isAllowed */ function isAllowedToken(address _tokenAddress) public view returns (bool) { for (uint256 index = 0; index < allowedTokens.length; index++) { if (allowedTokens[index] == _tokenAddress) { return true; } } return false; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.9; import '@openzeppelin/contracts/access/Ownable.sol'; /** * @title IMessenger * @dev Interface to create new Messenger contract to add lo Messenger lists */ abstract contract IMessenger is Ownable { struct SLIRequest { address slaAddress; uint256 periodId; } /** * @dev event emitted when created a new chainlink request * @param caller 1. Requester's address * @param requestsCounter 2. total count of requests * @param requestId 3. id of the Chainlink request */ event SLIRequested( address indexed caller, uint256 requestsCounter, bytes32 requestId ); /** * @dev event emitted when having a response from Chainlink with the SLI * @param slaAddress 1. SLA address to store the SLI * @param periodId 2. period id * @param requestId 3. id of the Chainlink request * @param chainlinkResponse 4. response from Chainlink */ event SLIReceived( address indexed slaAddress, uint256 periodId, bytes32 indexed requestId, bytes32 chainlinkResponse ); /** * @dev event emitted when updating Chainlink Job ID * @param owner 1. Oracle Owner * @param jobId 2. Updated job id * @param fee 3. Chainlink request fee */ event JobIdModified(address indexed owner, bytes32 jobId, uint256 fee); /** * @dev sets the SLARegistry contract address and can only be called once */ function setSLARegistry() external virtual; /** * @dev creates a ChainLink request to get a new SLI value for the * given params. Can only be called by the SLARegistry contract or Chainlink Oracle. * @param _periodId 1. id of the period to be queried * @param _slaAddress 2. address of the receiver SLA * @param _slaAddress 2. if approval by owner or msg.sender */ function requestSLI( uint256 _periodId, address _slaAddress, bool _ownerApproval, address _callerAddress ) external virtual; /** * @dev callback function for the Chainlink SLI request which stores * the SLI in the SLA contract * @param _requestId the ID of the ChainLink request * @param answer response object from Chainlink Oracles */ function fulfillSLI(bytes32 _requestId, uint256 answer) external virtual; /** * @dev gets the interfaces precision */ function messengerPrecision() external view virtual returns (uint256); /** * @dev gets the slaRegistryAddress */ function slaRegistryAddress() external view virtual returns (address); /** * @dev gets the chainlink oracle contract address */ function oracle() external view virtual returns (address); /** * @dev gets the chainlink job id */ function jobId() external view virtual returns (bytes32); /** * @dev gets the fee amount of LINK token */ function fee() external view virtual returns (uint256); /** * @dev returns the requestsCounter */ function requestsCounter() external view virtual returns (uint256); /** * @dev returns the fulfillsCounter */ function fulfillsCounter() external view virtual returns (uint256); /** * @dev returns the name of DSLA-LP token */ function lpName() external view virtual returns (string memory); /** * @dev returns the symbol of DSLA-LP token */ function lpSymbol() external view virtual returns (string memory); /** * @dev returns the symbol of DSLA-LP token with slaId */ function lpSymbolSlaId(uint128 slaId) external view virtual returns (string memory); /** * @dev returns the name of DSLA-SP token */ function spName() external view virtual returns (string memory); /** * @dev returns the symbol of DSLA-SP token */ function spSymbol() external view virtual returns (string memory); /** * @dev returns the symbol of DSLA-SP token with slaId */ function spSymbolSlaId(uint128 slaId) external view virtual returns (string memory); function setChainlinkJobID(bytes32 _newJobId, uint256 _feeMultiplier) external virtual; function retryRequest(address _slaAddress, uint256 _periodId) external virtual; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.9; interface IERC20Query { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); function symbol() external view returns (string memory); function name() external view returns (string memory); function balanceOf(address account) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transfer(address recipient, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.9; import '@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol'; contract dToken is ERC20PresetMinterPauser { uint8 _decimals; constructor( string memory name, string memory symbol, uint8 decimals_ ) ERC20PresetMinterPauser(name, symbol) { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); _decimals = decimals_; } function decimals() public view override returns (uint8) { return _decimals; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/presets/ERC20PresetMinterPauser.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../extensions/ERC20Burnable.sol"; import "../extensions/ERC20Pausable.sol"; import "../../../access/AccessControlEnumerable.sol"; import "../../../utils/Context.sol"; /** * @dev {ERC20} token, including: * * - ability for holders to burn (destroy) their tokens * - a minter role that allows for token minting (creation) * - a pauser role that allows to stop all token transfers * * This contract uses {AccessControl} to lock permissioned functions using the * different roles - head to its documentation for details. * * The account that deploys the contract will be granted the minter and pauser * roles, as well as the default admin role, which will let it grant both minter * and pauser roles to other accounts. * * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._ */ contract ERC20PresetMinterPauser is Context, AccessControlEnumerable, ERC20Burnable, ERC20Pausable { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); /** * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the * account that deploys the contract. * * See {ERC20-constructor}. */ constructor(string memory name, string memory symbol) ERC20(name, symbol) { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); } /** * @dev Creates `amount` new tokens for `to`. * * See {ERC20-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mint(address to, uint256 amount) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint"); _mint(to, amount); } /** * @dev Pauses all token transfers. * * See {ERC20Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to pause"); _pause(); } /** * @dev Unpauses all token transfers. * * See {ERC20Pausable} and {Pausable-_unpause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function unpause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to unpause"); _unpause(); } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override(ERC20, ERC20Pausable) { super._beforeTokenTransfer(from, to, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../security/Pausable.sol"; /** * @dev ERC20 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC20Pausable is ERC20, Pausable { /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!paused(), "ERC20Pausable: token transfer while paused"); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position 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; /// @solidity memory-safe-assembly 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; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"bool","name":"_whitelisted","type":"bool"},{"internalType":"enum IPeriodRegistry.PeriodType","name":"_periodType","type":"uint8"},{"internalType":"address","name":"_messengerAddress","type":"address"},{"internalType":"uint128","name":"_initialPeriodId","type":"uint128"},{"internalType":"uint128","name":"_finalPeriodId","type":"uint128"},{"internalType":"uint128","name":"_slaID","type":"uint128"},{"internalType":"string","name":"_ipfsHash","type":"string"},{"internalType":"uint256[]","name":"_severity","type":"uint256[]"},{"internalType":"uint256[]","name":"_penalty","type":"uint256[]"},{"internalType":"uint64","name":"_leverage","type":"uint64"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"address","name":"dpTokenAddress","type":"address"},{"indexed":false,"internalType":"string","name":"dpTokenName","type":"string"},{"indexed":false,"internalType":"string","name":"dpTokenSymbol","type":"string"},{"indexed":true,"internalType":"address","name":"duTokenAddress","type":"address"},{"indexed":false,"internalType":"string","name":"duTokenName","type":"string"},{"indexed":false,"internalType":"string","name":"duTokenSymbol","type":"string"}],"name":"DTokensCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"periodId","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardPercentage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardPercentagePrecision","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"ProviderRewardGenerated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"periodId","type":"uint256"},{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ProviderWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sli","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"periodId","type":"uint256"}],"name":"SLICreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"periodId","type":"uint256"},{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"enum Staking.Position","name":"position","type":"uint8"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"termination","type":"bool"}],"name":"ToggleTermination","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"periodId","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"userStake","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"leverage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"compensation","type":"uint256"}],"name":"UserCompensationGenerated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"periodId","type":"uint256"},{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"UserWithdraw","type":"event"},{"inputs":[],"name":"DSLAburnRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"addAllowedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_userAddresses","type":"address[]"}],"name":"addUsersToWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allowedTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractFinished","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"creationBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"dpTokenRegistry","outputs":[{"internalType":"contract dToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"duTokenRegistry","outputs":[{"internalType":"contract dToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finalPeriodId","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllowedTokensLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStakersLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialPeriodId","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ipfsHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_periodId","type":"uint256"}],"name":"isAllowedPeriod","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"isAllowedToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastProviderStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastUserStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"leverage","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messengerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextVerifiablePeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"penalty","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"periodSLIs","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"sli","type":"uint256"},{"internalType":"enum SLA.Status","name":"status","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodType","outputs":[{"internalType":"enum IPeriodRegistry.PeriodType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"providersPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_sli","type":"uint256"},{"internalType":"uint256","name":"_periodId","type":"uint256"}],"name":"registerSLI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"registeredStakers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_userAddresses","type":"address[]"}],"name":"removeUsersFromWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"severity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"slaID","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"enum Staking.Position","name":"_position","type":"uint8"}],"name":"stakeTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakersNum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"terminateContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleTermination","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"usersPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whitelistedContract","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"withdrawProviderTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"withdrawUserTokens","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102535760003560e01c80635e5f2e2611610146578063a224ee9c116100c3578063c8b5c24811610087578063c8b5c2481461065c578063cbe230c31461066f578063d7a5c42214610682578063ded81d2b14610695578063f2db10fe146106b5578063f2fde38b146106dc57600080fd5b8063a224ee9c146105ec578063a7e8d8d414610613578063b1659bad14610636578063b7bc347e1461063f578063c623674f1461064757600080fd5b806396f76f111161010a57806396f76f11146105865780639939219d1461058e5780639b19251a146105a15780639eacc13b146105c45780639fabeb00146105e457600080fd5b80635e5f2e26146105345780636f9064d714610547578063715018a61461055a5780638d21c770146105625780638da5cb5b1461057557600080fd5b80632fd949ca116101d45780634e0c91f6116101985780634e0c91f6146104885780634fb2647e146104c95780635ae698ff146104f25780635c1c20de146105055780635d7655ca1461052c57600080fd5b80632fd949ca146103bf5780633385d334146103cc5780634190edde146103f357806346e0fbae14610434578063484fbf2b1461046857600080fd5b80631bf309291161021b5780631bf30929146102e657806325091a081461030d5780632526743a1461032d57806326db18ac1461036c5780632c86d98e1461037f57600080fd5b8063021eef7f1461025857806304dfda391461028057806308728f6e146102a1578063171e44ea146102aa57806318e45427146102bf575b600080fd5b61026b610266366004612d2d565b6106ef565b60405190151581526020015b60405180910390f35b61029361028e366004612d2d565b610759565b604051908152602001610277565b610293600a5481565b6102bd6102b8366004612d5b565b61077a565b005b61026b7f000000000000000000000000000000000000000000000000000000000000000081565b6102937f0000000000000000000000000000000000000000000000000000000000f8a35981565b61029361031b366004612d5b565b60036020526000908152604090205481565b6103547f000000000000000000000000000000000000000000000000000000000000000281565b6040516001600160801b039091168152602001610277565b6102bd61037a366004612d78565b610e7d565b6103a67f000000000000000000000000000000000000000000000000000000000000000181565b60405167ffffffffffffffff9091168152602001610277565b60115461026b9060ff1681565b6103547f000000000000000000000000000000000000000000000000000000000000000781565b610425610401366004612d2d565b60136020526000908152604090208054600182015460029092015490919060ff1683565b60405161027793929190612dbe565b61045b7f000000000000000000000000000000000000000000000000000000000000000481565b6040516102779190612dfe565b610293610476366004612d5b565b60056020526000908152604090205481565b6104b1610496366004612d5b565b6007602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610277565b6104b16104d7366004612d5b565b6008602052600090815260409020546001600160a01b031681565b6102bd610500366004612e53565b610ee6565b6102937f000000000000000000000000000000000000000000000000000000000000000381565b6102bd610fa9565b6104b1610542366004612d2d565b611135565b610293610555366004612d2d565b61115f565b6102bd61116f565b6102bd610570366004612f05565b611183565b6000546001600160a01b03166104b1565b61026b611250565b6102bd61059c366004612f7a565b6113a5565b61026b6105af366004612d5b565b600c6020526000908152604090205460ff1681565b6102936105d2366004612d5b565b60046020526000908152604090205481565b600a54610293565b6104b17f000000000000000000000000028a3aa14d41753174fa117be234d04686f4471281565b61026b610621366004612d5b565b60096020526000908152604090205460ff1681565b61029360125481565b600b54610293565b61064f6115a8565b6040516102779190613018565b6102bd61066a366004612d78565b611636565b61026b61067d366004612d5b565b611693565b6102bd61069036600461302b565b6116fd565b6102936106a3366004612d5b565b60066020526000908152604090205481565b6103547f000000000000000000000000000000000000000000000000000000000000000181565b6102bd6106ea366004612d5b565b611996565b60007f00000000000000000000000000000000000000000000000000000000000000026001600160801b0316821015801561075357507f00000000000000000000000000000000000000000000000000000000000000076001600160801b03168211155b92915050565b600f818154811061076957600080fd5b600091825260209091200154905081565b610782611a0f565b60025460408051637b8041cf60e11b815290516000926001600160a01b03169163f700839e91600480830192610120929190829003018186803b1580156107c857600080fd5b505afa1580156107dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108009190613062565b5050965050505050505061081382611693565b156108715760405162461bcd60e51b8152602060048201526024808201527f5468697320746f6b656e20686173206265656e20616c6c6f77656420616c726560448201526330b23c9760e11b60648201526084015b60405180910390fd5b60025460405163cbe230c360e01b81526001600160a01b0384811660048301529091169063cbe230c39060240160206040518083038186803b1580156108b657600080fd5b505afa1580156108ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ee91906130e8565b61090a5760405162461bcd60e51b815260040161086890613103565b600b805460018101825560008290527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180546001600160a01b0319166001600160a01b038516179055548110156109975760405162461bcd60e51b815260206004820152601060248201526f0dac2f040e8ded6cadc40d8cadccee8d60831b6044820152606401610868565b60007f000000000000000000000000028a3aa14d41753174fa117be234d04686f447126001600160a01b03166376ff294b6040518163ffffffff1660e01b815260040160006040518083038186803b1580156109f257600080fd5b505afa158015610a06573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a2e919081019061313a565b6040516308cb8e2360e11b81526001600160801b037f00000000000000000000000000000000000000000000000000000000000000011660048201529091506000906001600160a01b037f000000000000000000000000028a3aa14d41753174fa117be234d04686f4471216906311971c469060240160006040518083038186803b158015610abc57600080fd5b505afa158015610ad0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610af8919081019061313a565b905060007f000000000000000000000000028a3aa14d41753174fa117be234d04686f447126001600160a01b03166346cd68016040518163ffffffff1660e01b815260040160006040518083038186803b158015610b5557600080fd5b505afa158015610b69573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b91919081019061313a565b60405163cb8d3fcf60e01b81526001600160801b037f00000000000000000000000000000000000000000000000000000000000000011660048201529091506000906001600160a01b037f000000000000000000000000028a3aa14d41753174fa117be234d04686f44712169063cb8d3fcf9060240160006040518083038186803b158015610c1f57600080fd5b505afa158015610c33573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c5b919081019061313a565b90506000866001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610c9857600080fd5b505afa158015610cac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd091906131ce565b6002546040516340c71f0f60e01b81529192506000916001600160a01b03909116906340c71f0f90610d0a908990899087906004016131f1565b602060405180830381600087803b158015610d2457600080fd5b505af1158015610d38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5c919061322a565b6002546040516340c71f0f60e01b81529192506000916001600160a01b03909116906340c71f0f90610d96908890889088906004016131f1565b602060405180830381600087803b158015610db057600080fd5b505af1158015610dc4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de8919061322a565b6001600160a01b03808b16600081815260086020908152604080832080548688166001600160a01b0319918216811790925560079093529281902080549589169590921685179091555193945091927fce8c390dc55dbcd418078f1391fbb7d471c01c228fc4464926095354cb27c02990610e6a908a908a908e908e90613247565b60405180910390a4505050505050505050565b610e928282601254610e8d611250565b611a69565b336001600160a01b0316601254826001600160a01b03167f5d73c1b3aab5bae46e08e09668d192166389623bef76bbe8cdae8df8ad320fce85604051610eda91815260200190565b60405180910390a45050565b610eee611a0f565b60005b8151811015610fa557600c6000838381518110610f1057610f10613294565b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff16610f93576001600c6000848481518110610f5357610f53613294565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610f9d816132c0565b915050610ef1565b5050565b610fb1611a0f565b60405160016259edcb60e01b031981526000906001600160a01b037f0000000000000000000000009fdff860daffddb4432897f0b838f285c77458d9169063ffa6123590611045907f0000000000000000000000000000000000000000000000000000000000000004907f0000000000000000000000000000000000000000000000000000000000000007906004016132db565b604080518083038186803b15801561105c57600080fd5b505afa158015611070573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109491906132ff565b915050804210156110e75760405162461bcd60e51b815260206004820152601a60248201527f5468697320534c4120686173206e6f742066696e69736865642e0000000000006044820152606401610868565b6011805460ff8082161560ff1990921682179092556040519116151581527f8259ff2e8d1f54e9c760a378e427d394a361d8b57fef4298a3c5b2094e61a7029060200160405180910390a150565b600b818154811061114557600080fd5b6000918252602090912001546001600160a01b0316905081565b6010818154811061076957600080fd5b611177611a0f565b6111816000611c9b565b565b61118b611a0f565b60005b8181101561124b57600c60008484848181106111ac576111ac613294565b90506020020160208101906111c19190612d5b565b6001600160a01b0316815260208101919091526040016000205460ff1615611239576000600c60008585858181106111fb576111fb613294565b90506020020160208101906112109190612d5b565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790555b80611243816132c0565b91505061118e565b505050565b6000807f0000000000000000000000009fdff860daffddb4432897f0b838f285c77458d96001600160a01b031663ffa612357f00000000000000000000000000000000000000000000000000000000000000047f00000000000000000000000000000000000000000000000000000000000000076040518363ffffffff1660e01b81526004016112e19291906132db565b604080518083038186803b1580156112f857600080fd5b505afa15801561130c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133091906132ff565b91505080421015801561139257507f00000000000000000000000000000000000000000000000000000000000000076001600160801b0316600090815260136020526040812060029081015460ff169081111561138f5761138f612da8565b14155b8061139f575060115460ff165b91505090565b6113ad611250565b156113f35760405162461bcd60e51b81526020600482015260166024820152752a3434b99029a620903430b9903334b734b9b432b21760511b6044820152606401610868565b600083116114435760405162461bcd60e51b815260206004820152601d60248201527f5374616b65206d7573742062652067726561746572207468616e20302e0000006044820152606401610868565b611451826012548584611ceb565b336001600160a01b0316601254836001600160a01b03167f0aeac0345c75d03926da69972a2eeeb3dcf7108d6fd4aa1bcc1c7bed84cc87578685604051611499929190613323565b60405180910390a4600e60009054906101000a90046001600160a01b03166001600160a01b031663683048356040518163ffffffff1660e01b815260040160206040518083038186803b1580156114ef57600080fd5b505afa158015611503573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611527919061322a565b604051635948284760e11b81523360048201526001600160a01b03919091169063b290508e90602401602060405180830381600087803b15801561156a57600080fd5b505af115801561157e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a291906130e8565b50505050565b600d80546115b590613347565b80601f01602080910402602001604051908101604052809291908181526020018280546115e190613347565b801561162e5780601f106116035761010080835404028352916020019161162e565b820191906000526020600020905b81548152906001019060200180831161161157829003601f168201915b505050505081565b61164b8282601254611646611250565b61229d565b336001600160a01b0316601254826001600160a01b03167fbd9be3d6449ecbdf4b3b9980b1631ec06c13d8cf9e09e2433075f123b348e3ba85604051610eda91815260200190565b6000805b600b548110156116f457826001600160a01b0316600b82815481106116be576116be613294565b6000918252602090912001546001600160a01b031614156116e25750600192915050565b806116ec816132c0565b915050611697565b50600092915050565b336001600160a01b037f000000000000000000000000028a3aa14d41753174fa117be234d04686f4471216146117655760405162461bcd60e51b815260206004820152600d60248201526c3737ba1036b2b9b9b2b733b2b960991b6044820152606401610868565b60125481146117aa5760405162461bcd60e51b81526020600482015260116024820152701a5b9d985b1a59081c195c9a5bd9081a59607a1b6044820152606401610868565b60408051428152602081018490529081018290527fc95987c1992805ee34bdc915e017cceae36ba1c156b9911fa7e691e6435eb46e9060600160405180910390a16117f6816001613382565b601255600081815260136020526040808220600181018590554281559051634c3fb26360e01b81529091906001600160a01b037f000000000000000000000000997da42d2c6d0f92a0dea7152cd138c255eeefca1690634c3fb263906118689087903090600f906010906004016133da565b60206040518083038186803b15801561188057600080fd5b505afa158015611894573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b89190613416565b604051631993b9df60e01b8152600481018690523060248201529091507f000000000000000000000000997da42d2c6d0f92a0dea7152cd138c255eeefca6001600160a01b031690631993b9df9060440160206040518083038186803b15801561192157600080fd5b505afa158015611935573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195991906130e8565b1561197c5760028201805460ff191660011790556119778382612568565b6115a2565b6002828101805460ff191690911790556115a28382612731565b61199e611a0f565b6001600160a01b038116611a035760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610868565b611a0c81611c9b565b50565b6000546001600160a01b031633146111815760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610868565b82611a7381611693565b611a8f5760405162461bcd60e51b815260040161086890613103565b60026001541415611ab25760405162461bcd60e51b81526004016108689061342f565b600260015581611b2c57336000908152600660205260409020548311611b2c5760405162461bcd60e51b815260206004820152602960248201527f55736572206c6f636b2d757020756e74696c20746865206e65787420766572696044820152683334b1b0ba34b7b71760b91b6064820152608401610868565b6001600160a01b0380851660009081526007602090815260408083205460058352928190205481516318160ddd60e01b81529151939094169384936379cc679093339386926318160ddd92600480840193919291829003018186803b158015611b9457600080fd5b505afa158015611ba8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bcc9190613416565b611bd6908b613466565b611be09190613485565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015611c2657600080fd5b505af1158015611c3a573d6000803e3d6000fd5b505050506001600160a01b03851660009081526005602052604081208054889290611c669084906134a7565b9091555060009050611c788787612931565b9050611c8e6001600160a01b0387163383612a3d565b5050600180555050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b83611cf581611693565b611d115760405162461bcd60e51b815260040161086890613103565b7f000000000000000000000000000000000000000000000000000000000000000015611d8857336000908152600c602052604090205460ff16611d885760405162461bcd60e51b815260206004820152600f60248201526e1b9bdd081dda1a5d195b1a5cdd1959608a1b6044820152606401610868565b60026001541415611dab5760405162461bcd60e51b81526004016108689061342f565b6002600155611dc56001600160a01b038616333086612aa0565b6001826001811115611dd957611dd9612da8565b1415612063576001600160a01b03851660009081526003602090815260408083205460059092529091205467ffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000011690611e3b908690613382565b611e459190613466565b1115611e935760405162461bcd60e51b815260206004820152601c60248201527f5374616b652065786365656473206c6576657261676564206361702e000000006044820152606401610868565b6001600160a01b0380861660009081526007602090815260408083205481516318160ddd60e01b8152915194169384926318160ddd9260048082019391829003018186803b158015611ee457600080fd5b505afa158015611ef8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1c9190613416565b905080611f88576040516340c10f1960e01b8152336004820152602481018690526001600160a01b038316906340c10f1990604401600060405180830381600087803b158015611f6b57600080fd5b505af1158015611f7f573d6000803e3d6000fd5b50505050612021565b6001600160a01b03878116600090815260056020526040902054908316906340c10f19903390611fb8858a613466565b611fc29190613485565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561200857600080fd5b505af115801561201c573d6000803e3d6000fd5b505050505b6001600160a01b03871660009081526005602052604081208054879290612049908490613382565b909155505033600090815260066020526040902086905550505b600082600181111561207757612077612da8565b141561224d576001600160a01b0380861660009081526008602090815260408083205481516318160ddd60e01b8152915194169384926318160ddd9260048082019391829003018186803b1580156120ce57600080fd5b505afa1580156120e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121069190613416565b905080612172576040516340c10f1960e01b8152336004820152602481018690526001600160a01b038316906340c10f1990604401600060405180830381600087803b15801561215557600080fd5b505af1158015612169573d6000803e3d6000fd5b5050505061220b565b6001600160a01b03878116600090815260036020526040902054908316906340c10f199033906121a2858a613466565b6121ac9190613485565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156121f257600080fd5b505af1158015612206573d6000803e3d6000fd5b505050505b6001600160a01b03871660009081526003602052604081208054879290612233908490613382565b909155505033600090815260046020526040902086905550505b3360009081526009602052604090205460ff1661229257336000908152600960205260408120805460ff19166001179055600a80549161228c836132c0565b91905055505b505060018055505050565b826122a781611693565b6122c35760405162461bcd60e51b815260040161086890613103565b600260015414156122e65760405162461bcd60e51b81526004016108689061342f565b60026001558161242e573360009081526004602052604090205483116123645760405162461bcd60e51b815260206004820152602d60248201527f50726f7669646572206c6f636b2d757020756e74696c20746865206e6578742060448201526c3b32b934b334b1b0ba34b7b71760991b6064820152608401610868565b6001600160a01b0384166000908152600560205260409020546123b29067ffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000011690613466565b6001600160a01b0385166000908152600360205260409020546123d69087906134a7565b101561242e5760405162461bcd60e51b815260206004820152602160248201527f5769746864726177616c2065786365656473206c6576657261676564206361706044820152601760f91b6064820152608401610868565b6001600160a01b0380851660009081526008602090815260408083205460038352928190205481516318160ddd60e01b81529151939094169384936379cc679093339386926318160ddd92600480840193919291829003018186803b15801561249657600080fd5b505afa1580156124aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ce9190613416565b6124d8908b613466565b6124e29190613485565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561252857600080fd5b505af115801561253c573d6000803e3d6000fd5b505050506001600160a01b03851660009081526003602052604081208054889290611c669084906134a7565b61271060005b600b548110156115a2576000600b828154811061258d5761258d613294565b60009182526020822001546001600160a01b031691506125d78467ffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000116613466565b6001600160a01b0383166000908152600360205260409020546125fb908790613466565b6126059190613485565b6001600160a01b0383166000908152600560205260409020549091508490612630906109c490613466565b61263a9190613485565b811115612674576001600160a01b0382166000908152600560205260409020548490612667908790613466565b6126719190613485565b90505b6001600160a01b0382166000908152600560205260408120805483929061269c9084906134a7565b90915550506001600160a01b038216600090815260036020526040812080548392906126c9908490613382565b909155505060408051868152602081018690529081018290526001600160a01b0383169087907f3173c1c4b679e2da86dbb0382bde749a6e16cd31912c5410e17985cd7d2b90529060600160405180910390a350508080612729906132c0565b91505061256e565b61271060005b600b548110156115a2576000600b828154811061275657612756613294565b60009182526020808320909101546001600160a01b031680835260059091526040822054909250849086906127b69067ffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000011690613466565b6127c09190613466565b6127ca9190613485565b6001600160a01b03831660009081526003602052604090205490915084906127f5906109c490613466565b6127ff9190613485565b811115612839576001600160a01b038216600090815260036020526040902054849061282c908790613466565b6128369190613485565b90505b6001600160a01b038216600090815260036020526040812080548392906128619084906134a7565b90915550506001600160a01b0382166000908152600560205260408120805483929061288e908490613382565b90915550506001600160a01b03821660008181526005602090815260409182902054825190815267ffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000001169181019190915290810183905287907f89385e9d619600da63726158403c0cfd9772b2cac90d3e093387a5456ee1a2479060600160405180910390a350508080612929906132c0565b915050612737565b600080612710612942601e86613466565b61294c9190613485565b9050600061271061295e600f87613466565b6129689190613485565b905061299061297f6000546001600160a01b031690565b6001600160a01b0386169084612a3d565b60025460408051638da5cb5b60e01b81529051612a1f926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b1580156129d657600080fd5b505afa1580156129ea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a0e919061322a565b6001600160a01b0386169083612a3d565b80612a2a83876134a7565b612a3491906134a7565b95945050505050565b6040516001600160a01b03831660248201526044810182905261124b90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612ad8565b6040516001600160a01b03808516602483015283166044820152606481018290526115a29085906323b872dd60e01b90608401612a69565b6000612b2d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612baa9092919063ffffffff16565b80519091501561124b5780806020019051810190612b4b91906130e8565b61124b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610868565b6060612bb98484600085612bc3565b90505b9392505050565b606082471015612c245760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610868565b6001600160a01b0385163b612c7b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610868565b600080866001600160a01b03168587604051612c9791906134be565b60006040518083038185875af1925050503d8060008114612cd4576040519150601f19603f3d011682016040523d82523d6000602084013e612cd9565b606091505b5091509150612ce9828286612cf4565b979650505050505050565b60608315612d03575081612bbc565b825115612d135782518084602001fd5b8160405162461bcd60e51b81526004016108689190613018565b600060208284031215612d3f57600080fd5b5035919050565b6001600160a01b0381168114611a0c57600080fd5b600060208284031215612d6d57600080fd5b8135612bbc81612d46565b60008060408385031215612d8b57600080fd5b823591506020830135612d9d81612d46565b809150509250929050565b634e487b7160e01b600052602160045260246000fd5b838152602081018390526060810160038310612ddc57612ddc612da8565b826040830152949350505050565b60068110612dfa57612dfa612da8565b9052565b602081016107538284612dea565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612e4b57612e4b612e0c565b604052919050565b60006020808385031215612e6657600080fd5b823567ffffffffffffffff80821115612e7e57600080fd5b818501915085601f830112612e9257600080fd5b813581811115612ea457612ea4612e0c565b8060051b9150612eb5848301612e22565b8181529183018401918481019088841115612ecf57600080fd5b938501935b83851015612ef95784359250612ee983612d46565b8282529385019390850190612ed4565b98975050505050505050565b60008060208385031215612f1857600080fd5b823567ffffffffffffffff80821115612f3057600080fd5b818501915085601f830112612f4457600080fd5b813581811115612f5357600080fd5b8660208260051b8501011115612f6857600080fd5b60209290920196919550909350505050565b600080600060608486031215612f8f57600080fd5b833592506020840135612fa181612d46565b9150604084013560028110612fb557600080fd5b809150509250925092565b60005b83811015612fdb578181015183820152602001612fc3565b838111156115a25750506000910152565b60008151808452613004816020860160208601612fc0565b601f01601f19169290920160200192915050565b602081526000612bbc6020830184612fec565b6000806040838503121561303e57600080fd5b50508035926020909101359150565b8051801515811461305d57600080fd5b919050565b60008060008060008060008060006101208a8c03121561308157600080fd5b8951985060208a0151975060408a0151965060608a0151955060808a0151945060a08a0151935060c08a0151925060e08a015167ffffffffffffffff811681146130ca57600080fd5b91506130d96101008b0161304d565b90509295985092959850929598565b6000602082840312156130fa57600080fd5b612bbc8261304d565b6020808252601a908201527f5468697320746f6b656e206973206e6f7420616c6c6f7765642e000000000000604082015260600190565b60006020828403121561314c57600080fd5b815167ffffffffffffffff8082111561316457600080fd5b818401915084601f83011261317857600080fd5b81518181111561318a5761318a612e0c565b61319d601f8201601f1916602001612e22565b91508082528560208285010111156131b457600080fd5b6131c5816020840160208601612fc0565b50949350505050565b6000602082840312156131e057600080fd5b815160ff81168114612bbc57600080fd5b6060815260006132046060830186612fec565b82810360208401526132168186612fec565b91505060ff83166040830152949350505050565b60006020828403121561323c57600080fd5b8151612bbc81612d46565b60808152600061325a6080830187612fec565b828103602084015261326c8187612fec565b905082810360408401526132808186612fec565b90508281036060840152612ce98185612fec565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156132d4576132d46132aa565b5060010190565b604081016132e98285612dea565b6001600160801b03831660208301529392505050565b6000806040838503121561331257600080fd5b505080516020909101519092909150565b828152604081016002831061333a5761333a612da8565b8260208301529392505050565b600181811c9082168061335b57607f821691505b6020821081141561337c57634e487b7160e01b600052602260045260246000fd5b50919050565b60008219821115613395576133956132aa565b500190565b6000815480845260208085019450836000528060002060005b838110156133cf578154875295820195600191820191016133b3565b509495945050505050565b8481526001600160a01b03841660208201526080604082018190526000906134049083018561339a565b8281036060840152612ce9818561339a565b60006020828403121561342857600080fd5b5051919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000816000190483118215151615613480576134806132aa565b500290565b6000826134a257634e487b7160e01b600052601260045260246000fd5b500490565b6000828210156134b9576134b96132aa565b500390565b600082516134d0818460208701612fc0565b919091019291505056fea264697066735822122083d9ed6f903afe3af8234ec884cdb4217f0518fe39495ff03253ceda09048b4f64736f6c63430008090033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | $0.000326 | 955,372.412 | $311.9 |
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.