Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 12220792 | 1323 days ago | IN | 0 ETH | 0.34571702 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
VoteV3
Compiler Version
v0.6.12+commit.27d51765
Contract Source Code (Solidity Multiple files format)
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "./SafeMath.sol"; import "./IERC20.sol"; import "./StrongPoolInterface.sol"; import "./ServiceInterface.sol"; import "./rewards.sol"; contract VoteV3 { event Voted(address indexed voter, address indexed service, address indexed entity, uint256 amount); event RecalledVote(address indexed voter, address indexed service, address indexed entity, uint256 amount); event Claimed(address indexed claimer, uint256 amount); event VotesAdded(address indexed miner, uint256 amount); event VotesSubtracted(address indexed miner, uint256 amount); event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance); using SafeMath for uint256; StrongPoolInterface public strongPool; IERC20 public strongToken; bool public initDone; address public admin; address public pendingAdmin; address public superAdmin; address public pendingSuperAdmin; address public parameterAdmin; uint256 public rewardBalance; uint256 public voterRewardPerBlockNumerator; uint256 public voterRewardPerBlockDenominator; uint256 public entityRewardPerBlockNumerator; uint256 public entityRewardPerBlockDenominator; mapping(address => uint96) public balances; mapping(address => address) public delegates; mapping(address => mapping(uint32 => uint32)) public checkpointsFromBlock; mapping(address => mapping(uint32 => uint96)) public checkpointsVotes; mapping(address => uint32) public numCheckpoints; mapping(address => uint256) public voterVotesOut; uint256 public totalVotesOut; mapping(address => uint256) public serviceVotes; mapping(address => mapping(address => uint256)) public serviceEntityVotes; mapping(address => mapping(address => mapping(address => uint256))) public voterServiceEntityVotes; mapping(address => address[]) public voterServices; mapping(address => mapping(address => uint256)) public voterServiceIndex; mapping(address => mapping(address => address[])) public voterServiceEntities; mapping(address => mapping(address => mapping(address => uint256))) public voterServiceEntityIndex; mapping(address => uint256) public voterBlockLastClaimedOn; mapping(address => mapping(address => uint256)) public serviceEntityBlockLastClaimedOn; address[] public serviceContracts; mapping(address => uint256) public serviceContractIndex; mapping(address => bool) public serviceContractActive; uint256 public voterRewardPerBlockNumeratorNew; uint256 public voterRewardPerBlockDenominatorNew; uint256 public entityRewardPerBlockNumeratorNew; uint256 public entityRewardPerBlockDenominatorNew; uint256 public rewardPerBlockNewEffectiveBlock; function init( address strongTokenAddress, address strongPoolAddress, address adminAddress, address superAdminAddress, uint256 voterRewardPerBlockNumeratorValue, uint256 voterRewardPerBlockDenominatorValue, uint256 entityRewardPerBlockNumeratorValue, uint256 entityRewardPerBlockDenominatorValue ) public { require(!initDone, "init done"); strongToken = IERC20(strongTokenAddress); strongPool = StrongPoolInterface(strongPoolAddress); admin = adminAddress; superAdmin = superAdminAddress; voterRewardPerBlockNumerator = voterRewardPerBlockNumeratorValue; voterRewardPerBlockDenominator = voterRewardPerBlockDenominatorValue; entityRewardPerBlockNumerator = entityRewardPerBlockNumeratorValue; entityRewardPerBlockDenominator = entityRewardPerBlockDenominatorValue; initDone = true; } // ADMIN // ************************************************************************************* function updateParameterAdmin(address newParameterAdmin) public { require(newParameterAdmin != address(0), "zero"); require(msg.sender == superAdmin); parameterAdmin = newParameterAdmin; } function setPendingAdmin(address newPendingAdmin) public { require(newPendingAdmin != address(0), "zero"); require(msg.sender == admin, "not admin"); pendingAdmin = newPendingAdmin; } function acceptAdmin() public { require(msg.sender == pendingAdmin && msg.sender != address(0), "not pendingAdmin"); admin = pendingAdmin; pendingAdmin = address(0); } function setPendingSuperAdmin(address newPendingSuperAdmin) public { require(newPendingSuperAdmin != address(0), "zero"); require(msg.sender == superAdmin, "not superAdmin"); pendingSuperAdmin = newPendingSuperAdmin; } function acceptSuperAdmin() public { require(msg.sender == pendingSuperAdmin && msg.sender != address(0), "not pendingSuperAdmin"); superAdmin = pendingSuperAdmin; pendingSuperAdmin = address(0); } // SERVICE CONTRACTS // ************************************************************************************* function addServiceContract(address contr) public { require(contr != address(0), "zero"); require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); if (serviceContracts.length != 0) { uint256 index = serviceContractIndex[contr]; require(serviceContracts[index] != contr, "exists"); } uint256 len = serviceContracts.length; serviceContractIndex[contr] = len; serviceContractActive[contr] = true; serviceContracts.push(contr); } function updateServiceContractActiveStatus(address contr, bool activeStatus) public { require(contr != address(0), "zero"); require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); require(serviceContracts.length > 0, "zero"); uint256 index = serviceContractIndex[contr]; require(serviceContracts[index] == contr, "not exists"); serviceContractActive[contr] = activeStatus; } function getServiceContracts() public view returns (address[] memory) { return serviceContracts; } // REWARD // ************************************************************************************* function updateVoterRewardPerBlock(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); require(denominator != 0, "invalid value"); voterRewardPerBlockNumerator = numerator; voterRewardPerBlockDenominator = denominator; } function updateEntityRewardPerBlock(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); require(denominator != 0, "invalid value"); entityRewardPerBlockNumerator = numerator; entityRewardPerBlockDenominator = denominator; } function deposit(uint256 amount) public { require(msg.sender == superAdmin, "not an admin"); require(amount > 0, "zero"); strongToken.transferFrom(msg.sender, address(this), amount); rewardBalance = rewardBalance.add(amount); } function withdraw(address destination, uint256 amount) public { require(msg.sender == superAdmin, "not an admin"); require(amount > 0, "zero"); require(rewardBalance >= amount, "not enough"); strongToken.transfer(destination, amount); rewardBalance = rewardBalance.sub(amount); } // CORE // ************************************************************************************* function getVoterServices(address voter) public view returns (address[] memory) { return voterServices[voter]; } function getVoterServiceEntities(address voter, address service) public view returns (address[] memory) { return voterServiceEntities[voter][service]; } function getVoterReward(address voter) public view returns (uint256) { uint256 blockLastClaimedOn = voterBlockLastClaimedOn[voter]; if (totalVotesOut == 0) return 0; if (blockLastClaimedOn == 0) return 0; uint256[2] memory rewardBlocks = rewards.blocks(blockLastClaimedOn, rewardPerBlockNewEffectiveBlock, block.number); uint256 rewardOld = voterRewardPerBlockNumerator > 0 ? rewardBlocks[0].mul(voterRewardPerBlockNumerator).div(voterRewardPerBlockDenominator) : 0; uint256 rewardNew = voterRewardPerBlockNumeratorNew > 0 ? rewardBlocks[1].mul(voterRewardPerBlockNumeratorNew).div(voterRewardPerBlockDenominatorNew) : 0; return rewardOld.add(rewardNew).mul(voterVotesOut[voter]).div(totalVotesOut); } function getEntityReward(address service, address entity) public view returns (uint256) { uint256 blockLastClaimedOn = serviceEntityBlockLastClaimedOn[service][entity]; if (serviceVotes[service] == 0) return 0; if (blockLastClaimedOn == 0) return 0; uint256[2] memory rewardBlocks = rewards.blocks(blockLastClaimedOn, rewardPerBlockNewEffectiveBlock, block.number); uint256 rewardOld = entityRewardPerBlockNumerator > 0 ? rewardBlocks[0].mul(entityRewardPerBlockNumerator).div(entityRewardPerBlockDenominator) : 0; uint256 rewardNew = entityRewardPerBlockNumeratorNew > 0 ? rewardBlocks[1].mul(entityRewardPerBlockNumeratorNew).div(entityRewardPerBlockDenominatorNew) : 0; return rewardOld.add(rewardNew).mul(serviceEntityVotes[service][entity]).div(serviceVotes[service]); } function vote( address service, address entity, uint256 amount ) public { require(amount > 0, "zero"); require(uint256(_getAvailableServiceEntityVotes(msg.sender)) >= amount, "not enough"); require(serviceContractActive[service], "service not active"); require(ServiceInterface(service).isEntityActive(entity), "entity not active"); uint256 serviceIndex = voterServiceIndex[msg.sender][service]; if (voterServices[msg.sender].length == 0 || voterServices[msg.sender][serviceIndex] != service) { uint256 len = voterServices[msg.sender].length; voterServiceIndex[msg.sender][service] = len; voterServices[msg.sender].push(service); } uint256 entityIndex = voterServiceEntityIndex[msg.sender][service][entity]; if ( voterServiceEntities[msg.sender][service].length == 0 || voterServiceEntities[msg.sender][service][entityIndex] != entity ) { uint256 len = voterServiceEntities[msg.sender][service].length; voterServiceEntityIndex[msg.sender][service][entity] = len; voterServiceEntities[msg.sender][service].push(entity); } if (block.number > voterBlockLastClaimedOn[msg.sender]) { uint256 reward = getVoterReward(msg.sender); if (reward > 0) { rewardBalance = rewardBalance.sub(reward); strongToken.approve(address(strongPool), reward); strongPool.mineFor(msg.sender, reward); voterBlockLastClaimedOn[msg.sender] = block.number; } } if (block.number > serviceEntityBlockLastClaimedOn[service][entity]) { uint256 reward = getEntityReward(service, entity); if (reward > 0) { rewardBalance = rewardBalance.sub(reward); strongToken.approve(address(strongPool), reward); strongPool.mineFor(entity, reward); serviceEntityBlockLastClaimedOn[service][entity] = block.number; } } serviceVotes[service] = serviceVotes[service].add(amount); serviceEntityVotes[service][entity] = serviceEntityVotes[service][entity].add(amount); voterServiceEntityVotes[msg.sender][service][entity] = voterServiceEntityVotes[msg.sender][service][entity].add( amount ); voterVotesOut[msg.sender] = voterVotesOut[msg.sender].add(amount); totalVotesOut = totalVotesOut.add(amount); if (voterBlockLastClaimedOn[msg.sender] == 0) { voterBlockLastClaimedOn[msg.sender] = block.number; } if (serviceEntityBlockLastClaimedOn[service][entity] == 0) { serviceEntityBlockLastClaimedOn[service][entity] = block.number; } emit Voted(msg.sender, service, entity, amount); } function recallVote( address service, address entity, uint256 amount ) public { require(amount > 0, "zero"); require(voterServiceEntityVotes[msg.sender][service][entity] >= amount, "not enough"); if (block.number > voterBlockLastClaimedOn[msg.sender]) { uint256 reward = getVoterReward(msg.sender); if (reward > 0) { rewardBalance = rewardBalance.sub(reward); strongToken.approve(address(strongPool), reward); strongPool.mineFor(msg.sender, reward); voterBlockLastClaimedOn[msg.sender] = block.number; } } if (block.number > serviceEntityBlockLastClaimedOn[service][entity]) { uint256 reward = getEntityReward(service, entity); if (reward > 0) { rewardBalance = rewardBalance.sub(reward); strongToken.approve(address(strongPool), reward); strongPool.mineFor(entity, reward); serviceEntityBlockLastClaimedOn[service][entity] = block.number; } } serviceVotes[service] = serviceVotes[service].sub(amount); serviceEntityVotes[service][entity] = serviceEntityVotes[service][entity].sub(amount); voterServiceEntityVotes[msg.sender][service][entity] = voterServiceEntityVotes[msg.sender][service][entity].sub( amount ); voterVotesOut[msg.sender] = voterVotesOut[msg.sender].sub(amount); totalVotesOut = totalVotesOut.sub(amount); if (voterVotesOut[msg.sender] == 0) { voterBlockLastClaimedOn[msg.sender] = 0; } if (serviceEntityVotes[service][entity] == 0) { serviceEntityBlockLastClaimedOn[service][entity] = 0; } emit RecalledVote(msg.sender, service, entity, amount); } function voterClaim() public { require(voterBlockLastClaimedOn[msg.sender] != 0, "error"); require(block.number > voterBlockLastClaimedOn[msg.sender], "too soon"); uint256 reward = getVoterReward(msg.sender); require(reward > 0, "no reward"); rewardBalance = rewardBalance.sub(reward); strongToken.approve(address(strongPool), reward); strongPool.mineFor(msg.sender, reward); voterBlockLastClaimedOn[msg.sender] = block.number; emit Claimed(msg.sender, reward); } function entityClaim(address service) public { require(serviceEntityBlockLastClaimedOn[service][msg.sender] != 0, "error"); require(block.number > serviceEntityBlockLastClaimedOn[service][msg.sender], "too soon"); require(ServiceInterface(service).isEntityActive(msg.sender), "not active"); uint256 reward = getEntityReward(service, msg.sender); require(reward > 0, "no reward"); rewardBalance = rewardBalance.sub(reward); strongToken.approve(address(strongPool), reward); strongPool.mineFor(msg.sender, reward); serviceEntityBlockLastClaimedOn[service][msg.sender] = block.number; emit Claimed(msg.sender, reward); } function updateVotes( address voter, uint256 rawAmount, bool adding ) public { require(msg.sender == address(strongPool), "not strongPool"); uint96 amount = _safe96(rawAmount, "amount exceeds 96 bits"); if (adding) { _addVotes(voter, amount); } else { require(_getAvailableServiceEntityVotes(voter) >= amount, "recall votes"); _subVotes(voter, amount); } } function getCurrentProposalVotes(address account) external view returns (uint96) { return _getCurrentProposalVotes(account); } function getPriorProposalVotes(address account, uint256 blockNumber) external view returns (uint96) { require(blockNumber < block.number, "not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if (checkpointsFromBlock[account][nCheckpoints - 1] <= blockNumber) { return checkpointsVotes[account][nCheckpoints - 1]; } if (checkpointsFromBlock[account][0] > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; uint32 fromBlock = checkpointsFromBlock[account][center]; uint96 votes = checkpointsVotes[account][center]; if (fromBlock == blockNumber) { return votes; } else if (fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpointsVotes[account][lower]; } function getAvailableServiceEntityVotes(address account) public view returns (uint96) { return _getAvailableServiceEntityVotes(account); } // SUPPORT // ************************************************************************************* function _addVotes(address voter, uint96 amount) internal { require(voter != address(0), "zero address"); balances[voter] = _add96(balances[voter], amount, "vote amount overflows"); _addDelegates(voter, amount); emit VotesAdded(voter, amount); } function _subVotes(address voter, uint96 amount) internal { balances[voter] = _sub96(balances[voter], amount, "vote amount exceeds balance"); _subtractDelegates(voter, amount); emit VotesSubtracted(voter, amount); } function _addDelegates(address miner, uint96 amount) internal { if (delegates[miner] == address(0)) { delegates[miner] = miner; } address currentDelegate = delegates[miner]; _moveDelegates(address(0), currentDelegate, amount); } function _subtractDelegates(address miner, uint96 amount) internal { address currentDelegate = delegates[miner]; _moveDelegates(currentDelegate, address(0), amount); } function _moveDelegates( address srcRep, address dstRep, uint96 amount ) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { uint32 srcRepNum = numCheckpoints[srcRep]; uint96 srcRepOld = srcRepNum > 0 ? checkpointsVotes[srcRep][srcRepNum - 1] : 0; uint96 srcRepNew = _sub96(srcRepOld, amount, "vote amount underflows"); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { uint32 dstRepNum = numCheckpoints[dstRep]; uint96 dstRepOld = dstRepNum > 0 ? checkpointsVotes[dstRep][dstRepNum - 1] : 0; uint96 dstRepNew = _add96(dstRepOld, amount, "vote amount overflows"); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _writeCheckpoint( address delegatee, uint32 nCheckpoints, uint96 oldVotes, uint96 newVotes ) internal { uint32 blockNumber = _safe32(block.number, "block number exceeds 32 bits"); if (nCheckpoints > 0 && checkpointsFromBlock[delegatee][nCheckpoints - 1] == blockNumber) { checkpointsVotes[delegatee][nCheckpoints - 1] = newVotes; } else { checkpointsFromBlock[delegatee][nCheckpoints] = blockNumber; checkpointsVotes[delegatee][nCheckpoints] = newVotes; numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } function _safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); } function _safe96(uint256 n, string memory errorMessage) internal pure returns (uint96) { require(n < 2**96, errorMessage); return uint96(n); } function _add96( uint96 a, uint96 b, string memory errorMessage ) internal pure returns (uint96) { uint96 c = a + b; require(c >= a, errorMessage); return c; } function _sub96( uint96 a, uint96 b, string memory errorMessage ) internal pure returns (uint96) { require(b <= a, errorMessage); return a - b; } function _getCurrentProposalVotes(address account) internal view returns (uint96) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpointsVotes[account][nCheckpoints - 1] : 0; } function _getAvailableServiceEntityVotes(address account) internal view returns (uint96) { uint96 proposalVotes = _getCurrentProposalVotes(account); return proposalVotes == 0 ? 0 : proposalVotes - _safe96(voterVotesOut[account], "voterVotesOut exceeds 96 bits"); } function updateRewardPerBlockNew( uint256 numeratorVoter, uint256 denominatorVoter, uint256 numeratorEntity, uint256 denominatorEntity, uint256 effectiveBlock ) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); voterRewardPerBlockNumeratorNew = numeratorVoter; voterRewardPerBlockDenominatorNew = denominatorVoter; entityRewardPerBlockNumeratorNew = numeratorEntity; entityRewardPerBlockDenominatorNew = denominatorEntity; rewardPerBlockNewEffectiveBlock = effectiveBlock != 0 ? effectiveBlock : block.number; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.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 GSN 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 payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "./SafeMath.sol"; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { // The {SafeMath} overflow check can be skipped here, see the comment at the top counter._value += 1; } function decrement(Counter storage counter) internal { counter._value = counter._value.sub(1); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.2; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155Preset { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external; /** * @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); /** * @dev Creates `amount` new tokens for `to`, of token type `id`. * * See {ERC1155-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mint(address to, uint256 id, uint256 amount, bytes memory data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] variant of {mint}. */ function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) external; function getOwnerIdByIndex(address owner, uint256 index) external view returns (uint256); function getOwnerIdIndex(address owner, uint256 id) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "./IERC20.sol"; import "./SafeMath.sol"; import "./StrongPoolInterface.sol"; import "./rewards.sol"; contract PoolV4 { event Mined(address indexed miner, uint256 amount); event Unmined(address indexed miner, uint256 amount); event Claimed(address indexed miner, uint256 reward); using SafeMath for uint256; bool public initDone; address public admin; address public pendingAdmin; address public superAdmin; address public pendingSuperAdmin; address public parameterAdmin; address payable public feeCollector; IERC20 public token; IERC20 public strongToken; StrongPoolInterface public strongPool; mapping(address => uint256) public minerBalance; uint256 public totalBalance; mapping(address => uint256) public minerBlockLastClaimedOn; uint256 public rewardBalance; uint256 public rewardPerBlockNumerator; uint256 public rewardPerBlockDenominator; uint256 public miningFeeNumerator; uint256 public miningFeeDenominator; uint256 public unminingFeeNumerator; uint256 public unminingFeeDenominator; uint256 public claimingFeeNumerator; uint256 public claimingFeeDenominator; uint256 public claimingFeeInWei; uint256 public rewardPerBlockNumeratorNew; uint256 public rewardPerBlockDenominatorNew; uint256 public rewardPerBlockNewEffectiveBlock; function init( address strongTokenAddress, address tokenAddress, address strongPoolAddress, address adminAddress, address superAdminAddress, uint256 rewardPerBlockNumeratorValue, uint256 rewardPerBlockDenominatorValue, uint256 miningFeeNumeratorValue, uint256 miningFeeDenominatorValue, uint256 unminingFeeNumeratorValue, uint256 unminingFeeDenominatorValue, uint256 claimingFeeNumeratorValue, uint256 claimingFeeDenominatorValue ) public { require(!initDone, "init done"); strongToken = IERC20(strongTokenAddress); token = IERC20(tokenAddress); strongPool = StrongPoolInterface(strongPoolAddress); admin = adminAddress; superAdmin = superAdminAddress; rewardPerBlockNumerator = rewardPerBlockNumeratorValue; rewardPerBlockDenominator = rewardPerBlockDenominatorValue; miningFeeNumerator = miningFeeNumeratorValue; miningFeeDenominator = miningFeeDenominatorValue; unminingFeeNumerator = unminingFeeNumeratorValue; unminingFeeDenominator = unminingFeeDenominatorValue; claimingFeeNumerator = claimingFeeNumeratorValue; claimingFeeDenominator = claimingFeeDenominatorValue; initDone = true; } // ADMIN // ************************************************************************************* function updateParameterAdmin(address newParameterAdmin) public { require(newParameterAdmin != address(0), "zero"); require(msg.sender == superAdmin); parameterAdmin = newParameterAdmin; } function setPendingAdmin(address newPendingAdmin) public { require(newPendingAdmin != address(0), "zero"); require(msg.sender == admin, "not admin"); pendingAdmin = newPendingAdmin; } function acceptAdmin() public { require(msg.sender == pendingAdmin && msg.sender != address(0), "not pendingAdmin"); admin = pendingAdmin; pendingAdmin = address(0); } function setPendingSuperAdmin(address newPendingSuperAdmin) public { require(newPendingSuperAdmin != address(0), "zero"); require(msg.sender == superAdmin, "not superAdmin"); pendingSuperAdmin = newPendingSuperAdmin; } function acceptSuperAdmin() public { require(msg.sender == pendingSuperAdmin && msg.sender != address(0), "not pendingSuperAdmin"); superAdmin = pendingSuperAdmin; pendingSuperAdmin = address(0); } // REWARD // ************************************************************************************* function updateRewardPerBlock(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); require(denominator != 0, "invalid value"); rewardPerBlockNumerator = numerator; rewardPerBlockDenominator = denominator; } function deposit(uint256 amount) public { require(msg.sender == superAdmin, "not an admin"); require(amount > 0, "zero"); strongToken.transferFrom(msg.sender, address(this), amount); rewardBalance = rewardBalance.add(amount); } function withdraw(address destination, uint256 amount) public { require(msg.sender == superAdmin, "not an admin"); require(amount > 0, "zero"); require(rewardBalance >= amount, "not enough"); strongToken.transfer(destination, amount); rewardBalance = rewardBalance.sub(amount); } // FEES // ************************************************************************************* function updateFeeCollector(address payable newFeeCollector) public { require(newFeeCollector != address(0), "zero"); require(msg.sender == superAdmin); feeCollector = newFeeCollector; } function updateMiningFee(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); require(denominator != 0, "invalid value"); miningFeeNumerator = numerator; miningFeeDenominator = denominator; } function updateUnminingFee(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); require(denominator != 0, "invalid value"); unminingFeeNumerator = numerator; unminingFeeDenominator = denominator; } function updateClaimingFee(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); require(denominator != 0, "invalid value"); claimingFeeNumerator = numerator; claimingFeeDenominator = denominator; } // CORE // ************************************************************************************* function mine(uint256 amount) public payable { require(amount > 0, "zero"); uint256 fee = amount.mul(miningFeeNumerator).div(miningFeeDenominator); require(msg.value == fee, "invalid fee"); feeCollector.transfer(msg.value); if (block.number > minerBlockLastClaimedOn[msg.sender]) { uint256 reward = getReward(msg.sender); if (reward > 0) { rewardBalance = rewardBalance.sub(reward); strongToken.approve(address(strongPool), reward); strongPool.mineFor(msg.sender, reward); minerBlockLastClaimedOn[msg.sender] = block.number; } } token.transferFrom(msg.sender, address(this), amount); minerBalance[msg.sender] = minerBalance[msg.sender].add(amount); totalBalance = totalBalance.add(amount); if (minerBlockLastClaimedOn[msg.sender] == 0) { minerBlockLastClaimedOn[msg.sender] = block.number; } emit Mined(msg.sender, amount); } function unmine(uint256 amount) public payable { require(amount > 0, "zero"); uint256 fee = amount.mul(unminingFeeNumerator).div(unminingFeeDenominator); require(msg.value == fee, "invalid fee"); require(minerBalance[msg.sender] >= amount, "not enough"); feeCollector.transfer(msg.value); if (block.number > minerBlockLastClaimedOn[msg.sender]) { uint256 reward = getReward(msg.sender); if (reward > 0) { rewardBalance = rewardBalance.sub(reward); strongToken.approve(address(strongPool), reward); strongPool.mineFor(msg.sender, reward); minerBlockLastClaimedOn[msg.sender] = block.number; } } minerBalance[msg.sender] = minerBalance[msg.sender].sub(amount); totalBalance = totalBalance.sub(amount); token.transfer(msg.sender, amount); if (minerBalance[msg.sender] == 0) { minerBlockLastClaimedOn[msg.sender] = 0; } emit Unmined(msg.sender, amount); } function claim(uint256 blockNumber) public payable { require(blockNumber <= block.number, "invalid block number"); require(minerBlockLastClaimedOn[msg.sender] != 0, "error"); require(blockNumber > minerBlockLastClaimedOn[msg.sender], "too soon"); uint256 reward = getRewardByBlock(msg.sender, blockNumber); require(reward > 0, "no reward"); uint256 fee = reward.mul(claimingFeeNumerator).div(claimingFeeDenominator); require(msg.value == fee, "invalid fee"); feeCollector.transfer(msg.value); strongToken.approve(address(strongPool), reward); strongPool.mineFor(msg.sender, reward); rewardBalance = rewardBalance.sub(reward); minerBlockLastClaimedOn[msg.sender] = blockNumber; emit Claimed(msg.sender, reward); } function getReward(address miner) public view returns (uint256) { return getRewardByBlock(miner, block.number); } function getRewardByBlock(address miner, uint256 blockNumber) public view returns (uint256) { uint256 blockLastClaimedOn = minerBlockLastClaimedOn[miner]; if (blockNumber > block.number) return 0; if (blockLastClaimedOn == 0) return 0; if (blockNumber < blockLastClaimedOn) return 0; if (totalBalance == 0) return 0; uint256[2] memory rewardBlocks = rewards.blocks(blockLastClaimedOn, rewardPerBlockNewEffectiveBlock, blockNumber); uint256 rewardOld = rewardPerBlockDenominator > 0 ? rewardBlocks[0].mul(rewardPerBlockNumerator).div(rewardPerBlockDenominator) : 0; uint256 rewardNew = rewardPerBlockDenominatorNew > 0 ? rewardBlocks[1].mul(rewardPerBlockNumeratorNew).div(rewardPerBlockDenominatorNew) : 0; return rewardOld.add(rewardNew).mul(minerBalance[miner]).div(totalBalance); } function updateRewardPerBlockNew( uint256 numerator, uint256 denominator, uint256 effectiveBlock ) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); rewardPerBlockNumeratorNew = numerator; rewardPerBlockDenominatorNew = denominator; rewardPerBlockNewEffectiveBlock = effectiveBlock != 0 ? effectiveBlock : block.number; } }
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./SafeMath.sol"; library rewards { using SafeMath for uint256; function blocks(uint256 lastClaimedOnBlock, uint256 newRewardBlock, uint256 blockNumber) internal pure returns (uint256[2] memory) { if (lastClaimedOnBlock >= blockNumber) return [uint256(0), uint256(0)]; if (blockNumber <= newRewardBlock || newRewardBlock == 0) { return [blockNumber.sub(lastClaimedOnBlock), uint256(0)]; } else if (lastClaimedOnBlock >= newRewardBlock) { return [uint256(0), blockNumber.sub(lastClaimedOnBlock)]; } else { return [newRewardBlock.sub(lastClaimedOnBlock), blockNumber.sub(newRewardBlock)]; } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; interface ServiceInterface { function claimingFeeNumerator() external view returns(uint256); function claimingFeeDenominator() external view returns(uint256); function doesNodeExist(address entity, uint128 nodeId) external view returns (bool); function getNodeId(address entity, uint128 nodeId) external view returns (bytes memory); function getReward(address entity, uint128 nodeId) external view returns (uint256); function getRewardByBlock(address entity, uint128 nodeId, uint256 blockNumber) external view returns (uint256); function getTraunch(address entity) external view returns (uint256); function isEntityActive(address entity) external view returns (bool); function claim(uint128 nodeId, uint256 blockNumber, bool toStrongPool) external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; interface ServiceInterfaceV10 { function traunch(address) external view returns(uint256); function claimingFeeNumerator() external view returns(uint256); function claimingFeeDenominator() external view returns(uint256); function doesNodeExist(address entity, uint128 nodeId) external view returns (bool); function getNodeId(address entity, uint128 nodeId) external view returns (bytes memory); function getReward(address entity, uint128 nodeId) external view returns (uint256); function getRewardByBlock(address entity, uint128 nodeId, uint256 blockNumber) external view returns (uint256); function isEntityActive(address entity) external view returns (bool); function claim(uint128 nodeId, uint256 blockNumber, bool toStrongPool) external payable; }
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IERC20.sol"; import "./SafeMath.sol"; import "./StrongPoolInterface.sol"; import "./IERC1155Preset.sol"; import "./StrongNFTBonusInterface.sol"; import "./rewards.sol"; contract ServiceV10 { event Requested(address indexed miner); event Claimed(address indexed miner, uint256 reward); using SafeMath for uint256; bool public initDone; address public admin; address public pendingAdmin; address public superAdmin; address public pendingSuperAdmin; address public serviceAdmin; address public parameterAdmin; address payable public feeCollector; IERC20 public strongToken; StrongPoolInterface public strongPool; uint256 public rewardPerBlockNumerator; uint256 public rewardPerBlockDenominator; uint256 public naasRewardPerBlockNumerator; uint256 public naasRewardPerBlockDenominator; uint256 public claimingFeeNumerator; uint256 public claimingFeeDenominator; uint256 public requestingFeeInWei; uint256 public strongFeeInWei; uint256 public recurringFeeInWei; uint256 public recurringNaaSFeeInWei; uint256 public recurringPaymentCycleInBlocks; uint256 public rewardBalance; mapping(address => uint256) public entityBlockLastClaimedOn; address[] public entities; mapping(address => uint256) public entityIndex; mapping(address => bool) public entityActive; mapping(address => bool) public requestPending; mapping(address => bool) public entityIsNaaS; mapping(address => uint256) public paidOnBlock; uint256 public activeEntities; string public desciption; uint256 public claimingFeeInWei; uint256 public naasRequestingFeeInWei; uint256 public naasStrongFeeInWei; bool public removedTokens; mapping(address => uint256) public traunch; uint256 public currentTraunch; mapping(bytes => bool) public entityNodeIsActive; mapping(bytes => bool) public entityNodeIsBYON; mapping(bytes => uint256) public entityNodeTraunch; mapping(bytes => uint256) public entityNodePaidOnBlock; mapping(bytes => uint256) public entityNodeClaimedOnBlock; mapping(address => uint128) public entityNodeCount; event Paid(address indexed entity, uint128 nodeId, bool isBYON, bool isRenewal, uint256 upToBlockNumber); event Migrated(address indexed from, address indexed to, uint128 fromNodeId, uint128 toNodeId, bool isBYON); uint256 public rewardPerBlockNumeratorNew; uint256 public rewardPerBlockDenominatorNew; uint256 public naasRewardPerBlockNumeratorNew; uint256 public naasRewardPerBlockDenominatorNew; uint256 public rewardPerBlockNewEffectiveBlock; StrongNFTBonusInterface public strongNFTBonus; function init( address strongTokenAddress, address strongPoolAddress, address adminAddress, address superAdminAddress, uint256 rewardPerBlockNumeratorValue, uint256 rewardPerBlockDenominatorValue, uint256 naasRewardPerBlockNumeratorValue, uint256 naasRewardPerBlockDenominatorValue, uint256 requestingFeeInWeiValue, uint256 strongFeeInWeiValue, uint256 recurringFeeInWeiValue, uint256 recurringNaaSFeeInWeiValue, uint256 recurringPaymentCycleInBlocksValue, uint256 claimingFeeNumeratorValue, uint256 claimingFeeDenominatorValue, string memory desc ) public { require(!initDone, "init done"); strongToken = IERC20(strongTokenAddress); strongPool = StrongPoolInterface(strongPoolAddress); admin = adminAddress; superAdmin = superAdminAddress; rewardPerBlockNumerator = rewardPerBlockNumeratorValue; rewardPerBlockDenominator = rewardPerBlockDenominatorValue; naasRewardPerBlockNumerator = naasRewardPerBlockNumeratorValue; naasRewardPerBlockDenominator = naasRewardPerBlockDenominatorValue; requestingFeeInWei = requestingFeeInWeiValue; strongFeeInWei = strongFeeInWeiValue; recurringFeeInWei = recurringFeeInWeiValue; recurringNaaSFeeInWei = recurringNaaSFeeInWeiValue; claimingFeeNumerator = claimingFeeNumeratorValue; claimingFeeDenominator = claimingFeeDenominatorValue; recurringPaymentCycleInBlocks = recurringPaymentCycleInBlocksValue; desciption = desc; initDone = true; } // ADMIN // ************************************************************************************* function updateServiceAdmin(address newServiceAdmin) public { require(msg.sender == superAdmin); serviceAdmin = newServiceAdmin; } function updateParameterAdmin(address newParameterAdmin) public { require(newParameterAdmin != address(0), "zero"); require(msg.sender == superAdmin); parameterAdmin = newParameterAdmin; } function updateFeeCollector(address payable newFeeCollector) public { require(newFeeCollector != address(0), "zero"); require(msg.sender == superAdmin); feeCollector = newFeeCollector; } function setPendingAdmin(address newPendingAdmin) public { require(msg.sender == admin, "not admin"); pendingAdmin = newPendingAdmin; } function acceptAdmin() public { require(msg.sender == pendingAdmin && msg.sender != address(0), "not pendingAdmin"); admin = pendingAdmin; pendingAdmin = address(0); } function setPendingSuperAdmin(address newPendingSuperAdmin) public { require(msg.sender == superAdmin, "not superAdmin"); pendingSuperAdmin = newPendingSuperAdmin; } function acceptSuperAdmin() public { require(msg.sender == pendingSuperAdmin && msg.sender != address(0), "not pendingSuperAdmin"); superAdmin = pendingSuperAdmin; pendingSuperAdmin = address(0); } // ENTITIES // ************************************************************************************* function getEntities() public view returns (address[] memory) { return entities; } function isEntityActive(address entity) public view returns (bool) { return entityActive[entity]; } // TRAUNCH // ************************************************************************************* function updateCurrentTraunch(uint256 value) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); currentTraunch = value; } // REWARD // ************************************************************************************* function updateRewardPerBlock(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); require(denominator != 0, "invalid value"); rewardPerBlockNumerator = numerator; rewardPerBlockDenominator = denominator; } function updateNaaSRewardPerBlock(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); require(denominator != 0, "invalid value"); naasRewardPerBlockNumerator = numerator; naasRewardPerBlockDenominator = denominator; } function updateRewardPerBlockNew( uint256 numerator, uint256 denominator, uint256 numeratorNass, uint256 denominatorNass, uint256 effectiveBlock ) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); rewardPerBlockNumeratorNew = numerator; rewardPerBlockDenominatorNew = denominator; naasRewardPerBlockNumeratorNew = numeratorNass; naasRewardPerBlockDenominatorNew = denominatorNass; rewardPerBlockNewEffectiveBlock = effectiveBlock != 0 ? effectiveBlock : block.number; } function deposit(uint256 amount) public { require(msg.sender == superAdmin, "not admin"); require(amount > 0, "zero"); strongToken.transferFrom(msg.sender, address(this), amount); rewardBalance = rewardBalance.add(amount); } function withdraw(address destination, uint256 amount) public { require(msg.sender == superAdmin, "not admin"); require(amount > 0, "zero"); require(rewardBalance >= amount, "not enough"); strongToken.transfer(destination, amount); rewardBalance = rewardBalance.sub(amount); } // FEES // ************************************************************************************* function updateRequestingFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); requestingFeeInWei = feeInWei; } function updateStrongFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); strongFeeInWei = feeInWei; } function updateNaasRequestingFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); naasRequestingFeeInWei = feeInWei; } function updateNaasStrongFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); naasStrongFeeInWei = feeInWei; } function updateClaimingFee(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); require(denominator != 0, "invalid value"); claimingFeeNumerator = numerator; claimingFeeDenominator = denominator; } function updateRecurringFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); recurringFeeInWei = feeInWei; } function updateRecurringNaaSFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); recurringNaaSFeeInWei = feeInWei; } function updateRecurringPaymentCycleInBlocks(uint256 blocks) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); require(blocks > 0, "zero"); recurringPaymentCycleInBlocks = blocks; } // CORE // ************************************************************************************* function requestAccess(bool isNaaS) public payable { uint256 rFee; uint256 sFee; if (hasLegacyNode(msg.sender)) { migrateLegacyNode(msg.sender); } uint128 nodeId = entityNodeCount[msg.sender] + 1; bytes memory id = getNodeId(msg.sender, nodeId); if (isNaaS) { rFee = naasRequestingFeeInWei; sFee = naasStrongFeeInWei; activeEntities = activeEntities.add(1); } else { rFee = requestingFeeInWei; sFee = strongFeeInWei; entityNodeIsBYON[id] = true; } require(msg.value == rFee, "invalid fee"); entityNodePaidOnBlock[id] = block.number; entityNodeTraunch[id] = currentTraunch; entityNodeClaimedOnBlock[id] = block.number; entityNodeCount[msg.sender] = entityNodeCount[msg.sender] + 1; feeCollector.transfer(msg.value); strongToken.transferFrom(msg.sender, address(this), sFee); strongToken.transfer(feeCollector, sFee); emit Paid(msg.sender, nodeId, entityNodeIsBYON[id], false, entityNodePaidOnBlock[id].add(recurringPaymentCycleInBlocks)); } function setEntityActiveStatus(address entity, bool status) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, "not admin"); uint256 index = entityIndex[entity]; require(entities[index] == entity, "invalid entity"); require(entityActive[entity] != status, "already set"); entityActive[entity] = status; if (status) { activeEntities = activeEntities.add(1); entityBlockLastClaimedOn[entity] = block.number; } else { activeEntities = activeEntities.sub(1); entityBlockLastClaimedOn[entity] = 0; } } function payFee(uint128 nodeId) public payable { address sender = msg.sender == address(this) ? tx.origin : msg.sender; bytes memory id = getNodeId(sender, nodeId); uint256 blockLastPaidOn = entityNodePaidOnBlock[id]; if (hasLegacyNode(sender)) { migrateLegacyNode(sender); } bool isExpired = block.number > blockLastPaidOn.add(recurringPaymentCycleInBlocks).add(recurringPaymentCycleInBlocks); require(doesNodeExist(sender, nodeId), "doesnt exist"); require(isExpired == false || msg.sender == address(this), "too late"); if (isExpired) { return; } if (entityNodeIsBYON[id]) { require(msg.value == recurringFeeInWei, "invalid fee"); } else { require(msg.value == recurringNaaSFeeInWei, "invalid fee"); } feeCollector.transfer(msg.value); entityNodePaidOnBlock[id] = entityNodePaidOnBlock[id].add(recurringPaymentCycleInBlocks); emit Paid(sender, nodeId, entityNodeIsBYON[id], true, entityNodePaidOnBlock[id]); } function getReward(address entity, uint128 nodeId) public view returns (uint256) { return getRewardByBlock(entity, nodeId, block.number); } function getRewardByBlock(address entity, uint128 nodeId, uint256 blockNumber) public view returns (uint256) { bytes memory id = getNodeId(entity, nodeId); if (hasLegacyNode(entity)) { return getRewardByBlockLegacy(entity, blockNumber); } uint256 blockLastClaimedOn = entityNodeClaimedOnBlock[id] != 0 ? entityNodeClaimedOnBlock[id] : entityNodePaidOnBlock[id]; if (blockNumber > block.number) return 0; if (blockLastClaimedOn == 0) return 0; if (blockNumber < blockLastClaimedOn) return 0; if (activeEntities == 0) return 0; if (entityNodeIsBYON[id] && !entityNodeIsActive[id]) return 0; uint256 rewardNumerator = entityNodeIsBYON[id] ? rewardPerBlockNumerator : naasRewardPerBlockNumerator; uint256 rewardDenominator = entityNodeIsBYON[id] ? rewardPerBlockDenominator : naasRewardPerBlockDenominator; uint256 newRewardNumerator = entityNodeIsBYON[id] ? rewardPerBlockNumeratorNew : naasRewardPerBlockNumeratorNew; uint256 newRewardDenominator = entityNodeIsBYON[id] ? rewardPerBlockDenominatorNew : naasRewardPerBlockDenominatorNew; uint256 bonus = address(strongNFTBonus) != address(0) ? strongNFTBonus.getBonus(entity, nodeId, blockLastClaimedOn, blockNumber) : 0; uint256[2] memory rewardBlocks = rewards.blocks(blockLastClaimedOn, rewardPerBlockNewEffectiveBlock, blockNumber); uint256 rewardOld = rewardDenominator > 0 ? rewardBlocks[0].mul(rewardNumerator).div(rewardDenominator) : 0; uint256 rewardNew = newRewardDenominator > 0 ? rewardBlocks[1].mul(newRewardNumerator).div(newRewardDenominator) : 0; return rewardOld.add(rewardNew).add(bonus); } function getRewardByBlockLegacy(address entity, uint256 blockNumber) public view returns (uint256) { if (blockNumber > block.number) return 0; if (entityBlockLastClaimedOn[entity] == 0) return 0; if (blockNumber < entityBlockLastClaimedOn[entity]) return 0; if (activeEntities == 0) return 0; uint256 blockResult = blockNumber.sub(entityBlockLastClaimedOn[entity]); uint256 rewardNumerator; uint256 rewardDenominator; if (entityIsNaaS[entity]) { rewardNumerator = naasRewardPerBlockNumerator; rewardDenominator = naasRewardPerBlockDenominator; } else { rewardNumerator = rewardPerBlockNumerator; rewardDenominator = rewardPerBlockDenominator; } uint256 rewardPerBlockResult = blockResult.mul(rewardNumerator).div(rewardDenominator); return rewardPerBlockResult; } function claim(uint128 nodeId, uint256 blockNumber, bool toStrongPool) public payable { address sender = msg.sender == address(this) || msg.sender == address(strongNFTBonus) ? tx.origin : msg.sender; bytes memory id = getNodeId(sender, nodeId); if (hasLegacyNode(sender)) { migrateLegacyNode(sender); } uint256 blockLastClaimedOn = entityNodeClaimedOnBlock[id] != 0 ? entityNodeClaimedOnBlock[id] : entityNodePaidOnBlock[id]; uint256 blockLastPaidOn = entityNodePaidOnBlock[id]; require(blockLastClaimedOn != 0, "never claimed"); require(blockNumber <= block.number, "invalid block"); require(blockNumber > blockLastClaimedOn, "too soon"); require(!entityNodeIsBYON[id] || entityNodeIsActive[id], "not active"); if ( (!entityNodeIsBYON[id] && recurringNaaSFeeInWei != 0) || (entityNodeIsBYON[id] && recurringFeeInWei != 0) ) { require(blockNumber < blockLastPaidOn.add(recurringPaymentCycleInBlocks), "pay fee"); } uint256 reward = getRewardByBlock(sender, nodeId, blockNumber); require(reward > 0, "no reward"); uint256 fee = reward.mul(claimingFeeNumerator).div(claimingFeeDenominator); require(msg.value >= fee, "invalid fee"); feeCollector.transfer(msg.value); if (toStrongPool) { strongToken.approve(address(strongPool), reward); strongPool.mineFor(sender, reward); } else { strongToken.transfer(sender, reward); } rewardBalance = rewardBalance.sub(reward); entityNodeClaimedOnBlock[id] = blockNumber; emit Claimed(sender, reward); } function getRewardAll(address entity, uint256 blockNumber) public view returns (uint256) { uint256 rewardsAll = 0; for (uint128 i = 1; i <= entityNodeCount[entity]; i++) { rewardsAll = rewardsAll.add(getRewardByBlock(entity, i, blockNumber > 0 ? blockNumber : block.number)); } return rewardsAll; } function doesNodeExist(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); return entityNodePaidOnBlock[id] > 0; } function getNodeId(address entity, uint128 nodeId) public view returns (bytes memory) { uint128 id = nodeId != 0 ? nodeId : entityNodeCount[entity] + 1; return abi.encodePacked(entity, id); } function getNodePaidOn(address entity, uint128 nodeId) public view returns (uint256) { bytes memory id = getNodeId(entity, nodeId); return entityNodePaidOnBlock[id]; } function getNodeFee(address entity, uint128 nodeId) public view returns (uint256) { bytes memory id = getNodeId(entity, nodeId); return entityNodeIsBYON[id] ? recurringFeeInWei : recurringNaaSFeeInWei; } function isNodeActive(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); return entityNodeIsActive[id] || !entityNodeIsBYON[id]; } function isNodeBYON(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); return entityNodeIsBYON[id]; } function hasLegacyNode(address entity) public view returns (bool) { return entityActive[entity] && entityNodeCount[entity] == 0; } function approveBYONNode(address entity, uint128 nodeId) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, "not admin"); bytes memory id = getNodeId(entity, nodeId); entityNodeIsActive[id] = true; entityNodeClaimedOnBlock[id] = block.number; activeEntities = activeEntities.add(1); } function suspendBYONNode(address entity, uint128 nodeId) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, "not admin"); bytes memory id = getNodeId(entity, nodeId); entityNodeIsActive[id] = false; activeEntities = activeEntities.sub(1); } function setNodeIsActive(address entity, uint128 nodeId, bool isActive) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, "not admin"); bytes memory id = getNodeId(entity, nodeId); if (isActive && !entityNodeIsActive[id]) { activeEntities = activeEntities.add(1); entityNodeClaimedOnBlock[id] = block.number; } if (!isActive && entityNodeIsActive[id]) { activeEntities = activeEntities.sub(1); } entityNodeIsActive[id] = isActive; } function setNodeIsNaaS(address entity, uint128 nodeId, bool isNaaS) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, "not admin"); bytes memory id = getNodeId(entity, nodeId); entityNodeIsBYON[id] = !isNaaS; } function migrateLegacyNode(address entity) private { bytes memory id = getNodeId(entity, 1); entityNodeClaimedOnBlock[id] = entityBlockLastClaimedOn[entity]; entityNodePaidOnBlock[id] = paidOnBlock[entity]; entityNodeTraunch[id] = traunch[entity]; entityNodeIsBYON[id] = !entityIsNaaS[entity]; if (entityNodeIsBYON[id]) { entityNodeIsActive[id] = true; } entityNodeCount[msg.sender] = 1; } function migrateNode(uint128 nodeId, address to) public { if (hasLegacyNode(msg.sender)) { migrateLegacyNode(msg.sender); } if (hasLegacyNode(to)) { migrateLegacyNode(to); } require(doesNodeExist(msg.sender, nodeId), "doesnt exist"); uint128 toNodeId = entityNodeCount[to] + 1; bytes memory fromId = getNodeId(msg.sender, nodeId); bytes memory toId = getNodeId(to, toNodeId); // move node to another address entityNodeIsActive[toId] = entityNodeIsActive[fromId]; entityNodeIsBYON[toId] = entityNodeIsBYON[fromId]; entityNodePaidOnBlock[toId] = entityNodePaidOnBlock[fromId]; entityNodeClaimedOnBlock[toId] = entityNodeClaimedOnBlock[fromId]; entityNodeTraunch[toId] = entityNodeTraunch[fromId]; entityNodeCount[to] = entityNodeCount[to] + 1; // deactivate node entityNodeIsActive[fromId] = false; entityNodePaidOnBlock[fromId] = 0; entityNodeClaimedOnBlock[fromId] = 0; entityNodeCount[msg.sender] = entityNodeCount[msg.sender] - 1; emit Migrated(msg.sender, to, nodeId, toNodeId, entityNodeIsBYON[fromId]); } function claimAll(uint256 blockNumber, bool toStrongPool) public payable { for (uint16 i = 1; i <= entityNodeCount[msg.sender]; i++) { uint256 reward = getRewardByBlock(msg.sender, i, blockNumber); uint256 fee = reward.mul(claimingFeeNumerator).div(claimingFeeDenominator); this.claim{value : fee}(i, blockNumber, toStrongPool); } } function payAll() public payable { for (uint16 i = 1; i <= entityNodeCount[msg.sender]; i++) { bytes memory id = getNodeId(msg.sender, i); uint256 fee = entityNodeIsBYON[id] ? recurringFeeInWei : recurringNaaSFeeInWei; this.payFee{value : fee}(i); } } function addNFTBonusContract(address _contract) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, "not admin"); strongNFTBonus = StrongNFTBonusInterface(_contract); } }
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IERC20.sol"; import "./SafeMath.sol"; import "./StrongPoolInterface.sol"; import "./IERC1155Preset.sol"; import "./StrongNFTBonusInterface.sol"; import "./rewards.sol"; contract ServiceV11 { event Requested(address indexed miner); event Claimed(address indexed miner, uint256 reward); using SafeMath for uint256; bool public initDone; address public admin; address public pendingAdmin; address public superAdmin; address public pendingSuperAdmin; address public serviceAdmin; address public parameterAdmin; address payable public feeCollector; IERC20 public strongToken; StrongPoolInterface public strongPool; uint256 public rewardPerBlockNumerator; uint256 public rewardPerBlockDenominator; uint256 public naasRewardPerBlockNumerator; uint256 public naasRewardPerBlockDenominator; uint256 public claimingFeeNumerator; uint256 public claimingFeeDenominator; uint256 public requestingFeeInWei; uint256 public strongFeeInWei; uint256 public recurringFeeInWei; uint256 public recurringNaaSFeeInWei; uint256 public recurringPaymentCycleInBlocks; uint256 public rewardBalance; mapping(address => uint256) public entityBlockLastClaimedOn; address[] public entities; mapping(address => uint256) public entityIndex; mapping(address => bool) public entityActive; mapping(address => bool) public requestPending; mapping(address => bool) public entityIsNaaS; mapping(address => uint256) public paidOnBlock; uint256 public activeEntities; string public desciption; uint256 public claimingFeeInWei; uint256 public naasRequestingFeeInWei; uint256 public naasStrongFeeInWei; bool public removedTokens; mapping(address => uint256) public traunch; uint256 public currentTraunch; mapping(bytes => bool) public entityNodeIsActive; mapping(bytes => bool) public entityNodeIsBYON; mapping(bytes => uint256) public entityNodeTraunch; mapping(bytes => uint256) public entityNodePaidOnBlock; mapping(bytes => uint256) public entityNodeClaimedOnBlock; mapping(address => uint128) public entityNodeCount; event Paid(address indexed entity, uint128 nodeId, bool isBYON, bool isRenewal, uint256 upToBlockNumber); event Migrated(address indexed from, address indexed to, uint128 fromNodeId, uint128 toNodeId, bool isBYON); uint256 public rewardPerBlockNumeratorNew; uint256 public rewardPerBlockDenominatorNew; uint256 public naasRewardPerBlockNumeratorNew; uint256 public naasRewardPerBlockDenominatorNew; uint256 public rewardPerBlockNewEffectiveBlock; StrongNFTBonusInterface public strongNFTBonus; uint256 public gracePeriodInBlocks; function init( address strongTokenAddress, address strongPoolAddress, address adminAddress, address superAdminAddress, uint256 rewardPerBlockNumeratorValue, uint256 rewardPerBlockDenominatorValue, uint256 naasRewardPerBlockNumeratorValue, uint256 naasRewardPerBlockDenominatorValue, uint256 requestingFeeInWeiValue, uint256 strongFeeInWeiValue, uint256 recurringFeeInWeiValue, uint256 recurringNaaSFeeInWeiValue, uint256 recurringPaymentCycleInBlocksValue, uint256 claimingFeeNumeratorValue, uint256 claimingFeeDenominatorValue, string memory desc ) public { require(!initDone, "init done"); strongToken = IERC20(strongTokenAddress); strongPool = StrongPoolInterface(strongPoolAddress); admin = adminAddress; superAdmin = superAdminAddress; rewardPerBlockNumerator = rewardPerBlockNumeratorValue; rewardPerBlockDenominator = rewardPerBlockDenominatorValue; naasRewardPerBlockNumerator = naasRewardPerBlockNumeratorValue; naasRewardPerBlockDenominator = naasRewardPerBlockDenominatorValue; requestingFeeInWei = requestingFeeInWeiValue; strongFeeInWei = strongFeeInWeiValue; recurringFeeInWei = recurringFeeInWeiValue; recurringNaaSFeeInWei = recurringNaaSFeeInWeiValue; claimingFeeNumerator = claimingFeeNumeratorValue; claimingFeeDenominator = claimingFeeDenominatorValue; recurringPaymentCycleInBlocks = recurringPaymentCycleInBlocksValue; desciption = desc; initDone = true; } // ADMIN // ************************************************************************************* function updateServiceAdmin(address newServiceAdmin) public { require(msg.sender == superAdmin); serviceAdmin = newServiceAdmin; } function updateParameterAdmin(address newParameterAdmin) public { require(newParameterAdmin != address(0), "zero"); require(msg.sender == superAdmin); parameterAdmin = newParameterAdmin; } function updateFeeCollector(address payable newFeeCollector) public { require(newFeeCollector != address(0), "zero"); require(msg.sender == superAdmin); feeCollector = newFeeCollector; } function setPendingAdmin(address newPendingAdmin) public { require(msg.sender == admin, "not admin"); pendingAdmin = newPendingAdmin; } function acceptAdmin() public { require(msg.sender == pendingAdmin && msg.sender != address(0), "not pendingAdmin"); admin = pendingAdmin; pendingAdmin = address(0); } function setPendingSuperAdmin(address newPendingSuperAdmin) public { require(msg.sender == superAdmin, "not superAdmin"); pendingSuperAdmin = newPendingSuperAdmin; } function acceptSuperAdmin() public { require(msg.sender == pendingSuperAdmin && msg.sender != address(0), "not pendingSuperAdmin"); superAdmin = pendingSuperAdmin; pendingSuperAdmin = address(0); } // ENTITIES // ************************************************************************************* function isEntityActive(address entity) public view returns (bool) { return entityActive[entity] || (doesNodeExist(entity, 1) && !hasNodeExpired(entity, 1)); } // REWARD // ************************************************************************************* function updateRewardPerBlock(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); require(denominator != 0, "invalid value"); rewardPerBlockNumerator = numerator; rewardPerBlockDenominator = denominator; } function updateNaaSRewardPerBlock(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); require(denominator != 0, "invalid value"); naasRewardPerBlockNumerator = numerator; naasRewardPerBlockDenominator = denominator; } function updateRewardPerBlockNew( uint256 numerator, uint256 denominator, uint256 numeratorNass, uint256 denominatorNass, uint256 effectiveBlock ) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); rewardPerBlockNumeratorNew = numerator; rewardPerBlockDenominatorNew = denominator; naasRewardPerBlockNumeratorNew = numeratorNass; naasRewardPerBlockDenominatorNew = denominatorNass; rewardPerBlockNewEffectiveBlock = effectiveBlock != 0 ? effectiveBlock : block.number; } function deposit(uint256 amount) public { require(msg.sender == superAdmin, "not admin"); require(amount > 0, "zero"); strongToken.transferFrom(msg.sender, address(this), amount); rewardBalance = rewardBalance.add(amount); } function withdraw(address destination, uint256 amount) public { require(msg.sender == superAdmin, "not admin"); require(amount > 0, "zero"); require(rewardBalance >= amount, "not enough"); strongToken.transfer(destination, amount); rewardBalance = rewardBalance.sub(amount); } // FEES // ************************************************************************************* function updateRequestingFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); requestingFeeInWei = feeInWei; } function updateStrongFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); strongFeeInWei = feeInWei; } function updateNaasRequestingFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); naasRequestingFeeInWei = feeInWei; } function updateNaasStrongFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); naasStrongFeeInWei = feeInWei; } function updateClaimingFee(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); require(denominator != 0, "invalid value"); claimingFeeNumerator = numerator; claimingFeeDenominator = denominator; } function updateRecurringFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); recurringFeeInWei = feeInWei; } function updateRecurringNaaSFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); recurringNaaSFeeInWei = feeInWei; } function updateRecurringPaymentCycleInBlocks(uint256 blocks) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); require(blocks > 0, "zero"); recurringPaymentCycleInBlocks = blocks; } function updateGracePeriodInBlocks(uint256 blocks) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); require(blocks > 0, "zero"); gracePeriodInBlocks = blocks; } // CORE // ************************************************************************************* function requestAccess(bool isNaaS) public payable { uint256 rFee; uint256 sFee; if (hasLegacyNode(msg.sender)) { migrateLegacyNode(msg.sender); } uint128 nodeId = entityNodeCount[msg.sender] + 1; bytes memory id = getNodeId(msg.sender, nodeId); if (isNaaS) { rFee = naasRequestingFeeInWei; sFee = naasStrongFeeInWei; activeEntities = activeEntities.add(1); } else { rFee = requestingFeeInWei; sFee = strongFeeInWei; entityNodeIsBYON[id] = true; } require(msg.value == rFee, "invalid fee"); entityNodePaidOnBlock[id] = block.number; entityNodeClaimedOnBlock[id] = block.number; entityNodeCount[msg.sender] = entityNodeCount[msg.sender] + 1; feeCollector.transfer(msg.value); strongToken.transferFrom(msg.sender, address(this), sFee); strongToken.transfer(feeCollector, sFee); emit Paid(msg.sender, nodeId, entityNodeIsBYON[id], false, entityNodePaidOnBlock[id].add(recurringPaymentCycleInBlocks)); } function setEntityActiveStatus(address entity, bool status) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, "not admin"); uint256 index = entityIndex[entity]; require(entities[index] == entity, "invalid entity"); require(entityActive[entity] != status, "already set"); entityActive[entity] = status; if (status) { activeEntities = activeEntities.add(1); entityBlockLastClaimedOn[entity] = block.number; } else { activeEntities = activeEntities.sub(1); entityBlockLastClaimedOn[entity] = 0; } } function payFee(uint128 nodeId) public payable { address sender = msg.sender == address(this) ? tx.origin : msg.sender; bytes memory id = getNodeId(sender, nodeId); if (hasLegacyNode(sender)) { migrateLegacyNode(sender); } bool isExpired = hasNodeExpired(msg.sender, nodeId); require(doesNodeExist(sender, nodeId), "doesnt exist"); require(isExpired == false || msg.sender == address(this), "too late"); if (isExpired) { return; } if (entityNodeIsBYON[id]) { require(msg.value == recurringFeeInWei, "invalid fee"); } else { require(msg.value == recurringNaaSFeeInWei, "invalid fee"); } feeCollector.transfer(msg.value); entityNodePaidOnBlock[id] = entityNodePaidOnBlock[id].add(recurringPaymentCycleInBlocks); emit Paid(sender, nodeId, entityNodeIsBYON[id], true, entityNodePaidOnBlock[id]); } function getReward(address entity, uint128 nodeId) public view returns (uint256) { return getRewardByBlock(entity, nodeId, block.number); } function getRewardByBlock(address entity, uint128 nodeId, uint256 blockNumber) public view returns (uint256) { bytes memory id = getNodeId(entity, nodeId); if (hasLegacyNode(entity)) { return getRewardByBlockLegacy(entity, blockNumber); } uint256 blockLastClaimedOn = entityNodeClaimedOnBlock[id] != 0 ? entityNodeClaimedOnBlock[id] : entityNodePaidOnBlock[id]; if (blockNumber > block.number) return 0; if (blockLastClaimedOn == 0) return 0; if (blockNumber < blockLastClaimedOn) return 0; if (activeEntities == 0) return 0; if (entityNodeIsBYON[id] && !entityNodeIsActive[id]) return 0; uint256 rewardNumerator = entityNodeIsBYON[id] ? rewardPerBlockNumerator : naasRewardPerBlockNumerator; uint256 rewardDenominator = entityNodeIsBYON[id] ? rewardPerBlockDenominator : naasRewardPerBlockDenominator; uint256 newRewardNumerator = entityNodeIsBYON[id] ? rewardPerBlockNumeratorNew : naasRewardPerBlockNumeratorNew; uint256 newRewardDenominator = entityNodeIsBYON[id] ? rewardPerBlockDenominatorNew : naasRewardPerBlockDenominatorNew; uint256 bonus = address(strongNFTBonus) != address(0) ? strongNFTBonus.getBonus(entity, nodeId, blockLastClaimedOn, blockNumber) : 0; uint256[2] memory rewardBlocks = rewards.blocks(blockLastClaimedOn, rewardPerBlockNewEffectiveBlock, blockNumber); uint256 rewardOld = rewardDenominator > 0 ? rewardBlocks[0].mul(rewardNumerator).div(rewardDenominator) : 0; uint256 rewardNew = newRewardDenominator > 0 ? rewardBlocks[1].mul(newRewardNumerator).div(newRewardDenominator) : 0; return rewardOld.add(rewardNew).add(bonus); } function getRewardByBlockLegacy(address entity, uint256 blockNumber) public view returns (uint256) { if (blockNumber > block.number) return 0; if (entityBlockLastClaimedOn[entity] == 0) return 0; if (blockNumber < entityBlockLastClaimedOn[entity]) return 0; if (activeEntities == 0) return 0; uint256 blockResult = blockNumber.sub(entityBlockLastClaimedOn[entity]); uint256 rewardNumerator; uint256 rewardDenominator; if (entityIsNaaS[entity]) { rewardNumerator = naasRewardPerBlockNumerator; rewardDenominator = naasRewardPerBlockDenominator; } else { rewardNumerator = rewardPerBlockNumerator; rewardDenominator = rewardPerBlockDenominator; } uint256 rewardPerBlockResult = blockResult.mul(rewardNumerator).div(rewardDenominator); return rewardPerBlockResult; } function claim(uint128 nodeId, uint256 blockNumber, bool toStrongPool) public payable { address sender = msg.sender == address(this) || msg.sender == address(strongNFTBonus) ? tx.origin : msg.sender; bytes memory id = getNodeId(sender, nodeId); if (hasLegacyNode(sender)) { migrateLegacyNode(sender); } uint256 blockLastClaimedOn = entityNodeClaimedOnBlock[id] != 0 ? entityNodeClaimedOnBlock[id] : entityNodePaidOnBlock[id]; uint256 blockLastPaidOn = entityNodePaidOnBlock[id]; require(blockLastClaimedOn != 0, "never claimed"); require(blockNumber <= block.number, "invalid block"); require(blockNumber > blockLastClaimedOn, "too soon"); require(!entityNodeIsBYON[id] || entityNodeIsActive[id], "not active"); if ( (!entityNodeIsBYON[id] && recurringNaaSFeeInWei != 0) || (entityNodeIsBYON[id] && recurringFeeInWei != 0) ) { require(blockNumber < blockLastPaidOn.add(recurringPaymentCycleInBlocks), "pay fee"); } uint256 reward = getRewardByBlock(sender, nodeId, blockNumber); require(reward > 0, "no reward"); uint256 fee = reward.mul(claimingFeeNumerator).div(claimingFeeDenominator); require(msg.value >= fee, "invalid fee"); feeCollector.transfer(msg.value); if (toStrongPool) { strongToken.approve(address(strongPool), reward); strongPool.mineFor(sender, reward); } else { strongToken.transfer(sender, reward); } rewardBalance = rewardBalance.sub(reward); entityNodeClaimedOnBlock[id] = blockNumber; emit Claimed(sender, reward); } function getRewardAll(address entity, uint256 blockNumber) public view returns (uint256) { uint256 rewardsAll = 0; for (uint128 i = 1; i <= entityNodeCount[entity]; i++) { rewardsAll = rewardsAll.add(getRewardByBlock(entity, i, blockNumber > 0 ? blockNumber : block.number)); } return rewardsAll; } function doesNodeExist(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); return entityNodePaidOnBlock[id] > 0; } function hasNodeExpired(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); uint256 blockLastPaidOn = entityNodePaidOnBlock[id]; return block.number > blockLastPaidOn.add(recurringPaymentCycleInBlocks).add(gracePeriodInBlocks); } function getNodeId(address entity, uint128 nodeId) public view returns (bytes memory) { uint128 id = nodeId != 0 ? nodeId : entityNodeCount[entity] + 1; return abi.encodePacked(entity, id); } function getNodePaidOn(address entity, uint128 nodeId) public view returns (uint256) { bytes memory id = getNodeId(entity, nodeId); return entityNodePaidOnBlock[id]; } function getNodeFee(address entity, uint128 nodeId) public view returns (uint256) { bytes memory id = getNodeId(entity, nodeId); return entityNodeIsBYON[id] ? recurringFeeInWei : recurringNaaSFeeInWei; } function isNodeActive(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); return entityNodeIsActive[id] || !entityNodeIsBYON[id]; } function isNodeBYON(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); return entityNodeIsBYON[id]; } function hasLegacyNode(address entity) public view returns (bool) { return entityActive[entity] && entityNodeCount[entity] == 0; } function approveBYONNode(address entity, uint128 nodeId) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, "not admin"); bytes memory id = getNodeId(entity, nodeId); entityNodeIsActive[id] = true; entityNodeClaimedOnBlock[id] = block.number; activeEntities = activeEntities.add(1); } function suspendBYONNode(address entity, uint128 nodeId) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, "not admin"); bytes memory id = getNodeId(entity, nodeId); entityNodeIsActive[id] = false; activeEntities = activeEntities.sub(1); } function setNodeIsActive(address entity, uint128 nodeId, bool isActive) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, "not admin"); bytes memory id = getNodeId(entity, nodeId); if (isActive && !entityNodeIsActive[id]) { activeEntities = activeEntities.add(1); entityNodeClaimedOnBlock[id] = block.number; } if (!isActive && entityNodeIsActive[id]) { activeEntities = activeEntities.sub(1); } entityNodeIsActive[id] = isActive; } function setNodeIsNaaS(address entity, uint128 nodeId, bool isNaaS) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, "not admin"); bytes memory id = getNodeId(entity, nodeId); entityNodeIsBYON[id] = !isNaaS; } function migrateLegacyNode(address entity) private { bytes memory id = getNodeId(entity, 1); entityNodeClaimedOnBlock[id] = entityBlockLastClaimedOn[entity]; entityNodePaidOnBlock[id] = paidOnBlock[entity]; entityNodeIsBYON[id] = !entityIsNaaS[entity]; if (entityNodeIsBYON[id]) { entityNodeIsActive[id] = true; } entityNodeCount[msg.sender] = 1; } function migrateNode(uint128 nodeId, address to) public { if (hasLegacyNode(msg.sender)) { migrateLegacyNode(msg.sender); } if (hasLegacyNode(to)) { migrateLegacyNode(to); } require(doesNodeExist(msg.sender, nodeId), "doesnt exist"); uint128 toNodeId = entityNodeCount[to] + 1; bytes memory fromId = getNodeId(msg.sender, nodeId); bytes memory toId = getNodeId(to, toNodeId); // move node to another address entityNodeIsActive[toId] = entityNodeIsActive[fromId]; entityNodeIsBYON[toId] = entityNodeIsBYON[fromId]; entityNodePaidOnBlock[toId] = entityNodePaidOnBlock[fromId]; entityNodeClaimedOnBlock[toId] = entityNodeClaimedOnBlock[fromId]; entityNodeCount[to] = entityNodeCount[to] + 1; // deactivate node entityNodeIsActive[fromId] = false; entityNodePaidOnBlock[fromId] = 0; entityNodeClaimedOnBlock[fromId] = 0; entityNodeCount[msg.sender] = entityNodeCount[msg.sender] - 1; emit Migrated(msg.sender, to, nodeId, toNodeId, entityNodeIsBYON[fromId]); } function claimAll(uint256 blockNumber, bool toStrongPool) public payable { for (uint16 i = 1; i <= entityNodeCount[msg.sender]; i++) { uint256 reward = getRewardByBlock(msg.sender, i, blockNumber); uint256 fee = reward.mul(claimingFeeNumerator).div(claimingFeeDenominator); this.claim{value : fee}(i, blockNumber, toStrongPool); } } function payAll() public payable { for (uint16 i = 1; i <= entityNodeCount[msg.sender]; i++) { bytes memory id = getNodeId(msg.sender, i); uint256 fee = entityNodeIsBYON[id] ? recurringFeeInWei : recurringNaaSFeeInWei; this.payFee{value : fee}(i); } } function addNFTBonusContract(address _contract) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, "not admin"); strongNFTBonus = StrongNFTBonusInterface(_contract); } }
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IERC20.sol"; import "./SafeMath.sol"; import "./StrongPoolInterface.sol"; import "./IERC1155Preset.sol"; import "./StrongNFTBonusInterface.sol"; import "./rewards.sol"; contract ServiceV12 { event Requested(address indexed miner); event Claimed(address indexed miner, uint256 reward); using SafeMath for uint256; bool public initDone; address public admin; address public pendingAdmin; address public superAdmin; address public pendingSuperAdmin; address public serviceAdmin; address public parameterAdmin; address payable public feeCollector; IERC20 public strongToken; StrongPoolInterface public strongPool; uint256 public rewardPerBlockNumerator; uint256 public rewardPerBlockDenominator; uint256 public naasRewardPerBlockNumerator; uint256 public naasRewardPerBlockDenominator; uint256 public claimingFeeNumerator; uint256 public claimingFeeDenominator; uint256 public requestingFeeInWei; uint256 public strongFeeInWei; uint256 public recurringFeeInWei; uint256 public recurringNaaSFeeInWei; uint256 public recurringPaymentCycleInBlocks; uint256 public rewardBalance; mapping(address => uint256) public entityBlockLastClaimedOn; address[] public entities; mapping(address => uint256) public entityIndex; mapping(address => bool) public entityActive; mapping(address => bool) public requestPending; mapping(address => bool) public entityIsNaaS; mapping(address => uint256) public paidOnBlock; uint256 public activeEntities; string public desciption; uint256 public claimingFeeInWei; uint256 public naasRequestingFeeInWei; uint256 public naasStrongFeeInWei; bool public removedTokens; mapping(address => uint256) public traunch; uint256 public currentTraunch; mapping(bytes => bool) public entityNodeIsActive; mapping(bytes => bool) public entityNodeIsBYON; mapping(bytes => uint256) public entityNodeTraunch; mapping(bytes => uint256) public entityNodePaidOnBlock; mapping(bytes => uint256) public entityNodeClaimedOnBlock; mapping(address => uint128) public entityNodeCount; event Paid(address indexed entity, uint128 nodeId, bool isBYON, bool isRenewal, uint256 upToBlockNumber); event Migrated(address indexed from, address indexed to, uint128 fromNodeId, uint128 toNodeId, bool isBYON); uint256 public rewardPerBlockNumeratorNew; uint256 public rewardPerBlockDenominatorNew; uint256 public naasRewardPerBlockNumeratorNew; uint256 public naasRewardPerBlockDenominatorNew; uint256 public rewardPerBlockNewEffectiveBlock; StrongNFTBonusInterface public strongNFTBonus; uint256 public gracePeriodInBlocks; function init( address strongTokenAddress, address strongPoolAddress, address adminAddress, address superAdminAddress, uint256 rewardPerBlockNumeratorValue, uint256 rewardPerBlockDenominatorValue, uint256 naasRewardPerBlockNumeratorValue, uint256 naasRewardPerBlockDenominatorValue, uint256 requestingFeeInWeiValue, uint256 strongFeeInWeiValue, uint256 recurringFeeInWeiValue, uint256 recurringNaaSFeeInWeiValue, uint256 recurringPaymentCycleInBlocksValue, uint256 claimingFeeNumeratorValue, uint256 claimingFeeDenominatorValue, string memory desc ) public { require(!initDone, "init done"); strongToken = IERC20(strongTokenAddress); strongPool = StrongPoolInterface(strongPoolAddress); admin = adminAddress; superAdmin = superAdminAddress; rewardPerBlockNumerator = rewardPerBlockNumeratorValue; rewardPerBlockDenominator = rewardPerBlockDenominatorValue; naasRewardPerBlockNumerator = naasRewardPerBlockNumeratorValue; naasRewardPerBlockDenominator = naasRewardPerBlockDenominatorValue; requestingFeeInWei = requestingFeeInWeiValue; strongFeeInWei = strongFeeInWeiValue; recurringFeeInWei = recurringFeeInWeiValue; recurringNaaSFeeInWei = recurringNaaSFeeInWeiValue; claimingFeeNumerator = claimingFeeNumeratorValue; claimingFeeDenominator = claimingFeeDenominatorValue; recurringPaymentCycleInBlocks = recurringPaymentCycleInBlocksValue; desciption = desc; initDone = true; } function updateServiceAdmin(address newServiceAdmin) public { require(msg.sender == superAdmin); serviceAdmin = newServiceAdmin; } function updateParameterAdmin(address newParameterAdmin) public { require(newParameterAdmin != address(0)); require(msg.sender == superAdmin); parameterAdmin = newParameterAdmin; } function updateFeeCollector(address payable newFeeCollector) public { require(newFeeCollector != address(0)); require(msg.sender == superAdmin); feeCollector = newFeeCollector; } function setPendingAdmin(address newPendingAdmin) public { require(msg.sender == admin); pendingAdmin = newPendingAdmin; } function acceptAdmin() public { require(msg.sender == pendingAdmin && msg.sender != address(0), "not pendingAdmin"); admin = pendingAdmin; pendingAdmin = address(0); } function setPendingSuperAdmin(address newPendingSuperAdmin) public { require(msg.sender == superAdmin, "not superAdmin"); pendingSuperAdmin = newPendingSuperAdmin; } function acceptSuperAdmin() public { require(msg.sender == pendingSuperAdmin && msg.sender != address(0), "not pendingSuperAdmin"); superAdmin = pendingSuperAdmin; pendingSuperAdmin = address(0); } function isEntityActive(address entity) public view returns (bool) { return entityActive[entity] || (doesNodeExist(entity, 1) && !hasNodeExpired(entity, 1)); } function updateRewardPerBlock(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin); require(denominator != 0); rewardPerBlockNumerator = numerator; rewardPerBlockDenominator = denominator; } function updateNaaSRewardPerBlock(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin); require(denominator != 0); naasRewardPerBlockNumerator = numerator; naasRewardPerBlockDenominator = denominator; } function updateRewardPerBlockNew( uint256 numerator, uint256 denominator, uint256 numeratorNass, uint256 denominatorNass, uint256 effectiveBlock ) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin); rewardPerBlockNumeratorNew = numerator; rewardPerBlockDenominatorNew = denominator; naasRewardPerBlockNumeratorNew = numeratorNass; naasRewardPerBlockDenominatorNew = denominatorNass; rewardPerBlockNewEffectiveBlock = effectiveBlock != 0 ? effectiveBlock : block.number; } function deposit(uint256 amount) public { require(msg.sender == superAdmin); require(amount > 0); strongToken.transferFrom(msg.sender, address(this), amount); rewardBalance = rewardBalance.add(amount); } function withdraw(address destination, uint256 amount) public { require(msg.sender == superAdmin); require(amount > 0); require(rewardBalance >= amount, "not enough"); strongToken.transfer(destination, amount); rewardBalance = rewardBalance.sub(amount); } function updateRequestingFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin); requestingFeeInWei = feeInWei; } function updateStrongFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin); strongFeeInWei = feeInWei; } function updateNaasRequestingFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin); naasRequestingFeeInWei = feeInWei; } function updateNaasStrongFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin); naasStrongFeeInWei = feeInWei; } function updateClaimingFee(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin); require(denominator != 0); claimingFeeNumerator = numerator; claimingFeeDenominator = denominator; } function updateRecurringFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin); recurringFeeInWei = feeInWei; } function updateRecurringNaaSFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin); recurringNaaSFeeInWei = feeInWei; } function updateRecurringPaymentCycleInBlocks(uint256 blocks) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin); require(blocks > 0); recurringPaymentCycleInBlocks = blocks; } function updateGracePeriodInBlocks(uint256 blocks) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin); require(blocks > 0); gracePeriodInBlocks = blocks; } function requestAccess(bool isNaaS) public payable { uint256 rFee; uint256 sFee; if (hasLegacyNode(msg.sender)) { migrateLegacyNode(msg.sender); } uint128 nodeId = entityNodeCount[msg.sender] + 1; bytes memory id = getNodeId(msg.sender, nodeId); if (isNaaS) { rFee = naasRequestingFeeInWei; sFee = naasStrongFeeInWei; activeEntities = activeEntities.add(1); } else { rFee = requestingFeeInWei; sFee = strongFeeInWei; entityNodeIsBYON[id] = true; } require(msg.value == rFee, "invalid fee"); entityNodePaidOnBlock[id] = block.number; entityNodeClaimedOnBlock[id] = block.number; entityNodeCount[msg.sender] = entityNodeCount[msg.sender] + 1; feeCollector.transfer(msg.value); strongToken.transferFrom(msg.sender, address(this), sFee); strongToken.transfer(feeCollector, sFee); emit Paid(msg.sender, nodeId, entityNodeIsBYON[id], false, entityNodePaidOnBlock[id].add(recurringPaymentCycleInBlocks)); } function setEntityActiveStatus(address entity, bool status) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin); uint256 index = entityIndex[entity]; require(entities[index] == entity, "invalid entity"); require(entityActive[entity] != status, "already set"); entityActive[entity] = status; if (status) { activeEntities = activeEntities.add(1); entityBlockLastClaimedOn[entity] = block.number; } else { activeEntities = activeEntities.sub(1); entityBlockLastClaimedOn[entity] = 0; } } function payFee(uint128 nodeId) public payable { address sender = msg.sender == address(this) ? tx.origin : msg.sender; bytes memory id = getNodeId(sender, nodeId); if (hasLegacyNode(sender)) { migrateLegacyNode(sender); } bool isExpired = hasNodeExpired(sender, nodeId); require(doesNodeExist(sender, nodeId), "doesnt exist"); require(isExpired == false || msg.sender == address(this), "too late"); if (isExpired) { return; } if (entityNodeIsBYON[id]) { require(msg.value == recurringFeeInWei, "invalid fee"); } else { require(msg.value == recurringNaaSFeeInWei, "invalid fee"); } feeCollector.transfer(msg.value); entityNodePaidOnBlock[id] = entityNodePaidOnBlock[id].add(recurringPaymentCycleInBlocks); emit Paid(sender, nodeId, entityNodeIsBYON[id], true, entityNodePaidOnBlock[id]); } function getReward(address entity, uint128 nodeId) public view returns (uint256) { return getRewardByBlock(entity, nodeId, block.number); } function getRewardByBlock(address entity, uint128 nodeId, uint256 blockNumber) public view returns (uint256) { bytes memory id = getNodeId(entity, nodeId); if (hasLegacyNode(entity)) { return getRewardByBlockLegacy(entity, blockNumber); } uint256 blockLastClaimedOn = entityNodeClaimedOnBlock[id] != 0 ? entityNodeClaimedOnBlock[id] : entityNodePaidOnBlock[id]; if (blockNumber > block.number) return 0; if (blockLastClaimedOn == 0) return 0; if (blockNumber < blockLastClaimedOn) return 0; if (activeEntities == 0) return 0; if (entityNodeIsBYON[id] && !entityNodeIsActive[id]) return 0; uint256 rewardNumerator = entityNodeIsBYON[id] ? rewardPerBlockNumerator : naasRewardPerBlockNumerator; uint256 rewardDenominator = entityNodeIsBYON[id] ? rewardPerBlockDenominator : naasRewardPerBlockDenominator; uint256 newRewardNumerator = entityNodeIsBYON[id] ? rewardPerBlockNumeratorNew : naasRewardPerBlockNumeratorNew; uint256 newRewardDenominator = entityNodeIsBYON[id] ? rewardPerBlockDenominatorNew : naasRewardPerBlockDenominatorNew; uint256 bonus = address(strongNFTBonus) != address(0) ? strongNFTBonus.getBonus(entity, nodeId, blockLastClaimedOn, blockNumber) : 0; uint256[2] memory rewardBlocks = rewards.blocks(blockLastClaimedOn, rewardPerBlockNewEffectiveBlock, blockNumber); uint256 rewardOld = rewardDenominator > 0 ? rewardBlocks[0].mul(rewardNumerator).div(rewardDenominator) : 0; uint256 rewardNew = newRewardDenominator > 0 ? rewardBlocks[1].mul(newRewardNumerator).div(newRewardDenominator) : 0; return rewardOld.add(rewardNew).add(bonus); } function getRewardByBlockLegacy(address entity, uint256 blockNumber) public view returns (uint256) { if (blockNumber > block.number) return 0; if (entityBlockLastClaimedOn[entity] == 0) return 0; if (blockNumber < entityBlockLastClaimedOn[entity]) return 0; if (activeEntities == 0) return 0; uint256 blockResult = blockNumber.sub(entityBlockLastClaimedOn[entity]); uint256 rewardNumerator; uint256 rewardDenominator; if (entityIsNaaS[entity]) { rewardNumerator = naasRewardPerBlockNumerator; rewardDenominator = naasRewardPerBlockDenominator; } else { rewardNumerator = rewardPerBlockNumerator; rewardDenominator = rewardPerBlockDenominator; } uint256 rewardPerBlockResult = blockResult.mul(rewardNumerator).div(rewardDenominator); return rewardPerBlockResult; } function claim(uint128 nodeId, uint256 blockNumber, bool toStrongPool) public payable { address sender = msg.sender == address(this) || msg.sender == address(strongNFTBonus) ? tx.origin : msg.sender; bytes memory id = getNodeId(sender, nodeId); if (hasLegacyNode(sender)) { migrateLegacyNode(sender); } uint256 blockLastClaimedOn = entityNodeClaimedOnBlock[id] != 0 ? entityNodeClaimedOnBlock[id] : entityNodePaidOnBlock[id]; uint256 blockLastPaidOn = entityNodePaidOnBlock[id]; require(blockLastClaimedOn != 0, "never claimed"); require(blockNumber <= block.number, "invalid block"); require(blockNumber > blockLastClaimedOn, "too soon"); require(!entityNodeIsBYON[id] || entityNodeIsActive[id], "not active"); if ( (!entityNodeIsBYON[id] && recurringNaaSFeeInWei != 0) || (entityNodeIsBYON[id] && recurringFeeInWei != 0) ) { require(blockNumber < blockLastPaidOn.add(recurringPaymentCycleInBlocks), "pay fee"); } uint256 reward = getRewardByBlock(sender, nodeId, blockNumber); require(reward > 0, "no reward"); uint256 fee = reward.mul(claimingFeeNumerator).div(claimingFeeDenominator); require(msg.value >= fee, "invalid fee"); feeCollector.transfer(msg.value); if (toStrongPool) { strongToken.approve(address(strongPool), reward); strongPool.mineFor(sender, reward); } else { strongToken.transfer(sender, reward); } rewardBalance = rewardBalance.sub(reward); entityNodeClaimedOnBlock[id] = blockNumber; emit Claimed(sender, reward); } function getRewardAll(address entity, uint256 blockNumber) public view returns (uint256) { uint256 rewardsAll = 0; for (uint128 i = 1; i <= entityNodeCount[entity]; i++) { rewardsAll = rewardsAll.add(getRewardByBlock(entity, i, blockNumber > 0 ? blockNumber : block.number)); } return rewardsAll; } function doesNodeExist(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); return entityNodePaidOnBlock[id] > 0; } function hasNodeExpired(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); uint256 blockLastPaidOn = entityNodePaidOnBlock[id]; return block.number > blockLastPaidOn.add(recurringPaymentCycleInBlocks).add(gracePeriodInBlocks); } function getNodeId(address entity, uint128 nodeId) public view returns (bytes memory) { uint128 id = nodeId != 0 ? nodeId : entityNodeCount[entity] + 1; return abi.encodePacked(entity, id); } function getNodePaidOn(address entity, uint128 nodeId) public view returns (uint256) { bytes memory id = getNodeId(entity, nodeId); return entityNodePaidOnBlock[id]; } function getNodeFee(address entity, uint128 nodeId) public view returns (uint256) { bytes memory id = getNodeId(entity, nodeId); return entityNodeIsBYON[id] ? recurringFeeInWei : recurringNaaSFeeInWei; } function isNodeActive(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); return entityNodeIsActive[id] || !entityNodeIsBYON[id]; } function isNodeBYON(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); return entityNodeIsBYON[id]; } function hasLegacyNode(address entity) public view returns (bool) { return entityActive[entity] && entityNodeCount[entity] == 0; } function approveBYONNode(address entity, uint128 nodeId) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin); bytes memory id = getNodeId(entity, nodeId); entityNodeIsActive[id] = true; entityNodeClaimedOnBlock[id] = block.number; activeEntities = activeEntities.add(1); } function suspendBYONNode(address entity, uint128 nodeId) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin); bytes memory id = getNodeId(entity, nodeId); entityNodeIsActive[id] = false; activeEntities = activeEntities.sub(1); } function setNodeIsActive(address entity, uint128 nodeId, bool isActive) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin); bytes memory id = getNodeId(entity, nodeId); if (isActive && !entityNodeIsActive[id]) { activeEntities = activeEntities.add(1); entityNodeClaimedOnBlock[id] = block.number; } if (!isActive && entityNodeIsActive[id]) { activeEntities = activeEntities.sub(1); } entityNodeIsActive[id] = isActive; } function setNodeIsNaaS(address entity, uint128 nodeId, bool isNaaS) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin); bytes memory id = getNodeId(entity, nodeId); entityNodeIsBYON[id] = !isNaaS; } function migrateLegacyNode(address entity) private { bytes memory id = getNodeId(entity, 1); entityNodeClaimedOnBlock[id] = entityBlockLastClaimedOn[entity]; entityNodePaidOnBlock[id] = paidOnBlock[entity]; entityNodeIsBYON[id] = !entityIsNaaS[entity]; if (entityNodeIsBYON[id]) { entityNodeIsActive[id] = true; } entityNodeCount[msg.sender] = 1; } function migrateNode(uint128 nodeId, address to) public { if (hasLegacyNode(msg.sender)) { migrateLegacyNode(msg.sender); } if (hasLegacyNode(to)) { migrateLegacyNode(to); } require(doesNodeExist(msg.sender, nodeId), "doesnt exist"); uint128 toNodeId = entityNodeCount[to] + 1; bytes memory fromId = getNodeId(msg.sender, nodeId); bytes memory toId = getNodeId(to, toNodeId); // move node to another address entityNodeIsActive[toId] = entityNodeIsActive[fromId]; entityNodeIsBYON[toId] = entityNodeIsBYON[fromId]; entityNodePaidOnBlock[toId] = entityNodePaidOnBlock[fromId]; entityNodeClaimedOnBlock[toId] = entityNodeClaimedOnBlock[fromId]; entityNodeCount[to] = entityNodeCount[to] + 1; // deactivate node entityNodeIsActive[fromId] = false; entityNodePaidOnBlock[fromId] = 0; entityNodeClaimedOnBlock[fromId] = 0; entityNodeCount[msg.sender] = entityNodeCount[msg.sender] - 1; emit Migrated(msg.sender, to, nodeId, toNodeId, entityNodeIsBYON[fromId]); } function claimAll(uint256 blockNumber, bool toStrongPool) public payable { for (uint16 i = 1; i <= entityNodeCount[msg.sender]; i++) { uint256 reward = getRewardByBlock(msg.sender, i, blockNumber); uint256 fee = reward.mul(claimingFeeNumerator).div(claimingFeeDenominator); this.claim{value : fee}(i, blockNumber, toStrongPool); } } function payAll() public payable { for (uint16 i = 1; i <= entityNodeCount[msg.sender]; i++) { bytes memory id = getNodeId(msg.sender, i); uint256 fee = entityNodeIsBYON[id] ? recurringFeeInWei : recurringNaaSFeeInWei; this.payFee{value : fee}(i); } } function addNFTBonusContract(address _contract) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin); strongNFTBonus = StrongNFTBonusInterface(_contract); } function payFeeAdmin(address entity, uint128[] memory nodes) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin); for (uint256 i = 0; i < nodes.length; i++) { uint128 nodeId = nodes[i]; bytes memory id = getNodeId(entity, nodeId); entityNodePaidOnBlock[id] = entityNodePaidOnBlock[id].add(recurringPaymentCycleInBlocks); emit Paid(entity, nodeId, entityNodeIsBYON[id], true, entityNodePaidOnBlock[id]); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; import "./IERC20.sol"; import "./SafeMath.sol"; import "./StrongPoolInterface.sol"; contract ServiceV9 { event Requested(address indexed miner); event Claimed(address indexed miner, uint256 reward); using SafeMath for uint256; bool public initDone; address public admin; address public pendingAdmin; address public superAdmin; address public pendingSuperAdmin; address public serviceAdmin; address public parameterAdmin; address payable public feeCollector; IERC20 public strongToken; StrongPoolInterface public strongPool; uint256 public rewardPerBlockNumerator; uint256 public rewardPerBlockDenominator; uint256 public naasRewardPerBlockNumerator; uint256 public naasRewardPerBlockDenominator; uint256 public claimingFeeNumerator; uint256 public claimingFeeDenominator; uint256 public requestingFeeInWei; uint256 public strongFeeInWei; uint256 public recurringFeeInWei; uint256 public recurringNaaSFeeInWei; uint256 public recurringPaymentCycleInBlocks; uint256 public rewardBalance; mapping(address => uint256) public entityBlockLastClaimedOn; address[] public entities; mapping(address => uint256) public entityIndex; mapping(address => bool) public entityActive; mapping(address => bool) public requestPending; mapping(address => bool) public entityIsNaaS; mapping(address => uint256) public paidOnBlock; uint256 public activeEntities; string public desciption; uint256 public claimingFeeInWei; uint256 public naasRequestingFeeInWei; uint256 public naasStrongFeeInWei; bool public removedTokens; mapping(address => uint256) public traunch; uint256 public currentTraunch; mapping(bytes => bool) public entityNodeIsActive; mapping(bytes => bool) public entityNodeIsBYON; mapping(bytes => uint256) public entityNodeTraunch; mapping(bytes => uint256) public entityNodePaidOnBlock; mapping(bytes => uint256) public entityNodeClaimedOnBlock; mapping(address => uint128) public entityNodeCount; event Paid(address indexed entity, uint128 nodeId, bool isBYON, bool isRenewal, uint256 upToBlockNumber); event Migrated(address indexed from, address indexed to, uint128 fromNodeId, uint128 toNodeId, bool isBYON); function init( address strongTokenAddress, address strongPoolAddress, address adminAddress, address superAdminAddress, uint256 rewardPerBlockNumeratorValue, uint256 rewardPerBlockDenominatorValue, uint256 naasRewardPerBlockNumeratorValue, uint256 naasRewardPerBlockDenominatorValue, uint256 requestingFeeInWeiValue, uint256 strongFeeInWeiValue, uint256 recurringFeeInWeiValue, uint256 recurringNaaSFeeInWeiValue, uint256 recurringPaymentCycleInBlocksValue, uint256 claimingFeeNumeratorValue, uint256 claimingFeeDenominatorValue, string memory desc ) public { require(!initDone, 'init done'); strongToken = IERC20(strongTokenAddress); strongPool = StrongPoolInterface(strongPoolAddress); admin = adminAddress; superAdmin = superAdminAddress; rewardPerBlockNumerator = rewardPerBlockNumeratorValue; rewardPerBlockDenominator = rewardPerBlockDenominatorValue; naasRewardPerBlockNumerator = naasRewardPerBlockNumeratorValue; naasRewardPerBlockDenominator = naasRewardPerBlockDenominatorValue; requestingFeeInWei = requestingFeeInWeiValue; strongFeeInWei = strongFeeInWeiValue; recurringFeeInWei = recurringFeeInWeiValue; recurringNaaSFeeInWei = recurringNaaSFeeInWeiValue; claimingFeeNumerator = claimingFeeNumeratorValue; claimingFeeDenominator = claimingFeeDenominatorValue; recurringPaymentCycleInBlocks = recurringPaymentCycleInBlocksValue; desciption = desc; initDone = true; } // ADMIN // ************************************************************************************* function updateServiceAdmin(address newServiceAdmin) public { require(msg.sender == superAdmin); serviceAdmin = newServiceAdmin; } function updateParameterAdmin(address newParameterAdmin) public { require(newParameterAdmin != address(0), 'zero'); require(msg.sender == superAdmin); parameterAdmin = newParameterAdmin; } function updateFeeCollector(address payable newFeeCollector) public { require(newFeeCollector != address(0), 'zero'); require(msg.sender == superAdmin); feeCollector = newFeeCollector; } function setPendingAdmin(address newPendingAdmin) public { require(msg.sender == admin, 'not admin'); pendingAdmin = newPendingAdmin; } function acceptAdmin() public { require(msg.sender == pendingAdmin && msg.sender != address(0), 'not pendingAdmin'); admin = pendingAdmin; pendingAdmin = address(0); } function setPendingSuperAdmin(address newPendingSuperAdmin) public { require(msg.sender == superAdmin, 'not superAdmin'); pendingSuperAdmin = newPendingSuperAdmin; } function acceptSuperAdmin() public { require(msg.sender == pendingSuperAdmin && msg.sender != address(0), 'not pendingSuperAdmin'); superAdmin = pendingSuperAdmin; pendingSuperAdmin = address(0); } // ENTITIES // ************************************************************************************* function getEntities() public view returns (address[] memory) { return entities; } function isEntityActive(address entity) public view returns (bool) { return entityActive[entity]; } // TRAUNCH // ************************************************************************************* function updateCurrentTraunch(uint256 value) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, 'not an admin'); currentTraunch = value; } function getTraunch(address entity) public view returns (uint256) { return traunch[entity]; } // REWARD // ************************************************************************************* function updateRewardPerBlock(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, 'not an admin'); require(denominator != 0, 'invalid value'); rewardPerBlockNumerator = numerator; rewardPerBlockDenominator = denominator; } function updateNaaSRewardPerBlock(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, 'not an admin'); require(denominator != 0, 'invalid value'); naasRewardPerBlockNumerator = numerator; naasRewardPerBlockDenominator = denominator; } function deposit(uint256 amount) public { require(msg.sender == superAdmin, 'not an admin'); require(amount > 0, 'zero'); strongToken.transferFrom(msg.sender, address(this), amount); rewardBalance = rewardBalance.add(amount); } function withdraw(address destination, uint256 amount) public { require(msg.sender == superAdmin, 'not an admin'); require(amount > 0, 'zero'); require(rewardBalance >= amount, 'not enough'); strongToken.transfer(destination, amount); rewardBalance = rewardBalance.sub(amount); } function removeTokens() public { require(!removedTokens, 'already removed'); require(msg.sender == superAdmin, 'not an admin'); // removing 2500 STRONG tokens sent in this tx: 0xe27640beda32a5e49aad3b6692790b9d380ed25da0cf8dca7fd5f3258efa600a strongToken.transfer(superAdmin, 2500000000000000000000); removedTokens = true; } // FEES // ************************************************************************************* function updateRequestingFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, 'not an admin'); requestingFeeInWei = feeInWei; } function updateStrongFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, 'not an admin'); strongFeeInWei = feeInWei; } function updateNaasRequestingFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, 'not an admin'); naasRequestingFeeInWei = feeInWei; } function updateNaasStrongFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, 'not an admin'); naasStrongFeeInWei = feeInWei; } function updateClaimingFee(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, 'not an admin'); require(denominator != 0, 'invalid value'); claimingFeeNumerator = numerator; claimingFeeDenominator = denominator; } function updateRecurringFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, 'not an admin'); recurringFeeInWei = feeInWei; } function updateRecurringNaaSFee(uint256 feeInWei) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, 'not an admin'); recurringNaaSFeeInWei = feeInWei; } function updateRecurringPaymentCycleInBlocks(uint256 blocks) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, 'not an admin'); require(blocks > 0, 'zero'); recurringPaymentCycleInBlocks = blocks; } // CORE // ************************************************************************************* function requestAccess(bool isNaaS) public payable { uint256 rFee; uint256 sFee; if (hasLegacyNode(msg.sender)) { migrateLegacyNode(msg.sender); } uint128 nodeId = entityNodeCount[msg.sender] + 1; bytes memory id = getNodeId(msg.sender, nodeId); if (isNaaS) { rFee = naasRequestingFeeInWei; sFee = naasStrongFeeInWei; activeEntities = activeEntities.add(1); } else { rFee = requestingFeeInWei; sFee = strongFeeInWei; entityNodeIsBYON[id] = true; } require(msg.value == rFee, 'invalid fee'); entityNodePaidOnBlock[id] = block.number; entityNodeTraunch[id] = currentTraunch; entityNodeClaimedOnBlock[id] = block.number; entityNodeCount[msg.sender] = entityNodeCount[msg.sender] + 1; feeCollector.transfer(msg.value); strongToken.transferFrom(msg.sender, address(this), sFee); strongToken.transfer(feeCollector, sFee); emit Paid(msg.sender, nodeId, entityNodeIsBYON[id], false, entityNodePaidOnBlock[id].add(recurringPaymentCycleInBlocks)); } function setEntityActiveStatus(address entity, bool status) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, 'not admin'); uint256 index = entityIndex[entity]; require(entities[index] == entity, 'invalid entity'); require(entityActive[entity] != status, 'already set'); entityActive[entity] = status; if (status) { activeEntities = activeEntities.add(1); entityBlockLastClaimedOn[entity] = block.number; } else { activeEntities = activeEntities.sub(1); entityBlockLastClaimedOn[entity] = 0; } } function setTraunch(address entity, uint256 value) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, 'not admin'); traunch[entity] = value; } function payFee(uint128 nodeId) public payable { address sender = msg.sender == address(this) ? tx.origin : msg.sender; bytes memory id = getNodeId(sender, nodeId); if (hasLegacyNode(sender)) { migrateLegacyNode(sender); } require(doesNodeExist(sender, nodeId), 'doesnt exist'); if (entityNodeIsBYON[id]) { require(msg.value == recurringFeeInWei, 'invalid fee'); } else { require(msg.value == recurringNaaSFeeInWei, 'invalid fee'); } feeCollector.transfer(msg.value); entityNodePaidOnBlock[id] = entityNodePaidOnBlock[id].add(recurringPaymentCycleInBlocks); emit Paid(sender, nodeId, entityNodeIsBYON[id], true, entityNodePaidOnBlock[id]); } function getReward(address entity, uint128 nodeId) public view returns (uint256) { return getRewardByBlock(entity, nodeId, block.number); } function getRewardByBlock(address entity, uint128 nodeId, uint256 blockNumber) public view returns (uint256) { bytes memory id = getNodeId(entity, nodeId); if (hasLegacyNode(entity)) { return getRewardByBlockLegacy(entity, blockNumber); } uint256 blockLastClaimedOn = entityNodeClaimedOnBlock[id] != 0 ? entityNodeClaimedOnBlock[id] : entityNodePaidOnBlock[id]; if (blockNumber > block.number) return 0; if (blockLastClaimedOn == 0) return 0; if (blockNumber < blockLastClaimedOn) return 0; if (activeEntities == 0) return 0; if (entityNodeIsBYON[id] && !entityNodeIsActive[id]) return 0; uint256 blockResult = blockNumber.sub(blockLastClaimedOn); uint256 rewardNumerator; uint256 rewardDenominator; if (entityNodeIsBYON[id]) { rewardNumerator = rewardPerBlockNumerator; rewardDenominator = rewardPerBlockDenominator; } else { rewardNumerator = naasRewardPerBlockNumerator; rewardDenominator = naasRewardPerBlockDenominator; } uint256 rewardPerBlockResult = blockResult.mul(rewardNumerator).div(rewardDenominator); return rewardPerBlockResult; } function getRewardByBlockLegacy(address entity, uint256 blockNumber) public view returns (uint256) { if (blockNumber > block.number) return 0; if (entityBlockLastClaimedOn[entity] == 0) return 0; if (blockNumber < entityBlockLastClaimedOn[entity]) return 0; if (activeEntities == 0) return 0; uint256 blockResult = blockNumber.sub(entityBlockLastClaimedOn[entity]); uint256 rewardNumerator; uint256 rewardDenominator; if (entityIsNaaS[entity]) { rewardNumerator = naasRewardPerBlockNumerator; rewardDenominator = naasRewardPerBlockDenominator; } else { rewardNumerator = rewardPerBlockNumerator; rewardDenominator = rewardPerBlockDenominator; } uint256 rewardPerBlockResult = blockResult.mul(rewardNumerator).div(rewardDenominator); return rewardPerBlockResult; } function claim(uint128 nodeId, uint256 blockNumber, bool toStrongPool) public payable { address sender = msg.sender == address(this) ? tx.origin : msg.sender; bytes memory id = getNodeId(sender, nodeId); if (hasLegacyNode(sender)) { migrateLegacyNode(sender); } uint256 blockLastClaimedOn = entityNodeClaimedOnBlock[id] != 0 ? entityNodeClaimedOnBlock[id] : entityNodePaidOnBlock[id]; uint256 blockLastPaidOn = entityNodePaidOnBlock[id]; require(blockLastClaimedOn != 0, 'never claimed'); require(blockNumber <= block.number, 'invalid block'); require(blockNumber > blockLastClaimedOn, 'too soon'); require(!entityNodeIsBYON[id] || entityNodeIsActive[id], 'not active'); if ( (!entityNodeIsBYON[id] && recurringNaaSFeeInWei != 0) || (entityNodeIsBYON[id] && recurringFeeInWei != 0) ) { require(blockNumber < blockLastPaidOn.add(recurringPaymentCycleInBlocks), 'pay fee'); } uint256 reward = getRewardByBlock(sender, nodeId, blockNumber); require(reward > 0, 'no reward'); uint256 fee = reward.mul(claimingFeeNumerator).div(claimingFeeDenominator); require(msg.value >= fee, 'invalid fee'); feeCollector.transfer(msg.value); if (toStrongPool) { strongToken.approve(address(strongPool), reward); strongPool.mineFor(sender, reward); } else { strongToken.transfer(sender, reward); } rewardBalance = rewardBalance.sub(reward); entityNodeClaimedOnBlock[id] = blockNumber; emit Claimed(sender, reward); } function getRewardAll(address entity, uint256 blockNumber) public view returns (uint256) { uint256 rewardsAll = 0; for (uint128 i = 1; i <= entityNodeCount[entity]; i++) { rewardsAll = rewardsAll.add(getRewardByBlock(entity, i, blockNumber > 0 ? blockNumber : block.number)); } return rewardsAll; } function doesNodeExist(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); return entityNodePaidOnBlock[id] > 0; } function getNodeId(address entity, uint128 nodeId) public view returns (bytes memory) { uint128 id = nodeId != 0 ? nodeId : entityNodeCount[entity] + 1; return abi.encodePacked(entity, id); } function getNodePaidOn(address entity, uint128 nodeId) public view returns (uint256) { bytes memory id = getNodeId(entity, nodeId); return entityNodePaidOnBlock[id]; } function getNodeFee(address entity, uint128 nodeId) public view returns (uint256) { bytes memory id = getNodeId(entity, nodeId); return entityNodeIsBYON[id] ? recurringFeeInWei : recurringNaaSFeeInWei; } function isNodeActive(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); return entityNodeIsActive[id] || !entityNodeIsBYON[id]; } function isNodeBYON(address entity, uint128 nodeId) public view returns (bool) { bytes memory id = getNodeId(entity, nodeId); return entityNodeIsBYON[id]; } function hasLegacyNode(address entity) public view returns (bool) { return entityActive[entity] && entityNodeCount[entity] == 0; } function approveBYONNode(address entity, uint128 nodeId) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, 'not admin'); bytes memory id = getNodeId(entity, nodeId); entityNodeIsActive[id] = true; entityNodeClaimedOnBlock[id] = block.number; activeEntities = activeEntities.add(1); } function suspendBYONNode(address entity, uint128 nodeId) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, 'not admin'); bytes memory id = getNodeId(entity, nodeId); entityNodeIsActive[id] = false; activeEntities = activeEntities.sub(1); } function setNodeIsActive(address entity, uint128 nodeId, bool isActive) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, 'not admin'); bytes memory id = getNodeId(entity, nodeId); if (isActive && !entityNodeIsActive[id]) { activeEntities = activeEntities.add(1); entityNodeClaimedOnBlock[id] = block.number; } if (!isActive && entityNodeIsActive[id]) { activeEntities = activeEntities.sub(1); } entityNodeIsActive[id] = isActive; } function setNodeIsNaaS(address entity, uint128 nodeId, bool isNaaS) public { require(msg.sender == admin || msg.sender == serviceAdmin || msg.sender == superAdmin, 'not admin'); bytes memory id = getNodeId(entity, nodeId); entityNodeIsBYON[id] = !isNaaS; } function migrateLegacyNode(address entity) private { bytes memory id = getNodeId(entity, 1); entityNodeClaimedOnBlock[id] = entityBlockLastClaimedOn[entity]; entityNodePaidOnBlock[id] = paidOnBlock[entity]; entityNodeTraunch[id] = traunch[entity]; entityNodeIsBYON[id] = !entityIsNaaS[entity]; if (entityNodeIsBYON[id]) { entityNodeIsActive[id] = true; } entityNodeCount[msg.sender] = 1; } function migrateNode(uint128 nodeId, address to) public { if (hasLegacyNode(msg.sender)) { migrateLegacyNode(msg.sender); } if (hasLegacyNode(to)) { migrateLegacyNode(to); } require(doesNodeExist(msg.sender, nodeId), 'doesnt exist'); uint128 toNodeId = entityNodeCount[to] + 1; bytes memory fromId = getNodeId(msg.sender, nodeId); bytes memory toId = getNodeId(to, toNodeId); // move node to another address entityNodeIsActive[toId] = entityNodeIsActive[fromId]; entityNodeIsBYON[toId] = entityNodeIsBYON[fromId]; entityNodePaidOnBlock[toId] = entityNodePaidOnBlock[fromId]; entityNodeClaimedOnBlock[toId] = entityNodeClaimedOnBlock[fromId]; entityNodeTraunch[toId] = entityNodeTraunch[fromId]; entityNodeCount[to] = entityNodeCount[to] + 1; // deactivate node entityNodeIsActive[fromId] = false; entityNodePaidOnBlock[fromId] = 0; entityNodeClaimedOnBlock[fromId] = 0; entityNodeCount[msg.sender] = entityNodeCount[msg.sender] - 1; emit Migrated(msg.sender, to, nodeId, toNodeId, entityNodeIsBYON[fromId]); } function claimAll(uint256 blockNumber, bool toStrongPool) public payable { for (uint16 i = 1; i <= entityNodeCount[msg.sender]; i++) { uint256 reward = getRewardByBlock(msg.sender, i, blockNumber); uint256 fee = reward.mul(claimingFeeNumerator).div(claimingFeeDenominator); this.claim{ value: fee }(i, blockNumber, toStrongPool); } } function payAll() public payable { for (uint16 i = 1; i <= entityNodeCount[msg.sender]; i++) { bytes memory id = getNodeId(msg.sender, i); uint256 fee = entityNodeIsBYON[id] ? recurringFeeInWei : recurringNaaSFeeInWei; this.payFee{ value: fee }(i); } } }
//SPDX-License-Identifier: Unlicense pragma solidity ^0.6.8; import "./ServiceInterface.sol"; import "./IERC1155Preset.sol"; import "./SafeMath.sol"; import "./Context.sol"; contract StrongNFTBonus is Context { using SafeMath for uint256; event Staked(address indexed sender, uint256 tokenId, uint128 nodeId, uint256 block); event Unstaked(address indexed sender, uint256 tokenId, uint128 nodeId, uint256 block); ServiceInterface public service; IERC1155Preset public nft; bool public initDone; address public serviceAdmin; address public superAdmin; string[] public nftBonusNames; mapping(string => uint256) public nftBonusLowerBound; mapping(string => uint256) public nftBonusUpperBound; mapping(string => uint256) public nftBonusValue; mapping(uint256 => uint256) public nftIdStakedForNodeId; mapping(address => mapping(uint128 => uint256)) public entityNodeStakedNftId; mapping(address => mapping(uint128 => uint256)) public entityNodeStakedNftBlock; function init(address serviceContract, address nftContract, address serviceAdminAddress, address superAdminAddress) public { require(initDone == false, "init done"); serviceAdmin = serviceAdminAddress; superAdmin = superAdminAddress; service = ServiceInterface(serviceContract); nft = IERC1155Preset(nftContract); initDone = true; } function isNftStaked(uint256 _tokenId) public view returns (bool) { return nftIdStakedForNodeId[_tokenId] != 0; } function getNftStakedForNodeId(uint256 _tokenId) public view returns (uint256) { return nftIdStakedForNodeId[_tokenId]; } function getStakedNftId(address _entity, uint128 _nodeId) public view returns (uint256) { return entityNodeStakedNftId[_entity][_nodeId]; } function getStakedNftBlock(address _entity, uint128 _nodeId) public view returns (uint256) { return entityNodeStakedNftBlock[_entity][_nodeId]; } function getBonus(address _entity, uint128 _nodeId, uint256 _fromBlock, uint256 _toBlock) public view returns (uint256) { uint256 nftId = entityNodeStakedNftId[_entity][_nodeId]; if (nftId == 0) return 0; if (nftId < nftBonusLowerBound["BRONZE"]) return 0; if (nftId > nftBonusUpperBound["BRONZE"]) return 0; if (nft.balanceOf(_entity, nftId) == 0) return 0; if (_fromBlock >= _toBlock) return 0; uint256 stakedAtBlock = entityNodeStakedNftBlock[_entity][_nodeId]; if (stakedAtBlock == 0) return 0; uint256 startFromBlock = stakedAtBlock > _fromBlock ? stakedAtBlock : _fromBlock; if (startFromBlock >= _toBlock) return 0; return _toBlock.sub(startFromBlock).mul(nftBonusValue["BRONZE"]); } function stakeNFT(uint256 _tokenId, uint128 _nodeId) public payable { require(nft.balanceOf(_msgSender(), _tokenId) != 0, "not enough"); require(_tokenId >= nftBonusLowerBound["BRONZE"] && _tokenId <= nftBonusUpperBound["BRONZE"], "not eligible"); require(nftIdStakedForNodeId[_tokenId] == 0, "already staked"); require(service.doesNodeExist(_msgSender(), _nodeId), "node doesnt exist"); nftIdStakedForNodeId[_tokenId] = _nodeId; entityNodeStakedNftId[_msgSender()][_nodeId] = _tokenId; entityNodeStakedNftBlock[_msgSender()][_nodeId] = block.number; emit Staked(msg.sender, _tokenId, _nodeId, block.number); } function unStakeNFT(uint256 _tokenId, uint128 _nodeId, uint256 _blockNumber) public payable { require(nft.balanceOf(_msgSender(), _tokenId) != 0, "not enough"); require(nftIdStakedForNodeId[_tokenId] == _nodeId, "not this node"); service.claim{value : msg.value}(_nodeId, _blockNumber, false); nftIdStakedForNodeId[_tokenId] = 0; entityNodeStakedNftId[_msgSender()][_nodeId] = 0; entityNodeStakedNftBlock[_msgSender()][_nodeId] = 0; emit Unstaked(msg.sender, _tokenId, _nodeId, _blockNumber); } function updateBonus(string memory _name, uint256 _lowerBound, uint256 _upperBound, uint256 _value) public { require(msg.sender == serviceAdmin || msg.sender == superAdmin, "not admin"); bool alreadyExit = false; for (uint i = 0; i < nftBonusNames.length; i++) { if (keccak256(abi.encode(nftBonusNames[i])) == keccak256(abi.encode(_name))) { alreadyExit = true; } } if (!alreadyExit) { nftBonusNames.push(_name); } nftBonusLowerBound[_name] = _lowerBound; nftBonusUpperBound[_name] = _upperBound; nftBonusValue[_name] = _value; } function updateContracts(address serviceContract, address nftContract) public { require(msg.sender == superAdmin, "not admin"); service = ServiceInterface(serviceContract); nft = IERC1155Preset(nftContract); } function updateServiceAdmin(address newServiceAdmin) public { require(msg.sender == superAdmin, "not admin"); serviceAdmin = newServiceAdmin; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; interface StrongNFTBonusInterface { function getBonus(address _entity, uint128 _nodeId, uint256 _fromBlock, uint256 _toBlock) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; interface StrongNFTClaimerInterface { function tokenNameAddressClaimed(string memory, address) external view returns(bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; interface StrongPoolInterface { function mineFor(address miner, uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; import "./IERC20.sol"; import "./SafeMath.sol"; import "./VoteInterface.sol"; import "./rewards.sol"; contract StrongPoolV4 { event MinedFor(address indexed miner, uint256 amount); event Mined(address indexed miner, uint256 amount); event MinedForVotesOnly(address indexed miner, uint256 amount); event UnminedForVotesOnly(address indexed miner, uint256 amount); event Unmined(address indexed miner, uint256 amount); event Claimed(address indexed miner, uint256 reward); using SafeMath for uint256; bool public initDone; address public admin; address public pendingAdmin; address public superAdmin; address public pendingSuperAdmin; address public parameterAdmin; address payable public feeCollector; IERC20 public strongToken; VoteInterface public vote; mapping(address => uint256) public minerBalance; uint256 public totalBalance; mapping(address => uint256) public minerBlockLastClaimedOn; mapping(address => uint256) public minerVotes; uint256 public rewardBalance; uint256 public rewardPerBlockNumerator; uint256 public rewardPerBlockDenominator; uint256 public miningFeeNumerator; uint256 public miningFeeDenominator; uint256 public unminingFeeNumerator; uint256 public unminingFeeDenominator; uint256 public claimingFeeNumerator; uint256 public claimingFeeDenominator; mapping(address => uint256) public inboundContractIndex; address[] public inboundContracts; mapping(address => bool) public inboundContractTrusted; uint256 public claimingFeeInWei; bool public removedTokens; uint256 public rewardPerBlockNumeratorNew; uint256 public rewardPerBlockDenominatorNew; uint256 public rewardPerBlockNewEffectiveBlock; function init( address voteAddress, address strongTokenAddress, address adminAddress, address superAdminAddress, uint256 rewardPerBlockNumeratorValue, uint256 rewardPerBlockDenominatorValue, uint256 miningFeeNumeratorValue, uint256 miningFeeDenominatorValue, uint256 unminingFeeNumeratorValue, uint256 unminingFeeDenominatorValue, uint256 claimingFeeNumeratorValue, uint256 claimingFeeDenominatorValue ) public { require(!initDone, "init done"); vote = VoteInterface(voteAddress); strongToken = IERC20(strongTokenAddress); admin = adminAddress; superAdmin = superAdminAddress; rewardPerBlockNumerator = rewardPerBlockNumeratorValue; rewardPerBlockDenominator = rewardPerBlockDenominatorValue; miningFeeNumerator = miningFeeNumeratorValue; miningFeeDenominator = miningFeeDenominatorValue; unminingFeeNumerator = unminingFeeNumeratorValue; unminingFeeDenominator = unminingFeeDenominatorValue; claimingFeeNumerator = claimingFeeNumeratorValue; claimingFeeDenominator = claimingFeeDenominatorValue; initDone = true; } // ADMIN // ************************************************************************************* function updateParameterAdmin(address newParameterAdmin) public { require(newParameterAdmin != address(0), "zero"); require(msg.sender == superAdmin); parameterAdmin = newParameterAdmin; } function updateFeeCollector(address payable newFeeCollector) public { require(newFeeCollector != address(0), "zero"); require(msg.sender == superAdmin); feeCollector = newFeeCollector; } function setPendingAdmin(address newPendingAdmin) public { require(newPendingAdmin != address(0), "zero"); require(msg.sender == admin, "not admin"); pendingAdmin = newPendingAdmin; } function acceptAdmin() public { require(msg.sender == pendingAdmin && msg.sender != address(0), "not pendingAdmin"); admin = pendingAdmin; pendingAdmin = address(0); } function setPendingSuperAdmin(address newPendingSuperAdmin) public { require(newPendingSuperAdmin != address(0), "zero"); require(msg.sender == superAdmin, "not superAdmin"); pendingSuperAdmin = newPendingSuperAdmin; } function acceptSuperAdmin() public { require(msg.sender == pendingSuperAdmin && msg.sender != address(0), "not pendingSuperAdmin"); superAdmin = pendingSuperAdmin; pendingSuperAdmin = address(0); } // INBOUND CONTRACTS // ************************************************************************************* function addInboundContract(address contr) public { require(contr != address(0), "zero"); require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); if (inboundContracts.length != 0) { uint256 index = inboundContractIndex[contr]; require(inboundContracts[index] != contr, "exists"); } uint256 len = inboundContracts.length; inboundContractIndex[contr] = len; inboundContractTrusted[contr] = true; inboundContracts.push(contr); } function inboundContractTrustStatus(address contr, bool trustStatus) public { require(contr != address(0), "zero"); require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); uint256 index = inboundContractIndex[contr]; require(inboundContracts[index] == contr, "not exists"); inboundContractTrusted[contr] = trustStatus; } // REWARD // ************************************************************************************* function updateRewardPerBlock(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); require(denominator != 0, "invalid value"); rewardPerBlockNumerator = numerator; rewardPerBlockDenominator = denominator; } function deposit(uint256 amount) public { require(msg.sender == superAdmin, "not an admin"); require(amount > 0, "zero"); strongToken.transferFrom(msg.sender, address(this), amount); rewardBalance = rewardBalance.add(amount); } function withdraw(address destination, uint256 amount) public { require(msg.sender == superAdmin, "not an admin"); require(amount > 0, "zero"); require(rewardBalance >= amount, "not enough"); strongToken.transfer(destination, amount); rewardBalance = rewardBalance.sub(amount); } // FEES // ************************************************************************************* function updateMiningFee(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); require(denominator != 0, "invalid value"); miningFeeNumerator = numerator; miningFeeDenominator = denominator; } function updateUnminingFee(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); require(denominator != 0, "invalid value"); unminingFeeNumerator = numerator; unminingFeeDenominator = denominator; } function updateClaimingFee(uint256 numerator, uint256 denominator) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not an admin"); require(denominator != 0, "invalid value"); claimingFeeNumerator = numerator; claimingFeeDenominator = denominator; } // CORE // ************************************************************************************* function mineForVotesOnly(uint256 amount) public { require(amount > 0, "zero"); strongToken.transferFrom(msg.sender, address(this), amount); minerVotes[msg.sender] = minerVotes[msg.sender].add(amount); vote.updateVotes(msg.sender, amount, true); emit MinedForVotesOnly(msg.sender, amount); } function unmineForVotesOnly(uint256 amount) public { require(amount > 0, "zero"); require(minerVotes[msg.sender] >= amount, "not enough"); minerVotes[msg.sender] = minerVotes[msg.sender].sub(amount); vote.updateVotes(msg.sender, amount, false); strongToken.transfer(msg.sender, amount); emit UnminedForVotesOnly(msg.sender, amount); } function mineFor(address miner, uint256 amount) public { require(inboundContractTrusted[msg.sender], "not trusted"); require(amount > 0, "zero"); strongToken.transferFrom(msg.sender, address(this), amount); minerBalance[miner] = minerBalance[miner].add(amount); totalBalance = totalBalance.add(amount); if (minerBlockLastClaimedOn[miner] == 0) { minerBlockLastClaimedOn[miner] = block.number; } vote.updateVotes(miner, amount, true); emit MinedFor(miner, amount); } function mine(uint256 amount) public payable { require(amount > 0, "zero"); uint256 fee = amount.mul(miningFeeNumerator).div(miningFeeDenominator); require(msg.value == fee, "invalid fee"); feeCollector.transfer(msg.value); strongToken.transferFrom(msg.sender, address(this), amount); if (block.number > minerBlockLastClaimedOn[msg.sender]) { uint256 reward = getReward(msg.sender); if (reward > 0) { minerBalance[msg.sender] = minerBalance[msg.sender].add(reward); totalBalance = totalBalance.add(reward); rewardBalance = rewardBalance.sub(reward); vote.updateVotes(msg.sender, reward, true); minerBlockLastClaimedOn[msg.sender] = block.number; } } minerBalance[msg.sender] = minerBalance[msg.sender].add(amount); totalBalance = totalBalance.add(amount); if (minerBlockLastClaimedOn[msg.sender] == 0) { minerBlockLastClaimedOn[msg.sender] = block.number; } vote.updateVotes(msg.sender, amount, true); emit Mined(msg.sender, amount); } function unmine(uint256 amount) public payable { require(amount > 0, "zero"); uint256 fee = amount.mul(unminingFeeNumerator).div(unminingFeeDenominator); require(msg.value == fee, "invalid fee"); require(minerBalance[msg.sender] >= amount, "not enough"); feeCollector.transfer(msg.value); bool unmineAll = (amount == minerBalance[msg.sender]); if (block.number > minerBlockLastClaimedOn[msg.sender]) { uint256 reward = getReward(msg.sender); if (reward > 0) { minerBalance[msg.sender] = minerBalance[msg.sender].add(reward); totalBalance = totalBalance.add(reward); rewardBalance = rewardBalance.sub(reward); vote.updateVotes(msg.sender, reward, true); minerBlockLastClaimedOn[msg.sender] = block.number; } } uint256 amountToUnmine = unmineAll ? minerBalance[msg.sender] : amount; minerBalance[msg.sender] = minerBalance[msg.sender].sub(amountToUnmine); totalBalance = totalBalance.sub(amountToUnmine); strongToken.transfer(msg.sender, amountToUnmine); vote.updateVotes(msg.sender, amountToUnmine, false); if (minerBalance[msg.sender] == 0) { minerBlockLastClaimedOn[msg.sender] = 0; } emit Unmined(msg.sender, amountToUnmine); } function claim(uint256 blockNumber) public payable { require(blockNumber <= block.number, "invalid block number"); require(minerBlockLastClaimedOn[msg.sender] != 0, "error"); require(blockNumber > minerBlockLastClaimedOn[msg.sender], "too soon"); uint256 reward = getRewardByBlock(msg.sender, blockNumber); require(reward > 0, "no reward"); uint256 fee = reward.mul(claimingFeeNumerator).div(claimingFeeDenominator); require(msg.value == fee, "invalid fee"); feeCollector.transfer(msg.value); minerBalance[msg.sender] = minerBalance[msg.sender].add(reward); totalBalance = totalBalance.add(reward); rewardBalance = rewardBalance.sub(reward); minerBlockLastClaimedOn[msg.sender] = blockNumber; vote.updateVotes(msg.sender, reward, true); emit Claimed(msg.sender, reward); } function getReward(address miner) public view returns (uint256) { return getRewardByBlock(miner, block.number); } function getRewardByBlock(address miner, uint256 blockNumber) public view returns (uint256) { uint256 blockLastClaimedOn = minerBlockLastClaimedOn[miner]; if (blockNumber > block.number) return 0; if (blockLastClaimedOn == 0) return 0; if (blockNumber < blockLastClaimedOn) return 0; if (totalBalance == 0) return 0; uint256[2] memory rewardBlocks = rewards.blocks(blockLastClaimedOn, rewardPerBlockNewEffectiveBlock, blockNumber); uint256 rewardOld = rewardPerBlockDenominator > 0 ? rewardBlocks[0].mul(rewardPerBlockNumerator).div(rewardPerBlockDenominator) : 0; uint256 rewardNew = rewardPerBlockDenominatorNew > 0 ? rewardBlocks[1].mul(rewardPerBlockNumeratorNew).div(rewardPerBlockDenominatorNew) : 0; return rewardOld.add(rewardNew).mul(minerBalance[miner]).div(totalBalance); } function updateRewardPerBlockNew( uint256 numerator, uint256 denominator, uint256 effectiveBlock ) public { require(msg.sender == admin || msg.sender == parameterAdmin || msg.sender == superAdmin, "not admin"); rewardPerBlockNumeratorNew = numerator; rewardPerBlockDenominatorNew = denominator; rewardPerBlockNewEffectiveBlock = effectiveBlock != 0 ? effectiveBlock : block.number; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.12; interface VoteInterface { function getPriorProposalVotes(address account, uint256 blockNumber) external view returns (uint96); function updateVotes( address voter, uint256 rawAmount, bool adding ) external; }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"claimer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"DelegateVotesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":true,"internalType":"address","name":"service","type":"address"},{"indexed":true,"internalType":"address","name":"entity","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RecalledVote","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"},{"indexed":true,"internalType":"address","name":"service","type":"address"},{"indexed":true,"internalType":"address","name":"entity","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Voted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"miner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"VotesAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"miner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"VotesSubtracted","type":"event"},{"inputs":[],"name":"acceptAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptSuperAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contr","type":"address"}],"name":"addServiceContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balances","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint32","name":"","type":"uint32"}],"name":"checkpointsFromBlock","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint32","name":"","type":"uint32"}],"name":"checkpointsVotes","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"service","type":"address"}],"name":"entityClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"entityRewardPerBlockDenominator","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entityRewardPerBlockDenominatorNew","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entityRewardPerBlockNumerator","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entityRewardPerBlockNumeratorNew","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAvailableServiceEntityVotes","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getCurrentProposalVotes","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"service","type":"address"},{"internalType":"address","name":"entity","type":"address"}],"name":"getEntityReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"getPriorProposalVotes","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getServiceContracts","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"voter","type":"address"}],"name":"getVoterReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"voter","type":"address"},{"internalType":"address","name":"service","type":"address"}],"name":"getVoterServiceEntities","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"voter","type":"address"}],"name":"getVoterServices","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"strongTokenAddress","type":"address"},{"internalType":"address","name":"strongPoolAddress","type":"address"},{"internalType":"address","name":"adminAddress","type":"address"},{"internalType":"address","name":"superAdminAddress","type":"address"},{"internalType":"uint256","name":"voterRewardPerBlockNumeratorValue","type":"uint256"},{"internalType":"uint256","name":"voterRewardPerBlockDenominatorValue","type":"uint256"},{"internalType":"uint256","name":"entityRewardPerBlockNumeratorValue","type":"uint256"},{"internalType":"uint256","name":"entityRewardPerBlockDenominatorValue","type":"uint256"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initDone","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numCheckpoints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"parameterAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingSuperAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"service","type":"address"},{"internalType":"address","name":"entity","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recallVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerBlockNewEffectiveBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"serviceContractActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"serviceContractIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"serviceContracts","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"serviceEntityBlockLastClaimedOn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"serviceEntityVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"serviceVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newPendingAdmin","type":"address"}],"name":"setPendingAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newPendingSuperAdmin","type":"address"}],"name":"setPendingSuperAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strongPool","outputs":[{"internalType":"contract StrongPoolInterface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"strongToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"superAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalVotesOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"updateEntityRewardPerBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newParameterAdmin","type":"address"}],"name":"updateParameterAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"numeratorVoter","type":"uint256"},{"internalType":"uint256","name":"denominatorVoter","type":"uint256"},{"internalType":"uint256","name":"numeratorEntity","type":"uint256"},{"internalType":"uint256","name":"denominatorEntity","type":"uint256"},{"internalType":"uint256","name":"effectiveBlock","type":"uint256"}],"name":"updateRewardPerBlockNew","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contr","type":"address"},{"internalType":"bool","name":"activeStatus","type":"bool"}],"name":"updateServiceContractActiveStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"updateVoterRewardPerBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"voter","type":"address"},{"internalType":"uint256","name":"rawAmount","type":"uint256"},{"internalType":"bool","name":"adding","type":"bool"}],"name":"updateVotes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"service","type":"address"},{"internalType":"address","name":"entity","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"voterBlockLastClaimedOn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voterClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"voterRewardPerBlockDenominator","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voterRewardPerBlockDenominatorNew","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voterRewardPerBlockNumerator","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voterRewardPerBlockNumeratorNew","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"voterServiceEntities","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"voterServiceEntityIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"voterServiceEntityVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"voterServiceIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"voterServices","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"voterVotesOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"destination","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061402b806100206000396000f3fe608060405234801561001057600080fd5b50600436106103c55760003560e01c8063896ed4eb116101ff578063d38f887e1161011a578063e7f9cefd116100ad578063f3fef3a31161007c578063f3fef3a314610bad578063f851a44014610bd9578063f8c34e9814610be1578063fed0a20e14610c19576103c5565b8063e7f9cefd14610b4a578063efa5d43114610b52578063f3737b8a14610b88578063f3d0ae0e14610b90576103c5565b8063e180ed0e116100e9578063e180ed0e14610ab4578063e195232e14610aee578063e229285014610af6578063e54e13c914610b24576103c5565b8063d38f887e14610a10578063d39ca7de14610a45578063d7b61ca514610a6b578063dc5a81c314610a8e576103c5565b80639fb9ec1111610192578063b6b55f2511610161578063b6b55f251461095f578063bffec1a21461097c578063c85c747b146109b2578063cd55e9da146109ea576103c5565b80639fb9ec11146108f5578063aa40f50014610929578063aa5c3ab41461094f578063ad61dfc114610957576103c5565b806391a27d55116101ce57806391a27d551461089c578063965d61b9146108a45780639da210ab146108ac5780639e31dd5f146108cf576103c5565b8063896ed4eb1461080e5780638d0deb301461083a5780639129273914610842578063916c435f14610870576103c5565b80634529c80f116102ef5780636bd7ef8d116102825780637999945311610251578063799994531461077f5780638187933a1461078757806381f0eefe146107e0578063857d49d514610806576103c5565b80636bd7ef8d146107055780636fcfff451461072b57806370daf187146107515780637760c6c714610759576103c5565b8063587cde1e116102be578063587cde1e146106835780635e3f8063146106a957806360119e99146106b1578063639c09c0146106df576103c5565b80634529c80f146105a957806348028d63146106275780634dd18bf51461062f57806352e6c6cd14610655576103c5565b806329575f6a11610367578063375b4cd411610336578063375b4cd4146105025780633a188acc1461054d5780633b92624f1461057b57806340b584b414610583576103c5565b806329575f6a146104965780632ee0b6861461049e578063317be1ff146104a6578063360358be146104cc576103c5565b80631a6465e0116103a35780631a6465e01461042a5780631d851bbd14610444578063267822471461044c57806327e235e314610470576103c5565b80630e18b681146103ca57806315ed0514146103d45780631957365814610422575b600080fd5b6103d2610c21565b005b610406600480360360408110156103ea57600080fd5b5080356001600160a01b0316906020013563ffffffff16610ca5565b604080516001600160601b039092168252519081900360200190f35b6103d2610ccb565b610432610efa565b60408051918252519081900360200190f35b610432610f00565b610454610f06565b604080516001600160a01b039092168252519081900360200190f35b6104066004803603602081101561048657600080fd5b50356001600160a01b0316610f15565b610454610f30565b610432610f3f565b610432600480360360208110156104bc57600080fd5b50356001600160a01b0316610f45565b6103d2600480360360608110156104e257600080fd5b506001600160a01b03813581169160208101359091169060400135610f57565b6105346004803603604081101561051857600080fd5b5080356001600160a01b0316906020013563ffffffff1661149c565b6040805163ffffffff9092168252519081900360200190f35b6103d26004803603604081101561056357600080fd5b506001600160a01b03813516906020013515156114bf565b610432611662565b6103d26004803603602081101561059957600080fd5b50356001600160a01b0316611668565b6105d7600480360360408110156105bf57600080fd5b506001600160a01b03813581169160200135166116e5565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156106135781810151838201526020016105fb565b505050509050019250505060405180910390f35b610454611769565b6103d26004803603602081101561064557600080fd5b50356001600160a01b0316611778565b6104326004803603604081101561066b57600080fd5b506001600160a01b0381358116916020013516611829565b6104546004803603602081101561069957600080fd5b50356001600160a01b0316611846565b610432611861565b610432600480360360408110156106c757600080fd5b506001600160a01b0381358116916020013516611867565b610432600480360360208110156106f557600080fd5b50356001600160a01b031661198d565b6103d26004803603602081101561071b57600080fd5b50356001600160a01b031661199f565b6105346004803603602081101561074157600080fd5b50356001600160a01b0316611cbb565b610432611cd3565b6103d26004803603602081101561076f57600080fd5b50356001600160a01b0316611cd9565b610432611e93565b6103d2600480360361010081101561079e57600080fd5b506001600160a01b0381358116916020810135821691604082013581169160608101359091169060808101359060a08101359060c08101359060e00135611e99565b610432600480360360208110156107f657600080fd5b50356001600160a01b0316611f53565b610454612038565b6104546004803603604081101561082457600080fd5b506001600160a01b038135169060200135612047565b61043261207c565b6104326004803603604081101561085857600080fd5b506001600160a01b0381358116916020013516612082565b6104066004803603604081101561088657600080fd5b506001600160a01b03813516906020013561209f565b6105d76122b6565b610454612318565b6103d2600480360360408110156108c257600080fd5b5080359060200135612327565b610432600480360360208110156108e557600080fd5b50356001600160a01b03166123ec565b6103d26004803603606081101561090b57600080fd5b506001600160a01b03813516906020810135906040013515156123fe565b6104066004803603602081101561093f57600080fd5b50356001600160a01b031661250d565b610432612518565b61043261251e565b6103d26004803603602081101561097557600080fd5b5035612524565b6104546004803603606081101561099257600080fd5b506001600160a01b03813581169160208101359091169060400135612649565b610432600480360360608110156109c857600080fd5b506001600160a01b03813581169160208101358216916040909101351661268b565b6105d760048036036020811015610a0057600080fd5b50356001600160a01b03166126ae565b6103d2600480360360a0811015610a2657600080fd5b5080359060208101359060408101359060608101359060800135612724565b6103d260048036036020811015610a5b57600080fd5b50356001600160a01b03166127c4565b6103d260048036036040811015610a8157600080fd5b508035906020013561287a565b61043260048036036020811015610aa457600080fd5b50356001600160a01b031661293f565b610ada60048036036020811015610aca57600080fd5b50356001600160a01b0316612951565b604080519115158252519081900360200190f35b610454612966565b61043260048036036040811015610b0c57600080fd5b506001600160a01b0381358116916020013516612975565b61040660048036036020811015610b3a57600080fd5b50356001600160a01b0316612992565b6103d261299d565b6103d260048036036060811015610b6857600080fd5b506001600160a01b03813581169160208101359091169060400135612a26565b610432613245565b61045460048036036020811015610ba657600080fd5b503561324b565b6103d260048036036040811015610bc357600080fd5b506001600160a01b038135169060200135613272565b6104546133d8565b61043260048036036060811015610bf757600080fd5b506001600160a01b0381358116916020810135821691604090910135166133e7565b610ada61340a565b6003546001600160a01b031633148015610c3a57503315155b610c7e576040805162461bcd60e51b815260206004820152601060248201526f3737ba103832b73234b733a0b236b4b760811b604482015290519081900360640190fd5b60038054600280546001600160a01b03199081166001600160a01b03841617909155169055565b600f6020908152600092835260408084209091529082529020546001600160601b031681565b336000908152601a6020526040902054610d14576040805162461bcd60e51b815260206004820152600560248201526432b93937b960d91b604482015290519081900360640190fd5b336000908152601a60205260409020544311610d62576040805162461bcd60e51b81526020600482015260086024820152673a37b79039b7b7b760c11b604482015290519081900360640190fd5b6000610d6d33611f53565b905060008111610db0576040805162461bcd60e51b81526020600482015260096024820152681b9bc81c995dd85c9960ba1b604482015290519081900360640190fd5b600754610dbd908261341a565b600755600154600080546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018690529051919093169263095ea7b39260448083019360209390929083900390910190829087803b158015610e1d57600080fd5b505af1158015610e31573d6000803e3d6000fd5b505050506040513d6020811015610e4757600080fd5b505060008054604080516330d6a97560e01b81523360048201526024810185905290516001600160a01b03909216926330d6a9759260448084019382900301818387803b158015610e9757600080fd5b505af1158015610eab573d6000803e3d6000fd5b5050336000818152601a6020908152604091829020439055815186815291519294507fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a9350908290030190a250565b60125481565b60235481565b6003546001600160a01b031681565b600c602052600090815260409020546001600160601b031681565b6004546001600160a01b031681565b60225481565b601d6020526000908152604090205481565b60008111610f95576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b3360009081526015602090815260408083206001600160a01b0387811685529083528184209086168452909152902054811115611006576040805162461bcd60e51b815260206004820152600a6024820152690dcdee840cadcdeeaced60b31b604482015290519081900360640190fd5b336000908152601a602052604090205443111561114457600061102833611f53565b905080156111425760075461103d908261341a565b600755600154600080546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018690529051919093169263095ea7b39260448083019360209390929083900390910190829087803b15801561109d57600080fd5b505af11580156110b1573d6000803e3d6000fd5b505050506040513d60208110156110c757600080fd5b505060008054604080516330d6a97560e01b81523360048201526024810185905290516001600160a01b03909216926330d6a9759260448084019382900301818387803b15801561111757600080fd5b505af115801561112b573d6000803e3d6000fd5b5050336000908152601a6020526040902043905550505b505b6001600160a01b038084166000908152601b60209081526040808320938616835292905220544311156112b357600061117d8484611867565b905080156112b157600754611192908261341a565b600755600154600080546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018690529051919093169263095ea7b39260448083019360209390929083900390910190829087803b1580156111f257600080fd5b505af1158015611206573d6000803e3d6000fd5b505050506040513d602081101561121c57600080fd5b505060008054604080516330d6a97560e01b81526001600160a01b03878116600483015260248201869052915191909216926330d6a975926044808201939182900301818387803b15801561127057600080fd5b505af1158015611284573d6000803e3d6000fd5b5050506001600160a01b038086166000908152601b60209081526040808320938816835292905220439055505b505b6001600160a01b0383166000908152601360205260409020546112d6908261341a565b6001600160a01b03808516600090815260136020908152604080832094909455601481528382209286168252919091522054611312908261341a565b6001600160a01b03808516600081815260146020908152604080832094881680845294825280832095909555338252601581528482209282529182528381209281529190522054611363908261341a565b3360008181526015602090815260408083206001600160a01b0389811685529083528184209088168452825280832094909455918152601190915220546113aa908261341a565b336000908152601160205260409020556012546113c7908261341a565b601255336000908152601160205260409020546113ef57336000908152601a60205260408120555b6001600160a01b03808416600090815260146020908152604080832093861683529290522054611442576001600160a01b038084166000908152601b602090815260408083209386168352929052908120555b816001600160a01b0316836001600160a01b0316336001600160a01b03167f3484575ad9bbb3c8329e8607ace1d4a353b6801fa9c14916d1f630c507fb8fac846040518082815260200191505060405180910390a4505050565b600e60209081526000928352604080842090915290825290205463ffffffff1681565b6001600160a01b038216611503576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b6002546001600160a01b031633148061152657506006546001600160a01b031633145b8061153b57506004546001600160a01b031633145b61157b576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b601c546115b8576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b6001600160a01b0382166000818152601d6020526040902054601c8054919291839081106115e257fe5b6000918252602090912001546001600160a01b031614611636576040805162461bcd60e51b815260206004820152600a6024820152696e6f742065786973747360b01b604482015290519081900360640190fd5b506001600160a01b03919091166000908152601e60205260409020805460ff1916911515919091179055565b60215481565b6001600160a01b0381166116ac576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b6004546001600160a01b031633146116c357600080fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03808316600090815260186020908152604080832093851683529281529082902080548351818402810184019094528084526060939283018282801561175b57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161173d575b505050505090505b92915050565b6005546001600160a01b031681565b6001600160a01b0381166117bc576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b6002546001600160a01b03163314611807576040805162461bcd60e51b81526020600482015260096024820152683737ba1030b236b4b760b91b604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b601b60209081526000928352604080842090915290825290205481565b600d602052600090815260409020546001600160a01b031681565b60205481565b6001600160a01b038083166000818152601b6020908152604080832094861683529381528382205492825260139052918220546118a8576000915050611763565b806118b7576000915050611763565b6118bf613fb6565b6118cc8260235443613463565b9050600080600a54116118e057600061190a565b61190a600b54611904600a54856000600281106118f957fe5b602002015190613514565b9061356d565b90506000806021541161191e576000611937565b611937602254611904602154866001600281106118f957fe5b6001600160a01b0380891660009081526013602090815260408083205460148352818420948c16845293909152902054919250611982916119049061197c86866135af565b90613514565b979650505050505050565b60116020526000908152604090205481565b6001600160a01b0381166000908152601b602090815260408083203384529091529020546119fc576040805162461bcd60e51b815260206004820152600560248201526432b93937b960d91b604482015290519081900360640190fd5b6001600160a01b0381166000908152601b602090815260408083203384529091529020544311611a5e576040805162461bcd60e51b81526020600482015260086024820152673a37b79039b7b7b760c11b604482015290519081900360640190fd5b604080516334dce6b360e01b815233600482015290516001600160a01b038316916334dce6b3916024808301926020929190829003018186803b158015611aa457600080fd5b505afa158015611ab8573d6000803e3d6000fd5b505050506040513d6020811015611ace57600080fd5b5051611b0e576040805162461bcd60e51b815260206004820152600a6024820152696e6f742061637469766560b01b604482015290519081900360640190fd5b6000611b1a8233611867565b905060008111611b5d576040805162461bcd60e51b81526020600482015260096024820152681b9bc81c995dd85c9960ba1b604482015290519081900360640190fd5b600754611b6a908261341a565b600755600154600080546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018690529051919093169263095ea7b39260448083019360209390929083900390910190829087803b158015611bca57600080fd5b505af1158015611bde573d6000803e3d6000fd5b505050506040513d6020811015611bf457600080fd5b505060008054604080516330d6a97560e01b81523360048201526024810185905290516001600160a01b03909216926330d6a9759260448084019382900301818387803b158015611c4457600080fd5b505af1158015611c58573d6000803e3d6000fd5b505050506001600160a01b0382166000908152601b602090815260408083203380855290835292819020439055805184815290517fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a929181900390910190a25050565b60106020526000908152604090205463ffffffff1681565b600b5481565b6001600160a01b038116611d1d576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b6002546001600160a01b0316331480611d4057506006546001600160a01b031633145b80611d5557506004546001600160a01b031633145b611d95576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b601c5415611e1a576001600160a01b0381166000818152601d6020526040902054601c805491929183908110611dc757fe5b6000918252602090912001546001600160a01b03161415611e18576040805162461bcd60e51b815260206004820152600660248201526565786973747360d01b604482015290519081900360640190fd5b505b601c80546001600160a01b039092166000818152601d6020908152604080832095909555601e9052928320805460ff1916600190811790915582549081018355919092527f0e4562a10381dec21b205ed72637e6b1b523bdd0e4d4d50af5cd23dd4500a2110180546001600160a01b0319169091179055565b601f5481565b600154600160a01b900460ff1615611ee4576040805162461bcd60e51b8152602060048201526009602482015268696e697420646f6e6560b81b604482015290519081900360640190fd5b60018054600080546001600160a01b039a8b166001600160a01b03199182161790915560028054998b169982169990991790985560048054978a1697891697909717909655600894909455600992909255600a55600b5560ff60a01b199390941691161716600160a01b179055565b6001600160a01b0381166000908152601a6020526040812054601254611f7d576000915050612033565b80611f8c576000915050612033565b611f94613fb6565b611fa18260235443613463565b905060008060085411611fb5576000611fce565b611fce600954611904600854856000600281106118f957fe5b9050600080601f5411611fe2576000611ffb565b611ffb602054611904601f54866001600281106118f957fe5b6012546001600160a01b03881660009081526011602052604090205491925061202c916119049061197c86866135af565b9450505050505b919050565b6006546001600160a01b031681565b6016602052816000526040600020818154811061206057fe5b6000918252602090912001546001600160a01b03169150829050565b60085481565b601760209081526000928352604080842090915290825290205481565b60004382106120ea576040805162461bcd60e51b81526020600482015260126024820152711b9bdd081e595d0819195d195c9b5a5b995960721b604482015290519081900360640190fd5b6001600160a01b03831660009081526010602052604090205463ffffffff1680612118576000915050611763565b6001600160a01b0384166000908152600e6020908152604080832063ffffffff60001986018116855292529091205416831061218d576001600160a01b0384166000908152600f602090815260408083206000199490940163ffffffff16835292905220546001600160601b03169050611763565b6001600160a01b0384166000908152600e6020908152604080832083805290915290205463ffffffff168310156121c8576000915050611763565b600060001982015b8163ffffffff168163ffffffff161115612279576001600160a01b0386166000818152600e60209081526040808320600263ffffffff888803811691909104870380821680875292855283862054968652600f855283862092865291909352922054919216906001600160601b031687821415612254579550611763945050505050565b878263ffffffff16101561226a57829450612271565b6001830393505b5050506121d0565b506001600160a01b0385166000908152600f6020908152604080832063ffffffff909416835292905220546001600160601b031691505092915050565b6060601c80548060200260200160405190810160405280929190818152602001828054801561230e57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116122f0575b5050505050905090565b6001546001600160a01b031681565b6002546001600160a01b031633148061234a57506006546001600160a01b031633145b8061235f57506004546001600160a01b031633145b61239f576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b806123e1576040805162461bcd60e51b815260206004820152600d60248201526c696e76616c69642076616c756560981b604482015290519081900360640190fd5b600a91909155600b55565b601a6020526000908152604090205481565b6000546001600160a01b0316331461244e576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd081cdd1c9bdb99d41bdbdb60921b604482015290519081900360640190fd5b60006124888360405180604001604052806016815260200175616d6f756e742065786365656473203936206269747360501b815250613609565b9050811561249f5761249a84826136a3565b612507565b806001600160601b03166124b2856137d9565b6001600160601b031610156124fd576040805162461bcd60e51b815260206004820152600c60248201526b726563616c6c20766f74657360a01b604482015290519081900360640190fd5b612507848261386a565b50505050565b60006117638261395e565b60075481565b600a5481565b6004546001600160a01b03163314612572576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b600081116125b0576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b600154604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561260a57600080fd5b505af115801561261e573d6000803e3d6000fd5b505050506040513d602081101561263457600080fd5b505060075461264390826135af565b60075550565b6018602052826000526040600020602052816000526040600020818154811061266e57fe5b6000918252602090912001546001600160a01b0316925083915050565b601560209081526000938452604080852082529284528284209052825290205481565b6001600160a01b03811660009081526016602090815260409182902080548351818402810184019094528084526060939283018282801561271857602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116126fa575b50505050509050919050565b6002546001600160a01b031633148061274757506006546001600160a01b031633145b8061275c57506004546001600160a01b031633145b612799576040805162461bcd60e51b81526020600482015260096024820152683737ba1030b236b4b760b91b604482015290519081900360640190fd5b601f859055602084905560218390556022829055806127b857436127ba565b805b6023555050505050565b6001600160a01b038116612808576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b6004546001600160a01b03163314612858576040805162461bcd60e51b815260206004820152600e60248201526d3737ba1039bab832b920b236b4b760911b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633148061289d57506006546001600160a01b031633145b806128b257506004546001600160a01b031633145b6128f2576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b80612934576040805162461bcd60e51b815260206004820152600d60248201526c696e76616c69642076616c756560981b604482015290519081900360640190fd5b600891909155600955565b60136020526000908152604090205481565b601e6020526000908152604090205460ff1681565b6000546001600160a01b031681565b601460209081526000928352604080842090915290825290205481565b6000611763826137d9565b6005546001600160a01b0316331480156129b657503315155b6129ff576040805162461bcd60e51b81526020600482015260156024820152743737ba103832b73234b733a9bab832b920b236b4b760591b604482015290519081900360640190fd5b60058054600480546001600160a01b03199081166001600160a01b03841617909155169055565b60008111612a64576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b80612a6e336137d9565b6001600160601b03161015612ab7576040805162461bcd60e51b815260206004820152600a6024820152690dcdee840cadcdeeaced60b31b604482015290519081900360640190fd5b6001600160a01b0383166000908152601e602052604090205460ff16612b19576040805162461bcd60e51b815260206004820152601260248201527173657276696365206e6f742061637469766560701b604482015290519081900360640190fd5b826001600160a01b03166334dce6b3836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612b6657600080fd5b505afa158015612b7a573d6000803e3d6000fd5b505050506040513d6020811015612b9057600080fd5b5051612bd7576040805162461bcd60e51b8152602060048201526011602482015270656e74697479206e6f742061637469766560781b604482015290519081900360640190fd5b3360008181526017602090815260408083206001600160a01b038816845282528083205493835260169091529020541580612c4c575033600090815260166020526040902080546001600160a01b038616919083908110612c3457fe5b6000918252602090912001546001600160a01b031614155b15612ca2573360009081526016602081815260408084208054601784528286206001600160a01b038b16808852908552928620819055938352600184018155845292200180546001600160a01b03191690911790555b3360008181526019602090815260408083206001600160a01b038981168086529184528285209089168552835281842054948452601883528184209084529091529020541580612d3957503360009081526018602090815260408083206001600160a01b038981168552925290912080549186169183908110612d2157fe5b6000918252602090912001546001600160a01b031614155b15612dab573360008181526018602090815260408083206001600160a01b038a8116808652828552838620805497875260198652848720918752908552838620918b16808752918552928520869055908352600185018255908352912090910180546001600160a01b03191690911790555b336000908152601a6020526040902054431115612ee9576000612dcd33611f53565b90508015612ee757600754612de2908261341a565b600755600154600080546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018690529051919093169263095ea7b39260448083019360209390929083900390910190829087803b158015612e4257600080fd5b505af1158015612e56573d6000803e3d6000fd5b505050506040513d6020811015612e6c57600080fd5b505060008054604080516330d6a97560e01b81523360048201526024810185905290516001600160a01b03909216926330d6a9759260448084019382900301818387803b158015612ebc57600080fd5b505af1158015612ed0573d6000803e3d6000fd5b5050336000908152601a6020526040902043905550505b505b6001600160a01b038086166000908152601b6020908152604080832093881683529290522054431115613058576000612f228686611867565b9050801561305657600754612f37908261341a565b600755600154600080546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018690529051919093169263095ea7b39260448083019360209390929083900390910190829087803b158015612f9757600080fd5b505af1158015612fab573d6000803e3d6000fd5b505050506040513d6020811015612fc157600080fd5b505060008054604080516330d6a97560e01b81526001600160a01b03898116600483015260248201869052915191909216926330d6a975926044808201939182900301818387803b15801561301557600080fd5b505af1158015613029573d6000803e3d6000fd5b5050506001600160a01b038088166000908152601b60209081526040808320938a16835292905220439055505b505b6001600160a01b03851660009081526013602052604090205461307b90846135af565b6001600160a01b038087166000908152601360209081526040808320949094556014815283822092881682529190915220546130b790846135af565b6001600160a01b038087166000818152601460209081526040808320948a168084529482528083209590955533825260158152848220928252918252838120928152919052205461310890846135af565b3360008181526015602090815260408083206001600160a01b038b81168552908352818420908a1684528252808320949094559181526011909152205461314f90846135af565b3360009081526011602052604090205560125461316c90846135af565b601255336000908152601a602052604090205461319657336000908152601a602052604090204390555b6001600160a01b038086166000908152601b60209081526040808320938816835292905220546131e9576001600160a01b038086166000908152601b602090815260408083209388168352929052204390555b836001600160a01b0316856001600160a01b0316336001600160a01b03167f882a614cdae7616c522e95228799e25cf449d413a056ffb6b0047c0c958ab9ff866040518082815260200191505060405180910390a45050505050565b60095481565b601c818154811061325857fe5b6000918252602090912001546001600160a01b0316905081565b6004546001600160a01b031633146132c0576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b600081116132fe576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b806007541015613342576040805162461bcd60e51b815260206004820152600a6024820152690dcdee840cadcdeeaced60b31b604482015290519081900360640190fd5b6001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561339857600080fd5b505af11580156133ac573d6000803e3d6000fd5b505050506040513d60208110156133c257600080fd5b50506007546133d1908261341a565b6007555050565b6002546001600160a01b031681565b601960209081526000938452604080852082529284528284209052825290205481565b600154600160a01b900460ff1681565b600061345c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506139c8565b9392505050565b61346b613fb6565b81841061348c5750604080518082019091526000808252602082015261345c565b8282111580613499575082155b156134c45760408051808201909152806134b3848761341a565b81526020016000815250905061345c565b8284106134f0576040805180820190915260008152602081016134e7848761341a565b9052905061345c565b6040805180820190915280613505858761341a565b81526020016134e7848661341a565b60008261352357506000611763565b8282028284828161353057fe5b041461345c5760405162461bcd60e51b8152600401808060200182810382526021815260200180613fd56021913960400191505060405180910390fd5b600061345c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613a22565b60008282018381101561345c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600081600160601b841061369b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613660578181015183820152602001613648565b50505050905090810190601f16801561368d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b509192915050565b6001600160a01b0382166136ed576040805162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b604482015290519081900360640190fd5b6001600160a01b0382166000908152600c60209081526040918290205482518084019093526015835274766f746520616d6f756e74206f766572666c6f777360581b9183019190915261374d916001600160601b03909116908390613a87565b6001600160a01b0383166000908152600c6020526040902080546001600160601b0319166001600160601b039290921691909117905561378d8282613af1565b604080516001600160601b038316815290516001600160a01b038416917fc201fdbe5711fb7afc983d6f16a8b0a62905e9369fa826ece9cf7335cbc00c24919081900360200190a25050565b6000806137e58361395e565b90506001600160601b038116156138615761385a60116000856001600160a01b03166001600160a01b03168152602001908152602001600020546040518060400160405280601d81526020017f766f746572566f7465734f757420657863656564732039362062697473000000815250613609565b810361345c565b60009392505050565b6001600160a01b0382166000908152600c6020908152604091829020548251808401909352601b83527f766f746520616d6f756e7420657863656564732062616c616e63650000000000918301919091526138d2916001600160601b03909116908390613b68565b6001600160a01b0383166000908152600c6020526040902080546001600160601b0319166001600160601b03929092169190911790556139128282613bcd565b604080516001600160601b038316815290516001600160a01b038416917f7e7055a3906068db3ff8f43cf91f9b2c03b1782818489b1b059fbe7c8c339273919081900360200190a25050565b6001600160a01b03811660009081526010602052604081205463ffffffff168061398957600061345c565b6001600160a01b0383166000908152600f6020908152604080832063ffffffff60001986011684529091529020546001600160601b0316915050919050565b60008184841115613a1a5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613660578181015183820152602001613648565b505050900390565b60008183613a715760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613660578181015183820152602001613648565b506000838581613a7d57fe5b0495945050505050565b6000838301826001600160601b038087169083161015613ae85760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613660578181015183820152602001613648565b50949350505050565b6001600160a01b038281166000908152600d602052604090205416613b3a576001600160a01b0382166000818152600d6020526040902080546001600160a01b03191690911790555b6001600160a01b038083166000908152600d602052604081205490911690613b63908284613bf3565b505050565b6000836001600160601b0316836001600160601b031611158290613a1a5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613660578181015183820152602001613648565b6001600160a01b038083166000908152600d602052604081205490911690613b63908290845b816001600160a01b0316836001600160a01b031614158015613c1e57506000816001600160601b0316115b15613b63576001600160a01b03831615613ce5576001600160a01b03831660009081526010602052604081205463ffffffff169081613c5e576000613c96565b6001600160a01b0385166000908152600f6020908152604080832063ffffffff60001987011684529091529020546001600160601b03165b90506000613cd3828560405180604001604052806016815260200175766f746520616d6f756e7420756e646572666c6f777360501b815250613b68565b9050613ce186848484613daa565b5050505b6001600160a01b03821615613b63576001600160a01b03821660009081526010602052604081205463ffffffff169081613d20576000613d58565b6001600160a01b0384166000908152600f6020908152604080832063ffffffff60001987011684529091529020546001600160601b03165b90506000613d94828560405180604001604052806015815260200174766f746520616d6f756e74206f766572666c6f777360581b815250613a87565b9050613da285848484613daa565b505050505050565b6000613deb436040518060400160405280601c81526020017f626c6f636b206e756d6265722065786365656473203332206269747300000000815250613f60565b905060008463ffffffff16118015613e3457506001600160a01b0385166000908152600e6020908152604080832063ffffffff6000198901811685529252909120548282169116145b15613e84576001600160a01b0385166000908152600f60209081526040808320600019880163ffffffff168452909152902080546001600160601b0319166001600160601b038416179055613f0c565b6001600160a01b0385166000818152600e6020908152604080832063ffffffff898116808652918452828520805463ffffffff1990811689841617909155868652600f855283862092865291845282852080546001600160601b0319166001600160601b038a1617905594845260109092529091208054909116600187019092169190911790555b604080516001600160601b0380861682528416602082015281516001600160a01b038816927fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724928290030190a25050505050565b600081640100000000841061369b5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613660578181015183820152602001613648565b6040518060400160405280600290602082028036833750919291505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212201cc059d2ef53f5fb8f539eb1d6c722d3502b59f1e57bb5d830689cfc60f1a6f964736f6c634300060c0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103c55760003560e01c8063896ed4eb116101ff578063d38f887e1161011a578063e7f9cefd116100ad578063f3fef3a31161007c578063f3fef3a314610bad578063f851a44014610bd9578063f8c34e9814610be1578063fed0a20e14610c19576103c5565b8063e7f9cefd14610b4a578063efa5d43114610b52578063f3737b8a14610b88578063f3d0ae0e14610b90576103c5565b8063e180ed0e116100e9578063e180ed0e14610ab4578063e195232e14610aee578063e229285014610af6578063e54e13c914610b24576103c5565b8063d38f887e14610a10578063d39ca7de14610a45578063d7b61ca514610a6b578063dc5a81c314610a8e576103c5565b80639fb9ec1111610192578063b6b55f2511610161578063b6b55f251461095f578063bffec1a21461097c578063c85c747b146109b2578063cd55e9da146109ea576103c5565b80639fb9ec11146108f5578063aa40f50014610929578063aa5c3ab41461094f578063ad61dfc114610957576103c5565b806391a27d55116101ce57806391a27d551461089c578063965d61b9146108a45780639da210ab146108ac5780639e31dd5f146108cf576103c5565b8063896ed4eb1461080e5780638d0deb301461083a5780639129273914610842578063916c435f14610870576103c5565b80634529c80f116102ef5780636bd7ef8d116102825780637999945311610251578063799994531461077f5780638187933a1461078757806381f0eefe146107e0578063857d49d514610806576103c5565b80636bd7ef8d146107055780636fcfff451461072b57806370daf187146107515780637760c6c714610759576103c5565b8063587cde1e116102be578063587cde1e146106835780635e3f8063146106a957806360119e99146106b1578063639c09c0146106df576103c5565b80634529c80f146105a957806348028d63146106275780634dd18bf51461062f57806352e6c6cd14610655576103c5565b806329575f6a11610367578063375b4cd411610336578063375b4cd4146105025780633a188acc1461054d5780633b92624f1461057b57806340b584b414610583576103c5565b806329575f6a146104965780632ee0b6861461049e578063317be1ff146104a6578063360358be146104cc576103c5565b80631a6465e0116103a35780631a6465e01461042a5780631d851bbd14610444578063267822471461044c57806327e235e314610470576103c5565b80630e18b681146103ca57806315ed0514146103d45780631957365814610422575b600080fd5b6103d2610c21565b005b610406600480360360408110156103ea57600080fd5b5080356001600160a01b0316906020013563ffffffff16610ca5565b604080516001600160601b039092168252519081900360200190f35b6103d2610ccb565b610432610efa565b60408051918252519081900360200190f35b610432610f00565b610454610f06565b604080516001600160a01b039092168252519081900360200190f35b6104066004803603602081101561048657600080fd5b50356001600160a01b0316610f15565b610454610f30565b610432610f3f565b610432600480360360208110156104bc57600080fd5b50356001600160a01b0316610f45565b6103d2600480360360608110156104e257600080fd5b506001600160a01b03813581169160208101359091169060400135610f57565b6105346004803603604081101561051857600080fd5b5080356001600160a01b0316906020013563ffffffff1661149c565b6040805163ffffffff9092168252519081900360200190f35b6103d26004803603604081101561056357600080fd5b506001600160a01b03813516906020013515156114bf565b610432611662565b6103d26004803603602081101561059957600080fd5b50356001600160a01b0316611668565b6105d7600480360360408110156105bf57600080fd5b506001600160a01b03813581169160200135166116e5565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156106135781810151838201526020016105fb565b505050509050019250505060405180910390f35b610454611769565b6103d26004803603602081101561064557600080fd5b50356001600160a01b0316611778565b6104326004803603604081101561066b57600080fd5b506001600160a01b0381358116916020013516611829565b6104546004803603602081101561069957600080fd5b50356001600160a01b0316611846565b610432611861565b610432600480360360408110156106c757600080fd5b506001600160a01b0381358116916020013516611867565b610432600480360360208110156106f557600080fd5b50356001600160a01b031661198d565b6103d26004803603602081101561071b57600080fd5b50356001600160a01b031661199f565b6105346004803603602081101561074157600080fd5b50356001600160a01b0316611cbb565b610432611cd3565b6103d26004803603602081101561076f57600080fd5b50356001600160a01b0316611cd9565b610432611e93565b6103d2600480360361010081101561079e57600080fd5b506001600160a01b0381358116916020810135821691604082013581169160608101359091169060808101359060a08101359060c08101359060e00135611e99565b610432600480360360208110156107f657600080fd5b50356001600160a01b0316611f53565b610454612038565b6104546004803603604081101561082457600080fd5b506001600160a01b038135169060200135612047565b61043261207c565b6104326004803603604081101561085857600080fd5b506001600160a01b0381358116916020013516612082565b6104066004803603604081101561088657600080fd5b506001600160a01b03813516906020013561209f565b6105d76122b6565b610454612318565b6103d2600480360360408110156108c257600080fd5b5080359060200135612327565b610432600480360360208110156108e557600080fd5b50356001600160a01b03166123ec565b6103d26004803603606081101561090b57600080fd5b506001600160a01b03813516906020810135906040013515156123fe565b6104066004803603602081101561093f57600080fd5b50356001600160a01b031661250d565b610432612518565b61043261251e565b6103d26004803603602081101561097557600080fd5b5035612524565b6104546004803603606081101561099257600080fd5b506001600160a01b03813581169160208101359091169060400135612649565b610432600480360360608110156109c857600080fd5b506001600160a01b03813581169160208101358216916040909101351661268b565b6105d760048036036020811015610a0057600080fd5b50356001600160a01b03166126ae565b6103d2600480360360a0811015610a2657600080fd5b5080359060208101359060408101359060608101359060800135612724565b6103d260048036036020811015610a5b57600080fd5b50356001600160a01b03166127c4565b6103d260048036036040811015610a8157600080fd5b508035906020013561287a565b61043260048036036020811015610aa457600080fd5b50356001600160a01b031661293f565b610ada60048036036020811015610aca57600080fd5b50356001600160a01b0316612951565b604080519115158252519081900360200190f35b610454612966565b61043260048036036040811015610b0c57600080fd5b506001600160a01b0381358116916020013516612975565b61040660048036036020811015610b3a57600080fd5b50356001600160a01b0316612992565b6103d261299d565b6103d260048036036060811015610b6857600080fd5b506001600160a01b03813581169160208101359091169060400135612a26565b610432613245565b61045460048036036020811015610ba657600080fd5b503561324b565b6103d260048036036040811015610bc357600080fd5b506001600160a01b038135169060200135613272565b6104546133d8565b61043260048036036060811015610bf757600080fd5b506001600160a01b0381358116916020810135821691604090910135166133e7565b610ada61340a565b6003546001600160a01b031633148015610c3a57503315155b610c7e576040805162461bcd60e51b815260206004820152601060248201526f3737ba103832b73234b733a0b236b4b760811b604482015290519081900360640190fd5b60038054600280546001600160a01b03199081166001600160a01b03841617909155169055565b600f6020908152600092835260408084209091529082529020546001600160601b031681565b336000908152601a6020526040902054610d14576040805162461bcd60e51b815260206004820152600560248201526432b93937b960d91b604482015290519081900360640190fd5b336000908152601a60205260409020544311610d62576040805162461bcd60e51b81526020600482015260086024820152673a37b79039b7b7b760c11b604482015290519081900360640190fd5b6000610d6d33611f53565b905060008111610db0576040805162461bcd60e51b81526020600482015260096024820152681b9bc81c995dd85c9960ba1b604482015290519081900360640190fd5b600754610dbd908261341a565b600755600154600080546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018690529051919093169263095ea7b39260448083019360209390929083900390910190829087803b158015610e1d57600080fd5b505af1158015610e31573d6000803e3d6000fd5b505050506040513d6020811015610e4757600080fd5b505060008054604080516330d6a97560e01b81523360048201526024810185905290516001600160a01b03909216926330d6a9759260448084019382900301818387803b158015610e9757600080fd5b505af1158015610eab573d6000803e3d6000fd5b5050336000818152601a6020908152604091829020439055815186815291519294507fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a9350908290030190a250565b60125481565b60235481565b6003546001600160a01b031681565b600c602052600090815260409020546001600160601b031681565b6004546001600160a01b031681565b60225481565b601d6020526000908152604090205481565b60008111610f95576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b3360009081526015602090815260408083206001600160a01b0387811685529083528184209086168452909152902054811115611006576040805162461bcd60e51b815260206004820152600a6024820152690dcdee840cadcdeeaced60b31b604482015290519081900360640190fd5b336000908152601a602052604090205443111561114457600061102833611f53565b905080156111425760075461103d908261341a565b600755600154600080546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018690529051919093169263095ea7b39260448083019360209390929083900390910190829087803b15801561109d57600080fd5b505af11580156110b1573d6000803e3d6000fd5b505050506040513d60208110156110c757600080fd5b505060008054604080516330d6a97560e01b81523360048201526024810185905290516001600160a01b03909216926330d6a9759260448084019382900301818387803b15801561111757600080fd5b505af115801561112b573d6000803e3d6000fd5b5050336000908152601a6020526040902043905550505b505b6001600160a01b038084166000908152601b60209081526040808320938616835292905220544311156112b357600061117d8484611867565b905080156112b157600754611192908261341a565b600755600154600080546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018690529051919093169263095ea7b39260448083019360209390929083900390910190829087803b1580156111f257600080fd5b505af1158015611206573d6000803e3d6000fd5b505050506040513d602081101561121c57600080fd5b505060008054604080516330d6a97560e01b81526001600160a01b03878116600483015260248201869052915191909216926330d6a975926044808201939182900301818387803b15801561127057600080fd5b505af1158015611284573d6000803e3d6000fd5b5050506001600160a01b038086166000908152601b60209081526040808320938816835292905220439055505b505b6001600160a01b0383166000908152601360205260409020546112d6908261341a565b6001600160a01b03808516600090815260136020908152604080832094909455601481528382209286168252919091522054611312908261341a565b6001600160a01b03808516600081815260146020908152604080832094881680845294825280832095909555338252601581528482209282529182528381209281529190522054611363908261341a565b3360008181526015602090815260408083206001600160a01b0389811685529083528184209088168452825280832094909455918152601190915220546113aa908261341a565b336000908152601160205260409020556012546113c7908261341a565b601255336000908152601160205260409020546113ef57336000908152601a60205260408120555b6001600160a01b03808416600090815260146020908152604080832093861683529290522054611442576001600160a01b038084166000908152601b602090815260408083209386168352929052908120555b816001600160a01b0316836001600160a01b0316336001600160a01b03167f3484575ad9bbb3c8329e8607ace1d4a353b6801fa9c14916d1f630c507fb8fac846040518082815260200191505060405180910390a4505050565b600e60209081526000928352604080842090915290825290205463ffffffff1681565b6001600160a01b038216611503576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b6002546001600160a01b031633148061152657506006546001600160a01b031633145b8061153b57506004546001600160a01b031633145b61157b576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b601c546115b8576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b6001600160a01b0382166000818152601d6020526040902054601c8054919291839081106115e257fe5b6000918252602090912001546001600160a01b031614611636576040805162461bcd60e51b815260206004820152600a6024820152696e6f742065786973747360b01b604482015290519081900360640190fd5b506001600160a01b03919091166000908152601e60205260409020805460ff1916911515919091179055565b60215481565b6001600160a01b0381166116ac576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b6004546001600160a01b031633146116c357600080fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03808316600090815260186020908152604080832093851683529281529082902080548351818402810184019094528084526060939283018282801561175b57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161173d575b505050505090505b92915050565b6005546001600160a01b031681565b6001600160a01b0381166117bc576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b6002546001600160a01b03163314611807576040805162461bcd60e51b81526020600482015260096024820152683737ba1030b236b4b760b91b604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b601b60209081526000928352604080842090915290825290205481565b600d602052600090815260409020546001600160a01b031681565b60205481565b6001600160a01b038083166000818152601b6020908152604080832094861683529381528382205492825260139052918220546118a8576000915050611763565b806118b7576000915050611763565b6118bf613fb6565b6118cc8260235443613463565b9050600080600a54116118e057600061190a565b61190a600b54611904600a54856000600281106118f957fe5b602002015190613514565b9061356d565b90506000806021541161191e576000611937565b611937602254611904602154866001600281106118f957fe5b6001600160a01b0380891660009081526013602090815260408083205460148352818420948c16845293909152902054919250611982916119049061197c86866135af565b90613514565b979650505050505050565b60116020526000908152604090205481565b6001600160a01b0381166000908152601b602090815260408083203384529091529020546119fc576040805162461bcd60e51b815260206004820152600560248201526432b93937b960d91b604482015290519081900360640190fd5b6001600160a01b0381166000908152601b602090815260408083203384529091529020544311611a5e576040805162461bcd60e51b81526020600482015260086024820152673a37b79039b7b7b760c11b604482015290519081900360640190fd5b604080516334dce6b360e01b815233600482015290516001600160a01b038316916334dce6b3916024808301926020929190829003018186803b158015611aa457600080fd5b505afa158015611ab8573d6000803e3d6000fd5b505050506040513d6020811015611ace57600080fd5b5051611b0e576040805162461bcd60e51b815260206004820152600a6024820152696e6f742061637469766560b01b604482015290519081900360640190fd5b6000611b1a8233611867565b905060008111611b5d576040805162461bcd60e51b81526020600482015260096024820152681b9bc81c995dd85c9960ba1b604482015290519081900360640190fd5b600754611b6a908261341a565b600755600154600080546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018690529051919093169263095ea7b39260448083019360209390929083900390910190829087803b158015611bca57600080fd5b505af1158015611bde573d6000803e3d6000fd5b505050506040513d6020811015611bf457600080fd5b505060008054604080516330d6a97560e01b81523360048201526024810185905290516001600160a01b03909216926330d6a9759260448084019382900301818387803b158015611c4457600080fd5b505af1158015611c58573d6000803e3d6000fd5b505050506001600160a01b0382166000908152601b602090815260408083203380855290835292819020439055805184815290517fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a929181900390910190a25050565b60106020526000908152604090205463ffffffff1681565b600b5481565b6001600160a01b038116611d1d576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b6002546001600160a01b0316331480611d4057506006546001600160a01b031633145b80611d5557506004546001600160a01b031633145b611d95576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b601c5415611e1a576001600160a01b0381166000818152601d6020526040902054601c805491929183908110611dc757fe5b6000918252602090912001546001600160a01b03161415611e18576040805162461bcd60e51b815260206004820152600660248201526565786973747360d01b604482015290519081900360640190fd5b505b601c80546001600160a01b039092166000818152601d6020908152604080832095909555601e9052928320805460ff1916600190811790915582549081018355919092527f0e4562a10381dec21b205ed72637e6b1b523bdd0e4d4d50af5cd23dd4500a2110180546001600160a01b0319169091179055565b601f5481565b600154600160a01b900460ff1615611ee4576040805162461bcd60e51b8152602060048201526009602482015268696e697420646f6e6560b81b604482015290519081900360640190fd5b60018054600080546001600160a01b039a8b166001600160a01b03199182161790915560028054998b169982169990991790985560048054978a1697891697909717909655600894909455600992909255600a55600b5560ff60a01b199390941691161716600160a01b179055565b6001600160a01b0381166000908152601a6020526040812054601254611f7d576000915050612033565b80611f8c576000915050612033565b611f94613fb6565b611fa18260235443613463565b905060008060085411611fb5576000611fce565b611fce600954611904600854856000600281106118f957fe5b9050600080601f5411611fe2576000611ffb565b611ffb602054611904601f54866001600281106118f957fe5b6012546001600160a01b03881660009081526011602052604090205491925061202c916119049061197c86866135af565b9450505050505b919050565b6006546001600160a01b031681565b6016602052816000526040600020818154811061206057fe5b6000918252602090912001546001600160a01b03169150829050565b60085481565b601760209081526000928352604080842090915290825290205481565b60004382106120ea576040805162461bcd60e51b81526020600482015260126024820152711b9bdd081e595d0819195d195c9b5a5b995960721b604482015290519081900360640190fd5b6001600160a01b03831660009081526010602052604090205463ffffffff1680612118576000915050611763565b6001600160a01b0384166000908152600e6020908152604080832063ffffffff60001986018116855292529091205416831061218d576001600160a01b0384166000908152600f602090815260408083206000199490940163ffffffff16835292905220546001600160601b03169050611763565b6001600160a01b0384166000908152600e6020908152604080832083805290915290205463ffffffff168310156121c8576000915050611763565b600060001982015b8163ffffffff168163ffffffff161115612279576001600160a01b0386166000818152600e60209081526040808320600263ffffffff888803811691909104870380821680875292855283862054968652600f855283862092865291909352922054919216906001600160601b031687821415612254579550611763945050505050565b878263ffffffff16101561226a57829450612271565b6001830393505b5050506121d0565b506001600160a01b0385166000908152600f6020908152604080832063ffffffff909416835292905220546001600160601b031691505092915050565b6060601c80548060200260200160405190810160405280929190818152602001828054801561230e57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116122f0575b5050505050905090565b6001546001600160a01b031681565b6002546001600160a01b031633148061234a57506006546001600160a01b031633145b8061235f57506004546001600160a01b031633145b61239f576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b806123e1576040805162461bcd60e51b815260206004820152600d60248201526c696e76616c69642076616c756560981b604482015290519081900360640190fd5b600a91909155600b55565b601a6020526000908152604090205481565b6000546001600160a01b0316331461244e576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd081cdd1c9bdb99d41bdbdb60921b604482015290519081900360640190fd5b60006124888360405180604001604052806016815260200175616d6f756e742065786365656473203936206269747360501b815250613609565b9050811561249f5761249a84826136a3565b612507565b806001600160601b03166124b2856137d9565b6001600160601b031610156124fd576040805162461bcd60e51b815260206004820152600c60248201526b726563616c6c20766f74657360a01b604482015290519081900360640190fd5b612507848261386a565b50505050565b60006117638261395e565b60075481565b600a5481565b6004546001600160a01b03163314612572576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b600081116125b0576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b600154604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561260a57600080fd5b505af115801561261e573d6000803e3d6000fd5b505050506040513d602081101561263457600080fd5b505060075461264390826135af565b60075550565b6018602052826000526040600020602052816000526040600020818154811061266e57fe5b6000918252602090912001546001600160a01b0316925083915050565b601560209081526000938452604080852082529284528284209052825290205481565b6001600160a01b03811660009081526016602090815260409182902080548351818402810184019094528084526060939283018282801561271857602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116126fa575b50505050509050919050565b6002546001600160a01b031633148061274757506006546001600160a01b031633145b8061275c57506004546001600160a01b031633145b612799576040805162461bcd60e51b81526020600482015260096024820152683737ba1030b236b4b760b91b604482015290519081900360640190fd5b601f859055602084905560218390556022829055806127b857436127ba565b805b6023555050505050565b6001600160a01b038116612808576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b6004546001600160a01b03163314612858576040805162461bcd60e51b815260206004820152600e60248201526d3737ba1039bab832b920b236b4b760911b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633148061289d57506006546001600160a01b031633145b806128b257506004546001600160a01b031633145b6128f2576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b80612934576040805162461bcd60e51b815260206004820152600d60248201526c696e76616c69642076616c756560981b604482015290519081900360640190fd5b600891909155600955565b60136020526000908152604090205481565b601e6020526000908152604090205460ff1681565b6000546001600160a01b031681565b601460209081526000928352604080842090915290825290205481565b6000611763826137d9565b6005546001600160a01b0316331480156129b657503315155b6129ff576040805162461bcd60e51b81526020600482015260156024820152743737ba103832b73234b733a9bab832b920b236b4b760591b604482015290519081900360640190fd5b60058054600480546001600160a01b03199081166001600160a01b03841617909155169055565b60008111612a64576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b80612a6e336137d9565b6001600160601b03161015612ab7576040805162461bcd60e51b815260206004820152600a6024820152690dcdee840cadcdeeaced60b31b604482015290519081900360640190fd5b6001600160a01b0383166000908152601e602052604090205460ff16612b19576040805162461bcd60e51b815260206004820152601260248201527173657276696365206e6f742061637469766560701b604482015290519081900360640190fd5b826001600160a01b03166334dce6b3836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612b6657600080fd5b505afa158015612b7a573d6000803e3d6000fd5b505050506040513d6020811015612b9057600080fd5b5051612bd7576040805162461bcd60e51b8152602060048201526011602482015270656e74697479206e6f742061637469766560781b604482015290519081900360640190fd5b3360008181526017602090815260408083206001600160a01b038816845282528083205493835260169091529020541580612c4c575033600090815260166020526040902080546001600160a01b038616919083908110612c3457fe5b6000918252602090912001546001600160a01b031614155b15612ca2573360009081526016602081815260408084208054601784528286206001600160a01b038b16808852908552928620819055938352600184018155845292200180546001600160a01b03191690911790555b3360008181526019602090815260408083206001600160a01b038981168086529184528285209089168552835281842054948452601883528184209084529091529020541580612d3957503360009081526018602090815260408083206001600160a01b038981168552925290912080549186169183908110612d2157fe5b6000918252602090912001546001600160a01b031614155b15612dab573360008181526018602090815260408083206001600160a01b038a8116808652828552838620805497875260198652848720918752908552838620918b16808752918552928520869055908352600185018255908352912090910180546001600160a01b03191690911790555b336000908152601a6020526040902054431115612ee9576000612dcd33611f53565b90508015612ee757600754612de2908261341a565b600755600154600080546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018690529051919093169263095ea7b39260448083019360209390929083900390910190829087803b158015612e4257600080fd5b505af1158015612e56573d6000803e3d6000fd5b505050506040513d6020811015612e6c57600080fd5b505060008054604080516330d6a97560e01b81523360048201526024810185905290516001600160a01b03909216926330d6a9759260448084019382900301818387803b158015612ebc57600080fd5b505af1158015612ed0573d6000803e3d6000fd5b5050336000908152601a6020526040902043905550505b505b6001600160a01b038086166000908152601b6020908152604080832093881683529290522054431115613058576000612f228686611867565b9050801561305657600754612f37908261341a565b600755600154600080546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018690529051919093169263095ea7b39260448083019360209390929083900390910190829087803b158015612f9757600080fd5b505af1158015612fab573d6000803e3d6000fd5b505050506040513d6020811015612fc157600080fd5b505060008054604080516330d6a97560e01b81526001600160a01b03898116600483015260248201869052915191909216926330d6a975926044808201939182900301818387803b15801561301557600080fd5b505af1158015613029573d6000803e3d6000fd5b5050506001600160a01b038088166000908152601b60209081526040808320938a16835292905220439055505b505b6001600160a01b03851660009081526013602052604090205461307b90846135af565b6001600160a01b038087166000908152601360209081526040808320949094556014815283822092881682529190915220546130b790846135af565b6001600160a01b038087166000818152601460209081526040808320948a168084529482528083209590955533825260158152848220928252918252838120928152919052205461310890846135af565b3360008181526015602090815260408083206001600160a01b038b81168552908352818420908a1684528252808320949094559181526011909152205461314f90846135af565b3360009081526011602052604090205560125461316c90846135af565b601255336000908152601a602052604090205461319657336000908152601a602052604090204390555b6001600160a01b038086166000908152601b60209081526040808320938816835292905220546131e9576001600160a01b038086166000908152601b602090815260408083209388168352929052204390555b836001600160a01b0316856001600160a01b0316336001600160a01b03167f882a614cdae7616c522e95228799e25cf449d413a056ffb6b0047c0c958ab9ff866040518082815260200191505060405180910390a45050505050565b60095481565b601c818154811061325857fe5b6000918252602090912001546001600160a01b0316905081565b6004546001600160a01b031633146132c0576040805162461bcd60e51b815260206004820152600c60248201526b3737ba1030b71030b236b4b760a11b604482015290519081900360640190fd5b600081116132fe576040805162461bcd60e51b815260206004808301919091526024820152637a65726f60e01b604482015290519081900360640190fd5b806007541015613342576040805162461bcd60e51b815260206004820152600a6024820152690dcdee840cadcdeeaced60b31b604482015290519081900360640190fd5b6001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561339857600080fd5b505af11580156133ac573d6000803e3d6000fd5b505050506040513d60208110156133c257600080fd5b50506007546133d1908261341a565b6007555050565b6002546001600160a01b031681565b601960209081526000938452604080852082529284528284209052825290205481565b600154600160a01b900460ff1681565b600061345c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506139c8565b9392505050565b61346b613fb6565b81841061348c5750604080518082019091526000808252602082015261345c565b8282111580613499575082155b156134c45760408051808201909152806134b3848761341a565b81526020016000815250905061345c565b8284106134f0576040805180820190915260008152602081016134e7848761341a565b9052905061345c565b6040805180820190915280613505858761341a565b81526020016134e7848661341a565b60008261352357506000611763565b8282028284828161353057fe5b041461345c5760405162461bcd60e51b8152600401808060200182810382526021815260200180613fd56021913960400191505060405180910390fd5b600061345c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613a22565b60008282018381101561345c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600081600160601b841061369b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613660578181015183820152602001613648565b50505050905090810190601f16801561368d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b509192915050565b6001600160a01b0382166136ed576040805162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b604482015290519081900360640190fd5b6001600160a01b0382166000908152600c60209081526040918290205482518084019093526015835274766f746520616d6f756e74206f766572666c6f777360581b9183019190915261374d916001600160601b03909116908390613a87565b6001600160a01b0383166000908152600c6020526040902080546001600160601b0319166001600160601b039290921691909117905561378d8282613af1565b604080516001600160601b038316815290516001600160a01b038416917fc201fdbe5711fb7afc983d6f16a8b0a62905e9369fa826ece9cf7335cbc00c24919081900360200190a25050565b6000806137e58361395e565b90506001600160601b038116156138615761385a60116000856001600160a01b03166001600160a01b03168152602001908152602001600020546040518060400160405280601d81526020017f766f746572566f7465734f757420657863656564732039362062697473000000815250613609565b810361345c565b60009392505050565b6001600160a01b0382166000908152600c6020908152604091829020548251808401909352601b83527f766f746520616d6f756e7420657863656564732062616c616e63650000000000918301919091526138d2916001600160601b03909116908390613b68565b6001600160a01b0383166000908152600c6020526040902080546001600160601b0319166001600160601b03929092169190911790556139128282613bcd565b604080516001600160601b038316815290516001600160a01b038416917f7e7055a3906068db3ff8f43cf91f9b2c03b1782818489b1b059fbe7c8c339273919081900360200190a25050565b6001600160a01b03811660009081526010602052604081205463ffffffff168061398957600061345c565b6001600160a01b0383166000908152600f6020908152604080832063ffffffff60001986011684529091529020546001600160601b0316915050919050565b60008184841115613a1a5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613660578181015183820152602001613648565b505050900390565b60008183613a715760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613660578181015183820152602001613648565b506000838581613a7d57fe5b0495945050505050565b6000838301826001600160601b038087169083161015613ae85760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613660578181015183820152602001613648565b50949350505050565b6001600160a01b038281166000908152600d602052604090205416613b3a576001600160a01b0382166000818152600d6020526040902080546001600160a01b03191690911790555b6001600160a01b038083166000908152600d602052604081205490911690613b63908284613bf3565b505050565b6000836001600160601b0316836001600160601b031611158290613a1a5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613660578181015183820152602001613648565b6001600160a01b038083166000908152600d602052604081205490911690613b63908290845b816001600160a01b0316836001600160a01b031614158015613c1e57506000816001600160601b0316115b15613b63576001600160a01b03831615613ce5576001600160a01b03831660009081526010602052604081205463ffffffff169081613c5e576000613c96565b6001600160a01b0385166000908152600f6020908152604080832063ffffffff60001987011684529091529020546001600160601b03165b90506000613cd3828560405180604001604052806016815260200175766f746520616d6f756e7420756e646572666c6f777360501b815250613b68565b9050613ce186848484613daa565b5050505b6001600160a01b03821615613b63576001600160a01b03821660009081526010602052604081205463ffffffff169081613d20576000613d58565b6001600160a01b0384166000908152600f6020908152604080832063ffffffff60001987011684529091529020546001600160601b03165b90506000613d94828560405180604001604052806015815260200174766f746520616d6f756e74206f766572666c6f777360581b815250613a87565b9050613da285848484613daa565b505050505050565b6000613deb436040518060400160405280601c81526020017f626c6f636b206e756d6265722065786365656473203332206269747300000000815250613f60565b905060008463ffffffff16118015613e3457506001600160a01b0385166000908152600e6020908152604080832063ffffffff6000198901811685529252909120548282169116145b15613e84576001600160a01b0385166000908152600f60209081526040808320600019880163ffffffff168452909152902080546001600160601b0319166001600160601b038416179055613f0c565b6001600160a01b0385166000818152600e6020908152604080832063ffffffff898116808652918452828520805463ffffffff1990811689841617909155868652600f855283862092865291845282852080546001600160601b0319166001600160601b038a1617905594845260109092529091208054909116600187019092169190911790555b604080516001600160601b0380861682528416602082015281516001600160a01b038816927fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724928290030190a25050505050565b600081640100000000841061369b5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315613660578181015183820152602001613648565b6040518060400160405280600290602082028036833750919291505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212201cc059d2ef53f5fb8f539eb1d6c722d3502b59f1e57bb5d830689cfc60f1a6f964736f6c634300060c0033
Deployed Bytecode Sourcemap
200:20447:18:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4089:181;;;:::i;:::-;;1396:69;;;;;;;;;;;;;;;;-1:-1:-1;1396:69:18;;-1:-1:-1;;;;;1396:69:18;;;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;1396:69:18;;;;;;;;;;;;;;13514:501;;;:::i;1574:28::-;;;:::i;:::-;;;;;;;;;;;;;;;;2666:46;;;:::i;866:27::-;;;:::i;:::-;;;;-1:-1:-1;;;;;866:27:18;;;;;;;;;;;;;;1224:42;;;;;;;;;;;;;;;;-1:-1:-1;1224:42:18;-1:-1:-1;;;;;1224:42:18;;:::i;897:25::-;;;:::i;2613:49::-;;;:::i;2343:55::-;;;;;;;;;;;;;;;;-1:-1:-1;2343:55:18;-1:-1:-1;;;;;2343:55:18;;:::i;11837:1673::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;11837:1673:18;;;;;;;;;;;;;;;;;:::i;1319:73::-;;;;;;;;;;;;;;;;-1:-1:-1;1319:73:18;;-1:-1:-1;;;;;1319:73:18;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;5363:450;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;5363:450:18;;;;;;;;;;:::i;2562:47::-;;;:::i;3682:202::-;;;;;;;;;;;;;;;;-1:-1:-1;3682:202:18;-1:-1:-1;;;;;3682:202:18;;:::i;7498:158::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;7498:158:18;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;926:32;;;:::i;3888:197::-;;;;;;;;;;;;;;;;-1:-1:-1;3888:197:18;-1:-1:-1;;;;;3888:197:18;;:::i;2215:86::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;2215:86:18;;;;;;;;;;:::i;1270:44::-;;;;;;;;;;;;;;;;-1:-1:-1;1270:44:18;-1:-1:-1;;;;;1270:44:18;;:::i;2510:48::-;;;:::i;8398:808::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;8398:808:18;;;;;;;;;;:::i;1522:48::-;;;;;;;;;;;;;;;;-1:-1:-1;1522:48:18;-1:-1:-1;;;;;1522:48:18;;:::i;14019:659::-;;;;;;;;;;;;;;;;-1:-1:-1;14019:659:18;-1:-1:-1;;;;;14019:659:18;;:::i;1469:48::-;;;;;;;;;;;;;;;;-1:-1:-1;1469:48:18;-1:-1:-1;;;;;1469:48:18;;:::i;1173:46::-;;;:::i;4839:520::-;;;;;;;;;;;;;;;;-1:-1:-1;4839:520:18;-1:-1:-1;;;;;4839:520:18;;:::i;2460:46::-;;;:::i;2717:859::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;2717:859:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;7660:734::-;;;;;;;;;;;;;;;;-1:-1:-1;7660:734:18;-1:-1:-1;;;;;7660:734:18;;:::i;962:29::-;;;:::i;1838:50::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;1838:50:18;;;;;;;;:::i;1029:43::-;;;:::i;1892:72::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;1892:72:18;;;;;;;;;;:::i;15232:976::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;15232:976:18;;;;;;;;:::i;5817:104::-;;;:::i;788:25::-;;;:::i;6373:344::-;;;;;;;;;;;;;;;;-1:-1:-1;6373:344:18;;;;;;;:::i;2153:58::-;;;;;;;;;;;;;;;;-1:-1:-1;2153:58:18;-1:-1:-1;;;;;2153:58:18;;:::i;14682:410::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;14682:410:18;;;;;;;;;;;;;;;:::i;15096:132::-;;;;;;;;;;;;;;;;-1:-1:-1;15096:132:18;-1:-1:-1;;;;;15096:132:18;;:::i;996:28::-;;;:::i;1125:44::-;;;:::i;6721:245::-;;;;;;;;;;;;;;;;-1:-1:-1;6721:245:18;;:::i;1969:77::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;1969:77:18;;;;;;;;;;;;;;;;;:::i;1735:98::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;1735:98:18;;;;;;;;;;;;;;;;;;;:::i;7376:118::-;;;;;;;;;;;;;;;;-1:-1:-1;7376:118:18;-1:-1:-1;;;;;7376:118:18;;:::i;20023:622::-;;;;;;;;;;;;;;;;-1:-1:-1;20023:622:18;;;;;;;;;;;;;;;;;;;;;;:::i;4274:232::-;;;;;;;;;;;;;;;;-1:-1:-1;4274:232:18;-1:-1:-1;;;;;4274:232:18;;:::i;6028:341::-;;;;;;;;;;;;;;;;-1:-1:-1;6028:341:18;;;;;;;:::i;1607:47::-;;;;;;;;;;;;;;;;-1:-1:-1;1607:47:18;-1:-1:-1;;;;;1607:47:18;;:::i;2402:53::-;;;;;;;;;;;;;;;;-1:-1:-1;2402:53:18;-1:-1:-1;;;;;2402:53:18;;:::i;:::-;;;;;;;;;;;;;;;;;;747:37;;;:::i;1658:73::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;1658:73:18;;;;;;;;;;:::i;16212:144::-;;;;;;;;;;;;;;;;-1:-1:-1;16212:144:18;-1:-1:-1;;;;;16212:144:18;;:::i;4510:211::-;;;:::i;9210:2623::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;9210:2623:18;;;;;;;;;;;;;;;;;:::i;1076:45::-;;;:::i;2306:33::-;;;;;;;;;;;;;;;;-1:-1:-1;2306:33:18;;:::i;6970:301::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;6970:301:18;;;;;;;;:::i;842:20::-;;;:::i;2050:98::-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;2050:98:18;;;;;;;;;;;;;;;;;;;:::i;818:20::-;;;:::i;4089:181::-;4147:12;;-1:-1:-1;;;;;4147:12:18;4133:10;:26;:54;;;;-1:-1:-1;4163:10:18;:24;;4133:54;4125:83;;;;;-1:-1:-1;;;4125:83:18;;;;;;;;;;;;-1:-1:-1;;;4125:83:18;;;;;;;;;;;;;;;4222:12;;;4214:5;:20;;-1:-1:-1;;;;;;4214:20:18;;;-1:-1:-1;;;;;4222:12:18;;4214:20;;;;4240:25;;;4089:181::o;1396:69::-;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1396:69:18;;:::o;13514:501::-;13581:10;13557:35;;;;:23;:35;;;;;;13549:58;;;;;-1:-1:-1;;;13549:58:18;;;;;;;;;;;;-1:-1:-1;;;13549:58:18;;;;;;;;;;;;;;;13660:10;13636:35;;;;:23;:35;;;;;;13621:12;:50;13613:71;;;;;-1:-1:-1;;;13613:71:18;;;;;;;;;;;;-1:-1:-1;;;13613:71:18;;;;;;;;;;;;;;;13690:14;13707:26;13722:10;13707:14;:26::i;:::-;13690:43;;13756:1;13747:6;:10;13739:32;;;;;-1:-1:-1;;;13739:32:18;;;;;;;;;;;;-1:-1:-1;;;13739:32:18;;;;;;;;;;;;;;;13793:13;;:25;;13811:6;13793:17;:25::i;:::-;13777:13;:41;13824:11;;;13852:10;;13824:48;;;-1:-1:-1;;;13824:48:18;;-1:-1:-1;;;;;13852:10:18;;;13824:48;;;;;;;;;;;;:11;;;;;:19;;:48;;;;;;;;;;;;;;;;;;;:11;:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;13878:10:18;;;:38;;;-1:-1:-1;;;13878:38:18;;13897:10;13878:38;;;;;;;;;;;;-1:-1:-1;;;;;13878:10:18;;;;:18;;:38;;;;;;;;;;:10;;:38;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;13946:10:18;13922:35;;;;:23;:35;;;;;;;;;13960:12;13922:50;;13983:27;;;;;;;13946:10;;-1:-1:-1;13983:27:18;;-1:-1:-1;13983:27:18;;;;;;;13514:501;:::o;1574:28::-;;;;:::o;2666:46::-;;;;:::o;866:27::-;;;-1:-1:-1;;;;;866:27:18;;:::o;1224:42::-;;;;;;;;;;;;-1:-1:-1;;;;;1224:42:18;;:::o;897:25::-;;;-1:-1:-1;;;;;897:25:18;;:::o;2613:49::-;;;;:::o;2343:55::-;;;;;;;;;;;;;:::o;11837:1673::-;11952:1;11943:6;:10;11935:27;;;;;-1:-1:-1;;;11935:27:18;;;;;;;;;;;;;;;-1:-1:-1;;;11935:27:18;;;;;;;;;;;;;;;12000:10;11976:35;;;;:23;:35;;;;;;;;-1:-1:-1;;;;;11976:44:18;;;;;;;;;;;:52;;;;;;;;;;;:62;-1:-1:-1;11976:62:18;11968:85;;;;;-1:-1:-1;;;11968:85:18;;;;;;;;;;;;-1:-1:-1;;;11968:85:18;;;;;;;;;;;;;;;12103:10;12079:35;;;;:23;:35;;;;;;12064:12;:50;12060:363;;;12124:14;12141:26;12156:10;12141:14;:26::i;:::-;12124:43;-1:-1:-1;12179:10:18;;12175:242;;12217:13;;:25;;12235:6;12217:17;:25::i;:::-;12201:13;:41;12252:11;;;12280:10;;12252:48;;;-1:-1:-1;;;12252:48:18;;-1:-1:-1;;;;;12280:10:18;;;12252:48;;;;;;;;;;;;:11;;;;;:19;;:48;;;;;;;;;;;;;;;;;;;:11;:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;12310:10:18;;;:38;;;-1:-1:-1;;;12310:38:18;;12329:10;12310:38;;;;;;;;;;;;-1:-1:-1;;;;;12310:10:18;;;;:18;;:38;;;;;;;;;;:10;;:38;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;12382:10:18;12358:35;;;;:23;:35;;;;;12396:12;12358:50;;-1:-1:-1;;12175:242:18;12060:363;;-1:-1:-1;;;;;12448:40:18;;;;;;;:31;:40;;;;;;;;:48;;;;;;;;;;12433:12;:63;12429:391;;;12506:14;12523:32;12539:7;12548:6;12523:15;:32::i;:::-;12506:49;-1:-1:-1;12567:10:18;;12563:251;;12605:13;;:25;;12623:6;12605:17;:25::i;:::-;12589:13;:41;12640:11;;;12668:10;;12640:48;;;-1:-1:-1;;;12640:48:18;;-1:-1:-1;;;;;12668:10:18;;;12640:48;;;;;;;;;;;;:11;;;;;:19;;:48;;;;;;;;;;;;;;;;;;;:11;:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;12698:10:18;;;:34;;;-1:-1:-1;;;12698:34:18;;-1:-1:-1;;;;;12698:34:18;;;;;;;;;;;;;;;:10;;;;;:18;;:34;;;;;;;;;;;:10;;:34;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;;;12742:40:18;;;;;;;:31;:40;;;;;;;;:48;;;;;;;;;12793:12;12742:63;;-1:-1:-1;12563:251:18;12429:391;;-1:-1:-1;;;;;12850:21:18;;;;;;:12;:21;;;;;;:33;;12876:6;12850:25;:33::i;:::-;-1:-1:-1;;;;;12826:21:18;;;;;;;:12;:21;;;;;;;;:57;;;;12927:18;:27;;;;;:35;;;;;;;;;;;:47;;12967:6;12927:39;:47::i;:::-;-1:-1:-1;;;;;12889:27:18;;;;;;;:18;:27;;;;;;;;:35;;;;;;;;;;;;:85;;;;13059:10;13035:35;;:23;:35;;;;;:44;;;;;;;;;:52;;;;;;;;:76;;13099:6;13035:56;:76::i;:::-;13004:10;12980:35;;;;:23;:35;;;;;;;;-1:-1:-1;;;;;12980:44:18;;;;;;;;;;;:52;;;;;;;;;;:131;;;;13146:25;;;:13;:25;;;;;:37;;13176:6;13146:29;:37::i;:::-;13132:10;13118:25;;;;:13;:25;;;;;:65;13205:13;;:25;;13223:6;13205:17;:25::i;:::-;13189:13;:41;13255:10;13241:25;;;;:13;:25;;;;;;13237:90;;13305:10;13319:1;13281:35;;;:23;:35;;;;;:39;13237:90;-1:-1:-1;;;;;13337:27:18;;;;;;;:18;:27;;;;;;;;:35;;;;;;;;;;13333:113;;-1:-1:-1;;;;;13387:40:18;;;13438:1;13387:40;;;:31;:40;;;;;;;;:48;;;;;;;;;;;:52;13333:113;13490:6;-1:-1:-1;;;;;13456:49:18;13481:7;-1:-1:-1;;;;;13456:49:18;13469:10;-1:-1:-1;;;;;13456:49:18;;13498:6;13456:49;;;;;;;;;;;;;;;;;;11837:1673;;;:::o;1319:73::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;5363:450::-;-1:-1:-1;;;;;5461:19:18;;5453:36;;;;;-1:-1:-1;;;5453:36:18;;;;;;;;;;;;;;;-1:-1:-1;;;5453:36:18;;;;;;;;;;;;;;;5517:5;;-1:-1:-1;;;;;5517:5:18;5503:10;:19;;:51;;-1:-1:-1;5540:14:18;;-1:-1:-1;;;;;5540:14:18;5526:10;:28;5503:51;:79;;;-1:-1:-1;5572:10:18;;-1:-1:-1;;;;;5572:10:18;5558;:24;5503:79;5495:104;;;;;-1:-1:-1;;;5495:104:18;;;;;;;;;;;;-1:-1:-1;;;5495:104:18;;;;;;;;;;;;;;;5613:16;:23;5605:44;;;;;-1:-1:-1;;;5605:44:18;;;;;;;;;;;;;;;-1:-1:-1;;;5605:44:18;;;;;;;;;;;;;;;-1:-1:-1;;;;;5671:27:18;;5655:13;5671:27;;;:20;:27;;;;;;5712:16;:23;;5671:27;;;;;5712:23;;;;;;;;;;;;;;;;-1:-1:-1;;;;;5712:23:18;:32;5704:55;;;;;-1:-1:-1;;;5704:55:18;;;;;;;;;;;;-1:-1:-1;;;5704:55:18;;;;;;;;;;;;;;;-1:-1:-1;;;;;;5765:28:18;;;;;;;;:21;:28;;;;;:43;;-1:-1:-1;;5765:43:18;;;;;;;;;;5363:450::o;2562:47::-;;;;:::o;3682:202::-;-1:-1:-1;;;;;3760:31:18;;3752:48;;;;;-1:-1:-1;;;3752:48:18;;;;;;;;;;;;;;;-1:-1:-1;;;3752:48:18;;;;;;;;;;;;;;;3828:10;;-1:-1:-1;;;;;3828:10:18;3814;:24;3806:33;;;;;;3845:14;:34;;-1:-1:-1;;;;;;3845:34:18;-1:-1:-1;;;;;3845:34:18;;;;;;;;;;3682:202::o;7498:158::-;-1:-1:-1;;;;;7615:27:18;;;;;;;:20;:27;;;;;;;;:36;;;;;;;;;;;;7608:43;;;;;;;;;;;;;;;;;7584:16;;7608:43;;;7615:36;7608:43;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;7608:43:18;;;;;;;;;;;;;;;;;;;;;;;7498:158;;;;;:::o;926:32::-;;;-1:-1:-1;;;;;926:32:18;;:::o;3888:197::-;-1:-1:-1;;;;;3959:29:18;;3951:46;;;;;-1:-1:-1;;;3951:46:18;;;;;;;;;;;;;;;-1:-1:-1;;;3951:46:18;;;;;;;;;;;;;;;4025:5;;-1:-1:-1;;;;;4025:5:18;4011:10;:19;4003:41;;;;;-1:-1:-1;;;4003:41:18;;;;;;;;;;;;-1:-1:-1;;;4003:41:18;;;;;;;;;;;;;;;4050:12;:30;;-1:-1:-1;;;;;;4050:30:18;-1:-1:-1;;;;;4050:30:18;;;;;;;;;;3888:197::o;2215:86::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;1270:44::-;;;;;;;;;;;;-1:-1:-1;;;;;1270:44:18;;:::o;2510:48::-;;;;:::o;8398:808::-;-1:-1:-1;;;;;8521:40:18;;;8477:7;8521:40;;;:31;:40;;;;;;;;:48;;;;;;;;;;;;8580:21;;;:12;:21;;;;;;8576:40;;8615:1;8608:8;;;;;8576:40;8626:23;8622:37;;8658:1;8651:8;;;;;8622:37;8666:30;;:::i;:::-;8699:81;8714:18;8734:31;;8767:12;8699:14;:81::i;:::-;8666:114;;8786:17;8838:1;8806:29;;:33;:127;;8932:1;8806:127;;;8842:87;8897:31;;8842:50;8862:29;;8842:12;8855:1;8842:15;;;;;;;;;;;;:19;:50::i;:::-;:54;;:87::i;:::-;8786:147;;8939:17;8994:1;8959:32;;:36;:136;;9094:1;8959:136;;;8998:93;9056:34;;8998:53;9018:32;;8998:12;9011:1;8998:15;;;;;;:93;-1:-1:-1;;;;;9179:21:18;;;;;;;:12;:21;;;;;;;;;9138:18;:27;;;;;:35;;;;;;;;;;;;8939:156;;-1:-1:-1;9109:92:18;;:65;;:24;:9;8939:156;9109:13;:24::i;:::-;:28;;:65::i;:92::-;9102:99;8398:808;-1:-1:-1;;;;;;;8398:808:18:o;1522:48::-;;;;;;;;;;;;;:::o;14019:659::-;-1:-1:-1;;;;;14078:40:18;;;;;;:31;:40;;;;;;;;14119:10;14078:52;;;;;;;;14070:75;;;;;-1:-1:-1;;;14070:75:18;;;;;;;;;;;;-1:-1:-1;;;14070:75:18;;;;;;;;;;;;;;;-1:-1:-1;;;;;14174:40:18;;;;;;:31;:40;;;;;;;;14215:10;14174:52;;;;;;;;14159:12;:67;14151:88;;;;;-1:-1:-1;;;14151:88:18;;;;;;;;;;;;-1:-1:-1;;;14151:88:18;;;;;;;;;;;;;;;14253:52;;;-1:-1:-1;;;14253:52:18;;14294:10;14253:52;;;;;;-1:-1:-1;;;;;14253:40:18;;;;;:52;;;;;;;;;;;;;;:40;:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;14253:52:18;14245:75;;;;;-1:-1:-1;;;14245:75:18;;;;;;;;;;;;-1:-1:-1;;;14245:75:18;;;;;;;;;;;;;;;14326:14;14343:36;14359:7;14368:10;14343:15;:36::i;:::-;14326:53;;14402:1;14393:6;:10;14385:32;;;;;-1:-1:-1;;;14385:32:18;;;;;;;;;;;;-1:-1:-1;;;14385:32:18;;;;;;;;;;;;;;;14439:13;;:25;;14457:6;14439:17;:25::i;:::-;14423:13;:41;14470:11;;;14498:10;;14470:48;;;-1:-1:-1;;;14470:48:18;;-1:-1:-1;;;;;14498:10:18;;;14470:48;;;;;;;;;;;;:11;;;;;:19;;:48;;;;;;;;;;;;;;;;;;;:11;:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;14524:10:18;;;:38;;;-1:-1:-1;;;14524:38:18;;14543:10;14524:38;;;;;;;;;;;;-1:-1:-1;;;;;14524:10:18;;;;:18;;:38;;;;;;;;;;:10;;:38;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;14568:40:18;;;;;;:31;:40;;;;;;;;14609:10;14568:52;;;;;;;;;;14623:12;14568:67;;14646:27;;;;;;;;;;;;;;;;;;14019:659;;:::o;1469:48::-;;;;;;;;;;;;;;;:::o;1173:46::-;;;;:::o;4839:520::-;-1:-1:-1;;;;;4903:19:18;;4895:36;;;;;-1:-1:-1;;;4895:36:18;;;;;;;;;;;;;;;-1:-1:-1;;;4895:36:18;;;;;;;;;;;;;;;4959:5;;-1:-1:-1;;;;;4959:5:18;4945:10;:19;;:51;;-1:-1:-1;4982:14:18;;-1:-1:-1;;;;;4982:14:18;4968:10;:28;4945:51;:79;;;-1:-1:-1;5014:10:18;;-1:-1:-1;;;;;5014:10:18;5000;:24;4945:79;4937:104;;;;;-1:-1:-1;;;4937:104:18;;;;;;;;;;;;-1:-1:-1;;;4937:104:18;;;;;;;;;;;;;;;5051:16;:23;:28;5047:151;;-1:-1:-1;;;;;5105:27:18;;5089:13;5105:27;;;:20;:27;;;;;;5148:16;:23;;5105:27;;;;;5148:23;;;;;;;;;;;;;;;;-1:-1:-1;;;;;5148:23:18;:32;;5140:51;;;;;-1:-1:-1;;;5140:51:18;;;;;;;;;;;;-1:-1:-1;;;5140:51:18;;;;;;;;;;;;;;;5047:151;;5217:16;:23;;-1:-1:-1;;;;;5246:27:18;;;5203:11;5246:27;;;:20;:27;;;;;;;;:33;;;;5285:21;:28;;;;;:35;;-1:-1:-1;;5285:35:18;5316:4;5285:35;;;;;;5326:28;;;;;;;;;;;;;;;-1:-1:-1;;;;;;5326:28:18;;;;;;4839:520::o;2460:46::-;;;;:::o;2717:859::-;3071:8;;-1:-1:-1;;;3071:8:18;;;;3070:9;3062:31;;;;;-1:-1:-1;;;3062:31:18;;;;;;;;;;;;-1:-1:-1;;;3062:31:18;;;;;;;;;;;;;;;3099:11;:40;;:11;3145:51;;-1:-1:-1;;;;;3145:51:18;;;-1:-1:-1;;;;;;3145:51:18;;;;;;;3202:5;:20;;;;;;;;;;;;;;;3228:10;:30;;;;;;;;;;;;;;;3264:28;:64;;;;3334:30;:68;;;;3408:29;:66;3480:31;:70;-1:-1:-1;;;;3099:40:18;;;;;;;3556:15;-1:-1:-1;;;3556:15:18;;;2717:859::o;7660:734::-;-1:-1:-1;;;;;7764:30:18;;7720:7;7764:30;;;:23;:30;;;;;;7805:13;;7801:32;;7832:1;7825:8;;;;;7801:32;7843:23;7839:37;;7875:1;7868:8;;;;;7839:37;7883:30;;:::i;:::-;7916:81;7931:18;7951:31;;7984:12;7916:14;:81::i;:::-;7883:114;;8003:17;8054:1;8023:28;;:32;:124;;8146:1;8023:124;;;8058:85;8112:30;;8058:49;8078:28;;8058:12;8071:1;8058:15;;;;;;:85;8003:144;;8153:17;8207:1;8173:31;;:35;:133;;8305:1;8173:133;;;8211:91;8268:33;;8211:52;8231:31;;8211:12;8224:1;8211:15;;;;;;:91;8375:13;;-1:-1:-1;;;;;8349:20:18;;;;;;:13;:20;;;;;;8153:153;;-1:-1:-1;8320:69:18;;:50;;:24;:9;8153:153;8320:13;:24::i;:69::-;8313:76;;;;;;7660:734;;;;:::o;962:29::-;;;-1:-1:-1;;;;;962:29:18;;:::o;1838:50::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1838:50:18;;-1:-1:-1;1838:50:18;;-1:-1:-1;1838:50:18:o;1029:43::-;;;;:::o;1892:72::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;15232:976::-;15324:6;15360:12;15346:11;:26;15338:57;;;;;-1:-1:-1;;;15338:57:18;;;;;;;;;;;;-1:-1:-1;;;15338:57:18;;;;;;;;;;;;;;;-1:-1:-1;;;;;15423:23:18;;15401:19;15423:23;;;:14;:23;;;;;;;;15456:17;15452:46;;15490:1;15483:8;;;;;15452:46;-1:-1:-1;;;;;15507:29:18;;;;;;:20;:29;;;;;;;;:47;-1:-1:-1;;15537:16:18;;15507:47;;;;;;;;;;;:62;-1:-1:-1;15503:133:18;;-1:-1:-1;;;;;15586:25:18;;;;;;:16;:25;;;;;;;;-1:-1:-1;;15612:16:18;;;;15586:43;;;;;;;;;-1:-1:-1;;;;;15586:43:18;;-1:-1:-1;15579:50:18;;15503:133;-1:-1:-1;;;;;15645:29:18;;;;;;:20;:29;;;;;;;;:32;;;;;;;;;;;:46;-1:-1:-1;15641:75:18;;;15708:1;15701:8;;;;;15641:75;15721:12;-1:-1:-1;;15758:16:18;;15780:379;15795:5;15787:13;;:5;:13;;;15780:379;;;-1:-1:-1;;;;;15880:29:18;;15810:13;15880:29;;;:20;:29;;;;;;;;15852:1;15834:19;15835:13;;;15834:19;;;;;;15826:27;;15880:37;;;;;;;;;;;;;15940:25;;;:16;:25;;;;;:33;;;;;;;;;;15826:27;;15880:37;;-1:-1:-1;;;;;15940:33:18;15985:24;;;15981:172;;;16028:5;-1:-1:-1;16021:12:18;;-1:-1:-1;;;;;16021:12:18;15981:172;16064:11;16052:9;:23;;;16048:105;;;16095:6;16087:14;;16048:105;;;16143:1;16134:6;:10;16126:18;;16048:105;15780:379;;;;;;-1:-1:-1;;;;;;16171:25:18;;;;;;:16;:25;;;;;;;;:32;;;;;;;;;;;-1:-1:-1;;;;;16171:32:18;;-1:-1:-1;;15232:976:18;;;;:::o;5817:104::-;5869:16;5900;5893:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;5893:23:18;;;;;;;;;;;;;;;;;;;;;;;5817:104;:::o;788:25::-;;;-1:-1:-1;;;;;788:25:18;;:::o;6373:344::-;6484:5;;-1:-1:-1;;;;;6484:5:18;6470:10;:19;;:51;;-1:-1:-1;6507:14:18;;-1:-1:-1;;;;;6507:14:18;6493:10;:28;6470:51;:79;;;-1:-1:-1;6539:10:18;;-1:-1:-1;;;;;6539:10:18;6525;:24;6470:79;6462:104;;;;;-1:-1:-1;;;6462:104:18;;;;;;;;;;;;-1:-1:-1;;;6462:104:18;;;;;;;;;;;;;;;6580:16;6572:42;;;;;-1:-1:-1;;;6572:42:18;;;;;;;;;;;;-1:-1:-1;;;6572:42:18;;;;;;;;;;;;;;;6620:29;:41;;;;6667:31;:45;6373:344::o;2153:58::-;;;;;;;;;;;;;:::o;14682:410::-;14809:10;;-1:-1:-1;;;;;14809:10:18;14787;:33;14779:60;;;;;-1:-1:-1;;;14779:60:18;;;;;;;;;;;;-1:-1:-1;;;14779:60:18;;;;;;;;;;;;;;;14845:13;14861:44;14869:9;14861:44;;;;;;;;;;;;;-1:-1:-1;;;14861:44:18;;;:7;:44::i;:::-;14845:60;;14915:6;14911:177;;;14931:24;14941:5;14948:6;14931:9;:24::i;:::-;14911:177;;;15026:6;-1:-1:-1;;;;;14984:48:18;:38;15016:5;14984:31;:38::i;:::-;-1:-1:-1;;;;;14984:48:18;;;14976:73;;;;;-1:-1:-1;;;14976:73:18;;;;;;;;;;;;-1:-1:-1;;;14976:73:18;;;;;;;;;;;;;;;15057:24;15067:5;15074:6;15057:9;:24::i;:::-;14682:410;;;;:::o;15096:132::-;15169:6;15190:33;15215:7;15190:24;:33::i;996:28::-;;;;:::o;1125:44::-;;;;:::o;6721:245::-;6789:10;;-1:-1:-1;;;;;6789:10:18;6775;:24;6767:49;;;;;-1:-1:-1;;;6767:49:18;;;;;;;;;;;;-1:-1:-1;;;6767:49:18;;;;;;;;;;;;;;;6839:1;6830:6;:10;6822:27;;;;;-1:-1:-1;;;6822:27:18;;;;;;;;;;;;;;;-1:-1:-1;;;6822:27:18;;;;;;;;;;;;;;;6855:11;;:59;;;-1:-1:-1;;;6855:59:18;;6880:10;6855:59;;;;6900:4;6855:59;;;;;;;;;;;;-1:-1:-1;;;;;6855:11:18;;;;:24;;:59;;;;;;;;;;;;;;;:11;;:59;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;6936:13:18;;:25;;6954:6;6936:17;:25::i;:::-;6920:13;:41;-1:-1:-1;6721:245:18:o;1969:77::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1969:77:18;;-1:-1:-1;1969:77:18;;-1:-1:-1;;1969:77:18:o;1735:98::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;7376:118::-;-1:-1:-1;;;;;7469:20:18;;;;;;:13;:20;;;;;;;;;7462:27;;;;;;;;;;;;;;;;;7438:16;;7462:27;;;7469:20;7462:27;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;7462:27:18;;;;;;;;;;;;;;;;;;;;;;;7376:118;;;:::o;20023:622::-;20241:5;;-1:-1:-1;;;;;20241:5:18;20227:10;:19;;:51;;-1:-1:-1;20264:14:18;;-1:-1:-1;;;;;20264:14:18;20250:10;:28;20227:51;:79;;;-1:-1:-1;20296:10:18;;-1:-1:-1;;;;;20296:10:18;20282;:24;20227:79;20219:101;;;;;-1:-1:-1;;;20219:101:18;;;;;;;;;;;;-1:-1:-1;;;20219:101:18;;;;;;;;;;;;;;;20327:31;:48;;;20381:33;:52;;;20439:32;:50;;;20495:34;:54;;;20589:19;:51;;20628:12;20589:51;;;20611:14;20589:51;20555:31;:85;-1:-1:-1;;;;;20023:622:18:o;4274:232::-;-1:-1:-1;;;;;4355:34:18;;4347:51;;;;;-1:-1:-1;;;4347:51:18;;;;;;;;;;;;;;;-1:-1:-1;;;4347:51:18;;;;;;;;;;;;;;;4426:10;;-1:-1:-1;;;;;4426:10:18;4412;:24;4404:51;;;;;-1:-1:-1;;;4404:51:18;;;;;;;;;;;;-1:-1:-1;;;4404:51:18;;;;;;;;;;;;;;;4461:17;:40;;-1:-1:-1;;;;;;4461:40:18;-1:-1:-1;;;;;4461:40:18;;;;;;;;;;4274:232::o;6028:341::-;6138:5;;-1:-1:-1;;;;;6138:5:18;6124:10;:19;;:51;;-1:-1:-1;6161:14:18;;-1:-1:-1;;;;;6161:14:18;6147:10;:28;6124:51;:79;;;-1:-1:-1;6193:10:18;;-1:-1:-1;;;;;6193:10:18;6179;:24;6124:79;6116:104;;;;;-1:-1:-1;;;6116:104:18;;;;;;;;;;;;-1:-1:-1;;;6116:104:18;;;;;;;;;;;;;;;6234:16;6226:42;;;;;-1:-1:-1;;;6226:42:18;;;;;;;;;;;;-1:-1:-1;;;6226:42:18;;;;;;;;;;;;;;;6274:28;:40;;;;6320:30;:44;6028:341::o;1607:47::-;;;;;;;;;;;;;:::o;2402:53::-;;;;;;;;;;;;;;;:::o;747:37::-;;;-1:-1:-1;;;;;747:37:18;;:::o;1658:73::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;16212:144::-;16290:6;16311:40;16343:7;16311:31;:40::i;4510:211::-;4573:17;;-1:-1:-1;;;;;4573:17:18;4559:10;:31;:59;;;;-1:-1:-1;4594:10:18;:24;;4559:59;4551:93;;;;;-1:-1:-1;;;4551:93:18;;;;;;;;;;;;-1:-1:-1;;;4551:93:18;;;;;;;;;;;;;;;4663:17;;;4650:10;:30;;-1:-1:-1;;;;;;4650:30:18;;;-1:-1:-1;;;;;4663:17:18;;4650:30;;;;4686;;;4510:211::o;9210:2623::-;9319:1;9310:6;:10;9302:27;;;;;-1:-1:-1;;;9302:27:18;;;;;;;;;;;;;;;-1:-1:-1;;;9302:27:18;;;;;;;;;;;;;;;9399:6;9351:43;9383:10;9351:31;:43::i;:::-;-1:-1:-1;;;;;9343:52:18;:62;;9335:85;;;;;-1:-1:-1;;;9335:85:18;;;;;;;;;;;;-1:-1:-1;;;9335:85:18;;;;;;;;;;;;;;;-1:-1:-1;;;;;9434:30:18;;;;;;:21;:30;;;;;;;;9426:61;;;;;-1:-1:-1;;;9426:61:18;;;;;;;;;;;;-1:-1:-1;;;9426:61:18;;;;;;;;;;;;;;;9518:7;-1:-1:-1;;;;;9501:40:18;;9542:6;9501:48;;;;;;;;;;;;;-1:-1:-1;;;;;9501:48:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;9501:48:18;9493:78;;;;;-1:-1:-1;;;9493:78:18;;;;;;;;;;;;-1:-1:-1;;;9493:78:18;;;;;;;;;;;;;;;9619:10;9578:20;9601:29;;;:17;:29;;;;;;;;-1:-1:-1;;;;;9601:38:18;;;;;;;;;;9649:25;;;:13;:25;;;;;:32;:37;;:91;;-1:-1:-1;9704:10:18;9690:25;;;;:13;:25;;;;;:39;;-1:-1:-1;;;;;9690:50:18;;;:25;9716:12;;9690:39;;;;;;;;;;;;;;;;-1:-1:-1;;;;;9690:39:18;:50;;9649:91;9645:257;;;9778:10;9750:11;9764:25;;;:13;:25;;;;;;;;:32;;9804:17;:29;;;;;-1:-1:-1;;;;;9804:38:18;;;;;;;;;;;:44;;;9856:25;;;:39;;;;;;;;;;;;-1:-1:-1;;;;;;9856:39:18;;;;;;9645:257;9954:10;9908:19;9930:35;;;:23;:35;;;;;;;;-1:-1:-1;;;;;9930:44:18;;;;;;;;;;;;:52;;;;;;;;;;;9999:32;;;:20;:32;;;;;:41;;;;;;;;:48;:53;;:127;;-1:-1:-1;10083:10:18;10062:32;;;;:20;:32;;;;;;;;-1:-1:-1;;;;;10062:41:18;;;;;;;;;;:54;;:64;;;;10104:11;;10062:54;;;;;;;;;;;;;;;;-1:-1:-1;;;;;10062:54:18;:64;;9999:127;9988:350;;;10176:10;10141:11;10155:32;;;:20;:32;;;;;;;;-1:-1:-1;;;;;10155:41:18;;;;;;;;;;;;:48;;10211:35;;;:23;:35;;;;;:44;;;;;;;;;:52;;;;;;;;;;;;:58;;;10277:41;;;:54;;;;;;;;;;;;;;;-1:-1:-1;;;;;;10277:54:18;;;;;;9988:350;10387:10;10363:35;;;;:23;:35;;;;;;10348:12;:50;10344:363;;;10408:14;10425:26;10440:10;10425:14;:26::i;:::-;10408:43;-1:-1:-1;10463:10:18;;10459:242;;10501:13;;:25;;10519:6;10501:17;:25::i;:::-;10485:13;:41;10536:11;;;10564:10;;10536:48;;;-1:-1:-1;;;10536:48:18;;-1:-1:-1;;;;;10564:10:18;;;10536:48;;;;;;;;;;;;:11;;;;;:19;;:48;;;;;;;;;;;;;;;;;;;:11;:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;10594:10:18;;;:38;;;-1:-1:-1;;;10594:38:18;;10613:10;10594:38;;;;;;;;;;;;-1:-1:-1;;;;;10594:10:18;;;;:18;;:38;;;;;;;;;;:10;;:38;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;10666:10:18;10642:35;;;;:23;:35;;;;;10680:12;10642:50;;-1:-1:-1;;10459:242:18;10344:363;;-1:-1:-1;;;;;10732:40:18;;;;;;;:31;:40;;;;;;;;:48;;;;;;;;;;10717:12;:63;10713:391;;;10790:14;10807:32;10823:7;10832:6;10807:15;:32::i;:::-;10790:49;-1:-1:-1;10851:10:18;;10847:251;;10889:13;;:25;;10907:6;10889:17;:25::i;:::-;10873:13;:41;10924:11;;;10952:10;;10924:48;;;-1:-1:-1;;;10924:48:18;;-1:-1:-1;;;;;10952:10:18;;;10924:48;;;;;;;;;;;;:11;;;;;:19;;:48;;;;;;;;;;;;;;;;;;;:11;:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;10982:10:18;;;:34;;;-1:-1:-1;;;10982:34:18;;-1:-1:-1;;;;;10982:34:18;;;;;;;;;;;;;;;:10;;;;;:18;;:34;;;;;;;;;;;:10;;:34;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;;;11026:40:18;;;;;;;:31;:40;;;;;;;;:48;;;;;;;;;11077:12;11026:63;;-1:-1:-1;10847:251:18;10713:391;;-1:-1:-1;;;;;11134:21:18;;;;;;:12;:21;;;;;;:33;;11160:6;11134:25;:33::i;:::-;-1:-1:-1;;;;;11110:21:18;;;;;;;:12;:21;;;;;;;;:57;;;;11211:18;:27;;;;;:35;;;;;;;;;;;:47;;11251:6;11211:39;:47::i;:::-;-1:-1:-1;;;;;11173:27:18;;;;;;;:18;:27;;;;;;;;:35;;;;;;;;;;;;:85;;;;11343:10;11319:35;;:23;:35;;;;;:44;;;;;;;;;:52;;;;;;;;:76;;11383:6;11319:56;:76::i;:::-;11288:10;11264:35;;;;:23;:35;;;;;;;;-1:-1:-1;;;;;11264:44:18;;;;;;;;;;;:52;;;;;;;;;;:131;;;;11430:25;;;:13;:25;;;;;:37;;11460:6;11430:29;:37::i;:::-;11416:10;11402:25;;;;:13;:25;;;;;:65;11489:13;;:25;;11507:6;11489:17;:25::i;:::-;11473:13;:41;11549:10;11525:35;;;;:23;:35;;;;;;11521:111;;11599:10;11575:35;;;;:23;:35;;;;;11613:12;11575:50;;11521:111;-1:-1:-1;;;;;11642:40:18;;;;;;;:31;:40;;;;;;;;:48;;;;;;;;;;11638:137;;-1:-1:-1;;;;;11705:40:18;;;;;;;:31;:40;;;;;;;;:48;;;;;;;;;11756:12;11705:63;;11638:137;11813:6;-1:-1:-1;;;;;11786:42:18;11804:7;-1:-1:-1;;;;;11786:42:18;11792:10;-1:-1:-1;;;;;11786:42:18;;11821:6;11786:42;;;;;;;;;;;;;;;;;;9210:2623;;;;;:::o;1076:45::-;;;;:::o;2306:33::-;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2306:33:18;;-1:-1:-1;2306:33:18;:::o;6970:301::-;7060:10;;-1:-1:-1;;;;;7060:10:18;7046;:24;7038:49;;;;;-1:-1:-1;;;7038:49:18;;;;;;;;;;;;-1:-1:-1;;;7038:49:18;;;;;;;;;;;;;;;7110:1;7101:6;:10;7093:27;;;;;-1:-1:-1;;;7093:27:18;;;;;;;;;;;;;;;-1:-1:-1;;;7093:27:18;;;;;;;;;;;;;;;7151:6;7134:13;;:23;;7126:46;;;;;-1:-1:-1;;;7126:46:18;;;;;;;;;;;;-1:-1:-1;;;7126:46:18;;;;;;;;;;;;;;;7178:11;;:41;;;-1:-1:-1;;;7178:41:18;;-1:-1:-1;;;;;7178:41:18;;;;;;;;;;;;;;;:11;;;;;:20;;:41;;;;;;;;;;;;;;:11;;:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;7241:13:18;;:25;;7259:6;7241:17;:25::i;:::-;7225:13;:41;-1:-1:-1;;6970:301:18:o;842:20::-;;;-1:-1:-1;;;;;842:20:18;;:::o;2050:98::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;818:20::-;;;-1:-1:-1;;;818:20:18;;;;;:::o;1329:134:5:-;1387:7;1413:43;1417:1;1420;1413:43;;;;;;;;;;;;;;;;;:3;:43::i;:::-;1406:50;1329:134;-1:-1:-1;;;1329:134:5:o;139:623:19:-;251:17;;:::i;:::-;306:11;284:18;:33;280:70;;-1:-1:-1;319:31:19;;;;;;;;;-1:-1:-1;319:31:19;;;;;;;;;280:70;380:14;365:11;:29;;:52;;;-1:-1:-1;398:19:19;;365:52;361:395;;;433:56;;;;;;;;;;441:35;:11;457:18;441:15;:35::i;:::-;433:56;;;;486:1;433:56;;;;;;;361:395;540:14;518:18;:36;514:242;;570:56;;;;;;;;;-1:-1:-1;570:56:19;;;;;590:35;:11;606:18;590:15;:35::i;:::-;570:56;;;-1:-1:-1;570:56:19;;514:242;665:80;;;;;;;;;;673:38;:14;692:18;673;:38::i;:::-;665:80;;;;713:31;:11;729:14;713:15;:31::i;2188:459:5:-;2246:7;2487:6;2483:45;;-1:-1:-1;2516:1:5;2509:8;;2483:45;2550:5;;;2554:1;2550;:5;:1;2573:5;;;;;:10;2565:56;;;;-1:-1:-1;;;2565:56:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3109:130;3167:7;3193:39;3197:1;3200;3193:39;;;;;;;;;;;;;;;;;:3;:39::i;882:176::-;940:7;971:5;;;994:6;;;;986:46;;;;;-1:-1:-1;;;986:46:5;;;;;;;;;;;;;;;;;;;;;;;;;;;19004:152:18;19083:6;19116:12;-1:-1:-1;;;19105:9:18;;19097:32;;;;-1:-1:-1;;;19097:32:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;19149:1:18;;19004:152;-1:-1:-1;;19004:152:18:o;16464:263::-;-1:-1:-1;;;;;16536:19:18;;16528:44;;;;;-1:-1:-1;;;16528:44:18;;;;;;;;;;;;-1:-1:-1;;;16528:44:18;;;;;;;;;;;;;;;-1:-1:-1;;;;;16603:15:18;;;;;;:8;:15;;;;;;;;;;16596:56;;;;;;;;;;;-1:-1:-1;;;16596:56:18;;;;;;;;;-1:-1:-1;;;;;16603:15:18;;;;16620:6;;16596;:56::i;:::-;-1:-1:-1;;;;;16578:15:18;;;;;;:8;:15;;;;;:74;;-1:-1:-1;;;;;;16578:74:18;-1:-1:-1;;;;;16578:74:18;;;;;;;;;;16658:28;16578:15;16679:6;16658:13;:28::i;:::-;16697:25;;;-1:-1:-1;;;;;16697:25:18;;;;;;-1:-1:-1;;;;;16697:25:18;;;;;;;;;;;;;16464:263;;:::o;19745:274::-;19826:6;19840:20;19863:33;19888:7;19863:24;:33::i;:::-;19840:56;-1:-1:-1;;;;;;19909:18:18;;;:105;;19950:64;19958:13;:22;19972:7;-1:-1:-1;;;;;19958:22:18;-1:-1:-1;;;;;19958:22:18;;;;;;;;;;;;;19950:64;;;;;;;;;;;;;;;;;:7;:64::i;:::-;19934:13;:80;19909:105;;;19930:1;19902:112;19745:274;-1:-1:-1;;;19745:274:18:o;16731:229::-;-1:-1:-1;;;;;16820:15:18;;;;;;:8;:15;;;;;;;;;;16813:62;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;16820:15:18;;;;16837:6;;16813;:62::i;:::-;-1:-1:-1;;;;;16795:15:18;;;;;;:8;:15;;;;;:80;;-1:-1:-1;;;;;;16795:80:18;-1:-1:-1;;;;;16795:80:18;;;;;;;;;;16881:33;16795:15;16907:6;16881:18;:33::i;:::-;16925:30;;;-1:-1:-1;;;;;16925:30:18;;;;;;-1:-1:-1;;;;;16925:30:18;;;;;;;;;;;;;16731:229;;:::o;19524:217::-;-1:-1:-1;;;;;19634:23:18;;19598:6;19634:23;;;:14;:23;;;;;;;;19670:16;:66;;19735:1;19670:66;;;-1:-1:-1;;;;;19689:25:18;;;;;;:16;:25;;;;;;;;:43;-1:-1:-1;;19715:16:18;;19689:43;;;;;;;;;-1:-1:-1;;;;;19689:43:18;19663:73;;;19524:217;;;:::o;1754:187:5:-;1840:7;1875:12;1867:6;;;;1859:29;;;;-1:-1:-1;;;1859:29:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;1910:5:5;;;1754:187::o;3721:272::-;3807:7;3841:12;3834:5;3826:28;;;;-1:-1:-1;;;3826:28:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3864:9;3880:1;3876;:5;;;;;;;3721:272;-1:-1:-1;;;;;3721:272:5:o;19160:187:18:-;19263:6;19288:5;;;19315:12;-1:-1:-1;;;;;19307:6:18;;;;;;;;19299:29;;;;-1:-1:-1;;;19299:29:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;19341:1:18;19160:187;-1:-1:-1;;;;19160:187:18:o;16964:252::-;-1:-1:-1;;;;;17036:16:18;;;17064:1;17036:16;;;:9;:16;;;;;;;17032:75;;-1:-1:-1;;;;;17076:16:18;;;;;;:9;:16;;;;;:24;;-1:-1:-1;;;;;;17076:24:18;;;;;;17032:75;-1:-1:-1;;;;;17138:16:18;;;17112:23;17138:16;;;:9;:16;;;;;;;;;;17160:51;;17138:16;17204:6;17160:14;:51::i;:::-;16964:252;;;:::o;19351:169::-;19454:6;19481:1;-1:-1:-1;;;;;19476:6:18;:1;-1:-1:-1;;;;;19476:6:18;;;19484:12;19468:29;;;;;-1:-1:-1;;;19468:29:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;17220:177;-1:-1:-1;;;;;17319:16:18;;;17293:23;17319:16;;;:9;:16;;;;;;;;;;17341:51;;17319:16;;17385:6;17401:804;17517:6;-1:-1:-1;;;;;17507:16:18;:6;-1:-1:-1;;;;;17507:16:18;;;:30;;;;;17536:1;17527:6;-1:-1:-1;;;;;17527:10:18;;17507:30;17503:698;;;-1:-1:-1;;;;;17551:20:18;;;17547:321;;-1:-1:-1;;;;;17602:22:18;;17583:16;17602:22;;;:14;:22;;;;;;;;;17653:13;:59;;17711:1;17653:59;;;-1:-1:-1;;;;;17669:24:18;;;;;;:16;:24;;;;;;;;:39;-1:-1:-1;;17694:13:18;;17669:39;;;;;;;;;-1:-1:-1;;;;;17669:39:18;17653:59;17634:78;;17722:16;17741:51;17748:9;17759:6;17741:51;;;;;;;;;;;;;-1:-1:-1;;;17741:51:18;;;:6;:51::i;:::-;17722:70;;17802:57;17819:6;17827:9;17838;17849;17802:16;:57::i;:::-;17547:321;;;;-1:-1:-1;;;;;17879:20:18;;;17875:320;;-1:-1:-1;;;;;17930:22:18;;17911:16;17930:22;;;:14;:22;;;;;;;;;17981:13;:59;;18039:1;17981:59;;;-1:-1:-1;;;;;17997:24:18;;;;;;:16;:24;;;;;;;;:39;-1:-1:-1;;18022:13:18;;17997:39;;;;;;;;;-1:-1:-1;;;;;17997:39:18;17981:59;17962:78;;18050:16;18069:50;18076:9;18087:6;18069:50;;;;;;;;;;;;;-1:-1:-1;;;18069:50:18;;;:6;:50::i;:::-;18050:69;;18129:57;18146:6;18154:9;18165;18176;18129:16;:57::i;:::-;17875:320;;;17401:804;;;:::o;18209:635::-;18344:18;18365:53;18373:12;18365:53;;;;;;;;;;;;;;;;;:7;:53::i;:::-;18344:74;;18443:1;18428:12;:16;;;:84;;;;-1:-1:-1;;;;;;18448:31:18;;;;;;:20;:31;;;;;;;;:64;-1:-1:-1;;18480:16:18;;18448:49;;;;;;;;;;:64;;;:49;;:64;18428:84;18424:353;;;-1:-1:-1;;;;;18522:27:18;;;;;;:16;:27;;;;;;;;-1:-1:-1;;18550:16:18;;18522:45;;;;;;;;;:56;;-1:-1:-1;;;;;;18522:56:18;-1:-1:-1;;;;;18522:56:18;;;;;18424:353;;;-1:-1:-1;;;;;18599:31:18;;;;;;:20;:31;;;;;;;;:45;;;;;;;;;;;;;:59;;-1:-1:-1;;18599:59:18;;;;;;;;;;18666:27;;;:16;:27;;;;;:41;;;;;;;;;:52;;-1:-1:-1;;;;;;18666:52:18;-1:-1:-1;;;;;18666:52:18;;;;;18726:25;;;:14;:25;;;;;;:44;;;;;-1:-1:-1;18754:16:18;;18726:44;;;;;;;;;18424:353;18788:51;;;-1:-1:-1;;;;;18788:51:18;;;;;;;;;;;;;-1:-1:-1;;;;;18788:51:18;;;;;;;;;;;18209:635;;;;;:::o;18848:152::-;18927:6;18960:12;18953:5;18949:9;;18941:32;;;;-1:-1:-1;;;18941:32:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;:::o
Swarm Source
ipfs://1cc059d2ef53f5fb8f539eb1d6c722d3502b59f1e57bb5d830689cfc60f1a6f9
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.