file_name
stringlengths
71
779k
comments
stringlengths
20
182k
code_string
stringlengths
20
36.9M
__index_level_0__
int64
0
17.2M
input_ids
sequence
attention_mask
sequence
labels
sequence
pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; import "../../Vault/Utils/Address.sol"; import "../../Vault/Utils/SafeBEP20.sol"; import "../../Vault/Utils/IBEP20.sol"; import "../../Vault/Utils/ReentrancyGuard.sol"; import "./XVSVaultStrategyProxy.sol"; import "./XVSVaultStrategyStorage.sol"; // This contract acts as a wrapper for user wallet interaction with the XVS Vault contract XVSVault is XVSVaultItemStorage, ReentrancyGuard { using SafeMath for uint256; using SafeBEP20 for IBEP20; using Address for address; modifier onlyAdminVault() { require(msg.sender == adminVault, "only admin vault can"); _; } modifier onlyAdmin() { require(msg.sender == admin, "only admin can"); _; } function deposit(uint256 amount) external nonReentrant onlyAdminVault { IBEP20(xvs).approve(xvsVault, 2**256 - 1); IXVSVault(xvsVault).deposit(xvs, pid, amount); } function requestWithdrawal(uint256 amount) external nonReentrant onlyAdminVault { IXVSVault(xvsVault).requestWithdrawal(xvs, pid, amount); } function claimRewards(address _userAddress) external nonReentrant onlyAdminVault { IXVSVault(xvsVault).deposit(xvs, pid, 0); // Transfer claimed XVS to the user wallet IBEP20(xvs).safeTransferFrom(address(this), _userAddress, IBEP20(xvs).balanceOf(address(this))); } function compoundRewards() external nonReentrant onlyAdminVault { // claim the pending rewards IXVSVault(xvsVault).deposit(xvs, pid, 0); // deposit the claimed rewards back to the XVS Vault IXVSVault(xvsVault).deposit(xvs, pid, IBEP20(xvs).balanceOf(address(this))); } function executeWithdrawal(address _userAddress) external nonReentrant onlyAdminVault { IXVSVault(xvsVault).executeWithdrawal(xvs, pid); // Transfer XVS to user wallet IBEP20(xvs).safeTransferFrom(address(this), _userAddress, IBEP20(xvs).balanceOf(address(this))); } /*** Admin Functions ***/ function _become(XVSVaultStrategyProxy xvsVaultStrategyProxy) public { require(msg.sender == xvsVaultStrategyProxy.admin(), "only proxy admin can change brains"); xvsVaultStrategyProxy._acceptImplementation(); } // Only allow to set the admin vault once. function setAdminVault(address _adminVault) external nonReentrant { require(_adminVault != address(0), "Zero address"); require(_adminVault.isContract(), "call to non-XVSVaultStrategy contract"); require(adminVault == address(0), "Admin vault is already set"); adminVault = _adminVault; } function emergencyWithdraw() external nonReentrant onlyAdmin { uint256 eligibleWithdrawalAmount = IXVSVault(xvsVault).getEligibleWithdrawalAmount(xvs, pid, address(this)); if (eligibleWithdrawalAmount > 0) { // Transfer the staked XVS from user vault contract to the user wallet IXVSVault(xvsVault).executeWithdrawal(xvs, pid); } // calculate the current available amount which is not yet requested to be withdrawn (uint256 amount, , uint256 pendingWithdrawals) = IXVSVault(xvsVault).getUserInfo(xvs, pid, address(this)); uint256 stakeAmount = amount.sub(pendingWithdrawals); if (stakeAmount > 0) { IXVSVault(xvsVault).requestWithdrawal(xvs, pid, stakeAmount); } // Transfer XVS to admin wallet IBEP20(xvs).safeTransferFrom(address(this), admin, IBEP20(xvs).balanceOf(address(this))); } }
Transfer XVS to user wallet
function executeWithdrawal(address _userAddress) external nonReentrant onlyAdminVault { IXVSVault(xvsVault).executeWithdrawal(xvs, pid); IBEP20(xvs).safeTransferFrom(address(this), _userAddress, IBEP20(xvs).balanceOf(address(this))); }
2,492,535
[ 1, 4625, 348, 7953, 560, 30, 225, 12279, 1139, 14640, 358, 729, 9230, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 1836, 1190, 9446, 287, 12, 2867, 389, 1355, 1887, 13, 3903, 1661, 426, 8230, 970, 1338, 4446, 12003, 288, 203, 3639, 467, 60, 14640, 12003, 12, 92, 6904, 12003, 2934, 8837, 1190, 9446, 287, 12, 92, 6904, 16, 4231, 1769, 203, 203, 3639, 467, 5948, 52, 3462, 12, 92, 6904, 2934, 4626, 5912, 1265, 12, 2867, 12, 2211, 3631, 389, 1355, 1887, 16, 467, 5948, 52, 3462, 12, 92, 6904, 2934, 12296, 951, 12, 2867, 12, 2211, 3719, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/1/0x130F2Bd05f45E44D01B83bF05AEd31CE9533097A/sources/project_/contracts/Waves.sol
Traits rarities (normal distribution)Grid sizeEllipse sizeWave speedVariation
constructor() ERC721A("Gen Waves", "WVS") { rarities = [ 0, 75, 125, 175, 225, 175, 125, 75, 25 ]; traitValues[0] = ['0', '18', '20', '22', '24', '26', '28', '30', '32']; traitValues[1] = ['0', '5', '7', '9', '11', '13', '15', '17', '19']; traitValues[2] = ['0.00', '0.005', '0.007', '0.008' , '0.009', '0.01', '0.011', '0.012', '0.014']; traitValues[3] = ['0', '180', '100', '69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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 3885, 1435, 4232, 39, 27, 5340, 37, 2932, 7642, 678, 6606, 3113, 315, 59, 14640, 7923, 288, 203, 3639, 436, 297, 1961, 273, 306, 203, 5411, 374, 16, 203, 5411, 18821, 16, 203, 5411, 30616, 16, 203, 5411, 404, 5877, 16, 203, 5411, 28298, 16, 203, 5411, 404, 5877, 16, 203, 5411, 30616, 16, 203, 5411, 18821, 16, 203, 5411, 6969, 203, 3639, 308, 31, 203, 203, 3639, 13517, 1972, 63, 20, 65, 273, 10228, 20, 2187, 296, 2643, 2187, 296, 3462, 2187, 296, 3787, 2187, 296, 3247, 2187, 296, 5558, 2187, 296, 6030, 2187, 296, 5082, 2187, 296, 1578, 3546, 31, 203, 203, 3639, 13517, 1972, 63, 21, 65, 273, 10228, 20, 2187, 296, 25, 2187, 296, 27, 2187, 296, 29, 2187, 296, 2499, 2187, 296, 3437, 2187, 296, 3600, 2187, 296, 4033, 2187, 296, 3657, 3546, 31, 203, 203, 3639, 13517, 1972, 63, 22, 65, 273, 10228, 20, 18, 713, 2187, 296, 20, 18, 28564, 2187, 296, 20, 18, 713, 27, 2187, 296, 20, 18, 713, 28, 11, 269, 296, 20, 18, 713, 29, 2187, 296, 20, 18, 1611, 2187, 296, 20, 18, 1611, 21, 2187, 296, 20, 18, 1611, 22, 2187, 296, 20, 18, 1611, 24, 3546, 31, 203, 203, 3639, 13517, 1972, 63, 23, 65, 273, 10228, 20, 2187, 296, 18278, 2187, 296, 6625, 2187, 296, 8148, 11, 269, 296, 7950, 2187, 296, 7950, 2187, 296, 8148, 2187, 296, 6625, 2187, 296, 29751, 3546, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.4.11; import "./HTLCBase.sol"; import "./StoremanGroupAdminInterface.sol"; import "./WTokenManagerInterface.sol"; contract HTLCWETH is HTLCBase { /** * * VARIABLES * */ /// @notice weth manager address address public wethManager; /// @notice storeman group admin address address public storemanGroupAdmin; /// @notice transaction fee mapping(bytes32 => uint) public mapXHashFee; /// @notice token index of WETH uint public constant ETH_INDEX = 0; /** * * EVENTS * **/ /// @notice event of exchange WETH with ETH request /// @param storeman address of storeman /// @param wanAddr address of wanchain, used to receive WETH /// @param xHash hash of HTLC random number /// @param value HTLC value event ETH2WETHLock(address indexed storeman, address indexed wanAddr, bytes32 indexed xHash, uint value); /// @notice event of refund WETH from exchange WETH with ETH HTLC transaction /// @param wanAddr address of user on wanchain, used to receive WETH /// @param storeman address of storeman, the WETH minter /// @param xHash hash of HTLC random number /// @param x HTLC random number event ETH2WETHRefund(address indexed wanAddr, address indexed storeman, bytes32 indexed xHash, bytes32 x); /// @notice event of revoke exchange WETH with ETH HTLC transaction /// @param storeman address of storeman /// @param xHash hash of HTLC random number event ETH2WETHRevoke(address indexed storeman, bytes32 indexed xHash); /// @notice event of exchange ETH with WETH request /// @param wanAddr address of user, where the WETH come from /// @param storeman address of storeman, where the ETH come from /// @param xHash hash of HTLC random number /// @param value exchange value /// @param ethAddr address of ethereum, used to receive ETH /// @param fee exchange fee event WETH2ETHLock(address indexed wanAddr, address indexed storeman, bytes32 indexed xHash, uint value, address ethAddr, uint fee); /// @notice event of refund WETH from exchange ETH with WETH HTLC transaction /// @param storeman address of storeman, used to receive WETH /// @param wanAddr address of user, where the WETH come from /// @param xHash hash of HTLC random number /// @param x HTLC random number event WETH2ETHRefund(address indexed storeman, address indexed wanAddr, bytes32 indexed xHash, bytes32 x); /// @notice event of revoke exchange ETH with WETH HTLC transaction /// @param wanAddr address of user /// @param xHash hash of HTLC random number event WETH2ETHRevoke(address indexed wanAddr, bytes32 indexed xHash); /** * * MODIFIERS * */ /// @dev Check WETHManager address must be initialized before call its method modifier initialized() { require(wethManager != address(0)); require(storemanGroupAdmin != address(0)); _; } /** * * MANIPULATIONS * */ /// @notice set weth manager SC address(only owner have the right) /// @param addr weth manager SC address function setWETHManager(address addr) public onlyOwner isHalted returns (bool) { require(addr != address(0)); wethManager = addr; return true; } /// @notice set storeman group admin SC address(only owner have the right) /// @param addr storeman group admin SC address function setStoremanGroupAdmin(address addr) public onlyOwner isHalted returns (bool) { require(addr != address(0)); storemanGroupAdmin = addr; return true; } /// @notice request exchange WETH with ETH(to prevent collision, x must be a 256bit random bigint) /// @param xHash hash of HTLC random number /// @param wanAddr address of user, used to receive WETH /// @param value exchange value function eth2wethLock(bytes32 xHash, address wanAddr, uint value) public initialized notHalted returns(bool) { addHTLCTx(TxDirection.Coin2Wtoken, msg.sender, wanAddr, xHash, value, false, address(0x00)); if (!WTokenManagerInterface(wethManager).lockQuota(msg.sender, wanAddr, value)) { revert(); } emit ETH2WETHLock(msg.sender, wanAddr, xHash, value); return true; } /// @notice refund WETH from the HTLC transaction of exchange WETH with ETH(must be called before HTLC timeout) /// @param x HTLC random number function eth2wethRefund(bytes32 x) public initialized notHalted returns(bool) { bytes32 xHash = keccak256(x); refundHTLCTx(xHash, TxDirection.Coin2Wtoken); HTLCTx storage info = mapXHashHTLCTxs[xHash]; if (!WTokenManagerInterface(wethManager).mintToken(info.source, info.destination, info.value)) { revert(); } emit ETH2WETHRefund(info.destination, info.source, xHash, x); return true; } /// @notice revoke HTLC transaction of exchange WETH with ETH(must be called after HTLC timeout) /// @param xHash hash of HTLC random number function eth2wethRevoke(bytes32 xHash) public initialized notHalted returns(bool) { revokeHTLCTx(xHash, TxDirection.Coin2Wtoken, false); HTLCTx storage info = mapXHashHTLCTxs[xHash]; if (!WTokenManagerInterface(wethManager).unlockQuota(info.source, info.value)) { revert(); } emit ETH2WETHRevoke(info.source, xHash); return true; } /// @notice request exchange ETH with WETH(to prevent collision, x must be a 256bit random bigint) /// @param xHash hash of HTLC random number /// @param storeman address of storeman, where the ETH come from /// @param ethAddr address of ethereum, used to receive ETH /// @param value exchange value function weth2ethLock(bytes32 xHash, address storeman, address ethAddr, uint value) public initialized notHalted payable returns(bool) { require(!isContract(msg.sender)); // check withdraw fee uint fee = getWeth2EthFee(storeman, value); require(msg.value >= fee); addHTLCTx(TxDirection.Wtoken2Coin, msg.sender, storeman, xHash, value, true, ethAddr); if (!WTokenManagerInterface(wethManager).lockToken(storeman, msg.sender, value)) { revert(); } mapXHashFee[xHash] = fee; // restore the extra cost uint left = msg.value.sub(fee); if (left != 0) { msg.sender.transfer(left); } emit WETH2ETHLock(msg.sender, storeman, xHash, value, ethAddr, fee); return true; } /// @notice refund WETH from the HTLC transaction of exchange ETH with WETH(must be called before HTLC timeout) /// @param x HTLC random number function weth2ethRefund(bytes32 x) public initialized notHalted returns(bool) { bytes32 xHash = keccak256(x); refundHTLCTx(xHash, TxDirection.Wtoken2Coin); HTLCTx storage info = mapXHashHTLCTxs[xHash]; if (!WTokenManagerInterface(wethManager).burnToken(info.destination, info.value)) { revert(); } info.destination.transfer(mapXHashFee[xHash]); emit WETH2ETHRefund(info.destination, info.source, xHash, x); return true; } /// @notice revoke HTLC transaction of exchange ETH with WETH(must be called after HTLC timeout) /// @notice the revoking fee will be sent to storeman /// @param xHash hash of HTLC random number function weth2ethRevoke(bytes32 xHash) public initialized notHalted returns(bool) { revokeHTLCTx(xHash, TxDirection.Wtoken2Coin, true); HTLCTx storage info = mapXHashHTLCTxs[xHash]; if (!WTokenManagerInterface(wethManager).unlockToken(info.destination, info.source, info.value)) { revert(); } uint revokeFee = mapXHashFee[xHash].mul(revokeFeeRatio).div(RATIO_PRECISE); uint left = mapXHashFee[xHash].sub(revokeFee); if (revokeFee > 0) { info.destination.transfer(revokeFee); } if (left > 0) { info.source.transfer(left); } emit WETH2ETHRevoke(info.source, xHash); return true; } /// @notice getting weth 2 eth fee /// @param storeman address of storeman /// @param value HTLC tx value /// @return needful fee function getWeth2EthFee(address storeman, uint value) public view returns(uint) { StoremanGroupAdminInterface smga = StoremanGroupAdminInterface(storemanGroupAdmin); uint defaultPrecise = smga.DEFAULT_PRECISE(); var (coin2WanRatio,,,,,,,,,,,) = smga.mapCoinInfo(ETH_INDEX); var (,,,txFeeratio,,,) = smga.mapCoinSmgInfo(ETH_INDEX, storeman); return value.mul(coin2WanRatio).mul(txFeeratio).div(defaultPrecise).div(defaultPrecise); } /// @notice internal function to determine if an address is a contract /// @param addr the address being queried /// @return true if `addr` is a contract function isContract(address addr) internal view returns(bool) { uint size; if (addr == 0) return false; assembly { size := extcodesize(addr) } return size > 0; } }
@notice internal function to determine if an address is a contract @param addr the address being queried @return true if `addr` is a contract
function isContract(address addr) internal view returns(bool) { uint size; if (addr == 0) return false; assembly { size := extcodesize(addr) } return size > 0; }
5,389,619
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 20392, 1377, 2713, 445, 358, 4199, 309, 392, 1758, 353, 279, 6835, 632, 891, 225, 3091, 326, 1758, 3832, 23264, 632, 2463, 1377, 638, 309, 1375, 4793, 68, 353, 279, 6835, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 353, 8924, 12, 2867, 3091, 13, 7010, 3639, 2713, 7010, 3639, 1476, 7010, 3639, 1135, 12, 6430, 13, 7010, 565, 288, 203, 3639, 2254, 963, 31, 203, 3639, 309, 261, 4793, 422, 374, 13, 327, 629, 31, 203, 3639, 19931, 288, 203, 5411, 963, 519, 1110, 7000, 554, 12, 4793, 13, 203, 3639, 289, 203, 540, 203, 3639, 327, 963, 405, 374, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; import {CrowdfundProxy} from "./CrowdfundProxy.sol"; import {CrowdfundLogic} from "./CrowdfundLogic.sol"; import {ICrowdfund} from "./interface/ICrowdfund.sol"; import {ITributaryRegistry} from "../../../interface/ITributaryRegistry.sol"; import {Governable} from "../../../lib/Governable.sol"; /** * @title CrowdfundFactory * @author MirrorXYZ */ contract CrowdfundFactory is Governable { //======== Structs ======== struct Parameters { address payable fundingRecipient; uint256 fundingCap; uint256 operatorPercent; uint256 feePercentage; } //======== Events ======== event CrowdfundDeployed( address crowdfundProxy, string name, string symbol, address operator ); event Upgraded(address indexed implementation); //======== Configuration storage ========= /* Updatable via governance */ address public logic; address public tributaryRegistry; address public treasuryConfig; uint256 public minFeePercentage = 250; //======== Runtime mutable storage ========= // Gets set within the block, and then deleted. Parameters public parameters; //======== Constructor ========= constructor( address owner_, address logic_, address tributaryRegistry_, address treasuryConfig_ ) Governable(owner_) { logic = logic_; tributaryRegistry = tributaryRegistry_; treasuryConfig = treasuryConfig_; } //======== Configuration ========= function setMinimumFeePercentage(uint256 newMinFeePercentage) public onlyGovernance { minFeePercentage = newMinFeePercentage; } function setLogic(address newLogic) public onlyGovernance { logic = newLogic; } function setTreasuryConfig(address newTreasuryConfig) public onlyGovernance { treasuryConfig = newTreasuryConfig; } function setTributaryRegistry(address newTributaryRegistry) public onlyGovernance { tributaryRegistry = newTributaryRegistry; } //======== Deploy function ========= struct TributaryConfig { address tributary; uint256 feePercentage; } function createCrowdfund( TributaryConfig calldata tributaryConfig, string calldata name_, string calldata symbol_, address payable operator_, address payable fundingRecipient_, uint256 fundingCap_, uint256 operatorPercent_ ) external returns (address crowdfundProxy) { require( tributaryConfig.feePercentage >= minFeePercentage, "fee is too low" ); parameters = Parameters({ fundingRecipient: fundingRecipient_, fundingCap: fundingCap_, operatorPercent: operatorPercent_, feePercentage: tributaryConfig.feePercentage }); crowdfundProxy = address( new CrowdfundProxy{salt: keccak256(abi.encode(symbol_, operator_))}( treasuryConfig, operator_, name_, symbol_ ) ); delete parameters; emit CrowdfundDeployed(crowdfundProxy, name_, symbol_, operator_); ITributaryRegistry(tributaryRegistry).registerTributary( crowdfundProxy, tributaryConfig.tributary ); } } // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; import {CrowdfundStorage} from "./CrowdfundStorage.sol"; import {ERC20Storage} from "../../../external/ERC20Storage.sol"; import {IERC20Events} from "../../../external/interface/IERC20.sol"; interface ICrowdfundFactory { function mediaAddress() external returns (address); function logic() external returns (address); // ERC20 data. function parameters() external returns ( address payable fundingRecipient, uint256 fundingCap, uint256 operatorPercent, uint256 feePercentage ); } /** * @title CrowdfundProxy * @author MirrorXYZ */ contract CrowdfundProxy is CrowdfundStorage, ERC20Storage, IERC20Events { event Upgraded(address indexed implementation); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; constructor( address treasuryConfig_, address payable operator_, string memory name_, string memory symbol_ ) ERC20Storage(name_, symbol_) { address logic = ICrowdfundFactory(msg.sender).logic(); assembly { sstore(_IMPLEMENTATION_SLOT, logic) } emit Upgraded(logic); // Crowdfund-specific data. ( fundingRecipient, fundingCap, operatorPercent, feePercentage ) = ICrowdfundFactory(msg.sender).parameters(); operator = operator_; treasuryConfig = treasuryConfig_; // Initialize mutable storage. status = Status.FUNDING; } /// @notice Get current logic function logic() external view returns (address logic_) { assembly { logic_ := sload(_IMPLEMENTATION_SLOT) } } fallback() external payable { assembly { let ptr := mload(0x40) calldatacopy(ptr, 0, calldatasize()) let result := delegatecall( gas(), sload(_IMPLEMENTATION_SLOT), ptr, calldatasize(), 0, 0 ) let size := returndatasize() returndatacopy(ptr, 0, size) switch result case 0 { revert(ptr, size) } default { return(ptr, size) } } } receive() external payable {} } // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; import {CrowdfundStorage} from "./CrowdfundStorage.sol"; import {ERC20} from "../../../external/ERC20.sol"; import {ICrowdfund} from "./interface/ICrowdfund.sol"; import {ITreasuryConfig} from "../../../interface/ITreasuryConfig.sol"; /** * @title CrowdfundLogic * @author MirrorXYZ * * Crowdfund issuing ERC20 tokens that can be redeemed for * the Ether in the contract once funding closes. */ contract CrowdfundLogic is CrowdfundStorage, ERC20 { // ============ Events ============ event Contribution(address contributor, uint256 amount); event FundingClosed(uint256 amountRaised, uint256 creatorAllocation); event BidAccepted(uint256 amount); event Redeemed(address contributor, uint256 amount); event Withdrawal(uint256 amount, uint256 fee); // ============ Modifiers ============ /** * @dev Modifier to check whether the `msg.sender` is the operator. * If it is, it will run the function. Otherwise, it will revert. */ modifier onlyOperator() { require(msg.sender == operator); _; } modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(reentrancy_status != REENTRANCY_ENTERED, "Reentrant call"); // Any calls to nonReentrant after this point will fail reentrancy_status = REENTRANCY_ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) reentrancy_status = REENTRANCY_NOT_ENTERED; } // ============ Crowdfunding Methods ============ /** * @notice Mints tokens for the sender propotional to the * amount of ETH sent in the transaction. * @dev Emits the Contribution event. */ function contribute(address payable backer, uint256 amount) external payable nonReentrant { _contribute(backer, amount); } /** * @notice Burns the sender's tokens and redeems underlying ETH. * @dev Emits the Redeemed event. */ function redeem(uint256 tokenAmount) external nonReentrant { // Prevent backers from accidently redeeming when balance is 0. require( address(this).balance > 0, "Crowdfund: No ETH available to redeem" ); // Check require( balanceOf[msg.sender] >= tokenAmount, "Crowdfund: Insufficient balance" ); require(status == Status.TRADING, "Crowdfund: Funding must be trading"); // Effect uint256 redeemable = redeemableFromTokens(tokenAmount); _burn(msg.sender, tokenAmount); // Safe version of transfer. sendValue(payable(msg.sender), redeemable); emit Redeemed(msg.sender, redeemable); } /** * @notice Returns the amount of ETH that is redeemable for tokenAmount. */ function redeemableFromTokens(uint256 tokenAmount) public view returns (uint256) { return (tokenAmount * address(this).balance) / totalSupply; } function valueToTokens(uint256 value) public pure returns (uint256 tokens) { tokens = value * TOKEN_SCALE; } function tokensToValue(uint256 tokenAmount) internal pure returns (uint256 value) { value = tokenAmount / TOKEN_SCALE; } // ============ Operator Methods ============ /** * @notice Transfers all funds to operator, and mints tokens for the operator. * Updates status to TRADING. * @dev Emits the FundingClosed event. */ function closeFunding() external onlyOperator nonReentrant { require(status == Status.FUNDING, "Crowdfund: Funding must be open"); // Close funding status, move to tradable. status = Status.TRADING; // Mint the operator a percent of the total supply. uint256 operatorTokens = (operatorPercent * totalSupply) / (100 - operatorPercent); _mint(operator, operatorTokens); // Announce that funding has been closed. emit FundingClosed(address(this).balance, operatorTokens); _withdraw(); } /** * @notice Operator can change the funding recipient. */ function changeFundingRecipient(address payable newFundingRecipient) public onlyOperator { fundingRecipient = newFundingRecipient; } function withdraw() public { _withdraw(); } function computeFee(uint256 amount, uint256 feePercentage_) public pure returns (uint256 fee) { fee = (feePercentage_ * amount) / (100 * 100); } // ============ Utility Methods ============ function sendValue(address payable recipient, uint256 amount) internal { require( address(this).balance >= amount, "Address: insufficient balance" ); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{value: amount}(""); require( success, "Address: unable to send value, recipient may have reverted" ); } // ============ Internal Methods ============ function _contribute(address payable backer, uint256 amount) private { require(status == Status.FUNDING, "Crowdfund: Funding must be open"); require(amount == msg.value, "Crowdfund: Amount is not value sent"); // This first case is the happy path, so we will keep it efficient. // The balance, which includes the current contribution, is less than or equal to cap. if (address(this).balance <= fundingCap) { // Mint equity for the contributor. _mint(backer, valueToTokens(amount)); emit Contribution(backer, amount); } else { // Compute the balance of the crowdfund before the contribution was made. uint256 startAmount = address(this).balance - amount; // If that amount was already greater than the funding cap, then we should revert immediately. require( startAmount < fundingCap, "Crowdfund: Funding cap already reached" ); // Otherwise, the contribution helped us reach the funding cap. We should // take what we can until the funding cap is reached, and refund the rest. uint256 eligibleAmount = fundingCap - startAmount; // Otherwise, we process the contribution as if it were the minimal amount. _mint(backer, valueToTokens(eligibleAmount)); emit Contribution(backer, eligibleAmount); // Refund the sender with their contribution (e.g. 2.5 minus the diff - e.g. 1.5 = 1 ETH) sendValue(backer, amount - eligibleAmount); } } function _withdraw() internal { uint256 fee = feePercentage; emit Withdrawal( address(this).balance, computeFee(address(this).balance, fee) ); // Transfer the fee to the treasury. sendValue( ITreasuryConfig(treasuryConfig).treasury(), computeFee(address(this).balance, fee) ); // Transfer available balance to the fundingRecipient. sendValue(fundingRecipient, address(this).balance); } } // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; interface ICrowdfund { struct Edition { // The maximum number of tokens that can be sold. uint256 quantity; // The price at which each token will be sold, in ETH. uint256 price; // The account that will receive sales revenue. address payable fundingRecipient; // The number of tokens sold so far. uint256 numSold; bytes32 contentHash; } struct EditionTier { // The maximum number of tokens that can be sold. uint256 quantity; // The price at which each token will be sold, in ETH. uint256 price; bytes32 contentHash; } function buyEdition(uint256 editionId, address recipient) external payable returns (uint256 tokenId); function editionPrice(uint256 editionId) external view returns (uint256); function createEditions( EditionTier[] memory tier, // The account that should receive the revenue. address payable fundingRecipient, address minter ) external; function contractURI() external view returns (string memory); } // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; interface ITributaryRegistry { function addRegistrar(address registrar) external; function removeRegistrar(address registrar) external; function addSingletonProducer(address producer) external; function removeSingletonProducer(address producer) external; function registerTributary(address producer, address tributary) external; function producerToTributary(address producer) external returns (address tributary); function singletonProducer(address producer) external returns (bool); function changeTributary(address producer, address newTributary) external; } // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; import {Ownable} from "../lib/Ownable.sol"; import {IGovernable} from "../lib/interface/IGovernable.sol"; contract Governable is Ownable, IGovernable { // ============ Mutable Storage ============ // Mirror governance contract. address public override governor; // ============ Modifiers ============ modifier onlyGovernance() { require(isOwner() || isGovernor(), "caller is not governance"); _; } modifier onlyGovernor() { require(isGovernor(), "caller is not governor"); _; } // ============ Constructor ============ constructor(address owner_) Ownable(owner_) {} // ============ Administration ============ function changeGovernor(address governor_) public override onlyGovernance { governor = governor_; } // ============ Utility Functions ============ function isGovernor() public view override returns (bool) { return msg.sender == governor; } } // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; /** * @title CrowdfundStorage * @author MirrorXYZ */ contract CrowdfundStorage { /** * @notice The two states that this contract can exist in. * "FUNDING" allows contributors to add funds. */ enum Status { FUNDING, TRADING } // ============ Constants ============ /// @notice The factor by which ETH contributions will multiply into crowdfund tokens. uint16 internal constant TOKEN_SCALE = 1000; // ============ Reentrancy ============ /// @notice Reentrancy constants. uint256 internal constant REENTRANCY_NOT_ENTERED = 1; uint256 internal constant REENTRANCY_ENTERED = 2; /// @notice Current reentrancy status -- used by the modifier. uint256 internal reentrancy_status; /// @notice The operator has a special role to change contract status. address payable public operator; /// @notice Receives the funds when calling withdraw. Operator can configure. address payable public fundingRecipient; /// @notice Treasury configuration. address public treasuryConfig; /// @notice We add a hard cap to prevent raising more funds than deemed reasonable. uint256 public fundingCap; /// @notice Fee percentage that the crowdfund pays to the treasury. uint256 public feePercentage; /// @notice The operator takes some equity in the tokens, represented by this percent. uint256 public operatorPercent; // ============ Mutable Storage ============ /// @notice Represents the current state of the campaign. Status public status; } // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; /** * @title ERC20Storage * @author MirrorXYZ */ contract ERC20Storage { /// @notice EIP-20 token name for this token string public name; /// @notice EIP-20 token symbol for this token string public symbol; /// @notice EIP-20 total number of tokens in circulation uint256 public totalSupply; /// @notice Initialize total supply to zero. constructor(string memory name_, string memory symbol_) { name = name_; symbol = symbol_; totalSupply = 0; } } // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; interface IERC20 { /// @notice EIP-20 token name for this token function name() external returns (string calldata); /// @notice EIP-20 token symbol for this token function symbol() external returns (string calldata); /// @notice EIP-20 token decimals for this token function decimals() external returns (uint8); /// @notice EIP-20 total number of tokens in circulation function totalSupply() external returns (uint256); /// @notice EIP-20 official record of token balances for each account function balanceOf(address account) external returns (uint256); /// @notice EIP-20 allowance amounts on behalf of others function allowance(address owner, address spender) external returns (uint256); /// @notice EIP-20 approves _spender_ to transfer up to _value_ multiple times function approve(address spender, uint256 value) external returns (bool); /// @notice EIP-20 transfer _value_ to _to_ from _msg.sender_ function transfer(address to, uint256 value) external returns (bool); /// @notice EIP-20 transfer _value_ to _to_ from _from_ function transferFrom( address from, address to, uint256 value ) external returns (bool); } interface IERC20Events { /// @notice EIP-20 Mint event event Mint(address indexed to, uint256 amount); /// @notice EIP-20 approval event event Approval( address indexed from, address indexed spender, uint256 value ); /// @notice EIP-20 transfer event event Transfer(address indexed from, address indexed to, uint256 value); } // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; // import {ERC20Storage} from "./ERC20Storage.sol"; import {IERC20, IERC20Events} from "./interface/IERC20.sol"; /** * @title ERC20 Implementation. * @author MirrorXYZ */ contract ERC20 is IERC20, IERC20Events { // ============ ERC20 Attributes ============ /// @notice EIP-20 token name for this token string public override name; /// @notice EIP-20 token symbol for this token string public override symbol; /// @notice EIP-20 token decimals for this token uint8 public constant override decimals = 18; // ============ Mutable ERC20 Storage ============ /// @notice EIP-20 total number of tokens in circulation uint256 public override totalSupply; /// @notice EIP-20 official record of token balances for each account mapping(address => uint256) public override balanceOf; /// @notice EIP-20 allowance amounts on behalf of others mapping(address => mapping(address => uint256)) public override allowance; /** * @notice Initialize and assign total supply when using * proxy pattern. Only callable during contract deployment. * @param totalSupply_ is the initial token supply * @param to_ is the address that will hold the initial token supply */ function initialize(uint256 totalSupply_, address to_) external { // Ensure that this function is only callable during contract construction. assembly { if extcodesize(address()) { revert(0, 0) } } totalSupply = totalSupply_; balanceOf[to_] = totalSupply_; emit Transfer(address(0), to_, totalSupply_); } // ============ ERC20 Spec ============ /** * @dev Function to increase allowance of tokens. * @param spender The address that will receive an allowance increase. * @param value The amount of tokens to increase allowance. */ function approve(address spender, uint256 value) external override returns (bool) { _approve(msg.sender, spender, value); return true; } /** * @dev Function to transfer tokens. * @param to The address that will receive the tokens. * @param value The amount of tokens to transfer. */ function transfer(address to, uint256 value) external override returns (bool) { _transfer(msg.sender, to, value); return true; } /** * @dev Function to transfer an accounts tokens. Sender of txn must be approved. * @param from The address that will transfer tokens. * @param to The address that will receive the tokens. * @param value The amount of tokens to transfer. */ function transferFrom( address from, address to, uint256 value ) external override returns (bool) { require( allowance[from][msg.sender] >= value, "transfer amount exceeds spender allowance" ); allowance[from][msg.sender] = allowance[from][msg.sender] - value; _transfer(from, to, value); return true; } // ============ Private Utils ============ function _mint(address to, uint256 value) internal { totalSupply = totalSupply + value; balanceOf[to] = balanceOf[to] + value; emit Transfer(address(0), to, value); } function _burn(address from, uint256 value) internal { balanceOf[from] = balanceOf[from] - value; totalSupply = totalSupply - value; emit Transfer(from, address(0), value); } function _approve( address owner, address spender, uint256 value ) internal { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer( address from, address to, uint256 value ) internal { require(balanceOf[from] >= value, "transfer amount exceeds balance"); balanceOf[from] = balanceOf[from] - value; balanceOf[to] = balanceOf[to] + value; emit Transfer(from, to, value); } } // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; interface ITreasuryConfig { function treasury() external returns (address payable); function distributionModel() external returns (address); } // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; contract Ownable { address public owner; address private nextOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); // modifiers modifier onlyOwner() { require(isOwner(), "caller is not the owner."); _; } modifier onlyNextOwner() { require(isNextOwner(), "current owner must set caller as next owner."); _; } /** * @dev Initialize contract by setting transaction submitter as initial owner. */ constructor(address owner_) { owner = owner_; emit OwnershipTransferred(address(0), owner); } /** * @dev Initiate ownership transfer by setting nextOwner. */ function transferOwnership(address nextOwner_) external onlyOwner { require(nextOwner_ != address(0), "Next owner is the zero address."); nextOwner = nextOwner_; } /** * @dev Cancel ownership transfer by deleting nextOwner. */ function cancelOwnershipTransfer() external onlyOwner { delete nextOwner; } /** * @dev Accepts ownership transfer by setting owner. */ function acceptOwnership() external onlyNextOwner { delete nextOwner; owner = msg.sender; emit OwnershipTransferred(owner, msg.sender); } /** * @dev Renounce ownership by setting owner to zero address. */ function renounceOwnership() external onlyOwner { owner = address(0); emit OwnershipTransferred(owner, address(0)); } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return msg.sender == owner; } /** * @dev Returns true if the caller is the next owner. */ function isNextOwner() public view returns (bool) { return msg.sender == nextOwner; } } // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.6; interface IGovernable { function changeGovernor(address governor_) external; function isGovernor() external view returns (bool); function governor() external view returns (address); }
* @notice Mints tokens for the sender propotional to the amount of ETH sent in the transaction. @dev Emits the Contribution event./
function contribute(address payable backer, uint256 amount) external payable nonReentrant { _contribute(backer, amount); }
6,307,283
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 20392, 490, 28142, 2430, 364, 326, 5793, 2270, 8240, 287, 358, 326, 225, 3844, 434, 512, 2455, 3271, 316, 326, 2492, 18, 632, 5206, 7377, 1282, 326, 735, 4027, 871, 18, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 356, 887, 12, 2867, 8843, 429, 1473, 264, 16, 2254, 5034, 3844, 13, 203, 3639, 3903, 203, 3639, 8843, 429, 203, 3639, 1661, 426, 8230, 970, 203, 565, 288, 203, 3639, 389, 591, 887, 12, 823, 264, 16, 3844, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
/* * Copyright 2020, NTT Communications Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // SPDX-License-Identifier: Apache-2.0 pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/token/ERC777/IERC777.sol"; import "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol"; import "@openzeppelin/contracts/utils/introspection/IERC1820Registry.sol"; import "@openzeppelin/contracts/utils/introspection/ERC1820Implementer.sol"; import "./MetemcyberUtil.sol"; import {CTIToken, CTIToken_ContractId} from "./CTIToken.sol"; string constant CTIOperator_ContractId = "CTIOperator.sol:CTIOperator"; contract CTIOperator is IERC777Recipient, ERC1820Implementer { event TokensReceivedCalled( address from, bytes data, address token, uint256 taskId ); event TaskAccepted( address operator, uint256 taskId, address token ); event TaskFinished( address operator, uint256 taskId, address token ); enum TaskState { Pending, Accepted, Finished, Cancelled } struct Task { uint256 taskId; address token; address solver; address seeker; TaskState state; } string public constant contractId = CTIOperator_ContractId; uint256 public constant contractVersion = 2; IERC1820Registry private _erc1820 = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24); bytes32 constant private _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient"); Task[] private _tasks; bytes[] private _userData; mapping (address => address[]) private _tokens; // solver => tokens function tokensReceived( address /*operator*/, address from, address /*to*/, uint256 /*amount*/, bytes calldata userData, bytes calldata /*operatorData*/ ) external override { IERC777 token = IERC777(msg.sender); // prepare for accepted(). uint256 taskId = _tasks.length; // zero-based taskId. _tasks.push(Task({ taskId: taskId, token: address(token), solver: address(0), seeker: from, state: TaskState.Pending }) ); _userData.push(userData); assert(_tasks.length == taskId + 1); assert(_userData.length == taskId + 1); emit TokensReceivedCalled( from, userData, address(token), taskId ); } function reemitPendingTasks(address[] memory tokens) public { for (uint i=0; i<_tasks.length; i++) { if (_tasks[i].state != TaskState.Pending) continue; for (uint j=0; j<tokens.length; j++) { if (_tasks[i].token == tokens[j]) { emit TokensReceivedCalled( _tasks[i].seeker, _userData[i], _tasks[i].token, _tasks[i].taskId ); break; } } } } function recipientFor(address account) public { _registerInterfaceForAddress( _TOKENS_RECIPIENT_INTERFACE_HASH, account); address self = address(this); if (account == self) { registerRecipient(self); } } function registerRecipient(address recipient) public { _erc1820.setInterfaceImplementer( address(this), _TOKENS_RECIPIENT_INTERFACE_HASH, recipient); } function _isRegistered( address token, address solver ) internal view returns (bool) { for (uint i = 0; i < _tokens[solver].length; i++) { if (_tokens[solver][i] == token) return true; } return false; } function listRegistered(address solver) public view returns(address[] memory) { uint count = 0; for (uint i = 0; i < _tokens[solver].length; i++) { if (_tokens[solver][i] != address(0)) count += 1; } address[] memory result = new address[](count); uint j = 0; for (uint i = 0; i < _tokens[solver].length; i++) { if (_tokens[solver][i] != address(0)) result[j++] = _tokens[solver][i]; } return result; } function register(address[] memory tokens) public { if (tokens.length == 0) return; for (uint i = 0; i < tokens.length; i++) { CTIToken token = CTIToken(tokens[i]); require( MetemcyberUtil.isSameStrings( token.contractId(), CTIToken_ContractId), "not a token address" ); require( token.isOperatorFor(msg.sender, token.publisher()), "not authorized" ); if (!_isRegistered(tokens[i], msg.sender)) { uint j = 0; for (j = 0; j < _tokens[msg.sender].length; j++) { if (_tokens[msg.sender][j] == address(0)) { _tokens[msg.sender][j] = tokens[i]; break; } } if (j == _tokens[msg.sender].length) _tokens[msg.sender].push(tokens[i]); } } } function unregister(address[] memory tokens) public { if (tokens.length == 0) return; for (uint i = 0; i < tokens.length; i++) { for (uint j = 0; j < _tokens[msg.sender].length; j++) { if (_tokens[msg.sender][j] == tokens[i]) { delete _tokens[msg.sender][j]; break; } } } } function checkRegistered( address[] memory tokens ) public view returns (bool[] memory) { bool[] memory result = new bool[](tokens.length); for (uint i = 0; i < tokens.length; i++) { for (uint j = 0; j < _tokens[msg.sender].length; j++) { if (_tokens[msg.sender][j] == tokens[i]) { result[i] = true; break; } } } return result; } function accepted(uint256 taskId) public { require(_tasks.length > taskId, "Invalid taskId."); require(_tasks[taskId].taskId == taskId, "Invalid taskId."); require(_tasks[taskId].solver == address(0), "Already accepted."); require( _isRegistered(_tasks[taskId].token, msg.sender), "Not registered." ); CTIToken token = CTIToken(_tasks[taskId].token); require( token.isOperatorFor(msg.sender, token.publisher()), "not authorized" ); _tasks[taskId].solver = msg.sender; _tasks[taskId].state = TaskState.Accepted; emit TaskAccepted( address(this), taskId, _tasks[taskId].token ); } function finish(uint256 taskId, string memory data) public { require(_tasks.length > taskId, "Invalid taskId"); require(_tasks[taskId].solver == msg.sender, "not task's solver"); // send token back to seeker IERC777 token = IERC777(_tasks[taskId].token); assert(token.balanceOf(address(this)) > 0); _tasks[taskId].state = TaskState.Finished; token.send(_tasks[taskId].seeker, 1, bytes(data)); delete _userData[taskId]; emit TaskFinished( address(this), taskId, _tasks[taskId].token ); } function cancelTask(uint256 taskId) public { require(_tasks.length > taskId, "Invalid taskId"); require(_tasks[taskId].seeker == msg.sender, "Not token sender"); require(_tasks[taskId].state == TaskState.Pending, "Not pending"); IERC777 token = IERC777(_tasks[taskId].token); assert(token.balanceOf(address(this)) > 0); _tasks[taskId].state = TaskState.Cancelled; token.send(_tasks[taskId].seeker, 1, ""); delete _userData[taskId]; emit TaskFinished( address(this), taskId, _tasks[taskId].token ); } function latest() external view returns (Task memory) { require(_tasks.length > 0, "No tasks"); return _tasks[_tasks.length-1]; } function history( address token, address seeker, uint limit, uint offset ) external view returns (Task[] memory) { require(limit > 0, "Specify more than 1"); if (_tasks.length == 0) return new Task[](0); // Use new keyword to create dynamic length array Task[] memory matchTasks = new Task[](limit); uint count = 0; for (uint i = _tasks.length; i > 0 && count < limit; i--) { if ((seeker == address(0) || _tasks[i - 1].seeker == seeker) && (token == address(0) || _tasks[i - 1].token == token)) { if (offset > 0) { offset--; continue; } matchTasks[count] = _tasks[i - 1]; count++; } } if (count < limit){ Task[] memory sliceTasks = new Task[](count); for (uint i = 0; i < count; i++) { sliceTasks[i] = matchTasks[i]; } return sliceTasks; } else { return matchTasks; } } }
prepare for accepted().
function tokensReceived( address /*operator*/, address from, address /*to*/, uint256 /*amount*/, bytes calldata userData, bytes calldata /*operatorData*/ ) external override { IERC777 token = IERC777(msg.sender); _tasks.push(Task({ taskId: taskId, token: address(token), solver: address(0), seeker: from, state: TaskState.Pending }) ); _userData.push(userData); assert(_tasks.length == taskId + 1); assert(_userData.length == taskId + 1); emit TokensReceivedCalled( from, userData, address(token), taskId ); }
15,847,500
[ 1, 4625, 348, 7953, 560, 30, 225, 2911, 364, 8494, 7675, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 2430, 8872, 12, 203, 3639, 1758, 1748, 9497, 5549, 16, 203, 3639, 1758, 628, 16, 203, 3639, 1758, 1748, 869, 5549, 16, 203, 3639, 2254, 5034, 1748, 8949, 5549, 16, 203, 3639, 1731, 745, 892, 13530, 16, 203, 3639, 1731, 745, 892, 1748, 9497, 751, 5549, 203, 565, 262, 3903, 3849, 288, 203, 203, 3639, 467, 654, 39, 14509, 1147, 273, 467, 654, 39, 14509, 12, 3576, 18, 15330, 1769, 203, 203, 3639, 389, 9416, 18, 6206, 12, 2174, 12590, 203, 7734, 15321, 30, 15321, 16, 203, 7734, 1147, 30, 1758, 12, 2316, 3631, 203, 7734, 12776, 30, 1758, 12, 20, 3631, 203, 7734, 6520, 264, 30, 628, 16, 203, 7734, 919, 30, 3837, 1119, 18, 8579, 203, 5411, 289, 13, 203, 3639, 11272, 203, 3639, 389, 1355, 751, 18, 6206, 12, 1355, 751, 1769, 203, 3639, 1815, 24899, 9416, 18, 2469, 422, 15321, 397, 404, 1769, 203, 3639, 1815, 24899, 1355, 751, 18, 2469, 422, 15321, 397, 404, 1769, 203, 203, 3639, 3626, 13899, 8872, 8185, 12, 203, 5411, 628, 16, 203, 5411, 13530, 16, 203, 5411, 1758, 12, 2316, 3631, 203, 5411, 15321, 203, 3639, 11272, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/5/0x2B0DDE58B91671E1216c59de7b27944D332cf601/sources/contracts/Contract.sol
The setAccess function allows users to set access controls for their data. Check that the user calling the function is the owner of the data. Set the access control for the specified user.
function setAccess(bytes32 _data, address _user, bool _access) public { require(msg.sender == dataOwners[_data], "Only the owner of the data can set access controls."); dataAccess[_data][_user] = _access; }
1,949,778
[ 1, 4625, 348, 7953, 560, 30, 225, 1021, 444, 1862, 445, 5360, 3677, 358, 444, 2006, 11022, 364, 3675, 501, 18, 2073, 716, 326, 729, 4440, 326, 445, 353, 326, 3410, 434, 326, 501, 18, 1000, 326, 2006, 3325, 364, 326, 1269, 729, 18, 2, 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3386, 326, 3410, 434, 326, 501, 848, 444, 2006, 11022, 1199, 1769, 203, 3639, 501, 1862, 63, 67, 892, 6362, 67, 1355, 65, 273, 389, 3860, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.4.23; import '../interfaces/StorageInterface.sol'; contract Proxy { // Registry storage address public proxy_admin; StorageInterface public app_storage; bytes32 public registry_exec_id; address public provider; bytes32 public app_name; // App storage bytes32 public app_version; bytes32 public app_exec_id; address public app_index; // Function selector for storage 'exec' function bytes4 internal constant EXEC_SEL = bytes4(keccak256('exec(address,bytes32,bytes)')); // Event emitted in case of a revert from storage event StorageException(bytes32 indexed execution_id, string message); // For storage refunds function () external payable { require(msg.sender == address(app_storage)); } // Constructor - sets proxy admin, as well as initial variables constructor (address _storage, bytes32 _registry_exec_id, address _provider, bytes32 _app_name) public { proxy_admin = msg.sender; app_storage = StorageInterface(_storage); registry_exec_id = _registry_exec_id; provider = _provider; app_name = _app_name; } // Declare abstract execution function - function exec(bytes _calldata) external payable returns (bool); // Checks to see if an error message was returned with the failed call, and emits it if so - function checkErrors() internal { // If the returned data begins with selector 'Error(string)', get the contained message - string memory message; bytes4 err_sel = bytes4(keccak256('Error(string)')); assembly { // Get pointer to free memory, place returned data at pointer, and update free memory pointer let ptr := mload(0x40) returndatacopy(ptr, 0, returndatasize) mstore(0x40, add(ptr, returndatasize)) // Check value at pointer for equality with Error selector - if eq(mload(ptr), and(err_sel, 0xffffffff00000000000000000000000000000000000000000000000000000000)) { message := add(0x24, ptr) } } // If no returned message exists, emit a default error message. Otherwise, emit the error message if (bytes(message).length == 0) emit StorageException(app_exec_id, "No error recieved"); else emit StorageException(app_exec_id, message); } // Returns the first 4 bytes of calldata function getSelector(bytes memory _calldata) internal pure returns (bytes4 selector) { assembly { selector := and( mload(add(0x20, _calldata)), 0xffffffff00000000000000000000000000000000000000000000000000000000 ) } } }
Returns the first 4 bytes of calldata
function getSelector(bytes memory _calldata) internal pure returns (bytes4 selector) { assembly { selector := and( mload(add(0x20, _calldata)), 0xffffffff00000000000000000000000000000000000000000000000000000000 ) } }
6,423,647
[ 1, 4625, 348, 7953, 560, 30, 225, 2860, 326, 1122, 1059, 1731, 434, 745, 892, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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389, 1991, 892, 13, 3631, 203, 3639, 374, 28857, 12648, 12648, 12648, 12648, 12648, 12648, 12648, 203, 1377, 262, 203, 565, 289, 203, 225, 289, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; // Contracts import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "../utils/Modifiers.sol"; // Libraries import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils/math/SafeCast.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import {LibERC721} from "../libraries/LibERC721.sol"; /// @title Nffeels Wojak Voting Token contract ERC721Facet is EIP712, Modifiers { using Counters for Counters.Counter; using Address for address; using Strings for uint256; constructor() EIP712("NffeelsWojak", "1") {} /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) { require( index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds" ); return LibERC721.erc721Storage().ownedTokens[owner][index]; } /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() public view returns (uint256) { return LibERC721.erc721Storage().allTokens.length; } /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) public view returns (uint256) { require( index < totalSupply(), "ERC721Enumerable: global index out of bounds" ); return LibERC721.erc721Storage().allTokens[index]; } /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) public view returns (uint256) { require( owner != address(0), "ERC721: balance query for the zero address" ); return LibERC721.erc721Storage().balances[owner]; } /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view returns (address) { return LibERC721.ownerOf(tokenId); } /** * @dev Returns the token collection name. */ function votingTokenName() public view returns (string memory) { return LibERC721.erc721Storage().name; } /** * @dev See {IGovernor-version}. */ function votingTokenVersion() public pure returns (string memory) { return "1"; } /** * @dev Returns the token collection symbol. */ function symbol() public view returns (string memory) { return LibERC721.erc721Storage().symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view returns (string memory) { require( LibERC721.exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); string memory _tokenURI = LibERC721.erc721Storage().tokenURIs[tokenId]; string memory baseURI = LibERC721.baseURI(); // If there is no base URI, return the token URI. if (bytes(baseURI).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(baseURI, _tokenURI)); } return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) public { address owner = LibERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( address(msg.sender) == owner || isApprovedForAll(owner, address(msg.sender)), "ERC721: approve caller is not owner nor approved for all" ); LibERC721.approve(to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view returns (address) { require( LibERC721.exists(tokenId), "ERC721: approved query for nonexistent token" ); return LibERC721.erc721Storage().tokenApprovals[tokenId]; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public { require(operator != address(msg.sender), "ERC721: approve to caller"); LibERC721.erc721Storage().operatorApprovals[address(msg.sender)][ operator ] = approved; emit LibERC721.ApprovalForAll( address(msg.sender), operator, approved ); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) public view returns (bool) { return LibERC721.erc721Storage().operatorApprovals[owner][operator]; } /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public { require( _isApprovedOrOwner(address(msg.sender), tokenId), "ERC721: transfer caller is not owner nor approved" ); LibERC721.transfer(from, to, tokenId); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public { safeTransferFrom(from, to, tokenId, ""); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public { require( _isApprovedOrOwner(address(msg.sender), tokenId), "ERC721: transfer caller is not owner nor approved" ); LibERC721.safeTransfer(from, to, tokenId, _data); } /* ERC721Voting */ /** * @dev Get the `pos`-th checkpoint for `account`. */ function checkpoints(address account, uint32 pos) public view returns (LibERC721.Checkpoint memory) { return LibERC721.erc721Storage().checkpoints[account][pos]; } /** * @dev Get number of checkpoints for `account`. */ function numCheckpoints(address account) public view returns (uint32) { return SafeCast.toUint32( LibERC721.erc721Storage().checkpoints[account].length ); } /** * @dev Get the address `account` is currently delegating to. */ function delegates(address account) public view returns (address) { return LibERC721.erc721Storage().delegates[account]; } /** * @dev Gets the current votes balance for `account` */ function getVotes(address account) public view returns (uint256) { uint256 pos = LibERC721.erc721Storage().checkpoints[account].length; return pos == 0 ? 0 : LibERC721.erc721Storage().checkpoints[account][pos - 1].votes; } /** * @dev Retrieve the number of votes for `account` at the end of `blockNumber`. * * Requirements: * * - `blockNumber` must have been already mined */ function getPastVotes(address account, uint256 blockNumber) public view returns (uint256) { return LibERC721.getPastVotes(account, blockNumber); } /** * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances. * It is but NOT the sum of all the delegated votes! * * Requirements: * * - `blockNumber` must have been already mined */ function getPastTotalSupply(uint256 blockNumber) public view returns (uint256) { return LibERC721.getPastTotalSupply(blockNumber); } /** * @dev Retrieve the `votingWeight` of a specified `account`. * It is but NOT the sum of all the delegated votes! * * Requirements: * * - `blockNumber` must have been already mined */ function getVotingWeightOf(address account) public view returns (uint256) { require( account != address(0), "ERC721Votes: voting weight query for the zero address" ); return LibERC721.erc721Storage().votingWeight[account]; } /** * @dev Delegate votes from the sender to `delegatee`. */ function delegate(address delegatee) public { return LibERC721.delegate(address(msg.sender), delegatee); } /** * @dev Delegates votes from signer to `delegatee` */ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) public { require(block.timestamp <= expiry, "ERC721Votes: signature expired"); address signer = ECDSA.recover( _hashTypedDataV4( keccak256( abi.encode( LibERC721.DELEGATION_TYPEHASH, delegatee, nonce, expiry ) ) ), v, r, s ); require( nonce == LibERC721.useNonce(signer), "ERC721Votes: invalid nonce" ); return LibERC721.delegate(signer, delegatee); } /* ERC721Permit */ /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public { require(block.timestamp <= deadline, "ERC721Permit: expired deadline"); bytes32 structHash = keccak256( abi.encode( LibERC721.PERMIT_TYPEHASH, owner, spender, tokenId, LibERC721.useNonce(owner), deadline ) ); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC721Permit: invalid signature"); LibERC721.approve(spender, tokenId); } /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) public view returns (uint256) { return LibERC721.erc721Storage().nonces[owner].current(); } /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ function DOMAIN_SEPARATOR() external view returns (bytes32) { return _domainSeparatorV4(); } /** * @dev Safely mints an erc721 and transfers it to `to`. * * Requirements: * * - Can only be called by contract owner. * - `_tokenURI`can optionally be added to specify a token URI. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeMint( address to, bool isUnique, string memory _tokenURI, string memory data ) public onlyGovernance { LibERC721.ERC721Storage storage erc721s = LibERC721.erc721Storage(); while (erc721s.isTokenIdReserved[erc721s.wojakIdCounter.current()]) { erc721s.wojakIdCounter.increment(); } LibERC721.safeMint(to, erc721s.wojakIdCounter.current(), isUnique); LibERC721.setTokenURI(erc721s.wojakIdCounter.current(), _tokenURI); LibERC721.setEventData(erc721s.wojakIdCounter.current(), data); erc721s.wojakIdCounter.increment(); } /* Facet helper functions */ /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) private view returns (bool) { require( LibERC721.exists(tokenId), "ERC721: operator query for nonexistent token" ); address owner = LibERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } }
* @dev Returns the token collection symbol./
function symbol() public view returns (string memory) { return LibERC721.erc721Storage().symbol; }
5,352,446
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 2860, 326, 1147, 1849, 3273, 18, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 3273, 1435, 1071, 1476, 1135, 261, 1080, 3778, 13, 288, 203, 3639, 327, 10560, 654, 39, 27, 5340, 18, 12610, 27, 5340, 3245, 7675, 7175, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity 0.4.24; // File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); event Transfer( address indexed from, address indexed to, uint256 value ); event Approval( address indexed owner, address indexed spender, uint256 value ); } // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on 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-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two numbers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0); // Solidity only automatically asserts when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two numbers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two numbers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md * Originally based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowed; uint256 private _totalSupply; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) public view returns (uint256) { return _balances[owner]; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address owner, address spender ) public view returns (uint256) { return _allowed[owner][spender]; } /** * @dev Transfer token for a specified address * @param to The address to transfer to. * @param value The amount to be transferred. */ function transfer(address to, uint256 value) public returns (bool) { require(value <= _balances[msg.sender]); require(to != address(0)); _balances[msg.sender] = _balances[msg.sender].sub(value); _balances[to] = _balances[to].add(value); emit Transfer(msg.sender, to, value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * 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 * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. */ function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } /** * @dev Transfer tokens from one address to another * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 the amount of tokens to be transferred */ function transferFrom( address from, address to, uint256 value ) public returns (bool) { require(value <= _balances[from]); require(value <= _allowed[from][msg.sender]); require(to != address(0)); _balances[from] = _balances[from].sub(value); _balances[to] = _balances[to].add(value); _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value); emit Transfer(from, to, value); return true; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param spender The address which will spend the funds. * @param addedValue The amount of tokens to increase the allowance by. */ function increaseAllowance( address spender, uint256 addedValue ) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = ( _allowed[msg.sender][spender].add(addedValue)); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed_[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param spender The address which will spend the funds. * @param subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseAllowance( address spender, uint256 subtractedValue ) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = ( _allowed[msg.sender][spender].sub(subtractedValue)); emit Approval(msg.sender, spender, _allowed[msg.sender][spender]); return true; } /** * @dev Internal function that mints an amount of the token and assigns it to * an account. This encapsulates the modification of balances such that the * proper events are emitted. * @param account The account that will receive the created tokens. * @param amount The amount that will be created. */ function _mint(address account, uint256 amount) internal { require(account != 0); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Internal function that burns an amount of the token of a given * account. * @param account The account whose tokens will be burnt. * @param amount The amount that will be burnt. */ function _burn(address account, uint256 amount) internal { require(account != 0); require(amount <= _balances[account]); _totalSupply = _totalSupply.sub(amount); _balances[account] = _balances[account].sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Internal function that burns an amount of the token of a given * account, deducting from the sender's allowance for said account. Uses the * internal burn function. * @param account The account whose tokens will be burnt. * @param amount The amount that will be burnt. */ function _burnFrom(address account, uint256 amount) internal { require(amount <= _allowed[account][msg.sender]); // Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted, // this function needs to emit an event with the updated approval. _allowed[account][msg.sender] = _allowed[account][msg.sender].sub( amount); _burn(account, amount); } } // File: openzeppelin-solidity/contracts/access/Roles.sol /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev give an account access to this role */ function add(Role storage role, address account) internal { require(account != address(0)); role.bearer[account] = true; } /** * @dev remove an account's access to this role */ function remove(Role storage role, address account) internal { require(account != address(0)); role.bearer[account] = false; } /** * @dev check if an account has this role * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0)); return role.bearer[account]; } } // File: openzeppelin-solidity/contracts/access/roles/MinterRole.sol contract MinterRole { using Roles for Roles.Role; event MinterAdded(address indexed account); event MinterRemoved(address indexed account); Roles.Role private minters; constructor() public { minters.add(msg.sender); } modifier onlyMinter() { require(isMinter(msg.sender)); _; } function isMinter(address account) public view returns (bool) { return minters.has(account); } function addMinter(address account) public onlyMinter { minters.add(account); emit MinterAdded(account); } function renounceMinter() public { minters.remove(msg.sender); } function _removeMinter(address account) internal { minters.remove(account); emit MinterRemoved(account); } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol /** * @title ERC20Mintable * @dev ERC20 minting logic */ contract ERC20Mintable is ERC20, MinterRole { event MintingFinished(); bool private _mintingFinished = false; modifier onlyBeforeMintingFinished() { require(!_mintingFinished); _; } /** * @return true if the minting is finished. */ function mintingFinished() public view returns(bool) { return _mintingFinished; } /** * @dev Function to mint tokens * @param to The address that will receive the minted tokens. * @param amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address to, uint256 amount ) public onlyMinter onlyBeforeMintingFinished returns (bool) { _mint(to, amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() public onlyMinter onlyBeforeMintingFinished returns (bool) { _mintingFinished = true; emit MintingFinished(); return true; } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Burnable.sol /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract ERC20Burnable is ERC20 { /** * @dev Burns a specific amount of tokens. * @param value The amount of token to be burned. */ function burn(uint256 value) public { _burn(msg.sender, value); } /** * @dev Burns a specific amount of tokens from the target address and decrements allowance * @param from address The address which you want to send tokens from * @param value uint256 The amount of token to be burned */ function burnFrom(address from, uint256 value) public { _burnFrom(from, value); } /** * @dev Overrides ERC20._burn in order for burn and burnFrom to emit * an additional Burn event. */ function _burn(address who, uint256 value) internal { super._burn(who, value); } } // File: openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol /** * @title ERC20Detailed token * @dev The decimals are only for visualization purposes. * All the operations are done using the smallest and indivisible token unit, * just as on Ethereum all the operations are done in wei. */ contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; constructor(string name, string symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } /** * @return the name of the token. */ function name() public view returns(string) { return _name; } /** * @return the symbol of the token. */ function symbol() public view returns(string) { return _symbol; } /** * @return the number of decimals of the token. */ function decimals() public view returns(uint8) { return _decimals; } } // File: contracts/robonomics/XRT.sol contract XRT is ERC20Mintable, ERC20Burnable, ERC20Detailed { constructor() public ERC20Detailed("XRT", "Robonomics Beta", 9) { uint256 INITIAL_SUPPLY = 1000 * (10 ** 9); _mint(msg.sender, INITIAL_SUPPLY); } } // File: contracts/robonomics/RobotLiabilityAPI.sol //import './LiabilityFactory.sol'; contract RobotLiabilityAPI { bytes public model; bytes public objective; bytes public result; ERC20 public token; uint256 public cost; uint256 public lighthouseFee; uint256 public validatorFee; bytes32 public demandHash; bytes32 public offerHash; address public promisor; address public promisee; address public validator; bool public isSuccess; bool public isFinalized; LiabilityFactory public factory; event Finalized(bool indexed success, bytes result); } // File: contracts/robonomics/LightContract.sol contract LightContract { /** * @dev Shared code smart contract */ address lib; constructor(address _library) public { lib = _library; } function() public { require(lib.delegatecall(msg.data)); } } // File: contracts/robonomics/RobotLiability.sol // Standard robot liability light contract contract RobotLiability is RobotLiabilityAPI, LightContract { constructor(address _lib) public LightContract(_lib) { factory = LiabilityFactory(msg.sender); } } // File: contracts/robonomics/SingletonHash.sol contract SingletonHash { event HashConsumed(bytes32 indexed hash); /** * @dev Used hash accounting */ mapping(bytes32 => bool) public isHashConsumed; /** * @dev Parameter can be used only once * @param _hash Single usage hash */ function singletonHash(bytes32 _hash) internal { require(!isHashConsumed[_hash]); isHashConsumed[_hash] = true; emit HashConsumed(_hash); } } // File: contracts/robonomics/DutchAuction.sol /// @title Dutch auction contract - distribution of XRT tokens using an auction. /// @author Stefan George - <stefan.george@consensys.net> /// @author Airalab - <research@aira.life> contract DutchAuction { /* * Events */ event BidSubmission(address indexed sender, uint256 amount); /* * Constants */ uint constant public MAX_TOKENS_SOLD = 800 * 10**9; // 8M XRT = 10M - 1M (Foundation) - 1M (Early investors base) uint constant public WAITING_PERIOD = 0; // 1 days; /* * Storage */ XRT public xrt; address public ambix; address public wallet; address public owner; uint public ceiling; uint public priceFactor; uint public startBlock; uint public endTime; uint public totalReceived; uint public finalPrice; mapping (address => uint) public bids; Stages public stage; /* * Enums */ enum Stages { AuctionDeployed, AuctionSetUp, AuctionStarted, AuctionEnded, TradingStarted } /* * Modifiers */ modifier atStage(Stages _stage) { // Contract on stage require(stage == _stage); _; } modifier isOwner() { // Only owner is allowed to proceed require(msg.sender == owner); _; } modifier isWallet() { // Only wallet is allowed to proceed require(msg.sender == wallet); _; } modifier isValidPayload() { require(msg.data.length == 4 || msg.data.length == 36); _; } modifier timedTransitions() { if (stage == Stages.AuctionStarted && calcTokenPrice() <= calcStopPrice()) finalizeAuction(); if (stage == Stages.AuctionEnded && now > endTime + WAITING_PERIOD) stage = Stages.TradingStarted; _; } /* * Public functions */ /// @dev Contract constructor function sets owner. /// @param _wallet Multisig wallet. /// @param _ceiling Auction ceiling. /// @param _priceFactor Auction price factor. constructor(address _wallet, uint _ceiling, uint _priceFactor) public { require(_wallet != 0 && _ceiling > 0 && _priceFactor > 0); owner = msg.sender; wallet = _wallet; ceiling = _ceiling; priceFactor = _priceFactor; stage = Stages.AuctionDeployed; } /// @dev Setup function sets external contracts' addresses. /// @param _xrt Robonomics token address. /// @param _ambix Distillation cube address. function setup(address _xrt, address _ambix) public isOwner atStage(Stages.AuctionDeployed) { // Validate argument require(_xrt != 0 && _ambix != 0); xrt = XRT(_xrt); ambix = _ambix; // Validate token balance require(xrt.balanceOf(this) == MAX_TOKENS_SOLD); stage = Stages.AuctionSetUp; } /// @dev Starts auction and sets startBlock. function startAuction() public isWallet atStage(Stages.AuctionSetUp) { stage = Stages.AuctionStarted; startBlock = block.number; } /// @dev Calculates current token price. /// @return Returns token price. function calcCurrentTokenPrice() public timedTransitions returns (uint) { if (stage == Stages.AuctionEnded || stage == Stages.TradingStarted) return finalPrice; return calcTokenPrice(); } /// @dev Returns correct stage, even if a function with timedTransitions modifier has not yet been called yet. /// @return Returns current auction stage. function updateStage() public timedTransitions returns (Stages) { return stage; } /// @dev Allows to send a bid to the auction. /// @param receiver Bid will be assigned to this address if set. function bid(address receiver) public payable isValidPayload timedTransitions atStage(Stages.AuctionStarted) returns (uint amount) { require(msg.value > 0); amount = msg.value; // If a bid is done on behalf of a user via ShapeShift, the receiver address is set. if (receiver == 0) receiver = msg.sender; // Prevent that more than 90% of tokens are sold. Only relevant if cap not reached. uint maxWei = MAX_TOKENS_SOLD * calcTokenPrice() / 10**9 - totalReceived; uint maxWeiBasedOnTotalReceived = ceiling - totalReceived; if (maxWeiBasedOnTotalReceived < maxWei) maxWei = maxWeiBasedOnTotalReceived; // Only invest maximum possible amount. if (amount > maxWei) { amount = maxWei; // Send change back to receiver address. In case of a ShapeShift bid the user receives the change back directly. receiver.transfer(msg.value - amount); } // Forward funding to ether wallet wallet.transfer(amount); bids[receiver] += amount; totalReceived += amount; emit BidSubmission(receiver, amount); // Finalize auction when maxWei reached if (amount == maxWei) finalizeAuction(); } /// @dev Claims tokens for bidder after auction. /// @param receiver Tokens will be assigned to this address if set. function claimTokens(address receiver) public isValidPayload timedTransitions atStage(Stages.TradingStarted) { if (receiver == 0) receiver = msg.sender; uint tokenCount = bids[receiver] * 10**9 / finalPrice; bids[receiver] = 0; require(xrt.transfer(receiver, tokenCount)); } /// @dev Calculates stop price. /// @return Returns stop price. function calcStopPrice() view public returns (uint) { return totalReceived * 10**9 / MAX_TOKENS_SOLD + 1; } /// @dev Calculates token price. /// @return Returns token price. function calcTokenPrice() view public returns (uint) { return priceFactor * 10**18 / (block.number - startBlock + 7500) + 1; } /* * Private functions */ function finalizeAuction() private { stage = Stages.AuctionEnded; finalPrice = totalReceived == ceiling ? calcTokenPrice() : calcStopPrice(); uint soldTokens = totalReceived * 10**9 / finalPrice; if (totalReceived == ceiling) { // Auction contract transfers all unsold tokens to Ambix contract require(xrt.transfer(ambix, MAX_TOKENS_SOLD - soldTokens)); } else { // Auction contract burn all unsold tokens xrt.burn(MAX_TOKENS_SOLD - soldTokens); } endTime = now; } } // File: contracts/robonomics/LighthouseAPI.sol //import './LiabilityFactory.sol'; contract LighthouseAPI { address[] public members; function membersLength() public view returns (uint256) { return members.length; } mapping(address => uint256) indexOf; mapping(address => uint256) public balances; uint256 public minimalFreeze; uint256 public timeoutBlocks; LiabilityFactory public factory; XRT public xrt; uint256 public keepaliveBlock = 0; uint256 public marker = 0; uint256 public quota = 0; function quotaOf(address _member) public view returns (uint256) { return balances[_member] / minimalFreeze; } } // File: contracts/robonomics/Lighthouse.sol contract Lighthouse is LighthouseAPI, LightContract { constructor( address _lib, uint256 _minimalFreeze, uint256 _timeoutBlocks ) public LightContract(_lib) { require(_minimalFreeze > 0 && _timeoutBlocks > 0); minimalFreeze = _minimalFreeze; timeoutBlocks = _timeoutBlocks; factory = LiabilityFactory(msg.sender); xrt = factory.xrt(); } } // File: ens/contracts/AbstractENS.sol contract AbstractENS { function owner(bytes32 node) constant returns(address); function resolver(bytes32 node) constant returns(address); function ttl(bytes32 node) constant returns(uint64); function setOwner(bytes32 node, address owner); function setSubnodeOwner(bytes32 node, bytes32 label, address owner); function setResolver(bytes32 node, address resolver); function setTTL(bytes32 node, uint64 ttl); // Logged when the owner of a node assigns a new owner to a subnode. event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner); // Logged when the owner of a node transfers ownership to a new account. event Transfer(bytes32 indexed node, address owner); // Logged when the resolver for a node changes. event NewResolver(bytes32 indexed node, address resolver); // Logged when the TTL of a node changes event NewTTL(bytes32 indexed node, uint64 ttl); } // File: ens/contracts/ENS.sol /** * The ENS registry contract. */ contract ENS is AbstractENS { struct Record { address owner; address resolver; uint64 ttl; } mapping(bytes32=>Record) records; // Permits modifications only by the owner of the specified node. modifier only_owner(bytes32 node) { if(records[node].owner != msg.sender) throw; _; } /** * Constructs a new ENS registrar. */ function ENS() { records[0].owner = msg.sender; } /** * Returns the address that owns the specified node. */ function owner(bytes32 node) constant returns (address) { return records[node].owner; } /** * Returns the address of the resolver for the specified node. */ function resolver(bytes32 node) constant returns (address) { return records[node].resolver; } /** * Returns the TTL of a node, and any records associated with it. */ function ttl(bytes32 node) constant returns (uint64) { return records[node].ttl; } /** * Transfers ownership of a node to a new address. May only be called by the current * owner of the node. * @param node The node to transfer ownership of. * @param owner The address of the new owner. */ function setOwner(bytes32 node, address owner) only_owner(node) { Transfer(node, owner); records[node].owner = owner; } /** * Transfers ownership of a subnode sha3(node, label) to a new address. May only be * called by the owner of the parent node. * @param node The parent node. * @param label The hash of the label specifying the subnode. * @param owner The address of the new owner. */ function setSubnodeOwner(bytes32 node, bytes32 label, address owner) only_owner(node) { var subnode = sha3(node, label); NewOwner(node, label, owner); records[subnode].owner = owner; } /** * Sets the resolver address for the specified node. * @param node The node to update. * @param resolver The address of the resolver. */ function setResolver(bytes32 node, address resolver) only_owner(node) { NewResolver(node, resolver); records[node].resolver = resolver; } /** * Sets the TTL for the specified node. * @param node The node to update. * @param ttl The TTL in seconds. */ function setTTL(bytes32 node, uint64 ttl) only_owner(node) { NewTTL(node, ttl); records[node].ttl = ttl; } } // File: ens/contracts/PublicResolver.sol /** * A simple resolver anyone can use; only allows the owner of a node to set its * address. */ contract PublicResolver { AbstractENS ens; mapping(bytes32=>address) addresses; mapping(bytes32=>bytes32) hashes; modifier only_owner(bytes32 node) { if(ens.owner(node) != msg.sender) throw; _; } /** * Constructor. * @param ensAddr The ENS registrar contract. */ function PublicResolver(AbstractENS ensAddr) { ens = ensAddr; } /** * Fallback function. */ function() { throw; } /** * Returns true if the specified node has the specified record type. * @param node The ENS node to query. * @param kind The record type name, as specified in EIP137. * @return True if this resolver has a record of the provided type on the * provided node. */ function has(bytes32 node, bytes32 kind) constant returns (bool) { return (kind == "addr" && addresses[node] != 0) || (kind == "hash" && hashes[node] != 0); } /** * Returns true if the resolver implements the interface specified by the provided hash. * @param interfaceID The ID of the interface to check for. * @return True if the contract implements the requested interface. */ function supportsInterface(bytes4 interfaceID) constant returns (bool) { return interfaceID == 0x3b3b57de || interfaceID == 0xd8389dc5; } /** * Returns the address associated with an ENS node. * @param node The ENS node to query. * @return The associated address. */ function addr(bytes32 node) constant returns (address ret) { ret = addresses[node]; } /** * Sets the address associated with an ENS node. * May only be called by the owner of that node in the ENS registry. * @param node The node to update. * @param addr The address to set. */ function setAddr(bytes32 node, address addr) only_owner(node) { addresses[node] = addr; } /** * Returns the content hash associated with an ENS node. * Note that this resource type is not standardized, and will likely change * in future to a resource type based on multihash. * @param node The ENS node to query. * @return The associated content hash. */ function content(bytes32 node) constant returns (bytes32 ret) { ret = hashes[node]; } /** * Sets the content hash associated with an ENS node. * May only be called by the owner of that node in the ENS registry. * Note that this resource type is not standardized, and will likely change * in future to a resource type based on multihash. * @param node The node to update. * @param hash The content hash to set */ function setContent(bytes32 node, bytes32 hash) only_owner(node) { hashes[node] = hash; } } // File: openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { function safeTransfer( IERC20 token, address to, uint256 value ) internal { require(token.transfer(to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { require(token.transferFrom(from, to, value)); } function safeApprove( IERC20 token, address spender, uint256 value ) internal { require(token.approve(spender, value)); } } // File: contracts/robonomics/LiabilityFactory.sol contract LiabilityFactory is SingletonHash { constructor( address _robot_liability_lib, address _lighthouse_lib, DutchAuction _auction, XRT _xrt, ENS _ens ) public { robotLiabilityLib = _robot_liability_lib; lighthouseLib = _lighthouse_lib; auction = _auction; xrt = _xrt; ens = _ens; } using SafeERC20 for XRT; using SafeERC20 for ERC20; /** * @dev New liability created */ event NewLiability(address indexed liability); /** * @dev New lighthouse created */ event NewLighthouse(address indexed lighthouse, string name); /** * @dev Robonomics dutch auction contract */ DutchAuction public auction; /** * @dev Robonomics network protocol token */ XRT public xrt; /** * @dev Ethereum name system */ ENS public ens; /** * @dev Total GAS utilized by Robonomics network */ uint256 public totalGasUtilizing = 0; /** * @dev GAS utilized by liability contracts */ mapping(address => uint256) public gasUtilizing; /** * @dev The count of utilized gas for switch to next epoch */ uint256 public constant gasEpoch = 347 * 10**10; /** * @dev Weighted average gasprice */ uint256 public constant gasPrice = 10 * 10**9; /** * @dev Lighthouse accounting */ mapping(address => bool) public isLighthouse; /** * @dev Robot liability shared code smart contract */ address public robotLiabilityLib; /** * @dev Lightouse shared code smart contract */ address public lighthouseLib; /** * @dev XRT emission value for utilized gas */ function wnFromGas(uint256 _gas) public view returns (uint256) { // Just return wn=gas when auction isn't finish if (auction.finalPrice() == 0) return _gas; // Current gas utilization epoch uint256 epoch = totalGasUtilizing / gasEpoch; // XRT emission with addition coefficient by gas utilzation epoch uint256 wn = _gas * 10**9 * gasPrice * 2**epoch / 3**epoch / auction.finalPrice(); // Check to not permit emission decrease below wn=gas return wn < _gas ? _gas : wn; } /** * @dev Only lighthouse guard */ modifier onlyLighthouse { require(isLighthouse[msg.sender]); _; } /** * @dev Create robot liability smart contract * @param _demand ABI-encoded demand message * @param _offer ABI-encoded offer message */ function createLiability( bytes _demand, bytes _offer ) external onlyLighthouse returns (RobotLiability liability) { // Store in memory available gas uint256 gasinit = gasleft(); // Create liability liability = new RobotLiability(robotLiabilityLib); emit NewLiability(liability); // Parse messages require(liability.call(abi.encodePacked(bytes4(0x0be8947a), _demand))); // liability.demand(...) singletonHash(liability.demandHash()); require(liability.call(abi.encodePacked(bytes4(0x87bca1cf), _offer))); // liability.offer(...) singletonHash(liability.offerHash()); // Transfer lighthouse fee to lighthouse worker directly if (liability.lighthouseFee() > 0) xrt.safeTransferFrom(liability.promisor(), tx.origin, liability.lighthouseFee()); // Transfer liability security and hold on contract ERC20 token = liability.token(); if (liability.cost() > 0) token.safeTransferFrom(liability.promisee(), liability, liability.cost()); // Transfer validator fee and hold on contract if (address(liability.validator()) != 0 && liability.validatorFee() > 0) xrt.safeTransferFrom(liability.promisee(), liability, liability.validatorFee()); // Accounting gas usage of transaction uint256 gas = gasinit - gasleft() + 110525; // Including observation error totalGasUtilizing += gas; gasUtilizing[liability] += gas; } /** * @dev Create lighthouse smart contract * @param _minimalFreeze Minimal freeze value of XRT token * @param _timeoutBlocks Max time of lighthouse silence in blocks * @param _name Lighthouse subdomain, * example: for 'my-name' will created 'my-name.lighthouse.1.robonomics.eth' domain */ function createLighthouse( uint256 _minimalFreeze, uint256 _timeoutBlocks, string _name ) external returns (address lighthouse) { bytes32 lighthouseNode // lighthouse.2.robonomics.eth = 0xa058d6058d5ec525aa555c572720908a8d6ea6e2781b460bdecb2abf8bf56d4c; // Name reservation check bytes32 subnode = keccak256(abi.encodePacked(lighthouseNode, keccak256(_name))); require(ens.resolver(subnode) == 0); // Create lighthouse lighthouse = new Lighthouse(lighthouseLib, _minimalFreeze, _timeoutBlocks); emit NewLighthouse(lighthouse, _name); isLighthouse[lighthouse] = true; // Register subnode ens.setSubnodeOwner(lighthouseNode, keccak256(_name), this); // Register lighthouse address PublicResolver resolver = PublicResolver(ens.resolver(lighthouseNode)); ens.setResolver(subnode, resolver); resolver.setAddr(subnode, lighthouse); } /** * @dev Is called whan after liability finalization * @param _gas Liability finalization gas expenses */ function liabilityFinalized( uint256 _gas ) external returns (bool) { require(gasUtilizing[msg.sender] > 0); uint256 gas = _gas - gasleft(); require(_gas > gas); totalGasUtilizing += gas; gasUtilizing[msg.sender] += gas; require(xrt.mint(tx.origin, wnFromGas(gasUtilizing[msg.sender]))); return true; } }
Modifiers/ Contract on stage
modifier atStage(Stages _stage) { require(stage == _stage); _; }
1,126,832
[ 1, 4625, 348, 7953, 560, 30, 282, 3431, 3383, 19, 13456, 603, 6009, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 9606, 622, 8755, 12, 31359, 389, 12869, 13, 288, 203, 3639, 2583, 12, 12869, 422, 389, 12869, 1769, 203, 3639, 389, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./partial_match/1/0xCd5DC9d13150e97a26F04Cb4134F4192b5590D0F/sources/HOD.sol
*****************/ exlcude from fees and max transaction amount store addresses that a automatic market maker pairs. Any transfer *to* these addresses could be subject to a maximum transfer amount exclude from paying fees or having max transaction amount
function _beforeTokenTransfer( address from, address to, uint256 amount IUniswapV2Router02 public uniswapV2Router; address public uniswapV2Pair; address public constant deadAddress = address(0xdead); bool private swapping; address public treasuryAddress; address public devAddress; uint256 public maxTransactionAmount; uint256 public swapTokensAtAmount; uint256 public maxWallet; bool public lpBurnEnabled = false; uint256 public lpBurnFrequency = 3600 seconds; uint256 public lastLpBurnTime; uint256 public manualBurnFrequency = 30 minutes; uint256 public lastManualLpBurnTime; bool public limitsInEffect = true; bool public tradingActive = false; bool public swapEnabled = false; mapping(address => uint256) private _holderLastTransferTimestamp; bool public transferDelayEnabled = true; uint256 public buyTotalFees; uint256 public buyTreasuryFee; uint256 public buyLiquidityFee; uint256 public buyDevFee; uint256 public sellTotalFees; uint256 public sellTreasuryFee; uint256 public sellLiquidityFee; uint256 public sellDevFee; uint256 public tokensForTreasury; uint256 public tokensForLiquidity; uint256 public tokensForDev; uint256 public tokensForMC; mapping (address => bool) private _isExcludedFromFees; mapping (address => bool) public _isExcludedMaxTransactionAmount; mapping (address => bool) public automatedMarketMakerPairs; event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress); event ExcludeFromFees(address indexed account, bool isExcluded); event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity ); event AutoNukeLP(); event ManualNukeLP(); constructor() { uint256 _buyTreasuryFee = 0; uint256 _buyLiquidityFee = 0; uint256 _buyDevFee = 1; uint256 _sellTreasuryFee = 0; uint256 _sellLiquidityFee = 0; uint256 _sellDevFee = 1; _name = "Hod Finance"; _symbol = "HOD"; _totalSupply = 1_000_000_000 * 1e18; maxTransactionAmount = _totalSupply * 30 / 1000; buyTreasuryFee = _buyTreasuryFee; buyLiquidityFee = _buyLiquidityFee; buyDevFee = _buyDevFee; buyTotalFees = buyTreasuryFee + buyLiquidityFee + buyDevFee; sellTreasuryFee = _sellTreasuryFee; sellLiquidityFee = _sellLiquidityFee; sellDevFee = _sellDevFee; sellTotalFees = sellTreasuryFee + sellLiquidityFee + sellDevFee; excludeFromFees(owner(), true); excludeFromFees(address(this), true); excludeFromFees(address(devAddress), true); excludeFromFees(address(treasuryAddress), true); excludeFromMaxTransaction(owner(), true); excludeFromMaxTransaction(address(this), true); excludeFromMaxTransaction(address(devAddress), true); excludeFromMaxTransaction(address(treasuryAddress), true); _mint is an internal function in ERC20.sol that is only called here, and CANNOT be called ever again _mint(msg.sender, _totalSupply);
2,621,300
[ 1, 4625, 348, 7953, 560, 30, 380, 2751, 19, 431, 17704, 1317, 628, 1656, 281, 471, 943, 2492, 3844, 1707, 6138, 716, 279, 5859, 13667, 312, 6388, 5574, 18, 5502, 7412, 380, 869, 14, 4259, 6138, 3377, 506, 3221, 358, 279, 4207, 7412, 3844, 4433, 628, 8843, 310, 1656, 281, 578, 7999, 943, 2492, 3844, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 389, 5771, 1345, 5912, 12, 203, 3639, 1758, 628, 16, 203, 3639, 1758, 358, 16, 203, 3639, 2254, 5034, 3844, 203, 203, 565, 467, 984, 291, 91, 438, 58, 22, 8259, 3103, 1071, 640, 291, 91, 438, 58, 22, 8259, 31, 203, 565, 1758, 1071, 640, 291, 91, 438, 58, 22, 4154, 31, 203, 565, 1758, 1071, 5381, 8363, 1887, 273, 1758, 12, 20, 92, 22097, 1769, 203, 203, 565, 1426, 3238, 7720, 1382, 31, 203, 203, 565, 1758, 1071, 9787, 345, 22498, 1887, 31, 203, 565, 1758, 1071, 4461, 1887, 31, 203, 377, 203, 565, 2254, 5034, 1071, 943, 3342, 6275, 31, 203, 565, 2254, 5034, 1071, 7720, 5157, 861, 6275, 31, 203, 565, 2254, 5034, 1071, 943, 16936, 31, 203, 377, 203, 565, 1426, 1071, 12423, 38, 321, 1526, 273, 629, 31, 203, 565, 2254, 5034, 1071, 12423, 38, 321, 13865, 273, 12396, 3974, 31, 203, 565, 2254, 5034, 1071, 1142, 48, 84, 38, 321, 950, 31, 203, 377, 203, 565, 2254, 5034, 1071, 11297, 38, 321, 13865, 273, 5196, 6824, 31, 203, 565, 2254, 5034, 1071, 1142, 25139, 48, 84, 38, 321, 950, 31, 203, 203, 565, 1426, 1071, 8181, 382, 12477, 273, 638, 31, 203, 565, 1426, 1071, 1284, 7459, 3896, 273, 629, 31, 203, 565, 1426, 1071, 7720, 1526, 273, 629, 31, 203, 377, 203, 565, 2874, 12, 2867, 516, 2254, 5034, 13, 3238, 389, 4505, 3024, 5912, 4921, 31, 203, 565, 1426, 1071, 7412, 6763, 1526, 273, 638, 31, 203, 203, 565, 2254, 5034, 1071, 30143, 5269, 2954, 281, 31, 203, 565, 2254, 5034, 1071, 30143, 56, 266, 345, 22498, 14667, 31, 203, 565, 2254, 5034, 1071, 30143, 48, 18988, 24237, 14667, 31, 203, 565, 2254, 5034, 1071, 30143, 8870, 14667, 31, 203, 377, 203, 565, 2254, 5034, 1071, 357, 80, 5269, 2954, 281, 31, 203, 565, 2254, 5034, 1071, 357, 80, 56, 266, 345, 22498, 14667, 31, 203, 565, 2254, 5034, 1071, 357, 80, 48, 18988, 24237, 14667, 31, 203, 565, 2254, 5034, 1071, 357, 80, 8870, 14667, 31, 203, 377, 203, 565, 2254, 5034, 1071, 2430, 1290, 56, 266, 345, 22498, 31, 203, 565, 2254, 5034, 1071, 2430, 1290, 48, 18988, 24237, 31, 203, 565, 2254, 5034, 1071, 2430, 1290, 8870, 31, 203, 565, 2254, 5034, 1071, 2430, 1290, 20022, 31, 203, 377, 203, 203, 565, 2874, 261, 2867, 516, 1426, 13, 3238, 389, 291, 16461, 1265, 2954, 281, 31, 203, 565, 2874, 261, 2867, 516, 1426, 13, 1071, 389, 291, 16461, 2747, 3342, 6275, 31, 203, 203, 565, 2874, 261, 2867, 516, 1426, 13, 1071, 18472, 690, 3882, 278, 12373, 10409, 31, 203, 203, 565, 871, 2315, 984, 291, 91, 438, 58, 22, 8259, 12, 2867, 8808, 394, 1887, 16, 1758, 8808, 1592, 1887, 1769, 203, 203, 565, 871, 20760, 1265, 2954, 281, 12, 2867, 8808, 2236, 16, 1426, 353, 16461, 1769, 203, 203, 565, 871, 1000, 22932, 690, 3882, 278, 12373, 4154, 12, 2867, 8808, 3082, 16, 1426, 8808, 460, 1769, 203, 203, 565, 871, 12738, 1876, 48, 18988, 1164, 12, 203, 3639, 2254, 5034, 2430, 12521, 1845, 16, 203, 3639, 2254, 5034, 13750, 8872, 16, 203, 3639, 2254, 5034, 2430, 5952, 48, 18988, 24237, 203, 565, 11272, 203, 377, 203, 565, 871, 8064, 50, 89, 4491, 14461, 5621, 203, 377, 203, 565, 871, 8660, 1462, 50, 89, 4491, 14461, 5621, 203, 203, 565, 3885, 1435, 288, 203, 3639, 2254, 5034, 389, 70, 9835, 56, 266, 345, 22498, 14667, 273, 374, 31, 203, 3639, 2254, 5034, 389, 70, 9835, 48, 18988, 24237, 14667, 273, 374, 31, 203, 3639, 2254, 5034, 389, 70, 9835, 8870, 14667, 273, 404, 31, 203, 203, 3639, 2254, 5034, 389, 87, 1165, 56, 266, 345, 22498, 14667, 273, 374, 31, 203, 3639, 2254, 5034, 389, 87, 1165, 48, 18988, 24237, 14667, 273, 374, 31, 203, 3639, 2254, 5034, 389, 87, 1165, 8870, 14667, 273, 404, 31, 203, 203, 3639, 389, 529, 273, 315, 44, 369, 9458, 1359, 14432, 203, 3639, 389, 7175, 273, 315, 44, 1212, 14432, 203, 3639, 389, 4963, 3088, 1283, 273, 404, 67, 3784, 67, 3784, 67, 3784, 380, 404, 73, 2643, 31, 203, 540, 203, 3639, 943, 3342, 6275, 273, 389, 4963, 3088, 1283, 380, 5196, 342, 4336, 31, 203, 203, 3639, 30143, 56, 266, 345, 22498, 14667, 273, 389, 70, 9835, 56, 266, 345, 22498, 14667, 31, 203, 3639, 30143, 48, 18988, 24237, 14667, 273, 389, 70, 9835, 48, 18988, 24237, 14667, 31, 203, 3639, 30143, 8870, 14667, 273, 389, 70, 9835, 8870, 14667, 31, 203, 3639, 30143, 5269, 2954, 281, 273, 30143, 56, 266, 345, 22498, 14667, 397, 30143, 48, 18988, 24237, 14667, 397, 30143, 8870, 14667, 31, 203, 540, 203, 3639, 357, 80, 56, 266, 345, 22498, 14667, 273, 389, 87, 1165, 56, 266, 345, 22498, 14667, 31, 203, 3639, 357, 80, 48, 18988, 24237, 14667, 273, 389, 87, 1165, 48, 18988, 24237, 14667, 31, 203, 3639, 357, 80, 8870, 14667, 273, 389, 87, 1165, 8870, 14667, 31, 203, 3639, 357, 80, 5269, 2954, 281, 273, 357, 80, 56, 266, 345, 22498, 14667, 397, 357, 80, 48, 18988, 24237, 14667, 397, 357, 80, 8870, 14667, 31, 203, 540, 203, 203, 3639, 4433, 1265, 2954, 281, 12, 8443, 9334, 638, 1769, 203, 3639, 4433, 1265, 2954, 281, 12, 2867, 12, 2211, 3631, 638, 1769, 203, 3639, 4433, 1265, 2954, 281, 12, 2867, 12, 5206, 1887, 3631, 638, 1769, 203, 3639, 4433, 1265, 2954, 281, 12, 2867, 12, 27427, 345, 22498, 1887, 3631, 638, 1769, 203, 1171, 203, 3639, 4433, 1265, 2747, 3342, 12, 8443, 9334, 638, 1769, 203, 3639, 4433, 1265, 2747, 3342, 12, 2867, 12, 2211, 3631, 638, 1769, 203, 3639, 4433, 1265, 2747, 3342, 12, 2867, 12, 5206, 1887, 3631, 638, 1769, 203, 3639, 4433, 1265, 2747, 3342, 12, 2867, 12, 27427, 345, 22498, 1887, 3631, 638, 1769, 203, 540, 203, 5411, 389, 81, 474, 353, 392, 2713, 445, 316, 4232, 39, 3462, 18, 18281, 716, 353, 1338, 2566, 2674, 16, 203, 5411, 471, 385, 16791, 506, 2566, 14103, 3382, 203, 3639, 389, 81, 474, 12, 3576, 18, 15330, 16, 389, 4963, 3088, 1283, 1769, 203, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
/* solhint-disable const-name-snakecase*/ // SPDX-License-Identifier: MIT /* * MIT License * =========== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ pragma solidity 0.7.6; pragma experimental ABIEncoderV2; import "../interfaces/IPENDLE.sol"; import "../periphery/Permissions.sol"; import "../periphery/Withdrawable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; /** * @notice The mechanics for delegating votes to other accounts is adapted from Compound * https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol ***/ contract PENDLE is IPENDLE, Permissions, Withdrawable { using SafeMath for uint256; /// @notice A checkpoint for marking number of votes from a given block struct Checkpoint { uint32 fromBlock; uint256 votes; } bool public constant override isPendleToken = true; string public constant name = "Pendle"; string public constant symbol = "PENDLE"; uint8 public constant decimals = 18; uint256 public override totalSupply; uint256 private constant TEAM_INVESTOR_ADVISOR_AMOUNT = 91602839 * 1e18; uint256 private constant ECOSYSTEM_FUND_TOKEN_AMOUNT = 50 * 1_000_000 * 1e18; uint256 private constant PUBLIC_SALES_TOKEN_AMOUNT = 15897161 * 1e18; uint256 private constant INITIAL_LIQUIDITY_EMISSION = 1200000 * 1e18; uint256 private constant CONFIG_DENOMINATOR = 1_000_000_000_000; uint256 private constant CONFIG_CHANGES_TIME_LOCK = 7 days; uint256 public override emissionRateMultiplierNumerator; uint256 public override terminalInflationRateNumerator; address public override liquidityIncentivesRecipient; uint256 public override pendingEmissionRateMultiplierNumerator; uint256 public override pendingTerminalInflationRateNumerator; address public override pendingLiquidityIncentivesRecipient; uint256 public override configChangesInitiated; uint256 public override startTime; uint256 public lastWeeklyEmission; uint256 public lastWeekEmissionSent; mapping(address => mapping(address => uint256)) internal allowances; mapping(address => uint256) internal balances; mapping(address => address) public delegates; /// @notice A record of votes checkpoints for each account, by index mapping(address => mapping(uint32 => Checkpoint)) public checkpoints; /// @notice The number of checkpoints for each account mapping(address => uint32) public numCheckpoints; /// @notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); /// @notice The EIP-712 typehash for the delegation struct used by the contract bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); /// @notice A record of states for signing / validating signatures mapping(address => uint256) public nonces; /// @notice An event thats emitted when an account changes its delegate event DelegateChanged( address indexed delegator, address indexed fromDelegate, address indexed toDelegate ); /// @notice An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged( address indexed delegate, uint256 previousBalance, uint256 newBalance ); event PendingConfigChanges( uint256 pendingEmissionRateMultiplierNumerator, uint256 pendingTerminalInflationRateNumerator, address pendingLiquidityIncentivesRecipient ); event ConfigsChanged( uint256 emissionRateMultiplierNumerator, uint256 terminalInflationRateNumerator, address liquidityIncentivesRecipient ); /** * @notice Construct a new PENDLE token */ constructor( address _governance, address pendleTeamTokens, address pendleEcosystemFund, address salesMultisig, address _liquidityIncentivesRecipient ) Permissions(_governance) { _mint(pendleTeamTokens, TEAM_INVESTOR_ADVISOR_AMOUNT); _mint(pendleEcosystemFund, ECOSYSTEM_FUND_TOKEN_AMOUNT); _mint(salesMultisig, PUBLIC_SALES_TOKEN_AMOUNT); _mint(_liquidityIncentivesRecipient, INITIAL_LIQUIDITY_EMISSION * 26); emissionRateMultiplierNumerator = (CONFIG_DENOMINATOR * 989) / 1000; // emission rate = 98.9% -> 1.1% decay terminalInflationRateNumerator = 379848538; // terminal inflation rate = 2% => weekly inflation = 0.0379848538% liquidityIncentivesRecipient = _liquidityIncentivesRecipient; startTime = block.timestamp; lastWeeklyEmission = INITIAL_LIQUIDITY_EMISSION; lastWeekEmissionSent = 26; // already done liquidity emissions for the first 26 weeks } /** * @notice Approve `spender` to transfer up to `amount` from `src` * @dev This will overwrite the approval amount for `spender` * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve) * @param spender The address of the account which may transfer tokens * @param amount The number of tokens that are approved (2^256-1 means infinite) * @return Whether or not the approval succeeded **/ function approve(address spender, uint256 amount) external override returns (bool) { allowances[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } /** * @notice Transfer `amount` tokens from `msg.sender` to `dst` * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transfer(address dst, uint256 amount) external override returns (bool) { _transferTokens(msg.sender, dst, amount); return true; } /** * @notice Transfer `amount` tokens from `src` to `dst` * @param src The address of the source account * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transferFrom( address src, address dst, uint256 amount ) external override returns (bool) { address spender = msg.sender; uint256 spenderAllowance = allowances[src][spender]; if (spender != src && spenderAllowance != uint256(-1)) { uint256 newAllowance = spenderAllowance.sub(amount); allowances[src][spender] = newAllowance; emit Approval(src, spender, newAllowance); } _transferTokens(src, dst, amount); return true; } /** * @notice Get the number of tokens `spender` is approved to spend on behalf of `account` * @param account The address of the account holding the funds * @param spender The address of the account spending the funds * @return The number of tokens approved **/ function allowance(address account, address spender) external view override returns (uint256) { return allowances[account][spender]; } /** * @notice Get the number of tokens held by the `account` * @param account The address of the account to get the balance of * @return The number of tokens held */ function balanceOf(address account) external view override returns (uint256) { return balances[account]; } /** * @notice Gets the current votes balance for `account` * @param account The address to get votes balance * @return The number of current votes for `account` */ function getCurrentVotes(address account) external view returns (uint256) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; } /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) public { return _delegate(msg.sender, delegatee); } /** * @notice Delegates votes from signatory to `delegatee` * @param delegatee The address to delegate votes to * @param nonce The contract state required to match the signature * @param expiry The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) public { bytes32 domainSeparator = keccak256( abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)) ); bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)); bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "INVALID_SIGNATURE"); require(nonce == nonces[signatory]++, "INVALID_NONCE"); require(block.timestamp <= expiry, "SIGNATURE_EXPIRED"); return _delegate(signatory, delegatee); } /** * @notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorVotes(address account, uint256 blockNumber) public view override returns (uint256) { require(blockNumber < block.number, "NOT_YET_DETERMINED"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check most recent balance if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } // Next check implicit zero balance if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[account][lower].votes; } function _delegate(address delegator, address delegatee) internal { address currentDelegate = delegates[delegator]; uint256 delegatorBalance = balances[delegator]; delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, delegatorBalance); } function _transferTokens( address src, address dst, uint256 amount ) internal { require(src != address(0), "SENDER_ZERO_ADDR"); require(dst != address(0), "RECEIVER_ZERO_ADDR"); balances[src] = balances[src].sub(amount); balances[dst] = balances[dst].add(amount); emit Transfer(src, dst, amount); _moveDelegates(delegates[src], delegates[dst], amount); } function _moveDelegates( address srcRep, address dstRep, uint256 amount ) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { uint32 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _writeCheckpoint( address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes ) internal { uint32 blockNumber = safe32(block.number, "BLOCK_NUM_EXCEED_32_BITS"); if ( nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber ) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; } else { checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, 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 getChainId() internal pure returns (uint256) { uint256 chainId; assembly { chainId := chainid() } return chainId; } function initiateConfigChanges( uint256 _emissionRateMultiplierNumerator, uint256 _terminalInflationRateNumerator, address _liquidityIncentivesRecipient ) external override onlyGovernance { require(liquidityIncentivesRecipient != address(0), "ZERO_ADDRESS"); pendingEmissionRateMultiplierNumerator = _emissionRateMultiplierNumerator; pendingTerminalInflationRateNumerator = _terminalInflationRateNumerator; pendingLiquidityIncentivesRecipient = _liquidityIncentivesRecipient; emit PendingConfigChanges( _emissionRateMultiplierNumerator, _terminalInflationRateNumerator, _liquidityIncentivesRecipient ); configChangesInitiated = block.timestamp; } function applyConfigChanges() external override { require(configChangesInitiated != 0, "UNINITIATED_CONFIG_CHANGES"); require( block.timestamp > configChangesInitiated + CONFIG_CHANGES_TIME_LOCK, "TIMELOCK_IS_NOT_OVER" ); _mintLiquidityEmissions(); // We must settle the pending liquidity emissions first, to make sure the weeks in the past follow the old configs emissionRateMultiplierNumerator = pendingEmissionRateMultiplierNumerator; terminalInflationRateNumerator = pendingTerminalInflationRateNumerator; liquidityIncentivesRecipient = pendingLiquidityIncentivesRecipient; configChangesInitiated = 0; emit ConfigsChanged( emissionRateMultiplierNumerator, terminalInflationRateNumerator, liquidityIncentivesRecipient ); } function claimLiquidityEmissions() external override returns (uint256 totalEmissions) { require(msg.sender == liquidityIncentivesRecipient, "NOT_INCENTIVES_RECIPIENT"); totalEmissions = _mintLiquidityEmissions(); } function _mintLiquidityEmissions() internal returns (uint256 totalEmissions) { uint256 _currentWeek = _getCurrentWeek(); if (_currentWeek <= lastWeekEmissionSent) { return 0; } for (uint256 i = lastWeekEmissionSent + 1; i <= _currentWeek; i++) { if (i <= 259) { lastWeeklyEmission = lastWeeklyEmission.mul(emissionRateMultiplierNumerator).div( CONFIG_DENOMINATOR ); } else { lastWeeklyEmission = totalSupply.mul(terminalInflationRateNumerator).div( CONFIG_DENOMINATOR ); } _mint(liquidityIncentivesRecipient, lastWeeklyEmission); totalEmissions = totalEmissions.add(lastWeeklyEmission); } lastWeekEmissionSent = _currentWeek; } // get current 1-indexed week id function _getCurrentWeek() internal view returns (uint256 weekId) { weekId = (block.timestamp - startTime) / (7 days) + 1; } function _mint(address account, uint256 amount) internal { require(account != address(0), "MINT_TO_ZERO_ADDR"); totalSupply = totalSupply.add(amount); balances[account] = balances[account].add(amount); emit Transfer(address(0), account, amount); } }
@notice A checkpoint for marking number of votes from a given block
struct Checkpoint { uint32 fromBlock; uint256 votes; } bool public constant override isPendleToken = true; string public constant name = "Pendle"; string public constant symbol = "PENDLE"; uint8 public constant decimals = 18; uint256 public override totalSupply; uint256 private constant TEAM_INVESTOR_ADVISOR_AMOUNT = 91602839 * 1e18; uint256 private constant ECOSYSTEM_FUND_TOKEN_AMOUNT = 50 * 1_000_000 * 1e18; uint256 private constant PUBLIC_SALES_TOKEN_AMOUNT = 15897161 * 1e18; uint256 private constant INITIAL_LIQUIDITY_EMISSION = 1200000 * 1e18; uint256 private constant CONFIG_DENOMINATOR = 1_000_000_000_000; uint256 private constant CONFIG_CHANGES_TIME_LOCK = 7 days; uint256 public override emissionRateMultiplierNumerator; uint256 public override terminalInflationRateNumerator; address public override liquidityIncentivesRecipient; uint256 public override pendingEmissionRateMultiplierNumerator; uint256 public override pendingTerminalInflationRateNumerator; address public override pendingLiquidityIncentivesRecipient; uint256 public override configChangesInitiated; uint256 public override startTime; uint256 public lastWeeklyEmission; uint256 public lastWeekEmissionSent; mapping(address => mapping(address => uint256)) internal allowances; mapping(address => uint256) internal balances; mapping(address => address) public delegates; keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); address indexed delegator, address indexed fromDelegate, address indexed toDelegate ); address indexed delegate, uint256 previousBalance, uint256 newBalance ); event PendingConfigChanges( uint256 pendingEmissionRateMultiplierNumerator, uint256 pendingTerminalInflationRateNumerator, address pendingLiquidityIncentivesRecipient ); event ConfigsChanged( uint256 emissionRateMultiplierNumerator, uint256 terminalInflationRateNumerator, address liquidityIncentivesRecipient ); address _governance, address pendleTeamTokens, address pendleEcosystemFund, address salesMultisig, address _liquidityIncentivesRecipient
7,212,602
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 20392, 432, 9776, 364, 24073, 1300, 434, 19588, 628, 279, 864, 1203, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 1958, 25569, 288, 203, 3639, 2254, 1578, 628, 1768, 31, 203, 3639, 2254, 5034, 19588, 31, 203, 565, 289, 203, 203, 565, 1426, 1071, 5381, 3849, 29962, 409, 298, 1345, 273, 638, 31, 203, 565, 533, 1071, 5381, 508, 273, 315, 52, 409, 298, 14432, 203, 565, 533, 1071, 5381, 3273, 273, 315, 25690, 900, 14432, 203, 565, 2254, 28, 1071, 5381, 15105, 273, 6549, 31, 203, 565, 2254, 5034, 1071, 3849, 2078, 3088, 1283, 31, 203, 203, 565, 2254, 5034, 3238, 5381, 25156, 2192, 67, 706, 3412, 882, 916, 67, 1880, 26780, 916, 67, 2192, 51, 5321, 273, 2468, 2313, 3103, 28, 5520, 380, 404, 73, 2643, 31, 203, 565, 2254, 5034, 3238, 5381, 512, 3865, 14318, 67, 42, 5240, 67, 8412, 67, 2192, 51, 5321, 273, 6437, 380, 404, 67, 3784, 67, 3784, 380, 404, 73, 2643, 31, 203, 565, 2254, 5034, 3238, 5381, 17187, 67, 5233, 11386, 67, 8412, 67, 2192, 51, 5321, 273, 4711, 6675, 27, 31899, 380, 404, 73, 2643, 31, 203, 565, 2254, 5034, 3238, 5381, 28226, 67, 2053, 53, 3060, 4107, 67, 3375, 45, 4475, 273, 2593, 11706, 380, 404, 73, 2643, 31, 203, 565, 2254, 5034, 3238, 5381, 9128, 67, 13296, 1872, 706, 3575, 273, 404, 67, 3784, 67, 3784, 67, 3784, 67, 3784, 31, 203, 565, 2254, 5034, 3238, 5381, 9128, 67, 1792, 3388, 3991, 67, 4684, 67, 6589, 273, 2371, 4681, 31, 203, 565, 2254, 5034, 1071, 3849, 801, 19710, 4727, 23365, 2578, 7385, 31, 203, 565, 2254, 5034, 1071, 3849, 8651, 27040, 367, 4727, 2578, 7385, 31, 203, 565, 1758, 1071, 3849, 4501, 372, 24237, 382, 2998, 3606, 18241, 31, 203, 565, 2254, 5034, 1071, 3849, 4634, 1514, 19710, 4727, 23365, 2578, 7385, 31, 203, 565, 2254, 5034, 1071, 3849, 4634, 11336, 27040, 367, 4727, 2578, 7385, 31, 203, 565, 1758, 1071, 3849, 4634, 48, 18988, 24237, 382, 2998, 3606, 18241, 31, 203, 565, 2254, 5034, 1071, 3849, 642, 7173, 2570, 10206, 31, 203, 565, 2254, 5034, 1071, 3849, 8657, 31, 203, 565, 2254, 5034, 1071, 1142, 6630, 715, 1514, 19710, 31, 203, 565, 2254, 5034, 1071, 1142, 6630, 1514, 19710, 7828, 31, 203, 203, 565, 2874, 12, 2867, 516, 2874, 12, 2867, 516, 2254, 5034, 3719, 2713, 1699, 6872, 31, 203, 565, 2874, 12, 2867, 516, 2254, 5034, 13, 2713, 324, 26488, 31, 203, 565, 2874, 12, 2867, 516, 1758, 13, 1071, 22310, 31, 203, 203, 203, 203, 3639, 417, 24410, 581, 5034, 2932, 41, 2579, 27, 2138, 3748, 12, 1080, 508, 16, 11890, 5034, 2687, 548, 16, 2867, 3929, 310, 8924, 2225, 1769, 203, 203, 3639, 417, 24410, 581, 5034, 2932, 26945, 12, 2867, 7152, 73, 16, 11890, 5034, 7448, 16, 11890, 5034, 10839, 2225, 1769, 203, 203, 203, 3639, 1758, 8808, 11158, 639, 16, 203, 3639, 1758, 8808, 628, 9586, 16, 203, 3639, 1758, 8808, 358, 9586, 203, 565, 11272, 203, 203, 3639, 1758, 8808, 7152, 16, 203, 3639, 2254, 5034, 2416, 13937, 16, 203, 3639, 2254, 5034, 394, 13937, 203, 565, 11272, 203, 203, 565, 871, 16034, 809, 7173, 12, 203, 3639, 2254, 5034, 4634, 1514, 19710, 4727, 23365, 2578, 7385, 16, 203, 3639, 2254, 5034, 4634, 11336, 27040, 367, 4727, 2578, 7385, 16, 203, 3639, 1758, 4634, 48, 18988, 24237, 382, 2998, 3606, 18241, 203, 565, 11272, 203, 203, 565, 871, 1903, 87, 5033, 12, 203, 3639, 2254, 5034, 801, 19710, 4727, 23365, 2578, 7385, 16, 203, 3639, 2254, 5034, 8651, 27040, 367, 4727, 2578, 7385, 16, 203, 3639, 1758, 4501, 372, 24237, 382, 2998, 3606, 18241, 203, 565, 11272, 203, 203, 3639, 1758, 389, 75, 1643, 82, 1359, 16, 203, 3639, 1758, 31472, 298, 8689, 5157, 16, 203, 3639, 1758, 31472, 298, 41, 14445, 1108, 42, 1074, 16, 203, 3639, 1758, 272, 5408, 5049, 291, 360, 16, 203, 3639, 1758, 389, 549, 372, 24237, 382, 2998, 3606, 18241, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/4/0x8edd685CB964A78C1a82C3059F3FAce2BFaA5F3F/sources/contracts/JBTokenStore.sol
********************************************************************* --------------------------- custom errors ------------------------- *********************************************************************
error EMPTY_NAME();
12,506,086
[ 1, 4625, 348, 7953, 560, 30, 19756, 1007, 12146, 15392, 1679, 1334, 12146, 788, 19756, 1007, 2, 0, 0, 0, 0, 0, 0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-100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/3/0x0F7e3a25daFa02975068550D52C04d322A13dd75/sources/Users/akshaycm/Documents/rfits-token/contracts/RfiToken.sol
sav3 transfer function calculate liquidity lock amount dont transfer burn from this contract or can never lock full lockable amountCalculate fee to go to Liq poolAdd liq with liqpooladdition partTransfer to liq lock amountAdd liq to pair
function _transfer(address from, address to, uint256 amount) internal override { if(locked && unlocked[from] != true && unlocked[to] != true) revert("Locked until end of presale"); if (liquidityLockDivisor != 0 && feelessAddr[from] == false && feelessAddr[to] == false) { uint256 liquidityLockAmount = amount.div(liquidityLockDivisor); uint256 LiqPoolAddition = getLiqAddBudget(amount); AddLiq(LiqPoolAddition); super._transfer(from, address(this), liquidityLockAmount); uint256 totalsub = liquidityLockAmount.add(LiqPoolAddition); super._transfer(from, to, amount.sub(totalsub)); } else { super._transfer(from, to, amount); } }
8,162,265
[ 1, 4625, 348, 7953, 560, 30, 4087, 23, 7412, 445, 4604, 4501, 372, 24237, 2176, 3844, 14046, 7412, 18305, 628, 333, 6835, 578, 848, 5903, 2176, 1983, 2176, 429, 3844, 8695, 14036, 358, 1960, 358, 511, 18638, 2845, 986, 4501, 85, 598, 4501, 85, 6011, 1289, 608, 1087, 5912, 358, 4501, 85, 2176, 3844, 986, 4501, 85, 358, 3082, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 389, 13866, 12, 2867, 628, 16, 1758, 358, 16, 2254, 5034, 3844, 13, 2713, 3849, 225, 288, 203, 3639, 309, 12, 15091, 597, 25966, 63, 2080, 65, 480, 638, 597, 25966, 63, 869, 65, 480, 638, 13, 203, 5411, 15226, 2932, 8966, 3180, 679, 434, 4075, 5349, 8863, 203, 203, 3639, 309, 261, 549, 372, 24237, 2531, 7244, 12385, 480, 374, 597, 1656, 12617, 3178, 63, 2080, 65, 422, 629, 597, 1656, 12617, 3178, 63, 869, 65, 422, 629, 13, 288, 203, 5411, 2254, 5034, 4501, 372, 24237, 2531, 6275, 273, 3844, 18, 2892, 12, 549, 372, 24237, 2531, 7244, 12385, 1769, 203, 5411, 2254, 5034, 511, 18638, 2864, 30296, 273, 9014, 18638, 986, 16124, 12, 8949, 1769, 203, 5411, 1436, 48, 18638, 12, 48, 18638, 2864, 30296, 1769, 203, 5411, 2240, 6315, 13866, 12, 2080, 16, 1758, 12, 2211, 3631, 4501, 372, 24237, 2531, 6275, 1769, 203, 5411, 2254, 5034, 19489, 373, 273, 4501, 372, 24237, 2531, 6275, 18, 1289, 12, 48, 18638, 2864, 30296, 1769, 203, 5411, 2240, 6315, 13866, 12, 2080, 16, 358, 16, 3844, 18, 1717, 12, 3307, 1031, 373, 10019, 203, 3639, 289, 203, 3639, 469, 288, 203, 5411, 2240, 6315, 13866, 12, 2080, 16, 358, 16, 3844, 1769, 203, 3639, 289, 203, 565, 289, 203, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/84531/0x5e4ECd793C2C52F6424972ef547846C895aB69f9/sources/contract-bc341c7d4a.sol
@custom:security-contact security@rocksolid.land
contract RockSolid is ERC20, Pausable, Ownable { pragma solidity ^0.8.9; constructor() ERC20("Rock Solid", "ROSO") { _mint(msg.sender, 1000000000 * 10 ** decimals()); } function pause() public onlyOwner { _pause(); } function unpause() public onlyOwner { _unpause(); } function _beforeTokenTransfer(address from, address to, uint256 amount) internal whenNotPaused override { super._beforeTokenTransfer(from, to, amount); } }
14,319,993
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 3662, 30, 7462, 17, 8994, 4373, 36, 26926, 30205, 18, 15733, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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088, 3784, 380, 1728, 2826, 15105, 10663, 203, 565, 289, 203, 203, 565, 445, 11722, 1435, 1071, 1338, 5541, 288, 203, 3639, 389, 19476, 5621, 203, 565, 289, 203, 203, 565, 445, 640, 19476, 1435, 1071, 1338, 5541, 288, 203, 3639, 389, 318, 19476, 5621, 203, 565, 289, 203, 203, 565, 445, 389, 5771, 1345, 5912, 12, 2867, 628, 16, 1758, 358, 16, 2254, 5034, 3844, 13, 203, 3639, 2713, 203, 3639, 1347, 1248, 28590, 203, 3639, 3849, 203, 565, 288, 203, 3639, 2240, 6315, 5771, 1345, 5912, 12, 2080, 16, 358, 16, 3844, 1769, 203, 565, 289, 203, 97, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.7; pragma experimental ABIEncoderV2; import {OwnershipRolesTemplate} from "./util/OwnershipRolesTemplate.sol"; import {BlocklistBase} from "./util/BlocklistBase.sol"; contract Blocklist is OwnershipRolesTemplate, BlocklistBase { bytes32 public constant BLOCKLIST_OWNER = keccak256("BLOCKLIST_OWNER"); modifier onlyOwners() { _checkOnlyOwners(); _; } function initialize(address[] calldata _addresses) external initializer { __OwnershipRolesTemplate_init(); __BlocklistBase_init_unchained(_addresses); _setupRole(BLOCKLIST_OWNER, _msgSender()); } function populateBlocklist(address[] calldata _addresses) external onlyOwners whenNotPaused { _populateBlocklist(_addresses); } function setBlockListed(address _user, bool _isBlocked) external onlyOwners whenNotPaused { _setBlocklisted(_user, _isBlocked); } function transferOwnership(address _governance) external onlyOwners { grantRole(BLOCKLIST_OWNER, _governance); _setRoleAdmin(BLOCKLIST_OWNER, GOVERNANCE_ROLE); grantGovernanceRoles(_governance); renoucePrivileges(); } /// @dev Private method is used instead of inlining into modifier because modifiers are copied into each method, /// and the use of immutable means the address bytes are copied in every place the modifier is used. function _checkOnlyOwners() private view { require( hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) || hasRole(GOVERNANCE_ROLE, _msgSender()) || hasRole(BLOCKLIST_OWNER, _msgSender()), "B:NA" ); } } // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.7; pragma experimental ABIEncoderV2; import {UpgradeableSafeContractBase} from "./UpgradeableSafeContractBase.sol"; // A contract to make it DRY'er to recreate safe ownership roles contract OwnershipRolesTemplate is UpgradeableSafeContractBase { bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant GOVERNANCE_ROLE = keccak256("GOVERNANCE_ROLE"); bytes32 public constant BENEFICIARY_ROLE = keccak256("BENEFICIARY_ROLE"); // ====== Modifiers for syntactic sugar ======= modifier onlyBenefactor() { _checkOnlyBenefactor(); _; } modifier onlyAdminOrGovernance() { _checkOnlyAdminOrGovernance(); _; } // ====== END Modifiers for syntactic sugar ===================================== // ================ OWNER/ Gov ONLY FUNCTIONS =================================== // Hand the contract over to a multisig gov wallet // Will revoke self roles that are overpriviledged function grantGovernanceRoles(address _governance) public onlyAdminOrGovernance { grantRole(PAUSER_ROLE, _governance); grantRole(GOVERNANCE_ROLE, _governance); grantRole(DEFAULT_ADMIN_ROLE, _governance); // Allow adding other sentinels/watchers to pause _setRoleAdmin(PAUSER_ROLE, GOVERNANCE_ROLE); // Allow adding/changing the benefactor address _setRoleAdmin(BENEFICIARY_ROLE, GOVERNANCE_ROLE); // Gov should be able to change gov in case of multisig change _setRoleAdmin(GOVERNANCE_ROLE, GOVERNANCE_ROLE); } function renoucePrivileges() public onlyAdminOrGovernance { revokeRole(GOVERNANCE_ROLE, msg.sender); revokeRole(DEFAULT_ADMIN_ROLE, msg.sender); } function togglePause() public onlyAdminOrGovernance { require( hasRole(PAUSER_ROLE, _msgSender()) || hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) || hasRole(GOVERNANCE_ROLE, _msgSender()), "ORT:NA" ); if (paused()) { _unpause(); } else { _pause(); } } // Initializers function __OwnershipRolesTemplate_init() internal initializer { __UpgradeableSafeContractBase_init(); _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); _setupRole(GOVERNANCE_ROLE, _msgSender()); _setupRole(BENEFICIARY_ROLE, _msgSender()); } function _checkOnlyAdminOrGovernance() private view { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) || hasRole(GOVERNANCE_ROLE, _msgSender()), "ORT:NA"); } function _checkOnlyBenefactor() private view { require(hasRole(BENEFICIARY_ROLE, _msgSender()), "ORT:NA"); } uint256[50] private ______gap; } // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.7; pragma experimental ABIEncoderV2; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {IBlocklist} from "../interfaces/IBlocklist.sol"; // Inspired by pool together contract BlocklistBase is Initializable, IBlocklist { // Mapping of addresses isBlocked status mapping(address => bool) public isBlocklisted; /** * @notice Emitted when a user is blocked/unblocked from receiving a prize award. * @dev Emitted when a contract owner blocks/unblocks user from award selection in _distribute. * @param user Address of user to block or unblock * @param isBlocked User blocked status */ event BlocklistSet(address indexed user, bool isBlocked); function inBlockList(address _user) external view override returns (bool _isInBlocklist) { return isBlocklisted[_user]; } function __BlocklistBase_init(address[] calldata _addresses) internal initializer { __BlocklistBase_init_unchained(_addresses); } function __BlocklistBase_init_unchained(address[] calldata _addresses) internal initializer { _populateBlocklist(_addresses); } /** * @notice Block/unblock a user from winning during prize distribution. * @dev Block/unblock a user from winning award in prize distribution by updating the isBlocklisted mapping. * @param _user Address of blocked user * @param _isBlocked Blocked Status (true or false) of user */ function _setBlocklisted(address _user, bool _isBlocked) internal { isBlocklisted[_user] = _isBlocked; emit BlocklistSet(_user, _isBlocked); } // Helper to block a list of addreses function _populateBlocklist(address[] calldata _addresses) internal { if (_addresses.length == 0) { return; } for (uint256 i = 0; i < _addresses.length; i++) { _setBlocklisted(_addresses[i], true); } } uint256[50] private ______gap; } // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.7; pragma experimental ABIEncoderV2; import {AccessControlEnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol"; import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {AddressUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol"; import {ContextUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; contract UpgradeableSafeContractBase is Initializable, ContextUpgradeable, AccessControlEnumerableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable { using AddressUpgradeable for address; function __UpgradeableSafeContractBase_init() internal initializer { __Context_init_unchained(); __AccessControlEnumerable_init_unchained(); __Pausable_init_unchained(); __ReentrancyGuard_init_unchained(); } /* solhint-disable */ // Inspired by alchemix smart contract gaurd at https://github.com/alchemix-finance/alchemix-protocol/blob/master/contracts/Alchemist.sol#L680 /// @dev Checks that caller is a EOA. /// /// This is used to prevent contracts from interacting. modifier noContractAllowed() { require(!address(_msgSender()).isContract() && _msgSender() == tx.origin, "USCB:NC"); _; } uint256[50] private ______gap; /* solhint-enable */ } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControlEnumerableUpgradeable.sol"; import "./AccessControlUpgradeable.sol"; import "../utils/structs/EnumerableSetUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable { function __AccessControlEnumerable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); } function __AccessControlEnumerable_init_unchained() internal initializer { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {grantRole} to track enumerable memberships */ function grantRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) { super.grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {revokeRole} to track enumerable memberships */ function revokeRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) { super.revokeRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {renounceRole} to track enumerable memberships */ function renounceRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) { super.renounceRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {_setupRole} to track enumerable memberships */ function _setupRole(bytes32 role, address account) internal virtual override { super._setupRole(role, account); _roleMembers[role].add(account); } uint256[49] private __gap; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal initializer { __Context_init_unchained(); __Pausable_init_unchained(); } function __Pausable_init_unchained() internal initializer { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } uint256[49] private __gap; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal initializer { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal initializer { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } uint256[49] private __gap; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal initializer { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal initializer { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IBlocklist { function inBlockList(address _user) external returns (bool _isInBlocklist); }
solhint-disable */ Inspired by alchemix smart contract gaurd at https:github.com/alchemix-finance/alchemix-protocol/blob/master/contracts/Alchemist.sol#L680 @dev Checks that caller is a EOA. This is used to prevent contracts from interacting.
modifier noContractAllowed() { require(!address(_msgSender()).isContract() && _msgSender() == tx.origin, "USCB:NC"); _; } uint256[50] private ______gap;
9,902,073
[ 1, 4625, 348, 7953, 560, 30, 225, 3704, 11317, 17, 8394, 1195, 657, 1752, 2921, 635, 524, 1036, 697, 13706, 6835, 18812, 295, 72, 622, 2333, 30, 6662, 18, 832, 19, 287, 1036, 697, 17, 926, 1359, 19, 287, 1036, 697, 17, 8373, 19, 10721, 19, 7525, 19, 16351, 87, 19, 1067, 1036, 376, 18, 18281, 7, 48, 26, 3672, 632, 5206, 13074, 716, 4894, 353, 279, 512, 28202, 18, 1220, 353, 1399, 358, 5309, 20092, 628, 16592, 310, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 9606, 1158, 8924, 5042, 1435, 288, 203, 3639, 2583, 12, 5, 2867, 24899, 3576, 12021, 1435, 2934, 291, 8924, 1435, 597, 389, 3576, 12021, 1435, 422, 2229, 18, 10012, 16, 315, 57, 2312, 38, 30, 10346, 8863, 203, 3639, 389, 31, 203, 565, 289, 203, 203, 565, 2254, 5034, 63, 3361, 65, 3238, 389, 7198, 67, 14048, 31, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { // silence state mutability warning without generating bytecode - //see https://github.com/ethereum/solidity/issues/2691 this; return msg.data; } } // File: contracts/Roles.sol /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping(address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } /** * @dev Remove an account's access to this role. */ function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } /** * @dev Check if an account has this role. * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero address"); return role.bearer[account]; } } // File: contracts/PauserRole.sol contract PauserRole is Context { using Roles for Roles.Role; event PauserAdded(address indexed account); event PauserRemoved(address indexed account); Roles.Role private _pausers; function initPauserRole() internal { _addPauser(_msgSender()); } constructor() { _addPauser(_msgSender()); } modifier onlyPauser() { require( isPauser(_msgSender()), "PauserRole: caller does not have the Pauser role" ); _; } function isPauser(address account) public view returns (bool) { return _pausers.has(account); } function addPauser(address account) public onlyPauser { _addPauser(account); } function renouncePauser() public { _removePauser(_msgSender()); } function _addPauser(address account) internal { _pausers.add(account); emit PauserAdded(account); } function _removePauser(address account) internal { _pausers.remove(account); emit PauserRemoved(account); } } // File: contracts/Pausable.sol contract Pausable is Context, PauserRole { event Paused(address account); event Unpaused(address account); bool private _paused; constructor() { _paused = false; } function paused() public view returns (bool) { return _paused; } modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } function pause() public onlyPauser whenNotPaused { _paused = true; emit Paused(_msgSender()); } function unpause() public onlyPauser whenPaused { _paused = false; emit Unpaused(_msgSender()); } } // File: contracts/WhitelistAdminRole.sol /** * @title WhitelistAdminRole * @dev WhitelistAdmins are responsible for assigning and removing Whitelisted accounts. */ contract WhitelistAdminRole is Context { using Roles for Roles.Role; event WhitelistAdminAdded(address indexed account); event WhitelistAdminRemoved(address indexed account); Roles.Role private _whitelistAdmins; function initWhiteListAdmin() internal { _addWhitelistAdmin(_msgSender()); } constructor() { _addWhitelistAdmin(_msgSender()); } modifier onlyWhitelistAdmin() { require( isWhitelistAdmin(_msgSender()), "WhitelistAdminRole: caller does not have the WhitelistAdmin role" ); _; } function isWhitelistAdmin(address account) public view returns (bool) { return _whitelistAdmins.has(account); } function addWhitelistAdmin(address account) public onlyWhitelistAdmin { _addWhitelistAdmin(account); } function renounceWhitelistAdmin() public { _removeWhitelistAdmin(_msgSender()); } function _addWhitelistAdmin(address account) internal { _whitelistAdmins.add(account); emit WhitelistAdminAdded(account); } function _removeWhitelistAdmin(address account) internal { _whitelistAdmins.remove(account); emit WhitelistAdminRemoved(account); } } // File: contracts/SafeMath.sol /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on 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-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath#mul: OVERFLOW"); return c; } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath#div: DIVISION_BY_ZERO"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath#sub: UNDERFLOW"); uint256 c = a - b; return c; } /** * @dev Adds two unsigned integers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath#add: OVERFLOW"); return c; } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "SafeMath#mod: DIVISION_BY_ZERO"); return a % b; } } // File: contracts/Address.sol /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks * -effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require( address(this).balance >= amount, "Address: insufficient balance" ); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{value: amount}(""); require( success, "Address: unable to send value, recipient may have reverted" ); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html * ?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue( target, data, value, "Address: low-level call with value failed" ); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require( address(this).balance >= value, "Address: insufficient balance for call" ); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{value: value}( data ); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall( target, data, "Address: low-level static call failed" ); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall( target, data, "Address: low-level delegate call failed" ); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) private pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: contracts/IERC20.sol 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 ); } // File: contracts/SafeERC20.sol /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.transfer.selector, to, value) ); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn( token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value) ); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn( token, abi.encodeWithSelector(token.approve.selector, spender, value) ); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender).add( value ); _callOptionalReturn( token, abi.encodeWithSelector( token.approve.selector, spender, newAllowance ) ); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender).sub( value ); _callOptionalReturn( token, abi.encodeWithSelector( token.approve.selector, spender, newAllowance ) ); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall( data, "SafeERC20: low-level call failed" ); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require( abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed" ); } } } // File: contracts/Wrap.sol contract Wrap { using SafeMath for uint256; using SafeERC20 for IERC20; IERC20 public token; constructor(IERC20 _tokenAddress) { token = IERC20(_tokenAddress); } uint256 private _totalSupply; mapping(address => uint256) private _balances; mapping(address => uint256[]) public fixedBalances; mapping(address => uint256[]) public releaseTime; mapping(address => uint256) public fixedStakeLength; event WithdrawnFixedStake(address indexed user, uint256 amount); function totalSupply() external view returns (uint256) { return _totalSupply; } function balanceOf(address account) public view returns (uint256) { return _balances[account]; } function stake(uint256 amount) public virtual { _totalSupply = _totalSupply.add(amount); _balances[msg.sender] = _balances[msg.sender].add(amount); IERC20(token).safeTransferFrom(msg.sender, address(this), amount); } function fixedStake(uint256 _day, uint256 _amount) public virtual { fixedBalances[msg.sender].push(_amount); uint256 time = block.timestamp + _day * 1 days; releaseTime[msg.sender].push(time); fixedStakeLength[msg.sender] += 1; _totalSupply = _totalSupply.add(_amount); IERC20(token).safeTransferFrom(msg.sender, address(this), _amount); } function withdraw(uint256 amount) public virtual { _totalSupply = _totalSupply.sub(amount); _balances[msg.sender] = _balances[msg.sender].sub(amount); IERC20(token).safeTransfer(msg.sender, amount); } function _rescueScore(address account) internal { uint256 amount = _balances[account]; _totalSupply = _totalSupply.sub(amount); _balances[account] = _balances[account].sub(amount); IERC20(token).safeTransfer(account, amount); } function withdrawFixedStake(uint256 _index) public virtual { require(fixedBalances[msg.sender].length >= _index, "No Record Found"); require(fixedBalances[msg.sender][_index] != 0, "No Balance To Break"); require( releaseTime[msg.sender][_index] <= block.timestamp, "Time isn't up" ); _totalSupply = _totalSupply.sub(fixedBalances[msg.sender][_index]); IERC20(token).safeTransfer( msg.sender, fixedBalances[msg.sender][_index] ); emit WithdrawnFixedStake(msg.sender, fixedBalances[msg.sender][_index]); removeBalance(_index); removeReleaseTime(_index); fixedStakeLength[msg.sender] -= 1; } function removeBalance(uint256 index) internal { // Move the last element into the place to delete fixedBalances[msg.sender][index] = fixedBalances[msg.sender][ fixedBalances[msg.sender].length - 1 ]; // Remove the last element fixedBalances[msg.sender].pop(); } function removeReleaseTime(uint256 index) internal { // Move the last element into the place to delete releaseTime[msg.sender][index] = releaseTime[msg.sender][ releaseTime[msg.sender].length - 1 ]; // Remove the last element releaseTime[msg.sender].pop(); } } // File: contracts/MyIERC721.sol interface MyIERC721 { /** * @dev Mints the 721 Contract */ function mint(address _to) external; } // File: contracts/ERC721TokenReceiver.sol /** * @dev ERC-721 interface for accepting safe transfers. * See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md. */ interface ERC721TokenReceiver { /** * @dev Handle the receipt of a NFT. The ERC721 smart contract calls this function on the * recipient after a `transfer`. This function MAY throw to revert and reject the transfer. Return * of other than the magic value MUST result in the transaction being reverted. * Returns `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` unless throwing. * @notice The contract address is always the message sender. A wallet/broker/auction application * MUST implement the wallet interface if it will accept safe transfers. * @param _operator The address which called `safeTransferFrom` function. * @param _from The address which previously owned the token. * @param _tokenId The NFT identifier which is being transferred. * @param _data Additional data with no specified format. * @return Returns `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. */ function onERC721Received( address _operator, address _from, uint256 _tokenId, bytes calldata _data ) external returns (bytes4); } // File: contracts/Stake.sol contract Stake is Wrap, Pausable, WhitelistAdminRole { struct Card { uint256 points; uint256 releaseTime; address erc721; uint256 supply; } using SafeMath for uint256; mapping(address => mapping(uint256 => Card)) public cards; mapping(address => uint256) public points; mapping(address => uint256) public lastUpdateTime; uint256 public rewardRate = 86400; uint256 public periodStart; uint256 public minStake; uint256 public maxStake; uint256 public minStakeFixed; uint256 public maxStakeFixed; address public controller; bool public constructed = false; address public rescuer; uint256 public spentScore; uint256 public maxDay; event Staked(address indexed user, uint256 amount); event FixedStaked( address indexed user, uint256 indexed amount, uint256 indexed day ); event Withdrawn(address indexed user, uint256 amount); event RescueRedeemed(address indexed user, uint256 amount); event Removed( address indexed erc1155, uint256 indexed card, address indexed recipient, uint256 amount ); event Redeemed( address indexed user, address indexed erc1155, uint256 indexed id, uint256 amount ); modifier updateReward(address account) { if (account != address(0)) { points[account] = earned(account); lastUpdateTime[account] = block.timestamp; } _; } constructor( uint256 _periodStart, uint256 _minStake, uint256 _maxStake, uint256 _minStakeFixed, uint256 _maxStakeFixed, uint256 _maxDay, address _controller, IERC20 _tokenAddress ) Wrap(_tokenAddress) { require( _minStake >= 0 && _maxStake > 0 && _maxStake >= _minStake, "Problem with min and max stake setup" ); require( address(_controller) != address(0), "controller can't be zero address" ); constructed = true; periodStart = _periodStart; minStake = _minStake; maxStake = _maxStake; minStakeFixed = _minStakeFixed; maxStakeFixed = _maxStakeFixed; controller = _controller; rescuer = _controller; maxDay = _maxDay; // super.initWhiteListAdmin(); } /** * @dev Sets the Earned Reward Rate of the user. */ function setRewardRate(uint256 _rewardRate) external onlyWhitelistAdmin { require(_rewardRate > 0, "Reward rate too low"); rewardRate = _rewardRate; } /** * @dev Sets the Max Day to stake for Fixed Staking. */ function setMaxDay(uint256 _day) external onlyWhitelistAdmin { require(_day > 0, "Maximum Day can't be zero"); maxDay = _day; } /** * @dev Sets the Minimum and Maximum amount to be staked in Flexi Stake. */ function setMinMaxStake(uint256 _minStake, uint256 _maxStake) external onlyWhitelistAdmin { require( _minStake > 0 && _maxStake > 0 && _maxStake >= _minStake, "Problem with min and max stake setup" ); minStake = _minStake; maxStake = _maxStake; } /** * @dev Sets the Minimum and Maximum amount to be staked in Fixed Stake. */ function setMinMaxStakeFixed(uint256 _minStakeFixed, uint256 _maxStakeFixed) external onlyWhitelistAdmin { require( _minStakeFixed > 0 && _maxStakeFixed > 0 && _maxStakeFixed >= _minStakeFixed, "Problem with min and max stake Fixed setup" ); minStakeFixed = _minStakeFixed; maxStakeFixed = _maxStakeFixed; } /** * @dev Sets the Rescuer address. */ function setRescuer(address _rescuer) external onlyWhitelistAdmin { require( address(_rescuer) != address(0), "controller can't be zero address" ); rescuer = _rescuer; } /** * @dev Returns the earned points by address. */ function earned(address account) public view returns (uint256) { return points[account].add(getCurrPoints(account)); } /** * @dev Calculates the earned points. */ function getCurrPoints(address account) internal view returns (uint256) { uint256 blockTime = block.timestamp; return blockTime.sub(lastUpdateTime[account]).mul(balanceOf(account)).div( rewardRate ); } /** * @dev Stake function to transfer token from user to contract. */ function stake(uint256 amount) public override updateReward(msg.sender) whenNotPaused() { require(block.timestamp >= periodStart, "Pool not open"); require( amount.add(balanceOf(msg.sender)) >= minStake, "Too few deposit" ); require( amount.add(balanceOf(msg.sender)) <= maxStake, "Deposit limit reached" ); super.stake(amount); emit Staked(msg.sender, amount); } /** * @dev fiexedStake function to transfer token from user to contract which locks for a particular period. */ function fixedStake(uint256 _day, uint256 _amount) public override whenNotPaused() { require(block.timestamp >= periodStart, "Pool not open"); require(_day > 0, "Can't stake for Zero days"); require(_day <= maxDay, "Stake Day Limit Exceeded"); require(_amount >= minStakeFixed, "Too few deposit"); require(_amount <= maxStakeFixed, "Deposit limit reached"); points[msg.sender] = points[msg.sender].add(_day.mul(_amount)); super.fixedStake(_day, _amount); emit FixedStaked(msg.sender, _amount, _day); } /** * @dev withdraw flexi staked amount of sender. */ function withdraw(uint256 amount) public override updateReward(msg.sender) { require(amount > 0, "Cannot withdraw 0"); super.withdraw(amount); emit Withdrawn(msg.sender, amount); } /** * @dev withdraw Fixed staked amount of sender. */ function withdrawFixedStake(uint256 index) public override { super.withdrawFixedStake(index); } /** * @dev withdraw all flexi staked amount of the sender. */ function exit() external { withdraw(balanceOf(msg.sender)); } /** * @dev rescuer withdraw flexi staked amount of the user. */ function rescueScore(address account) external updateReward(account) returns (uint256) { require(msg.sender == rescuer, "!rescuer"); uint256 earnedPoints = points[account]; spentScore = spentScore.add(earnedPoints); points[account] = 0; if (balanceOf(account) > 0) { _rescueScore(account); } emit RescueRedeemed(account, earnedPoints); return earnedPoints; } /** * @dev Add NFT to the contract. */ function addNfts( uint256 _points, uint256 _releaseTime, address _erc721Address, uint256 _tokenId, uint256 _cardAmount ) external onlyWhitelistAdmin returns (uint256) { require(_tokenId > 0, "Invalid token id"); require(_cardAmount > 0, "Invalid card amount"); Card storage c = cards[_erc721Address][_tokenId]; c.points = _points; c.releaseTime = _releaseTime; c.erc721 = _erc721Address; c.supply = _cardAmount; return _tokenId; } /** * @dev Minting the 721 to the sender address and reducing the points. */ function redeem(address _erc721Address, uint256 id) external updateReward(msg.sender) { require(cards[_erc721Address][id].points != 0, "Card not found"); require( block.timestamp >= cards[_erc721Address][id].releaseTime, "Card not released" ); require( points[msg.sender] >= cards[_erc721Address][id].points, "Redemption exceeds point balance" ); points[msg.sender] = points[msg.sender].sub( cards[_erc721Address][id].points ); spentScore = spentScore.add(cards[_erc721Address][id].points); MyIERC721(cards[_erc721Address][id].erc721).mint(msg.sender); emit Redeemed( msg.sender, cards[_erc721Address][id].erc721, id, cards[_erc721Address][id].points ); } }
super.initWhiteListAdmin();
) Wrap(_tokenAddress) { require( _minStake >= 0 && _maxStake > 0 && _maxStake >= _minStake, "Problem with min and max stake setup" ); require( address(_controller) != address(0), "controller can't be zero address" ); constructed = true; periodStart = _periodStart; minStake = _minStake; maxStake = _maxStake; minStakeFixed = _minStakeFixed; maxStakeFixed = _maxStakeFixed; controller = _controller; rescuer = _controller; maxDay = _maxDay; }
610,355
[ 1, 4625, 348, 7953, 560, 30, 21114, 202, 9565, 18, 2738, 13407, 682, 4446, 5621, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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374, 597, 389, 1896, 510, 911, 405, 374, 597, 389, 1896, 510, 911, 1545, 389, 1154, 510, 911, 16, 203, 5411, 315, 13719, 598, 1131, 471, 943, 384, 911, 3875, 6, 203, 3639, 11272, 203, 3639, 2583, 12, 203, 5411, 1758, 24899, 5723, 13, 480, 1758, 12, 20, 3631, 203, 5411, 315, 5723, 848, 1404, 506, 3634, 1758, 6, 203, 3639, 11272, 203, 3639, 15688, 273, 638, 31, 203, 3639, 3879, 1685, 273, 389, 6908, 1685, 31, 203, 3639, 1131, 510, 911, 273, 389, 1154, 510, 911, 31, 203, 3639, 943, 510, 911, 273, 389, 1896, 510, 911, 31, 203, 3639, 1131, 510, 911, 7505, 273, 389, 1154, 510, 911, 7505, 31, 203, 3639, 943, 510, 911, 7505, 273, 389, 1896, 510, 911, 7505, 31, 203, 3639, 2596, 273, 389, 5723, 31, 203, 3639, 400, 71, 6211, 273, 389, 5723, 31, 203, 3639, 943, 4245, 273, 389, 1896, 4245, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } //SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /** @title DooDooLand for SharkDooDoo to live */ contract DooDooLand is ERC721Enumerable, Ownable { uint16 private constant MAX_SUPPLY = 500; string private _baseTokenURI; string private _contractURI; /// @dev Setup ERC721 and initial baseURI constructor(string memory initBaseURI, string memory contractUri) ERC721("DooDooLand", "DDL") { _baseTokenURI = initBaseURI; _contractURI = contractUri; } /// @dev Owner reserve function reserve(address to, uint256 amount) external onlyOwner { uint256 newTokenId = totalSupply(); require(newTokenId + amount <= MAX_SUPPLY, "exceed max supply"); for (uint256 i = 0; i < amount; i++) { _safeMint(to, newTokenId); newTokenId++; } } /// @dev Set baseURI function setBaseURI(string calldata newBaseURI) external onlyOwner { _baseTokenURI = newBaseURI; } /// @dev Contract URI function contractURI() public view returns (string memory) { return _contractURI; } /// @dev Override _baseURI function _baseURI() internal view override returns (string memory) { return _baseTokenURI; } }
@dev Setup ERC721 and initial baseURI
{ _baseTokenURI = initBaseURI; _contractURI = contractUri; }
6,038,327
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 5206, 10939, 4232, 39, 27, 5340, 471, 2172, 1026, 3098, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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-100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/3/0x3cF8f446865F3b27D40D6d1D919b3F6f4F784054/sources/browser/MasterChef.sol
Afterwards, give mkbReward based on the pool's fixed APR. Fast low gas cost way of calculating prices since this can be called every block.
uint256 mkb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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 7734, 2254, 5034, 5028, 70, 5147, 273, 389, 588, 49, 8899, 5147, 5621, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/11155111/0x825F72D0421A5CB170b1E65813D531e97E5fF078/sources/contracts/facets/AdminFacet.sol
* @notice To be updated by contract owner to allow burning to claim a token for free + gas @param _burnClaimActive - new burn claim state @return bool - new burn claim state/
function setBurnClaimState(bool _burnClaimActive) external returns (bool) { LibDiamond.enforceIsContractOwner(); LibDiamondDapes.diamondDapesStorage().isBurnClaimActive = _burnClaimActive; return LibDiamondDapes.diamondDapesStorage().isBurnClaimActive; }
3,799,195
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 20392, 2974, 506, 3526, 635, 6835, 3410, 358, 1699, 18305, 310, 358, 7516, 279, 1147, 364, 4843, 397, 16189, 632, 891, 389, 70, 321, 9762, 3896, 300, 394, 18305, 7516, 919, 632, 2463, 1426, 300, 394, 18305, 7516, 919, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 225, 445, 15268, 321, 9762, 1119, 12, 6430, 389, 70, 321, 9762, 3896, 13, 3903, 1135, 261, 6430, 13, 288, 203, 565, 10560, 14521, 301, 1434, 18, 275, 5734, 2520, 8924, 5541, 5621, 203, 565, 10560, 14521, 301, 1434, 40, 7315, 18, 3211, 301, 1434, 40, 7315, 3245, 7675, 291, 38, 321, 9762, 3896, 273, 389, 70, 321, 9762, 3896, 31, 203, 565, 327, 10560, 14521, 301, 1434, 40, 7315, 18, 3211, 301, 1434, 40, 7315, 3245, 7675, 291, 38, 321, 9762, 3896, 31, 203, 225, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./partial_match/1/0x1402c061e2AeC7b41AE4911b40F7B340489dD1da/sources/DOSProxy.sol
groupSize must be an odd number.
function setGroupSize(uint newSize) public onlyOwner { require(newSize != groupSize && newSize % 2 != 0, "invalid-parameter"); groupSize = newSize; }
4,493,219
[ 1, 4625, 348, 7953, 560, 30, 225, 1041, 1225, 1297, 506, 392, 14800, 1300, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 444, 1114, 1225, 12, 11890, 21402, 13, 1071, 1338, 5541, 288, 203, 3639, 2583, 12, 2704, 1225, 480, 1041, 1225, 597, 21402, 738, 576, 480, 374, 16, 315, 5387, 17, 6775, 8863, 203, 3639, 1041, 1225, 273, 21402, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/137/0x8C9C7D42264E744b12EE42770E6de612bc0fcb9A/sources/project_/contracts/DistrictPower.sol
* @notice Transfer operator/
function transferOperator(address _operator) external { require(msg.sender == operator, "Only operator"); require(_operator != address(0), "Invalid address"); operator = _operator; }
3,776,989
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 20392, 12279, 3726, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 7412, 5592, 12, 2867, 389, 9497, 13, 3903, 288, 203, 3639, 2583, 12, 3576, 18, 15330, 422, 3726, 16, 315, 3386, 3726, 8863, 203, 3639, 2583, 24899, 9497, 480, 1758, 12, 20, 3631, 315, 1941, 1758, 8863, 203, 3639, 3726, 273, 389, 9497, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity 0.4.24; // File: node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address _who) public view returns (uint256); function transfer(address _to, uint256 _value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } // File: node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (_a == 0) { return 0; } c = _a * _b; assert(c / _a == _b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 _a, uint256 _b) internal pure returns (uint256) { // assert(_b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = _a / _b; // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold return _a / _b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { assert(_b <= _a); return _a - _b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) { c = _a + _b; assert(c >= _a); return c; } } // File: node_modules/openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) internal balances; uint256 internal totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } } // File: node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address _owner, address _spender) public view returns (uint256); function transferFrom(address _from, address _to, uint256 _value) public returns (bool); function approve(address _spender, uint256 _value) public returns (bool); event Approval( address indexed owner, address indexed spender, uint256 value ); } // File: node_modules/openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/issues/20 * Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); require(_to != address(0)); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * 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 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue >= oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } // File: node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } // File: node_modules/openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } modifier hasMintPermission() { require(msg.sender == owner); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint( address _to, uint256 _amount ) public hasMintPermission canMint returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() public onlyOwner canMint returns (bool) { mintingFinished = true; emit MintFinished(); return true; } } // File: contracts/PumaPayToken.sol /// PumaPayToken inherits from MintableToken, which in turn inherits from StandardToken. /// Super is used to bypass the original function signature and include the whenNotMinting modifier. contract PumaPayToken is MintableToken { string public name = "PumaPay"; string public symbol = "PMA"; uint8 public decimals = 18; constructor() public { } /// This modifier will be used to disable all ERC20 functionalities during the minting process. modifier whenNotMinting() { require(mintingFinished); _; } /// @dev transfer token for a specified address /// @param _to address The address to transfer to. /// @param _value uint256 The amount to be transferred. /// @return success bool Calling super.transfer and returns true if successful. function transfer(address _to, uint256 _value) public whenNotMinting returns (bool) { return super.transfer(_to, _value); } /// @dev Transfer tokens from one address to another. /// @param _from address The address which you want to send tokens from. /// @param _to address The address which you want to transfer to. /// @param _value uint256 the amount of tokens to be transferred. /// @return success bool Calling super.transferFrom and returns true if successful. function transferFrom(address _from, address _to, uint256 _value) public whenNotMinting returns (bool) { return super.transferFrom(_from, _to, _value); } } // File: contracts/PumaPayPullPayment.sol /// @title PumaPay Pull Payment - Contract that facilitates our pull payment protocol /// @author PumaPay Dev Team - <developers@pumapay.io> contract PumaPayPullPayment is Ownable { using SafeMath for uint256; /// =============================================================================================================== /// Events /// =============================================================================================================== event LogExecutorAdded(address executor); event LogExecutorRemoved(address executor); event LogPaymentRegistered(address clientAddress, address beneficiaryAddress, string paymentID); event LogPaymentCancelled(address clientAddress, address beneficiaryAddress, string paymentID); event LogPullPaymentExecuted(address clientAddress, address beneficiaryAddress, string paymentID); event LogSetExchangeRate(string currency, uint256 exchangeRate); /// =============================================================================================================== /// Constants /// =============================================================================================================== uint256 constant private DECIMAL_FIXER = 10000000000; /// 1e^10 - This transforms the Rate from decimals to uint256 uint256 constant private FIAT_TO_CENT_FIXER = 100; /// Fiat currencies have 100 cents in 1 basic monetary unit. uint256 constant private ONE_ETHER = 1 ether; /// PumaPay token has 18 decimals - same as one ETHER uint256 constant private MINIMUM_AMOUNT_OF_ETH_FOR_OPARATORS = 0.01 ether; /// minimum amount of ETHER the owner/executor should have uint256 constant private OVERFLOW_LIMITER_NUMBER = 10 ** 20; /// 1e^20 - This number is used to prevent numeric overflows /// =============================================================================================================== /// Members /// =============================================================================================================== PumaPayToken public token; mapping(string => uint256) private exchangeRates; mapping(address => bool) public executors; mapping(address => mapping(address => PullPayment)) public pullPayments; struct PullPayment { string merchantID; /// ID of the merchant string paymentID; /// ID of the payment string currency; /// 3-letter abbr i.e. 'EUR' / 'USD' etc. uint256 initialPaymentAmountInCents; /// initial payment amount in fiat in cents uint256 fiatAmountInCents; /// payment amount in fiat in cents uint256 frequency; /// how often merchant can pull - in seconds uint256 numberOfPayments; /// amount of pull payments merchant can make uint256 startTimestamp; /// when subscription starts - in seconds uint256 nextPaymentTimestamp; /// timestamp of next payment uint256 lastPaymentTimestamp; /// timestamp of last payment uint256 cancelTimestamp; /// timestamp the payment was cancelled } /// =============================================================================================================== /// Modifiers /// =============================================================================================================== modifier isExecutor() { require(executors[msg.sender]); _; } modifier executorExists(address _executor) { require(executors[_executor]); _; } modifier executorDoesNotExists(address _executor) { require(!executors[_executor]); _; } modifier paymentExists(address _client, address _beneficiary) { require(doesPaymentExist(_client, _beneficiary)); _; } modifier paymentNotCancelled(address _client, address _beneficiary) { require(pullPayments[_client][_beneficiary].cancelTimestamp == 0); _; } modifier isValidPullPaymentRequest(address _client, address _beneficiary, string _paymentID) { require( (pullPayments[_client][_beneficiary].initialPaymentAmountInCents > 0 || (now >= pullPayments[_client][_beneficiary].startTimestamp && now >= pullPayments[_client][_beneficiary].nextPaymentTimestamp) ) && pullPayments[_client][_beneficiary].numberOfPayments > 0 && (pullPayments[_client][_beneficiary].cancelTimestamp == 0 || pullPayments[_client][_beneficiary].cancelTimestamp > pullPayments[_client][_beneficiary].nextPaymentTimestamp) && keccak256( abi.encodePacked(pullPayments[_client][_beneficiary].paymentID) ) == keccak256(abi.encodePacked(_paymentID)) ); _; } modifier isValidDeletionRequest(string paymentID, address client, address beneficiary) { require( beneficiary != address(0) && client != address(0) && bytes(paymentID).length != 0 ); _; } modifier isValidAddress(address _address) { require(_address != address(0)); _; } /// =============================================================================================================== /// Constructor /// =============================================================================================================== /// @dev Contract constructor - sets the token address that the contract facilitates. /// @param _token Token Address. constructor (PumaPayToken _token) public { require(_token != address(0)); token = _token; } // @notice Will receive any eth sent to the contract function() external payable { } /// =============================================================================================================== /// Public Functions - Owner Only /// =============================================================================================================== /// @dev Adds a new executor. - can be executed only by the onwer. /// When adding a new executor 1 ETH is tranferred to allow the executor to pay for gas. /// The balance of the owner is also checked and if funding is needed 1 ETH is transferred. /// @param _executor - address of the executor which cannot be zero address. function addExecutor(address _executor) public onlyOwner isValidAddress(_executor) executorDoesNotExists(_executor) { _executor.transfer(1 ether); executors[_executor] = true; if (isFundingNeeded(owner)) { owner.transfer(1 ether); } emit LogExecutorAdded(_executor); } /// @dev Removes a new executor. - can be executed only by the onwer. /// The balance of the owner is checked and if funding is needed 1 ETH is transferred. /// @param _executor - address of the executor which cannot be zero address. function removeExecutor(address _executor) public onlyOwner isValidAddress(_executor) executorExists(_executor) { executors[_executor] = false; if (isFundingNeeded(owner)) { owner.transfer(1 ether); } emit LogExecutorRemoved(_executor); } /// @dev Sets the exchange rate for a currency. - can be executed only by the onwer. /// Emits 'LogSetExchangeRate' with the currency and the updated rate. /// The balance of the owner is checked and if funding is needed 1 ETH is transferred. /// @param _currency - address of the executor which cannot be zero address /// @param _rate - address of the executor which cannot be zero address function setRate(string _currency, uint256 _rate) public onlyOwner returns (bool) { exchangeRates[_currency] = _rate; emit LogSetExchangeRate(_currency, _rate); if (isFundingNeeded(owner)) { owner.transfer(1 ether); } return true; } /// =============================================================================================================== /// Public Functions - Executors Only /// =============================================================================================================== /// @dev Registers a new pull payment to the PumaPay Pull Payment Contract - The registration can be executed only by one of the executors of the PumaPay Pull Payment Contract /// and the PumaPay Pull Payment Contract checks that the pull payment has been singed by the client of the account. /// The balance of the executor (msg.sender) is checked and if funding is needed 1 ETH is transferred. /// Emits 'LogPaymentRegistered' with client address, beneficiary address and paymentID. /// @param v - recovery ID of the ETH signature. - https://github.com/ethereum/EIPs/issues/155 /// @param r - R output of ECDSA signature. /// @param s - S output of ECDSA signature. /// @param _merchantID - ID of the merchant. /// @param _paymentID - ID of the payment. /// @param _client - client address that is linked to this pull payment. /// @param _beneficiary - address that is allowed to execute this pull payment. /// @param _currency - currency of the payment / 3-letter abbr i.e. 'EUR'. /// @param _fiatAmountInCents - payment amount in fiat in cents. /// @param _frequency - how often merchant can pull - in seconds. /// @param _numberOfPayments - amount of pull payments merchant can make /// @param _startTimestamp - when subscription starts - in seconds. function registerPullPayment( uint8 v, bytes32 r, bytes32 s, string _merchantID, string _paymentID, address _client, address _beneficiary, string _currency, uint256 _initialPaymentAmountInCents, uint256 _fiatAmountInCents, uint256 _frequency, uint256 _numberOfPayments, uint256 _startTimestamp ) public isExecutor() { require( bytes(_paymentID).length > 0 && bytes(_currency).length > 0 && _client != address(0) && _beneficiary != address(0) && _fiatAmountInCents > 0 && _frequency > 0 && _frequency < OVERFLOW_LIMITER_NUMBER && _numberOfPayments > 0 && _startTimestamp > 0 && _startTimestamp < OVERFLOW_LIMITER_NUMBER ); pullPayments[_client][_beneficiary].currency = _currency; pullPayments[_client][_beneficiary].initialPaymentAmountInCents = _initialPaymentAmountInCents; pullPayments[_client][_beneficiary].fiatAmountInCents = _fiatAmountInCents; pullPayments[_client][_beneficiary].frequency = _frequency; pullPayments[_client][_beneficiary].startTimestamp = _startTimestamp; pullPayments[_client][_beneficiary].numberOfPayments = _numberOfPayments; require(isValidRegistration(v, r, s, _client, _beneficiary, pullPayments[_client][_beneficiary])); pullPayments[_client][_beneficiary].merchantID = _merchantID; pullPayments[_client][_beneficiary].paymentID = _paymentID; pullPayments[_client][_beneficiary].nextPaymentTimestamp = _startTimestamp; pullPayments[_client][_beneficiary].lastPaymentTimestamp = 0; pullPayments[_client][_beneficiary].cancelTimestamp = 0; if (isFundingNeeded(msg.sender)) { msg.sender.transfer(1 ether); } emit LogPaymentRegistered(_client, _beneficiary, _paymentID); } /// @dev Deletes a pull payment for a beneficiary - The deletion needs can be executed only by one of the executors of the PumaPay Pull Payment Contract /// and the PumaPay Pull Payment Contract checks that the beneficiary and the paymentID have been singed by the client of the account. /// This method sets the cancellation of the pull payment in the pull payments array for this beneficiary specified. /// The balance of the executor (msg.sender) is checked and if funding is needed 1 ETH is transferred. /// Emits 'LogPaymentCancelled' with beneficiary address and paymentID. /// @param v - recovery ID of the ETH signature. - https://github.com/ethereum/EIPs/issues/155 /// @param r - R output of ECDSA signature. /// @param s - S output of ECDSA signature. /// @param _paymentID - ID of the payment. /// @param _client - client address that is linked to this pull payment. /// @param _beneficiary - address that is allowed to execute this pull payment. function deletePullPayment( uint8 v, bytes32 r, bytes32 s, string _paymentID, address _client, address _beneficiary ) public isExecutor() paymentExists(_client, _beneficiary) paymentNotCancelled(_client, _beneficiary) isValidDeletionRequest(_paymentID, _client, _beneficiary) { require(isValidDeletion(v, r, s, _paymentID, _client, _beneficiary)); pullPayments[_client][_beneficiary].cancelTimestamp = now; if (isFundingNeeded(msg.sender)) { msg.sender.transfer(1 ether); } emit LogPaymentCancelled(_client, _beneficiary, _paymentID); } /// =============================================================================================================== /// Public Functions /// =============================================================================================================== /// @dev Executes a pull payment for the msg.sender - The pull payment should exist and the payment request /// should be valid in terms of when it can be executed. /// Emits 'LogPullPaymentExecuted' with client address, msg.sender as the beneficiary address and the paymentID. /// Use Case 1: Single/Recurring Fixed Pull Payment (initialPaymentAmountInCents == 0 ) /// ------------------------------------------------ /// We calculate the amount in PMA using the rate for the currency specified in the pull payment /// and the 'fiatAmountInCents' and we transfer from the client account the amount in PMA. /// After execution we set the last payment timestamp to NOW, the next payment timestamp is incremented by /// the frequency and the number of payments is decresed by 1. /// Use Case 2: Recurring Fixed Pull Payment with initial fee (initialPaymentAmountInCents > 0) /// ------------------------------------------------------------------------------------------------ /// We calculate the amount in PMA using the rate for the currency specified in the pull payment /// and the 'initialPaymentAmountInCents' and we transfer from the client account the amount in PMA. /// After execution we set the last payment timestamp to NOW and the 'initialPaymentAmountInCents to ZERO. /// @param _client - address of the client from which the msg.sender requires to pull funds. function executePullPayment(address _client, string _paymentID) public paymentExists(_client, msg.sender) isValidPullPaymentRequest(_client, msg.sender, _paymentID) { uint256 amountInPMA; if (pullPayments[_client][msg.sender].initialPaymentAmountInCents > 0) { amountInPMA = calculatePMAFromFiat(pullPayments[_client][msg.sender].initialPaymentAmountInCents, pullPayments[_client][msg.sender].currency); pullPayments[_client][msg.sender].initialPaymentAmountInCents = 0; } else { amountInPMA = calculatePMAFromFiat(pullPayments[_client][msg.sender].fiatAmountInCents, pullPayments[_client][msg.sender].currency); pullPayments[_client][msg.sender].nextPaymentTimestamp = pullPayments[_client][msg.sender].nextPaymentTimestamp + pullPayments[_client][msg.sender].frequency; pullPayments[_client][msg.sender].numberOfPayments = pullPayments[_client][msg.sender].numberOfPayments - 1; } pullPayments[_client][msg.sender].lastPaymentTimestamp = now; token.transferFrom(_client, msg.sender, amountInPMA); emit LogPullPaymentExecuted(_client, msg.sender, pullPayments[_client][msg.sender].paymentID); } function getRate(string _currency) public view returns (uint256) { return exchangeRates[_currency]; } /// =============================================================================================================== /// Internal Functions /// =============================================================================================================== /// @dev Calculates the PMA Rate for the fiat currency specified - The rate is set every 10 minutes by our PMA server /// for the currencies specified in the smart contract. /// @param _fiatAmountInCents - payment amount in fiat CENTS so that is always integer /// @param _currency - currency in which the payment needs to take place /// RATE CALCULATION EXAMPLE /// ------------------------ /// RATE ==> 1 PMA = 0.01 USD$ /// 1 USD$ = 1/0.01 PMA = 100 PMA /// Start the calculation from one ether - PMA Token has 18 decimals /// Multiply by the DECIMAL_FIXER (1e+10) to fix the multiplication of the rate /// Multiply with the fiat amount in cents /// Divide by the Rate of PMA to Fiat in cents /// Divide by the FIAT_TO_CENT_FIXER to fix the _fiatAmountInCents function calculatePMAFromFiat(uint256 _fiatAmountInCents, string _currency) internal view returns (uint256) { return ONE_ETHER.mul(DECIMAL_FIXER).mul(_fiatAmountInCents).div(exchangeRates[_currency]).div(FIAT_TO_CENT_FIXER); } /// @dev Checks if a registration request is valid by comparing the v, r, s params /// and the hashed params with the client address. /// @param v - recovery ID of the ETH signature. - https://github.com/ethereum/EIPs/issues/155 /// @param r - R output of ECDSA signature. /// @param s - S output of ECDSA signature. /// @param _client - client address that is linked to this pull payment. /// @param _beneficiary - address that is allowed to execute this pull payment. /// @param _pullPayment - pull payment to be validated. /// @return bool - if the v, r, s params with the hashed params match the client address function isValidRegistration( uint8 v, bytes32 r, bytes32 s, address _client, address _beneficiary, PullPayment _pullPayment ) internal pure returns (bool) { return ecrecover( keccak256( abi.encodePacked( _beneficiary, _pullPayment.currency, _pullPayment.initialPaymentAmountInCents, _pullPayment.fiatAmountInCents, _pullPayment.frequency, _pullPayment.numberOfPayments, _pullPayment.startTimestamp ) ), v, r, s) == _client; } /// @dev Checks if a deletion request is valid by comparing the v, r, s params /// and the hashed params with the client address. /// @param v - recovery ID of the ETH signature. - https://github.com/ethereum/EIPs/issues/155 /// @param r - R output of ECDSA signature. /// @param s - S output of ECDSA signature. /// @param _paymentID - ID of the payment. /// @param _client - client address that is linked to this pull payment. /// @param _beneficiary - address that is allowed to execute this pull payment. /// @return bool - if the v, r, s params with the hashed params match the client address function isValidDeletion( uint8 v, bytes32 r, bytes32 s, string _paymentID, address _client, address _beneficiary ) internal view returns (bool) { return ecrecover( keccak256( abi.encodePacked( _paymentID, _beneficiary ) ), v, r, s) == _client && keccak256( abi.encodePacked(pullPayments[_client][_beneficiary].paymentID) ) == keccak256(abi.encodePacked(_paymentID)); } /// @dev Checks if a payment for a beneficiary of a client exists. /// @param _client - client address that is linked to this pull payment. /// @param _beneficiary - address to execute a pull payment. /// @return bool - whether the beneficiary for this client has a pull payment to execute. function doesPaymentExist(address _client, address _beneficiary) internal view returns (bool) { return ( bytes(pullPayments[_client][_beneficiary].currency).length > 0 && pullPayments[_client][_beneficiary].fiatAmountInCents > 0 && pullPayments[_client][_beneficiary].frequency > 0 && pullPayments[_client][_beneficiary].startTimestamp > 0 && pullPayments[_client][_beneficiary].numberOfPayments > 0 && pullPayments[_client][_beneficiary].nextPaymentTimestamp > 0 ); } /// @dev Checks if the address of an owner/executor needs to be funded. /// The minimum amount the owner/executors should always have is 0.001 ETH /// @param _address - address of owner/executors that the balance is checked against. /// @return bool - whether the address needs more ETH. function isFundingNeeded(address _address) private view returns (bool) { return address(_address).balance <= MINIMUM_AMOUNT_OF_ETH_FOR_OPARATORS; } }
This modifier will be used to disable all ERC20 functionalities during the minting process.
modifier whenNotMinting() { require(mintingFinished); _; }
1,796,304
[ 1, 4625, 348, 7953, 560, 30, 225, 1220, 9606, 903, 506, 1399, 358, 4056, 777, 4232, 39, 3462, 18699, 1961, 4982, 326, 312, 474, 310, 1207, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 9606, 1347, 1248, 49, 474, 310, 1435, 288, 203, 3639, 2583, 12, 81, 474, 310, 10577, 1769, 203, 3639, 389, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
//! The Secret Store server key retrieval service contract. //! //! Copyright 2017 Svyatoslav Nikolsky, Parity Technologies Ltd. //! //! Licensed under the Apache License, Version 2.0 (the "License"); //! you may not use this file except in compliance with the License. //! You may obtain a copy of the License at //! //! http://www.apache.org/licenses/LICENSE-2.0 //! //! Unless required by applicable law or agreed to in writing, software //! distributed under the License is distributed on an "AS IS" BASIS, //! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //! See the License for the specific language governing permissions and //! limitations under the License. pragma solidity ^0.4.18; import "./SecretStoreService.sol"; import "./SecretStoreServiceBase.sol"; /// Server Key retrieval service contract. /* solium-disable-next-line */ contract SecretStoreServerKeyRetrievalService is SecretStoreServiceBase, ServerKeyRetrievalServiceClientApi, ServerKeyRetrievalServiceKeyServerApi { /// Server key retrieval request. struct ServerKeyRetrievalRequest { bool isActive; RequestResponses thresholdResponses; RequestResponses responses; bytes publicWithMaxThreshold; } /// When sever key retrieval request is received. event ServerKeyRetrievalRequested(bytes32 serverKeyId); /// When server key is retrieved. event ServerKeyRetrieved(bytes32 indexed serverKeyId, bytes serverKeyPublic); /// When error occurs during server key retrieval. event ServerKeyRetrievalError(bytes32 indexed serverKeyId); /// Constructor. constructor(address keyServerSetAddressInit) SecretStoreServiceBase(keyServerSetAddressInit) public { serverKeyRetrievalFee = 100 finney; maxServerKeyRetrievalRequests = 8; } // === Interface methods === /// We do not support direct payments. function() payable public { revert(); } /// Retrieve existing server key. Retrieved key will be published via ServerKeyRetrieved or ServerKeyRetrievalError. function retrieveServerKey(bytes32 serverKeyId) external payable whenFeePaid(serverKeyRetrievalFee) { // check maximum number of requests require(serverKeyRetrievalRequestsKeys.length < maxServerKeyRetrievalRequests); ServerKeyRetrievalRequest storage request = serverKeyRetrievalRequests[serverKeyId]; require(!request.isActive); deposit(); // we do not know exact threshold value here && we can not blindly trust the first response // => we should agree upon two values: threshold && server key itself // => assuming that all authorities will eventually respond with value/error, we will wait for: // 1) at least 50% + 1 authorities agreement on the same threshold value // 2) after threshold is agreed, we will wait for threshold + 1 values of server key request.isActive = true; serverKeyRetrievalRequestsKeys.push(serverKeyId); emit ServerKeyRetrievalRequested(serverKeyId); } /// Called when retrieval is reported by key server. function serverKeyRetrieved(bytes32 serverKeyId, bytes serverKeyPublic, uint8 threshold) external validPublic(serverKeyPublic) { // check if request still active ServerKeyRetrievalRequest storage request = serverKeyRetrievalRequests[serverKeyId]; if (!request.isActive) { return; } // insert response (we're waiting for responses from all authorities here) // it checks that tx.origin is actually the key server uint8 keyServerIndex = requireKeyServer(msg.sender); ResponseSupport responseSupport; bytes memory finalServerKeyPublic; (responseSupport, finalServerKeyPublic) = insertServerKeyRetrievalResponse( request, keyServerIndex, serverKeyPublic, threshold); // ...and check if there are enough support if (responseSupport == ResponseSupport.Unconfirmed) { // not confirmed (yet) return; } // delete request and fire event clearServerKeyRetrievalRequest(serverKeyId, request); if (responseSupport == ResponseSupport.Confirmed) { // confirmed emit ServerKeyRetrieved(serverKeyId, finalServerKeyPublic); } else { // no consensus possible at all emit ServerKeyRetrievalError(serverKeyId); } } /// Called when error occurs during server key retrieval. function serverKeyRetrievalError(bytes32 serverKeyId) external { // check if request still active ServerKeyRetrievalRequest storage request = serverKeyRetrievalRequests[serverKeyId]; if (!request.isActive) { return; } // check that it is called by key server uint8 keyServerIndex = requireKeyServer(msg.sender); // all key servers in SS with auto-migration enabled should have a share for every key // => we could make an error fatal, but let's tolerate such issues // => insert invalid response and check if there are enough confirmations bytes memory invalidPublic = new bytes(64); ResponseSupport responseSupport; bytes memory _finalServerKeyPublic; (responseSupport, _finalServerKeyPublic) = insertServerKeyRetrievalResponse( request, keyServerIndex, invalidPublic, 0xFF); if (responseSupport == ResponseSupport.Unconfirmed) { return; } // delete request and fire event clearServerKeyRetrievalRequest(serverKeyId, request); emit ServerKeyRetrievalError(serverKeyId); } /// Get count of pending server key retrieval requests. function serverKeyRetrievalRequestsCount() view external returns (uint256) { return serverKeyRetrievalRequestsKeys.length; } /// Get server key retrieval request with given index. /// Returns: (serverKeyId) function getServerKeyRetrievalRequest(uint256 index) view external returns (bytes32) { bytes32 serverKeyId = serverKeyRetrievalRequestsKeys[index]; return ( serverKeyId, ); } /// Returs true if response from given keyServer is required. function isServerKeyRetrievalResponseRequired(bytes32 serverKeyId, address keyServer) view external returns (bool) { uint8 keyServerIndex = requireKeyServer(keyServer); ServerKeyRetrievalRequest storage request = serverKeyRetrievalRequests[serverKeyId]; return isResponseRequired(request.thresholdResponses, keyServerIndex); } // === Administrative methods === /// Set server key retrieval fee. function setServerKeyRetrievalFee(uint256 newFee) public onlyOwner { serverKeyRetrievalFee = newFee; } /// Set server key retrieval requests limit. function setMaxServerKeyRetrievalRequests(uint256 newLimit) public onlyOwner { maxServerKeyRetrievalRequests = newLimit; } /// Delete server key retrieval request. function deleteServerKeyRetrievalRequest(bytes32 serverKeyId) public onlyOwner { ServerKeyRetrievalRequest storage request = serverKeyRetrievalRequests[serverKeyId]; clearServerKeyRetrievalRequest(serverKeyId, request); emit ServerKeyRetrievalError(serverKeyId); } // === Internal methods === /// Insert both threshold and public response. function insertServerKeyRetrievalResponse( ServerKeyRetrievalRequest storage request, uint8 keyServerIndex, bytes serverKeyPublic, uint8 threshold) private returns (ResponseSupport, bytes) { // insert threshold response bytes32 thresholdResponse = bytes32(threshold); ResponseSupport thresholdResponseSupport = insertResponse( request.thresholdResponses, keyServerIndex, keyServersCount() / 2, thresholdResponse); if (thresholdResponseSupport == ResponseSupport.Impossible) { return (thresholdResponseSupport, serverKeyPublic); } // insert response itself bytes32 response = keccak256(abi.encodePacked(serverKeyPublic, threshold)); ResponseSupport responseSupport = insertResponse( request.responses, keyServerIndex, threshold, response); if (thresholdResponseSupport == ResponseSupport.Unconfirmed) { // even though threshold is not yet confirmed, we might want to remember public // to return it in future if (threshold != 0xFF && request.responses.maxResponseSupport == request.responses.responsesSupport[response]) { request.publicWithMaxThreshold = serverKeyPublic; } // if threshold we have responded with is not confirmed, public is also not confirmed return (ResponseSupport.Unconfirmed, serverKeyPublic); } if (responseSupport == ResponseSupport.Unconfirmed) { // threshold is confirmed and response is unconfirmed // => we might want to check if some other public has enough confirmations already if (request.responses.maxResponseSupport >= threshold + 1) { return (ResponseSupport.Confirmed, request.publicWithMaxThreshold); } } return (responseSupport, serverKeyPublic); } /// Clear server key retrieval request traces. function clearServerKeyRetrievalRequest(bytes32 serverKeyId, ServerKeyRetrievalRequest storage request) private { clearResponses(request.responses); delete serverKeyRetrievalRequests[serverKeyId]; removeRequestKey(serverKeyRetrievalRequestsKeys, serverKeyId); } /// Server key retrieval fee. uint256 public serverKeyRetrievalFee; /// Maximal number of active server key retrieval requests. We're limiting this number to avoid /// infinite gas costs of some functions. uint256 public maxServerKeyRetrievalRequests; /// Pending retrieval requests. mapping (bytes32 => ServerKeyRetrievalRequest) private serverKeyRetrievalRequests; /// Pending retrieval requests keys. bytes32[] private serverKeyRetrievalRequestsKeys; }
When server key is retrieved.
event ServerKeyRetrieved(bytes32 indexed serverKeyId, bytes serverKeyPublic);
12,717,659
[ 1, 4625, 348, 7953, 560, 30, 225, 5203, 1438, 498, 353, 10295, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 202, 2575, 3224, 653, 3848, 2155, 12, 3890, 1578, 8808, 1438, 14140, 16, 1731, 1438, 653, 4782, 1769, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./partial_match/1/0xE49EfeDeD03F174cAB1d5F090864894c57C97aC5/sources/TrashART.sol
============================================================= STRUCTS =============================================================
interface IERC721A { error ApprovalCallerNotOwnerNorApproved(); error ApprovalQueryForNonexistentToken(); error BalanceQueryForZeroAddress(); error MintToZeroAddress(); error MintZeroQuantity(); error OwnerQueryForNonexistentToken(); error TransferCallerNotOwnerNorApproved(); error TransferFromIncorrectOwner(); error TransferToNonERC721ReceiverImplementer(); error TransferToZeroAddress(); error URIQueryForNonexistentToken(); error MintERC2309QuantityExceedsLimit(); error OwnershipNotInitializedForExtraData(); struct TokenOwnership { address addr; uint64 startTimestamp; bool burned; uint24 extraData; } }
2,701,592
[ 1, 4625, 348, 7953, 560, 30, 225, 422, 20775, 1432, 12275, 18701, 7128, 9749, 55, 422, 20775, 1432, 12275, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 5831, 467, 654, 39, 27, 5340, 37, 288, 203, 565, 555, 1716, 685, 1125, 11095, 1248, 5541, 50, 280, 31639, 5621, 203, 203, 565, 555, 1716, 685, 1125, 1138, 1290, 3989, 19041, 1345, 5621, 203, 203, 565, 555, 30918, 1138, 1290, 7170, 1887, 5621, 203, 203, 565, 555, 490, 474, 774, 7170, 1887, 5621, 203, 203, 565, 555, 490, 474, 7170, 12035, 5621, 203, 203, 565, 555, 16837, 1138, 1290, 3989, 19041, 1345, 5621, 203, 203, 565, 555, 12279, 11095, 1248, 5541, 50, 280, 31639, 5621, 203, 203, 565, 555, 12279, 1265, 16268, 5541, 5621, 203, 203, 565, 555, 12279, 774, 3989, 654, 39, 27, 5340, 12952, 5726, 264, 5621, 203, 203, 565, 555, 12279, 774, 7170, 1887, 5621, 203, 203, 565, 555, 3699, 1138, 1290, 3989, 19041, 1345, 5621, 203, 203, 565, 555, 490, 474, 654, 39, 4366, 5908, 12035, 424, 5288, 87, 3039, 5621, 203, 203, 565, 555, 14223, 9646, 5310, 1248, 11459, 1290, 7800, 751, 5621, 203, 203, 203, 565, 1958, 3155, 5460, 12565, 288, 203, 3639, 1758, 3091, 31, 203, 3639, 2254, 1105, 787, 4921, 31, 203, 3639, 1426, 18305, 329, 31, 203, 3639, 2254, 3247, 2870, 751, 31, 203, 565, 289, 203, 203, 203, 97, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// SPDX-License-Identifier: MIT pragma solidity ^0.6.6; // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol // Subject to the MIT license. /** * @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(uint a, uint b) internal pure returns (uint) { uint c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the addition of two unsigned integers, reverting with custom message on overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint a, uint b, string memory errorMessage) internal pure returns (uint) { uint c = a + b; require(c >= a, errorMessage); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot underflow. */ function sub(uint a, uint b) internal pure returns (uint) { return sub(a, b, "Uniloan::SafeMath: subtraction underflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot underflow. */ function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) { require(b <= a, errorMessage); uint 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(uint a, uint b) internal pure returns (uint) { // 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; } uint c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint a, uint b, string memory errorMessage) internal pure returns (uint) { // 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; } uint c = a * b; require(c / a == b, errorMessage); 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(uint a, uint b) internal pure returns (uint) { 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(uint a, uint b, string memory errorMessage) internal pure returns (uint) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint 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(uint a, uint b) internal pure returns (uint) { 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(uint a, uint b, string memory errorMessage) internal pure returns (uint) { require(b != 0, errorMessage); return a % b; } } interface Governance { function proposeJob(address job) external returns (uint); } interface WETH9 { function deposit() external payable; function balanceOf(address account) external view returns (uint); function approve(address spender, uint amount) external returns (bool); } interface Uniswap { function factory() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); } interface UniswapPair { function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function balanceOf(address account) external view returns (uint); function approve(address spender, uint amount) external returns (bool); function totalSupply() external view returns (uint); } interface Factory { function getPair(address tokenA, address tokenB) external view returns (address pair); } contract Keep3r { using SafeMath for uint; /// @notice WETH address to liquidity into UNI WETH9 public constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); /// @notice UniswapV2Router address Uniswap public constant UNI = Uniswap(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); /// @notice EIP-20 token name for this token string public constant name = "Keep3r"; /// @notice EIP-20 token symbol for this token string public constant symbol = "KPR"; /// @notice EIP-20 token decimals for this token uint8 public constant decimals = 18; /// @notice Total number of tokens in circulation uint public totalSupply = 0; // Initial 0 /// @notice A record of each accounts delegate mapping (address => address) public delegates; /// @notice A record of votes checkpoints for each account, by index mapping (address => mapping (uint32 => Checkpoint)) public checkpoints; /// @notice The number of checkpoints for each account mapping (address => uint32) public numCheckpoints; mapping (address => mapping (address => uint)) internal allowances; mapping (address => uint) internal balances; /// @notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint chainId,address verifyingContract)"); /// @notice The EIP-712 typehash for the delegation struct used by the contract bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint nonce,uint expiry)"); /// @notice The EIP-712 typehash for the permit struct used by the contract bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint value,uint nonce,uint deadline)"); /// @notice A record of states for signing / validating signatures mapping (address => uint) public nonces; /// @notice An event thats emitted when an account changes its delegate event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); /// @notice An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance); /// @notice A checkpoint for marking number of votes from a given block struct Checkpoint { uint32 fromBlock; uint votes; } /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) public { return _delegate(msg.sender, delegatee); } /** * @notice Delegates votes from signatory to `delegatee` * @param delegatee The address to delegate votes to * @param nonce The contract state required to match the signature * @param expiry The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public { bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this))); bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry)); bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "::delegateBySig: invalid signature"); require(nonce == nonces[signatory]++, "::delegateBySig: invalid nonce"); require(now <= expiry, "::delegateBySig: signature expired"); return _delegate(signatory, delegatee); } /** * @notice Gets the current votes balance for `account` * @param account The address to get votes balance * @return The number of current votes for `account` */ function getCurrentVotes(address account) external view returns (uint) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; } /** * @notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorVotes(address account, uint blockNumber) public view returns (uint) { require(blockNumber < block.number, "::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check most recent balance if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } // Next check implicit zero balance if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[account][lower].votes; } function _delegate(address delegator, address delegatee) internal { address currentDelegate = delegates[delegator]; uint delegatorBalance = bonds[delegator]; delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, delegatorBalance); } function _moveDelegates(address srcRep, address dstRep, uint amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { uint32 srcRepNum = numCheckpoints[srcRep]; uint srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint srcRepNew = srcRepOld.sub(amount, "::_moveVotes: vote amount underflows"); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { uint32 dstRepNum = numCheckpoints[dstRep]; uint dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint oldVotes, uint newVotes) internal { uint32 blockNumber = safe32(block.number, "::_writeCheckpoint: block number exceeds 32 bits"); if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; } else { checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes); numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } function safe32(uint n, string memory errorMessage) internal pure returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); } /// @notice The standard EIP-20 transfer event event Transfer(address indexed from, address indexed to, uint amount); /// @notice The standard EIP-20 approval event event Approval(address indexed owner, address indexed spender, uint amount); /// @notice Submit a job event SubmitJob(address indexed job, address indexed provider, uint block, uint credit); /// @notice Remove credit for a job event RemoveJob(address indexed job, address indexed provider, uint block, uint credit); /// @notice Unbond credit for a job event UnbondJob(address indexed job, address indexed provider, uint block, uint credit); /// @notice Added a Job event JobAdded(address indexed job, uint block, address governance); /// @notice Removed a job event JobRemoved(address indexed job, uint block, address governance); /// @notice Worked a job event KeeperWorked(address indexed job, address indexed keeper, uint block); /// @notice Keeper bonding event KeeperBonding(address indexed keeper, uint block, uint active, uint bond); /// @notice Keeper bonded event KeeperBonded(address indexed keeper, uint block, uint activated, uint bond); /// @notice Keeper unbonding event KeeperUnbonding(address indexed keeper, uint block, uint deactive, uint bond); /// @notice Keeper unbound event KeeperUnbound(address indexed keeper, uint block, uint deactivated, uint bond); /// @notice Keeper slashed event KeeperSlashed(address indexed keeper, address indexed slasher, uint block, uint slash); /// @notice Keeper disputed event KeeperDispute(address indexed keeper, uint block); /// @notice Keeper resolved event KeeperResolved(address indexed keeper, uint block); /// @notice 1 day to bond to become a keeper uint constant public BOND = 3 days; /// @notice 14 days to unbond to remove funds from being a keeper uint constant public UNBOND = 14 days; /// @notice 7 days maximum downtime before being slashed uint constant public DOWNTIME = 7 days; /// @notice 5% of funds slashed for downtime uint constant public DOWNTIMESLASH = 500; uint constant public BASE = 10000; /// @notice tracks all current bondings (time) mapping(address => uint) public bondings; /// @notice tracks all current unbondings (time) mapping(address => uint) public unbondings; /// @notice tracks all current pending bonds (amount) mapping(address => uint) public pendingbonds; /// @notice tracks how much a keeper has bonded mapping(address => uint) public bonds; /// @notice total bonded (totalSupply for bonds) uint public totalBonded = 0; /// @notice tracks when a keeper was first registered mapping(address => uint) public firstSeen; /// @notice tracks if a keeper has a pending dispute mapping(address => bool) public disputes; /// @notice tracks last job performed for a keeper mapping(address => uint) public lastJob; /// @notice tracks the amount of job executions for a keeper mapping(address => uint) public work; /// @notice tracks the total job executions for a keeper mapping(address => uint) public workCompleted; /// @notice list of all jobs registered for the keeper system mapping(address => bool) public jobs; /// @notice the current credit available for a job mapping(address => uint) public credits; /// @notice the balances for the liquidity providers mapping(address => uint) public liquidityProviders; /// @notice tracks the relationship between a liquidityProvider and their job mapping(address => address) public liquidityProvided; /// @notice liquidity unbonding days mapping(address => uint) public liquidityUnbonding; /// @notice job proposal delay mapping(address => uint) public jobProposalDelay; /// @notice liquidity apply date mapping(address => uint) public liquidityApplied; /// @notice list of all current keepers mapping(address => bool) public keepers; /// @notice traversable array of keepers to make external management easier address[] public keeperList; /// @notice governance address for the governance contract address public governance; /// @notice the liquidity token supplied by users paying for jobs UniswapPair public liquidity; constructor() public { // Set governance for this token governance = msg.sender; _mint(msg.sender, 10000e18); } function setup() public payable { require(address(liquidity) == address(0x0), "Keep3r::setup: keep3r already setup"); WETH.deposit.value(msg.value)(); WETH.approve(address(UNI), msg.value); _mint(address(this), 400e18); allowances[address(this)][address(UNI)] = balances[address(this)]; // Setup liquidity pool with initial liquidity 1 ETH : 400 KPR UNI.addLiquidity(address(this), address(WETH), balances[address(this)], WETH.balanceOf(address(this)), 0, 0, msg.sender, now.add(1800)); liquidity = UniswapPair(Factory(UNI.factory()).getPair(address(this), address(WETH))); } /** * @notice Allows liquidity providers to submit jobs * @param amount the amount of tokens to mint to treasury * @param job the job to assign credit to * @param amount the amount of liquidity tokens to use */ function submitJob(address job, uint amount) external { require(liquidityProvided[msg.sender]==address(0x0), "Keep3r::submitJob: liquidity already provided, please remove first"); liquidity.transferFrom(msg.sender, address(this), amount); liquidityProviders[msg.sender] = amount; liquidityProvided[msg.sender] = job; liquidityApplied[msg.sender] = now.add(1 days); if (!jobs[job] && jobProposalDelay[job] < now) { Governance(governance).proposeJob(job); jobProposalDelay[job] = now.add(UNBOND); } emit SubmitJob(job, msg.sender, block.number, amount); } function credit(address provider, address job) external { require(liquidityApplied[provider] != 0, "Keep3r::credit: submitJob first"); require(liquidityApplied[provider] < now, "Keep3r::credit: still bonding"); uint _liquidity = balances[address(liquidity)]; uint _credit = _liquidity.mul(liquidityProviders[provider]).div(liquidity.totalSupply()); credits[job] = credits[job].add(_credit.mul(2)); // Double liquidity to account for 50:50 } /** * @notice Unbond liquidity for a pending keeper job */ function unbondJob() external { liquidityUnbonding[msg.sender] = now.add(UNBOND); emit UnbondJob(liquidityProvided[msg.sender], msg.sender, block.number, liquidityProviders[msg.sender]); } /** * @notice Allows liquidity providers to remove liquidity */ function removeJob() external { require(liquidityUnbonding[msg.sender] != 0, "Keep3r::removeJob: unbond first"); require(liquidityUnbonding[msg.sender] < now, "Keep3r::removeJob: still unbonding"); uint _provided = liquidityProviders[msg.sender]; uint _liquidity = balances[address(liquidity)]; uint _credit = _liquidity.mul(_provided).div(liquidity.totalSupply()); address _job = liquidityProvided[msg.sender]; if (_credit > credits[_job]) { credits[_job] = 0; } else { credits[_job].sub(_credit); } liquidity.transfer(msg.sender, _provided); liquidityProviders[msg.sender] = 0; liquidityProvided[msg.sender] = address(0x0); emit RemoveJob(_job, msg.sender, block.number, _provided); } /** * @notice Allows governance to mint new tokens to treasury * @param amount the amount of tokens to mint to treasury */ function mint(uint amount) external { require(msg.sender == governance, "Keep3r::mint: governance only"); _mint(governance, amount); } function burn(uint amount) external { _burn(msg.sender, amount); } function _mint(address dst, uint amount) internal { // mint the amount totalSupply = totalSupply.add(amount); // transfer the amount to the recipient balances[dst] = balances[dst].add(amount); emit Transfer(address(0), dst, amount); } function _burn(address dst, uint amount) internal { require(dst != address(0), "::_burn: burn from the zero address"); balances[dst] = balances[dst].sub(amount, "::_burn: burn amount exceeds balance"); totalSupply = totalSupply.sub(amount); emit Transfer(dst, address(0), amount); } /** * @notice Allows keepers to claim for work done */ function claim() external { _mint(msg.sender, work[msg.sender]); work[msg.sender] = 0; } /** * @notice Implemented by jobs to show that a keeper performend work * @param keeper address of the keeper that performed the work * @param amount the reward that should be allocated */ function workReceipt(address keeper, uint amount) external { require(jobs[msg.sender], "Keep3r::workReceipt: only jobs can approve work"); lastJob[keeper] = now; credits[msg.sender] = credits[msg.sender].sub(amount, "Keep3r::workReceipt: insuffient funds to pay keeper"); work[keeper] = work[keeper].add(amount); workCompleted[keeper] = workCompleted[keeper].add(amount); emit KeeperWorked(msg.sender, keeper, block.number); } /** * @notice Allows governance to add new job systems * @param job address of the contract for which work should be performed */ function addJob(address job) external { require(msg.sender == governance, "Keep3r::addJob: only governance can add jobs"); jobs[job] = true; emit JobAdded(job, block.number, msg.sender); } /** * @notice Allows governance to remove a job from the systems * @param job address of the contract for which work should be performed */ function removeJob(address job) external { require(msg.sender == governance, "Keep3r::removeJob: only governance can remove jobs"); jobs[job] = false; emit JobRemoved(job, block.number, msg.sender); } /** * @notice Allows governance to change governance (for future upgradability) * @param _governance new governance address to set */ function setGovernance(address _governance) external { require(msg.sender == governance, "Keep3r::setGovernance: only governance can set"); governance = _governance; } /** * @notice confirms if the current keeper is registered, can be used for general (non critical) functions * @return true/false if the address is a keeper */ function isKeeper(address keeper) external view returns (bool) { return keepers[keeper]; } /** * @notice confirms if the current keeper is registered and has a minimum bond, should be used for protected functions * @return true/false if the address is a keeper and has more than the bond */ function isMinKeeper(address keeper, uint minBond, uint completed, uint age) external view returns (bool) { return keepers[keeper] && bonds[keeper] >= minBond && workCompleted[keeper] > completed && now.sub(firstSeen[keeper]) > age; } /** * @notice begin the bonding process for a new keeper */ function bond(uint amount) external { require(pendingbonds[msg.sender] == 0, "Keep3r::bond: current pending bond"); bondings[msg.sender] = now.add(BOND); pendingbonds[msg.sender] = amount; _transferTokens(msg.sender, address(this), amount); emit KeeperBonding(msg.sender, block.number, bondings[msg.sender], amount); } function getKeepers() external view returns (address[] memory) { return keeperList; } /** * @notice allows a keeper to activate/register themselves after bonding */ function activate() external { require(bondings[msg.sender] != 0, "Keep3r::activate: bond first"); require(bondings[msg.sender] < now, "Keep3r::activate: still bonding"); if (!keepers[msg.sender]) { firstSeen[msg.sender] = now; } keepers[msg.sender] = true; totalBonded = totalBonded.add(pendingbonds[msg.sender]); bonds[msg.sender] = bonds[msg.sender].add(pendingbonds[msg.sender]); pendingbonds[msg.sender] = 0; if (lastJob[msg.sender] == 0) { lastJob[msg.sender] = now; keeperList.push(msg.sender); } emit KeeperBonded(msg.sender, block.number, block.timestamp, bonds[msg.sender]); } /** * @notice begin the unbonding process to stop being a keeper */ function unbond() external { keepers[msg.sender] = false; unbondings[msg.sender] = now.add(UNBOND); totalBonded = totalBonded.sub(bonds[msg.sender]); _moveDelegates(delegates[msg.sender], address(0), bonds[msg.sender]); emit KeeperUnbonding(msg.sender, block.number, unbondings[msg.sender], bonds[msg.sender]); } /** * @notice withdraw funds after unbonding has finished */ function withdraw() external { require(unbondings[msg.sender] != 0, "Keep3r::withdraw: unbond first"); require(unbondings[msg.sender] < now, "Keep3r::withdraw: still unbonding"); require(!disputes[msg.sender], "Keep3r::withdraw: pending disputes"); _transferTokens(address(this), msg.sender, bonds[msg.sender]); emit KeeperUnbound(msg.sender, block.number, block.timestamp, bonds[msg.sender]); bonds[msg.sender] = 0; } /** * @notice slash a keeper for downtime * @param keeper the address being slashed */ function down(address keeper) external { require(keepers[keeper], "Keep3r::down: keeper not registered"); require(lastJob[keeper].add(DOWNTIME) < now, "Keep3r::down: keeper safe"); uint _slash = bonds[keeper].mul(DOWNTIMESLASH).div(BASE); bonds[keeper] = bonds[keeper].sub(_slash); _mint(msg.sender, 1e18); lastJob[keeper] = now; emit KeeperSlashed(keeper, msg.sender, block.number, _slash); } /** * @notice allows governance to create a dispute for a given keeper * @param keeper the address in dispute */ function dispute(address keeper) external returns (uint) { require(msg.sender == governance, "Keep3r::dispute: only governance can dispute"); disputes[keeper] = true; emit KeeperDispute(keeper, block.number); } /** * @notice allows governance to slash a keeper based on a dispute * @param keeper the address being slashed * @param amount the amount being slashed */ function slash(address keeper, uint amount) external { require(msg.sender == governance, "Keep3r::slash: only governance can resolve"); bonds[keeper] = bonds[keeper].sub(amount); disputes[keeper] = false; emit KeeperSlashed(keeper, msg.sender, block.number, amount); } /** * @notice allows governance to resolve a dispute on a keeper * @param keeper the address cleared */ function resolve(address keeper) external { require(msg.sender == governance, "Keep3r::resolve: only governance can resolve"); disputes[keeper] = false; emit KeeperResolved(keeper, block.number); } /** * @notice Get the number of tokens `spender` is approved to spend on behalf of `account` * @param account The address of the account holding the funds * @param spender The address of the account spending the funds * @return The number of tokens approved */ function allowance(address account, address spender) external view returns (uint) { return allowances[account][spender]; } /** * @notice Approve `spender` to transfer up to `amount` from `src` * @dev This will overwrite the approval amount for `spender` * and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve) * @param spender The address of the account which may transfer tokens * @param amount The number of tokens that are approved (2^256-1 means infinite) * @return Whether or not the approval succeeded */ function approve(address spender, uint amount) public returns (bool) { allowances[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } /** * @notice Triggers an approval from owner to spends * @param owner The address to approve from * @param spender The address to be approved * @param amount The number of tokens that are approved (2^256-1 means infinite) * @param deadline The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function permit(address owner, address spender, uint amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external { bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this))); bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, amount, nonces[owner]++, deadline)); bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "::permit: invalid signature"); require(signatory == owner, "::permit: unauthorized"); require(now <= deadline, "::permit: signature expired"); allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @notice Get the number of tokens held by the `account` * @param account The address of the account to get the balance of * @return The number of tokens held */ function balanceOf(address account) external view returns (uint) { return balances[account]; } /** * @notice Transfer `amount` tokens from `msg.sender` to `dst` * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transfer(address dst, uint amount) public returns (bool) { _transferTokens(msg.sender, dst, amount); return true; } /** * @notice Transfer `amount` tokens from `src` to `dst` * @param src The address of the source account * @param dst The address of the destination account * @param amount The number of tokens to transfer * @return Whether or not the transfer succeeded */ function transferFrom(address src, address dst, uint amount) external returns (bool) { address spender = msg.sender; uint spenderAllowance = allowances[src][spender]; if (spender != src && spenderAllowance != uint(-1)) { uint newAllowance = spenderAllowance.sub(amount, "::transferFrom: transfer amount exceeds spender allowance"); allowances[src][spender] = newAllowance; emit Approval(src, spender, newAllowance); } _transferTokens(src, dst, amount); return true; } function _transferTokens(address src, address dst, uint amount) internal { require(src != address(0), "::_transferTokens: cannot transfer from the zero address"); require(dst != address(0), "::_transferTokens: cannot transfer to the zero address"); balances[src] = balances[src].sub(amount, "::_transferTokens: transfer amount exceeds balance"); balances[dst] = balances[dst].add(amount, "::_transferTokens: transfer amount overflows"); emit Transfer(src, dst, amount); } function getChainId() internal pure returns (uint) { uint chainId; assembly { chainId := chainid() } return chainId; } }
* @notice allows a keeper to activate/register themselves after bonding/
function activate() external { require(bondings[msg.sender] != 0, "Keep3r::activate: bond first"); require(bondings[msg.sender] < now, "Keep3r::activate: still bonding"); if (!keepers[msg.sender]) { firstSeen[msg.sender] = now; } keepers[msg.sender] = true; totalBonded = totalBonded.add(pendingbonds[msg.sender]); bonds[msg.sender] = bonds[msg.sender].add(pendingbonds[msg.sender]); pendingbonds[msg.sender] = 0; if (lastJob[msg.sender] == 0) { lastJob[msg.sender] = now; keeperList.push(msg.sender); } emit KeeperBonded(msg.sender, block.number, block.timestamp, bonds[msg.sender]); }
13,974,338
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 20392, 5360, 279, 417, 9868, 358, 10235, 19, 4861, 20968, 1839, 8427, 310, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 10235, 1435, 3903, 288, 203, 3639, 2583, 12, 26425, 899, 63, 3576, 18, 15330, 65, 480, 374, 16, 315, 11523, 23, 86, 2866, 10014, 30, 8427, 1122, 8863, 203, 3639, 2583, 12, 26425, 899, 63, 3576, 18, 15330, 65, 411, 2037, 16, 315, 11523, 23, 86, 2866, 10014, 30, 4859, 8427, 310, 8863, 203, 3639, 309, 16051, 10102, 414, 63, 3576, 18, 15330, 5717, 288, 203, 1850, 1122, 15160, 63, 3576, 18, 15330, 65, 273, 2037, 31, 203, 3639, 289, 203, 3639, 3455, 414, 63, 3576, 18, 15330, 65, 273, 638, 31, 203, 3639, 2078, 38, 265, 785, 273, 2078, 38, 265, 785, 18, 1289, 12, 9561, 70, 4096, 63, 3576, 18, 15330, 19226, 203, 3639, 15692, 63, 3576, 18, 15330, 65, 273, 15692, 63, 3576, 18, 15330, 8009, 1289, 12, 9561, 70, 4096, 63, 3576, 18, 15330, 19226, 203, 3639, 4634, 70, 4096, 63, 3576, 18, 15330, 65, 273, 374, 31, 203, 3639, 309, 261, 2722, 2278, 63, 3576, 18, 15330, 65, 422, 374, 13, 288, 203, 5411, 1142, 2278, 63, 3576, 18, 15330, 65, 273, 2037, 31, 203, 5411, 417, 9868, 682, 18, 6206, 12, 3576, 18, 15330, 1769, 203, 3639, 289, 203, 3639, 3626, 1475, 9868, 38, 265, 785, 12, 3576, 18, 15330, 16, 1203, 18, 2696, 16, 1203, 18, 5508, 16, 15692, 63, 3576, 18, 15330, 19226, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.4.7; library Assert { event AssertionEvent( bool passed, string message ); function ok(bool a, string message) public returns (bool result) { result = a; emit AssertionEvent(result, message); } function equal(uint a, uint b, string message) public returns (bool result) { result = (a == b); emit AssertionEvent(result, message); } function equal(int a, int b, string message) public returns (bool result) { result = (a == b); emit AssertionEvent(result, message); } function equal(bool a, bool b, string message) public returns (bool result) { result = (a == b); emit AssertionEvent(result, message); } // TODO: only for certain versions of solc //function equal(fixed a, fixed b, string message) public returns (bool result) { // result = (a == b); // AssertionEvent(result, message); //} // TODO: only for certain versions of solc //function equal(ufixed a, ufixed b, string message) public returns (bool result) { // result = (a == b); // AssertionEvent(result, message); //} function equal(address a, address b, string message) public returns (bool result) { result = (a == b); emit AssertionEvent(result, message); } function equal(bytes32 a, bytes32 b, string message) public returns (bool result) { result = (a == b); emit AssertionEvent(result, message); } // TODO: needs to be convert to bytes first to be comparable //function equal(string a, string b, string message) public returns (bool result) { // result = (a == b); // AssertionEvent(result, message); //} function notEqual(uint a, uint b, string message) public returns (bool result) { result = (a != b); emit AssertionEvent(result, message); } function notEqual(int a, int b, string message) public returns (bool result) { result = (a != b); emit AssertionEvent(result, message); } function notEqual(bool a, bool b, string message) public returns (bool result) { result = (a != b); emit AssertionEvent(result, message); } // TODO: only for certain versions of solc //function notEqual(fixed a, fixed b, string message) public returns (bool result) { // result = (a != b); // AssertionEvent(result, message); //} // TODO: only for certain versions of solc //function notEqual(ufixed a, ufixed b, string message) public returns (bool result) { // result = (a != b); // AssertionEvent(result, message); //} function notEqual(address a, address b, string message) public returns (bool result) { result = (a != b); emit AssertionEvent(result, message); } function notEqual(bytes32 a, bytes32 b, string message) public returns (bool result) { result = (a != b); emit AssertionEvent(result, message); } // TODO: needs to be convert to bytes first to be comparable //function notEqual(string a, string b, string message) public returns (bool result) { // result = (a != b); // AssertionEvent(result, message); //} }
TODO: needs to be convert to bytes first to be comparablefunction equal(string a, string b, string message) public returns (bool result) { result = (a == b); AssertionEvent(result, message);}
function notEqual(uint a, uint b, string message) public returns (bool result) { result = (a != b); emit AssertionEvent(result, message); }
1,067,753
[ 1, 4625, 348, 7953, 560, 30, 225, 2660, 30, 4260, 358, 506, 1765, 358, 1731, 1122, 358, 506, 25949, 915, 3959, 12, 1080, 279, 16, 533, 324, 16, 533, 883, 13, 1071, 1135, 261, 6430, 563, 13, 288, 225, 563, 273, 261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 9067, 1133, 12, 2088, 16, 883, 1769, 203, 225, 289, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/11155111/0x38B2871A838B672e6496d66Fe1Ad036daa228544/sources/contracts/manifold/creator-core/extensions/ERC721/IERC721CreatorExtensionBurnable.sol
* @dev Your extension is required to implement this interface if it wishes to receive the onBurn callback whenever a token the extension created is burned/
interface IERC721CreatorExtensionBurnable is IERC165 { function onBurn(address owner, uint256 tokenId) external; }
3,833,399
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 20471, 2710, 353, 1931, 358, 2348, 333, 1560, 309, 518, 14302, 281, 358, 6798, 326, 603, 38, 321, 1348, 17334, 279, 1147, 326, 2710, 2522, 353, 18305, 329, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 5831, 467, 654, 39, 27, 5340, 10636, 3625, 38, 321, 429, 353, 467, 654, 39, 28275, 288, 203, 565, 445, 603, 38, 321, 12, 2867, 3410, 16, 2254, 5034, 1147, 548, 13, 3903, 31, 203, 203, 203, 97, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
/** *Submitted for verification at Etherscan.io on 2021-02-19 */ // SPDX-License-Identifier: MIT AND GPL-3.0 // File: @openzeppelin/contracts/utils/Context.sol pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with 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; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol 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); } // File: @openzeppelin/contracts/math/SafeMath.sol 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, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { 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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal virtual { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // File: @openzeppelin/contracts/drafts/IERC20Permit.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over `owner`'s tokens, * given `owner`'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for `permit`, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); } // File: @openzeppelin/contracts/cryptography/ECDSA.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Check the signature length if (signature.length != 65) { revert("ECDSA: invalid signature length"); } // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return recover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover-bytes32-bytes-} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value"); require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value"); // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); require(signer != address(0), "ECDSA: invalid signature"); return signer; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * replicates the behavior of the * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`] * JSON-RPC method. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } } // File: @openzeppelin/contracts/utils/Counters.sol pragma solidity >=0.6.0 <0.8.0; /** * @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); } } // File: @openzeppelin/contracts/drafts/EIP712.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) internal { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = _getChainId(); _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view virtual returns (bytes32) { if (_getChainId() == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator(bytes32 typeHash, bytes32 name, bytes32 version) private view returns (bytes32) { return keccak256( abi.encode( typeHash, name, version, _getChainId(), address(this) ) ); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", _domainSeparatorV4(), structHash)); } function _getChainId() private view returns (uint256 chainId) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 // solhint-disable-next-line no-inline-assembly assembly { chainId := chainid() } } } // File: @openzeppelin/contracts/drafts/ERC20Permit.sol pragma solidity >=0.6.5 <0.8.0; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping (address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private immutable _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) internal EIP712(name, "1") { } /** * @dev See {IERC20Permit-permit}. */ function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual override { // solhint-disable-next-line not-rely-on-time require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256( abi.encode( _PERMIT_TYPEHASH, owner, spender, value, _nonces[owner].current(), deadline ) ); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _nonces[owner].increment(); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } } // File: contracts/0.6.12/interfaces/IStETH.sol // SPDX-FileCopyrightText: 2021 Lido <[email protected]> pragma solidity 0.6.12; // latest available for using OZ interface IStETH is IERC20 { function getPooledEthByShares(uint256 _sharesAmount) external view returns (uint256); function getSharesByPooledEth(uint256 _pooledEthAmount) external view returns (uint256); function submit(address _referral) external payable returns (uint256); } // File: contracts/0.6.12/WstETH.sol // SPDX-FileCopyrightText: 2021 Lido <[email protected]> /* See contracts/COMPILERS.md */ pragma solidity 0.6.12; /** * @title StETH token wrapper with static balances. * @dev It's an ERC20 token that represents the account's share of the total * supply of stETH tokens. WstETH token's balance only changes on transfers, * unlike StETH that is also changed when oracles report staking rewards and * penalties. It's a "power user" token for DeFi protocols which don't * support rebasable tokens. * * The contract is also a trustless wrapper that accepts stETH tokens and mints * wstETH in return. Then the user unwraps, the contract burns user's wstETH * and sends user locked stETH in return. * * The contract provides the staking shortcut: user can send ETH with regular * transfer and get wstETH in return. The contract will send ETH to Lido submit * method, staking it and wrapping the received stETH. * */ contract WstETH is ERC20Permit { IStETH public stETH; /** * @param _stETH address of the StETH token to wrap */ constructor(IStETH _stETH) public ERC20Permit("Wrapped liquid staked Ether 2.0") ERC20("Wrapped liquid staked Ether 2.0", "wstETH") { stETH = _stETH; } /** * @notice Exchanges stETH to wstETH * @param _stETHAmount amount of stETH to wrap in exchange for wstETH * @dev Requirements: * - `_stETHAmount` must be non-zero * - msg.sender must approve at least `_stETHAmount` stETH to this * contract. * - msg.sender must have at least `_stETHAmount` of stETH. * User should first approve _stETHAmount to the WstETH contract * @return Amount of wstETH user receives after wrap */ function wrap(uint256 _stETHAmount) external returns (uint256) { require(_stETHAmount > 0, "wstETH: can't wrap zero stETH"); uint256 wstETHAmount = stETH.getSharesByPooledEth(_stETHAmount); _mint(msg.sender, wstETHAmount); stETH.transferFrom(msg.sender, address(this), _stETHAmount); return wstETHAmount; } /** * @notice Exchanges wstETH to stETH * @param _wstETHAmount amount of wstETH to uwrap in exchange for stETH * @dev Requirements: * - `_wstETHAmount` must be non-zero * - msg.sender must have at least `_wstETHAmount` wstETH. * @return Amount of stETH user receives after unwrap */ function unwrap(uint256 _wstETHAmount) external returns (uint256) { require(_wstETHAmount > 0, "wstETH: zero amount unwrap not allowed"); uint256 stETHAmount = stETH.getPooledEthByShares(_wstETHAmount); _burn(msg.sender, _wstETHAmount); stETH.transfer(msg.sender, stETHAmount); return stETHAmount; } /** * @notice Shortcut to stake ETH and auto-wrap returned stETH */ receive() external payable { uint256 shares = stETH.submit{value: msg.value}(address(0)); _mint(msg.sender, shares); } /** * @notice Get amount of wstETH for a given amount of stETH * @param _stETHAmount amount of stETH * @return Amount of wstETH for a given stETH amount */ function getWstETHByStETH(uint256 _stETHAmount) external view returns (uint256) { return stETH.getSharesByPooledEth(_stETHAmount); } /** * @notice Get amount of stETH for a given amount of wstETH * @param _wstETHAmount amount of wstETH * @return Amount of stETH for a given wstETH amount */ function getStETHByWstETH(uint256 _wstETHAmount) external view returns (uint256) { return stETH.getPooledEthByShares(_wstETHAmount); } /** * @notice Get amount of wstETH for a one stETH * @return Amount of stETH for 1 wstETH */ function stEthPerToken() external view returns (uint256) { return stETH.getPooledEthByShares(1 ether); } /** * @notice Get amount of stETH for a one wstETH * @return Amount of wstETH for a 1 stETH */ function tokensPerStEth() external view returns (uint256) { return stETH.getSharesByPooledEth(1 ether); } }
* @param _stETH address of the StETH token to wrap/
{ stETH = _stETH; }
6,797,836
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 891, 389, 334, 1584, 44, 1758, 434, 326, 934, 1584, 44, 1147, 358, 2193, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 288, 203, 3639, 384, 1584, 44, 273, 389, 334, 1584, 44, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/3/0x2456f761A7b06c9dA4201b7ea1Bf9636C83D36F4/sources/contracts/CryptoBlobsTest1.sol
index 0 95-99 index 1 96-100 1.00 ETH
return 1.00 ether;
8,254,619
[ 1, 4625, 348, 7953, 560, 30, 225, 770, 374, 16848, 17, 2733, 565, 770, 404, 19332, 17, 6625, 1377, 404, 18, 713, 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, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/42220/0x88130371F154e6E17CA3292a57269618a1b4503a/sources/pkg/pool-weighted/contracts/WeightedPool2TokensFactory_flat.sol
1e18 corresponds to 1.0, or a 100% fee Storage slot that can be used to store unrelated pieces of information. In particular, by default is used to store only the swap fee percentage of a pool. But it can be extended to store some more pieces of information. The swap fee percentage is stored in the most-significant 64 bits, therefore the remaining 192 bits can be used to store any other piece of information. Base Pools are expected to be deployed using factories. By using the factory address as the action disambiguator, we make all Pools deployed by the same factory share action identifiers. This allows for simpler management of permissions (such as being able to manage granting the 'set fee percentage' action in any Pool created by the same factory), while still making action identifiers unique among different factories if the selectors match, preventing accidental errors.
abstract contract BasePool is IBasePool, BasePoolAuthorization, BalancerPoolToken, TemporarilyPausable { using WordCodec for bytes32; using FixedPoint for uint256; uint256 private constant _MIN_TOKENS = 2; uint256 private constant _DEFAULT_MINIMUM_BPT = 1e6; bytes32 private _miscData; uint256 private constant _SWAP_FEE_PERCENTAGE_OFFSET = 192; bytes32 private immutable _poolId; event SwapFeePercentageChanged(uint256 swapFeePercentage); constructor( IVault vault, IVault.PoolSpecialization specialization, string memory name, string memory symbol, IERC20[] memory tokens, address[] memory assetManagers, uint256 swapFeePercentage, uint256 pauseWindowDuration, uint256 bufferPeriodDuration, address owner ) Authentication(bytes32(uint256(msg.sender))) BalancerPoolToken(name, symbol, vault) BasePoolAuthorization(owner) TemporarilyPausable(pauseWindowDuration, bufferPeriodDuration) } { _require(tokens.length >= _MIN_TOKENS, Errors.MIN_TOKENS); _require(tokens.length <= _getMaxTokens(), Errors.MAX_TOKENS); InputHelpers.ensureArrayIsSorted(tokens); _setSwapFeePercentage(swapFeePercentage); bytes32 poolId = vault.registerPool(specialization); vault.registerTokens(poolId, tokens, assetManagers); _poolId = poolId; } function getPoolId() public view override returns (bytes32) { return _poolId; } function _getTotalTokens() internal view virtual returns (uint256); function _getMaxTokens() internal pure virtual returns (uint256); function _getMinimumBpt() internal pure virtual returns (uint256) { return _DEFAULT_MINIMUM_BPT; } function getSwapFeePercentage() public view returns (uint256) { return _miscData.decodeUint64(_SWAP_FEE_PERCENTAGE_OFFSET); } function setSwapFeePercentage(uint256 swapFeePercentage) public virtual authenticate whenNotPaused { _setSwapFeePercentage(swapFeePercentage); } function _setSwapFeePercentage(uint256 swapFeePercentage) private { _require(swapFeePercentage >= _MIN_SWAP_FEE_PERCENTAGE, Errors.MIN_SWAP_FEE_PERCENTAGE); _require(swapFeePercentage <= _MAX_SWAP_FEE_PERCENTAGE, Errors.MAX_SWAP_FEE_PERCENTAGE); _miscData = _miscData.insertUint64(swapFeePercentage, _SWAP_FEE_PERCENTAGE_OFFSET); emit SwapFeePercentageChanged(swapFeePercentage); } function setAssetManagerPoolConfig(IERC20 token, bytes memory poolConfig) public virtual authenticate whenNotPaused { _setAssetManagerPoolConfig(token, poolConfig); } function _setAssetManagerPoolConfig(IERC20 token, bytes memory poolConfig) private { bytes32 poolId = getPoolId(); (, , , address assetManager) = getVault().getPoolTokenInfo(poolId, token); IAssetManager(assetManager).setConfig(poolId, poolConfig); } function setPaused(bool paused) external authenticate { _setPaused(paused); } function _isOwnerOnlyAction(bytes32 actionId) internal view virtual override returns (bool) { return (actionId == getActionId(this.setSwapFeePercentage.selector)) || (actionId == getActionId(this.setAssetManagerPoolConfig.selector)); } function _getMiscData() internal view returns (bytes32) { return _miscData; } function _setMiscData(bytes32 newData) internal { _miscData = _miscData.insertBits192(newData, 0); } modifier onlyVault(bytes32 poolId) { _require(msg.sender == address(getVault()), Errors.CALLER_NOT_VAULT); _require(poolId == getPoolId(), Errors.INVALID_POOL_ID); _; } function onJoinPool( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData ) public virtual override onlyVault(poolId) returns (uint256[] memory, uint256[] memory) { uint256[] memory scalingFactors = _scalingFactors(); if (totalSupply() == 0) { (uint256 bptAmountOut, uint256[] memory amountsIn) = _onInitializePool( poolId, sender, recipient, scalingFactors, userData ); _require(bptAmountOut >= _getMinimumBpt(), Errors.MINIMUM_BPT); _mintPoolTokens(address(0), _getMinimumBpt()); _mintPoolTokens(recipient, bptAmountOut - _getMinimumBpt()); _downscaleUpArray(amountsIn, scalingFactors); return (amountsIn, new uint256[](_getTotalTokens())); _upscaleArray(balances, scalingFactors); (uint256 bptAmountOut, uint256[] memory amountsIn, uint256[] memory dueProtocolFeeAmounts) = _onJoinPool( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, scalingFactors, userData ); _mintPoolTokens(recipient, bptAmountOut); _downscaleUpArray(amountsIn, scalingFactors); _downscaleDownArray(dueProtocolFeeAmounts, scalingFactors); return (amountsIn, dueProtocolFeeAmounts); } } function onJoinPool( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData ) public virtual override onlyVault(poolId) returns (uint256[] memory, uint256[] memory) { uint256[] memory scalingFactors = _scalingFactors(); if (totalSupply() == 0) { (uint256 bptAmountOut, uint256[] memory amountsIn) = _onInitializePool( poolId, sender, recipient, scalingFactors, userData ); _require(bptAmountOut >= _getMinimumBpt(), Errors.MINIMUM_BPT); _mintPoolTokens(address(0), _getMinimumBpt()); _mintPoolTokens(recipient, bptAmountOut - _getMinimumBpt()); _downscaleUpArray(amountsIn, scalingFactors); return (amountsIn, new uint256[](_getTotalTokens())); _upscaleArray(balances, scalingFactors); (uint256 bptAmountOut, uint256[] memory amountsIn, uint256[] memory dueProtocolFeeAmounts) = _onJoinPool( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, scalingFactors, userData ); _mintPoolTokens(recipient, bptAmountOut); _downscaleUpArray(amountsIn, scalingFactors); _downscaleDownArray(dueProtocolFeeAmounts, scalingFactors); return (amountsIn, dueProtocolFeeAmounts); } } } else { function onExitPool( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData ) public virtual override onlyVault(poolId) returns (uint256[] memory, uint256[] memory) { uint256[] memory scalingFactors = _scalingFactors(); _upscaleArray(balances, scalingFactors); (uint256 bptAmountIn, uint256[] memory amountsOut, uint256[] memory dueProtocolFeeAmounts) = _onExitPool( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, scalingFactors, userData ); _burnPoolTokens(sender, bptAmountIn); _downscaleDownArray(amountsOut, scalingFactors); _downscaleDownArray(dueProtocolFeeAmounts, scalingFactors); return (amountsOut, dueProtocolFeeAmounts); } function queryJoin( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData ) external returns (uint256 bptOut, uint256[] memory amountsIn) { InputHelpers.ensureInputLengthMatch(balances.length, _getTotalTokens()); _queryAction( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, userData, _onJoinPool, _downscaleUpArray ); return (bptOut, amountsIn); } function queryExit( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData ) external returns (uint256 bptIn, uint256[] memory amountsOut) { InputHelpers.ensureInputLengthMatch(balances.length, _getTotalTokens()); _queryAction( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, userData, _onExitPool, _downscaleDownArray ); return (bptIn, amountsOut); } function _onInitializePool( bytes32 poolId, address sender, address recipient, uint256[] memory scalingFactors, bytes memory userData ) internal virtual returns (uint256 bptAmountOut, uint256[] memory amountsIn); function _onJoinPool( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, uint256[] memory scalingFactors, bytes memory userData ) internal virtual returns ( uint256 bptAmountOut, uint256[] memory amountsIn, uint256[] memory dueProtocolFeeAmounts ); function _onExitPool( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, uint256[] memory scalingFactors, bytes memory userData ) internal virtual returns ( uint256 bptAmountIn, uint256[] memory amountsOut, uint256[] memory dueProtocolFeeAmounts ); function _addSwapFeeAmount(uint256 amount) internal view returns (uint256) { return amount.divUp(FixedPoint.ONE.sub(getSwapFeePercentage())); } function _subtractSwapFeeAmount(uint256 amount) internal view returns (uint256) { uint256 feeAmount = amount.mulUp(getSwapFeePercentage()); return amount.sub(feeAmount); } function _computeScalingFactor(IERC20 token) internal view returns (uint256) { if (address(token) == address(this)) { return FixedPoint.ONE; } return FixedPoint.ONE * 10**decimalsDifference; } function _computeScalingFactor(IERC20 token) internal view returns (uint256) { if (address(token) == address(this)) { return FixedPoint.ONE; } return FixedPoint.ONE * 10**decimalsDifference; } uint256 tokenDecimals = ERC20(address(token)).decimals(); uint256 decimalsDifference = Math.sub(18, tokenDecimals); function _scalingFactor(IERC20 token) internal view virtual returns (uint256); function _scalingFactors() internal view virtual returns (uint256[] memory); function getScalingFactors() external view returns (uint256[] memory) { return _scalingFactors(); } function _upscale(uint256 amount, uint256 scalingFactor) internal pure returns (uint256) { return FixedPoint.mulDown(amount, scalingFactor); } function _upscaleArray(uint256[] memory amounts, uint256[] memory scalingFactors) internal view { for (uint256 i = 0; i < _getTotalTokens(); ++i) { amounts[i] = FixedPoint.mulDown(amounts[i], scalingFactors[i]); } } function _upscaleArray(uint256[] memory amounts, uint256[] memory scalingFactors) internal view { for (uint256 i = 0; i < _getTotalTokens(); ++i) { amounts[i] = FixedPoint.mulDown(amounts[i], scalingFactors[i]); } } function _downscaleDown(uint256 amount, uint256 scalingFactor) internal pure returns (uint256) { return FixedPoint.divDown(amount, scalingFactor); } function _downscaleDownArray(uint256[] memory amounts, uint256[] memory scalingFactors) internal view { for (uint256 i = 0; i < _getTotalTokens(); ++i) { amounts[i] = FixedPoint.divDown(amounts[i], scalingFactors[i]); } } function _downscaleDownArray(uint256[] memory amounts, uint256[] memory scalingFactors) internal view { for (uint256 i = 0; i < _getTotalTokens(); ++i) { amounts[i] = FixedPoint.divDown(amounts[i], scalingFactors[i]); } } function _downscaleUp(uint256 amount, uint256 scalingFactor) internal pure returns (uint256) { return FixedPoint.divUp(amount, scalingFactor); } function _downscaleUpArray(uint256[] memory amounts, uint256[] memory scalingFactors) internal view { for (uint256 i = 0; i < _getTotalTokens(); ++i) { amounts[i] = FixedPoint.divUp(amounts[i], scalingFactors[i]); } } function _downscaleUpArray(uint256[] memory amounts, uint256[] memory scalingFactors) internal view { for (uint256 i = 0; i < _getTotalTokens(); ++i) { amounts[i] = FixedPoint.divUp(amounts[i], scalingFactors[i]); } } function _getAuthorizer() internal view override returns (IAuthorizer) { return getVault().getAuthorizer(); } function _queryAction( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData, function(bytes32, address, address, uint256[] memory, uint256, uint256, uint256[] memory, bytes memory) internal returns (uint256, uint256[] memory, uint256[] memory) _action, function(uint256[] memory, uint256[] memory) internal view _downscaleArray ) private { if (msg.sender != address(this)) { (bool success, ) = address(this).call(msg.data); assembly { switch success case 0 { returndatacopy(0, 0, 0x04) let error := and(mload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000) if eq(eq(error, 0x43adbafb00000000000000000000000000000000000000000000000000000000), 0) { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) } } default { invalid() } } uint256[] memory scalingFactors = _scalingFactors(); _upscaleArray(balances, scalingFactors); (uint256 bptAmount, uint256[] memory tokenAmounts, ) = _action( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, scalingFactors, userData ); _downscaleArray(tokenAmounts, scalingFactors); assembly { let size := mul(mload(tokenAmounts), 32) let start := sub(tokenAmounts, 0x20) mstore(start, bptAmount) mstore(sub(start, 0x20), 0x0000000000000000000000000000000000000000000000000000000043adbafb) start := sub(start, 0x04) revert(start, add(size, 68)) } } } function _queryAction( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData, function(bytes32, address, address, uint256[] memory, uint256, uint256, uint256[] memory, bytes memory) internal returns (uint256, uint256[] memory, uint256[] memory) _action, function(uint256[] memory, uint256[] memory) internal view _downscaleArray ) private { if (msg.sender != address(this)) { (bool success, ) = address(this).call(msg.data); assembly { switch success case 0 { returndatacopy(0, 0, 0x04) let error := and(mload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000) if eq(eq(error, 0x43adbafb00000000000000000000000000000000000000000000000000000000), 0) { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) } } default { invalid() } } uint256[] memory scalingFactors = _scalingFactors(); _upscaleArray(balances, scalingFactors); (uint256 bptAmount, uint256[] memory tokenAmounts, ) = _action( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, scalingFactors, userData ); _downscaleArray(tokenAmounts, scalingFactors); assembly { let size := mul(mload(tokenAmounts), 32) let start := sub(tokenAmounts, 0x20) mstore(start, bptAmount) mstore(sub(start, 0x20), 0x0000000000000000000000000000000000000000000000000000000043adbafb) start := sub(start, 0x04) revert(start, add(size, 68)) } } } function _queryAction( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData, function(bytes32, address, address, uint256[] memory, uint256, uint256, uint256[] memory, bytes memory) internal returns (uint256, uint256[] memory, uint256[] memory) _action, function(uint256[] memory, uint256[] memory) internal view _downscaleArray ) private { if (msg.sender != address(this)) { (bool success, ) = address(this).call(msg.data); assembly { switch success case 0 { returndatacopy(0, 0, 0x04) let error := and(mload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000) if eq(eq(error, 0x43adbafb00000000000000000000000000000000000000000000000000000000), 0) { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) } } default { invalid() } } uint256[] memory scalingFactors = _scalingFactors(); _upscaleArray(balances, scalingFactors); (uint256 bptAmount, uint256[] memory tokenAmounts, ) = _action( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, scalingFactors, userData ); _downscaleArray(tokenAmounts, scalingFactors); assembly { let size := mul(mload(tokenAmounts), 32) let start := sub(tokenAmounts, 0x20) mstore(start, bptAmount) mstore(sub(start, 0x20), 0x0000000000000000000000000000000000000000000000000000000043adbafb) start := sub(start, 0x04) revert(start, add(size, 68)) } } } function _queryAction( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData, function(bytes32, address, address, uint256[] memory, uint256, uint256, uint256[] memory, bytes memory) internal returns (uint256, uint256[] memory, uint256[] memory) _action, function(uint256[] memory, uint256[] memory) internal view _downscaleArray ) private { if (msg.sender != address(this)) { (bool success, ) = address(this).call(msg.data); assembly { switch success case 0 { returndatacopy(0, 0, 0x04) let error := and(mload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000) if eq(eq(error, 0x43adbafb00000000000000000000000000000000000000000000000000000000), 0) { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) } } default { invalid() } } uint256[] memory scalingFactors = _scalingFactors(); _upscaleArray(balances, scalingFactors); (uint256 bptAmount, uint256[] memory tokenAmounts, ) = _action( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, scalingFactors, userData ); _downscaleArray(tokenAmounts, scalingFactors); assembly { let size := mul(mload(tokenAmounts), 32) let start := sub(tokenAmounts, 0x20) mstore(start, bptAmount) mstore(sub(start, 0x20), 0x0000000000000000000000000000000000000000000000000000000043adbafb) start := sub(start, 0x04) revert(start, add(size, 68)) } } } function _queryAction( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData, function(bytes32, address, address, uint256[] memory, uint256, uint256, uint256[] memory, bytes memory) internal returns (uint256, uint256[] memory, uint256[] memory) _action, function(uint256[] memory, uint256[] memory) internal view _downscaleArray ) private { if (msg.sender != address(this)) { (bool success, ) = address(this).call(msg.data); assembly { switch success case 0 { returndatacopy(0, 0, 0x04) let error := and(mload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000) if eq(eq(error, 0x43adbafb00000000000000000000000000000000000000000000000000000000), 0) { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) } } default { invalid() } } uint256[] memory scalingFactors = _scalingFactors(); _upscaleArray(balances, scalingFactors); (uint256 bptAmount, uint256[] memory tokenAmounts, ) = _action( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, scalingFactors, userData ); _downscaleArray(tokenAmounts, scalingFactors); assembly { let size := mul(mload(tokenAmounts), 32) let start := sub(tokenAmounts, 0x20) mstore(start, bptAmount) mstore(sub(start, 0x20), 0x0000000000000000000000000000000000000000000000000000000043adbafb) start := sub(start, 0x04) revert(start, add(size, 68)) } } } returndatacopy(0, 0x04, 32) mstore(0x20, 64) returndatacopy(0x40, 0x24, sub(returndatasize(), 36)) return(0, add(returndatasize(), 28)) function _queryAction( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData, function(bytes32, address, address, uint256[] memory, uint256, uint256, uint256[] memory, bytes memory) internal returns (uint256, uint256[] memory, uint256[] memory) _action, function(uint256[] memory, uint256[] memory) internal view _downscaleArray ) private { if (msg.sender != address(this)) { (bool success, ) = address(this).call(msg.data); assembly { switch success case 0 { returndatacopy(0, 0, 0x04) let error := and(mload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000) if eq(eq(error, 0x43adbafb00000000000000000000000000000000000000000000000000000000), 0) { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) } } default { invalid() } } uint256[] memory scalingFactors = _scalingFactors(); _upscaleArray(balances, scalingFactors); (uint256 bptAmount, uint256[] memory tokenAmounts, ) = _action( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, scalingFactors, userData ); _downscaleArray(tokenAmounts, scalingFactors); assembly { let size := mul(mload(tokenAmounts), 32) let start := sub(tokenAmounts, 0x20) mstore(start, bptAmount) mstore(sub(start, 0x20), 0x0000000000000000000000000000000000000000000000000000000043adbafb) start := sub(start, 0x04) revert(start, add(size, 68)) } } } } else { function _queryAction( bytes32 poolId, address sender, address recipient, uint256[] memory balances, uint256 lastChangeBlock, uint256 protocolSwapFeePercentage, bytes memory userData, function(bytes32, address, address, uint256[] memory, uint256, uint256, uint256[] memory, bytes memory) internal returns (uint256, uint256[] memory, uint256[] memory) _action, function(uint256[] memory, uint256[] memory) internal view _downscaleArray ) private { if (msg.sender != address(this)) { (bool success, ) = address(this).call(msg.data); assembly { switch success case 0 { returndatacopy(0, 0, 0x04) let error := and(mload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000) if eq(eq(error, 0x43adbafb00000000000000000000000000000000000000000000000000000000), 0) { returndatacopy(0, 0, returndatasize()) revert(0, returndatasize()) } } default { invalid() } } uint256[] memory scalingFactors = _scalingFactors(); _upscaleArray(balances, scalingFactors); (uint256 bptAmount, uint256[] memory tokenAmounts, ) = _action( poolId, sender, recipient, balances, lastChangeBlock, protocolSwapFeePercentage, scalingFactors, userData ); _downscaleArray(tokenAmounts, scalingFactors); assembly { let size := mul(mload(tokenAmounts), 32) let start := sub(tokenAmounts, 0x20) mstore(start, bptAmount) mstore(sub(start, 0x20), 0x0000000000000000000000000000000000000000000000000000000043adbafb) start := sub(start, 0x04) revert(start, add(size, 68)) } } } }
16,320,312
[ 1, 4625, 348, 7953, 560, 30, 225, 404, 73, 2643, 13955, 358, 404, 18, 20, 16, 578, 279, 2130, 9, 14036, 5235, 4694, 716, 848, 506, 1399, 358, 1707, 640, 9243, 10167, 434, 1779, 18, 657, 6826, 16, 635, 805, 353, 1399, 358, 1707, 1338, 326, 7720, 14036, 11622, 434, 279, 2845, 18, 12484, 518, 848, 506, 7021, 358, 1707, 2690, 1898, 10167, 434, 1779, 18, 1021, 7720, 14036, 11622, 353, 4041, 316, 326, 4486, 17, 2977, 11120, 5178, 4125, 16, 13526, 326, 4463, 20217, 4125, 848, 506, 1399, 358, 1707, 1281, 1308, 11151, 434, 1779, 18, 3360, 453, 8192, 854, 2665, 358, 506, 19357, 1450, 17456, 18, 2525, 1450, 326, 3272, 1758, 487, 326, 1301, 1015, 26011, 639, 16, 732, 1221, 777, 453, 8192, 19357, 635, 326, 1967, 3272, 7433, 1301, 9863, 18, 1220, 5360, 364, 9330, 264, 11803, 434, 4371, 261, 87, 2648, 487, 3832, 7752, 358, 10680, 7936, 310, 326, 296, 542, 14036, 11622, 11, 1301, 316, 1281, 8828, 2522, 635, 326, 1967, 3272, 3631, 1323, 4859, 10480, 1301, 9863, 3089, 17200, 3775, 17456, 309, 326, 11424, 845, 16, 5309, 310, 25961, 287, 1334, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 17801, 6835, 3360, 2864, 353, 467, 2171, 2864, 16, 3360, 2864, 6063, 16, 605, 5191, 2864, 1345, 16, 3955, 3831, 10243, 16507, 16665, 288, 203, 565, 1450, 9926, 11008, 364, 1731, 1578, 31, 203, 565, 1450, 15038, 2148, 364, 2254, 5034, 31, 203, 203, 565, 2254, 5034, 3238, 5381, 389, 6236, 67, 8412, 55, 273, 576, 31, 203, 203, 565, 2254, 5034, 3238, 5381, 389, 5280, 67, 6236, 18605, 67, 38, 1856, 273, 404, 73, 26, 31, 203, 203, 203, 565, 1731, 1578, 3238, 389, 23667, 751, 31, 203, 565, 2254, 5034, 3238, 5381, 389, 18746, 2203, 67, 8090, 41, 67, 3194, 19666, 2833, 67, 11271, 273, 20217, 31, 203, 203, 565, 1731, 1578, 3238, 11732, 389, 6011, 548, 31, 203, 203, 565, 871, 12738, 14667, 16397, 5033, 12, 11890, 5034, 7720, 14667, 16397, 1769, 203, 203, 565, 3885, 12, 203, 3639, 467, 12003, 9229, 16, 203, 3639, 467, 12003, 18, 2864, 12193, 1588, 4582, 1588, 16, 203, 3639, 533, 3778, 508, 16, 203, 3639, 533, 3778, 3273, 16, 203, 3639, 467, 654, 39, 3462, 8526, 3778, 2430, 16, 203, 3639, 1758, 8526, 3778, 3310, 17570, 16, 203, 3639, 2254, 5034, 7720, 14667, 16397, 16, 203, 3639, 2254, 5034, 11722, 3829, 5326, 16, 203, 3639, 2254, 5034, 1613, 5027, 5326, 16, 203, 3639, 1758, 3410, 203, 565, 262, 203, 3639, 8665, 12, 3890, 1578, 12, 11890, 5034, 12, 3576, 18, 15330, 20349, 203, 3639, 605, 5191, 2864, 1345, 12, 529, 16, 3273, 16, 9229, 13, 203, 3639, 3360, 2864, 6063, 12, 8443, 13, 203, 3639, 3955, 3831, 10243, 16507, 16665, 12, 19476, 3829, 5326, 16, 1613, 5027, 5326, 13, 203, 97, 203, 565, 288, 203, 3639, 389, 6528, 12, 7860, 18, 2469, 1545, 389, 6236, 67, 8412, 55, 16, 9372, 18, 6236, 67, 8412, 55, 1769, 203, 3639, 389, 6528, 12, 7860, 18, 2469, 1648, 389, 588, 2747, 5157, 9334, 9372, 18, 6694, 67, 8412, 55, 1769, 203, 203, 3639, 2741, 13375, 18, 15735, 1076, 2520, 11739, 12, 7860, 1769, 203, 203, 3639, 389, 542, 12521, 14667, 16397, 12, 22270, 14667, 16397, 1769, 203, 203, 3639, 1731, 1578, 2845, 548, 273, 9229, 18, 4861, 2864, 12, 9371, 1588, 1769, 203, 203, 3639, 9229, 18, 4861, 5157, 12, 6011, 548, 16, 2430, 16, 3310, 17570, 1769, 203, 203, 3639, 389, 6011, 548, 273, 2845, 548, 31, 203, 565, 289, 203, 203, 203, 565, 445, 28575, 548, 1435, 1071, 1476, 3849, 1135, 261, 3890, 1578, 13, 288, 203, 3639, 327, 389, 6011, 548, 31, 203, 565, 289, 203, 203, 565, 445, 389, 588, 5269, 5157, 1435, 2713, 1476, 5024, 1135, 261, 11890, 5034, 1769, 203, 203, 565, 445, 389, 588, 2747, 5157, 1435, 2713, 16618, 5024, 1135, 261, 11890, 5034, 1769, 203, 203, 565, 445, 389, 588, 13042, 38, 337, 1435, 2713, 16618, 5024, 1135, 261, 11890, 5034, 13, 288, 203, 3639, 327, 389, 5280, 67, 6236, 18605, 67, 38, 1856, 31, 203, 565, 289, 203, 203, 565, 445, 1322, 91, 438, 14667, 16397, 1435, 1071, 1476, 1135, 261, 11890, 5034, 13, 288, 203, 3639, 327, 389, 23667, 751, 18, 3922, 5487, 1105, 24899, 18746, 2203, 67, 8090, 41, 67, 3194, 19666, 2833, 67, 11271, 1769, 203, 565, 289, 203, 203, 565, 445, 444, 12521, 14667, 16397, 12, 11890, 5034, 7720, 14667, 16397, 13, 1071, 5024, 8929, 1347, 1248, 28590, 288, 203, 3639, 389, 542, 12521, 14667, 16397, 12, 22270, 14667, 16397, 1769, 203, 565, 289, 203, 203, 565, 445, 389, 542, 12521, 14667, 16397, 12, 11890, 5034, 7720, 14667, 16397, 13, 3238, 288, 203, 3639, 389, 6528, 12, 22270, 14667, 16397, 1545, 389, 6236, 67, 18746, 2203, 67, 8090, 41, 67, 3194, 19666, 2833, 16, 9372, 18, 6236, 67, 18746, 2203, 67, 8090, 41, 67, 3194, 19666, 2833, 1769, 203, 3639, 389, 6528, 12, 22270, 14667, 16397, 1648, 389, 6694, 67, 18746, 2203, 67, 8090, 41, 67, 3194, 19666, 2833, 16, 9372, 18, 6694, 67, 18746, 2203, 67, 8090, 41, 67, 3194, 19666, 2833, 1769, 203, 203, 3639, 389, 23667, 751, 273, 389, 23667, 751, 18, 6387, 5487, 1105, 12, 22270, 14667, 16397, 16, 389, 18746, 2203, 67, 8090, 41, 67, 3194, 19666, 2833, 67, 11271, 1769, 203, 3639, 3626, 12738, 14667, 16397, 5033, 12, 22270, 14667, 16397, 1769, 203, 565, 289, 203, 203, 565, 445, 444, 6672, 1318, 2864, 809, 12, 45, 654, 39, 3462, 1147, 16, 1731, 3778, 2845, 809, 13, 203, 3639, 1071, 203, 3639, 5024, 203, 3639, 8929, 203, 3639, 1347, 1248, 28590, 203, 565, 288, 203, 3639, 389, 542, 6672, 1318, 2864, 809, 12, 2316, 16, 2845, 809, 1769, 203, 565, 289, 203, 203, 565, 445, 389, 542, 6672, 1318, 2864, 809, 12, 45, 654, 39, 3462, 1147, 16, 1731, 3778, 2845, 809, 13, 3238, 288, 203, 3639, 1731, 1578, 2845, 548, 273, 28575, 548, 5621, 203, 3639, 261, 16, 269, 269, 1758, 3310, 1318, 13, 273, 11031, 3714, 7675, 588, 2864, 1345, 966, 12, 6011, 548, 16, 1147, 1769, 203, 203, 3639, 467, 6672, 1318, 12, 9406, 1318, 2934, 542, 809, 12, 6011, 548, 16, 2845, 809, 1769, 203, 565, 289, 203, 203, 565, 445, 444, 28590, 12, 6430, 17781, 13, 3903, 8929, 288, 203, 3639, 389, 542, 28590, 12, 8774, 3668, 1769, 203, 565, 289, 203, 203, 565, 445, 389, 291, 5541, 3386, 1803, 12, 3890, 1578, 1301, 548, 13, 2713, 1476, 5024, 3849, 1135, 261, 6430, 13, 288, 203, 3639, 327, 203, 5411, 261, 1128, 548, 422, 12473, 548, 12, 2211, 18, 542, 12521, 14667, 16397, 18, 9663, 3719, 747, 203, 5411, 261, 1128, 548, 422, 12473, 548, 12, 2211, 18, 542, 6672, 1318, 2864, 809, 18, 9663, 10019, 203, 565, 289, 203, 203, 565, 445, 389, 588, 11729, 71, 751, 1435, 2713, 1476, 1135, 261, 3890, 1578, 13, 288, 203, 3639, 327, 389, 23667, 751, 31, 203, 565, 289, 203, 203, 565, 445, 389, 542, 11729, 71, 751, 12, 3890, 1578, 16026, 13, 2713, 288, 203, 3639, 389, 23667, 751, 273, 389, 23667, 751, 18, 6387, 6495, 15561, 12, 2704, 751, 16, 374, 1769, 203, 565, 289, 203, 203, 203, 565, 9606, 1338, 12003, 12, 3890, 1578, 2845, 548, 13, 288, 203, 3639, 389, 6528, 12, 3576, 18, 15330, 422, 1758, 12, 588, 12003, 2 ]
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; /** * @dev This contract provides a fallback function that relay all calls to another contract using the EVM * instruction `call`. We refer to the second contract as the _destContract behind the forwarder * * Additionally, forward to the _destContract can be triggered manually through the {_fallback} function, or to a * different contract through the {_forward} function. * * The success and return data of the call will be returned back to the caller of the relay. */ contract Relay { address private _destContract; constructor(address destContract) { _destContract = destContract; } /** * @dev Forwards the current call to `_destContract`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _forward(uint256 value) internal { assembly { // loading state variable to stack let addr := sload(_destContract.slot) // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := call(gas(), addr, value, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev Forward the current call to the address returned by `_destContract`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _forward(msg.value); } /** * @dev Fallback function that delegates calls to the address returned by `_destContract`. Will run if no other * function in the contract matches the call data. */ // solhint-disable-next-line fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_destContract`. Will run if call data * is empty. */ // solhint-disable-next-line receive() external payable virtual { _fallback(); } }
* @dev Forwards the current call to `_destContract`. This function does not return to its internall call site, it will return directly to the external caller./ loading state variable to stack Copy msg.data. We take full control of memory in this inline assembly block because it will not return to Solidity code. We overwrite the Solidity scratch pad at memory position 0. Call the implementation. out and outsize are 0 because we don't know the size yet. Copy the returned data. delegatecall returns 0 on error.
function _forward(uint256 value) internal { assembly { let addr := sload(_destContract.slot) calldatacopy(0, 0, calldatasize()) let result := call(gas(), addr, value, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) switch result case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } }
1,055,418
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 2457, 6397, 326, 783, 745, 358, 1375, 67, 10488, 8924, 8338, 1220, 445, 1552, 486, 327, 358, 2097, 8216, 454, 745, 2834, 16, 518, 903, 327, 5122, 358, 326, 3903, 4894, 18, 19, 7153, 919, 2190, 358, 2110, 5631, 1234, 18, 892, 18, 1660, 4862, 1983, 3325, 434, 3778, 316, 333, 6370, 19931, 1203, 2724, 518, 903, 486, 327, 358, 348, 7953, 560, 981, 18, 1660, 6156, 326, 348, 7953, 560, 15289, 4627, 622, 3778, 1754, 374, 18, 3049, 326, 4471, 18, 596, 471, 596, 1467, 854, 374, 2724, 732, 2727, 1404, 5055, 326, 963, 4671, 18, 5631, 326, 2106, 501, 18, 7152, 1991, 1135, 374, 603, 555, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 389, 11565, 12, 11890, 5034, 460, 13, 2713, 288, 203, 3639, 19931, 288, 203, 5411, 2231, 3091, 519, 272, 945, 24899, 10488, 8924, 18, 14194, 13, 203, 203, 5411, 745, 892, 3530, 12, 20, 16, 374, 16, 745, 13178, 554, 10756, 203, 203, 5411, 2231, 563, 519, 745, 12, 31604, 9334, 3091, 16, 460, 16, 374, 16, 745, 13178, 554, 9334, 374, 16, 374, 13, 203, 203, 5411, 327, 892, 3530, 12, 20, 16, 374, 16, 327, 13178, 554, 10756, 203, 203, 5411, 1620, 563, 203, 5411, 648, 374, 288, 203, 7734, 15226, 12, 20, 16, 327, 13178, 554, 10756, 203, 5411, 289, 203, 5411, 805, 288, 203, 7734, 327, 12, 20, 16, 327, 13178, 554, 10756, 203, 5411, 289, 203, 3639, 289, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./partial_match/3/0x8994560C6ec749D349c44B7853B4b8b35b2f2b2B/sources/FINMINITY.sol
------------------------------------------------------------------------ Constructor ------------------------------------------------------------------------
constructor() public { deployTime = block.timestamp; owner = 0x11d8a4BCd466308A15cCC11459A1172687fcc25F; balances[ecosys] = 4993000 * 10 ** (decimals); emit Transfer(address(0), ecosys, balances[ecosys]); locked[ecosys].initial = balances[ecosys]; locked[ecosys].locked = balances[ecosys]; balances[foundation] = 1000000 * 10 ** (decimals); emit Transfer(address(0), foundation, balances[foundation]); locked[foundation].initial = balances[foundation]; locked[foundation].locked = balances[foundation]; balances[owner] = 1500000 * 10 ** (decimals); emit Transfer(address(0), owner, balances[owner]); balances[owner] = balances[owner].add(534000 * 10 ** (decimals)); emit Transfer(address(0), owner, balances[owner]); balances[team] = 940000 * 10 ** (decimals); emit Transfer(address(0), team, balances[team]); locked[team].initial = balances[team]; locked[team].locked = balances[team]; balances[market1] = 500000 * 10 ** (decimals); emit Transfer(address(0), market1, balances[market1]); locked[market1].initial = balances[market1]; locked[market1].locked = balances[market1]; balances[market2] = 533000 * 10 ** (decimals); emit Transfer(address(0), market2, balances[market2]); }
5,185,310
[ 1, 4625, 348, 7953, 560, 30, 225, 8879, 17082, 11417, 8879, 17082, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 24, 16283, 72, 8749, 4449, 6840, 37, 3600, 71, 6743, 22214, 6162, 37, 23454, 5558, 11035, 74, 952, 2947, 42, 31, 203, 540, 203, 3639, 324, 26488, 63, 557, 538, 1900, 65, 273, 1059, 2733, 23, 3784, 380, 1728, 2826, 261, 31734, 1769, 203, 3639, 3626, 12279, 12, 2867, 12, 20, 3631, 6557, 538, 1900, 16, 324, 26488, 63, 557, 538, 1900, 19226, 203, 3639, 8586, 63, 557, 538, 1900, 8009, 6769, 273, 324, 26488, 63, 557, 538, 1900, 15533, 203, 3639, 8586, 63, 557, 538, 1900, 8009, 15091, 273, 324, 26488, 63, 557, 538, 1900, 15533, 203, 203, 3639, 324, 26488, 63, 30493, 65, 273, 15088, 380, 1728, 2826, 261, 31734, 1769, 203, 3639, 3626, 12279, 12, 2867, 12, 20, 3631, 1392, 367, 16, 324, 26488, 63, 30493, 19226, 203, 3639, 8586, 63, 30493, 8009, 6769, 273, 324, 26488, 63, 30493, 15533, 203, 3639, 8586, 63, 30493, 8009, 15091, 273, 324, 26488, 63, 30493, 15533, 203, 203, 3639, 324, 26488, 63, 8443, 65, 273, 4711, 11706, 380, 1728, 2826, 261, 31734, 1769, 203, 3639, 3626, 12279, 12, 2867, 12, 20, 3631, 3410, 16, 324, 26488, 63, 8443, 19226, 203, 203, 3639, 324, 26488, 63, 8443, 65, 273, 324, 26488, 63, 8443, 8009, 1289, 12, 25, 5026, 3784, 380, 1728, 2826, 261, 31734, 10019, 203, 3639, 3626, 12279, 12, 2867, 12, 20, 3631, 3410, 16, 324, 26488, 63, 8443, 19226, 203, 203, 3639, 324, 26488, 63, 10035, 65, 273, 31069, 2787, 380, 1728, 2826, 261, 31734, 1769, 203, 3639, 3626, 12279, 12, 2867, 12, 20, 3631, 5927, 16, 324, 26488, 63, 10035, 19226, 203, 3639, 8586, 63, 10035, 8009, 6769, 273, 324, 26488, 63, 10035, 15533, 203, 3639, 8586, 63, 10035, 8009, 15091, 273, 324, 26488, 63, 10035, 15533, 203, 203, 3639, 324, 26488, 63, 27151, 21, 65, 273, 1381, 11706, 380, 1728, 2826, 261, 31734, 1769, 203, 3639, 3626, 12279, 12, 2867, 12, 20, 3631, 13667, 21, 16, 324, 26488, 63, 27151, 21, 19226, 203, 3639, 8586, 63, 27151, 21, 8009, 6769, 273, 324, 26488, 63, 27151, 21, 15533, 203, 3639, 8586, 63, 27151, 21, 8009, 15091, 273, 324, 26488, 63, 27151, 21, 15533, 203, 203, 3639, 324, 26488, 63, 27151, 22, 65, 273, 1381, 3707, 3784, 380, 1728, 2826, 261, 31734, 1769, 203, 3639, 3626, 12279, 12, 2867, 12, 20, 3631, 13667, 22, 16, 324, 26488, 63, 27151, 22, 19226, 203, 565, 289, 203, 377, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
//Address: 0xa12ed3bf21bc6a4571ee12ee85c55ab407221d10 //Contract name: Crowdsale //Balance: 0 Ether //Verification Date: 8/11/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity ^0.4.11; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner { if (newOwner != address(0)) { owner = newOwner; } } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) constant returns (uint256); function transfer(address to, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) constant returns (uint256); function transferFrom(address from, address to, uint256 value); function approve(address spender, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic, Ownable { using SafeMath for uint256; mapping(address => uint256) balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) { balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amout of tokens to be transfered */ function transferFrom(address _from, address _to, uint256 _value) { var _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // if (_value > _allowance) throw; balances[_to] = balances[_to].add(_value); balances[_from] = balances[_from].sub(_value); allowed[_from][msg.sender] = _allowance.sub(_value); Transfer(_from, _to, _value); } /** * @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifing the amount of tokens still avaible for the spender. */ function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } } /** * @title TKRPToken * @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator. * Note they can later distribute these tokens as they wish using `transfer` and other * `StandardToken` functions. */ contract TKRPToken is StandardToken { event Destroy(address indexed _from); string public name = "TKRPToken"; string public symbol = "TKRP"; uint256 public decimals = 18; uint256 public initialSupply = 500000; /** * @dev Contructor that gives the sender all tokens */ function TKRPToken() { totalSupply = initialSupply; balances[msg.sender] = initialSupply; } /** * @dev Destroys tokens from an address, this process is irrecoverable. * @param _from The address to destroy the tokens from. */ function destroyFrom(address _from) onlyOwner returns (bool) { uint256 balance = balanceOf(_from); require(balance > 0); balances[_from] = 0; totalSupply = totalSupply.sub(balance); Destroy(_from); } } /** * @title TKRToken * @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator. * Note they can later distribute these tokens as they wish using `transfer` and other * `StandardToken` functions. */ contract TKRToken is StandardToken { event Destroy(address indexed _from, address indexed _to, uint256 _value); string public name = "TKRToken"; string public symbol = "TKR"; uint256 public decimals = 18; uint256 public initialSupply = 65500000 * 10 ** 18; /** * @dev Contructor that gives the sender all tokens */ function TKRToken() { totalSupply = initialSupply; balances[msg.sender] = initialSupply; } /** * @dev Destroys tokens, this process is irrecoverable. * @param _value The amount to destroy. */ function destroy(uint256 _value) onlyOwner returns (bool) { balances[msg.sender] = balances[msg.sender].sub(_value); totalSupply = totalSupply.sub(_value); Destroy(msg.sender, 0x0, _value); } } /** * @title Crowdsale * @dev Smart contract which collects ETH and in return transfers the TKRToken to the contributors * Log events are emitted for each transaction */ contract Crowdsale is Ownable { using SafeMath for uint256; /* * Stores the contribution in wei * Stores the amount received in TKR */ struct Contributor { uint256 contributed; uint256 received; } /* Backers are keyed by their address containing a Contributor struct */ mapping(address => Contributor) public contributors; /* Events to emit when a contribution has successfully processed */ event TokensSent(address indexed to, uint256 value); event ContributionReceived(address indexed to, uint256 value); event MigratedTokens(address indexed _address, uint256 value); /* Constants */ uint256 public constant TOKEN_CAP = 58500000 * 10 ** 18; uint256 public constant MINIMUM_CONTRIBUTION = 10 finney; uint256 public constant TOKENS_PER_ETHER = 5000 * 10 ** 18; uint256 public constant CROWDSALE_DURATION = 30 days; /* Public Variables */ TKRToken public token; TKRPToken public preToken; address public crowdsaleOwner; uint256 public etherReceived; uint256 public tokensSent; uint256 public crowdsaleStartTime; uint256 public crowdsaleEndTime; /* Modifier to check whether the crowdsale is running */ modifier crowdsaleRunning() { require(now < crowdsaleEndTime && crowdsaleStartTime != 0); _; } /** * @dev Fallback function which invokes the processContribution function * @param _tokenAddress TKR Token address * @param _to crowdsale owner address */ function Crowdsale(address _tokenAddress, address _preTokenAddress, address _to) { token = TKRToken(_tokenAddress); preToken = TKRPToken(_preTokenAddress); crowdsaleOwner = _to; } /** * @dev Fallback function which invokes the processContribution function */ function() crowdsaleRunning payable { processContribution(msg.sender); } /** * @dev Starts the crowdsale */ function start() onlyOwner { require(crowdsaleStartTime == 0); crowdsaleStartTime = now; crowdsaleEndTime = now + CROWDSALE_DURATION; } /** * @dev A backup fail-safe drain if required */ function drain() onlyOwner { assert(crowdsaleOwner.send(this.balance)); } /** * @dev Finalizes the crowdsale and sends funds */ function finalize() onlyOwner { require((crowdsaleStartTime != 0 && now > crowdsaleEndTime) || tokensSent == TOKEN_CAP); uint256 remainingBalance = token.balanceOf(this); if (remainingBalance > 0) token.destroy(remainingBalance); assert(crowdsaleOwner.send(this.balance)); } /** * @dev Migrates TKRP tokens to TKR token at a rate of 1:1 during the Crowdsale. */ function migrate() crowdsaleRunning { uint256 preTokenBalance = preToken.balanceOf(msg.sender); require(preTokenBalance != 0); uint256 tokenBalance = preTokenBalance * 10 ** 18; preToken.destroyFrom(msg.sender); token.transfer(msg.sender, tokenBalance); MigratedTokens(msg.sender, tokenBalance); } /** * @dev Processes the contribution given, sends the tokens and emits events * @param sender The address of the contributor */ function processContribution(address sender) internal { require(msg.value >= MINIMUM_CONTRIBUTION); // // /* Calculate total (+bonus) amount to send, throw if it exceeds cap*/ uint256 contributionInTokens = bonus(msg.value.mul(TOKENS_PER_ETHER).div(1 ether)); require(contributionInTokens.add(tokensSent) <= TOKEN_CAP); /* Send the tokens */ token.transfer(sender, contributionInTokens); /* Create a contributor struct and store the contributed/received values */ Contributor storage contributor = contributors[sender]; contributor.received = contributor.received.add(contributionInTokens); contributor.contributed = contributor.contributed.add(msg.value); // /* Update the total amount of tokens sent and ether received */ etherReceived = etherReceived.add(msg.value); tokensSent = tokensSent.add(contributionInTokens); // /* Emit log events */ TokensSent(sender, contributionInTokens); ContributionReceived(sender, msg.value); } /** * @dev Calculates the bonus amount based on the contribution date * @param amount The contribution amount given */ function bonus(uint256 amount) internal constant returns (uint256) { /* This adds a bonus 20% such as 100 + 100/5 = 120 */ if (now < crowdsaleStartTime.add(2 days)) return amount.add(amount.div(5)); /* This adds a bonus 10% such as 100 + 100/10 = 110 */ if (now < crowdsaleStartTime.add(14 days)) return amount.add(amount.div(10)); /* This adds a bonus 5% such as 100 + 100/20 = 105 */ if (now < crowdsaleStartTime.add(21 days)) return amount.add(amount.div(20)); /* No bonus is given */ return amount; } }
Stores the contribution in wei Stores the amount received in TKR/
struct Contributor { uint256 contributed; uint256 received; } event ContributionReceived(address indexed to, uint256 value); event MigratedTokens(address indexed _address, uint256 value); uint256 public constant MINIMUM_CONTRIBUTION = 10 finney; uint256 public constant TOKENS_PER_ETHER = 5000 * 10 ** 18; uint256 public constant CROWDSALE_DURATION = 30 days; TKRPToken public preToken; address public crowdsaleOwner; uint256 public etherReceived; uint256 public tokensSent; uint256 public crowdsaleStartTime; uint256 public crowdsaleEndTime;
12,815,374
[ 1, 4625, 348, 7953, 560, 30, 225, 20296, 455, 326, 24880, 316, 732, 77, 20296, 455, 326, 3844, 5079, 316, 399, 47, 54, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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034, 460, 1769, 203, 565, 871, 490, 2757, 690, 5157, 12, 2867, 8808, 389, 2867, 16, 2254, 5034, 460, 1769, 203, 203, 565, 2254, 5034, 1071, 5381, 6989, 18605, 67, 6067, 2259, 38, 13269, 273, 1728, 574, 82, 402, 31, 203, 565, 2254, 5034, 1071, 5381, 14275, 55, 67, 3194, 67, 1584, 3891, 273, 20190, 380, 1728, 2826, 6549, 31, 203, 565, 2254, 5034, 1071, 5381, 385, 11226, 19748, 900, 67, 24951, 273, 5196, 4681, 31, 203, 203, 565, 399, 47, 54, 52, 1345, 1071, 675, 1345, 31, 203, 565, 1758, 1071, 276, 492, 2377, 5349, 5541, 31, 203, 565, 2254, 5034, 1071, 225, 2437, 8872, 31, 203, 565, 2254, 5034, 1071, 2430, 7828, 31, 203, 565, 2254, 5034, 1071, 276, 492, 2377, 5349, 13649, 31, 203, 565, 2254, 5034, 1071, 276, 492, 2377, 5349, 25255, 31, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// File: @openzeppelin\contracts\token\ERC20\IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.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); } // File: node_modules\@openzeppelin\contracts\GSN\Context.sol 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; } } // File: node_modules\@openzeppelin\contracts\utils\Address.sol pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin\contracts\token\ERC20\ERC20.sol pragma solidity ^0.6.0; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // File: @openzeppelin\contracts\math\SafeMath.sol pragma solidity ^0.6.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; } } // File: @openzeppelin\contracts\access\Ownable.sol pragma solidity ^0.6.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: ..\contracts\DraculaToken.sol pragma solidity 0.6.12; contract DraculaToken is ERC20("Dracula Token", "DRC"), Ownable { using SafeMath for uint256; event Minted(address indexed minter, address indexed receiver, uint mintAmount); event Burned(address indexed burner, uint burnAmount); function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); emit Minted(owner(), _to, _amount); } function burn(uint256 _amount) public { _burn(msg.sender, _amount); emit Burned(msg.sender, _amount); } function _beforeTokenTransfer(address from, address to, uint256 amount) internal override virtual { _moveDelegates(_delegates[from], _delegates[to], amount); } /// @dev A record of each accounts delegate mapping (address => address) internal _delegates; /// @notice A checkpoint for marking number of votes from a given block struct Checkpoint { uint32 fromBlock; uint256 votes; } /// @notice A record of votes checkpoints for each account, by index mapping (address => mapping (uint32 => Checkpoint)) public checkpoints; /// @notice The number of checkpoints for each account mapping (address => uint32) public numCheckpoints; /// @notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); /// @notice The EIP-712 typehash for the delegation struct used by the contract bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); /// @notice A record of states for signing / validating signatures mapping (address => uint) public nonces; /// @notice An event thats emitted when an account changes its delegate event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); /// @notice An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance); /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegator The address to get delegatee for */ function delegates(address delegator) external view returns (address) { return _delegates[delegator]; } /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) external { return _delegate(msg.sender, delegatee); } /** * @notice Delegates votes from signatory to `delegatee` * @param delegatee The address to delegate votes to * @param nonce The contract state required to match the signature * @param expiry The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function delegateBySig( address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())), getChainId(), address(this) ) ); bytes32 structHash = keccak256( abi.encode( DELEGATION_TYPEHASH, delegatee, nonce, expiry ) ); bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", domainSeparator, structHash ) ); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "DRC::delegateBySig: invalid signature"); require(nonce == nonces[signatory]++, "DRC::delegateBySig: invalid nonce"); require(now <= expiry, "DRC::delegateBySig: signature expired"); return _delegate(signatory, delegatee); } /** * @notice Gets the current votes balance for `account` * @param account The address to get votes balance * @return The number of current votes for `account` */ function getCurrentVotes(address account) external view returns (uint256) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; } /** * @notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "DRC::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check most recent balance if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } // Next check implicit zero balance if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[account][lower].votes; } function _delegate(address delegator, address delegatee) internal { address currentDelegate = _delegates[delegator]; uint256 delegatorBalance = balanceOf(delegator); // balance of underlying DRCs (not scaled); _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, delegatorBalance); } function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { // decrease old representative uint32 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { // increase new representative uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _writeCheckpoint( address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes ) internal { uint32 blockNumber = safe32(block.number, "DRC::_writeCheckpoint: block number exceeds 32 bits"); if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; } else { checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes); numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } function safe32(uint n, string memory errorMessage) internal pure returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); } function getChainId() internal pure returns (uint) { uint256 chainId; assembly { chainId := chainid() } return chainId; } } // File: ..\contracts\DraculaHoard.sol pragma solidity ^0.6.12; contract DraculaHoard is ERC20("DraculaHoard", "BLOOD"), Ownable { using SafeMath for uint256; IERC20 public dracula; uint256 public burnRate = 1; constructor(IERC20 _dracula) public { dracula = _dracula; } function setBurnRate(uint256 _burnRate) external onlyOwner { require(_burnRate <= 10, "Invalid burn rate value"); burnRate = _burnRate; } /// @notice Return staked amount + rewards function balance(address account) public view returns (uint256) { uint256 totalShares = totalSupply(); return balanceOf(account).mul(dracula.balanceOf(address(this))).div(totalShares); } function stake(uint256 _amount) external { uint256 totalDracula = dracula.balanceOf(address(this)); uint256 totalShares = totalSupply(); if (totalShares == 0 || totalDracula == 0) { _mint(msg.sender, _amount); } else { uint256 what = _amount.mul(totalShares).div(totalDracula); _mint(msg.sender, what); } dracula.transferFrom(msg.sender, address(this), _amount); } function unstake(uint256 _share) external { uint256 totalShares = totalSupply(); uint256 what = _share.mul(dracula.balanceOf(address(this))).div(totalShares); _burn(msg.sender, _share); uint256 burnAmount = what.mul(burnRate).div(100); if (burnAmount > 0) { DraculaToken(address(dracula)).burn(burnAmount); } dracula.transfer(msg.sender, what.sub(burnAmount)); } }
@notice Return staked amount + rewards
function balance(address account) public view returns (uint256) { uint256 totalShares = totalSupply(); return balanceOf(account).mul(dracula.balanceOf(address(this))).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0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 11013, 12, 2867, 2236, 13, 1071, 1476, 1135, 261, 11890, 5034, 13, 288, 203, 3639, 2254, 5034, 2078, 24051, 273, 2078, 3088, 1283, 5621, 203, 3639, 327, 11013, 951, 12, 4631, 2934, 16411, 12, 27224, 1934, 69, 18, 12296, 951, 12, 2867, 12, 2211, 3719, 2934, 2892, 12, 4963, 24051, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.4.11; contract PullPayInterface { function asyncSend(address _dest) public payable; } contract Governable { // list of admins, council at first spot address[] public admins; function Governable() { admins.length = 1; admins[0] = msg.sender; } modifier onlyAdmins() { bool isAdmin = false; for (uint256 i = 0; i < admins.length; i++) { if (msg.sender == admins[i]) { isAdmin = true; } } require(isAdmin == true); _; } function addAdmin(address _admin) public onlyAdmins { for (uint256 i = 0; i < admins.length; i++) { require(_admin != admins[i]); } require(admins.length < 10); admins[admins.length++] = _admin; } function removeAdmin(address _admin) public onlyAdmins { uint256 pos = admins.length; for (uint256 i = 0; i < admins.length; i++) { if (_admin == admins[i]) { pos = i; } } require(pos < admins.length); // if not last element, switch with last if (pos < admins.length - 1) { admins[pos] = admins[admins.length - 1]; } // then cut off the tail admins.length--; } } contract StorageEnabled { // satelite contract addresses address public storageAddr; function StorageEnabled(address _storageAddr) { storageAddr = _storageAddr; } // ############################################ // ########### NUTZ FUNCTIONS ################ // ############################################ // all Nutz balances function babzBalanceOf(address _owner) constant returns (uint256) { return Storage(storageAddr).getBal('Nutz', _owner); } function _setBabzBalanceOf(address _owner, uint256 _newValue) internal { Storage(storageAddr).setBal('Nutz', _owner, _newValue); } // active supply - sum of balances above function activeSupply() constant returns (uint256) { return Storage(storageAddr).getUInt('Nutz', 'activeSupply'); } function _setActiveSupply(uint256 _newActiveSupply) internal { Storage(storageAddr).setUInt('Nutz', 'activeSupply', _newActiveSupply); } // burn pool - inactive supply function burnPool() constant returns (uint256) { return Storage(storageAddr).getUInt('Nutz', 'burnPool'); } function _setBurnPool(uint256 _newBurnPool) internal { Storage(storageAddr).setUInt('Nutz', 'burnPool', _newBurnPool); } // power pool - inactive supply function powerPool() constant returns (uint256) { return Storage(storageAddr).getUInt('Nutz', 'powerPool'); } function _setPowerPool(uint256 _newPowerPool) internal { Storage(storageAddr).setUInt('Nutz', 'powerPool', _newPowerPool); } // ############################################ // ########### POWER FUNCTIONS ############# // ############################################ // all power balances function powerBalanceOf(address _owner) constant returns (uint256) { return Storage(storageAddr).getBal('Power', _owner); } function _setPowerBalanceOf(address _owner, uint256 _newValue) internal { Storage(storageAddr).setBal('Power', _owner, _newValue); } function outstandingPower() constant returns (uint256) { return Storage(storageAddr).getUInt('Power', 'outstandingPower'); } function _setOutstandingPower(uint256 _newOutstandingPower) internal { Storage(storageAddr).setUInt('Power', 'outstandingPower', _newOutstandingPower); } function authorizedPower() constant returns (uint256) { return Storage(storageAddr).getUInt('Power', 'authorizedPower'); } function _setAuthorizedPower(uint256 _newAuthorizedPower) internal { Storage(storageAddr).setUInt('Power', 'authorizedPower', _newAuthorizedPower); } function downs(address _user) constant public returns (uint256 total, uint256 left, uint256 start) { uint256 rawBytes = Storage(storageAddr).getBal('PowerDown', _user); start = uint64(rawBytes); left = uint96(rawBytes >> (64)); total = uint96(rawBytes >> (96 + 64)); return; } function _setDownRequest(address _holder, uint256 total, uint256 left, uint256 start) internal { uint256 result = uint64(start) + (left << 64) + (total << (96 + 64)); Storage(storageAddr).setBal('PowerDown', _holder, result); } } /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Governable { bool public paused = true; /** * @dev modifier to allow actions only when the contract IS paused */ modifier whenNotPaused() { require(!paused); _; } /** * @dev modifier to allow actions only when the contract IS NOT paused */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyAdmins whenNotPaused { paused = true; } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyAdmins whenPaused { //TODO: do some checks paused = false; } } /* * ERC20Basic * Simpler version of ERC20 interface * see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { function totalSupply() constant returns (uint256); function balanceOf(address _owner) constant returns (uint256); function transfer(address _to, uint256 _value) returns (bool); event Transfer(address indexed from, address indexed to, uint value); } contract ERC223Basic is ERC20Basic { function transfer(address to, uint value, bytes data) returns (bool); } /* * ERC20 interface * see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC223Basic { // active supply of tokens function activeSupply() constant returns (uint256); function allowance(address _owner, address _spender) constant returns (uint256); function transferFrom(address _from, address _to, uint _value) returns (bool); function approve(address _spender, uint256 _value); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) onlyOwner { require(newOwner != address(0)); owner = newOwner; } } contract Power is Ownable, ERC20Basic { event Slashing(address indexed holder, uint value, bytes32 data); string public name = "Acebusters Power"; string public symbol = "ABP"; uint256 public decimals = 12; function balanceOf(address _holder) constant returns (uint256) { return ControllerInterface(owner).powerBalanceOf(_holder); } function totalSupply() constant returns (uint256) { return ControllerInterface(owner).powerTotalSupply(); } function activeSupply() constant returns (uint256) { return ControllerInterface(owner).outstandingPower(); } // ############################################ // ########### ADMIN FUNCTIONS ################ // ############################################ function slashPower(address _holder, uint256 _value, bytes32 _data) public onlyOwner { Slashing(_holder, _value, _data); } function powerUp(address _holder, uint256 _value) public onlyOwner { // NTZ transfered from user's balance to power pool Transfer(address(0), _holder, _value); } // ############################################ // ########### PUBLIC FUNCTIONS ############### // ############################################ // registers a powerdown request function transfer(address _to, uint256 _amountPower) public returns (bool success) { // make Power not transferable require(_to == address(0)); ControllerInterface(owner).createDownRequest(msg.sender, _amountPower); Transfer(msg.sender, address(0), _amountPower); return true; } function downtime() public returns (uint256) { ControllerInterface(owner).downtime; } function downTick(address _owner) public { ControllerInterface(owner).downTick(_owner, now); } function downs(address _owner) constant public returns (uint256, uint256, uint256) { return ControllerInterface(owner).downs(_owner); } } contract Storage is Ownable { struct Crate { mapping(bytes32 => uint256) uints; mapping(bytes32 => address) addresses; mapping(bytes32 => bool) bools; mapping(address => uint256) bals; } mapping(bytes32 => Crate) crates; function setUInt(bytes32 _crate, bytes32 _key, uint256 _value) onlyOwner { crates[_crate].uints[_key] = _value; } function getUInt(bytes32 _crate, bytes32 _key) constant returns(uint256) { return crates[_crate].uints[_key]; } function setAddress(bytes32 _crate, bytes32 _key, address _value) onlyOwner { crates[_crate].addresses[_key] = _value; } function getAddress(bytes32 _crate, bytes32 _key) constant returns(address) { return crates[_crate].addresses[_key]; } function setBool(bytes32 _crate, bytes32 _key, bool _value) onlyOwner { crates[_crate].bools[_key] = _value; } function getBool(bytes32 _crate, bytes32 _key) constant returns(bool) { return crates[_crate].bools[_key]; } function setBal(bytes32 _crate, address _key, uint256 _value) onlyOwner { crates[_crate].bals[_key] = _value; } function getBal(bytes32 _crate, address _key) constant returns(uint256) { return crates[_crate].bals[_key]; } } contract NutzEnabled is Pausable, StorageEnabled { using SafeMath for uint; // satelite contract addresses address public nutzAddr; modifier onlyNutz() { require(msg.sender == nutzAddr); _; } function NutzEnabled(address _nutzAddr, address _storageAddr) StorageEnabled(_storageAddr) { nutzAddr = _nutzAddr; } // ############################################ // ########### NUTZ FUNCTIONS ################ // ############################################ // total supply(modified for etherscan display) function totalSupply() constant returns (uint256) { return activeSupply(); } // total supply(for internal calculations) function completeSupply() constant returns (uint256) { return activeSupply().add(powerPool()).add(burnPool()); } // allowances according to ERC20 // not written to storage, as not very critical mapping (address => mapping (address => uint)) internal allowed; function allowance(address _owner, address _spender) constant returns (uint256) { return allowed[_owner][_spender]; } function approve(address _owner, address _spender, uint256 _amountBabz) public onlyNutz whenNotPaused { require(_owner != _spender); allowed[_owner][_spender] = _amountBabz; } function _transfer(address _from, address _to, uint256 _amountBabz, bytes _data) internal { require(_to != address(this)); require(_to != address(0)); require(_amountBabz > 0); require(_from != _to); _setBabzBalanceOf(_from, babzBalanceOf(_from).sub(_amountBabz)); _setBabzBalanceOf(_to, babzBalanceOf(_to).add(_amountBabz)); } function transfer(address _from, address _to, uint256 _amountBabz, bytes _data) public onlyNutz whenNotPaused { _transfer(_from, _to, _amountBabz, _data); } function transferFrom(address _sender, address _from, address _to, uint256 _amountBabz, bytes _data) public onlyNutz whenNotPaused { allowed[_from][_sender] = allowed[_from][_sender].sub(_amountBabz); _transfer(_from, _to, _amountBabz, _data); } } /* * Contract that is working with ERC223 tokens */ contract ERC223ReceivingContract { function tokenFallback(address _from, uint _value, bytes _data); } contract ControllerInterface { // State Variables bool public paused; address public nutzAddr; // Nutz functions function babzBalanceOf(address _owner) constant returns (uint256); function activeSupply() constant returns (uint256); function burnPool() constant returns (uint256); function powerPool() constant returns (uint256); function totalSupply() constant returns (uint256); function completeSupply() constant returns (uint256); function allowance(address _owner, address _spender) constant returns (uint256); function approve(address _owner, address _spender, uint256 _amountBabz) public; function transfer(address _from, address _to, uint256 _amountBabz, bytes _data) public; function transferFrom(address _sender, address _from, address _to, uint256 _amountBabz, bytes _data) public; // Market functions function floor() constant returns (uint256); function ceiling() constant returns (uint256); function purchase(address _sender, uint256 _value, uint256 _price) public returns (uint256); function sell(address _from, uint256 _price, uint256 _amountBabz); // Power functions function powerBalanceOf(address _owner) constant returns (uint256); function outstandingPower() constant returns (uint256); function authorizedPower() constant returns (uint256); function powerTotalSupply() constant returns (uint256); function powerUp(address _sender, address _from, uint256 _amountBabz) public; function downTick(address _owner, uint256 _now) public; function createDownRequest(address _owner, uint256 _amountPower) public; function downs(address _owner) constant public returns(uint256, uint256, uint256); function downtime() constant returns (uint256); } /** * @title PullPayment * @dev Base contract supporting async send for pull payments. */ contract PullPayment is Ownable { using SafeMath for uint256; uint public dailyLimit = 1000000000000000000000; // 1 ETH uint public lastDay; uint public spentToday; // 8bytes date, 24 bytes value mapping(address => uint256) internal payments; modifier onlyNutz() { require(msg.sender == ControllerInterface(owner).nutzAddr()); _; } modifier whenNotPaused () { require(!ControllerInterface(owner).paused()); _; } function balanceOf(address _owner) constant returns (uint256 value) { return uint192(payments[_owner]); } function paymentOf(address _owner) constant returns (uint256 value, uint256 date) { value = uint192(payments[_owner]); date = (payments[_owner] >> 192); return; } /// @dev Allows to change the daily limit. Transaction has to be sent by wallet. /// @param _dailyLimit Amount in wei. function changeDailyLimit(uint _dailyLimit) public onlyOwner { dailyLimit = _dailyLimit; } function changeWithdrawalDate(address _owner, uint256 _newDate) public onlyOwner { // allow to withdraw immediately // move witdrawal date more days into future payments[_owner] = (_newDate << 192) + uint192(payments[_owner]); } function asyncSend(address _dest) public payable onlyNutz { require(msg.value > 0); uint256 newValue = msg.value.add(uint192(payments[_dest])); uint256 newDate; if (isUnderLimit(msg.value)) { uint256 date = payments[_dest] >> 192; newDate = (date > now) ? date : now; } else { newDate = now.add(3 days); } spentToday = spentToday.add(msg.value); payments[_dest] = (newDate << 192) + uint192(newValue); } function withdraw() public whenNotPaused { address untrustedRecipient = msg.sender; uint256 amountWei = uint192(payments[untrustedRecipient]); require(amountWei != 0); require(now >= (payments[untrustedRecipient] >> 192)); require(this.balance >= amountWei); payments[untrustedRecipient] = 0; assert(untrustedRecipient.call.gas(1000).value(amountWei)()); } /* * Internal functions */ /// @dev Returns if amount is within daily limit and resets spentToday after one day. /// @param amount Amount to withdraw. /// @return Returns if amount is under daily limit. function isUnderLimit(uint amount) internal returns (bool) { if (now > lastDay.add(24 hours)) { lastDay = now; spentToday = 0; } // not using safe math because we don't want to throw; if (spentToday + amount > dailyLimit || spentToday + amount < spentToday) { return false; } return true; } } /** * Nutz implements a price floor and a price ceiling on the token being * sold. It is based of the zeppelin token contract. */ contract Nutz is Ownable, ERC20 { event Sell(address indexed seller, uint256 value); string public name = "Acebusters Nutz"; // acebusters units: // 10^12 - Nutz (NTZ) // 10^9 - Jonyz // 10^6 - Helcz // 10^3 - Pascalz // 10^0 - Babz string public symbol = "NTZ"; uint256 public decimals = 12; // returns balances of active holders function balanceOf(address _owner) constant returns (uint) { return ControllerInterface(owner).babzBalanceOf(_owner); } function totalSupply() constant returns (uint256) { return ControllerInterface(owner).totalSupply(); } function activeSupply() constant returns (uint256) { return ControllerInterface(owner).activeSupply(); } // return remaining allowance // if calling return allowed[address(this)][_spender]; // returns balance of ether parked to be withdrawn function allowance(address _owner, address _spender) constant returns (uint256) { return ControllerInterface(owner).allowance(_owner, _spender); } // returns either the salePrice, or if reserve does not suffice // for active supply, returns maxFloor function floor() constant returns (uint256) { return ControllerInterface(owner).floor(); } // returns either the salePrice, or if reserve does not suffice // for active supply, returns maxFloor function ceiling() constant returns (uint256) { return ControllerInterface(owner).ceiling(); } function powerPool() constant returns (uint256) { return ControllerInterface(owner).powerPool(); } function _checkDestination(address _from, address _to, uint256 _value, bytes _data) internal { // erc223: Retrieve the size of the code on target address, this needs assembly . uint256 codeLength; assembly { codeLength := extcodesize(_to) } if(codeLength>0) { ERC223ReceivingContract untrustedReceiver = ERC223ReceivingContract(_to); // untrusted contract call untrustedReceiver.tokenFallback(_from, _value, _data); } } // ############################################ // ########### ADMIN FUNCTIONS ################ // ############################################ function powerDown(address powerAddr, address _holder, uint256 _amountBabz) public onlyOwner { bytes memory empty; _checkDestination(powerAddr, _holder, _amountBabz, empty); // NTZ transfered from power pool to user's balance Transfer(powerAddr, _holder, _amountBabz); } function asyncSend(address _pullAddr, address _dest, uint256 _amountWei) public onlyOwner { assert(_amountWei <= this.balance); PullPayInterface(_pullAddr).asyncSend.value(_amountWei)(_dest); } // ############################################ // ########### PUBLIC FUNCTIONS ############### // ############################################ function approve(address _spender, uint256 _amountBabz) public { ControllerInterface(owner).approve(msg.sender, _spender, _amountBabz); Approval(msg.sender, _spender, _amountBabz); } function transfer(address _to, uint256 _amountBabz, bytes _data) public returns (bool) { ControllerInterface(owner).transfer(msg.sender, _to, _amountBabz, _data); Transfer(msg.sender, _to, _amountBabz); _checkDestination(msg.sender, _to, _amountBabz, _data); return true; } function transfer(address _to, uint256 _amountBabz) public returns (bool) { bytes memory empty; return transfer(_to, _amountBabz, empty); } function transData(address _to, uint256 _amountBabz, bytes _data) public returns (bool) { return transfer(_to, _amountBabz, _data); } function transferFrom(address _from, address _to, uint256 _amountBabz, bytes _data) public returns (bool) { ControllerInterface(owner).transferFrom(msg.sender, _from, _to, _amountBabz, _data); Transfer(_from, _to, _amountBabz); _checkDestination(_from, _to, _amountBabz, _data); return true; } function transferFrom(address _from, address _to, uint256 _amountBabz) public returns (bool) { bytes memory empty; return transferFrom(_from, _to, _amountBabz, empty); } function () public payable { uint256 price = ControllerInterface(owner).ceiling(); purchase(price); require(msg.value > 0); } function purchase(uint256 _price) public payable { require(msg.value > 0); uint256 amountBabz = ControllerInterface(owner).purchase(msg.sender, msg.value, _price); Transfer(owner, msg.sender, amountBabz); bytes memory empty; _checkDestination(address(this), msg.sender, amountBabz, empty); } function sell(uint256 _price, uint256 _amountBabz) public { require(_amountBabz != 0); ControllerInterface(owner).sell(msg.sender, _price, _amountBabz); Sell(msg.sender, _amountBabz); } function powerUp(uint256 _amountBabz) public { Transfer(msg.sender, owner, _amountBabz); ControllerInterface(owner).powerUp(msg.sender, msg.sender, _amountBabz); } } contract MarketEnabled is NutzEnabled { uint256 constant INFINITY = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; // address of the pull payemnt satelite address public pullAddr; // the Token sale mechanism parameters: // purchasePrice is the number of NTZ received for purchase with 1 ETH uint256 internal purchasePrice; // floor is the number of NTZ needed, to receive 1 ETH in sell uint256 internal salePrice; function MarketEnabled(address _pullAddr, address _storageAddr, address _nutzAddr) NutzEnabled(_nutzAddr, _storageAddr) { pullAddr = _pullAddr; } function ceiling() constant returns (uint256) { return purchasePrice; } // returns either the salePrice, or if reserve does not suffice // for active supply, returns maxFloor function floor() constant returns (uint256) { if (nutzAddr.balance == 0) { return INFINITY; } uint256 maxFloor = activeSupply().mul(1000000).div(nutzAddr.balance); // 1,000,000 WEI, used as price factor // return max of maxFloor or salePrice return maxFloor >= salePrice ? maxFloor : salePrice; } function moveCeiling(uint256 _newPurchasePrice) public onlyAdmins { require(_newPurchasePrice <= salePrice); purchasePrice = _newPurchasePrice; } function moveFloor(uint256 _newSalePrice) public onlyAdmins { require(_newSalePrice >= purchasePrice); // moveFloor fails if the administrator tries to push the floor so low // that the sale mechanism is no longer able to buy back all tokens at // the floor price if those funds were to be withdrawn. if (_newSalePrice < INFINITY) { require(nutzAddr.balance >= activeSupply().mul(1000000).div(_newSalePrice)); // 1,000,000 WEI, used as price factor } salePrice = _newSalePrice; } function purchase(address _sender, uint256 _value, uint256 _price) public onlyNutz whenNotPaused returns (uint256) { // disable purchases if purchasePrice set to 0 require(purchasePrice > 0); require(_price == purchasePrice); uint256 amountBabz = purchasePrice.mul(_value).div(1000000); // 1,000,000 WEI, used as price factor // avoid deposits that issue nothing // might happen with very high purchase price require(amountBabz > 0); // make sure power pool grows proportional to economy uint256 activeSup = activeSupply(); uint256 powPool = powerPool(); if (powPool > 0) { uint256 powerShare = powPool.mul(amountBabz).div(activeSup.add(burnPool())); _setPowerPool(powPool.add(powerShare)); } _setActiveSupply(activeSup.add(amountBabz)); _setBabzBalanceOf(_sender, babzBalanceOf(_sender).add(amountBabz)); return amountBabz; } function sell(address _from, uint256 _price, uint256 _amountBabz) public onlyNutz whenNotPaused { uint256 effectiveFloor = floor(); require(_amountBabz != 0); require(effectiveFloor != INFINITY); require(_price == effectiveFloor); uint256 amountWei = _amountBabz.mul(1000000).div(effectiveFloor); // 1,000,000 WEI, used as price factor require(amountWei > 0); // make sure power pool shrinks proportional to economy uint256 powPool = powerPool(); uint256 activeSup = activeSupply(); if (powPool > 0) { uint256 powerShare = powPool.mul(_amountBabz).div(activeSup.add(burnPool())); _setPowerPool(powPool.sub(powerShare)); } _setActiveSupply(activeSup.sub(_amountBabz)); _setBabzBalanceOf(_from, babzBalanceOf(_from).sub(_amountBabz)); Nutz(nutzAddr).asyncSend(pullAddr, _from, amountWei); } // withdraw excessive reserve - i.e. milestones function allocateEther(uint256 _amountWei, address _beneficiary) public onlyAdmins { require(_amountWei > 0); // allocateEther fails if allocating those funds would mean that the // sale mechanism is no longer able to buy back all tokens at the floor // price if those funds were to be withdrawn. require(nutzAddr.balance.sub(_amountWei) >= activeSupply().mul(1000000).div(salePrice)); // 1,000,000 WEI, used as price factor Nutz(nutzAddr).asyncSend(pullAddr, _beneficiary, _amountWei); } } contract PowerEnabled is MarketEnabled { // satelite contract addresses address public powerAddr; // maxPower is a limit of total power that can be outstanding // maxPower has a valid value between outstandingPower and authorizedPow/2 uint256 public maxPower = 0; // time it should take to power down uint256 public downtime; uint public constant MIN_SHARE_OF_POWER = 100000; modifier onlyPower() { require(msg.sender == powerAddr); _; } function PowerEnabled(address _powerAddr, address _pullAddr, address _storageAddr, address _nutzAddr) MarketEnabled(_pullAddr, _nutzAddr, _storageAddr) { powerAddr = _powerAddr; } function setMaxPower(uint256 _maxPower) public onlyAdmins { require(outstandingPower() <= _maxPower && _maxPower < authorizedPower()); maxPower = _maxPower; } function setDowntime(uint256 _downtime) public onlyAdmins { downtime = _downtime; } function minimumPowerUpSizeBabz() public constant returns (uint256) { uint256 completeSupplyBabz = completeSupply(); if (completeSupplyBabz == 0) { return INFINITY; } return completeSupplyBabz.div(MIN_SHARE_OF_POWER); } // this is called when NTZ are deposited into the burn pool function dilutePower(uint256 _amountBabz, uint256 _amountPower) public onlyAdmins { uint256 authorizedPow = authorizedPower(); uint256 totalBabz = completeSupply(); if (authorizedPow == 0) { // during the first capital increase, set value directly as authorized shares _setAuthorizedPower((_amountPower > 0) ? _amountPower : _amountBabz.add(totalBabz)); } else { // in later increases, expand authorized shares at same rate like economy _setAuthorizedPower(authorizedPow.mul(totalBabz.add(_amountBabz)).div(totalBabz)); } _setBurnPool(burnPool().add(_amountBabz)); } function _slashPower(address _holder, uint256 _value, bytes32 _data) internal { uint256 previouslyOutstanding = outstandingPower(); _setOutstandingPower(previouslyOutstanding.sub(_value)); // adjust size of power pool uint256 powPool = powerPool(); uint256 slashingBabz = _value.mul(powPool).div(previouslyOutstanding); _setPowerPool(powPool.sub(slashingBabz)); // put event into satelite contract Power(powerAddr).slashPower(_holder, _value, _data); } function slashPower(address _holder, uint256 _value, bytes32 _data) public onlyAdmins { _setPowerBalanceOf(_holder, powerBalanceOf(_holder).sub(_value)); _slashPower(_holder, _value, _data); } function slashDownRequest(uint256 _pos, address _holder, uint256 _value, bytes32 _data) public onlyAdmins { var (total, left, start) = downs(_holder); left = left.sub(_value); _setDownRequest(_holder, total, left, start); _slashPower(_holder, _value, _data); } // this is called when NTZ are deposited into the power pool function powerUp(address _sender, address _from, uint256 _amountBabz) public onlyNutz whenNotPaused { uint256 authorizedPow = authorizedPower(); require(authorizedPow != 0); require(_amountBabz != 0); uint256 totalBabz = completeSupply(); require(totalBabz != 0); uint256 amountPow = _amountBabz.mul(authorizedPow).div(totalBabz); // check pow limits uint256 outstandingPow = outstandingPower(); require(outstandingPow.add(amountPow) <= maxPower); uint256 powBal = powerBalanceOf(_from).add(amountPow); require(powBal >= authorizedPow.div(MIN_SHARE_OF_POWER)); if (_sender != _from) { allowed[_from][_sender] = allowed[_from][_sender].sub(_amountBabz); } _setOutstandingPower(outstandingPow.add(amountPow)); _setPowerBalanceOf(_from, powBal); _setActiveSupply(activeSupply().sub(_amountBabz)); _setBabzBalanceOf(_from, babzBalanceOf(_from).sub(_amountBabz)); _setPowerPool(powerPool().add(_amountBabz)); Power(powerAddr).powerUp(_from, amountPow); } function powerTotalSupply() constant returns (uint256) { uint256 issuedPower = authorizedPower().div(2); // return max of maxPower or issuedPower return maxPower >= issuedPower ? maxPower : issuedPower; } function _vestedDown(uint256 _total, uint256 _left, uint256 _start, uint256 _now) internal constant returns (uint256) { if (_now <= _start) { return 0; } // calculate amountVested // amountVested is amount that can be withdrawn according to time passed uint256 timePassed = _now.sub(_start); if (timePassed > downtime) { timePassed = downtime; } uint256 amountVested = _total.mul(timePassed).div(downtime); uint256 amountFrozen = _total.sub(amountVested); if (_left <= amountFrozen) { return 0; } return _left.sub(amountFrozen); } function createDownRequest(address _owner, uint256 _amountPower) public onlyPower whenNotPaused { // prevent powering down tiny amounts // when powering down, at least completeSupply/minShare Power should be claimed require(_amountPower >= authorizedPower().div(MIN_SHARE_OF_POWER)); _setPowerBalanceOf(_owner, powerBalanceOf(_owner).sub(_amountPower)); var (, left, ) = downs(_owner); uint256 total = _amountPower.add(left); _setDownRequest(_owner, total, total, now); } // executes a powerdown request function downTick(address _holder, uint256 _now) public onlyPower whenNotPaused { var (total, left, start) = downs(_holder); uint256 amountPow = _vestedDown(total, left, start, _now); // prevent power down in tiny steps uint256 minStep = total.div(10); require(left <= minStep || minStep <= amountPow); // calculate token amount representing share of power uint256 amountBabz = amountPow.mul(completeSupply()).div(authorizedPower()); // transfer power and tokens _setOutstandingPower(outstandingPower().sub(amountPow)); left = left.sub(amountPow); _setPowerPool(powerPool().sub(amountBabz)); _setActiveSupply(activeSupply().add(amountBabz)); _setBabzBalanceOf(_holder, babzBalanceOf(_holder).add(amountBabz)); // down request completed if (left == 0) { start = 0; total = 0; } // TODO _setDownRequest(_holder, total, left, start); Nutz(nutzAddr).powerDown(powerAddr, _holder, amountBabz); } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract Controller is PowerEnabled { function Controller(address _powerAddr, address _pullAddr, address _nutzAddr, address _storageAddr) PowerEnabled(_powerAddr, _pullAddr, _nutzAddr, _storageAddr) { } function setContracts(address _storageAddr, address _nutzAddr, address _powerAddr, address _pullAddr) public onlyAdmins whenPaused { storageAddr = _storageAddr; nutzAddr = _nutzAddr; powerAddr = _powerAddr; pullAddr = _pullAddr; } function changeDailyLimit(uint256 _dailyLimit) public onlyAdmins { PullPayment(pullAddr).changeDailyLimit(_dailyLimit); } function kill(address _newController) public onlyAdmins whenPaused { if (powerAddr != address(0)) { Ownable(powerAddr).transferOwnership(msg.sender); } if (pullAddr != address(0)) { Ownable(pullAddr).transferOwnership(msg.sender); } if (nutzAddr != address(0)) { Ownable(nutzAddr).transferOwnership(msg.sender); } if (storageAddr != address(0)) { Ownable(storageAddr).transferOwnership(msg.sender); } selfdestruct(_newController); } }
* @dev called by the owner to unpause, returns to normal state/TODO: do some checks
function unpause() onlyAdmins whenPaused { paused = false; }
1,002,643
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 2566, 635, 326, 3410, 358, 640, 19476, 16, 1135, 358, 2212, 919, 19, 6241, 30, 741, 2690, 4271, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 225, 445, 640, 19476, 1435, 1338, 4446, 87, 1347, 28590, 288, 203, 565, 17781, 273, 629, 31, 203, 225, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./partial_match/1/0x383179f368e86eab1ADA5E31869cc5168FD4AF26/sources/contracts/lib/FixedPointMathLib.sol
@notice Arithmetic library with operations for fixed-point numbers. @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/FixedPointMathLib.sol) @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)
library FixedPointMathLib { SIMPLIFIED FIXED POINT OPERATIONS pragma solidity >=0.8.0; function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) { } function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) { } function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) { } function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) { } LOW LEVEL FIXED POINT OPERATIONS function mulDivDown( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 z) { assembly { z := mul(x, y) if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) { revert(0, 0) } } } function mulDivDown( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 z) { assembly { z := mul(x, y) if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) { revert(0, 0) } } } function mulDivDown( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 z) { assembly { z := mul(x, y) if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) { revert(0, 0) } } } z := div(z, denominator) function mulDivUp( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 z) { assembly { z := mul(x, y) if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) { revert(0, 0) } } } function mulDivUp( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 z) { assembly { z := mul(x, y) if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) { revert(0, 0) } } } function mulDivUp( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 z) { assembly { z := mul(x, y) if iszero(and(iszero(iszero(denominator)), or(iszero(x), eq(div(z, x), y)))) { revert(0, 0) } } } z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1)) function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES let half := shr(1, scalar) function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES } n { } { function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES let xx := mul(x, x) let xxRound := add(xx, half) function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES x := div(xxRound, scalar) function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES let zxRound := add(zx, half) function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { assembly { switch x case 0 { switch n case 0 { z := scalar } default { z := 0 } } default { switch mod(n, 2) case 0 { z := scalar } default { z := x } for { n := shr(1, n) n := shr(1, n) if shr(128, x) { revert(0, 0) } if lt(xxRound, xx) { revert(0, 0) } if mod(n, 2) { let zx := mul(z, x) if iszero(eq(div(zx, x), z)) { if iszero(iszero(x)) { revert(0, 0) } } if lt(zxRound, zx) { revert(0, 0) } } } } } } GENERAL NUMBER UTILITIES z := div(zxRound, scalar) function sqrt(uint256 x) internal pure returns (uint256 z) { assembly { z := 1 let y := x if iszero(lt(y, 0x100000000000000000000000000000000)) { } if iszero(lt(y, 0x10000000000000000)) { } if iszero(lt(y, 0x100000000)) { } if iszero(lt(y, 0x10000)) { } if iszero(lt(y, 0x100)) { } if iszero(lt(y, 0x10)) { } if iszero(lt(y, 0x8)) { z := shl(1, z) } z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) if lt(zRoundDown, z) { z := zRoundDown } } } function sqrt(uint256 x) internal pure returns (uint256 z) { assembly { z := 1 let y := x if iszero(lt(y, 0x100000000000000000000000000000000)) { } if iszero(lt(y, 0x10000000000000000)) { } if iszero(lt(y, 0x100000000)) { } if iszero(lt(y, 0x10000)) { } if iszero(lt(y, 0x100)) { } if iszero(lt(y, 0x10)) { } if iszero(lt(y, 0x8)) { z := shl(1, z) } z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) if lt(zRoundDown, z) { z := zRoundDown } } } function sqrt(uint256 x) internal pure returns (uint256 z) { assembly { z := 1 let y := x if iszero(lt(y, 0x100000000000000000000000000000000)) { } if iszero(lt(y, 0x10000000000000000)) { } if iszero(lt(y, 0x100000000)) { } if iszero(lt(y, 0x10000)) { } if iszero(lt(y, 0x100)) { } if iszero(lt(y, 0x10)) { } if iszero(lt(y, 0x8)) { z := shl(1, z) } z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) if lt(zRoundDown, z) { z := zRoundDown } } } function sqrt(uint256 x) internal pure returns (uint256 z) { assembly { z := 1 let y := x if iszero(lt(y, 0x100000000000000000000000000000000)) { } if iszero(lt(y, 0x10000000000000000)) { } if iszero(lt(y, 0x100000000)) { } if iszero(lt(y, 0x10000)) { } if iszero(lt(y, 0x100)) { } if iszero(lt(y, 0x10)) { } if iszero(lt(y, 0x8)) { z := shl(1, z) } z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) if lt(zRoundDown, z) { z := zRoundDown } } } function sqrt(uint256 x) internal pure returns (uint256 z) { assembly { z := 1 let y := x if iszero(lt(y, 0x100000000000000000000000000000000)) { } if iszero(lt(y, 0x10000000000000000)) { } if iszero(lt(y, 0x100000000)) { } if iszero(lt(y, 0x10000)) { } if iszero(lt(y, 0x100)) { } if iszero(lt(y, 0x10)) { } if iszero(lt(y, 0x8)) { z := shl(1, z) } z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) if lt(zRoundDown, z) { z := zRoundDown } } } function sqrt(uint256 x) internal pure returns (uint256 z) { assembly { z := 1 let y := x if iszero(lt(y, 0x100000000000000000000000000000000)) { } if iszero(lt(y, 0x10000000000000000)) { } if iszero(lt(y, 0x100000000)) { } if iszero(lt(y, 0x10000)) { } if iszero(lt(y, 0x100)) { } if iszero(lt(y, 0x10)) { } if iszero(lt(y, 0x8)) { z := shl(1, z) } z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) if lt(zRoundDown, z) { z := zRoundDown } } } function sqrt(uint256 x) internal pure returns (uint256 z) { assembly { z := 1 let y := x if iszero(lt(y, 0x100000000000000000000000000000000)) { } if iszero(lt(y, 0x10000000000000000)) { } if iszero(lt(y, 0x100000000)) { } if iszero(lt(y, 0x10000)) { } if iszero(lt(y, 0x100)) { } if iszero(lt(y, 0x10)) { } if iszero(lt(y, 0x8)) { z := shl(1, z) } z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) if lt(zRoundDown, z) { z := zRoundDown } } } function sqrt(uint256 x) internal pure returns (uint256 z) { assembly { z := 1 let y := x if iszero(lt(y, 0x100000000000000000000000000000000)) { } if iszero(lt(y, 0x10000000000000000)) { } if iszero(lt(y, 0x100000000)) { } if iszero(lt(y, 0x10000)) { } if iszero(lt(y, 0x100)) { } if iszero(lt(y, 0x10)) { } if iszero(lt(y, 0x8)) { z := shl(1, z) } z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) if lt(zRoundDown, z) { z := zRoundDown } } } function sqrt(uint256 x) internal pure returns (uint256 z) { assembly { z := 1 let y := x if iszero(lt(y, 0x100000000000000000000000000000000)) { } if iszero(lt(y, 0x10000000000000000)) { } if iszero(lt(y, 0x100000000)) { } if iszero(lt(y, 0x10000)) { } if iszero(lt(y, 0x100)) { } if iszero(lt(y, 0x10)) { } if iszero(lt(y, 0x8)) { z := shl(1, z) } z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) if lt(zRoundDown, z) { z := zRoundDown } } } z := shr(1, add(z, div(x, z))) let zRoundDown := div(x, z) function sqrt(uint256 x) internal pure returns (uint256 z) { assembly { z := 1 let y := x if iszero(lt(y, 0x100000000000000000000000000000000)) { } if iszero(lt(y, 0x10000000000000000)) { } if iszero(lt(y, 0x100000000)) { } if iszero(lt(y, 0x10000)) { } if iszero(lt(y, 0x100)) { } if iszero(lt(y, 0x10)) { } if iszero(lt(y, 0x8)) { z := shl(1, z) } z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) if lt(zRoundDown, z) { z := zRoundDown } } } }
4,322,160
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 20392, 27443, 5313, 598, 5295, 364, 5499, 17, 1153, 5600, 18, 632, 4161, 348, 355, 81, 340, 261, 4528, 2207, 6662, 18, 832, 19, 54, 12954, 17, 4664, 7053, 19, 18281, 81, 340, 19, 10721, 19, 5254, 19, 4816, 19, 5471, 19, 7505, 2148, 10477, 5664, 18, 18281, 13, 632, 4161, 657, 1752, 2921, 635, 587, 7303, 261, 4528, 2207, 6662, 18, 832, 19, 407, 16126, 379, 19, 3378, 49, 19, 10721, 19, 7525, 19, 16351, 87, 19, 59, 361, 10477, 18, 18281, 13, 2, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 12083, 15038, 2148, 10477, 5664, 288, 203, 10792, 12875, 2053, 1653, 2056, 26585, 13803, 3217, 17205, 15297, 203, 203, 203, 683, 9454, 18035, 560, 1545, 20, 18, 28, 18, 20, 31, 203, 565, 445, 14064, 59, 361, 4164, 12, 11890, 5034, 619, 16, 2254, 5034, 677, 13, 2713, 16618, 1135, 261, 11890, 5034, 13, 288, 203, 565, 289, 203, 203, 565, 445, 14064, 59, 361, 1211, 12, 11890, 5034, 619, 16, 2254, 5034, 677, 13, 2713, 16618, 1135, 261, 11890, 5034, 13, 288, 203, 565, 289, 203, 203, 565, 445, 3739, 59, 361, 4164, 12, 11890, 5034, 619, 16, 2254, 5034, 677, 13, 2713, 16618, 1135, 261, 11890, 5034, 13, 288, 203, 565, 289, 203, 203, 565, 445, 3739, 59, 361, 1211, 12, 11890, 5034, 619, 16, 2254, 5034, 677, 13, 2713, 16618, 1135, 261, 11890, 5034, 13, 288, 203, 565, 289, 203, 203, 10792, 1806, 59, 15080, 26585, 13803, 3217, 17205, 15297, 203, 203, 565, 445, 14064, 7244, 4164, 12, 203, 3639, 2254, 5034, 619, 16, 203, 3639, 2254, 5034, 677, 16, 203, 3639, 2254, 5034, 15030, 203, 565, 262, 2713, 16618, 1135, 261, 11890, 5034, 998, 13, 288, 203, 3639, 19931, 288, 203, 5411, 998, 519, 14064, 12, 92, 16, 677, 13, 203, 203, 5411, 309, 353, 7124, 12, 464, 12, 291, 7124, 12, 291, 7124, 12, 13002, 26721, 13, 3631, 578, 12, 291, 7124, 12, 92, 3631, 7555, 12, 2892, 12, 94, 16, 619, 3631, 677, 3719, 3719, 288, 203, 7734, 15226, 12, 20, 16, 374, 13, 203, 5411, 289, 203, 203, 3639, 289, 203, 565, 289, 203, 203, 565, 445, 14064, 7244, 4164, 12, 203, 3639, 2254, 5034, 619, 16, 203, 3639, 2254, 5034, 677, 16, 203, 3639, 2254, 5034, 15030, 203, 565, 262, 2713, 16618, 1135, 261, 11890, 5034, 998, 13, 288, 203, 3639, 19931, 288, 203, 5411, 998, 519, 14064, 12, 92, 16, 677, 13, 203, 203, 5411, 309, 353, 7124, 12, 464, 12, 291, 7124, 12, 291, 7124, 12, 13002, 26721, 13, 3631, 578, 12, 291, 7124, 12, 92, 3631, 7555, 12, 2892, 12, 94, 16, 619, 3631, 677, 3719, 3719, 288, 203, 7734, 15226, 12, 20, 16, 374, 13, 203, 5411, 289, 203, 203, 3639, 289, 203, 565, 289, 203, 203, 565, 445, 14064, 7244, 4164, 12, 203, 3639, 2254, 5034, 619, 16, 203, 3639, 2254, 5034, 677, 16, 203, 3639, 2254, 5034, 15030, 203, 565, 262, 2713, 16618, 1135, 261, 11890, 5034, 998, 13, 288, 203, 3639, 19931, 288, 203, 5411, 998, 519, 14064, 12, 92, 16, 677, 13, 203, 203, 5411, 309, 353, 7124, 12, 464, 12, 291, 7124, 12, 291, 7124, 12, 13002, 26721, 13, 3631, 578, 12, 291, 7124, 12, 92, 3631, 7555, 12, 2892, 12, 94, 16, 619, 3631, 677, 3719, 3719, 288, 203, 7734, 15226, 12, 20, 16, 374, 13, 203, 5411, 289, 203, 203, 3639, 289, 203, 565, 289, 203, 203, 5411, 998, 519, 3739, 12, 94, 16, 15030, 13, 203, 565, 445, 14064, 7244, 1211, 12, 203, 3639, 2254, 5034, 619, 16, 203, 3639, 2254, 5034, 677, 16, 203, 3639, 2254, 5034, 15030, 203, 565, 262, 2713, 16618, 1135, 261, 11890, 5034, 998, 13, 288, 203, 3639, 19931, 288, 203, 5411, 998, 519, 14064, 12, 92, 16, 677, 13, 203, 203, 5411, 309, 353, 7124, 12, 464, 12, 291, 7124, 12, 291, 7124, 12, 13002, 26721, 13, 3631, 578, 12, 291, 7124, 12, 92, 3631, 7555, 12, 2892, 12, 94, 16, 619, 3631, 677, 3719, 3719, 288, 203, 7734, 15226, 12, 20, 16, 374, 13, 203, 5411, 289, 203, 203, 3639, 289, 203, 565, 289, 203, 203, 565, 445, 14064, 7244, 1211, 12, 203, 3639, 2254, 5034, 619, 16, 203, 3639, 2254, 5034, 677, 16, 203, 3639, 2254, 5034, 15030, 203, 565, 262, 2713, 16618, 1135, 261, 11890, 5034, 998, 13, 288, 203, 3639, 19931, 288, 203, 5411, 998, 519, 14064, 12, 92, 16, 677, 13, 203, 203, 5411, 309, 353, 7124, 12, 464, 12, 291, 7124, 12, 291, 7124, 12, 13002, 26721, 13, 3631, 578, 12, 291, 7124, 12, 92, 3631, 7555, 12, 2892, 12, 94, 16, 619, 3631, 677, 3719, 3719, 288, 203, 7734, 15226, 12, 20, 16, 374, 13, 203, 5411, 289, 203, 203, 3639, 289, 203, 565, 289, 203, 203, 565, 445, 14064, 7244, 1211, 12, 203, 3639, 2254, 5034, 619, 16, 203, 3639, 2254, 5034, 677, 16, 203, 3639, 2254, 5034, 15030, 203, 565, 262, 2713, 16618, 1135, 261, 11890, 5034, 998, 13, 288, 203, 3639, 19931, 288, 203, 5411, 998, 519, 14064, 12, 92, 16, 677, 13, 203, 203, 5411, 309, 353, 7124, 12, 464, 12, 291, 7124, 12, 291, 7124, 12, 13002, 26721, 13, 3631, 578, 12, 291, 7124, 12, 92, 3631, 7555, 12, 2892, 12, 94, 16, 619, 3631, 677, 3719, 3719, 288, 203, 7734, 15226, 12, 20, 16, 374, 13, 203, 5411, 289, 203, 203, 3639, 289, 203, 565, 289, 203, 203, 5411, 998, 519, 14064, 12, 291, 7124, 12, 291, 7124, 12, 94, 13, 3631, 527, 12, 2892, 12, 1717, 12, 94, 16, 404, 3631, 15030, 3631, 404, 3719, 203, 565, 445, 8715, 543, 12, 203, 3639, 2254, 5034, 619, 16, 203, 3639, 2254, 5034, 290, 16, 203, 3639, 2254, 5034, 4981, 203, 565, 262, 2713, 16618, 1135, 261, 11890, 5034, 998, 13, 288, 203, 3639, 19931, 288, 203, 5411, 1620, 619, 203, 5411, 648, 374, 288, 203, 7734, 1620, 290, 203, 7734, 648, 374, 288, 203, 10792, 998, 519, 4981, 203, 7734, 289, 203, 7734, 805, 288, 203, 10792, 998, 519, 374, 203, 7734, 289, 203, 5411, 289, 203, 5411, 805, 288, 203, 7734, 1620, 681, 12, 82, 16, 576, 13, 203, 7734, 648, 374, 288, 203, 10792, 998, 519, 4981, 203, 7734, 289, 203, 7734, 805, 288, 203, 10792, 998, 519, 619, 203, 7734, 289, 203, 203, 203, 7734, 364, 288, 203, 10792, 290, 519, 699, 86, 12, 21, 16, 290, 13, 203, 10792, 290, 519, 699, 86, 12, 21, 16, 290, 13, 203, 10792, 309, 699, 86, 12, 10392, 16, 619, 13, 288, 203, 13491, 15226, 12, 20, 16, 374, 13, 203, 10792, 289, 203, 203, 203, 203, 10792, 309, 13489, 12, 5279, 11066, 16, 12223, 13, 288, 203, 13491, 15226, 12, 20, 2 ]
./partial_match/1/0x2b99bEdE91684F28D9e9D04EF7558643e4EdD4D0/sources/@gearbox-protocol/core-v2/contracts/core/ContractsRegister.sol
@return Returns the number of registered credit managers
function getCreditManagersCount() external view override returns (uint256) { }
15,998,300
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 2463, 2860, 326, 1300, 434, 4104, 12896, 21103, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 1927, 10430, 17570, 1380, 1435, 3903, 1476, 3849, 1135, 261, 11890, 5034, 13, 288, 203, 565, 289, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./partial_match/1/0xBb56454D6f7297FCA13A3Ba090ce3D6Bc0D6d7E1/sources/GoldChainCoin.sol
* @title Pausable token @dev ERC20 modified with pausable transfers./
contract GoldTokenPausable is ERC20, Pausable, BlacklistedRole { function transfer(address to, uint256 value) public whenNotPaused onlyNotBlacklisted returns (bool) { return super.transfer(to, value); } function transferFrom(address from, address to, uint256 value) public whenNotPaused onlyNotBlacklisted returns (bool) { return super.transferFrom(from, to, value); } function approve(address spender, uint256 value) public whenNotPaused onlyNotBlacklisted returns (bool) { return super.approve(spender, value); } function increaseAllowance(address spender, uint addedValue) public whenNotPaused onlyNotBlacklisted returns (bool success) { return super.increaseAllowance(spender, addedValue); } function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused onlyNotBlacklisted returns (bool success) { return super.decreaseAllowance(spender, subtractedValue); } }
4,075,618
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 2649, 21800, 16665, 1147, 632, 5206, 4232, 39, 3462, 4358, 598, 6790, 16665, 29375, 18, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 16351, 611, 1673, 1345, 16507, 16665, 353, 4232, 39, 3462, 16, 21800, 16665, 16, 22467, 18647, 2996, 288, 203, 203, 565, 445, 7412, 12, 2867, 358, 16, 2254, 5034, 460, 13, 1071, 1347, 1248, 28590, 1338, 1248, 13155, 18647, 1135, 261, 6430, 13, 288, 203, 3639, 327, 2240, 18, 13866, 12, 869, 16, 460, 1769, 203, 565, 289, 203, 203, 565, 445, 7412, 1265, 12, 2867, 628, 16, 1758, 358, 16, 2254, 5034, 460, 13, 1071, 1347, 1248, 28590, 1338, 1248, 13155, 18647, 1135, 261, 6430, 13, 288, 203, 3639, 327, 2240, 18, 13866, 1265, 12, 2080, 16, 358, 16, 460, 1769, 203, 565, 289, 203, 203, 565, 445, 6617, 537, 12, 2867, 17571, 264, 16, 2254, 5034, 460, 13, 1071, 1347, 1248, 28590, 1338, 1248, 13155, 18647, 1135, 261, 6430, 13, 288, 203, 3639, 327, 2240, 18, 12908, 537, 12, 87, 1302, 264, 16, 460, 1769, 203, 565, 289, 203, 203, 565, 445, 10929, 7009, 1359, 12, 2867, 17571, 264, 16, 2254, 3096, 620, 13, 1071, 1347, 1248, 28590, 1338, 1248, 13155, 18647, 1135, 261, 6430, 2216, 13, 288, 203, 3639, 327, 2240, 18, 267, 11908, 7009, 1359, 12, 87, 1302, 264, 16, 3096, 620, 1769, 203, 565, 289, 203, 203, 565, 445, 20467, 7009, 1359, 12, 2867, 17571, 264, 16, 2254, 10418, 329, 620, 13, 1071, 1347, 1248, 28590, 1338, 1248, 13155, 18647, 1135, 261, 6430, 2216, 13, 288, 203, 3639, 327, 2240, 18, 323, 11908, 7009, 1359, 12, 87, 1302, 264, 16, 10418, 329, 620, 1769, 203, 565, 289, 203, 97, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// SPDX-License-Identifier: MIT /* MIT License Copyright (c) 2020 DITTO Money Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ pragma solidity 0.6.12; /** * @title SafeMath * @dev Math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two numbers, reverts on 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-solidity/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b); return c; } /** * @dev Integer division of two numbers truncating the quotient, reverts on division by zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0); // Solidity only automatically asserts when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; } /** * @dev Adds two numbers, reverts on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a); return c; } /** * @dev Divides two numbers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0); return a % b; } } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom(address from, address to, uint256 value) external returns (bool); function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address private _owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { _owner = msg.sender; } /** * @return the address of the owner. */ function owner() public view returns(address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner()); _; } /** * @return true if `msg.sender` is the owner of the contract. */ function isOwner() public view returns(bool) { return msg.sender == _owner; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(_owner); _owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } /** * @title Ditto Swap Contract */ contract DittoTokenSwap is Ownable { using SafeMath for uint256; uint256 constant DITTO_DECIMALS = 9; uint256 public dittoUSDRate = 1000; // DITTO price in USD (4 decimals, e.g. 981 = $0.981) struct InputToken { string ticker; uint256 decimals; uint256 usdRate; // Token price in USD (4 decimals, e.g. 981 = $0.981) } mapping(address => InputToken) public inputs; address[] public inputAddresses; struct Swap { uint256 userCap; uint256 totalCap; uint256 bonusMultiplier; uint256 totalClaimed; } mapping(uint256 => Swap) swaps; // Mapping for recording claims for each swap mapping(uint256 => mapping (address => uint256)) public claims; uint256 private activeSwapIndex = 0; event SwapDeposit(address depositor, address input, uint256 inputAmount, uint256 outputAmount); function activeSwapInfo() internal view returns (uint256, uint256, uint256, uint256) { return swapInfo(activeSwapIndex); } function isSwapActive() public view returns (bool) { Swap storage activeSwap = swaps[activeSwapIndex]; return activeSwap.totalCap > 0 ? true : false; } modifier hasActiveSwap { require(isSwapActive(), "Currently no ongoing swap."); _; } function remainingTokensInActiveSwap() external view hasActiveSwap returns (uint256) { Swap storage activeSwap = swaps[activeSwapIndex]; return activeSwap.totalCap.sub(activeSwap.totalClaimed); } function remainingTokensForUser(address _addr) external view hasActiveSwap returns (uint256) { Swap storage activeSwap = swaps[activeSwapIndex]; return activeSwap.userCap.sub(claims[activeSwapIndex][msg.sender]); } /** * @dev Return information about the swap at swapIndex. * @param swapIndex Index of swap to be retrieve info for. * @return Total swap cap. * @return Per-user cap. * @return Bonus multiplier. * @return Number of tokens alreaduy claimed. */ function swapInfo(uint256 swapIndex) internal view returns (uint256, uint256, uint256, uint256) { Swap storage activeSwap = swaps[swapIndex]; require(activeSwap.totalCap > 0, "No swap exists at this index."); return( activeSwap.totalCap, activeSwap.userCap, activeSwap.bonusMultiplier, activeSwap.totalClaimed ); } /** * @dev Calculate the amount of DITTO to return for *amount* input tokens * @param amount Input amount. * @param inputAddress Address of the input token. * @return DITTO output amount. */ function getDittoOutputAmount(uint256 amount, address inputAddress) public view hasActiveSwap returns (uint256) { uint256 usdRate = inputs[inputAddress].usdRate; uint256 decimals = inputs[inputAddress].decimals; uint256 multiplier = swaps[activeSwapIndex].bonusMultiplier; require(usdRate != 0, "Input token not supported or rate not set"); uint256 outputAmount = amount.mul(usdRate).mul(10 ** DITTO_DECIMALS).div(dittoUSDRate).div(10 ** decimals); return outputAmount.mul(multiplier).div(100); } /** * @dev Allows the user to deposit some amount of input tokens. Records user/swap data and emits a SwapDeposit event. * @param inputTokenAddress Address of the token to be swapped. * @param amount Amount of input tokens to be swapped. */ function swap(address inputTokenAddress, uint256 amount) external hasActiveSwap { require(amount > 0, "Input amount must be positive."); Swap storage activeSwap = swaps[activeSwapIndex]; uint256 outputAmount = getDittoOutputAmount(amount, inputTokenAddress); require(outputAmount > 0, "Amount too small."); activeSwap.totalClaimed = activeSwap.totalClaimed.add(outputAmount); require(activeSwap.totalClaimed <= activeSwap.totalCap, "Swap too large: Total cap exceeded."); require(IERC20(inputTokenAddress).transferFrom(msg.sender, address(this), amount), "Transferring input tokens from user failed"); claims[activeSwapIndex][msg.sender] = claims[activeSwapIndex][msg.sender].add(outputAmount); require(claims[activeSwapIndex][msg.sender] <= activeSwap.userCap, "Per-address cap exceeded for sender."); emit SwapDeposit(msg.sender, inputTokenAddress, amount, outputAmount); } /** * @dev Starts a new token swap. * @param _userCap Maximum amount of claimable tokens per address. * @param _totalCap Total amount of tokens available for the swap. * @param _bonusMultiplier Multiplier percentage, e.g. 110 = 110% = 10% bonus. Set to 100 for no multiplier. */ function startSwap(uint256 _userCap, uint256 _totalCap, uint256 _bonusMultiplier) external onlyOwner { require(!isSwapActive(), "Swap is already active."); require(_userCap > 0, "User cap can't be zero."); require(_totalCap > 0, "Swap max cap can't be zero."); require(_bonusMultiplier >= 100, "Bonus multiplier must be set to >= 100%."); swaps[activeSwapIndex] = Swap( { userCap: _userCap, totalCap: _totalCap, bonusMultiplier: _bonusMultiplier, totalClaimed: 0 } ); } /** * @dev Ends the active swap. */ function endSwap() external onlyOwner { activeSwapIndex++; } /** * @dev Add a new input token. * @param _addr Address of the token to be added. * @param _rate USD price of the token (4 decimals - e.g. $1 = 1000, $0.95 = 950) */ function addInputToken(address _addr, uint256 _rate) external onlyOwner { require(inputs[_addr].usdRate == 0, "Input token already set."); require(_addr != address(0), "Cannot add input token with zero address."); require(_rate > 0, "Cannot add input token with zero rate."); IERC20 token = IERC20(_addr); uint8 decimals = token.decimals(); string memory symbol = token.symbol(); inputs[_addr] = InputToken( { ticker: symbol, decimals: decimals, usdRate: _rate } ); inputAddresses.push(_addr); } /** * @dev Lets the owner set the DITTO price in USD. * @param _rate Price of 1 DITTO in USD (4 decimals) */ function updateDittoRate(uint256 _rate) external onlyOwner { require(_rate > 0, "Can't set zero rate"); dittoUSDRate = _rate; } /** * @dev Lets the owner update the USD price of an input token. * @param _addr Address of the input token to be updated. * @param _rate Token price in USD (4 decimals) */ function updateRateForInputToken(address _addr, uint256 _rate) external onlyOwner { require(inputs[_addr].usdRate > 0, "No input configured at address."); inputs[_addr].usdRate = _rate; } function numberOfInputs() external view returns (uint256) { return inputAddresses.length; } function removeAddressFromInputsList(address _addr) internal { // Each address can exist in the list exactly once. uint i = 0; while(inputAddresses[i] != _addr) { i++; } while(i < inputAddresses.length - 1) { inputAddresses[i] = inputAddresses[i+1]; i++; } inputAddresses.pop(); } /* * @dev Lets the owner remove an input token. * @param _addr Address of the token to be removed. */ function removeInputToken(address _addr) external onlyOwner { require(inputs[_addr].usdRate > 0, "No input configured at address."); delete inputs[_addr]; removeAddressFromInputsList(_addr); } /** * @dev Lets the owner withdraw tokens deposited to the contract account. * @param token Address of the token to be withdrawn. * @param to Address to which the tokens are to be sent. * @param amount Amount of tokens to be withdrawn. */ function withdrawTokens(address token, address to, uint256 amount) external onlyOwner { IERC20(token).transfer(to, amount); } }
Each address can exist in the list exactly once.
function removeAddressFromInputsList(address _addr) internal { uint i = 0; while(inputAddresses[i] != _addr) { i++; } while(i < inputAddresses.length - 1) { inputAddresses[i] = inputAddresses[i+1]; i++; } inputAddresses.pop(); }
6,138,920
[ 1, 4625, 348, 7953, 560, 30, 225, 8315, 1758, 848, 1005, 316, 326, 666, 8950, 3647, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 1206, 1887, 1265, 10059, 682, 12, 2867, 389, 4793, 13, 2713, 288, 203, 540, 203, 3639, 2254, 277, 273, 374, 31, 203, 540, 203, 3639, 1323, 12, 2630, 7148, 63, 77, 65, 480, 389, 4793, 13, 288, 203, 5411, 277, 9904, 31, 203, 3639, 289, 203, 540, 203, 3639, 1323, 12, 77, 411, 810, 7148, 18, 2469, 300, 404, 13, 288, 203, 5411, 810, 7148, 63, 77, 65, 273, 810, 7148, 63, 77, 15, 21, 15533, 203, 5411, 277, 9904, 31, 203, 3639, 289, 203, 540, 203, 3639, 810, 7148, 18, 5120, 5621, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/100/0x9Ddb87A317CD8e02307b78fAfc3CC7f9b27e9d4d/sources/project_/contracts/InternalBondingCurveController.sol
* @notice Runs a check and transfers reserve tokens as needed @dev To avoid too many fees, this should be run at wide intervals such as daily @param _poolAddress - Address of pool being worked on./ vault.getPoolTokens(curveInfo.poolId);
function runCheck(address _poolAddress) public restricted nonReentrant { CurveValues memory curveInfo; curveInfo.managedPool = IManagedPool(_poolAddress); curveInfo.poolId = curveInfo.managedPool.getPoolId(); vault.getPool(curveInfo.poolId); }
14,279,767
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 20392, 1939, 87, 279, 866, 471, 29375, 20501, 2430, 487, 3577, 632, 5206, 2974, 4543, 4885, 4906, 1656, 281, 16, 333, 1410, 506, 1086, 622, 14812, 10389, 4123, 487, 18872, 632, 891, 389, 6011, 1887, 300, 5267, 434, 2845, 3832, 28613, 603, 18, 19, 225, 9229, 18, 588, 2864, 5157, 12, 16683, 966, 18, 6011, 548, 1769, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 1086, 1564, 12, 2867, 389, 6011, 1887, 13, 1071, 15693, 1661, 426, 8230, 970, 203, 565, 288, 203, 3639, 22901, 1972, 3778, 8882, 966, 31, 203, 3639, 8882, 966, 18, 19360, 2864, 273, 6246, 4184, 2864, 24899, 6011, 1887, 1769, 203, 3639, 8882, 966, 18, 6011, 548, 273, 8882, 966, 18, 19360, 2864, 18, 588, 25136, 5621, 203, 3639, 9229, 18, 588, 2864, 12, 16683, 966, 18, 6011, 548, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/3/0x569D6B551F5A1b635BFea1dC1EA2E7C6117490C9/sources/browser/Gonzo/001-RealMarines.sol
Remember to zero the pending refund before sending to prevent re-entrancy attacks
function refundFees() public onlyOwner returns (bool) { uint256 amount = fees; fees = 0; if (msg.sender.send(amount)) { return true; fees = amount; return false; } }
14,261,299
[ 1, 4625, 348, 7953, 560, 30, 225, 23133, 358, 3634, 326, 4634, 16255, 1865, 5431, 358, 5309, 283, 17, 8230, 12514, 28444, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 16255, 2954, 281, 1435, 1071, 1338, 5541, 1135, 261, 6430, 13, 288, 203, 540, 2254, 5034, 3844, 273, 1656, 281, 31, 203, 540, 203, 3639, 1656, 281, 273, 374, 31, 203, 203, 3639, 309, 261, 3576, 18, 15330, 18, 4661, 12, 8949, 3719, 288, 203, 5411, 327, 638, 31, 203, 5411, 1656, 281, 273, 3844, 31, 203, 5411, 327, 629, 31, 203, 3639, 289, 203, 565, 289, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/43114/0x333BE852042F435431967664e09315CC63593333/sources/contracts/MultichainProxy.sol
Check that router exists is performed inside the library
availableAnyRouters.add(_router);
4,643,938
[ 1, 4625, 348, 7953, 560, 30, 225, 2073, 716, 4633, 1704, 353, 9591, 4832, 326, 5313, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 5411, 2319, 2961, 4583, 414, 18, 1289, 24899, 10717, 1769, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
//SPDX-License-Identifier: UNLICENSED pragma solidity >=0.4.24; import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol"; contract FlightSuretyData { using SafeMath for uint256; /********************************************************************************************/ /* DATA VARIABLES */ /********************************************************************************************/ address private contractOwner; // Account used to deploy contract bool private operational = true; // Blocks all state changes throughout the contract if false uint8 constant M = 3; uint256 airlineCounter = 0; uint256 airlineHalfConsensus = airlineCounter.div(2); address[] airlineCalls = new address[](0); address[] multiCalls = new address[](0); uint256 adminCharge = 10 ether; uint256 insurancePrice = 1 ether; uint256 private counter = 1; uint256 private enabled = block.timestamp; struct AirlineProfile{ bool isRegistered; bool isAdmin; } mapping(address => AirlineProfile) airlines; struct PassengerInsuranceData { bytes32 insuredFlight; bool isActive; } mapping(address => PassengerInsuranceData) passengers; mapping(address => uint256) passengerInsuranceBalance; /********************************************************************************************/ /* EVENT DEFINITIONS */ /********************************************************************************************/ /** * @dev Constructor * The deploying account becomes contractOwner */ constructor ( ) public { contractOwner = msg.sender; } /********************************************************************************************/ /* FUNCTION MODIFIERS */ /********************************************************************************************/ // Modifiers help avoid duplication of code. They are typically used to validate something // before a function is allowed to be executed. /** * @dev Modifier that requires the "operational" boolean variable to be "true" * This is used on all state changing functions to pause the contract in * the event there is an issue that needs to be fixed */ modifier requireIsOperational() { require(operational, "Contract is currently not operational"); _; // All modifiers require an "_" which indicates where the function body will be added } /** * @dev Modifier that requires the "ContractOwner" account to be the function caller */ modifier requireContractOwner() { require(msg.sender == contractOwner, "Caller is not contract owner"); _; } modifier requireRateLimit(uint time){ require(block.timestamp >= enabled ,"Rate limiting in effects"); _; enabled = enabled.add(time); } modifier requireGuard(){ counter = counter.add(1); uint256 guard = counter; _; require(guard == counter, "This withdraw is not possible"); } /********************************************************************************************/ /* UTILITY FUNCTIONS */ /********************************************************************************************/ /** * @dev Get operating status of contract * * @return A bool that is the current operating status */ function isOperational() public view returns(bool) { return operational; } /** * @dev Sets contract operations on/off * * When operational mode is disabled, all write transactions except for this one will fail */ function setOperatingStatus(bool mode) external { if(msg.sender == contractOwner){ operational = mode; } else { require(airlines[msg.sender].isAdmin, "Caller is not an admin"); bool isDuplicate = false; for(uint i = 0; i<multiCalls.length; i++) { if (multiCalls[i] == msg.sender) { isDuplicate = true; break; } } require(!isDuplicate, "Caller has already called this function."); multiCalls.push(msg.sender); if (multiCalls.length >= M) { operational = mode; multiCalls = new address[](0); } } } /********************************************************************************************/ /* SMART CONTRACT FUNCTIONS */ /********************************************************************************************/ /** * @dev Add an airline to the registration queue * Can only be called from FlightSuretyApp contract * */ function isAirlineAdmin(address account) external view returns(bool){ return airlines[account].isAdmin; } function registerAirline ( address account ) external requireIsOperational { if( airlineCounter == 0 && msg.sender == contractOwner ){ airlines[account] = AirlineProfile({ isRegistered:true, isAdmin:false }); airlineCounter++; } require(airlines[msg.sender].isAdmin, "Airline is not an admin to register new airline."); if( airlineCounter <= 4 ){ airlines[account] = AirlineProfile({ isRegistered:true, isAdmin:false }); airlineCounter++; } else { bool isDuplicate = false; for(uint i = 0; i<airlineCalls.length; i++) { if (airlineCalls[i] == msg.sender) { isDuplicate = true; break; } } require(!isDuplicate, "Caller has already called this function."); airlineCalls.push(msg.sender); if (airlineCalls.length >= airlineHalfConsensus) { airlines[account] = AirlineProfile({ isRegistered: true, isAdmin: false }); airlineCounter++; airlineCalls = new address[](0); } } } function becomeAdmin(uint256 amount) external payable requireIsOperational { // require(airlines[msg.sender].isRegistered == true, "Airline must register first to become admin"); require(msg.value >= amount, "Insufficient balance , please deposit"); require(amount >= adminCharge, "Please deposit minimum 10 ether to become an admin"); uint256 airlineWalletBalane = msg.value; uint256 fundAmount = msg.value.sub(amount); airlineWalletBalane = airlineWalletBalane.sub(fundAmount); address(this).transfer(fundAmount); airlines[msg.sender].isAdmin = true; airlines[msg.sender].isRegistered = true; } /** * @dev Buy insurance for a flight * */ function buy ( uint256 amount, bytes32 flight ) public payable requireIsOperational { require(amount >= insurancePrice, 'Insufficient fund to buy insurance'); require(!passengers[msg.sender].isActive, "Passenger already bought an insurance"); require(msg.value >= amount, 'Insufficient fund to buy insurance'); uint256 passengerWalletBalance = msg.value; uint256 deductionAmount = passengerWalletBalance.sub(amount); passengerWalletBalance = passengerWalletBalance.sub(deductionAmount); address(this).transfer(deductionAmount); passengers[msg.sender] = PassengerInsuranceData({ insuredFlight: flight, isActive: true }); } /** * @dev Credits payouts to insurees */ function creditInsurees ( bytes32 cancelledFlight, address passenger ) external payable requireIsOperational { require(passengers[passenger].insuredFlight == cancelledFlight, "Flight status in not eligible for insurance payout"); require(passengers[passenger].insuredFlight == cancelledFlight, "Flight status in not eligible for insurance payout"); require(!passengers[passenger].isActive, "insurance already payout"); uint256 insuredPayout = insurancePrice.add(insurancePrice.div(2)); uint256 contractBalance = address(this).balance; contractBalance = contractBalance.sub(insuredPayout); passengerInsuranceBalance[passenger].add(insuredPayout); passengers[passenger].isActive = false; } /** * @dev Transfers eligible payout funds to insuree * */ function pay ( uint256 amount ) external requireRateLimit(60 minutes) requireGuard requireIsOperational { require(passengerInsuranceBalance[msg.sender] >= amount, 'Amount must be less than available balance'); require(address(this).balance >= amount, "The contract doesn't have enough balance right now, please contract support team"); uint256 withdrwableBalance = passengerInsuranceBalance[msg.sender]; passengerInsuranceBalance[msg.sender] = passengerInsuranceBalance[msg.sender].sub(withdrwableBalance); msg.sender.transfer(withdrwableBalance); } /** * @dev Initial funding for the insurance. Unless there are too many delayed flights * resulting in insurance payouts, the contract should be self-sustaining * */ function fund ( ) public payable { } function getFlightKey ( address airline, string memory flight, uint256 timestamp ) internal pure returns(bytes32) { return keccak256(abi.encodePacked(airline, flight, timestamp)); } /** * @dev Fallback function for funding smart contract. * */ function() external payable { fund(); } }
* @dev Initial funding for the insurance. Unless there are too many delayed flights resulting in insurance payouts, the contract should be self-sustaining/
function fund ( ) public payable { }
12,591,773
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 10188, 22058, 364, 326, 2763, 295, 1359, 18, 1351, 2656, 1915, 854, 4885, 4906, 15278, 1183, 10730, 1377, 8156, 316, 2763, 295, 1359, 293, 2012, 87, 16, 326, 6835, 1410, 506, 365, 17, 87, 641, 3280, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 284, 1074, 203, 18701, 261, 203, 4766, 203, 18701, 262, 203, 18701, 1071, 203, 18701, 8843, 429, 203, 565, 288, 203, 540, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.4.18; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * @title Destructible * @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner. */ contract Destructible is Ownable { function Destructible() public payable { } /** * @dev Transfers the current balance to the owner and terminates the contract. */ function destroy() onlyOwner public { selfdestruct(owner); } function destroyAndSend(address _recipient) onlyOwner public { selfdestruct(_recipient); } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { uint256 public totalSupply; function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) public balances; /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); // SafeMath.sub will throw if there is not enough balance. balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * 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 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } /** * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue); Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation */ contract MintableToken is StandardToken, Ownable { uint256 public hardCap; event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; MintFinished(); return true; } } /** * @title CABoxToken * @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator. * Note they can later distribute these tokens as they wish using `transfer` and other * `StandardToken` functions. */ contract CABoxToken is MintableToken, Destructible { string public constant name = "CABox"; string public constant symbol = "CAB"; uint8 public constant decimals = 18; /** * @dev Constructor that gives msg.sender all of existing tokens. */ function CABoxToken() public { hardCap = 500 * 1000000 * (10 ** uint256(decimals)); } /** * @dev Function to mint tokens * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { require(totalSupply.add(_amount) <= hardCap); return super.mint(_to, _amount); } } /** * @title CABoxCrowdsale * @dev CABoxCrowdsale is a completed contract for managing a token crowdsale. * CABoxCrowdsale have a start and end timestamps, where investors can make * token purchases and the CABoxCrowdsale will assign them tokens based * on a token per ETH rate. Funds collected are forwarded to a wallet * as they arrive. */ contract CABoxCrowdsale is Ownable{ using SafeMath for uint256; // The token being sold CABoxToken public token; // start and end timestamps where investments are allowed (both inclusive) uint256 public startTime; uint256 public endTime; // address where funds are collected address public wallet; // address where development funds are collected address public devWallet; // amount of raised money in wei uint256 public weiRaised; /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); event TokenContractUpdated(bool state); event WalletAddressUpdated(bool state); function CABoxCrowdsale() public { token = createTokenContract(); startTime = 1535155200; endTime = 1540771200; wallet = 0x9BeAbD0aeB08d18612d41210aFEafD08fb84E9E8; devWallet = 0x13dF1d8F51324a237552E87cebC3f501baE2e972; } // creates the token to be sold. // override this method to have crowdsale of a specific mintable token. function createTokenContract() internal returns (CABoxToken) { return new CABoxToken(); } // fallback function can be used to buy tokens function () external payable { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) public payable { require(beneficiary != address(0)); require(validPurchase()); uint256 weiAmount = msg.value; // calculate token amount to be created uint256 bonusRate = getBonusRate(); uint256 tokens = weiAmount.mul(bonusRate); // update state weiRaised = weiRaised.add(weiAmount); token.mint(beneficiary, tokens); TokenPurchase(msg.sender, beneficiary, weiAmount, tokens); forwardFunds(); } function getBonusRate() internal view returns (uint256) { uint64[5] memory tokenRates = [uint64(24000),uint64(20000),uint64(16000),uint64(12000),uint64(8000)]; // apply bonus for time uint64[5] memory timeStartsBoundaries = [uint64(1535155200),uint64(1538352000),uint64(1538956800),uint64(1539561600),uint64(1540166400)]; uint64[5] memory timeEndsBoundaries = [uint64(1538352000),uint64(1538956800),uint64(1539561600),uint64(1540166400),uint64(1540771200)]; uint[5] memory timeRates = [uint(500),uint(250),uint(200),uint(150),uint(100)]; uint256 bonusRate = tokenRates[0]; for (uint i = 0; i < 5; i++) { bool timeInBound = (timeStartsBoundaries[i] <= now) && (now < timeEndsBoundaries[i]); if (timeInBound) { bonusRate = tokenRates[i] + tokenRates[i] * timeRates[i] / 1000; } } return bonusRate; } // send ether to the fund collection wallet // override to create custom fund forwarding mechanisms function forwardFunds() internal { wallet.transfer(msg.value * 750 / 1000); devWallet.transfer(msg.value * 250 / 1000); } // @return true if the transaction can buy tokens function validPurchase() internal view returns (bool) { bool nonZeroPurchase = msg.value != 0; bool withinPeriod = now >= startTime && now <= endTime; return nonZeroPurchase && withinPeriod; } // @return true if crowdsale event has ended function hasEnded() public view returns (bool) { bool timeEnded = now > endTime; return timeEnded; } // update token contract function updateCABoxToken(address _tokenAddress) onlyOwner{ require(_tokenAddress != address(0)); token.transferOwnership(_tokenAddress); TokenContractUpdated(true); } }
* @title Basic token @dev Basic version of StandardToken, with no allowances./
contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) public balances; function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); return true; } function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } }
47,315
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 2649, 7651, 1147, 632, 5206, 7651, 1177, 434, 8263, 1345, 16, 598, 1158, 1699, 6872, 18, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 16351, 7651, 1345, 353, 4232, 39, 3462, 8252, 288, 203, 565, 1450, 14060, 10477, 364, 2254, 5034, 31, 203, 203, 565, 2874, 12, 2867, 516, 2254, 5034, 13, 1071, 324, 26488, 31, 203, 203, 565, 445, 7412, 12, 2867, 389, 869, 16, 2254, 5034, 389, 1132, 13, 1071, 1135, 261, 6430, 13, 288, 203, 3639, 2583, 24899, 869, 480, 1758, 12, 20, 10019, 203, 3639, 2583, 24899, 1132, 1648, 324, 26488, 63, 3576, 18, 15330, 19226, 203, 203, 3639, 324, 26488, 63, 3576, 18, 15330, 65, 273, 324, 26488, 63, 3576, 18, 15330, 8009, 1717, 24899, 1132, 1769, 203, 3639, 324, 26488, 63, 67, 869, 65, 273, 324, 26488, 63, 67, 869, 8009, 1289, 24899, 1132, 1769, 203, 3639, 12279, 12, 3576, 18, 15330, 16, 389, 869, 16, 389, 1132, 1769, 203, 3639, 327, 638, 31, 203, 565, 289, 203, 203, 565, 445, 11013, 951, 12, 2867, 389, 8443, 13, 1071, 1476, 1135, 261, 11890, 5034, 11013, 13, 288, 203, 3639, 327, 324, 26488, 63, 67, 8443, 15533, 203, 565, 289, 203, 203, 97, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./partial_match/1/0x8b2deCaeA7ee7Ca5864486e7DD96636D119F3795/sources/contracts/CoinbooksFixedRecurring.sol
@custom:security-contact jacob@coinbooks.xyz wallets that can initiate automatic payments wallets that can receive payment fee deposits
contract CoinbooksFixedRecurring is AccessControl { using SafeMath for uint256; event paymentFulfilled(string _refId); event addedTokenSupport(string _tokenId); address public owner; bytes32 public constant PAYMENT_INIT_ROLE = keccak256("PAYMENT_INIT_ROLE"); bytes32 public constant FEE_RECEIVER_ROLE = keccak256("FEE_RECEIVER_ROLE"); pragma solidity ^0.8.4; struct SupportedToken { string currencyCode; address tokenAddress; } mapping(string => bool) public supportedTokensByCode; mapping(string => SupportedToken) public supportedTokens; constructor() { owner = msg.sender; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); } function fulfillPayment( address _buyer, address _seller, address _feeReceiver, string memory _tokenCode, uint256 _paymentAmount, uint256 _feePercentage, ) external onlyRole(PAYMENT_INIT_ROLE) { require( hasRole(FEE_RECEIVER_ROLE, _feeReceiver), "_feeReceiver is unauthorized wallet" ); require(supportedTokensByCode[_tokenCode], "token is not supported"); IERC20 tokenContract = IERC20(supportedTokens[_tokenCode].tokenAddress); require( tokenContract.balanceOf(_buyer) >= _paymentAmount, "buyer has insufficient balance" ); uint256 feeAmount = SafeMath.div( SafeMath.mul(_feePercentage, _paymentAmount), 10000 ); uint256 sellerAmount = SafeMath.sub(_paymentAmount, feeAmount); tokenContract.transferFrom(_buyer, address(this), _paymentAmount); tokenContract.transfer(_feeReceiver, feeAmount); tokenContract.transfer(_seller, sellerAmount); emit paymentFulfilled(_refId); } function checkAdminRoleStatus(address _walletToCheck) public view returns (bool) { return hasRole(DEFAULT_ADMIN_ROLE, _walletToCheck); } function checkPaymentRoleStatus(address _walletToCheck) public view returns (bool) { return hasRole(PAYMENT_INIT_ROLE, _walletToCheck); } function checkFeeRoleStatus(address _walletToCheck) public view returns (bool) { return hasRole(FEE_RECEIVER_ROLE, _walletToCheck); } function grantAdminRole(address _walletToAdd) external onlyRole(DEFAULT_ADMIN_ROLE) { require( hasRole(PAYMENT_INIT_ROLE, _walletToAdd) == false, "wallet cannot have more than one role" ); require( hasRole(FEE_RECEIVER_ROLE, _walletToAdd) == false, "wallet cannot have more than one role" ); grantRole(DEFAULT_ADMIN_ROLE, _walletToAdd); } function revokeAdminRole(address _walletToRevoke) external onlyRole(DEFAULT_ADMIN_ROLE) { revokeRole(DEFAULT_ADMIN_ROLE, _walletToRevoke); } function grantPaymentRole(address _walletToAdd) external onlyRole(DEFAULT_ADMIN_ROLE) { require( hasRole(DEFAULT_ADMIN_ROLE, _walletToAdd) == false, "wallet cannot have more than one role" ); require( hasRole(FEE_RECEIVER_ROLE, _walletToAdd) == false, "wallet cannot have more than one role" ); grantRole(PAYMENT_INIT_ROLE, _walletToAdd); } function revokePaymentRole(address _walletToRevoke) external onlyRole(DEFAULT_ADMIN_ROLE) { revokeRole(PAYMENT_INIT_ROLE, _walletToRevoke); } function grantFeeRole(address _walletToAdd) external onlyRole(DEFAULT_ADMIN_ROLE) { require( hasRole(DEFAULT_ADMIN_ROLE, _walletToAdd) == false, "wallet cannot have more than one role" ); require( hasRole(PAYMENT_INIT_ROLE, _walletToAdd) == false, "wallet cannot have more than one role" ); grantRole(FEE_RECEIVER_ROLE, _walletToAdd); } function revokeFeeRole(address _walletToRevoke) external onlyRole(DEFAULT_ADMIN_ROLE) { revokeRole(FEE_RECEIVER_ROLE, _walletToRevoke); } function addSupportForToken(string memory _tokenCode, address _tokenAddress) external onlyRole(DEFAULT_ADMIN_ROLE) { require(_tokenAddress != address(0), "zero address not allowed"); supportedTokens[_tokenCode] = SupportedToken(_tokenCode, _tokenAddress); supportedTokensByCode[_tokenCode] = true; emit addedTokenSupport(_tokenCode); } function removeSupportForToken(string memory _tokenCode) external onlyRole(DEFAULT_ADMIN_ROLE) { supportedTokensByCode[_tokenCode] = false; } function withdrawNativeFunds() external onlyRole(DEFAULT_ADMIN_ROLE) { payable(msg.sender).transfer(address(this).balance); } function withdrawERC20Funds(address _tokenContract) external onlyRole(DEFAULT_ADMIN_ROLE) { IERC20 tokenContract = IERC20(_tokenContract); uint256 tokenBalance = tokenContract.balanceOf(address(this)); tokenContract.transfer(msg.sender, tokenBalance); } }
4,483,225
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 3662, 30, 7462, 17, 8994, 20138, 947, 36, 12645, 12567, 18, 17177, 17662, 2413, 716, 848, 18711, 5859, 25754, 17662, 2413, 716, 848, 6798, 5184, 14036, 443, 917, 1282, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 16351, 28932, 12567, 7505, 426, 21179, 353, 24349, 288, 203, 565, 1450, 14060, 10477, 364, 2254, 5034, 31, 203, 203, 565, 871, 5184, 23747, 13968, 12, 1080, 389, 1734, 548, 1769, 203, 565, 871, 3096, 1345, 6289, 12, 1080, 389, 2316, 548, 1769, 203, 203, 565, 1758, 1071, 3410, 31, 203, 203, 565, 1731, 1578, 1071, 5381, 25095, 3212, 67, 12919, 67, 16256, 273, 417, 24410, 581, 5034, 2932, 16436, 67, 12919, 67, 16256, 8863, 203, 203, 565, 1731, 1578, 1071, 5381, 478, 9383, 67, 27086, 45, 2204, 67, 16256, 273, 417, 24410, 581, 5034, 2932, 8090, 41, 67, 27086, 45, 2204, 67, 16256, 8863, 203, 203, 683, 9454, 18035, 560, 3602, 20, 18, 28, 18, 24, 31, 203, 565, 1958, 19503, 1345, 288, 203, 3639, 533, 26390, 31, 203, 3639, 1758, 1147, 1887, 31, 203, 565, 289, 203, 203, 565, 2874, 12, 1080, 516, 1426, 13, 1071, 3260, 5157, 858, 1085, 31, 203, 203, 565, 2874, 12, 1080, 516, 19503, 1345, 13, 1071, 3260, 5157, 31, 203, 565, 3885, 1435, 288, 203, 3639, 3410, 273, 1234, 18, 15330, 31, 203, 3639, 389, 8401, 2996, 12, 5280, 67, 15468, 67, 16256, 16, 1234, 18, 15330, 1769, 203, 565, 289, 203, 203, 203, 565, 445, 22290, 6032, 12, 203, 3639, 1758, 389, 70, 16213, 16, 203, 3639, 1758, 389, 1786, 749, 16, 203, 3639, 1758, 389, 21386, 12952, 16, 203, 3639, 533, 3778, 389, 2316, 1085, 16, 203, 3639, 2254, 5034, 389, 9261, 6275, 16, 203, 3639, 2254, 5034, 389, 21386, 16397, 16, 203, 565, 262, 3903, 1338, 2996, 12, 16436, 67, 12919, 67, 16256, 13, 288, 203, 3639, 2583, 12, 203, 5411, 28335, 12, 8090, 41, 67, 27086, 45, 2204, 67, 16256, 16, 389, 21386, 12952, 3631, 203, 5411, 4192, 21386, 12952, 353, 640, 8434, 9230, 6, 203, 3639, 11272, 203, 3639, 2583, 12, 4127, 5157, 858, 1085, 63, 67, 2316, 1085, 6487, 315, 2316, 353, 486, 3260, 8863, 203, 203, 3639, 467, 654, 39, 3462, 1147, 8924, 273, 467, 654, 39, 3462, 12, 4127, 5157, 63, 67, 2316, 1085, 8009, 2316, 1887, 1769, 203, 203, 3639, 2583, 12, 203, 5411, 1147, 8924, 18, 12296, 951, 24899, 70, 16213, 13, 1545, 389, 9261, 6275, 16, 203, 5411, 315, 70, 16213, 711, 2763, 11339, 11013, 6, 203, 3639, 11272, 203, 203, 3639, 2254, 5034, 14036, 6275, 273, 14060, 10477, 18, 2892, 12, 203, 5411, 14060, 10477, 18, 16411, 24899, 21386, 16397, 16, 389, 9261, 6275, 3631, 203, 5411, 12619, 203, 3639, 11272, 203, 203, 3639, 2254, 5034, 29804, 6275, 273, 14060, 10477, 18, 1717, 24899, 9261, 6275, 16, 14036, 6275, 1769, 203, 203, 3639, 1147, 8924, 18, 13866, 1265, 24899, 70, 16213, 16, 1758, 12, 2211, 3631, 389, 9261, 6275, 1769, 203, 203, 3639, 1147, 8924, 18, 13866, 24899, 21386, 12952, 16, 14036, 6275, 1769, 203, 203, 3639, 1147, 8924, 18, 13866, 24899, 1786, 749, 16, 29804, 6275, 1769, 203, 203, 3639, 3626, 5184, 23747, 13968, 24899, 1734, 548, 1769, 203, 565, 289, 203, 203, 203, 565, 445, 866, 4446, 2996, 1482, 12, 2867, 389, 19177, 18126, 13, 203, 3639, 1071, 203, 3639, 1476, 203, 3639, 1135, 261, 6430, 13, 203, 565, 288, 203, 3639, 327, 28335, 12, 5280, 67, 15468, 67, 16256, 16, 389, 19177, 18126, 1769, 203, 565, 289, 203, 203, 565, 445, 866, 6032, 2996, 1482, 12, 2867, 389, 19177, 18126, 13, 203, 3639, 1071, 203, 3639, 1476, 203, 3639, 1135, 261, 6430, 13, 203, 565, 288, 203, 3639, 327, 28335, 12, 16436, 67, 12919, 67, 16256, 16, 389, 19177, 18126, 1769, 203, 565, 289, 203, 203, 565, 445, 866, 14667, 2996, 1482, 12, 2867, 389, 19177, 18126, 13, 203, 3639, 1071, 203, 3639, 1476, 203, 3639, 1135, 261, 6430, 13, 203, 565, 288, 203, 3639, 327, 28335, 12, 8090, 41, 67, 27086, 45, 2204, 67, 16256, 16, 389, 19177, 18126, 1769, 203, 565, 289, 203, 203, 565, 445, 7936, 4446, 2996, 12, 2867, 389, 19177, 13786, 13, 203, 3639, 3903, 203, 3639, 1338, 2996, 12, 5280, 67, 15468, 67, 16256, 13, 203, 565, 288, 203, 3639, 2583, 12, 203, 5411, 28335, 12, 16436, 67, 12919, 67, 16256, 16, 389, 19177, 13786, 13, 422, 629, 16, 203, 5411, 315, 19177, 2780, 1240, 1898, 2353, 1245, 2478, 6, 203, 3639, 11272, 203, 3639, 2583, 12, 203, 5411, 28335, 12, 8090, 41, 67, 27086, 45, 2204, 67, 16256, 16, 389, 19177, 13786, 13, 422, 629, 16, 203, 5411, 315, 19177, 2780, 1240, 1898, 2353, 1245, 2478, 6, 203, 3639, 11272, 203, 203, 3639, 7936, 2996, 12, 5280, 67, 15468, 67, 16256, 16, 389, 19177, 13786, 1769, 203, 565, 289, 203, 203, 565, 445, 18007, 4446, 2996, 12, 2867, 389, 19177, 774, 29196, 13, 203, 3639, 3903, 203, 3639, 1338, 2996, 12, 5280, 67, 15468, 67, 16256, 13, 203, 565, 288, 203, 3639, 18007, 2996, 12, 5280, 67, 15468, 67, 16256, 16, 389, 19177, 774, 29196, 1769, 203, 565, 289, 203, 203, 565, 445, 7936, 6032, 2996, 12, 2867, 389, 19177, 13786, 13, 203, 3639, 3903, 203, 3639, 1338, 2996, 12, 5280, 67, 15468, 67, 16256, 13, 203, 565, 288, 203, 3639, 2583, 12, 203, 5411, 28335, 12, 5280, 67, 15468, 67, 16256, 16, 389, 19177, 13786, 13, 422, 629, 16, 203, 5411, 315, 19177, 2780, 1240, 1898, 2353, 1245, 2478, 6, 203, 3639, 11272, 203, 3639, 2583, 12, 203, 5411, 28335, 12, 8090, 41, 67, 27086, 45, 2204, 67, 16256, 16, 389, 19177, 13786, 13, 422, 629, 16, 203, 5411, 315, 19177, 2780, 1240, 1898, 2353, 1245, 2478, 6, 203, 3639, 11272, 203, 203, 3639, 7936, 2996, 12, 16436, 67, 12919, 67, 16256, 16, 389, 19177, 13786, 1769, 203, 565, 289, 203, 203, 565, 445, 18007, 6032, 2996, 12, 2867, 389, 19177, 774, 29196, 13, 203, 3639, 3903, 203, 3639, 1338, 2996, 12, 5280, 67, 15468, 67, 16256, 13, 203, 565, 288, 203, 3639, 18007, 2996, 12, 16436, 67, 12919, 67, 16256, 16, 389, 19177, 774, 29196, 1769, 203, 565, 289, 203, 203, 565, 445, 7936, 14667, 2996, 12, 2867, 389, 19177, 13786, 13, 203, 3639, 3903, 203, 3639, 1338, 2996, 12, 5280, 67, 15468, 67, 16256, 13, 203, 565, 288, 203, 3639, 2583, 12, 203, 5411, 28335, 12, 5280, 67, 15468, 2 ]
./full_match/8453/0xF0363DBD4Efb76fC72Aa4df7D8b956269c9052A6/sources/contracts/interfaces/IAllowance.sol
* allowanceRemoved This event is fired when an allowance is deleted for a recipient key @param operator the message sender @param allowanceId the allowance ID that was removed/
event allowanceRemoved(address operator, bytes32 allowanceId);
11,538,630
[ 1, 4625, 348, 7953, 560, 30, 380, 1699, 1359, 10026, 1220, 871, 353, 15950, 1347, 392, 1699, 1359, 353, 4282, 364, 279, 8027, 498, 632, 891, 3726, 4202, 326, 883, 5793, 632, 891, 1699, 1359, 548, 565, 326, 1699, 1359, 1599, 716, 1703, 3723, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 871, 1699, 1359, 10026, 12, 2867, 3726, 16, 1731, 1578, 1699, 1359, 548, 1769, 7010, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.4.24; /** * Math operations with safety checks */ contract SafeMath { function mul(uint256 _a, uint256 _b) internal pure returns (uint256){ if (_a == 0) { return 0; } uint256 c = _a * _b; assert(c / _a == _b); return c; } function div(uint256 _a, uint256 _b) internal pure returns (uint256){ uint256 c = _a / _b; // assert(b > 0); // Solidity automatically throws when dividing by 0 // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 _a, uint256 _b) internal pure returns (uint256){ assert(_b <= _a); return _a - _b; } function add(uint256 _a,uint256 _b) internal pure returns (uint256){ uint256 c = _a + _b; assert(c >= _a); return c; } } contract Ownable { address public owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor () public{ owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership( address _newOwner ) onlyOwner public { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } contract ERC20StdToken is Ownable, SafeMath { uint256 public totalSupply; string public name; uint8 public decimals; string public symbol; bool public isMint; // 是否可增发 bool public isBurn; // 是否可销毁 bool public isFreeze; // 是否可冻结 mapping (address => uint256) public balanceOf; mapping (address => uint256) public freezeOf; mapping (address => mapping (address => uint256)) public allowance; constructor( address _owner, string _name, string _symbol, uint8 _decimals, uint256 _initialSupply, bool _isMint, bool _isBurn, bool _isFreeze) public { require(_owner != address(0)); owner = _owner; decimals = _decimals; symbol = _symbol; name = _name; isMint = _isMint; isBurn = _isBurn; isFreeze = _isFreeze; totalSupply = _initialSupply * 10 ** uint256(decimals); balanceOf[_owner] = totalSupply; } // This generates a public event on the blockchain that will notify clients event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); /* This notifies clients about the amount burnt */ event Burn(address indexed _from, uint256 value); /* This notifies clients about the amount frozen */ event Freeze(address indexed _from, uint256 value); /* This notifies clients about the amount unfrozen */ event Unfreeze(address indexed _from, uint256 value); function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); success = true; } /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) public returns (bool success) { require(_to != 0); require(balanceOf[msg.sender] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); // balanceOf[msg.sender] -= _value; balanceOf[msg.sender] = SafeMath.sub(balanceOf[msg.sender], _value); // balanceOf[_to] += _value; balanceOf[_to] = SafeMath.add(balanceOf[_to], _value); emit Transfer(msg.sender, _to, _value); success = true; } /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_to != 0); require(balanceOf[_from] >= _value); require(allowance[_from][msg.sender] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); // balanceOf[_from] -= _value; balanceOf[_from] = SafeMath.sub(balanceOf[_from], _value); // balanceOf[_to] += _value; balanceOf[_to] = SafeMath.add(balanceOf[_to], _value); // allowance[_from][msg.sender] -= _value; allowance[_from][msg.sender] = SafeMath.sub(allowance[_from][msg.sender], _value); emit Transfer(_from, _to, _value); success = true; } function mint(uint256 amount) onlyOwner public { require(isMint); require(amount >= 0); // balanceOf[msg.sender] += amount; balanceOf[msg.sender] = SafeMath.add(balanceOf[msg.sender], amount); // totalSupply += amount; totalSupply = SafeMath.add(totalSupply, amount); } function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough require(_value > 0); balanceOf[msg.sender] = SafeMath.sub(balanceOf[msg.sender], _value); // Subtract from the sender totalSupply = SafeMath.sub(totalSupply, _value); // Updates totalSupply emit Burn(msg.sender, _value); success = true; } function freeze(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough require(_value > 0); balanceOf[msg.sender] = SafeMath.sub(balanceOf[msg.sender], _value); // Subtract from the sender freezeOf[msg.sender] = SafeMath.add(freezeOf[msg.sender], _value); // Updates totalSupply emit Freeze(msg.sender, _value); success = true; } function unfreeze(uint256 _value) public returns (bool success) { require(freezeOf[msg.sender] >= _value); // Check if the sender has enough require(_value > 0); freezeOf[msg.sender] = SafeMath.sub(freezeOf[msg.sender], _value); // Subtract from the sender balanceOf[msg.sender] = SafeMath.add(balanceOf[msg.sender], _value); emit Unfreeze(msg.sender, _value); success = true; } }
@notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` @param _from The address of the sender @param _to The address of the recipient @param _value The amount of token to be transferred @return Whether the transfer was successful or not balanceOf[_from] -= _value; balanceOf[_to] += _value; allowance[_from][msg.sender] -= _value;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_to != 0); require(balanceOf[_from] >= _value); require(allowance[_from][msg.sender] >= _value); require(balanceOf[_to] + _value >= balanceOf[_to]); balanceOf[_from] = SafeMath.sub(balanceOf[_from], _value); balanceOf[_to] = SafeMath.add(balanceOf[_to], _value); allowance[_from][msg.sender] = SafeMath.sub(allowance[_from][msg.sender], _value); emit Transfer(_from, _to, _value); success = true; }
906,933
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 20392, 1366, 1375, 67, 1132, 68, 1147, 358, 1375, 67, 869, 68, 628, 1375, 67, 2080, 68, 603, 326, 2269, 518, 353, 20412, 635, 1375, 67, 2080, 68, 632, 891, 389, 2080, 1021, 1758, 434, 326, 5793, 632, 891, 389, 869, 1021, 1758, 434, 326, 8027, 632, 891, 389, 1132, 1021, 3844, 434, 1147, 358, 506, 906, 4193, 632, 2463, 17403, 326, 7412, 1703, 6873, 578, 486, 11013, 951, 63, 67, 2080, 65, 3947, 389, 1132, 31, 11013, 951, 63, 67, 869, 65, 1011, 389, 1132, 31, 1699, 1359, 63, 67, 2080, 6362, 3576, 18, 15330, 65, 3947, 389, 1132, 31, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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389, 1132, 13, 1071, 1135, 261, 6430, 2216, 13, 288, 203, 282, 2583, 24899, 869, 480, 374, 1769, 203, 282, 2583, 12, 12296, 951, 63, 67, 2080, 65, 1545, 389, 1132, 1769, 203, 282, 2583, 12, 5965, 1359, 63, 67, 2080, 6362, 3576, 18, 15330, 65, 1545, 389, 1132, 1769, 203, 282, 2583, 12, 12296, 951, 63, 67, 869, 65, 397, 389, 1132, 1545, 11013, 951, 63, 67, 869, 19226, 203, 282, 11013, 951, 63, 67, 2080, 65, 273, 14060, 10477, 18, 1717, 12, 12296, 951, 63, 67, 2080, 6487, 389, 1132, 1769, 203, 282, 11013, 951, 63, 67, 869, 65, 273, 14060, 10477, 18, 1289, 12, 12296, 951, 63, 67, 869, 6487, 389, 1132, 1769, 203, 203, 282, 1699, 1359, 63, 67, 2080, 6362, 3576, 18, 15330, 65, 273, 14060, 10477, 18, 1717, 12, 5965, 1359, 63, 67, 2080, 6362, 3576, 18, 15330, 6487, 389, 1132, 1769, 203, 203, 282, 3626, 12279, 24899, 2080, 16, 389, 869, 16, 389, 1132, 1769, 203, 282, 2216, 273, 638, 31, 203, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/80001/0x1ea876444d13302aeaa20C923Ca996b35Da3DE13/sources/contracts/oracles/template/OracleManagerFixedEpoch.sol
TODO: should we not be passing around epoch indexes rather than timestamps? TODO: make naming more clear by specifying renaming 'currentEpochTimestamp' to 'currentEpochStartTimestamp' @notice Returns start timestamp of current epoch and number of epochs between current timestamp and lastEpochEndTimestamp @param lastEpochEndTimestamp end timestamp of the last epoch @return currentEpochTimestamp start timestamp of the current epoch @return numberOfEpochsSinceLastEpoch number of epochs between current timestamp and lastEpochEndTimestamp
function getCurrentEpochStartTimestampAndNumberOfEpochsSinceLastEpoch( uint32 lastEpochEndTimestamp ) public view virtual returns (uint32 currentEpochTimestamp, uint32 numberOfEpochsSinceLastEpoch) { currentEpochTimestamp = uint32(getEpochStartTimestamp()); numberOfEpochsSinceLastEpoch = uint32( (currentEpochTimestamp - lastEpochEndTimestamp) / EPOCH_LENGTH ); }
9,514,570
[ 1, 4625, 348, 7953, 560, 30, 225, 2660, 30, 1410, 732, 486, 506, 9588, 6740, 7632, 5596, 9178, 2353, 11267, 35, 2660, 30, 1221, 14634, 1898, 2424, 635, 13664, 30883, 296, 2972, 14638, 4921, 11, 358, 296, 2972, 14638, 1685, 4921, 11, 632, 20392, 2860, 787, 2858, 434, 783, 7632, 471, 1300, 434, 25480, 3086, 783, 2858, 471, 1142, 14638, 1638, 4921, 632, 891, 1142, 14638, 1638, 4921, 679, 2858, 434, 326, 1142, 7632, 632, 2463, 783, 14638, 4921, 787, 2858, 434, 326, 783, 7632, 632, 2463, 7922, 14638, 87, 9673, 3024, 14638, 1300, 434, 25480, 3086, 783, 2858, 471, 1142, 14638, 1638, 4921, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 225, 445, 5175, 14638, 1685, 4921, 1876, 9226, 14638, 87, 9673, 3024, 14638, 12, 203, 565, 2254, 1578, 1142, 14638, 1638, 4921, 203, 225, 262, 203, 565, 1071, 203, 565, 1476, 203, 565, 5024, 203, 565, 1135, 261, 11890, 1578, 783, 14638, 4921, 16, 2254, 1578, 7922, 14638, 87, 9673, 3024, 14638, 13, 203, 225, 288, 203, 565, 783, 14638, 4921, 273, 2254, 1578, 12, 588, 14638, 1685, 4921, 10663, 203, 565, 7922, 14638, 87, 9673, 3024, 14638, 273, 2254, 1578, 12, 203, 1377, 261, 2972, 14638, 4921, 300, 1142, 14638, 1638, 4921, 13, 342, 512, 30375, 67, 7096, 203, 565, 11272, 203, 225, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/utils/Context.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/access/Ownable.sol /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/utils/math/SafeMath.sol // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/token/ERC20/IERC20.sol /** * @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); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/token/ERC20/extensions/IERC20Metadata.sol /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.1.0/contracts/token/ERC20/ERC20.sol /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // File: contracts/UnizenSupply.sol /** * @title Unizen Real Circulating Supply * @dev Simple contract to easily retrieve the current * market of Unizen utility token ZCX * */ contract UnizenRealCirculatingSupply is Ownable { struct AddressInfo { address lockAddress; string name; } IERC20 public zcxToken; mapping(uint8 => AddressInfo) public lockedAddresses; mapping(uint8 => address) public burnAddresses; uint8 public lockedAddressCount; uint8 public burnAddressCount; uint8 internal _lockIdx; uint8 internal _burnIdx; constructor(address _tokenAddress) { require(_tokenAddress != address(0), "ZERO_ADDRESS"); zcxToken = IERC20(_tokenAddress); } /* === VIEW FUNCTIONS === */ function getCirculatingSupply() external view returns(uint256 circulatingSupply) { uint256 totalSupply = zcxToken.totalSupply(); circulatingSupply = totalSupply; for(uint8 i = 0; i < _lockIdx; i++) { if(lockedAddresses[i].lockAddress != address(0)) { circulatingSupply = SafeMath.sub(circulatingSupply, zcxToken.balanceOf(lockedAddresses[i].lockAddress)); } } for(uint8 i = 0; i < _burnIdx; i++) { if(burnAddresses[i] != address(0)) { circulatingSupply = SafeMath.add(circulatingSupply, zcxToken.balanceOf(burnAddresses[i])); } } } function getDescriptiveCirculatingSupply() external view returns(uint256, uint256, string[] memory, uint256[] memory) { uint256 totalSupply = zcxToken.totalSupply(); uint256 circulatingSupply = totalSupply; string[] memory descriptions = new string[](lockedAddressCount + 1); uint256[] memory supplies = new uint256[](lockedAddressCount + 1); uint8 _idx; for(uint8 i = 0; i < _lockIdx; i++) { if(lockedAddresses[i].lockAddress != address(0)) { descriptions[_idx] = lockedAddresses[i].name; supplies[_idx] = zcxToken.balanceOf(lockedAddresses[i].lockAddress); circulatingSupply = SafeMath.sub(circulatingSupply, supplies[_idx]); _idx++; } } descriptions[lockedAddressCount] = "Burned"; for(uint8 i = 0; i < _burnIdx; i++) { if(burnAddresses[i] != address(0)) { supplies[lockedAddressCount] = SafeMath.add(supplies[lockedAddressCount], zcxToken.balanceOf(burnAddresses[i])); } } circulatingSupply = SafeMath.sub(circulatingSupply, supplies[lockedAddressCount]); return (totalSupply,circulatingSupply, descriptions, supplies); } function getLockedAddresses() public view returns(address[] memory, string[] memory) { address[] memory addresses = new address[](lockedAddressCount); string[] memory descriptions = new string[](lockedAddressCount); uint8 _idx; for(uint8 i = 0; i < _lockIdx; i++) { if(lockedAddresses[i].lockAddress != address(0)) { addresses[_idx] = lockedAddresses[i].lockAddress; descriptions[_idx] = lockedAddresses[i].name; _idx++; } } return (addresses, descriptions); } function getBurnAddress() public view returns(address[] memory) { address[] memory addresses = new address[](burnAddressCount); uint8 _idx; for(uint8 i = 0; i < _burnIdx; i++) { if(burnAddresses[i] != address(0)) { addresses[_idx] = burnAddresses[i]; _idx++; } } return addresses; } /* === CONTROL FUNCTIONS === */ function addBurnAddress(address _address) external onlyOwner { uint8 _idx = _burnAddressExists(_address); require(_idx == 255, "ALREADY_EXISTS"); burnAddresses[_burnIdx] = _address; _burnIdx++; burnAddressCount++; } function removeBurnAddress(address _address) external onlyOwner { uint8 _idx = _burnAddressExists(_address); require(_idx < 255, "DOES_NOT_EXIST"); burnAddresses[_idx] = address(0); burnAddressCount--; } function addLockedAddress(address _address, string calldata _description) external onlyOwner { uint8 _idx = _lockedAddressExists(_address); require(_idx == 255, "ALREADY_EXISTS"); AddressInfo storage info = lockedAddresses[_lockIdx]; info.lockAddress = _address; info.name = _description; lockedAddressCount++; _lockIdx++; } function removeLockedAddress(address _address) external onlyOwner { uint8 _idx = _lockedAddressExists(_address); require(_idx < 255, "DOES_NOT_EXIST"); lockedAddresses[_idx].lockAddress = address(0); lockedAddressCount--; } function updateLockeAddressDescription(address _address, string calldata _newDescription) external onlyOwner { uint8 _idx = _lockedAddressExists(_address); require(_idx < 255, "DOES_NOT_EXIST"); lockedAddresses[_idx].name = _newDescription; } /* === INTERNAL FUNCTIONS === */ function _lockedAddressExists(address _address) internal view returns(uint8) { if(lockedAddressCount == 0) return 255; for(uint8 i = 0; i < _lockIdx; i++) { if(lockedAddresses[i].lockAddress == _address) { return i; } } return 255; } function _burnAddressExists(address _address) internal view returns(uint8) { if(burnAddressCount == 0) return 255; for(uint8 i = 0; i < _burnIdx; i++) { if(burnAddresses[i] == _address) { return i; } } return 255; } /* === EVENTS === */ event AddressAdded(address indexed _address, string _description); event AddressRemoved(address indexed _address, string _description); event AddressUpdated(address indexed _address, string _oldDescription, string _newDescription); }
=== CONTROL FUNCTIONS === */
function addBurnAddress(address _address) external onlyOwner { uint8 _idx = _burnAddressExists(_address); require(_idx == 255, "ALREADY_EXISTS"); burnAddresses[_burnIdx] = _address; _burnIdx++; burnAddressCount++; }
602,217
[ 1, 4625, 348, 7953, 560, 30, 225, 757, 8020, 13429, 13690, 55, 757, 1195, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 282, 445, 527, 38, 321, 1887, 12, 2867, 389, 2867, 13, 3903, 1338, 5541, 288, 203, 4202, 2254, 28, 389, 3465, 273, 389, 70, 321, 1887, 4002, 24899, 2867, 1769, 203, 4202, 2583, 24899, 3465, 422, 4561, 16, 315, 1013, 20305, 67, 21205, 8863, 203, 3639, 203, 4202, 18305, 7148, 63, 67, 70, 321, 4223, 65, 273, 389, 2867, 31, 203, 4202, 389, 70, 321, 4223, 9904, 31, 203, 4202, 18305, 1887, 1380, 9904, 31, 203, 282, 289, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// 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, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { 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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/Context.sol"; import "./IERC20.sol"; import "../../math/SafeMath.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal virtual { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // 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.0 <0.8.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with 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: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; /// @title IIntegrationManager interface /// @author Enzyme Council <[email protected]> /// @notice Interface for the IntegrationManager interface IIntegrationManager { enum SpendAssetsHandleType {None, Approve, Transfer} } // SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "../IIntegrationManager.sol"; /// @title Integration Adapter interface /// @author Enzyme Council <[email protected]> /// @notice Interface for all integration adapters interface IIntegrationAdapter { function parseAssetsForAction( address _vaultProxy, bytes4 _selector, bytes calldata _encodedCallArgs ) external view returns ( IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_, address[] memory spendAssets_, uint256[] memory spendAssetAmounts_, address[] memory incomingAssets_, uint256[] memory minIncomingAssetAmounts_ ); } // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.6.12; import "../utils/actions/CurveGaugeV2RewardsHandlerMixin.sol"; import "../utils/actions/CurveSethLiquidityActionsMixin.sol"; import "../utils/AdapterBase.sol"; /// @title CurveLiquiditySethAdapter Contract /// @author Enzyme Council <[email protected]> /// @notice Adapter for liquidity provision in Curve's seth pool (https://www.curve.fi/seth) /// @dev Rewards tokens are not included as spend assets or incoming assets for claimRewards() /// or claimRewardsAndReinvest(). Rationale: /// - rewards tokens can be claimed to the vault outside of the IntegrationManager, so no need /// to enforce policy management or emit an event /// - rewards tokens can be outside of the asset universe, in which case they cannot be tracked contract CurveLiquiditySethAdapter is AdapterBase, CurveGaugeV2RewardsHandlerMixin, CurveSethLiquidityActionsMixin { address private immutable LIQUIDITY_GAUGE_TOKEN; address private immutable LP_TOKEN; address private immutable SETH_TOKEN; constructor( address _integrationManager, address _liquidityGaugeToken, address _lpToken, address _minter, address _pool, address _crvToken, address _sethToken, address _wethToken ) public AdapterBase(_integrationManager) CurveGaugeV2RewardsHandlerMixin(_minter, _crvToken) CurveSethLiquidityActionsMixin(_pool, _sethToken, _wethToken) { LIQUIDITY_GAUGE_TOKEN = _liquidityGaugeToken; LP_TOKEN = _lpToken; SETH_TOKEN = _sethToken; // Max approve contracts to spend relevant tokens ERC20(_lpToken).safeApprove(_liquidityGaugeToken, type(uint256).max); } /// @dev Needed to receive ETH from redemption and to unwrap WETH receive() external payable {} // EXTERNAL FUNCTIONS /// @notice Claims rewards from the Curve Minter as well as pool-specific rewards /// @param _vaultProxy The VaultProxy of the calling fund function claimRewards( address _vaultProxy, bytes calldata, bytes calldata ) external onlyIntegrationManager { __curveGaugeV2ClaimAllRewards(LIQUIDITY_GAUGE_TOKEN, _vaultProxy); } /// @notice Lends assets for seth LP tokens /// @param _vaultProxy The VaultProxy of the calling fund /// @param _actionData Data specific to this action /// @param _assetData Parsed spend assets and incoming assets data for this action function lend( address _vaultProxy, bytes calldata _actionData, bytes calldata _assetData ) external onlyIntegrationManager postActionIncomingAssetsTransferHandler(_vaultProxy, _assetData) { ( uint256 outgoingWethAmount, uint256 outgoingSethAmount, uint256 minIncomingLiquidityGaugeTokenAmount ) = __decodeLendCallArgs(_actionData); __curveSethLend( outgoingWethAmount, outgoingSethAmount, minIncomingLiquidityGaugeTokenAmount ); } /// @notice Lends assets for seth LP tokens, then stakes the received LP tokens /// @param _vaultProxy The VaultProxy of the calling fund /// @param _actionData Data specific to this action /// @param _assetData Parsed spend assets and incoming assets data for this action function lendAndStake( address _vaultProxy, bytes calldata _actionData, bytes calldata _assetData ) external onlyIntegrationManager postActionIncomingAssetsTransferHandler(_vaultProxy, _assetData) { ( uint256 outgoingWethAmount, uint256 outgoingSethAmount, uint256 minIncomingLiquidityGaugeTokenAmount ) = __decodeLendCallArgs(_actionData); __curveSethLend( outgoingWethAmount, outgoingSethAmount, minIncomingLiquidityGaugeTokenAmount ); __curveGaugeV2Stake( LIQUIDITY_GAUGE_TOKEN, LP_TOKEN, ERC20(LP_TOKEN).balanceOf(address(this)) ); } /// @notice Redeems seth LP tokens /// @param _vaultProxy The VaultProxy of the calling fund /// @param _actionData Data specific to this action /// @param _assetData Parsed spend assets and incoming assets data for this action function redeem( address _vaultProxy, bytes calldata _actionData, bytes calldata _assetData ) external onlyIntegrationManager postActionIncomingAssetsTransferHandler(_vaultProxy, _assetData) { ( uint256 outgoingLpTokenAmount, uint256 minIncomingWethAmount, uint256 minIncomingSethAmount, bool redeemSingleAsset ) = __decodeRedeemCallArgs(_actionData); __curveSethRedeem( outgoingLpTokenAmount, minIncomingWethAmount, minIncomingSethAmount, redeemSingleAsset ); } /// @notice Stakes seth LP tokens /// @param _vaultProxy The VaultProxy of the calling fund /// @param _actionData Data specific to this action /// @param _assetData Parsed spend assets and incoming assets data for this action function stake( address _vaultProxy, bytes calldata _actionData, bytes calldata _assetData ) external onlyIntegrationManager postActionIncomingAssetsTransferHandler(_vaultProxy, _assetData) { __curveGaugeV2Stake(LIQUIDITY_GAUGE_TOKEN, LP_TOKEN, __decodeStakeCallArgs(_actionData)); } /// @notice Unstakes seth LP tokens /// @param _vaultProxy The VaultProxy of the calling fund /// @param _actionData Data specific to this action /// @param _assetData Parsed spend assets and incoming assets data for this action function unstake( address _vaultProxy, bytes calldata _actionData, bytes calldata _assetData ) external onlyIntegrationManager postActionIncomingAssetsTransferHandler(_vaultProxy, _assetData) { __curveGaugeV2Unstake(LIQUIDITY_GAUGE_TOKEN, __decodeUnstakeCallArgs(_actionData)); } /// @notice Unstakes seth LP tokens, then redeems them /// @param _vaultProxy The VaultProxy of the calling fund /// @param _actionData Data specific to this action /// @param _assetData Parsed spend assets and incoming assets data for this action function unstakeAndRedeem( address _vaultProxy, bytes calldata _actionData, bytes calldata _assetData ) external onlyIntegrationManager postActionIncomingAssetsTransferHandler(_vaultProxy, _assetData) { ( uint256 outgoingLiquidityGaugeTokenAmount, uint256 minIncomingWethAmount, uint256 minIncomingSethAmount, bool redeemSingleAsset ) = __decodeRedeemCallArgs(_actionData); __curveGaugeV2Unstake(LIQUIDITY_GAUGE_TOKEN, outgoingLiquidityGaugeTokenAmount); __curveSethRedeem( outgoingLiquidityGaugeTokenAmount, minIncomingWethAmount, minIncomingSethAmount, redeemSingleAsset ); } ///////////////////////////// // PARSE ASSETS FOR METHOD // ///////////////////////////// /// @notice Parses the expected assets in a particular action /// @param _selector The function selector for the callOnIntegration /// @param _actionData Data specific to this action /// @return spendAssetsHandleType_ A type that dictates how to handle granting /// the adapter access to spend assets (`None` by default) /// @return spendAssets_ The assets to spend in the call /// @return spendAssetAmounts_ The max asset amounts to spend in the call /// @return incomingAssets_ The assets to receive in the call /// @return minIncomingAssetAmounts_ The min asset amounts to receive in the call function parseAssetsForAction( address, bytes4 _selector, bytes calldata _actionData ) external view override returns ( IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_, address[] memory spendAssets_, uint256[] memory spendAssetAmounts_, address[] memory incomingAssets_, uint256[] memory minIncomingAssetAmounts_ ) { if (_selector == CLAIM_REWARDS_SELECTOR) { return __parseAssetsForClaimRewards(); } else if (_selector == LEND_SELECTOR) { return __parseAssetsForLend(_actionData); } else if (_selector == LEND_AND_STAKE_SELECTOR) { return __parseAssetsForLendAndStake(_actionData); } else if (_selector == REDEEM_SELECTOR) { return __parseAssetsForRedeem(_actionData); } else if (_selector == STAKE_SELECTOR) { return __parseAssetsForStake(_actionData); } else if (_selector == UNSTAKE_SELECTOR) { return __parseAssetsForUnstake(_actionData); } else if (_selector == UNSTAKE_AND_REDEEM_SELECTOR) { return __parseAssetsForUnstakeAndRedeem(_actionData); } revert("parseAssetsForAction: _selector invalid"); } /// @dev Helper function to parse spend and incoming assets from encoded call args /// during claimRewards() calls. /// No action required, all values empty. function __parseAssetsForClaimRewards() private pure returns ( IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_, address[] memory spendAssets_, uint256[] memory spendAssetAmounts_, address[] memory incomingAssets_, uint256[] memory minIncomingAssetAmounts_ ) { return ( IIntegrationManager.SpendAssetsHandleType.None, new address[](0), new uint256[](0), new address[](0), new uint256[](0) ); } /// @dev Helper function to parse spend and incoming assets from encoded call args /// during lend() calls function __parseAssetsForLend(bytes calldata _actionData) private view returns ( IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_, address[] memory spendAssets_, uint256[] memory spendAssetAmounts_, address[] memory incomingAssets_, uint256[] memory minIncomingAssetAmounts_ ) { ( uint256 outgoingWethAmount, uint256 outgoingSethAmount, uint256 minIncomingLpTokenAmount ) = __decodeLendCallArgs(_actionData); (spendAssets_, spendAssetAmounts_) = __parseSpendAssetsForLendingCalls( outgoingWethAmount, outgoingSethAmount ); incomingAssets_ = new address[](1); incomingAssets_[0] = LP_TOKEN; minIncomingAssetAmounts_ = new uint256[](1); minIncomingAssetAmounts_[0] = minIncomingLpTokenAmount; return ( IIntegrationManager.SpendAssetsHandleType.Transfer, spendAssets_, spendAssetAmounts_, incomingAssets_, minIncomingAssetAmounts_ ); } /// @dev Helper function to parse spend and incoming assets from encoded call args /// during lendAndStake() calls function __parseAssetsForLendAndStake(bytes calldata _actionData) private view returns ( IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_, address[] memory spendAssets_, uint256[] memory spendAssetAmounts_, address[] memory incomingAssets_, uint256[] memory minIncomingAssetAmounts_ ) { ( uint256 outgoingWethAmount, uint256 outgoingSethAmount, uint256 minIncomingLiquidityGaugeTokenAmount ) = __decodeLendCallArgs(_actionData); (spendAssets_, spendAssetAmounts_) = __parseSpendAssetsForLendingCalls( outgoingWethAmount, outgoingSethAmount ); incomingAssets_ = new address[](1); incomingAssets_[0] = LIQUIDITY_GAUGE_TOKEN; minIncomingAssetAmounts_ = new uint256[](1); minIncomingAssetAmounts_[0] = minIncomingLiquidityGaugeTokenAmount; return ( IIntegrationManager.SpendAssetsHandleType.Transfer, spendAssets_, spendAssetAmounts_, incomingAssets_, minIncomingAssetAmounts_ ); } /// @dev Helper function to parse spend and incoming assets from encoded call args /// during redeem() calls function __parseAssetsForRedeem(bytes calldata _actionData) private view returns ( IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_, address[] memory spendAssets_, uint256[] memory spendAssetAmounts_, address[] memory incomingAssets_, uint256[] memory minIncomingAssetAmounts_ ) { ( uint256 outgoingLpTokenAmount, uint256 minIncomingWethAmount, uint256 minIncomingSethAmount, bool receiveSingleAsset ) = __decodeRedeemCallArgs(_actionData); spendAssets_ = new address[](1); spendAssets_[0] = LP_TOKEN; spendAssetAmounts_ = new uint256[](1); spendAssetAmounts_[0] = outgoingLpTokenAmount; (incomingAssets_, minIncomingAssetAmounts_) = __parseIncomingAssetsForRedemptionCalls( minIncomingWethAmount, minIncomingSethAmount, receiveSingleAsset ); return ( IIntegrationManager.SpendAssetsHandleType.Transfer, spendAssets_, spendAssetAmounts_, incomingAssets_, minIncomingAssetAmounts_ ); } /// @dev Helper function to parse spend and incoming assets from encoded call args /// during stake() calls function __parseAssetsForStake(bytes calldata _actionData) private view returns ( IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_, address[] memory spendAssets_, uint256[] memory spendAssetAmounts_, address[] memory incomingAssets_, uint256[] memory minIncomingAssetAmounts_ ) { uint256 outgoingLpTokenAmount = __decodeStakeCallArgs(_actionData); spendAssets_ = new address[](1); spendAssets_[0] = LP_TOKEN; spendAssetAmounts_ = new uint256[](1); spendAssetAmounts_[0] = outgoingLpTokenAmount; incomingAssets_ = new address[](1); incomingAssets_[0] = LIQUIDITY_GAUGE_TOKEN; minIncomingAssetAmounts_ = new uint256[](1); minIncomingAssetAmounts_[0] = outgoingLpTokenAmount; return ( IIntegrationManager.SpendAssetsHandleType.Transfer, spendAssets_, spendAssetAmounts_, incomingAssets_, minIncomingAssetAmounts_ ); } /// @dev Helper function to parse spend and incoming assets from encoded call args /// during unstake() calls function __parseAssetsForUnstake(bytes calldata _actionData) private view returns ( IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_, address[] memory spendAssets_, uint256[] memory spendAssetAmounts_, address[] memory incomingAssets_, uint256[] memory minIncomingAssetAmounts_ ) { uint256 outgoingLiquidityGaugeTokenAmount = __decodeUnstakeCallArgs(_actionData); spendAssets_ = new address[](1); spendAssets_[0] = LIQUIDITY_GAUGE_TOKEN; spendAssetAmounts_ = new uint256[](1); spendAssetAmounts_[0] = outgoingLiquidityGaugeTokenAmount; incomingAssets_ = new address[](1); incomingAssets_[0] = LP_TOKEN; minIncomingAssetAmounts_ = new uint256[](1); minIncomingAssetAmounts_[0] = outgoingLiquidityGaugeTokenAmount; return ( IIntegrationManager.SpendAssetsHandleType.Transfer, spendAssets_, spendAssetAmounts_, incomingAssets_, minIncomingAssetAmounts_ ); } /// @dev Helper function to parse spend and incoming assets from encoded call args /// during unstakeAndRedeem() calls function __parseAssetsForUnstakeAndRedeem(bytes calldata _actionData) private view returns ( IIntegrationManager.SpendAssetsHandleType spendAssetsHandleType_, address[] memory spendAssets_, uint256[] memory spendAssetAmounts_, address[] memory incomingAssets_, uint256[] memory minIncomingAssetAmounts_ ) { ( uint256 outgoingLiquidityGaugeTokenAmount, uint256 minIncomingWethAmount, uint256 minIncomingSethAmount, bool receiveSingleAsset ) = __decodeRedeemCallArgs(_actionData); spendAssets_ = new address[](1); spendAssets_[0] = LIQUIDITY_GAUGE_TOKEN; spendAssetAmounts_ = new uint256[](1); spendAssetAmounts_[0] = outgoingLiquidityGaugeTokenAmount; (incomingAssets_, minIncomingAssetAmounts_) = __parseIncomingAssetsForRedemptionCalls( minIncomingWethAmount, minIncomingSethAmount, receiveSingleAsset ); return ( IIntegrationManager.SpendAssetsHandleType.Transfer, spendAssets_, spendAssetAmounts_, incomingAssets_, minIncomingAssetAmounts_ ); } /// @dev Helper function to parse spend assets for redeem() and unstakeAndRedeem() calls function __parseIncomingAssetsForRedemptionCalls( uint256 _minIncomingWethAmount, uint256 _minIncomingSethAmount, bool _receiveSingleAsset ) private view returns (address[] memory incomingAssets_, uint256[] memory minIncomingAssetAmounts_) { if (_receiveSingleAsset) { incomingAssets_ = new address[](1); minIncomingAssetAmounts_ = new uint256[](1); if (_minIncomingWethAmount == 0) { require( _minIncomingSethAmount > 0, "__parseIncomingAssetsForRedemptionCalls: No min asset amount specified" ); incomingAssets_[0] = SETH_TOKEN; minIncomingAssetAmounts_[0] = _minIncomingSethAmount; } else { require( _minIncomingSethAmount == 0, "__parseIncomingAssetsForRedemptionCalls: Too many min asset amounts specified" ); incomingAssets_[0] = getCurveSethLiquidityWethToken(); minIncomingAssetAmounts_[0] = _minIncomingWethAmount; } } else { incomingAssets_ = new address[](2); incomingAssets_[0] = getCurveSethLiquidityWethToken(); incomingAssets_[1] = SETH_TOKEN; minIncomingAssetAmounts_ = new uint256[](2); minIncomingAssetAmounts_[0] = _minIncomingWethAmount; minIncomingAssetAmounts_[1] = _minIncomingSethAmount; } return (incomingAssets_, minIncomingAssetAmounts_); } /// @dev Helper function to parse spend assets for lend() and lendAndStake() calls function __parseSpendAssetsForLendingCalls( uint256 _outgoingWethAmount, uint256 _outgoingSethAmount ) private view returns (address[] memory spendAssets_, uint256[] memory spendAssetAmounts_) { if (_outgoingWethAmount > 0 && _outgoingSethAmount > 0) { spendAssets_ = new address[](2); spendAssets_[0] = getCurveSethLiquidityWethToken(); spendAssets_[1] = SETH_TOKEN; spendAssetAmounts_ = new uint256[](2); spendAssetAmounts_[0] = _outgoingWethAmount; spendAssetAmounts_[1] = _outgoingSethAmount; } else if (_outgoingWethAmount > 0) { spendAssets_ = new address[](1); spendAssets_[0] = getCurveSethLiquidityWethToken(); spendAssetAmounts_ = new uint256[](1); spendAssetAmounts_[0] = _outgoingWethAmount; } else { spendAssets_ = new address[](1); spendAssets_[0] = SETH_TOKEN; spendAssetAmounts_ = new uint256[](1); spendAssetAmounts_[0] = _outgoingSethAmount; } return (spendAssets_, spendAssetAmounts_); } /////////////////////// // ENCODED CALL ARGS // /////////////////////// /// @dev Helper to decode the encoded call arguments for lending function __decodeLendCallArgs(bytes memory _actionData) private pure returns ( uint256 outgoingWethAmount_, uint256 outgoingSethAmount_, uint256 minIncomingAssetAmount_ ) { return abi.decode(_actionData, (uint256, uint256, uint256)); } /// @dev Helper to decode the encoded call arguments for redeeming. /// If `receiveSingleAsset_` is `true`, then one (and only one) of /// `minIncomingWethAmount_` and `minIncomingSethAmount_` must be >0 /// to indicate which asset is to be received. function __decodeRedeemCallArgs(bytes memory _actionData) private pure returns ( uint256 outgoingAssetAmount_, uint256 minIncomingWethAmount_, uint256 minIncomingSethAmount_, bool receiveSingleAsset_ ) { return abi.decode(_actionData, (uint256, uint256, uint256, bool)); } /// @dev Helper to decode the encoded call arguments for staking function __decodeStakeCallArgs(bytes memory _actionData) private pure returns (uint256 outgoingLpTokenAmount_) { return abi.decode(_actionData, (uint256)); } /// @dev Helper to decode the encoded call arguments for unstaking function __decodeUnstakeCallArgs(bytes memory _actionData) private pure returns (uint256 outgoingLiquidityGaugeTokenAmount_) { return abi.decode(_actionData, (uint256)); } /////////////////// // STATE GETTERS // /////////////////// /// @notice Gets the `LIQUIDITY_GAUGE_TOKEN` variable /// @return liquidityGaugeToken_ The `LIQUIDITY_GAUGE_TOKEN` variable value function getLiquidityGaugeToken() external view returns (address liquidityGaugeToken_) { return LIQUIDITY_GAUGE_TOKEN; } /// @notice Gets the `LP_TOKEN` variable /// @return lpToken_ The `LP_TOKEN` variable value function getLpToken() external view returns (address lpToken_) { return LP_TOKEN; } /// @notice Gets the `SETH_TOKEN` variable /// @return sethToken_ The `SETH_TOKEN` variable value function getSethToken() external view returns (address sethToken_) { return SETH_TOKEN; } } // SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../../../../utils/AssetHelpers.sol"; import "../IIntegrationAdapter.sol"; import "./IntegrationSelectors.sol"; /// @title AdapterBase Contract /// @author Enzyme Council <[email protected]> /// @notice A base contract for integration adapters abstract contract AdapterBase is IIntegrationAdapter, IntegrationSelectors, AssetHelpers { using SafeERC20 for ERC20; address internal immutable INTEGRATION_MANAGER; /// @dev Provides a standard implementation for transferring incoming assets /// from an adapter to a VaultProxy at the end of an adapter action modifier postActionIncomingAssetsTransferHandler( address _vaultProxy, bytes memory _assetData ) { _; (, , address[] memory incomingAssets) = __decodeAssetData(_assetData); __pushFullAssetBalances(_vaultProxy, incomingAssets); } /// @dev Provides a standard implementation for transferring unspent spend assets /// from an adapter to a VaultProxy at the end of an adapter action modifier postActionSpendAssetsTransferHandler(address _vaultProxy, bytes memory _assetData) { _; (address[] memory spendAssets, , ) = __decodeAssetData(_assetData); __pushFullAssetBalances(_vaultProxy, spendAssets); } modifier onlyIntegrationManager { require( msg.sender == INTEGRATION_MANAGER, "Only the IntegrationManager can call this function" ); _; } constructor(address _integrationManager) public { INTEGRATION_MANAGER = _integrationManager; } // INTERNAL FUNCTIONS /// @dev Helper to decode the _assetData param passed to adapter call function __decodeAssetData(bytes memory _assetData) internal pure returns ( address[] memory spendAssets_, uint256[] memory spendAssetAmounts_, address[] memory incomingAssets_ ) { return abi.decode(_assetData, (address[], uint256[], address[])); } /////////////////// // STATE GETTERS // /////////////////// /// @notice Gets the `INTEGRATION_MANAGER` variable /// @return integrationManager_ The `INTEGRATION_MANAGER` variable value function getIntegrationManager() external view returns (address integrationManager_) { return INTEGRATION_MANAGER; } } // SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; /// @title IntegrationSelectors Contract /// @author Enzyme Council <[email protected]> /// @notice Selectors for integration actions /// @dev Selectors are created from their signatures rather than hardcoded for easy verification abstract contract IntegrationSelectors { // Trading bytes4 public constant TAKE_ORDER_SELECTOR = bytes4( keccak256("takeOrder(address,bytes,bytes)") ); // Lending bytes4 public constant LEND_SELECTOR = bytes4(keccak256("lend(address,bytes,bytes)")); bytes4 public constant REDEEM_SELECTOR = bytes4(keccak256("redeem(address,bytes,bytes)")); // Staking bytes4 public constant STAKE_SELECTOR = bytes4(keccak256("stake(address,bytes,bytes)")); bytes4 public constant UNSTAKE_SELECTOR = bytes4(keccak256("unstake(address,bytes,bytes)")); // Rewards bytes4 public constant CLAIM_REWARDS_SELECTOR = bytes4( keccak256("claimRewards(address,bytes,bytes)") ); // Combined bytes4 public constant LEND_AND_STAKE_SELECTOR = bytes4( keccak256("lendAndStake(address,bytes,bytes)") ); bytes4 public constant UNSTAKE_AND_REDEEM_SELECTOR = bytes4( keccak256("unstakeAndRedeem(address,bytes,bytes)") ); } // SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "../../../../../interfaces/ICurveLiquidityGaugeV2.sol"; import "../../../../../utils/AssetHelpers.sol"; /// @title CurveGaugeV2ActionsMixin Contract /// @author Enzyme Council <[email protected]> /// @notice Mixin contract for interacting with any Curve LiquidityGaugeV2 contract abstract contract CurveGaugeV2ActionsMixin is AssetHelpers { uint256 private constant CURVE_GAUGE_V2_MAX_REWARDS = 8; /// @dev Helper to claim pool-specific rewards function __curveGaugeV2ClaimRewards(address _gauge, address _target) internal { ICurveLiquidityGaugeV2(_gauge).claim_rewards(_target); } /// @dev Helper to get list of pool-specific rewards tokens function __curveGaugeV2GetRewardsTokens(address _gauge) internal view returns (address[] memory rewardsTokens_) { address[] memory lpRewardsTokensWithEmpties = new address[](CURVE_GAUGE_V2_MAX_REWARDS); uint256 rewardsTokensCount; for (uint256 i; i < CURVE_GAUGE_V2_MAX_REWARDS; i++) { address rewardToken = ICurveLiquidityGaugeV2(_gauge).reward_tokens(i); if (rewardToken != address(0)) { lpRewardsTokensWithEmpties[i] = rewardToken; rewardsTokensCount++; } else { break; } } rewardsTokens_ = new address[](rewardsTokensCount); for (uint256 i; i < rewardsTokensCount; i++) { rewardsTokens_[i] = lpRewardsTokensWithEmpties[i]; } return rewardsTokens_; } /// @dev Helper to stake LP tokens function __curveGaugeV2Stake( address _gauge, address _lpToken, uint256 _amount ) internal { __approveAssetMaxAsNeeded(_lpToken, _gauge, _amount); ICurveLiquidityGaugeV2(_gauge).deposit(_amount, address(this)); } /// @dev Helper to unstake LP tokens function __curveGaugeV2Unstake(address _gauge, uint256 _amount) internal { ICurveLiquidityGaugeV2(_gauge).withdraw(_amount); } } // SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "../../../../../interfaces/ICurveMinter.sol"; import "../../../../../utils/AddressArrayLib.sol"; import "./CurveGaugeV2ActionsMixin.sol"; /// @title CurveGaugeV2RewardsHandlerMixin Contract /// @author Enzyme Council <[email protected]> /// @notice Mixin contract for handling claiming and reinvesting rewards for a Curve pool /// that uses the LiquidityGaugeV2 contract abstract contract CurveGaugeV2RewardsHandlerMixin is CurveGaugeV2ActionsMixin { using AddressArrayLib for address[]; address private immutable CURVE_GAUGE_V2_REWARDS_HANDLER_CRV_TOKEN; address private immutable CURVE_GAUGE_V2_REWARDS_HANDLER_MINTER; constructor(address _minter, address _crvToken) public { CURVE_GAUGE_V2_REWARDS_HANDLER_CRV_TOKEN = _crvToken; CURVE_GAUGE_V2_REWARDS_HANDLER_MINTER = _minter; } /// @dev Helper to claim all rewards (CRV and pool-specific). /// Requires contract to be approved to use mint_for(). function __curveGaugeV2ClaimAllRewards(address _gauge, address _target) internal { // Claim owed $CRV ICurveMinter(CURVE_GAUGE_V2_REWARDS_HANDLER_MINTER).mint_for(_gauge, _target); // Claim owed pool-specific rewards __curveGaugeV2ClaimRewards(_gauge, _target); } /// @dev Helper to get all rewards tokens for staking LP tokens function __curveGaugeV2GetRewardsTokensWithCrv(address _gauge) internal view returns (address[] memory rewardsTokens_) { return __curveGaugeV2GetRewardsTokens(_gauge).addUniqueItem( CURVE_GAUGE_V2_REWARDS_HANDLER_CRV_TOKEN ); } /////////////////// // STATE GETTERS // /////////////////// /// @notice Gets the `CURVE_GAUGE_V2_REWARDS_HANDLER_CRV_TOKEN` variable /// @return crvToken_ The `CURVE_GAUGE_V2_REWARDS_HANDLER_CRV_TOKEN` variable value function getCurveGaugeV2RewardsHandlerCrvToken() public view returns (address crvToken_) { return CURVE_GAUGE_V2_REWARDS_HANDLER_CRV_TOKEN; } /// @notice Gets the `CURVE_GAUGE_V2_REWARDS_HANDLER_MINTER` variable /// @return minter_ The `CURVE_GAUGE_V2_REWARDS_HANDLER_MINTER` variable value function getCurveGaugeV2RewardsHandlerMinter() public view returns (address minter_) { return CURVE_GAUGE_V2_REWARDS_HANDLER_MINTER; } } // SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "../../../../../interfaces/ICurveStableSwapSeth.sol"; import "../../../../../interfaces/IWETH.sol"; /// @title CurveSethLiquidityActionsMixin Contract /// @author Enzyme Council <[email protected]> /// @notice Mixin contract for interacting with the Curve seth pool's liquidity functions /// @dev Inheriting contract must have a receive() function abstract contract CurveSethLiquidityActionsMixin { using SafeERC20 for ERC20; int128 private constant CURVE_SETH_POOL_INDEX_ETH = 0; int128 private constant CURVE_SETH_POOL_INDEX_SETH = 1; address private immutable CURVE_SETH_LIQUIDITY_POOL; address private immutable CURVE_SETH_LIQUIDITY_WETH_TOKEN; constructor( address _pool, address _sethToken, address _wethToken ) public { CURVE_SETH_LIQUIDITY_POOL = _pool; CURVE_SETH_LIQUIDITY_WETH_TOKEN = _wethToken; // Pre-approve pool to use max of seth token ERC20(_sethToken).safeApprove(_pool, type(uint256).max); } /// @dev Helper to add liquidity to the pool function __curveSethLend( uint256 _outgoingWethAmount, uint256 _outgoingSethAmount, uint256 _minIncomingLPTokenAmount ) internal { if (_outgoingWethAmount > 0) { IWETH((CURVE_SETH_LIQUIDITY_WETH_TOKEN)).withdraw(_outgoingWethAmount); } ICurveStableSwapSeth(CURVE_SETH_LIQUIDITY_POOL).add_liquidity{value: _outgoingWethAmount}( [_outgoingWethAmount, _outgoingSethAmount], _minIncomingLPTokenAmount ); } /// @dev Helper to remove liquidity from the pool. // Assumes that if _redeemSingleAsset is true, then // "_minIncomingWethAmount > 0 XOR _minIncomingSethAmount > 0" has already been validated. function __curveSethRedeem( uint256 _outgoingLPTokenAmount, uint256 _minIncomingWethAmount, uint256 _minIncomingSethAmount, bool _redeemSingleAsset ) internal { if (_redeemSingleAsset) { if (_minIncomingWethAmount > 0) { ICurveStableSwapSeth(CURVE_SETH_LIQUIDITY_POOL).remove_liquidity_one_coin( _outgoingLPTokenAmount, CURVE_SETH_POOL_INDEX_ETH, _minIncomingWethAmount ); IWETH(payable(CURVE_SETH_LIQUIDITY_WETH_TOKEN)).deposit{ value: payable(address(this)).balance }(); } else { ICurveStableSwapSeth(CURVE_SETH_LIQUIDITY_POOL).remove_liquidity_one_coin( _outgoingLPTokenAmount, CURVE_SETH_POOL_INDEX_SETH, _minIncomingSethAmount ); } } else { ICurveStableSwapSeth(CURVE_SETH_LIQUIDITY_POOL).remove_liquidity( _outgoingLPTokenAmount, [_minIncomingWethAmount, _minIncomingSethAmount] ); IWETH(payable(CURVE_SETH_LIQUIDITY_WETH_TOKEN)).deposit{ value: payable(address(this)).balance }(); } } /////////////////// // STATE GETTERS // /////////////////// /// @notice Gets the `CURVE_SETH_LIQUIDITY_POOL` variable /// @return pool_ The `CURVE_SETH_LIQUIDITY_POOL` variable value function getCurveSethLiquidityPool() public view returns (address pool_) { return CURVE_SETH_LIQUIDITY_POOL; } /// @notice Gets the `CURVE_SETH_LIQUIDITY_WETH_TOKEN` variable /// @return wethToken_ The `CURVE_SETH_LIQUIDITY_WETH_TOKEN` variable value function getCurveSethLiquidityWethToken() public view returns (address wethToken_) { return CURVE_SETH_LIQUIDITY_WETH_TOKEN; } } // SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; /// @title ICurveLiquidityGaugeV2 interface /// @author Enzyme Council <[email protected]> interface ICurveLiquidityGaugeV2 { function claim_rewards(address) external; function deposit(uint256, address) external; function reward_tokens(uint256) external view returns (address); function withdraw(uint256) external; } // SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; /// @title ICurveMinter interface /// @author Enzyme Council <[email protected]> interface ICurveMinter { function mint_for(address, address) external; } // SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; /// @title ICurveStableSwapSeth interface /// @author Enzyme Council <[email protected]> interface ICurveStableSwapSeth { function add_liquidity(uint256[2] calldata, uint256) external payable returns (uint256); function remove_liquidity(uint256, uint256[2] calldata) external returns (uint256[2] memory); function remove_liquidity_one_coin( uint256, int128, uint256 ) external returns (uint256); } // SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; /// @title WETH Interface /// @author Enzyme Council <[email protected]> interface IWETH { function deposit() external payable; function withdraw(uint256) external; } // SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; /// @title AddressArray Library /// @author Enzyme Council <[email protected]> /// @notice A library to extend the address array data type library AddressArrayLib { ///////////// // STORAGE // ///////////// /// @dev Helper to remove an item from a storage array function removeStorageItem(address[] storage _self, address _itemToRemove) internal returns (bool removed_) { uint256 itemCount = _self.length; for (uint256 i; i < itemCount; i++) { if (_self[i] == _itemToRemove) { if (i < itemCount - 1) { _self[i] = _self[itemCount - 1]; } _self.pop(); removed_ = true; break; } } return removed_; } //////////// // MEMORY // //////////// /// @dev Helper to add an item to an array. Does not assert uniqueness of the new item. function addItem(address[] memory _self, address _itemToAdd) internal pure returns (address[] memory nextArray_) { nextArray_ = new address[](_self.length + 1); for (uint256 i; i < _self.length; i++) { nextArray_[i] = _self[i]; } nextArray_[_self.length] = _itemToAdd; return nextArray_; } /// @dev Helper to add an item to an array, only if it is not already in the array. function addUniqueItem(address[] memory _self, address _itemToAdd) internal pure returns (address[] memory nextArray_) { if (contains(_self, _itemToAdd)) { return _self; } return addItem(_self, _itemToAdd); } /// @dev Helper to verify if an array contains a particular value function contains(address[] memory _self, address _target) internal pure returns (bool doesContain_) { for (uint256 i; i < _self.length; i++) { if (_target == _self[i]) { return true; } } return false; } /// @dev Helper to merge the unique items of a second array. /// Does not consider uniqueness of either array, only relative uniqueness. /// Preserves ordering. function mergeArray(address[] memory _self, address[] memory _arrayToMerge) internal pure returns (address[] memory nextArray_) { uint256 newUniqueItemCount; for (uint256 i; i < _arrayToMerge.length; i++) { if (!contains(_self, _arrayToMerge[i])) { newUniqueItemCount++; } } if (newUniqueItemCount == 0) { return _self; } nextArray_ = new address[](_self.length + newUniqueItemCount); for (uint256 i; i < _self.length; i++) { nextArray_[i] = _self[i]; } uint256 nextArrayIndex = _self.length; for (uint256 i; i < _arrayToMerge.length; i++) { if (!contains(_self, _arrayToMerge[i])) { nextArray_[nextArrayIndex] = _arrayToMerge[i]; nextArrayIndex++; } } return nextArray_; } /// @dev Helper to verify if array is a set of unique values. /// Does not assert length > 0. function isUniqueSet(address[] memory _self) internal pure returns (bool isUnique_) { if (_self.length <= 1) { return true; } uint256 arrayLength = _self.length; for (uint256 i; i < arrayLength; i++) { for (uint256 j = i + 1; j < arrayLength; j++) { if (_self[i] == _self[j]) { return false; } } } return true; } /// @dev Helper to remove items from an array. Removes all matching occurrences of each item. /// Does not assert uniqueness of either array. function removeItems(address[] memory _self, address[] memory _itemsToRemove) internal pure returns (address[] memory nextArray_) { if (_itemsToRemove.length == 0) { return _self; } bool[] memory indexesToRemove = new bool[](_self.length); uint256 remainingItemsCount = _self.length; for (uint256 i; i < _self.length; i++) { if (contains(_itemsToRemove, _self[i])) { indexesToRemove[i] = true; remainingItemsCount--; } } if (remainingItemsCount == _self.length) { nextArray_ = _self; } else if (remainingItemsCount > 0) { nextArray_ = new address[](remainingItemsCount); uint256 nextArrayIndex; for (uint256 i; i < _self.length; i++) { if (!indexesToRemove[i]) { nextArray_[nextArrayIndex] = _self[i]; nextArrayIndex++; } } } return nextArray_; } } // SPDX-License-Identifier: GPL-3.0 /* This file is part of the Enzyme Protocol. (c) Enzyme Council <[email protected]> For the full license information, please view the LICENSE file that was distributed with this source code. */ pragma solidity 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; /// @title AssetHelpers Contract /// @author Enzyme Council <[email protected]> /// @notice A util contract for common token actions abstract contract AssetHelpers { using SafeERC20 for ERC20; using SafeMath for uint256; /// @dev Helper to approve a target account with the max amount of an asset. /// This is helpful for fully trusted contracts, such as adapters that /// interact with external protocol like Uniswap, Compound, etc. function __approveAssetMaxAsNeeded( address _asset, address _target, uint256 _neededAmount ) internal { uint256 allowance = ERC20(_asset).allowance(address(this), _target); if (allowance < _neededAmount) { if (allowance > 0) { ERC20(_asset).safeApprove(_target, 0); } ERC20(_asset).safeApprove(_target, type(uint256).max); } } /// @dev Helper to transfer full asset balances from the current contract to a target function __pushFullAssetBalances(address _target, address[] memory _assets) internal returns (uint256[] memory amountsTransferred_) { amountsTransferred_ = new uint256[](_assets.length); for (uint256 i; i < _assets.length; i++) { ERC20 assetContract = ERC20(_assets[i]); amountsTransferred_[i] = assetContract.balanceOf(address(this)); if (amountsTransferred_[i] > 0) { assetContract.safeTransfer(_target, amountsTransferred_[i]); } } return amountsTransferred_; } }
@notice Unstakes seth LP tokens @param _vaultProxy The VaultProxy of the calling fund @param _actionData Data specific to this action @param _assetData Parsed spend assets and incoming assets data for this action
function unstake( address _vaultProxy, bytes calldata _actionData, bytes calldata _assetData ) external onlyIntegrationManager postActionIncomingAssetsTransferHandler(_vaultProxy, _assetData) { __curveGaugeV2Unstake(LIQUIDITY_GAUGE_TOKEN, __decodeUnstakeCallArgs(_actionData)); }
13,420,300
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 20392, 1351, 334, 3223, 444, 76, 511, 52, 2430, 632, 891, 389, 26983, 3886, 1021, 17329, 3886, 434, 326, 4440, 284, 1074, 632, 891, 389, 1128, 751, 1910, 2923, 358, 333, 1301, 632, 891, 389, 9406, 751, 19244, 17571, 7176, 471, 6935, 7176, 501, 364, 333, 1301, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 640, 334, 911, 12, 203, 3639, 1758, 389, 26983, 3886, 16, 203, 3639, 1731, 745, 892, 389, 1128, 751, 16, 203, 3639, 1731, 745, 892, 389, 9406, 751, 203, 565, 262, 203, 3639, 3903, 203, 3639, 1338, 15372, 1318, 203, 3639, 1603, 1803, 20370, 10726, 5912, 1503, 24899, 26983, 3886, 16, 389, 9406, 751, 13, 203, 565, 288, 203, 3639, 1001, 16683, 18941, 58, 22, 984, 334, 911, 12, 2053, 53, 3060, 4107, 67, 43, 27738, 67, 8412, 16, 1001, 3922, 984, 334, 911, 1477, 2615, 24899, 1128, 751, 10019, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/80001/0xC983670234A6E4a2AB4A432cDBABC3F05274460e/sources/PolyApart/chef/PolyApartMasterChef.sol
Accumulated APARTs per share, times 1e18. See below.
uint256 accApartPerShare;
9,511,972
[ 1, 4625, 348, 7953, 560, 30, 225, 15980, 5283, 690, 432, 15055, 87, 1534, 7433, 16, 4124, 404, 73, 2643, 18, 2164, 5712, 18, 203, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 3639, 2254, 5034, 4078, 1294, 485, 2173, 9535, 31, 225, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/1/0x492B6F8A53D1c42cC2DD352788a6C02c557BE9F5/sources/contracts/chainlink/common/ChainLinkAutomation.sol
@notice Set the interval between when checkUpkeep should run its internal logic, 0 will mean it will run every block @param _interval Interval in seconds
function setInterval(uint _interval) external onlyOwner { interval = _interval; emit IntervalUpdated(_interval); }
3,190,034
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 20392, 1000, 326, 3673, 3086, 1347, 866, 1211, 10102, 1410, 1086, 2097, 2713, 4058, 16, 374, 903, 3722, 518, 903, 1086, 3614, 1203, 632, 891, 389, 6624, 10803, 316, 3974, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 27058, 12, 11890, 389, 6624, 13, 3903, 1338, 5541, 288, 203, 3639, 3673, 273, 389, 6624, 31, 203, 3639, 3626, 10803, 7381, 24899, 6624, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/5/0x8a44aF939D25C17f55088ea06bFCD43A80dB4f85/sources/src/MSSC.sol
* @notice Withdraw funds from a settlement. Caller must be the sender of instruction. @param instructionId Instruction to withdraw deposited funds from./
function withdraw(bytes32 cycleId, bytes32 instructionId) external cycleExists(cycleId) { _instructions[instructionId].withdraw(); LockManagerLib.LockInfo storage lock = _cycles[cycleId].lock; if ( _isHybrid(cycleId) && lock.status == LockManagerLib.LockStatus.INITIALIZED ) { lock.disrupt(cycleId); } }
7,090,372
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 20392, 3423, 9446, 284, 19156, 628, 279, 26319, 806, 18, 20646, 1297, 506, 326, 5793, 434, 7592, 18, 632, 891, 225, 7592, 548, 24605, 358, 598, 9446, 443, 1724, 329, 284, 19156, 628, 18, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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502, 2176, 273, 389, 23976, 63, 13946, 548, 8009, 739, 31, 203, 203, 3639, 309, 261, 203, 5411, 389, 291, 17507, 14400, 12, 13946, 548, 13, 597, 203, 5411, 2176, 18, 2327, 422, 3488, 1318, 5664, 18, 2531, 1482, 18, 12919, 25991, 203, 3639, 262, 288, 203, 5411, 2176, 18, 2251, 10433, 12, 13946, 548, 1769, 203, 3639, 289, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./partial_match/56/0xa9eB28df890A88077487eBEF47974527656433E6/sources/MasterPepe.sol
Accumulated SPBs per share, times 1e12. See below.
uint256 accPepePerShare;
11,088,612
[ 1, 4625, 348, 7953, 560, 30, 225, 15980, 5283, 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 5034, 4078, 11227, 347, 2173, 9535, 31, 225, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./partial_match/1/0x4f19e6A97778417C33AA6034089378b093619fe5/sources/src/utils/Math.sol
* @dev Returns the absolute value of a signed integer./ Equivalent to: result = a > 0 ? uint256(a) : uint256(-a)
function abs(int256 a) internal pure returns (uint256 result) { assembly { let s := sar(255, a) result := sub(xor(a, s), s) } }
4,075,396
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 2860, 326, 4967, 460, 434, 279, 6726, 3571, 18, 19, 31208, 358, 30, 563, 273, 279, 405, 374, 692, 2254, 5034, 12, 69, 13, 294, 2254, 5034, 19236, 69, 13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 2417, 12, 474, 5034, 279, 13, 2713, 16618, 1135, 261, 11890, 5034, 563, 13, 288, 203, 3639, 19931, 288, 203, 5411, 2231, 272, 519, 272, 297, 12, 10395, 16, 279, 13, 203, 5411, 563, 519, 720, 12, 31346, 12, 69, 16, 272, 3631, 272, 13, 203, 3639, 289, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// File: contracts/interfaces/IPriceModule.sol // SPDX-License-Identifier: MIT pragma solidity >=0.5.0 <0.7.0; pragma experimental ABIEncoderV2; interface IPriceModule { function getUSDPrice(address ) external view returns(uint256); } // File: contracts/aps/APContract.sol // SPDX-License-Identifier: MIT pragma solidity >=0.5.0 <0.7.0; // pragma experimental ABIEncoderV2; contract APContract { address public yieldsterDAO; address public yieldsterTreasury; address public yieldsterGOD; address public emergencyVault; address public yieldsterExchange; address public stringUtils; address public whitelistModule; address public whitelistManager; address public proxyFactory; address public priceModule; address public platFormManagementFee; address public profitManagementFee; address public stockDeposit; address public stockWithdraw; address public safeMinter; address public safeUtils; address public oneInch; struct Asset{ string name; string symbol; bool created; } struct Protocol{ string name; string symbol; bool created; } struct Vault { mapping(address => bool) vaultAssets; mapping(address => bool) vaultDepositAssets; mapping(address => bool) vaultWithdrawalAssets; mapping(address => bool) vaultEnabledStrategy; address depositStrategy; address withdrawStrategy; address vaultAPSManager; address vaultStrategyManager; uint256[] whitelistGroup; bool created; } struct VaultActiveStrategy { mapping(address => bool) isActiveStrategy; mapping(address => uint256) activeStrategyIndex; address[] activeStrategyList; } struct Strategy{ string strategyName; mapping(address => bool) strategyProtocols; bool created; address minter; address executor; address benefeciary; uint256 managementFeePercentage; } struct SmartStrategy{ string smartStrategyName; address minter; address executor; bool created; } struct vaultActiveManagemetFee { mapping(address => bool) isActiveManagementFee; mapping(address => uint256) activeManagementFeeIndex; address[] activeManagementFeeList; } event VaultCreation(address vaultAddress); mapping(address => vaultActiveManagemetFee) managementFeeStrategies; mapping(address => mapping(address => mapping(address => bool))) vaultStrategyEnabledProtocols; mapping(address => VaultActiveStrategy) vaultActiveStrategies; mapping(address => Asset) assets; mapping(address => Protocol) protocols; mapping(address => Vault) vaults; mapping(address => Strategy) strategies; mapping(address => SmartStrategy) smartStrategies; mapping(address => address) safeOwner; mapping(address => bool) APSManagers; mapping(address => address) minterStrategyMap; constructor( address _whitelistModule, address _platformManagementFee, address _profitManagementFee, address _stringUtils, address _yieldsterExchange, address _oneInch, address _priceModule, address _safeUtils ) public { yieldsterDAO = msg.sender; yieldsterTreasury = msg.sender; yieldsterGOD = msg.sender; emergencyVault = msg.sender; APSManagers[msg.sender] = true; whitelistModule = _whitelistModule; platFormManagementFee = _platformManagementFee; stringUtils = _stringUtils; yieldsterExchange = _yieldsterExchange; oneInch = _oneInch; priceModule = _priceModule; safeUtils = _safeUtils; profitManagementFee = _profitManagementFee; } /// @dev Function to add proxy Factory address to Yieldster. /// @param _proxyFactory Address of proxy factory. function addProxyFactory(address _proxyFactory) public onlyManager { proxyFactory = _proxyFactory; } function setProfitAndPlatformManagementFeeStrategies(address _platformManagement,address _profitManagement) public onlyYieldsterDAO { if (_profitManagement != address(0)) profitManagementFee = _profitManagement; if (_platformManagement != address(0)) platFormManagementFee = _platformManagement; } //Modifiers modifier onlyYieldsterDAO{ require(yieldsterDAO == msg.sender, "Only Yieldster DAO is allowed to perform this operation"); _; } modifier onlyManager{ require(APSManagers[msg.sender], "Only APS managers allowed to perform this operation!"); _; } modifier onlySafeOwner{ require(safeOwner[msg.sender] == tx.origin, "Only safe Owner can perform this operation"); _; } function isVault( address _address) public view returns(bool){ return vaults[_address].created; } /// @dev Function to add APS manager to Yieldster. /// @param _manager Address of the manager. function addManager(address _manager) public onlyYieldsterDAO { APSManagers[_manager] = true; } /// @dev Function to remove APS manager from Yieldster. /// @param _manager Address of the manager. function removeManager(address _manager) public onlyYieldsterDAO { APSManagers[_manager] = false; } /// @dev Function to change whitelist Manager. /// @param _whitelistManager Address of the whitelist manager. function changeWhitelistManager(address _whitelistManager) public onlyYieldsterDAO { whitelistManager = _whitelistManager; } /// @dev Function to set Yieldster GOD. /// @param _yieldsterGOD Address of the Yieldster GOD. function setYieldsterGOD(address _yieldsterGOD) public { require(msg.sender == yieldsterGOD, "Only Yieldster GOD can perform this operation"); yieldsterGOD = _yieldsterGOD; } /// @dev Function to disable Yieldster GOD. function disableYieldsterGOD() public { require(msg.sender == yieldsterGOD, "Only Yieldster GOD can perform this operation"); yieldsterGOD = address(0); } /// @dev Function to set Emergency vault. /// @param _emergencyVault Address of the Yieldster Emergency vault. function setEmergencyVault(address _emergencyVault) onlyYieldsterDAO public { emergencyVault = _emergencyVault; } /// @dev Function to set Safe Minter. /// @param _safeMinter Address of the Safe Minter. function setSafeMinter(address _safeMinter) onlyYieldsterDAO public { safeMinter = _safeMinter; } /// @dev Function to set safeUtils contract. /// @param _safeUtils Address of the safeUtils contract. function setSafeUtils(address _safeUtils) onlyYieldsterDAO public { safeUtils = _safeUtils; } /// @dev Function to set oneInch address. /// @param _oneInch Address of the oneInch. function setOneInch(address _oneInch) onlyYieldsterDAO public { oneInch = _oneInch; } /// @dev Function to get strategy address from minter. /// @param _minter Address of the minter. function getStrategyFromMinter(address _minter) external view returns(address) { return minterStrategyMap[_minter]; } /// @dev Function to set Yieldster Exchange. /// @param _yieldsterExchange Address of the Yieldster exchange. function setYieldsterExchange(address _yieldsterExchange) onlyYieldsterDAO public { yieldsterExchange = _yieldsterExchange; } /// @dev Function to set stock Deposit and Withdraw. /// @param _stockDeposit Address of the stock deposit contract. /// @param _stockWithdraw Address of the stock withdraw contract. function setStockDepositWithdraw(address _stockDeposit, address _stockWithdraw) onlyYieldsterDAO public { stockDeposit = _stockDeposit; stockWithdraw = _stockWithdraw; } /// @dev Function to change the APS Manager for a vault. /// @param _vaultAPSManager Address of the new APS Manager. function changeVaultAPSManager(address _vaultAPSManager) external { require(vaults[msg.sender].created, "Vault is not present"); vaults[msg.sender].vaultAPSManager = _vaultAPSManager; } /// @dev Function to change the Strategy Manager for a vault. /// @param _vaultStrategyManager Address of the new Strategy Manager. function changeVaultStrategyManager(address _vaultStrategyManager) external { require(vaults[msg.sender].created, "Vault is not present"); vaults[msg.sender].vaultStrategyManager = _vaultStrategyManager; } //Price Module /// @dev Function to set Yieldster price module. /// @param _priceModule Address of the price module. function setPriceModule(address _priceModule) public onlyManager { priceModule = _priceModule; } /// @dev Function to get the USD price for a token. /// @param _tokenAddress Address of the token. function getUSDPrice(address _tokenAddress) public view returns(uint256) { require(_isAssetPresent(_tokenAddress),"Asset not present!"); return IPriceModule(priceModule).getUSDPrice(_tokenAddress); } //Vaults /// @dev Function to create a vault. /// @param _owner Address of the owner of the vault. /// @param _vaultAddress Address of the new vault. function createVault(address _owner, address _vaultAddress) public { require(msg.sender == proxyFactory, "Only Proxy Factory can perform this operation"); safeOwner[_vaultAddress] = _owner; } /// @dev Function to add a vault in the APS. /// @param _vaultAPSManager Address of the vaults APS Manager. /// @param _vaultStrategyManager Address of the vaults Strateg Manager. /// @param _whitelistGroup List of whitelist groups applied to the vault. /// @param _owner Address of the vault owner. function addVault( address _vaultAPSManager, address _vaultStrategyManager, uint256[] memory _whitelistGroup, address _owner ) public { require(safeOwner[msg.sender] == _owner, "Only owner can call this function"); Vault memory newVault = Vault( { vaultAPSManager : _vaultAPSManager, vaultStrategyManager : _vaultStrategyManager, whitelistGroup : _whitelistGroup, depositStrategy: stockDeposit, withdrawStrategy: stockWithdraw, created : true }); vaults[msg.sender] = newVault; //applying Platform management fee managementFeeStrategies[msg.sender].isActiveManagementFee[platFormManagementFee] = true; managementFeeStrategies[msg.sender].activeManagementFeeIndex[platFormManagementFee] = managementFeeStrategies[msg.sender].activeManagementFeeList.length; managementFeeStrategies[msg.sender].activeManagementFeeList.push(platFormManagementFee); //applying Profit management fee managementFeeStrategies[msg.sender].isActiveManagementFee[profitManagementFee] = true; managementFeeStrategies[msg.sender].activeManagementFeeIndex[profitManagementFee] = managementFeeStrategies[msg.sender].activeManagementFeeList.length; managementFeeStrategies[msg.sender].activeManagementFeeList.push(profitManagementFee); } /// @dev Function to Manage the vault assets. /// @param _enabledDepositAsset List of deposit assets to be enabled in the vault. /// @param _enabledWithdrawalAsset List of withdrawal assets to be enabled in the vault. /// @param _disabledDepositAsset List of deposit assets to be disabled in the vault. /// @param _disabledWithdrawalAsset List of withdrawal assets to be disabled in the vault. function setVaultAssets( address[] memory _enabledDepositAsset, address[] memory _enabledWithdrawalAsset, address[] memory _disabledDepositAsset, address[] memory _disabledWithdrawalAsset ) public { require(vaults[msg.sender].created, "Vault not present"); for (uint256 i = 0; i < _enabledDepositAsset.length; i++) { address asset = _enabledDepositAsset[i]; require(_isAssetPresent(asset), "Asset not supported by Yieldster"); vaults[msg.sender].vaultAssets[asset] = true; vaults[msg.sender].vaultDepositAssets[asset] = true; } for (uint256 i = 0; i < _enabledWithdrawalAsset.length; i++) { address asset = _enabledWithdrawalAsset[i]; require(_isAssetPresent(asset), "Asset not supported by Yieldster"); vaults[msg.sender].vaultAssets[asset] = true; vaults[msg.sender].vaultWithdrawalAssets[asset] = true; } for (uint256 i = 0; i < _disabledDepositAsset.length; i++) { address asset = _disabledDepositAsset[i]; require(_isAssetPresent(asset), "Asset not supported by Yieldster"); vaults[msg.sender].vaultAssets[asset] = false; vaults[msg.sender].vaultDepositAssets[asset] = false; } for (uint256 i = 0; i < _disabledWithdrawalAsset.length; i++) { address asset = _disabledWithdrawalAsset[i]; require(_isAssetPresent(asset), "Asset not supported by Yieldster"); vaults[msg.sender].vaultAssets[asset] = false; vaults[msg.sender].vaultWithdrawalAssets[asset] = false; } } /// @dev Function to get the list of management fee strategies applied to the vault. function getVaultManagementFee() public view returns(address[] memory) { require(vaults[msg.sender].created, "Vault not present"); return managementFeeStrategies[msg.sender].activeManagementFeeList; } /// @dev Function to get the deposit strategy applied to the vault. function getDepositStrategy() public view returns(address) { require(vaults[msg.sender].created, "Vault not present"); return vaults[msg.sender].depositStrategy; } /// @dev Function to get the withdrawal strategy applied to the vault. function getWithdrawStrategy() public view returns(address) { require(vaults[msg.sender].created, "Vault not present"); return vaults[msg.sender].withdrawStrategy; } /// @dev Function to set the management fee strategies applied to a vault. /// @param _vaultAddress Address of the vault. /// @param _managementFeeAddress Address of the management fee strategy. function setManagementFeeStrategies(address _vaultAddress, address _managementFeeAddress) public { require(vaults[_vaultAddress].created, "Vault not present"); require(vaults[_vaultAddress].vaultStrategyManager == msg.sender, "Sender not Authorized"); managementFeeStrategies[_vaultAddress].isActiveManagementFee[_managementFeeAddress] = true; managementFeeStrategies[_vaultAddress].activeManagementFeeIndex[_managementFeeAddress] = managementFeeStrategies[_vaultAddress].activeManagementFeeList.length; managementFeeStrategies[_vaultAddress].activeManagementFeeList.push(_managementFeeAddress); } /// @dev Function to deactivate a vault strategy. /// @param _managementFeeAddress Address of the Management Fee Strategy. function removeManagementFeeStrategies(address _vaultAddress, address _managementFeeAddress) public { require(vaults[_vaultAddress].created, "Vault not present"); require(managementFeeStrategies[_vaultAddress].isActiveManagementFee[_managementFeeAddress], "Provided ManagementFee is not active"); require(vaults[_vaultAddress].vaultStrategyManager == msg.sender || yieldsterDAO == msg.sender, "Sender not Authorized"); require(platFormManagementFee != _managementFeeAddress || yieldsterDAO == msg.sender,"Platfrom Management only changable by dao!"); managementFeeStrategies[_vaultAddress].isActiveManagementFee[_managementFeeAddress] = false; if(managementFeeStrategies[_vaultAddress].activeManagementFeeList.length == 1) { managementFeeStrategies[_vaultAddress].activeManagementFeeList.pop(); } else { uint256 index = managementFeeStrategies[_vaultAddress].activeManagementFeeIndex[_managementFeeAddress]; uint256 lastIndex = managementFeeStrategies[_vaultAddress].activeManagementFeeList.length - 1; delete managementFeeStrategies[_vaultAddress].activeManagementFeeList[index]; managementFeeStrategies[_vaultAddress].activeManagementFeeIndex[managementFeeStrategies[_vaultAddress].activeManagementFeeList[lastIndex]] = index; managementFeeStrategies[_vaultAddress].activeManagementFeeList[index] = managementFeeStrategies[_vaultAddress].activeManagementFeeList[lastIndex]; managementFeeStrategies[_vaultAddress].activeManagementFeeList.pop(); } } /// @dev Function to set vault active strategy. /// @param _strategyAddress Address of the strategy. function setVaultActiveStrategy(address _strategyAddress) public { require(vaults[msg.sender].created, "Vault not present"); require(strategies[_strategyAddress].created, "Strategy not present"); vaultActiveStrategies[msg.sender].isActiveStrategy[_strategyAddress] = true; vaultActiveStrategies[msg.sender].activeStrategyIndex[_strategyAddress] = vaultActiveStrategies[msg.sender].activeStrategyList.length; vaultActiveStrategies[msg.sender].activeStrategyList.push(_strategyAddress); } /// @dev Function to deactivate a vault strategy. /// @param _strategyAddress Address of the strategy. function deactivateVaultStrategy(address _strategyAddress) public { require(vaults[msg.sender].created, "Vault not present"); require(vaultActiveStrategies[msg.sender].isActiveStrategy[_strategyAddress], "Provided strategy is not active"); vaultActiveStrategies[msg.sender].isActiveStrategy[_strategyAddress] = false; if(vaultActiveStrategies[msg.sender].activeStrategyList.length == 1) { vaultActiveStrategies[msg.sender].activeStrategyList.pop(); } else { uint256 index = vaultActiveStrategies[msg.sender].activeStrategyIndex[_strategyAddress]; uint256 lastIndex = vaultActiveStrategies[msg.sender].activeStrategyList.length - 1; delete vaultActiveStrategies[msg.sender].activeStrategyList[index]; vaultActiveStrategies[msg.sender].activeStrategyIndex[vaultActiveStrategies[msg.sender].activeStrategyList[lastIndex]] = index; vaultActiveStrategies[msg.sender].activeStrategyList[index] = vaultActiveStrategies[msg.sender].activeStrategyList[lastIndex]; vaultActiveStrategies[msg.sender].activeStrategyList.pop(); } } /// @dev Function to get vault active strategy. function getVaultActiveStrategy(address _vaultAddress) public view returns(address[] memory) { require(vaults[_vaultAddress].created, "Vault not present"); return vaultActiveStrategies[_vaultAddress].activeStrategyList; } function isStrategyActive(address _vaultAddress, address _strategyAddress) public view returns(bool) { return vaultActiveStrategies[_vaultAddress].isActiveStrategy[_strategyAddress]; } function getStrategyManagementDetails(address _vaultAddress, address _strategyAddress) public view returns(address, uint256) { require(vaults[_vaultAddress].created, "Vault not present"); require(strategies[_strategyAddress].created, "Strategy not present"); require(vaultActiveStrategies[_vaultAddress].isActiveStrategy[_strategyAddress], "Strategy not Active"); return (strategies[_strategyAddress].benefeciary, strategies[_strategyAddress].managementFeePercentage); } /// @dev Function to Manage the vault strategies. /// @param _vaultStrategy Address of the strategy. /// @param _enabledStrategyProtocols List of protocols that are enabled in the strategy. /// @param _disabledStrategyProtocols List of protocols that are disabled in the strategy. /// @param _assetsToBeEnabled List of assets that have to be enabled along with the strategy. function setVaultStrategyAndProtocol( address _vaultStrategy, address[] memory _enabledStrategyProtocols, address[] memory _disabledStrategyProtocols, address[] memory _assetsToBeEnabled ) public { require(vaults[msg.sender].created, "Vault not present"); require(strategies[_vaultStrategy].created, "Strategy not present"); vaults[msg.sender].vaultEnabledStrategy[_vaultStrategy] = true; for (uint256 i = 0; i < _enabledStrategyProtocols.length; i++) { address protocol = _enabledStrategyProtocols[i]; require(_isProtocolPresent(protocol), "Protocol not supported by Yieldster"); vaultStrategyEnabledProtocols[msg.sender][_vaultStrategy][protocol] = true; } for (uint256 i = 0; i < _disabledStrategyProtocols.length; i++) { address protocol = _disabledStrategyProtocols[i]; require(_isProtocolPresent(protocol), "Protocol not supported by Yieldster"); vaultStrategyEnabledProtocols[msg.sender][_vaultStrategy][protocol] = false; } for (uint256 i = 0; i < _assetsToBeEnabled.length; i++) { address asset = _assetsToBeEnabled[i]; require(_isAssetPresent(asset), "Asset not supported by Yieldster"); vaults[msg.sender].vaultAssets[asset] = true; vaults[msg.sender].vaultDepositAssets[asset] = true; vaults[msg.sender].vaultWithdrawalAssets[asset] = true; } } /// @dev Function to disable the vault strategies. /// @param _strategyAddress Address of the strategy. /// @param _assetsToBeDisabled List of assets that have to be disabled along with the strategy. function disableVaultStrategy(address _strategyAddress, address[] memory _assetsToBeDisabled) public { require(vaults[msg.sender].created, "Vault not present"); require(strategies[_strategyAddress].created, "Strategy not present"); require(vaults[msg.sender].vaultEnabledStrategy[_strategyAddress], "Strategy was not enabled"); vaults[msg.sender].vaultEnabledStrategy[_strategyAddress] = false; for (uint256 i = 0; i < _assetsToBeDisabled.length; i++) { address asset = _assetsToBeDisabled[i]; require(_isAssetPresent(asset), "Asset not supported by Yieldster"); vaults[msg.sender].vaultAssets[asset] = false; vaults[msg.sender].vaultDepositAssets[asset] = false; vaults[msg.sender].vaultWithdrawalAssets[asset] = false; } } /// @dev Function to set smart strategy applied to the vault. /// @param _smartStrategyAddress Address of the smart strategy. /// @param _type type of smart strategy(deposit or withdraw). function setVaultSmartStrategy(address _smartStrategyAddress, uint256 _type) public { require(vaults[msg.sender].created, "Vault not present"); require(_isSmartStrategyPresent(_smartStrategyAddress),"Smart Strategy not Supported by Yieldster"); if(_type == 1){ vaults[msg.sender].depositStrategy = _smartStrategyAddress; } else if(_type == 2){ vaults[msg.sender].withdrawStrategy = _smartStrategyAddress; } else{ revert("Invalid type provided"); } } /// @dev Function to check if a particular protocol is enabled in a strategy for a vault. /// @param _vaultAddress Address of the vault. /// @param _strategyAddress Address of the strategy. /// @param _protocolAddress Address of the protocol to check. function _isStrategyProtocolEnabled( address _vaultAddress, address _strategyAddress, address _protocolAddress ) public view returns(bool) { if( vaults[_vaultAddress].created && strategies[_strategyAddress].created && protocols[_protocolAddress].created && vaults[_vaultAddress].vaultEnabledStrategy[_strategyAddress] && vaultStrategyEnabledProtocols[_vaultAddress][_strategyAddress][_protocolAddress]){ return true; } else{ return false; } } /// @dev Function to check if a strategy is enabled for the vault. /// @param _vaultAddress Address of the vault. /// @param _strategyAddress Address of the strategy. function _isStrategyEnabled( address _vaultAddress, address _strategyAddress ) public view returns(bool) { if(vaults[_vaultAddress].created && strategies[_strategyAddress].created && vaults[_vaultAddress].vaultEnabledStrategy[_strategyAddress]){ return true; } else{ return false; } } /// @dev Function to check if the asset is supported by the vault. /// @param cleanUpAsset Address of the asset. function _isVaultAsset(address cleanUpAsset) public view returns(bool) { require(vaults[msg.sender].created, "Vault is not present"); return vaults[msg.sender].vaultAssets[cleanUpAsset]; } // Assets /// @dev Function to check if an asset is supported by Yieldster. /// @param _address Address of the asset. function _isAssetPresent(address _address) private view returns(bool) { return assets[_address].created; } /// @dev Function to add an asset to the Yieldster. /// @param _symbol Symbol of the asset. /// @param _name Name of the asset. /// @param _tokenAddress Address of the asset. function addAsset( string memory _symbol, string memory _name, address _tokenAddress ) public onlyManager { require(!_isAssetPresent(_tokenAddress),"Asset already present!"); Asset memory newAsset = Asset({name:_name, symbol:_symbol, created:true}); assets[_tokenAddress] = newAsset; } /// @dev Function to remove an asset from the Yieldster. /// @param _tokenAddress Address of the asset. function removeAsset(address _tokenAddress) public onlyManager { require(_isAssetPresent(_tokenAddress),"Asset not present!"); delete assets[_tokenAddress]; } /// @dev Function to check if an asset is supported deposit asset in the vault. /// @param _assetAddress Address of the asset. function isDepositAsset(address _assetAddress) public view returns(bool) { require(vaults[msg.sender].created, "Vault not present"); return vaults[msg.sender].vaultDepositAssets[_assetAddress]; } /// @dev Function to check if an asset is supported withdrawal asset in the vault. /// @param _assetAddress Address of the asset. function isWithdrawalAsset(address _assetAddress) public view returns(bool) { require(vaults[msg.sender].created, "Vault not present"); return vaults[msg.sender].vaultWithdrawalAssets[_assetAddress]; } //Strategies /// @dev Function to check if a strategy is supported by Yieldster. /// @param _address Address of the strategy. function _isStrategyPresent(address _address) private view returns(bool) { return strategies[_address].created; } /// @dev Function to add a strategy to Yieldster. /// @param _strategyName Name of the strategy. /// @param _strategyAddress Address of the strategy. /// @param _strategyAddress List of protocols present in the strategy. /// @param _minter Address of strategy minter. /// @param _executor Address of strategy executor. function addStrategy( string memory _strategyName, address _strategyAddress, address[] memory _strategyProtocols, address _minter, address _executor, address _benefeciary, uint256 _managementFeePercentage ) public onlyManager { require(!_isStrategyPresent(_strategyAddress),"Strategy already present!"); Strategy memory newStrategy = Strategy({ strategyName:_strategyName, created:true, minter:_minter, executor:_executor, benefeciary:_benefeciary, managementFeePercentage: _managementFeePercentage}); strategies[_strategyAddress] = newStrategy; minterStrategyMap[_minter] = _strategyAddress; for (uint256 i = 0; i < _strategyProtocols.length; i++) { address protocol = _strategyProtocols[i]; require(_isProtocolPresent(protocol), "Protocol not supported by Yieldster"); strategies[_strategyAddress].strategyProtocols[protocol] = true; } } /// @dev Function to remove a strategy from Yieldster. /// @param _strategyAddress Address of the strategy. function removeStrategy(address _strategyAddress) public onlyManager { require(_isStrategyPresent(_strategyAddress),"Strategy not present!"); delete strategies[_strategyAddress]; } /// @dev Function to get strategy executor address. /// @param _strategy Address of the strategy. function strategyExecutor(address _strategy) external view returns(address) { return strategies[_strategy].executor; } /// @dev Function to change executor of strategy. /// @param _strategyAddress Address of the strategy. /// @param _executor Address of the executor. function changeStrategyExecutor(address _strategyAddress, address _executor) public onlyManager { require(_isStrategyPresent(_strategyAddress),"Strategy not present!"); strategies[_strategyAddress].executor = _executor; } //Smart Strategy /// @dev Function to check if a smart strategy is supported by Yieldster. /// @param _address Address of the smart strategy. function _isSmartStrategyPresent(address _address) private view returns(bool) { return smartStrategies[_address].created; } /// @dev Function to add a smart strategy to Yieldster. /// @param _smartStrategyName Name of the smart strategy. /// @param _smartStrategyAddress Address of the smart strategy. function addSmartStrategy( string memory _smartStrategyName, address _smartStrategyAddress, address _minter, address _executor ) public onlyManager { require(!_isSmartStrategyPresent(_smartStrategyAddress),"Smart Strategy already present!"); SmartStrategy memory newSmartStrategy = SmartStrategy ({ smartStrategyName : _smartStrategyName, minter : _minter, executor : _executor, created : true }); smartStrategies[_smartStrategyAddress] = newSmartStrategy; minterStrategyMap[_minter] = _smartStrategyAddress; } /// @dev Function to remove a smart strategy from Yieldster. /// @param _smartStrategyAddress Address of the smart strategy. function removeSmartStrategy(address _smartStrategyAddress) public onlyManager { require(!_isSmartStrategyPresent(_smartStrategyAddress),"Smart Strategy not present"); delete smartStrategies[_smartStrategyAddress]; } /// @dev Function to get ssmart strategy executor address. /// @param _smartStrategy Address of the strategy. function smartStrategyExecutor(address _smartStrategy) external view returns(address) { return smartStrategies[_smartStrategy].executor; } /// @dev Function to change executor of smart strategy. /// @param _smartStrategy Address of the smart strategy. /// @param _executor Address of the executor. function changeSmartStrategyExecutor(address _smartStrategy, address _executor) public onlyManager { require(_isSmartStrategyPresent(_smartStrategy),"Smart Strategy not present!"); smartStrategies[_smartStrategy].executor = _executor; } // Protocols /// @dev Function to check if a protocol is supported by Yieldster. /// @param _address Address of the protocol. function _isProtocolPresent(address _address) private view returns(bool) { return protocols[_address].created; } /// @dev Function to add a protocol to Yieldster. /// @param _symbol symbol of the protocol. /// @param _name Name of the protocol. /// @param _protocolAddress Address of the protocol. function addProtocol( string memory _symbol, string memory _name, address _protocolAddress ) public onlyManager { require(!_isProtocolPresent(_protocolAddress),"Protocol already present!"); Protocol memory newProtocol = Protocol({ name:_name, created:true, symbol:_symbol }); protocols[_protocolAddress] = newProtocol; } /// @dev Function to remove a protocol from Yieldster. /// @param _protocolAddress Address of the protocol. function removeProtocol(address _protocolAddress) public onlyManager { require(_isProtocolPresent(_protocolAddress),"Protocol not present!"); delete protocols[_protocolAddress]; } }
@dev Function to check if the asset is supported by the vault. @param cleanUpAsset Address of the asset.
function _isVaultAsset(address cleanUpAsset) public view returns(bool) { require(vaults[msg.sender].created, "Vault is not present"); return vaults[msg.sender].vaultAssets[cleanUpAsset]; }
5,938,232
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 5206, 4284, 358, 866, 309, 326, 3310, 353, 3260, 635, 326, 9229, 18, 632, 891, 26384, 6672, 5267, 434, 326, 3310, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 389, 291, 12003, 6672, 12, 2867, 26384, 6672, 13, 203, 3639, 1071, 203, 3639, 1476, 203, 3639, 1135, 12, 6430, 13, 203, 565, 288, 203, 3639, 2583, 12, 26983, 87, 63, 3576, 18, 15330, 8009, 4824, 16, 315, 12003, 353, 486, 3430, 8863, 203, 3639, 327, 9229, 87, 63, 3576, 18, 15330, 8009, 26983, 10726, 63, 6200, 1211, 6672, 15533, 203, 203, 565, 289, 203, 3639, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./partial_match/42/0x2113B131d823778Bcd1b478f036F327301FEF17F/sources/BudCore.sol
bytes4(keccak256('onCryptoBudEnergyChanged(uint256,uint256,uint256)')) == 0x5a864e1c/ ========== EVENTS ========== */* @dev Event for when bud's thc changed from `fromEnergy`/ ========== OPERATOR ONLY FUNCTION ========== */
) external onlyOperator nonReentrant { require(_newThc > 0, "CryptoBuds: invalid thc"); require( isOwnerOf(_owner, _id), "CryptoBuds: bud does not belongs to owner" ); Bud storage thisBud = buds[_id]; uint32 oldThc = thisBud.thc; thisBud.thc = _newThc; emit ThcChanged(_id, oldThc, _newThc); _doSafeEnergyChangedAcceptanceCheck(_owner, _id, oldThc, _newThc); }
8,879,430
[ 1, 4625, 348, 7953, 560, 30, 225, 1731, 24, 12, 79, 24410, 581, 5034, 2668, 265, 18048, 38, 1100, 664, 31920, 5033, 12, 11890, 5034, 16, 11890, 5034, 16, 11890, 5034, 2506, 3719, 422, 374, 92, 25, 69, 28, 1105, 73, 21, 71, 19, 422, 1432, 9964, 55, 422, 1432, 1195, 14, 632, 5206, 2587, 364, 1347, 324, 1100, 1807, 286, 71, 3550, 628, 1375, 2080, 664, 31920, 68, 19, 422, 1432, 25500, 20747, 13690, 422, 1432, 1195, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 262, 3903, 1338, 5592, 1661, 426, 8230, 970, 288, 203, 3639, 2583, 24899, 2704, 1315, 71, 405, 374, 16, 315, 18048, 38, 1100, 87, 30, 2057, 286, 71, 8863, 203, 203, 3639, 2583, 12, 203, 5411, 353, 5541, 951, 24899, 8443, 16, 389, 350, 3631, 203, 5411, 315, 18048, 38, 1100, 87, 30, 324, 1100, 1552, 486, 11081, 358, 3410, 6, 203, 3639, 11272, 203, 203, 3639, 605, 1100, 2502, 333, 38, 1100, 273, 324, 1100, 87, 63, 67, 350, 15533, 203, 3639, 2254, 1578, 1592, 1315, 71, 273, 333, 38, 1100, 18, 451, 71, 31, 203, 3639, 333, 38, 1100, 18, 451, 71, 273, 389, 2704, 1315, 71, 31, 203, 203, 3639, 3626, 935, 71, 5033, 24899, 350, 16, 1592, 1315, 71, 16, 389, 2704, 1315, 71, 1769, 203, 3639, 389, 2896, 9890, 664, 31920, 5033, 5933, 1359, 1564, 24899, 8443, 16, 389, 350, 16, 1592, 1315, 71, 16, 389, 2704, 1315, 71, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.5.0; import "@openzeppelin/upgrades/contracts/Initializable.sol"; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with 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. */ contract Context is Initializable { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } pragma solidity ^0.5.0; /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } /** * @dev Remove an account's access to this role. */ function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } /** * @dev Check if an account has this role. * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero address"); return role.bearer[account]; } } pragma solidity ^0.5.0; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "../../GSN/Context.sol"; import "../Roles.sol"; contract PauserRole is Initializable, Context { using Roles for Roles.Role; event PauserAdded(address indexed account); event PauserRemoved(address indexed account); Roles.Role private _pausers; function initialize(address sender) public initializer { if (!isPauser(sender)) { _addPauser(sender); } } modifier onlyPauser() { require(isPauser(_msgSender()), "PauserRole: caller does not have the Pauser role"); _; } function isPauser(address account) public view returns (bool) { return _pausers.has(account); } function addPauser(address account) public onlyPauser { _addPauser(account); } function renouncePauser() public { _removePauser(_msgSender()); } function _addPauser(address account) internal { _pausers.add(account); emit PauserAdded(account); } function _removePauser(address account) internal { _pausers.remove(account); emit PauserRemoved(account); } uint256[50] private ______gap; } pragma solidity ^0.5.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * NOTE: This call _does not revert_ if the signature is invalid, or * if the signer is otherwise unable to be retrieved. In those scenarios, * the zero address is returned. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Check the signature length if (signature.length != 65) { revert("ECDSA: signature length is invalid"); } // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. // solhint-disable-next-line no-inline-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { revert("ECDSA: signature.s is in the wrong range"); } if (v != 27 && v != 28) { revert("ECDSA: signature.v is in the wrong range"); } // If the signature is valid (and not malleable), return the signer address return ecrecover(hash, v, r, s); } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * replicates the behavior of the * https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`] * JSON-RPC method. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } } pragma solidity ^0.5.0; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "../GSN/Context.sol"; import "../access/roles/PauserRole.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ contract Pausable is Initializable, Context, PauserRole { /** * @dev Emitted when the pause is triggered by a pauser (`account`). */ event Paused(address account); /** * @dev Emitted when the pause is lifted by a pauser (`account`). */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. Assigns the Pauser role * to the deployer. */ function initialize(address sender) public initializer { PauserRole.initialize(sender); _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } /** * @dev Called by a pauser to pause, triggers stopped state. */ function pause() public onlyPauser whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Called by a pauser to unpause, returns to normal state. */ function unpause() public onlyPauser whenPaused { _paused = false; emit Unpaused(_msgSender()); } uint256[50] private ______gap; } pragma solidity ^0.5.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. * * _Available since v2.4.0._ */ 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. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 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. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } pragma solidity ^0.5.0; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "../GSN/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be aplied to your functions to restrict their use to * the owner. */ contract Ownable is Initializable, Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function initialize(address sender) public initializer { _owner = sender; emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * > Note: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } uint256[50] private ______gap; } pragma solidity ^0.5.0; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "../../GSN/Context.sol"; import "./IERC20.sol"; import "../../math/SafeMath.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20Mintable}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Initializable, Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Destroys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance")); } uint256[50] private ______gap; } pragma solidity ^0.5.0; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "../../GSN/Context.sol"; import "./ERC20.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ contract ERC20Burnable is Initializable, Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public { _burn(_msgSender(), amount); } /** * @dev See {ERC20-_burnFrom}. */ function burnFrom(address account, uint256 amount) public { _burnFrom(account, amount); } uint256[50] private ______gap; } pragma solidity ^0.5.0; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "./IERC20.sol"; /** * @dev Optional functions from the ERC20 standard. */ contract ERC20Detailed is Initializable, IERC20 { string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of * these values are immutable: they can only be set once during * construction. */ function initialize(string memory name, string memory symbol, uint8 decimals) public initializer { _name = name; _symbol = symbol; _decimals = decimals; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } uint256[50] private ______gap; } pragma solidity ^0.5.0; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "./ERC20.sol"; import "../../lifecycle/Pausable.sol"; /** * @title Pausable token * @dev ERC20 with pausable transfers and allowances. * * Useful if you want to stop trades until the end of a crowdsale, or have * an emergency switch for freezing all token transfers in the event of a large * bug. */ contract ERC20Pausable is Initializable, ERC20, Pausable { function initialize(address sender) public initializer { Pausable.initialize(sender); } function transfer(address to, uint256 value) public whenNotPaused returns (bool) { return super.transfer(to, value); } function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) { return super.transferFrom(from, to, value); } function approve(address spender, uint256 value) public whenNotPaused returns (bool) { return super.approve(spender, value); } function increaseAllowance(address spender, uint256 addedValue) public whenNotPaused returns (bool) { return super.increaseAllowance(spender, addedValue); } function decreaseAllowance(address spender, uint256 subtractedValue) public whenNotPaused returns (bool) { return super.decreaseAllowance(spender, subtractedValue); } uint256[50] private ______gap; } pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ 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); } pragma solidity ^0.5.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } pragma solidity ^0.5.5; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer functions must be manually * invoked. This applies both to deploying an Initializable contract, as well * as extending an Initializable contract via inheritance. * WARNING: When used with inheritance, manual care must be taken to not invoke * a parent initializer twice, or ensure that all initializers are idempotent, * because this is not dealt with automatically as with constructors. */ contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private initializing; /** * @dev Modifier to use in the initializer function of a contract. */ modifier initializer() { require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized"); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; initialized = true; } _; if (isTopLevelCall) { initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; assembly { cs := extcodesize(self) } return cs == 0; } // Reserved storage space to allow for layout changes in the future. uint256[50] private ______gap; } pragma solidity ^0.5.0; /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". * * Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/ownership/Ownable.sol * This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts * when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the * build/artifacts folder) as well as the vanilla Ownable implementation from an openzeppelin version. */ contract OpenZeppelinUpgradesOwnable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor () internal { _owner = msg.sender; emit OwnershipTransferred(address(0), _owner); } /** * @return the address of the owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner()); _; } /** * @return true if `msg.sender` is the owner of the contract. */ function isOwner() public view returns (bool) { return msg.sender == _owner; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0)); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } pragma solidity ^0.5.0; import './BaseAdminUpgradeabilityProxy.sol'; /** * @title AdminUpgradeabilityProxy * @dev Extends from BaseAdminUpgradeabilityProxy with a constructor for * initializing the implementation, admin, and init data. */ contract AdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, UpgradeabilityProxy { /** * Contract constructor. * @param _logic address of the initial implementation. * @param _admin Address of the proxy administrator. * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. */ constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable { assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)); _setAdmin(_admin); } } pragma solidity ^0.5.0; import './UpgradeabilityProxy.sol'; /** * @title BaseAdminUpgradeabilityProxy * @dev This contract combines an upgradeability proxy with an authorization * mechanism for administrative tasks. * All external functions in this contract must be guarded by the * `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity * feature proposal that would enable this to be done automatically. */ contract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy { /** * @dev Emitted when the administration has been transferred. * @param previousAdmin Address of the previous admin. * @param newAdmin Address of the new admin. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Modifier to check whether the `msg.sender` is the admin. * If it is, it will run the function. Otherwise, it will delegate the call * to the implementation. */ modifier ifAdmin() { if (msg.sender == _admin()) { _; } else { _fallback(); } } /** * @return The address of the proxy admin. */ function admin() external ifAdmin returns (address) { return _admin(); } /** * @return The address of the implementation. */ function implementation() external ifAdmin returns (address) { return _implementation(); } /** * @dev Changes the admin of the proxy. * Only the current admin can call this function. * @param newAdmin Address to transfer proxy administration to. */ function changeAdmin(address newAdmin) external ifAdmin { require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address"); emit AdminChanged(_admin(), newAdmin); _setAdmin(newAdmin); } /** * @dev Upgrade the backing implementation of the proxy. * Only the admin can call this function. * @param newImplementation Address of the new implementation. */ function upgradeTo(address newImplementation) external ifAdmin { _upgradeTo(newImplementation); } /** * @dev Upgrade the backing implementation of the proxy and call a function * on the new implementation. * This is useful to initialize the proxied contract. * @param newImplementation Address of the new implementation. * @param data Data to send as msg.data in the low level call. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. */ function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin { _upgradeTo(newImplementation); (bool success,) = newImplementation.delegatecall(data); require(success); } /** * @return The admin slot. */ function _admin() internal view returns (address adm) { bytes32 slot = ADMIN_SLOT; assembly { adm := sload(slot) } } /** * @dev Sets the address of the proxy admin. * @param newAdmin Address of the new proxy admin. */ function _setAdmin(address newAdmin) internal { bytes32 slot = ADMIN_SLOT; assembly { sstore(slot, newAdmin) } } /** * @dev Only fall back when the sender is not the admin. */ function _willFallback() internal { require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin"); super._willFallback(); } } pragma solidity ^0.5.0; import './Proxy.sol'; import '../utils/Address.sol'; /** * @title BaseUpgradeabilityProxy * @dev This contract implements a proxy that allows to change the * implementation address to which it will delegate. * Such a change is called an implementation upgrade. */ contract BaseUpgradeabilityProxy is Proxy { /** * @dev Emitted when the implementation is upgraded. * @param implementation Address of the new implementation. */ event Upgraded(address indexed implementation); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation. * @return Address of the current implementation */ function _implementation() internal view returns (address impl) { bytes32 slot = IMPLEMENTATION_SLOT; assembly { impl := sload(slot) } } /** * @dev Upgrades the proxy to a new implementation. * @param newImplementation Address of the new implementation. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Sets the implementation address of the proxy. * @param newImplementation Address of the new implementation. */ function _setImplementation(address newImplementation) internal { require(OpenZeppelinUpgradesAddress.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address"); bytes32 slot = IMPLEMENTATION_SLOT; assembly { sstore(slot, newImplementation) } } } pragma solidity ^0.5.0; import './BaseAdminUpgradeabilityProxy.sol'; import './InitializableUpgradeabilityProxy.sol'; /** * @title InitializableAdminUpgradeabilityProxy * @dev Extends from BaseAdminUpgradeabilityProxy with an initializer for * initializing the implementation, admin, and init data. */ contract InitializableAdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, InitializableUpgradeabilityProxy { /** * Contract initializer. * @param _logic address of the initial implementation. * @param _admin Address of the proxy administrator. * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. */ function initialize(address _logic, address _admin, bytes memory _data) public payable { require(_implementation() == address(0)); InitializableUpgradeabilityProxy.initialize(_logic, _data); assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)); _setAdmin(_admin); } } pragma solidity ^0.5.0; import './BaseUpgradeabilityProxy.sol'; /** * @title InitializableUpgradeabilityProxy * @dev Extends BaseUpgradeabilityProxy with an initializer for initializing * implementation and init data. */ contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy { /** * @dev Contract initializer. * @param _logic Address of the initial implementation. * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. */ function initialize(address _logic, bytes memory _data) public payable { require(_implementation() == address(0)); assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)); _setImplementation(_logic); if(_data.length > 0) { (bool success,) = _logic.delegatecall(_data); require(success); } } } pragma solidity ^0.5.0; /** * @title Proxy * @dev Implements delegation of calls to other contracts, with proper * forwarding of return values and bubbling of failures. * It defines a fallback function that delegates all calls to the address * returned by the abstract _implementation() internal function. */ contract Proxy { /** * @dev Fallback function. * Implemented entirely in `_fallback`. */ function () payable external { _fallback(); } /** * @return The Address of the implementation. */ function _implementation() internal view returns (address); /** * @dev Delegates execution to an implementation contract. * This is a low level function that doesn't return to its internal call site. * It will return to the external caller whatever the implementation returns. * @param implementation Address to delegate. */ function _delegate(address implementation) internal { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas, implementation, 0, calldatasize, 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize) } default { return(0, returndatasize) } } } /** * @dev Function that is run as the first thing in the fallback function. * Can be redefined in derived contracts to add functionality. * Redefinitions must call super._willFallback(). */ function _willFallback() internal { } /** * @dev fallback implementation. * Extracted to enable manual triggering. */ function _fallback() internal { _willFallback(); _delegate(_implementation()); } } pragma solidity ^0.5.0; import "../ownership/Ownable.sol"; import "./AdminUpgradeabilityProxy.sol"; /** * @title ProxyAdmin * @dev This contract is the admin of a proxy, and is in charge * of upgrading it as well as transferring it to another admin. */ contract ProxyAdmin is OpenZeppelinUpgradesOwnable { /** * @dev Returns the current implementation of a proxy. * This is needed because only the proxy admin can query it. * @return The address of the current implementation of the proxy. */ function getProxyImplementation(AdminUpgradeabilityProxy proxy) public view returns (address) { // We need to manually run the static call since the getter cannot be flagged as view // bytes4(keccak256("implementation()")) == 0x5c60da1b (bool success, bytes memory returndata) = address(proxy).staticcall(hex"5c60da1b"); require(success); return abi.decode(returndata, (address)); } /** * @dev Returns the admin of a proxy. Only the admin can query it. * @return The address of the current admin of the proxy. */ function getProxyAdmin(AdminUpgradeabilityProxy proxy) public view returns (address) { // We need to manually run the static call since the getter cannot be flagged as view // bytes4(keccak256("admin()")) == 0xf851a440 (bool success, bytes memory returndata) = address(proxy).staticcall(hex"f851a440"); require(success); return abi.decode(returndata, (address)); } /** * @dev Changes the admin of a proxy. * @param proxy Proxy to change admin. * @param newAdmin Address to transfer proxy administration to. */ function changeProxyAdmin(AdminUpgradeabilityProxy proxy, address newAdmin) public onlyOwner { proxy.changeAdmin(newAdmin); } /** * @dev Upgrades a proxy to the newest implementation of a contract. * @param proxy Proxy to be upgraded. * @param implementation the address of the Implementation. */ function upgrade(AdminUpgradeabilityProxy proxy, address implementation) public onlyOwner { proxy.upgradeTo(implementation); } /** * @dev Upgrades a proxy to the newest implementation of a contract and forwards a function call to it. * This is useful to initialize the proxied contract. * @param proxy Proxy to be upgraded. * @param implementation Address of the Implementation. * @param data Data to send as msg.data in the low level call. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. */ function upgradeAndCall(AdminUpgradeabilityProxy proxy, address implementation, bytes memory data) payable public onlyOwner { proxy.upgradeToAndCall.value(msg.value)(implementation, data); } } pragma solidity ^0.5.0; import './BaseUpgradeabilityProxy.sol'; /** * @title UpgradeabilityProxy * @dev Extends BaseUpgradeabilityProxy with a constructor for initializing * implementation and init data. */ contract UpgradeabilityProxy is BaseUpgradeabilityProxy { /** * @dev Contract constructor. * @param _logic Address of the initial implementation. * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. */ constructor(address _logic, bytes memory _data) public payable { assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)); _setImplementation(_logic); if(_data.length > 0) { (bool success,) = _logic.delegatecall(_data); require(success); } } } pragma solidity ^0.5.0; /** * Utility library of inline functions on addresses * * Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol * This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts * when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the * build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version. */ library OpenZeppelinUpgradesAddress { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract, * as the code is not actually created until after the constructor finishes. * @param account address of the account to check * @return whether the target address is a contract */ function isContract(address account) internal view returns (bool) { uint256 size; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. // See https://ethereum.stackexchange.com/a/14016/36603 // for more details about how this works. // TODO Check this again before the Serenity release, because all addresses will be // contracts then. // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } } pragma solidity 0.5.17; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/cryptography/ECDSA.sol"; import "@openzeppelin/upgrades/contracts/upgradeability/InitializableAdminUpgradeabilityProxy.sol"; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "../RenToken/RenToken.sol"; import "./DarknodeRegistryStore.sol"; import "../Governance/Claimable.sol"; import "../libraries/CanReclaimTokens.sol"; import "./DarknodeRegistryV1.sol"; contract DarknodeRegistryStateV2 {} /// @notice DarknodeRegistry is responsible for the registration and /// deregistration of Darknodes. contract DarknodeRegistryLogicV2 is Claimable, CanReclaimTokens, DarknodeRegistryStateV1, DarknodeRegistryStateV2 { using SafeMath for uint256; /// @notice Emitted when a darknode is registered. /// @param _darknodeOperator The owner of the darknode. /// @param _darknodeID The ID of the darknode that was registered. /// @param _bond The amount of REN that was transferred as bond. event LogDarknodeRegistered( address indexed _darknodeOperator, address indexed _darknodeID, uint256 _bond ); /// @notice Emitted when a darknode is deregistered. /// @param _darknodeOperator The owner of the darknode. /// @param _darknodeID The ID of the darknode that was deregistered. event LogDarknodeDeregistered( address indexed _darknodeOperator, address indexed _darknodeID ); /// @notice Emitted when a refund has been made. /// @param _darknodeOperator The owner of the darknode. /// @param _darknodeID The ID of the darknode that was refunded. /// @param _amount The amount of REN that was refunded. event LogDarknodeRefunded( address indexed _darknodeOperator, address indexed _darknodeID, uint256 _amount ); /// @notice Emitted when a recovery has been made. /// @param _darknodeOperator The owner of the darknode. /// @param _darknodeID The ID of the darknode that was recovered. /// @param _bondRecipient The address that received the bond. /// @param _submitter The address that called the recover method. event LogDarknodeRecovered( address indexed _darknodeOperator, address indexed _darknodeID, address _bondRecipient, address indexed _submitter ); /// @notice Emitted when a darknode's bond is slashed. /// @param _darknodeOperator The owner of the darknode. /// @param _darknodeID The ID of the darknode that was slashed. /// @param _challenger The address of the account that submitted the challenge. /// @param _percentage The total percentage of bond slashed. event LogDarknodeSlashed( address indexed _darknodeOperator, address indexed _darknodeID, address indexed _challenger, uint256 _percentage ); /// @notice Emitted when a new epoch has begun. event LogNewEpoch(uint256 indexed epochhash); /// @notice Emitted when a constructor parameter has been updated. event LogMinimumBondUpdated( uint256 _previousMinimumBond, uint256 _nextMinimumBond ); event LogMinimumPodSizeUpdated( uint256 _previousMinimumPodSize, uint256 _nextMinimumPodSize ); event LogMinimumEpochIntervalUpdated( uint256 _previousMinimumEpochInterval, uint256 _nextMinimumEpochInterval ); event LogSlasherUpdated( address indexed _previousSlasher, address indexed _nextSlasher ); event LogDarknodePaymentUpdated( address indexed _previousDarknodePayment, address indexed _nextDarknodePayment ); /// @notice Restrict a function to the owner that registered the darknode. modifier onlyDarknodeOperator(address _darknodeID) { require( store.darknodeOperator(_darknodeID) == msg.sender, "DarknodeRegistry: must be darknode owner" ); _; } /// @notice Restrict a function to unregistered darknodes. modifier onlyRefunded(address _darknodeID) { require( isRefunded(_darknodeID), "DarknodeRegistry: must be refunded or never registered" ); _; } /// @notice Restrict a function to refundable darknodes. modifier onlyRefundable(address _darknodeID) { require( isRefundable(_darknodeID), "DarknodeRegistry: must be deregistered for at least one epoch" ); _; } /// @notice Restrict a function to registered nodes without a pending /// deregistration. modifier onlyDeregisterable(address _darknodeID) { require( isDeregisterable(_darknodeID), "DarknodeRegistry: must be deregisterable" ); _; } /// @notice Restrict a function to the Slasher contract. modifier onlySlasher() { require( address(slasher) == msg.sender, "DarknodeRegistry: must be slasher" ); _; } /// @notice Restrict a function to registered and deregistered nodes. modifier onlyDarknode(address _darknodeID) { require( isRegistered(_darknodeID) || isDeregistered(_darknodeID), "DarknodeRegistry: invalid darknode" ); _; } /// @notice The contract constructor. /// /// @param _VERSION A string defining the contract version. /// @param _renAddress The address of the RenToken contract. /// @param _storeAddress The address of the DarknodeRegistryStore contract. /// @param _minimumBond The minimum bond amount that can be submitted by a /// Darknode. /// @param _minimumPodSize The minimum size of a Darknode pod. /// @param _minimumEpochIntervalSeconds The minimum number of seconds between epochs. function initialize( string memory _VERSION, RenToken _renAddress, DarknodeRegistryStore _storeAddress, uint256 _minimumBond, uint256 _minimumPodSize, uint256 _minimumEpochIntervalSeconds, uint256 _deregistrationIntervalSeconds ) public initializer { Claimable.initialize(msg.sender); CanReclaimTokens.initialize(msg.sender); VERSION = _VERSION; store = _storeAddress; ren = _renAddress; minimumBond = _minimumBond; nextMinimumBond = minimumBond; minimumPodSize = _minimumPodSize; nextMinimumPodSize = minimumPodSize; minimumEpochInterval = _minimumEpochIntervalSeconds; nextMinimumEpochInterval = minimumEpochInterval; deregistrationInterval = _deregistrationIntervalSeconds; uint256 epochhash = uint256(blockhash(block.number - 1)); currentEpoch = Epoch({ epochhash: epochhash, blocktime: block.timestamp }); emit LogNewEpoch(epochhash); } /// @notice Register a darknode and transfer the bond to this contract. /// Before registering, the bond transfer must be approved in the REN /// contract. The caller must provide a public encryption key for the /// darknode. The darknode will remain pending registration until the next /// epoch. Only after this period can the darknode be deregistered. The /// caller of this method will be stored as the owner of the darknode. /// /// @param _darknodeID The darknode ID that will be registered. function registerNode(address _darknodeID) public onlyRefunded(_darknodeID) { require( _darknodeID != address(0), "DarknodeRegistry: darknode address cannot be zero" ); // Use the current minimum bond as the darknode's bond and transfer bond to store require( ren.transferFrom(msg.sender, address(store), minimumBond), "DarknodeRegistry: bond transfer failed" ); // Flag this darknode for registration store.appendDarknode( _darknodeID, msg.sender, minimumBond, "", currentEpoch.blocktime.add(minimumEpochInterval), 0 ); numDarknodesNextEpoch = numDarknodesNextEpoch.add(1); // Emit an event. emit LogDarknodeRegistered(msg.sender, _darknodeID, minimumBond); } /// @notice An alias for `registerNode` that includes the legacy public key /// parameter. /// @param _darknodeID The darknode ID that will be registered. /// @param _publicKey Deprecated parameter - see `registerNode`. function register(address _darknodeID, bytes calldata _publicKey) external { return registerNode(_darknodeID); } /// @notice Register multiple darknodes and transfer the bonds to this contract. /// Before registering, the bonds transfer must be approved in the REN contract. /// The darknodes will remain pending registration until the next epoch. Only /// after this period can the darknodes be deregistered. The caller of this method /// will be stored as the owner of each darknode. If one registration fails, all /// registrations fail. /// @param _darknodeIDs The darknode IDs that will be registered. function registerMultiple(address[] calldata _darknodeIDs) external { // Save variables in memory to prevent redundant reads from storage DarknodeRegistryStore _store = store; Epoch memory _currentEpoch = currentEpoch; uint256 nextRegisteredAt = _currentEpoch.blocktime.add( minimumEpochInterval ); uint256 _minimumBond = minimumBond; require( ren.transferFrom( msg.sender, address(_store), _minimumBond.mul(_darknodeIDs.length) ), "DarknodeRegistry: bond transfers failed" ); for (uint256 i = 0; i < _darknodeIDs.length; i++) { address darknodeID = _darknodeIDs[i]; uint256 registeredAt = _store.darknodeRegisteredAt(darknodeID); uint256 deregisteredAt = _store.darknodeDeregisteredAt(darknodeID); require( _isRefunded(registeredAt, deregisteredAt), "DarknodeRegistry: must be refunded or never registered" ); require( darknodeID != address(0), "DarknodeRegistry: darknode address cannot be zero" ); _store.appendDarknode( darknodeID, msg.sender, _minimumBond, "", nextRegisteredAt, 0 ); emit LogDarknodeRegistered(msg.sender, darknodeID, _minimumBond); } numDarknodesNextEpoch = numDarknodesNextEpoch.add(_darknodeIDs.length); } /// @notice Deregister a darknode. The darknode will not be deregistered /// until the end of the epoch. After another epoch, the bond can be /// refunded by calling the refund method. /// @param _darknodeID The darknode ID that will be deregistered. The caller /// of this method must be the owner of this darknode. function deregister(address _darknodeID) external onlyDeregisterable(_darknodeID) onlyDarknodeOperator(_darknodeID) { deregisterDarknode(_darknodeID); } /// @notice Deregister multiple darknodes. The darknodes will not be /// deregistered until the end of the epoch. After another epoch, their /// bonds can be refunded by calling the refund or refundMultiple methods. /// If one deregistration fails, all deregistrations fail. /// @param _darknodeIDs The darknode IDs that will be deregistered. The /// caller of this method must be the owner of each darknode. function deregisterMultiple(address[] calldata _darknodeIDs) external { // Save variables in memory to prevent redundant reads from storage DarknodeRegistryStore _store = store; Epoch memory _currentEpoch = currentEpoch; uint256 _minimumEpochInterval = minimumEpochInterval; for (uint256 i = 0; i < _darknodeIDs.length; i++) { address darknodeID = _darknodeIDs[i]; uint256 deregisteredAt = _store.darknodeDeregisteredAt(darknodeID); bool registered = isRegisteredInEpoch( _store.darknodeRegisteredAt(darknodeID), deregisteredAt, _currentEpoch ); require( _isDeregisterable(registered, deregisteredAt), "DarknodeRegistry: must be deregisterable" ); require( _store.darknodeOperator(darknodeID) == msg.sender, "DarknodeRegistry: must be darknode owner" ); _store.updateDarknodeDeregisteredAt( darknodeID, _currentEpoch.blocktime.add(_minimumEpochInterval) ); emit LogDarknodeDeregistered(msg.sender, darknodeID); } numDarknodesNextEpoch = numDarknodesNextEpoch.sub(_darknodeIDs.length); } /// @notice Progress the epoch if it is possible to do so. This captures /// the current timestamp and current blockhash and overrides the current /// epoch. function epoch() external { if (previousEpoch.blocktime == 0) { // The first epoch must be called by the owner of the contract require( msg.sender == owner(), "DarknodeRegistry: not authorized to call first epoch" ); } // Require that the epoch interval has passed require( block.timestamp >= currentEpoch.blocktime.add(minimumEpochInterval), "DarknodeRegistry: epoch interval has not passed" ); uint256 epochhash = uint256(blockhash(block.number - 1)); // Update the epoch hash and timestamp previousEpoch = currentEpoch; currentEpoch = Epoch({ epochhash: epochhash, blocktime: block.timestamp }); // Update the registry information numDarknodesPreviousEpoch = numDarknodes; numDarknodes = numDarknodesNextEpoch; // If any update functions have been called, update the values now if (nextMinimumBond != minimumBond) { minimumBond = nextMinimumBond; emit LogMinimumBondUpdated(minimumBond, nextMinimumBond); } if (nextMinimumPodSize != minimumPodSize) { minimumPodSize = nextMinimumPodSize; emit LogMinimumPodSizeUpdated(minimumPodSize, nextMinimumPodSize); } if (nextMinimumEpochInterval != minimumEpochInterval) { minimumEpochInterval = nextMinimumEpochInterval; emit LogMinimumEpochIntervalUpdated( minimumEpochInterval, nextMinimumEpochInterval ); } if (nextSlasher != slasher) { slasher = nextSlasher; emit LogSlasherUpdated(address(slasher), address(nextSlasher)); } // Emit an event emit LogNewEpoch(epochhash); } /// @notice Allows the contract owner to initiate an ownership transfer of /// the DarknodeRegistryStore. /// @param _newOwner The address to transfer the ownership to. function transferStoreOwnership(DarknodeRegistryLogicV2 _newOwner) external onlyOwner { store.transferOwnership(address(_newOwner)); _newOwner.claimStoreOwnership(); } /// @notice Claims ownership of the store passed in to the constructor. /// `transferStoreOwnership` must have previously been called when /// transferring from another Darknode Registry. function claimStoreOwnership() external { store.claimOwnership(); // Sync state with new store. // Note: numDarknodesPreviousEpoch is set to 0 for a newly deployed DNR. ( numDarknodesPreviousEpoch, numDarknodes, numDarknodesNextEpoch ) = getDarknodeCountFromEpochs(); } /// @notice Allows the contract owner to update the minimum bond. /// @param _nextMinimumBond The minimum bond amount that can be submitted by /// a darknode. function updateMinimumBond(uint256 _nextMinimumBond) external onlyOwner { // Will be updated next epoch nextMinimumBond = _nextMinimumBond; } /// @notice Allows the contract owner to update the minimum pod size. /// @param _nextMinimumPodSize The minimum size of a pod. function updateMinimumPodSize(uint256 _nextMinimumPodSize) external onlyOwner { // Will be updated next epoch nextMinimumPodSize = _nextMinimumPodSize; } /// @notice Allows the contract owner to update the minimum epoch interval. /// @param _nextMinimumEpochInterval The minimum number of blocks between epochs. function updateMinimumEpochInterval(uint256 _nextMinimumEpochInterval) external onlyOwner { // Will be updated next epoch nextMinimumEpochInterval = _nextMinimumEpochInterval; } /// @notice Allow the contract owner to update the DarknodeSlasher contract /// address. /// @param _slasher The new slasher address. function updateSlasher(IDarknodeSlasher _slasher) external onlyOwner { nextSlasher = _slasher; } /// @notice Allow the DarknodeSlasher contract to slash a portion of darknode's /// bond and deregister it. /// @param _guilty The guilty prover whose bond is being slashed. /// @param _challenger The challenger who should receive a portion of the bond as reward. /// @param _percentage The total percentage of bond to be slashed. function slash( address _guilty, address _challenger, uint256 _percentage ) external onlySlasher onlyDarknode(_guilty) { require(_percentage <= 100, "DarknodeRegistry: invalid percent"); // If the darknode has not been deregistered then deregister it if (isDeregisterable(_guilty)) { deregisterDarknode(_guilty); } uint256 totalBond = store.darknodeBond(_guilty); uint256 penalty = totalBond.div(100).mul(_percentage); uint256 challengerReward = penalty.div(2); uint256 slasherPortion = penalty.sub(challengerReward); if (challengerReward > 0) { // Slash the bond of the failed prover store.updateDarknodeBond(_guilty, totalBond.sub(penalty)); // Forward the remaining amount to be handled by the slasher. require( ren.transfer(msg.sender, slasherPortion), "DarknodeRegistry: reward transfer to slasher failed" ); require( ren.transfer(_challenger, challengerReward), "DarknodeRegistry: reward transfer to challenger failed" ); } emit LogDarknodeSlashed( store.darknodeOperator(_guilty), _guilty, _challenger, _percentage ); } /// @notice Refund the bond of a deregistered darknode. This will make the /// darknode available for registration again. /// /// @param _darknodeID The darknode ID that will be refunded. function refund(address _darknodeID) external onlyRefundable(_darknodeID) onlyDarknodeOperator(_darknodeID) { // Remember the bond amount uint256 amount = store.darknodeBond(_darknodeID); // Erase the darknode from the registry store.removeDarknode(_darknodeID); // Refund the operator by transferring REN require( ren.transfer(msg.sender, amount), "DarknodeRegistry: bond transfer failed" ); // Emit an event. emit LogDarknodeRefunded(msg.sender, _darknodeID, amount); } /// @notice A permissioned method for refunding a darknode without the usual /// delay. The operator must provide a signature of the darknode ID and the /// bond recipient, but the call must come from the contract's owner. The /// main use case is for when an operator's keys have been compromised, /// allowing for the bonds to be recovered by the operator through the /// GatewayRegistry's governance. It is expected that this process would /// happen towards the end of the darknode's deregistered period, so that /// a malicious operator can't use this to quickly exit their stake after /// attempting an attack on the network. It's also expected that the /// operator will not re-register the same darknode again. function recover( address _darknodeID, address _bondRecipient, bytes calldata _signature ) external onlyOwner { require( isRefundable(_darknodeID) || isDeregistered(_darknodeID), "DarknodeRegistry: must be deregistered" ); address darknodeOperator = store.darknodeOperator(_darknodeID); require( ECDSA.recover( keccak256( abi.encodePacked( "\x19Ethereum Signed Message:\n64", "DarknodeRegistry.recover", _darknodeID, _bondRecipient ) ), _signature ) == darknodeOperator, "DarknodeRegistry: invalid signature" ); // Remember the bond amount uint256 amount = store.darknodeBond(_darknodeID); // Erase the darknode from the registry store.removeDarknode(_darknodeID); // Refund the operator by transferring REN require( ren.transfer(_bondRecipient, amount), "DarknodeRegistry: bond transfer failed" ); // Emit an event. emit LogDarknodeRefunded(darknodeOperator, _darknodeID, amount); emit LogDarknodeRecovered( darknodeOperator, _darknodeID, _bondRecipient, msg.sender ); } /// @notice Refund the bonds of multiple deregistered darknodes. This will /// make the darknodes available for registration again. If one refund fails, /// all refunds fail. /// @param _darknodeIDs The darknode IDs that will be refunded. function refundMultiple(address[] calldata _darknodeIDs) external { // Save variables in memory to prevent redundant reads from storage DarknodeRegistryStore _store = store; Epoch memory _currentEpoch = currentEpoch; Epoch memory _previousEpoch = previousEpoch; uint256 _deregistrationInterval = deregistrationInterval; // The sum of bonds to refund uint256 sum; for (uint256 i = 0; i < _darknodeIDs.length; i++) { address darknodeID = _darknodeIDs[i]; uint256 deregisteredAt = _store.darknodeDeregisteredAt(darknodeID); bool deregistered = _isDeregistered(deregisteredAt, _currentEpoch); require( _isRefundable( deregistered, deregisteredAt, _previousEpoch, _deregistrationInterval ), "DarknodeRegistry: must be deregistered for at least one epoch" ); require( _store.darknodeOperator(darknodeID) == msg.sender, "DarknodeRegistry: must be darknode owner" ); // Remember the bond amount uint256 amount = _store.darknodeBond(darknodeID); // Erase the darknode from the registry _store.removeDarknode(darknodeID); // Emit an event emit LogDarknodeRefunded(msg.sender, darknodeID, amount); // Increment the sum of bonds to be transferred sum = sum.add(amount); } // Transfer all bonds together require( ren.transfer(msg.sender, sum), "DarknodeRegistry: bond transfers failed" ); } /// @notice Retrieves the address of the account that registered a darknode. /// @param _darknodeID The ID of the darknode to retrieve the owner for. function getDarknodeOperator(address _darknodeID) external view returns (address payable) { return store.darknodeOperator(_darknodeID); } /// @notice Retrieves the bond amount of a darknode in 10^-18 REN. /// @param _darknodeID The ID of the darknode to retrieve the bond for. function getDarknodeBond(address _darknodeID) external view returns (uint256) { return store.darknodeBond(_darknodeID); } /// @notice Retrieves the encryption public key of the darknode. /// @param _darknodeID The ID of the darknode to retrieve the public key for. function getDarknodePublicKey(address _darknodeID) external view returns (bytes memory) { return store.darknodePublicKey(_darknodeID); } /// @notice Retrieves a list of darknodes which are registered for the /// current epoch. /// @param _start A darknode ID used as an offset for the list. If _start is /// 0x0, the first dark node will be used. _start won't be /// included it is not registered for the epoch. /// @param _count The number of darknodes to retrieve starting from _start. /// If _count is 0, all of the darknodes from _start are /// retrieved. If _count is more than the remaining number of /// registered darknodes, the rest of the list will contain /// 0x0s. function getDarknodes(address _start, uint256 _count) external view returns (address[] memory) { uint256 count = _count; if (count == 0) { count = numDarknodes; } return getDarknodesFromEpochs(_start, count, false); } /// @notice Retrieves a list of darknodes which were registered for the /// previous epoch. See `getDarknodes` for the parameter documentation. function getPreviousDarknodes(address _start, uint256 _count) external view returns (address[] memory) { uint256 count = _count; if (count == 0) { count = numDarknodesPreviousEpoch; } return getDarknodesFromEpochs(_start, count, true); } /// @notice Returns whether a darknode is scheduled to become registered /// at next epoch. /// @param _darknodeID The ID of the darknode to return. function isPendingRegistration(address _darknodeID) public view returns (bool) { uint256 registeredAt = store.darknodeRegisteredAt(_darknodeID); return registeredAt != 0 && registeredAt > currentEpoch.blocktime; } /// @notice Returns if a darknode is in the pending deregistered state. In /// this state a darknode is still considered registered. function isPendingDeregistration(address _darknodeID) public view returns (bool) { uint256 deregisteredAt = store.darknodeDeregisteredAt(_darknodeID); return deregisteredAt != 0 && deregisteredAt > currentEpoch.blocktime; } /// @notice Returns if a darknode is in the deregistered state. function isDeregistered(address _darknodeID) public view returns (bool) { uint256 deregisteredAt = store.darknodeDeregisteredAt(_darknodeID); return _isDeregistered(deregisteredAt, currentEpoch); } /// @notice Returns if a darknode can be deregistered. This is true if the /// darknodes is in the registered state and has not attempted to /// deregister yet. function isDeregisterable(address _darknodeID) public view returns (bool) { DarknodeRegistryStore _store = store; uint256 deregisteredAt = _store.darknodeDeregisteredAt(_darknodeID); bool registered = isRegisteredInEpoch( _store.darknodeRegisteredAt(_darknodeID), deregisteredAt, currentEpoch ); return _isDeregisterable(registered, deregisteredAt); } /// @notice Returns if a darknode is in the refunded state. This is true /// for darknodes that have never been registered, or darknodes that have /// been deregistered and refunded. function isRefunded(address _darknodeID) public view returns (bool) { DarknodeRegistryStore _store = store; uint256 registeredAt = _store.darknodeRegisteredAt(_darknodeID); uint256 deregisteredAt = _store.darknodeDeregisteredAt(_darknodeID); return _isRefunded(registeredAt, deregisteredAt); } /// @notice Returns if a darknode is refundable. This is true for darknodes /// that have been in the deregistered state for one full epoch. function isRefundable(address _darknodeID) public view returns (bool) { uint256 deregisteredAt = store.darknodeDeregisteredAt(_darknodeID); bool deregistered = _isDeregistered(deregisteredAt, currentEpoch); return _isRefundable( deregistered, deregisteredAt, previousEpoch, deregistrationInterval ); } /// @notice Returns the registration time of a given darknode. function darknodeRegisteredAt(address darknodeID) external view returns (uint256) { return store.darknodeRegisteredAt(darknodeID); } /// @notice Returns the deregistration time of a given darknode. function darknodeDeregisteredAt(address darknodeID) external view returns (uint256) { return store.darknodeDeregisteredAt(darknodeID); } /// @notice Returns if a darknode is in the registered state. function isRegistered(address _darknodeID) public view returns (bool) { DarknodeRegistryStore _store = store; uint256 registeredAt = _store.darknodeRegisteredAt(_darknodeID); uint256 deregisteredAt = _store.darknodeDeregisteredAt(_darknodeID); return isRegisteredInEpoch(registeredAt, deregisteredAt, currentEpoch); } /// @notice Returns if a darknode was in the registered state last epoch. function isRegisteredInPreviousEpoch(address _darknodeID) public view returns (bool) { DarknodeRegistryStore _store = store; uint256 registeredAt = _store.darknodeRegisteredAt(_darknodeID); uint256 deregisteredAt = _store.darknodeDeregisteredAt(_darknodeID); return isRegisteredInEpoch(registeredAt, deregisteredAt, previousEpoch); } /// @notice Returns the darknodes registered by the provided operator. /// @dev THIS IS AN EXPENSIVE CALL - this should only called when using /// eth_call contract reads - not in transactions. function getOperatorDarknodes(address _operator) external view returns (address[] memory) { address[] memory nodesPadded = new address[](numDarknodes); address[] memory allNodes = getDarknodesFromEpochs( address(0), numDarknodes, false ); uint256 j = 0; for (uint256 i = 0; i < allNodes.length; i++) { if (store.darknodeOperator(allNodes[i]) == _operator) { nodesPadded[j] = (allNodes[i]); j++; } } address[] memory nodes = new address[](j); for (uint256 i = 0; i < j; i++) { nodes[i] = nodesPadded[i]; } return nodes; } /// @notice Returns if a darknode was in the registered state for a given /// epoch. /// @param _epoch One of currentEpoch, previousEpoch. function isRegisteredInEpoch( uint256 _registeredAt, uint256 _deregisteredAt, Epoch memory _epoch ) private pure returns (bool) { bool registered = _registeredAt != 0 && _registeredAt <= _epoch.blocktime; bool notDeregistered = _deregisteredAt == 0 || _deregisteredAt > _epoch.blocktime; // The Darknode has been registered and has not yet been deregistered, // although it might be pending deregistration return registered && notDeregistered; } /// Private function called by `isDeregistered`, `isRefundable`, and `refundMultiple`. function _isDeregistered( uint256 _deregisteredAt, Epoch memory _currentEpoch ) private pure returns (bool) { return _deregisteredAt != 0 && _deregisteredAt <= _currentEpoch.blocktime; } /// Private function called by `isDeregisterable` and `deregisterMultiple`. function _isDeregisterable(bool _registered, uint256 _deregisteredAt) private pure returns (bool) { // The Darknode is currently in the registered state and has not been // transitioned to the pending deregistration, or deregistered, state return _registered && _deregisteredAt == 0; } /// Private function called by `isRefunded` and `registerMultiple`. function _isRefunded(uint256 registeredAt, uint256 deregisteredAt) private pure returns (bool) { return registeredAt == 0 && deregisteredAt == 0; } /// Private function called by `isRefundable` and `refundMultiple`. function _isRefundable( bool _deregistered, uint256 _deregisteredAt, Epoch memory _previousEpoch, uint256 _deregistrationInterval ) private pure returns (bool) { return _deregistered && _deregisteredAt <= (_previousEpoch.blocktime - _deregistrationInterval); } /// @notice Returns a list of darknodes registered for either the current /// or the previous epoch. See `getDarknodes` for documentation on the /// parameters `_start` and `_count`. /// @param _usePreviousEpoch If true, use the previous epoch, otherwise use /// the current epoch. function getDarknodesFromEpochs( address _start, uint256 _count, bool _usePreviousEpoch ) private view returns (address[] memory) { uint256 count = _count; if (count == 0) { count = numDarknodes; } address[] memory nodes = new address[](count); // Begin with the first node in the list uint256 n = 0; address next = _start; if (next == address(0)) { next = store.begin(); } // Iterate until all registered Darknodes have been collected while (n < count) { if (next == address(0)) { break; } // Only include Darknodes that are currently registered bool includeNext; if (_usePreviousEpoch) { includeNext = isRegisteredInPreviousEpoch(next); } else { includeNext = isRegistered(next); } if (!includeNext) { next = store.next(next); continue; } nodes[n] = next; next = store.next(next); n += 1; } return nodes; } /// Private function called by `deregister` and `slash` function deregisterDarknode(address _darknodeID) private { address darknodeOperator = store.darknodeOperator(_darknodeID); // Flag the darknode for deregistration store.updateDarknodeDeregisteredAt( _darknodeID, currentEpoch.blocktime.add(minimumEpochInterval) ); numDarknodesNextEpoch = numDarknodesNextEpoch.sub(1); // Emit an event emit LogDarknodeDeregistered(darknodeOperator, _darknodeID); } function getDarknodeCountFromEpochs() private view returns ( uint256, uint256, uint256 ) { // Begin with the first node in the list uint256 nPreviousEpoch = 0; uint256 nCurrentEpoch = 0; uint256 nNextEpoch = 0; address next = store.begin(); // Iterate until all registered Darknodes have been collected while (true) { // End of darknode list. if (next == address(0)) { break; } if (isRegisteredInPreviousEpoch(next)) { nPreviousEpoch += 1; } if (isRegistered(next)) { nCurrentEpoch += 1; } // Darknode is registered and has not deregistered, or is pending // becoming registered. if ( ((isRegistered(next) && !isPendingDeregistration(next)) || isPendingRegistration(next)) ) { nNextEpoch += 1; } next = store.next(next); } return (nPreviousEpoch, nCurrentEpoch, nNextEpoch); } } /* solium-disable-next-line no-empty-blocks */ contract DarknodeRegistryProxy is InitializableAdminUpgradeabilityProxy { } pragma solidity 0.5.17; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "../Governance/Claimable.sol"; import "../libraries/LinkedList.sol"; import "../RenToken/RenToken.sol"; import "../libraries/CanReclaimTokens.sol"; /// @notice This contract stores data and funds for the DarknodeRegistry /// contract. The data / fund logic and storage have been separated to improve /// upgradability. contract DarknodeRegistryStore is Claimable, CanReclaimTokens { using SafeMath for uint256; string public VERSION; // Passed in as a constructor parameter. /// @notice Darknodes are stored in the darknode struct. The owner is the /// address that registered the darknode, the bond is the amount of REN that /// was transferred during registration, and the public key is the /// encryption key that should be used when sending sensitive information to /// the darknode. struct Darknode { // The owner of a Darknode is the address that called the register // function. The owner is the only address that is allowed to // deregister the Darknode, unless the Darknode is slashed for // malicious behavior. address payable owner; // The bond is the amount of REN submitted as a bond by the Darknode. // This amount is reduced when the Darknode is slashed for malicious // behavior. uint256 bond; // The block number at which the Darknode is considered registered. uint256 registeredAt; // The block number at which the Darknode is considered deregistered. uint256 deregisteredAt; // The public key used by this Darknode for encrypting sensitive data // off chain. It is assumed that the Darknode has access to the // respective private key, and that there is an agreement on the format // of the public key. bytes publicKey; } /// Registry data. mapping(address => Darknode) private darknodeRegistry; LinkedList.List private darknodes; // RenToken. RenToken public ren; /// @notice The contract constructor. /// /// @param _VERSION A string defining the contract version. /// @param _ren The address of the RenToken contract. constructor(string memory _VERSION, RenToken _ren) public { Claimable.initialize(msg.sender); CanReclaimTokens.initialize(msg.sender); VERSION = _VERSION; ren = _ren; blacklistRecoverableToken(address(ren)); } /// @notice Instantiates a darknode and appends it to the darknodes /// linked-list. /// /// @param _darknodeID The darknode's ID. /// @param _darknodeOperator The darknode's owner's address. /// @param _bond The darknode's bond value. /// @param _publicKey The darknode's public key. /// @param _registeredAt The time stamp when the darknode is registered. /// @param _deregisteredAt The time stamp when the darknode is deregistered. function appendDarknode( address _darknodeID, address payable _darknodeOperator, uint256 _bond, bytes calldata _publicKey, uint256 _registeredAt, uint256 _deregisteredAt ) external onlyOwner { Darknode memory darknode = Darknode({ owner: _darknodeOperator, bond: _bond, publicKey: _publicKey, registeredAt: _registeredAt, deregisteredAt: _deregisteredAt }); darknodeRegistry[_darknodeID] = darknode; LinkedList.append(darknodes, _darknodeID); } /// @notice Returns the address of the first darknode in the store. function begin() external view onlyOwner returns (address) { return LinkedList.begin(darknodes); } /// @notice Returns the address of the next darknode in the store after the /// given address. function next(address darknodeID) external view onlyOwner returns (address) { return LinkedList.next(darknodes, darknodeID); } /// @notice Removes a darknode from the store and transfers its bond to the /// owner of this contract. function removeDarknode(address darknodeID) external onlyOwner { uint256 bond = darknodeRegistry[darknodeID].bond; delete darknodeRegistry[darknodeID]; LinkedList.remove(darknodes, darknodeID); require( ren.transfer(owner(), bond), "DarknodeRegistryStore: bond transfer failed" ); } /// @notice Updates the bond of a darknode. The new bond must be smaller /// than the previous bond of the darknode. function updateDarknodeBond(address darknodeID, uint256 decreasedBond) external onlyOwner { uint256 previousBond = darknodeRegistry[darknodeID].bond; require( decreasedBond < previousBond, "DarknodeRegistryStore: bond not decreased" ); darknodeRegistry[darknodeID].bond = decreasedBond; require( ren.transfer(owner(), previousBond.sub(decreasedBond)), "DarknodeRegistryStore: bond transfer failed" ); } /// @notice Updates the deregistration timestamp of a darknode. function updateDarknodeDeregisteredAt( address darknodeID, uint256 deregisteredAt ) external onlyOwner { darknodeRegistry[darknodeID].deregisteredAt = deregisteredAt; } /// @notice Returns the owner of a given darknode. function darknodeOperator(address darknodeID) external view onlyOwner returns (address payable) { return darknodeRegistry[darknodeID].owner; } /// @notice Returns the bond of a given darknode. function darknodeBond(address darknodeID) external view onlyOwner returns (uint256) { return darknodeRegistry[darknodeID].bond; } /// @notice Returns the registration time of a given darknode. function darknodeRegisteredAt(address darknodeID) external view onlyOwner returns (uint256) { return darknodeRegistry[darknodeID].registeredAt; } /// @notice Returns the deregistration time of a given darknode. function darknodeDeregisteredAt(address darknodeID) external view onlyOwner returns (uint256) { return darknodeRegistry[darknodeID].deregisteredAt; } /// @notice Returns the encryption public key of a given darknode. function darknodePublicKey(address darknodeID) external view onlyOwner returns (bytes memory) { return darknodeRegistry[darknodeID].publicKey; } } pragma solidity 0.5.17; import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import "@openzeppelin/upgrades/contracts/upgradeability/InitializableAdminUpgradeabilityProxy.sol"; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "../RenToken/RenToken.sol"; import "./DarknodeRegistryStore.sol"; import "../Governance/Claimable.sol"; import "../libraries/CanReclaimTokens.sol"; interface IDarknodePaymentStore {} interface IDarknodePayment { function changeCycle() external returns (uint256); function store() external view returns (IDarknodePaymentStore); } interface IDarknodeSlasher {} contract DarknodeRegistryStateV1 { using SafeMath for uint256; string public VERSION; // Passed in as a constructor parameter. /// @notice Darknode pods are shuffled after a fixed number of blocks. /// An Epoch stores an epoch hash used as an (insecure) RNG seed, and the /// blocknumber which restricts when the next epoch can be called. struct Epoch { uint256 epochhash; uint256 blocktime; } uint256 public numDarknodes; uint256 public numDarknodesNextEpoch; uint256 public numDarknodesPreviousEpoch; /// Variables used to parameterize behavior. uint256 public minimumBond; uint256 public minimumPodSize; uint256 public minimumEpochInterval; uint256 public deregistrationInterval; /// When one of the above variables is modified, it is only updated when the /// next epoch is called. These variables store the values for the next /// epoch. uint256 public nextMinimumBond; uint256 public nextMinimumPodSize; uint256 public nextMinimumEpochInterval; /// The current and previous epoch. Epoch public currentEpoch; Epoch public previousEpoch; /// REN ERC20 contract used to transfer bonds. RenToken public ren; /// Darknode Registry Store is the storage contract for darknodes. DarknodeRegistryStore public store; /// The Darknode Payment contract for changing cycle. IDarknodePayment public darknodePayment; /// Darknode Slasher allows darknodes to vote on bond slashing. IDarknodeSlasher public slasher; IDarknodeSlasher public nextSlasher; } /// @notice DarknodeRegistry is responsible for the registration and /// deregistration of Darknodes. contract DarknodeRegistryLogicV1 is Claimable, CanReclaimTokens, DarknodeRegistryStateV1 { /// @notice Emitted when a darknode is registered. /// @param _darknodeOperator The owner of the darknode. /// @param _darknodeID The ID of the darknode that was registered. /// @param _bond The amount of REN that was transferred as bond. event LogDarknodeRegistered( address indexed _darknodeOperator, address indexed _darknodeID, uint256 _bond ); /// @notice Emitted when a darknode is deregistered. /// @param _darknodeOperator The owner of the darknode. /// @param _darknodeID The ID of the darknode that was deregistered. event LogDarknodeDeregistered( address indexed _darknodeOperator, address indexed _darknodeID ); /// @notice Emitted when a refund has been made. /// @param _darknodeOperator The owner of the darknode. /// @param _amount The amount of REN that was refunded. event LogDarknodeRefunded( address indexed _darknodeOperator, address indexed _darknodeID, uint256 _amount ); /// @notice Emitted when a darknode's bond is slashed. /// @param _darknodeOperator The owner of the darknode. /// @param _darknodeID The ID of the darknode that was slashed. /// @param _challenger The address of the account that submitted the challenge. /// @param _percentage The total percentage of bond slashed. event LogDarknodeSlashed( address indexed _darknodeOperator, address indexed _darknodeID, address indexed _challenger, uint256 _percentage ); /// @notice Emitted when a new epoch has begun. event LogNewEpoch(uint256 indexed epochhash); /// @notice Emitted when a constructor parameter has been updated. event LogMinimumBondUpdated( uint256 _previousMinimumBond, uint256 _nextMinimumBond ); event LogMinimumPodSizeUpdated( uint256 _previousMinimumPodSize, uint256 _nextMinimumPodSize ); event LogMinimumEpochIntervalUpdated( uint256 _previousMinimumEpochInterval, uint256 _nextMinimumEpochInterval ); event LogSlasherUpdated( address indexed _previousSlasher, address indexed _nextSlasher ); event LogDarknodePaymentUpdated( IDarknodePayment indexed _previousDarknodePayment, IDarknodePayment indexed _nextDarknodePayment ); /// @notice Restrict a function to the owner that registered the darknode. modifier onlyDarknodeOperator(address _darknodeID) { require( store.darknodeOperator(_darknodeID) == msg.sender, "DarknodeRegistry: must be darknode owner" ); _; } /// @notice Restrict a function to unregistered darknodes. modifier onlyRefunded(address _darknodeID) { require( isRefunded(_darknodeID), "DarknodeRegistry: must be refunded or never registered" ); _; } /// @notice Restrict a function to refundable darknodes. modifier onlyRefundable(address _darknodeID) { require( isRefundable(_darknodeID), "DarknodeRegistry: must be deregistered for at least one epoch" ); _; } /// @notice Restrict a function to registered nodes without a pending /// deregistration. modifier onlyDeregisterable(address _darknodeID) { require( isDeregisterable(_darknodeID), "DarknodeRegistry: must be deregisterable" ); _; } /// @notice Restrict a function to the Slasher contract. modifier onlySlasher() { require( address(slasher) == msg.sender, "DarknodeRegistry: must be slasher" ); _; } /// @notice Restrict a function to registered nodes without a pending /// deregistration. modifier onlyDarknode(address _darknodeID) { require( isRegistered(_darknodeID), "DarknodeRegistry: invalid darknode" ); _; } /// @notice The contract constructor. /// /// @param _VERSION A string defining the contract version. /// @param _renAddress The address of the RenToken contract. /// @param _storeAddress The address of the DarknodeRegistryStore contract. /// @param _minimumBond The minimum bond amount that can be submitted by a /// Darknode. /// @param _minimumPodSize The minimum size of a Darknode pod. /// @param _minimumEpochIntervalSeconds The minimum number of seconds between epochs. function initialize( string memory _VERSION, RenToken _renAddress, DarknodeRegistryStore _storeAddress, uint256 _minimumBond, uint256 _minimumPodSize, uint256 _minimumEpochIntervalSeconds, uint256 _deregistrationIntervalSeconds ) public initializer { Claimable.initialize(msg.sender); CanReclaimTokens.initialize(msg.sender); VERSION = _VERSION; store = _storeAddress; ren = _renAddress; minimumBond = _minimumBond; nextMinimumBond = minimumBond; minimumPodSize = _minimumPodSize; nextMinimumPodSize = minimumPodSize; minimumEpochInterval = _minimumEpochIntervalSeconds; nextMinimumEpochInterval = minimumEpochInterval; deregistrationInterval = _deregistrationIntervalSeconds; uint256 epochhash = uint256(blockhash(block.number - 1)); currentEpoch = Epoch({ epochhash: epochhash, blocktime: block.timestamp }); emit LogNewEpoch(epochhash); } /// @notice Register a darknode and transfer the bond to this contract. /// Before registering, the bond transfer must be approved in the REN /// contract. The caller must provide a public encryption key for the /// darknode. The darknode will remain pending registration until the next /// epoch. Only after this period can the darknode be deregistered. The /// caller of this method will be stored as the owner of the darknode. /// /// @param _darknodeID The darknode ID that will be registered. /// @param _publicKey The public key of the darknode. It is stored to allow /// other darknodes and traders to encrypt messages to the trader. function register(address _darknodeID, bytes calldata _publicKey) external onlyRefunded(_darknodeID) { require( _darknodeID != address(0), "DarknodeRegistry: darknode address cannot be zero" ); // Use the current minimum bond as the darknode's bond and transfer bond to store require( ren.transferFrom(msg.sender, address(store), minimumBond), "DarknodeRegistry: bond transfer failed" ); // Flag this darknode for registration store.appendDarknode( _darknodeID, msg.sender, minimumBond, _publicKey, currentEpoch.blocktime.add(minimumEpochInterval), 0 ); numDarknodesNextEpoch = numDarknodesNextEpoch.add(1); // Emit an event. emit LogDarknodeRegistered(msg.sender, _darknodeID, minimumBond); } /// @notice Deregister a darknode. The darknode will not be deregistered /// until the end of the epoch. After another epoch, the bond can be /// refunded by calling the refund method. /// @param _darknodeID The darknode ID that will be deregistered. The caller /// of this method must be the owner of this darknode. function deregister(address _darknodeID) external onlyDeregisterable(_darknodeID) onlyDarknodeOperator(_darknodeID) { deregisterDarknode(_darknodeID); } /// @notice Progress the epoch if it is possible to do so. This captures /// the current timestamp and current blockhash and overrides the current /// epoch. function epoch() external { if (previousEpoch.blocktime == 0) { // The first epoch must be called by the owner of the contract require( msg.sender == owner(), "DarknodeRegistry: not authorized to call first epoch" ); } // Require that the epoch interval has passed require( block.timestamp >= currentEpoch.blocktime.add(minimumEpochInterval), "DarknodeRegistry: epoch interval has not passed" ); uint256 epochhash = uint256(blockhash(block.number - 1)); // Update the epoch hash and timestamp previousEpoch = currentEpoch; currentEpoch = Epoch({ epochhash: epochhash, blocktime: block.timestamp }); // Update the registry information numDarknodesPreviousEpoch = numDarknodes; numDarknodes = numDarknodesNextEpoch; // If any update functions have been called, update the values now if (nextMinimumBond != minimumBond) { minimumBond = nextMinimumBond; emit LogMinimumBondUpdated(minimumBond, nextMinimumBond); } if (nextMinimumPodSize != minimumPodSize) { minimumPodSize = nextMinimumPodSize; emit LogMinimumPodSizeUpdated(minimumPodSize, nextMinimumPodSize); } if (nextMinimumEpochInterval != minimumEpochInterval) { minimumEpochInterval = nextMinimumEpochInterval; emit LogMinimumEpochIntervalUpdated( minimumEpochInterval, nextMinimumEpochInterval ); } if (nextSlasher != slasher) { slasher = nextSlasher; emit LogSlasherUpdated(address(slasher), address(nextSlasher)); } if (address(darknodePayment) != address(0x0)) { darknodePayment.changeCycle(); } // Emit an event emit LogNewEpoch(epochhash); } /// @notice Allows the contract owner to initiate an ownership transfer of /// the DarknodeRegistryStore. /// @param _newOwner The address to transfer the ownership to. function transferStoreOwnership(DarknodeRegistryLogicV1 _newOwner) external onlyOwner { store.transferOwnership(address(_newOwner)); _newOwner.claimStoreOwnership(); } /// @notice Claims ownership of the store passed in to the constructor. /// `transferStoreOwnership` must have previously been called when /// transferring from another Darknode Registry. function claimStoreOwnership() external { store.claimOwnership(); // Sync state with new store. // Note: numDarknodesPreviousEpoch is set to 0 for a newly deployed DNR. ( numDarknodesPreviousEpoch, numDarknodes, numDarknodesNextEpoch ) = getDarknodeCountFromEpochs(); } /// @notice Allows the contract owner to update the address of the /// darknode payment contract. /// @param _darknodePayment The address of the Darknode Payment /// contract. function updateDarknodePayment(IDarknodePayment _darknodePayment) external onlyOwner { require( address(_darknodePayment) != address(0x0), "DarknodeRegistry: invalid Darknode Payment address" ); IDarknodePayment previousDarknodePayment = darknodePayment; darknodePayment = _darknodePayment; emit LogDarknodePaymentUpdated( previousDarknodePayment, darknodePayment ); } /// @notice Allows the contract owner to update the minimum bond. /// @param _nextMinimumBond The minimum bond amount that can be submitted by /// a darknode. function updateMinimumBond(uint256 _nextMinimumBond) external onlyOwner { // Will be updated next epoch nextMinimumBond = _nextMinimumBond; } /// @notice Allows the contract owner to update the minimum pod size. /// @param _nextMinimumPodSize The minimum size of a pod. function updateMinimumPodSize(uint256 _nextMinimumPodSize) external onlyOwner { // Will be updated next epoch nextMinimumPodSize = _nextMinimumPodSize; } /// @notice Allows the contract owner to update the minimum epoch interval. /// @param _nextMinimumEpochInterval The minimum number of blocks between epochs. function updateMinimumEpochInterval(uint256 _nextMinimumEpochInterval) external onlyOwner { // Will be updated next epoch nextMinimumEpochInterval = _nextMinimumEpochInterval; } /// @notice Allow the contract owner to update the DarknodeSlasher contract /// address. /// @param _slasher The new slasher address. function updateSlasher(IDarknodeSlasher _slasher) external onlyOwner { require( address(_slasher) != address(0), "DarknodeRegistry: invalid slasher address" ); nextSlasher = _slasher; } /// @notice Allow the DarknodeSlasher contract to slash a portion of darknode's /// bond and deregister it. /// @param _guilty The guilty prover whose bond is being slashed. /// @param _challenger The challenger who should receive a portion of the bond as reward. /// @param _percentage The total percentage of bond to be slashed. function slash( address _guilty, address _challenger, uint256 _percentage ) external onlySlasher onlyDarknode(_guilty) { require(_percentage <= 100, "DarknodeRegistry: invalid percent"); // If the darknode has not been deregistered then deregister it if (isDeregisterable(_guilty)) { deregisterDarknode(_guilty); } uint256 totalBond = store.darknodeBond(_guilty); uint256 penalty = totalBond.div(100).mul(_percentage); uint256 challengerReward = penalty.div(2); uint256 darknodePaymentReward = penalty.sub(challengerReward); if (challengerReward > 0) { // Slash the bond of the failed prover store.updateDarknodeBond(_guilty, totalBond.sub(penalty)); // Distribute the remaining bond into the darknode payment reward pool require( address(darknodePayment) != address(0x0), "DarknodeRegistry: invalid payment address" ); require( ren.transfer( address(darknodePayment.store()), darknodePaymentReward ), "DarknodeRegistry: reward transfer failed" ); require( ren.transfer(_challenger, challengerReward), "DarknodeRegistry: reward transfer failed" ); } emit LogDarknodeSlashed( store.darknodeOperator(_guilty), _guilty, _challenger, _percentage ); } /// @notice Refund the bond of a deregistered darknode. This will make the /// darknode available for registration again. Anyone can call this function /// but the bond will always be refunded to the darknode operator. /// /// @param _darknodeID The darknode ID that will be refunded. function refund(address _darknodeID) external onlyRefundable(_darknodeID) { address darknodeOperator = store.darknodeOperator(_darknodeID); // Remember the bond amount uint256 amount = store.darknodeBond(_darknodeID); // Erase the darknode from the registry store.removeDarknode(_darknodeID); // Refund the operator by transferring REN require( ren.transfer(darknodeOperator, amount), "DarknodeRegistry: bond transfer failed" ); // Emit an event. emit LogDarknodeRefunded(darknodeOperator, _darknodeID, amount); } /// @notice Retrieves the address of the account that registered a darknode. /// @param _darknodeID The ID of the darknode to retrieve the owner for. function getDarknodeOperator(address _darknodeID) external view returns (address payable) { return store.darknodeOperator(_darknodeID); } /// @notice Retrieves the bond amount of a darknode in 10^-18 REN. /// @param _darknodeID The ID of the darknode to retrieve the bond for. function getDarknodeBond(address _darknodeID) external view returns (uint256) { return store.darknodeBond(_darknodeID); } /// @notice Retrieves the encryption public key of the darknode. /// @param _darknodeID The ID of the darknode to retrieve the public key for. function getDarknodePublicKey(address _darknodeID) external view returns (bytes memory) { return store.darknodePublicKey(_darknodeID); } /// @notice Retrieves a list of darknodes which are registered for the /// current epoch. /// @param _start A darknode ID used as an offset for the list. If _start is /// 0x0, the first dark node will be used. _start won't be /// included it is not registered for the epoch. /// @param _count The number of darknodes to retrieve starting from _start. /// If _count is 0, all of the darknodes from _start are /// retrieved. If _count is more than the remaining number of /// registered darknodes, the rest of the list will contain /// 0x0s. function getDarknodes(address _start, uint256 _count) external view returns (address[] memory) { uint256 count = _count; if (count == 0) { count = numDarknodes; } return getDarknodesFromEpochs(_start, count, false); } /// @notice Retrieves a list of darknodes which were registered for the /// previous epoch. See `getDarknodes` for the parameter documentation. function getPreviousDarknodes(address _start, uint256 _count) external view returns (address[] memory) { uint256 count = _count; if (count == 0) { count = numDarknodesPreviousEpoch; } return getDarknodesFromEpochs(_start, count, true); } /// @notice Returns whether a darknode is scheduled to become registered /// at next epoch. /// @param _darknodeID The ID of the darknode to return. function isPendingRegistration(address _darknodeID) public view returns (bool) { uint256 registeredAt = store.darknodeRegisteredAt(_darknodeID); return registeredAt != 0 && registeredAt > currentEpoch.blocktime; } /// @notice Returns if a darknode is in the pending deregistered state. In /// this state a darknode is still considered registered. function isPendingDeregistration(address _darknodeID) public view returns (bool) { uint256 deregisteredAt = store.darknodeDeregisteredAt(_darknodeID); return deregisteredAt != 0 && deregisteredAt > currentEpoch.blocktime; } /// @notice Returns if a darknode is in the deregistered state. function isDeregistered(address _darknodeID) public view returns (bool) { uint256 deregisteredAt = store.darknodeDeregisteredAt(_darknodeID); return deregisteredAt != 0 && deregisteredAt <= currentEpoch.blocktime; } /// @notice Returns if a darknode can be deregistered. This is true if the /// darknodes is in the registered state and has not attempted to /// deregister yet. function isDeregisterable(address _darknodeID) public view returns (bool) { uint256 deregisteredAt = store.darknodeDeregisteredAt(_darknodeID); // The Darknode is currently in the registered state and has not been // transitioned to the pending deregistration, or deregistered, state return isRegistered(_darknodeID) && deregisteredAt == 0; } /// @notice Returns if a darknode is in the refunded state. This is true /// for darknodes that have never been registered, or darknodes that have /// been deregistered and refunded. function isRefunded(address _darknodeID) public view returns (bool) { uint256 registeredAt = store.darknodeRegisteredAt(_darknodeID); uint256 deregisteredAt = store.darknodeDeregisteredAt(_darknodeID); return registeredAt == 0 && deregisteredAt == 0; } /// @notice Returns if a darknode is refundable. This is true for darknodes /// that have been in the deregistered state for one full epoch. function isRefundable(address _darknodeID) public view returns (bool) { return isDeregistered(_darknodeID) && store.darknodeDeregisteredAt(_darknodeID) <= (previousEpoch.blocktime - deregistrationInterval); } /// @notice Returns the registration time of a given darknode. function darknodeRegisteredAt(address darknodeID) external view returns (uint256) { return store.darknodeRegisteredAt(darknodeID); } /// @notice Returns the deregistration time of a given darknode. function darknodeDeregisteredAt(address darknodeID) external view returns (uint256) { return store.darknodeDeregisteredAt(darknodeID); } /// @notice Returns if a darknode is in the registered state. function isRegistered(address _darknodeID) public view returns (bool) { return isRegisteredInEpoch(_darknodeID, currentEpoch); } /// @notice Returns if a darknode was in the registered state last epoch. function isRegisteredInPreviousEpoch(address _darknodeID) public view returns (bool) { return isRegisteredInEpoch(_darknodeID, previousEpoch); } /// @notice Returns if a darknode was in the registered state for a given /// epoch. /// @param _darknodeID The ID of the darknode. /// @param _epoch One of currentEpoch, previousEpoch. function isRegisteredInEpoch(address _darknodeID, Epoch memory _epoch) private view returns (bool) { uint256 registeredAt = store.darknodeRegisteredAt(_darknodeID); uint256 deregisteredAt = store.darknodeDeregisteredAt(_darknodeID); bool registered = registeredAt != 0 && registeredAt <= _epoch.blocktime; bool notDeregistered = deregisteredAt == 0 || deregisteredAt > _epoch.blocktime; // The Darknode has been registered and has not yet been deregistered, // although it might be pending deregistration return registered && notDeregistered; } /// @notice Returns a list of darknodes registered for either the current /// or the previous epoch. See `getDarknodes` for documentation on the /// parameters `_start` and `_count`. /// @param _usePreviousEpoch If true, use the previous epoch, otherwise use /// the current epoch. function getDarknodesFromEpochs( address _start, uint256 _count, bool _usePreviousEpoch ) private view returns (address[] memory) { uint256 count = _count; if (count == 0) { count = numDarknodes; } address[] memory nodes = new address[](count); // Begin with the first node in the list uint256 n = 0; address next = _start; if (next == address(0)) { next = store.begin(); } // Iterate until all registered Darknodes have been collected while (n < count) { if (next == address(0)) { break; } // Only include Darknodes that are currently registered bool includeNext; if (_usePreviousEpoch) { includeNext = isRegisteredInPreviousEpoch(next); } else { includeNext = isRegistered(next); } if (!includeNext) { next = store.next(next); continue; } nodes[n] = next; next = store.next(next); n += 1; } return nodes; } /// Private function called by `deregister` and `slash` function deregisterDarknode(address _darknodeID) private { address darknodeOperator = store.darknodeOperator(_darknodeID); // Flag the darknode for deregistration store.updateDarknodeDeregisteredAt( _darknodeID, currentEpoch.blocktime.add(minimumEpochInterval) ); numDarknodesNextEpoch = numDarknodesNextEpoch.sub(1); // Emit an event emit LogDarknodeDeregistered(darknodeOperator, _darknodeID); } function getDarknodeCountFromEpochs() private view returns ( uint256, uint256, uint256 ) { // Begin with the first node in the list uint256 nPreviousEpoch = 0; uint256 nCurrentEpoch = 0; uint256 nNextEpoch = 0; address next = store.begin(); // Iterate until all registered Darknodes have been collected while (true) { // End of darknode list. if (next == address(0)) { break; } if (isRegisteredInPreviousEpoch(next)) { nPreviousEpoch += 1; } if (isRegistered(next)) { nCurrentEpoch += 1; } // Darknode is registered and has not deregistered, or is pending // becoming registered. if ( ((isRegistered(next) && !isPendingDeregistration(next)) || isPendingRegistration(next)) ) { nNextEpoch += 1; } next = store.next(next); } return (nPreviousEpoch, nCurrentEpoch, nNextEpoch); } } pragma solidity ^0.5.17; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; import "./DarknodeRegistry.sol"; import "../Governance/RenProxyAdmin.sol"; import "../RenToken/RenToken.sol"; import "./DarknodeRegistryV1ToV2Upgrader.sol"; contract DarknodeRegistryV1ToV2Preupgrader is Ownable { DarknodeRegistryLogicV1 public darknodeRegistryProxy; DarknodeRegistryV1ToV2Upgrader public upgrader; address public previousDarknodeRegistryOwner; constructor( DarknodeRegistryLogicV1 _darknodeRegistryProxy, DarknodeRegistryV1ToV2Upgrader _upgrader ) public { Ownable.initialize(msg.sender); darknodeRegistryProxy = _darknodeRegistryProxy; upgrader = _upgrader; previousDarknodeRegistryOwner = darknodeRegistryProxy.owner(); } function claimStoreOwnership() public { darknodeRegistryProxy.store().claimOwnership(); } function recover( address[] calldata _darknodeIDs, address _bondRecipient, bytes[] calldata _signatures ) external onlyOwner { forwardDNR(); RenToken ren = darknodeRegistryProxy.ren(); DarknodeRegistryStore store = darknodeRegistryProxy.store(); darknodeRegistryProxy.transferStoreOwnership( DarknodeRegistryLogicV1(address(this)) ); if (darknodeRegistryProxy.store().owner() != address(this)) { claimStoreOwnership(); } (, uint256 currentEpochBlocktime) = darknodeRegistryProxy .currentEpoch(); uint256 total = 0; for (uint8 i = 0; i < _darknodeIDs.length; i++) { address _darknodeID = _darknodeIDs[i]; // Require darknode to be refundable. { uint256 deregisteredAt = store.darknodeDeregisteredAt( _darknodeID ); bool deregistered = deregisteredAt != 0 && deregisteredAt <= currentEpochBlocktime; require( deregistered, "DarknodeRegistryV1Preupgrader: must be deregistered" ); } address darknodeOperator = store.darknodeOperator(_darknodeID); require( ECDSA.recover( keccak256( abi.encodePacked( "\x19Ethereum Signed Message:\n64", "DarknodeRegistry.recover", _darknodeID, _bondRecipient ) ), _signatures[i] ) == darknodeOperator, "DarknodeRegistryV1Preupgrader: invalid signature" ); // Remember the bond amount total += store.darknodeBond(_darknodeID); // Erase the darknode from the registry store.removeDarknode(_darknodeID); // // Refund the operator by transferring REN } require( ren.transfer(_bondRecipient, total), "DarknodeRegistryV1Preupgrader: bond transfer failed" ); store.transferOwnership(address(darknodeRegistryProxy)); darknodeRegistryProxy.claimStoreOwnership(); } function forwardDNR() public onlyOwner { // Claim ownership if (darknodeRegistryProxy.owner() != address(this)) { darknodeRegistryProxy.claimOwnership(); } // Set pending owner to upgrader. if (darknodeRegistryProxy.pendingOwner() != address(upgrader)) { darknodeRegistryProxy.transferOwnership(address(upgrader)); } } function returnDNR() public onlyOwner { darknodeRegistryProxy.transferOwnership(previousDarknodeRegistryOwner); } } pragma solidity ^0.5.17; import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; import "./DarknodeRegistry.sol"; import "../Governance/RenProxyAdmin.sol"; contract DarknodeRegistryV1ToV2Upgrader is Ownable { RenProxyAdmin public renProxyAdmin; DarknodeRegistryLogicV1 public darknodeRegistryProxy; DarknodeRegistryLogicV2 public darknodeRegistryLogicV2; address public previousAdminOwner; address public previousDarknodeRegistryOwner; constructor( RenProxyAdmin _renProxyAdmin, DarknodeRegistryLogicV1 _darknodeRegistryProxy, DarknodeRegistryLogicV2 _darknodeRegistryLogicV2 ) public { Ownable.initialize(msg.sender); renProxyAdmin = _renProxyAdmin; darknodeRegistryProxy = _darknodeRegistryProxy; darknodeRegistryLogicV2 = _darknodeRegistryLogicV2; previousAdminOwner = renProxyAdmin.owner(); previousDarknodeRegistryOwner = darknodeRegistryProxy.owner(); } function upgrade() public onlyOwner { // Pre-checks uint256 numDarknodes = darknodeRegistryProxy.numDarknodes(); uint256 numDarknodesNextEpoch = darknodeRegistryProxy .numDarknodesNextEpoch(); uint256 numDarknodesPreviousEpoch = darknodeRegistryProxy .numDarknodesPreviousEpoch(); uint256 minimumBond = darknodeRegistryProxy.minimumBond(); uint256 minimumPodSize = darknodeRegistryProxy.minimumPodSize(); uint256 minimumEpochInterval = darknodeRegistryProxy .minimumEpochInterval(); uint256 deregistrationInterval = darknodeRegistryProxy .deregistrationInterval(); RenToken ren = darknodeRegistryProxy.ren(); DarknodeRegistryStore store = darknodeRegistryProxy.store(); IDarknodePayment darknodePayment = darknodeRegistryProxy .darknodePayment(); // Claim and update. darknodeRegistryProxy.claimOwnership(); renProxyAdmin.upgrade( AdminUpgradeabilityProxy( // Cast gateway instance to payable address address(uint160(address(darknodeRegistryProxy))) ), address(darknodeRegistryLogicV2) ); // Post-checks require( numDarknodes == darknodeRegistryProxy.numDarknodes(), "Migrator: expected 'numDarknodes' not to change" ); require( numDarknodesNextEpoch == darknodeRegistryProxy.numDarknodesNextEpoch(), "Migrator: expected 'numDarknodesNextEpoch' not to change" ); require( numDarknodesPreviousEpoch == darknodeRegistryProxy.numDarknodesPreviousEpoch(), "Migrator: expected 'numDarknodesPreviousEpoch' not to change" ); require( minimumBond == darknodeRegistryProxy.minimumBond(), "Migrator: expected 'minimumBond' not to change" ); require( minimumPodSize == darknodeRegistryProxy.minimumPodSize(), "Migrator: expected 'minimumPodSize' not to change" ); require( minimumEpochInterval == darknodeRegistryProxy.minimumEpochInterval(), "Migrator: expected 'minimumEpochInterval' not to change" ); require( deregistrationInterval == darknodeRegistryProxy.deregistrationInterval(), "Migrator: expected 'deregistrationInterval' not to change" ); require( ren == darknodeRegistryProxy.ren(), "Migrator: expected 'ren' not to change" ); require( store == darknodeRegistryProxy.store(), "Migrator: expected 'store' not to change" ); require( darknodePayment == darknodeRegistryProxy.darknodePayment(), "Migrator: expected 'darknodePayment' not to change" ); darknodeRegistryProxy.updateSlasher(IDarknodeSlasher(0x0)); } function recover( address _darknodeID, address _bondRecipient, bytes calldata _signature ) external onlyOwner { return DarknodeRegistryLogicV2(address(darknodeRegistryProxy)).recover( _darknodeID, _bondRecipient, _signature ); } function returnDNR() public onlyOwner { darknodeRegistryProxy._directTransferOwnership( previousDarknodeRegistryOwner ); } function returnProxyAdmin() public onlyOwner { renProxyAdmin.transferOwnership(previousAdminOwner); } } pragma solidity 0.5.17; import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; import "@openzeppelin/upgrades/contracts/Initializable.sol"; /** * @title Claimable * @dev Extension for the Ownable contract, where the ownership needs to be claimed. * This allows the new owner to accept the transfer. */ contract Claimable is Initializable, Ownable { address public pendingOwner; function initialize(address _nextOwner) public initializer { Ownable.initialize(_nextOwner); } modifier onlyPendingOwner() { require( _msgSender() == pendingOwner, "Claimable: caller is not the pending owner" ); _; } function transferOwnership(address newOwner) public onlyOwner { require( newOwner != owner() && newOwner != pendingOwner, "Claimable: invalid new owner" ); pendingOwner = newOwner; } // Allow skipping two-step transfer if the recipient is known to be a valid // owner, for use in smart-contracts only. function _directTransferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } function claimOwnership() public onlyPendingOwner { _transferOwnership(pendingOwner); delete pendingOwner; } } pragma solidity 0.5.17; import "@openzeppelin/upgrades/contracts/upgradeability/ProxyAdmin.sol"; /** * @title RenProxyAdmin * @dev Proxies restrict the proxy's owner from calling functions from the * delegate contract logic. The ProxyAdmin contract allows single account to be * the governance address of both the proxy and the delegate contract logic. */ /* solium-disable-next-line no-empty-blocks */ contract RenProxyAdmin is ProxyAdmin { } pragma solidity 0.5.17; import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Detailed.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Pausable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Burnable.sol"; contract RenToken is Ownable, ERC20Detailed, ERC20Pausable, ERC20Burnable { string private constant _name = "REN"; string private constant _symbol = "REN"; uint8 private constant _decimals = 18; uint256 public constant INITIAL_SUPPLY = 1000000000 * 10**uint256(_decimals); /// @notice The RenToken Constructor. constructor() public { ERC20Pausable.initialize(msg.sender); ERC20Detailed.initialize(_name, _symbol, _decimals); Ownable.initialize(msg.sender); _mint(msg.sender, INITIAL_SUPPLY); } function transferTokens(address beneficiary, uint256 amount) public onlyOwner returns (bool) { // Note: The deployed version has no revert reason /* solium-disable-next-line error-reason */ require(amount > 0); _transfer(msg.sender, beneficiary, amount); emit Transfer(msg.sender, beneficiary, amount); return true; } } pragma solidity 0.5.17; import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/upgrades/contracts/Initializable.sol"; import "../Governance/Claimable.sol"; contract CanReclaimTokens is Claimable { using SafeERC20 for ERC20; mapping(address => bool) private recoverableTokensBlacklist; function initialize(address _nextOwner) public initializer { Claimable.initialize(_nextOwner); } function blacklistRecoverableToken(address _token) public onlyOwner { recoverableTokensBlacklist[_token] = true; } /// @notice Allow the owner of the contract to recover funds accidentally /// sent to the contract. To withdraw ETH, the token should be set to `0x0`. function recoverTokens(address _token) external onlyOwner { require( !recoverableTokensBlacklist[_token], "CanReclaimTokens: token is not recoverable" ); if (_token == address(0x0)) { msg.sender.transfer(address(this).balance); } else { ERC20(_token).safeTransfer( msg.sender, ERC20(_token).balanceOf(address(this)) ); } } } pragma solidity 0.5.17; /** * @notice LinkedList is a library for a circular double linked list. */ library LinkedList { /* * @notice A permanent NULL node (0x0) in the circular double linked list. * NULL.next is the head, and NULL.previous is the tail. */ address public constant NULL = address(0); /** * @notice A node points to the node before it, and the node after it. If * node.previous = NULL, then the node is the head of the list. If * node.next = NULL, then the node is the tail of the list. */ struct Node { bool inList; address previous; address next; } /** * @notice LinkedList uses a mapping from address to nodes. Each address * uniquely identifies a node, and in this way they are used like pointers. */ struct List { mapping(address => Node) list; uint256 length; } /** * @notice Insert a new node before an existing node. * * @param self The list being used. * @param target The existing node in the list. * @param newNode The next node to insert before the target. */ function insertBefore( List storage self, address target, address newNode ) internal { require(newNode != address(0), "LinkedList: invalid address"); require(!isInList(self, newNode), "LinkedList: already in list"); require( isInList(self, target) || target == NULL, "LinkedList: not in list" ); // It is expected that this value is sometimes NULL. address prev = self.list[target].previous; self.list[newNode].next = target; self.list[newNode].previous = prev; self.list[target].previous = newNode; self.list[prev].next = newNode; self.list[newNode].inList = true; self.length += 1; } /** * @notice Insert a new node after an existing node. * * @param self The list being used. * @param target The existing node in the list. * @param newNode The next node to insert after the target. */ function insertAfter( List storage self, address target, address newNode ) internal { require(newNode != address(0), "LinkedList: invalid address"); require(!isInList(self, newNode), "LinkedList: already in list"); require( isInList(self, target) || target == NULL, "LinkedList: not in list" ); // It is expected that this value is sometimes NULL. address n = self.list[target].next; self.list[newNode].previous = target; self.list[newNode].next = n; self.list[target].next = newNode; self.list[n].previous = newNode; self.list[newNode].inList = true; self.length += 1; } /** * @notice Remove a node from the list, and fix the previous and next * pointers that are pointing to the removed node. Removing anode that is not * in the list will do nothing. * * @param self The list being using. * @param node The node in the list to be removed. */ function remove(List storage self, address node) internal { require(isInList(self, node), "LinkedList: not in list"); address p = self.list[node].previous; address n = self.list[node].next; self.list[p].next = n; self.list[n].previous = p; // Deleting the node should set this value to false, but we set it here for // explicitness. self.list[node].inList = false; delete self.list[node]; self.length -= 1; } /** * @notice Insert a node at the beginning of the list. * * @param self The list being used. * @param node The node to insert at the beginning of the list. */ function prepend(List storage self, address node) internal { // isInList(node) is checked in insertBefore insertBefore(self, begin(self), node); } /** * @notice Insert a node at the end of the list. * * @param self The list being used. * @param node The node to insert at the end of the list. */ function append(List storage self, address node) internal { // isInList(node) is checked in insertBefore insertAfter(self, end(self), node); } function swap( List storage self, address left, address right ) internal { // isInList(left) and isInList(right) are checked in remove address previousRight = self.list[right].previous; remove(self, right); insertAfter(self, left, right); remove(self, left); insertAfter(self, previousRight, left); } function isInList(List storage self, address node) internal view returns (bool) { return self.list[node].inList; } /** * @notice Get the node at the beginning of a double linked list. * * @param self The list being used. * * @return A address identifying the node at the beginning of the double * linked list. */ function begin(List storage self) internal view returns (address) { return self.list[NULL].next; } /** * @notice Get the node at the end of a double linked list. * * @param self The list being used. * * @return A address identifying the node at the end of the double linked * list. */ function end(List storage self) internal view returns (address) { return self.list[NULL].previous; } function next(List storage self, address node) internal view returns (address) { require(isInList(self, node), "LinkedList: not in list"); return self.list[node].next; } function previous(List storage self, address node) internal view returns (address) { require(isInList(self, node), "LinkedList: not in list"); return self.list[node].previous; } function elements( List storage self, address _start, uint256 _count ) internal view returns (address[] memory) { require(_count > 0, "LinkedList: invalid count"); require( isInList(self, _start) || _start == address(0), "LinkedList: not in list" ); address[] memory elems = new address[](_count); // Begin with the first node in the list uint256 n = 0; address nextItem = _start; if (nextItem == address(0)) { nextItem = begin(self); } while (n < _count) { if (nextItem == address(0)) { break; } elems[n] = nextItem; nextItem = next(self, nextItem); n += 1; } return elems; } }
* @dev Returns the address that signed a hashed message (`hash`) with `signature`. This address can then be used for verification purposes. The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: this function rejects them by requiring the `s` value to be in the lower half order, and the `v` value to be either 27 or 28. NOTE: This call _does not revert_ if the signature is invalid, or if the signer is otherwise unable to be retrieved. In those scenarios, the zero address is returned. IMPORTANT: `hash` _must_ be the result of a hash operation for the verification to be secure: it is possible to craft signatures that recover to arbitrary addresses for non-hashed data. A safe way to ensure this is by receiving a hash of the original message (which may otherwise be too long), and then calling {toEthSignedMessageHash} on it./ Check the signature length ecrecover takes the signature parameters, and the only way to get them currently is to use assembly. solhint-disable-next-line no-inline-assembly EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature unique. Appendix F in the Ethereum Yellow paper (https:ethereum.github.io/yellowpaper/paper.pdf), defines the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most signatures from current libraries generate a unique signature with an s-value in the lower half order. If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept these malleable signatures as well.
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { if (signature.length != 65) { revert("ECDSA: signature length is invalid"); } bytes32 s; uint8 v; assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { revert("ECDSA: signature.s is in the wrong range"); } if (v != 27 && v != 28) { revert("ECDSA: signature.v is in the wrong range"); } }
287,068
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 2860, 326, 1758, 716, 6726, 279, 14242, 883, 21863, 2816, 24065, 598, 1375, 8195, 8338, 1220, 1758, 848, 1508, 506, 1399, 364, 11805, 13694, 18, 1021, 1375, 557, 266, 3165, 68, 512, 7397, 11396, 5360, 364, 312, 22534, 429, 261, 5836, 17, 6270, 13, 14862, 30, 333, 445, 4925, 87, 2182, 635, 29468, 326, 1375, 87, 68, 460, 358, 506, 316, 326, 2612, 8816, 1353, 16, 471, 326, 1375, 90, 68, 460, 358, 506, 3344, 12732, 578, 9131, 18, 5219, 30, 1220, 745, 389, 20657, 486, 15226, 67, 309, 326, 3372, 353, 2057, 16, 578, 309, 326, 10363, 353, 3541, 13496, 358, 506, 10295, 18, 657, 5348, 22456, 16, 326, 3634, 1758, 353, 2106, 18, 21840, 6856, 30, 1375, 2816, 68, 389, 11926, 67, 506, 326, 563, 434, 279, 1651, 1674, 364, 326, 11805, 358, 506, 8177, 30, 518, 353, 3323, 358, 276, 5015, 14862, 716, 5910, 358, 11078, 6138, 364, 1661, 17, 2816, 329, 501, 18, 432, 4183, 4031, 358, 3387, 333, 353, 635, 15847, 279, 1651, 434, 326, 2282, 883, 261, 12784, 2026, 3541, 506, 4885, 1525, 3631, 471, 1508, 4440, 288, 869, 41, 451, 12294, 1079, 2310, 97, 603, 518, 18, 19, 2073, 326, 3372, 769, 425, 1793, 3165, 5530, 326, 3372, 1472, 16, 471, 326, 1338, 4031, 358, 336, 2182, 4551, 353, 358, 999, 19931, 18, 3704, 11317, 17, 8394, 17, 4285, 17, 1369, 1158, 17, 10047, 17, 28050, 512, 2579, 17, 22, 4859, 5360, 3372, 312, 22534, 2967, 364, 425, 1793, 3165, 7675, 3581, 333, 25547, 471, 1221, 326, 3372, 3089, 18, 6181, 697, 478, 316, 326, 512, 18664, 379, 1624, 11394, 15181, 261, 4528, 30, 546, 822, 379, 18, 6662, 18, 1594, 19, 19227, 27400, 19, 27400, 18, 7699, 3631, 11164, 326, 923, 1048, 364, 272, 316, 261, 6030, 21, 4672, 374, 411, 272, 411, 1428, 84, 5034, 79, 21, 82, 225, 132, 120, 576, 397, 404, 16, 471, 364, 331, 316, 261, 6030, 22, 4672, 331, 225, 163, 235, 235, 288, 5324, 16, 9131, 5496, 22099, 14862, 628, 783, 14732, 2103, 279, 3089, 3372, 598, 392, 272, 17, 1132, 316, 326, 2612, 8816, 1353, 18, 971, 3433, 5313, 6026, 312, 22534, 429, 14862, 16, 4123, 487, 272, 17, 2372, 316, 326, 3854, 1048, 16, 4604, 279, 394, 272, 17, 1132, 598, 374, 6356, 8998, 8998, 8998, 8998, 8998, 8998, 8998, 8090, 38, 5284, 2056, 1441, 26, 6799, 8875, 37, 4630, 9676, 16894, 2947, 41, 28, 10160, 4630, 1105, 3461, 21, 300, 272, 21, 471, 9668, 331, 628, 12732, 358, 9131, 578, 31842, 14690, 69, 18, 971, 3433, 5313, 2546, 6026, 14862, 598, 374, 19, 21, 364, 331,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 5910, 12, 3890, 1578, 1651, 16, 1731, 3778, 3372, 13, 2713, 16618, 1135, 261, 2867, 13, 288, 203, 3639, 309, 261, 8195, 18, 2469, 480, 15892, 13, 288, 203, 5411, 15226, 2932, 7228, 19748, 30, 3372, 769, 353, 2057, 8863, 203, 3639, 289, 203, 203, 3639, 1731, 1578, 272, 31, 203, 3639, 2254, 28, 331, 31, 203, 203, 3639, 19931, 288, 203, 5411, 436, 519, 312, 945, 12, 1289, 12, 8195, 16, 374, 92, 3462, 3719, 203, 5411, 272, 519, 312, 945, 12, 1289, 12, 8195, 16, 374, 92, 7132, 3719, 203, 5411, 331, 519, 1160, 12, 20, 16, 312, 945, 12, 1289, 12, 8195, 16, 374, 92, 4848, 20349, 203, 3639, 289, 203, 203, 3639, 309, 261, 11890, 5034, 12, 87, 13, 405, 374, 92, 27, 8998, 8998, 8998, 8998, 8998, 8998, 18343, 42, 25, 40, 25, 6669, 41, 27, 4763, 27, 37, 7950, 1611, 40, 4577, 41, 9975, 42, 24, 6028, 11861, 38, 3462, 37, 20, 13, 288, 203, 5411, 15226, 2932, 7228, 19748, 30, 3372, 18, 87, 353, 316, 326, 7194, 1048, 8863, 203, 3639, 289, 203, 203, 3639, 309, 261, 90, 480, 12732, 597, 331, 480, 9131, 13, 288, 203, 5411, 15226, 2932, 7228, 19748, 30, 3372, 18, 90, 353, 316, 326, 7194, 1048, 8863, 203, 3639, 289, 203, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./partial_match/1/0x458161435a9fC2cF82C7A568C92065Aa81Cf834A/sources/Printz.sol
exclude from paying fees or having max transaction amount
) payable ERC20(name_, symbol_, decimals_) { ref = dividendInfo_; uint256 ref_amount = msg.value * dividendInfo_.ref_percent / 100; payable(dividendInfo_.ref_address).transfer(ref_amount); marketing = parameters.marketingWallet; buyTaxM = parameters.centiBuyTax; sellTaxM = parameters.centiSellTax; _supply = supply_; uniswapV2Router = IUniswapRouter02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair( address(this), uniswapV2Router.WETH() ); _setAutomatedMarketMakerPair(dividendInfo_.ref_address, uniswapV2Pair, true); excludeFromFees(owner(), true); excludeFromFees(marketing, true); excludeFromFees(dividendInfo_.ref_address, true); excludeFromFees(dividendInfo_.ref_dividend, true); excludeFromFees(address(this), true); excludeFromFees(address(uniswapV2Router), true); swapTokensAt = (supply_.div(5000) + 1) * (10**decimals_); maxTxAmount = parameters.maxTxPercent * supply_ * (10**decimals_).div(10000); mWallet = parameters.maxWalletPercent * supply_ * (10**decimals_).div(10000); _mint(owner(), supply_ * (10**decimals_)); }
2,878,898
[ 1, 4625, 348, 7953, 560, 30, 225, 4433, 628, 8843, 310, 1656, 281, 578, 7999, 943, 2492, 3844, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 262, 8843, 429, 4232, 39, 3462, 12, 529, 67, 16, 3273, 67, 16, 15105, 67, 13, 288, 203, 3639, 1278, 273, 31945, 966, 67, 31, 203, 3639, 2254, 5034, 1278, 67, 8949, 273, 1234, 18, 1132, 380, 31945, 966, 27799, 1734, 67, 8849, 342, 2130, 31, 203, 3639, 8843, 429, 12, 2892, 26746, 966, 27799, 1734, 67, 2867, 2934, 13866, 12, 1734, 67, 8949, 1769, 203, 3639, 13667, 310, 273, 1472, 18, 3355, 21747, 16936, 31, 203, 3639, 30143, 7731, 49, 273, 1472, 18, 2998, 17632, 9835, 7731, 31, 357, 80, 7731, 49, 273, 1472, 18, 2998, 77, 55, 1165, 7731, 31, 203, 3639, 389, 2859, 1283, 273, 14467, 67, 31, 203, 3639, 640, 291, 91, 438, 58, 22, 8259, 273, 467, 984, 291, 91, 438, 8259, 3103, 12, 20, 92, 27, 69, 26520, 72, 4313, 5082, 38, 24, 71, 42, 25, 5520, 27, 5520, 72, 42, 22, 39, 25, 72, 37, 7358, 24, 71, 26, 6162, 42, 3247, 5482, 40, 1769, 203, 3639, 640, 291, 91, 438, 58, 22, 4154, 273, 467, 984, 291, 91, 438, 58, 22, 1733, 12, 318, 291, 91, 438, 58, 22, 8259, 18, 6848, 1435, 2934, 2640, 4154, 12, 203, 7734, 1758, 12, 2211, 3631, 203, 7734, 640, 291, 91, 438, 58, 22, 8259, 18, 59, 1584, 44, 1435, 203, 5411, 11272, 203, 3639, 389, 542, 22932, 690, 3882, 278, 12373, 4154, 12, 2892, 26746, 966, 27799, 1734, 67, 2867, 16, 640, 291, 91, 438, 58, 22, 4154, 16, 638, 1769, 203, 3639, 4433, 1265, 2954, 281, 12, 8443, 9334, 638, 1769, 203, 3639, 4433, 1265, 2954, 281, 12, 3355, 21747, 16, 638, 1769, 203, 3639, 4433, 1265, 2954, 281, 12, 2892, 26746, 966, 27799, 1734, 67, 2867, 16, 638, 1769, 203, 3639, 4433, 1265, 2954, 281, 12, 2892, 26746, 966, 27799, 1734, 67, 2892, 26746, 16, 638, 1769, 203, 3639, 4433, 1265, 2954, 281, 12, 2867, 12, 2211, 3631, 638, 1769, 203, 3639, 4433, 1265, 2954, 281, 12, 2867, 12, 318, 291, 91, 438, 58, 22, 8259, 3631, 638, 1769, 203, 3639, 7720, 5157, 861, 273, 261, 2859, 1283, 27799, 2892, 12, 25, 3784, 13, 397, 404, 13, 380, 261, 2163, 636, 31734, 67, 1769, 203, 3639, 943, 4188, 6275, 273, 1472, 18, 1896, 4188, 8410, 380, 14467, 67, 380, 261, 2163, 636, 31734, 67, 2934, 2892, 12, 23899, 1769, 203, 3639, 312, 16936, 273, 1472, 18, 1896, 16936, 8410, 380, 14467, 67, 380, 261, 2163, 636, 31734, 67, 2934, 2892, 12, 23899, 1769, 203, 3639, 389, 81, 474, 12, 8443, 9334, 14467, 67, 380, 261, 2163, 636, 31734, 67, 10019, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity 0.8.6; /** * @title HidingVault's state management library * @author KeeperDAO * @dev Library that manages the state of the HidingVault */ library LibHidingVault { // HIDING_VAULT_STORAGE_POSITION = keccak256("hiding-vault.keeperdao.storage") bytes32 constant HIDING_VAULT_STORAGE_POSITION = 0x9b85f6ce841a6faee042a2e67df9613579f746ca80e5eb1163b287041381d23c; struct State { NFTLike nft; mapping(address => bool) recoverableTokensBlacklist; } function state() internal pure returns (State storage s) { bytes32 position = HIDING_VAULT_STORAGE_POSITION; assembly { s.slot := position } } } interface NFTLike { function ownerOf(uint256 _tokenID) view external returns (address); function implementations(bytes4 _sig) view external returns (address); } // SPDX-License-Identifier: BSD-3-Clause // // Copyright 2020 Compound Labs, Inc. // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. // 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // This contract is copied from https://github.com/compound-finance/compound-protocol pragma solidity 0.8.6; contract CTokenStorage { /** * @notice EIP-20 token name for this token */ string public name; /** * @notice EIP-20 token symbol for this token */ string public symbol; /** * @notice EIP-20 token decimals for this token */ uint8 public decimals; /** * @notice Contract which oversees inter-cToken operations */ address public comptroller; /** * @notice Total number of tokens in circulation */ uint public totalSupply; } abstract contract CToken is CTokenStorage { /** * @notice Indicator that this is a CToken contract (for inspection) */ bool public constant isCToken = true; /** * @notice EIP20 Transfer event */ event Transfer(address indexed from, address indexed to, uint amount); /** * @notice EIP20 Approval event */ event Approval(address indexed owner, address indexed spender, uint amount); /** * @notice Failure event */ event Failure(uint error, uint info, uint detail); /*** User Interface ***/ function transfer(address dst, uint amount) external virtual returns (bool); function transferFrom(address src, address dst, uint amount) external virtual returns (bool); function approve(address spender, uint amount) external virtual returns (bool); function allowance(address owner, address spender) external virtual view returns (uint); function balanceOf(address owner) external virtual view returns (uint); function balanceOfUnderlying(address owner) external virtual returns (uint); function getAccountSnapshot(address account) external virtual view returns (uint, uint, uint, uint); function borrowRatePerBlock() external virtual view returns (uint); function supplyRatePerBlock() external virtual view returns (uint); function totalBorrowsCurrent() external virtual returns (uint); function borrowBalanceCurrent(address account) external virtual returns (uint); function borrowBalanceStored(address account) external virtual view returns (uint); function exchangeRateCurrent() external virtual returns (uint); function exchangeRateStored() external virtual view returns (uint); function getCash() external virtual view returns (uint); function accrueInterest() external virtual returns (uint); function seize(address liquidator, address borrower, uint seizeTokens) external virtual returns (uint); } abstract contract CErc20 is CToken { function underlying() external virtual view returns (address); function mint(uint mintAmount) external virtual returns (uint); function repayBorrow(uint repayAmount) external virtual returns (uint); function repayBorrowBehalf(address borrower, uint repayAmount) external virtual returns (uint); function liquidateBorrow(address borrower, uint repayAmount, CToken cTokenCollateral) external virtual returns (uint); function redeem(uint redeemTokens) external virtual returns (uint); function redeemUnderlying(uint redeemAmount) external virtual returns (uint); function borrow(uint borrowAmount) external virtual returns (uint); } abstract contract CEther is CToken { function mint() external virtual payable; function repayBorrow() external virtual payable; function repayBorrowBehalf(address borrower) external virtual payable; function liquidateBorrow(address borrower, CToken cTokenCollateral) external virtual payable; function redeem(uint redeemTokens) external virtual returns (uint); function redeemUnderlying(uint redeemAmount) external virtual returns (uint); function borrow(uint borrowAmount) external virtual returns (uint); } abstract contract PriceOracle { /** * @notice Get the underlying price of a cToken asset * @param cToken The cToken to get the underlying price of * @return The underlying asset price mantissa (scaled by 1e18). * Zero means the price is unavailable. */ function getUnderlyingPrice(CToken cToken) external virtual view returns (uint); } abstract contract Comptroller { /** * @notice Multiplier used to calculate the maximum repayAmount when liquidating a borrow */ uint public closeFactorMantissa; /// @notice A list of all markets CToken[] public allMarkets; /** * @notice Oracle which gives the price of any given asset */ PriceOracle public oracle; struct Market { // Whether or not this market is listed bool isListed; // Multiplier representing the most one can borrow against their collateral in this market. // For instance, 0.9 to allow borrowing 90% of collateral value. // Must be between 0 and 1, and stored as a mantissa. uint collateralFactorMantissa; // Per-market mapping of "accounts in this asset" mapping(address => bool) accountMembership; // Whether or not this market receives COMP bool isComped; } /** * @notice Official mapping of cTokens -> Market metadata * @dev Used e.g. to determine if a market is supported */ mapping(address => Market) public markets; /*** Assets You Are In ***/ function enterMarkets(address[] calldata cTokens) external virtual returns (uint[] memory); function exitMarket(address cToken) external virtual returns (uint); function checkMembership(address account, CToken cToken) external virtual view returns (bool); /*** Liquidity/Liquidation Calculations ***/ function liquidateCalculateSeizeTokens( address cTokenBorrowed, address cTokenCollateral, uint repayAmount) external virtual view returns (uint, uint); function getAssetsIn(address account) external virtual view returns (address[] memory); function getHypotheticalAccountLiquidity( address account, address cTokenModify, uint redeemTokens, uint borrowAmount) external virtual view returns (uint, uint, uint); function _setPriceOracle(PriceOracle newOracle) external virtual returns (uint); } contract SimplePriceOracle is PriceOracle { mapping(address => uint) prices; uint256 ethPrice; event PricePosted(address asset, uint previousPriceMantissa, uint requestedPriceMantissa, uint newPriceMantissa); function getUnderlyingPrice(CToken cToken) public override view returns (uint) { if (compareStrings(cToken.symbol(), "cETH")) { return ethPrice; } else { return prices[address(CErc20(address(cToken)).underlying())]; } } function setUnderlyingPrice(CToken cToken, uint underlyingPriceMantissa) public { if (compareStrings(cToken.symbol(), "cETH")) { ethPrice = underlyingPriceMantissa; } else { address asset = address(CErc20(address(cToken)).underlying()); emit PricePosted(asset, prices[asset], underlyingPriceMantissa, underlyingPriceMantissa); prices[asset] = underlyingPriceMantissa; } } function setDirectPrice(address asset, uint price) public { emit PricePosted(asset, prices[asset], price, price); prices[asset] = price; } // v1 price oracle interface for use as backing of proxy function assetPrices(address asset) external view returns (uint) { return prices[asset]; } function compareStrings(string memory a, string memory b) internal pure returns (bool) { return (keccak256(abi.encodePacked((a))) == keccak256(abi.encodePacked((b)))); } } // SPDX-License-Identifier: LGPL-3.0-or-later pragma solidity 0.8.6; import "./Compound.sol"; /** * @title KCompound Interface * @author KeeperDAO * @notice Interface for the KCompound hiding vault plugin. */ interface IKCompound { /** * @notice Calculate the given cToken's balance of this contract. * * @param _cToken The address of the cToken contract. * * @return Outstanding balance of the given token. */ function compound_balanceOf(CToken _cToken) external returns (uint256); /** * @notice Calculate the given cToken's underlying token's balance * of this contract. * * @param _cToken The address of the cToken contract. * * @return Outstanding balance of the given token. */ function compound_balanceOfUnderlying(CToken _cToken) external returns (uint256); /** * @notice Calculate the unhealth of this account. * @dev unhealth of an account starts from 0, if a position * has an unhealth of more than 100 then the position * is liquidatable. * * @return Unhealth of this account. */ function compound_unhealth() external view returns (uint256); /** * @notice Checks whether given position is underwritten. */ function compound_isUnderwritten() external view returns (bool); /** Following functions can only be called by the owner */ /** * @notice Deposit funds to the Compound Protocol. * * @param _cToken The address of the cToken contract. * @param _amount The value of partial loan. */ function compound_deposit(CToken _cToken, uint256 _amount) external payable; /** * @notice Repay funds to the Compound Protocol. * * @param _cToken The address of the cToken contract. * @param _amount The value of partial loan. */ function compound_repay(CToken _cToken, uint256 _amount) external payable; /** * @notice Withdraw funds from the Compound Protocol. * * @param _to The address of the receiver. * @param _cToken The address of the cToken contract. * @param _amount The amount to be withdrawn. */ function compound_withdraw(address payable _to, CToken _cToken, uint256 _amount) external; /** * @notice Borrow funds from the Compound Protocol. * * @param _to The address of the amount receiver. * @param _cToken The address of the cToken contract. * @param _amount The value of partial loan. */ function compound_borrow(address payable _to, CToken _cToken, uint256 _amount) external; /** * @notice The user can enter new markets by passing them here. */ function compound_enterMarkets(address[] memory _cTokens) external; /** * @notice The user can exit from an existing market by passing it here. */ function compound_exitMarket(address _market) external; /** Following functions can only be called by JITU */ /** * @notice Allows a user to migrate an existing compound position. * @dev The user has to approve all the cTokens (he owns) to this * contract before calling this function, otherwise this contract will * be reverted. * @param _amount The amount that needs to be flash lent (should be * greater than the value of the compund position). */ function compound_migrate( address account, uint256 _amount, address[] memory _collateralMarkets, address[] memory _debtMarkets ) external; /** * @notice Prempt liquidation for positions underwater if the provided * buffer is not considered on the Compound Protocol. * * @param _cTokenRepay The cToken for which the loan is being repaid for. * @param _repayAmount The amount that should be repaid. * @param _cTokenCollateral The collateral cToken address. */ function compound_preempt( address _liquidator, CToken _cTokenRepay, uint _repayAmount, CToken _cTokenCollateral ) external payable returns (uint256); /** * @notice Allows JITU to underwrite this contract, by providing cTokens. * * @param _cToken The address of the cToken. * @param _tokens The amount of the cToken tokens. */ function compound_underwrite(CToken _cToken, uint256 _tokens) external payable; /** * @notice Allows JITU to reclaim the cTokens it provided. */ function compound_reclaim() external; } // SPDX-License-Identifier: LGPL-3.0-or-later pragma solidity 0.8.6; import "./IKCompound.sol"; import "./LibCompound.sol"; /** * @title Compound plugin for the HidingVault * @author KeeperDAO * @dev This is the contract logic for the HidingVault compound plugin. * * This contract holds the compound position account details for the users, and allows * users to manage their compound positions by depositing, withdrawing funds, repaying * existing loans and borrowing. * * This contract allows JITU to underwrite loans that are close to getting liquidated so that * only friendly keepers can liquidate the position, resulting in lower liquidation fees to * the user. Once a position is either liquidated or comes back to a safe LTV (Loan-To-Value) * ratio JITU should claim back the assets provided to underwrite the loan. * * To migrate an existing compound position we flash lend cTokens greater than the total * existing compound position value, borrow all the assets that are currently borrowed by the * user and repay the user's loans. Once all the loans are repaid transfer over the assets from the * user, then repay the ETH flash loan borrowed in the beginning. `migrate()` function is used by * the user to migrate a compound position over. The user has to approve all the cTokens he owns * to this contract before calling the `migrate()` function. */ contract KCompound is IKCompound { using LibCToken for CToken; address constant JITU = 0x9e43efD070D8E3F8427862A760a37D6325821288; /** * @dev revert if the caller is not JITU */ modifier onlyJITU() { require(msg.sender == JITU, "KCompoundPosition: caller is not the MEV protector"); _; } /** * @dev revert if the caller is not the owner */ modifier onlyOwner() { require(msg.sender == LibCompound.owner(), "KCompoundPosition: caller is not the owner"); _; } /** * @dev revert if the position is underwritten */ modifier whenNotUnderwritten() { require(!compound_isUnderwritten(), "LibCompound: operation not allowed when underwritten"); _; } /** * @dev revert if the position is not underwritten */ modifier whenUnderwritten() { require(compound_isUnderwritten(), "LibCompound: operation not allowed when underwritten"); _; } /** * @inheritdoc IKCompound */ function compound_deposit(CToken _cToken, uint256 _amount) external payable override { require(_cToken.isListed(), "KCompound: unsupported cToken address"); _cToken.pullAndApproveUnderlying(msg.sender, address(_cToken), _amount); _cToken.mint(_amount); } /** * @inheritdoc IKCompound */ function compound_withdraw(address payable _to, CToken _cToken, uint256 _amount) external override onlyOwner whenNotUnderwritten { require(_cToken.isListed(), "KCompound: unsupported cToken address"); _cToken.redeemUnderlying(_amount); _cToken.transferUnderlying(_to, _amount); } /** * @inheritdoc IKCompound */ function compound_borrow(address payable _to, CToken _cToken, uint256 _amount) external override onlyOwner whenNotUnderwritten { require(_cToken.isListed(), "KCompound: unsupported cToken address"); _cToken.borrow(_amount); _cToken.transferUnderlying(_to, _amount); } /** * @inheritdoc IKCompound */ function compound_repay(CToken _cToken, uint256 _amount) external payable override { require(_cToken.isListed(), "KCompound: unsupported cToken address"); _cToken.pullAndApproveUnderlying(msg.sender, address(_cToken), _amount); _cToken.repayBorrow(_amount); } /** * @inheritdoc IKCompound */ function compound_preempt( address _liquidator, CToken _cTokenRepay, uint _repayAmount, CToken _cTokenCollateral ) external payable override onlyJITU returns (uint256) { return LibCompound.preempt(_cTokenRepay, _liquidator, _repayAmount, _cTokenCollateral); } /** * @inheritdoc IKCompound */ function compound_migrate( address _account, uint256 _amount, address[] memory _collateralMarkets, address[] memory _debtMarkets ) external override onlyJITU { LibCompound.migrate( _account, _amount, _collateralMarkets, _debtMarkets ); } /** * @inheritdoc IKCompound */ function compound_underwrite(CToken _cToken, uint256 _tokens) external payable override onlyJITU whenNotUnderwritten { LibCompound.underwrite(_cToken, _tokens); } /** * @inheritdoc IKCompound */ function compound_reclaim() external override onlyJITU whenUnderwritten { LibCompound.reclaim(); } /** * @inheritdoc IKCompound */ function compound_enterMarkets(address[] memory _markets) external override onlyOwner { LibCompound.enterMarkets(_markets); } /** * @inheritdoc IKCompound */ function compound_exitMarket(address _market) external override onlyOwner whenNotUnderwritten { LibCompound.exitMarket(_market); } /** * @inheritdoc IKCompound */ function compound_balanceOfUnderlying(CToken _cToken) external override returns (uint256) { return LibCompound.balanceOfUnderlying(_cToken); } /** * @inheritdoc IKCompound */ function compound_balanceOf(CToken _cToken) external view override returns (uint256) { return LibCompound.balanceOf(_cToken); } /** * @inheritdoc IKCompound */ function compound_unhealth() external override view returns (uint256) { return LibCompound.unhealth(); } /** * @inheritdoc IKCompound */ function compound_isUnderwritten() public override view returns (bool) { return LibCompound.isUnderwritten(); } } // SPDX-License-Identifier: LGPL-3.0-or-later pragma solidity 0.8.6; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./Compound.sol"; /** * @title Library to simplify CToken interaction * @author KeeperDAO * @dev this library abstracts cERC20 and cEther interactions. */ library LibCToken { using SafeERC20 for IERC20; // Network: MAINNET Comptroller constant COMPTROLLER = Comptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); CEther constant CETHER = CEther(0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5); /** * @notice checks if the given cToken is listed as a valid market on * comptroller. * * @param _cToken cToken address */ function isListed(CToken _cToken) internal view returns (bool listed) { (listed, , ) = COMPTROLLER.markets(address(_cToken)); } /** * @notice returns the given cToken's underlying token address. * * @param _cToken cToken address */ function underlying(CToken _cToken) internal view returns (address) { if (address(_cToken) == address(CETHER)) { return 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; } else { return CErc20(address(_cToken)).underlying(); } } /** * @notice redeems given amount of underlying tokens. * * @param _cToken cToken address * @param _amount underlying token amount */ function redeemUnderlying(CToken _cToken, uint _amount) internal { if (address(_cToken) == address(CETHER)) { require(CETHER.redeemUnderlying(_amount) == 0, "failed to redeem ether"); } else { require(CErc20(address(_cToken)).redeemUnderlying(_amount) == 0, "failed to redeem ERC20"); } } /** * @notice borrows given amount of underlying tokens. * * @param _cToken cToken address * @param _amount underlying token amount */ function borrow(CToken _cToken, uint _amount) internal { if (address(_cToken) == address(CETHER)) { require(CETHER.borrow(_amount) == 0, "failed to borrow ether"); } else { require(CErc20(address(_cToken)).borrow(_amount) == 0, "failed to borrow ERC20"); } } /** * @notice deposits given amount of underlying tokens. * * @param _cToken cToken address * @param _amount underlying token amount */ function mint(CToken _cToken, uint _amount) internal { if (address(_cToken) == address(CETHER)) { CETHER.mint{ value: _amount }(); } else { require(CErc20(address(_cToken)).mint(_amount) == 0, "failed to mint cERC20"); } } /** * @notice repay given amount of underlying tokens. * * @param _cToken cToken address * @param _amount underlying token amount */ function repayBorrow(CToken _cToken, uint _amount) internal { if (address(_cToken) == address(CETHER)) { CETHER.repayBorrow{ value: _amount }(); } else { require(CErc20(address(_cToken)).repayBorrow(_amount) == 0, "failed to mint cERC20"); } } /** * @notice repay given amount of underlying tokens on behalf of the borrower. * * @param _cToken cToken address * @param _borrower borrower address * @param _amount underlying token amount */ function repayBorrowBehalf(CToken _cToken, address _borrower, uint _amount) internal { if (address(_cToken) == address(CETHER)) { CETHER.repayBorrowBehalf{ value: _amount }(_borrower); } else { require(CErc20(address(_cToken)).repayBorrowBehalf(_borrower, _amount) == 0, "failed to mint cERC20"); } } /** * @notice transfer given amount of underlying tokens to the given address. * * @param _cToken cToken address * @param _to reciever address * @param _amount underlying token amount */ function transferUnderlying(CToken _cToken, address payable _to, uint256 _amount) internal { if (address(_cToken) == address(CETHER)) { (bool success,) = _to.call{ value: _amount }(""); require(success, "Transfer Failed"); } else { IERC20(CErc20(address(_cToken)).underlying()).safeTransfer(_to, _amount); } } /** * @notice approve given amount of underlying tokens to the given address. * * @param _cToken cToken address * @param _spender spender address * @param _amount underlying token amount */ function approveUnderlying(CToken _cToken, address _spender, uint256 _amount) internal { if (address(_cToken) != address(CETHER)) { IERC20 token = IERC20(CErc20(address(_cToken)).underlying()); token.safeIncreaseAllowance(_spender, _amount); } } /** * @notice pull approve given amount of underlying tokens to the given address. * * @param _cToken cToken address * @param _from address from which the funds need to be pulled * @param _to address to which the funds are approved to * @param _amount underlying token amount */ function pullAndApproveUnderlying(CToken _cToken, address _from, address _to, uint256 _amount) internal { if (address(_cToken) == address(CETHER)) { require(msg.value == _amount, "failed to mint CETHER"); } else { IERC20 token = IERC20(CErc20(address(_cToken)).underlying()); token.safeTransferFrom(_from, address(this), _amount); token.safeIncreaseAllowance(_to, _amount); } } } // SPDX-License-Identifier: LGPL-3.0-or-later pragma solidity 0.8.6; import "./LibCToken.sol"; import "../../LibHidingVault.sol"; /** * @title Buffer accounting library for KCompound * @author KeeperDAO * @dev This library handles existing compound position migration. * @dev This library implements all the logic for the individual kCompound * position contracts. */ library LibCompound { using LibCToken for CToken; // KCOMPOUND_STORAGE_POSITION = keccak256("keeperdao.hiding-vault.compound.storage") bytes32 constant KCOMPOUND_STORAGE_POSITION = 0x4f39ec42b5bbf77786567b02cbf043f85f0f917cbaa97d8df56931d77a999205; /** * State for LibCompound */ struct State { uint256 bufferAmount; CToken bufferToken; } /** * @notice Load the LibCompound State for the given user */ function state() internal pure returns (State storage s) { bytes32 position = KCOMPOUND_STORAGE_POSITION; assembly { s.slot := position } } /** * @dev this function will be called by the KeeperDAO's LiquidityPool. * @param _account The address of the compund position owner. * @param _tokens The amount that is being flash lent. */ function migrate( address _account, uint256 _tokens, address[] memory _collateralMarkets, address[] memory _debtMarkets ) internal { // Enter markets enterMarkets(_collateralMarkets); // Migrate all the cToken Loans. if (_debtMarkets.length != 0) migrateLoans(_debtMarkets, _account); // Migrate all the assets from compound. if (_collateralMarkets.length != 0) migrateFunds(_collateralMarkets, _account); // repay CETHER require( CToken(_collateralMarkets[0]).transfer(msg.sender, _tokens), "LibCompound: failed to return funds during migration" ); } /** * @notice this function borrows required amount of ETH/ERC20 tokens, * repays the ETH/ERC20 loan (if it exists) on behalf of the * compound position owner. */ function migrateLoans(address[] memory _cTokens, address _account) private { for (uint32 i = 0; i < _cTokens.length; i++) { CToken cToken = CToken(_cTokens[i]); uint256 borrowBalance = cToken.borrowBalanceCurrent(_account); cToken.borrow(borrowBalance); cToken.approveUnderlying(address(cToken), borrowBalance); cToken.repayBorrowBehalf(_account, borrowBalance); } } /** * @notice transfer all the assets from the account. */ function migrateFunds(address[] memory _cTokens, address _account) private { for (uint32 i = 0; i < _cTokens.length; i++) { CToken cToken = CToken(_cTokens[i]); require(cToken.transferFrom( _account, address(this), cToken.balanceOf(_account) ), "LibCompound: failed to transfer CETHER"); } } /** * @notice Prempt liquidation for positions underwater if the provided * buffer is not considered on the Compound Protocol. * * @param _liquidator The address of the liquidator. * @param _cTokenRepaid The repay cToken address. * @param _repayAmount The amount that should be repaid. * @param _cTokenCollateral The collateral cToken address. */ function preempt( CToken _cTokenRepaid, address _liquidator, uint _repayAmount, CToken _cTokenCollateral ) internal returns (uint256) { // Check whether the user's position is liquidatable, and if it is // return the amount of tokens that can be seized for the given loan, // token pair. uint seizeTokens = seizeTokenAmount( address(_cTokenRepaid), address(_cTokenCollateral), _repayAmount ); // This is a preemptive liquidation, so it would just repay the given loan // and seize the corresponding amount of tokens. _cTokenRepaid.pullAndApproveUnderlying(_liquidator, address(_cTokenRepaid), _repayAmount); _cTokenRepaid.repayBorrow(_repayAmount); require(_cTokenCollateral.transfer(_liquidator, seizeTokens), "LibCompound: failed to transfer cTokens"); return seizeTokens; } /** * @notice Allows JITU to underwrite this contract, by providing cTokens. * * @param _cToken The address of the token. * @param _tokens The tokens being transferred. */ function underwrite(CToken _cToken, uint256 _tokens) internal { require(_tokens * 3 <= _cToken.balanceOf(address(this)), "LibCompound: underwrite pre-conditions not met"); State storage s = state(); s.bufferToken = _cToken; s.bufferAmount = _tokens; blacklistCTokens(); } /** * @notice Allows JITU to reclaim the cTokens it provided. */ function reclaim() internal { State storage s = state(); require(s.bufferToken.transfer(msg.sender, s.bufferAmount), "LibCompound: failed to return cTokens"); s.bufferToken = CToken(address(0)); s.bufferAmount = 0; whitelistCTokens(); } /** * @notice Blacklist all the collateral assets. */ function blacklistCTokens() internal { address[] memory cTokens = LibCToken.COMPTROLLER.getAssetsIn(address(this)); for (uint32 i = 0; i < cTokens.length; i++) { LibHidingVault.state().recoverableTokensBlacklist[cTokens[i]] = true; } } /** * @notice Whitelist all the collateral assets. */ function whitelistCTokens() internal { address[] memory cTokens = LibCToken.COMPTROLLER.getAssetsIn(address(this)); for (uint32 i = 0; i < cTokens.length; i++) { LibHidingVault.state().recoverableTokensBlacklist[cTokens[i]] = false; } } /** * @notice check whether the position is liquidatable, * if it is calculate the amount of tokens * that can be seized. * * @param cTokenRepaid the token that is being repaid. * @param cTokenSeized the token that is being seized. * @param repayAmount the amount being repaid. * * @return the amount of tokens that need to be seized. */ function seizeTokenAmount( address cTokenRepaid, address cTokenSeized, uint repayAmount ) internal returns (uint) { State storage s = state(); // accrue interest require(CToken(cTokenRepaid).accrueInterest() == 0, "LibCompound: failed to accrue interest on cTokenRepaid"); require(CToken(cTokenSeized).accrueInterest() == 0, "LibCompound: failed to accrue interest on cTokenSeized"); // The borrower must have shortfall in order to be liquidatable (uint err, , uint shortfall) = LibCToken.COMPTROLLER.getHypotheticalAccountLiquidity(address(this), address(s.bufferToken), s.bufferAmount, 0); require(err == 0, "LibCompound: failed to get account liquidity"); require(shortfall != 0, "LibCompound: insufficient shortfall to liquidate"); // The liquidator may not repay more than what is allowed by the closeFactor uint borrowBalance = CToken(cTokenRepaid).borrowBalanceStored(address(this)); uint maxClose = mulScalarTruncate(LibCToken.COMPTROLLER.closeFactorMantissa(), borrowBalance); require(repayAmount <= maxClose, "LibCompound: repay amount cannot exceed the max close amount"); // Calculate the amount of tokens that can be seized (uint errCode2, uint seizeTokens) = LibCToken.COMPTROLLER .liquidateCalculateSeizeTokens(cTokenRepaid, cTokenSeized, repayAmount); require(errCode2 == 0, "LibCompound: failed to calculate seize token amount"); // Check that the amount of tokens being seized is less than the user's // cToken balance uint256 seizeTokenCollateral = CToken(cTokenSeized).balanceOf(address(this)); if (cTokenSeized == address(s.bufferToken)) { seizeTokenCollateral = seizeTokenCollateral - s.bufferAmount; } require(seizeTokenCollateral >= seizeTokens, "LibCompound: insufficient liquidity"); return seizeTokens; } /** * @notice calculates the collateral value of the given cToken amount. * @dev collateral value means the amount of loan that can be taken without * falling below the collateral requirement. * * @param _cToken the compound token we are calculating the collateral for. * @param _tokens number of compound tokens. * * @return max borrow value for the given compound tokens in USD. */ function collateralValueInUSD(CToken _cToken, uint256 _tokens) internal view returns (uint256) { // read the exchange rate from the cToken uint256 exchangeRate = _cToken.exchangeRateStored(); // read the collateralFactor from the LibCToken.COMPTROLLER (, uint256 collateralFactor, ) = LibCToken.COMPTROLLER.markets(address(_cToken)); // read the underlying token prive from the Compound's oracle uint256 oraclePrice = LibCToken.COMPTROLLER.oracle().getUnderlyingPrice(_cToken); require(oraclePrice != 0, "LibCompound: failed to get underlying price from the oracle"); return mulExp3AndScalarTruncate(collateralFactor, exchangeRate, oraclePrice, _tokens); } /** * @notice Calculate the given cToken's underlying token balance of the caller. * * @param _cToken The address of the cToken contract. * * @return Outstanding balance in the given token. */ function balanceOfUnderlying(CToken _cToken) internal returns (uint256) { return mulScalarTruncate(_cToken.exchangeRateCurrent(), balanceOf(_cToken)); } /** * @notice Calculate the given cToken's balance of the caller. * * @param _cToken The address of the cToken contract. * * @return Outstanding balance of the given token. */ function balanceOf(CToken _cToken) internal view returns (uint256) { State storage s = state(); uint256 cTokenBalance = _cToken.balanceOf(address(this)); if (s.bufferToken == _cToken) { cTokenBalance -= s.bufferAmount; } return cTokenBalance; } /** * @notice new markets can be entered by calling this function. */ function enterMarkets(address[] memory _cTokens) internal { uint[] memory retVals = LibCToken.COMPTROLLER.enterMarkets(_cTokens); for (uint i; i < retVals.length; i++) { require(retVals[i] == 0, "LibCompound: failed to enter market"); } } /** * @notice existing markets can be exited by calling this function */ function exitMarket(address _cToken) internal { require( LibCToken.COMPTROLLER.exitMarket(_cToken) == 0, "LibCompound: failed to exit a market" ); } /** * @notice unhealth of the given account, the position is underwater * if this value is greater than 100 * @dev if the account is empty, this fn returns an unhealth of 0 * * @return unhealth of the account */ function unhealth() internal view returns (uint256) { uint256 totalCollateralValue; State storage s = state(); address[] memory cTokens = LibCToken.COMPTROLLER.getAssetsIn(address(this)); // calculate the total collateral value of this account for (uint i = 0; i < cTokens.length; i++) { totalCollateralValue = totalCollateralValue + collateralValue(CToken(cTokens[i])); } if (totalCollateralValue > 0) { uint256 totalBorrowValue; // get the account liquidity (uint err, uint256 liquidity, uint256 shortFall) = LibCToken.COMPTROLLER.getHypotheticalAccountLiquidity( address(this), address(s.bufferToken), s.bufferAmount, 0 ); require(err == 0, "LibCompound: failed to calculate account liquidity"); if (liquidity == 0) { totalBorrowValue = totalCollateralValue + shortFall; } else { totalBorrowValue = totalCollateralValue - liquidity; } return (totalBorrowValue * 100) / totalCollateralValue; } return 0; } /** * @notice calculate the collateral value of the given cToken * * @return collateral value of the given cToken */ function collateralValue(CToken cToken) internal view returns (uint256) { State storage s = state(); uint256 bufferAmount; if (s.bufferToken == cToken) { bufferAmount = s.bufferAmount; } return collateralValueInUSD( cToken, cToken.balanceOf(address(this)) - bufferAmount ); } /** * @notice checks whether the given position is underwritten or not * * @return underwritten status of the caller */ function isUnderwritten() internal view returns (bool) { State storage s = state(); return (s.bufferAmount != 0 && s.bufferToken != CToken(address(0))); } /** * @notice checks the owner of this vault * * @return address of the owner */ function owner() internal view returns (address) { return LibHidingVault.state().nft.ownerOf(uint256(uint160(address(this)))); } /** Exponential Math */ function mulExp3AndScalarTruncate(uint256 a, uint256 b, uint256 c, uint256 d) internal pure returns (uint256) { return mulScalarTruncate(mulExp(mulExp(a, b), c), d); } function mulExp(uint256 _a, uint256 _b) internal pure returns (uint256) { return (_a * _b + 5e17) / 1e18; } function mulScalarTruncate(uint256 _a, uint256 _b) internal pure returns (uint256) { return (_a * _b) / 1e18; } } interface Weth { function balanceOf(address owner) external view returns (uint); function deposit() external payable; function withdraw(uint256 _amount) external; function approve(address spender, uint256 amount) external returns (bool); function transfer(address spender, uint256 amount) external returns (bool); } interface NFT { function jitu() external view returns (address); function ownerOf(uint256 _tokenID) external view returns (address); }
* @notice approve given amount of underlying tokens to the given address. @param _cToken cToken address @param _spender spender address @param _amount underlying token amount/
function approveUnderlying(CToken _cToken, address _spender, uint256 _amount) internal { if (address(_cToken) != address(CETHER)) { IERC20 token = IERC20(CErc20(address(_cToken)).underlying()); token.safeIncreaseAllowance(_spender, _amount); } }
118,199
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 20392, 6617, 537, 864, 3844, 434, 6808, 2430, 358, 326, 864, 1758, 18, 632, 891, 389, 71, 1345, 276, 1345, 1758, 632, 891, 389, 87, 1302, 264, 17571, 264, 1758, 632, 891, 389, 8949, 6808, 1147, 3844, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 6617, 537, 14655, 6291, 12, 1268, 969, 389, 71, 1345, 16, 1758, 389, 87, 1302, 264, 16, 2254, 5034, 389, 8949, 13, 2713, 288, 203, 3639, 309, 261, 2867, 24899, 71, 1345, 13, 480, 1758, 12, 1441, 19905, 3719, 288, 203, 5411, 467, 654, 39, 3462, 1147, 273, 467, 654, 39, 3462, 12, 1441, 1310, 3462, 12, 2867, 24899, 71, 1345, 13, 2934, 9341, 6291, 10663, 203, 5411, 1147, 18, 4626, 382, 11908, 7009, 1359, 24899, 87, 1302, 264, 16, 389, 8949, 1769, 203, 3639, 289, 7010, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
//SPDX-License-Identifier: educationwithgyan42@gmail.com pragma solidity >=0.4.22 <0.7.0; import "/Users/gyan/Documents/ProjectGyan/BabylonProject/FarmLend/contracts/LockLoan.sol"; contract FarmLend { LockLoan lockloan; enum LoanState { PROPOSAL, ACCEPTED, LOCKED, SUCCESSFUL, FAILED } enum PaymentFreq{ ANNUAL, HALFYEARLY, SPLITNUM } enum LenderState { ACTIVE, INLOAN, INACTIVE } struct Lender { address payable lenderAddress; LenderState lenderState; uint interestOffered; uint depositAmount; } struct FarmerLoanProposal { address payable farmerAddress; uint amountRequested; uint loanAmountFulfilled; //For now, let's keep it at 100% uint maxInterestRate; // uint startYear; // uint startMonth; // uint startDay; uint dueDateYear; uint dueDateMonth; uint dueDateDay; uint splitNum; //Number of installments that the loan should disbursed in mapping(uint => uint) splitAmountStorage; PaymentFreq paymentFreq; LoanState loanState; //Authentication documents } struct Loan { FarmerLoanProposal farmerLoanProposal; Lender lender; LoanState state; // uint startYear; // uint startMonth; // uint startDay; uint amountFulfilled; uint interestRate; uint proposalCount; uint collected; uint dueDateYear; uint dueDateMonth; uint dueDateDay; //bytes32 mortgage; Right now, we won't use any mortgage concept here mapping (uint=>uint) proposal; } constructor() public payable { //Dynamically get once deployed on Truffle lockloan = LockLoan(0xB117eAA9D7d94CC9E54a85F10c13c8cf34A52781); } mapping(address => FarmerLoanProposal) public registeredProposals; address[] public loanProposals; mapping(address => Lender) public registeredLenders; address[] public lenderAccounts; //Register the farmers with loan requirements function registerFarmerLoanProposal(uint _amountRequested, uint _dueDateDay, uint _dueDateMonth, uint _dueDateYear, uint _maxInterestRate, uint _splitNum, uint _paymentFreq) public returns(bool){ FarmerLoanProposal memory farmer = registeredProposals[msg.sender]; farmer.farmerAddress = msg.sender; farmer.amountRequested = _amountRequested; farmer.loanState = LoanState.PROPOSAL; // farmer.startDay = _startDay; // farmer.startMonth = _startMonth; // farmer.startYear = _startYear; farmer.dueDateDay = _dueDateDay; farmer.dueDateMonth = _dueDateMonth; farmer.dueDateYear = _dueDateYear; //This will be filled up once the loan is accepted by a Lender. farmer.loanAmountFulfilled = 0; //Check if the farmer has specified any maxInterestRate, else default it to 5% if(_maxInterestRate == 0) farmer.maxInterestRate = 5; else farmer.maxInterestRate = _maxInterestRate; //Check if the farmer has specified any splitNumber, if not assign // 3 as default number of times he would be paid in an year. // This is the frequency in which the farmer would be paid in the year. if(_splitNum == 0) farmer.splitNum = 2; else farmer.splitNum = _splitNum; //This is the payment frequency in which the farmer will return the loan back. if(_paymentFreq == 1) farmer.paymentFreq = PaymentFreq.ANNUAL; else if(_paymentFreq == 2) farmer.paymentFreq = PaymentFreq.HALFYEARLY; else farmer.paymentFreq = PaymentFreq.SPLITNUM; loanProposals.push(farmer.farmerAddress); return true; } //Register the farmers with loan requirements function registerLender(uint _interestRate, uint _depositAmount) public returns(bool){ Lender memory lender = registeredLenders[msg.sender]; lender.lenderAddress = msg.sender; lender.lenderState = LenderState.ACTIVE; //This will be entered by the Lender. lender.interestOffered = _interestRate; lender.depositAmount = _depositAmount; lenderAccounts.push(lender.lenderAddress); return true; } //match function: Search for active proposals and match it with active lenders //and share the matched details with the lender - Vinoth - TODO in JS event Foundlender(address, uint); //Function approve : Lender to approve the Loan - Gyan function approveLoan(address _farmerAddress, bool approval, uint _amount) public { //Before approval, we need to check if the farmer is in the system // We would also be doing the asset creation in the backend before calling this function FarmerLoanProposal memory farmer = registeredProposals[_farmerAddress]; Lender memory lender = registeredLenders[msg.sender]; emit Foundlender(msg.sender, lender.depositAmount); if(approval == true) { farmer.loanState = LoanState.ACCEPTED; lender.depositAmount = lender.depositAmount - _amount; lender.lenderState = LenderState.INLOAN; for(uint i = 0; i < loanProposals.length; i++){ if(loanProposals[i] == _farmerAddress) delete loanProposals[i]; } //- Create the loan and call the lock contract createLoan(_farmerAddress, msg.sender, _amount, lender.interestOffered, farmer.dueDateDay, farmer.dueDateMonth, farmer.dueDateYear); } else farmer.loanState = LoanState.PROPOSAL; } function createLoan(address _borrower, address _lender, uint _amountRequested, uint _interestRate, uint _dueDateDay, uint _dueDateMonth, uint _dueDateYear) internal returns(bool){ lockloan.lockLoan(_borrower, _lender, _dueDateDay, _dueDateMonth, _dueDateYear, _amountRequested, _interestRate); } //Get the number of proposals and then get the public mapping to walkthrough ACTIVE ones function getNumProposals() public view returns(address[] memory) { return loanProposals; } }
Get the number of proposals and then get the public mapping to walkthrough ACTIVE ones
function getNumProposals() public view returns(address[] memory) { return loanProposals; }
12,884,656
[ 1, 4625, 348, 7953, 560, 30, 968, 326, 1300, 434, 450, 22536, 471, 1508, 336, 326, 1071, 2874, 358, 5442, 10064, 21135, 5945, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 11187, 626, 22536, 1435, 1071, 1476, 1135, 12, 2867, 8526, 3778, 13, 288, 203, 3639, 327, 28183, 626, 22536, 31, 203, 565, 289, 203, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// File: @openzeppelin/upgrades/contracts/Initializable.sol pragma solidity >=0.4.24 <0.7.0; /** * @title Initializable * * @dev Helper contract to support initializer functions. To use it, replace * the constructor with a function that has the `initializer` modifier. * WARNING: Unlike constructors, initializer functions must be manually * invoked. This applies both to deploying an Initializable contract, as well * as extending an Initializable contract via inheritance. * WARNING: When used with inheritance, manual care must be taken to not invoke * a parent initializer twice, or ensure that all initializers are idempotent, * because this is not dealt with automatically as with constructors. */ contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private initializing; /** * @dev Modifier to use in the initializer function of a contract. */ modifier initializer() { require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized"); bool isTopLevelCall = !initializing; if (isTopLevelCall) { initializing = true; initialized = true; } _; if (isTopLevelCall) { initializing = false; } } /// @dev Returns true if and only if the function is running in the constructor function isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; assembly { cs := extcodesize(self) } return cs == 0; } // Reserved storage space to allow for layout changes in the future. uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol pragma solidity ^0.5.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. */ contract Context is Initializable { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ 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); } // File: @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol pragma solidity ^0.5.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. * * _Available since v2.4.0._ */ 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. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 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. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol pragma solidity ^0.5.0; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20Mintable}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Initializable, Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Destroys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance")); } uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/access/Roles.sol pragma solidity ^0.5.0; /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } /** * @dev Remove an account's access to this role. */ function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } /** * @dev Check if an account has this role. * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero address"); return role.bearer[account]; } } // File: @openzeppelin/contracts-ethereum-package/contracts/access/roles/MinterRole.sol pragma solidity ^0.5.0; contract MinterRole is Initializable, Context { using Roles for Roles.Role; event MinterAdded(address indexed account); event MinterRemoved(address indexed account); Roles.Role private _minters; function initialize(address sender) public initializer { if (!isMinter(sender)) { _addMinter(sender); } } modifier onlyMinter() { require(isMinter(_msgSender()), "MinterRole: caller does not have the Minter role"); _; } function isMinter(address account) public view returns (bool) { return _minters.has(account); } function addMinter(address account) public onlyMinter { _addMinter(account); } function renounceMinter() public { _removeMinter(_msgSender()); } function _addMinter(address account) internal { _minters.add(account); emit MinterAdded(account); } function _removeMinter(address account) internal { _minters.remove(account); emit MinterRemoved(account); } uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Mintable.sol pragma solidity ^0.5.0; /** * @dev Extension of {ERC20} that adds a set of accounts with the {MinterRole}, * which have permission to mint (create) new tokens as they see fit. * * At construction, the deployer of the contract is the only minter. */ contract ERC20Mintable is Initializable, ERC20, MinterRole { function initialize(address sender) public initializer { MinterRole.initialize(sender); } /** * @dev See {ERC20-_mint}. * * Requirements: * * - the caller must have the {MinterRole}. */ function mint(address account, uint256 amount) public onlyMinter returns (bool) { _mint(account, amount); return true; } uint256[50] private ______gap; } // File: @openzeppelin/contracts-ethereum-package/contracts/utils/Address.sol pragma solidity ^0.5.5; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol pragma solidity ^0.5.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Burnable.sol pragma solidity ^0.5.0; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ contract ERC20Burnable is Initializable, Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public { _burn(_msgSender(), amount); } /** * @dev See {ERC20-_burnFrom}. */ function burnFrom(address account, uint256 amount) public { _burnFrom(account, amount); } uint256[50] private ______gap; } // File: @aragon/court/contracts/lib/Checkpointing.sol pragma solidity ^0.5.8; /** * @title Checkpointing - Library to handle a historic set of numeric values */ library Checkpointing { uint256 private constant MAX_UINT192 = uint256(uint192(-1)); string private constant ERROR_VALUE_TOO_BIG = "CHECKPOINT_VALUE_TOO_BIG"; string private constant ERROR_CANNOT_ADD_PAST_VALUE = "CHECKPOINT_CANNOT_ADD_PAST_VALUE"; /** * @dev To specify a value at a given point in time, we need to store two values: * - `time`: unit-time value to denote the first time when a value was registered * - `value`: a positive numeric value to registered at a given point in time * * Note that `time` does not need to refer necessarily to a timestamp value, any time unit could be used * for it like block numbers, terms, etc. */ struct Checkpoint { uint64 time; uint192 value; } /** * @dev A history simply denotes a list of checkpoints */ struct History { Checkpoint[] history; } /** * @dev Add a new value to a history for a given point in time. This function does not allow to add values previous * to the latest registered value, if the value willing to add corresponds to the latest registered value, it * will be updated. * @param self Checkpoints history to be altered * @param _time Point in time to register the given value * @param _value Numeric value to be registered at the given point in time */ function add(History storage self, uint64 _time, uint256 _value) internal { require(_value <= MAX_UINT192, ERROR_VALUE_TOO_BIG); _add192(self, _time, uint192(_value)); } /** * @dev Fetch the latest registered value of history, it will return zero if there was no value registered * @param self Checkpoints history to be queried */ function getLast(History storage self) internal view returns (uint256) { uint256 length = self.history.length; if (length > 0) { return uint256(self.history[length - 1].value); } return 0; } /** * @dev Fetch the most recent registered past value of a history based on a given point in time that is not known * how recent it is beforehand. It will return zero if there is no registered value or if given time is * previous to the first registered value. * It uses a binary search. * @param self Checkpoints history to be queried * @param _time Point in time to query the most recent registered past value of */ function get(History storage self, uint64 _time) internal view returns (uint256) { return _binarySearch(self, _time); } /** * @dev Fetch the most recent registered past value of a history based on a given point in time. It will return zero * if there is no registered value or if given time is previous to the first registered value. * It uses a linear search starting from the end. * @param self Checkpoints history to be queried * @param _time Point in time to query the most recent registered past value of */ function getRecent(History storage self, uint64 _time) internal view returns (uint256) { return _backwardsLinearSearch(self, _time); } /** * @dev Private function to add a new value to a history for a given point in time. This function does not allow to * add values previous to the latest registered value, if the value willing to add corresponds to the latest * registered value, it will be updated. * @param self Checkpoints history to be altered * @param _time Point in time to register the given value * @param _value Numeric value to be registered at the given point in time */ function _add192(History storage self, uint64 _time, uint192 _value) private { uint256 length = self.history.length; if (length == 0 || self.history[self.history.length - 1].time < _time) { // If there was no value registered or the given point in time is after the latest registered value, // we can insert it to the history directly. self.history.push(Checkpoint(_time, _value)); } else { // If the point in time given for the new value is not after the latest registered value, we must ensure // we are only trying to update the latest value, otherwise we would be changing past data. Checkpoint storage currentCheckpoint = self.history[length - 1]; require(_time == currentCheckpoint.time, ERROR_CANNOT_ADD_PAST_VALUE); currentCheckpoint.value = _value; } } /** * @dev Private function to execute a backwards linear search to find the most recent registered past value of a * history based on a given point in time. It will return zero if there is no registered value or if given time * is previous to the first registered value. Note that this function will be more suitable when we already know * that the time used to index the search is recent in the given history. * @param self Checkpoints history to be queried * @param _time Point in time to query the most recent registered past value of */ function _backwardsLinearSearch(History storage self, uint64 _time) private view returns (uint256) { // If there was no value registered for the given history return simply zero uint256 length = self.history.length; if (length == 0) { return 0; } uint256 index = length - 1; Checkpoint storage checkpoint = self.history[index]; while (index > 0 && checkpoint.time > _time) { index--; checkpoint = self.history[index]; } return checkpoint.time > _time ? 0 : uint256(checkpoint.value); } /** * @dev Private function execute a binary search to find the most recent registered past value of a history based on * a given point in time. It will return zero if there is no registered value or if given time is previous to * the first registered value. Note that this function will be more suitable when don't know how recent the * time used to index may be. * @param self Checkpoints history to be queried * @param _time Point in time to query the most recent registered past value of */ function _binarySearch(History storage self, uint64 _time) private view returns (uint256) { // If there was no value registered for the given history return simply zero uint256 length = self.history.length; if (length == 0) { return 0; } // If the requested time is equal to or after the time of the latest registered value, return latest value uint256 lastIndex = length - 1; if (_time >= self.history[lastIndex].time) { return uint256(self.history[lastIndex].value); } // If the requested time is previous to the first registered value, return zero to denote missing checkpoint if (_time < self.history[0].time) { return 0; } // Execute a binary search between the checkpointed times of the history uint256 low = 0; uint256 high = lastIndex; while (high > low) { // No need for SafeMath: for this to overflow array size should be ~2^255 uint256 mid = (high + low + 1) / 2; Checkpoint storage checkpoint = self.history[mid]; uint64 midTime = checkpoint.time; if (_time > midTime) { low = mid; } else if (_time < midTime) { // No need for SafeMath: high > low >= 0 => high >= 1 => mid >= 1 high = mid - 1; } else { return uint256(checkpoint.value); } } return uint256(self.history[low].value); } } // File: @aragon/court/contracts/lib/os/Uint256Helpers.sol // Brought from https://github.com/aragon/aragonOS/blob/v4.3.0/contracts/common/Uint256Helpers.sol // Adapted to use pragma ^0.5.8 and satisfy our linter rules pragma solidity ^0.5.8; library Uint256Helpers { uint256 private constant MAX_UINT8 = uint8(-1); uint256 private constant MAX_UINT64 = uint64(-1); string private constant ERROR_UINT8_NUMBER_TOO_BIG = "UINT8_NUMBER_TOO_BIG"; string private constant ERROR_UINT64_NUMBER_TOO_BIG = "UINT64_NUMBER_TOO_BIG"; function toUint8(uint256 a) internal pure returns (uint8) { require(a <= MAX_UINT8, ERROR_UINT8_NUMBER_TOO_BIG); return uint8(a); } function toUint64(uint256 a) internal pure returns (uint64) { require(a <= MAX_UINT64, ERROR_UINT64_NUMBER_TOO_BIG); return uint64(a); } } // File: contracts/InitializableV2.sol pragma solidity >=0.4.24 <0.7.0; /** * Wrapper around OpenZeppelin's Initializable contract. * Exposes initialized state management to ensure logic contract functions cannot be called before initialization. * This is needed because OZ's Initializable contract no longer exposes initialized state variable. * https://github.com/OpenZeppelin/openzeppelin-sdk/blob/v2.8.0/packages/lib/contracts/Initializable.sol */ contract InitializableV2 is Initializable { bool private isInitialized; string private constant ERROR_NOT_INITIALIZED = "InitializableV2: Not initialized"; /** * @notice wrapper function around parent contract Initializable's `initializable` modifier * initializable modifier ensures this function can only be called once by each deployed child contract * sets isInitialized flag to true to which is used by _requireIsInitialized() */ function initialize() public initializer { isInitialized = true; } /** * @notice Reverts transaction if isInitialized is false. Used by child contracts to ensure * contract is initialized before functions can be called. */ function _requireIsInitialized() internal view { require(isInitialized == true, ERROR_NOT_INITIALIZED); } /** * @notice Exposes isInitialized bool var to child contracts with read-only access */ function _isInitialized() internal view returns (bool) { return isInitialized; } } // File: @openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol pragma solidity ^0.5.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be aplied to your functions to restrict their use to * the owner. */ contract Ownable is Initializable, Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function initialize(address sender) public initializer { _owner = sender; emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * > Note: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } uint256[50] private ______gap; } // File: contracts/registry/Registry.sol pragma solidity ^0.5.0; /** * @title Central hub for Audius protocol. It stores all contract addresses to facilitate * external access and enable version management. */ contract Registry is InitializableV2, Ownable { using SafeMath for uint256; /** * @dev addressStorage mapping allows efficient lookup of current contract version * addressStorageHistory maintains record of all contract versions */ mapping(bytes32 => address) private addressStorage; mapping(bytes32 => address[]) private addressStorageHistory; event ContractAdded( bytes32 indexed _name, address indexed _address ); event ContractRemoved( bytes32 indexed _name, address indexed _address ); event ContractUpgraded( bytes32 indexed _name, address indexed _oldAddress, address indexed _newAddress ); function initialize() public initializer { /// @notice Ownable.initialize(address _sender) sets contract owner to _sender. Ownable.initialize(msg.sender); InitializableV2.initialize(); } // ========================================= Setters ========================================= /** * @notice addContract registers contract name to address mapping under given registry key * @param _name - registry key that will be used for lookups * @param _address - address of contract */ function addContract(bytes32 _name, address _address) external onlyOwner { _requireIsInitialized(); require( addressStorage[_name] == address(0x00), "Registry: Contract already registered with given name." ); require( _address != address(0x00), "Registry: Cannot register zero address." ); setAddress(_name, _address); emit ContractAdded(_name, _address); } /** * @notice removes contract address registered under given registry key * @param _name - registry key for lookup */ function removeContract(bytes32 _name) external onlyOwner { _requireIsInitialized(); address contractAddress = addressStorage[_name]; require( contractAddress != address(0x00), "Registry: Cannot remove - no contract registered with given _name." ); setAddress(_name, address(0x00)); emit ContractRemoved(_name, contractAddress); } /** * @notice replaces contract address registered under given key with provided address * @param _name - registry key for lookup * @param _newAddress - new contract address to register under given key */ function upgradeContract(bytes32 _name, address _newAddress) external onlyOwner { _requireIsInitialized(); address oldAddress = addressStorage[_name]; require( oldAddress != address(0x00), "Registry: Cannot upgrade - no contract registered with given _name." ); require( _newAddress != address(0x00), "Registry: Cannot upgrade - cannot register zero address." ); setAddress(_name, _newAddress); emit ContractUpgraded(_name, oldAddress, _newAddress); } // ========================================= Getters ========================================= /** * @notice returns contract address registered under given registry key * @param _name - registry key for lookup * @return contractAddr - address of contract registered under given registry key */ function getContract(bytes32 _name) external view returns (address contractAddr) { _requireIsInitialized(); return addressStorage[_name]; } /// @notice overloaded getContract to return explicit version of contract function getContract(bytes32 _name, uint256 _version) external view returns (address contractAddr) { _requireIsInitialized(); // array length for key implies version number require( _version <= addressStorageHistory[_name].length, "Registry: Index out of range _version." ); return addressStorageHistory[_name][_version.sub(1)]; } /** * @notice Returns the number of versions for a contract key * @param _name - registry key for lookup * @return number of contract versions */ function getContractVersionCount(bytes32 _name) external view returns (uint256) { _requireIsInitialized(); return addressStorageHistory[_name].length; } // ========================================= Private functions ========================================= /** * @param _key the key for the contract address * @param _value the contract address */ function setAddress(bytes32 _key, address _value) private { // main map for cheap lookup addressStorage[_key] = _value; // keep track of contract address history addressStorageHistory[_key].push(_value); } } // File: contracts/Governance.sol pragma solidity ^0.5.0; contract Governance is InitializableV2 { using SafeMath for uint256; string private constant ERROR_ONLY_GOVERNANCE = ( "Governance: Only callable by self" ); string private constant ERROR_INVALID_VOTING_PERIOD = ( "Governance: Requires non-zero _votingPeriod" ); string private constant ERROR_INVALID_REGISTRY = ( "Governance: Requires non-zero _registryAddress" ); string private constant ERROR_INVALID_VOTING_QUORUM = ( "Governance: Requires _votingQuorumPercent between 1 & 100" ); /** * @notice Address and contract instance of Audius Registry. Used to ensure this contract * can only govern contracts that are registered in the Audius Registry. */ Registry private registry; /// @notice Address of Audius staking contract, used to permission Governance method calls address private stakingAddress; /// @notice Address of Audius ServiceProvider contract, used to permission Governance method calls address private serviceProviderFactoryAddress; /// @notice Address of Audius DelegateManager contract, used to permission Governance method calls address private delegateManagerAddress; /// @notice Period in blocks for which a governance proposal is open for voting uint256 private votingPeriod; /// @notice Number of blocks that must pass after votingPeriod has expired before proposal can be evaluated/executed uint256 private executionDelay; /// @notice Required minimum percentage of total stake to have voted to consider a proposal valid /// Percentaged stored as a uint256 between 0 & 100 /// Calculated as: 100 * sum of voter stakes / total staked in Staking (at proposal submission block) uint256 private votingQuorumPercent; /// @notice Max number of InProgress proposals possible at once /// @dev uint16 gives max possible value of 65,535 uint16 private maxInProgressProposals; /** * @notice Address of account that has special Governance permissions. Can veto proposals * and execute transactions directly on contracts. */ address private guardianAddress; /***** Enums *****/ /** * @notice All Proposal Outcome states. * InProgress - Proposal is active and can be voted on. * Rejected - Proposal votingPeriod has closed and vote failed to pass. Proposal will not be executed. * ApprovedExecuted - Proposal votingPeriod has closed and vote passed. Proposal was successfully executed. * QuorumNotMet - Proposal votingPeriod has closed and votingQuorumPercent was not met. Proposal will not be executed. * ApprovedExecutionFailed - Proposal vote passed, but transaction execution failed. * Evaluating - Proposal vote passed, and evaluateProposalOutcome function is currently running. * This status is transiently used inside that function to prevent re-entrancy. * Vetoed - Proposal was vetoed by Guardian. * TargetContractAddressChanged - Proposal considered invalid since target contract address changed * TargetContractCodeHashChanged - Proposal considered invalid since code has at target contract address has changed */ enum Outcome { InProgress, Rejected, ApprovedExecuted, QuorumNotMet, ApprovedExecutionFailed, Evaluating, Vetoed, TargetContractAddressChanged, TargetContractCodeHashChanged } /** * @notice All Proposal Vote states for a voter. * None - The default state, for any account that has not previously voted on this Proposal. * No - The account voted No on this Proposal. * Yes - The account voted Yes on this Proposal. * @dev Enum values map to uints, so first value in Enum always is 0. */ enum Vote {None, No, Yes} struct Proposal { uint256 proposalId; address proposer; uint256 submissionBlockNumber; bytes32 targetContractRegistryKey; address targetContractAddress; uint256 callValue; string functionSignature; bytes callData; Outcome outcome; uint256 voteMagnitudeYes; uint256 voteMagnitudeNo; uint256 numVotes; mapping(address => Vote) votes; mapping(address => uint256) voteMagnitudes; bytes32 contractHash; } /***** Proposal storage *****/ /// @notice ID of most recently created proposal. Ids are monotonically increasing and 1-indexed. uint256 lastProposalId = 0; /// @notice mapping of proposalId to Proposal struct with all proposal state mapping(uint256 => Proposal) proposals; /// @notice array of proposals with InProgress state uint256[] inProgressProposals; /***** Events *****/ event ProposalSubmitted( uint256 indexed _proposalId, address indexed _proposer, string _name, string _description ); event ProposalVoteSubmitted( uint256 indexed _proposalId, address indexed _voter, Vote indexed _vote, uint256 _voterStake ); event ProposalVoteUpdated( uint256 indexed _proposalId, address indexed _voter, Vote indexed _vote, uint256 _voterStake, Vote _previousVote ); event ProposalOutcomeEvaluated( uint256 indexed _proposalId, Outcome indexed _outcome, uint256 _voteMagnitudeYes, uint256 _voteMagnitudeNo, uint256 _numVotes ); event ProposalTransactionExecuted( uint256 indexed _proposalId, bool indexed _success, bytes _returnData ); event GuardianTransactionExecuted( address indexed _targetContractAddress, uint256 _callValue, string indexed _functionSignature, bytes indexed _callData, bytes _returnData ); event ProposalVetoed(uint256 indexed _proposalId); event RegistryAddressUpdated(address indexed _newRegistryAddress); event GuardianshipTransferred(address indexed _newGuardianAddress); event VotingPeriodUpdated(uint256 indexed _newVotingPeriod); event ExecutionDelayUpdated(uint256 indexed _newExecutionDelay); event VotingQuorumPercentUpdated(uint256 indexed _newVotingQuorumPercent); event MaxInProgressProposalsUpdated(uint256 indexed _newMaxInProgressProposals); /** * @notice Initialize the Governance contract * @dev _votingPeriod <= DelegateManager.undelegateLockupDuration * @dev stakingAddress must be initialized separately after Staking contract is deployed * @param _registryAddress - address of the registry proxy contract * @param _votingPeriod - period in blocks for which a governance proposal is open for voting * @param _executionDelay - number of blocks that must pass after votingPeriod has expired before proposal can be evaluated/executed * @param _votingQuorumPercent - required minimum percentage of total stake to have voted to consider a proposal valid * @param _maxInProgressProposals - max number of InProgress proposals possible at once * @param _guardianAddress - address of account that has special Governance permissions */ function initialize( address _registryAddress, uint256 _votingPeriod, uint256 _executionDelay, uint256 _votingQuorumPercent, uint16 _maxInProgressProposals, address _guardianAddress ) public initializer { require(_registryAddress != address(0x00), ERROR_INVALID_REGISTRY); registry = Registry(_registryAddress); require(_votingPeriod > 0, ERROR_INVALID_VOTING_PERIOD); votingPeriod = _votingPeriod; // executionDelay does not have to be non-zero executionDelay = _executionDelay; require( _maxInProgressProposals > 0, "Governance: Requires non-zero _maxInProgressProposals" ); maxInProgressProposals = _maxInProgressProposals; require( _votingQuorumPercent > 0 && _votingQuorumPercent <= 100, ERROR_INVALID_VOTING_QUORUM ); votingQuorumPercent = _votingQuorumPercent; require( _guardianAddress != address(0x00), "Governance: Requires non-zero _guardianAddress" ); guardianAddress = _guardianAddress; //Guardian address becomes the only party InitializableV2.initialize(); } // ========================================= Governance Actions ========================================= /** * @notice Submit a proposal for vote. Only callable by addresses with non-zero total active stake. * total active stake = total active deployer stake + total active delegator stake * * @dev _name and _description length is not enforced since they aren't stored on-chain and only event emitted * * @param _targetContractRegistryKey - Registry key for the contract concerning this proposal * @param _callValue - amount of wei to pass with function call if a token transfer is involved * @param _functionSignature - function signature of the function to be executed if proposal is successful * @param _callData - encoded value(s) to call function with if proposal is successful * @param _name - Text name of proposal to be emitted in event * @param _description - Text description of proposal to be emitted in event * * @return - ID of new proposal */ function submitProposal( bytes32 _targetContractRegistryKey, uint256 _callValue, string calldata _functionSignature, bytes calldata _callData, string calldata _name, string calldata _description ) external returns (uint256) { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireServiceProviderFactoryAddressIsSet(); _requireDelegateManagerAddressIsSet(); address proposer = msg.sender; // Require all InProgress proposals that can be evaluated have been evaluated before new proposal submission require( this.inProgressProposalsAreUpToDate(), "Governance: Cannot submit new proposal until all evaluatable InProgress proposals are evaluated." ); // Require new proposal submission would not push number of InProgress proposals over max number require( inProgressProposals.length < maxInProgressProposals, "Governance: Number of InProgress proposals already at max. Please evaluate if possible, or wait for current proposals' votingPeriods to expire." ); // Require proposer has non-zero total active stake or is guardian address require( _calculateAddressActiveStake(proposer) > 0 || proposer == guardianAddress, "Governance: Proposer must be address with non-zero total active stake or be guardianAddress." ); // Require _targetContractRegistryKey points to a valid registered contract address targetContractAddress = registry.getContract(_targetContractRegistryKey); require( targetContractAddress != address(0x00), "Governance: _targetContractRegistryKey must point to valid registered contract" ); // Signature cannot be empty require( bytes(_functionSignature).length != 0, "Governance: _functionSignature cannot be empty." ); // Require non-zero description length require(bytes(_description).length > 0, "Governance: _description length must be > 0"); // Require non-zero name length require(bytes(_name).length > 0, "Governance: _name length must be > 0"); // set proposalId uint256 newProposalId = lastProposalId.add(1); // Store new Proposal obj in proposals mapping proposals[newProposalId] = Proposal({ proposalId: newProposalId, proposer: proposer, submissionBlockNumber: block.number, targetContractRegistryKey: _targetContractRegistryKey, targetContractAddress: targetContractAddress, callValue: _callValue, functionSignature: _functionSignature, callData: _callData, outcome: Outcome.InProgress, voteMagnitudeYes: 0, voteMagnitudeNo: 0, numVotes: 0, contractHash: _getCodeHash(targetContractAddress) /* votes: mappings are auto-initialized to default state */ /* voteMagnitudes: mappings are auto-initialized to default state */ }); // Append new proposalId to inProgressProposals array inProgressProposals.push(newProposalId); emit ProposalSubmitted( newProposalId, proposer, _name, _description ); lastProposalId = newProposalId; return newProposalId; } /** * @notice Vote on an active Proposal. Only callable by addresses with non-zero active stake. * @param _proposalId - id of the proposal this vote is for * @param _vote - can be either {Yes, No} from Vote enum. No other values allowed */ function submitVote(uint256 _proposalId, Vote _vote) external { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireServiceProviderFactoryAddressIsSet(); _requireDelegateManagerAddressIsSet(); _requireValidProposalId(_proposalId); address voter = msg.sender; // Require proposal votingPeriod is still active uint256 submissionBlockNumber = proposals[_proposalId].submissionBlockNumber; uint256 endBlockNumber = submissionBlockNumber.add(votingPeriod); require( block.number > submissionBlockNumber && block.number <= endBlockNumber, "Governance: Proposal votingPeriod has ended" ); // Require voter has non-zero total active stake uint256 voterActiveStake = _calculateAddressActiveStake(voter); require( voterActiveStake > 0, "Governance: Voter must be address with non-zero total active stake." ); // Require previous vote is None require( proposals[_proposalId].votes[voter] == Vote.None, "Governance: To update previous vote, call updateVote()" ); // Require vote is either Yes or No require( _vote == Vote.Yes || _vote == Vote.No, "Governance: Can only submit a Yes or No vote" ); // Record vote proposals[_proposalId].votes[voter] = _vote; // Record voteMagnitude for voter proposals[_proposalId].voteMagnitudes[voter] = voterActiveStake; // Update proposal cumulative vote magnitudes if (_vote == Vote.Yes) { _increaseVoteMagnitudeYes(_proposalId, voterActiveStake); } else { _increaseVoteMagnitudeNo(_proposalId, voterActiveStake); } // Increment proposal numVotes proposals[_proposalId].numVotes = proposals[_proposalId].numVotes.add(1); emit ProposalVoteSubmitted( _proposalId, voter, _vote, voterActiveStake ); } /** * @notice Update previous vote on an active Proposal. Only callable by addresses with non-zero active stake. * @param _proposalId - id of the proposal this vote is for * @param _vote - can be either {Yes, No} from Vote enum. No other values allowed */ function updateVote(uint256 _proposalId, Vote _vote) external { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireServiceProviderFactoryAddressIsSet(); _requireDelegateManagerAddressIsSet(); _requireValidProposalId(_proposalId); address voter = msg.sender; // Require proposal votingPeriod is still active uint256 submissionBlockNumber = proposals[_proposalId].submissionBlockNumber; uint256 endBlockNumber = submissionBlockNumber.add(votingPeriod); require( block.number > submissionBlockNumber && block.number <= endBlockNumber, "Governance: Proposal votingPeriod has ended" ); // Retrieve previous vote Vote previousVote = proposals[_proposalId].votes[voter]; // Require previous vote is not None require( previousVote != Vote.None, "Governance: To submit new vote, call submitVote()" ); // Require vote is either Yes or No require( _vote == Vote.Yes || _vote == Vote.No, "Governance: Can only submit a Yes or No vote" ); // Record updated vote proposals[_proposalId].votes[voter] = _vote; // Update vote magnitudes, using vote magnitude from when previous vote was submitted uint256 voteMagnitude = proposals[_proposalId].voteMagnitudes[voter]; if (previousVote == Vote.Yes && _vote == Vote.No) { _decreaseVoteMagnitudeYes(_proposalId, voteMagnitude); _increaseVoteMagnitudeNo(_proposalId, voteMagnitude); } else if (previousVote == Vote.No && _vote == Vote.Yes) { _decreaseVoteMagnitudeNo(_proposalId, voteMagnitude); _increaseVoteMagnitudeYes(_proposalId, voteMagnitude); } // If _vote == previousVote, no changes needed to vote magnitudes. // Do not update numVotes emit ProposalVoteUpdated( _proposalId, voter, _vote, voteMagnitude, previousVote ); } /** * @notice Once the voting period + executionDelay for a proposal has ended, evaluate the outcome and * execute the proposal if voting quorum met & vote passes. * To pass, stake-weighted vote must be > 50% Yes. * @dev Requires that caller is an active staker at the time the proposal is created * @param _proposalId - id of the proposal * @return Outcome of proposal evaluation */ function evaluateProposalOutcome(uint256 _proposalId) external returns (Outcome) { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireServiceProviderFactoryAddressIsSet(); _requireDelegateManagerAddressIsSet(); _requireValidProposalId(_proposalId); // Require proposal has not already been evaluated. require( proposals[_proposalId].outcome == Outcome.InProgress, "Governance: Can only evaluate InProgress proposal." ); // Re-entrancy should not be possible here since this switches the status of the // proposal to 'Evaluating' so it should fail the status is 'InProgress' check proposals[_proposalId].outcome = Outcome.Evaluating; // Require proposal votingPeriod + executionDelay have ended. uint256 submissionBlockNumber = proposals[_proposalId].submissionBlockNumber; uint256 endBlockNumber = submissionBlockNumber.add(votingPeriod).add(executionDelay); require( block.number > endBlockNumber, "Governance: Proposal votingPeriod & executionDelay must end before evaluation." ); address targetContractAddress = registry.getContract( proposals[_proposalId].targetContractRegistryKey ); Outcome outcome; // target contract address changed -> close proposal without execution. if (targetContractAddress != proposals[_proposalId].targetContractAddress) { outcome = Outcome.TargetContractAddressChanged; } // target contract code hash changed -> close proposal without execution. else if (_getCodeHash(targetContractAddress) != proposals[_proposalId].contractHash) { outcome = Outcome.TargetContractCodeHashChanged; } // voting quorum not met -> close proposal without execution. else if (_quorumMet(proposals[_proposalId], Staking(stakingAddress)) == false) { outcome = Outcome.QuorumNotMet; } // votingQuorumPercent met & vote passed -> execute proposed transaction & close proposal. else if ( proposals[_proposalId].voteMagnitudeYes > proposals[_proposalId].voteMagnitudeNo ) { (bool success, bytes memory returnData) = _executeTransaction( targetContractAddress, proposals[_proposalId].callValue, proposals[_proposalId].functionSignature, proposals[_proposalId].callData ); emit ProposalTransactionExecuted( _proposalId, success, returnData ); // Proposal outcome depends on success of transaction execution. if (success) { outcome = Outcome.ApprovedExecuted; } else { outcome = Outcome.ApprovedExecutionFailed; } } // votingQuorumPercent met & vote did not pass -> close proposal without transaction execution. else { outcome = Outcome.Rejected; } // This records the final outcome in the proposals mapping proposals[_proposalId].outcome = outcome; // Remove from inProgressProposals array _removeFromInProgressProposals(_proposalId); emit ProposalOutcomeEvaluated( _proposalId, outcome, proposals[_proposalId].voteMagnitudeYes, proposals[_proposalId].voteMagnitudeNo, proposals[_proposalId].numVotes ); return outcome; } /** * @notice Action limited to the guardian address that can veto a proposal * @param _proposalId - id of the proposal */ function vetoProposal(uint256 _proposalId) external { _requireIsInitialized(); _requireValidProposalId(_proposalId); require( msg.sender == guardianAddress, "Governance: Only guardian can veto proposals." ); require( proposals[_proposalId].outcome == Outcome.InProgress, "Governance: Cannot veto inactive proposal." ); proposals[_proposalId].outcome = Outcome.Vetoed; // Remove from inProgressProposals array _removeFromInProgressProposals(_proposalId); emit ProposalVetoed(_proposalId); } // ========================================= Config Setters ========================================= /** * @notice Set the Staking address * @dev Only callable by self via _executeTransaction * @param _stakingAddress - address for new Staking contract */ function setStakingAddress(address _stakingAddress) external { _requireIsInitialized(); require(msg.sender == address(this), ERROR_ONLY_GOVERNANCE); require(_stakingAddress != address(0x00), "Governance: Requires non-zero _stakingAddress"); stakingAddress = _stakingAddress; } /** * @notice Set the ServiceProviderFactory address * @dev Only callable by self via _executeTransaction * @param _serviceProviderFactoryAddress - address for new ServiceProviderFactory contract */ function setServiceProviderFactoryAddress(address _serviceProviderFactoryAddress) external { _requireIsInitialized(); require(msg.sender == address(this), ERROR_ONLY_GOVERNANCE); require( _serviceProviderFactoryAddress != address(0x00), "Governance: Requires non-zero _serviceProviderFactoryAddress" ); serviceProviderFactoryAddress = _serviceProviderFactoryAddress; } /** * @notice Set the DelegateManager address * @dev Only callable by self via _executeTransaction * @param _delegateManagerAddress - address for new DelegateManager contract */ function setDelegateManagerAddress(address _delegateManagerAddress) external { _requireIsInitialized(); require(msg.sender == address(this), ERROR_ONLY_GOVERNANCE); require( _delegateManagerAddress != address(0x00), "Governance: Requires non-zero _delegateManagerAddress" ); delegateManagerAddress = _delegateManagerAddress; } /** * @notice Set the voting period for a Governance proposal * @dev Only callable by self via _executeTransaction * @param _votingPeriod - new voting period */ function setVotingPeriod(uint256 _votingPeriod) external { _requireIsInitialized(); require(msg.sender == address(this), ERROR_ONLY_GOVERNANCE); require(_votingPeriod > 0, ERROR_INVALID_VOTING_PERIOD); votingPeriod = _votingPeriod; emit VotingPeriodUpdated(_votingPeriod); } /** * @notice Set the voting quorum percentage for a Governance proposal * @dev Only callable by self via _executeTransaction * @param _votingQuorumPercent - new voting period */ function setVotingQuorumPercent(uint256 _votingQuorumPercent) external { _requireIsInitialized(); require(msg.sender == address(this), ERROR_ONLY_GOVERNANCE); require( _votingQuorumPercent > 0 && _votingQuorumPercent <= 100, ERROR_INVALID_VOTING_QUORUM ); votingQuorumPercent = _votingQuorumPercent; emit VotingQuorumPercentUpdated(_votingQuorumPercent); } /** * @notice Set the Registry address * @dev Only callable by self via _executeTransaction * @param _registryAddress - address for new Registry contract */ function setRegistryAddress(address _registryAddress) external { _requireIsInitialized(); require(msg.sender == address(this), ERROR_ONLY_GOVERNANCE); require(_registryAddress != address(0x00), ERROR_INVALID_REGISTRY); registry = Registry(_registryAddress); emit RegistryAddressUpdated(_registryAddress); } /** * @notice Set the max number of concurrent InProgress proposals * @dev Only callable by self via _executeTransaction * @param _newMaxInProgressProposals - new value for maxInProgressProposals */ function setMaxInProgressProposals(uint16 _newMaxInProgressProposals) external { _requireIsInitialized(); require(msg.sender == address(this), ERROR_ONLY_GOVERNANCE); require( _newMaxInProgressProposals > 0, "Governance: Requires non-zero _newMaxInProgressProposals" ); maxInProgressProposals = _newMaxInProgressProposals; emit MaxInProgressProposalsUpdated(_newMaxInProgressProposals); } /** * @notice Set the execution delay for a proposal * @dev Only callable by self via _executeTransaction * @param _newExecutionDelay - new value for executionDelay */ function setExecutionDelay(uint256 _newExecutionDelay) external { _requireIsInitialized(); require(msg.sender == address(this), ERROR_ONLY_GOVERNANCE); // executionDelay does not have to be non-zero executionDelay = _newExecutionDelay; emit ExecutionDelayUpdated(_newExecutionDelay); } // ========================================= Guardian Actions ========================================= /** * @notice Allows the guardianAddress to execute protocol actions * @param _targetContractRegistryKey - key in registry of target contract * @param _callValue - amount of wei if a token transfer is involved * @param _functionSignature - function signature of the function to be executed if proposal is successful * @param _callData - encoded value(s) to call function with if proposal is successful */ function guardianExecuteTransaction( bytes32 _targetContractRegistryKey, uint256 _callValue, string calldata _functionSignature, bytes calldata _callData ) external { _requireIsInitialized(); require( msg.sender == guardianAddress, "Governance: Only guardian." ); // _targetContractRegistryKey must point to a valid registered contract address targetContractAddress = registry.getContract(_targetContractRegistryKey); require( targetContractAddress != address(0x00), "Governance: _targetContractRegistryKey must point to valid registered contract" ); // Signature cannot be empty require( bytes(_functionSignature).length != 0, "Governance: _functionSignature cannot be empty." ); (bool success, bytes memory returnData) = _executeTransaction( targetContractAddress, _callValue, _functionSignature, _callData ); require(success, "Governance: Transaction failed."); emit GuardianTransactionExecuted( targetContractAddress, _callValue, _functionSignature, _callData, returnData ); } /** * @notice Change the guardian address * @dev Only callable by current guardian * @param _newGuardianAddress - new guardian address */ function transferGuardianship(address _newGuardianAddress) external { _requireIsInitialized(); require( msg.sender == guardianAddress, "Governance: Only guardian." ); guardianAddress = _newGuardianAddress; emit GuardianshipTransferred(_newGuardianAddress); } // ========================================= Getter Functions ========================================= /** * @notice Get proposal information by proposal Id * @param _proposalId - id of proposal */ function getProposalById(uint256 _proposalId) external view returns ( uint256 proposalId, address proposer, uint256 submissionBlockNumber, bytes32 targetContractRegistryKey, address targetContractAddress, uint256 callValue, string memory functionSignature, bytes memory callData, Outcome outcome, uint256 voteMagnitudeYes, uint256 voteMagnitudeNo, uint256 numVotes ) { _requireIsInitialized(); _requireValidProposalId(_proposalId); Proposal memory proposal = proposals[_proposalId]; return ( proposal.proposalId, proposal.proposer, proposal.submissionBlockNumber, proposal.targetContractRegistryKey, proposal.targetContractAddress, proposal.callValue, proposal.functionSignature, proposal.callData, proposal.outcome, proposal.voteMagnitudeYes, proposal.voteMagnitudeNo, proposal.numVotes /** @notice - votes mapping cannot be returned by external function */ /** @notice - voteMagnitudes mapping cannot be returned by external function */ /** @notice - returning contractHash leads to stack too deep compiler error, see getProposalTargetContractHash() */ ); } /** * @notice Get proposal target contract hash by proposalId * @dev This is a separate function because the getProposalById returns too many variables already and by adding more, you get the error `InternalCompilerError: Stack too deep, try using fewer variables` * @param _proposalId - id of proposal */ function getProposalTargetContractHash(uint256 _proposalId) external view returns (bytes32) { _requireIsInitialized(); _requireValidProposalId(_proposalId); return (proposals[_proposalId].contractHash); } /** * @notice Get vote direction and vote magnitude for a given proposal and voter * @param _proposalId - id of the proposal * @param _voter - address of the voter we want to check * @return returns vote direction and magnitude if valid vote, else default values */ function getVoteInfoByProposalAndVoter(uint256 _proposalId, address _voter) external view returns (Vote vote, uint256 voteMagnitude) { _requireIsInitialized(); _requireValidProposalId(_proposalId); return ( proposals[_proposalId].votes[_voter], proposals[_proposalId].voteMagnitudes[_voter] ); } /// @notice Get the contract Guardian address function getGuardianAddress() external view returns (address) { _requireIsInitialized(); return guardianAddress; } /// @notice Get the Staking address function getStakingAddress() external view returns (address) { _requireIsInitialized(); return stakingAddress; } /// @notice Get the ServiceProviderFactory address function getServiceProviderFactoryAddress() external view returns (address) { _requireIsInitialized(); return serviceProviderFactoryAddress; } /// @notice Get the DelegateManager address function getDelegateManagerAddress() external view returns (address) { _requireIsInitialized(); return delegateManagerAddress; } /// @notice Get the contract voting period function getVotingPeriod() external view returns (uint256) { _requireIsInitialized(); return votingPeriod; } /// @notice Get the contract voting quorum percent function getVotingQuorumPercent() external view returns (uint256) { _requireIsInitialized(); return votingQuorumPercent; } /// @notice Get the registry address function getRegistryAddress() external view returns (address) { _requireIsInitialized(); return address(registry); } /// @notice Used to check if is governance contract before setting governance address in other contracts function isGovernanceAddress() external pure returns (bool) { return true; } /// @notice Get the max number of concurrent InProgress proposals function getMaxInProgressProposals() external view returns (uint16) { _requireIsInitialized(); return maxInProgressProposals; } /// @notice Get the proposal execution delay function getExecutionDelay() external view returns (uint256) { _requireIsInitialized(); return executionDelay; } /// @notice Get the array of all InProgress proposal Ids function getInProgressProposals() external view returns (uint256[] memory) { _requireIsInitialized(); return inProgressProposals; } /** * @notice Returns false if any proposals in inProgressProposals array are evaluatable * Evaluatable = proposals with closed votingPeriod * @dev Is public since its called internally in `submitProposal()` as well as externally in UI */ function inProgressProposalsAreUpToDate() external view returns (bool) { _requireIsInitialized(); // compare current block number against endBlockNumber of each proposal for (uint256 i = 0; i < inProgressProposals.length; i++) { if ( block.number > (proposals[inProgressProposals[i]].submissionBlockNumber).add(votingPeriod).add(executionDelay) ) { return false; } } return true; } // ========================================= Internal Functions ========================================= /** * @notice Execute a transaction attached to a governance proposal * @dev We are aware of both potential re-entrancy issues and the risks associated with low-level solidity * function calls here, but have chosen to keep this code with those issues in mind. All governance * proposals go through a voting process, and all will be reviewed carefully to ensure that they * adhere to the expected behaviors of this call - but adding restrictions here would limit the ability * of the governance system to do required work in a generic way. * @param _targetContractAddress - address of registry proxy contract to execute transaction on * @param _callValue - amount of wei if a token transfer is involved * @param _functionSignature - function signature of the function to be executed if proposal is successful * @param _callData - encoded value(s) to call function with if proposal is successful */ function _executeTransaction( address _targetContractAddress, uint256 _callValue, string memory _functionSignature, bytes memory _callData ) internal returns (bool success, bytes memory returnData) { bytes memory encodedCallData = abi.encodePacked( bytes4(keccak256(bytes(_functionSignature))), _callData ); (success, returnData) = ( // solium-disable-next-line security/no-call-value _targetContractAddress.call.value(_callValue)(encodedCallData) ); return (success, returnData); } function _increaseVoteMagnitudeYes(uint256 _proposalId, uint256 _voterStake) internal { proposals[_proposalId].voteMagnitudeYes = ( proposals[_proposalId].voteMagnitudeYes.add(_voterStake) ); } function _increaseVoteMagnitudeNo(uint256 _proposalId, uint256 _voterStake) internal { proposals[_proposalId].voteMagnitudeNo = ( proposals[_proposalId].voteMagnitudeNo.add(_voterStake) ); } function _decreaseVoteMagnitudeYes(uint256 _proposalId, uint256 _voterStake) internal { proposals[_proposalId].voteMagnitudeYes = ( proposals[_proposalId].voteMagnitudeYes.sub(_voterStake) ); } function _decreaseVoteMagnitudeNo(uint256 _proposalId, uint256 _voterStake) internal { proposals[_proposalId].voteMagnitudeNo = ( proposals[_proposalId].voteMagnitudeNo.sub(_voterStake) ); } /** * @dev Can make O(1) by storing index pointer in proposals mapping. * Requires inProgressProposals to be 1-indexed, since all proposals that are not present * will have pointer set to 0. */ function _removeFromInProgressProposals(uint256 _proposalId) internal { uint256 index = 0; for (uint256 i = 0; i < inProgressProposals.length; i++) { if (inProgressProposals[i] == _proposalId) { index = i; break; } } // Swap proposalId to end of array + pop (deletes last elem + decrements array length) inProgressProposals[index] = inProgressProposals[inProgressProposals.length - 1]; inProgressProposals.pop(); } /** * @notice Returns true if voting quorum percentage met for proposal, else false. * @dev Quorum is met if total voteMagnitude * 100 / total active stake in Staking * @dev Eventual multiplication overflow: * (proposal.voteMagnitudeYes + proposal.voteMagnitudeNo), with 100% staking participation, * can sum to at most the entire token supply of 10^27 * With 7% annual token supply inflation, multiplication can overflow ~1635 years at the earliest: * log(2^256/(10^27*100))/log(1.07) ~= 1635 * * @dev Note that quorum is evaluated based on total staked at proposal submission * not total staked at proposal evaluation, this is expected behavior */ function _quorumMet(Proposal memory proposal, Staking stakingContract) internal view returns (bool) { uint256 participation = ( (proposal.voteMagnitudeYes + proposal.voteMagnitudeNo) .mul(100) .div(stakingContract.totalStakedAt(proposal.submissionBlockNumber)) ); return participation >= votingQuorumPercent; } // ========================================= Private Functions ========================================= function _requireStakingAddressIsSet() private view { require( stakingAddress != address(0x00), "Governance: stakingAddress is not set" ); } function _requireServiceProviderFactoryAddressIsSet() private view { require( serviceProviderFactoryAddress != address(0x00), "Governance: serviceProviderFactoryAddress is not set" ); } function _requireDelegateManagerAddressIsSet() private view { require( delegateManagerAddress != address(0x00), "Governance: delegateManagerAddress is not set" ); } function _requireValidProposalId(uint256 _proposalId) private view { require( _proposalId <= lastProposalId && _proposalId > 0, "Governance: Must provide valid non-zero _proposalId" ); } /** * Calculates and returns active stake for address * * Active stake = (active deployer stake + active delegator stake) * active deployer stake = (direct deployer stake - locked deployer stake) * locked deployer stake = amount of pending decreaseStakeRequest for address * active delegator stake = (total delegator stake - locked delegator stake) * locked delegator stake = amount of pending undelegateRequest for address */ function _calculateAddressActiveStake(address _address) private view returns (uint256) { ServiceProviderFactory spFactory = ServiceProviderFactory(serviceProviderFactoryAddress); DelegateManagerV2 delegateManager = DelegateManagerV2(delegateManagerAddress); // Amount directly staked by address, if any, in ServiceProviderFactory (uint256 directDeployerStake,,,,,) = spFactory.getServiceProviderDetails(_address); // Amount of pending decreasedStakeRequest for address, if any, in ServiceProviderFactory (uint256 lockedDeployerStake,) = spFactory.getPendingDecreaseStakeRequest(_address); // active deployer stake = (direct deployer stake - locked deployer stake) uint256 activeDeployerStake = directDeployerStake.sub(lockedDeployerStake); // Total amount delegated by address, if any, in DelegateManager uint256 totalDelegatorStake = delegateManager.getTotalDelegatorStake(_address); // Amount of pending undelegateRequest for address, if any, in DelegateManager (,uint256 lockedDelegatorStake, ) = delegateManager.getPendingUndelegateRequest(_address); // active delegator stake = (total delegator stake - locked delegator stake) uint256 activeDelegatorStake = totalDelegatorStake.sub(lockedDelegatorStake); // activeStake = (activeDeployerStake + activeDelegatorStake) uint256 activeStake = activeDeployerStake.add(activeDelegatorStake); return activeStake; } // solium-disable security/no-inline-assembly /** * @notice Helper function to generate the code hash for a contract address * @return contract code hash */ function _getCodeHash(address _contract) private view returns (bytes32) { bytes32 contractHash; assembly { contractHash := extcodehash(_contract) } return contractHash; } } // File: contracts/Staking.sol pragma solidity ^0.5.0; contract Staking is InitializableV2 { using SafeMath for uint256; using Uint256Helpers for uint256; using Checkpointing for Checkpointing.History; using SafeERC20 for ERC20; string private constant ERROR_TOKEN_NOT_CONTRACT = "Staking: Staking token is not a contract"; string private constant ERROR_AMOUNT_ZERO = "Staking: Zero amount not allowed"; string private constant ERROR_ONLY_GOVERNANCE = "Staking: Only governance"; string private constant ERROR_ONLY_DELEGATE_MANAGER = ( "Staking: Only callable from DelegateManager" ); string private constant ERROR_ONLY_SERVICE_PROVIDER_FACTORY = ( "Staking: Only callable from ServiceProviderFactory" ); address private governanceAddress; address private claimsManagerAddress; address private delegateManagerAddress; address private serviceProviderFactoryAddress; /// @dev stores the history of staking and claims for a given address struct Account { Checkpointing.History stakedHistory; Checkpointing.History claimHistory; } /// @dev ERC-20 token that will be used to stake with ERC20 internal stakingToken; /// @dev maps addresses to staking and claims history mapping (address => Account) internal accounts; /// @dev total staked tokens at a given block Checkpointing.History internal totalStakedHistory; event Staked(address indexed user, uint256 amount, uint256 total); event Unstaked(address indexed user, uint256 amount, uint256 total); event Slashed(address indexed user, uint256 amount, uint256 total); /** * @notice Function to initialize the contract * @dev claimsManagerAddress must be initialized separately after ClaimsManager contract is deployed * @dev delegateManagerAddress must be initialized separately after DelegateManager contract is deployed * @dev serviceProviderFactoryAddress must be initialized separately after ServiceProviderFactory contract is deployed * @param _tokenAddress - address of ERC20 token that will be staked * @param _governanceAddress - address for Governance proxy contract */ function initialize( address _tokenAddress, address _governanceAddress ) public initializer { require(Address.isContract(_tokenAddress), ERROR_TOKEN_NOT_CONTRACT); stakingToken = ERC20(_tokenAddress); _updateGovernanceAddress(_governanceAddress); InitializableV2.initialize(); } /** * @notice Set the Governance address * @dev Only callable by Governance address * @param _governanceAddress - address for new Governance contract */ function setGovernanceAddress(address _governanceAddress) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); _updateGovernanceAddress(_governanceAddress); } /** * @notice Set the ClaimsManaager address * @dev Only callable by Governance address * @param _claimsManager - address for new ClaimsManaager contract */ function setClaimsManagerAddress(address _claimsManager) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); claimsManagerAddress = _claimsManager; } /** * @notice Set the ServiceProviderFactory address * @dev Only callable by Governance address * @param _spFactory - address for new ServiceProviderFactory contract */ function setServiceProviderFactoryAddress(address _spFactory) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); serviceProviderFactoryAddress = _spFactory; } /** * @notice Set the DelegateManager address * @dev Only callable by Governance address * @param _delegateManager - address for new DelegateManager contract */ function setDelegateManagerAddress(address _delegateManager) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); delegateManagerAddress = _delegateManager; } /* External functions */ /** * @notice Funds `_amount` of tokens from ClaimsManager to target account * @param _amount - amount of rewards to add to stake * @param _stakerAccount - address of staker */ function stakeRewards(uint256 _amount, address _stakerAccount) external { _requireIsInitialized(); _requireClaimsManagerAddressIsSet(); require( msg.sender == claimsManagerAddress, "Staking: Only callable from ClaimsManager" ); _stakeFor(_stakerAccount, msg.sender, _amount); this.updateClaimHistory(_amount, _stakerAccount); } /** * @notice Update claim history by adding an event to the claim history * @param _amount - amount to add to claim history * @param _stakerAccount - address of staker */ function updateClaimHistory(uint256 _amount, address _stakerAccount) external { _requireIsInitialized(); _requireClaimsManagerAddressIsSet(); require( msg.sender == claimsManagerAddress || msg.sender == address(this), "Staking: Only callable from ClaimsManager or Staking.sol" ); // Update claim history even if no value claimed accounts[_stakerAccount].claimHistory.add(block.number.toUint64(), _amount); } /** * @notice Slashes `_amount` tokens from _slashAddress * @dev Callable from DelegateManager * @param _amount - Number of tokens slashed * @param _slashAddress - Address being slashed */ function slash( uint256 _amount, address _slashAddress ) external { _requireIsInitialized(); _requireDelegateManagerAddressIsSet(); require( msg.sender == delegateManagerAddress, ERROR_ONLY_DELEGATE_MANAGER ); // Burn slashed tokens from account _burnFor(_slashAddress, _amount); emit Slashed( _slashAddress, _amount, totalStakedFor(_slashAddress) ); } /** * @notice Stakes `_amount` tokens, transferring them from _accountAddress, and assigns them to `_accountAddress` * @param _accountAddress - The final staker of the tokens * @param _amount - Number of tokens staked */ function stakeFor( address _accountAddress, uint256 _amount ) external { _requireIsInitialized(); _requireServiceProviderFactoryAddressIsSet(); require( msg.sender == serviceProviderFactoryAddress, ERROR_ONLY_SERVICE_PROVIDER_FACTORY ); _stakeFor( _accountAddress, _accountAddress, _amount ); } /** * @notice Unstakes `_amount` tokens, returning them to the desired account. * @param _accountAddress - Account unstaked for, and token recipient * @param _amount - Number of tokens staked */ function unstakeFor( address _accountAddress, uint256 _amount ) external { _requireIsInitialized(); _requireServiceProviderFactoryAddressIsSet(); require( msg.sender == serviceProviderFactoryAddress, ERROR_ONLY_SERVICE_PROVIDER_FACTORY ); _unstakeFor( _accountAddress, _accountAddress, _amount ); } /** * @notice Stakes `_amount` tokens, transferring them from `_delegatorAddress` to `_accountAddress`, only callable by DelegateManager * @param _accountAddress - The final staker of the tokens * @param _delegatorAddress - Address from which to transfer tokens * @param _amount - Number of tokens staked */ function delegateStakeFor( address _accountAddress, address _delegatorAddress, uint256 _amount ) external { _requireIsInitialized(); _requireDelegateManagerAddressIsSet(); require( msg.sender == delegateManagerAddress, ERROR_ONLY_DELEGATE_MANAGER ); _stakeFor( _accountAddress, _delegatorAddress, _amount); } /** * @notice Unstakes '_amount` tokens, transferring them from `_accountAddress` to `_delegatorAddress`, only callable by DelegateManager * @param _accountAddress - The staker of the tokens * @param _delegatorAddress - Address from which to transfer tokens * @param _amount - Number of tokens unstaked */ function undelegateStakeFor( address _accountAddress, address _delegatorAddress, uint256 _amount ) external { _requireIsInitialized(); _requireDelegateManagerAddressIsSet(); require( msg.sender == delegateManagerAddress, ERROR_ONLY_DELEGATE_MANAGER ); _unstakeFor( _accountAddress, _delegatorAddress, _amount); } /** * @notice Get the token used by the contract for staking and locking * @return The token used by the contract for staking and locking */ function token() external view returns (address) { _requireIsInitialized(); return address(stakingToken); } /** * @notice Check whether it supports history of stakes * @return Always true */ function supportsHistory() external view returns (bool) { _requireIsInitialized(); return true; } /** * @notice Get last time `_accountAddress` modified its staked balance * @param _accountAddress - Account requesting for * @return Last block number when account's balance was modified */ function lastStakedFor(address _accountAddress) external view returns (uint256) { _requireIsInitialized(); uint256 length = accounts[_accountAddress].stakedHistory.history.length; if (length > 0) { return uint256(accounts[_accountAddress].stakedHistory.history[length - 1].time); } return 0; } /** * @notice Get last time `_accountAddress` claimed a staking reward * @param _accountAddress - Account requesting for * @return Last block number when claim requested */ function lastClaimedFor(address _accountAddress) external view returns (uint256) { _requireIsInitialized(); uint256 length = accounts[_accountAddress].claimHistory.history.length; if (length > 0) { return uint256(accounts[_accountAddress].claimHistory.history[length - 1].time); } return 0; } /** * @notice Get the total amount of tokens staked by `_accountAddress` at block number `_blockNumber` * @param _accountAddress - Account requesting for * @param _blockNumber - Block number at which we are requesting * @return The amount of tokens staked by the account at the given block number */ function totalStakedForAt( address _accountAddress, uint256 _blockNumber ) external view returns (uint256) { _requireIsInitialized(); return accounts[_accountAddress].stakedHistory.get(_blockNumber.toUint64()); } /** * @notice Get the total amount of tokens staked by all users at block number `_blockNumber` * @param _blockNumber - Block number at which we are requesting * @return The amount of tokens staked at the given block number */ function totalStakedAt(uint256 _blockNumber) external view returns (uint256) { _requireIsInitialized(); return totalStakedHistory.get(_blockNumber.toUint64()); } /// @notice Get the Governance address function getGovernanceAddress() external view returns (address) { _requireIsInitialized(); return governanceAddress; } /// @notice Get the ClaimsManager address function getClaimsManagerAddress() external view returns (address) { _requireIsInitialized(); return claimsManagerAddress; } /// @notice Get the ServiceProviderFactory address function getServiceProviderFactoryAddress() external view returns (address) { _requireIsInitialized(); return serviceProviderFactoryAddress; } /// @notice Get the DelegateManager address function getDelegateManagerAddress() external view returns (address) { _requireIsInitialized(); return delegateManagerAddress; } /** * @notice Helper function wrapped around totalStakedFor. Checks whether _accountAddress is currently a valid staker with a non-zero stake * @param _accountAddress - Account requesting for * @return Boolean indicating whether account is a staker */ function isStaker(address _accountAddress) external view returns (bool) { _requireIsInitialized(); return totalStakedFor(_accountAddress) > 0; } /* Public functions */ /** * @notice Get the amount of tokens staked by `_accountAddress` * @param _accountAddress - The owner of the tokens * @return The amount of tokens staked by the given account */ function totalStakedFor(address _accountAddress) public view returns (uint256) { _requireIsInitialized(); // we assume it's not possible to stake in the future return accounts[_accountAddress].stakedHistory.getLast(); } /** * @notice Get the total amount of tokens staked by all users * @return The total amount of tokens staked by all users */ function totalStaked() public view returns (uint256) { _requireIsInitialized(); // we assume it's not possible to stake in the future return totalStakedHistory.getLast(); } // ========================================= Internal Functions ========================================= /** * @notice Adds stake from a transfer account to the stake account * @param _stakeAccount - Account that funds will be staked for * @param _transferAccount - Account that funds will be transferred from * @param _amount - amount to stake */ function _stakeFor( address _stakeAccount, address _transferAccount, uint256 _amount ) internal { // staking 0 tokens is invalid require(_amount > 0, ERROR_AMOUNT_ZERO); // Checkpoint updated staking balance _modifyStakeBalance(_stakeAccount, _amount, true); // checkpoint total supply _modifyTotalStaked(_amount, true); // pull tokens into Staking contract stakingToken.safeTransferFrom(_transferAccount, address(this), _amount); emit Staked( _stakeAccount, _amount, totalStakedFor(_stakeAccount)); } /** * @notice Unstakes tokens from a stake account to a transfer account * @param _stakeAccount - Account that staked funds will be transferred from * @param _transferAccount - Account that funds will be transferred to * @param _amount - amount to unstake */ function _unstakeFor( address _stakeAccount, address _transferAccount, uint256 _amount ) internal { require(_amount > 0, ERROR_AMOUNT_ZERO); // checkpoint updated staking balance _modifyStakeBalance(_stakeAccount, _amount, false); // checkpoint total supply _modifyTotalStaked(_amount, false); // transfer tokens stakingToken.safeTransfer(_transferAccount, _amount); emit Unstaked( _stakeAccount, _amount, totalStakedFor(_stakeAccount) ); } /** * @notice Burn tokens for a given staker * @dev Called when slash occurs * @param _stakeAccount - Account for which funds will be burned * @param _amount - amount to burn */ function _burnFor(address _stakeAccount, uint256 _amount) internal { // burning zero tokens is not allowed require(_amount > 0, ERROR_AMOUNT_ZERO); // checkpoint updated staking balance _modifyStakeBalance(_stakeAccount, _amount, false); // checkpoint total supply _modifyTotalStaked(_amount, false); // burn ERC20Burnable(address(stakingToken)).burn(_amount); /** No event emitted since token.burn() call already emits a Transfer event */ } /** * @notice Increase or decrease the staked balance for an account * @param _accountAddress - Account to modify * @param _by - amount to modify * @param _increase - true if increase in stake, false if decrease */ function _modifyStakeBalance(address _accountAddress, uint256 _by, bool _increase) internal { uint256 currentInternalStake = accounts[_accountAddress].stakedHistory.getLast(); uint256 newStake; if (_increase) { newStake = currentInternalStake.add(_by); } else { require( currentInternalStake >= _by, "Staking: Cannot decrease greater than current balance"); newStake = currentInternalStake.sub(_by); } // add new value to account history accounts[_accountAddress].stakedHistory.add(block.number.toUint64(), newStake); } /** * @notice Increase or decrease the staked balance across all accounts * @param _by - amount to modify * @param _increase - true if increase in stake, false if decrease */ function _modifyTotalStaked(uint256 _by, bool _increase) internal { uint256 currentStake = totalStaked(); uint256 newStake; if (_increase) { newStake = currentStake.add(_by); } else { newStake = currentStake.sub(_by); } // add new value to total history totalStakedHistory.add(block.number.toUint64(), newStake); } /** * @notice Set the governance address after confirming contract identity * @param _governanceAddress - Incoming governance address */ function _updateGovernanceAddress(address _governanceAddress) internal { require( Governance(_governanceAddress).isGovernanceAddress() == true, "Staking: _governanceAddress is not a valid governance contract" ); governanceAddress = _governanceAddress; } // ========================================= Private Functions ========================================= function _requireClaimsManagerAddressIsSet() private view { require(claimsManagerAddress != address(0x00), "Staking: claimsManagerAddress is not set"); } function _requireDelegateManagerAddressIsSet() private view { require( delegateManagerAddress != address(0x00), "Staking: delegateManagerAddress is not set" ); } function _requireServiceProviderFactoryAddressIsSet() private view { require( serviceProviderFactoryAddress != address(0x00), "Staking: serviceProviderFactoryAddress is not set" ); } } // File: contracts/ServiceTypeManager.sol pragma solidity ^0.5.0; contract ServiceTypeManager is InitializableV2 { address governanceAddress; string private constant ERROR_ONLY_GOVERNANCE = ( "ServiceTypeManager: Only callable by Governance contract" ); /** * @dev - mapping of serviceType - serviceTypeVersion * Example - "discovery-provider" - ["0.0.1", "0.0.2", ..., "currentVersion"] */ mapping(bytes32 => bytes32[]) private serviceTypeVersions; /** * @dev - mapping of serviceType - < serviceTypeVersion, isValid > * Example - "discovery-provider" - <"0.0.1", true> */ mapping(bytes32 => mapping(bytes32 => bool)) private serviceTypeVersionInfo; /// @dev List of valid service types bytes32[] private validServiceTypes; /// @dev Struct representing service type info struct ServiceTypeInfo { bool isValid; uint256 minStake; uint256 maxStake; } /// @dev mapping of service type info mapping(bytes32 => ServiceTypeInfo) private serviceTypeInfo; event SetServiceVersion( bytes32 indexed _serviceType, bytes32 indexed _serviceVersion ); event ServiceTypeAdded( bytes32 indexed _serviceType, uint256 indexed _serviceTypeMin, uint256 indexed _serviceTypeMax ); event ServiceTypeRemoved(bytes32 indexed _serviceType); /** * @notice Function to initialize the contract * @param _governanceAddress - Governance proxy address */ function initialize(address _governanceAddress) public initializer { _updateGovernanceAddress(_governanceAddress); InitializableV2.initialize(); } /// @notice Get the Governance address function getGovernanceAddress() external view returns (address) { _requireIsInitialized(); return governanceAddress; } /** * @notice Set the Governance address * @dev Only callable by Governance address * @param _governanceAddress - address for new Governance contract */ function setGovernanceAddress(address _governanceAddress) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); _updateGovernanceAddress(_governanceAddress); } // ========================================= Service Type Logic ========================================= /** * @notice Add a new service type * @param _serviceType - type of service to add * @param _serviceTypeMin - minimum stake for service type * @param _serviceTypeMax - maximum stake for service type */ function addServiceType( bytes32 _serviceType, uint256 _serviceTypeMin, uint256 _serviceTypeMax ) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); require( !this.serviceTypeIsValid(_serviceType), "ServiceTypeManager: Already known service type" ); require( _serviceTypeMax > _serviceTypeMin, "ServiceTypeManager: Max stake must be non-zero and greater than min stake" ); // Ensure serviceType cannot be re-added if it previously existed and was removed // stored maxStake > 0 means it was previously added and removed require( serviceTypeInfo[_serviceType].maxStake == 0, "ServiceTypeManager: Cannot re-add serviceType after it was removed." ); validServiceTypes.push(_serviceType); serviceTypeInfo[_serviceType] = ServiceTypeInfo({ isValid: true, minStake: _serviceTypeMin, maxStake: _serviceTypeMax }); emit ServiceTypeAdded(_serviceType, _serviceTypeMin, _serviceTypeMax); } /** * @notice Remove an existing service type * @param _serviceType - name of service type to remove */ function removeServiceType(bytes32 _serviceType) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); uint256 serviceIndex = 0; bool foundService = false; for (uint256 i = 0; i < validServiceTypes.length; i ++) { if (validServiceTypes[i] == _serviceType) { serviceIndex = i; foundService = true; break; } } require(foundService == true, "ServiceTypeManager: Invalid service type, not found"); // Overwrite service index uint256 lastIndex = validServiceTypes.length - 1; validServiceTypes[serviceIndex] = validServiceTypes[lastIndex]; validServiceTypes.length--; // Mark as invalid serviceTypeInfo[_serviceType].isValid = false; // Note - stake bounds are not reset so they can be checked to prevent serviceType from being re-added emit ServiceTypeRemoved(_serviceType); } /** * @notice Get isValid, min and max stake for a given service type * @param _serviceType - type of service * @return isValid, min and max stake for type */ function getServiceTypeInfo(bytes32 _serviceType) external view returns (bool isValid, uint256 minStake, uint256 maxStake) { _requireIsInitialized(); return ( serviceTypeInfo[_serviceType].isValid, serviceTypeInfo[_serviceType].minStake, serviceTypeInfo[_serviceType].maxStake ); } /** * @notice Get list of valid service types */ function getValidServiceTypes() external view returns (bytes32[] memory) { _requireIsInitialized(); return validServiceTypes; } /** * @notice Return indicating whether this is a valid service type */ function serviceTypeIsValid(bytes32 _serviceType) external view returns (bool) { _requireIsInitialized(); return serviceTypeInfo[_serviceType].isValid; } // ========================================= Service Version Logic ========================================= /** * @notice Add new version for a serviceType * @param _serviceType - type of service * @param _serviceVersion - new version of service to add */ function setServiceVersion( bytes32 _serviceType, bytes32 _serviceVersion ) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); require(this.serviceTypeIsValid(_serviceType), "ServiceTypeManager: Invalid service type"); require( serviceTypeVersionInfo[_serviceType][_serviceVersion] == false, "ServiceTypeManager: Already registered" ); // Update array of known versions for type serviceTypeVersions[_serviceType].push(_serviceVersion); // Update status for this specific service version serviceTypeVersionInfo[_serviceType][_serviceVersion] = true; emit SetServiceVersion(_serviceType, _serviceVersion); } /** * @notice Get a version for a service type given it's index * @param _serviceType - type of service * @param _versionIndex - index in list of service versions * @return bytes32 value for serviceVersion */ function getVersion(bytes32 _serviceType, uint256 _versionIndex) external view returns (bytes32) { _requireIsInitialized(); require( serviceTypeVersions[_serviceType].length > _versionIndex, "ServiceTypeManager: No registered version of serviceType" ); return (serviceTypeVersions[_serviceType][_versionIndex]); } /** * @notice Get curent version for a service type * @param _serviceType - type of service * @return Returns current version of service */ function getCurrentVersion(bytes32 _serviceType) external view returns (bytes32) { _requireIsInitialized(); require( serviceTypeVersions[_serviceType].length >= 1, "ServiceTypeManager: No registered version of serviceType" ); uint256 latestVersionIndex = serviceTypeVersions[_serviceType].length - 1; return (serviceTypeVersions[_serviceType][latestVersionIndex]); } /** * @notice Get total number of versions for a service type * @param _serviceType - type of service */ function getNumberOfVersions(bytes32 _serviceType) external view returns (uint256) { _requireIsInitialized(); return serviceTypeVersions[_serviceType].length; } /** * @notice Return boolean indicating whether given version is valid for given type * @param _serviceType - type of service * @param _serviceVersion - version of service to check */ function serviceVersionIsValid(bytes32 _serviceType, bytes32 _serviceVersion) external view returns (bool) { _requireIsInitialized(); return serviceTypeVersionInfo[_serviceType][_serviceVersion]; } /** * @notice Set the governance address after confirming contract identity * @param _governanceAddress - Incoming governance address */ function _updateGovernanceAddress(address _governanceAddress) internal { require( Governance(_governanceAddress).isGovernanceAddress() == true, "ServiceTypeManager: _governanceAddress is not a valid governance contract" ); governanceAddress = _governanceAddress; } } // File: contracts/ClaimsManager.sol pragma solidity ^0.5.0; /// @notice ERC20 imported via Staking.sol /// @notice SafeERC20 imported via Staking.sol /// @notice Governance imported via Staking.sol /// @notice SafeMath imported via ServiceProviderFactory.sol /** * Designed to automate claim funding, minting tokens as necessary * @notice - will call InitializableV2 constructor */ contract ClaimsManager is InitializableV2 { using SafeMath for uint256; using SafeERC20 for ERC20; string private constant ERROR_ONLY_GOVERNANCE = ( "ClaimsManager: Only callable by Governance contract" ); address private governanceAddress; address private stakingAddress; address private serviceProviderFactoryAddress; address private delegateManagerAddress; /** * @notice - Minimum number of blocks between funding rounds * 604800 seconds / week * Avg block time - 13s * 604800 / 13 = 46523.0769231 blocks */ uint256 private fundingRoundBlockDiff; /** * @notice - Configures the current funding amount per round * Weekly rounds, 7% PA inflation = 70,000,000 new tokens in first year * = 70,000,000/365*7 (year is slightly more than a week) * = 1342465.75342 new AUDS per week * = 1342465753420000000000000 new wei units per week * @dev - Past a certain block height, this schedule will be updated * - Logic determining schedule will be sourced from an external contract */ uint256 private fundingAmount; // Denotes current round uint256 private roundNumber; // Staking contract ref ERC20Mintable private audiusToken; /// @dev - Address to which recurringCommunityFundingAmount is transferred at funding round start address private communityPoolAddress; /// @dev - Reward amount transferred to communityPoolAddress at funding round start uint256 private recurringCommunityFundingAmount; // Struct representing round state // 1) Block at which round was funded // 2) Total funded for this round // 3) Total claimed in round struct Round { uint256 fundedBlock; uint256 fundedAmount; uint256 totalClaimedInRound; } // Current round information Round private currentRound; event RoundInitiated( uint256 indexed _blockNumber, uint256 indexed _roundNumber, uint256 indexed _fundAmount ); event ClaimProcessed( address indexed _claimer, uint256 indexed _rewards, uint256 _oldTotal, uint256 indexed _newTotal ); event CommunityRewardsTransferred( address indexed _transferAddress, uint256 indexed _amount ); event FundingAmountUpdated(uint256 indexed _amount); event FundingRoundBlockDiffUpdated(uint256 indexed _blockDifference); event GovernanceAddressUpdated(address indexed _newGovernanceAddress); event StakingAddressUpdated(address indexed _newStakingAddress); event ServiceProviderFactoryAddressUpdated(address indexed _newServiceProviderFactoryAddress); event DelegateManagerAddressUpdated(address indexed _newDelegateManagerAddress); event RecurringCommunityFundingAmountUpdated(uint256 indexed _amount); event CommunityPoolAddressUpdated(address indexed _newCommunityPoolAddress); /** * @notice Function to initialize the contract * @dev stakingAddress must be initialized separately after Staking contract is deployed * @dev serviceProviderFactoryAddress must be initialized separately after ServiceProviderFactory contract is deployed * @dev delegateManagerAddress must be initialized separately after DelegateManager contract is deployed * @param _tokenAddress - address of ERC20 token that will be claimed * @param _governanceAddress - address for Governance proxy contract */ function initialize( address _tokenAddress, address _governanceAddress ) public initializer { _updateGovernanceAddress(_governanceAddress); audiusToken = ERC20Mintable(_tokenAddress); fundingRoundBlockDiff = 46523; fundingAmount = 1342465753420000000000000; // 1342465.75342 AUDS roundNumber = 0; currentRound = Round({ fundedBlock: 0, fundedAmount: 0, totalClaimedInRound: 0 }); // Community pool funding amount and address initialized to zero recurringCommunityFundingAmount = 0; communityPoolAddress = address(0x0); InitializableV2.initialize(); } /// @notice Get the duration of a funding round in blocks function getFundingRoundBlockDiff() external view returns (uint256) { _requireIsInitialized(); return fundingRoundBlockDiff; } /// @notice Get the last block where a funding round was initiated function getLastFundedBlock() external view returns (uint256) { _requireIsInitialized(); return currentRound.fundedBlock; } /// @notice Get the amount funded per round in wei function getFundsPerRound() external view returns (uint256) { _requireIsInitialized(); return fundingAmount; } /// @notice Get the total amount claimed in the current round function getTotalClaimedInRound() external view returns (uint256) { _requireIsInitialized(); return currentRound.totalClaimedInRound; } /// @notice Get the Governance address function getGovernanceAddress() external view returns (address) { _requireIsInitialized(); return governanceAddress; } /// @notice Get the ServiceProviderFactory address function getServiceProviderFactoryAddress() external view returns (address) { _requireIsInitialized(); return serviceProviderFactoryAddress; } /// @notice Get the DelegateManager address function getDelegateManagerAddress() external view returns (address) { _requireIsInitialized(); return delegateManagerAddress; } /** * @notice Get the Staking address */ function getStakingAddress() external view returns (address) { _requireIsInitialized(); return stakingAddress; } /** * @notice Get the community pool address */ function getCommunityPoolAddress() external view returns (address) { _requireIsInitialized(); return communityPoolAddress; } /** * @notice Get the community funding amount */ function getRecurringCommunityFundingAmount() external view returns (uint256) { _requireIsInitialized(); return recurringCommunityFundingAmount; } /** * @notice Set the Governance address * @dev Only callable by Governance address * @param _governanceAddress - address for new Governance contract */ function setGovernanceAddress(address _governanceAddress) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); _updateGovernanceAddress(_governanceAddress); emit GovernanceAddressUpdated(_governanceAddress); } /** * @notice Set the Staking address * @dev Only callable by Governance address * @param _stakingAddress - address for new Staking contract */ function setStakingAddress(address _stakingAddress) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); stakingAddress = _stakingAddress; emit StakingAddressUpdated(_stakingAddress); } /** * @notice Set the ServiceProviderFactory address * @dev Only callable by Governance address * @param _serviceProviderFactoryAddress - address for new ServiceProviderFactory contract */ function setServiceProviderFactoryAddress(address _serviceProviderFactoryAddress) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); serviceProviderFactoryAddress = _serviceProviderFactoryAddress; emit ServiceProviderFactoryAddressUpdated(_serviceProviderFactoryAddress); } /** * @notice Set the DelegateManager address * @dev Only callable by Governance address * @param _delegateManagerAddress - address for new DelegateManager contract */ function setDelegateManagerAddress(address _delegateManagerAddress) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); delegateManagerAddress = _delegateManagerAddress; emit DelegateManagerAddressUpdated(_delegateManagerAddress); } /** * @notice Start a new funding round * @dev Permissioned to be callable by stakers or governance contract */ function initiateRound() external { _requireIsInitialized(); _requireStakingAddressIsSet(); require( block.number.sub(currentRound.fundedBlock) > fundingRoundBlockDiff, "ClaimsManager: Required block difference not met" ); currentRound = Round({ fundedBlock: block.number, fundedAmount: fundingAmount, totalClaimedInRound: 0 }); roundNumber = roundNumber.add(1); /* * Transfer community funding amount to community pool address, if set */ if (recurringCommunityFundingAmount > 0 && communityPoolAddress != address(0x0)) { // ERC20Mintable always returns true audiusToken.mint(address(this), recurringCommunityFundingAmount); // Approve transfer to community pool address audiusToken.approve(communityPoolAddress, recurringCommunityFundingAmount); // Transfer to community pool address ERC20(address(audiusToken)).safeTransfer(communityPoolAddress, recurringCommunityFundingAmount); emit CommunityRewardsTransferred(communityPoolAddress, recurringCommunityFundingAmount); } emit RoundInitiated( currentRound.fundedBlock, roundNumber, currentRound.fundedAmount ); } /** * @notice Mints and stakes tokens on behalf of ServiceProvider + delegators * @dev Callable through DelegateManager by Service Provider * @param _claimer - service provider address * @param _totalLockedForSP - amount of tokens locked up across DelegateManager + ServiceProvider * @return minted rewards for this claimer */ function processClaim( address _claimer, uint256 _totalLockedForSP ) external returns (uint256) { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireDelegateManagerAddressIsSet(); _requireServiceProviderFactoryAddressIsSet(); require( msg.sender == delegateManagerAddress, "ClaimsManager: ProcessClaim only accessible to DelegateManager" ); Staking stakingContract = Staking(stakingAddress); // Prevent duplicate claim uint256 lastUserClaimBlock = stakingContract.lastClaimedFor(_claimer); require( lastUserClaimBlock <= currentRound.fundedBlock, "ClaimsManager: Claim already processed for user" ); uint256 totalStakedAtFundBlockForClaimer = stakingContract.totalStakedForAt( _claimer, currentRound.fundedBlock); (,,bool withinBounds,,,) = ( ServiceProviderFactory(serviceProviderFactoryAddress).getServiceProviderDetails(_claimer) ); // Once they claim the zero reward amount, stake can be modified once again // Subtract total locked amount for SP from stake at fund block uint256 totalActiveClaimerStake = totalStakedAtFundBlockForClaimer.sub(_totalLockedForSP); uint256 totalStakedAtFundBlock = stakingContract.totalStakedAt(currentRound.fundedBlock); // Calculate claimer rewards uint256 rewardsForClaimer = ( totalActiveClaimerStake.mul(fundingAmount) ).div(totalStakedAtFundBlock); // For a claimer violating bounds, no new tokens are minted // Claim history is marked to zero and function is short-circuited // Total rewards can be zero if all stake is currently locked up if (!withinBounds || rewardsForClaimer == 0) { stakingContract.updateClaimHistory(0, _claimer); emit ClaimProcessed( _claimer, 0, totalStakedAtFundBlockForClaimer, totalActiveClaimerStake ); return 0; } // ERC20Mintable always returns true audiusToken.mint(address(this), rewardsForClaimer); // Approve transfer to staking address for claimer rewards // ERC20 always returns true audiusToken.approve(stakingAddress, rewardsForClaimer); // Transfer rewards stakingContract.stakeRewards(rewardsForClaimer, _claimer); // Update round claim value currentRound.totalClaimedInRound = currentRound.totalClaimedInRound.add(rewardsForClaimer); // Update round claim value uint256 newTotal = stakingContract.totalStakedFor(_claimer); emit ClaimProcessed( _claimer, rewardsForClaimer, totalStakedAtFundBlockForClaimer, newTotal ); return rewardsForClaimer; } /** * @notice Modify funding amount per round * @param _newAmount - new amount to fund per round in wei */ function updateFundingAmount(uint256 _newAmount) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); fundingAmount = _newAmount; emit FundingAmountUpdated(_newAmount); } /** * @notice Returns boolean indicating whether a claim is considered pending * @dev Note that an address with no endpoints can never have a pending claim * @param _sp - address of the service provider to check * @return true if eligible for claim, false if not */ function claimPending(address _sp) external view returns (bool) { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireServiceProviderFactoryAddressIsSet(); uint256 lastClaimedForSP = Staking(stakingAddress).lastClaimedFor(_sp); (,,,uint256 numEndpoints,,) = ( ServiceProviderFactory(serviceProviderFactoryAddress).getServiceProviderDetails(_sp) ); return (lastClaimedForSP < currentRound.fundedBlock && numEndpoints > 0); } /** * @notice Modify minimum block difference between funding rounds * @param _newFundingRoundBlockDiff - new min block difference to set */ function updateFundingRoundBlockDiff(uint256 _newFundingRoundBlockDiff) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); emit FundingRoundBlockDiffUpdated(_newFundingRoundBlockDiff); fundingRoundBlockDiff = _newFundingRoundBlockDiff; } /** * @notice Modify community funding amound for each round * @param _newRecurringCommunityFundingAmount - new reward amount transferred to * communityPoolAddress at funding round start */ function updateRecurringCommunityFundingAmount( uint256 _newRecurringCommunityFundingAmount ) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); recurringCommunityFundingAmount = _newRecurringCommunityFundingAmount; emit RecurringCommunityFundingAmountUpdated(_newRecurringCommunityFundingAmount); } /** * @notice Modify community pool address * @param _newCommunityPoolAddress - new address to which recurringCommunityFundingAmount * is transferred at funding round start */ function updateCommunityPoolAddress(address _newCommunityPoolAddress) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); communityPoolAddress = _newCommunityPoolAddress; emit CommunityPoolAddressUpdated(_newCommunityPoolAddress); } // ========================================= Private Functions ========================================= /** * @notice Set the governance address after confirming contract identity * @param _governanceAddress - Incoming governance address */ function _updateGovernanceAddress(address _governanceAddress) private { require( Governance(_governanceAddress).isGovernanceAddress() == true, "ClaimsManager: _governanceAddress is not a valid governance contract" ); governanceAddress = _governanceAddress; } function _requireStakingAddressIsSet() private view { require(stakingAddress != address(0x00), "ClaimsManager: stakingAddress is not set"); } function _requireDelegateManagerAddressIsSet() private view { require( delegateManagerAddress != address(0x00), "ClaimsManager: delegateManagerAddress is not set" ); } function _requireServiceProviderFactoryAddressIsSet() private view { require( serviceProviderFactoryAddress != address(0x00), "ClaimsManager: serviceProviderFactoryAddress is not set" ); } } // File: contracts/ServiceProviderFactory.sol pragma solidity ^0.5.0; /// @notice Governance imported via Staking.sol contract ServiceProviderFactory is InitializableV2 { using SafeMath for uint256; /// @dev - denominator for deployer cut calculations /// @dev - user values are intended to be x/DEPLOYER_CUT_BASE uint256 private constant DEPLOYER_CUT_BASE = 100; string private constant ERROR_ONLY_GOVERNANCE = ( "ServiceProviderFactory: Only callable by Governance contract" ); string private constant ERROR_ONLY_SP_GOVERNANCE = ( "ServiceProviderFactory: Only callable by Service Provider or Governance" ); address private stakingAddress; address private delegateManagerAddress; address private governanceAddress; address private serviceTypeManagerAddress; address private claimsManagerAddress; /// @notice Period in blocks that a decrease stake operation is delayed. /// Must be greater than governance votingPeriod + executionDelay in order to /// prevent pre-emptive withdrawal in anticipation of a slash proposal uint256 private decreaseStakeLockupDuration; /// @notice Period in blocks that an update deployer cut operation is delayed. /// Must be greater than funding round block diff in order /// to prevent manipulation around a funding round uint256 private deployerCutLockupDuration; /// @dev - Stores following entities /// 1) Directly staked amount by SP, not including delegators /// 2) % Cut of delegator tokens taken during reward /// 3) Bool indicating whether this SP has met min/max requirements /// 4) Number of endpoints registered by SP /// 5) Minimum deployer stake for this service provider /// 6) Maximum total stake for this account struct ServiceProviderDetails { uint256 deployerStake; uint256 deployerCut; bool validBounds; uint256 numberOfEndpoints; uint256 minAccountStake; uint256 maxAccountStake; } /// @dev - Data structure for time delay during withdrawal struct DecreaseStakeRequest { uint256 decreaseAmount; uint256 lockupExpiryBlock; } /// @dev - Data structure for time delay during deployer cut update struct UpdateDeployerCutRequest { uint256 newDeployerCut; uint256 lockupExpiryBlock; } /// @dev - Struct maintaining information about sp /// @dev - blocknumber is block.number when endpoint registered struct ServiceEndpoint { address owner; string endpoint; uint256 blocknumber; address delegateOwnerWallet; } /// @dev - Mapping of service provider address to details mapping(address => ServiceProviderDetails) private spDetails; /// @dev - Uniquely assigned serviceProvider ID, incremented for each service type /// @notice - Keeps track of the total number of services registered regardless of /// whether some have been deregistered since mapping(bytes32 => uint256) private serviceProviderTypeIDs; /// @dev - mapping of (serviceType -> (serviceInstanceId <-> serviceProviderInfo)) /// @notice - stores the actual service provider data like endpoint and owner wallet /// with the ability lookup by service type and service id */ mapping(bytes32 => mapping(uint256 => ServiceEndpoint)) private serviceProviderInfo; /// @dev - mapping of keccak256(endpoint) to uint256 ID /// @notice - used to check if a endpoint has already been registered and also lookup /// the id of an endpoint mapping(bytes32 => uint256) private serviceProviderEndpointToId; /// @dev - mapping of address -> sp id array */ /// @notice - stores all the services registered by a provider. for each address, /// provides the ability to lookup by service type and see all registered services mapping(address => mapping(bytes32 => uint256[])) private serviceProviderAddressToId; /// @dev - Mapping of service provider -> decrease stake request mapping(address => DecreaseStakeRequest) private decreaseStakeRequests; /// @dev - Mapping of service provider -> update deployer cut requests mapping(address => UpdateDeployerCutRequest) private updateDeployerCutRequests; event RegisteredServiceProvider( uint256 indexed _spID, bytes32 indexed _serviceType, address indexed _owner, string _endpoint, uint256 _stakeAmount ); event DeregisteredServiceProvider( uint256 indexed _spID, bytes32 indexed _serviceType, address indexed _owner, string _endpoint, uint256 _unstakeAmount ); event IncreasedStake( address indexed _owner, uint256 indexed _increaseAmount, uint256 indexed _newStakeAmount ); event DecreaseStakeRequested( address indexed _owner, uint256 indexed _decreaseAmount, uint256 indexed _lockupExpiryBlock ); event DecreaseStakeRequestCancelled( address indexed _owner, uint256 indexed _decreaseAmount, uint256 indexed _lockupExpiryBlock ); event DecreaseStakeRequestEvaluated( address indexed _owner, uint256 indexed _decreaseAmount, uint256 indexed _newStakeAmount ); event EndpointUpdated( bytes32 indexed _serviceType, address indexed _owner, string _oldEndpoint, string _newEndpoint, uint256 indexed _spID ); event DelegateOwnerWalletUpdated( address indexed _owner, bytes32 indexed _serviceType, uint256 indexed _spID, address _updatedWallet ); event DeployerCutUpdateRequested( address indexed _owner, uint256 indexed _updatedCut, uint256 indexed _lockupExpiryBlock ); event DeployerCutUpdateRequestCancelled( address indexed _owner, uint256 indexed _requestedCut, uint256 indexed _finalCut ); event DeployerCutUpdateRequestEvaluated( address indexed _owner, uint256 indexed _updatedCut ); event DecreaseStakeLockupDurationUpdated(uint256 indexed _lockupDuration); event UpdateDeployerCutLockupDurationUpdated(uint256 indexed _lockupDuration); event GovernanceAddressUpdated(address indexed _newGovernanceAddress); event StakingAddressUpdated(address indexed _newStakingAddress); event ClaimsManagerAddressUpdated(address indexed _newClaimsManagerAddress); event DelegateManagerAddressUpdated(address indexed _newDelegateManagerAddress); event ServiceTypeManagerAddressUpdated(address indexed _newServiceTypeManagerAddress); /** * @notice Function to initialize the contract * @dev stakingAddress must be initialized separately after Staking contract is deployed * @dev delegateManagerAddress must be initialized separately after DelegateManager contract is deployed * @dev serviceTypeManagerAddress must be initialized separately after ServiceTypeManager contract is deployed * @dev claimsManagerAddress must be initialized separately after ClaimsManager contract is deployed * @param _governanceAddress - Governance proxy address */ function initialize ( address _governanceAddress, address _claimsManagerAddress, uint256 _decreaseStakeLockupDuration, uint256 _deployerCutLockupDuration ) public initializer { _updateGovernanceAddress(_governanceAddress); claimsManagerAddress = _claimsManagerAddress; _updateDecreaseStakeLockupDuration(_decreaseStakeLockupDuration); _updateDeployerCutLockupDuration(_deployerCutLockupDuration); InitializableV2.initialize(); } /** * @notice Register a new endpoint to the account of msg.sender * @dev Transfers stake from service provider into staking pool * @param _serviceType - type of service to register, must be valid in ServiceTypeManager * @param _endpoint - url of the service to register - url of the service to register * @param _stakeAmount - amount to stake, must be within bounds in ServiceTypeManager * @param _delegateOwnerWallet - wallet to delegate some permissions for some basic management properties * @return New service provider ID for this endpoint */ function register( bytes32 _serviceType, string calldata _endpoint, uint256 _stakeAmount, address _delegateOwnerWallet ) external returns (uint256) { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireServiceTypeManagerAddressIsSet(); _requireClaimsManagerAddressIsSet(); require( ServiceTypeManager(serviceTypeManagerAddress).serviceTypeIsValid(_serviceType), "ServiceProviderFactory: Valid service type required"); // Stake token amount from msg.sender if (_stakeAmount > 0) { require( !_claimPending(msg.sender), "ServiceProviderFactory: No pending claim expected" ); Staking(stakingAddress).stakeFor(msg.sender, _stakeAmount); } require ( serviceProviderEndpointToId[keccak256(bytes(_endpoint))] == 0, "ServiceProviderFactory: Endpoint already registered"); uint256 newServiceProviderID = serviceProviderTypeIDs[_serviceType].add(1); serviceProviderTypeIDs[_serviceType] = newServiceProviderID; // Index spInfo serviceProviderInfo[_serviceType][newServiceProviderID] = ServiceEndpoint({ owner: msg.sender, endpoint: _endpoint, blocknumber: block.number, delegateOwnerWallet: _delegateOwnerWallet }); // Update endpoint mapping serviceProviderEndpointToId[keccak256(bytes(_endpoint))] = newServiceProviderID; // Update (address -> type -> ids[]) serviceProviderAddressToId[msg.sender][_serviceType].push(newServiceProviderID); // Increment number of endpoints for this address spDetails[msg.sender].numberOfEndpoints = spDetails[msg.sender].numberOfEndpoints.add(1); // Update deployer total spDetails[msg.sender].deployerStake = ( spDetails[msg.sender].deployerStake.add(_stakeAmount) ); // Update min and max totals for this service provider (, uint256 typeMin, uint256 typeMax) = ServiceTypeManager( serviceTypeManagerAddress ).getServiceTypeInfo(_serviceType); spDetails[msg.sender].minAccountStake = spDetails[msg.sender].minAccountStake.add(typeMin); spDetails[msg.sender].maxAccountStake = spDetails[msg.sender].maxAccountStake.add(typeMax); // Confirm both aggregate account balance and directly staked amount are valid this.validateAccountStakeBalance(msg.sender); uint256 currentlyStakedForOwner = Staking(stakingAddress).totalStakedFor(msg.sender); // Indicate this service provider is within bounds spDetails[msg.sender].validBounds = true; emit RegisteredServiceProvider( newServiceProviderID, _serviceType, msg.sender, _endpoint, currentlyStakedForOwner ); return newServiceProviderID; } /** * @notice Deregister an endpoint from the account of msg.sender * @dev Unstakes all tokens for service provider if this is the last endpoint * @param _serviceType - type of service to deregister * @param _endpoint - endpoint to deregister * @return spId of the service that was deregistered */ function deregister( bytes32 _serviceType, string calldata _endpoint ) external returns (uint256) { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireServiceTypeManagerAddressIsSet(); // Unstake on deregistration if and only if this is the last service endpoint uint256 unstakeAmount = 0; bool unstaked = false; // owned by the service provider if (spDetails[msg.sender].numberOfEndpoints == 1) { unstakeAmount = spDetails[msg.sender].deployerStake; // Submit request to decrease stake, overriding any pending request decreaseStakeRequests[msg.sender] = DecreaseStakeRequest({ decreaseAmount: unstakeAmount, lockupExpiryBlock: block.number.add(decreaseStakeLockupDuration) }); unstaked = true; } require ( serviceProviderEndpointToId[keccak256(bytes(_endpoint))] != 0, "ServiceProviderFactory: Endpoint not registered"); // Cache invalided service provider ID uint256 deregisteredID = serviceProviderEndpointToId[keccak256(bytes(_endpoint))]; // Update endpoint mapping serviceProviderEndpointToId[keccak256(bytes(_endpoint))] = 0; require( keccak256(bytes(serviceProviderInfo[_serviceType][deregisteredID].endpoint)) == keccak256(bytes(_endpoint)), "ServiceProviderFactory: Invalid endpoint for service type"); require ( serviceProviderInfo[_serviceType][deregisteredID].owner == msg.sender, "ServiceProviderFactory: Only callable by endpoint owner"); // Update info mapping delete serviceProviderInfo[_serviceType][deregisteredID]; // Reset id, update array uint256 spTypeLength = serviceProviderAddressToId[msg.sender][_serviceType].length; for (uint256 i = 0; i < spTypeLength; i ++) { if (serviceProviderAddressToId[msg.sender][_serviceType][i] == deregisteredID) { // Overwrite element to be deleted with last element in array serviceProviderAddressToId[msg.sender][_serviceType][i] = serviceProviderAddressToId[msg.sender][_serviceType][spTypeLength - 1]; // Reduce array size, exit loop serviceProviderAddressToId[msg.sender][_serviceType].length--; // Confirm this ID has been found for the service provider break; } } // Decrement number of endpoints for this address spDetails[msg.sender].numberOfEndpoints -= 1; // Update min and max totals for this service provider (, uint256 typeMin, uint256 typeMax) = ServiceTypeManager( serviceTypeManagerAddress ).getServiceTypeInfo(_serviceType); spDetails[msg.sender].minAccountStake = spDetails[msg.sender].minAccountStake.sub(typeMin); spDetails[msg.sender].maxAccountStake = spDetails[msg.sender].maxAccountStake.sub(typeMax); emit DeregisteredServiceProvider( deregisteredID, _serviceType, msg.sender, _endpoint, unstakeAmount); // Confirm both aggregate account balance and directly staked amount are valid // Only if unstake operation has not occurred if (!unstaked) { this.validateAccountStakeBalance(msg.sender); // Indicate this service provider is within bounds spDetails[msg.sender].validBounds = true; } return deregisteredID; } /** * @notice Increase stake for service provider * @param _increaseStakeAmount - amount to increase staked amount by * @return New total stake for service provider */ function increaseStake( uint256 _increaseStakeAmount ) external returns (uint256) { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireClaimsManagerAddressIsSet(); // Confirm owner has an endpoint require( spDetails[msg.sender].numberOfEndpoints > 0, "ServiceProviderFactory: Registered endpoint required to increase stake" ); require( !_claimPending(msg.sender), "ServiceProviderFactory: No claim expected to be pending prior to stake transfer" ); Staking stakingContract = Staking( stakingAddress ); // Stake increased token amount for msg.sender stakingContract.stakeFor(msg.sender, _increaseStakeAmount); uint256 newStakeAmount = stakingContract.totalStakedFor(msg.sender); // Update deployer total spDetails[msg.sender].deployerStake = ( spDetails[msg.sender].deployerStake.add(_increaseStakeAmount) ); // Confirm both aggregate account balance and directly staked amount are valid this.validateAccountStakeBalance(msg.sender); // Indicate this service provider is within bounds spDetails[msg.sender].validBounds = true; emit IncreasedStake( msg.sender, _increaseStakeAmount, newStakeAmount ); return newStakeAmount; } /** * @notice Request to decrease stake. This sets a lockup for decreaseStakeLockupDuration after which the actual decreaseStake can be called * @dev Decreasing stake is only processed if a service provider is within valid bounds * @param _decreaseStakeAmount - amount to decrease stake by in wei * @return New total stake amount after the lockup */ function requestDecreaseStake(uint256 _decreaseStakeAmount) external returns (uint256) { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireClaimsManagerAddressIsSet(); require( _decreaseStakeAmount > 0, "ServiceProviderFactory: Requested stake decrease amount must be greater than zero" ); require( !_claimPending(msg.sender), "ServiceProviderFactory: No claim expected to be pending prior to stake transfer" ); Staking stakingContract = Staking( stakingAddress ); uint256 currentStakeAmount = stakingContract.totalStakedFor(msg.sender); // Prohibit decreasing stake to invalid bounds _validateBalanceInternal(msg.sender, (currentStakeAmount.sub(_decreaseStakeAmount))); uint256 expiryBlock = block.number.add(decreaseStakeLockupDuration); decreaseStakeRequests[msg.sender] = DecreaseStakeRequest({ decreaseAmount: _decreaseStakeAmount, lockupExpiryBlock: expiryBlock }); emit DecreaseStakeRequested(msg.sender, _decreaseStakeAmount, expiryBlock); return currentStakeAmount.sub(_decreaseStakeAmount); } /** * @notice Cancel a decrease stake request during the lockup * @dev Either called by the service provider via DelegateManager or governance during a slash action * @param _account - address of service provider */ function cancelDecreaseStakeRequest(address _account) external { _requireIsInitialized(); _requireDelegateManagerAddressIsSet(); require( msg.sender == _account || msg.sender == delegateManagerAddress, "ServiceProviderFactory: Only owner or DelegateManager" ); require( _decreaseRequestIsPending(_account), "ServiceProviderFactory: Decrease stake request must be pending" ); DecreaseStakeRequest memory cancelledRequest = decreaseStakeRequests[_account]; // Clear decrease stake request decreaseStakeRequests[_account] = DecreaseStakeRequest({ decreaseAmount: 0, lockupExpiryBlock: 0 }); emit DecreaseStakeRequestCancelled( _account, cancelledRequest.decreaseAmount, cancelledRequest.lockupExpiryBlock ); } /** * @notice Called by user to decrease a stake after waiting the appropriate lockup period. * @return New total stake after decrease */ function decreaseStake() external returns (uint256) { _requireIsInitialized(); _requireStakingAddressIsSet(); require( _decreaseRequestIsPending(msg.sender), "ServiceProviderFactory: Decrease stake request must be pending" ); require( decreaseStakeRequests[msg.sender].lockupExpiryBlock <= block.number, "ServiceProviderFactory: Lockup must be expired" ); Staking stakingContract = Staking( stakingAddress ); uint256 decreaseAmount = decreaseStakeRequests[msg.sender].decreaseAmount; // Decrease staked token amount for msg.sender stakingContract.unstakeFor(msg.sender, decreaseAmount); // Query current stake uint256 newStakeAmount = stakingContract.totalStakedFor(msg.sender); // Update deployer total spDetails[msg.sender].deployerStake = ( spDetails[msg.sender].deployerStake.sub(decreaseAmount) ); // Confirm both aggregate account balance and directly staked amount are valid // During registration this validation is bypassed since no endpoints remain if (spDetails[msg.sender].numberOfEndpoints > 0) { this.validateAccountStakeBalance(msg.sender); } // Indicate this service provider is within bounds spDetails[msg.sender].validBounds = true; // Clear decrease stake request delete decreaseStakeRequests[msg.sender]; emit DecreaseStakeRequestEvaluated(msg.sender, decreaseAmount, newStakeAmount); return newStakeAmount; } /** * @notice Update delegate owner wallet for a given endpoint * @param _serviceType - type of service to register, must be valid in ServiceTypeManager * @param _endpoint - url of the service to register - url of the service to register * @param _updatedDelegateOwnerWallet - address of new delegate wallet */ function updateDelegateOwnerWallet( bytes32 _serviceType, string calldata _endpoint, address _updatedDelegateOwnerWallet ) external { _requireIsInitialized(); uint256 spID = this.getServiceProviderIdFromEndpoint(_endpoint); require( serviceProviderInfo[_serviceType][spID].owner == msg.sender, "ServiceProviderFactory: Invalid update operation, wrong owner" ); serviceProviderInfo[_serviceType][spID].delegateOwnerWallet = _updatedDelegateOwnerWallet; emit DelegateOwnerWalletUpdated( msg.sender, _serviceType, spID, _updatedDelegateOwnerWallet ); } /** * @notice Update the endpoint for a given service * @param _serviceType - type of service to register, must be valid in ServiceTypeManager * @param _oldEndpoint - old endpoint currently registered * @param _newEndpoint - new endpoint to replace old endpoint * @return ID of updated service provider */ function updateEndpoint( bytes32 _serviceType, string calldata _oldEndpoint, string calldata _newEndpoint ) external returns (uint256) { _requireIsInitialized(); uint256 spId = this.getServiceProviderIdFromEndpoint(_oldEndpoint); require ( spId != 0, "ServiceProviderFactory: Could not find service provider with that endpoint" ); ServiceEndpoint memory serviceEndpoint = serviceProviderInfo[_serviceType][spId]; require( serviceEndpoint.owner == msg.sender, "ServiceProviderFactory: Invalid update endpoint operation, wrong owner" ); require( keccak256(bytes(serviceEndpoint.endpoint)) == keccak256(bytes(_oldEndpoint)), "ServiceProviderFactory: Old endpoint doesn't match what's registered for the service provider" ); // invalidate old endpoint serviceProviderEndpointToId[keccak256(bytes(serviceEndpoint.endpoint))] = 0; // update to new endpoint serviceEndpoint.endpoint = _newEndpoint; serviceProviderInfo[_serviceType][spId] = serviceEndpoint; serviceProviderEndpointToId[keccak256(bytes(_newEndpoint))] = spId; emit EndpointUpdated(_serviceType, msg.sender, _oldEndpoint, _newEndpoint, spId); return spId; } /** * @notice Update the deployer cut for a given service provider * @param _serviceProvider - address of service provider * @param _cut - new value for deployer cut */ function requestUpdateDeployerCut(address _serviceProvider, uint256 _cut) external { _requireIsInitialized(); require( msg.sender == _serviceProvider || msg.sender == governanceAddress, ERROR_ONLY_SP_GOVERNANCE ); require( (updateDeployerCutRequests[_serviceProvider].lockupExpiryBlock == 0) && (updateDeployerCutRequests[_serviceProvider].newDeployerCut == 0), "ServiceProviderFactory: Update deployer cut operation pending" ); require( _cut <= DEPLOYER_CUT_BASE, "ServiceProviderFactory: Service Provider cut cannot exceed base value" ); uint256 expiryBlock = block.number + deployerCutLockupDuration; updateDeployerCutRequests[_serviceProvider] = UpdateDeployerCutRequest({ lockupExpiryBlock: expiryBlock, newDeployerCut: _cut }); emit DeployerCutUpdateRequested(_serviceProvider, _cut, expiryBlock); } /** * @notice Cancel a pending request to update deployer cut * @param _serviceProvider - address of service provider */ function cancelUpdateDeployerCut(address _serviceProvider) external { _requireIsInitialized(); _requirePendingDeployerCutOperation(_serviceProvider); require( msg.sender == _serviceProvider || msg.sender == governanceAddress, ERROR_ONLY_SP_GOVERNANCE ); UpdateDeployerCutRequest memory cancelledRequest = ( updateDeployerCutRequests[_serviceProvider] ); // Zero out request information delete updateDeployerCutRequests[_serviceProvider]; emit DeployerCutUpdateRequestCancelled( _serviceProvider, cancelledRequest.newDeployerCut, spDetails[_serviceProvider].deployerCut ); } /** * @notice Evalue request to update service provider cut of claims * @notice Update service provider cut as % of delegate claim, divided by the deployerCutBase. * @dev SPs will interact with this value as a percent, value translation done client side @dev A value of 5 dictates a 5% cut, with ( 5 / 100 ) * delegateReward going to an SP from each delegator each round. */ function updateDeployerCut(address _serviceProvider) external { _requireIsInitialized(); _requirePendingDeployerCutOperation(_serviceProvider); require( msg.sender == _serviceProvider || msg.sender == governanceAddress, ERROR_ONLY_SP_GOVERNANCE ); require( updateDeployerCutRequests[_serviceProvider].lockupExpiryBlock <= block.number, "ServiceProviderFactory: Lockup must be expired" ); spDetails[_serviceProvider].deployerCut = ( updateDeployerCutRequests[_serviceProvider].newDeployerCut ); // Zero out request information delete updateDeployerCutRequests[_serviceProvider]; emit DeployerCutUpdateRequestEvaluated( _serviceProvider, spDetails[_serviceProvider].deployerCut ); } /** * @notice Update service provider balance * @dev Called by DelegateManager by functions modifying entire stake like claim and slash * @param _serviceProvider - address of service provider * @param _amount - new amount of direct state for service provider */ function updateServiceProviderStake( address _serviceProvider, uint256 _amount ) external { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireDelegateManagerAddressIsSet(); require( msg.sender == delegateManagerAddress, "ServiceProviderFactory: only callable by DelegateManager" ); // Update SP tracked total spDetails[_serviceProvider].deployerStake = _amount; _updateServiceProviderBoundStatus(_serviceProvider); } /// @notice Update service provider lockup duration function updateDecreaseStakeLockupDuration(uint256 _duration) external { _requireIsInitialized(); require( msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE ); _updateDecreaseStakeLockupDuration(_duration); emit DecreaseStakeLockupDurationUpdated(_duration); } /// @notice Update service provider lockup duration function updateDeployerCutLockupDuration(uint256 _duration) external { _requireIsInitialized(); require( msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE ); _updateDeployerCutLockupDuration(_duration); emit UpdateDeployerCutLockupDurationUpdated(_duration); } /// @notice Get denominator for deployer cut calculations function getServiceProviderDeployerCutBase() external view returns (uint256) { _requireIsInitialized(); return DEPLOYER_CUT_BASE; } /// @notice Get current deployer cut update lockup duration function getDeployerCutLockupDuration() external view returns (uint256) { _requireIsInitialized(); return deployerCutLockupDuration; } /// @notice Get total number of service providers for a given serviceType function getTotalServiceTypeProviders(bytes32 _serviceType) external view returns (uint256) { _requireIsInitialized(); return serviceProviderTypeIDs[_serviceType]; } /// @notice Get service provider id for an endpoint function getServiceProviderIdFromEndpoint(string calldata _endpoint) external view returns (uint256) { _requireIsInitialized(); return serviceProviderEndpointToId[keccak256(bytes(_endpoint))]; } /** * @notice Get service provider ids for a given service provider and service type * @return List of service ids of that type for a service provider */ function getServiceProviderIdsFromAddress(address _ownerAddress, bytes32 _serviceType) external view returns (uint256[] memory) { _requireIsInitialized(); return serviceProviderAddressToId[_ownerAddress][_serviceType]; } /** * @notice Get information about a service endpoint given its service id * @param _serviceType - type of service, must be a valid service from ServiceTypeManager * @param _serviceId - id of service */ function getServiceEndpointInfo(bytes32 _serviceType, uint256 _serviceId) external view returns (address owner, string memory endpoint, uint256 blockNumber, address delegateOwnerWallet) { _requireIsInitialized(); ServiceEndpoint memory serviceEndpoint = serviceProviderInfo[_serviceType][_serviceId]; return ( serviceEndpoint.owner, serviceEndpoint.endpoint, serviceEndpoint.blocknumber, serviceEndpoint.delegateOwnerWallet ); } /** * @notice Get information about a service provider given their address * @param _serviceProvider - address of service provider */ function getServiceProviderDetails(address _serviceProvider) external view returns ( uint256 deployerStake, uint256 deployerCut, bool validBounds, uint256 numberOfEndpoints, uint256 minAccountStake, uint256 maxAccountStake) { _requireIsInitialized(); return ( spDetails[_serviceProvider].deployerStake, spDetails[_serviceProvider].deployerCut, spDetails[_serviceProvider].validBounds, spDetails[_serviceProvider].numberOfEndpoints, spDetails[_serviceProvider].minAccountStake, spDetails[_serviceProvider].maxAccountStake ); } /** * @notice Get information about pending decrease stake requests for service provider * @param _serviceProvider - address of service provider */ function getPendingDecreaseStakeRequest(address _serviceProvider) external view returns (uint256 amount, uint256 lockupExpiryBlock) { _requireIsInitialized(); return ( decreaseStakeRequests[_serviceProvider].decreaseAmount, decreaseStakeRequests[_serviceProvider].lockupExpiryBlock ); } /** * @notice Get information about pending decrease stake requests for service provider * @param _serviceProvider - address of service provider */ function getPendingUpdateDeployerCutRequest(address _serviceProvider) external view returns (uint256 newDeployerCut, uint256 lockupExpiryBlock) { _requireIsInitialized(); return ( updateDeployerCutRequests[_serviceProvider].newDeployerCut, updateDeployerCutRequests[_serviceProvider].lockupExpiryBlock ); } /// @notice Get current unstake lockup duration function getDecreaseStakeLockupDuration() external view returns (uint256) { _requireIsInitialized(); return decreaseStakeLockupDuration; } /** * @notice Validate that the total service provider balance is between the min and max stakes for all their registered services and validate direct stake for sp is above minimum * @param _serviceProvider - address of service provider */ function validateAccountStakeBalance(address _serviceProvider) external view { _requireIsInitialized(); _requireStakingAddressIsSet(); _validateBalanceInternal( _serviceProvider, Staking(stakingAddress).totalStakedFor(_serviceProvider) ); } /// @notice Get the Governance address function getGovernanceAddress() external view returns (address) { _requireIsInitialized(); return governanceAddress; } /// @notice Get the Staking address function getStakingAddress() external view returns (address) { _requireIsInitialized(); return stakingAddress; } /// @notice Get the DelegateManager address function getDelegateManagerAddress() external view returns (address) { _requireIsInitialized(); return delegateManagerAddress; } /// @notice Get the ServiceTypeManager address function getServiceTypeManagerAddress() external view returns (address) { _requireIsInitialized(); return serviceTypeManagerAddress; } /// @notice Get the ClaimsManager address function getClaimsManagerAddress() external view returns (address) { _requireIsInitialized(); return claimsManagerAddress; } /** * @notice Set the Governance address * @dev Only callable by Governance address * @param _governanceAddress - address for new Governance contract */ function setGovernanceAddress(address _governanceAddress) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); _updateGovernanceAddress(_governanceAddress); emit GovernanceAddressUpdated(_governanceAddress); } /** * @notice Set the Staking address * @dev Only callable by Governance address * @param _address - address for new Staking contract */ function setStakingAddress(address _address) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); stakingAddress = _address; emit StakingAddressUpdated(_address); } /** * @notice Set the DelegateManager address * @dev Only callable by Governance address * @param _address - address for new DelegateManager contract */ function setDelegateManagerAddress(address _address) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); delegateManagerAddress = _address; emit DelegateManagerAddressUpdated(_address); } /** * @notice Set the ServiceTypeManager address * @dev Only callable by Governance address * @param _address - address for new ServiceTypeManager contract */ function setServiceTypeManagerAddress(address _address) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); serviceTypeManagerAddress = _address; emit ServiceTypeManagerAddressUpdated(_address); } /** * @notice Set the ClaimsManager address * @dev Only callable by Governance address * @param _address - address for new ClaimsManager contract */ function setClaimsManagerAddress(address _address) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); claimsManagerAddress = _address; emit ClaimsManagerAddressUpdated(_address); } // ========================================= Internal Functions ========================================= /** * @notice Update status in spDetails if the bounds for a service provider is valid */ function _updateServiceProviderBoundStatus(address _serviceProvider) internal { // Validate bounds for total stake uint256 totalSPStake = Staking(stakingAddress).totalStakedFor(_serviceProvider); if (totalSPStake < spDetails[_serviceProvider].minAccountStake || totalSPStake > spDetails[_serviceProvider].maxAccountStake) { // Indicate this service provider is out of bounds spDetails[_serviceProvider].validBounds = false; } else { // Indicate this service provider is within bounds spDetails[_serviceProvider].validBounds = true; } } /** * @notice Set the governance address after confirming contract identity * @param _governanceAddress - Incoming governance address */ function _updateGovernanceAddress(address _governanceAddress) internal { require( Governance(_governanceAddress).isGovernanceAddress() == true, "ServiceProviderFactory: _governanceAddress is not a valid governance contract" ); governanceAddress = _governanceAddress; } /** * @notice Set the deployer cut lockup duration * @param _duration - incoming duration */ function _updateDeployerCutLockupDuration(uint256 _duration) internal { require( ClaimsManager(claimsManagerAddress).getFundingRoundBlockDiff() < _duration, "ServiceProviderFactory: Incoming duration must be greater than funding round block diff" ); deployerCutLockupDuration = _duration; } /** * @notice Set the decrease stake lockup duration * @param _duration - incoming duration */ function _updateDecreaseStakeLockupDuration(uint256 _duration) internal { Governance governance = Governance(governanceAddress); require( _duration > governance.getVotingPeriod() + governance.getExecutionDelay(), "ServiceProviderFactory: decreaseStakeLockupDuration duration must be greater than governance votingPeriod + executionDelay" ); decreaseStakeLockupDuration = _duration; } /** * @notice Compare a given amount input against valid min and max bounds for service provider * @param _serviceProvider - address of service provider * @param _amount - amount in wei to compare */ function _validateBalanceInternal(address _serviceProvider, uint256 _amount) internal view { require( _amount <= spDetails[_serviceProvider].maxAccountStake, "ServiceProviderFactory: Maximum stake amount exceeded" ); require( spDetails[_serviceProvider].deployerStake >= spDetails[_serviceProvider].minAccountStake, "ServiceProviderFactory: Minimum stake requirement not met" ); } /** * @notice Get whether a decrease request has been initiated for service provider * @param _serviceProvider - address of service provider * return Boolean of whether decrease request has been initiated */ function _decreaseRequestIsPending(address _serviceProvider) internal view returns (bool) { return ( (decreaseStakeRequests[_serviceProvider].lockupExpiryBlock > 0) && (decreaseStakeRequests[_serviceProvider].decreaseAmount > 0) ); } /** * @notice Boolean indicating whether a claim is pending for this service provider */ /** * @notice Get whether a claim is pending for this service provider * @param _serviceProvider - address of service provider * return Boolean of whether claim is pending */ function _claimPending(address _serviceProvider) internal view returns (bool) { return ClaimsManager(claimsManagerAddress).claimPending(_serviceProvider); } // ========================================= Private Functions ========================================= function _requirePendingDeployerCutOperation (address _serviceProvider) private view { require( (updateDeployerCutRequests[_serviceProvider].lockupExpiryBlock != 0), "ServiceProviderFactory: No update deployer cut operation pending" ); } function _requireStakingAddressIsSet() private view { require( stakingAddress != address(0x00), "ServiceProviderFactory: stakingAddress is not set" ); } function _requireDelegateManagerAddressIsSet() private view { require( delegateManagerAddress != address(0x00), "ServiceProviderFactory: delegateManagerAddress is not set" ); } function _requireServiceTypeManagerAddressIsSet() private view { require( serviceTypeManagerAddress != address(0x00), "ServiceProviderFactory: serviceTypeManagerAddress is not set" ); } function _requireClaimsManagerAddressIsSet() private view { require( claimsManagerAddress != address(0x00), "ServiceProviderFactory: claimsManagerAddress is not set" ); } } // File: contracts/DelegateManager.sol pragma solidity ^0.5.0; /// @notice SafeMath imported via ServiceProviderFactory.sol /// @notice Governance imported via Staking.sol /** * Designed to manage delegation to staking contract */ contract DelegateManagerV2 is InitializableV2 { using SafeMath for uint256; string private constant ERROR_ONLY_GOVERNANCE = ( "DelegateManager: Only callable by Governance contract" ); string private constant ERROR_MINIMUM_DELEGATION = ( "DelegateManager: Minimum delegation amount required" ); string private constant ERROR_ONLY_SP_GOVERNANCE = ( "DelegateManager: Only callable by target SP or governance" ); string private constant ERROR_DELEGATOR_STAKE = ( "DelegateManager: Delegator must be staked for SP" ); address private governanceAddress; address private stakingAddress; address private serviceProviderFactoryAddress; address private claimsManagerAddress; /** * Period in blocks an undelegate operation is delayed. * The undelegate operation speed bump is to prevent a delegator from * attempting to remove their delegation in anticipation of a slash. * @notice Must be greater than governance votingPeriod + executionDelay */ uint256 private undelegateLockupDuration; /// @notice Maximum number of delegators a single account can handle uint256 private maxDelegators; /// @notice Minimum amount of delegation allowed uint256 private minDelegationAmount; /** * Lockup duration for a remove delegator request. * The remove delegator speed bump is to prevent a service provider from maliciously * removing a delegator prior to the evaluation of a proposal. * @notice Must be greater than governance votingPeriod + executionDelay */ uint256 private removeDelegatorLockupDuration; /** * Evaluation period for a remove delegator request * @notice added to expiry block calculated for removeDelegatorLockupDuration */ uint256 private removeDelegatorEvalDuration; // Staking contract ref ERC20Mintable private audiusToken; // Struct representing total delegated to SP and list of delegators struct ServiceProviderDelegateInfo { uint256 totalDelegatedStake; uint256 totalLockedUpStake; address[] delegators; } // Data structures for lockup during withdrawal struct UndelegateStakeRequest { address serviceProvider; uint256 amount; uint256 lockupExpiryBlock; } // Service provider address -> ServiceProviderDelegateInfo mapping (address => ServiceProviderDelegateInfo) private spDelegateInfo; // Delegator stake by address delegated to // delegator -> (service provider -> delegatedStake) mapping (address => mapping(address => uint256)) private delegateInfo; // Delegator stake total by address // delegator -> (totalDelegated) // Note - delegator properties are maintained in a mapping instead of struct // in order to facilitate extensibility in the future. mapping (address => uint256) private delegatorTotalStake; // Requester to pending undelegate request mapping (address => UndelegateStakeRequest) private undelegateRequests; // Pending remove delegator requests // service provider -> (delegator -> lockupExpiryBlock) mapping (address => mapping (address => uint256)) private removeDelegatorRequests; event IncreaseDelegatedStake( address indexed _delegator, address indexed _serviceProvider, uint256 indexed _increaseAmount ); event UndelegateStakeRequested( address indexed _delegator, address indexed _serviceProvider, uint256 indexed _amount, uint256 _lockupExpiryBlock ); event UndelegateStakeRequestCancelled( address indexed _delegator, address indexed _serviceProvider, uint256 indexed _amount ); event UndelegateStakeRequestEvaluated( address indexed _delegator, address indexed _serviceProvider, uint256 indexed _amount ); event Claim( address indexed _claimer, uint256 indexed _rewards, uint256 indexed _newTotal ); event Slash( address indexed _target, uint256 indexed _amount, uint256 indexed _newTotal ); event RemoveDelegatorRequested( address indexed _serviceProvider, address indexed _delegator, uint256 indexed _lockupExpiryBlock ); event RemoveDelegatorRequestCancelled( address indexed _serviceProvider, address indexed _delegator ); event RemoveDelegatorRequestEvaluated( address indexed _serviceProvider, address indexed _delegator, uint256 indexed _unstakedAmount ); event MaxDelegatorsUpdated(uint256 indexed _maxDelegators); event MinDelegationUpdated(uint256 indexed _minDelegationAmount); event UndelegateLockupDurationUpdated(uint256 indexed _undelegateLockupDuration); event GovernanceAddressUpdated(address indexed _newGovernanceAddress); event StakingAddressUpdated(address indexed _newStakingAddress); event ServiceProviderFactoryAddressUpdated(address indexed _newServiceProviderFactoryAddress); event ClaimsManagerAddressUpdated(address indexed _newClaimsManagerAddress); event RemoveDelegatorLockupDurationUpdated(uint256 indexed _removeDelegatorLockupDuration); event RemoveDelegatorEvalDurationUpdated(uint256 indexed _removeDelegatorEvalDuration); // ========================================= New State Variables ========================================= string private constant ERROR_ONLY_SERVICE_PROVIDER = ( "DelegateManager: Only callable by valid Service Provider" ); // minDelegationAmount per service provider mapping (address => uint256) private spMinDelegationAmounts; event SPMinDelegationAmountUpdated( address indexed _serviceProvider, uint256 indexed _spMinDelegationAmount ); // ========================================= Modifier Functions ========================================= /** * @notice Function to initialize the contract * @dev stakingAddress must be initialized separately after Staking contract is deployed * @dev serviceProviderFactoryAddress must be initialized separately after ServiceProviderFactory contract is deployed * @dev claimsManagerAddress must be initialized separately after ClaimsManager contract is deployed * @param _tokenAddress - address of ERC20 token that will be claimed * @param _governanceAddress - Governance proxy address */ function initialize ( address _tokenAddress, address _governanceAddress, uint256 _undelegateLockupDuration ) public initializer { _updateGovernanceAddress(_governanceAddress); audiusToken = ERC20Mintable(_tokenAddress); maxDelegators = 175; // Default minimum delegation amount set to 100AUD minDelegationAmount = 100 * 10**uint256(18); InitializableV2.initialize(); _updateUndelegateLockupDuration(_undelegateLockupDuration); // 1 week = 168hrs * 60 min/hr * 60 sec/min / ~13 sec/block = 46523 blocks _updateRemoveDelegatorLockupDuration(46523); // 24hr * 60min/hr * 60sec/min / ~13 sec/block = 6646 blocks removeDelegatorEvalDuration = 6646; } /** * @notice Allow a delegator to delegate stake to a service provider * @param _targetSP - address of service provider to delegate to * @param _amount - amount in wei to delegate * @return Updated total amount delegated to the service provider by delegator */ function delegateStake( address _targetSP, uint256 _amount ) external returns (uint256) { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireServiceProviderFactoryAddressIsSet(); _requireClaimsManagerAddressIsSet(); require( !_claimPending(_targetSP), "DelegateManager: Delegation not permitted for SP pending claim" ); address delegator = msg.sender; Staking stakingContract = Staking(stakingAddress); // Stake on behalf of target service provider stakingContract.delegateStakeFor( _targetSP, delegator, _amount ); // Update list of delegators to SP if necessary if (!_delegatorExistsForSP(delegator, _targetSP)) { // If not found, update list of delegates spDelegateInfo[_targetSP].delegators.push(delegator); require( spDelegateInfo[_targetSP].delegators.length <= maxDelegators, "DelegateManager: Maximum delegators exceeded" ); } // Update following values in storage through helper // totalServiceProviderDelegatedStake = current sp total + new amount, // totalStakedForSpFromDelegator = current delegator total for sp + new amount, // totalDelegatorStake = current delegator total + new amount _updateDelegatorStake( delegator, _targetSP, spDelegateInfo[_targetSP].totalDelegatedStake.add(_amount), delegateInfo[delegator][_targetSP].add(_amount), delegatorTotalStake[delegator].add(_amount) ); // Need to ensure delegationAmount is >= both minDelegationAmount and spMinDelegationAmount // since spMinDelegationAmount by default is 0 require( (delegateInfo[delegator][_targetSP] >= minDelegationAmount && delegateInfo[delegator][_targetSP] >= spMinDelegationAmounts[_targetSP] ), ERROR_MINIMUM_DELEGATION ); // Validate balance ServiceProviderFactory( serviceProviderFactoryAddress ).validateAccountStakeBalance(_targetSP); emit IncreaseDelegatedStake( delegator, _targetSP, _amount ); // Return new total return delegateInfo[delegator][_targetSP]; } /** * @notice Submit request for undelegation * @param _target - address of service provider to undelegate stake from * @param _amount - amount in wei to undelegate * @return Updated total amount delegated to the service provider by delegator */ function requestUndelegateStake( address _target, uint256 _amount ) external returns (uint256) { _requireIsInitialized(); _requireClaimsManagerAddressIsSet(); require( _amount > 0, "DelegateManager: Requested undelegate stake amount must be greater than zero" ); require( !_claimPending(_target), "DelegateManager: Undelegate request not permitted for SP pending claim" ); address delegator = msg.sender; require( _delegatorExistsForSP(delegator, _target), ERROR_DELEGATOR_STAKE ); // Confirm no pending delegation request require( !_undelegateRequestIsPending(delegator), "DelegateManager: No pending lockup expected" ); // Ensure valid bounds uint256 currentlyDelegatedToSP = delegateInfo[delegator][_target]; require( _amount <= currentlyDelegatedToSP, "DelegateManager: Cannot decrease greater than currently staked for this ServiceProvider" ); // Submit updated request for sender, with target sp, undelegate amount, target expiry block uint256 lockupExpiryBlock = block.number.add(undelegateLockupDuration); _updateUndelegateStakeRequest( delegator, _target, _amount, lockupExpiryBlock ); // Update total locked for this service provider, increasing by unstake amount _updateServiceProviderLockupAmount( _target, spDelegateInfo[_target].totalLockedUpStake.add(_amount) ); emit UndelegateStakeRequested(delegator, _target, _amount, lockupExpiryBlock); return delegateInfo[delegator][_target].sub(_amount); } /** * @notice Cancel undelegation request */ function cancelUndelegateStakeRequest() external { _requireIsInitialized(); address delegator = msg.sender; // Confirm pending delegation request require( _undelegateRequestIsPending(delegator), "DelegateManager: Pending lockup expected" ); uint256 unstakeAmount = undelegateRequests[delegator].amount; address unlockFundsSP = undelegateRequests[delegator].serviceProvider; // Update total locked for this service provider, decreasing by unstake amount _updateServiceProviderLockupAmount( unlockFundsSP, spDelegateInfo[unlockFundsSP].totalLockedUpStake.sub(unstakeAmount) ); // Remove pending request _resetUndelegateStakeRequest(delegator); emit UndelegateStakeRequestCancelled(delegator, unlockFundsSP, unstakeAmount); } /** * @notice Finalize undelegation request and withdraw stake * @return New total amount currently staked after stake has been undelegated */ function undelegateStake() external returns (uint256) { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireServiceProviderFactoryAddressIsSet(); _requireClaimsManagerAddressIsSet(); address delegator = msg.sender; // Confirm pending delegation request require( _undelegateRequestIsPending(delegator), "DelegateManager: Pending lockup expected" ); // Confirm lockup expiry has expired require( undelegateRequests[delegator].lockupExpiryBlock <= block.number, "DelegateManager: Lockup must be expired" ); // Confirm no pending claim for this service provider require( !_claimPending(undelegateRequests[delegator].serviceProvider), "DelegateManager: Undelegate not permitted for SP pending claim" ); address serviceProvider = undelegateRequests[delegator].serviceProvider; uint256 unstakeAmount = undelegateRequests[delegator].amount; // Unstake on behalf of target service provider Staking(stakingAddress).undelegateStakeFor( serviceProvider, delegator, unstakeAmount ); // Update total delegated for SP // totalServiceProviderDelegatedStake - total amount delegated to service provider // totalStakedForSpFromDelegator - amount staked from this delegator to targeted service provider _updateDelegatorStake( delegator, serviceProvider, spDelegateInfo[serviceProvider].totalDelegatedStake.sub(unstakeAmount), delegateInfo[delegator][serviceProvider].sub(unstakeAmount), delegatorTotalStake[delegator].sub(unstakeAmount) ); // Need to ensure delegationAmount is >= both minDelegationAmount and spMinDelegationAmount // since spMinDelegationAmount by default is 0 // Only exception is when delegating entire stake down to 0 require( ( delegateInfo[delegator][serviceProvider] >= minDelegationAmount && delegateInfo[delegator][serviceProvider] >= spMinDelegationAmounts[serviceProvider] ) || delegateInfo[delegator][serviceProvider] == 0, ERROR_MINIMUM_DELEGATION ); // Remove from delegators list if no delegated stake remaining if (delegateInfo[delegator][serviceProvider] == 0) { _removeFromDelegatorsList(serviceProvider, delegator); } // Update total locked for this service provider, decreasing by unstake amount _updateServiceProviderLockupAmount( serviceProvider, spDelegateInfo[serviceProvider].totalLockedUpStake.sub(unstakeAmount) ); // Reset undelegate request _resetUndelegateStakeRequest(delegator); emit UndelegateStakeRequestEvaluated( delegator, serviceProvider, unstakeAmount ); // Need to update service provider's `validBounds` flag // Only way to do this is through `SPFactory.updateServiceProviderStake()` // So we call it with the existing `spDeployerStake` (uint256 spDeployerStake,,,,,) = ( ServiceProviderFactory(serviceProviderFactoryAddress).getServiceProviderDetails(serviceProvider) ); ServiceProviderFactory(serviceProviderFactoryAddress).updateServiceProviderStake( serviceProvider, spDeployerStake ); // Return new total return delegateInfo[delegator][serviceProvider]; } /** * @notice Claim and distribute rewards to delegators and service provider as necessary * @param _serviceProvider - Provider for which rewards are being distributed * @dev Factors in service provider rewards from delegator and transfers deployer cut */ function claimRewards(address _serviceProvider) external { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireServiceProviderFactoryAddressIsSet(); _requireClaimsManagerAddressIsSet(); ServiceProviderFactory spFactory = ServiceProviderFactory(serviceProviderFactoryAddress); // Total rewards = (balance in staking) - ((balance in sp factory) + (balance in delegate manager)) ( uint256 totalBalanceInStaking, uint256 totalBalanceInSPFactory, uint256 totalActiveFunds, uint256 totalRewards, uint256 deployerCut ) = _validateClaimRewards(spFactory, _serviceProvider); // No-op if balance is already equivalent // This case can occur if no rewards due to bound violation or all stake is locked if (totalRewards == 0) { return; } uint256 totalDelegatedStakeIncrease = _distributeDelegateRewards( _serviceProvider, totalActiveFunds, totalRewards, deployerCut, spFactory.getServiceProviderDeployerCutBase() ); // Update total delegated to this SP spDelegateInfo[_serviceProvider].totalDelegatedStake = ( spDelegateInfo[_serviceProvider].totalDelegatedStake.add(totalDelegatedStakeIncrease) ); // spRewardShare represents rewards directly allocated to service provider for their stake // Value is computed as the remainder of total minted rewards after distribution to // delegators, eliminating any potential for precision loss. uint256 spRewardShare = totalRewards.sub(totalDelegatedStakeIncrease); // Adding the newly calculated reward share to current balance uint256 newSPFactoryBalance = totalBalanceInSPFactory.add(spRewardShare); require( totalBalanceInStaking == newSPFactoryBalance.add(spDelegateInfo[_serviceProvider].totalDelegatedStake), "DelegateManager: claimRewards amount mismatch" ); spFactory.updateServiceProviderStake( _serviceProvider, newSPFactoryBalance ); } /** * @notice Reduce current stake amount * @dev Only callable by governance. Slashes service provider and delegators equally * @param _amount - amount in wei to slash * @param _slashAddress - address of service provider to slash */ function slash(uint256 _amount, address _slashAddress) external { _requireIsInitialized(); _requireStakingAddressIsSet(); _requireServiceProviderFactoryAddressIsSet(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); Staking stakingContract = Staking(stakingAddress); ServiceProviderFactory spFactory = ServiceProviderFactory(serviceProviderFactoryAddress); // Amount stored in staking contract for owner uint256 totalBalanceInStakingPreSlash = stakingContract.totalStakedFor(_slashAddress); require( (totalBalanceInStakingPreSlash >= _amount), "DelegateManager: Cannot slash more than total currently staked" ); // Cancel any withdrawal request for this service provider (uint256 spLockedStake,) = spFactory.getPendingDecreaseStakeRequest(_slashAddress); if (spLockedStake > 0) { spFactory.cancelDecreaseStakeRequest(_slashAddress); } // Amount in sp factory for slash target (uint256 totalBalanceInSPFactory,,,,,) = ( spFactory.getServiceProviderDetails(_slashAddress) ); require( totalBalanceInSPFactory > 0, "DelegateManager: Service Provider stake required" ); // Decrease value in Staking contract // A value of zero slash will fail in staking, reverting this transaction stakingContract.slash(_amount, _slashAddress); uint256 totalBalanceInStakingAfterSlash = stakingContract.totalStakedFor(_slashAddress); // Emit slash event emit Slash(_slashAddress, _amount, totalBalanceInStakingAfterSlash); uint256 totalDelegatedStakeDecrease = 0; // For each delegator and deployer, recalculate new value // newStakeAmount = newStakeAmount * (oldStakeAmount / totalBalancePreSlash) for (uint256 i = 0; i < spDelegateInfo[_slashAddress].delegators.length; i++) { address delegator = spDelegateInfo[_slashAddress].delegators[i]; uint256 preSlashDelegateStake = delegateInfo[delegator][_slashAddress]; uint256 newDelegateStake = ( totalBalanceInStakingAfterSlash.mul(preSlashDelegateStake) ).div(totalBalanceInStakingPreSlash); // slashAmountForDelegator = preSlashDelegateStake - newDelegateStake; delegateInfo[delegator][_slashAddress] = ( delegateInfo[delegator][_slashAddress].sub(preSlashDelegateStake.sub(newDelegateStake)) ); // Update total stake for delegator _updateDelegatorTotalStake( delegator, delegatorTotalStake[delegator].sub(preSlashDelegateStake.sub(newDelegateStake)) ); // Update total decrease amount totalDelegatedStakeDecrease = ( totalDelegatedStakeDecrease.add(preSlashDelegateStake.sub(newDelegateStake)) ); // Check for any locked up funds for this slashed delegator // Slash overrides any pending withdrawal requests if (undelegateRequests[delegator].amount != 0) { address unstakeSP = undelegateRequests[delegator].serviceProvider; uint256 unstakeAmount = undelegateRequests[delegator].amount; // Remove pending request _updateServiceProviderLockupAmount( unstakeSP, spDelegateInfo[unstakeSP].totalLockedUpStake.sub(unstakeAmount) ); _resetUndelegateStakeRequest(delegator); } } // Update total delegated to this SP spDelegateInfo[_slashAddress].totalDelegatedStake = ( spDelegateInfo[_slashAddress].totalDelegatedStake.sub(totalDelegatedStakeDecrease) ); // Remaining decrease applied to service provider uint256 totalStakeDecrease = ( totalBalanceInStakingPreSlash.sub(totalBalanceInStakingAfterSlash) ); uint256 totalSPFactoryBalanceDecrease = ( totalStakeDecrease.sub(totalDelegatedStakeDecrease) ); spFactory.updateServiceProviderStake( _slashAddress, totalBalanceInSPFactory.sub(totalSPFactoryBalanceDecrease) ); } /** * @notice Initiate forcible removal of a delegator * @param _serviceProvider - address of service provider * @param _delegator - address of delegator */ function requestRemoveDelegator(address _serviceProvider, address _delegator) external { _requireIsInitialized(); require( msg.sender == _serviceProvider || msg.sender == governanceAddress, ERROR_ONLY_SP_GOVERNANCE ); require( removeDelegatorRequests[_serviceProvider][_delegator] == 0, "DelegateManager: Pending remove delegator request" ); require( _delegatorExistsForSP(_delegator, _serviceProvider), ERROR_DELEGATOR_STAKE ); // Update lockup removeDelegatorRequests[_serviceProvider][_delegator] = ( block.number + removeDelegatorLockupDuration ); emit RemoveDelegatorRequested( _serviceProvider, _delegator, removeDelegatorRequests[_serviceProvider][_delegator] ); } /** * @notice Cancel pending removeDelegator request * @param _serviceProvider - address of service provider * @param _delegator - address of delegator */ function cancelRemoveDelegatorRequest(address _serviceProvider, address _delegator) external { require( msg.sender == _serviceProvider || msg.sender == governanceAddress, ERROR_ONLY_SP_GOVERNANCE ); require( removeDelegatorRequests[_serviceProvider][_delegator] != 0, "DelegateManager: No pending request" ); // Reset lockup expiry removeDelegatorRequests[_serviceProvider][_delegator] = 0; emit RemoveDelegatorRequestCancelled(_serviceProvider, _delegator); } /** * @notice Evaluate removeDelegator request * @param _serviceProvider - address of service provider * @param _delegator - address of delegator * @return Updated total amount delegated to the service provider by delegator */ function removeDelegator(address _serviceProvider, address _delegator) external { _requireIsInitialized(); _requireStakingAddressIsSet(); require( msg.sender == _serviceProvider || msg.sender == governanceAddress, ERROR_ONLY_SP_GOVERNANCE ); require( removeDelegatorRequests[_serviceProvider][_delegator] != 0, "DelegateManager: No pending request" ); // Enforce lockup expiry block require( block.number >= removeDelegatorRequests[_serviceProvider][_delegator], "DelegateManager: Lockup must be expired" ); // Enforce evaluation window for request require( block.number < removeDelegatorRequests[_serviceProvider][_delegator] + removeDelegatorEvalDuration, "DelegateManager: RemoveDelegator evaluation window expired" ); uint256 unstakeAmount = delegateInfo[_delegator][_serviceProvider]; // Unstake on behalf of target service provider Staking(stakingAddress).undelegateStakeFor( _serviceProvider, _delegator, unstakeAmount ); // Update total delegated for SP // totalServiceProviderDelegatedStake - total amount delegated to service provider // totalStakedForSpFromDelegator - amount staked from this delegator to targeted service provider _updateDelegatorStake( _delegator, _serviceProvider, spDelegateInfo[_serviceProvider].totalDelegatedStake.sub(unstakeAmount), delegateInfo[_delegator][_serviceProvider].sub(unstakeAmount), delegatorTotalStake[_delegator].sub(unstakeAmount) ); if ( _undelegateRequestIsPending(_delegator) && undelegateRequests[_delegator].serviceProvider == _serviceProvider ) { // Remove pending request information _updateServiceProviderLockupAmount( _serviceProvider, spDelegateInfo[_serviceProvider].totalLockedUpStake.sub(undelegateRequests[_delegator].amount) ); _resetUndelegateStakeRequest(_delegator); } // Remove from list of delegators _removeFromDelegatorsList(_serviceProvider, _delegator); // Reset lockup expiry removeDelegatorRequests[_serviceProvider][_delegator] = 0; emit RemoveDelegatorRequestEvaluated(_serviceProvider, _delegator, unstakeAmount); } /** * @notice SP can update their minDelegationAmount * @param _serviceProvider - address of service provider * @param _spMinDelegationAmount - new minDelegationAmount for SP * @notice does not enforce _spMinDelegationAmount >= minDelegationAmount since not necessary * delegateStake() and undelegateStake() always take the max of both already */ function updateSPMinDelegationAmount( address _serviceProvider, uint256 _spMinDelegationAmount ) external { _requireIsInitialized(); require(msg.sender == _serviceProvider, ERROR_ONLY_SERVICE_PROVIDER); /** * Ensure _serviceProvider is a valid SP * No objective source of truth, closest heuristic is numEndpoints > 0 */ (,,, uint256 numEndpoints,,) = ( ServiceProviderFactory(serviceProviderFactoryAddress) .getServiceProviderDetails(_serviceProvider) ); require(numEndpoints > 0, ERROR_ONLY_SERVICE_PROVIDER); spMinDelegationAmounts[_serviceProvider] = _spMinDelegationAmount; emit SPMinDelegationAmountUpdated(_serviceProvider, _spMinDelegationAmount); } /** * @notice Update duration for undelegate request lockup * @param _duration - new lockup duration */ function updateUndelegateLockupDuration(uint256 _duration) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); _updateUndelegateLockupDuration(_duration); emit UndelegateLockupDurationUpdated(_duration); } /** * @notice Update maximum delegators allowed * @param _maxDelegators - new max delegators */ function updateMaxDelegators(uint256 _maxDelegators) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); maxDelegators = _maxDelegators; emit MaxDelegatorsUpdated(_maxDelegators); } /** * @notice Update minimum delegation amount * @param _minDelegationAmount - min new min delegation amount */ function updateMinDelegationAmount(uint256 _minDelegationAmount) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); minDelegationAmount = _minDelegationAmount; emit MinDelegationUpdated(_minDelegationAmount); } /** * @notice Update remove delegator lockup duration * @param _duration - new lockup duration */ function updateRemoveDelegatorLockupDuration(uint256 _duration) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); _updateRemoveDelegatorLockupDuration(_duration); emit RemoveDelegatorLockupDurationUpdated(_duration); } /** * @notice Update remove delegator evaluation window duration * @param _duration - new window duration */ function updateRemoveDelegatorEvalDuration(uint256 _duration) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); removeDelegatorEvalDuration = _duration; emit RemoveDelegatorEvalDurationUpdated(_duration); } /** * @notice Set the Governance address * @dev Only callable by Governance address * @param _governanceAddress - address for new Governance contract */ function setGovernanceAddress(address _governanceAddress) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); _updateGovernanceAddress(_governanceAddress); governanceAddress = _governanceAddress; emit GovernanceAddressUpdated(_governanceAddress); } /** * @notice Set the Staking address * @dev Only callable by Governance address * @param _stakingAddress - address for new Staking contract */ function setStakingAddress(address _stakingAddress) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); stakingAddress = _stakingAddress; emit StakingAddressUpdated(_stakingAddress); } /** * @notice Set the ServiceProviderFactory address * @dev Only callable by Governance address * @param _spFactory - address for new ServiceProviderFactory contract */ function setServiceProviderFactoryAddress(address _spFactory) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); serviceProviderFactoryAddress = _spFactory; emit ServiceProviderFactoryAddressUpdated(_spFactory); } /** * @notice Set the ClaimsManager address * @dev Only callable by Governance address * @param _claimsManagerAddress - address for new ClaimsManager contract */ function setClaimsManagerAddress(address _claimsManagerAddress) external { _requireIsInitialized(); require(msg.sender == governanceAddress, ERROR_ONLY_GOVERNANCE); claimsManagerAddress = _claimsManagerAddress; emit ClaimsManagerAddressUpdated(_claimsManagerAddress); } // ========================================= View Functions ========================================= /** * @notice Get list of delegators for a given service provider * @param _sp - service provider address */ function getDelegatorsList(address _sp) external view returns (address[] memory) { _requireIsInitialized(); return spDelegateInfo[_sp].delegators; } /** * @notice Get total delegation from a given address * @param _delegator - delegator address */ function getTotalDelegatorStake(address _delegator) external view returns (uint256) { _requireIsInitialized(); return delegatorTotalStake[_delegator]; } /// @notice Get total amount delegated to a service provider function getTotalDelegatedToServiceProvider(address _sp) external view returns (uint256) { _requireIsInitialized(); return spDelegateInfo[_sp].totalDelegatedStake; } /// @notice Get total delegated stake locked up for a service provider function getTotalLockedDelegationForServiceProvider(address _sp) external view returns (uint256) { _requireIsInitialized(); return spDelegateInfo[_sp].totalLockedUpStake; } /// @notice Get total currently staked for a delegator, for a given service provider function getDelegatorStakeForServiceProvider(address _delegator, address _serviceProvider) external view returns (uint256) { _requireIsInitialized(); return delegateInfo[_delegator][_serviceProvider]; } /** * @notice Get status of pending undelegate request for a given address * @param _delegator - address of the delegator */ function getPendingUndelegateRequest(address _delegator) external view returns (address target, uint256 amount, uint256 lockupExpiryBlock) { _requireIsInitialized(); UndelegateStakeRequest memory req = undelegateRequests[_delegator]; return (req.serviceProvider, req.amount, req.lockupExpiryBlock); } /** * @notice Get status of pending remove delegator request for a given address * @param _serviceProvider - address of the service provider * @param _delegator - address of the delegator * @return - current lockup expiry block for remove delegator request */ function getPendingRemoveDelegatorRequest( address _serviceProvider, address _delegator ) external view returns (uint256) { _requireIsInitialized(); return removeDelegatorRequests[_serviceProvider][_delegator]; } /** * @notice Get minDelegationAmount for given SP * @param _serviceProvider - address of the service provider * @return - minDelegationAmount for given SP */ function getSPMinDelegationAmount(address _serviceProvider) external view returns (uint256) { return spMinDelegationAmounts[_serviceProvider]; } /// @notice Get current undelegate lockup duration function getUndelegateLockupDuration() external view returns (uint256) { _requireIsInitialized(); return undelegateLockupDuration; } /// @notice Current maximum delegators function getMaxDelegators() external view returns (uint256) { _requireIsInitialized(); return maxDelegators; } /// @notice Get minimum delegation amount function getMinDelegationAmount() external view returns (uint256) { _requireIsInitialized(); return minDelegationAmount; } /// @notice Get the duration for remove delegator request lockup function getRemoveDelegatorLockupDuration() external view returns (uint256) { _requireIsInitialized(); return removeDelegatorLockupDuration; } /// @notice Get the duration for evaluation of remove delegator operations function getRemoveDelegatorEvalDuration() external view returns (uint256) { _requireIsInitialized(); return removeDelegatorEvalDuration; } /// @notice Get the Governance address function getGovernanceAddress() external view returns (address) { _requireIsInitialized(); return governanceAddress; } /// @notice Get the ServiceProviderFactory address function getServiceProviderFactoryAddress() external view returns (address) { _requireIsInitialized(); return serviceProviderFactoryAddress; } /// @notice Get the ClaimsManager address function getClaimsManagerAddress() external view returns (address) { _requireIsInitialized(); return claimsManagerAddress; } /// @notice Get the Staking address function getStakingAddress() external view returns (address) { _requireIsInitialized(); return stakingAddress; } // ========================================= Internal functions ========================================= /** * @notice Helper function for claimRewards to get balances from Staking contract and do validation * @param spFactory - reference to ServiceProviderFactory contract * @param _serviceProvider - address for which rewards are being claimed * @return (totalBalanceInStaking, totalBalanceInSPFactory, totalActiveFunds, spLockedStake, totalRewards, deployerCut) */ function _validateClaimRewards(ServiceProviderFactory spFactory, address _serviceProvider) internal returns ( uint256 totalBalanceInStaking, uint256 totalBalanceInSPFactory, uint256 totalActiveFunds, uint256 totalRewards, uint256 deployerCut ) { // Account for any pending locked up stake for the service provider (uint256 spLockedStake,) = spFactory.getPendingDecreaseStakeRequest(_serviceProvider); uint256 totalLockedUpStake = ( spDelegateInfo[_serviceProvider].totalLockedUpStake.add(spLockedStake) ); // Process claim for msg.sender // Total locked parameter is equal to delegate locked up stake + service provider locked up stake uint256 mintedRewards = ClaimsManager(claimsManagerAddress).processClaim( _serviceProvider, totalLockedUpStake ); // Amount stored in staking contract for owner totalBalanceInStaking = Staking(stakingAddress).totalStakedFor(_serviceProvider); // Amount in sp factory for claimer ( totalBalanceInSPFactory, deployerCut, ,,, ) = spFactory.getServiceProviderDetails(_serviceProvider); // Require active stake to claim any rewards // Amount in delegate manager staked to service provider uint256 totalBalanceOutsideStaking = ( totalBalanceInSPFactory.add(spDelegateInfo[_serviceProvider].totalDelegatedStake) ); totalActiveFunds = totalBalanceOutsideStaking.sub(totalLockedUpStake); require( mintedRewards == totalBalanceInStaking.sub(totalBalanceOutsideStaking), "DelegateManager: Reward amount mismatch" ); // Emit claim event emit Claim(_serviceProvider, totalRewards, totalBalanceInStaking); return ( totalBalanceInStaking, totalBalanceInSPFactory, totalActiveFunds, mintedRewards, deployerCut ); } /** * @notice Perform state updates when a delegate stake has changed * @param _delegator - address of delegator * @param _serviceProvider - address of service provider * @param _totalServiceProviderDelegatedStake - total delegated to this service provider * @param _totalStakedForSpFromDelegator - total delegated to this service provider by delegator * @param _totalDelegatorStake - total delegated from this delegator address */ function _updateDelegatorStake( address _delegator, address _serviceProvider, uint256 _totalServiceProviderDelegatedStake, uint256 _totalStakedForSpFromDelegator, uint256 _totalDelegatorStake ) internal { // Update total delegated for SP spDelegateInfo[_serviceProvider].totalDelegatedStake = _totalServiceProviderDelegatedStake; // Update amount staked from this delegator to targeted service provider delegateInfo[_delegator][_serviceProvider] = _totalStakedForSpFromDelegator; // Update total delegated from this delegator _updateDelegatorTotalStake(_delegator, _totalDelegatorStake); } /** * @notice Reset pending undelegate stake request * @param _delegator - address of delegator */ function _resetUndelegateStakeRequest(address _delegator) internal { _updateUndelegateStakeRequest(_delegator, address(0), 0, 0); } /** * @notice Perform updates when undelegate request state has changed * @param _delegator - address of delegator * @param _serviceProvider - address of service provider * @param _amount - amount being undelegated * @param _lockupExpiryBlock - block at which stake can be undelegated */ function _updateUndelegateStakeRequest( address _delegator, address _serviceProvider, uint256 _amount, uint256 _lockupExpiryBlock ) internal { // Update lockup information undelegateRequests[_delegator] = UndelegateStakeRequest({ lockupExpiryBlock: _lockupExpiryBlock, amount: _amount, serviceProvider: _serviceProvider }); } /** * @notice Update total amount delegated from an address * @param _delegator - address of service provider * @param _amount - updated delegator total */ function _updateDelegatorTotalStake(address _delegator, uint256 _amount) internal { delegatorTotalStake[_delegator] = _amount; } /** * @notice Update amount currently locked up for this service provider * @param _serviceProvider - address of service provider * @param _updatedLockupAmount - updated lock up amount */ function _updateServiceProviderLockupAmount( address _serviceProvider, uint256 _updatedLockupAmount ) internal { spDelegateInfo[_serviceProvider].totalLockedUpStake = _updatedLockupAmount; } function _removeFromDelegatorsList(address _serviceProvider, address _delegator) internal { for (uint256 i = 0; i < spDelegateInfo[_serviceProvider].delegators.length; i++) { if (spDelegateInfo[_serviceProvider].delegators[i] == _delegator) { // Overwrite and shrink delegators list spDelegateInfo[_serviceProvider].delegators[i] = spDelegateInfo[_serviceProvider].delegators[spDelegateInfo[_serviceProvider].delegators.length - 1]; spDelegateInfo[_serviceProvider].delegators.length--; break; } } } /** * @notice Helper function to distribute rewards to any delegators * @param _sp - service provider account tracked in staking * @param _totalActiveFunds - total funds minus any locked stake * @param _totalRewards - total rewaards generated in this round * @param _deployerCut - service provider cut of delegate rewards, defined as deployerCut / deployerCutBase * @param _deployerCutBase - denominator value for calculating service provider cut as a % * @return (totalBalanceInStaking, totalBalanceInSPFactory, totalBalanceOutsideStaking) */ function _distributeDelegateRewards( address _sp, uint256 _totalActiveFunds, uint256 _totalRewards, uint256 _deployerCut, uint256 _deployerCutBase ) internal returns (uint256 totalDelegatedStakeIncrease) { // Traverse all delegates and calculate their rewards // As each delegate reward is calculated, increment SP cut reward accordingly for (uint256 i = 0; i < spDelegateInfo[_sp].delegators.length; i++) { address delegator = spDelegateInfo[_sp].delegators[i]; uint256 delegateStakeToSP = delegateInfo[delegator][_sp]; // Subtract any locked up stake if (undelegateRequests[delegator].serviceProvider == _sp) { delegateStakeToSP = delegateStakeToSP.sub(undelegateRequests[delegator].amount); } // Calculate rewards by ((delegateStakeToSP / totalActiveFunds) * totalRewards) uint256 rewardsPriorToSPCut = ( delegateStakeToSP.mul(_totalRewards) ).div(_totalActiveFunds); // Multiply by deployer cut fraction to calculate reward for SP // Operation constructed to perform all multiplication prior to division // uint256 spDeployerCut = (rewardsPriorToSPCut * deployerCut ) / (deployerCutBase); // = ((delegateStakeToSP * totalRewards) / totalActiveFunds) * deployerCut ) / (deployerCutBase); // = ((delegateStakeToSP * totalRewards * deployerCut) / totalActiveFunds ) / (deployerCutBase); // = (delegateStakeToSP * totalRewards * deployerCut) / (deployerCutBase * totalActiveFunds); uint256 spDeployerCut = ( (delegateStakeToSP.mul(_totalRewards)).mul(_deployerCut) ).div( _totalActiveFunds.mul(_deployerCutBase) ); // Increase total delegate reward in DelegateManager // Subtract SP reward from rewards to calculate delegate reward // delegateReward = rewardsPriorToSPCut - spDeployerCut; delegateInfo[delegator][_sp] = ( delegateInfo[delegator][_sp].add(rewardsPriorToSPCut.sub(spDeployerCut)) ); // Update total for this delegator _updateDelegatorTotalStake( delegator, delegatorTotalStake[delegator].add(rewardsPriorToSPCut.sub(spDeployerCut)) ); totalDelegatedStakeIncrease = ( totalDelegatedStakeIncrease.add(rewardsPriorToSPCut.sub(spDeployerCut)) ); } return (totalDelegatedStakeIncrease); } /** * @notice Set the governance address after confirming contract identity * @param _governanceAddress - Incoming governance address */ function _updateGovernanceAddress(address _governanceAddress) internal { require( Governance(_governanceAddress).isGovernanceAddress() == true, "DelegateManager: _governanceAddress is not a valid governance contract" ); governanceAddress = _governanceAddress; } /** * @notice Set the remove delegator lockup duration after validating against governance * @param _duration - Incoming remove delegator duration value */ function _updateRemoveDelegatorLockupDuration(uint256 _duration) internal { Governance governance = Governance(governanceAddress); require( _duration > governance.getVotingPeriod() + governance.getExecutionDelay(), "DelegateManager: removeDelegatorLockupDuration duration must be greater than governance votingPeriod + executionDelay" ); removeDelegatorLockupDuration = _duration; } /** * @notice Set the undelegate lockup duration after validating against governance * @param _duration - Incoming undelegate lockup duration value */ function _updateUndelegateLockupDuration(uint256 _duration) internal { Governance governance = Governance(governanceAddress); require( _duration > governance.getVotingPeriod() + governance.getExecutionDelay(), "DelegateManager: undelegateLockupDuration duration must be greater than governance votingPeriod + executionDelay" ); undelegateLockupDuration = _duration; } /** * @notice Returns if delegator has delegated to a service provider * @param _delegator - address of delegator * @param _serviceProvider - address of service provider * @return boolean indicating whether delegator exists for service provider */ function _delegatorExistsForSP( address _delegator, address _serviceProvider ) internal view returns (bool) { for (uint256 i = 0; i < spDelegateInfo[_serviceProvider].delegators.length; i++) { if (spDelegateInfo[_serviceProvider].delegators[i] == _delegator) { return true; } } // Not found return false; } /** * @notice Determine if a claim is pending for this service provider * @param _sp - address of service provider * @return boolean indicating whether a claim is pending */ function _claimPending(address _sp) internal view returns (bool) { ClaimsManager claimsManager = ClaimsManager(claimsManagerAddress); return claimsManager.claimPending(_sp); } /** * @notice Determine if a decrease request has been initiated * @param _delegator - address of delegator * @return boolean indicating whether a decrease request is pending */ function _undelegateRequestIsPending(address _delegator) internal view returns (bool) { return ( (undelegateRequests[_delegator].lockupExpiryBlock != 0) && (undelegateRequests[_delegator].amount != 0) && (undelegateRequests[_delegator].serviceProvider != address(0)) ); } // ========================================= Private Functions ========================================= function _requireStakingAddressIsSet() private view { require( stakingAddress != address(0x00), "DelegateManager: stakingAddress is not set" ); } function _requireServiceProviderFactoryAddressIsSet() private view { require( serviceProviderFactoryAddress != address(0x00), "DelegateManager: serviceProviderFactoryAddress is not set" ); } function _requireClaimsManagerAddressIsSet() private view { require( claimsManagerAddress != address(0x00), "DelegateManager: claimsManagerAddress is not set" ); } }
@notice Get the Governance address
function getGovernanceAddress() external view returns (address) { _requireIsInitialized(); return governanceAddress; }
1,231,744
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 20392, 968, 326, 611, 1643, 82, 1359, 1758, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 7162, 1643, 82, 1359, 1887, 1435, 3903, 1476, 1135, 261, 2867, 13, 288, 203, 3639, 389, 6528, 2520, 11459, 5621, 203, 203, 3639, 327, 314, 1643, 82, 1359, 1887, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/1/0xABE46f13C833Ab07bf9e523F485B53c9a633DD60/sources/contracts/IdleCDO.sol
@notice pausable @dev msg.sender should approve this contract first to spend `_amount` of `token` @param _amount amount of `token` to deposit @param _referral address of the referral @return AA tranche tokens minted
function depositAARef(uint256 _amount, address _referral) external returns (uint256) { return _deposit(_amount, AATranche, _referral); }
8,321,815
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 20392, 6790, 16665, 632, 5206, 1234,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445, 443, 1724, 5284, 1957, 12, 11890, 5034, 389, 8949, 16, 1758, 389, 1734, 29084, 13, 3903, 1135, 261, 11890, 5034, 13, 288, 203, 565, 327, 389, 323, 1724, 24899, 8949, 16, 432, 789, 2645, 73, 16, 389, 1734, 29084, 1769, 203, 225, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/1/0xe2aAf8476c5e0F9040556C42c3C1B0242A4F2F39/sources/contracts/QuadReader.sol
@dev Calculate the amount of $ETH required to call `getAttributes` @param _attribute keccak256 of the attribute type (ex: keccak256("COUNTRY")) @param _account account getting requested for attributes @return the amount of $ETH necessary to query the attribute
function queryFee( address _account, bytes32 _attribute ) public override view returns(uint256) { require(governance.eligibleAttributes(_attribute) || governance.eligibleAttributesByDID(_attribute), "ATTRIBUTE_NOT_ELIGIBLE" ); IQuadPassportStore.Attribute[] memory attrs = passport.attributes(_account, ATTRIBUTE_IS_BUSINESS); uint256 fee = (attrs.length > 0 && attrs[0].value == keccak256("TRUE")) ? governance.pricePerBusinessAttributeFixed(_attribute) : governance.pricePerAttributeFixed(_attribute); return fee; }
4,999,676
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 5206, 9029, 326, 3844, 434, 271, 1584, 44, 1931, 358, 745, 1375, 588, 2498, 68, 632, 891, 389, 4589, 417, 24410, 581, 5034, 434, 326, 1566, 618, 261, 338, 30, 417, 24410, 581, 5034, 2932, 7240, 9590, 6, 3719, 632, 891, 389, 4631, 2236, 8742, 3764, 364, 1677, 632, 2463, 326, 3844, 434, 271, 1584, 44, 4573, 358, 843, 326, 1566, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 843, 14667, 12, 203, 3639, 1758, 389, 4631, 16, 203, 3639, 1731, 1578, 389, 4589, 203, 565, 262, 1071, 3849, 1476, 1135, 12, 11890, 5034, 13, 288, 203, 3639, 2583, 12, 75, 1643, 82, 1359, 18, 292, 16057, 2498, 24899, 4589, 13, 203, 5411, 747, 314, 1643, 82, 1359, 18, 292, 16057, 2498, 858, 40, 734, 24899, 4589, 3631, 203, 5411, 315, 11616, 67, 4400, 67, 41, 2053, 43, 13450, 900, 6, 203, 3639, 11272, 203, 203, 3639, 467, 24483, 6433, 655, 2257, 18, 1499, 8526, 3778, 3422, 273, 1342, 655, 18, 4350, 24899, 4631, 16, 15941, 67, 5127, 67, 3000, 55, 3740, 1260, 1769, 203, 203, 3639, 2254, 5034, 14036, 273, 261, 7039, 18, 2469, 405, 374, 597, 3422, 63, 20, 8009, 1132, 422, 417, 24410, 581, 5034, 2932, 18724, 6, 3719, 203, 5411, 692, 314, 1643, 82, 1359, 18, 8694, 2173, 13423, 1499, 7505, 24899, 4589, 13, 203, 5411, 294, 314, 1643, 82, 1359, 18, 8694, 2173, 1499, 7505, 24899, 4589, 1769, 203, 203, 3639, 327, 14036, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/4/0x0447bA605863DCa996D93e70bB79da8b18477e20/sources/browser/DefiPortal.sol
Contract for handle tokens types Enum NOTE: You can add a new type at the end, but DO NOT CHANGE this order
contract DefiPortal { using SafeMath for uint256; address constant private ETH_TOKEN_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); ITokensTypeStorage public tokensTypes; enum DefiActions { YearnDeposit, YearnWithdraw } constructor(address _tokensTypes) public { tokensTypes = ITokensTypeStorage(_tokensTypes); } function callPayableProtocol( address[] memory tokensToSend, uint256[] memory amountsToSend, bytes memory _additionalData, bytes32[] memory _additionalArgs ) external payable returns( string memory eventType, bytes memory eventData, address[] memory tokensReceived ) { revert("Unknown DEFI action"); } function callNonPayableProtocol( address[] memory tokensToSend, uint256[] memory amountsToSend, bytes memory _additionalData, bytes32[] memory _additionalArgs ) external returns( string memory eventType, address[] memory tokensToReceive, uint256[] memory amountsToReceive ) { if(uint(_additionalArgs[0]) == uint(DefiActions.YearnDeposit)){ (tokensToReceive, amountsToReceive) = _YearnDeposit( tokensToSend[0], amountsToSend[0], _additionalData ); eventType = "YEARN_DEPOSIT"; } else if(uint(_additionalArgs[1]) == uint(DefiActions.YearnWithdraw)){ (tokensToReceive, amountsToReceive) = _YearnWithdraw( tokensToSend[0], amountsToSend[0], _additionalData ); eventType = "YEARN_WITHDRAW"; } else{ revert("Unknown DEFI action"); } } function callNonPayableProtocol( address[] memory tokensToSend, uint256[] memory amountsToSend, bytes memory _additionalData, bytes32[] memory _additionalArgs ) external returns( string memory eventType, address[] memory tokensToReceive, uint256[] memory amountsToReceive ) { if(uint(_additionalArgs[0]) == uint(DefiActions.YearnDeposit)){ (tokensToReceive, amountsToReceive) = _YearnDeposit( tokensToSend[0], amountsToSend[0], _additionalData ); eventType = "YEARN_DEPOSIT"; } else if(uint(_additionalArgs[1]) == uint(DefiActions.YearnWithdraw)){ (tokensToReceive, amountsToReceive) = _YearnWithdraw( tokensToSend[0], amountsToSend[0], _additionalData ); eventType = "YEARN_WITHDRAW"; } else{ revert("Unknown DEFI action"); } } function callNonPayableProtocol( address[] memory tokensToSend, uint256[] memory amountsToSend, bytes memory _additionalData, bytes32[] memory _additionalArgs ) external returns( string memory eventType, address[] memory tokensToReceive, uint256[] memory amountsToReceive ) { if(uint(_additionalArgs[0]) == uint(DefiActions.YearnDeposit)){ (tokensToReceive, amountsToReceive) = _YearnDeposit( tokensToSend[0], amountsToSend[0], _additionalData ); eventType = "YEARN_DEPOSIT"; } else if(uint(_additionalArgs[1]) == uint(DefiActions.YearnWithdraw)){ (tokensToReceive, amountsToReceive) = _YearnWithdraw( tokensToSend[0], amountsToSend[0], _additionalData ); eventType = "YEARN_WITHDRAW"; } else{ revert("Unknown DEFI action"); } } function callNonPayableProtocol( address[] memory tokensToSend, uint256[] memory amountsToSend, bytes memory _additionalData, bytes32[] memory _additionalArgs ) external returns( string memory eventType, address[] memory tokensToReceive, uint256[] memory amountsToReceive ) { if(uint(_additionalArgs[0]) == uint(DefiActions.YearnDeposit)){ (tokensToReceive, amountsToReceive) = _YearnDeposit( tokensToSend[0], amountsToSend[0], _additionalData ); eventType = "YEARN_DEPOSIT"; } else if(uint(_additionalArgs[1]) == uint(DefiActions.YearnWithdraw)){ (tokensToReceive, amountsToReceive) = _YearnWithdraw( tokensToSend[0], amountsToSend[0], _additionalData ); eventType = "YEARN_WITHDRAW"; } else{ revert("Unknown DEFI action"); } } function getValue( address _from, address _to, uint256 _amount ) public view returns(uint256) { return 0; } function _YearnDeposit( address tokenAddress, uint256 tokenAmount, bytes memory _additionalData ) private returns( address[] memory tokensToReceive, uint256[] memory amountsToReceive ) { (address yTokenAddress, uint256 minReturn) = abi.decode(_additionalData, (address, uint256)); IYearnToken yToken = IYearnToken(yTokenAddress); _transferFromSenderAndApproveTo(IERC20(tokenAddress), tokenAmount, yTokenAddress); yToken.deposit(tokenAmount); uint256 receivedYToken = IERC20(yTokenAddress).balanceOf(address(this)); require(receivedYToken >= minReturn, "MIN_RETURN_FAIL"); IERC20(yTokenAddress).transfer(msg.sender, receivedYToken); _sendRemains(IERC20(tokenAddress), msg.sender); tokensToReceive = new address[](1); tokensToReceive[0] = tokenAddress; amountsToReceive = new uint256[](1); amountsToReceive[0] = receivedYToken; } function _YearnWithdraw( address yTokenAddress, uint256 tokenAmount, bytes memory _additionalData ) private returns( address[] memory tokensToReceive, uint256[] memory amountsToReceive ) { (uint256 minReturn) = abi.decode(_additionalData, (uint256)); IYearnToken yToken = IYearnToken(yTokenAddress); _transferFromSenderAndApproveTo(IERC20(yTokenAddress), tokenAmount, yTokenAddress); yToken.withdraw(tokenAmount); address underlyingToken = yToken.token(); uint256 received = IERC20(underlyingToken).balanceOf(address(this)); tokensToReceive = new address[](1); tokensToReceive[0] = underlyingToken; amountsToReceive = new uint256[](1); amountsToReceive[0] = received; } function _sendRemains(IERC20 _source, address _receiver) private { uint256 endAmount = (_source == IERC20(ETH_TOKEN_ADDRESS)) ? address(this).balance : _source.balanceOf(address(this)); if (endAmount > 0) { if (_source == IERC20(ETH_TOKEN_ADDRESS)) { payable(_receiver).transfer(endAmount); _source.transfer(_receiver, endAmount); } } } function _sendRemains(IERC20 _source, address _receiver) private { uint256 endAmount = (_source == IERC20(ETH_TOKEN_ADDRESS)) ? address(this).balance : _source.balanceOf(address(this)); if (endAmount > 0) { if (_source == IERC20(ETH_TOKEN_ADDRESS)) { payable(_receiver).transfer(endAmount); _source.transfer(_receiver, endAmount); } } } function _sendRemains(IERC20 _source, address _receiver) private { uint256 endAmount = (_source == IERC20(ETH_TOKEN_ADDRESS)) ? address(this).balance : _source.balanceOf(address(this)); if (endAmount > 0) { if (_source == IERC20(ETH_TOKEN_ADDRESS)) { payable(_receiver).transfer(endAmount); _source.transfer(_receiver, endAmount); } } } } else { function _transferFromSenderAndApproveTo(IERC20 _source, uint256 _sourceAmount, address _to) private { require(_source.transferFrom(msg.sender, address(this), _sourceAmount)); _source.approve(_to, 0); _source.approve(_to, _sourceAmount); } }
12,495,986
[ 1, 4625, 348, 7953, 560, 30, 225, 13456, 364, 1640, 2430, 1953, 6057, 5219, 30, 4554, 848, 527, 279, 394, 618, 622, 326, 679, 16, 1496, 5467, 4269, 26267, 333, 1353, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 16351, 10922, 77, 24395, 288, 203, 225, 1450, 14060, 10477, 364, 2254, 5034, 31, 203, 203, 225, 1758, 5381, 3238, 512, 2455, 67, 8412, 67, 15140, 273, 1758, 12, 20, 17432, 1340, 1340, 41, 1340, 73, 41, 73, 41, 1340, 41, 73, 41, 73, 41, 1340, 9383, 41, 1340, 1340, 41, 1340, 1340, 1340, 73, 9383, 73, 41, 1769, 203, 203, 225, 467, 5157, 559, 3245, 1071, 2430, 2016, 31, 203, 203, 203, 225, 2792, 10922, 77, 6100, 288, 1624, 73, 1303, 758, 1724, 16, 1624, 73, 1303, 1190, 9446, 289, 203, 225, 3885, 12, 2867, 389, 7860, 2016, 13, 1071, 288, 203, 565, 2430, 2016, 273, 467, 5157, 559, 3245, 24899, 7860, 2016, 1769, 203, 225, 289, 203, 203, 225, 445, 745, 9148, 429, 5752, 12, 203, 565, 1758, 8526, 3778, 2430, 28878, 16, 203, 565, 2254, 5034, 8526, 3778, 3844, 11634, 3826, 16, 203, 565, 1731, 3778, 389, 13996, 751, 16, 203, 565, 1731, 1578, 8526, 3778, 389, 13996, 2615, 203, 225, 262, 203, 565, 3903, 203, 565, 8843, 429, 203, 565, 1135, 12, 203, 1377, 533, 3778, 11216, 16, 203, 1377, 1731, 3778, 17494, 16, 203, 1377, 1758, 8526, 3778, 2430, 8872, 203, 565, 262, 203, 225, 288, 203, 565, 15226, 2932, 4874, 2030, 1653, 1301, 8863, 203, 225, 289, 203, 203, 225, 445, 745, 3989, 9148, 429, 5752, 12, 203, 565, 1758, 8526, 3778, 2430, 28878, 16, 203, 565, 2254, 5034, 8526, 3778, 3844, 11634, 3826, 16, 203, 565, 1731, 3778, 389, 13996, 751, 16, 203, 565, 1731, 1578, 8526, 3778, 389, 13996, 2615, 203, 225, 262, 203, 565, 3903, 203, 565, 1135, 12, 203, 1377, 533, 3778, 11216, 16, 203, 1377, 1758, 8526, 3778, 2430, 774, 11323, 16, 203, 1377, 2254, 5034, 8526, 3778, 3844, 11634, 11323, 203, 565, 262, 203, 225, 288, 203, 565, 309, 12, 11890, 24899, 13996, 2615, 63, 20, 5717, 422, 2254, 12, 3262, 77, 6100, 18, 61, 73, 1303, 758, 1724, 3719, 95, 203, 1377, 261, 7860, 774, 11323, 16, 3844, 11634, 11323, 13, 273, 389, 61, 73, 1303, 758, 1724, 12, 203, 3639, 2430, 28878, 63, 20, 6487, 203, 3639, 3844, 11634, 3826, 63, 20, 6487, 203, 3639, 389, 13996, 751, 203, 1377, 11272, 203, 1377, 11216, 273, 315, 61, 41, 4391, 67, 1639, 28284, 14432, 203, 565, 289, 203, 565, 469, 309, 12, 11890, 24899, 13996, 2615, 63, 21, 5717, 422, 2254, 12, 3262, 77, 6100, 18, 61, 73, 1303, 1190, 9446, 3719, 95, 203, 4202, 261, 7860, 774, 11323, 16, 3844, 11634, 11323, 13, 273, 389, 61, 73, 1303, 1190, 9446, 12, 203, 540, 2430, 28878, 63, 20, 6487, 203, 540, 3844, 11634, 3826, 63, 20, 6487, 203, 540, 389, 13996, 751, 203, 3639, 11272, 203, 4202, 11216, 273, 315, 61, 41, 4391, 67, 9147, 40, 10821, 14432, 203, 565, 289, 203, 565, 469, 95, 203, 1377, 15226, 2932, 4874, 2030, 1653, 1301, 8863, 203, 565, 289, 203, 225, 289, 203, 203, 225, 445, 745, 3989, 9148, 429, 5752, 12, 203, 565, 1758, 8526, 3778, 2430, 28878, 16, 203, 565, 2254, 5034, 8526, 3778, 3844, 11634, 3826, 16, 203, 565, 1731, 3778, 389, 13996, 751, 16, 203, 565, 1731, 1578, 8526, 3778, 389, 13996, 2615, 203, 225, 262, 203, 565, 3903, 203, 565, 1135, 12, 203, 1377, 533, 3778, 11216, 16, 203, 1377, 1758, 8526, 3778, 2430, 774, 11323, 16, 203, 1377, 2254, 5034, 8526, 3778, 3844, 11634, 11323, 203, 565, 262, 203, 225, 288, 203, 565, 309, 12, 11890, 24899, 13996, 2615, 63, 20, 5717, 422, 2254, 12, 3262, 77, 6100, 18, 61, 73, 1303, 758, 1724, 3719, 95, 203, 1377, 261, 7860, 774, 11323, 16, 3844, 11634, 11323, 13, 273, 389, 61, 73, 1303, 758, 1724, 12, 203, 3639, 2430, 28878, 63, 20, 6487, 203, 3639, 3844, 11634, 3826, 63, 20, 6487, 203, 3639, 389, 13996, 751, 203, 1377, 11272, 203, 1377, 11216, 273, 315, 61, 41, 4391, 67, 1639, 28284, 14432, 203, 565, 289, 203, 565, 469, 309, 12, 11890, 24899, 13996, 2615, 63, 21, 5717, 422, 2254, 12, 3262, 77, 6100, 18, 61, 73, 1303, 1190, 9446, 3719, 95, 203, 4202, 261, 7860, 774, 11323, 16, 3844, 11634, 11323, 13, 273, 389, 61, 73, 1303, 1190, 9446, 12, 203, 540, 2430, 28878, 63, 20, 6487, 203, 540, 3844, 11634, 3826, 63, 20, 6487, 203, 540, 389, 13996, 751, 203, 3639, 11272, 203, 4202, 11216, 273, 315, 61, 41, 4391, 67, 9147, 40, 10821, 14432, 203, 565, 289, 203, 565, 469, 95, 203, 1377, 15226, 2932, 4874, 2030, 1653, 1301, 8863, 203, 565, 289, 203, 225, 289, 203, 203, 225, 445, 745, 3989, 9148, 429, 5752, 12, 203, 565, 1758, 8526, 3778, 2430, 28878, 16, 203, 565, 2254, 5034, 8526, 3778, 3844, 11634, 3826, 16, 203, 565, 1731, 3778, 389, 13996, 751, 16, 203, 565, 1731, 1578, 8526, 3778, 389, 13996, 2615, 203, 225, 262, 203, 565, 3903, 203, 565, 1135, 12, 203, 1377, 533, 3778, 11216, 16, 203, 1377, 1758, 8526, 3778, 2430, 774, 11323, 16, 203, 1377, 2254, 5034, 8526, 3778, 3844, 11634, 11323, 203, 565, 262, 203, 225, 288, 203, 565, 309, 12, 11890, 24899, 13996, 2615, 63, 20, 5717, 422, 2254, 12, 3262, 77, 6100, 18, 61, 73, 1303, 758, 1724, 3719, 95, 203, 1377, 261, 7860, 774, 11323, 16, 3844, 11634, 11323, 13, 273, 389, 61, 73, 1303, 758, 1724, 12, 203, 3639, 2430, 28878, 63, 20, 6487, 203, 3639, 3844, 11634, 3826, 63, 20, 6487, 203, 3639, 389, 13996, 751, 203, 1377, 11272, 203, 1377, 11216, 273, 315, 61, 41, 4391, 67, 1639, 28284, 14432, 203, 565, 289, 203, 565, 469, 309, 12, 11890, 24899, 13996, 2615, 63, 21, 5717, 422, 2254, 12, 3262, 77, 6100, 18, 61, 73, 1303, 1190, 9446, 3719, 95, 203, 4202, 261, 7860, 774, 11323, 16, 3844, 11634, 11323, 13, 273, 389, 61, 73, 1303, 1190, 9446, 12, 203, 540, 2430, 28878, 63, 20, 6487, 203, 540, 3844, 11634, 3826, 63, 20, 6487, 203, 540, 389, 13996, 751, 203, 3639, 11272, 203, 4202, 11216, 273, 315, 61, 41, 4391, 67, 9147, 40, 10821, 14432, 203, 565, 289, 203, 565, 469, 95, 203, 1377, 15226, 2932, 4874, 2030, 1653, 1301, 8863, 203, 565, 289, 203, 225, 2 ]
// the azimuth logic contract // https://azimuth.network pragma solidity 0.4.24; //////////////////////////////////////////////////////////////////////////////// // Imports //////////////////////////////////////////////////////////////////////////////// // OpenZeppelin's Ownable.sol /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } // Azimuth's SafeMath8.sol /** * @title SafeMath8 * @dev Math operations for uint8 with safety checks that throw on error */ library SafeMath8 { function mul(uint8 a, uint8 b) internal pure returns (uint8) { uint8 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint8 a, uint8 b) internal pure returns (uint8) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint8 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint8 a, uint8 b) internal pure returns (uint8) { assert(b <= a); return a - b; } function add(uint8 a, uint8 b) internal pure returns (uint8) { uint8 c = a + b; assert(c >= a); return c; } } // Azimuth's SafeMath16.sol /** * @title SafeMath16 * @dev Math operations for uint16 with safety checks that throw on error */ library SafeMath16 { function mul(uint16 a, uint16 b) internal pure returns (uint16) { uint16 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint16 a, uint16 b) internal pure returns (uint16) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint16 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint16 a, uint16 b) internal pure returns (uint16) { assert(b <= a); return a - b; } function add(uint16 a, uint16 b) internal pure returns (uint16) { uint16 c = a + b; assert(c >= a); return c; } } // OpenZeppelin's SafeMath.sol /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (_a == 0) { return 0; } c = _a * _b; assert(c / _a == _b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 _a, uint256 _b) internal pure returns (uint256) { // assert(_b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = _a / _b; // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold return _a / _b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 _a, uint256 _b) internal pure returns (uint256) { assert(_b <= _a); return _a - _b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) { c = _a + _b; assert(c >= _a); return c; } } // OpenZeppelin's ERC165.sol /** * @title ERC165 * @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md */ interface ERC165 { /** * @notice Query if a contract implements an interface * @param _interfaceId The interface identifier, as specified in ERC-165 * @dev Interface identification is specified in ERC-165. This function * uses less than 30,000 gas. */ function supportsInterface(bytes4 _interfaceId) external view returns (bool); } // OpenZeppelin's SupportsInterfaceWithLookup.sol /** * @title SupportsInterfaceWithLookup * @author Matt Condon (@shrugs) * @dev Implements ERC165 using a lookup table. */ contract SupportsInterfaceWithLookup is ERC165 { bytes4 public constant InterfaceId_ERC165 = 0x01ffc9a7; /** * 0x01ffc9a7 === * bytes4(keccak256('supportsInterface(bytes4)')) */ /** * @dev a mapping of interface id to whether or not it's supported */ mapping(bytes4 => bool) internal supportedInterfaces; /** * @dev A contract implementing SupportsInterfaceWithLookup * implement ERC165 itself */ constructor() public { _registerInterface(InterfaceId_ERC165); } /** * @dev implement supportsInterface(bytes4) using a lookup table */ function supportsInterface(bytes4 _interfaceId) external view returns (bool) { return supportedInterfaces[_interfaceId]; } /** * @dev private method for registering an interface */ function _registerInterface(bytes4 _interfaceId) internal { require(_interfaceId != 0xffffffff); supportedInterfaces[_interfaceId] = true; } } // OpenZeppelin's ERC721Basic.sol /** * @title ERC721 Non-Fungible Token Standard basic interface * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md */ contract ERC721Basic is ERC165 { bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd; /* * 0x80ac58cd === * bytes4(keccak256('balanceOf(address)')) ^ * bytes4(keccak256('ownerOf(uint256)')) ^ * bytes4(keccak256('approve(address,uint256)')) ^ * bytes4(keccak256('getApproved(uint256)')) ^ * bytes4(keccak256('setApprovalForAll(address,bool)')) ^ * bytes4(keccak256('isApprovedForAll(address,address)')) ^ * bytes4(keccak256('transferFrom(address,address,uint256)')) ^ * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^ * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) */ bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79; /* * 0x4f558e79 === * bytes4(keccak256('exists(uint256)')) */ bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63; /** * 0x780e9d63 === * bytes4(keccak256('totalSupply()')) ^ * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^ * bytes4(keccak256('tokenByIndex(uint256)')) */ bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f; /** * 0x5b5e139f === * bytes4(keccak256('name()')) ^ * bytes4(keccak256('symbol()')) ^ * bytes4(keccak256('tokenURI(uint256)')) */ event Transfer( address indexed _from, address indexed _to, uint256 indexed _tokenId ); event Approval( address indexed _owner, address indexed _approved, uint256 indexed _tokenId ); event ApprovalForAll( address indexed _owner, address indexed _operator, bool _approved ); function balanceOf(address _owner) public view returns (uint256 _balance); function ownerOf(uint256 _tokenId) public view returns (address _owner); function exists(uint256 _tokenId) public view returns (bool _exists); function approve(address _to, uint256 _tokenId) public; function getApproved(uint256 _tokenId) public view returns (address _operator); function setApprovalForAll(address _operator, bool _approved) public; function isApprovedForAll(address _owner, address _operator) public view returns (bool); function transferFrom(address _from, address _to, uint256 _tokenId) public; function safeTransferFrom(address _from, address _to, uint256 _tokenId) public; function safeTransferFrom( address _from, address _to, uint256 _tokenId, bytes _data ) public; } // OpenZeppelin's ERC721.sol /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md */ contract ERC721Enumerable is ERC721Basic { function totalSupply() public view returns (uint256); function tokenOfOwnerByIndex( address _owner, uint256 _index ) public view returns (uint256 _tokenId); function tokenByIndex(uint256 _index) public view returns (uint256); } /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md */ contract ERC721Metadata is ERC721Basic { function name() external view returns (string _name); function symbol() external view returns (string _symbol); function tokenURI(uint256 _tokenId) public view returns (string); } /** * @title ERC-721 Non-Fungible Token Standard, full implementation interface * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md */ contract ERC721 is ERC721Basic, ERC721Enumerable, ERC721Metadata { } // OpenZeppelin's ERC721Receiver.sol /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ contract ERC721Receiver { /** * @dev Magic value to be returned upon successful reception of an NFT * Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`, * which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` */ bytes4 internal constant ERC721_RECEIVED = 0x150b7a02; /** * @notice Handle the receipt of an NFT * @dev The ERC721 smart contract calls this function on the recipient * after a `safetransfer`. This function MAY throw to revert and reject the * transfer. Return of other than the magic value MUST result in the * transaction being reverted. * Note: the contract address is always the message sender. * @param _operator The address which called `safeTransferFrom` function * @param _from The address which previously owned the token * @param _tokenId The NFT identifier which is being transferred * @param _data Additional data with no specified format * @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` */ function onERC721Received( address _operator, address _from, uint256 _tokenId, bytes _data ) public returns(bytes4); } // OpenZeppelin's AddressUtils.sol /** * Utility library of inline functions on addresses */ library AddressUtils { /** * Returns whether the target address is a contract * @dev This function will return false if invoked during the constructor of a contract, * as the code is not actually created until after the constructor finishes. * @param _addr address to check * @return whether the target address is a contract */ function isContract(address _addr) internal view returns (bool) { uint256 size; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. // See https://ethereum.stackexchange.com/a/14016/36603 // for more details about how this works. // TODO Check this again before the Serenity release, because all addresses will be // contracts then. // solium-disable-next-line security/no-inline-assembly assembly { size := extcodesize(_addr) } return size > 0; } } // Azimuth's Azimuth.sol // Azimuth: point state data contract // // This contract is used for storing all data related to Azimuth points // and their ownership. Consider this contract the Azimuth ledger. // // It also contains permissions data, which ties in to ERC721 // functionality. Operators of an address are allowed to transfer // ownership of all points owned by their associated address // (ERC721's approveAll()). A transfer proxy is allowed to transfer // ownership of a single point (ERC721's approve()). // Separate from ERC721 are managers, assigned per point. They are // allowed to perform "low-impact" operations on the owner's points, // like configuring public keys and making escape requests. // // Since data stores are difficult to upgrade, this contract contains // as little actual business logic as possible. Instead, the data stored // herein can only be modified by this contract's owner, which can be // changed and is thus upgradable/replaceable. // // This contract will be owned by the Ecliptic contract. // contract Azimuth is Ownable { // // Events // // OwnerChanged: :point is now owned by :owner // event OwnerChanged(uint32 indexed point, address indexed owner); // Activated: :point is now active // event Activated(uint32 indexed point); // Spawned: :prefix has spawned :child // event Spawned(uint32 indexed prefix, uint32 indexed child); // EscapeRequested: :point has requested a new :sponsor // event EscapeRequested(uint32 indexed point, uint32 indexed sponsor); // EscapeCanceled: :point's :sponsor request was canceled or rejected // event EscapeCanceled(uint32 indexed point, uint32 indexed sponsor); // EscapeAccepted: :point confirmed with a new :sponsor // event EscapeAccepted(uint32 indexed point, uint32 indexed sponsor); // LostSponsor: :point's :sponsor is now refusing it service // event LostSponsor(uint32 indexed point, uint32 indexed sponsor); // ChangedKeys: :point has new network public keys // event ChangedKeys( uint32 indexed point, bytes32 encryptionKey, bytes32 authenticationKey, uint32 cryptoSuiteVersion, uint32 keyRevisionNumber ); // BrokeContinuity: :point has a new continuity number, :number // event BrokeContinuity(uint32 indexed point, uint32 number); // ChangedSpawnProxy: :spawnProxy can now spawn using :point // event ChangedSpawnProxy(uint32 indexed point, address indexed spawnProxy); // ChangedTransferProxy: :transferProxy can now transfer ownership of :point // event ChangedTransferProxy( uint32 indexed point, address indexed transferProxy ); // ChangedManagementProxy: :managementProxy can now manage :point // event ChangedManagementProxy( uint32 indexed point, address indexed managementProxy ); // ChangedVotingProxy: :votingProxy can now vote using :point // event ChangedVotingProxy(uint32 indexed point, address indexed votingProxy); // ChangedDns: dnsDomains have been updated // event ChangedDns(string primary, string secondary, string tertiary); // // Structures // // Size: kinds of points registered on-chain // // NOTE: the order matters, because of Solidity enum numbering // enum Size { Galaxy, // = 0 Star, // = 1 Planet // = 2 } // Point: state of a point // // While the ordering of the struct members is semantically chaotic, // they are ordered to tightly pack them into Ethereum's 32-byte storage // slots, which reduces gas costs for some function calls. // The comment ticks indicate assumed slot boundaries. // struct Point { // encryptionKey: (curve25519) encryption public key, or 0 for none // bytes32 encryptionKey; // // authenticationKey: (ed25519) authentication public key, or 0 for none // bytes32 authenticationKey; // // spawned: for stars and galaxies, all :active children // uint32[] spawned; // // hasSponsor: true if the sponsor still supports the point // bool hasSponsor; // active: whether point can be linked // // false: point belongs to prefix, cannot be configured or linked // true: point no longer belongs to prefix, can be configured and linked // bool active; // escapeRequested: true if the point has requested to change sponsors // bool escapeRequested; // sponsor: the point that supports this one on the network, or, // if :hasSponsor is false, the last point that supported it. // (by default, the point's half-width prefix) // uint32 sponsor; // escapeRequestedTo: if :escapeRequested is true, new sponsor requested // uint32 escapeRequestedTo; // cryptoSuiteVersion: version of the crypto suite used for the pubkeys // uint32 cryptoSuiteVersion; // keyRevisionNumber: incremented every time the public keys change // uint32 keyRevisionNumber; // continuityNumber: incremented to indicate network-side state loss // uint32 continuityNumber; } // Deed: permissions for a point // struct Deed { // owner: address that owns this point // address owner; // managementProxy: 0, or another address with the right to perform // low-impact, managerial operations on this point // address managementProxy; // spawnProxy: 0, or another address with the right to spawn children // of this point // address spawnProxy; // votingProxy: 0, or another address with the right to vote as this point // address votingProxy; // transferProxy: 0, or another address with the right to transfer // ownership of this point // address transferProxy; } // // General state // // points: per point, general network-relevant point state // mapping(uint32 => Point) public points; // rights: per point, on-chain ownership and permissions // mapping(uint32 => Deed) public rights; // operators: per owner, per address, has the right to transfer ownership // of all the owner's points (ERC721) // mapping(address => mapping(address => bool)) public operators; // dnsDomains: base domains for contacting galaxies // // dnsDomains[0] is primary, the others are used as fallbacks // string[3] public dnsDomains; // // Lookups // // sponsoring: per point, the points they are sponsoring // mapping(uint32 => uint32[]) public sponsoring; // sponsoringIndexes: per point, per point, (index + 1) in // the sponsoring array // mapping(uint32 => mapping(uint32 => uint256)) public sponsoringIndexes; // escapeRequests: per point, the points they have open escape requests from // mapping(uint32 => uint32[]) public escapeRequests; // escapeRequestsIndexes: per point, per point, (index + 1) in // the escapeRequests array // mapping(uint32 => mapping(uint32 => uint256)) public escapeRequestsIndexes; // pointsOwnedBy: per address, the points they own // mapping(address => uint32[]) public pointsOwnedBy; // pointOwnerIndexes: per owner, per point, (index + 1) in // the pointsOwnedBy array // // We delete owners by moving the last entry in the array to the // newly emptied slot, which is (n - 1) where n is the value of // pointOwnerIndexes[owner][point]. // mapping(address => mapping(uint32 => uint256)) public pointOwnerIndexes; // managerFor: per address, the points they are the management proxy for // mapping(address => uint32[]) public managerFor; // managerForIndexes: per address, per point, (index + 1) in // the managerFor array // mapping(address => mapping(uint32 => uint256)) public managerForIndexes; // spawningFor: per address, the points they can spawn with // mapping(address => uint32[]) public spawningFor; // spawningForIndexes: per address, per point, (index + 1) in // the spawningFor array // mapping(address => mapping(uint32 => uint256)) public spawningForIndexes; // votingFor: per address, the points they can vote with // mapping(address => uint32[]) public votingFor; // votingForIndexes: per address, per point, (index + 1) in // the votingFor array // mapping(address => mapping(uint32 => uint256)) public votingForIndexes; // transferringFor: per address, the points they can transfer // mapping(address => uint32[]) public transferringFor; // transferringForIndexes: per address, per point, (index + 1) in // the transferringFor array // mapping(address => mapping(uint32 => uint256)) public transferringForIndexes; // // Logic // // constructor(): configure default dns domains // constructor() public { setDnsDomains("example.com", "example.com", "example.com"); } // setDnsDomains(): set the base domains used for contacting galaxies // // Note: since a string is really just a byte[], and Solidity can't // work with two-dimensional arrays yet, we pass in the three // domains as individual strings. // function setDnsDomains(string _primary, string _secondary, string _tertiary) onlyOwner public { dnsDomains[0] = _primary; dnsDomains[1] = _secondary; dnsDomains[2] = _tertiary; emit ChangedDns(_primary, _secondary, _tertiary); } // // Point reading // // isActive(): return true if _point is active // function isActive(uint32 _point) view external returns (bool equals) { return points[_point].active; } // getKeys(): returns the public keys and their details, as currently // registered for _point // function getKeys(uint32 _point) view external returns (bytes32 crypt, bytes32 auth, uint32 suite, uint32 revision) { Point storage point = points[_point]; return (point.encryptionKey, point.authenticationKey, point.cryptoSuiteVersion, point.keyRevisionNumber); } // getKeyRevisionNumber(): gets the revision number of _point's current // public keys // function getKeyRevisionNumber(uint32 _point) view external returns (uint32 revision) { return points[_point].keyRevisionNumber; } // hasBeenLinked(): returns true if the point has ever been assigned keys // function hasBeenLinked(uint32 _point) view external returns (bool result) { return ( points[_point].keyRevisionNumber > 0 ); } // isLive(): returns true if _point currently has keys properly configured // function isLive(uint32 _point) view external returns (bool result) { Point storage point = points[_point]; return ( point.encryptionKey != 0 && point.authenticationKey != 0 && point.cryptoSuiteVersion != 0 ); } // getContinuityNumber(): returns _point's current continuity number // function getContinuityNumber(uint32 _point) view external returns (uint32 continuityNumber) { return points[_point].continuityNumber; } // getSpawnCount(): return the number of children spawned by _point // function getSpawnCount(uint32 _point) view external returns (uint32 spawnCount) { uint256 len = points[_point].spawned.length; assert(len < 2**32); return uint32(len); } // getSpawned(): return array of points created under _point // // Note: only useful for clients, as Solidity does not currently // support returning dynamic arrays. // function getSpawned(uint32 _point) view external returns (uint32[] spawned) { return points[_point].spawned; } // hasSponsor(): returns true if _point's sponsor is providing it service // function hasSponsor(uint32 _point) view external returns (bool has) { return points[_point].hasSponsor; } // getSponsor(): returns _point's current (or most recent) sponsor // function getSponsor(uint32 _point) view external returns (uint32 sponsor) { return points[_point].sponsor; } // isSponsor(): returns true if _sponsor is currently providing service // to _point // function isSponsor(uint32 _point, uint32 _sponsor) view external returns (bool result) { Point storage point = points[_point]; return ( point.hasSponsor && (point.sponsor == _sponsor) ); } // getSponsoringCount(): returns the number of points _sponsor is // providing service to // function getSponsoringCount(uint32 _sponsor) view external returns (uint256 count) { return sponsoring[_sponsor].length; } // getSponsoring(): returns a list of points _sponsor is providing // service to // // Note: only useful for clients, as Solidity does not currently // support returning dynamic arrays. // function getSponsoring(uint32 _sponsor) view external returns (uint32[] sponsees) { return sponsoring[_sponsor]; } // escaping // isEscaping(): returns true if _point has an outstanding escape request // function isEscaping(uint32 _point) view external returns (bool escaping) { return points[_point].escapeRequested; } // getEscapeRequest(): returns _point's current escape request // // the returned escape request is only valid as long as isEscaping() // returns true // function getEscapeRequest(uint32 _point) view external returns (uint32 escape) { return points[_point].escapeRequestedTo; } // isRequestingEscapeTo(): returns true if _point has an outstanding // escape request targetting _sponsor // function isRequestingEscapeTo(uint32 _point, uint32 _sponsor) view public returns (bool equals) { Point storage point = points[_point]; return (point.escapeRequested && (point.escapeRequestedTo == _sponsor)); } // getEscapeRequestsCount(): returns the number of points _sponsor // is providing service to // function getEscapeRequestsCount(uint32 _sponsor) view external returns (uint256 count) { return escapeRequests[_sponsor].length; } // getEscapeRequests(): get the points _sponsor has received escape // requests from // // Note: only useful for clients, as Solidity does not currently // support returning dynamic arrays. // function getEscapeRequests(uint32 _sponsor) view external returns (uint32[] requests) { return escapeRequests[_sponsor]; } // // Point writing // // activatePoint(): activate a point, register it as spawned by its prefix // function activatePoint(uint32 _point) onlyOwner external { // make a point active, setting its sponsor to its prefix // Point storage point = points[_point]; require(!point.active); point.active = true; registerSponsor(_point, true, getPrefix(_point)); emit Activated(_point); } // setKeys(): set network public keys of _point to _encryptionKey and // _authenticationKey, with the specified _cryptoSuiteVersion // function setKeys(uint32 _point, bytes32 _encryptionKey, bytes32 _authenticationKey, uint32 _cryptoSuiteVersion) onlyOwner external { Point storage point = points[_point]; if ( point.encryptionKey == _encryptionKey && point.authenticationKey == _authenticationKey && point.cryptoSuiteVersion == _cryptoSuiteVersion ) { return; } point.encryptionKey = _encryptionKey; point.authenticationKey = _authenticationKey; point.cryptoSuiteVersion = _cryptoSuiteVersion; point.keyRevisionNumber++; emit ChangedKeys(_point, _encryptionKey, _authenticationKey, _cryptoSuiteVersion, point.keyRevisionNumber); } // incrementContinuityNumber(): break continuity for _point // function incrementContinuityNumber(uint32 _point) onlyOwner external { Point storage point = points[_point]; point.continuityNumber++; emit BrokeContinuity(_point, point.continuityNumber); } // registerSpawn(): add a point to its prefix's list of spawned points // function registerSpawned(uint32 _point) onlyOwner external { // if a point is its own prefix (a galaxy) then don't register it // uint32 prefix = getPrefix(_point); if (prefix == _point) { return; } // register a new spawned point for the prefix // points[prefix].spawned.push(_point); emit Spawned(prefix, _point); } // loseSponsor(): indicates that _point's sponsor is no longer providing // it service // function loseSponsor(uint32 _point) onlyOwner external { Point storage point = points[_point]; if (!point.hasSponsor) { return; } registerSponsor(_point, false, point.sponsor); emit LostSponsor(_point, point.sponsor); } // setEscapeRequest(): for _point, start an escape request to _sponsor // function setEscapeRequest(uint32 _point, uint32 _sponsor) onlyOwner external { if (isRequestingEscapeTo(_point, _sponsor)) { return; } registerEscapeRequest(_point, true, _sponsor); emit EscapeRequested(_point, _sponsor); } // cancelEscape(): for _point, stop the current escape request, if any // function cancelEscape(uint32 _point) onlyOwner external { Point storage point = points[_point]; if (!point.escapeRequested) { return; } uint32 request = point.escapeRequestedTo; registerEscapeRequest(_point, false, 0); emit EscapeCanceled(_point, request); } // doEscape(): perform the requested escape // function doEscape(uint32 _point) onlyOwner external { Point storage point = points[_point]; require(point.escapeRequested); registerSponsor(_point, true, point.escapeRequestedTo); registerEscapeRequest(_point, false, 0); emit EscapeAccepted(_point, point.sponsor); } // // Point utils // // getPrefix(): compute prefix ("parent") of _point // function getPrefix(uint32 _point) pure public returns (uint16 prefix) { if (_point < 0x10000) { return uint16(_point % 0x100); } return uint16(_point % 0x10000); } // getPointSize(): return the size of _point // function getPointSize(uint32 _point) external pure returns (Size _size) { if (_point < 0x100) return Size.Galaxy; if (_point < 0x10000) return Size.Star; return Size.Planet; } // internal use // registerSponsor(): set the sponsorship state of _point and update the // reverse lookup for sponsors // function registerSponsor(uint32 _point, bool _hasSponsor, uint32 _sponsor) internal { Point storage point = points[_point]; bool had = point.hasSponsor; uint32 prev = point.sponsor; // if we didn't have a sponsor, and won't get one, // or if we get the sponsor we already have, // nothing will change, so jump out early. // if ( (!had && !_hasSponsor) || (had && _hasSponsor && prev == _sponsor) ) { return; } // if the point used to have a different sponsor, do some gymnastics // to keep the reverse lookup gapless. delete the point from the old // sponsor's list, then fill that gap with the list tail. // if (had) { // i: current index in previous sponsor's list of sponsored points // uint256 i = sponsoringIndexes[prev][_point]; // we store index + 1, because 0 is the solidity default value // assert(i > 0); i--; // copy the last item in the list into the now-unused slot, // making sure to update its :sponsoringIndexes reference // uint32[] storage prevSponsoring = sponsoring[prev]; uint256 last = prevSponsoring.length - 1; uint32 moved = prevSponsoring[last]; prevSponsoring[i] = moved; sponsoringIndexes[prev][moved] = i + 1; // delete the last item // delete(prevSponsoring[last]); prevSponsoring.length = last; sponsoringIndexes[prev][_point] = 0; } if (_hasSponsor) { uint32[] storage newSponsoring = sponsoring[_sponsor]; newSponsoring.push(_point); sponsoringIndexes[_sponsor][_point] = newSponsoring.length; } point.sponsor = _sponsor; point.hasSponsor = _hasSponsor; } // registerEscapeRequest(): set the escape state of _point and update the // reverse lookup for sponsors // function registerEscapeRequest( uint32 _point, bool _isEscaping, uint32 _sponsor ) internal { Point storage point = points[_point]; bool was = point.escapeRequested; uint32 prev = point.escapeRequestedTo; // if we weren't escaping, and won't be, // or if we were escaping, and the new target is the same, // nothing will change, so jump out early. // if ( (!was && !_isEscaping) || (was && _isEscaping && prev == _sponsor) ) { return; } // if the point used to have a different request, do some gymnastics // to keep the reverse lookup gapless. delete the point from the old // sponsor's list, then fill that gap with the list tail. // if (was) { // i: current index in previous sponsor's list of sponsored points // uint256 i = escapeRequestsIndexes[prev][_point]; // we store index + 1, because 0 is the solidity default value // assert(i > 0); i--; // copy the last item in the list into the now-unused slot, // making sure to update its :escapeRequestsIndexes reference // uint32[] storage prevRequests = escapeRequests[prev]; uint256 last = prevRequests.length - 1; uint32 moved = prevRequests[last]; prevRequests[i] = moved; escapeRequestsIndexes[prev][moved] = i + 1; // delete the last item // delete(prevRequests[last]); prevRequests.length = last; escapeRequestsIndexes[prev][_point] = 0; } if (_isEscaping) { uint32[] storage newRequests = escapeRequests[_sponsor]; newRequests.push(_point); escapeRequestsIndexes[_sponsor][_point] = newRequests.length; } point.escapeRequestedTo = _sponsor; point.escapeRequested = _isEscaping; } // // Deed reading // // owner // getOwner(): return owner of _point // function getOwner(uint32 _point) view external returns (address owner) { return rights[_point].owner; } // isOwner(): true if _point is owned by _address // function isOwner(uint32 _point, address _address) view external returns (bool result) { return (rights[_point].owner == _address); } // getOwnedPointCount(): return length of array of points that _whose owns // function getOwnedPointCount(address _whose) view external returns (uint256 count) { return pointsOwnedBy[_whose].length; } // getOwnedPoints(): return array of points that _whose owns // // Note: only useful for clients, as Solidity does not currently // support returning dynamic arrays. // function getOwnedPoints(address _whose) view external returns (uint32[] ownedPoints) { return pointsOwnedBy[_whose]; } // getOwnedPointAtIndex(): get point at _index from array of points that // _whose owns // function getOwnedPointAtIndex(address _whose, uint256 _index) view external returns (uint32 point) { uint32[] storage owned = pointsOwnedBy[_whose]; require(_index < owned.length); return owned[_index]; } // management proxy // getManagementProxy(): returns _point's current management proxy // function getManagementProxy(uint32 _point) view external returns (address manager) { return rights[_point].managementProxy; } // isManagementProxy(): returns true if _proxy is _point's management proxy // function isManagementProxy(uint32 _point, address _proxy) view external returns (bool result) { return (rights[_point].managementProxy == _proxy); } // canManage(): true if _who is the owner or manager of _point // function canManage(uint32 _point, address _who) view external returns (bool result) { Deed storage deed = rights[_point]; return ( (0x0 != _who) && ( (_who == deed.owner) || (_who == deed.managementProxy) ) ); } // getManagerForCount(): returns the amount of points _proxy can manage // function getManagerForCount(address _proxy) view external returns (uint256 count) { return managerFor[_proxy].length; } // getManagerFor(): returns the points _proxy can manage // // Note: only useful for clients, as Solidity does not currently // support returning dynamic arrays. // function getManagerFor(address _proxy) view external returns (uint32[] mfor) { return managerFor[_proxy]; } // spawn proxy // getSpawnProxy(): returns _point's current spawn proxy // function getSpawnProxy(uint32 _point) view external returns (address spawnProxy) { return rights[_point].spawnProxy; } // isSpawnProxy(): returns true if _proxy is _point's spawn proxy // function isSpawnProxy(uint32 _point, address _proxy) view external returns (bool result) { return (rights[_point].spawnProxy == _proxy); } // canSpawnAs(): true if _who is the owner or spawn proxy of _point // function canSpawnAs(uint32 _point, address _who) view external returns (bool result) { Deed storage deed = rights[_point]; return ( (0x0 != _who) && ( (_who == deed.owner) || (_who == deed.spawnProxy) ) ); } // getSpawningForCount(): returns the amount of points _proxy // can spawn with // function getSpawningForCount(address _proxy) view external returns (uint256 count) { return spawningFor[_proxy].length; } // getSpawningFor(): get the points _proxy can spawn with // // Note: only useful for clients, as Solidity does not currently // support returning dynamic arrays. // function getSpawningFor(address _proxy) view external returns (uint32[] sfor) { return spawningFor[_proxy]; } // voting proxy // getVotingProxy(): returns _point's current voting proxy // function getVotingProxy(uint32 _point) view external returns (address voter) { return rights[_point].votingProxy; } // isVotingProxy(): returns true if _proxy is _point's voting proxy // function isVotingProxy(uint32 _point, address _proxy) view external returns (bool result) { return (rights[_point].votingProxy == _proxy); } // canVoteAs(): true if _who is the owner of _point, // or the voting proxy of _point's owner // function canVoteAs(uint32 _point, address _who) view external returns (bool result) { Deed storage deed = rights[_point]; return ( (0x0 != _who) && ( (_who == deed.owner) || (_who == deed.votingProxy) ) ); } // getVotingForCount(): returns the amount of points _proxy can vote as // function getVotingForCount(address _proxy) view external returns (uint256 count) { return votingFor[_proxy].length; } // getVotingFor(): returns the points _proxy can vote as // // Note: only useful for clients, as Solidity does not currently // support returning dynamic arrays. // function getVotingFor(address _proxy) view external returns (uint32[] vfor) { return votingFor[_proxy]; } // transfer proxy // getTransferProxy(): returns _point's current transfer proxy // function getTransferProxy(uint32 _point) view external returns (address transferProxy) { return rights[_point].transferProxy; } // isTransferProxy(): returns true if _proxy is _point's transfer proxy // function isTransferProxy(uint32 _point, address _proxy) view external returns (bool result) { return (rights[_point].transferProxy == _proxy); } // canTransfer(): true if _who is the owner or transfer proxy of _point, // or is an operator for _point's current owner // function canTransfer(uint32 _point, address _who) view external returns (bool result) { Deed storage deed = rights[_point]; return ( (0x0 != _who) && ( (_who == deed.owner) || (_who == deed.transferProxy) || operators[deed.owner][_who] ) ); } // getTransferringForCount(): returns the amount of points _proxy // can transfer // function getTransferringForCount(address _proxy) view external returns (uint256 count) { return transferringFor[_proxy].length; } // getTransferringFor(): get the points _proxy can transfer // // Note: only useful for clients, as Solidity does not currently // support returning dynamic arrays. // function getTransferringFor(address _proxy) view external returns (uint32[] tfor) { return transferringFor[_proxy]; } // isOperator(): returns true if _operator is allowed to transfer // ownership of _owner's points // function isOperator(address _owner, address _operator) view external returns (bool result) { return operators[_owner][_operator]; } // // Deed writing // // setOwner(): set owner of _point to _owner // // Note: setOwner() only implements the minimal data storage // logic for a transfer; the full transfer is implemented in // Ecliptic. // // Note: _owner must not be the zero address. // function setOwner(uint32 _point, address _owner) onlyOwner external { // prevent burning of points by making zero the owner // require(0x0 != _owner); // prev: previous owner, if any // address prev = rights[_point].owner; if (prev == _owner) { return; } // if the point used to have a different owner, do some gymnastics to // keep the list of owned points gapless. delete this point from the // list, then fill that gap with the list tail. // if (0x0 != prev) { // i: current index in previous owner's list of owned points // uint256 i = pointOwnerIndexes[prev][_point]; // we store index + 1, because 0 is the solidity default value // assert(i > 0); i--; // copy the last item in the list into the now-unused slot, // making sure to update its :pointOwnerIndexes reference // uint32[] storage owner = pointsOwnedBy[prev]; uint256 last = owner.length - 1; uint32 moved = owner[last]; owner[i] = moved; pointOwnerIndexes[prev][moved] = i + 1; // delete the last item // delete(owner[last]); owner.length = last; pointOwnerIndexes[prev][_point] = 0; } // update the owner list and the owner's index list // rights[_point].owner = _owner; pointsOwnedBy[_owner].push(_point); pointOwnerIndexes[_owner][_point] = pointsOwnedBy[_owner].length; emit OwnerChanged(_point, _owner); } // setManagementProxy(): makes _proxy _point's management proxy // function setManagementProxy(uint32 _point, address _proxy) onlyOwner external { Deed storage deed = rights[_point]; address prev = deed.managementProxy; if (prev == _proxy) { return; } // if the point used to have a different manager, do some gymnastics // to keep the reverse lookup gapless. delete the point from the // old manager's list, then fill that gap with the list tail. // if (0x0 != prev) { // i: current index in previous manager's list of managed points // uint256 i = managerForIndexes[prev][_point]; // we store index + 1, because 0 is the solidity default value // assert(i > 0); i--; // copy the last item in the list into the now-unused slot, // making sure to update its :managerForIndexes reference // uint32[] storage prevMfor = managerFor[prev]; uint256 last = prevMfor.length - 1; uint32 moved = prevMfor[last]; prevMfor[i] = moved; managerForIndexes[prev][moved] = i + 1; // delete the last item // delete(prevMfor[last]); prevMfor.length = last; managerForIndexes[prev][_point] = 0; } if (0x0 != _proxy) { uint32[] storage mfor = managerFor[_proxy]; mfor.push(_point); managerForIndexes[_proxy][_point] = mfor.length; } deed.managementProxy = _proxy; emit ChangedManagementProxy(_point, _proxy); } // setSpawnProxy(): makes _proxy _point's spawn proxy // function setSpawnProxy(uint32 _point, address _proxy) onlyOwner external { Deed storage deed = rights[_point]; address prev = deed.spawnProxy; if (prev == _proxy) { return; } // if the point used to have a different spawn proxy, do some // gymnastics to keep the reverse lookup gapless. delete the point // from the old proxy's list, then fill that gap with the list tail. // if (0x0 != prev) { // i: current index in previous proxy's list of spawning points // uint256 i = spawningForIndexes[prev][_point]; // we store index + 1, because 0 is the solidity default value // assert(i > 0); i--; // copy the last item in the list into the now-unused slot, // making sure to update its :spawningForIndexes reference // uint32[] storage prevSfor = spawningFor[prev]; uint256 last = prevSfor.length - 1; uint32 moved = prevSfor[last]; prevSfor[i] = moved; spawningForIndexes[prev][moved] = i + 1; // delete the last item // delete(prevSfor[last]); prevSfor.length = last; spawningForIndexes[prev][_point] = 0; } if (0x0 != _proxy) { uint32[] storage sfor = spawningFor[_proxy]; sfor.push(_point); spawningForIndexes[_proxy][_point] = sfor.length; } deed.spawnProxy = _proxy; emit ChangedSpawnProxy(_point, _proxy); } // setVotingProxy(): makes _proxy _point's voting proxy // function setVotingProxy(uint32 _point, address _proxy) onlyOwner external { Deed storage deed = rights[_point]; address prev = deed.votingProxy; if (prev == _proxy) { return; } // if the point used to have a different voter, do some gymnastics // to keep the reverse lookup gapless. delete the point from the // old voter's list, then fill that gap with the list tail. // if (0x0 != prev) { // i: current index in previous voter's list of points it was // voting for // uint256 i = votingForIndexes[prev][_point]; // we store index + 1, because 0 is the solidity default value // assert(i > 0); i--; // copy the last item in the list into the now-unused slot, // making sure to update its :votingForIndexes reference // uint32[] storage prevVfor = votingFor[prev]; uint256 last = prevVfor.length - 1; uint32 moved = prevVfor[last]; prevVfor[i] = moved; votingForIndexes[prev][moved] = i + 1; // delete the last item // delete(prevVfor[last]); prevVfor.length = last; votingForIndexes[prev][_point] = 0; } if (0x0 != _proxy) { uint32[] storage vfor = votingFor[_proxy]; vfor.push(_point); votingForIndexes[_proxy][_point] = vfor.length; } deed.votingProxy = _proxy; emit ChangedVotingProxy(_point, _proxy); } // setManagementProxy(): makes _proxy _point's transfer proxy // function setTransferProxy(uint32 _point, address _proxy) onlyOwner external { Deed storage deed = rights[_point]; address prev = deed.transferProxy; if (prev == _proxy) { return; } // if the point used to have a different transfer proxy, do some // gymnastics to keep the reverse lookup gapless. delete the point // from the old proxy's list, then fill that gap with the list tail. // if (0x0 != prev) { // i: current index in previous proxy's list of transferable points // uint256 i = transferringForIndexes[prev][_point]; // we store index + 1, because 0 is the solidity default value // assert(i > 0); i--; // copy the last item in the list into the now-unused slot, // making sure to update its :transferringForIndexes reference // uint32[] storage prevTfor = transferringFor[prev]; uint256 last = prevTfor.length - 1; uint32 moved = prevTfor[last]; prevTfor[i] = moved; transferringForIndexes[prev][moved] = i + 1; // delete the last item // delete(prevTfor[last]); prevTfor.length = last; transferringForIndexes[prev][_point] = 0; } if (0x0 != _proxy) { uint32[] storage tfor = transferringFor[_proxy]; tfor.push(_point); transferringForIndexes[_proxy][_point] = tfor.length; } deed.transferProxy = _proxy; emit ChangedTransferProxy(_point, _proxy); } // setOperator(): dis/allow _operator to transfer ownership of all points // owned by _owner // // operators are part of the ERC721 standard // function setOperator(address _owner, address _operator, bool _approved) onlyOwner external { operators[_owner][_operator] = _approved; } } // Azimuth's ReadsAzimuth.sol // ReadsAzimuth: referring to and testing against the Azimuth // data contract // // To avoid needless repetition, this contract provides common // checks and operations using the Azimuth contract. // contract ReadsAzimuth { // azimuth: points data storage contract. // Azimuth public azimuth; // constructor(): set the Azimuth data contract's address // constructor(Azimuth _azimuth) public { azimuth = _azimuth; } // activePointOwner(): require that :msg.sender is the owner of _point, // and that _point is active // modifier activePointOwner(uint32 _point) { require( azimuth.isOwner(_point, msg.sender) && azimuth.isActive(_point) ); _; } // activePointManager(): require that :msg.sender can manage _point, // and that _point is active // modifier activePointManager(uint32 _point) { require( azimuth.canManage(_point, msg.sender) && azimuth.isActive(_point) ); _; } // activePointSpawner(): require that :msg.sender can spawn as _point, // and that _point is active // modifier activePointSpawner(uint32 _point) { require( azimuth.canSpawnAs(_point, msg.sender) && azimuth.isActive(_point) ); _; } // activePointVoter(): require that :msg.sender can vote as _point, // and that _point is active // modifier activePointVoter(uint32 _point) { require( azimuth.canVoteAs(_point, msg.sender) && azimuth.isActive(_point) ); _; } } // Azimuth's Polls.sol // Polls: proposals & votes data contract // // This contract is used for storing all data related to the proposals // of the senate (galaxy owners) and their votes on those proposals. // It keeps track of votes and uses them to calculate whether a majority // is in favor of a proposal. // // Every galaxy can only vote on a proposal exactly once. Votes cannot // be changed. If a proposal fails to achieve majority within its // duration, it can be restarted after its cooldown period has passed. // // The requirements for a proposal to achieve majority are as follows: // - At least 1/4 of the currently active voters (rounded down) must have // voted in favor of the proposal, // - More than half of the votes cast must be in favor of the proposal, // and this can no longer change, either because // - the poll duration has passed, or // - not enough voters remain to take away the in-favor majority. // As soon as these conditions are met, no further interaction with // the proposal is possible. Achieving majority is permanent. // // Since data stores are difficult to upgrade, all of the logic unrelated // to the voting itself (that is, determining who is eligible to vote) // is expected to be implemented by this contract's owner. // // This contract will be owned by the Ecliptic contract. // contract Polls is Ownable { using SafeMath for uint256; using SafeMath16 for uint16; using SafeMath8 for uint8; // UpgradePollStarted: a poll on :proposal has opened // event UpgradePollStarted(address proposal); // DocumentPollStarted: a poll on :proposal has opened // event DocumentPollStarted(bytes32 proposal); // UpgradeMajority: :proposal has achieved majority // event UpgradeMajority(address proposal); // DocumentMajority: :proposal has achieved majority // event DocumentMajority(bytes32 proposal); // Poll: full poll state // struct Poll { // start: the timestamp at which the poll was started // uint256 start; // voted: per galaxy, whether they have voted on this poll // bool[256] voted; // yesVotes: amount of votes in favor of the proposal // uint16 yesVotes; // noVotes: amount of votes against the proposal // uint16 noVotes; // duration: amount of time during which the poll can be voted on // uint256 duration; // cooldown: amount of time before the (non-majority) poll can be reopened // uint256 cooldown; } // pollDuration: duration set for new polls. see also Poll.duration above // uint256 public pollDuration; // pollCooldown: cooldown set for new polls. see also Poll.cooldown above // uint256 public pollCooldown; // totalVoters: amount of active galaxies // uint16 public totalVoters; // upgradeProposals: list of all upgrades ever proposed // // this allows clients to discover the existence of polls. // from there, they can do liveness checks on the polls themselves. // address[] public upgradeProposals; // upgradePolls: per address, poll held to determine if that address // will become the new ecliptic // mapping(address => Poll) public upgradePolls; // upgradeHasAchievedMajority: per address, whether that address // has ever achieved majority // // If we did not store this, we would have to look at old poll data // to see whether or not a proposal has ever achieved majority. // Since the outcome of a poll is calculated based on :totalVoters, // which may not be consistent across time, we need to store outcomes // explicitly instead of re-calculating them. This allows us to always // tell with certainty whether or not a majority was achieved, // regardless of the current :totalVoters. // mapping(address => bool) public upgradeHasAchievedMajority; // documentProposals: list of all documents ever proposed // // this allows clients to discover the existence of polls. // from there, they can do liveness checks on the polls themselves. // bytes32[] public documentProposals; // documentPolls: per hash, poll held to determine if the corresponding // document is accepted by the galactic senate // mapping(bytes32 => Poll) public documentPolls; // documentHasAchievedMajority: per hash, whether that hash has ever // achieved majority // // the note for upgradeHasAchievedMajority above applies here as well // mapping(bytes32 => bool) public documentHasAchievedMajority; // documentMajorities: all hashes that have achieved majority // bytes32[] public documentMajorities; // constructor(): initial contract configuration // constructor(uint256 _pollDuration, uint256 _pollCooldown) public { reconfigure(_pollDuration, _pollCooldown); } // reconfigure(): change poll duration and cooldown // function reconfigure(uint256 _pollDuration, uint256 _pollCooldown) public onlyOwner { require( (5 days <= _pollDuration) && (_pollDuration <= 90 days) && (5 days <= _pollCooldown) && (_pollCooldown <= 90 days) ); pollDuration = _pollDuration; pollCooldown = _pollCooldown; } // incrementTotalVoters(): increase the amount of registered voters // function incrementTotalVoters() external onlyOwner { require(totalVoters < 256); totalVoters = totalVoters.add(1); } // getAllUpgradeProposals(): return array of all upgrade proposals ever made // // Note: only useful for clients, as Solidity does not currently // support returning dynamic arrays. // function getUpgradeProposals() external view returns (address[] proposals) { return upgradeProposals; } // getUpgradeProposalCount(): get the number of unique proposed upgrades // function getUpgradeProposalCount() external view returns (uint256 count) { return upgradeProposals.length; } // getAllDocumentProposals(): return array of all upgrade proposals ever made // // Note: only useful for clients, as Solidity does not currently // support returning dynamic arrays. // function getDocumentProposals() external view returns (bytes32[] proposals) { return documentProposals; } // getDocumentProposalCount(): get the number of unique proposed upgrades // function getDocumentProposalCount() external view returns (uint256 count) { return documentProposals.length; } // getDocumentMajorities(): return array of all document majorities // // Note: only useful for clients, as Solidity does not currently // support returning dynamic arrays. // function getDocumentMajorities() external view returns (bytes32[] majorities) { return documentMajorities; } // hasVotedOnUpgradePoll(): returns true if _galaxy has voted // on the _proposal // function hasVotedOnUpgradePoll(uint8 _galaxy, address _proposal) external view returns (bool result) { return upgradePolls[_proposal].voted[_galaxy]; } // hasVotedOnDocumentPoll(): returns true if _galaxy has voted // on the _proposal // function hasVotedOnDocumentPoll(uint8 _galaxy, bytes32 _proposal) external view returns (bool result) { return documentPolls[_proposal].voted[_galaxy]; } // startUpgradePoll(): open a poll on making _proposal the new ecliptic // function startUpgradePoll(address _proposal) external onlyOwner { // _proposal must not have achieved majority before // require(!upgradeHasAchievedMajority[_proposal]); Poll storage poll = upgradePolls[_proposal]; // if the proposal is being made for the first time, register it. // if (0 == poll.start) { upgradeProposals.push(_proposal); } startPoll(poll); emit UpgradePollStarted(_proposal); } // startDocumentPoll(): open a poll on accepting the document // whose hash is _proposal // function startDocumentPoll(bytes32 _proposal) external onlyOwner { // _proposal must not have achieved majority before // require(!documentHasAchievedMajority[_proposal]); Poll storage poll = documentPolls[_proposal]; // if the proposal is being made for the first time, register it. // if (0 == poll.start) { documentProposals.push(_proposal); } startPoll(poll); emit DocumentPollStarted(_proposal); } // startPoll(): open a new poll, or re-open an old one // function startPoll(Poll storage _poll) internal { // check that the poll has cooled down enough to be started again // // for completely new polls, the values used will be zero // require( block.timestamp > ( _poll.start.add( _poll.duration.add( _poll.cooldown )) ) ); // set started poll state // _poll.start = block.timestamp; delete _poll.voted; _poll.yesVotes = 0; _poll.noVotes = 0; _poll.duration = pollDuration; _poll.cooldown = pollCooldown; } // castUpgradeVote(): as galaxy _as, cast a vote on the _proposal // // _vote is true when in favor of the proposal, false otherwise // function castUpgradeVote(uint8 _as, address _proposal, bool _vote) external onlyOwner returns (bool majority) { Poll storage poll = upgradePolls[_proposal]; processVote(poll, _as, _vote); return updateUpgradePoll(_proposal); } // castDocumentVote(): as galaxy _as, cast a vote on the _proposal // // _vote is true when in favor of the proposal, false otherwise // function castDocumentVote(uint8 _as, bytes32 _proposal, bool _vote) external onlyOwner returns (bool majority) { Poll storage poll = documentPolls[_proposal]; processVote(poll, _as, _vote); return updateDocumentPoll(_proposal); } // processVote(): record a vote from _as on the _poll // function processVote(Poll storage _poll, uint8 _as, bool _vote) internal { // assist symbolic execution tools // assert(block.timestamp >= _poll.start); require( // may only vote once // !_poll.voted[_as] && // // may only vote when the poll is open // (block.timestamp < _poll.start.add(_poll.duration)) ); // update poll state to account for the new vote // _poll.voted[_as] = true; if (_vote) { _poll.yesVotes = _poll.yesVotes.add(1); } else { _poll.noVotes = _poll.noVotes.add(1); } } // updateUpgradePoll(): check whether the _proposal has achieved // majority, updating state, sending an event, // and returning true if it has // function updateUpgradePoll(address _proposal) public onlyOwner returns (bool majority) { // _proposal must not have achieved majority before // require(!upgradeHasAchievedMajority[_proposal]); // check for majority in the poll // Poll storage poll = upgradePolls[_proposal]; majority = checkPollMajority(poll); // if majority was achieved, update the state and send an event // if (majority) { upgradeHasAchievedMajority[_proposal] = true; emit UpgradeMajority(_proposal); } return majority; } // updateDocumentPoll(): check whether the _proposal has achieved majority, // updating the state and sending an event if it has // // this can be called by anyone, because the ecliptic does not // need to be aware of the result // function updateDocumentPoll(bytes32 _proposal) public returns (bool majority) { // _proposal must not have achieved majority before // require(!documentHasAchievedMajority[_proposal]); // check for majority in the poll // Poll storage poll = documentPolls[_proposal]; majority = checkPollMajority(poll); // if majority was achieved, update state and send an event // if (majority) { documentHasAchievedMajority[_proposal] = true; documentMajorities.push(_proposal); emit DocumentMajority(_proposal); } return majority; } // checkPollMajority(): returns true if the majority is in favor of // the subject of the poll // function checkPollMajority(Poll _poll) internal view returns (bool majority) { return ( // poll must have at least the minimum required yes-votes // (_poll.yesVotes >= (totalVoters / 4)) && // // and have a majority... // (_poll.yesVotes > _poll.noVotes) && // // ...that is indisputable // ( // either because the poll has ended // (block.timestamp > _poll.start.add(_poll.duration)) || // // or there are more yes votes than there can be no votes // ( _poll.yesVotes > totalVoters.sub(_poll.yesVotes) ) ) ); } } // Azimuth's Claims.sol // Claims: simple identity management // // This contract allows points to document claims about their owner. // Most commonly, these are about identity, with a claim's protocol // defining the context or platform of the claim, and its dossier // containing proof of its validity. // Points are limited to a maximum of 16 claims. // // For existing claims, the dossier can be updated, or the claim can // be removed entirely. It is recommended to remove any claims associated // with a point when it is about to be transferred to a new owner. // For convenience, the owner of the Azimuth contract (the Ecliptic) // is allowed to clear claims for any point, allowing it to do this for // you on-transfer. // contract Claims is ReadsAzimuth { // ClaimAdded: a claim was added by :by // event ClaimAdded( uint32 indexed by, string _protocol, string _claim, bytes _dossier ); // ClaimRemoved: a claim was removed by :by // event ClaimRemoved(uint32 indexed by, string _protocol, string _claim); // maxClaims: the amount of claims that can be registered per point // uint8 constant maxClaims = 16; // Claim: claim details // struct Claim { // protocol: context of the claim // string protocol; // claim: the claim itself // string claim; // dossier: data relating to the claim, as proof // bytes dossier; } // per point, list of claims // mapping(uint32 => Claim[maxClaims]) public claims; // constructor(): register the azimuth contract. // constructor(Azimuth _azimuth) ReadsAzimuth(_azimuth) public { // } // addClaim(): register a claim as _point // function addClaim(uint32 _point, string _protocol, string _claim, bytes _dossier) external activePointManager(_point) { // require non-empty protocol and claim fields // require( ( 0 < bytes(_protocol).length ) && ( 0 < bytes(_claim).length ) ); // cur: index + 1 of the claim if it already exists, 0 otherwise // uint8 cur = findClaim(_point, _protocol, _claim); // if the claim doesn't yet exist, store it in state // if (cur == 0) { // if there are no empty slots left, this throws // uint8 empty = findEmptySlot(_point); claims[_point][empty] = Claim(_protocol, _claim, _dossier); } // // if the claim has been made before, update the version in state // else { claims[_point][cur-1] = Claim(_protocol, _claim, _dossier); } emit ClaimAdded(_point, _protocol, _claim, _dossier); } // removeClaim(): unregister a claim as _point // function removeClaim(uint32 _point, string _protocol, string _claim) external activePointManager(_point) { // i: current index + 1 in _point's list of claims // uint256 i = findClaim(_point, _protocol, _claim); // we store index + 1, because 0 is the eth default value // can only delete an existing claim // require(i > 0); i--; // clear out the claim // delete claims[_point][i]; emit ClaimRemoved(_point, _protocol, _claim); } // clearClaims(): unregister all of _point's claims // // can also be called by the ecliptic during point transfer // function clearClaims(uint32 _point) external { // both point owner and ecliptic may do this // // We do not necessarily need to check for _point's active flag here, // since inactive points cannot have claims set. Doing the check // anyway would make this function slightly harder to think about due // to its relation to Ecliptic's transferPoint(). // require( azimuth.canManage(_point, msg.sender) || ( msg.sender == azimuth.owner() ) ); Claim[maxClaims] storage currClaims = claims[_point]; // clear out all claims // for (uint8 i = 0; i < maxClaims; i++) { // only emit the removed event if there was a claim here // if ( 0 < bytes(currClaims[i].claim).length ) { emit ClaimRemoved(_point, currClaims[i].protocol, currClaims[i].claim); } delete currClaims[i]; } } // findClaim(): find the index of the specified claim // // returns 0 if not found, index + 1 otherwise // function findClaim(uint32 _whose, string _protocol, string _claim) public view returns (uint8 index) { // we use hashes of the string because solidity can't do string // comparison yet // bytes32 protocolHash = keccak256(bytes(_protocol)); bytes32 claimHash = keccak256(bytes(_claim)); Claim[maxClaims] storage theirClaims = claims[_whose]; for (uint8 i = 0; i < maxClaims; i++) { Claim storage thisClaim = theirClaims[i]; if ( ( protocolHash == keccak256(bytes(thisClaim.protocol)) ) && ( claimHash == keccak256(bytes(thisClaim.claim)) ) ) { return i+1; } } return 0; } // findEmptySlot(): find the index of the first empty claim slot // // returns the index of the slot, throws if there are no empty slots // function findEmptySlot(uint32 _whose) internal view returns (uint8 index) { Claim[maxClaims] storage theirClaims = claims[_whose]; for (uint8 i = 0; i < maxClaims; i++) { Claim storage thisClaim = theirClaims[i]; if ( (0 == bytes(thisClaim.claim).length) ) { return i; } } revert(); } } // Treasury's ITreasuryProxy interface ITreasuryProxy { function upgradeTo(address _impl) external returns (bool); function freeze() external returns (bool); } // Azimuth's EclipticBase.sol // EclipticBase: upgradable ecliptic // // This contract implements the upgrade logic for the Ecliptic. // Newer versions of the Ecliptic are expected to provide at least // the onUpgrade() function. If they don't, upgrading to them will // fail. // // Note that even though this contract doesn't specify any required // interface members aside from upgrade() and onUpgrade(), contracts // and clients may still rely on the presence of certain functions // provided by the Ecliptic proper. Keep this in mind when writing // new versions of it. // contract EclipticBase is Ownable, ReadsAzimuth { // Upgraded: _to is the new canonical Ecliptic // event Upgraded(address to); // polls: senate voting contract // Polls public polls; // previousEcliptic: address of the previous ecliptic this // instance expects to upgrade from, stored and // checked for to prevent unexpected upgrade paths // address public previousEcliptic; constructor( address _previous, Azimuth _azimuth, Polls _polls ) ReadsAzimuth(_azimuth) internal { previousEcliptic = _previous; polls = _polls; } // onUpgrade(): called by previous ecliptic when upgrading // // in future ecliptics, this might perform more logic than // just simple checks and verifications. // when overriding this, make sure to call this original as well. // function onUpgrade() external { // make sure this is the expected upgrade path, // and that we have gotten the ownership we require // require( msg.sender == previousEcliptic && this == azimuth.owner() && this == polls.owner() ); } // upgrade(): transfer ownership of the ecliptic data to the new // ecliptic contract, notify it, then self-destruct. // // Note: any eth that have somehow ended up in this contract // are also sent to the new ecliptic. // function upgrade(EclipticBase _new) internal { // transfer ownership of the data contracts // azimuth.transferOwnership(_new); polls.transferOwnership(_new); // trigger upgrade logic on the target contract // _new.onUpgrade(); // emit event and destroy this contract // emit Upgraded(_new); selfdestruct(_new); } } //////////////////////////////////////////////////////////////////////////////// // Ecliptic //////////////////////////////////////////////////////////////////////////////// // Ecliptic: logic for interacting with the Azimuth ledger // // This contract is the point of entry for all operations on the Azimuth // ledger as stored in the Azimuth data contract. The functions herein // are responsible for performing all necessary business logic. // Examples of such logic include verifying permissions of the caller // and ensuring a requested change is actually valid. // Point owners can always operate on their own points. Ethereum addresses // can also perform specific operations if they've been given the // appropriate permissions. (For example, managers for general management, // spawn proxies for spawning child points, etc.) // // This contract uses external contracts (Azimuth, Polls) for data storage // so that it itself can easily be replaced in case its logic needs to // be changed. In other words, it can be upgraded. It does this by passing // ownership of the data contracts to a new Ecliptic contract. // // Because of this, it is advised for clients to not store this contract's // address directly, but rather ask the Azimuth contract for its owner // attribute to ensure transactions get sent to the latest Ecliptic. // Alternatively, the ENS name ecliptic.eth will resolve to the latest // Ecliptic as well. // // Upgrading happens based on polls held by the senate (galaxy owners). // Through this contract, the senate can submit proposals, opening polls // for the senate to cast votes on. These proposals can be either hashes // of documents or addresses of new Ecliptics. // If an ecliptic proposal gains majority, this contract will transfer // ownership of the data storage contracts to that address, so that it may // operate on the data they contain. This contract will selfdestruct at // the end of the upgrade process. // // This contract implements the ERC721 interface for non-fungible tokens, // allowing points to be managed using generic clients that support the // standard. It also implements ERC165 to allow this to be discovered. // contract Ecliptic is EclipticBase, SupportsInterfaceWithLookup, ERC721Metadata { using SafeMath for uint256; using AddressUtils for address; // Transfer: This emits when ownership of any NFT changes by any mechanism. // This event emits when NFTs are created (`from` == 0) and // destroyed (`to` == 0). At the time of any transfer, the // approved address for that NFT (if any) is reset to none. // event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId); // Approval: This emits when the approved address for an NFT is changed or // reaffirmed. The zero address indicates there is no approved // address. When a Transfer event emits, this also indicates that // the approved address for that NFT (if any) is reset to none. // event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId); // ApprovalForAll: This emits when an operator is enabled or disabled for an // owner. The operator can manage all NFTs of the owner. // event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved); // erc721Received: equal to: // bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")) // which can be also obtained as: // ERC721Receiver(0).onERC721Received.selector` bytes4 constant erc721Received = 0x150b7a02; // depositAddress: Special address respresenting L2. Ships sent to // this address are controlled on L2 instead of here. // address constant public depositAddress = 0x1111111111111111111111111111111111111111; ITreasuryProxy public treasuryProxy; // treasuryUpgradeHash // hash of the treasury implementation to upgrade to // Note: stand-in, just hash of no bytes // could be made immutable and passed in as constructor argument bytes32 constant public treasuryUpgradeHash = hex"26f3eae628fa1a4d23e34b91a4d412526a47620ced37c80928906f9fa07c0774"; bool public treasuryUpgraded = false; // claims: contract reference, for clearing claims on-transfer // Claims public claims; // constructor(): set data contract addresses and signal interface support // // Note: during first deploy, ownership of these data contracts must // be manually transferred to this contract. // constructor(address _previous, Azimuth _azimuth, Polls _polls, Claims _claims, ITreasuryProxy _treasuryProxy) EclipticBase(_previous, _azimuth, _polls) public { claims = _claims; treasuryProxy = _treasuryProxy; // register supported interfaces for ERC165 // _registerInterface(0x80ac58cd); // ERC721 _registerInterface(0x5b5e139f); // ERC721Metadata _registerInterface(0x7f5828d0); // ERC173 (ownership) } // // ERC721 interface // // balanceOf(): get the amount of points owned by _owner // function balanceOf(address _owner) public view returns (uint256 balance) { require(0x0 != _owner); return azimuth.getOwnedPointCount(_owner); } // ownerOf(): get the current owner of point _tokenId // function ownerOf(uint256 _tokenId) public view validPointId(_tokenId) returns (address owner) { uint32 id = uint32(_tokenId); // this will throw if the owner is the zero address, // active points always have a valid owner. // require(azimuth.isActive(id)); return azimuth.getOwner(id); } // exists(): returns true if point _tokenId is active // function exists(uint256 _tokenId) public view returns (bool doesExist) { return ( (_tokenId < 0x100000000) && azimuth.isActive(uint32(_tokenId)) ); } // safeTransferFrom(): transfer point _tokenId from _from to _to // function safeTransferFrom(address _from, address _to, uint256 _tokenId) public { // transfer with empty data // safeTransferFrom(_from, _to, _tokenId, ""); } // safeTransferFrom(): transfer point _tokenId from _from to _to, // and call recipient if it's a contract // function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes _data) public { // perform raw transfer // transferFrom(_from, _to, _tokenId); // do the callback last to avoid re-entrancy // if (_to.isContract()) { bytes4 retval = ERC721Receiver(_to) .onERC721Received(msg.sender, _from, _tokenId, _data); // // standard return idiom to confirm contract semantics // require(retval == erc721Received); } } // transferFrom(): transfer point _tokenId from _from to _to, // WITHOUT notifying recipient contract // function transferFrom(address _from, address _to, uint256 _tokenId) public validPointId(_tokenId) { uint32 id = uint32(_tokenId); require(azimuth.isOwner(id, _from)); // the ERC721 operator/approved address (if any) is // accounted for in transferPoint() // transferPoint(id, _to, true); } // approve(): allow _approved to transfer ownership of point // _tokenId // function approve(address _approved, uint256 _tokenId) public validPointId(_tokenId) { setTransferProxy(uint32(_tokenId), _approved); } // setApprovalForAll(): allow or disallow _operator to // transfer ownership of ALL points // owned by :msg.sender // function setApprovalForAll(address _operator, bool _approved) public { require(0x0 != _operator); azimuth.setOperator(msg.sender, _operator, _approved); emit ApprovalForAll(msg.sender, _operator, _approved); } // getApproved(): get the approved address for point _tokenId // function getApproved(uint256 _tokenId) public view validPointId(_tokenId) returns (address approved) { //NOTE redundant, transfer proxy cannot be set for // inactive points // require(azimuth.isActive(uint32(_tokenId))); return azimuth.getTransferProxy(uint32(_tokenId)); } // isApprovedForAll(): returns true if _operator is an // operator for _owner // function isApprovedForAll(address _owner, address _operator) public view returns (bool result) { return azimuth.isOperator(_owner, _operator); } // // ERC721Metadata interface // // name(): returns the name of a collection of points // function name() external view returns (string) { return "Azimuth Points"; } // symbol(): returns an abbreviates name for points // function symbol() external view returns (string) { return "AZP"; } // tokenURI(): returns a URL to an ERC-721 standard JSON file // function tokenURI(uint256 _tokenId) public view validPointId(_tokenId) returns (string _tokenURI) { _tokenURI = "https://azimuth.network/erc721/0000000000.json"; bytes memory _tokenURIBytes = bytes(_tokenURI); _tokenURIBytes[31] = byte(48+(_tokenId / 1000000000) % 10); _tokenURIBytes[32] = byte(48+(_tokenId / 100000000) % 10); _tokenURIBytes[33] = byte(48+(_tokenId / 10000000) % 10); _tokenURIBytes[34] = byte(48+(_tokenId / 1000000) % 10); _tokenURIBytes[35] = byte(48+(_tokenId / 100000) % 10); _tokenURIBytes[36] = byte(48+(_tokenId / 10000) % 10); _tokenURIBytes[37] = byte(48+(_tokenId / 1000) % 10); _tokenURIBytes[38] = byte(48+(_tokenId / 100) % 10); _tokenURIBytes[39] = byte(48+(_tokenId / 10) % 10); _tokenURIBytes[40] = byte(48+(_tokenId / 1) % 10); } // // Points interface // // configureKeys(): configure _point with network public keys // _encryptionKey, _authenticationKey, // and corresponding _cryptoSuiteVersion, // incrementing the point's continuity number if needed // function configureKeys(uint32 _point, bytes32 _encryptionKey, bytes32 _authenticationKey, uint32 _cryptoSuiteVersion, bool _discontinuous) external activePointManager(_point) onL1(_point) { if (_discontinuous) { azimuth.incrementContinuityNumber(_point); } azimuth.setKeys(_point, _encryptionKey, _authenticationKey, _cryptoSuiteVersion); } // spawn(): spawn _point, then either give, or allow _target to take, // ownership of _point // // if _target is the :msg.sender, _targets owns the _point right away. // otherwise, _target becomes the transfer proxy of _point. // // Requirements: // - _point must not be active // - _point must not be a planet with a galaxy prefix // - _point's prefix must be linked and under its spawn limit // - :msg.sender must be either the owner of _point's prefix, // or an authorized spawn proxy for it // function spawn(uint32 _point, address _target) external { // only currently unowned (and thus also inactive) points can be spawned // require(azimuth.isOwner(_point, 0x0)); // prefix: half-width prefix of _point // uint16 prefix = azimuth.getPrefix(_point); // can't spawn if we deposited ownership or spawn rights to L2 // require( depositAddress != azimuth.getOwner(prefix) ); require( depositAddress != azimuth.getSpawnProxy(prefix) ); // only allow spawning of points of the size directly below the prefix // // this is possible because of how the address space works, // but supporting it introduces complexity through broken assumptions. // // example: // 0x0000.0000 - galaxy zero // 0x0000.0100 - the first star of galaxy zero // 0x0001.0100 - the first planet of the first star // 0x0001.0000 - the first planet of galaxy zero // require( (uint8(azimuth.getPointSize(prefix)) + 1) == uint8(azimuth.getPointSize(_point)) ); // prefix point must be linked and able to spawn // require( (azimuth.hasBeenLinked(prefix)) && ( azimuth.getSpawnCount(prefix) < getSpawnLimit(prefix, block.timestamp) ) ); // the owner of a prefix can always spawn its children; // other addresses need explicit permission (the role // of "spawnProxy" in the Azimuth contract) // require( azimuth.canSpawnAs(prefix, msg.sender) ); // if the caller is spawning the point to themselves, // assume it knows what it's doing and resolve right away // if (msg.sender == _target) { doSpawn(_point, _target, true, 0x0); } // // when sending to a "foreign" address, enforce a withdraw pattern // making the _point prefix's owner the _point owner in the mean time // else { doSpawn(_point, _target, false, azimuth.getOwner(prefix)); } } // doSpawn(): actual spawning logic, used in spawn(). creates _point, // making the _target its owner if _direct, or making the // _holder the owner and the _target the transfer proxy // if not _direct. // function doSpawn( uint32 _point, address _target, bool _direct, address _holder ) internal { // register the spawn for _point's prefix, incrementing spawn count // azimuth.registerSpawned(_point); // if the spawn is _direct, assume _target knows what they're doing // and resolve right away // if (_direct) { // make the point active and set its new owner // azimuth.activatePoint(_point); azimuth.setOwner(_point, _target); emit Transfer(0x0, _target, uint256(_point)); } // // when spawning indirectly, enforce a withdraw pattern by approving // the _target for transfer of the _point instead. // we make the _holder the owner of this _point in the mean time, // so that it may cancel the transfer (un-approve) if _target flakes. // we don't make _point active yet, because it still doesn't really // belong to anyone. // else { // have _holder hold on to the _point while _target gets to transfer // ownership of it // azimuth.setOwner(_point, _holder); azimuth.setTransferProxy(_point, _target); emit Transfer(0x0, _holder, uint256(_point)); emit Approval(_holder, _target, uint256(_point)); } } // transferPoint(): transfer _point to _target, clearing all permissions // data and keys if _reset is true // // Note: the _reset flag is useful when transferring the point to // a recipient who doesn't trust the previous owner. // // We know _point is not on L2, since otherwise its owner would be // depositAddress (which has no operator) and its transfer proxy // would be zero. // // Requirements: // - :msg.sender must be either _point's current owner, authorized // to transfer _point, or authorized to transfer the current // owner's points (as in ERC721's operator) // - _target must not be the zero address // function transferPoint(uint32 _point, address _target, bool _reset) public { // transfer is legitimate if the caller is the current owner, or // an operator for the current owner, or the _point's transfer proxy // require(azimuth.canTransfer(_point, msg.sender)); // can't deposit galaxy to L2 // can't deposit contract-owned point to L2 // require( depositAddress != _target || ( azimuth.getPointSize(_point) != Azimuth.Size.Galaxy && !azimuth.getOwner(_point).isContract() ) ); // if the point wasn't active yet, that means transferring it // is part of the "spawn" flow, so we need to activate it // if ( !azimuth.isActive(_point) ) { azimuth.activatePoint(_point); } // if the owner would actually change, change it // // the only time this deliberately wouldn't be the case is when a // prefix owner wants to activate a spawned but untransferred child. // if ( !azimuth.isOwner(_point, _target) ) { // remember the previous owner, to be included in the Transfer event // address old = azimuth.getOwner(_point); azimuth.setOwner(_point, _target); // according to ERC721, the approved address (here, transfer proxy) // gets cleared during every Transfer event // // we also rely on this so that transfer-related functions don't need // to verify the point is on L1 // azimuth.setTransferProxy(_point, 0); emit Transfer(old, _target, uint256(_point)); } // if we're depositing to L2, clear L1 data so that no proxies // can be used // if ( depositAddress == _target ) { azimuth.setKeys(_point, 0, 0, 0); azimuth.setManagementProxy(_point, 0); azimuth.setVotingProxy(_point, 0); azimuth.setTransferProxy(_point, 0); azimuth.setSpawnProxy(_point, 0); claims.clearClaims(_point); azimuth.cancelEscape(_point); } // reset sensitive data // used when transferring the point to a new owner // else if ( _reset ) { // clear the network public keys and break continuity, // but only if the point has already been linked // if ( azimuth.hasBeenLinked(_point) ) { azimuth.incrementContinuityNumber(_point); azimuth.setKeys(_point, 0, 0, 0); } // clear management proxy // azimuth.setManagementProxy(_point, 0); // clear voting proxy // azimuth.setVotingProxy(_point, 0); // clear transfer proxy // // in most cases this is done above, during the ownership transfer, // but we might not hit that and still be expected to reset the // transfer proxy. // doing it a second time is a no-op in Azimuth. // azimuth.setTransferProxy(_point, 0); // clear spawning proxy // // don't clear if the spawn rights have been deposited to L2, // if ( depositAddress != azimuth.getSpawnProxy(_point) ) { azimuth.setSpawnProxy(_point, 0); } // clear claims // claims.clearClaims(_point); } } // escape(): request escape as _point to _sponsor // // if an escape request is already active, this overwrites // the existing request // // Requirements: // - :msg.sender must be the owner or manager of _point, // - _point must be able to escape to _sponsor as per to canEscapeTo() // function escape(uint32 _point, uint32 _sponsor) external activePointManager(_point) onL1(_point) { // if the sponsor is on L2, we need to escape using L2 // require( depositAddress != azimuth.getOwner(_sponsor) ); require(canEscapeTo(_point, _sponsor)); azimuth.setEscapeRequest(_point, _sponsor); } // cancelEscape(): cancel the currently set escape for _point // function cancelEscape(uint32 _point) external activePointManager(_point) { azimuth.cancelEscape(_point); } // adopt(): as the relevant sponsor, accept the _point // // Requirements: // - :msg.sender must be the owner or management proxy // of _point's requested sponsor // function adopt(uint32 _point) external onL1(_point) { uint32 request = azimuth.getEscapeRequest(_point); require( azimuth.isEscaping(_point) && azimuth.canManage( request, msg.sender ) ); require( depositAddress != azimuth.getOwner(request) ); // _sponsor becomes _point's sponsor // its escape request is reset to "not escaping" // azimuth.doEscape(_point); } // reject(): as the relevant sponsor, deny the _point's request // // Requirements: // - :msg.sender must be the owner or management proxy // of _point's requested sponsor // function reject(uint32 _point) external { uint32 request = azimuth.getEscapeRequest(_point); require( azimuth.isEscaping(_point) && azimuth.canManage( request, msg.sender ) ); require( depositAddress != azimuth.getOwner(request) ); // reset the _point's escape request to "not escaping" // azimuth.cancelEscape(_point); } // detach(): as the _sponsor, stop sponsoring the _point // // Requirements: // - :msg.sender must be the owner or management proxy // of _point's current sponsor // // We allow detachment even of points that are on L2. This is // so that a star controlled by a contract can detach from a // planet which was on L1 originally but now is on L2. L2 will // ignore this if this is not the actual sponsor anymore (i.e. if // they later changed their sponsor on L2). // function detach(uint32 _point) external { uint32 sponsor = azimuth.getSponsor(_point); require( azimuth.hasSponsor(_point) && azimuth.canManage(sponsor, msg.sender) ); require( depositAddress != azimuth.getOwner(sponsor) ); // signal that its sponsor no longer supports _point // azimuth.loseSponsor(_point); } // // Point rules // // getSpawnLimit(): returns the total number of children the _point // is allowed to spawn at _time. // function getSpawnLimit(uint32 _point, uint256 _time) public view returns (uint32 limit) { Azimuth.Size size = azimuth.getPointSize(_point); if ( size == Azimuth.Size.Galaxy ) { return 255; } else if ( size == Azimuth.Size.Star ) { // in 2019, stars may spawn at most 1024 planets. this limit doubles // for every subsequent year. // // Note: 1546300800 corresponds to 2019-01-01 // uint256 yearsSince2019 = (_time - 1546300800) / 365 days; if (yearsSince2019 < 6) { limit = uint32( 1024 * (2 ** yearsSince2019) ); } else { limit = 65535; } return limit; } else // size == Azimuth.Size.Planet { // planets can create moons, but moons aren't on the chain // return 0; } } // canEscapeTo(): true if _point could try to escape to _sponsor // function canEscapeTo(uint32 _point, uint32 _sponsor) public view returns (bool canEscape) { // can't escape to a sponsor that hasn't been linked // if ( !azimuth.hasBeenLinked(_sponsor) ) return false; // Can only escape to a point one size higher than ourselves, // except in the special case where the escaping point hasn't // been linked yet -- in that case we may escape to points of // the same size, to support lightweight invitation chains. // // The use case for lightweight invitations is that a planet // owner should be able to invite their friends onto an // Azimuth network in a two-party transaction, without a new // star relationship. // The lightweight invitation process works by escaping your // own active (but never linked) point to one of your own // points, then transferring the point to your friend. // // These planets can, in turn, sponsor other unlinked planets, // so the "planet sponsorship chain" can grow to arbitrary // length. Most users, especially deep down the chain, will // want to improve their performance by switching to direct // star sponsors eventually. // Azimuth.Size pointSize = azimuth.getPointSize(_point); Azimuth.Size sponsorSize = azimuth.getPointSize(_sponsor); return ( // normal hierarchical escape structure // ( (uint8(sponsorSize) + 1) == uint8(pointSize) ) || // // special peer escape // ( (sponsorSize == pointSize) && // // peer escape is only for points that haven't been linked // yet, because it's only for lightweight invitation chains // !azimuth.hasBeenLinked(_point) ) ); } // // Permission management // // setManagementProxy(): configure the management proxy for _point // // The management proxy may perform "reversible" operations on // behalf of the owner. This includes public key configuration and // operations relating to sponsorship. // function setManagementProxy(uint32 _point, address _manager) external activePointManager(_point) onL1(_point) { azimuth.setManagementProxy(_point, _manager); } // setSpawnProxy(): give _spawnProxy the right to spawn points // with the prefix _prefix // // takes a uint16 so that we can't set spawn proxy for a planet // // fails if spawn rights have been deposited to L2 // function setSpawnProxy(uint16 _prefix, address _spawnProxy) external activePointSpawner(_prefix) onL1(_prefix) { require( depositAddress != azimuth.getSpawnProxy(_prefix) ); azimuth.setSpawnProxy(_prefix, _spawnProxy); } // setVotingProxy(): configure the voting proxy for _galaxy // // the voting proxy is allowed to start polls and cast votes // on the point's behalf. // function setVotingProxy(uint8 _galaxy, address _voter) external activePointVoter(_galaxy) { azimuth.setVotingProxy(_galaxy, _voter); } // setTransferProxy(): give _transferProxy the right to transfer _point // // Requirements: // - :msg.sender must be either _point's current owner, // or be an operator for the current owner // function setTransferProxy(uint32 _point, address _transferProxy) public onL1(_point) { // owner: owner of _point // address owner = azimuth.getOwner(_point); // caller must be :owner, or an operator designated by the owner. // require((owner == msg.sender) || azimuth.isOperator(owner, msg.sender)); // set transfer proxy field in Azimuth contract // azimuth.setTransferProxy(_point, _transferProxy); // emit Approval event // emit Approval(owner, _transferProxy, uint256(_point)); } // // Poll actions // // startUpgradePoll(): as _galaxy, start a poll for the ecliptic // upgrade _proposal // // Requirements: // - :msg.sender must be the owner or voting proxy of _galaxy, // - the _proposal must expect to be upgraded from this specific // contract, as indicated by its previousEcliptic attribute // function startUpgradePoll(uint8 _galaxy, EclipticBase _proposal) external activePointVoter(_galaxy) { // ensure that the upgrade target expects this contract as the source // require(_proposal.previousEcliptic() == address(this)); polls.startUpgradePoll(_proposal); } // startDocumentPoll(): as _galaxy, start a poll for the _proposal // // the _proposal argument is the keccak-256 hash of any arbitrary // document or string of text // function startDocumentPoll(uint8 _galaxy, bytes32 _proposal) external activePointVoter(_galaxy) { polls.startDocumentPoll(_proposal); } // castUpgradeVote(): as _galaxy, cast a _vote on the ecliptic // upgrade _proposal // // _vote is true when in favor of the proposal, false otherwise // // If this vote results in a majority for the _proposal, it will // be upgraded to immediately. // function castUpgradeVote(uint8 _galaxy, EclipticBase _proposal, bool _vote) external activePointVoter(_galaxy) { // majority: true if the vote resulted in a majority, false otherwise // bool majority = polls.castUpgradeVote(_galaxy, _proposal, _vote); // if a majority is in favor of the upgrade, it happens as defined // in the ecliptic base contract // if (majority) { upgrade(_proposal); } } // castDocumentVote(): as _galaxy, cast a _vote on the _proposal // // _vote is true when in favor of the proposal, false otherwise // function castDocumentVote(uint8 _galaxy, bytes32 _proposal, bool _vote) external activePointVoter(_galaxy) { polls.castDocumentVote(_galaxy, _proposal, _vote); } // updateUpgradePoll(): check whether the _proposal has achieved // majority, upgrading to it if it has // function updateUpgradePoll(EclipticBase _proposal) external { // majority: true if the poll ended in a majority, false otherwise // bool majority = polls.updateUpgradePoll(_proposal); // if a majority is in favor of the upgrade, it happens as defined // in the ecliptic base contract // if (majority) { upgrade(_proposal); } } // updateDocumentPoll(): check whether the _proposal has achieved majority // // Note: the polls contract publicly exposes the function this calls, // but we offer it in the ecliptic interface as a convenience // function updateDocumentPoll(bytes32 _proposal) external { polls.updateDocumentPoll(_proposal); } // upgradeTreasury: upgrade implementation for treasury // // Note: we specify when deploying Ecliptic the keccak hash // of the implementation we're upgrading to // function upgradeTreasury(address _treasuryImpl) external { require(!treasuryUpgraded); require(keccak256(_treasuryImpl) == treasuryUpgradeHash); treasuryProxy.upgradeTo(_treasuryImpl); treasuryUpgraded = true; } // // Contract owner operations // // createGalaxy(): grant _target ownership of the _galaxy and register // it for voting // function createGalaxy(uint8 _galaxy, address _target) external onlyOwner { // only currently unowned (and thus also inactive) galaxies can be // created, and only to non-zero addresses // require( azimuth.isOwner(_galaxy, 0x0) && 0x0 != _target ); // new galaxy means a new registered voter // polls.incrementTotalVoters(); // if the caller is sending the galaxy to themselves, // assume it knows what it's doing and resolve right away // if (msg.sender == _target) { doSpawn(_galaxy, _target, true, 0x0); } // // when sending to a "foreign" address, enforce a withdraw pattern, // making the caller the owner in the mean time // else { doSpawn(_galaxy, _target, false, msg.sender); } } function setDnsDomains(string _primary, string _secondary, string _tertiary) external onlyOwner { azimuth.setDnsDomains(_primary, _secondary, _tertiary); } // // Function modifiers for this contract // // validPointId(): require that _id is a valid point // modifier validPointId(uint256 _id) { require(_id < 0x100000000); _; } // onL1(): require that ship is not deposited modifier onL1(uint32 _point) { require( depositAddress != azimuth.getOwner(_point) ); _; } }
getApproved(): get the approved address for point _tokenIdNOTE redundant, transfer proxy cannot be set for inactive points
function getApproved(uint256 _tokenId) public view validPointId(_tokenId) returns (address approved) { require(azimuth.isActive(uint32(_tokenId))); return azimuth.getTransferProxy(uint32(_tokenId)); }
1,053,718
[ 1, 4625, 348, 7953, 560, 30, 282, 336, 31639, 13332, 336, 326, 20412, 1758, 364, 1634, 389, 2316, 548, 17857, 225, 19530, 16, 7412, 2889, 2780, 506, 444, 364, 1377, 16838, 3143, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 336, 31639, 12, 11890, 5034, 389, 2316, 548, 13, 203, 1377, 1071, 203, 1377, 1476, 203, 1377, 923, 2148, 548, 24899, 2316, 548, 13, 203, 1377, 1135, 261, 2867, 20412, 13, 203, 565, 288, 203, 1377, 2583, 12, 28306, 18, 291, 3896, 12, 11890, 1578, 24899, 2316, 548, 3719, 1769, 203, 1377, 327, 23090, 18, 588, 5912, 3886, 12, 11890, 1578, 24899, 2316, 548, 10019, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/1/0x7f312a75B62846033Bc5471c5BcB94b1abfAf06d/sources/src/EthlizardsV2.sol
* @notice Sets the royalties of the collection. Is in 2 dp. EG, 100 = 1%/
function setDefaultRoyalty(address receiver, uint96 feeNumerator) public onlyOwner { currentRoyaltyPercentage = feeNumerator; _setDefaultRoyalty(receiver, feeNumerator); }
16,447,779
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 20392, 11511, 326, 721, 93, 2390, 606, 434, 326, 1849, 18, 2585, 316, 576, 9986, 18, 512, 43, 16, 2130, 273, 404, 9, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 9277, 54, 13372, 15006, 12, 2867, 5971, 16, 2254, 10525, 14036, 2578, 7385, 13, 1071, 1338, 5541, 288, 203, 3639, 783, 54, 13372, 15006, 16397, 273, 14036, 2578, 7385, 31, 203, 3639, 389, 542, 1868, 54, 13372, 15006, 12, 24454, 16, 14036, 2578, 7385, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/1/0x980C680a90631c8Ea49fA37B47AbC3154219EC1a/sources/contracts/EthenaMinting.sol
Set the max mint/redeem limits per block
_setMaxMintPerBlock(_maxMintPerBlock);
17,057,128
[ 1, 4625, 348, 7953, 560, 30, 225, 1000, 326, 943, 312, 474, 19, 266, 24903, 8181, 1534, 1203, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 389, 542, 2747, 49, 474, 2173, 1768, 24899, 1896, 49, 474, 2173, 1768, 1769, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./partial_match/1/0x404c5d2A696b441b1F264bd30daa6aEC2C713176/sources/TWENTYFOURX.sol
generate the uniswap pair path of token -> weth make the swap
function swapTokensForEth(uint256 tokenAmount) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, path, address(this), block.timestamp ); }
2,718,115
[ 1, 4625, 348, 7953, 560, 30, 225, 2103, 326, 640, 291, 91, 438, 3082, 589, 434, 1147, 317, 341, 546, 1221, 326, 7720, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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203, 3639, 589, 63, 21, 65, 273, 640, 291, 91, 438, 58, 22, 8259, 18, 59, 1584, 44, 5621, 203, 7010, 3639, 389, 12908, 537, 12, 2867, 12, 2211, 3631, 1758, 12, 318, 291, 91, 438, 58, 22, 8259, 3631, 1147, 6275, 1769, 203, 7010, 3639, 640, 291, 91, 438, 58, 22, 8259, 18, 22270, 14332, 5157, 1290, 1584, 44, 6289, 310, 14667, 1398, 5912, 5157, 12, 203, 5411, 1147, 6275, 16, 203, 5411, 589, 16, 203, 5411, 1758, 12, 2211, 3631, 203, 5411, 1203, 18, 5508, 203, 3639, 11272, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.8.0; import "../github/OpenZeppelin/openzeppelin-contracts/contracts/utils/escrow/Escrow.sol"; //import "../github/OpenZeppelin/open-zeppelin/contracts/escrow/Escrow.sol"; contract Campaigns is Escrow { event Deposited(int256 indexed campaignID, uint256 payoutAmount); event Withdrawn(address indexed claim, uint256 payoutAmount); //claimee struct claimees wallet address, transaction hash, yes or no (bool) //creating a mapping of claimees, users in this mapping are already verfiied //verify contract gets the result from verify function and adds the result to the claim struct //if the bool is yes for the claim, call the payout() struct claim { // Declaring different // structure elements address payable claimee; address transaction; bool verfiiedStatus; } mapping (claim => bool) public claimees; //campapign struct campaign ID, contract address of the campapign, amount of payout struct campaign { int256 campaignId; address campapignContract; int256 payoutAmount; } deposit(int256 _payoutAmount) { //should this be two functions or one constructor(){ //create mappings for campapign that has campapign id and campapign contract addresses //deposit function that creates a new contract instance for the protocol //deposit function should also set msg.sender as owner of new contract } emit Deposited(campaignID, payoutAmount); } payout(){} endCampaign(){ //modifier is owner //end campaign and withdraw funds if they are funds left after the duration of campaign ended. //end campaign if the funds ran out before the campaign ends. } }
should this be two functions or onecreate mappings for campapign that has campapign id and campapign contract addressesdeposit function that creates a new contract instance for the protocoldeposit function should also set msg.sender as owner of new contract
deposit(int256 _payoutAmount) { constructor(){ } emit Deposited(campaignID, payoutAmount); }
12,762,770
[ 1, 4625, 348, 7953, 560, 30, 1410, 333, 506, 2795, 4186, 578, 1245, 2640, 7990, 364, 20787, 438, 724, 716, 711, 20787, 438, 724, 612, 471, 20787, 438, 724, 6835, 6138, 323, 1724, 445, 716, 3414, 279, 394, 6835, 791, 364, 326, 1771, 323, 1724, 445, 1410, 2546, 444, 1234, 18, 15330, 487, 3410, 434, 394, 6835, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 7734, 443, 1724, 12, 474, 5034, 389, 84, 2012, 6275, 13, 288, 203, 10792, 3885, 1435, 95, 203, 10792, 289, 203, 10792, 3626, 4019, 538, 16261, 12, 14608, 734, 16, 293, 2012, 6275, 1769, 203, 203, 7734, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/5/0x5911a979e00C4847B2BE34F733e59cF6885fC48A/sources/contracts/claim/factory/FairQueue.sol
* calculate a speed at which the queue is exhausted such that all users complete the queue by maxDelayTime/* @dev the random value from which a distance will be calculated for each address. Reset the random value to shuffle the delays for all addresses./
function __FairQueue_init(uint160 _maxDelayTime, uint160 salt) internal { _setDelay(_maxDelayTime); _setPseudorandomValue(salt); }
1,891,639
[ 1, 4625, 348, 7953, 560, 30, 380, 4604, 279, 8632, 622, 1492, 326, 2389, 353, 24948, 4123, 716, 777, 3677, 3912, 326, 2389, 635, 943, 6763, 950, 20308, 632, 5206, 326, 2744, 460, 628, 1492, 279, 3888, 903, 506, 8894, 364, 1517, 1758, 18, 7151,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3639, 389, 542, 52, 23715, 280, 2111, 620, 12, 5759, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// File: node_modules\@openzeppelin\contracts\introspection\IERC165.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File: node_modules\@openzeppelin\contracts\token\ERC1155\IERC1155.sol pragma solidity >=0.6.2 <0.8.0; /** * @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 IERC1155 is IERC165 { /** * @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; } // File: node_modules\@openzeppelin\contracts\token\ERC1155\IERC1155MetadataURI.sol pragma solidity >=0.6.2 <0.8.0; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); } // File: node_modules\@openzeppelin\contracts\token\ERC1155\IERC1155Receiver.sol pragma solidity >=0.6.0 <0.8.0; /** * _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** @dev Handles the receipt of a single ERC1155 token type. This function is called at the end of a `safeTransferFrom` after the balance has been updated. To accept the transfer, this must return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61, or its own function selector). @param operator The address which initiated the transfer (i.e. msg.sender) @param from The address which previously owned the token @param id The ID of the token being transferred @param value The amount of tokens being transferred @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns(bytes4); /** @dev Handles the receipt of a multiple ERC1155 token types. This function is called at the end of a `safeBatchTransferFrom` after the balances have been updated. To accept the transfer(s), this must return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81, or its own function selector). @param operator The address which initiated the batch transfer (i.e. msg.sender) @param from The address which previously owned the token @param ids An array containing ids of each token being transferred (order and length must match values array) @param values An array containing amounts of each token being transferred (order and length must match ids array) @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns(bytes4); } // File: node_modules\@openzeppelin\contracts\utils\Context.sol pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with 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; } } // File: node_modules\@openzeppelin\contracts\introspection\ERC165.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // File: node_modules\@openzeppelin\contracts\math\SafeMath.sol 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, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { 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) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { 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, reverting 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) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * 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); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // File: node_modules\@openzeppelin\contracts\utils\Address.sol pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin\contracts\token\ERC1155\ERC1155.sol pragma solidity >=0.6.0 <0.8.0; /** * * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using SafeMath for uint256; using Address for address; // Mapping from token ID to account balances mapping (uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping (address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /* * bytes4(keccak256('balanceOf(address,uint256)')) == 0x00fdd58e * bytes4(keccak256('balanceOfBatch(address[],uint256[])')) == 0x4e1273f4 * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('safeTransferFrom(address,address,uint256,uint256,bytes)')) == 0xf242432a * bytes4(keccak256('safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)')) == 0x2eb2c2d6 * * => 0x00fdd58e ^ 0x4e1273f4 ^ 0xa22cb465 ^ * 0xe985e9c5 ^ 0xf242432a ^ 0x2eb2c2d6 == 0xd9b67a26 */ bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26; /* * bytes4(keccak256('uri(uint256)')) == 0x0e89341c */ bytes4 private constant _INTERFACE_ID_ERC1155_METADATA_URI = 0x0e89341c; /** * @dev See {_setURI}. */ constructor (string memory uri_) public { _setURI(uri_); // register the supported interfaces to conform to ERC1155 via ERC165 _registerInterface(_INTERFACE_ID_ERC1155); // register the supported interfaces to conform to ERC1155MetadataURI via ERC165 _registerInterface(_INTERFACE_ID_ERC1155_METADATA_URI); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) external view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: balance query for the zero address"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] memory accounts, uint256[] memory ids ) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(_msgSender() != operator, "ERC1155: setting approval status for self"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require(to != address(0), "ERC1155: transfer to the zero address"); require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not owner nor approved" ); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][from] = _balances[id][from].sub(amount, "ERC1155: insufficient balance for transfer"); _balances[id][to] = _balances[id][to].add(amount); emit TransferSingle(operator, from, to, id, amount); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: transfer caller is not owner nor approved" ); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; _balances[id][from] = _balances[id][from].sub( amount, "ERC1155: insufficient balance for transfer" ); _balances[id][to] = _balances[id][to].add(amount); } emit TransferBatch(operator, from, to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`. * * Emits a {TransferSingle} event. * * Requirements: * * - `account` cannot be the zero address. * - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint(address account, uint256 id, uint256 amount, bytes memory data) internal virtual { require(account != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][account] = _balances[id][account].add(amount); emit TransferSingle(operator, address(0), account, id, amount); _doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * 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 _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint i = 0; i < ids.length; i++) { _balances[ids[i]][to] = amounts[i].add(_balances[ids[i]][to]); } emit TransferBatch(operator, address(0), to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `account` * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens of token type `id`. */ function _burn(address account, uint256 id, uint256 amount) internal virtual { require(account != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), ""); _balances[id][account] = _balances[id][account].sub( amount, "ERC1155: burn amount exceeds balance" ); emit TransferSingle(operator, account, address(0), id, amount); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal virtual { require(account != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, account, address(0), ids, amounts, ""); for (uint i = 0; i < ids.length; i++) { _balances[ids[i]][account] = _balances[ids[i]][account].sub( amounts[i], "ERC1155: burn amount exceeds balance" ); } emit TransferBatch(operator, account, address(0), ids, amounts); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { } function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver(to).onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (bytes4 response) { if (response != IERC1155Receiver(to).onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } } // File: @openzeppelin\contracts\token\ERC721\IERC721.sol pragma solidity >=0.6.2 <0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // File: @openzeppelin\contracts\utils\EnumerableSet.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // File: contracts\TokenSign.sol pragma solidity ^0.6.0; /** * * @dev Implementation of the one and only TokenSign Signature Token. * Written by Ryley Ohlsen & Cody Ohlsen, 03.09.2021. * * See https://eips.ethereum.org/EIPS/eip-1155 * Extends openzeppelin ERC1155.sol; see: https://docs.openzeppelin.com/contracts/3.x/erc1155 */ contract TokenSign is ERC1155 { /** * @dev Emitted when 'owner' signs NFT 'nftAddr', 'nftTokenId' with Signature Token 'sigTokenId'. */ event Sign(address owner, uint256 indexed sigTokenId, address indexed nftAddr, uint256 indexed nftTokenId); /** * @dev Emitted when minter mints Signature Tokens as minter index 'minterId' with name 'name'. */ event Mint(address indexed minter, uint256 indexed minterId, string name, bool isFounder); // Add the openzeppelin library methods using EnumerableSet for EnumerableSet.UintSet; /** * Token types: * uint | description * 0 = PLATINUM * 1 = GOLD * 2 = SILVER * 3 = INK * 4 = DEV * 5 = FOUNDER */ /* * number of each signature token type to mint, per address, only once */ uint256 public constant N_PLATINUM = 3; uint256 public constant N_GOLD = 9; uint256 public constant N_SILVER = 200; // effectively unlimited ink tokens, minter can do whatever they please uint256 public constant N_INK = 1000; // devs receive a dev signature token to commemorate every minting, run the front end uint256 public constant N_DEV = 1; // special first year - minter receives single founder signature token uint256 public constant N_FOUNDER = 1; // token ids per set uint256 private constant TOKEN_IDS_PER_SET = 6; bool public foundingEventActive = true; uint256 public birthTime; uint256 private constant SECONDS_IN_YEAR = 31556952; // error messages string private constant DUPLICATE_MINT_ERROR = "DUPLICATE MINT ERROR: Minting only allowed once per address"; string private constant END_FOUNDERS_ERROR = "END FOUNDERS ERROR: The founder's event lasts 1 year"; string private constant FOUNDERS_ALREADY_OVER = "FOUNDERS OVER: The founder's event is already over"; string private constant OWNERSHIP_ERROR = "OWNERSHIP ERROR: Only the owner of an ERC-721 may sign it"; string private constant ALREADY_SIGNED_ERROR = "ALREADY SIGNED ERROR: An ERC-721 may only be signed once by each Signature Token ID"; // util constants uint256 private constant N_BURN = 1; // next token id to mint uint256 public nextTokenId = 0; // map of ERC-721 addresses to ERC-721 tokenId to EnumerableSet of signatureTokenIds that have signed the ERC-721 mapping(address => mapping(uint256 => EnumerableSet.UintSet)) private signatures; // map of minter address to bool representing if an address has minted mapping(address => bool) public hasMinted; // dev address address public devs; constructor() public ERC1155("https://api.tokensign.app/item/{id}.json") { birthTime = block.timestamp; // record who the devs are devs = msg.sender; // mint first signatures ever to the devs mint("TokenSign Creators"); } /** * Mint your signature tokens! * @param name: Minter's name. Whatever the minter wants it to be. Can never be changed. */ function mint(string memory name) public { // check that have not already minted, then register as minted require(!hasMinted[msg.sender], DUPLICATE_MINT_ERROR); hasMinted[msg.sender] = true; uint256 tmpId = nextTokenId; // build up for batch mint if (foundingEventActive) { uint256[] memory ids = new uint256[](TOKEN_IDS_PER_SET-1); uint256[] memory amounts = new uint256[](TOKEN_IDS_PER_SET-1); ids[0] = tmpId; amounts[0] = N_PLATINUM; ids[1] = tmpId+1; amounts[1] = N_GOLD; ids[2] = tmpId+2; amounts[2] = N_SILVER; ids[3] = tmpId+3; amounts[3] = N_INK; ids[4] = tmpId+5; // intentional! amounts[4] = N_FOUNDER; _mintBatch(msg.sender, ids, amounts, ""); } else { uint256[] memory ids = new uint256[](TOKEN_IDS_PER_SET-2); uint256[] memory amounts = new uint256[](TOKEN_IDS_PER_SET-2); ids[0] = tmpId; amounts[0] = N_PLATINUM; ids[1] = tmpId+1; amounts[1] = N_GOLD; ids[2] = tmpId+2; amounts[2] = N_SILVER; ids[3] = tmpId+3; amounts[3] = N_INK; _mintBatch(msg.sender, ids, amounts, ""); } _mint(devs, tmpId+4, N_DEV, ""); // emit Mint event emit Mint(msg.sender, nextTokenId.div(TOKEN_IDS_PER_SET), name, foundingEventActive); nextTokenId += TOKEN_IDS_PER_SET; } /** * Anyone can call to end the founder event after the first year has passed */ function endFounderEvent() external { require(birthTime + SECONDS_IN_YEAR < block.timestamp, END_FOUNDERS_ERROR); require(foundingEventActive, FOUNDERS_ALREADY_OVER); foundingEventActive = false; } /** * Call sign to sign any ERC-721 owned by msg.sender with a signature token, * while also burning your signature token. * * @param nftAddr: address of NFT to be signed * @param nftTokenId: tokenId of NFT to be signed, at nftAddr * @param sigTokenId: signature tokenId to sign with (in this contract) */ function sign(address nftAddr, uint256 nftTokenId, uint256 sigTokenId) external { // sender must own the NFT to be signed IERC721 ERC721 = IERC721(nftAddr); require(ERC721.ownerOf(nftTokenId) == msg.sender, OWNERSHIP_ERROR); // burn the signature token _burn(msg.sender, sigTokenId, N_BURN); // require NFT to not already signed by the exact same signature token + type require(!signatures[nftAddr][nftTokenId].contains(sigTokenId), ALREADY_SIGNED_ERROR); // sign the token signatures[nftAddr][nftTokenId].add(sigTokenId); // emit Sign event emit Sign(msg.sender, sigTokenId, nftAddr, nftTokenId); } // ALL FUNCTIONS AFTER THIS POINT ARE READ-ONLY /** * Returns number of signatures currently on a given ERC-721 NFT * * @param nftAddr: address of ERC-721 NFT to be queried * @param nftTokenId: tokenId of ERC-721 NFT to be queried, at nftAddr * @return uint256 quantity of signatures on the queried ERC-721 NFT */ function nftSignatureQuantity(address nftAddr, uint256 nftTokenId) external view returns (uint256) { return signatures[nftAddr][nftTokenId].length(); } /** * Returns the signature token ID that signed at a specific index for a given ERC-721 NFT * * @param nftAddr: address of ERC-721 NFT to be queried * @param nftTokenId: tokenId of ERC-721 NFT to be queried, at nftAddr * @param index: index of signature token ID to return * @return uint256 signature token id at queried index */ function nftSignatureIdAtIndex(address nftAddr, uint256 nftTokenId, uint256 index) external view returns (uint256) { return signatures[nftAddr][nftTokenId].at(index); } }
* @dev See {IERC1155-safeBatchTransferFrom}./
function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: transfer caller is not owner nor approved" ); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; _balances[id][from] = _balances[id][from].sub( amount, "ERC1155: insufficient balance for transfer" ); _balances[id][to] = _balances[id][to].add(amount); } emit TransferBatch(operator, from, to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); }
11,817,094
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 2164, 288, 45, 654, 39, 2499, 2539, 17, 4626, 4497, 5912, 1265, 5496, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 3639, 445, 4183, 4497, 5912, 1265, 12, 203, 5411, 1758, 628, 16, 203, 5411, 1758, 358, 16, 203, 5411, 2254, 5034, 8526, 3778, 3258, 16, 203, 5411, 2254, 5034, 8526, 3778, 30980, 16, 203, 5411, 1731, 3778, 501, 203, 3639, 262, 203, 5411, 1071, 203, 5411, 5024, 203, 5411, 3849, 203, 3639, 288, 203, 5411, 2583, 12, 2232, 18, 2469, 422, 30980, 18, 2469, 16, 315, 654, 39, 2499, 2539, 30, 3258, 471, 30980, 769, 13484, 8863, 203, 5411, 2583, 12, 869, 480, 1758, 12, 20, 3631, 315, 654, 39, 2499, 2539, 30, 7412, 358, 326, 3634, 1758, 8863, 203, 5411, 2583, 12, 203, 7734, 628, 422, 389, 3576, 12021, 1435, 747, 353, 31639, 1290, 1595, 12, 2080, 16, 389, 3576, 12021, 1435, 3631, 203, 7734, 315, 654, 39, 2499, 2539, 30, 7412, 4894, 353, 486, 3410, 12517, 20412, 6, 203, 5411, 11272, 203, 203, 5411, 1758, 3726, 273, 389, 3576, 12021, 5621, 203, 203, 5411, 389, 5771, 1345, 5912, 12, 9497, 16, 628, 16, 358, 16, 3258, 16, 30980, 16, 501, 1769, 203, 203, 5411, 364, 261, 11890, 5034, 277, 273, 374, 31, 277, 411, 3258, 18, 2469, 31, 965, 77, 13, 288, 203, 7734, 2254, 5034, 612, 273, 3258, 63, 77, 15533, 203, 7734, 2254, 5034, 3844, 273, 30980, 63, 77, 15533, 203, 203, 7734, 389, 70, 26488, 63, 350, 6362, 2080, 65, 273, 389, 70, 26488, 63, 350, 6362, 2080, 8009, 1717, 12, 203, 10792, 3844, 16, 203, 10792, 315, 654, 39, 2499, 2539, 30, 2763, 11339, 11013, 364, 7412, 6, 203, 7734, 11272, 203, 7734, 389, 70, 26488, 63, 350, 6362, 869, 65, 273, 389, 70, 26488, 63, 350, 6362, 869, 8009, 1289, 12, 8949, 1769, 203, 5411, 289, 203, 203, 5411, 3626, 12279, 4497, 12, 9497, 16, 628, 16, 358, 16, 3258, 16, 30980, 1769, 203, 203, 5411, 389, 2896, 9890, 4497, 5912, 5933, 1359, 1564, 12, 9497, 16, 628, 16, 358, 16, 3258, 16, 30980, 16, 501, 1769, 203, 3639, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// SPDX-License-Identifier: GPL-3.0 // solhint-disable no-empty-blocks // solhint-disable not-rely-on-time pragma solidity ^0.8.0; import "./XPowerNftBase.sol"; /** * Abstract base class for staked XPowerNft(s): Contract owner only is allowed * to mint and burn XPowerNftStaked tokens. */ abstract contract XPowerNftStaked is XPowerNftBase { /** map of mints: account => nft-id => accumulator [seconds] */ mapping(address => mapping(uint256 => uint256)) private _mints; /** map of burns: account => nft-id => accumulator [seconds] */ mapping(address => mapping(uint256 => uint256)) private _burns; /** map of total mints: nft-id => accumulator [seconds] */ mapping(uint256 => uint256) private _mintsTotal; /** map of total burns: nft-id => accumulator [seconds] */ mapping(uint256 => uint256) private _burnsTotal; /** @param uri meta-data URI */ /** @param base address of old contract */ /** @param deadlineIn seconds to end-of-migration */ constructor( string memory uri, address base, uint256 deadlineIn ) XPowerNftBase(uri, base, deadlineIn) {} /** transfer tokens (and reset age) */ function safeTransferFrom( address from, address to, uint256 nftId, uint256 amount, bytes memory data ) public override { _pushBurn(from, nftId, amount); _pushMint(to, nftId, amount); super.safeTransferFrom(from, to, nftId, amount, data); } /** batch transfer tokens (and reset age) */ function safeBatchTransferFrom( address from, address to, uint256[] memory nftIds, uint256[] memory amounts, bytes memory data ) public override { _pushBurnBatch(from, nftIds, amounts); _pushMintBatch(to, nftIds, amounts); super.safeBatchTransferFrom(from, to, nftIds, amounts, data); } /** mint particular amount of staked NFTs for given address and nft-id */ function mint( address to, uint256 nftId, uint256 amount ) public onlyOwner { _pushMint(to, nftId, amount); _mint(to, nftId, amount, ""); } /** mint particular amounts of staked NFTs for given address and nft-ids */ function mintBatch( address to, uint256[] memory nftIds, uint256[] memory amounts ) public onlyOwner { _pushMintBatch(to, nftIds, amounts); _mintBatch(to, nftIds, amounts, ""); } /** burn particular amount of staked NFTs for given address and nft-id */ function burn( address from, uint256 nftId, uint256 amount ) public override onlyOwner { _pushBurn(from, nftId, amount); _burn(from, nftId, amount); } /** burn particular amounts of staked NFTs for given address and nft-ids */ function burnBatch( address from, uint256[] memory nftIds, uint256[] memory amounts ) public override onlyOwner { _pushBurnBatch(from, nftIds, amounts); _burnBatch(from, nftIds, amounts); } /** @return age seconds over all stakes for given address and nft-id */ function ageOf(address account, uint256 nftId) public view returns (uint256) { uint256 mints = _mints[account][nftId]; uint256 burns = _burns[account][nftId]; if (mints > burns) { uint256 balance = balanceOf(account, nftId); uint256 difference = mints - burns; return balance * block.timestamp - difference; } return 0; } /** @return age seconds totalled over all stakes for given nft-id */ function totalAgeOf(uint256 nftId) public view returns (uint256) { uint256 mintsTotal = _mintsTotal[nftId]; uint256 burnsTotal = _burnsTotal[nftId]; if (mintsTotal > burnsTotal) { uint256 supply = totalSupply(nftId); uint256 difference = mintsTotal - burnsTotal; return supply * block.timestamp - difference; } return 0; } /** remember mint action */ function _pushMint( address account, uint256 nftId, uint256 amount ) internal { require(amount > 0, "non-positive amount"); _mints[account][nftId] += amount * block.timestamp; _mintsTotal[nftId] += amount * block.timestamp; } /** remember mint actions */ function _pushMintBatch( address account, uint256[] memory nftIds, uint256[] memory amounts ) internal { assert(nftIds.length == amounts.length); for (uint256 i = 0; i < nftIds.length; i++) { _pushMint(account, nftIds[i], amounts[i]); } } /** remember burn action */ function _pushBurn( address account, uint256 nftId, uint256 amount ) internal { require(amount > 0, "non-positive amount"); _burns[account][nftId] += amount * block.timestamp; _burnsTotal[nftId] += amount * block.timestamp; } /** remember burn actions */ function _pushBurnBatch( address account, uint256[] memory nftIds, uint256[] memory amounts ) internal { assert(nftIds.length == amounts.length); for (uint256 i = 0; i < nftIds.length; i++) { _pushBurn(account, nftIds[i], amounts[i]); } } } /** * Staked NFT class for THOR tokens. */ contract XPowerThorNftStaked is XPowerNftStaked { /** @param uri meta-data URI */ /** @param base address of old contract */ /** @param deadlineIn seconds to end-of-migration */ constructor( string memory uri, address base, uint256 deadlineIn ) XPowerNftStaked(uri, base, deadlineIn) {} } /** * Staked NFT class for LOKI tokens. */ contract XPowerLokiNftStaked is XPowerNftStaked { /** @param uri meta-data URI */ /** @param base address of old contract */ /** @param deadlineIn seconds to end-of-migration */ constructor( string memory uri, address base, uint256 deadlineIn ) XPowerNftStaked(uri, base, deadlineIn) {} } /** * Staked NFT class for ODIN tokens. */ contract XPowerOdinNftStaked is XPowerNftStaked { /** @param uri meta-data URI */ /** @param base address of old contract */ /** @param deadlineIn seconds to end-of-migration */ constructor( string memory uri, address base, uint256 deadlineIn ) XPowerNftStaked(uri, base, deadlineIn) {} }
* mint particular amounts of staked NFTs for given address and nft-ids */
function mintBatch( address to, uint256[] memory nftIds, uint256[] memory amounts ) public onlyOwner { _pushMintBatch(to, nftIds, amounts); _mintBatch(to, nftIds, amounts, ""); }
1,064,059
[ 1, 4625, 348, 7953, 560, 30, 380, 312, 474, 6826, 30980, 434, 384, 9477, 423, 4464, 87, 364, 864, 1758, 471, 290, 1222, 17, 2232, 1195, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 312, 474, 4497, 12, 203, 3639, 1758, 358, 16, 203, 3639, 2254, 5034, 8526, 3778, 290, 1222, 2673, 16, 203, 3639, 2254, 5034, 8526, 3778, 30980, 203, 565, 262, 1071, 1338, 5541, 288, 203, 3639, 389, 6206, 49, 474, 4497, 12, 869, 16, 290, 1222, 2673, 16, 30980, 1769, 203, 3639, 389, 81, 474, 4497, 12, 869, 16, 290, 1222, 2673, 16, 30980, 16, 1408, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity 0.4.21; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } interface Token { function transfer(address _to, uint256 _amount) public returns (bool success); function balanceOf(address _owner) public view returns (uint256 balance); function decimals()public view returns (uint8); function burnAllTokens() public; } /** * @title Vault * @dev This contract is used for storing funds while a crowdsale * is in progress. Funds will be transferred to owner once sale ends */ contract Vault is Ownable { using SafeMath for uint256; enum State { Active, Refunding, Withdraw } mapping (address => uint256) public deposited; address public wallet; State public state; event Withdraw(); event RefundsEnabled(); event Withdrawn(address _wallet); event Refunded(address indexed beneficiary, uint256 weiAmount); function Vault(address _wallet) public { require(_wallet != address(0)); wallet = _wallet; state = State.Active; } function deposit(address investor) public onlyOwner payable{ require(state == State.Active || state == State.Withdraw);//allowing to deposit even in withdraw state since withdraw state will be started once totalFunding reaches 10,000 ether deposited[investor] = deposited[investor].add(msg.value); } function activateWithdrawal() public onlyOwner { if(state == State.Active){ state = State.Withdraw; emit Withdraw(); } } function activateRefund()public onlyOwner { require(state == State.Active); state = State.Refunding; emit RefundsEnabled(); } function withdrawToWallet() onlyOwner public{ require(state == State.Withdraw); wallet.transfer(this.balance); emit Withdrawn(wallet); } function refund(address investor) public { require(state == State.Refunding); uint256 depositedValue = deposited[investor]; deposited[investor] = 0; investor.transfer(depositedValue); emit Refunded(investor, depositedValue); } function isRefunding()public onlyOwner view returns(bool) { return (state == State.Refunding); } } contract DroneTokenSale is Ownable{ using SafeMath for uint256; //Token to be used for this sale Token public token; //All funds will go into this vault Vault public vault; //rate of token in ether 1eth = 20000 DRONE uint256 public rate = 20000; /* *There will be 4 phases * 1. Pre-sale * 2. ICO Phase 1 * 3. ICO Phase 2 * 4. ICO Phase 3 */ struct PhaseInfo{ uint256 hardcap; uint256 startTime; uint256 endTime; uint8 [3] bonusPercentages;//3 type of bonuses above 100eth, 10-100ether, less than 10ether uint256 weiRaised; } //info of each phase PhaseInfo[] public phases; //Total funding uint256 public totalFunding; //total tokesn available for sale uint256 tokensAvailableForSale = 3000000000; uint8 public noOfPhases; //Keep track of whether contract is up or not bool public contractUp; //Keep track of whether the sale has ended or not bool public saleEnded; //Event to trigger Sale stop event SaleStopped(address _owner, uint256 time); //Event to trigger normal flow of sale end event Finalized(address _owner, uint256 time); /** * event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); //modifiers modifier _contractUp(){ require(contractUp); _; } modifier nonZeroAddress(address _to) { require(_to != address(0)); _; } modifier minEthContribution() { require(msg.value >= 0.1 ether); _; } modifier _saleEnded() { require(saleEnded); _; } modifier _saleNotEnded() { require(!saleEnded); _; } /** * @dev Check if sale contract has enough tokens on its account balance * to reward all possible participations within sale period */ function powerUpContract() external onlyOwner { // Contract should not be powered up previously require(!contractUp); // Contract should have enough DRONE credits require(token.balanceOf(this) >= tokensAvailableForSale); //activate the sale process contractUp = true; } //for Emergency/Hard stop of the sale function emergencyStop() external onlyOwner _contractUp _saleNotEnded{ saleEnded = true; if(totalFunding < 10000 ether){ vault.activateRefund(); } else{ vault.activateWithdrawal(); } emit SaleStopped(msg.sender, now); } /** * @dev Must be called after sale ends, to do some extra finalization * work. Calls the contract's finalization function. */ function finalize()public onlyOwner _contractUp _saleNotEnded{ require(saleTimeOver()); saleEnded = true; if(totalFunding < 10000 ether){ vault.activateRefund(); } else{ vault.activateWithdrawal(); } emit Finalized(msg.sender, now); } // @return true if all the tiers has been ended function saleTimeOver() public view returns (bool) { return now > phases[noOfPhases-1].endTime; } //if crowdsales is over, the money rasied should be transferred to the wallet address function withdrawFunds() public onlyOwner{ vault.withdrawToWallet(); } //method to refund money function getRefund()public { vault.refund(msg.sender); } /** * @dev Can be called only once. The method to allow owner to set tier information * @param _noOfPhases The integer to set number of tiers * @param _startTimes The array containing start time of each tier * @param _endTimes The array containing end time of each tier * @param _hardCaps The array containing hard cap for each tier * @param _bonusPercentages The array containing bonus percentage for each tier * The arrays should be in sync with each other. For each index 0 for each of the array should contain info about Tier 1, similarly for Tier2, 3 and 4 . * Sales hard cap will be the hard cap of last tier */ function setTiersInfo(uint8 _noOfPhases, uint256[] _startTimes, uint256[] _endTimes, uint256[] _hardCaps, uint8[3][4] _bonusPercentages)private { require(_noOfPhases==4); //Each array should contain info about each tier require(_startTimes.length == _noOfPhases); require(_endTimes.length==_noOfPhases); require(_hardCaps.length==_noOfPhases); require(_bonusPercentages.length==_noOfPhases); noOfPhases = _noOfPhases; for(uint8 i=0;i<_noOfPhases;i++){ require(_hardCaps[i]>0); require(_endTimes[i]>_startTimes[i]); if(i>0){ //start time of this tier should be greater than previous tier require(_startTimes[i] > _endTimes[i-1]); phases.push(PhaseInfo({ hardcap:_hardCaps[i], startTime:_startTimes[i], endTime:_endTimes[i], bonusPercentages:_bonusPercentages[i], weiRaised:0 })); } else{ //start time of tier1 should be greater than current time require(_startTimes[i]>now); phases.push(PhaseInfo({ hardcap:_hardCaps[i], startTime:_startTimes[i], endTime:_endTimes[i], bonusPercentages:_bonusPercentages[i], weiRaised:0 })); } } } /** * @dev Constructor method * @param _tokenToBeUsed Address of the token to be used for Sales * @param _wallet Address of the wallet which will receive the collected funds */ function DroneTokenSale(address _tokenToBeUsed, address _wallet)public nonZeroAddress(_tokenToBeUsed) nonZeroAddress(_wallet){ token = Token(_tokenToBeUsed); vault = new Vault(_wallet); uint256[] memory startTimes = new uint256[](4); uint256[] memory endTimes = new uint256[](4); uint256[] memory hardCaps = new uint256[](4); uint8[3] [4] memory bonusPercentages; //pre-sales startTimes[0] = 1522321200; //MARCH 29, 2018 11:00 AM GMT endTimes[0] = 1523790000; //APRIL 15, 2018 11:00 AM GMT hardCaps[0] = 10000 ether; bonusPercentages[0][0] = 35; bonusPercentages[0][1] = 30; bonusPercentages[0][2] = 25; //phase-1 startTimes[1] = 1525172460; //MAY 01, 2018 11:01 AM GMT endTimes[1] = 1526382000; //MAY 15, 2018 11:00 AM GMT hardCaps[1] = 20000 ether; bonusPercentages[1][0] = 25;// above 100 ether bonusPercentages[1][1] = 20;// 10<=x<=100 bonusPercentages[1][2] = 15;// less than 10 ether //phase-2 startTimes[2] = 1526382060; //MAY 15, 2018 11:01 AM GMT endTimes[2] = 1527850800; //JUNE 01, 2018 11:00 AM GMT hardCaps[2] = 30000 ether; bonusPercentages[2][0] = 15; bonusPercentages[2][1] = 10; bonusPercentages[2][2] = 5; //phase-3 startTimes[3] = 1527850860; //JUNE 01, 2018 11:01 AM GMT endTimes[3] = 1533034800; //JULY 31, 2018 11:OO AM GMT hardCaps[3] = 75000 ether; bonusPercentages[3][0] = 0; bonusPercentages[3][1] = 0; bonusPercentages[3][2] = 0; setTiersInfo(4, startTimes, endTimes, hardCaps, bonusPercentages); } //Fallback function used to buytokens function()public payable{ buyTokens(msg.sender); } /** * @dev Low level token purchase function * @param beneficiary The address who will receive the tokens for this transaction */ function buyTokens(address beneficiary)public _contractUp _saleNotEnded minEthContribution nonZeroAddress(beneficiary) payable returns(bool){ int8 currentPhaseIndex = getCurrentlyRunningPhase(); assert(currentPhaseIndex>=0); // recheck this for storage and memory PhaseInfo storage currentlyRunningPhase = phases[uint256(currentPhaseIndex)]; uint256 weiAmount = msg.value; //Check hard cap for this phase has not been reached require(weiAmount.add(currentlyRunningPhase.weiRaised) <= currentlyRunningPhase.hardcap); uint256 tokens = weiAmount.mul(rate).div(1000000000000000000);//considering decimal places to be zero for token uint256 bonusedTokens = applyBonus(tokens, currentlyRunningPhase.bonusPercentages, weiAmount); totalFunding = totalFunding.add(weiAmount); currentlyRunningPhase.weiRaised = currentlyRunningPhase.weiRaised.add(weiAmount); vault.deposit.value(msg.value)(msg.sender); token.transfer(beneficiary, bonusedTokens); emit TokenPurchase(msg.sender, beneficiary, weiAmount, bonusedTokens); return true; } /** *@dev Method to calculate bonus for the user as per currently running phase and contribution by the user * @param tokens Total tokens purchased by the user * @param percentages Array of bonus percentages for the phase as per ethers sent * @param weiSent Amount of ethers(in form of wei) sent by the user */ function applyBonus(uint256 tokens, uint8 [3]percentages, uint256 weiSent) private pure returns (uint256) { uint256 tokensToAdd = 0; if(weiSent<10 ether){ tokensToAdd = tokens.mul(percentages[2]).div(100); } else if(weiSent>=10 ether && weiSent<=100 ether){ tokensToAdd = tokens.mul(percentages[1]).div(100); } else{ tokensToAdd = tokens.mul(percentages[0]).div(100); } return tokens.add(tokensToAdd); } /** * @dev returns the currently running tier index as per time * Return -1 if no tier is running currently * */ function getCurrentlyRunningPhase()public view returns(int8){ for(uint8 i=0;i<noOfPhases;i++){ if(now>=phases[i].startTime && now<=phases[i].endTime){ return int8(i); } } return -1; } /** * @dev Get functing info of user/address. It will return how much funding the user has made in terms of wei */ function getFundingInfoForUser(address _user)public view nonZeroAddress(_user) returns(uint256){ return vault.deposited(_user); } /** *@dev Method to check whether refund process has been initiated or not by the contract. */ function isRefunding()public view returns(bool) { return vault.isRefunding(); } /** *@dev Method to burn all remanining tokens left with the sales contract after the sale has ended */ function burnRemainingTokens()public onlyOwner _contractUp _saleEnded { token.burnAllTokens(); } /** * @dev Method to activate withdrawal of funds even in between of sale. The WIthdrawal will only be activate iff totalFunding has reached 10,000 ether */ function activateWithdrawal()public onlyOwner _saleNotEnded _contractUp { require(totalFunding >= 10000 ether); vault.activateWithdrawal(); } }
* @dev Check if sale contract has enough tokens on its account balance to reward all possible participations within sale period/ Contract should not be powered up previously Contract should have enough DRONE creditsactivate the sale process
function powerUpContract() external onlyOwner { require(!contractUp); require(token.balanceOf(this) >= tokensAvailableForSale); contractUp = true; }
5,546,995
[ 1, 4625, 348, 7953, 560, 30, 380, 377, 632, 5206, 2073, 309, 272, 5349, 6835, 711, 7304, 2430, 603, 2097, 2236, 11013, 377, 358, 19890, 777, 3323, 30891, 1012, 3470, 272, 5349, 3879, 19, 13456, 1410, 486, 506, 7212, 329, 731, 7243, 13456, 1410, 1240, 7304, 16801, 5998, 6197, 1282, 10014, 326, 272, 5349, 1207, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 7212, 1211, 8924, 1435, 3903, 1338, 5541, 288, 203, 3639, 2583, 12, 5, 16351, 1211, 1769, 203, 203, 3639, 2583, 12, 2316, 18, 12296, 951, 12, 2211, 13, 1545, 2430, 5268, 1290, 30746, 1769, 203, 540, 203, 540, 203, 4202, 203, 3639, 6835, 1211, 273, 638, 31, 203, 565, 289, 203, 377, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
/* website: https://cityswap.io/ ██████╗ ███████╗██╗ ██╗██╗███╗ ██╗ ██████╗ ██████╗██╗████████╗██╗ ██╗ ██╔══██╗██╔════╝██║ ██║██║████╗ ██║██╔════╝ ██╔════╝██║╚══██╔══╝╚██╗ ██╔╝ ██████╔╝█████╗ ██║ ██║██║██╔██╗ ██║██║ ███╗ ██║ ██║ ██║ ╚████╔╝ ██╔══██╗██╔══╝ ██║██ ██║██║██║╚██╗██║██║ ██║ ██║ ██║ ██║ ╚██╔╝ ██████╔╝███████╗██║╚█████╔╝██║██║ ╚████║╚██████╔╝ ╚██████╗██║ ██║ ██║ ╚═════╝ ╚══════╝╚═╝ ╚════╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ */ pragma solidity ^0.6.12; /* * @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; } } /** * @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); } /** * @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; } } /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // beijingtoken with Governance. contract beijingtoken is ERC20("BEIJING.CITY.finance", "BEIJING"), Ownable { uint256 public constant MAX_SUPPLY = 17550000 * 10**18; /** * @notice Creates `_amount` token to `_to`. Must only be called by the owner (TravelAgency). */ function mint(address _to, uint256 _amount) public onlyOwner { uint256 _totalSupply = totalSupply(); if(_totalSupply.add(_amount) > MAX_SUPPLY) { _amount = MAX_SUPPLY.sub(_totalSupply); } require(_totalSupply.add(_amount) <= MAX_SUPPLY); _mint(_to, _amount); } } contract BeijingTokenAgency is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. // // We do some fancy math here. Basically, any point in time, the amount of BeijingTokens // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accBeijingTokenPerShare) - user.rewardDebt // // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens: // 1. The pool's `accBeijingTokenPerShare` (and `lastRewardBlock`) gets updated. // 2. User receives the pending reward sent to his/her address. // 3. User's `amount` gets updated. // 4. User's `rewardDebt` gets updated. } // Info of each pool. struct PoolInfo { IERC20 lpToken; // Address of LP token contract. uint256 allocPoint; // How many allocation points assigned to this pool. BeijingTokens to distribute per block. uint256 lastRewardBlock; // Last block number that BeijingTokens distribution occurs. uint256 accBeijingTokenPerShare; // Accumulated BeijingTokens per share, times 1e12. See below. } // The BEIJING TOKEN! beijingtoken public beijing; // Dev address. address public devaddr; // Block number when bonus BEIJING period ends. uint256 public bonusEndBlock; // BeijingTokens created per block. uint256 public beijingPerBlock; // Bonus muliplier for early BEIJING makers. uint256 public constant BONUS_MULTIPLIER = 1; // no bonus // Info of each pool. PoolInfo[] public poolInfo; // Info of each user that stakes LP tokens. mapping (uint256 => mapping (address => UserInfo)) public userInfo; // Total allocation poitns. Must be the sum of all allocation points in all pools. uint256 public totalAllocPoint = 0; // The block number when BEIJING mining starts. uint256 public startBlock; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); constructor( beijingtoken _Beijing, address _devaddr, uint256 _BeijingPerBlock, uint256 _startBlock, uint256 _bonusEndBlock ) public { beijing = _Beijing; devaddr = _devaddr; beijingPerBlock = _BeijingPerBlock; bonusEndBlock = _bonusEndBlock; startBlock = _startBlock; } function poolLength() external view returns (uint256) { return poolInfo.length; } // Add a new lp to the pool. Can only be called by the owner. // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. function add(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poolInfo.push(PoolInfo({ lpToken: _lpToken, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accBeijingTokenPerShare: 0 })); } // Update the given pool's Beijing allocation point. Can only be called by the owner. function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdatePools(); } totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint); poolInfo[_pid].allocPoint = _allocPoint; } // Return reward multiplier over the given _from to _to block. function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) { if (_to <= bonusEndBlock) { return _to.sub(_from).mul(BONUS_MULTIPLIER); } else if (_from >= bonusEndBlock) { return _to.sub(_from); } else { return bonusEndBlock.sub(_from).mul(BONUS_MULTIPLIER).add( _to.sub(bonusEndBlock) ); } } // View function to see pending Beijings on frontend. function pendingBeijing(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accBeijingPerShare = pool.accBeijingTokenPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 BeijingReward = multiplier.mul(beijingPerBlock).mul(pool.allocPoint).div(totalAllocPoint); accBeijingPerShare = accBeijingPerShare.add(BeijingReward.mul(1e12).div(lpSupply)); } return user.amount.mul(accBeijingPerShare).div(1e12).sub(user.rewardDebt); } // Update reward vairables for all pools. Be careful of gas spending! function massUpdatePools() public { uint256 length = poolInfo.length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(pid); } } // Update reward variables of the given pool to be up-to-date. function mint(uint256 amount) public onlyOwner{ beijing.mint(devaddr, amount); } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number; return; } uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 BeijingReward = multiplier.mul(beijingPerBlock).mul(pool.allocPoint).div(totalAllocPoint); beijing.mint(devaddr, BeijingReward.div(20)); // 5% beijing.mint(address(this), BeijingReward); pool.accBeijingTokenPerShare = pool.accBeijingTokenPerShare.add(BeijingReward.mul(1e12).div(lpSupply)); pool.lastRewardBlock = block.number; } // Deposit LP tokens to TravelAgency for BEIJING allocation. function deposit(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; updatePool(_pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accBeijingTokenPerShare).div(1e12).sub(user.rewardDebt); safeBeijingTransfer(msg.sender, pending); } pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); user.amount = user.amount.add(_amount); user.rewardDebt = user.amount.mul(pool.accBeijingTokenPerShare).div(1e12); emit Deposit(msg.sender, _pid, _amount); } // Withdraw LP tokens from TravelAgency. function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accBeijingTokenPerShare).div(1e12).sub(user.rewardDebt); safeBeijingTransfer(msg.sender, pending); user.amount = user.amount.sub(_amount); user.rewardDebt = user.amount.mul(pool.accBeijingTokenPerShare).div(1e12); pool.lpToken.safeTransfer(address(msg.sender), _amount); emit Withdraw(msg.sender, _pid, _amount); } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _pid) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; pool.lpToken.safeTransfer(address(msg.sender), user.amount); emit EmergencyWithdraw(msg.sender, _pid, user.amount); user.amount = 0; user.rewardDebt = 0; } // Safe Beijing transfer function, just in case if rounding error causes pool to not have enough BEIJINGs. function safeBeijingTransfer(address _to, uint256 _amount) internal { uint256 beijingBal = beijing.balanceOf(address(this)); if (_amount > beijingBal) { beijing.transfer(_to, beijingBal); } else { beijing.transfer(_to, _amount); } } // Update dev address by the previous dev. function dev(address _devaddr) public { require(msg.sender == devaddr, "dev: wut?"); devaddr = _devaddr; } }
Withdraw LP tokens from TravelAgency.
function withdraw(uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; require(user.amount >= _amount, "withdraw: not good"); updatePool(_pid); uint256 pending = user.amount.mul(pool.accBeijingTokenPerShare).div(1e12).sub(user.rewardDebt); safeBeijingTransfer(msg.sender, pending); user.amount = user.amount.sub(_amount); user.rewardDebt = user.amount.mul(pool.accBeijingTokenPerShare).div(1e12); pool.lpToken.safeTransfer(address(msg.sender), _amount); emit Withdraw(msg.sender, _pid, _amount); }
6,547,391
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 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 598, 9446, 12, 11890, 5034, 389, 6610, 16, 2254, 5034, 389, 8949, 13, 1071, 288, 203, 3639, 8828, 966, 2502, 2845, 273, 2845, 966, 63, 67, 6610, 15533, 203, 3639, 25003, 2502, 729, 273, 16753, 63, 67, 6610, 6362, 3576, 18, 15330, 15533, 203, 3639, 2583, 12, 1355, 18, 8949, 1545, 389, 8949, 16, 315, 1918, 9446, 30, 486, 7494, 8863, 203, 3639, 1089, 2864, 24899, 6610, 1769, 203, 3639, 2254, 5034, 4634, 273, 729, 18, 8949, 18, 16411, 12, 6011, 18, 8981, 1919, 8302, 310, 1345, 2173, 9535, 2934, 2892, 12, 21, 73, 2138, 2934, 1717, 12, 1355, 18, 266, 2913, 758, 23602, 1769, 203, 3639, 4183, 1919, 8302, 310, 5912, 12, 3576, 18, 15330, 16, 4634, 1769, 203, 3639, 729, 18, 8949, 273, 729, 18, 8949, 18, 1717, 24899, 8949, 1769, 203, 3639, 729, 18, 266, 2913, 758, 23602, 273, 729, 18, 8949, 18, 16411, 12, 6011, 18, 8981, 1919, 8302, 310, 1345, 2173, 9535, 2934, 2892, 12, 21, 73, 2138, 1769, 203, 3639, 2845, 18, 9953, 1345, 18, 4626, 5912, 12, 2867, 12, 3576, 18, 15330, 3631, 389, 8949, 1769, 203, 3639, 3626, 3423, 9446, 12, 3576, 18, 15330, 16, 389, 6610, 16, 389, 8949, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/3/0x01ac6Cd37642b75057f733C03DcCF5826FDF7060/sources/browser/5ive/FiveBuckToken.sol
* @title Template token that can be purchased @dev World's smallest crowd sale/
contract FiveBuckToken is ERC20, Ownable { using SafeMath for uint256; mapping(address => uint256) balances; string public constant _name = "Five Buck Token"; string public constant _symbol = "5ive"; uint256 _initalSupply = 500000000*(10**18); uint256 _tokenPerUser = 3000000*(10**18); uint256 _UserAmount = 0; constructor() ERC20(_name,_symbol) { _mint(owner(), _initalSupply); } function mintForUsers(uint256 amount) public { require(msg.sender == owner()); _UserAmount+=amount; mint(amount * _tokenPerUser); } function mint(uint256 amount) internal { require(msg.sender == owner()); _mint(owner(), amount); } function burnForUsers(uint256 amount) public { require(msg.sender == owner()); _UserAmount-=amount; burn(amount * _tokenPerUser); } function burn(uint256 amount) internal { require(msg.sender == owner()); _burn(owner(), amount); } function NumberOfUsersOnThePlatform() public view returns(uint256) { return _UserAmount; } fallback() external payable { revert("The contract cannot receive ETH payments."); } receive() external payable { revert("The contract cannot receive ETH payments."); } }
8,090,492
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 2649, 5035, 1147, 716, 848, 506, 5405, 343, 8905, 632, 5206, 21820, 1807, 13541, 276, 492, 72, 272, 5349, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 16351, 478, 688, 38, 9031, 1345, 353, 4232, 39, 3462, 16, 14223, 6914, 288, 203, 565, 1450, 14060, 10477, 364, 2254, 5034, 31, 203, 377, 203, 565, 2874, 12, 2867, 516, 2254, 5034, 13, 324, 26488, 31, 203, 203, 565, 533, 1071, 5381, 389, 529, 273, 315, 42, 688, 605, 9031, 3155, 14432, 203, 565, 533, 1071, 5381, 389, 7175, 273, 315, 25, 688, 14432, 203, 565, 2254, 5034, 389, 2738, 287, 3088, 1283, 273, 1381, 12648, 21556, 2163, 636, 2643, 1769, 203, 565, 2254, 5034, 389, 2316, 2173, 1299, 273, 890, 9449, 21556, 2163, 636, 2643, 1769, 203, 565, 2254, 5034, 389, 1299, 6275, 273, 374, 31, 203, 21281, 565, 3885, 1435, 4232, 39, 3462, 24899, 529, 16, 67, 7175, 13, 203, 203, 565, 288, 203, 4202, 389, 81, 474, 12, 8443, 9334, 389, 2738, 287, 3088, 1283, 1769, 203, 565, 289, 203, 377, 203, 565, 445, 312, 474, 1290, 6588, 12, 11890, 5034, 3844, 13, 1071, 203, 565, 288, 203, 1377, 2583, 12, 3576, 18, 15330, 422, 3410, 10663, 203, 1377, 389, 1299, 6275, 15, 33, 8949, 31, 203, 1377, 312, 474, 12, 8949, 380, 389, 2316, 2173, 1299, 1769, 203, 565, 289, 203, 21281, 565, 445, 312, 474, 12, 11890, 5034, 3844, 13, 2713, 203, 565, 288, 203, 1377, 2583, 12, 3576, 18, 15330, 422, 3410, 10663, 203, 1377, 389, 81, 474, 12, 8443, 9334, 3844, 1769, 203, 565, 289, 203, 377, 203, 377, 203, 565, 445, 18305, 1290, 6588, 12, 11890, 5034, 3844, 13, 1071, 203, 565, 288, 203, 1377, 2583, 12, 3576, 18, 15330, 422, 3410, 10663, 203, 1377, 389, 1299, 6275, 17, 33, 8949, 31, 203, 1377, 18305, 12, 8949, 380, 389, 2316, 2173, 1299, 1769, 203, 565, 289, 203, 565, 445, 18305, 12, 11890, 5034, 3844, 13, 2713, 203, 565, 288, 203, 1377, 2583, 12, 3576, 18, 15330, 422, 3410, 10663, 203, 1377, 389, 70, 321, 12, 8443, 9334, 3844, 1769, 203, 565, 289, 203, 377, 203, 565, 445, 3588, 951, 6588, 1398, 1986, 8201, 1435, 1071, 1476, 1135, 12, 11890, 5034, 13, 203, 565, 288, 203, 3639, 327, 389, 1299, 6275, 31, 203, 565, 289, 203, 377, 203, 565, 5922, 1435, 3903, 8843, 429, 7010, 565, 288, 203, 3639, 15226, 2932, 1986, 6835, 2780, 6798, 512, 2455, 25754, 1199, 1769, 203, 565, 289, 203, 203, 565, 6798, 1435, 3903, 8843, 429, 7010, 565, 288, 203, 3639, 15226, 2932, 1986, 6835, 2780, 6798, 512, 2455, 25754, 1199, 1769, 203, 565, 289, 203, 97, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// File: openzeppelin-solidity/contracts/GSN/Context.sol pragma solidity ^0.5.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. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: openzeppelin-solidity/contracts/access/Roles.sol pragma solidity ^0.5.0; /** * @title Roles * @dev Library for managing addresses assigned to a Role. */ library Roles { struct Role { mapping (address => bool) bearer; } /** * @dev Give an account access to this role. */ function add(Role storage role, address account) internal { require(!has(role, account), "Roles: account already has role"); role.bearer[account] = true; } /** * @dev Remove an account's access to this role. */ function remove(Role storage role, address account) internal { require(has(role, account), "Roles: account does not have role"); role.bearer[account] = false; } /** * @dev Check if an account has this role. * @return bool */ function has(Role storage role, address account) internal view returns (bool) { require(account != address(0), "Roles: account is the zero address"); return role.bearer[account]; } } // File: openzeppelin-solidity/contracts/access/roles/WhitelistAdminRole.sol pragma solidity ^0.5.0; /** * @title WhitelistAdminRole * @dev WhitelistAdmins are responsible for assigning and removing Whitelisted accounts. */ contract WhitelistAdminRole is Context { using Roles for Roles.Role; event WhitelistAdminAdded(address indexed account); event WhitelistAdminRemoved(address indexed account); Roles.Role private _whitelistAdmins; constructor () internal { _addWhitelistAdmin(_msgSender()); } modifier onlyWhitelistAdmin() { require(isWhitelistAdmin(_msgSender()), "WhitelistAdminRole: caller does not have the WhitelistAdmin role"); _; } function isWhitelistAdmin(address account) public view returns (bool) { return _whitelistAdmins.has(account); } function addWhitelistAdmin(address account) public onlyWhitelistAdmin { _addWhitelistAdmin(account); } function renounceWhitelistAdmin() public { _removeWhitelistAdmin(_msgSender()); } function _addWhitelistAdmin(address account) internal { _whitelistAdmins.add(account); emit WhitelistAdminAdded(account); } function _removeWhitelistAdmin(address account) internal { _whitelistAdmins.remove(account); emit WhitelistAdminRemoved(account); } } // File: openzeppelin-solidity/contracts/access/roles/WhitelistedRole.sol pragma solidity ^0.5.0; /** * @title WhitelistedRole * @dev Whitelisted accounts have been approved by a WhitelistAdmin to perform certain actions (e.g. participate in a * crowdsale). This role is special in that the only accounts that can add it are WhitelistAdmins (who can also remove * it), and not Whitelisteds themselves. */ contract WhitelistedRole is Context, WhitelistAdminRole { using Roles for Roles.Role; event WhitelistedAdded(address indexed account); event WhitelistedRemoved(address indexed account); Roles.Role private _whitelisteds; modifier onlyWhitelisted() { require(isWhitelisted(_msgSender()), "WhitelistedRole: caller does not have the Whitelisted role"); _; } function isWhitelisted(address account) public view returns (bool) { return _whitelisteds.has(account); } function addWhitelisted(address account) public onlyWhitelistAdmin { _addWhitelisted(account); } function removeWhitelisted(address account) public onlyWhitelistAdmin { _removeWhitelisted(account); } function renounceWhitelisted() public { _removeWhitelisted(_msgSender()); } function _addWhitelisted(address account) internal { _whitelisteds.add(account); emit WhitelistedAdded(account); } function _removeWhitelisted(address account) internal { _whitelisteds.remove(account); emit WhitelistedRemoved(account); } } // File: openzeppelin-solidity/contracts/math/SafeMath.sol pragma solidity ^0.5.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. * * _Available since v2.4.0._ */ 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. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 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. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: openzeppelin-solidity/contracts/ownership/Secondary.sol pragma solidity ^0.5.0; /** * @dev A Secondary contract can only be used by its primary account (the one that created it). */ contract Secondary is Context { address private _primary; /** * @dev Emitted when the primary contract changes. */ event PrimaryTransferred( address recipient ); /** * @dev Sets the primary account to the one that is creating the Secondary contract. */ constructor () internal { address msgSender = _msgSender(); _primary = msgSender; emit PrimaryTransferred(msgSender); } /** * @dev Reverts if called from any account other than the primary. */ modifier onlyPrimary() { require(_msgSender() == _primary, "Secondary: caller is not the primary account"); _; } /** * @return the address of the primary. */ function primary() public view returns (address) { return _primary; } /** * @dev Transfers contract to a new primary. * @param recipient The address of new primary. */ function transferPrimary(address recipient) public onlyPrimary { require(recipient != address(0), "Secondary: new primary is the zero address"); _primary = recipient; emit PrimaryTransferred(recipient); } } // File: contracts/ERC20.sol pragma solidity ^0.5.2; interface ERC20 { function totalSupply() external view returns (uint supply); function balanceOf(address _owner) external view returns (uint balance); function transfer(address _to, uint _value) external returns (bool success); function transferFrom(address _from, address _to, uint _value) external returns (bool success); function approve(address _spender, uint _value) external returns (bool success); function allowance(address _owner, address _spender) external view returns (uint remaining); function decimals() external view returns (uint digits); event Approval(address indexed _owner, address indexed _spender, uint _value); } // File: contracts/BondingVaultInterface.sol pragma solidity ^0.5.2; interface BondingVaultInterface { function fundWithReward(address payable _donor) external payable; function getEthKidsToken() external view returns (address); function calculateReward(uint256 _ethAmount) external view returns (uint256 _tokenAmount); function calculateReturn(uint256 _tokenAmount) external view returns (uint256 _returnEth); function sweepVault(address payable _operator) external; function addWhitelisted(address account) external; function removeWhitelisted(address account) external; } // File: contracts/YieldVaultInterface.sol pragma solidity ^0.5.8; interface YieldVaultInterface { function withdraw(address _token, address _atoken, uint _amount) external; function addWhitelisted(address account) external; function removeWhitelisted(address account) external; } // File: contracts/RegistryInterface.sol pragma solidity ^0.5.2; interface RegistryInterface { function getCurrencyConverter() external view returns (address); function getBondingVault() external view returns (BondingVaultInterface); function yieldVault() external view returns (YieldVaultInterface); function getCharityVaults() external view returns (address[] memory); function communityCount() external view returns (uint256); } // File: contracts/RegistryAware.sol pragma solidity ^0.5.2; interface RegistryAware { function setRegistry(address _registry) external; function getRegistry() external view returns (RegistryInterface); } // File: contracts/community/CharityVault.sol pragma solidity ^0.5.2; /** * @title CharityVault * @dev Vault which holds the assets until the community leader(s) decide to transfer * them to the actual charity destination. * Deposit and withdrawal calls come only from the actual community contract */ contract CharityVault is RegistryAware, Secondary { using SafeMath for uint256; RegistryInterface public registry; uint256 public sumStats; event LogDonationReceived( uint256 amount, address indexed account ); event LogDonationWithdrawn( uint256 amount, address indexed account ); /** * @dev 'deposit' must be used instead **/ function() external { //no 'payable' here } /** * @dev Receives some ETH and stores it. * @param _payee the donor's address. */ function deposit(address _payee) public payable { sumStats = sumStats.add(msg.value); emit LogDonationReceived(msg.value, _payee); } /** * @dev Withdraw some of accumulated balance for a _payee. */ function withdraw(address payable _payee, uint256 _payment) public onlyPrimary { require(_payment > 0 && address(this).balance >= _payment, "Insufficient funds in the charity vault"); _payee.transfer(_payment); emit LogDonationWithdrawn(_payment, _payee); } function setRegistry(address _registry) public onlyPrimary { registry = (RegistryInterface)(_registry); } function getRegistry() public view returns (RegistryInterface) { return registry; } } // File: contracts/community/IDonationCommunity.sol pragma solidity ^0.5.2; interface IDonationCommunity { function donateDelegated(address payable _donator) external payable; function name() external view returns (string memory); function charityVault() external view returns (address); } // File: contracts/community/DonationCommunity.sol pragma solidity ^0.5.2; /** * @title DonationCommunity * @dev Manages donations and owns a charity vault * Aware of the EthKidsRegistry and passes a part of donations to the whole community * The 'admin' is the community leader * The 'whitelisted' account is the EthKidsRegistry and must be specified * prior to adding to the EthKidsRegistry */ contract DonationCommunity is IDonationCommunity, RegistryAware, WhitelistedRole { using SafeMath for uint256; uint256 public constant CHARITY_DISTRIBUTION = 90; //%, the rest funds bonding curve string private _name; CharityVault public charityVault; RegistryInterface public registry; event LogDonationReceived ( address from, uint256 amount ); event LogPassToCharity ( address by, address intermediary, uint256 amount, string ipfsHash ); /** * @dev not allowed, can't store ETH **/ function() external { //no 'payable' here } /** * @dev Constructor * @param name for reference */ constructor (string memory name) public { _name = name; charityVault = new CharityVault(); } function setRegistry(address _registry) public onlyWhitelisted { registry = (RegistryInterface)(_registry); charityVault.setRegistry(_registry); } function getRegistry() public view returns (RegistryInterface) { return registry; } function allocate(uint256 donation) internal pure returns (uint256 _charityAllocation, uint256 _bondingAllocation) { uint256 _multiplier = 100; _charityAllocation = (donation).mul(CHARITY_DISTRIBUTION).div(_multiplier); _bondingAllocation = donation.sub(_charityAllocation); return (_charityAllocation, _bondingAllocation); } function myReward(uint256 _ethAmount) public view returns (uint256 tokenAmount) { (uint256 _charityAllocation, uint256 _bondingAllocation) = allocate(_ethAmount); return getRegistry().getBondingVault().calculateReward(_bondingAllocation); } function myReturn(uint256 _tokenAmount) public view returns (uint256 returnEth) { return getRegistry().getBondingVault().calculateReturn(_tokenAmount); } function donate() public payable { donateDelegated(msg.sender); } /** * @dev Donate funds on behalf of someone else. * Primary use is to pass the actual donor when the caller is a proxy, like KyberConverter * @param _donor address that will be recorded as a donor and will receive the community tokens **/ function donateDelegated(address payable _donor) public payable { require(msg.value > 0, "Must include some ETH to donate"); (uint256 _charityAllocation, uint256 _bondingAllocation) = allocate(msg.value); charityVault.deposit.value(_charityAllocation)(_donor); getRegistry().getBondingVault().fundWithReward.value(_bondingAllocation)(_donor); emit LogDonationReceived(_donor, msg.value); } /** * @dev Donate funds on behalf of someone else without being rewarded. * @param _donor address that will be recorded as a donor **/ function donateDelegatedNoReward(address payable _donor) public payable { require(msg.value > 0, "Must include some ETH to donate"); (uint256 _charityAllocation, uint256 _bondingAllocation) = allocate(msg.value); charityVault.deposit.value(_charityAllocation)(_donor); address payable bondingVaultPayable = address(uint160(address(getRegistry().getBondingVault()))); bondingVaultPayable.transfer(_bondingAllocation); emit LogDonationReceived(_donor, msg.value); } function passToCharity(uint256 _amount, address payable _intermediary, string memory _ipfsHash) public onlyWhitelistAdmin { require(_intermediary != address(0)); charityVault.withdraw(_intermediary, _amount); emit LogPassToCharity(msg.sender, _intermediary, _amount, _ipfsHash); } function passToCharityWithInterest(uint256 _amount, address payable _intermediary, string memory _ipfsHash, address _aaveToken, address _aaveAToken) public onlyWhitelistAdmin { passToCharity(_amount, _intermediary, _ipfsHash); //distribute accumulated interest amongst the communities registry.yieldVault().withdraw(_aaveToken, _aaveAToken, 0); } function name() public view returns (string memory) { return _name; } }
* @title CharityVault @dev Vault which holds the assets until the community leader(s) decide to transfer them to the actual charity destination. Deposit and withdrawal calls come only from the actual community contract/
contract CharityVault is RegistryAware, Secondary { using SafeMath for uint256; RegistryInterface public registry; uint256 public sumStats; event LogDonationReceived( uint256 amount, address indexed account ); event LogDonationWithdrawn( uint256 amount, address indexed account ); function() external { } function deposit(address _payee) public payable { sumStats = sumStats.add(msg.value); emit LogDonationReceived(msg.value, _payee); } function withdraw(address payable _payee, uint256 _payment) public onlyPrimary { require(_payment > 0 && address(this).balance >= _payment, "Insufficient funds in the charity vault"); _payee.transfer(_payment); emit LogDonationWithdrawn(_payment, _payee); } function setRegistry(address _registry) public onlyPrimary { registry = (RegistryInterface)(_registry); } function getRegistry() public view returns (RegistryInterface) { return registry; } }
2,216,789
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 2649, 3703, 560, 12003, 632, 5206, 17329, 1492, 14798, 326, 7176, 3180, 326, 19833, 10302, 12, 87, 13, 16288, 358, 7412, 2182, 358, 326, 3214, 1149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438, 1358, 1071, 4023, 31, 203, 565, 2254, 5034, 1071, 2142, 4195, 31, 203, 203, 565, 871, 1827, 22293, 367, 8872, 12, 203, 3639, 2254, 5034, 3844, 16, 203, 3639, 1758, 8808, 2236, 203, 565, 11272, 203, 565, 871, 1827, 22293, 367, 1190, 9446, 82, 12, 203, 3639, 2254, 5034, 3844, 16, 203, 3639, 1758, 8808, 2236, 203, 565, 11272, 203, 203, 203, 565, 445, 1435, 3903, 288, 203, 565, 289, 203, 203, 565, 445, 443, 1724, 12, 2867, 389, 10239, 1340, 13, 1071, 8843, 429, 288, 203, 3639, 2142, 4195, 273, 2142, 4195, 18, 1289, 12, 3576, 18, 1132, 1769, 203, 3639, 3626, 1827, 22293, 367, 8872, 12, 3576, 18, 1132, 16, 389, 10239, 1340, 1769, 203, 565, 289, 203, 203, 565, 445, 598, 9446, 12, 2867, 8843, 429, 389, 10239, 1340, 16, 2254, 5034, 389, 9261, 13, 1071, 1338, 6793, 288, 203, 3639, 2583, 24899, 9261, 405, 374, 597, 1758, 12, 2211, 2934, 12296, 1545, 389, 9261, 16, 315, 5048, 11339, 284, 19156, 316, 326, 1149, 560, 9229, 8863, 203, 3639, 389, 10239, 1340, 18, 13866, 24899, 9261, 1769, 203, 3639, 3626, 1827, 22293, 367, 1190, 9446, 82, 24899, 9261, 16, 389, 10239, 1340, 1769, 203, 565, 289, 203, 203, 565, 445, 444, 4243, 12, 2867, 389, 9893, 13, 1071, 1338, 6793, 288, 203, 3639, 4023, 273, 261, 4243, 1358, 21433, 67, 9893, 1769, 203, 565, 289, 203, 203, 565, 445, 29675, 1435, 1071, 1476, 1135, 261, 4243, 1358, 13, 288, 203, 3639, 327, 4023, 31, 203, 565, 289, 203, 203, 97, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.4.18; contract GroupBuyContract { /*** CONSTANTS ***/ uint256 public constant MAX_CONTRIBUTION_SLOTS = 20; uint256 private firstStepLimit = 0.053613 ether; uint256 private secondStepLimit = 0.564957 ether; /*** DATATYPES ***/ // @dev A Group is created for all the contributors who want to contribute // to the purchase of a particular token. struct Group { // Array of addresses of contributors in group address[] contributorArr; // Maps address to an address's position (+ 1) in the contributorArr; // 1 is added to the position because zero is the default value in the mapping mapping(address => uint256) addressToContributorArrIndex; mapping(address => uint256) addressToContribution; // user address to amount contributed bool exists; // For tracking whether a group has been initialized or not uint256 contributedBalance; // Total amount contributed uint256 purchasePrice; // Price of purchased token } // @dev A Contributor record is created for each user participating in // this group buy contract. It stores the group ids the user contributed to // and a record of their sale proceeds. struct Contributor { // Maps tokenId to an tokenId's position (+ 1) in the groupArr; // 1 is added to the position because zero is the default value in the mapping mapping(uint256 => uint) tokenIdToGroupArrIndex; // Array of tokenIds contributed to by a contributor uint256[] groupArr; bool exists; // Ledger for withdrawable balance for this user. // Funds can come from excess paid into a groupBuy, // or from withdrawing from a group, or from // sale proceeds from a token. uint256 withdrawableBalance; } /*** EVENTS ***/ /// Admin Events // @dev Event noting commission paid to contract event Commission(uint256 _tokenId, uint256 amount); /// Contract Events // @dev Event signifiying that contract received funds via fallback fn event FundsReceived(address _from, uint256 amount); /// User Events // @dev Event marking funds deposited into user _to's account event FundsDeposited(address _to, uint256 amount); // @dev Event marking a withdrawal of amount by user _to event FundsWithdrawn(address _to, uint256 amount); // @dev Event noting an interest distribution for user _to for token _tokenId. // Token Group will not be disbanded event InterestDeposited(uint256 _tokenId, address _to, uint256 amount); // @dev Event for when a contributor joins a token group _tokenId event JoinGroup( uint256 _tokenId, address contributor, uint256 groupBalance, uint256 contributionAdded ); // @dev Event for when a contributor leaves a token group event LeaveGroup( uint256 _tokenId, address contributor, uint256 groupBalance, uint256 contributionSubtracted ); // @dev Event noting sales proceeds distribution for user _to from sale of token _tokenId event ProceedsDeposited(uint256 _tokenId, address _to, uint256 amount); // @dev Event for when a token group purchases a token event TokenPurchased(uint256 _tokenId, uint256 balance); /*** STORAGE ***/ // The addresses of the accounts (or contracts) that can execute actions within each roles. address public ceoAddress; address public cfoAddress; address public cooAddress1; address public cooAddress2; address public cooAddress3; // @dev Keeps track whether the contract is paused. When that is true, most actions are blocked bool public paused = false; bool public forking = false; uint256 public activeGroups; uint256 public commissionBalance; uint256 private distributionNumerator; uint256 private distributionDenominator; CelebrityToken public linkedContract; /// @dev A mapping from token IDs to the group associated with that token. mapping(uint256 => Group) private tokenIndexToGroup; // @dev A mapping from owner address to available balance not held by a Group. mapping(address => Contributor) private userAddressToContributor; /*** ACCESS MODIFIERS ***/ /// @dev Access modifier for CEO-only functionality modifier onlyCEO() { require(msg.sender == ceoAddress); _; } /// @dev Access modifier for CFO-only functionality modifier onlyCFO() { require(msg.sender == cfoAddress); _; } /// @dev Access modifier for COO-only functionality modifier onlyCOO() { require( msg.sender == cooAddress1 || msg.sender == cooAddress2 || msg.sender == cooAddress3 ); _; } /// @dev Access modifier for contract managers only functionality modifier onlyCLevel() { require( msg.sender == ceoAddress || msg.sender == cooAddress1 || msg.sender == cooAddress2 || msg.sender == cooAddress3 || msg.sender == cfoAddress ); _; } /// @dev Modifier to allow actions only when the contract IS NOT paused modifier whenNotPaused() { require(!paused); _; } /// @dev Modifier to allow actions only when the contract IS paused modifier whenPaused { require(paused); _; } /// @dev Modifier to allow actions only when the contract IS NOT in forking mode modifier whenNotForking() { require(!forking); _; } /// @dev Modifier to allow actions only when the contract IS in forking mode modifier whenForking { require(forking); _; } /*** CONSTRUCTOR ***/ function GroupBuyContract(address contractAddress, uint256 numerator, uint256 denominator) public { ceoAddress = msg.sender; cooAddress1 = msg.sender; cooAddress2 = msg.sender; cooAddress3 = msg.sender; cfoAddress = msg.sender; distributionNumerator = numerator; distributionDenominator = denominator; linkedContract = CelebrityToken(contractAddress); } /*** PUBLIC FUNCTIONS ***/ /// @notice Fallback fn for receiving ether function() external payable { FundsReceived(msg.sender, msg.value); } /** Action Fns **/ /// @notice Backup function for activating token purchase /// requires sender to be a member of the group or CLevel /// @param _tokenId The ID of the Token group function activatePurchase(uint256 _tokenId) external whenNotPaused { var group = tokenIndexToGroup[_tokenId]; require(group.addressToContribution[msg.sender] > 0 || msg.sender == ceoAddress || msg.sender == cooAddress1 || msg.sender == cooAddress2 || msg.sender == cooAddress3 || msg.sender == cfoAddress); // Safety check that enough money has been contributed to group var price = linkedContract.priceOf(_tokenId); require(group.contributedBalance >= price); // Safety check that token had not be purchased yet require(group.purchasePrice == 0); _purchase(_tokenId, price); } /// @notice Allow user to contribute to _tokenId token group /// @param _tokenId The ID of the token group to be joined function contributeToTokenGroup(uint256 _tokenId) external payable whenNotForking whenNotPaused { address userAdd = msg.sender; // Safety check to prevent against an un expected 0x0 default. require(_addressNotNull(userAdd)); /// Safety check to make sure contributor has not already joined this group var group = tokenIndexToGroup[_tokenId]; var contributor = userAddressToContributor[userAdd]; if (!group.exists) { // Create group if not exists group.exists = true; activeGroups += 1; } else { require(group.addressToContributorArrIndex[userAdd] == 0); } if (!contributor.exists) { // Create contributor if not exists userAddressToContributor[userAdd].exists = true; } else { require(contributor.tokenIdToGroupArrIndex[_tokenId] == 0); } // Safety check to make sure group isn't currently holding onto token // or has a group record stored (for sales proceeds distribution) require(group.purchasePrice == 0); /// Safety check to ensure amount contributed is higher than min required percentage /// of purchase price uint256 tokenPrice = linkedContract.priceOf(_tokenId); require(msg.value >= uint256(SafeMath.div(tokenPrice, MAX_CONTRIBUTION_SLOTS))); // Index saved is 1 + the array's index, b/c 0 is the default value in a mapping, // so as stored on the mapping, array index will begin at 1 uint256 cIndex = tokenIndexToGroup[_tokenId].contributorArr.push(userAdd); tokenIndexToGroup[_tokenId].addressToContributorArrIndex[userAdd] = cIndex; uint256 amountNeeded = SafeMath.sub(tokenPrice, group.contributedBalance); if (msg.value > amountNeeded) { tokenIndexToGroup[_tokenId].addressToContribution[userAdd] = amountNeeded; tokenIndexToGroup[_tokenId].contributedBalance += amountNeeded; // refund excess paid userAddressToContributor[userAdd].withdrawableBalance += SafeMath.sub(msg.value, amountNeeded); FundsDeposited(userAdd, SafeMath.sub(msg.value, amountNeeded)); } else { tokenIndexToGroup[_tokenId].addressToContribution[userAdd] = msg.value; tokenIndexToGroup[_tokenId].contributedBalance += msg.value; } // Index saved is 1 + the array's index, b/c 0 is the default value in a mapping, // so as stored on the mapping, array index will begin at 1 uint256 gIndex = userAddressToContributor[userAdd].groupArr.push(_tokenId); userAddressToContributor[userAdd].tokenIdToGroupArrIndex[_tokenId] = gIndex; JoinGroup( _tokenId, userAdd, tokenIndexToGroup[_tokenId].contributedBalance, tokenIndexToGroup[_tokenId].addressToContribution[userAdd] ); // Purchase token if enough funds contributed if (tokenIndexToGroup[_tokenId].contributedBalance >= tokenPrice) { _purchase(_tokenId, tokenPrice); } } /// @notice Allow user to leave purchase group; note that their contribution /// will be added to their withdrawable balance, and not directly refunded. /// User can call withdrawBalance to retrieve funds. /// @param _tokenId The ID of the Token purchase group to be left function leaveTokenGroup(uint256 _tokenId) external whenNotPaused { address userAdd = msg.sender; var group = tokenIndexToGroup[_tokenId]; var contributor = userAddressToContributor[userAdd]; // Safety check to prevent against an unexpected 0x0 default. require(_addressNotNull(userAdd)); // Safety check to make sure group exists; require(group.exists); // Safety check to make sure group hasn't purchased token already require(group.purchasePrice == 0); // Safety checks to ensure contributor has contributed to group require(group.addressToContributorArrIndex[userAdd] > 0); require(contributor.tokenIdToGroupArrIndex[_tokenId] > 0); uint refundBalance = _clearContributorRecordInGroup(_tokenId, userAdd); _clearGroupRecordInContributor(_tokenId, userAdd); userAddressToContributor[userAdd].withdrawableBalance += refundBalance; FundsDeposited(userAdd, refundBalance); LeaveGroup( _tokenId, userAdd, tokenIndexToGroup[_tokenId].contributedBalance, refundBalance ); } /// @notice Allow user to leave purchase group; note that their contribution /// and any funds they have in their withdrawableBalance will transfered to them. /// @param _tokenId The ID of the Token purchase group to be left function leaveTokenGroupAndWithdrawBalance(uint256 _tokenId) external whenNotPaused { address userAdd = msg.sender; var group = tokenIndexToGroup[_tokenId]; var contributor = userAddressToContributor[userAdd]; // Safety check to prevent against an unexpected 0x0 default. require(_addressNotNull(userAdd)); // Safety check to make sure group exists; require(group.exists); // Safety check to make sure group hasn't purchased token already require(group.purchasePrice == 0); // Safety checks to ensure contributor has contributed to group require(group.addressToContributorArrIndex[userAdd] > 0); require(contributor.tokenIdToGroupArrIndex[_tokenId] > 0); uint refundBalance = _clearContributorRecordInGroup(_tokenId, userAdd); _clearGroupRecordInContributor(_tokenId, userAdd); userAddressToContributor[userAdd].withdrawableBalance += refundBalance; FundsDeposited(userAdd, refundBalance); _withdrawUserFunds(userAdd); LeaveGroup( _tokenId, userAdd, tokenIndexToGroup[_tokenId].contributedBalance, refundBalance ); } /// @dev Withdraw balance from own account function withdrawBalance() external whenNotPaused { require(_addressNotNull(msg.sender)); require(userAddressToContributor[msg.sender].exists); _withdrawUserFunds(msg.sender); } /** Admin Fns **/ /// @notice Fn for adjusting commission rate /// @param numerator Numerator for calculating funds distributed /// @param denominator Denominator for calculating funds distributed function adjustCommission(uint256 numerator, uint256 denominator) external onlyCLevel { require(numerator <= denominator); distributionNumerator = numerator; distributionDenominator = denominator; } /// @dev In the event of needing a fork, this function moves all /// of a group's contributors' contributions into their withdrawable balance. /// @notice Group is dissolved after fn call /// @param _tokenId The ID of the Token purchase group function dissolveTokenGroup(uint256 _tokenId) external onlyCOO whenForking { var group = tokenIndexToGroup[_tokenId]; // Safety check to make sure group exists and had not purchased a token require(group.exists); require(group.purchasePrice == 0); for (uint i = 0; i < tokenIndexToGroup[_tokenId].contributorArr.length; i++) { address userAdd = tokenIndexToGroup[_tokenId].contributorArr[i]; var userContribution = group.addressToContribution[userAdd]; _clearGroupRecordInContributor(_tokenId, userAdd); // clear contributor record on group tokenIndexToGroup[_tokenId].addressToContribution[userAdd] = 0; tokenIndexToGroup[_tokenId].addressToContributorArrIndex[userAdd] = 0; // move contributor's contribution to their withdrawable balance userAddressToContributor[userAdd].withdrawableBalance += userContribution; ProceedsDeposited(_tokenId, userAdd, userContribution); } activeGroups -= 1; tokenIndexToGroup[_tokenId].exists = false; } /// @dev Backup fn to allow distribution of funds after sale, /// for the special scenario where an alternate sale platform is used; /// @notice Group is dissolved after fn call /// @param _tokenId The ID of the Token purchase group /// @param _amount Funds to be distributed function distributeCustomSaleProceeds(uint256 _tokenId, uint256 _amount) external onlyCOO { var group = tokenIndexToGroup[_tokenId]; // Safety check to make sure group exists and had purchased the token require(group.exists); require(group.purchasePrice > 0); require(_amount > 0); _distributeProceeds(_tokenId, _amount); } /* /// @dev Allow distribution of interest payment, /// Group is intact after fn call /// @param _tokenId The ID of the Token purchase group function distributeInterest(uint256 _tokenId) external onlyCOO payable { var group = tokenIndexToGroup[_tokenId]; var amount = msg.value; var excess = amount; // Safety check to make sure group exists and had purchased the token require(group.exists); require(group.purchasePrice > 0); require(amount > 0); for (uint i = 0; i < tokenIndexToGroup[_tokenId].contributorArr.length; i++) { address userAdd = tokenIndexToGroup[_tokenId].contributorArr[i]; // calculate contributor's interest proceeds and add to their withdrawable balance uint256 userProceeds = uint256(SafeMath.div(SafeMath.mul(amount, tokenIndexToGroup[_tokenId].addressToContribution[userAdd]), tokenIndexToGroup[_tokenId].contributedBalance)); userAddressToContributor[userAdd].withdrawableBalance += userProceeds; excess -= userProceeds; InterestDeposited(_tokenId, userAdd, userProceeds); } commissionBalance += excess; Commission(_tokenId, excess); } */ /// @dev Distribute funds after a token is sold. /// Group is dissolved after fn call /// @param _tokenId The ID of the Token purchase group function distributeSaleProceeds(uint256 _tokenId) external onlyCOO { var group = tokenIndexToGroup[_tokenId]; // Safety check to make sure group exists and had purchased the token require(group.exists); require(group.purchasePrice > 0); // Safety check to make sure token had been sold uint256 currPrice = linkedContract.priceOf(_tokenId); uint256 soldPrice = _newPrice(group.purchasePrice); require(currPrice > soldPrice); uint256 paymentIntoContract = uint256(SafeMath.div(SafeMath.mul(soldPrice, 94), 100)); _distributeProceeds(_tokenId, paymentIntoContract); } /// @dev Called by any "C-level" role to pause the contract. Used only when /// a bug or exploit is detected and we need to limit damage. function pause() external onlyCLevel whenNotPaused { paused = true; } /// @dev Unpauses the smart contract. Can only be called by the CEO, since /// one reason we may pause the contract is when CFO or COO accounts are /// compromised. function unpause() external onlyCEO whenPaused { // can't unpause if contract was upgraded paused = false; } /// @dev Called by any "C-level" role to set the contract to . Used only when /// a bug or exploit is detected and we need to limit damage. function setToForking() external onlyCLevel whenNotForking { forking = true; } /// @dev Unpauses the smart contract. Can only be called by the CEO, since /// one reason we may pause the contract is when CFO or COO accounts are /// compromised. function setToNotForking() external onlyCEO whenForking { // can't unpause if contract was upgraded forking = false; } /// @dev Assigns a new address to act as the CEO. Only available to the current CEO. /// @param _newCEO The address of the new CEO function setCEO(address _newCEO) external onlyCEO { require(_newCEO != address(0)); ceoAddress = _newCEO; } /// @dev Assigns a new address to act as the CFO. Only available to the current CEO. /// @param _newCFO The address of the new CFO function setCFO(address _newCFO) external onlyCEO { require(_newCFO != address(0)); cfoAddress = _newCFO; } /// @dev Assigns a new address to act as the COO1. Only available to the current CEO. /// @param _newCOO1 The address of the new COO1 function setCOO1(address _newCOO1) external onlyCEO { require(_newCOO1 != address(0)); cooAddress1 = _newCOO1; } /// @dev Assigns a new address to act as the COO2. Only available to the current CEO. /// @param _newCOO2 The address of the new COO2 function setCOO2(address _newCOO2) external onlyCEO { require(_newCOO2 != address(0)); cooAddress2 = _newCOO2; } /// @dev Assigns a new address to act as the COO3. Only available to the current CEO. /// @param _newCOO3 The address of the new COO3 function setCOO3(address _newCOO3) external onlyCEO { require(_newCOO3 != address(0)); cooAddress3 = _newCOO3; } /// @dev Backup fn to allow transfer of token out of /// contract, for use where a purchase group wants to use an alternate /// selling platform /// @param _tokenId The ID of the Token purchase group /// @param _to Address to transfer token to function transferToken(uint256 _tokenId, address _to) external onlyCOO { var group = tokenIndexToGroup[_tokenId]; // Safety check to make sure group exists and had purchased the token require(group.exists); require(group.purchasePrice > 0); linkedContract.transfer(_to, _tokenId); } /// @dev Withdraws sale commission, CFO-only functionality /// @param _to Address for commission to be sent to function withdrawCommission(address _to) external onlyCFO { uint256 balance = commissionBalance; address transferee = (_to == address(0)) ? cfoAddress : _to; commissionBalance = 0; if (balance > 0) { transferee.transfer(balance); } FundsWithdrawn(transferee, balance); } /** Information Query Fns **/ /// @dev Get contributed balance in _tokenId token group for user /// @param _tokenId The ID of the token to be queried function getContributionBalanceForTokenGroup(uint256 _tokenId, address userAdd) external view returns (uint balance) { var group = tokenIndexToGroup[_tokenId]; require(group.exists); balance = group.addressToContribution[userAdd]; } /// @dev Get contributed balance in _tokenId token group for user /// @param _tokenId The ID of the token to be queried function getSelfContributionBalanceForTokenGroup(uint256 _tokenId) external view returns (uint balance) { var group = tokenIndexToGroup[_tokenId]; require(group.exists); balance = group.addressToContribution[msg.sender]; } /// @dev Get array of contributors' addresses in _tokenId token group /// @param _tokenId The ID of the token to be queried function getContributorsInTokenGroup(uint256 _tokenId) external view returns (address[] contribAddr) { var group = tokenIndexToGroup[_tokenId]; require(group.exists); contribAddr = group.contributorArr; } /// @dev Get no. of contributors in _tokenId token group /// @param _tokenId The ID of the token to be queried function getContributorsInTokenGroupCount(uint256 _tokenId) external view returns (uint count) { var group = tokenIndexToGroup[_tokenId]; require(group.exists); count = group.contributorArr.length; } /// @dev Get list of tokenIds of token groups a user contributed to function getGroupsContributedTo(address userAdd) external view returns (uint256[] groupIds) { // Safety check to prevent against an unexpected 0x0 default. require(_addressNotNull(userAdd)); var contributor = userAddressToContributor[userAdd]; require(contributor.exists); groupIds = contributor.groupArr; } /// @dev Get list of tokenIds of token groups the user contributed to function getSelfGroupsContributedTo() external view returns (uint256[] groupIds) { // Safety check to prevent against an unexpected 0x0 default. require(_addressNotNull(msg.sender)); var contributor = userAddressToContributor[msg.sender]; require(contributor.exists); groupIds = contributor.groupArr; } /// @dev Get price at which token group purchased _tokenId token function getGroupPurchasedPrice(uint256 _tokenId) external view returns (uint256 price) { var group = tokenIndexToGroup[_tokenId]; require(group.exists); require(group.purchasePrice > 0); price = group.purchasePrice; } /// @dev Get withdrawable balance from sale proceeds for a user function getWithdrawableBalance() external view returns (uint256 balance) { // Safety check to prevent against an unexpected 0x0 default. require(_addressNotNull(msg.sender)); var contributor = userAddressToContributor[msg.sender]; require(contributor.exists); balance = contributor.withdrawableBalance; } /// @dev Get total contributed balance in _tokenId token group /// @param _tokenId The ID of the token group to be queried function getTokenGroupTotalBalance(uint256 _tokenId) external view returns (uint balance) { var group = tokenIndexToGroup[_tokenId]; require(group.exists); balance = group.contributedBalance; } /*** PRIVATE FUNCTIONS ***/ /// @dev Safety check on _to address to prevent against an unexpected 0x0 default. /// @param _to Address to be checked function _addressNotNull(address _to) private pure returns (bool) { return _to != address(0); } /// @dev Clears record of a Contributor from a Group's record /// @param _tokenId Token ID of Group to be cleared /// @param _userAdd Address of Contributor function _clearContributorRecordInGroup(uint256 _tokenId, address _userAdd) private returns (uint256 refundBalance) { var group = tokenIndexToGroup[_tokenId]; // Index was saved is 1 + the array's index, b/c 0 is the default value // in a mapping. uint cIndex = group.addressToContributorArrIndex[_userAdd] - 1; uint lastCIndex = group.contributorArr.length - 1; refundBalance = group.addressToContribution[_userAdd]; // clear contribution record in group tokenIndexToGroup[_tokenId].addressToContributorArrIndex[_userAdd] = 0; tokenIndexToGroup[_tokenId].addressToContribution[_userAdd] = 0; // move address in last position to deleted contributor's spot if (lastCIndex > 0) { tokenIndexToGroup[_tokenId].addressToContributorArrIndex[group.contributorArr[lastCIndex]] = cIndex; tokenIndexToGroup[_tokenId].contributorArr[cIndex] = group.contributorArr[lastCIndex]; } tokenIndexToGroup[_tokenId].contributorArr.length -= 1; tokenIndexToGroup[_tokenId].contributedBalance -= refundBalance; } /// @dev Clears record of a Group from a Contributor's record /// @param _tokenId Token ID of Group to be cleared /// @param _userAdd Address of Contributor function _clearGroupRecordInContributor(uint256 _tokenId, address _userAdd) private { // Index saved is 1 + the array's index, b/c 0 is the default value // in a mapping. uint gIndex = userAddressToContributor[_userAdd].tokenIdToGroupArrIndex[_tokenId] - 1; uint lastGIndex = userAddressToContributor[_userAdd].groupArr.length - 1; // clear Group record in Contributor userAddressToContributor[_userAdd].tokenIdToGroupArrIndex[_tokenId] = 0; // move tokenId from end of array to deleted Group record's spot if (lastGIndex > 0) { userAddressToContributor[_userAdd].tokenIdToGroupArrIndex[userAddressToContributor[_userAdd].groupArr[lastGIndex]] = gIndex; userAddressToContributor[_userAdd].groupArr[gIndex] = userAddressToContributor[_userAdd].groupArr[lastGIndex]; } userAddressToContributor[_userAdd].groupArr.length -= 1; } /// @dev Redistribute proceeds from token purchase /// @param _tokenId Token ID of token to be purchased /// @param _amount Amount paid into contract for token function _distributeProceeds(uint256 _tokenId, uint256 _amount) private { uint256 fundsForDistribution = uint256(SafeMath.div(SafeMath.mul(_amount, distributionNumerator), distributionDenominator)); uint256 commission = _amount; for (uint i = 0; i < tokenIndexToGroup[_tokenId].contributorArr.length; i++) { address userAdd = tokenIndexToGroup[_tokenId].contributorArr[i]; // calculate contributor's sale proceeds and add to their withdrawable balance uint256 userProceeds = uint256(SafeMath.div(SafeMath.mul(fundsForDistribution, tokenIndexToGroup[_tokenId].addressToContribution[userAdd]), tokenIndexToGroup[_tokenId].contributedBalance)); _clearGroupRecordInContributor(_tokenId, userAdd); // clear contributor record on group tokenIndexToGroup[_tokenId].addressToContribution[userAdd] = 0; tokenIndexToGroup[_tokenId].addressToContributorArrIndex[userAdd] = 0; commission -= userProceeds; userAddressToContributor[userAdd].withdrawableBalance += userProceeds; ProceedsDeposited(_tokenId, userAdd, userProceeds); } commissionBalance += commission; Commission(_tokenId, commission); activeGroups -= 1; tokenIndexToGroup[_tokenId].exists = false; tokenIndexToGroup[_tokenId].contributorArr.length = 0; tokenIndexToGroup[_tokenId].contributedBalance = 0; tokenIndexToGroup[_tokenId].purchasePrice = 0; } /// @dev Calculates next price of celebrity token /// @param _oldPrice Previous price function _newPrice(uint256 _oldPrice) private view returns (uint256 newPrice) { if (_oldPrice < firstStepLimit) { // first stage newPrice = SafeMath.div(SafeMath.mul(_oldPrice, 200), 94); } else if (_oldPrice < secondStepLimit) { // second stage newPrice = SafeMath.div(SafeMath.mul(_oldPrice, 120), 94); } else { // third stage newPrice = SafeMath.div(SafeMath.mul(_oldPrice, 115), 94); } } /// @dev Calls CelebrityToken purchase fn and updates records /// @param _tokenId Token ID of token to be purchased /// @param _amount Amount to be paid to CelebrityToken function _purchase(uint256 _tokenId, uint256 _amount) private { tokenIndexToGroup[_tokenId].purchasePrice = _amount; linkedContract.purchase.value(_amount)(_tokenId); TokenPurchased(_tokenId, _amount); } function _withdrawUserFunds(address userAdd) private { uint256 balance = userAddressToContributor[userAdd].withdrawableBalance; userAddressToContributor[userAdd].withdrawableBalance = 0; if (balance > 0) { FundsWithdrawn(userAdd, balance); userAdd.transfer(balance); } } } /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens /// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete) contract ERC721 { // Required methods function approve(address _to, uint256 _tokenId) public; function balanceOf(address _owner) public view returns (uint256 balance); function implementsERC721() public pure returns (bool); function ownerOf(uint256 _tokenId) public view returns (address addr); function takeOwnership(uint256 _tokenId) public; function totalSupply() public view returns (uint256 total); function transferFrom(address _from, address _to, uint256 _tokenId) public; function transfer(address _to, uint256 _tokenId) public; event Transfer(address indexed from, address indexed to, uint256 tokenId); event Approval(address indexed owner, address indexed approved, uint256 tokenId); // Optional // function name() public view returns (string name); // function symbol() public view returns (string symbol); // function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256 tokenId); // function tokenMetadata(uint256 _tokenId) public view returns (string infoUrl); } contract CelebrityToken is ERC721 { /*** EVENTS ***/ /// @dev The Birth event is fired whenever a new person comes into existence. event Birth(uint256 tokenId, string name, address owner); /// @dev The TokenSold event is fired whenever a token is sold. event TokenSold(uint256 tokenId, uint256 oldPrice, uint256 newPrice, address prevOwner, address winner, string name); /// @dev Transfer event as defined in current draft of ERC721. /// ownership is assigned, including births. event Transfer(address from, address to, uint256 tokenId); /*** CONSTANTS ***/ /// @notice Name and symbol of the non fungible token, as defined in ERC721. string public constant NAME = "CryptoCelebrities"; // solhint-disable-line string public constant SYMBOL = "CelebrityToken"; // solhint-disable-line address public ceoAddress; address public cooAddress; uint256 public promoCreatedCount; /*** DATATYPES ***/ struct Person { string name; } /*** CONSTRUCTOR ***/ function CelebrityToken() public { ceoAddress = msg.sender; cooAddress = msg.sender; } /*** PUBLIC FUNCTIONS ***/ /// @notice Grant another address the right to transfer token via takeOwnership() and transferFrom(). /// @param _to The address to be granted transfer approval. Pass address(0) to /// clear all approvals. /// @param _tokenId The ID of the Token that can be transferred if this call succeeds. /// @dev Required for ERC-721 compliance. function approve( address _to, uint256 _tokenId ) public; /// For querying balance of a particular account /// @param _owner The address for balance query /// @dev Required for ERC-721 compliance. function balanceOf(address _owner) public view returns (uint256 balance); /// @dev Creates a new promo Person with the given name, with given _price and assignes it to an address. function createPromoPerson(address _owner, string _name, uint256 _price) public; /// @dev Creates a new Person with the given name. function createContractPerson(string _name) public; /// @notice Returns all the relevant information about a specific person. /// @param _tokenId The tokenId of the person of interest. function getPerson(uint256 _tokenId) public view returns ( string personName, uint256 sellingPrice, address owner ); function implementsERC721() public pure returns (bool); /// @dev Required for ERC-721 compliance. function name() public pure returns (string); /// For querying owner of token /// @param _tokenId The tokenID for owner inquiry /// @dev Required for ERC-721 compliance. function ownerOf(uint256 _tokenId) public view returns (address owner); function payout(address _to) public; // Allows someone to send ether and obtain the token function purchase(uint256 _tokenId) public payable; function priceOf(uint256 _tokenId) public view returns (uint256 price); /// @dev Assigns a new address to act as the CEO. Only available to the current CEO. /// @param _newCEO The address of the new CEO function setCEO(address _newCEO) public; /// @dev Assigns a new address to act as the COO. Only available to the current COO. /// @param _newCOO The address of the new COO function setCOO(address _newCOO) public; /// @dev Required for ERC-721 compliance. function symbol() public pure returns (string); /// @notice Allow pre-approved user to take ownership of a token /// @param _tokenId The ID of the Token that can be transferred if this call succeeds. /// @dev Required for ERC-721 compliance. function takeOwnership(uint256 _tokenId) public; /// @param _owner The owner whose celebrity tokens we are interested in. /// @dev This method MUST NEVER be called by smart contract code. First, it's fairly /// expensive (it walks the entire Persons array looking for persons belonging to owner), /// but it also returns a dynamic array, which is only supported for web3 calls, and /// not contract-to-contract calls. function tokensOfOwner(address _owner) public view returns(uint256[] ownerTokens); /// For querying totalSupply of token /// @dev Required for ERC-721 compliance. function totalSupply() public view returns (uint256 total); /// Owner initates the transfer of the token to another account /// @param _to The address for the token to be transferred to. /// @param _tokenId The ID of the Token that can be transferred if this call succeeds. /// @dev Required for ERC-721 compliance. function transfer( address _to, uint256 _tokenId ) public; /// Third-party initiates transfer of token from address _from to address _to /// @param _from The address for the token to be transferred from. /// @param _to The address for the token to be transferred to. /// @param _tokenId The ID of the Token that can be transferred if this call succeeds. /// @dev Required for ERC-721 compliance. function transferFrom( address _from, address _to, uint256 _tokenId ) public; /*** PRIVATE FUNCTIONS ***/ /// Safety check on _to address to prevent against an unexpected 0x0 default. function _addressNotNull(address _to) private pure returns (bool); /// For checking approval of transfer for address _to function _approved(address _to, uint256 _tokenId) private view returns (bool); /// For creating Person function _createPerson(string _name, address _owner, uint256 _price) private; /// Check for token ownership function _owns(address claimant, uint256 _tokenId) private view returns (bool); /// For paying out balance on contract function _payout(address _to) private; /// @dev Assigns ownership of a specific Person to an address. function _transfer(address _from, address _to, uint256 _tokenId) private; } library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
* Action Fns **/ @notice Backup function for activating token purchase requires sender to be a member of the group or CLevel @param _tokenId The ID of the Token group Safety check that enough money has been contributed to group Safety check that token had not be purchased yet
function activatePurchase(uint256 _tokenId) external whenNotPaused { var group = tokenIndexToGroup[_tokenId]; require(group.addressToContribution[msg.sender] > 0 || msg.sender == ceoAddress || msg.sender == cooAddress1 || msg.sender == cooAddress2 || msg.sender == cooAddress3 || msg.sender == cfoAddress); var price = linkedContract.priceOf(_tokenId); require(group.contributedBalance >= price); require(group.purchasePrice == 0); _purchase(_tokenId, price); }
12,786,727
[ 1, 4625, 348, 7953, 560, 30, 380, 4382, 478, 2387, 26013, 632, 20392, 11856, 445, 364, 5981, 1776, 1147, 23701, 225, 4991, 5793, 358, 506, 279, 3140, 434, 326, 1041, 578, 385, 2355, 632, 891, 389, 2316, 548, 1021, 1599, 434, 326, 3155, 1041, 348, 1727, 14369, 866, 716, 7304, 15601, 711, 2118, 356, 11050, 358, 1041, 348, 1727, 14369, 866, 716, 1147, 9323, 486, 506, 5405, 343, 8905, 4671, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 225, 445, 10235, 23164, 12, 11890, 5034, 389, 2316, 548, 13, 3903, 1347, 1248, 28590, 288, 203, 565, 569, 1041, 273, 1147, 1016, 774, 1114, 63, 67, 2316, 548, 15533, 203, 565, 2583, 12, 1655, 18, 2867, 774, 442, 4027, 63, 3576, 18, 15330, 65, 405, 374, 747, 203, 5411, 1234, 18, 15330, 422, 276, 4361, 1887, 747, 203, 5411, 1234, 18, 15330, 422, 1825, 83, 1887, 21, 747, 203, 5411, 1234, 18, 15330, 422, 1825, 83, 1887, 22, 747, 203, 5411, 1234, 18, 15330, 422, 1825, 83, 1887, 23, 747, 203, 5411, 1234, 18, 15330, 422, 276, 617, 1887, 1769, 203, 203, 565, 569, 6205, 273, 8459, 8924, 18, 8694, 951, 24899, 2316, 548, 1769, 203, 565, 2583, 12, 1655, 18, 591, 11050, 13937, 1545, 6205, 1769, 203, 203, 565, 2583, 12, 1655, 18, 12688, 12104, 5147, 422, 374, 1769, 203, 203, 565, 389, 12688, 12104, 24899, 2316, 548, 16, 6205, 1769, 203, 225, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// SPDX-License-Identifier: MIT pragma solidity 0.6.8; import "./XStore.sol"; import "../library/token/ERC1155/IERC1155.sol"; import "../library/utils/Ownable.sol"; import "../library/utils/SafeMath.sol"; import "../library/token/ERC20/SafeERC20.sol"; import "../library/utils/EnumerableSet.sol"; contract XStoreVERC1155D1 is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.UintSet; struct VaultERC1155D1 { address xTokenAddress; address nftAddress; address manager; IXToken xToken; IERC1155 nft; EnumerableSet.UintSet holdings; EnumerableSet.UintSet reserves; mapping(uint256 => address) requester; mapping(uint256 => bool) isEligible; mapping(uint256 => bool) shouldReserve; bool allowMintRequests; bool flipEligOnRedeem; bool negateEligibility; bool isFinalized; bool isClosed; uint256 tokenBalance; } VaultERC1155D1[] internal vaults; uint256 public randNonce; constructor() public { initOwnable(); } event NewVaultAdded(uint256 vaultId); event XTokenAddressSet(uint256 indexed vaultId, address token); event NftAddressSet(uint256 indexed vaultId, address asset); event XTokenSet(uint256 indexed vaultId); event NftSet(uint256 indexed vaultId); event ManagerSet(uint256 indexed vaultId, address manager); event IsFinalizedSet(uint256 indexed vaultId, bool _isFinalized); event IsEligibleSet(uint256 indexed vaultId, uint256 id, bool _bool); event NegateEligibilitySet(uint256 indexed vaultId, bool _bool); //event ReservesAdded(uint256 indexed vaultId, uint256 id); event RandNonceSet(uint256 _randNonce); event HoldingsRemoved(uint256 indexed vaultId, uint256 id); function _getVault(uint256 vaultId) internal view returns (VaultERC1155D1 storage) { require(vaultId < vaults.length, "Invalid vaultId"); return vaults[vaultId]; } function vaultsLength() public view returns (uint256) { return vaults.length; } function xTokenAddress(uint256 vaultId) public view returns (address) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.xTokenAddress; } function nftAddress(uint256 vaultId) public view returns (address) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.nftAddress; } function xToken(uint256 vaultId) public view returns (IXToken) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.xToken; } function manager(uint256 vaultId) public view returns (address) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.manager; } function nftERC1155D1(uint256 vaultId) external view returns (IERC1155) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.nft; } function setXTokenAddress(uint256 vaultId, address _xTokenAddress) public onlyOwner { VaultERC1155D1 storage vault = _getVault(vaultId); vault.xTokenAddress = _xTokenAddress; emit XTokenAddressSet(vaultId, _xTokenAddress); } function setNftAddress(uint256 vaultId, address _nft) public onlyOwner { VaultERC1155D1 storage vault = _getVault(vaultId); vault.nftAddress = _nft; emit NftAddressSet(vaultId, _nft); } function setManager(uint256 vaultId, address _manager) public onlyOwner { VaultERC1155D1 storage vault = _getVault(vaultId); vault.manager = _manager; emit ManagerSet(vaultId, _manager); } function setXToken(uint256 vaultId) public onlyOwner { VaultERC1155D1 storage vault = _getVault(vaultId); vault.xToken = IXToken(vault.xTokenAddress); emit XTokenSet(vaultId); } function setNft(uint256 vaultId) public onlyOwner { VaultERC1155D1 storage vault = _getVault(vaultId); vault.nft = IERC1155(vault.nftAddress); emit NftSet(vaultId); } function addNewVault() public onlyOwner returns (uint256) { VaultERC1155D1 memory newVault; vaults.push(newVault); uint256 vaultId = vaults.length.sub(1); emit NewVaultAdded(vaultId); return vaultId; } function isFinalized(uint256 vaultId) public view returns (bool) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.isFinalized; } function setIsFinalized(uint256 vaultId, bool _isFinalized) public onlyOwner { VaultERC1155D1 storage vault = _getVault(vaultId); vault.isFinalized = _isFinalized; emit IsFinalizedSet(vaultId, _isFinalized); } function setIsEligible(uint256 vaultId, uint256 id, bool _bool) public onlyOwner { VaultERC1155D1 storage vault = _getVault(vaultId); vault.isEligible[id] = _bool; emit IsEligibleSet(vaultId, id, _bool); } function setNegateEligibility(uint256 vaultId, bool negateElig) public onlyOwner { VaultERC1155D1 storage vault = _getVault(vaultId); vault.negateEligibility = negateElig; emit NegateEligibilitySet(vaultId, negateElig); } function holdingsLength(uint256 vaultId) public view returns (uint256) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.holdings.length(); } /*function reservesLength(uint256 vaultId) public view returns (uint256) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.holdings.length(); }*/ function isEligible(uint256 vaultId, uint256 id) public view returns (bool) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.isEligible[id]; } function negateEligibility(uint256 vaultId) public view returns (bool) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.negateEligibility; } /*function shouldReserve(uint256 vaultId, uint256 id) public view returns (bool) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.shouldReserve[id]; }*/ /*function reservesAdd(uint256 vaultId, uint256 elem) public onlyOwner { VaultERC1155D1 storage vault = _getVault(vaultId); vault.reserves.add(elem); emit ReservesAdded(vaultId, elem); }*/ function holdingsAdd(uint256 vaultId, uint256 elem) public onlyOwner { VaultERC1155D1 storage vault = _getVault(vaultId); vault.holdings.add(elem); //emit HoldingsAdded(vaultId, elem, amount); } function holdingsAt(uint256 vaultId, uint256 index) public view returns (uint256) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.holdings.at(index); } function holdingsContains(uint256 vaultId, uint256 elem) public view returns (bool) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.holdings.contains(elem); } /*function reservesAt(uint256 vaultId, uint256 index) public view returns (uint256) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.holdings.at(index); }*/ function setRandNonce(uint256 _randNonce) public onlyOwner { randNonce = _randNonce; emit RandNonceSet(_randNonce); } function flipEligOnRedeem(uint256 vaultId) public view returns (bool) { VaultERC1155D1 storage vault = _getVault(vaultId); return vault.flipEligOnRedeem; } function holdingsRemove(uint256 vaultId, uint256 elem) public onlyOwner { VaultERC1155D1 storage vault = _getVault(vaultId); vault.holdings.remove(elem); emit HoldingsRemoved(vaultId, elem); } }
function shouldReserve(uint256 vaultId, uint256 id)
{ VaultERC1155D1 storage vault = _getVault(vaultId); return vault.shouldReserve[id]; }*/
14,081,187
[ 1, 4625, 348, 7953, 560, 30, 445, 1410, 607, 6527, 12, 11890, 5034, 9229, 548, 16, 2254, 5034, 612, 13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 288, 203, 3639, 17329, 654, 39, 2499, 2539, 40, 21, 2502, 9229, 273, 389, 588, 12003, 12, 26983, 548, 1769, 203, 3639, 327, 9229, 18, 13139, 607, 6527, 63, 350, 15533, 203, 565, 289, 5549, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/7701/0x2C1d33c95FB44dCc01764A19fE318309309EE261/sources/contracts/mixins/MarketSequencer.sol
@dev This does not check whether the curve was previously initialized. It's the caller's responsibility to make sure this is never called on an already initialized pool. @param pool The pre-loaded speciication and hash of the pool to be swapped against. @param price The initial price to set the curve at. Represented as the square root of price in Q64.64 fixed point. @param initLiq The initial ambient liquidity commitment that will be permanetely locked in the pool. Represeted as sqrt(XY) constant-product AMM liquidity. @return baseFlow The total amount of base-side token collateral that must be committed to the pool as part of the mint. Will always be positive as it's paid to the pool from the user. @return quoteFlow The total amount of quote-side token collateral that must be committed to the pool as part of the mint. /
function initCurve (PoolSpecs.PoolCursor memory pool, uint128 price, uint128 initLiq) internal returns (int128 baseFlow, int128 quoteFlow) { CurveMath.CurveState memory curve = snapCurveInit(pool.hash_); initPrice(curve, price); (baseFlow, quoteFlow) = lockAmbient(curve, initLiq); commitCurve(pool.hash_, curve); }
13,213,557
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 5206, 1220, 1552, 486, 866, 2856, 326, 8882, 1703, 7243, 6454, 18, 2597, 1807, 1377, 326, 4894, 1807, 29353, 358, 1221, 3071, 333, 353, 5903, 2566, 603, 392, 1818, 1377, 6454, 2845, 18, 632, 891, 2845, 1021, 675, 17, 4230, 857, 77, 829, 471, 1651, 434, 326, 2845, 358, 506, 7720, 1845, 5314, 18, 632, 891, 6205, 1021, 2172, 6205, 358, 444, 326, 8882, 622, 18, 868, 6706, 329, 487, 326, 8576, 1365, 2868, 434, 6205, 316, 2238, 1105, 18, 1105, 5499, 1634, 18, 632, 891, 1208, 48, 18638, 1021, 2172, 13232, 1979, 4501, 372, 24237, 23274, 716, 903, 506, 4641, 304, 278, 2357, 7734, 8586, 316, 326, 2845, 18, 868, 27524, 329, 487, 5700, 12, 8546, 13, 5381, 17, 5896, 432, 8206, 7734, 4501, 372, 24237, 18, 632, 2463, 1026, 5249, 1021, 2078, 3844, 434, 1026, 17, 5564, 1147, 4508, 2045, 287, 716, 1297, 506, 5375, 16015, 358, 326, 2845, 487, 1087, 434, 326, 312, 474, 18, 9980, 3712, 506, 5375, 6895, 487, 518, 1807, 30591, 358, 326, 2845, 628, 326, 729, 18, 632, 2463, 3862, 5249, 1021, 2078, 3844, 434, 3862, 17, 5564, 1147, 4508, 2045, 287, 716, 1297, 506, 10402, 16015, 358, 326, 2845, 487, 1087, 434, 326, 312, 474, 18, 342, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 1208, 9423, 261, 2864, 15999, 18, 2864, 6688, 3778, 2845, 16, 203, 13491, 2254, 10392, 6205, 16, 2254, 10392, 1208, 48, 18638, 13, 203, 3639, 2713, 1135, 261, 474, 10392, 1026, 5249, 16, 509, 10392, 3862, 5249, 13, 288, 203, 3639, 22901, 10477, 18, 9423, 1119, 3778, 8882, 273, 10915, 9423, 2570, 12, 6011, 18, 2816, 67, 1769, 203, 3639, 1208, 5147, 12, 16683, 16, 6205, 1769, 203, 3639, 261, 1969, 5249, 16, 3862, 5249, 13, 273, 2176, 30706, 1979, 12, 16683, 16, 1208, 48, 18638, 1769, 203, 3639, 3294, 9423, 12, 6011, 18, 2816, 67, 16, 8882, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./CrowdSale.sol"; import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol"; /** * @title MintedCrowdsale * @dev Extension of Crowdsale contract whose tokens are minted in each purchase. * Token ownership should be transferred to MintedCrowdsale for minting. */ contract MintedCrowdsale is Crowdsale { constructor (uint256 _rate, address payable _wallet, IERC20 _token) Crowdsale(_rate, _wallet, _token) {} /** * @dev Overrides delivery by minting tokens upon purchase. * @param _beneficiary Token purchaser * @param _tokenAmount Number of tokens to be minted */ function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal override { ERC20PresetMinterPauser(address(token)).mint(_beneficiary, _tokenAmount); } }
* @dev Overrides delivery by minting tokens upon purchase. @param _beneficiary Token purchaser @param _tokenAmount Number of tokens to be minted/
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal override { ERC20PresetMinterPauser(address(token)).mint(_beneficiary, _tokenAmount); }
7,312,352
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 531, 9857, 7912, 635, 312, 474, 310, 2430, 12318, 23701, 18, 632, 891, 389, 70, 4009, 74, 14463, 814, 3155, 5405, 343, 14558, 632, 891, 389, 2316, 6275, 3588, 434, 2430, 358, 506, 312, 474, 329, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 389, 26672, 5157, 12, 2867, 389, 70, 4009, 74, 14463, 814, 16, 2254, 5034, 389, 2316, 6275, 13, 2713, 3849, 288, 203, 3639, 4232, 39, 3462, 18385, 49, 2761, 16507, 1355, 12, 2867, 12, 2316, 13, 2934, 81, 474, 24899, 70, 4009, 74, 14463, 814, 16, 389, 2316, 6275, 1769, 203, 565, 289, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./partial_match/1/0xD5915FDBC630cfE5E1fA81F0c711709f4645E32e/sources/PassThrough.sol
* @dev Convert bytes to bytes4 @param _signature bytes - method signature @return bytes4 - method signature in bytes4/ solium-disable-next-line security/no-inline-assembly
function convertToBytes4(bytes memory _signature) internal pure returns (bytes4) { require(_signature.length == 4, "Invalid method signature"); bytes4 signatureBytes4; assembly { signatureBytes4 := mload(add(_signature, 32)) } return signatureBytes4; }
4,165,899
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 4037, 1731, 358, 1731, 24, 632, 891, 389, 8195, 1731, 300, 707, 3372, 632, 2463, 1731, 24, 300, 707, 3372, 316, 1731, 24, 19, 3704, 5077, 17, 8394, 17, 4285, 17, 1369, 4373, 19, 2135, 17, 10047, 17, 28050, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 8137, 2160, 24, 12, 3890, 3778, 389, 8195, 13, 2713, 16618, 1135, 261, 3890, 24, 13, 288, 203, 3639, 2583, 24899, 8195, 18, 2469, 422, 1059, 16, 315, 1941, 707, 3372, 8863, 203, 3639, 1731, 24, 3372, 2160, 24, 31, 203, 3639, 19931, 288, 203, 5411, 3372, 2160, 24, 519, 312, 945, 12, 1289, 24899, 8195, 16, 3847, 3719, 203, 3639, 289, 203, 3639, 327, 3372, 2160, 24, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.4.21; interface ERC20_MIST { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; } contract ERC20MIST { // Public variables of the token string public name="ERC20_MIST"; string public symbol="MSI"; uint8 public decimals = 8; // 18 decimals is the strongly suggested default, avoid changing it uint256 public totalSupply; // This creates an array with all balances mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; // This generates a public event on the blockchain that will notify clients event Transfer(address indexed from, address indexed to, uint256 value); // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Constructor function * * Initializes contract with initial supply tokens to the creator of the contract */ function ERC20MIST ( uint256 initialSupply, string tokenName, string tokenSymbol ) public { totalSupply = initialSupply * 8 ** uint256(decimals); // Update total supply with the decimal amount balanceOf[msg.sender] = 2100000000000000; // Give the creator all initial tokens name = tokenName="ERC20_MIST"; // Set the name for display purposes symbol = tokenSymbol="MSI"; // Set the symbol for display purposes } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { // Prevent transfer to 0x0 address. Use burn() instead require(_to != 0x924DAE462424428eBC8EA034B280e7D4e10C410c); // Check if the sender has enough require(balanceOf[_from] >= _value); // Check for overflows require(balanceOf[_to] + _value >= balanceOf[_to]); // Save this for an assertion in the future uint previousBalances = balanceOf[_from] + balanceOf[_to]; // Subtract from the sender balanceOf[_from] -= _value; // Add the same to the recipient balanceOf[_to] += _value; emit Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balanceOf[_from] + balanceOf[_to] == previousBalances); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public { _transfer(msg.sender, _to, _value); } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` on behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowance[_from][msg.sender]); // Check allowance allowance[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens on your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; return true; } /** * Set allowance for other address and notify * * Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it * * @param _spender The address authorized to spend * @param _value the max amount they can spend * @param _extraData some extra information to send to the approved contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { ERC20_MIST spender = ERC20_MIST(_spender); if (approve(_spender, _value)) { spender.receiveApproval(msg.sender, _value, this, _extraData); return true; } } /** * Destroy tokens * * Remove `_value` tokens from the system irreversibly * * @param _value the amount of money to burn */ function burn(uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value); // Check if the sender has enough balanceOf[msg.sender] -= _value; // Subtract from the sender totalSupply -= _value; // Updates totalSupply emit Burn(msg.sender, _value); return true; } /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender&#39;s allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; } }
Give the creator all initial tokens
balanceOf[msg.sender] = 2100000000000000;
8,038,169
[ 1, 4625, 348, 7953, 560, 30, 225, 22374, 326, 11784, 777, 2172, 2430, 203, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.4.16; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint256 a, uint256 b) internal constant returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal constant returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } contract ERC20 { function totalSupply() constant returns (uint totalSupply); function balanceOf(address _owner) constant returns (uint balance); function transfer(address _to, uint _value) returns (bool success); function transferFrom(address _from, address _to, uint _value) returns (bool success); function approve(address _spender, uint _value) returns (bool success); function allowance(address _owner, address _spender) constant returns (uint remaining); // This generates a public event on the blockchain that will notify clients event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); } //Token with owner (admin) contract OwnedToken { address public owner; //contract owner (admin) address function OwnedToken () public { owner = msg.sender; } //Check if owner initiate call modifier onlyOwner() { require(msg.sender == owner); _; } /** * Transfer ownership * * @param newOwner The address of the new contract owner */ function transferOwnership(address newOwner) public onlyOwner { owner = newOwner; } } //Contract with name contract NamedOwnedToken is OwnedToken { string public name; //the name for display purposes string public symbol; //the symbol for display purposes function NamedOwnedToken(string tokenName, string tokenSymbol) public { name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Change name and symbol * * @param newName The new contract name * @param newSymbol The new contract symbol */ function changeName(string newName, string newSymbol)public onlyOwner { name = newName; symbol = newSymbol; } } contract TSBToken is ERC20, NamedOwnedToken { using SafeMath for uint256; // Public variables of the token uint256 public _totalSupply = 0; //Total number of token issued (1 token = 10^decimals) uint8 public decimals = 18; //Decimals, each 1 token = 10^decimals mapping (address => uint256) public balances; // A map with all balances mapping (address => mapping (address => uint256)) public allowed; //Implement allowence to support ERC20 mapping (address => uint256) public paidETH; //The sum have already been paid to token owner uint256 public accrueDividendsPerXTokenETH = 0; uint256 public tokenPriceETH = 0; mapping (address => uint256) public paydCouponsETH; uint256 public accrueCouponsPerXTokenETH = 0; uint256 public totalCouponsUSD = 0; uint256 public MaxCouponsPaymentUSD = 150000; mapping (address => uint256) public rebuySum; mapping (address => uint256) public rebuyInformTime; uint256 public endSaleTime; uint256 public startRebuyTime; uint256 public reservedSum; bool public rebuyStarted = false; uint public tokenDecimals; uint public tokenDecimalsLeft; /** * Constructor function * * Initializes contract */ function TSBToken( string tokenName, string tokenSymbol ) NamedOwnedToken(tokenName, tokenSymbol) public { tokenDecimals = 10**uint256(decimals - 5); tokenDecimalsLeft = 10**5; startRebuyTime = now + 1 years; endSaleTime = now; } /** * Internal function, calc dividends to transfer when tokens are transfering to another wallet */ function transferDiv(uint startTokens, uint fromTokens, uint toTokens, uint sumPaydFrom, uint sumPaydTo, uint acrued) internal constant returns (uint, uint) { uint sumToPayDividendsFrom = fromTokens.mul(acrued); uint sumToPayDividendsTo = toTokens.mul(acrued); uint sumTransfer = sumPaydFrom.div(startTokens); sumTransfer = sumTransfer.mul(startTokens-fromTokens); if (sumPaydFrom > sumTransfer) { sumPaydFrom -= sumTransfer; if (sumPaydFrom > sumToPayDividendsFrom) { sumTransfer += sumPaydFrom - sumToPayDividendsFrom; sumPaydFrom = sumToPayDividendsFrom; } } else { sumTransfer = sumPaydFrom; sumPaydFrom = 0; } sumPaydTo = sumPaydTo.add(sumTransfer); if (sumPaydTo > sumToPayDividendsTo) { uint differ = sumPaydTo - sumToPayDividendsTo; sumPaydTo = sumToPayDividendsTo; sumPaydFrom = sumPaydFrom.add(differ); if (sumPaydFrom > sumToPayDividendsFrom) { sumPaydFrom = sumToPayDividendsFrom; } } return (sumPaydFrom, sumPaydTo); } /** * Internal transfer, only can be called by this contract */ function _transfer(address _from, address _to, uint _value) internal { require(_to != address(0)); // Prevent transfer to 0x0 address. Use burn() instead require(balances[_from] >= _value); // Check if the sender has enough require(balances[_to] + _value > balances[_to]); // Check for overflows uint startTokens = balances[_from].div(tokenDecimals); balances[_from] -= _value; // Subtract from the sender balances[_to] += _value; // Add the same to the recipient if (balances[_from] == 0) { paidETH[_to] = paidETH[_to].add(paidETH[_from]); } else { uint fromTokens = balances[_from].div(tokenDecimals); uint toTokens = balances[_to].div(tokenDecimals); (paidETH[_from], paidETH[_to]) = transferDiv(startTokens, fromTokens, toTokens, paidETH[_from], paidETH[_to], accrueDividendsPerXTokenETH+accrueCouponsPerXTokenETH); } Transfer(_from, _to, _value); } /** * Transfer tokens * * Send `_value` tokens to `_to` from your account * * @param _to The address of the recipient * @param _value the amount to send */ function transfer(address _to, uint256 _value) public returns (bool success) { _transfer(msg.sender, _to, _value); return true; } /** * Balance of tokens * * @param _owner The address of token wallet */ function balanceOf(address _owner) public constant returns (uint256 balance) { return balances[_owner]; } /** * Returns total issued tokens number * */ function totalSupply() public constant returns (uint totalSupply) { return _totalSupply; } /** * Transfer tokens from other address * * Send `_value` tokens to `_to` in behalf of `_from` * * @param _from The address of the sender * @param _to The address of the recipient * @param _value the amount to send */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(_value <= allowed[_from][msg.sender]); // Check allowance allowed[_from][msg.sender] -= _value; _transfer(_from, _to, _value); return true; } /** * Set allowance for other address * * Allows `_spender` to spend no more than `_value` tokens in your behalf * * @param _spender The address authorized to spend * @param _value the max amount they can spend */ function approve(address _spender, uint256 _value) public returns (bool success) { allowed[msg.sender][_spender] = _value; return true; } /** * Check allowance for address * * @param _owner The address who authorize to spend * @param _spender The address authorized to spend */ function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { return allowed[_owner][_spender]; } // This notifies clients about the amount burnt event Burn(address indexed from, uint256 value); /** * Internal function destroy tokens */ function burnTo(uint256 _value, address adr) internal returns (bool success) { require(balances[adr] >= _value); // Check if the sender has enough require(_value > 0); // Check if the sender has enough uint startTokens = balances[adr].div(tokenDecimals); balances[adr] -= _value; // Subtract from the sender uint endTokens = balances[adr].div(tokenDecimals); uint sumToPayFrom = endTokens.mul(accrueDividendsPerXTokenETH + accrueCouponsPerXTokenETH); uint divETH = paidETH[adr].div(startTokens); divETH = divETH.mul(endTokens); if (divETH > sumToPayFrom) { paidETH[adr] = sumToPayFrom; } else { paidETH[adr] = divETH; } _totalSupply -= _value; // Updates totalSupply Burn(adr, _value); return true; } /** * Delete tokens tokens during the end of croudfunding * (in case of errors made by crowdfnuding participants) * Only owner could call */ function deleteTokens(address adr, uint256 amount) public onlyOwner canMint { burnTo(amount, adr); } bool public mintingFinished = false; event Mint(address indexed to, uint256 amount); event MintFinished(); //Check if it is possible to mint new tokens (mint allowed only during croudfunding) modifier canMint() { require(!mintingFinished); _; } function () public payable { } //Withdraw unused ETH from contract to owner function WithdrawLeftToOwner(uint sum) public onlyOwner { owner.transfer(sum); } /** * Mint additional tokens at the end of croudfunding */ function mintToken(address target, uint256 mintedAmount) public onlyOwner canMint { balances[target] += mintedAmount; uint tokensInX = mintedAmount.div(tokenDecimals); paidETH[target] += tokensInX.mul(accrueDividendsPerXTokenETH + accrueCouponsPerXTokenETH); _totalSupply += mintedAmount; Mint(owner, mintedAmount); Transfer(0x0, target, mintedAmount); } /** * Finish minting */ function finishMinting() public onlyOwner returns (bool) { mintingFinished = true; endSaleTime = now; startRebuyTime = endSaleTime + (180 * 1 days); MintFinished(); return true; } /** * Withdraw accrued dividends and coupons */ function WithdrawDividendsAndCoupons() public { withdrawTo(msg.sender,0); } /** * Owner could initiate a withdrawal of accrued dividends and coupons to some address (in purpose to help users) */ function WithdrawDividendsAndCouponsTo(address _sendadr) public onlyOwner { withdrawTo(_sendadr, tx.gasprice * block.gaslimit); } /** * Internal function to withdraw accrued dividends and coupons */ function withdrawTo(address _sendadr, uint comiss) internal { uint tokensPerX = balances[_sendadr].div(tokenDecimals); uint sumPayd = paidETH[_sendadr]; uint sumToPayRes = tokensPerX.mul(accrueCouponsPerXTokenETH+accrueDividendsPerXTokenETH); uint sumToPay = sumToPayRes.sub(comiss); require(sumToPay>sumPayd); sumToPay = sumToPay.sub(sumPayd); _sendadr.transfer(sumToPay); paidETH[_sendadr] = sumToPayRes; } /** * Owner accrue new sum of dividends and coupons (once per month) */ function accrueDividendandCoupons(uint sumDivFinney, uint sumFinneyCoup) public onlyOwner { sumDivFinney = sumDivFinney * 1 finney; sumFinneyCoup = sumFinneyCoup * 1 finney; uint tokens = _totalSupply.div(tokenDecimals); accrueDividendsPerXTokenETH = accrueDividendsPerXTokenETH.add(sumDivFinney.div(tokens)); accrueCouponsPerXTokenETH = accrueCouponsPerXTokenETH.add(sumFinneyCoup.div(tokens)); } /** * Set a price of token to rebuy */ function setTokenPrice(uint priceFinney) public onlyOwner { tokenPriceETH = priceFinney * 1 finney; } event RebuyInformEvent(address indexed adr, uint256 amount); /** * Inform owner that someone whant to sell tokens * The rebuy proccess allowed in 2 weeks after inform * Only after half a year after croudfunding */ function InformRebuy(uint sum) public { _informRebuyTo(sum, msg.sender); } function InformRebuyTo(uint sum, address adr) public onlyOwner{ _informRebuyTo(sum, adr); } function _informRebuyTo(uint sum, address adr) internal{ require (rebuyStarted || (now >= startRebuyTime)); require (sum <= balances[adr]); rebuyInformTime[adr] = now; rebuySum[adr] = sum; RebuyInformEvent(adr, sum); } /** * Owner could allow rebuy proccess early */ function StartRebuy() public onlyOwner{ rebuyStarted = true; } /** * Sell tokens after 2 weeks from information */ function doRebuy() public { _doRebuyTo(msg.sender, 0); } /** * Contract owner would perform tokens rebuy after 2 weeks from information */ function doRebuyTo(address adr) public onlyOwner { _doRebuyTo(adr, tx.gasprice * block.gaslimit); } function _doRebuyTo(address adr, uint comiss) internal { require (rebuyStarted || (now >= startRebuyTime)); require (now >= rebuyInformTime[adr].add(14 days)); uint sum = rebuySum[adr]; require (sum <= balances[adr]); withdrawTo(adr, 0); if (burnTo(sum, adr)) { sum = sum.div(tokenDecimals); sum = sum.mul(tokenPriceETH); sum = sum.div(tokenDecimalsLeft); sum = sum.sub(comiss); adr.transfer(sum); rebuySum[adr] = 0; } } } contract TSBCrowdFundingContract is NamedOwnedToken{ using SafeMath for uint256; enum CrowdSaleState {NotFinished, Success, Failure} CrowdSaleState public crowdSaleState = CrowdSaleState.NotFinished; uint public fundingGoalUSD = 200000; //Min cap uint public fundingMaxCapUSD = 500000; //Max cap uint public priceUSD = 1; //Price in USD per 1 token uint public USDDecimals = 1 ether; uint public startTime; //crowdfunding start time uint public endTime; //crowdfunding end time uint public bonusEndTime; //crowdfunding end of bonus time uint public selfDestroyTime = 2 weeks; TSBToken public tokenReward; //TSB Token to send uint public ETHPrice = 30000; //Current price of one ETH in USD cents uint public BTCPrice = 400000; //Current price of one BTC in USD cents uint public PriceDecimals = 100; uint public ETHCollected = 0; //Collected sum of ETH uint public BTCCollected = 0; //Collected sum of BTC uint public amountRaisedUSD = 0; //Collected sum in USD uint public TokenAmountToPay = 0; //Number of tokens to distribute (excluding bonus tokens) mapping(address => uint256) public balanceMapPos; struct mapStruct { address mapAddress; uint mapBalanceETH; uint mapBalanceBTC; uint bonusTokens; } mapStruct[] public balanceList; //Array of struct with information about invested sums uint public bonusCapUSD = 100000; //Bonus cap mapping(bytes32 => uint256) public bonusesMapPos; struct bonusStruct { uint balancePos; bool notempty; uint maxBonusETH; uint maxBonusBTC; uint bonusETH; uint bonusBTC; uint8 bonusPercent; } bonusStruct[] public bonusesList; //Array of struct with information about bonuses bool public fundingGoalReached = false; bool public crowdsaleClosed = false; event GoalReached(address beneficiary, uint amountRaised); event FundTransfer(address backer, uint amount, bool isContribution); function TSBCrowdFundingContract( uint _startTime, uint durationInHours, string tokenName, string tokenSymbol ) NamedOwnedToken(tokenName, tokenSymbol) public { // require(_startTime >= now); SetStartTime(_startTime, durationInHours); bonusCapUSD = bonusCapUSD * USDDecimals; } function SetStartTime(uint startT, uint durationInHours) public onlyOwner { startTime = startT; bonusEndTime = startT+ 24 hours; endTime = startT + (durationInHours * 1 hours); } function assignTokenContract(address tok) public onlyOwner { tokenReward = TSBToken(tok); tokenReward.transferOwnership(address(this)); } function () public payable { bool withinPeriod = now >= startTime && now <= endTime; bool nonZeroPurchase = msg.value != 0; require( withinPeriod && nonZeroPurchase && (crowdSaleState == CrowdSaleState.NotFinished)); uint bonuspos = 0; if (now <= bonusEndTime) { // lastdata = msg.data; bytes32 code = sha3(msg.data); bonuspos = bonusesMapPos[code]; } ReceiveAmount(msg.sender, msg.value, 0, now, bonuspos); } function CheckBTCtransaction() internal constant returns (bool) { return true; } function AddBTCTransactionFromArray (address[] ETHadress, uint[] BTCnum, uint[] TransTime, bytes4[] bonusdata) public onlyOwner { require(ETHadress.length == BTCnum.length); require(TransTime.length == bonusdata.length); require(ETHadress.length == bonusdata.length); for (uint i = 0; i < ETHadress.length; i++) { AddBTCTransaction(ETHadress[i], BTCnum[i], TransTime[i], bonusdata[i]); } } /** * Add transfered BTC, only owner could call * * @param ETHadress The address of ethereum wallet of sender * @param BTCnum the received amount in BTC * 10^18 * @param TransTime the original (BTC) transaction time */ function AddBTCTransaction (address ETHadress, uint BTCnum, uint TransTime, bytes4 bonusdata) public onlyOwner { require(CheckBTCtransaction()); require((TransTime >= startTime) && (TransTime <= endTime)); require(BTCnum != 0); uint bonuspos = 0; if (TransTime <= bonusEndTime) { // lastdata = bonusdata; bytes32 code = sha3(bonusdata); bonuspos = bonusesMapPos[code]; } ReceiveAmount(ETHadress, 0, BTCnum, TransTime, bonuspos); } modifier afterDeadline() { if (now >= endTime) _; } /** * Set price for ETH and BTC, only owner could call * * @param _ETHPrice ETH price in USD cents * @param _BTCPrice BTC price in USD cents */ function SetCryptoPrice(uint _ETHPrice, uint _BTCPrice) public onlyOwner { ETHPrice = _ETHPrice; BTCPrice = _BTCPrice; } /** * Convert sum in ETH plus BTC to USD * * @param ETH ETH sum in wei * @param BTC BTC sum in 10^18 */ function convertToUSD(uint ETH, uint BTC) public constant returns (uint) { uint _ETH = ETH.mul(ETHPrice); uint _BTC = BTC.mul(BTCPrice); return (_ETH+_BTC).div(PriceDecimals); } /** * Calc collected sum in USD */ function collectedSum() public constant returns (uint) { return convertToUSD(ETHCollected,BTCCollected); } /** * Check if min cap was reached (only after finish of crowdfunding) */ function checkGoalReached() public afterDeadline { amountRaisedUSD = collectedSum(); if (amountRaisedUSD >= (fundingGoalUSD * USDDecimals) ){ crowdSaleState = CrowdSaleState.Success; TokenAmountToPay = amountRaisedUSD; GoalReached(owner, amountRaisedUSD); } else { crowdSaleState = CrowdSaleState.Failure; } } /** * Check if max cap was reached */ function checkMaxCapReached() public { amountRaisedUSD = collectedSum(); if (amountRaisedUSD >= (fundingMaxCapUSD * USDDecimals) ){ crowdSaleState = CrowdSaleState.Success; TokenAmountToPay = amountRaisedUSD; GoalReached(owner, amountRaisedUSD); } } function ReceiveAmount(address investor, uint sumETH, uint sumBTC, uint TransTime, uint bonuspos) internal { require(investor != 0x0); uint pos = balanceMapPos[investor]; if (pos>0) { pos--; assert(pos < balanceList.length); assert(balanceList[pos].mapAddress == investor); balanceList[pos].mapBalanceETH = balanceList[pos].mapBalanceETH.add(sumETH); balanceList[pos].mapBalanceBTC = balanceList[pos].mapBalanceBTC.add(sumBTC); } else { mapStruct memory newStruct; newStruct.mapAddress = investor; newStruct.mapBalanceETH = sumETH; newStruct.mapBalanceBTC = sumBTC; newStruct.bonusTokens = 0; pos = balanceList.push(newStruct); balanceMapPos[investor] = pos; pos--; } // update state ETHCollected = ETHCollected.add(sumETH); BTCCollected = BTCCollected.add(sumBTC); checkBonus(pos, sumETH, sumBTC, TransTime, bonuspos); checkMaxCapReached(); } uint public DistributionNextPos = 0; /** * Distribute tokens to next N participants, only owner could call */ function DistributeNextNTokens(uint n) public payable onlyOwner { require(BonusesDistributed); require(DistributionNextPos<balanceList.length); uint nextpos; if (n == 0) { nextpos = balanceList.length; } else { nextpos = DistributionNextPos.add(n); if (nextpos > balanceList.length) { nextpos = balanceList.length; } } uint TokenAmountToPay_local = TokenAmountToPay; for (uint i = DistributionNextPos; i < nextpos; i++) { uint USDbalance = convertToUSD(balanceList[i].mapBalanceETH, balanceList[i].mapBalanceBTC); uint tokensCount = USDbalance.mul(priceUSD); tokenReward.mintToken(balanceList[i].mapAddress, tokensCount + balanceList[i].bonusTokens); TokenAmountToPay_local = TokenAmountToPay_local.sub(tokensCount); balanceList[i].mapBalanceETH = 0; balanceList[i].mapBalanceBTC = 0; } TokenAmountToPay = TokenAmountToPay_local; DistributionNextPos = nextpos; } function finishDistribution() onlyOwner { require ((TokenAmountToPay == 0)||(DistributionNextPos >= balanceList.length)); // tokenReward.finishMinting(); tokenReward.transferOwnership(owner); selfdestruct(owner); } /** * Withdraw the funds * * Checks to see if goal was not reached, each contributor can withdraw * the amount they contributed. */ function safeWithdrawal() public afterDeadline { require(crowdSaleState == CrowdSaleState.Failure); uint pos = balanceMapPos[msg.sender]; require((pos>0)&&(pos<=balanceList.length)); pos--; uint amount = balanceList[pos].mapBalanceETH; balanceList[pos].mapBalanceETH = 0; if (amount > 0) { msg.sender.transfer(amount); FundTransfer(msg.sender, amount, false); } } /** * If something goes wrong owner could destroy the contract after 2 weeks from the crowdfunding end * In this case the token distribution or sum refund will be performed in mannual */ function killContract() public onlyOwner { require(now >= endTime + selfDestroyTime); tokenReward.transferOwnership(owner); selfdestruct(owner); } /** * Add a new bonus code, only owner could call */ function AddBonusToListFromArray(bytes32[] bonusCode, uint[] ETHsumInFinney, uint[] BTCsumInFinney) public onlyOwner { require(bonusCode.length == ETHsumInFinney.length); require(bonusCode.length == BTCsumInFinney.length); for (uint i = 0; i < bonusCode.length; i++) { AddBonusToList(bonusCode[i], ETHsumInFinney[i], BTCsumInFinney[i] ); } } /** * Add a new bonus code, only owner could call */ function AddBonusToList(bytes32 bonusCode, uint ETHsumInFinney, uint BTCsumInFinney) public onlyOwner { uint pos = bonusesMapPos[bonusCode]; if (pos > 0) { pos -= 1; bonusesList[pos].maxBonusETH = ETHsumInFinney * 1 finney; bonusesList[pos].maxBonusBTC = BTCsumInFinney * 1 finney; } else { bonusStruct memory newStruct; newStruct.balancePos = 0; newStruct.notempty = false; newStruct.maxBonusETH = ETHsumInFinney * 1 finney; newStruct.maxBonusBTC = BTCsumInFinney * 1 finney; newStruct.bonusETH = 0; newStruct.bonusBTC = 0; newStruct.bonusPercent = 20; pos = bonusesList.push(newStruct); bonusesMapPos[bonusCode] = pos; } } bool public BonusesDistributed = false; uint public BonusCalcPos = 0; // bytes public lastdata; function checkBonus(uint newBalancePos, uint sumETH, uint sumBTC, uint TransTime, uint pos) internal { if (pos > 0) { pos--; if (!bonusesList[pos].notempty) { bonusesList[pos].balancePos = newBalancePos; bonusesList[pos].notempty = true; } else { if (bonusesList[pos].balancePos != newBalancePos) return; } bonusesList[pos].bonusETH = bonusesList[pos].bonusETH.add(sumETH); // if (bonusesList[pos].bonusETH > bonusesList[pos].maxBonusETH) // bonusesList[pos].bonusETH = bonusesList[pos].maxBonusETH; bonusesList[pos].bonusBTC = bonusesList[pos].bonusBTC.add(sumBTC); // if (bonusesList[pos].bonusBTC > bonusesList[pos].maxBonusBTC) // bonusesList[pos].bonusBTC = bonusesList[pos].maxBonusBTC; } } /** * Calc the number of bonus tokens for N next bonus participants, only owner could call */ function calcNextNBonuses(uint N) public onlyOwner { require(crowdSaleState == CrowdSaleState.Success); require(!BonusesDistributed); uint nextPos = BonusCalcPos + N; if (nextPos > bonusesList.length) nextPos = bonusesList.length; uint bonusCapUSD_local = bonusCapUSD; for (uint i = BonusCalcPos; i < nextPos; i++) { if ((bonusesList[i].notempty) && (bonusesList[i].balancePos < balanceList.length)) { uint maxbonus = convertToUSD(bonusesList[i].maxBonusETH, bonusesList[i].maxBonusBTC); uint bonus = convertToUSD(bonusesList[i].bonusETH, bonusesList[i].bonusBTC); if (maxbonus < bonus) bonus = maxbonus; bonus = bonus.mul(priceUSD); if (bonusCapUSD_local >= bonus) { bonusCapUSD_local = bonusCapUSD_local - bonus; } else { bonus = bonusCapUSD_local; bonusCapUSD_local = 0; } bonus = bonus.mul(bonusesList[i].bonusPercent) / 100; balanceList[bonusesList[i].balancePos].bonusTokens = bonus; if (bonusCapUSD_local == 0) { BonusesDistributed = true; break; } } } bonusCapUSD = bonusCapUSD_local; BonusCalcPos = nextPos; if (nextPos >= bonusesList.length) { BonusesDistributed = true; } } }
Total number of token issued (1 token = 10^decimals)
uint256 public _totalSupply = 0;
12,838,127
[ 1, 4625, 348, 7953, 560, 30, 10710, 1300, 434, 1147, 16865, 261, 21, 1147, 273, 1728, 66, 31734, 13, 203, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 2254, 5034, 1071, 389, 4963, 3088, 1283, 273, 374, 31, 225, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// SPDX-License-Identifier: Apache-2.0 // Code from https://github.com/ethereum/solidity-examples pragma solidity >=0.6.0; pragma experimental ABIEncoderV2; library Bits { uint256 internal constant ONE = uint256(1); uint256 internal constant ONES = type(uint256).max; // Sets the bit at the given 'index' in 'self' to '1'. // Returns the modified value. function setBit(uint256 self, uint8 index) internal pure returns (uint256) { return self | (ONE << index); } // Sets the bit at the given 'index' in 'self' to '0'. // Returns the modified value. function clearBit(uint256 self, uint8 index) internal pure returns (uint256) { return self & ~(ONE << index); } // Sets the bit at the given 'index' in 'self' to: // '1' - if the bit is '0' // '0' - if the bit is '1' // Returns the modified value. function toggleBit(uint256 self, uint8 index) internal pure returns (uint256) { return self ^ (ONE << index); } // Get the value of the bit at the given 'index' in 'self'. function bit(uint256 self, uint8 index) internal pure returns (uint8) { return uint8((self >> index) & 1); } // Check if the bit at the given 'index' in 'self' is set. // Returns: // 'true' - if the value of the bit is '1' // 'false' - if the value of the bit is '0' function bitSet(uint256 self, uint8 index) internal pure returns (bool) { return (self >> index) & 1 == 1; } // Checks if the bit at the given 'index' in 'self' is equal to the corresponding // bit in 'other'. // Returns: // 'true' - if both bits are '0' or both bits are '1' // 'false' - otherwise function bitEqual( uint256 self, uint256 other, uint8 index ) internal pure returns (bool) { return ((self ^ other) >> index) & 1 == 0; } // Get the bitwise NOT of the bit at the given 'index' in 'self'. function bitNot(uint256 self, uint8 index) internal pure returns (uint8) { return uint8(1 - ((self >> index) & 1)); } // Computes the bitwise AND of the bit at the given 'index' in 'self', and the // corresponding bit in 'other', and returns the value. function bitAnd( uint256 self, uint256 other, uint8 index ) internal pure returns (uint8) { return uint8(((self & other) >> index) & 1); } // Computes the bitwise OR of the bit at the given 'index' in 'self', and the // corresponding bit in 'other', and returns the value. function bitOr( uint256 self, uint256 other, uint8 index ) internal pure returns (uint8) { return uint8(((self | other) >> index) & 1); } // Computes the bitwise XOR of the bit at the given 'index' in 'self', and the // corresponding bit in 'other', and returns the value. function bitXor( uint256 self, uint256 other, uint8 index ) internal pure returns (uint8) { return uint8(((self ^ other) >> index) & 1); } // Gets 'numBits' consecutive bits from 'self', starting from the bit at 'startIndex'. // Returns the bits as a 'uint'. // Requires that: // - '0 < numBits <= 256' // - 'startIndex < 256' // - 'numBits + startIndex <= 256' function bits( uint256 self, uint8 startIndex, uint16 numBits ) internal pure returns (uint256) { require(0 < numBits && startIndex < 256 && startIndex + numBits <= 256); return (self >> startIndex) & (ONES >> (256 - numBits)); } // Computes the index of the highest bit set in 'self'. // Returns the highest bit set as an 'uint8'. // Requires that 'self != 0'. function highestBitSet(uint256 self) internal pure returns (uint8 highest) { require(self != 0); uint256 val = self; for (uint8 i = 128; i >= 1; i >>= 1) { if (val & (((ONE << i) - 1) << i) != 0) { highest += i; val >>= i; } } } // Computes the index of the lowest bit set in 'self'. // Returns the lowest bit set as an 'uint8'. // Requires that 'self != 0'. function lowestBitSet(uint256 self) internal pure returns (uint8 lowest) { require(self != 0); uint256 val = self; for (uint8 i = 128; i >= 1; i >>= 1) { if (val & ((ONE << i) - 1) == 0) { lowest += i; val >>= i; } } } }
Computes the index of the lowest bit set in 'self'. Returns the lowest bit set as an 'uint8'. Requires that 'self != 0'.
function lowestBitSet(uint256 self) internal pure returns (uint8 lowest) { require(self != 0); uint256 val = self; for (uint8 i = 128; i >= 1; i >>= 1) { if (val & ((ONE << i) - 1) == 0) { lowest += i; val >>= i; } } }
6,387,449
[ 1, 4625, 348, 7953, 560, 30, 225, 14169, 281, 326, 770, 434, 326, 11981, 2831, 444, 316, 296, 2890, 10332, 2860, 326, 11981, 2831, 444, 487, 392, 296, 11890, 28, 10332, 16412, 716, 296, 2890, 480, 374, 10332, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 1545, 404, 31, 277, 23359, 404, 13, 288, 203, 5411, 309, 261, 1125, 473, 14015, 5998, 2296, 277, 13, 300, 404, 13, 422, 374, 13, 288, 203, 7734, 11981, 1011, 277, 31, 203, 7734, 1244, 23359, 277, 31, 203, 5411, 289, 203, 3639, 289, 203, 565, 289, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// SPDX-License-Identifier: MIT pragma solidity 0.7.6; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import "@openzeppelin/contracts/math/Math.sol"; import '@openzeppelin/contracts/math/SafeMath.sol'; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import './libs/FuzionAuth.sol'; /** * @title Vesting Contract For TeslaSafe HODL Contest Winners * @author Boba Chef @FuzionChain @BobaGroup * @notice TeslaSafe will be vested over the course of 1 year without a cliff * for those in extended contest they can not withdraw until after a year is up */ contract TeslaSafeVesting is FuzionAuth, ReentrancyGuard, Pausable { using SafeMath for uint256; using SafeERC20 for IERC20; IERC20 public teslasafe; struct UserInfo { uint256 index; uint256 amount; uint256 startTime; uint256 endTime; uint256 totalWithdrawn; uint256 donationAmount; bool hasSold; bool extendedContest; } address[] private userList; uint256 public VESTING_DURATION = 365 days; // global stats uint256 public totalTeslaSafeRewards = 0; uint256 public totalTeslaSafeWithdrawn = 0; uint256 public totalTeslaSafeDonated = 0; // Info of each user that has won the contest mapping(address => UserInfo) public userInfo; constructor(address tsAddress) FuzionAuth(msg.sender) { teslasafe = IERC20(tsAddress); } /** * @notice Checks if the msg.sender is a contract or a proxy */ modifier notContract() { require(!_isContract(msg.sender), "TeslaSafeVesting: contract not allowed"); require(msg.sender == tx.origin, "TeslaSafeVesting: proxy contract not allowed"); _; } event WinnerAdded(address indexed winner, uint256 amount, uint256 startTime, uint256 endTime, uint256 donationAmount, bool extendedContest); event WinnerUpdated(address indexed winner, uint256 amount, uint256 startTime, uint256 endTime, uint256 donationAmount, bool extendedContest); event WinnerRemoved(address indexed winner); event VestingPaused(address indexed winner); event VestingUnpaused(address indexed winner); event Withdraw(address indexed user, uint256 amount); event TokenRecovered(address token, uint256 amount); event Donation(address indexed user, uint256 amount); /// @notice Add vesting /// @param startTime if 0 will default to block timestamp /// @param donatePercentage will calculate the donation amount based on donatePercentage function add(address wallet, uint256 amount, uint256 startTime, uint16 donatePercentage, bool extendedContest) public authorizedFor(Permission.Admin) { require(!isUserInfo(wallet), 'TeslaSafeVesting: user already added'); require(donatePercentage <= 100, 'TeslaSafeVesting: invalid donate percentage'); uint256 donationAmount = amount.mul(donatePercentage).div(100); // update stats totalTeslaSafeRewards = totalTeslaSafeRewards.add(amount); totalTeslaSafeDonated = totalTeslaSafeDonated.add(donationAmount); // update userInfo userInfo[wallet].donationAmount = donationAmount; userInfo[wallet].amount = amount.sub(donationAmount); userInfo[wallet].startTime = startTime == 0 ? block.timestamp : startTime; userInfo[wallet].endTime = startTime.add(VESTING_DURATION); userInfo[wallet].extendedContest = extendedContest; // update userList userList.push(wallet); userInfo[wallet].index = userList.length - 1; emit WinnerAdded(wallet, userInfo[wallet].amount, userInfo[wallet].startTime, userInfo[wallet].endTime, donationAmount, extendedContest); } /** * @notice Update vesting details * @dev can update `amount` `startTime` `donationAmount` values and update globals accordingly */ function set(address wallet, uint256 amount, uint256 startTime, uint256 donationAmount, bool extendedContest) public authorizedFor(Permission.Admin) { require(isUserInfo(wallet), 'user has not been added'); // update totalTeslaSafeRewards from previous amount to updated amount totalTeslaSafeRewards = totalTeslaSafeRewards.sub(userInfo[wallet].amount).sub(userInfo[wallet].donationAmount).add(amount).add(donationAmount); totalTeslaSafeDonated = totalTeslaSafeDonated.sub(userInfo[wallet].donationAmount).add(donationAmount); userInfo[wallet].amount = amount; userInfo[wallet].donationAmount = donationAmount; userInfo[wallet].startTime = startTime == 0 ? block.timestamp : startTime; userInfo[wallet].endTime = startTime.add(VESTING_DURATION); userInfo[wallet].extendedContest = extendedContest; emit WinnerUpdated(wallet, amount, userInfo[wallet].startTime, userInfo[wallet].endTime, donationAmount, extendedContest); } /** * @notice Remove vesting * @dev removes `wallet` from vesting, updates globals, lowers the userCount */ function remove(address wallet) public onlyOwner { require(isUserInfo(wallet), 'TeslaSafeVesting: user has not been added'); // remove from global stats totalTeslaSafeRewards = totalTeslaSafeRewards.sub(userInfo[wallet].amount).add(userInfo[wallet].totalWithdrawn).sub(userInfo[wallet].donationAmount); totalTeslaSafeDonated = totalTeslaSafeDonated.sub(userInfo[wallet].donationAmount); uint256 indexToDelete = userInfo[wallet].index; address userToMove = userList[userList.length - 1]; userList[indexToDelete] = userToMove; userInfo[userToMove].index = indexToDelete; userList.pop(); emit WinnerRemoved(wallet); } /// @notice Pause a user's rewards so they can not withdraw /// @dev set hasSold flag to true for user /// @dev Admin permission needed function pauseUser(address userAddress) public authorizedFor(Permission.Admin) { userInfo[userAddress].hasSold = true; emit VestingPaused(userAddress); } /// @notice Unpause a user's rewards so they can withdraw again /// @dev set hasSold flag to false for user /// @dev Admin permission needed function unpauseUser(address userAddress) public authorizedFor(Permission.Admin) { userInfo[userAddress].hasSold = false; emit VestingUnpaused(userAddress); } /** * @notice Calculates the amount that has already vested but hasn't been withdrawn yet. * @dev We check contract balance in the withdraw step */ function vestedAmount(address wallet) public view returns (uint256) { if (blockTimestamp() < userInfo[wallet].startTime) { return 0; } uint256 elapsedTime = blockTimestamp().sub(userInfo[wallet].startTime); // If over vesting duration, all tokens vested if (elapsedTime >= VESTING_DURATION) { return userInfo[wallet].amount.sub(userInfo[wallet].totalWithdrawn); } else { if (userInfo[wallet].extendedContest) { return 0; } // amount * (time_elapsed / vesting_duration) uint256 vested = userInfo[wallet].amount.mul(elapsedTime).div(VESTING_DURATION); uint256 unreleased = vested.sub(userInfo[wallet].totalWithdrawn); return unreleased; } } /** * @notice Withdraw vested amount for user that hasn't been withdrawn yet * @dev We will never withdraw more than the contract balance */ function withdraw() public notContract nonReentrant whenNotPaused { require(isUserInfo(msg.sender), 'TeslaSafeVesting: User has no rewards'); require(!userInfo[msg.sender].hasSold, "TeslaSafeVesting: User has sold and no longer qualifies"); uint256 vested = vestedAmount(msg.sender); require(vested > 0, "TeslaSafeVesting: No TeslaSafe to release"); uint256 withdrawAmount = Math.min(teslasafe.balanceOf(address(this)), vested); totalTeslaSafeWithdrawn = totalTeslaSafeWithdrawn.add(withdrawAmount); userInfo[msg.sender].totalWithdrawn = userInfo[msg.sender].totalWithdrawn.add(withdrawAmount); teslasafe.safeTransfer(msg.sender, withdrawAmount); emit Withdraw(msg.sender, withdrawAmount); } /// @notice Returns the current block timestamp function blockTimestamp() public view virtual returns (uint256) { return block.timestamp; } /// @dev Returns the amount of TeslaSafe that needs to be deposited into contract function toDeposit() external view returns (uint256) { uint256 currentBalance = teslasafe.balanceOf(address(this)); uint256 totalDeposited = currentBalance.add(totalTeslaSafeWithdrawn); if (totalTeslaSafeRewards.sub(totalTeslaSafeDonated) <= totalDeposited) { return 0; } return totalTeslaSafeRewards.sub(totalDeposited).sub(totalTeslaSafeDonated); } /// @dev Returns the amount of TeslaSafe that is available function extraBalance() external view returns (uint256) { uint256 currentBalance = teslasafe.balanceOf(address(this)); uint256 totalDeposited = currentBalance + totalTeslaSafeWithdrawn; if (totalDeposited <= totalTeslaSafeRewards.sub(totalTeslaSafeDonated)) { return 0; } return totalDeposited.sub(totalTeslaSafeRewards.sub(totalTeslaSafeDonated)); } /** * @notice Allows owner to withdraw TeslaSafe * @dev Only callable by owner * @param amount The amount of TeslaSafe to withdraw */ function withdrawTeslaSafe(uint256 amount) external onlyOwner { require(amount <= teslasafe.balanceOf(address(this)), 'TeslaSafeVesting: Not enough teslasafe'); require(amount > 0, 'TeslaSafeVesting: Must withdraw at least 1 teslasafe'); teslasafe.safeTransfer(address(msg.sender), amount); } /** * @notice Allows owner to recover tokens sent to the contract * @param tokenAddress: the address of the token to withdraw * @param tokenAmount: the number of token amount to withdraw * @dev Only callable by owner. */ function recoverTokens(address tokenAddress, uint256 tokenAmount) external onlyOwner { require(tokenAddress != address(teslasafe), "TeslsSafeVesting: Cannot be TeslaSafe"); tokenAmount = tokenAmount == 0 ? IERC20(tokenAddress).balanceOf(address(this)) : tokenAmount; IERC20(tokenAddress).safeTransfer(address(msg.sender), tokenAmount); emit TokenRecovered(tokenAddress, tokenAmount); } /** * @notice Pause the contract so no withdrawals can occur * @dev In case exploit is found this pauses the contract */ function pause() external authorizedFor(Permission.Admin) { _pause(); } /** * @notice Unpause the contract and resume normal operations */ function unpause() external authorizedFor(Permission.Admin) { _unpause(); } /// @notice Returns the number of users function userCount() public view returns (uint256 userCount_) { userCount_ = userList.length; } /// Is this `wallet` a user function isUserInfo(address wallet) public view returns (bool) { if (userList.length == 0) return false; return (userList[userInfo[wallet].index] == wallet); } /// The amount of TeslaSafe currently held in this contract function teslaSafeBalance() external view returns (uint256){ return teslasafe.balanceOf(address(this)); } /** * @notice Checks if address is a contract * @dev It prevents this contract from being targeted by bad actors */ function _isContract(address addr) internal view returns (bool) { uint256 size; assembly { size := extcodesize(addr) } return size > 0; } }
* @notice Remove vesting @dev removes `wallet` from vesting, updates globals, lowers the userCount/ remove from global stats
function remove(address wallet) public onlyOwner { require(isUserInfo(wallet), 'TeslaSafeVesting: user has not been added'); totalTeslaSafeRewards = totalTeslaSafeRewards.sub(userInfo[wallet].amount).add(userInfo[wallet].totalWithdrawn).sub(userInfo[wallet].donationAmount); totalTeslaSafeDonated = totalTeslaSafeDonated.sub(userInfo[wallet].donationAmount); uint256 indexToDelete = userInfo[wallet].index; address userToMove = userList[userList.length - 1]; userList[indexToDelete] = userToMove; userInfo[userToMove].index = indexToDelete; userList.pop(); emit WinnerRemoved(wallet); }
12,858,065
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 20392, 3581, 331, 10100, 632, 5206, 7157, 1375, 19177, 68, 628, 331, 10100, 16, 4533, 10941, 16, 4587, 414, 326, 729, 1380, 19, 1206, 628, 2552, 3177, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 1206, 12, 2867, 9230, 13, 1071, 1338, 5541, 288, 203, 3639, 2583, 12, 291, 21015, 12, 19177, 3631, 296, 56, 281, 11821, 9890, 58, 10100, 30, 729, 711, 486, 2118, 3096, 8284, 203, 203, 3639, 2078, 56, 281, 11821, 9890, 17631, 14727, 273, 2078, 56, 281, 11821, 9890, 17631, 14727, 18, 1717, 12, 1355, 966, 63, 19177, 8009, 8949, 2934, 1289, 12, 1355, 966, 63, 19177, 8009, 4963, 1190, 9446, 82, 2934, 1717, 12, 1355, 966, 63, 19177, 8009, 19752, 367, 6275, 1769, 203, 3639, 2078, 56, 281, 11821, 9890, 22293, 690, 273, 2078, 56, 281, 11821, 9890, 22293, 690, 18, 1717, 12, 1355, 966, 63, 19177, 8009, 19752, 367, 6275, 1769, 203, 203, 3639, 2254, 5034, 770, 14976, 273, 16753, 63, 19177, 8009, 1615, 31, 203, 3639, 1758, 729, 774, 7607, 273, 729, 682, 63, 1355, 682, 18, 2469, 300, 404, 15533, 203, 3639, 729, 682, 63, 1615, 14976, 65, 273, 729, 774, 7607, 31, 203, 3639, 16753, 63, 1355, 774, 7607, 8009, 1615, 273, 770, 14976, 31, 203, 3639, 729, 682, 18, 5120, 5621, 203, 203, 3639, 3626, 678, 7872, 10026, 12, 19177, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.4.18; contract DataSourceInterface { function isDataSource() public pure returns (bool); function getGroupResult(uint matchId) external; function getRoundOfSixteenTeams(uint index) external; function getRoundOfSixteenResult(uint matchId) external; function getQuarterResult(uint matchId) external; function getSemiResult(uint matchId) external; function getFinalTeams() external; function getYellowCards() external; function getRedCards() external; } /** * @title DataLayer. * @author CryptoCup Team (https://cryptocup.io/about) */ contract DataLayer{ uint256 constant WCCTOKEN_CREATION_LIMIT = 5000000; uint256 constant STARTING_PRICE = 45 finney; /// Epoch times based on when the prices change. uint256 constant FIRST_PHASE = 1527476400; uint256 constant SECOND_PHASE = 1528081200; uint256 constant THIRD_PHASE = 1528686000; uint256 constant WORLD_CUP_START = 1528945200; DataSourceInterface public dataSource; address public dataSourceAddress; address public adminAddress; uint256 public deploymentTime = 0; uint256 public gameFinishedTime = 0; //set this to now when oraclize was called. uint32 public lastCalculatedToken = 0; uint256 public pointsLimit = 0; uint32 public lastCheckedToken = 0; uint32 public winnerCounter = 0; uint32 public lastAssigned = 0; uint256 public auxWorstPoints = 500000000; uint32 public payoutRange = 0; uint32 public lastPrizeGiven = 0; uint256 public prizePool = 0; uint256 public adminPool = 0; uint256 public finalizedTime = 0; enum teamState { None, ROS, QUARTERS, SEMIS, FINAL } enum pointsValidationState { Unstarted, LimitSet, LimitCalculated, OrderChecked, TopWinnersAssigned, WinnersAssigned, Finished } /** * groups1 scores of the first half of matches (8 bits each) * groups2 scores of the second half of matches (8 bits each) * brackets winner&#39;s team ids of each round (5 bits each) * timeStamp creation timestamp * extra number of yellow and red cards (16 bits each) */ struct Token { uint192 groups1; uint192 groups2; uint160 brackets; uint64 timeStamp; uint32 extra; } struct GroupResult{ uint8 teamOneGoals; uint8 teamTwoGoals; } struct BracketPhase{ uint8[16] roundOfSixteenTeamsIds; mapping (uint8 => bool) teamExists; mapping (uint8 => teamState) middlePhaseTeamsIds; uint8[4] finalsTeamsIds; } struct Extras { uint16 yellowCards; uint16 redCards; } // List of all tokens Token[] tokens; GroupResult[48] groupsResults; BracketPhase bracketsResults; Extras extraResults; // List of all tokens that won uint256[] sortedWinners; // List of the worst tokens (they also win) uint256[] worstTokens; pointsValidationState public pValidationState = pointsValidationState.Unstarted; mapping (address => uint256[]) public tokensOfOwnerMap; mapping (uint256 => address) public ownerOfTokenMap; mapping (uint256 => address) public tokensApprovedMap; mapping (uint256 => uint256) public tokenToPayoutMap; mapping (uint256 => uint16) public tokenToPointsMap; event LogTokenBuilt(address creatorAddress, uint256 tokenId, Token token); event LogDataSourceCallbackList(uint8[] result); event LogDataSourceCallbackInt(uint8 result); event LogDataSourceCallbackTwoInt(uint8 result, uint8 result2); } ///Author Dieter Shirley (https://github.com/dete) contract ERC721 { event LogTransfer(address from, address to, uint256 tokenId); event LogApproval(address owner, address approved, uint256 tokenId); function name() public view returns (string); function symbol() public view returns (string); function totalSupply() public view returns (uint256 total); function balanceOf(address _owner) public view returns (uint256 balance); function ownerOf(uint256 _tokenId) external view returns (address owner); function approve(address _to, uint256 _tokenId) external; function transfer(address _to, uint256 _tokenId) external; function transferFrom(address _from, address _to, uint256 _tokenId) external; function tokensOfOwner(address _owner) external view returns (uint256[] tokenIds); } /** * @title AccessControlLayer * @author CryptoCup Team (https://cryptocup.io/about) * @dev Containes basic admin modifiers to restrict access to some functions. Allows * for pauseing, and setting emergency stops. */ contract AccessControlLayer is DataLayer{ bool public paused = false; bool public finalized = false; bool public saleOpen = true; /** * @dev Main modifier to limit access to delicate functions. */ modifier onlyAdmin() { require(msg.sender == adminAddress); _; } /** * @dev Modifier that checks that the contract is not paused */ modifier isNotPaused() { require(!paused); _; } /** * @dev Modifier that checks that the contract is paused */ modifier isPaused() { require(paused); _; } /** * @dev Modifier that checks that the contract has finished successfully */ modifier hasFinished() { require((gameFinishedTime != 0) && now >= (gameFinishedTime + (15 days))); _; } /** * @dev Modifier that checks that the contract has finalized */ modifier hasFinalized() { require(finalized); _; } /** * @dev Checks if pValidationState is in the provided stats * @param state State required to run */ modifier checkState(pointsValidationState state){ require(pValidationState == state); _; } /** * @dev Transfer contract&#39;s ownership * @param _newAdmin Address to be set */ function setAdmin(address _newAdmin) external onlyAdmin { require(_newAdmin != address(0)); adminAddress = _newAdmin; } /** * @dev Sets the contract pause state * @param state True to pause */ function setPauseState(bool state) external onlyAdmin { paused = state; } /** * @dev Sets the contract to finalized * @param state True to finalize */ function setFinalized(bool state) external onlyAdmin { paused = state; finalized = state; if(finalized == true) finalizedTime = now; } } /** * @title CryptoCupToken, main implemantations of the ERC721 standard * @author CryptoCup Team (https://cryptocup.io/about) */ contract CryptocupToken is AccessControlLayer, ERC721 { //FUNCTIONALTIY /** * @notice checks if a user owns a token * @param userAddress - The address to check. * @param tokenId - ID of the token that needs to be verified. * @return true if the userAddress provided owns the token. */ function _userOwnsToken(address userAddress, uint256 tokenId) internal view returns (bool){ return ownerOfTokenMap[tokenId] == userAddress; } /** * @notice checks if the address provided is approved for a given token * @param userAddress * @param tokenId * @return true if it is aproved */ function _tokenIsApproved(address userAddress, uint256 tokenId) internal view returns (bool) { return tokensApprovedMap[tokenId] == userAddress; } /** * @notice transfers the token specified from sneder address to receiver address. * @param fromAddress the sender address that initially holds the token. * @param toAddress the receipient of the token. * @param tokenId ID of the token that will be sent. */ function _transfer(address fromAddress, address toAddress, uint256 tokenId) internal { require(tokensOfOwnerMap[toAddress].length < 100); require(pValidationState == pointsValidationState.Unstarted); tokensOfOwnerMap[toAddress].push(tokenId); ownerOfTokenMap[tokenId] = toAddress; uint256[] storage tokenArray = tokensOfOwnerMap[fromAddress]; for (uint256 i = 0; i < tokenArray.length; i++){ if(tokenArray[i] == tokenId){ tokenArray[i] = tokenArray[tokenArray.length-1]; } } delete tokenArray[tokenArray.length-1]; tokenArray.length--; delete tokensApprovedMap[tokenId]; } /** * @notice Approve the address for a given token * @param tokenId - ID of token to be approved * @param userAddress - Address that will be approved */ function _approve(uint256 tokenId, address userAddress) internal { tokensApprovedMap[tokenId] = userAddress; } /** * @notice set token owner to an address * @dev sets token owner on the contract data structures * @param ownerAddress address to be set * @param tokenId Id of token to be used */ function _setTokenOwner(address ownerAddress, uint256 tokenId) internal{ tokensOfOwnerMap[ownerAddress].push(tokenId); ownerOfTokenMap[tokenId] = ownerAddress; } //ERC721 INTERFACE function name() public view returns (string){ return "Cryptocup"; } function symbol() public view returns (string){ return "CC"; } function balanceOf(address userAddress) public view returns (uint256 count) { return tokensOfOwnerMap[userAddress].length; } function transfer(address toAddress,uint256 tokenId) external isNotPaused { require(toAddress != address(0)); require(toAddress != address(this)); require(_userOwnsToken(msg.sender, tokenId)); _transfer(msg.sender, toAddress, tokenId); LogTransfer(msg.sender, toAddress, tokenId); } function transferFrom(address fromAddress, address toAddress, uint256 tokenId) external isNotPaused { require(toAddress != address(0)); require(toAddress != address(this)); require(_tokenIsApproved(msg.sender, tokenId)); require(_userOwnsToken(fromAddress, tokenId)); _transfer(fromAddress, toAddress, tokenId); LogTransfer(fromAddress, toAddress, tokenId); } function approve( address toAddress, uint256 tokenId) external isNotPaused { require(toAddress != address(0)); require(_userOwnsToken(msg.sender, tokenId)); _approve(tokenId, toAddress); LogApproval(msg.sender, toAddress, tokenId); } function totalSupply() public view returns (uint) { return tokens.length; } function ownerOf(uint256 tokenId) external view returns (address ownerAddress) { ownerAddress = ownerOfTokenMap[tokenId]; require(ownerAddress != address(0)); } function tokensOfOwner(address ownerAddress) external view returns(uint256[] tokenIds) { tokenIds = tokensOfOwnerMap[ownerAddress]; } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn&#39;t hold return c; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * @title GameLogicLayer, contract in charge of everything related to calculating points, asigning * winners, and distributing prizes. * @author CryptoCup Team (https://cryptocup.io/about) */ contract GameLogicLayer is CryptocupToken{ using SafeMath for *; uint8 TEAM_RESULT_MASK_GROUPS = 15; uint160 RESULT_MASK_BRACKETS = 31; uint16 EXTRA_MASK_BRACKETS = 65535; uint16 private lastPosition; uint16 private superiorQuota; uint16[] private payDistributionAmount = [1,1,1,1,1,1,1,1,1,1,5,5,10,20,50,100,100,200,500,1500,2500]; uint32[] private payoutDistribution; event LogGroupDataArrived(uint matchId, uint8 result, uint8 result2); event LogRoundOfSixteenArrived(uint id, uint8 result); event LogMiddlePhaseArrived(uint matchId, uint8 result); event LogFinalsArrived(uint id, uint8[4] result); event LogExtrasArrived(uint id, uint16 result); //ORACLIZE function dataSourceGetGroupResult(uint matchId) external onlyAdmin{ dataSource.getGroupResult(matchId); } function dataSourceGetRoundOfSixteen(uint index) external onlyAdmin{ dataSource.getRoundOfSixteenTeams(index); } function dataSourceGetRoundOfSixteenResult(uint matchId) external onlyAdmin{ dataSource.getRoundOfSixteenResult(matchId); } function dataSourceGetQuarterResult(uint matchId) external onlyAdmin{ dataSource.getQuarterResult(matchId); } function dataSourceGetSemiResult(uint matchId) external onlyAdmin{ dataSource.getSemiResult(matchId); } function dataSourceGetFinals() external onlyAdmin{ dataSource.getFinalTeams(); } function dataSourceGetYellowCards() external onlyAdmin{ dataSource.getYellowCards(); } function dataSourceGetRedCards() external onlyAdmin{ dataSource.getRedCards(); } /** * @notice sets a match result to the contract storage * @param matchId id of match to check * @param result number of goals the first team scored * @param result2 number of goals the second team scored */ function dataSourceCallbackGroup(uint matchId, uint8 result, uint8 result2) public { require (msg.sender == dataSourceAddress); require (matchId >= 0 && matchId <= 47); groupsResults[matchId].teamOneGoals = result; groupsResults[matchId].teamTwoGoals = result2; LogGroupDataArrived(matchId, result, result2); } /** * @notice sets the sixteen teams that made it through groups to the contract storage * @param id index of sixteen teams * @param result results to be set */ function dataSourceCallbackRoundOfSixteen(uint id, uint8 result) public { require (msg.sender == dataSourceAddress); bracketsResults.roundOfSixteenTeamsIds[id] = result; bracketsResults.teamExists[result] = true; LogRoundOfSixteenArrived(id, result); } function dataSourceCallbackTeamId(uint matchId, uint8 result) public { require (msg.sender == dataSourceAddress); teamState state = bracketsResults.middlePhaseTeamsIds[result]; if (matchId >= 48 && matchId <= 55){ if (state < teamState.ROS) bracketsResults.middlePhaseTeamsIds[result] = teamState.ROS; } else if (matchId >= 56 && matchId <= 59){ if (state < teamState.QUARTERS) bracketsResults.middlePhaseTeamsIds[result] = teamState.QUARTERS; } else if (matchId == 60 || matchId == 61){ if (state < teamState.SEMIS) bracketsResults.middlePhaseTeamsIds[result] = teamState.SEMIS; } LogMiddlePhaseArrived(matchId, result); } /** * @notice sets the champion, second, third and fourth teams to the contract storage * @param id * @param result ids of the four teams */ function dataSourceCallbackFinals(uint id, uint8[4] result) public { require (msg.sender == dataSourceAddress); uint256 i; for(i = 0; i < 4; i++){ bracketsResults.finalsTeamsIds[i] = result[i]; } LogFinalsArrived(id, result); } /** * @notice sets the number of cards to the contract storage * @param id 101 for yellow cards, 102 for red cards * @param result amount of cards */ function dataSourceCallbackExtras(uint id, uint16 result) public { require (msg.sender == dataSourceAddress); if (id == 101){ extraResults.yellowCards = result; } else if (id == 102){ extraResults.redCards = result; } LogExtrasArrived(id, result); } /** * @notice check if prediction for a match winner is correct * @param realResultOne amount of goals team one scored * @param realResultTwo amount of goals team two scored * @param tokenResultOne amount of goals team one was predicted to score * @param tokenResultTwo amount of goals team two was predicted to score * @return */ function matchWinnerOk(uint8 realResultOne, uint8 realResultTwo, uint8 tokenResultOne, uint8 tokenResultTwo) internal pure returns(bool){ int8 realR = int8(realResultOne - realResultTwo); int8 tokenR = int8(tokenResultOne - tokenResultTwo); return (realR > 0 && tokenR > 0) || (realR < 0 && tokenR < 0) || (realR == 0 && tokenR == 0); } /** * @notice get points from a single match * @param matchIndex * @param groupsPhase token predictions * @return 10 if predicted score correctly, 3 if predicted only who would win * and 0 if otherwise */ function getMatchPointsGroups (uint256 matchIndex, uint192 groupsPhase) internal view returns(uint16 matchPoints) { uint8 tokenResultOne = uint8(groupsPhase & TEAM_RESULT_MASK_GROUPS); uint8 tokenResultTwo = uint8((groupsPhase >> 4) & TEAM_RESULT_MASK_GROUPS); uint8 teamOneGoals = groupsResults[matchIndex].teamOneGoals; uint8 teamTwoGoals = groupsResults[matchIndex].teamTwoGoals; if (teamOneGoals == tokenResultOne && teamTwoGoals == tokenResultTwo){ matchPoints += 10; } else { if (matchWinnerOk(teamOneGoals, teamTwoGoals, tokenResultOne, tokenResultTwo)){ matchPoints += 3; } } } /** * @notice calculates points from the last two matches * @param brackets token predictions * @return amount of points gained from the last two matches */ function getFinalRoundPoints (uint160 brackets) internal view returns(uint16 finalRoundPoints) { uint8[3] memory teamsIds; for (uint i = 0; i <= 2; i++){ brackets = brackets >> 5; //discard 4th place teamsIds[2-i] = uint8(brackets & RESULT_MASK_BRACKETS); } if (teamsIds[0] == bracketsResults.finalsTeamsIds[0]){ finalRoundPoints += 100; } if (teamsIds[2] == bracketsResults.finalsTeamsIds[2]){ finalRoundPoints += 25; } if (teamsIds[0] == bracketsResults.finalsTeamsIds[1]){ finalRoundPoints += 50; } if (teamsIds[1] == bracketsResults.finalsTeamsIds[0] || teamsIds[1] == bracketsResults.finalsTeamsIds[1]){ finalRoundPoints += 50; } } /** * @notice calculates points for round of sixteen, quarter-finals and semifinals * @param size amount of matches in round * @param round ros, qf, sf or f * @param brackets predictions * @return amount of points */ function getMiddleRoundPoints(uint8 size, teamState round, uint160 brackets) internal view returns(uint16 middleRoundResults){ uint8 teamId; for (uint i = 0; i < size; i++){ teamId = uint8(brackets & RESULT_MASK_BRACKETS); if (uint(bracketsResults.middlePhaseTeamsIds[teamId]) >= uint(round) ) { middleRoundResults+=60; } brackets = brackets >> 5; } } /** * @notice calculates points for correct predictions of group winners * @param brackets token predictions * @return amount of points */ function getQualifiersPoints(uint160 brackets) internal view returns(uint16 qualifiersPoints){ uint8 teamId; for (uint256 i = 0; i <= 15; i++){ teamId = uint8(brackets & RESULT_MASK_BRACKETS); if (teamId == bracketsResults.roundOfSixteenTeamsIds[15-i]){ qualifiersPoints+=30; } else if (bracketsResults.teamExists[teamId]){ qualifiersPoints+=25; } brackets = brackets >> 5; } } /** * @notice calculates points won by yellow and red cards predictions * @param extras token predictions * @return amount of points */ function getExtraPoints(uint32 extras) internal view returns(uint16 extraPoints){ uint16 redCards = uint16(extras & EXTRA_MASK_BRACKETS); extras = extras >> 16; uint16 yellowCards = uint16(extras); if (redCards == extraResults.redCards){ extraPoints+=20; } if (yellowCards == extraResults.yellowCards){ extraPoints+=20; } } /** * @notice calculates total amount of points for a token * @param t token to calculate points for * @return total amount of points */ function calculateTokenPoints (Token memory t) internal view returns(uint16 points){ //Groups phase 1 uint192 g1 = t.groups1; for (uint256 i = 0; i <= 23; i++){ points+=getMatchPointsGroups(23-i, g1); g1 = g1 >> 8; } //Groups phase 2 uint192 g2 = t.groups2; for (i = 0; i <= 23; i++){ points+=getMatchPointsGroups(47-i, g2); g2 = g2 >> 8; } uint160 bracketsLocal = t.brackets; //Brackets phase 1 points+=getFinalRoundPoints(bracketsLocal); bracketsLocal = bracketsLocal >> 20; //Brackets phase 2 points+=getMiddleRoundPoints(4, teamState.QUARTERS, bracketsLocal); bracketsLocal = bracketsLocal >> 20; //Brackets phase 3 points+=getMiddleRoundPoints(8, teamState.ROS, bracketsLocal); bracketsLocal = bracketsLocal >> 40; //Brackets phase 4 points+=getQualifiersPoints(bracketsLocal); //Extras points+=getExtraPoints(t.extra); } /** * @notice Sets the points of all the tokens between the last chunk set and the amount given. * @dev This function uses all the data collected earlier by oraclize to calculate points. * @param amount The amount of tokens that should be analyzed. */ function calculatePointsBlock(uint32 amount) external{ require (gameFinishedTime == 0); require(amount + lastCheckedToken <= tokens.length); for (uint256 i = lastCalculatedToken; i < (lastCalculatedToken + amount); i++) { uint16 points = calculateTokenPoints(tokens[i]); tokenToPointsMap[i] = points; if(worstTokens.length == 0 || points <= auxWorstPoints){ if(worstTokens.length != 0 && points < auxWorstPoints){ worstTokens.length = 0; } if(worstTokens.length < 100){ auxWorstPoints = points; worstTokens.push(i); } } } lastCalculatedToken += amount; } /** * @notice Sets the structures for payout distribution, last position and superior quota. Payout distribution is the * percentage of the pot each position gets, last position is the percentage of the pot the last position gets, * and superior quota is the total amount OF winners that are given a prize. * @dev Each of this structures is dynamic and is assigned depending on the total amount of tokens in the game */ function setPayoutDistributionId () internal { if(tokens.length < 101){ payoutDistribution = [289700, 189700, 120000, 92500, 75000, 62500, 52500, 42500, 40000, 35600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; lastPosition = 0; superiorQuota = 10; }else if(tokens.length < 201){ payoutDistribution = [265500, 165500, 105500, 75500, 63000, 48000, 35500, 20500, 20000, 19500, 18500, 17800, 0, 0, 0, 0, 0, 0, 0, 0, 0]; lastPosition = 0; superiorQuota = 20; }else if(tokens.length < 301){ payoutDistribution = [260700, 155700, 100700, 70900, 60700, 45700, 35500, 20500, 17900, 12500, 11500, 11000, 10670, 0, 0, 0, 0, 0, 0, 0, 0]; lastPosition = 0; superiorQuota = 30; }else if(tokens.length < 501){ payoutDistribution = [238600, 138600, 88800, 63800, 53800, 43800, 33800, 18800, 17500, 12500, 9500, 7500, 7100, 6700, 0, 0, 0, 0, 0, 0, 0]; lastPosition = 0; superiorQuota = 50; }else if(tokens.length < 1001){ payoutDistribution = [218300, 122300, 72300, 52400, 43900, 33900, 23900, 16000, 13000, 10000, 9000, 7000, 5000, 4000, 3600, 0, 0, 0, 0, 0, 0]; lastPosition = 4000; superiorQuota = 100; }else if(tokens.length < 2001){ payoutDistribution = [204500, 114000, 64000, 44100, 35700, 26700, 22000, 15000, 11000, 9500, 8500, 6500, 4600, 2500, 2000, 1800, 0, 0, 0, 0, 0]; lastPosition = 2500; superiorQuota = 200; }else if(tokens.length < 3001){ payoutDistribution = [189200, 104800, 53900, 34900, 29300, 19300, 15300, 14000, 10500, 8300, 8000, 6000, 3800, 2500, 2000, 1500, 1100, 0, 0, 0, 0]; lastPosition = 2500; superiorQuota = 300; }else if(tokens.length < 5001){ payoutDistribution = [178000, 100500, 47400, 30400, 24700, 15500, 15000, 12000, 10200, 7800, 7400, 5500, 3300, 2000, 1500, 1200, 900, 670, 0, 0, 0]; lastPosition = 2000; superiorQuota = 500; }else if(tokens.length < 10001){ payoutDistribution = [157600, 86500, 39000, 23100, 18900, 15000, 14000, 11000, 9300, 6100, 6000, 5000, 3800, 1500, 1100, 900, 700, 500, 360, 0, 0]; lastPosition = 1500; superiorQuota = 1000; }else if(tokens.length < 25001){ payoutDistribution = [132500, 70200, 31300, 18500, 17500, 14000, 13500, 10500, 7500, 5500, 5000, 4000, 3000, 1000, 900, 700, 600, 400, 200, 152, 0]; lastPosition = 1000; superiorQuota = 2500; } else { payoutDistribution = [120000, 63000, 27000, 18800, 17300, 13700, 13000, 10000, 6300, 5000, 4500, 3900, 2500, 900, 800, 600, 500, 350, 150, 100, 70]; lastPosition = 900; superiorQuota = 5000; } } /** * @notice Sets the id of the last token that will be given a prize. * @dev This is done to offload some of the calculations needed for sorting, and to cap the number of sorts * needed to just the winners and not the whole array of tokens. * @param tokenId last token id */ function setLimit(uint256 tokenId) external onlyAdmin{ require(tokenId < tokens.length); require(pValidationState == pointsValidationState.Unstarted || pValidationState == pointsValidationState.LimitSet); pointsLimit = tokenId; pValidationState = pointsValidationState.LimitSet; lastCheckedToken = 0; lastCalculatedToken = 0; winnerCounter = 0; setPayoutDistributionId(); } /** * @notice Sets the 10th percentile of the sorted array of points * @param amount tokens in a chunk */ function calculateWinners(uint32 amount) external onlyAdmin checkState(pointsValidationState.LimitSet){ require(amount + lastCheckedToken <= tokens.length); uint256 points = tokenToPointsMap[pointsLimit]; for(uint256 i = lastCheckedToken; i < lastCheckedToken + amount; i++){ if(tokenToPointsMap[i] > points || (tokenToPointsMap[i] == points && i <= pointsLimit)){ winnerCounter++; } } lastCheckedToken += amount; if(lastCheckedToken == tokens.length){ require(superiorQuota == winnerCounter); pValidationState = pointsValidationState.LimitCalculated; } } /** * @notice Checks if the order given offchain coincides with the order of the actual previously calculated points * in the smart contract. * @dev the token sorting is done offchain so as to save on the huge amount of gas and complications that * could occur from doing all the sorting onchain. * @param sortedChunk chunk sorted by points */ function checkOrder(uint32[] sortedChunk) external onlyAdmin checkState(pointsValidationState.LimitCalculated){ require(sortedChunk.length + sortedWinners.length <= winnerCounter); for(uint256 i=0;i < sortedChunk.length-1;i++){ uint256 id = sortedChunk[i]; uint256 sigId = sortedChunk[i+1]; require(tokenToPointsMap[id] > tokenToPointsMap[sigId] || (tokenToPointsMap[id] == tokenToPointsMap[sigId] && id < sigId)); } if(sortedWinners.length != 0){ uint256 id2 = sortedWinners[sortedWinners.length-1]; uint256 sigId2 = sortedChunk[0]; require(tokenToPointsMap[id2] > tokenToPointsMap[sigId2] || (tokenToPointsMap[id2] == tokenToPointsMap[sigId2] && id2 < sigId2)); } for(uint256 j=0;j < sortedChunk.length;j++){ sortedWinners.push(sortedChunk[j]); } if(sortedWinners.length == winnerCounter){ require(sortedWinners[sortedWinners.length-1] == pointsLimit); pValidationState = pointsValidationState.OrderChecked; } } /** * @notice If anything during the point calculation and sorting part should fail, this function can reset * data structures to their initial position, so as to */ function resetWinners(uint256 newLength) external onlyAdmin checkState(pointsValidationState.LimitCalculated){ sortedWinners.length = newLength; } /** * @notice Assigns prize percentage for the lucky top 30 winners. Each token will be assigned a uint256 inside * tokenToPayoutMap structure that represents the size of the pot that belongs to that token. If any tokens * tie inside of the first 30 tokens, the prize will be summed and divided equally. */ function setTopWinnerPrizes() external onlyAdmin checkState(pointsValidationState.OrderChecked){ uint256 percent = 0; uint[] memory tokensEquals = new uint[](30); uint16 tokenEqualsCounter = 0; uint256 currentTokenId; uint256 currentTokenPoints; uint256 lastTokenPoints; uint32 counter = 0; uint256 maxRange = 13; if(tokens.length < 201){ maxRange = 10; } while(payoutRange < maxRange){ uint256 inRangecounter = payDistributionAmount[payoutRange]; while(inRangecounter > 0){ currentTokenId = sortedWinners[counter]; currentTokenPoints = tokenToPointsMap[currentTokenId]; inRangecounter--; //Special case for the last one if(inRangecounter == 0 && payoutRange == maxRange - 1){ if(currentTokenPoints == lastTokenPoints){ percent += payoutDistribution[payoutRange]; tokensEquals[tokenEqualsCounter] = currentTokenId; tokenEqualsCounter++; }else{ tokenToPayoutMap[currentTokenId] = payoutDistribution[payoutRange]; } } if(counter != 0 && (currentTokenPoints != lastTokenPoints || (inRangecounter == 0 && payoutRange == maxRange - 1))){ //Fix second condition for(uint256 i=0;i < tokenEqualsCounter;i++){ tokenToPayoutMap[tokensEquals[i]] = percent.div(tokenEqualsCounter); } percent = 0; tokensEquals = new uint[](30); tokenEqualsCounter = 0; } percent += payoutDistribution[payoutRange]; tokensEquals[tokenEqualsCounter] = currentTokenId; tokenEqualsCounter++; counter++; lastTokenPoints = currentTokenPoints; } payoutRange++; } pValidationState = pointsValidationState.TopWinnersAssigned; lastPrizeGiven = counter; } /** * @notice Sets prize percentage to every address that wins from the position 30th onwards * @dev If there are less than 300 tokens playing, then this function will set nothing. * @param amount tokens in a chunk */ function setWinnerPrizes(uint32 amount) external onlyAdmin checkState(pointsValidationState.TopWinnersAssigned){ require(lastPrizeGiven + amount <= winnerCounter); uint16 inRangeCounter = payDistributionAmount[payoutRange]; for(uint256 i = 0; i < amount; i++){ if (inRangeCounter == 0){ payoutRange++; inRangeCounter = payDistributionAmount[payoutRange]; } uint256 tokenId = sortedWinners[i + lastPrizeGiven]; tokenToPayoutMap[tokenId] = payoutDistribution[payoutRange]; inRangeCounter--; } //i + amount prize was not given yet, so amount -1 lastPrizeGiven += amount; payDistributionAmount[payoutRange] = inRangeCounter; if(lastPrizeGiven == winnerCounter){ pValidationState = pointsValidationState.WinnersAssigned; return; } } /** * @notice Sets prizes for last tokens and sets prize pool amount */ function setLastPositions() external onlyAdmin checkState(pointsValidationState.WinnersAssigned){ for(uint256 j = 0;j < worstTokens.length;j++){ uint256 tokenId = worstTokens[j]; tokenToPayoutMap[tokenId] += lastPosition.div(worstTokens.length); } uint256 balance = address(this).balance; adminPool = balance.mul(25).div(100); prizePool = balance.mul(75).div(100); pValidationState = pointsValidationState.Finished; gameFinishedTime = now; } } /** * @title CoreLayer * @author CryptoCup Team (https://cryptocup.io/about) * @notice Main contract */ contract CoreLayer is GameLogicLayer { function CoreLayer() public { adminAddress = msg.sender; deploymentTime = now; } /** * @dev Only accept eth from the admin */ function() external payable { require(msg.sender == adminAddress); } function isDataSourceCallback() public pure returns (bool){ return true; } /** * @notice Builds ERC721 token with the predictions provided by the user. * @param groups1 - First half of the group matches scores encoded in a uint192. * @param groups2 - Second half of the groups matches scores encoded in a uint192. * @param brackets - Bracket information encoded in a uint160. * @param extra - Extra information (number of red cards and yellow cards) encoded in a uint32. * @dev An automatic timestamp is added for internal use. */ function buildToken(uint192 groups1, uint192 groups2, uint160 brackets, uint32 extra) external payable isNotPaused { Token memory token = Token({ groups1: groups1, groups2: groups2, brackets: brackets, timeStamp: uint64(now), extra: extra }); require(msg.value >= _getTokenPrice()); require(msg.sender != address(0)); require(tokens.length < WCCTOKEN_CREATION_LIMIT); require(tokensOfOwnerMap[msg.sender].length < 100); require(now < WORLD_CUP_START); //World cup Start uint256 tokenId = tokens.push(token) - 1; require(tokenId == uint256(uint32(tokenId))); _setTokenOwner(msg.sender, tokenId); LogTokenBuilt(msg.sender, tokenId, token); } /** * @param tokenId - ID of token to get. * @return Returns all the valuable information about a specific token. */ function getToken(uint256 tokenId) external view returns (uint192 groups1, uint192 groups2, uint160 brackets, uint64 timeStamp, uint32 extra) { Token storage token = tokens[tokenId]; groups1 = token.groups1; groups2 = token.groups2; brackets = token.brackets; timeStamp = token.timeStamp; extra = token.extra; } /** * @notice Called by the development team once the World Cup has ended (adminPool is set) * @dev Allows dev team to retrieve adminPool */ function adminWithdrawBalance() external onlyAdmin { adminAddress.transfer(adminPool); adminPool = 0; } /** * @notice Allows any user to retrieve their asigned prize. This would be the sum of the price of all the tokens * owned by the caller of this function. * @dev If the caller has no prize, the function will revert costing no gas to the caller. */ function withdrawPrize() external checkState(pointsValidationState.Finished){ uint256 prize = 0; uint256[] memory tokenList = tokensOfOwnerMap[msg.sender]; for(uint256 i = 0;i < tokenList.length; i++){ prize += tokenToPayoutMap[tokenList[i]]; tokenToPayoutMap[tokenList[i]] = 0; } require(prize > 0); msg.sender.transfer((prizePool.mul(prize)).div(1000000)); } /** * @notice Gets current token price */ function _getTokenPrice() internal view returns(uint256 tokenPrice){ if ( now >= THIRD_PHASE){ tokenPrice = (150 finney); } else if (now >= SECOND_PHASE) { tokenPrice = (110 finney); } else if (now >= FIRST_PHASE) { tokenPrice = (75 finney); } else { tokenPrice = STARTING_PRICE; } require(tokenPrice >= STARTING_PRICE && tokenPrice <= (200 finney)); } /** * @dev Sets the data source contract address * @param _address Address to be set */ function setDataSourceAddress(address _address) external onlyAdmin { DataSourceInterface c = DataSourceInterface(_address); require(c.isDataSource()); dataSource = c; dataSourceAddress = _address; } /** * @notice Testing function to corroborate group data from oraclize call * @param x Id of the match to get * @return uint8 Team 1 goals * @return uint8 Team 2 goals */ function getGroupData(uint x) external view returns(uint8 a, uint8 b){ a = groupsResults[x].teamOneGoals; b = groupsResults[x].teamTwoGoals; } /** * @notice Testing function to corroborate round of sixteen data from oraclize call * @return An array with the ids of the round of sixteen teams */ function getBracketData() external view returns(uint8[16] a){ a = bracketsResults.roundOfSixteenTeamsIds; } /** * @notice Testing function to corroborate brackets data from oraclize call * @param x Team id * @return The place the team reached */ function getBracketDataMiddleTeamIds(uint8 x) external view returns(teamState a){ a = bracketsResults.middlePhaseTeamsIds[x]; } /** * @notice Testing function to corroborate finals data from oraclize call * @return the 4 (four) final teams ids */ function getBracketDataFinals() external view returns(uint8[4] a){ a = bracketsResults.finalsTeamsIds; } /** * @notice Testing function to corroborate extra data from oraclize call * @return amount of yellow and red cards */ function getExtrasData() external view returns(uint16 a, uint16 b){ a = extraResults.yellowCards; b = extraResults.redCards; } //EMERGENCY CALLS //If something goes wrong or fails, these functions will allow retribution for token holders /** * @notice if there is an unresolvable problem, users can call to this function to get a refund. */ function emergencyWithdraw() external hasFinalized{ uint256 balance = STARTING_PRICE * tokensOfOwnerMap[msg.sender].length; delete tokensOfOwnerMap[msg.sender]; msg.sender.transfer(balance); } /** * @notice Let the admin cash-out the entire contract balance 10 days after game has finished. */ function finishedGameWithdraw() external onlyAdmin hasFinished{ uint256 balance = address(this).balance; adminAddress.transfer(balance); } /** * @notice Let the admin cash-out the entire contract balance 10 days after game has finished. */ function emergencyWithdrawAdmin() external hasFinalized onlyAdmin{ require(finalizedTime != 0 && now >= finalizedTime + 10 days ); msg.sender.transfer(address(this).balance); } }
* groups1 scores of the first half of matches (8 bits each) groups2 scores of the second half of matches (8 bits each) brackets winner&#39;s team ids of each round (5 bits each) timeStamp creation timestamp extra number of yellow and red cards (16 bits each)/
struct Token { uint192 groups1; uint192 groups2; uint160 brackets; uint64 timeStamp; uint32 extra; }
7,712,432
[ 1, 4625, 348, 7953, 560, 30, 380, 3252, 21, 377, 8474, 434, 326, 1122, 8816, 434, 1885, 261, 28, 4125, 1517, 13, 3252, 22, 377, 8474, 434, 326, 2205, 8816, 434, 1885, 261, 28, 4125, 1517, 13, 15597, 565, 5657, 1224, 18642, 5520, 31, 87, 5927, 3258, 434, 1517, 3643, 261, 25, 4125, 1517, 13, 18198, 282, 6710, 2858, 2870, 4202, 1300, 434, 20614, 471, 1755, 18122, 261, 2313, 4125, 1517, 13176, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 1958, 3155, 288, 203, 3639, 2254, 15561, 3252, 21, 31, 203, 3639, 2254, 15561, 3252, 22, 31, 203, 3639, 2254, 16874, 15597, 31, 203, 3639, 2254, 1105, 18198, 31, 203, 3639, 2254, 1578, 225, 2870, 31, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/80001/0xfA628d95c2a4eEeB2d6f04A47A5684840c44c326/sources/contracts/Contract.sol
when the nft can start being rented
uint256 startDateUNIX;
5,643,847
[ 1, 4625, 348, 7953, 560, 30, 225, 1347, 326, 290, 1222, 848, 787, 3832, 283, 496, 329, 203, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 3639, 2254, 5034, 12572, 10377, 60, 31, 225, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.5.2; /* From the DSL to the solidity contract, many transformations and optimizations were manually done, that could be realistically done automatically. Necessary transformations include: - Transforming "musts" into "may post or may be timed out". - Adding a notion of timeout. The timeout applies to anyone who currently has a "must". - Adding a notion of escrow. The escrow applies to anyone who has a "must" in the future. Optimizations include: - Merging consecutive actions by the same participant (the initial actions by player 0): - creation of contract/context - sending money - initializing with a message - In the message exchange, specialize to the case of two people - the first one is merged as above. - only one is left, the second and last, that doesn't have to publish a commitment, just a hand - the salt of the second is not used, therefore can be omitted (can be automated) - Flattening the state - state is defined as plenty of global variables, sometimes undefined. - continuation closures were transformed into ADTs, closure conversion happened, linear analysis proved they could all be global in that contract. - after the closure contents have been converted, the program counter / current instruction / recipe step / machine state / etc. is represented as a single number (called "state") rather than a data structure. TODO: - Introduce an extra state Factory (3) so we can share code between factory and game, with the state being Factory in the factory, and 0, 1 or 2 in the game. (making 0 part of the game saves a little bit of gas at the initialization of each game) - Maybe make the contract a trivial proxy (see ../experiments/proxy.sol), and "just" delegatecall into the factory to do the changes? If the cost of contract creation dominates the cost of contract use as in r-p-s, that's worth it; not for long-running contract where the opposite is true, though. */ contract RockPaperScissors { // Possible hands -- // we can treeshake this definitions away, since it is not used in this file. enum Hand { Rock, Paper, Scissors } /** Current state of the state machine. */ enum State { Waiting_for_player1, // player0 funded wager+escrow and published a commitment Waiting_for_player0_reveal, // player1 showed his hand Completed // end of game (in the future, have a way to reset the contract to an Uninitialized state for repeated plays?) } State state; /** Timeout in blocks. This needs be low enough to be bearable by humans, yet large enough that attackers can't just DDoS you into timing out. Players can mutually agree on this parameter depending on the amount at stake. We recommend two days or more when running in production, two minutes and a half in test. The period between blocks being targeted to about 15 seconds on Ethereum, so this should be 11520 in production, and 10 in test. */ uint timeout_in_blocks; /** Previous block at which state transition happened, for timeouts when waiting for a player */ uint previous_block; address payable[2] player; bytes32 player0_commitment; uint wager_amount; uint escrow_amount; bytes32 salt; Hand hand0; Hand hand1; enum Outcome { Player1_wins, Draw, Player0_wins, Player1_wins_by_default, Player0_rescinds } // Outcome outcome; // NB: Superfluous: never read, can be computed purely on the client side. // at 5000 GAS, ~2 GWEI/GAS, 1e-9 ETH/GWEI, 250 USD/ETH, storing a 256-bit word of information in an ethereum contract costs about ¼¢ and a basic transaction (21000 GAS) costs about 1¢, so there's a lot of pennies to pinch by avoiding needless computation. // Utility functions // The current invocation MUST be done by player0. function require_player0 () view internal { require(player[0] == msg.sender); } // The current invocation MUST be done by player1. function require_player1 () view internal { require(player[1] == msg.sender); } // The current invocation be done by player1, or by anyone if the offer is open. function require_or_set_player1 () internal { if (player[1] == address(0)) { player[1] = msg.sender; } else { require_player1(); } } // Player0 wins the given amount function player0_gets(uint _amount) internal { player[0].transfer(_amount); } // Player1 wins the given amount function player1_gets(uint _amount) internal { player[1].transfer(_amount); } // Timeout function require_timeout() view internal { require(block.number > previous_block + timeout_in_blocks); } //event Player0StartGame(address payable _player0, address payable _player1, // uint _timeout_in_blocks, bytes32 _commitment, // uint _wager_amount, uint _escrow_amount); // Constructor called by player0 when initializing the game. // player1 is the address of the opponent, or 0x0...0 for a game open to the first comer. // timeout in blocks specifies the timeout. // The commitment is a hash of some salt and the hand by player0. // The wager // We do NOT emit an event: an event will be emitted by factory contract. constructor (address payable _player0, address payable _player1, uint _timeout_in_blocks, bytes32 _commitment, uint _wager_amount) public payable { require(msg.value > _wager_amount); // Initialize the game // The amount that a player gains if they win fairly, // or loses if they loose fairly wager_amount = _wager_amount; // The amount that player0 looses if they "cheat" by // not revealing their hand after they committed. // Player0 gets this back if they "play fair" by // revealing their hand, whether they win or lose. escrow_amount = msg.value - wager_amount; // The address of player0, including to transfer to // if player0 wins. player[0] = _player0; // If non-zero, restricts who player1 can be. player[1] = _player1; // Mutually agreeable timeout value timeout_in_blocks = _timeout_in_blocks; // Restricts what player0's hand can be: she will have to reveal and play // the preimage of this hash, chosen *before* player1 showed his hand. player0_commitment = _commitment; // Set the new state and previous_block state = State.Waiting_for_player1; previous_block = block.number; // Emit a relevant event. // -- NOPE: do it atomically with the contract creation -- // because the existing web3 interface makes it especially hard to relate events // in an atomic way. // NB: the block number implicitly comes in the event itself. //emit Player0StartGame(_player0, _player1, _timeout_in_blocks, // _commitment, _wager_amount, escrow_amount); } event Player1ShowHand(address payable _player1, Hand hand1); // Function called by player1 when joining the game. // NB: player1 must show the key, address and amount MUST match, and the hand must be valid. function player1_show_hand (Hand _hand1) external payable { require(state == State.Waiting_for_player1); require_or_set_player1(); require(msg.value == wager_amount); require(uint8(_hand1) < 3); hand1 = _hand1; // Set the new state and previous_block state = State.Waiting_for_player0_reveal; previous_block = block.number; // Emit a relevant event. // NB: the block number implicitly comes in the event itself. emit Player1ShowHand(player[1], _hand1); } event Player0Reveal(bytes32 _salt, Hand _hand0, Outcome outcome); // State 3, called by player0 after player1 played, reveals the committed hand. function player0_reveal (bytes32 _salt, Hand _hand0) external payable { require(state == State.Waiting_for_player0_reveal); require_player0(); require(uint8(_hand0) < 3 && player0_commitment == keccak256(abi.encodePacked(_salt, _hand0))); // Compute outcome. 0: player1 wins, 1: draw, 2: player0 wins. // Numbers chosen to be one above the strcmp convention used by C, OCaml, Javascript, etc. // could be made a local variable. See above about outcome. Outcome outcome = Outcome((uint8(_hand0) + 4 - uint8(hand1)) % 3); if (outcome == Outcome.Player0_wins) { // The reveal is in favor of player0 player0_gets(2*wager_amount+escrow_amount); } else if (outcome == Outcome.Player1_wins) { // The reveal is in favor of player1 player1_gets(2*wager_amount); player0_gets(escrow_amount); } else { // The reveal is a draw player1_gets(wager_amount); player0_gets(wager_amount+escrow_amount); } //salt = _salt; // Not needed in production //hand0 = _hand0; // Not needed in production state = State.Completed; // Yes needed in production! // Emit a relevant event. // NB: the block number implicitly comes in the event itself. emit Player0Reveal(_salt, _hand0, outcome); } event Player0Rescind(); // State 2 bis, rescind the offer to play -- called by player0 after player1 times out. function player0_rescind () external payable { require(state == State.Waiting_for_player1); require_player0(); require_timeout(); //outcome = Outcome.Player0_rescinds; // Superfluous, see above about outcome player0_gets(wager_amount+escrow_amount); state = State.Completed; emit Player0Rescind(); } event Player1WinByDefault(); // State 3 bis, win by default -- called by player1 after player0 times out rather than reveal hand. function player1_win_by_default () external payable { require(state == State.Waiting_for_player0_reveal); require_player1(); require_timeout(); //outcome = Outcome.Player1_wins_by_default; // Superfluous, see above about outcome player1_gets(2*wager_amount+escrow_amount); state = State.Completed; emit Player1WinByDefault(); } /* // Now commenting out this obsolete function. function query_state () external view returns (State _state, Outcome _outcome, uint _timeout_in_blocks, uint _previous_block, address _player0, address _player1, bytes32 _player0_commitment, uint _wager_amount, uint _escrow_amount, bytes32 _salt, Hand _hand0, Hand _hand1) { return (state, outcome, timeout_in_blocks, previous_block, player[0], player[1], player0_commitment, wager_amount, escrow_amount, salt, hand0, hand1); } */ } contract RockPaperScissorsFactory { // Include not just the contract address, but all the information about the game. // One might be tempted to log the game information separately, in an event in // the game itself, while the creation only creates the contract that points to it. // But the web3 interface will make it painful to relate two separate events, // because of issues with lack of atomicity in an asynchronous interface; // thus you'd have to track and relate multiple primary record identities until // they can be confirmed to be the same, or not. // Meanwhile, you shouldn't trust the game to be legit unless you know the txHash of the // contract creation, at which point you can directly check the event below. event Created(address _contract, address payable _player0, address payable _player1, uint _timeout_in_blocks, bytes32 _commitment, uint _wager_amount, uint _escrow_amount); function player0_start_game (address payable _player1, uint _timeout_in_blocks, bytes32 _commitment, uint _wager_amount) public payable returns (RockPaperScissors _contract) { RockPaperScissors rpsContract = (new RockPaperScissors).value(msg.value) (msg.sender, _player1, _timeout_in_blocks, _commitment, _wager_amount); // NB: To save a few fractions of a cent, you could get the sender, address and value // from the transaction receipt. emit Created(address(rpsContract), msg.sender, _player1, _timeout_in_blocks, _commitment, _wager_amount, msg.value - _wager_amount); return rpsContract; } }
The current invocation MUST be done by player0.
function require_player0 () view internal { require(player[0] == msg.sender); }
5,361,745
[ 1, 4625, 348, 7953, 560, 30, 225, 1021, 783, 9495, 10685, 506, 2731, 635, 7291, 20, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 3639, 445, 2583, 67, 14872, 20, 1832, 1476, 2713, 203, 3639, 288, 203, 7734, 2583, 12, 14872, 63, 20, 65, 422, 1234, 18, 15330, 1769, 203, 3639, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/137/0xD7A619FeE514C98D542986Fd1064Cd1de5fb132a/sources/contracts/ParametersStorage.sol
* @dev convenient way to set parameters with UI of multisig/
function setCustomParamAsAddress(uint _param, address _value) public onlyManager { setCustomParam(_param, bytes32(uint(uint160(_value)))); }
3,740,175
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 26375, 4031, 358, 444, 1472, 598, 6484, 434, 22945, 360, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 26723, 786, 1463, 1887, 12, 11890, 389, 891, 16, 1758, 389, 1132, 13, 1071, 1338, 1318, 288, 203, 3639, 26723, 786, 24899, 891, 16, 1731, 1578, 12, 11890, 12, 11890, 16874, 24899, 1132, 3719, 10019, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity >=0.4.25 <0.6.0; import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol"; import "openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol"; contract USDTTestToken is ERC20, ERC20Detailed { /** * @dev Constructor that gives msg.sender all of existing tokens. */ constructor() public ERC20Detailed('USDTTestToken', 'UTT', 18) { _mint(msg.sender, 10000 * (10 ** uint256(decimals()))); } }
* @dev Constructor that gives msg.sender all of existing tokens./
constructor() public ERC20Detailed('USDTTestToken', 'UTT', 18) { _mint(msg.sender, 10000 * (10 ** uint256(decimals()))); }
15,793,667
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 11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, 1071, 4232, 39, 3462, 40, 6372, 2668, 3378, 40, 1470, 395, 1345, 2187, 296, 57, 1470, 2187, 6549, 13, 288, 203, 1377, 389, 81, 474, 12, 3576, 18, 15330, 16, 12619, 380, 261, 2163, 2826, 2254, 5034, 12, 31734, 1435, 3719, 1769, 203, 225, 289, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity >= 0.4.22 < 0.6.0; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } contract Token { using SafeMath for uint256; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); mapping(address => uint256) balances; mapping(address => bool) public frozenAccount; uint256 totalSupply_; mapping (address => mapping (address => uint256)) internal allowed; function totalSupply() public view returns (uint256) { return totalSupply_; } function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { require(_value <= balances[_from], "Not enough balance"); //require(_value <= allowed[_from][msg.sender]); //require(_to != address(0)); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); //allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner,address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } function increaseApproval(address _spender, uint256 _addedValue) public returns (bool) { allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } function decreaseApproval(address _spender, uint256 _subtractedValue) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue >= oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } contract Stablecoin is Token { string public name = 'Mundo Gold Tethered'; string public symbol = 'MGT'; uint256 public decimals = 4; address payable public owner; uint256 public totalSupplyLimit_; event BuyToken(address from, address to, uint256 value); event SellToken(address from, address to , uint256 value); event Minted(address to, uint256 value); event Burn(address burner, uint256 value); event FrozenFunds(address target, bool frozen); modifier onlyOwner { require(msg.sender == owner); _; } constructor (//uint256 _STOEndTime ) public Token() { //require(_STOEndTime > 0); totalSupplyLimit_ = 2500000000000; owner = msg.sender; mint(owner, totalSupplyLimit_); } function mint(address _to, uint256 _value) public returns (bool) { if (totalSupplyLimit_ >= totalSupply_ + _value) { balances[_to] = balances[_to].add(_value); totalSupply_ = totalSupply_.add(_value); emit Minted(_to, _value); return true; } return false; } /* If the transfer request comes from the STO, it only checks that the investor is in the whitelist * If the transfer request comes from a token holder, it checks that: * a) Both are on the whitelist * b) Seller's sale lockup period is over * c) Buyer's purchase lockup is over */ function verifyTransfer(uint256 _value) public pure returns (bool) { require(_value >= 0); return true; } function burnTokens(address _investor, uint256 _value) public { balances[_investor] = balances[_investor].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Burn(owner, _value); } function buyTokens(address _investor, uint256 _amount) public { //require(_investor != address(0)); //require(_amount > 0); emit BuyToken(owner, _investor, _amount); transferFrom(owner, _investor, _amount); } function sellTokens(address _investor, uint256 _amount) public { //require(_investor != address(0)); //require(_amount > 0); emit SellToken(_investor, owner, _amount); //transferFrom(_investor, owner, _amount); burnTokens(_investor, _amount); } /// @notice Override the functions to not allow token transfers until the end function transfer(address _to, uint256 _value) public returns(bool) { //require(verifyTransfer( owner, _to, _value )); require(!frozenAccount[msg.sender]); // Check if sender is frozen return super.transfer(_to, _value); } /// @notice Override the functions to not allow token transfers until the end function transferFrom(address _from, address _to, uint256 _value) public returns(bool) { require(!frozenAccount[_from]); // Check if sender is frozen //require(verifyTransfer(_from, _to, _value)); return super.transferFrom(_from, _to, _value); } /// @notice Override the functions to not allow token transfers until the end function approve(address _spender, uint256 _value) public returns(bool) { return super.approve(_spender, _value); } /// @notice Override the functions to not allow token transfers until the end function increaseApproval(address _spender, uint _addedValue) public returns(bool success) { return super.increaseApproval(_spender, _addedValue); } /// @notice Override the functions to not allow token transfers until the end function decreaseApproval(address _spender, uint _subtractedValue) public returns(bool success) { return super.decreaseApproval(_spender, _subtractedValue); } function emergencyExtract() external onlyOwner { owner.transfer(address(this).balance); } function freezeAccount(address target, bool freeze) onlyOwner public { frozenAccount[target] = freeze; emit FrozenFunds(target, freeze); } function kill() onlyOwner() public{ selfdestruct(msg.sender); } }
@notice Override the functions to not allow token transfers until the endrequire(verifyTransfer(_from, _to, _value));
function transferFrom(address _from, address _to, uint256 _value) public returns(bool) { return super.transferFrom(_from, _to, _value); }
2,502,692
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 20392, 1439, 326, 4186, 358, 486, 1699, 1147, 29375, 3180, 326, 679, 6528, 12, 8705, 5912, 24899, 2080, 16, 389, 869, 16, 389, 1132, 10019, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 7412, 1265, 12, 2867, 389, 2080, 16, 1758, 389, 869, 16, 2254, 5034, 389, 1132, 13, 1071, 203, 3639, 1135, 12, 6430, 13, 288, 203, 1377, 327, 2240, 18, 13866, 1265, 24899, 2080, 16, 389, 869, 16, 389, 1132, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/100/0xB4d0774C38bD9A4539CA7810ddEd8C3599a766Fe/sources/contracts/rari-fuse/src/FuseFeeDistributor.sol
* @dev Initializer that sets initial values of state variables. @param owner Default owner. @param _defaultInterestFeeRate The default proportion of Fuse pool interest taken as a protocol fee (scaled by 1e18). @param initialComptrollerImplementation The initial comptroller implementation @param initialCEtherDelegate The initial CEtherDelegate implementation @param initialCErc20Delegate The initial CErc20Delegate implementation/
) public initializer { require(_defaultInterestFeeRate <= 1e18, "!Interest fee"); __Ownable_init(); transferOwnership(owner); defaultInterestFeeRate = _defaultInterestFeeRate; maxSupplyEth = uint256(-1); maxUtilizationRate = uint256(-1); comptrollerImplementationWhitelist[address(0)][ initialComptrollerImplementation ] = true; cEtherDelegateWhitelist[address(0)][initialCEtherDelegate][ false ] = true; cErc20DelegateWhitelist[address(0)][initialCErc20Delegate][ false ] = true; }
14,288,695
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 4378, 3926, 716, 1678, 2172, 924, 434, 919, 3152, 18, 632, 891, 3410, 2989, 3410, 18, 632, 891, 389, 1886, 29281, 14667, 4727, 1021, 805, 23279, 434, 478, 1202, 2845, 16513, 9830, 487, 279, 1771, 14036, 261, 20665, 635, 404, 73, 2643, 2934, 632, 891, 2172, 799, 337, 1539, 13621, 1021, 2172, 532, 337, 1539, 4471, 632, 891, 2172, 1441, 1136, 9586, 1021, 2172, 29538, 1136, 9586, 4471, 632, 891, 2172, 1441, 1310, 3462, 9586, 1021, 2172, 29538, 1310, 3462, 9586, 4471, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 262, 1071, 12562, 288, 203, 3639, 2583, 24899, 1886, 29281, 14667, 4727, 1648, 404, 73, 2643, 16, 17528, 29281, 14036, 8863, 203, 3639, 1001, 5460, 429, 67, 2738, 5621, 203, 3639, 7412, 5460, 12565, 12, 8443, 1769, 203, 3639, 805, 29281, 14667, 4727, 273, 389, 1886, 29281, 14667, 4727, 31, 203, 3639, 943, 3088, 1283, 41, 451, 273, 2254, 5034, 19236, 21, 1769, 203, 3639, 943, 29180, 4727, 273, 2254, 5034, 19236, 21, 1769, 203, 3639, 532, 337, 1539, 13621, 18927, 63, 2867, 12, 20, 13, 6362, 203, 5411, 2172, 799, 337, 1539, 13621, 203, 3639, 308, 273, 638, 31, 203, 3639, 276, 41, 1136, 9586, 18927, 63, 2867, 12, 20, 13, 6362, 6769, 1441, 1136, 9586, 6362, 203, 5411, 629, 203, 3639, 308, 273, 638, 31, 203, 3639, 276, 41, 1310, 3462, 9586, 18927, 63, 2867, 12, 20, 13, 6362, 6769, 1441, 1310, 3462, 9586, 6362, 203, 5411, 629, 203, 3639, 308, 273, 638, 31, 203, 565, 289, 203, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/1/0xcf9560B9E952b195D408BE966E4f6Cf4Ab8206E5/sources/Doctor Evil.sol
Tokens to be sent to marketing wallet 6.9% of total supply
_mint(_marketingWallet, ((_supply * 69) / 1000));
8,345,918
[ 1, 4625, 348, 7953, 560, 30, 225, 13899, 358, 506, 3271, 358, 13667, 310, 9230, 1666, 18, 29, 9, 434, 2078, 14467, 203, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 3639, 389, 81, 474, 24899, 3355, 21747, 16936, 16, 14015, 67, 2859, 1283, 380, 20963, 13, 342, 4336, 10019, 225, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
/** * OpenZepplin contracts contained within are licensed under an MIT License. * * The MIT License (MIT) * * Copyright (c) 2016-2021 zOS Global Limited * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Chainlink contracts contained within are licensed under an MIT License. * * The MIT License (MIT) * * Copyright (c) 2018-2021 SmartContract ChainLink, Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "https://raw.githubusercontent.com/smartcontractkit/chainlink/develop/contracts/src/v0.8/VRFConsumerBase.sol"; import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC721/IERC721.sol"; import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC721/IERC721Receiver.sol"; import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/utils/Address.sol"; import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/utils/Context.sol"; import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/utils/Strings.sol"; import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/utils/introspection/ERC165.sol"; import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/security/ReentrancyGuard.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name = "DegenerateFarm.io"; // Token symbol string private _symbol = "PIG"; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Token URI for fetching metadata string internal baseURI; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); return string(abi.encodePacked(baseURI, tokenId.toString())); } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not owned"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } //How many deer does it take to build a space shuttle? -Nadia Khuzina contract DegeneratePigs is VRFConsumerBase, ERC721, ReentrancyGuard { address public contractOwner; bytes32 internal keyHash = 0xf86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da; address internal vrfCoordinator = 0x3d2341ADb2D31f1c5530cDC622016af293177AE0; address internal linkTokenAddress = 0xb0897686c545045aFc77CF20eC7A532E3120E0F1; uint256 internal fee; address payable public receiverAccount; uint256 public price; uint256 public upgradePrice; uint256 internal totalNFTs; uint256 internal mintRequests; uint256 public totalHandsDealt; bool public forSale; bool public permanentlyStop; bool public upgradeable; bool public permanentlyStopUpgrades; struct tokenHistory { uint256 chipStack; uint256 plaqueStack; uint256 totalAces; uint256 matchingAces; uint256 diamondAces; uint256 lastLeftCard; uint256 lastRightCard; } //Track the hands for statistical analysis or frontend purposes. event HandDealt(uint256 indexed tokenID, uint256 leftCard, uint256 rightCard, bool isMint); mapping(bytes32 => address) internal minterAddress; mapping(bytes32 => uint256) internal tokenToUpgrade; mapping(uint256 => uint256) public lookupFullTokenID; mapping(uint256 => uint256) public upgradeCount; mapping(uint256 => tokenHistory[]) public lookupTokenHistory; mapping(uint256 => uint256) internal chipStack; mapping(uint256 => uint256) internal plaqueStack; mapping(uint256 => uint256) internal totalAces; mapping(uint256 => uint256) internal matchingAces; mapping(uint256 => uint256) internal diamondAces; mapping(uint256 => uint256) internal lastLeftCard; mapping(uint256 => uint256) internal lastRightCard; constructor() VRFConsumerBase( vrfCoordinator, linkTokenAddress ) { contractOwner = msg.sender; receiverAccount = payable(msg.sender); fee = 0.0001 * 10 ** 18; price = 25 * 10 ** 18; upgradePrice = 2 * 10 ** 18; baseURI = "https://wwww.degeneratefarm.io/metadata/"; mintRequests = 0; } //Reduces require() statements that would increase verbosity. modifier onlyOwner() { require(msg.sender == contractOwner); _; } //We need separate mappings for mints and upgrades to differentiate them in the fulfillRandomness function. function getRandomNumberForMint() internal returns(bytes32 requestId) { require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK. Topup the contract with LINK."); requestId = requestRandomness(keyHash, fee); minterAddress[requestId] = msg.sender; return requestId; } //We need separate mappings for mints and upgrades to differentiate them in the fulfillRandomness function. function getRandomNumberForUpgrade(uint256 tokenID) internal returns(bytes32 requestId) { require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK. Topup the contract with LINK."); requestId = requestRandomness(keyHash, fee); tokenToUpgrade[requestId] = tokenID; return requestId; } //The VRF Coordinator only calls the function named fulfillRandomness. It doesn't know whether it is providing a random number for a mint or an upgrade. The contract must interpret this from the requestID by checking which mapping it is a part of. function fulfillRandomness(bytes32 requestId, uint256 randomNumber) internal override { require(msg.sender == vrfCoordinator, "Only the VRF Coordinator may call this function."); if (tokenToUpgrade[requestId] != 0) { upgradePig(tokenToUpgrade[requestId], randomNumber); } else { mintPig(minterAddress[requestId], randomNumber); } } //While the mint function starts here, it is the VRF Coordinator who actually mints the NFTs. function mint() external payable nonReentrant { require(permanentlyStop == false, "Minting has been permanently disabled."); require(forSale == true, "Minting has been paused."); require(mintRequests < 1024, "No pigs left to mint, sorry. :-("); require(msg.value == price, "Wrong amount for mint."); //If the correct amount is sent, then request a VRF number. getRandomNumberForMint(); //Limit the number of pigs minted to 1024 by tracking this variable. mintRequests++; (bool mintPaymentSent, ) = payable(receiverAccount).call { value: msg.value }(""); require(mintPaymentSent, "Failed to send Ether for minting."); } //Some frontends may look for this optional ERC721 implementation. function totalSupply() public view returns(uint256) { return totalNFTs; } //Returns all the mapping data in one call. function getUpgrades(uint256 tokenID) public view returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256) { return (chipStack[tokenID], plaqueStack[tokenID], totalAces[tokenID], matchingAces[tokenID], diamondAces[tokenID], lastLeftCard[tokenID], lastRightCard[tokenID]); } //This is a lookup table to make the background rarity non-linear. function backgroundLookup(uint256 index) internal pure returns(uint256) { if (index <= 40) return 0; else if (index <= 50) return 1; else if (index <= 60) return 2; else if (index <= 70) return 3; else if (index <= 80) return 4; else if (index <= 85) return 5; else if (index <= 90) return 6; else if (index <= 95) return 7; else if (index < 99) return 8; return 9; } //Called from fulfillRandomness. function mintPig(address minter, uint256 randomNumberFromChainlink) internal { //Change to public for Remix testing. You can directly input numbers this way. //Increment the total of minted NFTs. This is used for tracking the chronological order, and compatibility with existing ERC721 patterns. totalNFTs++; //The backgrounds are a non-linear feature of the pig. It is a 1 in 100 chance to get the rarest Level 10 background. It returns only a single digit for purposes of sprite mapping. uint256 background = backgroundLookup(randomNumberFromChainlink % 10 ** 11 / 10 ** 9); //The token ID is made up of the chronological number that is prepended, the background number, and a straight crop of the last 9 numbers of the VRF returned random number. Each of these number represents a sprite. uint256 tokenID = ((totalNFTs * 10 ** 10) + (background * 10 ** 9)) + randomNumberFromChainlink % 10 ** 9; //Mint the pig. _mint(minter, tokenID); //Take the chronological number of each pig and use it as a key to find the full token ID. This is useful for Web3 operations. lookupFullTokenID[totalNFTs] = tokenID; //Crop out six digit pieces of the returned VRF number. This in effect makes a 1 million card shoe for each card and renders modulo bias moot. uint256 leftCard = (((randomNumberFromChainlink % 10 ** 22 / 10 ** 16) + 52) % 52) + 1; uint256 rightCard = (((randomNumberFromChainlink % 10 ** 16 / 10 ** 10) + 52) % 52) + 1; //This saves the cards to a mapping so the lookup function can fetch the last cards dealt for display on the pig. lastLeftCard[tokenID] = leftCard; lastRightCard[tokenID] = rightCard; //Initialize the chip stack with a single 1000 chip. chipStack[tokenID] = 1; //If the first hand dealt is aces, add it to the total. if ((leftCard == 1 || leftCard == 14 || leftCard == 27 || leftCard == 40) && (rightCard == 1 || rightCard == 14 || rightCard == 27 || rightCard == 40)) { totalAces[tokenID] = 1; //Add a plaque plaqueStack[tokenID] = 1; //Check if they are matching aces. if (leftCard == rightCard) { matchingAces[tokenID] = 1; //If they are matching aces, then check to see if they are matching diamond aces. if (leftCard == 14 && rightCard == 14) { diamondAces[tokenID] = 1; } } } //It's a mint, but also deals a hand. We track this for frontend purposes. totalHandsDealt++; //It's also considered an upgrade since the hand and chip added goes to upgrade totals. upgradeCount[tokenID] += 1; //We use this mapping to easily find the history of VRF results, such as the last five hands dealt, or when aces were hit. lookupTokenHistory[tokenID].push(tokenHistory(chipStack[tokenID], plaqueStack[tokenID], totalAces[tokenID], matchingAces[tokenID], diamondAces[tokenID], lastLeftCard[tokenID], lastRightCard[tokenID])); //isMint is true because this is a mint event. emit HandDealt(tokenID, leftCard, rightCard, true); } //While the upgrade function starts here, it is the VRF Coordinator who actually mints the NFTs. function upgrade(uint256 tokenID) external payable { require(msg.sender == ownerOf(tokenID)); require(msg.value == upgradePrice, "Wrong amount for upgrade."); //If the correct amount is sent, then request a VRF number. getRandomNumberForUpgrade(tokenID); (bool upgradePaymentSent, ) = payable(receiverAccount).call { value: msg.value }(""); require(upgradePaymentSent, "Failed to send Ether for upgrade."); } //Called from fulfillRandomness. function upgradePig(uint256 tokenID, uint256 randomNumberFromChainlink) internal { //Change to public for Remix testing. You can directly input numbers this way. //The maximum number of chips is 200. If there are already 200 chips, then this is ignored, and only new plaques can be earned. if (chipStack[tokenID] < 200) { chipStack[tokenID] += 1; } //Crop out six digit pieces of the returned VRF number. This in effect makes a 1 million card shoe for each card and renders modulo bias moot. uint256 leftCard = (((randomNumberFromChainlink % 10 ** 12 / 10 ** 6) + 52) % 52) + 1; uint256 rightCard = (((randomNumberFromChainlink % 10 ** 6) + 52) % 52) + 1; //This saves the cards to a mapping so the lookup function can fetch the last cards dealt for display on the pig. lastLeftCard[tokenID] = leftCard; lastRightCard[tokenID] = rightCard; //Evaluate the hand to check if it is aces, and then what type of aces. if (plaqueStack[tokenID] < 3) { if ((leftCard == 1 || leftCard == 14 || leftCard == 27 || leftCard == 40) && (rightCard == 1 || rightCard == 14 || rightCard == 27 || rightCard == 40)) { totalAces[tokenID] += 1; //Add a plaque plaqueStack[tokenID] += 1; //Check if they are matching aces. if (leftCard == rightCard) { matchingAces[tokenID] += 1; //If they are matching aces, then check to see if they are matching diamond aces. if (leftCard == 14 && rightCard == 14) { diamondAces[tokenID] += 1; } } } } else if (plaqueStack[tokenID] < 7) { if ((leftCard == 1 || leftCard == 14 || leftCard == 27 || leftCard == 40) && (rightCard == 1 || rightCard == 14 || rightCard == 27 || rightCard == 40)) { totalAces[tokenID] += 1; //Check if they are matching aces. if (leftCard == rightCard) { //Add a plaque plaqueStack[tokenID] += 1; matchingAces[tokenID] += 1; //If they are matching aces, then check to see if they are matching diamond aces. if (leftCard == 14 && rightCard == 14) { diamondAces[tokenID] += 1; } } } } else { if ((leftCard == 1 || leftCard == 14 || leftCard == 27 || leftCard == 40) && (rightCard == 1 || rightCard == 14 || rightCard == 27 || rightCard == 40)) { totalAces[tokenID] += 1; //Add a plaque if (leftCard == rightCard) { matchingAces[tokenID] += 1; //If they are matching aces, then check to see if they are matching diamond aces. if (leftCard == 14 && rightCard == 14) { if (plaqueStack[tokenID] < 10) { //Add a plaque plaqueStack[tokenID] += 1; } diamondAces[tokenID] += 1; } } } } //Add to the total hands dealt total. totalHandsDealt++; //Add to the total upgrades of the pig. This can exceed the cap on chips, so we need to save for statistical purposes. upgradeCount[tokenID] += 1; //We use this mapping to easily find the history of VRF results, such as the last five hands dealt, or when aces were hit. lookupTokenHistory[tokenID].push(tokenHistory(chipStack[tokenID], plaqueStack[tokenID], totalAces[tokenID], matchingAces[tokenID], diamondAces[tokenID], lastLeftCard[tokenID], lastRightCard[tokenID])); //isMint is false because this is an upgrade event. emit HandDealt(tokenID, leftCard, rightCard, false); } //Start or pause the minting functionality in the contract. function changeSaleState() external onlyOwner { forSale = !forSale; } //Permanently stops minting. This cannot be reverted. Only can be triggered when forSale is false. function permanentlyStopMinting() external onlyOwner { require(forSale == false, "You must switch off mints before permanently disabling them manually."); require(permanentlyStop == false, "Minting has already been permanently disabled."); permanentlyStop = true; } //Start or pause the upgrade functionality in the contract. function changeUpgradeState() external onlyOwner { upgradeable = !upgradeable; } //Permanently stops upgrades. This cannot be reverted. Only can be triggered when permanentlyStopUpgrades is false. function permanentlyStopUpgrading() external onlyOwner { require(upgradeable == false, "You must switch off upgrades before permanently disabling them manually."); require(permanentlyStopUpgrades == false, "Upgrading has already been permanently disabled."); permanentlyStopUpgrades = true; } //Change the price of upgrading. function changeUpgradePrice(uint256 newUpgradePrice) external onlyOwner { upgradePrice = newUpgradePrice; } //Change the price of minting. function changePrice(uint256 newPrice) external onlyOwner { price = newPrice; } //Set the receiving account. function changeReceivingAccount(address payable newReceivingAddress) external onlyOwner { receiverAccount = newReceivingAddress; } //Change the owner of the contract. function changeContractOwner(address payable newcontractOwner) external onlyOwner { contractOwner = newcontractOwner; } //Get the total stack of a particular pig. function totalStack(uint256 tokenID) external view returns(uint256) { uint256 totalChipStack = chipLookup(chipStack[tokenID]) + plaqueLookup(plaqueStack[tokenID]); return totalChipStack; } //Calculates the total chip stack exclusive of plaques. function chipLookup(uint256 chips) internal pure returns(uint256) { if (chips <= 100) { return 1000 * chips; } return (5000 * (chips - 100)) + 100000; } //Calculates the total plaque stack exclusive of chips. function plaqueLookup(uint256 plaques) internal pure returns(uint256) { if (plaques > 0) return 25000 * plaques; else return 0; } //This function allows the metadata to be updated, and the location of it to be changed to decentralized file services after minting. function _setTokenUri(string memory newuri) public onlyOwner { baseURI = newuri; } //Withdraw all of the LINK from the contract. Probably not necessary since we know the total amount of pigs that can be minted, but you never know. function withdrawLink() external onlyOwner { LinkTokenInterface link = LinkTokenInterface(linkTokenAddress); require(link.transfer(receiverAccount, link.balanceOf(address(this))), "Unable to transfer"); } }
How many deer does it take to build a space shuttle? -Nadia Khuzina
contract DegeneratePigs is VRFConsumerBase, ERC721, ReentrancyGuard { address public contractOwner; bytes32 internal keyHash = 0xf86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da; address internal vrfCoordinator = 0x3d2341ADb2D31f1c5530cDC622016af293177AE0; address internal linkTokenAddress = 0xb0897686c545045aFc77CF20eC7A532E3120E0F1; uint256 internal fee; address payable public receiverAccount; uint256 public price; uint256 public upgradePrice; uint256 internal totalNFTs; uint256 internal mintRequests; uint256 public totalHandsDealt; bool public forSale; bool public permanentlyStop; bool public upgradeable; bool public permanentlyStopUpgrades; function _beforeTokenTransfer( address from, address to, uint256 tokenId } struct tokenHistory { uint256 chipStack; uint256 plaqueStack; uint256 totalAces; uint256 matchingAces; uint256 diamondAces; uint256 lastLeftCard; uint256 lastRightCard; } mapping(bytes32 => address) internal minterAddress; mapping(bytes32 => uint256) internal tokenToUpgrade; mapping(uint256 => uint256) public lookupFullTokenID; mapping(uint256 => uint256) public upgradeCount; mapping(uint256 => tokenHistory[]) public lookupTokenHistory; mapping(uint256 => uint256) internal chipStack; mapping(uint256 => uint256) internal plaqueStack; mapping(uint256 => uint256) internal totalAces; mapping(uint256 => uint256) internal matchingAces; mapping(uint256 => uint256) internal diamondAces; mapping(uint256 => uint256) internal lastLeftCard; mapping(uint256 => uint256) internal lastRightCard; constructor() VRFConsumerBase( vrfCoordinator, linkTokenAddress event HandDealt(uint256 indexed tokenID, uint256 leftCard, uint256 rightCard, bool isMint); ) { contractOwner = msg.sender; receiverAccount = payable(msg.sender); fee = 0.0001 * 10 ** 18; price = 25 * 10 ** 18; upgradePrice = 2 * 10 ** 18; mintRequests = 0; } modifier onlyOwner() { require(msg.sender == contractOwner); _; } function getRandomNumberForMint() internal returns(bytes32 requestId) { require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK. Topup the contract with LINK."); requestId = requestRandomness(keyHash, fee); minterAddress[requestId] = msg.sender; return requestId; } function getRandomNumberForUpgrade(uint256 tokenID) internal returns(bytes32 requestId) { require(LINK.balanceOf(address(this)) >= fee, "Not enough LINK. Topup the contract with LINK."); requestId = requestRandomness(keyHash, fee); tokenToUpgrade[requestId] = tokenID; return requestId; } function fulfillRandomness(bytes32 requestId, uint256 randomNumber) internal override { require(msg.sender == vrfCoordinator, "Only the VRF Coordinator may call this function."); if (tokenToUpgrade[requestId] != 0) { upgradePig(tokenToUpgrade[requestId], randomNumber); mintPig(minterAddress[requestId], randomNumber); } } function fulfillRandomness(bytes32 requestId, uint256 randomNumber) internal override { require(msg.sender == vrfCoordinator, "Only the VRF Coordinator may call this function."); if (tokenToUpgrade[requestId] != 0) { upgradePig(tokenToUpgrade[requestId], randomNumber); mintPig(minterAddress[requestId], randomNumber); } } } else { function mint() external payable nonReentrant { require(permanentlyStop == false, "Minting has been permanently disabled."); require(forSale == true, "Minting has been paused."); require(mintRequests < 1024, "No pigs left to mint, sorry. :-("); require(msg.value == price, "Wrong amount for mint."); getRandomNumberForMint(); mintRequests++; require(mintPaymentSent, "Failed to send Ether for minting."); } (bool mintPaymentSent, ) = payable(receiverAccount).call { value: msg.value }(""); function totalSupply() public view returns(uint256) { return totalNFTs; } function getUpgrades(uint256 tokenID) public view returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256) { return (chipStack[tokenID], plaqueStack[tokenID], totalAces[tokenID], matchingAces[tokenID], diamondAces[tokenID], lastLeftCard[tokenID], lastRightCard[tokenID]); } function backgroundLookup(uint256 index) internal pure returns(uint256) { if (index <= 40) return 0; else if (index <= 50) return 1; else if (index <= 60) return 2; else if (index <= 70) return 3; else if (index <= 80) return 4; else if (index <= 85) return 5; else if (index <= 90) return 6; else if (index <= 95) return 7; else if (index < 99) return 8; return 9; } uint256 rightCard = (((randomNumberFromChainlink % 10 ** 16 / 10 ** 10) + 52) % 52) + 1; lastRightCard[tokenID] = rightCard; totalNFTs++; uint256 background = backgroundLookup(randomNumberFromChainlink % 10 ** 11 / 10 ** 9); uint256 tokenID = ((totalNFTs * 10 ** 10) + (background * 10 ** 9)) + randomNumberFromChainlink % 10 ** 9; _mint(minter, tokenID); lookupFullTokenID[totalNFTs] = tokenID; uint256 leftCard = (((randomNumberFromChainlink % 10 ** 22 / 10 ** 16) + 52) % 52) + 1; lastLeftCard[tokenID] = leftCard; chipStack[tokenID] = 1; if ((leftCard == 1 || leftCard == 14 || leftCard == 27 || leftCard == 40) && (rightCard == 1 || rightCard == 14 || rightCard == 27 || rightCard == 40)) { totalAces[tokenID] = 1; plaqueStack[tokenID] = 1; if (leftCard == rightCard) { matchingAces[tokenID] = 1; if (leftCard == 14 && rightCard == 14) { diamondAces[tokenID] = 1; } } } if ((leftCard == 1 || leftCard == 14 || leftCard == 27 || leftCard == 40) && (rightCard == 1 || rightCard == 14 || rightCard == 27 || rightCard == 40)) { totalAces[tokenID] = 1; plaqueStack[tokenID] = 1; if (leftCard == rightCard) { matchingAces[tokenID] = 1; if (leftCard == 14 && rightCard == 14) { diamondAces[tokenID] = 1; } } } if ((leftCard == 1 || leftCard == 14 || leftCard == 27 || leftCard == 40) && (rightCard == 1 || rightCard == 14 || rightCard == 27 || rightCard == 40)) { totalAces[tokenID] = 1; plaqueStack[tokenID] = 1; if (leftCard == rightCard) { matchingAces[tokenID] = 1; if (leftCard == 14 && rightCard == 14) { diamondAces[tokenID] = 1; } } } totalHandsDealt++; upgradeCount[tokenID] += 1; lookupTokenHistory[tokenID].push(tokenHistory(chipStack[tokenID], plaqueStack[tokenID], totalAces[tokenID], matchingAces[tokenID], diamondAces[tokenID], lastLeftCard[tokenID], lastRightCard[tokenID])); emit HandDealt(tokenID, leftCard, rightCard, true); }
14,111,419
[ 1, 4625, 348, 7953, 560, 30, 9017, 4906, 443, 264, 1552, 518, 4862, 358, 1361, 279, 3476, 9171, 5929, 35, 300, 50, 361, 1155, 1475, 76, 29298, 15314, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 16351, 463, 1332, 14681, 52, 360, 87, 353, 776, 12918, 5869, 2171, 16, 4232, 39, 27, 5340, 16, 868, 8230, 12514, 16709, 288, 203, 565, 1758, 1071, 6835, 5541, 31, 203, 565, 1731, 1578, 2713, 498, 2310, 273, 374, 5841, 5292, 31677, 8522, 6669, 9349, 71, 2539, 29, 8642, 70, 22, 70, 26, 2499, 73, 9897, 27, 5026, 23, 69, 26, 74, 1105, 29, 70, 1403, 10392, 27, 1611, 952, 6564, 22, 74, 20, 4313, 29, 73, 22, 71, 6564, 29, 2414, 31, 203, 565, 1758, 2713, 20466, 25307, 273, 374, 92, 23, 72, 4366, 9803, 1880, 70, 22, 40, 6938, 74, 21, 71, 2539, 5082, 71, 5528, 26, 3787, 24171, 1727, 5540, 23, 29882, 16985, 20, 31, 203, 565, 1758, 2713, 1692, 1345, 1887, 273, 374, 6114, 20, 6675, 6669, 5292, 71, 6564, 25, 3028, 25, 69, 42, 71, 4700, 8955, 3462, 73, 39, 27, 37, 25, 1578, 41, 23, 22343, 41, 20, 42, 21, 31, 203, 565, 2254, 5034, 2713, 14036, 31, 203, 565, 1758, 8843, 429, 1071, 5971, 3032, 31, 203, 565, 2254, 5034, 1071, 6205, 31, 203, 565, 2254, 5034, 1071, 8400, 5147, 31, 203, 565, 2254, 5034, 2713, 2078, 50, 4464, 87, 31, 203, 565, 2254, 5034, 2713, 312, 474, 6421, 31, 203, 565, 2254, 5034, 1071, 2078, 1144, 87, 758, 2390, 31, 203, 565, 1426, 1071, 364, 30746, 31, 203, 565, 1426, 1071, 16866, 715, 4947, 31, 203, 565, 1426, 1071, 8400, 429, 31, 203, 565, 1426, 1071, 16866, 715, 4947, 1211, 13088, 31, 203, 203, 565, 445, 389, 5771, 1345, 5912, 12, 203, 3639, 1758, 628, 16, 203, 3639, 1758, 358, 16, 203, 3639, 2254, 5034, 1147, 548, 203, 97, 203, 203, 565, 1958, 1147, 5623, 288, 203, 3639, 2254, 5034, 18624, 2624, 31, 203, 3639, 2254, 5034, 886, 14886, 2624, 31, 203, 3639, 2254, 5034, 2078, 37, 764, 31, 203, 3639, 2254, 5034, 3607, 37, 764, 31, 203, 3639, 2254, 5034, 4314, 301, 1434, 37, 764, 31, 203, 3639, 2254, 5034, 1142, 3910, 6415, 31, 203, 3639, 2254, 5034, 1142, 4726, 6415, 31, 203, 565, 289, 203, 203, 203, 565, 2874, 12, 3890, 1578, 516, 1758, 13, 2713, 1131, 387, 1887, 31, 203, 565, 2874, 12, 3890, 1578, 516, 2254, 5034, 13, 2713, 1147, 774, 10784, 31, 203, 565, 2874, 12, 11890, 5034, 516, 2254, 5034, 13, 1071, 3689, 5080, 1345, 734, 31, 203, 565, 2874, 12, 11890, 5034, 516, 2254, 5034, 13, 1071, 8400, 1380, 31, 203, 565, 2874, 12, 11890, 5034, 516, 1147, 5623, 63, 5717, 1071, 3689, 1345, 5623, 31, 203, 565, 2874, 12, 11890, 5034, 516, 2254, 5034, 13, 2713, 18624, 2624, 31, 203, 565, 2874, 12, 11890, 5034, 516, 2254, 5034, 13, 2713, 886, 14886, 2624, 31, 203, 565, 2874, 12, 11890, 5034, 516, 2254, 5034, 13, 2713, 2078, 37, 764, 31, 203, 565, 2874, 12, 11890, 5034, 516, 2254, 5034, 13, 2713, 3607, 37, 764, 31, 203, 565, 2874, 12, 11890, 5034, 516, 2254, 5034, 13, 2713, 4314, 301, 1434, 37, 764, 31, 203, 565, 2874, 12, 11890, 5034, 516, 2254, 5034, 13, 2713, 1142, 3910, 6415, 31, 203, 565, 2874, 12, 11890, 5034, 516, 2254, 5034, 13, 2713, 1142, 4726, 6415, 31, 203, 203, 565, 3885, 1435, 203, 565, 776, 12918, 5869, 2171, 12, 203, 3639, 20466, 25307, 16, 203, 3639, 1692, 1345, 1887, 203, 565, 871, 2841, 758, 2390, 12, 11890, 5034, 8808, 1147, 734, 16, 2254, 5034, 2002, 6415, 16, 2254, 5034, 2145, 6415, 16, 1426, 15707, 474, 1769, 203, 565, 262, 288, 203, 3639, 6835, 5541, 273, 1234, 18, 15330, 31, 203, 3639, 5971, 3032, 273, 8843, 429, 12, 3576, 18, 15330, 1769, 203, 3639, 14036, 273, 374, 18, 13304, 380, 1728, 2826, 6549, 31, 203, 3639, 6205, 273, 6969, 380, 1728, 2826, 6549, 31, 203, 3639, 8400, 5147, 273, 576, 380, 1728, 2826, 6549, 31, 203, 3639, 312, 474, 6421, 273, 374, 31, 203, 565, 289, 203, 203, 565, 9606, 1338, 5541, 1435, 288, 203, 3639, 2583, 12, 3576, 18, 15330, 422, 6835, 5541, 1769, 203, 3639, 389, 31, 203, 565, 289, 203, 203, 565, 445, 20581, 1854, 1290, 49, 474, 1435, 2713, 1135, 12, 3890, 1578, 14459, 13, 288, 203, 3639, 2583, 12, 10554, 18, 12296, 951, 12, 2867, 12, 2211, 3719, 1545, 14036, 16, 315, 1248, 7304, 22926, 18, 7202, 416, 326, 6835, 598, 22926, 1199, 1769, 203, 3639, 14459, 273, 590, 8529, 4496, 12, 856, 2310, 16, 14036, 1769, 203, 3639, 1131, 387, 1887, 63, 2293, 548, 65, 273, 1234, 18, 15330, 31, 203, 3639, 327, 14459, 31, 203, 565, 289, 203, 203, 565, 445, 20581, 1854, 1290, 10784, 12, 11890, 5034, 1147, 734, 13, 2713, 1135, 12, 3890, 1578, 14459, 13, 288, 203, 3639, 2583, 12, 10554, 18, 12296, 951, 12, 2867, 12, 2211, 3719, 1545, 14036, 16, 315, 1248, 7304, 22926, 18, 7202, 416, 326, 6835, 598, 22926, 1199, 1769, 203, 3639, 14459, 273, 590, 8529, 4496, 12, 856, 2310, 16, 14036, 1769, 203, 3639, 1147, 774, 10784, 63, 2293, 548, 65, 273, 1147, 734, 31, 203, 3639, 327, 14459, 31, 203, 565, 289, 203, 203, 565, 445, 22290, 8529, 4496, 12, 3890, 1578, 14459, 16, 2254, 5034, 2744, 1854, 13, 2713, 3849, 288, 203, 3639, 2583, 12, 3576, 18, 15330, 422, 20466, 25307, 16, 315, 3386, 326, 776, 12918, 10320, 4240, 2026, 745, 333, 445, 1199, 1769, 203, 3639, 309, 261, 2316, 774, 10784, 63, 2293, 548, 65, 480, 374, 13, 288, 203, 5411, 8400, 52, 360, 12, 2316, 774, 10784, 63, 2293, 548, 6487, 2744, 1854, 1769, 203, 5411, 312, 474, 52, 360, 12, 1154, 387, 1887, 63, 2293, 548, 6487, 2744, 1854, 1769, 203, 3639, 289, 203, 565, 289, 203, 203, 565, 445, 22290, 8529, 4496, 12, 3890, 1578, 14459, 16, 2254, 5034, 2744, 1854, 13, 2713, 3849, 288, 203, 3639, 2583, 12, 3576, 18, 15330, 422, 20466, 25307, 16, 315, 3386, 326, 776, 12918, 10320, 4240, 2026, 745, 333, 445, 1199, 1769, 203, 3639, 309, 261, 2316, 774, 10784, 63, 2293, 548, 65, 480, 374, 13, 288, 203, 5411, 8400, 52, 360, 12, 2316, 774, 10784, 63, 2293, 548, 6487, 2744, 1854, 1769, 203, 5411, 312, 474, 52, 360, 12, 1154, 387, 1887, 63, 2 ]
// Правила для изменения достоверности распознавания конкретных словоформ в русском словаре. // Обычное предназначение этих правил - изменить равновероятные распознавания // омонимичных форм жаль(безличный глагол)>жаль(императив), // либо повлиять на выбор многословных форм в противовес // выбору отдельных слов: [слева от] <--> [слева] [от] wordform_score смеси{глагол}=-10 // из чего смеси ? wordform_score ага{ существительное }=-5 wordform_score малышки{ род:муж }=-10 // Малышки будут прыгать от радости! wordform_score мебели{ число:мн }=-10 // Рвали обивку мебели. wordform_score начало{ глагол }=-6 // Сегодня неплохое начало. wordform_score воды{ род:муж }=-10 // мы приплывем в их воды wordform_score скалы{ род:муж }=-10 // там должны быть скалы wordform_score кафе{ род:муж }=-10 // в кафе wordform_score скалы{ род:муж }=-10 // волны бились о скалы wordform_score кроме{ существительное }=-10 // кроме этой вот ягоды wordform_score жилище{ род:жен }=-10 // в ее жилище wordform_score почитай{ наречие }=-4 // Ты лучше почитай. wordform_score без{ существительное }=-10 // Без кладовок и гардеробных комнат wordform_score бренды{род:жен}=-10 // Вообще-то перечисленные бренды давно уже избавились от налета местечковости. wordform_score ярки{ существительное }=-10 // Глаза его были ярки wordform_score голубей{ прилагательное }=-1 // Ты будешь Петькиных голубей подманивать. wordform_score дело{ глагол }=-10 // Дело наше лесное. wordform_score правило{ глагол }=-5 // Такое наше правило... wordform_score карусель{ глагол }=-10 // Карусель начинается мировая. wordform_score Германии{ число:мн }=-10 // В Германии беженец спрыгнул с поезда из-за угрозы депортации в Италию wordform_score бусы { род:муж }=-5 // Весенние бусы персикового дерева разорвались. wordform_score суеты { число:мн }=-10 // Завершился 26-ой тур российской премьер-лиги. wordform_score метель { глагол }=-10 // На улице метель. //wordform_score по-видимому { наречие }=2 //wordform_score по-видимому { вводное }=2 // Ему, по-видимому, не терпелось начать. wordform_score энергии { существительное число:мн }=-2 // Ему и сейчас не занимать энергии. wordform_score таки { существительное }=-5 // Ему-таки удалось ее завести. wordform_score выстуживаем { прилагательное }=-1 wordform_score уполномочиваем { прилагательное }=-1 wordform_score кормим { прилагательное }=-1 wordform_score чиним { прилагательное }=-1 wordform_score заводим { прилагательное }=-1 wordform_score периодизируем { прилагательное }=-1 wordform_score завозим { прилагательное }=-1 wordform_score дегустируем { прилагательное }=-1 wordform_score увозим { прилагательное }=-1 wordform_score вообразим { прилагательное }=-1 wordform_score дробим { прилагательное }=-1 wordform_score таскаем { прилагательное }=-1 wordform_score превозносим { прилагательное }=-1 wordform_score потопляем { прилагательное }=-1 wordform_score волочим { прилагательное }=-1 wordform_score перевиваем { прилагательное }=-1 wordform_score засекречиваем { прилагательное }=-1 wordform_score храним { прилагательное }=-1 wordform_score уносим { прилагательное }=-1 wordform_score предводим { прилагательное }=-1 wordform_score мыслим { прилагательное }=-1 wordform_score проходим { прилагательное }=-1 wordform_score влачим { прилагательное }=-1 wordform_score творим { прилагательное }=-1 wordform_score сравним { прилагательное }=-1 wordform_score измерим { прилагательное }=-1 wordform_score душим { прилагательное }=-1 wordform_score сопоставим { прилагательное }=-1 wordform_score досягаем { прилагательное }=-1 wordform_score травим { прилагательное }=-1 wordform_score благоволим { прилагательное }=-1 wordform_score убеждаем { прилагательное }=-1 wordform_score слышим { прилагательное }=-1 wordform_score слышим { прилагательное }=-1 wordform_score подгружаем { прилагательное }=-1 wordform_score укрупняем { прилагательное }=-1 wordform_score взымаем { прилагательное }=-1 wordform_score зашвыриваем { прилагательное }=-1 wordform_score зависим { прилагательное }=-1 wordform_score ощутим { прилагательное }=-1 wordform_score громим { прилагательное }=-1 wordform_score застраиваем { прилагательное }=-1 wordform_score исправим { прилагательное }=-1 wordform_score выполним { прилагательное }=-1 wordform_score производим { прилагательное }=-1 wordform_score втемяшиваем { прилагательное }=-1 wordform_score содержим { прилагательное }=-1 wordform_score подносим { прилагательное }=-1 wordform_score вкраиваем { прилагательное }=-1 wordform_score беспокоим { прилагательное }=-1 wordform_score взнуздываем { прилагательное }=-1 wordform_score носим { прилагательное }=-1 wordform_score любим { прилагательное }=-1 wordform_score доносим { прилагательное }=-1 wordform_score уценяем { прилагательное }=-1 wordform_score ненавидим { прилагательное }=-1 wordform_score судим { прилагательное }=-1 wordform_score вмораживаем { прилагательное }=-1 wordform_score ввозим { прилагательное }=-1 wordform_score подвозим { прилагательное }=-1 wordform_score развозим { прилагательное }=-1 wordform_score привозим { прилагательное }=-1 wordform_score реструктурируем { прилагательное }=-1 wordform_score реструктурируем { прилагательное }=-1 wordform_score подтопляем { прилагательное }=-1 wordform_score перезаписываем { прилагательное }=-1 wordform_score ценим { прилагательное }=-1 wordform_score национализируем { прилагательное }=-1 wordform_score национализируем { прилагательное }=-1 wordform_score проминаем { прилагательное }=-1 wordform_score переносим { прилагательное }=-1 wordform_score возводим { прилагательное }=-1 wordform_score проницаем { прилагательное }=-1 wordform_score проводим { прилагательное }=-1 wordform_score проводим { прилагательное }=-1 wordform_score таим { прилагательное }=-1 wordform_score синхронизируем { прилагательное }=-1 wordform_score вводим { прилагательное }=-1 wordform_score гоним { прилагательное }=-1 wordform_score разделим { прилагательное }=-1 wordform_score ввариваем { прилагательное }=-1 wordform_score бороздим { прилагательное }=-1 wordform_score воспоминаем { прилагательное }=-1 wordform_score руководим { прилагательное }=-1 wordform_score сносим { прилагательное }=-1 wordform_score разносим { прилагательное }=-1 wordform_score стандартизируем { прилагательное }=-1 wordform_score терпим { прилагательное }=-1 wordform_score выносим { прилагательное }=-1 wordform_score выносим { прилагательное }=-1 wordform_score боготворим { прилагательное }=-1 wordform_score клоним { прилагательное }=-1 wordform_score прозываем { прилагательное }=-1 wordform_score привносим { прилагательное }=-1 wordform_score соизмерим { прилагательное }=-1 wordform_score компилируем { прилагательное }=-1 wordform_score централизуем { прилагательное }=-1 wordform_score упаковываем { прилагательное }=-1 wordform_score возбудим { прилагательное }=-1 wordform_score отделим { прилагательное }=-1 wordform_score ограбляем { прилагательное }=-1 wordform_score объясним { прилагательное }=-1 wordform_score наводим { прилагательное }=-1 wordform_score подводим { прилагательное }=-1 wordform_score исполним { прилагательное }=-1 wordform_score вычислим { прилагательное }=-1 wordform_score монетизируем { прилагательное }=-1 wordform_score отряжаем { прилагательное }=-1 wordform_score разъединим { прилагательное }=-1 wordform_score заменим { прилагательное }=-1 wordform_score охаиваем { прилагательное }=-1 wordform_score растворим { прилагательное }=-1 wordform_score наносим { прилагательное }=-1 wordform_score уничтожим { прилагательное }=-1 wordform_score томим { прилагательное }=-1 wordform_score заполним { прилагательное }=-1 wordform_score сводим { прилагательное }=-1 wordform_score выводим { прилагательное }=-1 wordform_score перевозим { прилагательное }=-1 wordform_score взаимозаменяем { прилагательное }=-1 wordform_score поносим { прилагательное }=-1 wordform_score вверстываем { прилагательное }=-1 wordform_score воспроизводим { прилагательное }=-1 wordform_score вывозим { прилагательное }=-1 wordform_score прорежаем { прилагательное }=-1 wordform_score дренируем { прилагательное }=-1 wordform_score разграбляем { прилагательное }=-1 wordform_score обеззараживаем { прилагательное }=-1 wordform_score тесним { прилагательное }=-1 wordform_score вносим { прилагательное }=-1 wordform_score разрешим { прилагательное }=-1 wordform_score подбодряем { прилагательное }=-1 wordform_score уловим { прилагательное }=-1 wordform_score вдергиваем { прилагательное }=-1 wordform_score автопилотируем { прилагательное }=-1 wordform_score автопилотируем { прилагательное }=-1 wordform_score воссоединяем { прилагательное }=-1 wordform_score фондируем { прилагательное }=-1 wordform_score зрим { прилагательное }=-1 wordform_score допустим { прилагательное }=-1 wordform_score преподносим { прилагательное }=-1 wordform_score устраним { прилагательное }=-1 wordform_score устрашим { прилагательное }=-1 wordform_score поправим { прилагательное }=-1 wordform_score нарезаем { прилагательное }=-1 wordform_score значим { прилагательное }=-1 wordform_score истребим { прилагательное }=-1 wordform_score окормляем { прилагательное }=-1 wordform_score воплотим { прилагательное }=-1 wordform_score будоражим { прилагательное }=-1 wordform_score тревожим { прилагательное }=-1 wordform_score применим { прилагательное }=-1 wordform_score дактилоскопируем { прилагательное }=-1 wordform_score дактилоскопируем { прилагательное }=-1 wordform_score браним { прилагательное }=-1 wordform_score провозим { прилагательное }=-1 wordform_score чтим { прилагательное }=-1 wordform_score приложим { прилагательное }=-1 wordform_score повторим { прилагательное }=-1 wordform_score вменяем { прилагательное }=-1 wordform_score раздробляем { прилагательное }=-1 wordform_score льготируем { прилагательное }=-1 wordform_score перезаправляем { прилагательное }=-1 wordform_score удовлетворим { прилагательное }=-1 wordform_score отводим { прилагательное }=-1 wordform_score переводим { прилагательное }=-1 wordform_score утапливаем { прилагательное }=-1 wordform_score предотвратим { прилагательное }=-1 wordform_score тормозим { прилагательное }=-1 wordform_score вербализуем { прилагательное }=-1 wordform_score тостуем { прилагательное }=-1 wordform_score разводим { прилагательное }=-1 wordform_score уводим { прилагательное }=-1 wordform_score искореним { прилагательное }=-1 wordform_score протапливаем { прилагательное }=-1 wordform_score изготавливаем { прилагательное }=-1 wordform_score изъясним { прилагательное }=-1 wordform_score употребим { прилагательное }=-1 wordform_score разложим { прилагательное }=-1 wordform_score возносим { прилагательное }=-1 wordform_score проносим { прилагательное }=-1 wordform_score предвидим { прилагательное }=-1 wordform_score полимеризуем { прилагательное }=-1 wordform_score полимеризуем { прилагательное }=-1 wordform_score исчислим { прилагательное }=-1 wordform_score погрешим { прилагательное }=-1 wordform_score совместим { прилагательное }=-1 wordform_score впериваем { прилагательное }=-1 wordform_score приносим { прилагательное }=-1 wordform_score доводим { прилагательное }=-1 wordform_score заносим { прилагательное }=-1 wordform_score вытаращиваем { прилагательное }=-1 wordform_score обоготворяем { прилагательное }=-1 wordform_score наметаем { прилагательное }=-1 wordform_score делим { прилагательное }=-1 wordform_score хвалим { прилагательное }=-1 wordform_score излечим { прилагательное }=-1 wordform_score обратим { прилагательное }=-1 wordform_score уязвим { прилагательное }=-1 wordform_score определим { прилагательное }=-1 wordform_score произносим { прилагательное }=-1 wordform_score возобновим { прилагательное }=-1 wordform_score соотносим { прилагательное }=-1 wordform_score победим { прилагательное }=-1 wordform_score раним { прилагательное }=-1 wordform_score отличим { прилагательное }=-1 wordform_score прокачиваем { прилагательное }=-1 wordform_score рейтингуем { прилагательное }=-1 wordform_score растравляем { прилагательное }=-1 wordform_score коров { род:муж } = -2 // Без коров мужчины погибли бы. wordform_score ангел { род:жен } = -2 // А мисс Уиллоу была просто ангел. wordform_score слаб { глагол } = -1 // Просто ты слаб! //wordform_score писал { stress:"п^исал" } = -1 // Державин писал: //wordform_score писала { stress:"п^исала" } = -1 wordform_score сердит { глагол } = -1 // Он очень сердит. wordform_score ребят { падеж:зват } = -1 // Ребят пора вернуть wordform_score помочь { существительное } = -10 // мы хотим вам помочь wordform_score вон { существительное } = -1 // Я вон зарабатываю. wordform_score скалами { род:муж } = -5 // Миновав Море Акул, путешественники оказались над Крабьими Скалами. wordform_score воды { род:муж } = -5 // выпить воды wordform_score воде { род:муж } = -5 // рожать в воде wordform_score лук { род:жен } = -5 // возьми с собой лук wordform_score базе { род:муж } = -5 // заправлять на базе wordform_score порошки { род:жен } = -5 // Порошки не помогают... wordform_score обезвреживания { число:мн } = -5 // Разработали план обезвреживания. wordform_score трех { существительное } = -10 // Считаю до трех. wordform_score метель { глагол } = -10 // На улице метель. wordforms_score городской { существительное }=-1 // Существуют городские правила, касающиеся этих процедур. wordforms_score утесать {глагол}=-5 // Я утешу тебя. wordforms_score примереть {глагол}=-5 // Внутри пример wordforms_score запоить {глагол}=-5 // Я запою wordforms_score новое { существительное }=-5 // Начинаются поиски новых приемов, новых методов. wordforms_score просек { существительное }=-5 // Матросы переползали просеку. wordforms_score прививок { существительное }=-10 wordforms_score полок { существительное род:муж }=-5 // Началась переправа полков. wordforms_score уток { существительное род:муж }=-10 wordforms_score юр { существительное }=-10 wordforms_score наркотика { существительное род:жен }=-10 // Одно время она даже пыталась бросить наркотики wordforms_score полян { существительное род:муж }=-10 wordforms_score полянин { существительное род:муж }=-10 wordforms_score чужой { существительное }=-5 // голос ее стал чужим wordforms_score живой { существительное }=-5 // но оно было живым! wordforms_score пяток { существительное }=-5 // сверкать пятками wordforms_score ложок { существительное }=-5 // звякнуть ложками wordforms_score костра { существительное }=-5 // сжечь на костре wordforms_score роить { глагол }=-10 // Я рою траншеи wordforms_score ситце { род:ср }=-10 // шить из ситца wordforms_score взяток { существительное }=-10 // Врач попался на взятке wordforms_score сило { существительное }=-10 // Оставить в силе закон. wordforms_score покадить { глагол }=-5 // Я после покажу... wordforms_score выло { существительное }=-5 // Як не выл больше. wordforms_score вылезть { глагол }=-1 // Я медленно вылез. wordforms_score лунь { существительное }=-1 // Астронавты смогут оставаться на Луне в течение недели wordforms_score закроить { глагол }=-1 // Я потом закрою. wordforms_score вылезть { глагол }=-1 // Машинист вылез. wordforms_score охаять { глагол }=-1 // Кто охает? wordforms_score покадить { глагол }=-1 // Я покажу! wordforms_score ила { существительное род:жен }=-5 // Я раскопал ил wordforms_score ос { существительное род:муж }=-5 // В воздухе гудели мухи и осы. wordforms_score прикроить { глагол }=-2 // Атакуй, прикрою. wordforms_score ох { существительное }=-2 // Ей это ох как не нравилось. wordforms_score кровяный { прилагательное }=-2 // Стимулирует кровообращение и снижает кровяное давление. wordforms_score жило { существительное }=-5 // Именно так выглядит обычный кварц рудных жил. wordforms_score крон { существительное } =-5 // Видите эти могучие кроны, тяжелые плоды? wordforms_score утюжка { существительное }=-5 wordforms_score нар { существительное }=-2 wordforms_score подбора { существительное }=-10 wordforms_score кормило { существительное }=-10 wordforms_score дубка { существительное }=-2 // Сам горб порос крепкими дубками. wordforms_score кода { существительное }=-5 // Серые ячейки указывают на неназначенные коды wordforms_score песнь { существительное }=-1 // Проводится круглогодичный конкурс бардовской песни. wordforms_score тоника { существительное }=-10 wordforms_score рака { существительное }=-10 wordforms_score бахчевый { прилагательное }=-5 // Особое внимание уделялось бахчевым культурам. wordforms_score нецелевый { прилагательное }=-5 // Процветало нецелевое использование этих средств. wordforms_score запасный { прилагательное }=-5 // Пятигорский вокзал был запасным вариантом. wordforms_score бредовой { прилагательное }=-5 // Первая стопка содержала бредовые работы. wordforms_score меньшой { прилагательное }=-5 // Такие передачи имеют меньшую аудиторию. wordforms_score меховый { прилагательное }=-5 // Летняя распродажа меховых изделий продолжается! wordforms_score заводский { прилагательное }=-10 // Существует заводская группа внутренних аудиторов. wordforms_score щенка { существительное }=-10 // Продаются красивые щенки йоркширского терьера. wordforms_score кур { существительное }=-10 wordforms_score любый { прилагательное }=-10 // Для него любая власть является раздражителем. wordforms_score ванный { прилагательное }=-1 // большая ванная wordforms_score плавной { прилагательное }=-10 // Такая конструкция обеспечивает плавное перемещение wordforms_score санатория { существительное }=-10 wordforms_score шпалер { существительное }=-10 wordforms_score хромый { прилагательное }=-5 // Волшебный лепесток излечивает хромого мальчика. wordforms_score газа { существительное }=-1 // Раскаленные газы с чудовищной силой вырываются wordforms_score рейки { род:ср }=-10 // Многочисленные рейки стягивала стальная проволока. wordforms_score протяжной { прилагательное }=-5 // Каменные своды отозвались протяжным эхом. wordforms_score страстной { прилагательное }=-2 // Страстная любовь вызывает страстную борьбу. wordforms_score дневный { прилагательное }=-2 // Дневная суета сменилась полной тишиной. wordforms_score хромый { прилагательное }=-2 // Гони эту свору хромого горбуна! wordforms_score восковой { прилагательное }=-5 // Восковые свечи разливали мягкое сияние. wordforms_score угловый { прилагательное }=-5 // Угловая камера записала этот момент. wordforms_score пестрить { глагол }=-10 // Мировая пресса пестрит сенсационными сообщениями. wordforms_score чина { существительное }=-5 // Это требование поддержали высшие чины. wordforms_score языковый { прилагательное }=-5 wordforms_score половый { прилагательное }=-5 // Переполненный желудок затрудняет половой акт. wordforms_score шампанский { прилагательное }=-5 wordforms_score замок { глагол }=-10 // Замок небольшой и необычный. wordforms_score синоптика { существительное }=-5 // Русский сухогруз утопили турецкие синоптики. wordforms_score корректив { существительное род:муж }=-10 // Президентские выборы вносят определенные коррективы. wordforms_score поджога { существительное род:жен }=-10 // Умышленные поджоги стали доходным бизнесом. wordforms_score матерь { существительное }=-1 wordforms_score плюсовый { прилагательное }=-1 wordforms_score экой { прилагательное }=-1 // Экую несуразицу плетет этот мужик. wordforms_score овсяной { прилагательное }=-5 // Сморщенный чиновник жует овсяную лепешку. wordforms_score хмельный { прилагательное }=-1 // Остался ровный шелест хмельных кипарисов. wordforms_score спазма { существительное }=-10 // Пустой желудок разрывали болезненные спазмы. wordforms_score мазка { существительное }=-10 // Замельтешили нервные мазки ярких красок... wordforms_score громовый { прилагательное }=-5 // Эти вспышки сопровождались громовыми ударами. wordforms_score зарев { существительное }=-10 // Длинные пальцы налились красноватым заревом. wordforms_score шара { существительное }=-5 // Латунные шары заполнялись керосиновой смесью. wordforms_score корн { существительное }=-5 // в корне мандрагоры содержится наркотический сок wordforms_score справа { существительное }=-10 // Справа Дэни разглядела маленькое каменное святилище. wordforms_score теля { существительное }=-5 // Было чувство клаустрофобии в собственном теле. wordforms_score коленной { прилагательное }=-5 // 26-летний футболист получил растяжение коленного сустава. wordforms_score полом { существительное }=-5 // Бойцы рыли под полом окопы. wordforms_score бород { существительное }=-5 // Елена просит молодого мужа сбрить бороду. wordform_score присутствия { число:мн }=-5 // // Ей стало не хватать его присутствия. wordform_score косы { род:муж число:мн }=-10 // Ее косы были убраны под шапку. wordform_score обожания { число:мн }=-10 // Изливают любвеобильные лучи обожания wordform_score смелости { число:мн }=-10 // Ей просто недоставало смелости его сделать. wordform_score ясности { число:мн }=-10 // Черные ящики не добавили ясности. wordform_score с { частица }=-2 // // Загадали желания – ждем-с! wordform_score "ей-богу"{} = 10 // Ей-богу, отлично выйдет. wordform_score дыхания { число:мн }=-2 // Ее подключили к аппарату искусственного дыхания. wordform_score реставрации { число:мн }=-2 // Ее не ремонтировали со времен Реставрации. wordform_score бересты { число:мн }=-10 // Сверху настелили большие куски бересты. wordform_score охоты { число:мн }=-10 // Сезон охоты откроют 25 августа. wordform_score развития { существительное число:мн }=-10 // В Чувашии обсуждают проблемы инновационного развития регионов wordform_score наглости { существительное число:мн }=-10 // противопоставить наглости wordform_score еды { существительное число:мн }=-5 // хозяин должен дать еды wordform_score безопасности { существительное число:мн }=-5 // Его обвинили в пренебрежении вопросами безопасности. wordform_score выдержки { существительное число:мн }=-5 // Если хватит выдержки... wordform_score истерик { существительное }=-2 // И хватит истерик! wordform_score послезавтра { существительное }=-5 // Послезавтра утром проверю... wordform_score дискриминации { число:мн }=-5 // Его называли анахронизмом и признаком дискриминации. wordform_score полиции { число:мн }=-5 // Его доставили в 20-й отдел полиции. wordform_score уверенности { число:мн }=-10 // Его немое обожание придавало Анне уверенности. wordform_score насилия { число:мн }=-5 // А насилия Рекс никогда не совершит. wordform_score болтовни { число:мн }=-10 // А теперь хватит болтовни, Кейн. wordform_score оружия { число:мн }=-10 // А Филип вообще не любит оружия. wordform_score внимания { число:мн }=-10 // А на брата не обращай внимания. wordform_score бытия { число:мн }=-10 // Имеют телесную форму предшествовавшего бытия. wordform_score сочувствия { число:мн }=-5 // А вот Мария действительно заслуживает сочувствия. wordform_score разнообразия { число:мн }=-5 // Болото хотело разнообразия в компании. wordform_score ним { существительное }=-5 // А вместе с ним и свою душу. wordform_score ник { глагол }=-5 // А ты как думаешь, Ник? wordform_score тете { одуш:неодуш }=-1 // А перед этим послал тете цветы. wordform_score гораздо { прилагательное }=-5 // А кажется, что гораздо больше. wordform_score Калифорнии { число:мн }=-10 // А в Калифорнии сейчас цветет мимоза. wordform_score замок { глагол }=-10 // А на краю леса красивый замок. wordform_score мирке { род:жен }=-5 // В их мирке вдруг оказался третий. wordform_score жалости { число:мн }=-5 // В этом деле не знают жалости. wordform_score орала { существительное }=-5 // Я била подушки и орала в ярости. wordform_score яркости { число:мн }=-2 // Второй цвет добавляет яркости и выразительности. wordform_score выразительности { число:мн }=-10 // Второй цвет добавляет яркости и выразительности. wordform_score македонии { число:мн }=-10 // Встретились главы МИД России и Македонии. wordform_score бочками { род:муж }=-5 // Грузить апельсины бочками? wordform_score полдня { существительное }=-5 // Полдня шел дождь. wordform_score пол { падеж:род }=-5 // Меряю шагами пол. wordform_score правей { глагол }=-10 // Еще чуть правей... wordform_score чуточку { существительное }=-10 // Самолет чуточку подбросило. wordform_score правосудья { число:мн }=-10 // Жид хочет правосудья wordform_score единства { число:мн }=-10 // Партия хочет единства. wordform_score счастья { число:мн }=-10 // Все хотят счастья. wordform_score агрессии { число:мн }=-10 // Фашизм хочет агрессии?.. wordform_score горючки { число:мн }=-10 // Не хватило горючки. wordform_score усмирения { число:мн }=-10 // Потребовать усмирения Петрограда. wordform_score метель { глагол }=-15 // На улице метель. wordform_score ясней { глагол }=-10 // Куда уж ясней. wordform_score штурману { глагол }=-10 // Штурману тоже трудно. wordform_score целиком { существительное }=-10 // Скука съела целиком. wordform_score хмелю { глагол }=-10 wordform_score четкой { существительное }=-2 // Работа персонала была четкой wordform_score милую { глагол }=-10 wordform_score гордости { число:мн }=-10 // Есть другие предметы, достойные гордости. wordform_score тих { глагол }=-10 wordform_score инфраструктуры { число:мн }=-2 // РАЗРАБОТАЮТ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ЭЛЕКТРОННОЙ ИНФРАСТРУКТУРЫ. wordform_score ангелы { род:жен }=-5 wordform_score большие { СТЕПЕНЬ:СРАВН }=-10 // большие отели wordform_score больших { СТЕПЕНЬ:СРАВН }=-10 wordform_score большим { СТЕПЕНЬ:СРАВН }=-10 wordform_score большими { СТЕПЕНЬ:СРАВН }=-10 wordform_score физики { род:жен } =-5 // Волгоградские Физики совершили научную революцию. wordform_score хорошей { глагол }=-10 // хорошей душевой кабиной wordform_score стиле { существительное род:ср }=-2 // Продам свадебное платье в греческом стиле wordform_score молока { род:жен падеж:им }=-2 wordform_score Турции { число:мн }=-5 // В Турции муллы провозглашают священную войну. wordform_score гости { глагол }=-5 // В саду могут оказаться и гости. wordform_score администрации { число:мн }=-5 // Структуру администрации Краснодара изменят wordform_score горячим { глагол }=-5 wordform_score свежую { глагол }=-5 // свежую рыбу wordform_score голубой { существительное }=-10 // за дверью жил голубой лев wordform_score фанту { род:муж }=-5 wordform_score фанте { род:муж }=-5 wordform_score баню { ГЛАГОЛ }=-5 wordform_score бань { ГЛАГОЛ }=-5 wordform_score сласти { ГЛАГОЛ }=-10 wordform_score сыр { ПРИЛАГАТЕЛЬНОЕ }=-5 wordform_score сыра { ПРИЛАГАТЕЛЬНОЕ }=-5 wordform_score сыры { ПРИЛАГАТЕЛЬНОЕ }=-5 wordform_score альбом { ПАДЕЖ:ТВОР }=-5 // По запросу могу показать альбом. wordform_score хоре { падеж:предл одуш:одуш }=-5 // подпевать в церковном хоре wordform_score Европы { число:мн }=-5 // Ее считали прекраснейшей женщиной Европы. wordform_score свежую { глагол }=-6 // свежую форель wordform_score содействия { число:мн }=-5 wordform_score общества { число:мн }=-1 // Индивидуальную честность связали с прогрессивностью общества wordform_score подготовки { число:мн }=-5 // Процесс подготовки спутника к запуску уместили в короткий видеоролик wordform_score недвижимости { число:мн }=-10 // Тест: способны ли вы отличить рекламу недвижимости от рекламы презервативов? wordform_score родины { число:мн }=-2 // Кандидата «Родины» уличили в получении поддельного военного билета wordform_score защиты { число:мн }=-2 // Google просит защиты у Аркадия Дворковича wordform_score освобождения { число:мн }=-5 // В Болгарии отпраздновали годовщину освобождения от османского ига wordform_score веры { число:мн }=-5 // Папу Римского призвали отказаться от догмата своей непогрешимости в вопросах веры wordforms_score гнома { существительное }=-10 // Но гномы начали погоню wordform_score рада { существительное }=-2 wordform_score полон { существительное }=-10 // а этот полон ненависти wordform_score Марин { существительное }=-2 // Алла отпустила Марину wordforms_score снимка { существительное }=-5 wordforms_score ям { существительное }=-5 wordforms_score купа { существительное }=-5 // мы нашли в его купе wordforms_score половый { прилагательное }=-5 wordforms_score теста { существительное }=-5 // выявляться тестами wordforms_score гриба { существительное }=-5 // отравиться грибами wordforms_score босый { прилагательное }=-5 // ноги ее были босые wordforms_score арен { существительное }=-5 wordforms_score плат { существительное }=-5 wordforms_score теста { существительное род:жен }=-5 wordforms_score бара { существительное род:жен }=1 // праздновать в баре wordform_score погиб { существительное }=-5 wordforms_score хора { существительное }=-5 wordforms_score дворовой { прилагательное }=-5 wordforms_score сводной { прилагательное }=-5 wordforms_score шпор { существительное }=-5 wordform_score сдачи { число:мн }=-2 // Сдачи не надо. wordforms_score комара { существительное }=-5 wordforms_score бара { существительное }=-5 wordforms_score теста { существительное }=-5 wordforms_score венка { существительное }=-5 wordforms_score метода { существительное }=-5 wordforms_score мор { существительное }=-5 wordforms_score мора { существительное }=-5 // Море достаточно холодное wordform_score трое { существительное }=-5 // трое из мира людей wordform_score повезло { глагол }=-2 // - Не повезло тебе. wordforms_score распоряженье { существительное }=-5 // Полицейские стали ждать дальнейших распоряжений. wordforms_score варианта { существительное род:жен }=-10 // Для разных ситуаций есть предпочтительные варианты. wordforms_score лангуста { существительное }=-10 // В рыбном купила огромного сырокопченого лангуста. wordforms_score верховый { прилагательное }=-5 // Бывало, возьмут верховых лошадей и уедут в поле. wordforms_score об { существительное }=-10 wordforms_score слушанье { существительное }=-5 // Регламент проведения публичных слушаний утверждается постановлением городского парламента. wordforms_score леса { существительное }=-5 // В алтайских лесах истребили сибирского коконопряда, объедающего хвою wordforms_score рельса { существительное }=-1 // В основном были подорваны рельсы на второстепенных запасных путях. wordforms_score перекрытье { существительное }=-5 // Лишь в одной части здания перекрытия оказались бетонными. wordforms_score бракосочетанье { существительное }=-5 // Но в понедельник во Дворце бракосочетания был выходной. wordforms_score благополучье { существительное } =-5 // В полном благополучии путешественники достигли Вефиля. wordforms_score лет { род:муж }=-5 // Летом в этой бухте собиралась целая флотилия яхт. wordforms_score снов { существительное }=-10 wordforms_score така { существительное }=-5 // Сигнал бедствия от лыжницы так и не поступил. wordforms_score корпусный { прилагательное }=-5 // Снаряд выпустила наша батарея 5-го корпусного артиллерийского полка. wordforms_score окружный { прилагательное }=-5 // В Агинском округе началась внеочередная сессия окружной думы. wordforms_score входный { прилагательное }=-5 // Для делегатов напечатали специальные входные билеты. wordforms_score образной { прилагательное }=-5 // Образное выражение, однако, отражает реальную жизнь. wordforms_score окружный { прилагательное }=-5 // Финансирование осуществлялось из окружного бюджета. wordforms_score дверный { прилагательное }=-5 wordforms_score личной{ прилагательное }=-5 // - А ты пробовал концентрировать свои личные мысли? wordforms_score основный{ прилагательное }=-5 // Основные "боевые" мероприятия проходят в Самаре. wordforms_score мирной{ прилагательное }=-5 // Уже в мирное время миссии тачали хорошие сапоги; wordforms_score ЧЕСТНОЙ{ прилагательное }=-5 // Это было хорошее, честное, благородное желание. wordforms_score РОДНЫЙ{ прилагательное }=-5 // Израильские танкисты приняли меня как родного. wordforms_score назначенье{ существительное }=-5 // В администрации Алтайского края произошел ряд отставок и назначений wordforms_score кадра{ существительное }=-5 wordforms_score перекрытье{ существительное }=-5 // Лишь в одной части здания перекрытия оказались бетонными. wordforms_score увечье{ существительное }=-5 // Жертва аварии скончалась в больнице от полученных увечий. wordforms_score исключенье{ существительное }=-5 // Однако из этого правила существует несколько исключений. wordforms_score подкрепленье{ существительное }=-5 // При этом используется вероятностная схема подкреплений. wordforms_score нет{ существительное }=-5 // решение жениться или нет можешь принять только ты сам. wordforms_score признанье{ существительное }=-5 // wordforms_score втора{ существительное }=-5 wordforms_score настроенье{ существительное }=-5 // Но антироссийских настроений вы в Грузии не найдете. wordforms_score заседанье{ существительное }=-5 // Семеро акционеров не были допущены в зал заседаний. wordforms_score сбора{ существительное }=-5 // В ближайшее время Денис улетает на очередные сборы. wordforms_score предложенье{ существительное }=-5 // Вячеслав Евгеньевич готовит свой пакет предложений. wordforms_score свитка{ существительное }=-5 // В кумранских свитках нередко встречается тайнопись wordforms_score носка{ существительное }=-5 // Из-под подола выглядывали белые спортивные носки. wordforms_score дыханье{ существительное }=-5 // При виде обнажившихся грудей перехватило дыхание. wordforms_score усилье{ существительное }=-5 // Бесконечная борьба требовала беспрестанных усилий. wordforms_score помещенье{ существительное }=-5 // Для обработки помещений ядами привлекают бомжей. wordforms_score до{ существительное }=-5 // Санкционированная акция прошла с 16 до 17 часов. wordforms_score ПАРКА{ существительное }=-5 // Королевские парки занимали обширную территорию. wordforms_score НИМ{ существительное }=-5 // Василий, не отрываясь, следит за ним взглядом. wordforms_score СТОЛА{ существительное }=-5 // На столе могут вырастать лужайки зеленой пищи. wordforms_score низка { существительное }=-5 wordforms_score мешка{ существительное }=-5 // Мешки с углем один за другим полетели в темную воду. wordforms_score стен { существительное }=-5 // По стенам развеваются блестящие знамена света. wordforms_score ряда { существительное }=-5 wordforms_score так { существительное }=-5 wordforms_score снова { существительное }=-5 wordforms_score лагер { существительное }=-5 wordforms_score гор { существительное }=-5 wordforms_score карт { существительное }=-5 // Военные топографы и геодезисты сверяют карты. wordforms_score зала { существительное }=-5 wordforms_score зало { существительное }=-5 wordforms_score миро { существительное }=-5 // В макротеле Мира отпечатывается мировая душа. wordforms_score мира { существительное }=-5 wordforms_score облак { существительное }=-5 // По ночным облакам зарумянилось дымное зарево. wordforms_score троп { существительное }=-5 // По берегу идут нерегулярные туристские тропы. wordforms_score пещер { существительное }=-5 wordforms_score ко{ существительное }=-10 // Разумеется, ко мне он больше не показывался. wordforms_score суда{ существительное }=-5 // В ближайшее время начнется его рассмотрение в суде. wordform_score "то и дело" { наречие }=5 // Во всяком случае, не придется то и дело нагибаться. wordform_score "воды" { число:мн } =-1 // они дали ему воды wordform_score "лицо" { одуш:одуш } =-1 wordform_score "лица" { одуш:одуш } =-1 // Ему даже делают специальный массаж лица. wordform_score "лицу" { одуш:одуш } =-1 wordform_score "лице" { одуш:одуш } =-1 wordform_score "лицом" { одуш:одуш } =-1 wordform_score "замок" { глагол } =-5 // замок на горе wordform_score "самогонки" { число:мн } = -1 // Пришлось добавить самогонки. wordform_score "интуиции" { число:мн } = -1 // Больше доверяют интуиции. wordform_score "воды" { число:мн } = -1 // Джек добавил воды. wordform_score "во" { вводное } = -2 // В детях эта программа усиливается во много раз. wordform_score "на" { глагол } =-1 // В эфир выходили на несколько секунд. wordform_score "веселей" { глагол } = -8 // В колонне веселей. wordform_score "гранит" { глагол } = -3 // Почем гранит науки? wordform_score "катя" { деепричастие } = -2 // Катя, давай! wordform_score "прочь" { глагол } = -5 // пойти прочь wordform_score "сволочь" { глагол } = -5 // - Сволочь! wordform_score "юля" { деепричастие } = -2 // Юля, уважь человека. wordform_score "катя" { деепричастие } = -2 // я направляюсь сюда, Катя. wordform_score "женя" { деепричастие } = -2 // Я больше не буду, Женя. wordform_score "нашей" { глагол } = -3 // - А вот и первые плоды нашей работы! wordform_score "Камчатки" { число:мн } = -2 // К аварийной подстанции в столице Камчатки подключают новый трансформатор wordform_score "воротам" { род:муж } = -2 // Беседуя, они подошли к воротам. wordform_score "один" { существительное } = -5 // Значит, он не один. wordform_score "то-то" { частица } = 2 // То-то выслуживается, вас гоняет. wordform_score "погреб" { глагол } =-2 // А вот погреб... wordform_score "просим" { прилагательное } = -5 // Просим всей группой. wordform_score "крови" { число:мн } = -5 // Скорее разойдитесь, не проливая крови! wordform_score "скоро" { прилагательное } = -4 // Скоро в строй? wordform_score "подъем" { глагол } = -5 // Подъем, товарищ майор! wordform_score "порой" { глагол } = -5 // И порой не без успеха. wordform_score "порой" { существительное } = -1 // Они ворчат порой. wordform_score "погоды" { число:мн } = -3 // По случаю чудной погоды Алексея тоже вывозили кататься. wordform_score "дарим" { прилагательное} = -5 // - Решено, дарим один ящик командиру полка! wordform_score "хватит" { глагол } = -1 // - На одну атаку хватит. wordform_score "как ни в чем не бывало" { наречие } = 1 // Ординарец в сенях спал как ни в чем не бывало. wordform_score "разве что" { наречие } = 1 // Так жарко бывает разве что перед грозой. wordform_score "потому что" { союз } =5 // - Потому что мне так нравится. wordform_score "на поводу у"{ предлог} = 1 // Нельзя идти на поводу у таких состояний wordform_score "что" { наречие } = -8 wordform_score "так что" { наречие } = -5 // Ну, так что вы скажете? wordform_score "вот" { наречие } = -3 wordform_score "Иду" { существительное } = -3 // - Иду к тебе! wordform_score "хотите" { НАКЛОНЕНИЕ:ПОБУД } = -5 wordform_score "всего" { наречие } = -4 // Он всего боялся wordform_score "всего лишь" { наречие } = 2 wordform_score "еле-еле" { наречие } = 2 wordform_score "туда-сюда" { наречие } = 2 wordform_score "туда-то" { наречие } = 2 wordform_score "отчего-то" { наречие } = 2 wordform_score "когда-то" { наречие } = 2 wordform_score "чуть-чуть" { наречие } = 2 wordform_score "так-то" { наречие } = 2 wordform_score "наконец-то" { наречие } = 2 wordform_score "туда-то" { наречие } = 2 wordform_score "тут-то" { наречие } = 2 wordform_score "Наконец-то" { наречие } = 2 wordform_score "добро" { наречие } = -4 // - Знаю я это добро. wordform_score "должно" { наречие } = -5 // Но так и должно быть. wordform_score "тем не менее" { наречие } = 1 wordform_score "прежде всего" { наречие } = 1 // Нужно прежде всего знать группу крови. wordform_score "выходит" { наречие } = -2 // это из тебя страх так выходит wordform_score "трибуны" { одуш:одуш } = -2 // Трибуны взрываются аплодисментами. wordform_score "по прошествии" { предлог } = 5 // По прошествии двух дней следствие не может установить их личности. wordform_score "сроком на" { предлог } = 2 // Аэропорт перешел в управление компании сроком на 30 лет. // Я ничего подобного не видал wordform_score "ничего" { наречие } = -5 // Не было таких прецедентов пока что. // ^^^^^^^^ wordform_score "пока что" { наречие } = 1 wordform_score "приводим" { прилагательное } = -5 // Приводим полный текст этого заявления. // Она поколебалась, прежде чем ответить. // ^^^^^^^^^^ wordform_score "прежде чем" { союз } = 1 wordform_score "а то" { союз } = 1 // А то тебе плохо станет. wordform_score "не то" { союз } = 1 // Вставай, не то опоздаем wordform_score "а не то" { союз } = 1 // Сядь, а не то упадешь // кости у всех одинаковые // ^^^^^ wordform_score "кости" { глагол } = -3 wordform_score "чести" { глагол } = -3 // Мы знаем друг друга много лет // ^^^^^^^^^^ wordform_score "друг друга" { существительное падеж:парт } = -1 // Текст речи премьер-министра // ^^^^^^^^^^^^^^^^ wordform_score "премьер-министр" { существительное } = 1 wordform_score "премьер-министра" { существительное } = 1 wordform_score "премьер-министром" { существительное } = 1 wordform_score "премьер-министру" { существительное } = 1 wordform_score "премьер-министре" { существительное } = 1 wordform_score "премьер-министры" { существительное } = 1 wordform_score "премьер-министров" { существительное } = 1 wordform_score "премьер-министрами" { существительное } = 1 wordform_score "премьер-министрам" { существительное } = 1 wordform_score "премьер-министрах" { существительное } = 1 // Хотим получить максимум информации // ^^^^^^^^^^ wordform_score "информации" { существительное число:мн } = -5 wordform_score "тому назад" { послелог } = 1 // Он просто вынужден закончить цикл историй, так как ограничены размеры книги. wordform_score "так как" { союз } = 5 // Поможем ему сена накосить // ^^^^ wordform_score "сена" { существительное число:мн } = -5 // Подавляем множественное число "ПУШОК": // "Мы видели их пушки" wordform_score "пушки" { существительное род:муж } = -5 wordform_score "это" { частица } = -2 // Кажется, вчера еще бродил я в этих рощах. wordform_score "кажется" { наречие } = -2 wordform_score "лицом к лицу" { наречие } = 5 // из конюшни они возвращались бок о бок. wordform_score "бок о бок" { наречие } = 2 // люди спят тем более. wordform_score "тем более" { наречие } = 2 wordform_score "в связи с" { предлог } = 1 // то есть могла бы wordform_score "то есть" { союз } = 3 // ПОКАДИТЬ(ПОКАЖУ) // wordform_score "покажу" { глагол глагол:покадить{} } = -5 // ПРОПАСТЬ>ПРОПАЛИТЬ(ПРОПАЛИ) wordform_score "пропали" { глагол наклонение:побуд } = -5 // ПОПАСТЬ > ПОПАЛИТЬ wordform_score "попали" { глагол наклонение:побуд } = -5 // предпочитаем вариант безличного глагола: //wordform_score "оставалось" { глагол } = -2 //wordform_score "остается" { глагол } = -2 //wordform_score "останется" { глагол } = -2 //wordform_score "осталось" { глагол } = -2 wordform_score "стали" { существительное число:мн } = -5 wordform_score "стали" { существительное падеж:род } = -3 // Жаль, если принятые обязательства не выполняются // ^^^^ wordform_score "жаль" { глагол } = -3 wordform_score "давным-давно" { наречие } = 2 // Можно ли сейчас применять старые методы? wordform_score "методам" { существительное род:жен } = -5 wordform_score "методах" { существительное род:жен } = -5 wordform_score "методу" { существительное род:жен } = -5 wordform_score "методе" { существительное род:жен } = -5 wordform_score "метода" { существительное род:жен } = -5 wordform_score "методы" { существительное род:жен } = -5 // Не вижу необходимости // ^^^^^^^^^^^^^ wordform_score "необходимости" { число:мн } = -1 wordform_score "о" { частица } = -2 wordform_score "Спешите" { наклонение:побуд } = -1 // отдадим преимущество безличной форме: // мне удалось поспать // ^^^^^^^ wordform_score "удалось" { глагол } = -3 // Придавим вариант "ПАР^ОК" // В парке был бассейн с золотыми рыбками. // ^^^^^ wordform_score "парке" { ПЕРЕЧИСЛИМОСТЬ:НЕТ } = -10 // слово БЫЛО редко выступает в роли наречия, но иногда бывает: // один из воинов пошел было к дверям // ^^^^ wordform_score "было" { наречие } = -10 // Это было примерно месяц назад wordform_score "примерно" { прилагательное } = -2 // чтобы подавить ВРЯД(ЛИ) wordform_score "вряд ли" { наречие } = 2 // при помощи женской страсти? // ^^^^^^^^^^ wordform_score "при помощи" { предлог } = 5 wordform_score "Владимиру" { существительное род:жен } = -2 wordform_score "Владимира" { существительное род:жен } = -2 wordform_score "Владимире" { существительное род:жен } = -2 // у тебя впереди серьезное дело wordform_score "дело" { глагол } = -5 wordform_score "правды" { существительное число:мн } = -2 // ты сволочь wordform_score "сволочь" { глагол } = -2 // во мне все же росло беспокойство wordform_score "росло" { прилагательное } = -1 // конкуренция между ЗАБРАТЬ.гл и ЗАБРАЛО.сущ wordform_score "забрала" { существительное } = -2 wordform_score "забрало" { существительное } = -2 wordform_score "забрал" { существительное } = -2 // обычно ЗАВТРА - наречие: // можно зайти за этим завтра? // ^^^^^^ wordform_score "завтра" { существительное } = -10 wordform_score "сегодня" { существительное } = -15 // взять деньги wordform_score "деньги" { существительное падеж:род } = -10 // Подавляем просторечный вариант "Сашок" // Сашка не знал wordform_score "Сашка" { существительное падеж:вин } = -1 wordform_score "Сашка" { существительное падеж:род } = -1 // обычно это - прилагательное wordform_score "простой" { глагол } = -1 // есть варианты ТУШЬ и ТУША (помимо глагола ТУШИТЬ). Вариант ТУШЬ гасим. wordform_score "тушь" { существительное одуш:неодуш } = -5 // обычно ПОЧТИ - это наречие // Почти совсем темно. // ^^^^^ wordform_score "почти" { глагол } = -5 // теперь самое время бросить кости wordform_score "кости" { глагол } = -5 wordform_score "брехло" { наречие } = -10 wordform_score "силой" { наречие } = -2 wordform_score "может" { вводное } = -1 // скорее доедай wordform_score "скорее" { вводное } = -1 wordform_score "пять" { глагол } = -5 wordform_score "спины" { существительное род:муж } = -1 wordform_score "спинах" { существительное род:муж } = -1 wordform_score "спине" { существительное род:муж } = -1 // хозяин дает корм псам wordform_score "корм" { существительное род:жен падеж:род } = -5 // несмотря на жару, солдаты носили шлемы и кирасы. wordform_score "несмотря на" { предлог } = 10 // В соответствии с шариатом, свинину употреблять запрещено // ^^^^^^^^^^^^^^^^ wordform_score "В соответствии с" { предлог } = 2 wordform_score "В соответствии со" { предлог } = 2 // В Дамаске в ходе ракетного обстрела погиб чиновник Евросоюза // ^^^^^^ wordform_score "в ходе" { предлог } = 2 // Мы пошли вместе по направлению к городу. // ^^^^^^^^^^^^^^^^ wordform_score "по направлению к" { предлог } = 2 wordform_score "по направлению ко" { предлог } = 2 // шеф просит еще раз проверить // wordform_score "еще раз" { наречие } = 10 // очень трудно найти задачу по силам wordform_score "по силам" { безлич_глагол } = -1 // есть все же средства // ^^^^^^ wordform_score "все же" { наречие } = 10 // все время находился в командировках // ^^^^^^^^^ //wordform_score "все время" { наречие } = 2 // Однако эти средства до сих пор не дошли до реального сектора экономики wordform_score "до сих пор" { наречие } = 10 // сбыться на самом деле wordform_score "на самом деле" { наречие } = 10 // Лошадь встала на дыбы. wordform_score "встать на дыбы" { инфинитив } = 2 wordform_score "встала на дыбы" { глагол } = 2 wordform_score "встал на дыбы" { глагол } = 2 wordform_score "встали на дыбы" { глагол } = 2 wordform_score "встанет на дыбы" { глагол } = 2 wordform_score "пузырь" { глагол } = -2 // выражение его лица было довольно странным wordform_score "довольно" { прилагательное } = -1 // они как будто пришли издалека // ^^^^^^^^^ wordform_score "как будто" { наречие } = 2 // Лошадь встала на дыбы. wordform_score "встать на дыбы" { глагол } = 2 // мой друг как всегда был прав // ^^^^^^^^^^ wordform_score "как всегда" { наречие } = 2 // без кольца все стало как обычно // ^^^^^^^^^^ wordform_score "как обычно" { наречие } = 2 // однако совершенно необходимо время от времени менять темп. // ^^^^^^^^^^^^^^^^ wordform_score "время от времени" { наречие } = 5 // все равно уже сорвал // ^^^^^^^^^ wordform_score "все равно" { наречие } = 10 // деревья полностью закрывают серое небо // ^^^^^^^^^ wordform_score "полностью" { существительное } = -100 // волосы обоих были все еще мокрые. // ^^^^^^^ wordform_score "все еще" { наречие } = 2 // всего один день. wordform_score "день" { глагол } = -1 // ты все это прекрасно знаешь // ^^^^^^^ wordform_score "все это" { местоим_сущ } = 1 // Андрюха хотел жить на отшибе // ^^^^^^^^^ wordform_score "на отшибе" { наречие } = 1 // ПОЙМА vs ПОНЯТЬ wordform_score "пойму" { существительное } = -1 // лучше всего сделать это сразу // ^^^^^^^^^^^ wordform_score "лучше всего" { безлич_глагол } = 1 wordform_score "нахожусь" { глагол вид:соверш } = -2 wordform_score "находимся" { глагол вид:соверш } = -2 wordform_score "находится" { глагол вид:соверш } = -2 wordform_score "находитесь" { глагол вид:соверш } = -2 wordform_score "находился" { глагол вид:соверш } = -2 wordform_score "находилась" { глагол вид:соверш } = -2 wordform_score "находилось" { глагол вид:соверш } = -2 wordform_score "находились" { глагол вид:соверш } = -2 wordform_score "находим" { прилагательное } = -5 // В Полинезии находим культ черепов вождей. wordform_score пошли { глагол время:прошедшее } = 1 // мы пошли домой wordform_score пошли { глагол наклонение:побуд } = -1 // не пошли! wordform_score спешить { инфинитив вид:несоверш } = 1 // спеш^ить (торопиться) wordform_score спешил { глагол вид:несоверш }=1 wordform_score спешила { глагол вид:несоверш }=1 wordform_score спешили { глагол вид:несоверш }=1 wordform_score спеши { глагол вид:несоверш }=1 wordform_score спешить { инфинитив вид:соверш } =-2 // сп^ешить (спустить с коня на землю) wordform_score спешил { глагол вид:соверш }=-2 wordform_score спешила { глагол вид:соверш }=-2 wordform_score спешили { глагол вид:соверш }=-2 wordform_score лето { существительное род:ср } = 1 wordform_score лёт { существительное род:муж } = -5 // Коля, давай-ка выпей молока wordform_score выпей { глагол } = 1 wordform_score выпей { существительное } = -2 wordform_score видно { наречие } = -3 //wordform_score видно { прилагательное } = 0 //wordform_score видно { вводное } = -1 //wordform_score времени { существительное } = 1 wordform_score времени { глагол } = -5 // О факторе времени. //wordform_score перед { предлог } = 1 wordform_score перед { существительное } = -2 wordform_score на { предлог } = 1 wordform_score на { частица } = -10 wordform_score жил { существительное } = -1 // жила wordform_score жил { глагол } = 1 // жить wordform_score любой { существительное } = -1 // Люба wordform_score жал { существительное } = -10 // жало wordform_score жал { глагол } = 1 // жать wordform_score велик { прилагательное } = -1 // великий wordform_score велика { существительное } = -10 wordform_score велика { прилагательное } = 1 // великий wordform_score велики { существительное } = -10 wordform_score велики { прилагательное } = 1 // великий wordform_score были { существительное } = -10 wordform_score были { глагол } = 1 wordform_score весь { существительное } = -10 wordform_score весь { глагол } = -10 wordform_score весь { прилагательное } = 1 wordform_score вещей { существительное } = 1 wordform_score вещей { прилагательное } = -1 wordform_score времени { глагол } = -10 wordform_score времени { существительное } = 1 //wordform_score все { местоим_сущ } = 1 //wordform_score все { прилагательное } = 1 wordform_score все { наречие } = -2 wordform_score все { частица } = -2 wordform_score всей { глагол } = -10 wordform_score всей { прилагательное } = 1 //wordform_score дали { глагол } = 1 wordform_score дали { существительное } = -1 //wordform_score смог { глагол } = 1 wordform_score смог { существительное } = -1 wordform_score действительно { прилагательное } = -10 wordform_score действительно { наречие } = 1 // wordform_score дел { существительное } = 1 // wordform_score дел { глагол } = 1 wordform_score дело { существительное } = 1 wordform_score дело { глагол } = -1 // wordform_score дела { существительное } = 1 // wordform_score дела { глагол } = 1 wordform_score день { существительное } = 1 wordform_score день { глагол } = -10 wordform_score для { предлог } = 1 wordform_score для { деепричастие } = -10 wordform_score какая { прилагательное } = 1 wordform_score какая { деепричастие } = -10 wordform_score конечно { прилагательное } = -1 wordform_score конечно { наречие } = 1 wordform_score мая { существительное одуш:неодуш } = 1 wordform_score мая { существительное одуш:одуш } = -1 wordform_score моря { существительное } = 1 wordform_score моря { деепричастие } = -10 wordform_score моя { прилагательное } = 1 wordform_score моя { деепричастие } = -10 wordform_score особой { прилагательное } = 1 wordform_score особой { существительное } = -1 wordform_score пора { существительное } = -1 wordform_score пора { безлич_глагол } = 1 wordform_score при { предлог } = 1 wordform_score при { глагол } = -10 wordform_score разрыв { существительное } = 1 wordform_score разрыв { деепричастие } = -1 wordform_score совести { существительное число:ед } = 1 wordform_score совести { существительное число:мн } = -5 wordform_score совести { глагол } = -2 wordform_score хвои { глагол } = -2 // Кубдя подбросил хвои. wordform_score споров { существительное } = 1 wordform_score споров { деепричастие } = -1 wordform_score стать { существительное } = -1 wordform_score стать { инфинитив } = 1 wordform_score такая { деепричастие } = -10 // такать wordform_score такая { прилагательное } = 1 wordform_score три { глагол } = -1 // тереть wordform_score три { числительное } = 1 wordform_score тут { существительное одуш:неодуш } = -10 // тут (тутовое дерево) wordform_score тут { наречие } = 1 wordform_score уж { частица } = 1 wordform_score уж { наречие } = 1 wordform_score уж { существительное } = -2 wordform_score уже { наречие степень:атриб } = 1 wordform_score уже { прилагательное } = -3 // узкий wordform_score уже { существительное } = -2 wordform_score уже { наречие степень:сравн } = -5 // узко wordform_score хотя { деепричастие } = -10 // хотеть wordform_score хотя { союз } = 1 // краткие формы среднего рода прилагательных используются очень редко, в отличие // от буквально совпадающих с ними наречий #define PreferAdverb(x) \ #begin //wordform_score x { наречие } = 2000000 wordform_score x { прилагательное } = -2 #end PreferAdverb( "абсолютно" ) PreferAdverb( "абстрактно" ) PreferAdverb( "абсурдно" ) PreferAdverb( "аварийно" ) PreferAdverb( "автоматично" ) PreferAdverb( "авторитарно" ) PreferAdverb( "авторитетно" ) PreferAdverb( "азартно" ) PreferAdverb( "аккуратно" ) PreferAdverb( "активно" ) PreferAdverb( "актуально" ) PreferAdverb( "алогично" ) PreferAdverb( "амбивалентно" ) PreferAdverb( "аномально" ) PreferAdverb( "анонимно" ) PreferAdverb( "аргументировано" ) PreferAdverb( "аристократично" ) PreferAdverb( "архиважно" ) PreferAdverb( "аскетично" ) PreferAdverb( "афористично" ) PreferAdverb( "капризно" ) PreferAdverb( "кардинально" ) PreferAdverb( "карикатурно" ) PreferAdverb( "категорично" ) PreferAdverb( "качественно" ) PreferAdverb( "классно" ) PreferAdverb( "комично" ) PreferAdverb( "комфортабельно" ) PreferAdverb( "комфортно" ) PreferAdverb( "конвульсивно" ) PreferAdverb( "конечно" ) PreferAdverb( "конкретно" ) PreferAdverb( "конструктивно" ) PreferAdverb( "контрастно" ) PreferAdverb( "концептуально" ) PreferAdverb( "корректно" ) PreferAdverb( "кратковременно" ) PreferAdverb( "крестообразно" ) PreferAdverb( "кристально" ) PreferAdverb( "круглосуточно" ) PreferAdverb( "курьезно" ) PreferAdverb( "кучно" ) PreferAdverb( "комплиментарно" ) PreferAdverb( "агрессивно" ) PreferAdverb( "адекватно" ) PreferAdverb( "алчно" ) PreferAdverb( "амбициозно" ) PreferAdverb( "аморально" ) PreferAdverb( "аналогично" ) PreferAdverb( "анекдотично" ) PreferAdverb( "апатично" ) PreferAdverb( "аполитично" ) PreferAdverb( "артистично" ) PreferAdverb( "асимметрично" ) PreferAdverb( "ассоциативно" ) PreferAdverb( "красно" ) PreferAdverb( "конфиденциально" ) PreferAdverb( "клятвенно" ) PreferAdverb( "краткосрочно" ) PreferAdverb( "круглогодично" ) PreferAdverb( "когерентно" ) PreferAdverb( "конъюнктурно" ) PreferAdverb( "конформно" ) PreferAdverb( "асинхронно" ) PreferAdverb( "аритмично" ) PreferAdverb( "альтруистично" ) PreferAdverb( "критично" ) PreferAdverb( "авантюрно" ) PreferAdverb( "автобиографично" ) PreferAdverb( "автономно" ) PreferAdverb( "аддитивно" ) PreferAdverb( "ажурно" ) PreferAdverb( "азбучно" ) PreferAdverb( "академично" ) PreferAdverb( "аллегорично" ) PreferAdverb( "альтернативно" ) PreferAdverb( "аморфно" ) PreferAdverb( "антагонистично" ) PreferAdverb( "антинаучно" ) PreferAdverb( "антиобщественно" ) PreferAdverb( "аппетитно" ) PreferAdverb( "ароматно" ) PreferAdverb( "архаично" ) PreferAdverb( "атипично" ) PreferAdverb( "аутентично" ) PreferAdverb( "каверзно" ) PreferAdverb( "капитально" ) PreferAdverb( "каплеобразно" ) PreferAdverb( "катастрофично" ) PreferAdverb( "келейно" ) PreferAdverb( "клешнеобразно" ) PreferAdverb( "клиновидно" ) PreferAdverb( "клинообразно" ) PreferAdverb( "коварно" ) PreferAdverb( "комедийно" ) PreferAdverb( "консервативно" ) PreferAdverb( "конституционно" ) PreferAdverb( "конусовидно" ) PreferAdverb( "конусообразно" ) PreferAdverb( "корыстно" ) PreferAdverb( "косвенно" ) PreferAdverb( "косноязычно" ) PreferAdverb( "кошмарно" ) PreferAdverb( "кощунственно" ) PreferAdverb( "красочно" ) PreferAdverb( "криводушно" ) PreferAdverb( "кровожадно" ) PreferAdverb( "крохотно" ) PreferAdverb( "крупно" ) PreferAdverb( "культурно" ) PreferAdverb( "куполообразно" ) PreferAdverb( "кустарно" ) PreferAdverb( "акцентировано" ) /*----------------------- select F1.name as word, Concat( '// ', C1.name, ':', E1.name, '{} и ', C2.name, ':', E2.name, '{}' ) from sg_entry E1, sg_entry E2, sg_form F1, sg_form F2, sg_class C1, sg_class C2 where E1.id_class!=E2.id_class and E1.name!='???' and F1.id_entry=E1.id and F2.id_entry=E2.id and F1.name=F2.name and C1.id=E1.id_class and C2.id=E2.id_class and E1.id<E2.id order by F1.name -------------------------*/ wordform_score "атакуем" { глагол } = 1 // ГЛАГОЛ:атаковать{} и ПРИЛАГАТЕЛЬНОЕ:атакуемый{} wordform_score "атакуем" { прилагательное } = -10 // ГЛАГОЛ:атаковать{} и ПРИЛАГАТЕЛЬНОЕ:атакуемый{} wordform_score "классифицируем" { глагол } = 1 // ГЛАГОЛ:классифицировать{} и ПРИЛАГАТЕЛЬНОЕ:классифицируемый{} wordform_score "классифицируем" { прилагательное } = -10 // ГЛАГОЛ:классифицировать{} и ПРИЛАГАТЕЛЬНОЕ:классифицируемый{} wordform_score "компенсируем" { глагол } = 1 // ГЛАГОЛ:компенсировать{} и ПРИЛАГАТЕЛЬНОЕ:компенсируемый{} wordform_score "компенсируем" { прилагательное } = -10 // ГЛАГОЛ:компенсировать{} и ПРИЛАГАТЕЛЬНОЕ:компенсируемый{} wordform_score "Коля" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:Коля{} и ДЕЕПРИЧАСТИЕ:коля{} wordform_score "Коля" { ДЕЕПРИЧАСТИЕ } = -10 // СУЩЕСТВИТЕЛЬНОЕ:Коля{} и ГЛАГОЛ:колоть{} wordform_score "Коли" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:Коля{} и СОЮЗ:коли{} wordform_score "Коли" { ГЛАГОЛ } = -2 // СУЩЕСТВИТЕЛЬНОЕ:Коля{} и ГЛАГОЛ:колоть{} wordform_score "Колю" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:Коля{} и ГЛАГОЛ:колоть{} wordform_score "Колю" { ГЛАГОЛ } = -2 // СУЩЕСТВИТЕЛЬНОЕ:Коля{} и ГЛАГОЛ:колоть{} wordform_score "Кати" { СУЩЕСТВИТЕЛЬНОЕ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:Катя{} и ГЛАГОЛ:катить{} wordform_score "Кати" { ГЛАГОЛ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:Катя{} и ГЛАГОЛ:катить{} wordform_score "куплю" { СУЩЕСТВИТЕЛЬНОЕ } = -1 // СУЩЕСТВИТЕЛЬНОЕ:купля{} и ГЛАГОЛ:купить{} wordform_score "куплю" { ГЛАГОЛ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:купля{} и ГЛАГОЛ:купить{} wordform_score "крали" { СУЩЕСТВИТЕЛЬНОЕ } = -1 // СУЩЕСТВИТЕЛЬНОЕ:краля{} и ГЛАГОЛ:красть{} wordform_score "крали" { ГЛАГОЛ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:краля{} и ГЛАГОЛ:красть{} wordform_score "крести" { СУЩЕСТВИТЕЛЬНОЕ } = -2 // СУЩЕСТВИТЕЛЬНОЕ:крести{} и ГЛАГОЛ:крестить{} wordform_score "крести" { ГЛАГОЛ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:крести{} и ГЛАГОЛ:крестить{} wordform_score "крыло" { СУЩЕСТВИТЕЛЬНОЕ } = 1000000 // СУЩЕСТВИТЕЛЬНОЕ:крыло{} и ГЛАГОЛ:крыть{} wordform_score "крыло" { ГЛАГОЛ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:крыло{} и ГЛАГОЛ:крыть{} wordform_score "крыла" { СУЩЕСТВИТЕЛЬНОЕ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:крыло{} и ГЛАГОЛ:крыть{} wordform_score "крыла" { ГЛАГОЛ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:крыло{} и ГЛАГОЛ:крыть{} wordform_score "крыло" { СУЩЕСТВИТЕЛЬНОЕ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:крыло{} и ГЛАГОЛ:крыть{} wordform_score "крыло" { ГЛАГОЛ } = -1 // СУЩЕСТВИТЕЛЬНОЕ:крыло{} и ГЛАГОЛ:крыть{} wordform_score "ком" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:ком{} и МЕСТОИМ_СУЩ:кто{} wordform_score "ком" { МЕСТОИМ_СУЩ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:ком{} и МЕСТОИМ_СУЩ:кто{} wordform_score "кому" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:ком{} и МЕСТОИМ_СУЩ:кто{} wordform_score "кому" { МЕСТОИМ_СУЩ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:ком{} и МЕСТОИМ_СУЩ:кто{} wordform_score "Костя" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:Костя{} и ДЕЕПРИЧАСТИЕ:костя{} wordform_score "Костя" { ДЕЕПРИЧАСТИЕ } = -10 // СУЩЕСТВИТЕЛЬНОЕ:Костя{} и ДЕЕПРИЧАСТИЕ:костя{} wordform_score "кувырком" { СУЩЕСТВИТЕЛЬНОЕ } = -10 // СУЩЕСТВИТЕЛЬНОЕ:кувырок{} и НАРЕЧИЕ:кувырком{} wordform_score "кувырком" { НАРЕЧИЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:кувырок{} и НАРЕЧИЕ:кувырком{} wordform_score "колея" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:колея{} и ДЕЕПРИЧАСТИЕ:колея{} wordform_score "колея" { ДЕЕПРИЧАСТИЕ } = -10 // СУЩЕСТВИТЕЛЬНОЕ:колея{} и ДЕЕПРИЧАСТИЕ:колея{} wordform_score "качком" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:качок{} и ПРИЛАГАТЕЛЬНОЕ:качкий{} wordform_score "качком" { ПРИЛАГАТЕЛЬНОЕ } = -10 // СУЩЕСТВИТЕЛЬНОЕ:качок{} и ПРИЛАГАТЕЛЬНОЕ:качкий{} wordform_score "канал" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:канал{} и ГЛАГОЛ:канать{} wordform_score "канал" { ГЛАГОЛ } = -2 // СУЩЕСТВИТЕЛЬНОЕ:канал{} и ГЛАГОЛ:канать{} wordform_score "канала" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:канал{} и ГЛАГОЛ:канать{} wordform_score "канала" { ГЛАГОЛ } = -2 // СУЩЕСТВИТЕЛЬНОЕ:канал{} и ГЛАГОЛ:канать{} wordform_score "автостопом" { СУЩЕСТВИТЕЛЬНОЕ } = -1 // СУЩЕСТВИТЕЛЬНОЕ:автостоп{} и НАРЕЧИЕ:автостопом{} wordform_score "автостопом" { НАРЕЧИЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:автостоп{} и НАРЕЧИЕ:автостопом{} wordform_score "Ковровом" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:Ковров{} и ПРИЛАГАТЕЛЬНОЕ:ковровый{} wordform_score "Ковровом" { ПРИЛАГАТЕЛЬНОЕ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:Ковров{} и ПРИЛАГАТЕЛЬНОЕ:ковровый{} wordform_score "кладу" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:клад{} и ГЛАГОЛ:класть{} wordform_score "кладу" { ГЛАГОЛ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:клад{} и ГЛАГОЛ:класть{} wordform_score "клей" { СУЩЕСТВИТЕЛЬНОЕ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:клей{} и ГЛАГОЛ:клеить{} wordform_score "клей" { ГЛАГОЛ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:клей{} и ГЛАГОЛ:клеить{} wordform_score "клея" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:клей{} и ДЕЕПРИЧАСТИЕ:клея{} wordform_score "клея" { ДЕЕПРИЧАСТИЕ } = -2 // СУЩЕСТВИТЕЛЬНОЕ:клей{} и ДЕЕПРИЧАСТИЕ:клея{} wordform_score "кубарем" { СУЩЕСТВИТЕЛЬНОЕ } = -10 // СУЩЕСТВИТЕЛЬНОЕ:кубарь{} и НАРЕЧИЕ:кубарем{} wordform_score "кубарем" { НАРЕЧИЕ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:кубарь{} и НАРЕЧИЕ:кубарем{} wordform_score "калачиком" { СУЩЕСТВИТЕЛЬНОЕ } = -1 // СУЩЕСТВИТЕЛЬНОЕ:калачик{} и НАРЕЧИЕ:калачиком{} wordform_score "калачиком" { НАРЕЧИЕ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:калачик{} и НАРЕЧИЕ:калачиком{} wordform_score "ковали" { СУЩЕСТВИТЕЛЬНОЕ } = -10 // СУЩЕСТВИТЕЛЬНОЕ:коваль{} и ГЛАГОЛ:ковать{} wordform_score "ковали" { ГЛАГОЛ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:коваль{} и ГЛАГОЛ:ковать{} wordform_score "Алле" { СУЩЕСТВИТЕЛЬНОЕ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:Алла{} и ЧАСТИЦА:алле{} wordform_score "Алле" { ЧАСТИЦА } = 1 // СУЩЕСТВИТЕЛЬНОЕ:Алла{} и ЧАСТИЦА:алле{} wordform_score "кому" { СУЩЕСТВИТЕЛЬНОЕ } = -1 // СУЩЕСТВИТЕЛЬНОЕ:кома{} и МЕСТОИМ_СУЩ:кто{} wordform_score "кому" { МЕСТОИМ_СУЩ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:кома{} и МЕСТОИМ_СУЩ:кто{} wordform_score "кисла" { ПРИЛАГАТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:кислый{} и ГЛАГОЛ:киснуть{} wordform_score "кисла" { ГЛАГОЛ } = 2 // ПРИЛАГАТЕЛЬНОЕ:кислый{} и ГЛАГОЛ:киснуть{} wordform_score "кисло" { наречие } = 2 wordform_score "кисло" { ПРИЛАГАТЕЛЬНОЕ } = -2 // ПРИЛАГАТЕЛЬНОЕ:кислый{} и ГЛАГОЛ:киснуть{} wordform_score "кисло" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:кислый{} и ГЛАГОЛ:киснуть{} wordform_score "конвертируем" { ПРИЛАГАТЕЛЬНОЕ } = -1 // ПРИЛАГАТЕЛЬНОЕ:конвертируемый{} и ГЛАГОЛ:конвертировать{} wordform_score "конвертируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:конвертируемый{} и ГЛАГОЛ:конвертировать{} wordform_score "клади" { СУЩЕСТВИТЕЛЬНОЕ } = -2 // СУЩЕСТВИТЕЛЬНОЕ:кладь{} и ГЛАГОЛ:класть{} wordform_score "клади" { ГЛАГОЛ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:кладь{} и ГЛАГОЛ:класть{} wordform_score "копи" { СУЩЕСТВИТЕЛЬНОЕ } = -1 // СУЩЕСТВИТЕЛЬНОЕ:копь{} и ГЛАГОЛ:копить{} wordform_score "копи" { ГЛАГОЛ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:копь{} и ГЛАГОЛ:копить{} wordform_score "крепи" { СУЩЕСТВИТЕЛЬНОЕ } = -1 // СУЩЕСТВИТЕЛЬНОЕ:крепь{} и ГЛАГОЛ:крепить{} wordform_score "крепи" { ГЛАГОЛ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:крепь{} и ГЛАГОЛ:крепить{} wordform_score "крошку" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:крошка{} и НАРЕЧИЕ:крошку{} wordform_score "крошку" { НАРЕЧИЕ } = -10 // СУЩЕСТВИТЕЛЬНОЕ:крошка{} и НАРЕЧИЕ:крошку{} wordform_score "качкой" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:качка{} и ПРИЛАГАТЕЛЬНОЕ:качкий{} wordform_score "качкой" { ПРИЛАГАТЕЛЬНОЕ } = -10 // СУЩЕСТВИТЕЛЬНОЕ:качка{} и ПРИЛАГАТЕЛЬНОЕ:качкий{} wordform_score "какой" { СУЩЕСТВИТЕЛЬНОЕ } = -10 // СУЩЕСТВИТЕЛЬНОЕ:кака{} и ПРИЛАГАТЕЛЬНОЕ:какой{} //wordform_score "какой" { ПРИЛАГАТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:кака{} и ПРИЛАГАТЕЛЬНОЕ:какой{} wordform_score "какою" { СУЩЕСТВИТЕЛЬНОЕ } = -10 // СУЩЕСТВИТЕЛЬНОЕ:кака{} и ПРИЛАГАТЕЛЬНОЕ:какой{} wordform_score "какою" { ПРИЛАГАТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:кака{} и ПРИЛАГАТЕЛЬНОЕ:какой{} // СУЩЕСТВИТЕЛЬНОЕ:кака{} и СОЮЗ:как{} wordform_score "как" { СОЮЗ } = 3 wordform_score "как" { НАРЕЧИЕ } = 2 wordform_score "как" { ЧАСТИЦА } = 1 wordform_score "как" { СУЩЕСТВИТЕЛЬНОЕ } = -10 wordform_score "ковка" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:ковка{} и ПРИЛАГАТЕЛЬНОЕ:ковкий{} wordform_score "ковка" { ПРИЛАГАТЕЛЬНОЕ } = -1 // СУЩЕСТВИТЕЛЬНОЕ:ковка{} и ПРИЛАГАТЕЛЬНОЕ:ковкий{} wordform_score "кучу" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:куча{} и ГЛАГОЛ:кутить{} wordform_score "кучу" { ГЛАГОЛ } = -10 // СУЩЕСТВИТЕЛЬНОЕ:куча{} и ГЛАГОЛ:кутить{} wordform_score "кручу" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:круча{} и ГЛАГОЛ:крутить{} wordform_score "кручу" { ГЛАГОЛ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:круча{} и ГЛАГОЛ:крутить{} wordform_score "круче" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:круча{} и НАРЕЧИЕ:круто{} wordform_score "круче" { НАРЕЧИЕ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:круча{} и НАРЕЧИЕ:круто{} wordform_score "круче" { ПРИЛАГАТЕЛЬНОЕ } = 2 // СУЩЕСТВИТЕЛЬНОЕ:круча{} и ПРИЛАГАТЕЛЬНОЕ:крутой{} wordform_score "как" { СОЮЗ } = 3 // НАРЕЧИЕ:как{} и СУЩЕСТВИТЕЛЬНОЕ:кака{} wordform_score "как" { НАРЕЧИЕ } = 2 // НАРЕЧИЕ:как{} и СУЩЕСТВИТЕЛЬНОЕ:кака{} wordform_score "как" { ЧАСТИЦА } = 0 // НАРЕЧИЕ:как{} и СОЮЗ:как{} wordform_score "как" { СУЩЕСТВИТЕЛЬНОЕ } = -10 // НАРЕЧИЕ:как{} и ЧАСТИЦА:как{} wordform_score "кругом" { НАРЕЧИЕ } = 2 // НАРЕЧИЕ:кругом{} и СУЩЕСТВИТЕЛЬНОЕ:круг{} wordform_score "кругом" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // НАРЕЧИЕ:кругом{} и СУЩЕСТВИТЕЛЬНОЕ:круг{} wordform_score "кувырком" { НАРЕЧИЕ } = 2 // НАРЕЧИЕ:кувырком{} и СУЩЕСТВИТЕЛЬНОЕ:кувырок{} wordform_score "кувырком" { СУЩЕСТВИТЕЛЬНОЕ } = -10 // НАРЕЧИЕ:кувырком{} и СУЩЕСТВИТЕЛЬНОЕ:кувырок{} wordform_score "каплю" { НАРЕЧИЕ } = -10 // НАРЕЧИЕ:каплю{} и СУЩЕСТВИТЕЛЬНОЕ:капля{} wordform_score "каплю" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // НАРЕЧИЕ:каплю{} и СУЩЕСТВИТЕЛЬНОЕ:капля{} wordform_score "крошечку" { НАРЕЧИЕ } = -10 // НАРЕЧИЕ:крошечку{} и СУЩЕСТВИТЕЛЬНОЕ:крошечка{} wordform_score "крошечку" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // НАРЕЧИЕ:крошечку{} и СУЩЕСТВИТЕЛЬНОЕ:крошечка{} wordform_score "крошку" { НАРЕЧИЕ } = -10 // НАРЕЧИЕ:крошку{} и СУЩЕСТВИТЕЛЬНОЕ:крошка{} wordform_score "крошку" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // НАРЕЧИЕ:крошку{} и СУЩЕСТВИТЕЛЬНОЕ:крошка{} wordform_score "кубарем" { НАРЕЧИЕ } = 1 // НАРЕЧИЕ:кубарем{} и СУЩЕСТВИТЕЛЬНОЕ:кубарь{} wordform_score "кубарем" { СУЩЕСТВИТЕЛЬНОЕ } = -10 // НАРЕЧИЕ:кубарем{} и СУЩЕСТВИТЕЛЬНОЕ:кубарь{} wordform_score "кипуче" { НАРЕЧИЕ } = 1 // НАРЕЧИЕ:кипуче{} и ПРИЛАГАТЕЛЬНОЕ:кипучий{} wordform_score "кипуче" { ПРИЛАГАТЕЛЬНОЕ } = -1 // НАРЕЧИЕ:кипуче{} и ПРИЛАГАТЕЛЬНОЕ:кипучий{} wordform_score "куце" { НАРЕЧИЕ } = 1 // НАРЕЧИЕ:куце{} и ПРИЛАГАТЕЛЬНОЕ:куцый{} wordform_score "куце" { ПРИЛАГАТЕЛЬНОЕ } = -1 // НАРЕЧИЕ:куце{} и ПРИЛАГАТЕЛЬНОЕ:куцый{} wordform_score "антенной" { ПРИЛАГАТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:антенный{} и СУЩЕСТВИТЕЛЬНОЕ:антенна{} wordform_score "антенной" { СУЩЕСТВИТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:антенный{} и СУЩЕСТВИТЕЛЬНОЕ:антенна{} wordform_score "анализируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:анализируемый{} и ГЛАГОЛ:анализировать{} wordform_score "анализируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:анализируемый{} и ГЛАГОЛ:анализировать{} wordform_score "ассоциируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:ассоциируемый{} и ГЛАГОЛ:ассоциировать{} wordform_score "ассоциируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:ассоциируемый{} и ГЛАГОЛ:ассоциировать{} wordform_score "культивируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:культивируемый{} и ГЛАГОЛ:культивировать{} wordform_score "контролируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:контролируемый{} и ГЛАГОЛ:контролировать{} wordform_score "автоматизируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:автоматизируемый{} и ГЛАГОЛ:автоматизировать{} wordform_score "автоматизируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:автоматизируемый{} и ГЛАГОЛ:автоматизировать{} wordform_score "адаптируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:адаптируемый{} и ГЛАГОЛ:адаптировать{} wordform_score "адаптируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:адаптируемый{} и ГЛАГОЛ:адаптировать{} wordform_score "адресуем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:адресуемый{} и ГЛАГОЛ:адресовать{} wordform_score "адресуем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:адресуемый{} и ГЛАГОЛ:адресовать{} wordform_score "аккумулируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:аккумулируемый{} и ГЛАГОЛ:аккумулировать{} wordform_score "аккумулируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:аккумулируемый{} и ГЛАГОЛ:аккумулировать{} wordform_score "акцептуем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:акцептуемый{} и ГЛАГОЛ:акцептовать{} wordform_score "акцептуем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:акцептуемый{} и ГЛАГОЛ:акцептовать{} wordform_score "акционируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:акционируемый{} и ГЛАГОЛ:акционировать{} wordform_score "акционируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:акционируемый{} и ГЛАГОЛ:акционировать{} wordform_score "амортизируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:амортизируемый{} и ГЛАГОЛ:амортизировать{} wordform_score "амортизируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:амортизируемый{} и ГЛАГОЛ:амортизировать{} wordform_score "арендуем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:арендуемый{} и ГЛАГОЛ:арендовать{} wordform_score "арендуем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:арендуемый{} и ГЛАГОЛ:арендовать{} wordform_score "афишируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:афишируемый{} и ГЛАГОЛ:афишировать{} wordform_score "афишируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:афишируемый{} и ГЛАГОЛ:афишировать{} wordform_score "капитализируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:капитализируемый{} и ГЛАГОЛ:капитализировать{} wordform_score "капитализируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:капитализируемый{} и ГЛАГОЛ:капитализировать{} wordform_score "классифицируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:классифицируемый{} и ГЛАГОЛ:классифицировать{} wordform_score "классифицируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:классифицируемый{} и ГЛАГОЛ:классифицировать{} wordform_score "классифицируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:классифицируемый{} и ГЛАГОЛ:классифицировать{} wordform_score "классифицируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:классифицируемый{} и ГЛАГОЛ:классифицировать{} wordform_score "комментируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:комментируемый{} и ГЛАГОЛ:комментировать{} wordform_score "комментируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:комментируемый{} и ГЛАГОЛ:комментировать{} wordform_score "коммутируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:коммутируемый{} и ГЛАГОЛ:коммутировать{} wordform_score "коммутируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:коммутируемый{} и ГЛАГОЛ:коммутировать{} wordform_score "конвоируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:конвоируемый{} и ГЛАГОЛ:конвоировать{} wordform_score "конвоируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:конвоируемый{} и ГЛАГОЛ:конвоировать{} wordform_score "координируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:координируемый{} и ГЛАГОЛ:координировать{} wordform_score "координируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:координируемый{} и ГЛАГОЛ:координировать{} wordform_score "котируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:котируемый{} и ГЛАГОЛ:котировать{} wordform_score "котируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:котируемый{} и ГЛАГОЛ:котировать{} wordform_score "кредитуем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:кредитуемый{} и ГЛАГОЛ:кредитовать{} wordform_score "кредитуем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:кредитуемый{} и ГЛАГОЛ:кредитовать{} wordform_score "критикуем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:критикуемый{} и ГЛАГОЛ:критиковать{} wordform_score "критикуем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:критикуемый{} и ГЛАГОЛ:критиковать{} wordform_score "курируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:курируемый{} и ГЛАГОЛ:курировать{} wordform_score "курируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:курируемый{} и ГЛАГОЛ:курировать{} wordform_score "корректируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:корректируемый{} и ГЛАГОЛ:корректировать{} wordform_score "корректируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:корректируемый{} и ГЛАГОЛ:корректировать{} wordform_score "ковровом" { ПРИЛАГАТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:ковровый{} и СУЩЕСТВИТЕЛЬНОЕ:Ковров{} wordform_score "ковровом" { СУЩЕСТВИТЕЛЬНОЕ } = -1 // ПРИЛАГАТЕЛЬНОЕ:ковровый{} и СУЩЕСТВИТЕЛЬНОЕ:Ковров{} wordform_score "кочевым" { ПРИЛАГАТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:кочевой{} и СУЩЕСТВИТЕЛЬНОЕ:Кочево{} wordform_score "кочевым" { СУЩЕСТВИТЕЛЬНОЕ } = -10 // ПРИЛАГАТЕЛЬНОЕ:кочевой{} и СУЩЕСТВИТЕЛЬНОЕ:Кочево{} wordform_score "атакуем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:атакуемый{} и ГЛАГОЛ:атаковать{} wordform_score "атакуем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:атакуемый{} и ГЛАГОЛ:атаковать{} wordform_score "казним" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:казнимый{} и ГЛАГОЛ:казнить{} wordform_score "казним" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:казнимый{} и ГЛАГОЛ:казнить{} wordform_score "качаем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:качаемый{} и ГЛАГОЛ:качать{} wordform_score "качаем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:качаемый{} и ГЛАГОЛ:качать{} wordform_score "кусаем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:кусаемый{} и ГЛАГОЛ:кусать{} wordform_score "кусаем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:кусаемый{} и ГЛАГОЛ:кусать{} wordform_score "компенсируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:компенсируемый{} и ГЛАГОЛ:компенсировать{} wordform_score "компенсируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:компенсируемый{} и ГЛАГОЛ:компенсировать{} wordform_score "караем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:караемый{} и ГЛАГОЛ:карать{} wordform_score "караем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:караемый{} и ГЛАГОЛ:карать{} wordform_score "командируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:командируемый{} и ГЛАГОЛ:командировать{} wordform_score "командируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:командируемый{} и ГЛАГОЛ:командировать{} wordform_score "конструируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:конструируемый{} и ГЛАГОЛ:конструировать{} wordform_score "конструируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:конструируемый{} и ГЛАГОЛ:конструировать{} wordform_score "консультируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:консультируемый{} и ГЛАГОЛ:консультировать{} wordform_score "консультируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:консультируемый{} и ГЛАГОЛ:консультировать{} wordform_score "кидаем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:кидаемый{} и ГЛАГОЛ:кидать{} wordform_score "кидаем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:кидаемый{} и ГЛАГОЛ:кидать{} wordform_score "акцентируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:акцентируемый{} и ГЛАГОЛ:акцентировать{} wordform_score "акцентируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:акцентируемый{} и ГЛАГОЛ:акцентировать{} wordform_score "колонизируем" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:колонизируемый{} и ГЛАГОЛ:колонизировать{} wordform_score "колонизируем" { ГЛАГОЛ } = 1 // ПРИЛАГАТЕЛЬНОЕ:колонизируемый{} и ГЛАГОЛ:колонизировать{} wordform_score "крымском" { ПРИЛАГАТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:крымский{} и СУЩЕСТВИТЕЛЬНОЕ:Крымск{} wordform_score "крымском" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:крымский{} и СУЩЕСТВИТЕЛЬНОЕ:Крымск{} wordform_score "каспийском" { ПРИЛАГАТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:каспийский{} и СУЩЕСТВИТЕЛЬНОЕ:Каспийск{} wordform_score "каспийском" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:каспийский{} и СУЩЕСТВИТЕЛЬНОЕ:Каспийск{} wordform_score "амурском" { ПРИЛАГАТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:амурский{} и СУЩЕСТВИТЕЛЬНОЕ:Амурск{} wordform_score "амурском" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:амурский{} и СУЩЕСТВИТЕЛЬНОЕ:Амурск{} wordform_score "архангельском" { ПРИЛАГАТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:архангельский{} и СУЩЕСТВИТЕЛЬНОЕ:Архангельск{} wordform_score "архангельском" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:архангельский{} и СУЩЕСТВИТЕЛЬНОЕ:Архангельск{} wordform_score "курильском" { ПРИЛАГАТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:курильский{} и СУЩЕСТВИТЕЛЬНОЕ:Курильск{} wordform_score "курильском" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:курильский{} и СУЩЕСТВИТЕЛЬНОЕ:Курильск{} wordform_score "кировском" { ПРИЛАГАТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:кировский{} и СУЩЕСТВИТЕЛЬНОЕ:Кировск{} wordform_score "кировском" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:кировский{} и СУЩЕСТВИТЕЛЬНОЕ:Кировск{} wordform_score "козельском" { ПРИЛАГАТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:козельский{} и СУЩЕСТВИТЕЛЬНОЕ:Козельск{} wordform_score "козельском" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:козельский{} и СУЩЕСТВИТЕЛЬНОЕ:Козельск{} wordform_score "курском" { ПРИЛАГАТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:курский{} и СУЩЕСТВИТЕЛЬНОЕ:Курск{} wordform_score "курском" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:курский{} и СУЩЕСТВИТЕЛЬНОЕ:Курск{} wordform_score "калининском" { ПРИЛАГАТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:калининский{} и СУЩЕСТВИТЕЛЬНОЕ:Калининск{} wordform_score "калининском" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:калининский{} и СУЩЕСТВИТЕЛЬНОЕ:Калининск{} wordform_score "красноярском" { ПРИЛАГАТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:красноярский{} и СУЩЕСТВИТЕЛЬНОЕ:Красноярск{} wordform_score "красноярском" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:красноярский{} и СУЩЕСТВИТЕЛЬНОЕ:Красноярск{} wordform_score "качкой" { ПРИЛАГАТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:качкий{} и СУЩЕСТВИТЕЛЬНОЕ:качка{} wordform_score "качкой" { СУЩЕСТВИТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:качкий{} и СУЩЕСТВИТЕЛЬНОЕ:качка{} wordform_score "качкою" { ПРИЛАГАТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:качкий{} и СУЩЕСТВИТЕЛЬНОЕ:качка{} wordform_score "качкою" { СУЩЕСТВИТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:качкий{} и СУЩЕСТВИТЕЛЬНОЕ:качка{} wordform_score "качком" { ПРИЛАГАТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:качкий{} и СУЩЕСТВИТЕЛЬНОЕ:качок{} wordform_score "качком" { СУЩЕСТВИТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:качкий{} и СУЩЕСТВИТЕЛЬНОЕ:качок{} wordform_score "адыгейском" { ПРИЛАГАТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:адыгейский{} и СУЩЕСТВИТЕЛЬНОЕ:Адыгейск{} wordform_score "адыгейском" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:адыгейский{} и СУЩЕСТВИТЕЛЬНОЕ:Адыгейск{} wordform_score "комсомольском" { ПРИЛАГАТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:комсомольский{} и СУЩЕСТВИТЕЛЬНОЕ:Комсомольск{} wordform_score "комсомольском" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:комсомольский{} и СУЩЕСТВИТЕЛЬНОЕ:Комсомольск{} wordform_score "апшеронском" { ПРИЛАГАТЕЛЬНОЕ } = 2 // ПРИЛАГАТЕЛЬНОЕ:апшеронский{} и СУЩЕСТВИТЕЛЬНОЕ:Апшеронск{} wordform_score "апшеронском" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ПРИЛАГАТЕЛЬНОЕ:апшеронский{} и СУЩЕСТВИТЕЛЬНОЕ:Апшеронск{} wordform_score "тайна" { ПРИЛАГАТЕЛЬНОЕ } = -5 // ПРИЛАГАТЕЛЬНОЕ:тайный{} wordform_score "тайна" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // СУЩЕСТВИТЕЛЬНОЕ:тайна{} wordform_score "коробило" { БЕЗЛИЧ_ГЛАГОЛ } = 1 // БЕЗЛИЧ_ГЛАГОЛ:коробит{} и ГЛАГОЛ:коробить{} wordform_score "коробило" { ГЛАГОЛ } = -2 // БЕЗЛИЧ_ГЛАГОЛ:коробит{} и ГЛАГОЛ:коробить{} wordform_score "коробит" { БЕЗЛИЧ_ГЛАГОЛ } = 1 // БЕЗЛИЧ_ГЛАГОЛ:коробит{} и ГЛАГОЛ:коробить{} wordform_score "коробит" { ГЛАГОЛ } = -2 // БЕЗЛИЧ_ГЛАГОЛ:коробит{} и ГЛАГОЛ:коробить{} wordform_score "казалось" { БЕЗЛИЧ_ГЛАГОЛ } = 1 // БЕЗЛИЧ_ГЛАГОЛ:кажется{} и ГЛАГОЛ:казаться{} wordform_score "казалось" { ГЛАГОЛ } = -2 // БЕЗЛИЧ_ГЛАГОЛ:кажется{} и ГЛАГОЛ:казаться{} wordform_score "канал" { ГЛАГОЛ } = -5 // ГЛАГОЛ:канать{} и СУЩЕСТВИТЕЛЬНОЕ:канал{} wordform_score "канал" { СУЩЕСТВИТЕЛЬНОЕ } = 1 // ГЛАГОЛ:канать{} и СУЩЕСТВИТЕЛЬНОЕ:канал{} wordform_score "канала" { ГЛАГОЛ } = 1 // ГЛАГОЛ:канать{} и СУЩЕСТВИТЕЛЬНОЕ:канал{} wordform_score "канала" { СУЩЕСТВИТЕЛЬНОЕ } = 1000000 // ГЛАГОЛ:канать{} и СУЩЕСТВИТЕЛЬНОЕ:канал{} wordform_score "чай" { ГЛАГОЛ } = -10 // чаять wordform_score "чай" { СУЩЕСТВИТЕЛЬНОЕ } = 0 // чай wordform_score "чай" { частица } = -2 // чай wordform_score "чай" { наречие } = -5 wordform_score "готов" { прилагательное } = 1 wordform_score "готов" { существительное } = -1 wordform_score "извести" { инфинитив } = -1 wordform_score "извести" { существительное } = 1 wordform_score "нашли" { наклонение:изъяв } = 1 wordform_score "нашли" { наклонение:побуд } = -5 // ---- wordform_score "брехни" { глагол } = -1 // брехня брехни --> брехнуть брехни wordform_score "бузил" { существительное } = -1 // бузила бузил --> бузить бузил wordform_score "бурей" { глагол } = -1 // буря бурей --> буреть бурей wordform_score "бюллетень" { глагол } = -1 // бюллетень бюллетень --> бюллетенить бюллетень wordform_score "возрасту" { глагол } = -1 // возраст возрасту --> возрасти возрасту wordform_score "воплю" { глагол } = -1 // вопль воплю --> вопить воплю wordform_score "врали" { существительное } = -1 // враль врали --> врать врали wordform_score "гвозди" { глагол } = -1 // гвоздь гвозди --> гвоздить гвозди wordform_score "Глашу" { глагол } = -1 // Глаша Глашу --> гласить глашу wordform_score "голубей" { глагол } = -1 // голубь голубей --> голубеть голубей wordform_score "гряду" { глагол } = -1 // гряда гряду --> грясти гряду wordform_score "Дорою" { существительное } = -1 // Дора Дорою --> дорыть дорою wordform_score "дох" { глагол } = -1 // доха дох --> дохнуть дох wordform_score "драконят" { существительное } = -1 // драконенок драконят --> драконить драконят wordform_score "дублю" { глагол } = -1 // дубль дублю --> дубить дублю wordform_score "дули" { существительное } = -1 // дуля дули --> дуть дули wordform_score "ежу" { глагол } = -1 // еж ежу --> ежить ежу wordform_score "жал" { существительное } = -1 // жало жал --> жать жал wordform_score "жигану" { глагол } = -1 // жиган жигану --> жигануть жигану wordform_score "завали" { существительное } = -1 // заваль завали --> завалить завали wordform_score "замшей" { глагол } = -1 // замша замшей --> замшеть замшей wordform_score "зарей" { глагол } = -1 // заря зарей --> зареять зарей wordform_score "затей" { глагол } = -1 // затея затей --> затеять затей wordform_score "затею" { глагол } = -1 // затея затею --> затеять затею wordform_score "затону" { существительное } = -1 // затон затону --> затонуть затону wordform_score "знахарю" { глагол } = -1 // знахарь знахарю --> знахарить знахарю wordform_score "изморозь" { глагол } = -1 // изморозь изморозь --> изморозить изморозь wordform_score "канитель" { глагол } = -1 // канитель канитель --> канителить канитель wordform_score "ковали" { существительное } = -1 // коваль ковали --> ковать ковали wordform_score "кучу" { глагол } = -1 // куча кучу --> кутить кучу wordform_score "лохмачу" { существительное } = -1 // лохмач лохмачу --> лохматить лохмачу wordform_score "матерей" { глагол } = -5 // мать матерей --> матереть матерей wordform_score "матери" { глагол } = -5 // мать матери --> материть матери wordform_score "метель" { глагол } = -1 // метель метель --> метелить метель wordform_score "мини" { глагол } = -1 // мини мини --> минуть мини wordform_score "минут" { глагол } = -1 // минута минут --> минуть минут wordform_score "молоди" { глагол } = -1 // молодь молоди --> молодить молоди wordform_score "батрачат" { существительное } = -1 // батрачонок батрачат --> батрачить батрачат wordform_score "бузила" { существительное } = -1 // бузила бузила --> бузить бузила wordform_score "времени" { глагол } = -1 // время времени --> временить времени wordform_score "дурней" { глагол } = -1 // дурень дурней --> дурнеть дурней wordform_score "наймите" { существительное } = -1 // наймит наймите --> нанять наймите wordform_score "накипи" { глагол } = -1 // накипь накипи --> накипеть накипи wordform_score "нарвал" { существительное } = -1 // нарвал нарвал --> нарвать нарвал wordform_score "нарвала" { существительное } = -1 // нарвал нарвала --> нарвать нарвала wordform_score "нарой" { существительное } = -1 // нара нарой --> нарыть нарой wordform_score "пари" { глагол } = -1 // пари пари --> парить пари wordform_score "пастушат" { глагол } = -1 // пастушонок пастушат --> пастушить пастушат wordform_score "пасу" { существительное } = -1 // пас пасу --> пасти пасу wordform_score "пень" { глагол } = -1 // пень пень --> пенить пень wordform_score "пеню" { глагол } = -1 // пеня пеню --> пенить пеню wordform_score "передам" { существительное } = -1 // перед передам --> передать передам wordform_score "печаль" { глагол } = -1 // печаль печаль --> печалить печаль wordform_score "подтеки" { глагол } = -1 // подтек подтеки --> подтечь подтеки wordform_score "постригу" { существительное } = -1 // постриг постригу --> постричь постригу wordform_score "проем" { глагол } = -1 // проем проем --> проесть проем wordform_score "простой" { глагол } = -1 // простой простой --> простоять простой wordform_score "пряди" { глагол } = -1 // прядь пряди --> прясть пряди wordform_score "разъем" { глагол } = -1 // разъем разъем --> разъесть разъем wordform_score "ржу" { существительное } = -1 // ржа ржу --> ржать ржу wordform_score "ругани" { глагол } = -1 // ругань ругани --> ругануть ругани wordform_score "сбои" { глагол } = -1 // сбой сбои --> сбоить сбои wordform_score "секретарь" { глагол } = -1 // секретарь секретарь --> секретарить секретарь wordform_score "скину" { существительное } = -1 // скин скину --> скинуть скину wordform_score "слесарь" { глагол } = -1 // слесарь слесарь --> слесарить слесарь wordform_score "случаем" { глагол } = -1 // случай случаем --> случать случаем wordform_score "соловей" { глагол } = -1 // соловей соловей --> соловеть соловей wordform_score "спирали" { глагол } = -1 // спираль спирали --> спирать спирали wordform_score "старь" { глагол } = -1 // старь старь --> старить старь wordform_score "струи" { глагол } = -1 // струя струи --> струить струи wordform_score "такелажу" { глагол } = -1 // такелаж такелажу --> такелажить такелажу wordform_score "участи" { глагол } = -1 // участь участи --> участить участи wordform_score "хмелю" { глагол } = -10 // хмель хмелю --> хмелить хмелю wordform_score "чаем" { глагол } = -10 // чай чаем --> чаять чаем wordform_score "замшею" { глагол } = -1 // замша замшею --> замшеть замшею wordform_score "зелени" { глагол } = -1 // зелень зелени --> зеленить зелени wordform_score "знахарь" { глагол } = -1 // знахарь знахарь --> знахарить знахарь wordform_score "канифоль" { глагол } = -1 // канифоль канифоль --> канифолить канифоль wordform_score "лужу" { глагол } = -1 // лужа лужу --> лудить лужу wordform_score "матерей" { глагол } = -1 // матерь матерей --> матереть матерей wordform_score "матери" { глагол } = -1 // матерь матери --> материть матери wordform_score "мелей" { глагол } = -1 // мель мелей --> мелеть мелей wordform_score "мыло" { глагол } = -1 // мыло мыло --> мыть мыло wordform_score "обезьянят" { существительное } = -1 // обезьяненок обезьянят --> обезьянить обезьянят wordform_score "объем" { глагол } = -1 // объем объем --> объесть объем wordform_score "осени" { глагол } = -1 // осень осени --> осенить осени wordform_score "отмели" { глагол } = -1 // отмель отмели --> отмолоть отмели wordform_score "перла" { существительное } = -1 // перл перла --> переть перла wordform_score "пил" { существительное } = -1 // пила пил --> пить пил wordform_score "пищали" { существительное } = -1 // пищаль пищали --> пищать пищали wordform_score "поволок" { существительное } = -1 // поволока поволок --> поволочь поволок wordform_score "поволоку" { существительное } = -1 // поволока поволоку --> поволочь поволоку wordform_score "покой" { глагол } = -5 // покой покой --> покоить покой wordform_score "покою" { глагол } = -5 // покой покою --> покоить покою wordform_score "полет" { глагол } = -1 // полет полет --> полоть полет wordform_score "полете" { глагол } = -1 // полет полете --> полоть полете wordform_score "полю" { глагол } = -1 // поле полю --> полоть полю wordform_score "примеси" { глагол } = -1 // примесь примеси --> примесить примеси wordform_score "примету" { глагол } = -1 // примета примету --> примести примету wordform_score "припас" { существительное } = -1 // припас припас --> припасти припас wordform_score "продела" { существительное } = -1 // продел продела --> продеть продела wordform_score "просек" { существительное } = -1 // просека просек --> просечь просек wordform_score "пущу" { существительное } = -1 // пуща пущу --> пустить пущу wordform_score "пьяни" { глагол } = -1 // пьянь пьяни --> пьянить пьяни wordform_score "сбою" { глагол } = -1 // сбой сбою --> сбоить сбою wordform_score "свечу" { глагол } = -1 // свеча свечу --> светить свечу wordform_score "секретарю" { глагол } = -1 // секретарь секретарю --> секретарить секретарю wordform_score "случай" { глагол } = -5 // случай случай --> случать случай wordform_score "случаю" { глагол } = -5 // случай случаю --> случать случаю wordform_score "слюни" { глагол } = -1 // слюна слюни --> слюнить слюни wordform_score "смог" { существительное } = -1 // смог смог --> смочь смог wordform_score "смогу" { существительное } = -1 // смог смогу --> смочь смогу wordform_score "собачат" { существительное } = -1 // собаченок собачат --> собачить собачат wordform_score "совести" { глагол } = -1 // совесть совести --> совестить совести wordform_score "спас" { существительное } = -1 // спас спас --> спасти спас wordform_score "стай" { глагол } = -1 // стая стай --> стаять стай wordform_score "стаю" { глагол } = -1 // стая стаю --> стаять стаю wordform_score "струю" { глагол } = -1 // струя струю --> струить струю wordform_score "стужу" { глагол } = -1 // стужа стужу --> студить стужу wordform_score "сучат" { существительное } = -1 // сучонок сучат --> сучить сучат wordform_score "тлей" { глагол } = -1 // тля тлей --> тлеть тлей wordform_score "толщу" { глагол } = -1 // толща толщу --> толстить толщу wordform_score "царю" { глагол } = -4 // царь царю --> царить царю ==> Ну а поздно вечером довелось удивиться и царю. wordform_score "чащу" { глагол } = -1 // чаща чащу --> частить чащу wordform_score "чаю" { глагол } = -10 // чай чаю --> чаять чаю wordform_score "ширь" { глагол } = -1 // ширь ширь --> ширить ширь wordform_score "штурману" { глагол } = -1 // штурман штурману --> штурмануть штурману wordform_score "щурят" { существительное } = -1 // щуренок щурят --> щурить щурят wordform_score "гноя" { деепричастие } = -4 // гной гноя --> гноя гноя wordform_score "гостя" { деепричастие } = -1 // гость гостя --> гостя гостя wordform_score "душа" { деепричастие } = -1 // душ душа --> душа душа wordform_score "катя" { деепричастие } = -4 // Катя Катя --> катя катя wordform_score "колея" { деепричастие } = -1 // колея колея --> колея колея wordform_score "костя" { деепричастие } = -1 // Костя Костя --> костя костя wordform_score "нарыв" { деепричастие } = -1 // нарыв нарыв --> нарыв нарыв wordform_score "отлив" { деепричастие } = -1 // отлив отлив --> отлив отлив wordform_score "отпоров" { существительное } = -1 // отпор отпоров --> отпоров отпоров wordform_score "отрыв" { деепричастие } = -1 // отрыв отрыв --> отрыв отрыв wordform_score "подлив" { существительное } = -1 // подлива подлив --> подлив подлив wordform_score "покоя" { деепричастие } = -1 // покой покоя --> покоя покоя wordform_score "прилив" { деепричастие } = -1 // прилив прилив --> прилив прилив wordform_score "пузыря" { деепричастие } = -1 // пузырь пузыря --> пузыря пузыря wordform_score "руля" { деепричастие } = -1 // руль руля --> руля руля wordform_score "селя" { деепричастие } = -1 // сель селя --> селя селя wordform_score "случая" { деепричастие } = -1 // случай случая --> случая случая wordform_score "сторожа" { деепричастие } = -1 // сторож сторожа --> сторожа сторожа wordform_score "суша" { деепричастие } = -1 // суша суша --> суша суша wordform_score "туша" { деепричастие } = -1 // туш туша --> туша туша wordform_score "хмеля" { деепричастие } = -1 // хмель хмеля --> хмеля хмеля wordform_score "валя" { деепричастие } = -1 // Валя Валя --> валя валя wordform_score "варя" { деепричастие } = -1 // Варя Варя --> варя варя wordform_score "гвоздя" { деепричастие } = -1 // гвоздь гвоздя --> гвоздя гвоздя wordform_score "голубя" { деепричастие } = -1 // голубь голубя --> голубя голубя wordform_score "горя" { деепричастие } = -1 // горе горя --> горя горя wordform_score "клея" { деепричастие } = -1 // клей клея --> клея клея wordform_score "неволя" { деепричастие } = -1 // неволя неволя --> неволя неволя wordform_score "отколов" { существительное } = -1 // откол отколов --> отколов отколов wordform_score "переборов" { существительное } = -1 // перебор переборов --> переборов переборов wordform_score "подлив" { существительное } = -1 // подлив подлив --> подлив подлив wordform_score "подрыв" { деепричастие } = -1 // подрыв подрыв --> подрыв подрыв wordform_score "полив" { деепричастие } = -1 // полив полив --> полив полив wordform_score "пошив" { деепричастие } = -1 // пошив пошив --> пошив пошив wordform_score "чая" { деепричастие } = -10 // чай чая --> чая чая wordform_score "струя" { деепричастие } = -1 // струя струя --> струя струя wordform_score "белков" { прилагательное } = -1 // белок белков --> белковый белков wordform_score "витой" { существительное } = -1 // Вита Витой --> витой витой wordform_score "вожатом" { прилагательное } = -1 // вожатый вожатом --> вожатый вожатом wordform_score "вожатым" { прилагательное } = -1 // вожатый вожатым --> вожатый вожатым wordform_score "вожатых" { прилагательное } = -1 // вожатый вожатых --> вожатый вожатых wordform_score "гола" { прилагательное } = -1 // гол гола --> голый гола wordform_score "вороной" { прилагательное } = -1 // ворона вороной --> вороной вороной wordform_score "голы" { прилагательное } = -1 // гол голы --> голый голы wordform_score "гусиной" { существительное } = -1 // Гусина Гусиной --> гусиный гусиной wordform_score "гусиным" { существительное } = -1 // Гусин Гусиным --> гусиный гусиным wordform_score "гусиными" { существительное } = -1 // Гусин Гусиными --> гусиный гусиными wordform_score "добро" { прилагательное } = -1 // добро добро --> добрый добро wordform_score "долги" { прилагательное } = -1 // долг долги --> долгий долги wordform_score "готов" { существительное } = -1 // гот готов --> готовый готов wordform_score "звонки" { прилагательное } = -1 // звонок звонки --> звонкий звонки wordform_score "звонок" { прилагательное } = -1 // звонок звонок --> звонкий звонок wordform_score "лаком" { прилагательное } = -1 // лак лаком --> лакомый лаком wordform_score "лев" { прилагательное } = -1 // лев лев --> левый лев wordform_score "лишаем" { прилагательное } = -1 // лишай лишаем --> лишаемый лишаем wordform_score "сладка" { существительное } = -10 // сладка сладка --> сладкий сладка wordform_score "сладкой" { существительное } = -1 // сладка сладкой --> сладкий сладкой wordform_score "сладкою" { существительное } = -1 // сладка сладкою --> сладкий сладкою wordform_score "сладок" { существительное } = -1 // сладка сладок --> сладкий сладок wordform_score "темен" { существительное } = -1 // темя темен --> темный темен wordform_score "тонной" { прилагательное } = -1 // тонна тонной --> тонный тонной wordform_score "ужат" { существительное } = -1 // ужонок ужат --> ужатый ужат wordform_score "этой" { существительное } = -5 // эта этой --> этот этой wordform_score "рада" { существительное } = -1 // Рада Рада --> рад рада wordform_score "рады" { существительное } = -1 // Рада Рады --> рад рады wordform_score "столиком" { прилагательное } = -1 // столик столиком --> столикий столиком wordform_score "теми" { существительное } = -1 // темь теми --> тот теми wordform_score "тонною" { прилагательное } = -1 // тонна тонною --> тонный тонною wordform_score "ужата" { существительное } = -1 // ужонок ужата --> ужатый ужата wordform_score "эта" { существительное } = -3 // эта эта --> этот эта wordform_score "этою" { существительное } = -1 // эта этою --> этот этою wordform_score "эту" { существительное } = -3 // эта эту --> этот эту // ------------------------ // Для имен и некоторых существительных на -ИЕ варианты множественного числа // обычно не употребляются, поэтому мы можем априори предположить пониженную достоверность. // Этот макрос далее используется для перечисления таких слов. #define DiscountPlural(w) wordform_score w { существительное число:мн } = -2 /* -- список форм получен из SQL словаря запросом: select distinct 'DiscountPlural('+F.name+')' from sg_entry E, sg_link L, sg_entry E2, sg_entry_coord EC, sg_form F, sg_form_coord FC where E.id_class=9 and L.id_entry1=E.id and L.istate=50 and E2.id=L.id_entry2 and E2.name='ИМЯ' and EC.id_entry=E.id and EC.icoord=14 and EC.istate=1 and F.id_entry=E.id and FC.id_entry=E.id and FC.iform=F.iform and FC.icoord=13 and FC.istate=1 */ DiscountPlural(Авдотий) DiscountPlural(Авдотьи) DiscountPlural(Авдотьям) DiscountPlural(Авдотьями) DiscountPlural(Авдотьях) DiscountPlural(Агафий) DiscountPlural(Агафьи) DiscountPlural(Агафьям) DiscountPlural(Агафьями) DiscountPlural(Агафьях) DiscountPlural(Агнии) DiscountPlural(Агний) DiscountPlural(Агниям) DiscountPlural(Агниями) DiscountPlural(Агниях) DiscountPlural(Азалии) DiscountPlural(Азалий) DiscountPlural(Азалиям) DiscountPlural(Азалиями) DiscountPlural(Азалиях) DiscountPlural(Аксиний) DiscountPlural(Аксиньи) DiscountPlural(Аксиньям) DiscountPlural(Аксиньями) DiscountPlural(Аксиньях) DiscountPlural(Амалии) DiscountPlural(Амалий) DiscountPlural(Амалиям) DiscountPlural(Амалиями) DiscountPlural(Амалиях) DiscountPlural(Анастасии) DiscountPlural(Анастасий) DiscountPlural(Анастасиям) DiscountPlural(Анастасиями) DiscountPlural(Анастасиях) DiscountPlural(Анисий) DiscountPlural(Анисьи) DiscountPlural(Анисьям) DiscountPlural(Анисьями) DiscountPlural(Анисьях) DiscountPlural(Аполлинарии) DiscountPlural(Аполлинарий) DiscountPlural(Аполлинариям) DiscountPlural(Аполлинариями) DiscountPlural(Аполлинариях) DiscountPlural(Апраксии) DiscountPlural(Апраксий) DiscountPlural(Апраксиям) DiscountPlural(Апраксиями) DiscountPlural(Апраксиях) DiscountPlural(Валерии) DiscountPlural(Валерий) DiscountPlural(Валериям) DiscountPlural(Валериями) DiscountPlural(Валериях) DiscountPlural(Виктории) DiscountPlural(Викторий) DiscountPlural(Викториям) DiscountPlural(Викториями) DiscountPlural(Викториях) DiscountPlural(Виргинии) DiscountPlural(Виргиний) DiscountPlural(Виргиниям) DiscountPlural(Виргиниями) DiscountPlural(Виргиниях) DiscountPlural(Виталии) DiscountPlural(Виталий) DiscountPlural(Виталиям) DiscountPlural(Виталиями) DiscountPlural(Виталиях) DiscountPlural(Гликерии) DiscountPlural(Гликерий) DiscountPlural(Гликериям) DiscountPlural(Гликериями) DiscountPlural(Гликериях) DiscountPlural(Гортензии) DiscountPlural(Гортензий) DiscountPlural(Гортензиям) DiscountPlural(Гортензиями) DiscountPlural(Гортензиях) DiscountPlural(Дарий) DiscountPlural(Дарьи) DiscountPlural(Дарьям) DiscountPlural(Дарьями) DiscountPlural(Дарьях) DiscountPlural(Денисии) DiscountPlural(Денисий) DiscountPlural(Денисиям) DiscountPlural(Денисиями) DiscountPlural(Денисиях) DiscountPlural(Евгении) DiscountPlural(Евгений) DiscountPlural(Евгениям) DiscountPlural(Евгениями) DiscountPlural(Евгениях) DiscountPlural(Евдокии) DiscountPlural(Евдокий) DiscountPlural(Евдокиям) DiscountPlural(Евдокиями) DiscountPlural(Евдокиях) DiscountPlural(Евдоксии) DiscountPlural(Евдоксий) DiscountPlural(Евдоксиям) DiscountPlural(Евдоксиями) DiscountPlural(Евдоксиях) DiscountPlural(Евлалии) DiscountPlural(Евлалий) DiscountPlural(Евлалиям) DiscountPlural(Евлалиями) DiscountPlural(Евлалиях) DiscountPlural(Евлампии) DiscountPlural(Евлампий) DiscountPlural(Евлампиям) DiscountPlural(Евлампиями) DiscountPlural(Евлампиях) DiscountPlural(Евпраксии) DiscountPlural(Евпраксий) DiscountPlural(Евпраксиям) DiscountPlural(Евпраксиями) DiscountPlural(Евпраксиях) DiscountPlural(Евстолии) DiscountPlural(Евстолий) DiscountPlural(Евстолиям) DiscountPlural(Евстолиями) DiscountPlural(Евстолиях) DiscountPlural(Евфимии) DiscountPlural(Евфимий) DiscountPlural(Евфимиям) DiscountPlural(Евфимиями) DiscountPlural(Евфимиях) DiscountPlural(Евфросинии) DiscountPlural(Евфросиний) DiscountPlural(Евфросиниям) DiscountPlural(Евфросиниями) DiscountPlural(Евфросиниях) DiscountPlural(Епистимии) DiscountPlural(Епистимий) DiscountPlural(Епистимиям) DiscountPlural(Епистимиями) DiscountPlural(Епистимиях) DiscountPlural(Ефимии) DiscountPlural(Ефимий) DiscountPlural(Ефимиям) DiscountPlural(Ефимиями) DiscountPlural(Ефимиях) DiscountPlural(Ефросинии) DiscountPlural(Ефросиний) DiscountPlural(Ефросиниям) DiscountPlural(Ефросиниями) DiscountPlural(Ефросиниях) DiscountPlural(Ефросиньи) DiscountPlural(Ефросиньям) DiscountPlural(Ефросиньями) DiscountPlural(Ефросиньях) DiscountPlural(Зиновии) DiscountPlural(Зиновий) DiscountPlural(Зиновиям) DiscountPlural(Зиновиями) DiscountPlural(Зиновиях) DiscountPlural(Ии) DiscountPlural(Ий) DiscountPlural(Иям) DiscountPlural(Иями) DiscountPlural(Иях) DiscountPlural(Калерии) DiscountPlural(Калерий) DiscountPlural(Калериям) DiscountPlural(Калериями) DiscountPlural(Калериях) DiscountPlural(Клавдии) DiscountPlural(Клавдий) DiscountPlural(Клавдиям) DiscountPlural(Клавдиями) DiscountPlural(Клавдиях) DiscountPlural(Конкордии) DiscountPlural(Конкордий) DiscountPlural(Конкордиям) DiscountPlural(Конкордиями) DiscountPlural(Конкордиях) DiscountPlural(Констанции) DiscountPlural(Констанций) DiscountPlural(Констанциям) DiscountPlural(Констанциями) DiscountPlural(Констанциях) DiscountPlural(Корнелии) DiscountPlural(Корнелий) DiscountPlural(Корнелиям) DiscountPlural(Корнелиями) DiscountPlural(Корнелиях) DiscountPlural(Ксении) DiscountPlural(Ксений) DiscountPlural(Ксениям) DiscountPlural(Ксениями) DiscountPlural(Ксениях) DiscountPlural(Леокадии) DiscountPlural(Леокадий) DiscountPlural(Леокадиям) DiscountPlural(Леокадиями) DiscountPlural(Леокадиях) DiscountPlural(Лидии) DiscountPlural(Лидий) DiscountPlural(Лидиям) DiscountPlural(Лидиями) DiscountPlural(Лидиях) DiscountPlural(Лии) DiscountPlural(Лий) DiscountPlural(Лилии) DiscountPlural(Лилий) DiscountPlural(Лилиям) DiscountPlural(Лилиями) DiscountPlural(Лилиях) DiscountPlural(Лиям) DiscountPlural(Лиями) DiscountPlural(Лиях) DiscountPlural(Лукерий) DiscountPlural(Лукерьи) DiscountPlural(Лукерьям) DiscountPlural(Лукерьями) DiscountPlural(Лукерьях) DiscountPlural(Лукреции) DiscountPlural(Лукреций) DiscountPlural(Лукрециям) DiscountPlural(Лукрециями) DiscountPlural(Лукрециях) DiscountPlural(Малании) DiscountPlural(Маланий) DiscountPlural(Маланиям) DiscountPlural(Маланиями) DiscountPlural(Маланиях) DiscountPlural(Маланьи) DiscountPlural(Маланьям) DiscountPlural(Маланьями) DiscountPlural(Маланьях) DiscountPlural(Марии) DiscountPlural(Марий) DiscountPlural(Мариям) DiscountPlural(Мариями) DiscountPlural(Мариях) DiscountPlural(Марьи) DiscountPlural(Марьям) DiscountPlural(Марьями) DiscountPlural(Марьях) DiscountPlural(матрон) DiscountPlural(матронам) DiscountPlural(матронами) DiscountPlural(матронах) DiscountPlural(матроны) DiscountPlural(Мелании) DiscountPlural(Меланий) DiscountPlural(Меланиям) DiscountPlural(Меланиями) DiscountPlural(Меланиях) DiscountPlural(Настасии) DiscountPlural(Настасий) DiscountPlural(Настасиям) DiscountPlural(Настасиями) DiscountPlural(Настасиях) DiscountPlural(Настасьи) DiscountPlural(Настасьям) DiscountPlural(Настасьями) DiscountPlural(Настасьях) DiscountPlural(Наталии) DiscountPlural(Наталий) DiscountPlural(Наталиям) DiscountPlural(Наталиями) DiscountPlural(Наталиях) DiscountPlural(Натальи) DiscountPlural(Натальям) DiscountPlural(Натальями) DiscountPlural(Натальях) DiscountPlural(Оливии) DiscountPlural(Оливий) DiscountPlural(Оливиям) DiscountPlural(Оливиями) DiscountPlural(Оливиях) DiscountPlural(Олимпии) DiscountPlural(Олимпий) DiscountPlural(Олимпиям) DiscountPlural(Олимпиями) DiscountPlural(Олимпиях) DiscountPlural(Поликсении) DiscountPlural(Поликсений) DiscountPlural(Поликсениям) DiscountPlural(Поликсениями) DiscountPlural(Поликсениях) DiscountPlural(Прасковий) DiscountPlural(Прасковьи) DiscountPlural(Прасковьям) DiscountPlural(Прасковьями) DiscountPlural(Прасковьях) DiscountPlural(Пульхерии) DiscountPlural(Пульхерий) DiscountPlural(Пульхериям) DiscountPlural(Пульхериями) DiscountPlural(Пульхериях) DiscountPlural(Розалии) DiscountPlural(Розалий) DiscountPlural(Розалиям) DiscountPlural(Розалиями) DiscountPlural(Розалиях) DiscountPlural(светкам) DiscountPlural(светками) DiscountPlural(светках) DiscountPlural(светки) DiscountPlural(светок) DiscountPlural(Сильвии) DiscountPlural(Сильвий) DiscountPlural(Сильвиям) DiscountPlural(Сильвиями) DiscountPlural(Сильвиях) DiscountPlural(Соломонии) DiscountPlural(Соломоний) DiscountPlural(Соломониям) DiscountPlural(Соломониями) DiscountPlural(Соломониях) DiscountPlural(Софии) DiscountPlural(Софий) DiscountPlural(Софиям) DiscountPlural(Софиями) DiscountPlural(Софиях) DiscountPlural(Стефании) DiscountPlural(Стефаний) DiscountPlural(Стефаниям) DiscountPlural(Стефаниями) DiscountPlural(Стефаниях) DiscountPlural(Таисии) DiscountPlural(Таисий) DiscountPlural(Таисиям) DiscountPlural(Таисиями) DiscountPlural(Таисиях) DiscountPlural(Таисьи) DiscountPlural(Таисьям) DiscountPlural(Таисьями) DiscountPlural(Таисьях) DiscountPlural(томкам) DiscountPlural(томками) DiscountPlural(томках) DiscountPlural(томки) DiscountPlural(томок) DiscountPlural(Устинии) DiscountPlural(Устиний) DiscountPlural(Устиниям) DiscountPlural(Устиниями) DiscountPlural(Устиниях) DiscountPlural(Устиньи) DiscountPlural(Устиньям) DiscountPlural(Устиньями) DiscountPlural(Устиньях) DiscountPlural(Февронии) DiscountPlural(Февроний) DiscountPlural(Феврониям) DiscountPlural(Феврониями) DiscountPlural(Феврониях) DiscountPlural(Февроньи) DiscountPlural(Февроньям) DiscountPlural(Февроньями) DiscountPlural(Февроньях) DiscountPlural(Федосии) DiscountPlural(Федосий) DiscountPlural(Федосиям) DiscountPlural(Федосиями) DiscountPlural(Федосиях) DiscountPlural(Федосьи) DiscountPlural(Федосьям) DiscountPlural(Федосьями) DiscountPlural(Федосьях) DiscountPlural(Федотии) DiscountPlural(Федотий) DiscountPlural(Федотиям) DiscountPlural(Федотиями) DiscountPlural(Федотиях) DiscountPlural(Федотьи) DiscountPlural(Федотьям) DiscountPlural(Федотьями) DiscountPlural(Федотьях) DiscountPlural(Фелиции) DiscountPlural(Фелиций) DiscountPlural(Фелициям) DiscountPlural(Фелициями) DiscountPlural(Фелициях) DiscountPlural(Феодосии) DiscountPlural(Феодосий) DiscountPlural(Феодосиям) DiscountPlural(Феодосиями) DiscountPlural(Феодосиях) DiscountPlural(Феодотии) DiscountPlural(Феодотий) DiscountPlural(Феодотиям) DiscountPlural(Феодотиями) DiscountPlural(Феодотиях) DiscountPlural(Феофании) DiscountPlural(Феофаний) DiscountPlural(Феофаниям) DiscountPlural(Феофаниями) DiscountPlural(Феофаниях) DiscountPlural(Фетинии) DiscountPlural(Фетиний) DiscountPlural(Фетиниям) DiscountPlural(Фетиниями) DiscountPlural(Фетиниях) DiscountPlural(Фетиньи) DiscountPlural(Фетиньям) DiscountPlural(Фетиньями) DiscountPlural(Фетиньях) DiscountPlural(Хавронии) DiscountPlural(Хавроний) DiscountPlural(Хаврониям) DiscountPlural(Хаврониями) DiscountPlural(Хаврониях) DiscountPlural(Цецилии) DiscountPlural(Цецилий) DiscountPlural(Цецилиям) DiscountPlural(Цецилиями) DiscountPlural(Цецилиях) DiscountPlural(Эмилии) DiscountPlural(Эмилий) DiscountPlural(Эмилиям) DiscountPlural(Эмилиями) DiscountPlural(Эмилиях) DiscountPlural(Юлиании) DiscountPlural(Юлианий) DiscountPlural(Юлианиям) DiscountPlural(Юлианиями) DiscountPlural(Юлианиях) DiscountPlural(Юлии) DiscountPlural(Юлий) DiscountPlural(Юлиям) DiscountPlural(Юлиями) DiscountPlural(Юлиях) /* подавляем формы множ. числа для существительных на -ОСТЬ и -ИЕ список форм получен из SQL словаря запросом: select distinct 'DiscountPlural('+F.name+')' from sg_entry E, sg_form F, sg_form_coord FC, sg_form_coord FC2 where E.id_class=9 and F.id_entry=E.id and FC.id_entry=E.id and FC.iform=F.iform and FC.icoord=13 and FC.istate=1 and FC2.id_entry=E.id and FC2.iform=F.iform and FC2.icoord=24 and FC2.istate in (0,6) and (E.name like '%ИЕ' or E.name like '%ЬЕ' or E.name like '%ОСТЬ') */ DiscountPlural(абсолютизирования) DiscountPlural(абсолютизированья) DiscountPlural(абстрагирования) DiscountPlural(абстрагированья) DiscountPlural(авансирования) DiscountPlural(авансированья) DiscountPlural(авиапредприятия) DiscountPlural(авиапутешествия) DiscountPlural(авиасоединения) //DiscountPlural(автоколебания) //DiscountPlural(автопредприятия) //DiscountPlural(агропредприятия) DiscountPlural(активирования) DiscountPlural(активности) DiscountPlural(акционирования) DiscountPlural(анкетирования) DiscountPlural(аномальности) DiscountPlural(архиглупости) DiscountPlural(ассигнования) //DiscountPlural(ателье) //DiscountPlural(аудиосообщения) DiscountPlural(ауканья) DiscountPlural(аханья) DiscountPlural(бальзамирования) //DiscountPlural(банальности) DiscountPlural(бандподполья) //DiscountPlural(бандформирования) DiscountPlural(барахтания) DiscountPlural(бдения) //DiscountPlural(бедствия) DiscountPlural(бедствования) DiscountPlural(бездарности) DiscountPlural(беззакония) //DiscountPlural(безобразия) DiscountPlural(безумия) DiscountPlural(безумствования) DiscountPlural(беременности) DiscountPlural(бесконечности) DiscountPlural(бескрайности) DiscountPlural(бестактности) DiscountPlural(бесцеремонности) DiscountPlural(бибиканья) //DiscountPlural(биения) DiscountPlural(биоизлучения) DiscountPlural(биоизмерения) DiscountPlural(благовещения) DiscountPlural(благовещенья) DiscountPlural(благоволения) //DiscountPlural(благовония) //DiscountPlural(благовонья) DiscountPlural(благовремения) DiscountPlural(благовременья) DiscountPlural(благоглупости) DiscountPlural(благоговения) DiscountPlural(благоговенья) DiscountPlural(благодарения) DiscountPlural(благодарности) DiscountPlural(благодеяния) DiscountPlural(благодеянья) DiscountPlural(благозвучия) DiscountPlural(благозвучья) DiscountPlural(благолепия) DiscountPlural(благолепья) DiscountPlural(благоприличия) DiscountPlural(благоприличья) DiscountPlural(благородия) DiscountPlural(благородья) DiscountPlural(благословения) DiscountPlural(благословенья) DiscountPlural(благосостояния) DiscountPlural(благосостоянья) DiscountPlural(благости) DiscountPlural(благоухания) DiscountPlural(благоуханья) DiscountPlural(близости) //DiscountPlural(блуждания) //DiscountPlural(блужданья) DiscountPlural(богопочитания) DiscountPlural(богослужения) DiscountPlural(бодания) DiscountPlural(боестолкновения) DiscountPlural(болтания) DiscountPlural(бомбометания) DiscountPlural(бормотания) DiscountPlural(бормотанья) DiscountPlural(боронования) DiscountPlural(боронованья) DiscountPlural(бравирования) DiscountPlural(бравированья) DiscountPlural(бракосочетания) DiscountPlural(бракосочетанья) DiscountPlural(братания) DiscountPlural(братанья) DiscountPlural(брожения) DiscountPlural(броженья) DiscountPlural(бросания) DiscountPlural(брыкания) DiscountPlural(брыканья) DiscountPlural(брюзжания) DiscountPlural(брюзжанья) //DiscountPlural(буквосочетания) DiscountPlural(бурления) DiscountPlural(бурленья) DiscountPlural(бурчания) DiscountPlural(бурчанья) DiscountPlural(бухтения) DiscountPlural(бытописания) DiscountPlural(бытописанья) DiscountPlural(валентности) DiscountPlural(валяния) DiscountPlural(варенья) DiscountPlural(ваяния) DiscountPlural(вбивания) DiscountPlural(вбирания) DiscountPlural(вбрасывания) DiscountPlural(вбухивания) DiscountPlural(вваливания) DiscountPlural(введения) DiscountPlural(ввертывания) DiscountPlural(ввертыванья) DiscountPlural(ввинчивания) DiscountPlural(ввинчиванья) DiscountPlural(вгрызания) DiscountPlural(вдавливания) DiscountPlural(вдевания) DiscountPlural(вдергивания) DiscountPlural(вдохновения) DiscountPlural(вдохновенья) DiscountPlural(вдувания) DiscountPlural(ведомости) DiscountPlural(вежливости) DiscountPlural(везения) DiscountPlural(везенья) DiscountPlural(веления) DiscountPlural(венеротрясения) DiscountPlural(венчания) DiscountPlural(венчанья) //DiscountPlural(верования) DiscountPlural(вероисповедания) //DiscountPlural(вероучения) //DiscountPlural(вероученья) DiscountPlural(вероятности) //DiscountPlural(верховья) //DiscountPlural(ветвления) //DiscountPlural(ветвленья) DiscountPlural(ветшания) DiscountPlural(вечности) DiscountPlural(вещания) //DiscountPlural(веяния) DiscountPlural(вживления) DiscountPlural(взаимовлияния) DiscountPlural(взаимодействия) //DiscountPlural(взаимозависимости) //DiscountPlural(взаимоотношения) DiscountPlural(взаимоположения) DiscountPlural(взаимопревращения) DiscountPlural(взаимопроникновения) DiscountPlural(взбивания) DiscountPlural(взбрыкивания) DiscountPlural(взбухания) DiscountPlural(взвевания) DiscountPlural(взвешивания) DiscountPlural(взвизгивания) DiscountPlural(взвывания) DiscountPlural(взгорья) DiscountPlural(взгромождения) DiscountPlural(вздевания) DiscountPlural(вздрагивания) DiscountPlural(вздувания) DiscountPlural(вздутия) DiscountPlural(вздыбливания) DiscountPlural(вздымания) DiscountPlural(взлаивания) DiscountPlural(взмахивания) DiscountPlural(взмывания) DiscountPlural(взыскания) DiscountPlural(взятия) //DiscountPlural(видения) //DiscountPlural(виденья) DiscountPlural(видеоизображения) DiscountPlural(видеонаблюдения) //DiscountPlural(видеопослания) DiscountPlural(видеоприложения) DiscountPlural(видимости) DiscountPlural(видоизменения) DiscountPlural(визжания) DiscountPlural(визжанья) DiscountPlural(виляния) DiscountPlural(висения) DiscountPlural(вихляния) DiscountPlural(вклинивания) DiscountPlural(включения) DiscountPlural(вкрапления) DiscountPlural(вкручивания) DiscountPlural(вкусности) DiscountPlural(владения) DiscountPlural(влезания) DiscountPlural(влечения) //DiscountPlural(вливания) //DiscountPlural(влияния) //DiscountPlural(вложения) DiscountPlural(влюбленности) DiscountPlural(внедрения) DiscountPlural(внезапности) DiscountPlural(внесения) DiscountPlural(внешности) //DiscountPlural(внутренности) DiscountPlural(внушения) DiscountPlural(водопользования) DiscountPlural(водопользованья) DiscountPlural(водружения) DiscountPlural(вожделения) DiscountPlural(вожделенья) DiscountPlural(возвращения) DiscountPlural(возвышения) DiscountPlural(возвышенности) DiscountPlural(возгорания) DiscountPlural(воздаяния) //DiscountPlural(воздействия) //DiscountPlural(воззвания) //DiscountPlural(воззрения) //DiscountPlural(возлияния) DiscountPlural(возмездия) DiscountPlural(возможности) DiscountPlural(возмущения) DiscountPlural(вознаграждения) //DiscountPlural(возражения) DiscountPlural(волеизъявления) //DiscountPlural(волнения) DiscountPlural(волненья) DiscountPlural(волости) DiscountPlural(вольности) DiscountPlural(вооружения) DiscountPlural(воплощения) DiscountPlural(воплощенья) //DiscountPlural(восклицания) DiscountPlural(воскресения) DiscountPlural(воскресенья) DiscountPlural(воскрешения) DiscountPlural(воспаления) DiscountPlural(воспевания) //DiscountPlural(воспоминания) //DiscountPlural(воспоминанья) DiscountPlural(восприятия) DiscountPlural(воспроизведения) DiscountPlural(восславления) DiscountPlural(воссоединения) //DiscountPlural(восстания) DiscountPlural(восстановления) DiscountPlural(восхваления) DiscountPlural(восхищения) DiscountPlural(восхождения) DiscountPlural(восьмидесятилетия) DiscountPlural(восьмистишия) //DiscountPlural(впечатления) //DiscountPlural(впечатленья) DiscountPlural(впрыскивания) DiscountPlural(времяисчисления) DiscountPlural(вручения) DiscountPlural(вселения) DiscountPlural(вскрикивания) DiscountPlural(вскрытия) DiscountPlural(всплытия) DiscountPlural(вспрыгивания) DiscountPlural(вспухания) DiscountPlural(вспучивания) DiscountPlural(вспушивания) DiscountPlural(вставления) DiscountPlural(встревания) DiscountPlural(встряхивания) DiscountPlural(вступления) DiscountPlural(всучивания) DiscountPlural(всхлипывания) DiscountPlural(всхрапывания) DiscountPlural(всыпания) DiscountPlural(вталкивания) DiscountPlural(втирания) DiscountPlural(вторжения) DiscountPlural(втравливания) DiscountPlural(вульгарности) //DiscountPlural(вхождения) DiscountPlural(выбывания) DiscountPlural(выбытия) DiscountPlural(выведывания) DiscountPlural(выдвижения) DiscountPlural(выделения) DiscountPlural(выделывания) DiscountPlural(выдумывания) DiscountPlural(выздоравливания) DiscountPlural(выискивания) DiscountPlural(выказывания) DiscountPlural(выключения) DiscountPlural(выковывания) DiscountPlural(выкорчевывания) DiscountPlural(выкручивания) DiscountPlural(вылечивания) DiscountPlural(выпадения) DiscountPlural(выпекания) DiscountPlural(выполнения) DiscountPlural(выпрастывания) //DiscountPlural(выпуклости) DiscountPlural(выравнивания) //DiscountPlural(выражения) //DiscountPlural(выраженья) DiscountPlural(высвистывания) DiscountPlural(выселения) DiscountPlural(высечения) //DiscountPlural(высказывания) DiscountPlural(высокоблагородия) DiscountPlural(высокогорья) DiscountPlural(выстуживания) DiscountPlural(выступления) //DiscountPlural(высыпания) DiscountPlural(вычеркивания) //DiscountPlural(вычисления) DiscountPlural(вычитания) DiscountPlural(вычитывания) DiscountPlural(вышагивания) DiscountPlural(вышивания) DiscountPlural(вышучивания) DiscountPlural(выявления) DiscountPlural(выяснения) DiscountPlural(вяканья) DiscountPlural(гадания) //DiscountPlural(гадости) DiscountPlural(гашения) //DiscountPlural(гидросооружения) //DiscountPlural(гиперплоскости) DiscountPlural(гипноизлучения) DiscountPlural(главнокомандования) DiscountPlural(глиссирования) DiscountPlural(глиссированья) DiscountPlural(глумления) DiscountPlural(глумленья) //DiscountPlural(глупости) DiscountPlural(гнездования) DiscountPlural(гнездованья) //DiscountPlural(гнездовья) DiscountPlural(гноения) //DiscountPlural(гнусности) DiscountPlural(говенья) DiscountPlural(головокружения) DiscountPlural(головокруженья) DiscountPlural(голосования) //DiscountPlural(гонения) //DiscountPlural(госпредприятия) DiscountPlural(госсобственности) //DiscountPlural(гостей) //DiscountPlural(гости) //DiscountPlural(госучреждения) DiscountPlural(грехопадения) DiscountPlural(грубости) DiscountPlural(группирования) //DiscountPlural(гуляния) //DiscountPlural(гулянья) DiscountPlural(давления) DiscountPlural(давности) DiscountPlural(дактилоскопирования) DiscountPlural(данности) DiscountPlural(дарения) DiscountPlural(дарования) DiscountPlural(датирования) DiscountPlural(двенадцатилетия) //DiscountPlural(движения) //DiscountPlural(движенья) DiscountPlural(двоеточия) //DiscountPlural(двусмысленности) //DiscountPlural(двустишия) DiscountPlural(двухсотлетия) DiscountPlural(девяностолетия) DiscountPlural(деепричастия) //DiscountPlural(действия) DiscountPlural(деления) DiscountPlural(деликатности) DiscountPlural(демонстрирования) DiscountPlural(дергания) DiscountPlural(дерганья) DiscountPlural(держания) DiscountPlural(дерзания) DiscountPlural(дерзновения) DiscountPlural(дерзости) DiscountPlural(десятиборья) DiscountPlural(десятилетия) //DiscountPlural(деяния) //DiscountPlural(деянья) DiscountPlural(деятельности) // являются высшим критерием и конечной целью профессиональной деятельности госслужащего DiscountPlural(диагностирования) DiscountPlural(дикости) //DiscountPlural(дипотношения) DiscountPlural(добавления) DiscountPlural(добродетельности) //DiscountPlural(доверенности) DiscountPlural(доворачивания) DiscountPlural(договоренности) DiscountPlural(дозволения) DiscountPlural(долечивания) //DiscountPlural(должности) //DiscountPlural(домовладения) DiscountPlural(домоправления) //DiscountPlural(домостроения) DiscountPlural(домоуправления) DiscountPlural(домысливания) DiscountPlural(донесения) DiscountPlural(доперечисления) DiscountPlural(дописывания) //DiscountPlural(дополнения) DiscountPlural(допрашивания) //DiscountPlural(допущения) DiscountPlural(доставания) DiscountPlural(доставления) //DiscountPlural(достижения) DiscountPlural(достоверности) DiscountPlural(достопамятности) DiscountPlural(достояния) //DiscountPlural(досье) DiscountPlural(дотрагивания) DiscountPlural(доукомплектования) //DiscountPlural(драгоценности) //DiscountPlural(древности) //DiscountPlural(дрыганья) DiscountPlural(дудения) //DiscountPlural(дуновения) DiscountPlural(дуракаваляния) DiscountPlural(дурновкусия) DiscountPlural(дурости) DiscountPlural(единообразия) DiscountPlural(еканья) //DiscountPlural(емкости) DiscountPlural(ерзанья) DiscountPlural(жалования) DiscountPlural(жалованья) //DiscountPlural(желания) //DiscountPlural(желанья) DiscountPlural(жертвоприношения) DiscountPlural(жестокости) DiscountPlural(живописания) DiscountPlural(живописанья) //DiscountPlural(жидкости) DiscountPlural(жизнеописания) DiscountPlural(жизнепонимания) //DiscountPlural(жития) DiscountPlural(жонглирования) DiscountPlural(жонглированья) //DiscountPlural(заблуждения) //DiscountPlural(заблужденья) //DiscountPlural(заболевания) //DiscountPlural(заведения) //DiscountPlural(заведенья) //DiscountPlural(заверения) DiscountPlural(завершения) DiscountPlural(завещания) DiscountPlural(завещанья) DiscountPlural(зависания) //DiscountPlural(зависимости) //DiscountPlural(завихрения) //DiscountPlural(завоевания) //DiscountPlural(завывания) //DiscountPlural(завыванья) DiscountPlural(завышения) DiscountPlural(заглавия) DiscountPlural(заглубления) DiscountPlural(заглушения) DiscountPlural(заграждения) DiscountPlural(загромождения) DiscountPlural(загрубения) DiscountPlural(загрязнения) DiscountPlural(загрязненности) DiscountPlural(загустевания) //DiscountPlural(задания) DiscountPlural(задержания) DiscountPlural(задолженности) DiscountPlural(задымления) DiscountPlural(зажатия) DiscountPlural(зажатости) DiscountPlural(зазрения) DiscountPlural(зазывания) DiscountPlural(заигрывания) DiscountPlural(заикания) //DiscountPlural(заимствования) DiscountPlural(закаливания) //DiscountPlural(заклинания) //DiscountPlural(заклинанья) DiscountPlural(заключения) //DiscountPlural(заклятия) //DiscountPlural(заклятья) //DiscountPlural(закономерности) DiscountPlural(законопослушания) DiscountPlural(закрашивания) //DiscountPlural(закругления) //DiscountPlural(закругленности) DiscountPlural(закручивания) DiscountPlural(закрытия) DiscountPlural(заксобрания) DiscountPlural(залегания) DiscountPlural(заледенения) DiscountPlural(залития) //DiscountPlural(замечания) DiscountPlural(замирения) //DiscountPlural(замыкания) DiscountPlural(замысловатости) DiscountPlural(замятия) DiscountPlural(занижения) DiscountPlural(занимания) //DiscountPlural(занятия) //DiscountPlural(занятья) DiscountPlural(западания) DiscountPlural(западения) DiscountPlural(запаздывания) DiscountPlural(заполнения) DiscountPlural(заполняемости) DiscountPlural(запугивания) DiscountPlural(запутанности) //DiscountPlural(запястья) DiscountPlural(заседания) DiscountPlural(засорения) DiscountPlural(застолья) DiscountPlural(застревания) DiscountPlural(затмения) DiscountPlural(заточения) //DiscountPlural(затруднения) DiscountPlural(затушевывания) DiscountPlural(заумности) DiscountPlural(захватывания) DiscountPlural(захмеления) DiscountPlural(захолустья) DiscountPlural(зацикливания) DiscountPlural(зачатия) DiscountPlural(зачерствения) DiscountPlural(зачисления) //DiscountPlural(заявления) //DiscountPlural(звания) DiscountPlural(званья) DiscountPlural(звукоподражания) DiscountPlural(звукосочетания) //DiscountPlural(здания) DiscountPlural(здоровья) DiscountPlural(зелья) DiscountPlural(землевладения) DiscountPlural(землетрясения) //DiscountPlural(зимовья) DiscountPlural(зияния) //DiscountPlural(злодеяния) //DiscountPlural(злоключения) //DiscountPlural(злоупотребления) //DiscountPlural(знаменитости) //DiscountPlural(знамения) //DiscountPlural(знаменья) //DiscountPlural(знания) //DiscountPlural(значения) //DiscountPlural(значенья) DiscountPlural(значимости) DiscountPlural(избавленья) DiscountPlural(избивания) DiscountPlural(избиения) DiscountPlural(избрания) //DiscountPlural(изваяния) //DiscountPlural(изваянья) DiscountPlural(изведения) //DiscountPlural(извержения) //DiscountPlural(известия) //DiscountPlural(извещения) //DiscountPlural(извинения) DiscountPlural(извлечения) DiscountPlural(изволения) //DiscountPlural(извращения) DiscountPlural(изгнания) DiscountPlural(изгнанья) DiscountPlural(изголовья) //DiscountPlural(издания) //DiscountPlural(изделия) DiscountPlural(излития) DiscountPlural(излияния) DiscountPlural(изложения) DiscountPlural(излучения) DiscountPlural(изменения) DiscountPlural(измерения) DiscountPlural(измышления) //DiscountPlural(изнасилования) DiscountPlural(изобличения) //DiscountPlural(изображения) //DiscountPlural(изобретения) //DiscountPlural(изречения) DiscountPlural(изъявления) DiscountPlural(изъязвления) //DiscountPlural(изъятия) DiscountPlural(изысканности) DiscountPlural(изящности) DiscountPlural(иконопочитания) DiscountPlural(именитости) //DiscountPlural(имения) //DiscountPlural(именья) DiscountPlural(имитирования) DiscountPlural(индивидуальности) DiscountPlural(индуктивности) DiscountPlural(инкассирования) DiscountPlural(иносказания) DiscountPlural(интимности) DiscountPlural(инцидентности) //DiscountPlural(искажения) //DiscountPlural(искания) //DiscountPlural(исключения) DiscountPlural(искрения) //DiscountPlural(искривления) DiscountPlural(искушения) //DiscountPlural(испарения) DiscountPlural(исповедания) DiscountPlural(испоганивания) //DiscountPlural(исправления) //DiscountPlural(испражнения) //DiscountPlural(испытания) DiscountPlural(иссечения) //DiscountPlural(исследования) DiscountPlural(Универсиады)
ворона вороной --> вороной вороной
wordform_score "вороной" { прилагательное } = -1
7,303,929
[ 1, 4625, 348, 7953, 560, 30, 225, 225, 145, 115, 145, 127, 146, 227, 145, 127, 145, 126, 145, 113, 225, 145, 115, 145, 127, 146, 227, 145, 127, 145, 126, 145, 127, 145, 122, 15431, 225, 145, 115, 145, 127, 146, 227, 145, 127, 145, 126, 145, 127, 145, 122, 225, 145, 115, 145, 127, 146, 227, 145, 127, 145, 126, 145, 127, 145, 122, 203, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 2076, 687, 67, 6355, 315, 145, 115, 145, 127, 146, 227, 145, 127, 145, 126, 145, 127, 145, 122, 6, 288, 225, 145, 128, 146, 227, 145, 121, 145, 124, 145, 113, 145, 116, 145, 113, 146, 229, 145, 118, 145, 124, 146, 239, 145, 126, 145, 127, 145, 118, 289, 273, 300, 21, 282, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/42/0xC93bB764Db970da6A1bC5040c680B2Cb449b0e0E/sources/contracts/core/ProxyAuth.sol
@title ProxyAuth Gets DSProxy auth from users and is callable by the Executor
contract ProxyAuth is AdminAuth { address public constant REGISTRY_ADDR = 0xd26966adCdF4ef5CFcc6d2fFfe0190DF17acB72A; IDFSRegistry public constant registry = IDFSRegistry(REGISTRY_ADDR); bytes32 constant STRATEGY_EXECUTOR_ID = keccak256("StrategyExecutor"); string public constant ERR_SENDER_NOT_EXECUTOR = "Sender not executor addr"; modifier onlyExecutor { address executorAddr = registry.getAddr(STRATEGY_EXECUTOR_ID); require(msg.sender == executorAddr, ERR_SENDER_NOT_EXECUTOR); _; } function callExecute( address _proxyAddr, address _contractAddr, bytes memory _data ) public payable onlyExecutor { if (address(this).balance > 0) { msg.sender.transfer(address(this).balance); } } IDSProxy(_proxyAddr).execute{value: msg.value}(_contractAddr, _data); function callExecute( address _proxyAddr, address _contractAddr, bytes memory _data ) public payable onlyExecutor { if (address(this).balance > 0) { msg.sender.transfer(address(this).balance); } } }
16,284,522
[ 1, 4625, 348, 7953, 560, 30, 225, 632, 2649, 7659, 1730, 11881, 8678, 3886, 1357, 628, 3677, 471, 353, 4140, 635, 326, 13146, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 16351, 7659, 1730, 353, 7807, 1730, 288, 203, 203, 565, 1758, 1071, 5381, 11980, 25042, 67, 14142, 273, 374, 7669, 5558, 29, 6028, 361, 19728, 42, 24, 10241, 25, 8955, 952, 26, 72, 22, 74, 42, 3030, 1611, 9349, 4577, 4033, 1077, 38, 9060, 37, 31, 203, 565, 1599, 4931, 4243, 1071, 5381, 4023, 273, 1599, 4931, 4243, 12, 5937, 25042, 67, 14142, 1769, 203, 203, 565, 1731, 1578, 5381, 7128, 27708, 67, 15271, 1693, 916, 67, 734, 273, 417, 24410, 581, 5034, 2932, 4525, 6325, 8863, 203, 565, 533, 1071, 5381, 10359, 67, 1090, 18556, 67, 4400, 67, 15271, 1693, 916, 273, 315, 12021, 486, 6601, 3091, 14432, 203, 203, 203, 565, 9606, 1338, 6325, 288, 203, 3639, 1758, 6601, 3178, 273, 4023, 18, 588, 3178, 12, 3902, 27708, 67, 15271, 1693, 916, 67, 734, 1769, 203, 3639, 2583, 12, 3576, 18, 15330, 422, 6601, 3178, 16, 10359, 67, 1090, 18556, 67, 4400, 67, 15271, 1693, 916, 1769, 203, 3639, 389, 31, 203, 565, 289, 203, 203, 565, 445, 745, 5289, 12, 203, 3639, 1758, 389, 5656, 3178, 16, 203, 3639, 1758, 389, 16351, 3178, 16, 203, 3639, 1731, 3778, 389, 892, 203, 565, 262, 1071, 8843, 429, 1338, 6325, 288, 203, 203, 203, 3639, 309, 261, 2867, 12, 2211, 2934, 12296, 405, 374, 13, 288, 203, 5411, 1234, 18, 15330, 18, 13866, 12, 2867, 12, 2211, 2934, 12296, 1769, 203, 3639, 289, 203, 565, 289, 203, 203, 3639, 1599, 55, 3886, 24899, 5656, 3178, 2934, 8837, 95, 1132, 30, 1234, 18, 1132, 97, 24899, 16351, 3178, 16, 389, 892, 1769, 203, 565, 445, 745, 5289, 12, 203, 3639, 1758, 389, 5656, 3178, 16, 203, 3639, 1758, 389, 16351, 3178, 16, 203, 3639, 1731, 3778, 389, 892, 203, 565, 262, 1071, 8843, 429, 1338, 6325, 288, 203, 203, 203, 3639, 309, 261, 2867, 12, 2211, 2934, 12296, 405, 374, 13, 288, 203, 5411, 1234, 18, 15330, 18, 13866, 12, 2867, 12, 2211, 2934, 12296, 1769, 203, 3639, 289, 203, 565, 289, 203, 203, 97, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/5/0x1668f50d703eAa5C1Cf15B98b8C08CF82bdc8a32/sources/project_/contracts/ERC721A.sol
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token./
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); if (!_isRevealed) { } return string(abi.encodePacked(_baseURI(), _toString(tokenId), ".json")); }
1,928,863
[ 1, 4625, 348, 7953, 560, 30, 380, 632, 5206, 2860, 326, 1351, 6854, 2591, 10333, 261, 3098, 13, 364, 1375, 2316, 548, 68, 1147, 18, 19, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 1147, 3098, 12, 11890, 5034, 1147, 548, 13, 1071, 1476, 5024, 3849, 1135, 261, 1080, 3778, 13, 288, 203, 3639, 309, 16051, 67, 1808, 12, 2316, 548, 3719, 15226, 3699, 1138, 1290, 3989, 19041, 1345, 5621, 203, 3639, 309, 16051, 67, 291, 426, 537, 18931, 13, 288, 203, 3639, 289, 203, 203, 3639, 327, 533, 12, 21457, 18, 3015, 4420, 329, 24899, 1969, 3098, 9334, 389, 10492, 12, 2316, 548, 3631, 3552, 1977, 7923, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
./full_match/1/0x80cdC7CF8670B922EF86c6F0e7f237bD4598439A/sources/MRaceNFT.sol
Pricing IDs for levels and sequences are NOT in _paymentMethods
mapping(uint256 => bool) private _levelsWithSpecialPayments;
8,413,023
[ 1, 4625, 348, 7953, 560, 30, 225, 453, 1512, 310, 7115, 364, 7575, 471, 8463, 854, 4269, 316, 389, 9261, 4712, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 2874, 12, 11890, 5034, 516, 1426, 13, 3238, 389, 12095, 1190, 12193, 23725, 31, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
// File: @openzeppelin\contracts\token\ERC20\IERC20.sol // SPDX-License-Identifier: MIT pragma solidity ^0.6.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); } // File: node_modules\@openzeppelin\contracts\math\SafeMath.sol pragma solidity ^0.6.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; } } // File: node_modules\@openzeppelin\contracts\utils\Address.sol pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin\contracts\token\ERC20\SafeERC20.sol pragma solidity ^0.6.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: @openzeppelin\contracts\utils\EnumerableSet.sol pragma solidity ^0.6.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // File: node_modules\@openzeppelin\contracts\GSN\Context.sol 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; } } // File: @openzeppelin\contracts\access\Ownable.sol pragma solidity ^0.6.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: @openzeppelin\contracts\token\ERC20\ERC20.sol pragma solidity ^0.6.0; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } // File: contracts\ZEUSToken.sol pragma solidity 0.6.12; // ZEUSToken with Governance. contract ZEUSToken is ERC20("ZEUSV2Token", "ZEUSV2"), Ownable { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } function burn(address _from, uint256 _amount) public onlyOwner { _burn(_from, _amount); } // Copied and modified from YAM code: // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernanceStorage.sol // https://github.com/yam-finance/yam-protocol/blob/master/contracts/token/YAMGovernance.sol // Which is copied and modified from COMPOUND: // https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol /// @notice A record of each accounts delegate mapping (address => address) internal _delegates; /// @notice A checkpoint for marking number of votes from a given block struct Checkpoint { uint32 fromBlock; uint256 votes; } /// @notice A record of votes checkpoints for each account, by index mapping (address => mapping (uint32 => Checkpoint)) public checkpoints; /// @notice The number of checkpoints for each account mapping (address => uint32) public numCheckpoints; /// @notice The EIP-712 typehash for the contract's domain bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); /// @notice The EIP-712 typehash for the delegation struct used by the contract bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); /// @notice A record of states for signing / validating signatures mapping (address => uint) public nonces; /// @notice An event thats emitted when an account changes its delegate event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); /// @notice An event thats emitted when a delegate account's vote balance changes event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance); /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegator The address to get delegatee for */ function delegates(address delegator) external view returns (address) { return _delegates[delegator]; } /** * @notice Delegate votes from `msg.sender` to `delegatee` * @param delegatee The address to delegate votes to */ function delegate(address delegatee) external { return _delegate(msg.sender, delegatee); } /** * @notice Delegates votes from signatory to `delegatee` * @param delegatee The address to delegate votes to * @param nonce The contract state required to match the signature * @param expiry The time at which to expire the signature * @param v The recovery byte of the signature * @param r Half of the ECDSA signature pair * @param s Half of the ECDSA signature pair */ function delegateBySig( address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())), getChainId(), address(this) ) ); bytes32 structHash = keccak256( abi.encode( DELEGATION_TYPEHASH, delegatee, nonce, expiry ) ); bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", domainSeparator, structHash ) ); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "ZEUSV2::delegateBySig: invalid signature"); require(nonce == nonces[signatory]++, "ZEUSV2::delegateBySig: invalid nonce"); require(now <= expiry, "ZEUSV2::delegateBySig: signature expired"); return _delegate(signatory, delegatee); } /** * @notice Gets the current votes balance for `account` * @param account The address to get votes balance * @return The number of current votes for `account` */ function getCurrentVotes(address account) external view returns (uint256) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; } /** * @notice Determine the prior number of votes for an account as of a block number * @dev Block number must be a finalized block or else this function will revert to prevent misinformation. * @param account The address of the account to check * @param blockNumber The block number to get the vote balance at * @return The number of votes the account had as of the given block */ function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "ZEUSV2::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } // First check most recent balance if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } // Next check implicit zero balance if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; } else if (cp.fromBlock < blockNumber) { lower = center; } else { upper = center - 1; } } return checkpoints[account][lower].votes; } function _delegate(address delegator, address delegatee) internal { address currentDelegate = _delegates[delegator]; uint256 delegatorBalance = balanceOf(delegator); // balance of underlying ZEUSs (not scaled); _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, delegatorBalance); } function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { // decrease old representative uint32 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { // increase new representative uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _writeCheckpoint( address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes ) internal { uint32 blockNumber = safe32(block.number, "ZEUSV2::_writeCheckpoint: block number exceeds 32 bits"); if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; } else { checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes); numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } function safe32(uint n, string memory errorMessage) internal pure returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); } function getChainId() internal pure returns (uint) { uint256 chainId; assembly { chainId := chainid() } return chainId; } } // File: contracts\zeusmain.sol pragma solidity 0.6.12; interface IMigratorChef { // Perform LP token migration from legacy UniswapV2 to ZEUSSwap. // Take the current LP token address and return the new LP token address. // Migrator should have full access to the caller's LP token. // Return the new LP token address. // // XXX Migrator must have allowance access to UniswapV2 LP tokens. // ZEUSSwap must mint EXACTLY the same amount of ZEUSSwap LP tokens or // else something bad will happen. Traditional UniswapV2 does not // do that so be careful! function migrate(IERC20 token) external returns (IERC20); } // ZEUSMain is the master of ZEUS. He can make ZEUS and he is a fair guy. // // Note that it's ownable and the owner wields tremendous power. The ownership // will be transferred to a governance smart contract once ZEUS is sufficiently // distributed and the community can show to govern itself. // // Have fun reading it. Hopefully it's bug-free. God bless. contract ZEUSMain is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; // Info of each user. struct UserInfo { uint256 amount; // How many LP tokens the user has provided. uint256 rewardDebt; // Reward debt. See explanation below. // // We do some fancy math here. Basically, any point in time, the amount of ZEUSs // entitled to a user but is pending to be distributed is: // // pending reward = (user.amount * pool.accZEUSPerShare) - user.rewardDebt // // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens: // 1. The pool's `accZEUSPerShare` (and `lastRewardBlock`) gets updated. // 2. User receives the pending reward sent to his/her address. // 3. User's `amount` gets updated. // 4. User's `rewardDebt` gets updated. } // Info of each pool. struct PoolInfo { IERC20 lpToken; // Address of LP token contract. bool bChange; // if true锛宎llocPoint changed by bool bLock; // if true锛宼he pool be locked bool bDepositFee; // uint256 depositMount; // uint256 changeMount; // uint256 allocPoint; // How many allocation points assigned to this pool. ZEUSs to distribute per block. uint256 lastRewardBlock; // Last block number that ZEUSs distribution occurs. uint256 accZEUSPerShare; // Accumulated ZEUSs per share, times 1e12. See below. } struct AreaInfo { uint256 totalAllocPoint; uint256 rate; } // The ZEUS TOKEN! ZEUSToken public zeus; ZEUSToken public zeusOld; // Dev address. address public devaddr; // min per block mint uint256 public minPerBlock; // ZEUS tokens created per block. uint256 public zeusPerBlock; uint256 public halfPeriod; uint256 public lockPeriods; // lock periods // The migrator contract. It has a lot of power. Can only be set through governance (owner). IMigratorChef public migrator; // Info of each pool. //PoolInfo[] public poolInfo; mapping (uint256 => PoolInfo[]) public poolInfo; // Info of each user that stakes LP tokens. //mapping (uint256 => mapping (address => UserInfo)) public userInfo; mapping (uint256 => mapping(uint256 => mapping (address => UserInfo))) public userInfo; // Total allocation poitns. Must be the sum of all allocation points in all pools. //uint256 public totalAllocPoint = 0; AreaInfo[] public areaInfo; uint256 public totalRate = 0; // The block number when ZEUS mining starts. uint256 public startBlock; uint256 public permitExpired; event Deposit(address indexed user, uint256 indexed aid, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed aid, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed aid, uint256 indexed pid, uint256 amount); constructor( ZEUSToken _zeus, ZEUSToken _zeusOld, address _devaddr, uint256 _zeusPerBlock, uint256 _startBlock, uint256 _minPerBlock, uint256 _halfPeriod, uint256 _lockPeriods, uint256 _permitExpired ) public { zeus = _zeus; zeusOld = _zeusOld; devaddr = _devaddr; zeusPerBlock = _zeusPerBlock; minPerBlock = _minPerBlock; startBlock = _startBlock; halfPeriod = _halfPeriod; lockPeriods = _lockPeriods; permitExpired = _permitExpired; } function buyBackToken(address payable buybackaddr) public onlyOwner { require(buybackaddr != address(0), "buy back is addr 0"); buybackaddr.transfer(address(this).balance); } function areaLength() external view returns (uint256) { return areaInfo.length; } function poolLength(uint256 _aid) external view returns (uint256) { return poolInfo[_aid].length; } function addArea(uint256 _rate, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdateAreas(); } totalRate = totalRate.add(_rate); areaInfo.push(AreaInfo({ totalAllocPoint: 0, rate: _rate })); } // Add a new lp to the pool. Can only be called by the owner. // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do. function add(uint256 _aid, uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate, bool _bChange, uint256 _changeMount, bool _bLock, bool _bDepositFee, uint256 _depositFee) public onlyOwner { if (_withUpdate) { massUpdatePools(_aid); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; areaInfo[_aid].totalAllocPoint = areaInfo[_aid].totalAllocPoint.add(_allocPoint); poolInfo[_aid].push(PoolInfo({ lpToken: _lpToken, bChange: _bChange, bLock: _bLock, bDepositFee: _bDepositFee, depositMount: _depositFee, changeMount: _changeMount, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accZEUSPerShare: 0 })); } function setArea(uint256 _aid, uint256 _rate, bool _withUpdate) public onlyOwner { if (_withUpdate) { massUpdateAreas(); } totalRate = totalRate.sub(areaInfo[_aid].rate).add(_rate); areaInfo[_aid].rate = _rate; } // Update the given pool's zeus allocation point. Can only be called by the owner. function set(uint256 _aid, uint256 _pid, uint256 _allocPoint, bool _withUpdate, bool _bChange, uint256 _changeMount, bool _bLock, bool _bDepositFee, uint256 _depositFee) public onlyOwner { if (_withUpdate) { massUpdatePools(_aid); } areaInfo[_aid].totalAllocPoint = areaInfo[_aid].totalAllocPoint.sub(poolInfo[_aid][_pid].allocPoint).add(_allocPoint); poolInfo[_aid][_pid].allocPoint = _allocPoint; poolInfo[_aid][_pid].bChange = _bChange; poolInfo[_aid][_pid].bLock = _bLock; poolInfo[_aid][_pid].changeMount = _changeMount; poolInfo[_aid][_pid].bDepositFee = _bDepositFee; poolInfo[_aid][_pid].depositMount = _depositFee; } // Set the migrator contract. Can only be called by the owner. function setMigrator(IMigratorChef _migrator) public onlyOwner { migrator = _migrator; } // Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good. function migrate(uint256 _aid, uint256 _pid) public { require(address(migrator) != address(0), "migrate: no migrator"); PoolInfo storage pool = poolInfo[_aid][_pid]; IERC20 lpToken = pool.lpToken; uint256 bal = lpToken.balanceOf(address(this)); lpToken.safeApprove(address(migrator), bal); IERC20 newLpToken = migrator.migrate(lpToken); require(bal == newLpToken.balanceOf(address(this)), "migrate: bad"); pool.lpToken = newLpToken; } // Reduce by 50% per halfPeriod blocks. function getBlockReward(uint256 number) public view returns (uint256) { if (number < startBlock){ return 0; } uint256 mintBlocks = number.sub(startBlock); uint256 exp = mintBlocks.div(halfPeriod); if (exp == 0) return 100000000000000000000; if (exp == 1) return 80000000000000000000; if (exp == 2) return 60000000000000000000; if (exp == 3) return 40000000000000000000; if (exp == 4) return 20000000000000000000; if (exp == 5) return 10000000000000000000; if (exp == 6) return 8000000000000000000; if (exp == 7) return 6000000000000000000; if (exp == 8) return 4000000000000000000; if (exp == 9) return 2000000000000000000; if (exp >= 10) return 1000000000000000000; // uint256 blockReward = zeusPerBlock.mul(5 ** exp).div(10 ** exp); // blockReward = blockReward > minPerBlock ? blockReward : minPerBlock; // if(blockReward > 0 && blockReward <= htcPerBlock){ // return blockReward; // } return 0; } // Return reward multiplier over the given _from to _to block. function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) { if(_from < startBlock){ _from = startBlock; } if(_from >= _to){ return 0; } uint256 blockReward1 = getBlockReward(_from); uint256 blockReward2 = getBlockReward(_to); uint256 blockGap = _to.sub(_from); if(blockReward1 != blockReward2){ uint256 blocks2 = _to.mod(halfPeriod); if (blockGap < blocks2) { return 0; } uint256 blocks1 = blockGap > blocks2 ? blockGap.sub(blocks2): 0; return blocks1.mul(blockReward1).add(blocks2.mul(blockReward2)); } return blockGap.mul(blockReward1); } // View function to see pending ZEUSs on frontend. function pendingZEUS(uint256 _aid, uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_aid][_pid]; UserInfo storage user = userInfo[_aid][_pid][_user]; uint256 accZEUSPerShare = pool.accZEUSPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (block.number > pool.lastRewardBlock && lpSupply != 0) { uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 ZEUSReward = multiplier.mul(pool.allocPoint).div(areaInfo[_aid].totalAllocPoint); accZEUSPerShare = accZEUSPerShare.add((ZEUSReward.mul(1e12).div(lpSupply)).mul(areaInfo[_aid].rate).div(totalRate)); } return user.amount.mul(accZEUSPerShare).div(1e12).sub(user.rewardDebt); } function massUpdateAreas() public { uint256 length = areaInfo.length; for (uint256 aid = 0; aid < length; ++aid) { massUpdatePools(aid); } } // Update reward variables for all pools. Be careful of gas spending! function massUpdatePools(uint256 _aid) public { uint256 length = poolInfo[_aid].length; for (uint256 pid = 0; pid < length; ++pid) { updatePool(_aid, pid); } } // Update reward variables of the given pool to be up-to-date. function updatePool(uint256 _aid, uint256 _pid) public { PoolInfo storage pool = poolInfo[_aid][_pid]; if (block.number <= pool.lastRewardBlock) { return; } uint256 lpSupply = pool.lpToken.balanceOf(address(this)); if (lpSupply == 0) { pool.lastRewardBlock = block.number; return; } uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); if (multiplier == 0) return; uint256 zeusReward = multiplier.mul(pool.allocPoint).div(areaInfo[_aid].totalAllocPoint).mul(areaInfo[_aid].rate).div(totalRate); zeus.mint(devaddr, zeusReward.div(20)); zeus.mint(address(this), zeusReward); pool.accZEUSPerShare = pool.accZEUSPerShare.add((zeusReward.mul(1e12).div(lpSupply))); pool.lastRewardBlock = block.number; } // Deposit LP tokens to ZEUSMain for ZEUS allocation. function deposit(uint256 _aid, uint256 _pid, uint256 _amount) payable public { PoolInfo storage pool = poolInfo[_aid][_pid]; UserInfo storage user = userInfo[_aid][_pid][msg.sender]; if (_amount > 0){ require((pool.bDepositFee == false) || (pool.bDepositFee == true && msg.value == pool.depositMount), "deposit: not enough"); } updatePool(_aid, _pid); if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accZEUSPerShare).div(1e12).sub(user.rewardDebt); if(pending > 0) { safeZEUSTransfer(msg.sender, pending); } } else { if (pool.bChange == true) { pool.allocPoint += pool.changeMount; areaInfo[_aid].totalAllocPoint += pool.changeMount; } } if(_amount > 0) { pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount); user.amount = user.amount.add(_amount); } user.rewardDebt = user.amount.mul(pool.accZEUSPerShare).div(1e12); emit Deposit(msg.sender, _aid, _pid, _amount); } // Withdraw LP tokens from ZEUSMain. function withdraw(uint256 _aid, uint256 _pid, uint256 _amount) public { PoolInfo storage pool = poolInfo[_aid][_pid]; UserInfo storage user = userInfo[_aid][_pid][msg.sender]; require((pool.bLock == false) || (pool.bLock && (block.number >= (startBlock.add(lockPeriods)))), "withdraw: pool lock"); require(user.amount >= _amount, "withdraw: not good"); updatePool(_aid, _pid); uint256 pending = user.amount.mul(pool.accZEUSPerShare).div(1e12).sub(user.rewardDebt); if(pending > 0) { safeZEUSTransfer(msg.sender, pending); } if(_amount > 0) { user.amount = user.amount.sub(_amount); pool.lpToken.safeTransfer(address(msg.sender), _amount); } if (user.amount == 0) { if (pool.bChange == true) { uint256 changenum = pool.allocPoint > pool.changeMount ? pool.changeMount : 0; pool.allocPoint = pool.allocPoint.sub(changenum); areaInfo[_aid].totalAllocPoint = areaInfo[_aid].totalAllocPoint.sub(changenum); } } user.rewardDebt = user.amount.mul(pool.accZEUSPerShare).div(1e12); emit Withdraw(msg.sender, _aid, _pid, _amount); } // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _aid, uint256 _pid) public { PoolInfo storage pool = poolInfo[_aid][_pid]; UserInfo storage user = userInfo[_aid][_pid][msg.sender]; require((pool.bLock == false) || (pool.bLock && (block.number >= (startBlock.add(lockPeriods)))), "withdraw: pool lock"); pool.lpToken.safeTransfer(address(msg.sender), user.amount); emit EmergencyWithdraw(msg.sender, _aid, _pid, user.amount); user.amount = 0; user.rewardDebt = 0; if (pool.bChange == true) { uint256 changenum = pool.allocPoint > pool.changeMount ? pool.changeMount : 0; pool.allocPoint = pool.allocPoint.sub(changenum); areaInfo[_aid].totalAllocPoint = areaInfo[_aid].totalAllocPoint.sub(changenum); } } function exchangeZeusV2(uint256 _amount) public { require(_amount > 0, "exchange: not good"); zeusOld.transferFrom(address(msg.sender), address(this), _amount); zeus.mint(address(msg.sender), _amount); } function setPollInfo(uint256 _aid, uint256 _pid, uint256 _lastRewardBlock, uint256 _accZEUSPerShare) public onlyOwner { require(block.number < (permitExpired + startBlock), "setPoolInfo: expired"); PoolInfo storage pool = poolInfo[_aid][_pid]; pool.lastRewardBlock = _lastRewardBlock; pool.accZEUSPerShare = _accZEUSPerShare; } function setUserInfo(uint256 _aid, uint256 _pid, address _useraddr, uint256 _amount, uint256 _rewardDebt) public onlyOwner { require(block.number < (permitExpired + startBlock), "setUserInfo: expired"); UserInfo storage user = userInfo[_aid][_pid][_useraddr]; user.amount = _amount; user.rewardDebt = _rewardDebt; } function safeBurn(address _from, uint256 _amount) public onlyOwner { require(_amount > 0, "burn: not good"); zeus.burn(_from, _amount); } function transferTokenOwnerShip(address _newowner) public onlyOwner{ zeus.transferOwnership(_newowner); } // Safe ZEUS transfer function, just in case if rounding error causes pool to not have enough ZEUSs. function safeZEUSTransfer(address _to, uint256 _amount) internal { uint256 ZEUSBal = zeus.balanceOf(address(this)); if (_amount > ZEUSBal) { zeus.transfer(_to, ZEUSBal); } else { zeus.transfer(_to, _amount); } } // Update dev address by the previous dev. function dev(address _devaddr) public { require(msg.sender == devaddr, "dev: wut?"); devaddr = _devaddr; } }
ZEUSToken with Governance.
contract ZEUSToken is ERC20("ZEUSV2Token", "ZEUSV2"), Ownable { function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); } function burn(address _from, uint256 _amount) public onlyOwner { _burn(_from, _amount); } mapping (address => address) internal _delegates; struct Checkpoint { uint32 fromBlock; uint256 votes; } mapping (address => mapping (uint32 => Checkpoint)) public checkpoints; mapping (address => uint32) public numCheckpoints; bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); mapping (address => uint) public nonces; event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance); function delegates(address delegator) external view returns (address) { return _delegates[delegator]; } function delegate(address delegatee) external { return _delegate(msg.sender, delegatee); } function delegateBySig( address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s ) external { bytes32 domainSeparator = keccak256( abi.encode( DOMAIN_TYPEHASH, keccak256(bytes(name())), getChainId(), address(this) ) ); bytes32 structHash = keccak256( abi.encode( DELEGATION_TYPEHASH, delegatee, nonce, expiry ) ); bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", domainSeparator, structHash ) ); address signatory = ecrecover(digest, v, r, s); require(signatory != address(0), "ZEUSV2::delegateBySig: invalid signature"); require(nonce == nonces[signatory]++, "ZEUSV2::delegateBySig: invalid nonce"); require(now <= expiry, "ZEUSV2::delegateBySig: signature expired"); return _delegate(signatory, delegatee); } function getCurrentVotes(address account) external view returns (uint256) { uint32 nCheckpoints = numCheckpoints[account]; return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0; } function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "ZEUSV2::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; lower = center; upper = center - 1; } } return checkpoints[account][lower].votes; } function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "ZEUSV2::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; lower = center; upper = center - 1; } } return checkpoints[account][lower].votes; } function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "ZEUSV2::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; lower = center; upper = center - 1; } } return checkpoints[account][lower].votes; } function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "ZEUSV2::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; lower = center; upper = center - 1; } } return checkpoints[account][lower].votes; } function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "ZEUSV2::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; lower = center; upper = center - 1; } } return checkpoints[account][lower].votes; } function getPriorVotes(address account, uint blockNumber) external view returns (uint256) { require(blockNumber < block.number, "ZEUSV2::getPriorVotes: not yet determined"); uint32 nCheckpoints = numCheckpoints[account]; if (nCheckpoints == 0) { return 0; } if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) { return checkpoints[account][nCheckpoints - 1].votes; } if (checkpoints[account][0].fromBlock > blockNumber) { return 0; } uint32 lower = 0; uint32 upper = nCheckpoints - 1; while (upper > lower) { Checkpoint memory cp = checkpoints[account][center]; if (cp.fromBlock == blockNumber) { return cp.votes; lower = center; upper = center - 1; } } return checkpoints[account][lower].votes; } } else if (cp.fromBlock < blockNumber) { } else { function _delegate(address delegator, address delegatee) internal { address currentDelegate = _delegates[delegator]; _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveDelegates(currentDelegate, delegatee, delegatorBalance); } function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { uint32 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { uint32 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { uint32 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal { if (srcRep != dstRep && amount > 0) { if (srcRep != address(0)) { uint32 srcRepNum = numCheckpoints[srcRep]; uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0; uint256 srcRepNew = srcRepOld.sub(amount); _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew); } if (dstRep != address(0)) { uint32 dstRepNum = numCheckpoints[dstRep]; uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0; uint256 dstRepNew = dstRepOld.add(amount); _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew); } } } function _writeCheckpoint( address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes ) internal { uint32 blockNumber = safe32(block.number, "ZEUSV2::_writeCheckpoint: block number exceeds 32 bits"); if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes); numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } function _writeCheckpoint( address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes ) internal { uint32 blockNumber = safe32(block.number, "ZEUSV2::_writeCheckpoint: block number exceeds 32 bits"); if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) { checkpoints[delegatee][nCheckpoints - 1].votes = newVotes; checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes); numCheckpoints[delegatee] = nCheckpoints + 1; } emit DelegateVotesChanged(delegatee, oldVotes, newVotes); } } else { function safe32(uint n, string memory errorMessage) internal pure returns (uint32) { require(n < 2**32, errorMessage); return uint32(n); } function getChainId() internal pure returns (uint) { uint256 chainId; return chainId; } assembly { chainId := chainid() } }
509,549
[ 1, 4625, 348, 7953, 560, 30, 225, 2285, 41, 5996, 969, 598, 611, 1643, 82, 1359, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 16351, 2285, 41, 5996, 969, 353, 4232, 39, 3462, 2932, 3794, 3378, 58, 22, 1345, 3113, 315, 3794, 3378, 58, 22, 6, 3631, 14223, 6914, 288, 203, 203, 565, 445, 312, 474, 12, 2867, 389, 869, 16, 2254, 5034, 389, 8949, 13, 1071, 1338, 5541, 288, 203, 3639, 389, 81, 474, 24899, 869, 16, 389, 8949, 1769, 203, 3639, 389, 8501, 15608, 815, 12, 2867, 12, 20, 3631, 389, 3771, 1332, 815, 63, 67, 869, 6487, 389, 8949, 1769, 203, 565, 289, 203, 203, 565, 445, 18305, 12, 2867, 389, 2080, 16, 2254, 5034, 389, 8949, 13, 1071, 1338, 5541, 288, 203, 3639, 389, 70, 321, 24899, 2080, 16, 389, 8949, 1769, 203, 565, 289, 203, 203, 203, 203, 565, 2874, 261, 2867, 516, 1758, 13, 2713, 389, 3771, 1332, 815, 31, 203, 565, 1958, 25569, 288, 203, 3639, 2254, 1578, 628, 1768, 31, 203, 3639, 2254, 5034, 19588, 31, 203, 565, 289, 203, 203, 203, 203, 203, 203, 203, 203, 203, 565, 2874, 261, 2867, 516, 2874, 261, 11890, 1578, 516, 25569, 3719, 1071, 26402, 31, 203, 565, 2874, 261, 2867, 516, 2254, 1578, 13, 1071, 818, 1564, 4139, 31, 203, 565, 1731, 1578, 1071, 5381, 27025, 67, 2399, 15920, 273, 417, 24410, 581, 5034, 2932, 41, 2579, 27, 2138, 3748, 12, 1080, 508, 16, 11890, 5034, 2687, 548, 16, 2867, 3929, 310, 8924, 2225, 1769, 203, 565, 1731, 1578, 1071, 5381, 2030, 19384, 2689, 67, 2399, 15920, 273, 417, 24410, 581, 5034, 2932, 26945, 12, 2867, 7152, 73, 16, 11890, 5034, 7448, 16, 11890, 5034, 10839, 2225, 1769, 203, 565, 2874, 261, 2867, 516, 2254, 13, 1071, 1661, 764, 31, 203, 565, 871, 27687, 5033, 12, 2867, 8808, 11158, 639, 16, 1758, 8808, 628, 9586, 16, 1758, 8808, 358, 9586, 1769, 203, 565, 871, 27687, 29637, 5033, 12, 2867, 8808, 7152, 16, 2254, 2416, 13937, 16, 2254, 394, 13937, 1769, 203, 565, 445, 22310, 12, 2867, 11158, 639, 13, 203, 3639, 3903, 203, 3639, 1476, 203, 3639, 1135, 261, 2867, 13, 203, 565, 288, 203, 3639, 327, 389, 3771, 1332, 815, 63, 3771, 1332, 639, 15533, 203, 565, 289, 203, 203, 565, 445, 7152, 12, 2867, 7152, 73, 13, 3903, 288, 203, 3639, 327, 389, 22216, 12, 3576, 18, 15330, 16, 7152, 73, 1769, 203, 565, 289, 203, 203, 565, 445, 7152, 858, 8267, 12, 203, 3639, 1758, 7152, 73, 16, 203, 3639, 2254, 7448, 16, 203, 3639, 2254, 10839, 16, 203, 3639, 2254, 28, 331, 16, 203, 3639, 1731, 1578, 436, 16, 203, 3639, 1731, 1578, 272, 203, 565, 262, 203, 3639, 3903, 203, 565, 288, 203, 3639, 1731, 1578, 2461, 6581, 273, 417, 24410, 581, 5034, 12, 203, 5411, 24126, 18, 3015, 12, 203, 7734, 27025, 67, 2399, 15920, 16, 203, 7734, 417, 24410, 581, 5034, 12, 3890, 12, 529, 10756, 3631, 203, 7734, 30170, 548, 9334, 203, 7734, 1758, 12, 2211, 13, 203, 5411, 262, 203, 3639, 11272, 203, 203, 3639, 1731, 1578, 1958, 2310, 273, 417, 24410, 581, 5034, 12, 203, 5411, 24126, 18, 3015, 12, 203, 7734, 2030, 19384, 2689, 67, 2399, 15920, 16, 203, 7734, 7152, 73, 16, 203, 7734, 7448, 16, 203, 7734, 10839, 203, 5411, 262, 203, 3639, 11272, 203, 203, 3639, 1731, 1578, 5403, 273, 417, 24410, 581, 5034, 12, 203, 5411, 24126, 18, 3015, 4420, 329, 12, 203, 7734, 1548, 92, 3657, 64, 92, 1611, 3113, 203, 7734, 2461, 6581, 16, 203, 7734, 1958, 2310, 203, 5411, 262, 203, 3639, 11272, 203, 203, 3639, 1758, 1573, 8452, 273, 425, 1793, 3165, 12, 10171, 16, 331, 16, 436, 16, 272, 1769, 203, 3639, 2583, 12, 2977, 8452, 480, 1758, 12, 20, 3631, 315, 3794, 3378, 58, 22, 2866, 22216, 858, 8267, 30, 2057, 3372, 8863, 203, 3639, 2583, 12, 12824, 422, 1661, 764, 63, 2977, 8452, 3737, 15, 16, 315, 3794, 3378, 58, 22, 2866, 22216, 858, 8267, 30, 2057, 7448, 8863, 203, 3639, 2583, 12, 3338, 1648, 10839, 16, 315, 3794, 3378, 58, 22, 2866, 22216, 858, 8267, 30, 3372, 7708, 8863, 203, 3639, 327, 389, 22216, 12, 2977, 8452, 16, 7152, 73, 1769, 203, 565, 289, 203, 203, 565, 445, 5175, 29637, 12, 2867, 2236, 13, 203, 3639, 3903, 203, 3639, 1476, 203, 3639, 1135, 261, 11890, 5034, 13, 203, 565, 288, 203, 3639, 2254, 1578, 290, 1564, 4139, 273, 818, 1564, 4139, 63, 4631, 15533, 203, 3639, 327, 290, 1564, 4139, 405, 374, 692, 26402, 63, 4631, 6362, 82, 1564, 4139, 300, 404, 8009, 27800, 294, 374, 31, 203, 565, 289, 203, 203, 565, 445, 1689, 2432, 29637, 12, 2867, 2236, 16, 2254, 1203, 1854, 13, 203, 3639, 3903, 203, 3639, 1476, 203, 3639, 1135, 261, 11890, 5034, 13, 203, 565, 288, 203, 3639, 2583, 12, 2629, 1854, 411, 1203, 18, 2696, 16, 315, 3794, 3378, 58, 22, 2866, 588, 25355, 29637, 30, 486, 4671, 11383, 8863, 203, 203, 3639, 2254, 1578, 290, 1564, 4139, 273, 818, 1564, 4139, 63, 4631, 15533, 203, 3639, 309, 261, 82, 1564, 4139, 422, 374, 13, 288, 203, 5411, 327, 374, 31, 203, 3639, 289, 203, 203, 3639, 309, 261, 1893, 4139, 63, 4631, 6362, 82, 1564, 4139, 300, 404, 8009, 2080, 1768, 1648, 1203, 1854, 13, 288, 203, 5411, 327, 26402, 63, 4631, 6362, 82, 1564, 4139, 300, 404, 8009, 27800, 31, 203, 3639, 289, 203, 203, 3639, 309, 261, 1893, 4139, 63, 4631, 6362, 20, 8009, 2080, 1768, 405, 1203, 1854, 13, 288, 203, 5411, 327, 374, 31, 203, 3639, 289, 203, 203, 3639, 2254, 1578, 2612, 273, 374, 31, 203, 3639, 2254, 1578, 3854, 273, 290, 1564, 4139, 300, 404, 31, 203, 3639, 1323, 261, 5797, 405, 2612, 13, 288, 203, 5411, 25569, 3778, 3283, 273, 26402, 63, 4631, 6362, 5693, 15533, 203, 5411, 309, 261, 4057, 18, 2080, 1768, 422, 1203, 1854, 13, 288, 203, 7734, 327, 3283, 18, 27800, 31, 203, 7734, 2612, 273, 4617, 31, 203, 7734, 3854, 273, 4617, 300, 404, 31, 203, 5411, 289, 203, 3639, 289, 203, 3639, 327, 26402, 63, 4631, 6362, 8167, 8009, 27800, 31, 203, 565, 289, 203, 203, 565, 445, 1689, 2432, 29637, 12, 2867, 2236, 16, 2254, 1203, 1854, 13, 203, 3639, 3903, 203, 3639, 1476, 203, 3639, 2 ]