file_name
stringlengths
71
779k
comments
stringlengths
20
182k
code_string
stringlengths
20
36.9M
__index_level_0__
int64
0
17.2M
input_ids
list
attention_mask
list
labels
list
pragma solidity 0.5.17; import "./api/IBondedECDSAKeepVendor.sol"; import "@keep-network/keep-core/contracts/KeepRegistry.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; /// @title Bonded ECDSA Keep Vendor /// @notice The contract is used to obtain a new Bonded ECDSA keep factory. contract BondedECDSAKeepVendorImplV1 is IBondedECDSAKeepVendor { using SafeMath for uint256; // Mapping to store new implementation versions that inherit from // this contract. mapping(string => bool) internal _initialized; // KeepRegistry contract with a list of approved factories (operator contracts) // and upgraders. KeepRegistry internal registry; // Upgrade time delay defines a waiting period for factory address upgrade. // When new factory upgrade is initialized it has to wait this period // before the change can take effect on the currently registered facotry // address. uint256 public factoryUpgradeTimeDelay; // Address of ECDSA keep factory. address payable keepFactory; // Address of a new ECDSA keep factory in update process. address payable newKeepFactory; // Timestamp of the moment when factory upgrade process has started. uint256 factoryUpgradeInitiatedTimestamp; event FactoryUpgradeStarted(address factory, uint256 timestamp); event FactoryUpgradeCompleted(address factory); constructor() public { // Mark as already initialized to block the direct usage of the contract // after deployment. The contract is intended to be called via proxy, so // setting this value will not affect the clones usage. _initialized["BondedECDSAKeepVendorImplV1"] = true; } /// @notice Initializes Keep Vendor contract implementation. /// @param registryAddress Keep registry contract linked to this contract. /// @param factory Keep factory contract registered initially in the vendor /// contract. function initialize(address registryAddress, address payable factory) public { require(registryAddress != address(0), "Incorrect registry address"); require(factory != address(0), "Incorrect factory address"); require(!initialized(), "Contract is already initialized."); _initialized["BondedECDSAKeepVendorImplV1"] = true; registry = KeepRegistry(registryAddress); keepFactory = factory; factoryUpgradeTimeDelay = 1 days; } /// @notice Checks if this contract is initialized. function initialized() public view returns (bool) { return _initialized["BondedECDSAKeepVendorImplV1"]; } /// @notice Starts new ECDSA keep factory upgrade. /// @dev Registers a new ECDSA keep factory. Address cannot be zero /// and cannot be the same that is currently registered. It is a first part /// of the two-step factory upgrade process. The function emits an event /// containing the new factory address and current block timestamp. /// @param _factory ECDSA keep factory address. function upgradeFactory(address payable _factory) public onlyOperatorContractUpgrader { require(_factory != address(0), "Incorrect factory address"); if (isUpgradeInitiated()) { require( newKeepFactory != _factory, "Factory upgrade already initiated" ); } else { require(keepFactory != _factory, "Factory already registered"); } require( registry.isApprovedOperatorContract(_factory), "Factory contract is not approved" ); newKeepFactory = _factory; /* solium-disable-next-line security/no-block-members */ uint256 timestamp = block.timestamp; factoryUpgradeInitiatedTimestamp = timestamp; emit FactoryUpgradeStarted(_factory, timestamp); } /// @notice Finalizes ECDSA keep factory upgrade. /// @dev It is the second part of the two-step factory upgrade process. /// The function can be called after factory upgrade time delay period /// has passed since the new factory upgrade. It emits an event /// containing the new factory address. function completeFactoryUpgrade() public { require(isUpgradeInitiated(), "Upgrade not initiated"); require( /* solium-disable-next-line security/no-block-members */ block.timestamp.sub(factoryUpgradeInitiatedTimestamp) >= factoryUpgradeTimeDelay, "Timer not elapsed" ); keepFactory = newKeepFactory; newKeepFactory = address(0); factoryUpgradeInitiatedTimestamp = 0; emit FactoryUpgradeCompleted(keepFactory); } /// @notice Selects the latest ECDSA keep factory. /// @return ECDSA keep factory address. function selectFactory() public view returns (address payable) { require(keepFactory != address(0), "Keep factory is not registered"); return keepFactory; } function isUpgradeInitiated() internal view returns (bool) { return factoryUpgradeInitiatedTimestamp > 0; } /// @dev Throws if called by any account other than the operator contract /// upgrader authorized for this service contract. modifier onlyOperatorContractUpgrader() { require( address(registry) != address(0), "KeepRegistry address is not registered" ); address operatorContractUpgrader = registry.operatorContractUpgraderFor( address(this) ); require( operatorContractUpgrader == msg.sender, "Caller is not operator contract upgrader" ); _; } }
@notice Initializes Keep Vendor contract implementation. @param registryAddress Keep registry contract linked to this contract. @param factory Keep factory contract registered initially in the vendor contract.
function initialize(address registryAddress, address payable factory) public { require(registryAddress != address(0), "Incorrect registry address"); require(factory != address(0), "Incorrect factory address"); require(!initialized(), "Contract is already initialized."); _initialized["BondedECDSAKeepVendorImplV1"] = true; registry = KeepRegistry(registryAddress); keepFactory = factory; factoryUpgradeTimeDelay = 1 days; }
6,364,659
[ 1, 9685, 10498, 776, 5227, 6835, 4471, 18, 225, 4023, 1887, 10498, 4023, 6835, 8459, 358, 333, 6835, 18, 225, 3272, 10498, 3272, 6835, 4104, 22458, 316, 326, 8556, 6835, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 4046, 12, 2867, 4023, 1887, 16, 1758, 8843, 429, 3272, 13, 203, 3639, 1071, 203, 565, 288, 203, 3639, 2583, 12, 9893, 1887, 480, 1758, 12, 20, 3631, 315, 16268, 4023, 1758, 8863, 203, 3639, 2583, 12, 6848, 480, 1758, 12, 20, 3631, 315, 16268, 3272, 1758, 8863, 203, 203, 3639, 2583, 12, 5, 13227, 9334, 315, 8924, 353, 1818, 6454, 1199, 1769, 203, 3639, 389, 13227, 9614, 38, 265, 785, 7228, 19748, 11523, 14786, 2828, 58, 21, 11929, 273, 638, 31, 203, 203, 3639, 4023, 273, 10498, 4243, 12, 9893, 1887, 1769, 203, 3639, 3455, 1733, 273, 3272, 31, 203, 203, 3639, 3272, 10784, 950, 6763, 273, 404, 4681, 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 ]
./full_match/43113/0x093e86EA52C3bb00f172575b9cE7695C621956BA/sources/D_buy.sol
购买装备 一手交钱 admin.transfer(num); 一手交货
function buy() public payable returns (uint256) { return admin.balance; }
13,180,485
[ 1, 169, 117, 260, 165, 122, 113, 169, 101, 232, 166, 102, 234, 225, 165, 121, 227, 167, 236, 238, 165, 123, 102, 170, 245, 114, 3981, 18, 13866, 12, 2107, 1769, 225, 165, 121, 227, 167, 236, 238, 165, 123, 102, 169, 117, 105, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 30143, 1435, 1071, 8843, 429, 1135, 261, 11890, 5034, 13, 288, 203, 3639, 327, 3981, 18, 12296, 31, 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 ]
./full_match/8453/0xa05fAAF51546fB595ad937808DA76fb715F95Bf4/sources/contracts/universal/StandardBridge.sol
@notice Sends ERC20 tokens to a receiver's address on the other chain. Note that if the ERC20 token on the other chain does not recognize the local token as the correct pair token, the ERC20 bridge will fail and the tokens will be returned to sender on this chain. @param _localToken Address of the ERC20 on this chain. @param _remoteToken Address of the corresponding token on the remote chain. @param _to Address of the receiver. @param _amount Amount of local tokens to deposit. @param _minGasLimit Minimum amount of gas that the bridge can be relayed with. @param _extraData Extra data to be sent with the transaction. Note that the recipient will not be triggered with this data, but it will be emitted and can be used to identify the transaction.
function bridgeERC20To( address _localToken, address _remoteToken, address _to, uint256 _amount, uint32 _minGasLimit, bytes calldata _extraData ) public virtual { _initiateBridgeERC20(_localToken, _remoteToken, msg.sender, _to, _amount, _minGasLimit, _extraData); }
11,542,983
[ 1, 10501, 4232, 39, 3462, 2430, 358, 279, 5971, 1807, 1758, 603, 326, 1308, 2687, 18, 3609, 716, 309, 326, 540, 4232, 39, 3462, 1147, 603, 326, 1308, 2687, 1552, 486, 21431, 326, 1191, 1147, 487, 326, 3434, 540, 3082, 1147, 16, 326, 4232, 39, 3462, 10105, 903, 2321, 471, 326, 2430, 903, 506, 2106, 358, 5793, 603, 540, 333, 2687, 18, 225, 389, 3729, 1345, 225, 5267, 434, 326, 4232, 39, 3462, 603, 333, 2687, 18, 225, 389, 7222, 1345, 5267, 434, 326, 4656, 1147, 603, 326, 2632, 2687, 18, 225, 389, 869, 1850, 5267, 434, 326, 5971, 18, 225, 389, 8949, 1377, 16811, 434, 1191, 2430, 358, 443, 1724, 18, 225, 389, 1154, 27998, 3039, 23456, 3844, 434, 16189, 716, 326, 10105, 848, 506, 18874, 329, 598, 18, 225, 389, 7763, 751, 282, 13592, 501, 358, 506, 3271, 598, 326, 2492, 18, 3609, 716, 326, 8027, 903, 2 ]
[ 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, 225, 445, 10105, 654, 39, 3462, 774, 12, 203, 565, 1758, 389, 3729, 1345, 16, 203, 565, 1758, 389, 7222, 1345, 16, 203, 565, 1758, 389, 869, 16, 203, 565, 2254, 5034, 389, 8949, 16, 203, 565, 2254, 1578, 389, 1154, 27998, 3039, 16, 203, 565, 1731, 745, 892, 389, 7763, 751, 203, 225, 262, 1071, 5024, 288, 203, 565, 389, 2738, 3840, 13691, 654, 39, 3462, 24899, 3729, 1345, 16, 389, 7222, 1345, 16, 1234, 18, 15330, 16, 389, 869, 16, 389, 8949, 16, 389, 1154, 27998, 3039, 16, 389, 7763, 751, 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 ]
pragma solidity ^0.4.24; /** * @title TavernQuestRewardTest */ contract TavernQuestRewardTest { // Validates the parameters for a new quest function validateQuest(address _tavern, address _creator, string _name, string _hint, uint _maxWinners, bytes32 _merkleRoot, string _merkleBody, string _metadata, uint _prize) public returns (bool) { return true; } // Mint reward function rewardCompletion(address _tavern, address _winner, uint _questIndex) public returns (bool) { return true; } }
* @title TavernQuestRewardTest/ Validates the parameters for a new quest
contract TavernQuestRewardTest { function validateQuest(address _tavern, address _creator, string _name, string _hint, uint _maxWinners, bytes32 _merkleRoot, string _merkleBody, string _metadata, uint _prize) public returns (bool) { return true; } function rewardCompletion(address _tavern, address _winner, uint _questIndex) public returns (bool) { return true; } }
14,114,702
[ 1, 56, 21851, 82, 30791, 17631, 1060, 4709, 19, 2364, 815, 326, 1472, 364, 279, 394, 225, 456, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 399, 21851, 82, 30791, 17631, 1060, 4709, 288, 203, 203, 565, 445, 1954, 30791, 12, 2867, 389, 2351, 502, 82, 16, 1758, 389, 20394, 16, 533, 389, 529, 16, 533, 389, 11317, 16, 2254, 389, 1896, 18049, 9646, 16, 1731, 1578, 389, 6592, 15609, 2375, 16, 533, 389, 6592, 15609, 2250, 16, 533, 389, 4165, 16, 2254, 389, 683, 554, 13, 1071, 1135, 261, 6430, 13, 288, 203, 3639, 327, 638, 31, 203, 565, 289, 203, 203, 565, 445, 19890, 11238, 12, 2867, 389, 2351, 502, 82, 16, 1758, 389, 91, 7872, 16, 2254, 389, 456, 1016, 13, 1071, 1135, 261, 6430, 13, 288, 203, 3639, 327, 638, 31, 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 ]
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.4; import "../Constants.sol"; /// @notice Calculate the digest of a node. /// @param left The left child. /// @param right The right child. /// @return digest The node digest. /// @dev More details in https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#binary-merkle-tree // solhint-disable-next-line func-visibility function nodeDigest(bytes32 left, bytes32 right) pure returns (bytes32 digest) { digest = sha256(abi.encodePacked(Constants.NODE_PREFIX, left, right)); } /// @notice Calculate the digest of a leaf. /// @param data The data of the leaf. /// @return digest The leaf digest. /// @dev More details in https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#binary-merkle-tree // solhint-disable-next-line func-visibility function leafDigest(bytes memory data) pure returns (bytes32 digest) { digest = sha256(abi.encodePacked(Constants.LEAF_PREFIX, data)); }
@notice Calculate the digest of a leaf. @param data The data of the leaf. @return digest The leaf digest. @dev More details in https://github.com/celestiaorg/celestia-specs/blob/master/src/specs/data_structures.md#binary-merkle-tree solhint-disable-next-line func-visibility
function leafDigest(bytes memory data) pure returns (bytes32 digest) { digest = sha256(abi.encodePacked(Constants.LEAF_PREFIX, data)); }
5,412,150
[ 1, 8695, 326, 5403, 434, 279, 7839, 18, 225, 501, 1021, 501, 434, 326, 7839, 18, 327, 5403, 1021, 7839, 5403, 18, 225, 16053, 3189, 316, 2333, 2207, 6662, 18, 832, 19, 2183, 395, 1155, 3341, 19, 2183, 395, 1155, 17, 15115, 19, 10721, 19, 7525, 19, 4816, 19, 15115, 19, 892, 67, 27979, 18, 1264, 8578, 17, 6592, 15609, 17, 3413, 3704, 11317, 17, 8394, 17, 4285, 17, 1369, 1326, 17, 14422, 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 ]
[ 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, 0, 0, 0, 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, 915, 7839, 9568, 12, 3890, 3778, 501, 13, 16618, 1135, 261, 3890, 1578, 5403, 13, 288, 203, 565, 5403, 273, 6056, 5034, 12, 21457, 18, 3015, 4420, 329, 12, 2918, 18, 900, 6799, 67, 6307, 16, 501, 10019, 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 ]
// SPDX-License-Identifier: Unlicense pragma solidity >=0.8.4; import "./IERC20.sol"; import "./IERC20Normalizer.sol"; /// @title ERC20Normalizer /// @author Paul Razvan Berg contract ERC20Normalizer is IERC20Normalizer { /// INTERNAL STORAGE /// /// @dev Mapping between ERC-20 tokens and their associated scalars $10^(18 - decimals)$. mapping(IERC20 => uint256) internal scalars; /// CONSTANT FUNCTIONS /// /// @inheritdoc IERC20Normalizer function getScalar(IERC20 token) public view override returns (uint256 scalar) { // Check if we already have a cached scalar for the given token. scalar = scalars[token]; } /// NON-CONSTANT FUNCTIONS /// /// @inheritdoc IERC20Normalizer function computeScalar(IERC20 token) public returns (uint256 scalar) { // Query the ERC-20 contract to obtain the decimals. uint256 decimals = uint256(token.decimals()); // Revert if the token's decimals are zero. if (decimals == 0) { revert IERC20Normalizer__TokenDecimalsZero(token); } // Revert if the token's decimals are greater than 18. if (decimals > 18) { revert IERC20Normalizer__TokenDecimalsGreaterThan18(token, decimals); } // Calculate the scalar. unchecked { scalar = 10**(18 - decimals); } // Save the scalar in storage. scalars[token] = scalar; } /// @inheritdoc IERC20Normalizer function denormalize(IERC20 token, uint256 amount) external returns (uint256 denormalizedAmount) { uint256 scalar = getScalar(token); // If the scalar is zero, it means that this is the first time we encounter this ERC-20 token. We compute // its precision scalar and cache it. if (scalar == 0) { scalar = computeScalar(token); } // Denormalize the amount. It is safe to use unchecked arithmetic because we do not allow tokens with decimals // greater than 18. unchecked { denormalizedAmount = scalar != 1 ? amount / scalar : amount; } } /// @inheritdoc IERC20Normalizer function normalize(IERC20 token, uint256 amount) external returns (uint256 normalizedAmount) { uint256 scalar = getScalar(token); // If the scalar is zero, it means that this is the first time we encounter this ERC-20 token. We need // to compute its precision scalar and cache it. if (scalar == 0) { scalar = computeScalar(token); } // Normalize the amount. We have to use checked arithmetic because the calculation can overflow uint256. normalizedAmount = scalar != 1 ? amount * scalar : amount; } }
INTERNAL STORAGE @dev Mapping between ERC-20 tokens and their associated scalars $10^(18 - decimals)$. CONSTANT FUNCTIONS @inheritdoc IERC20Normalizer Check if we already have a cached scalar for the given token.
function getScalar(IERC20 token) public view override returns (uint256 scalar) { scalar = scalars[token]; }
12,697,473
[ 1, 14005, 2347, 15553, 282, 9408, 3086, 4232, 39, 17, 3462, 2430, 471, 3675, 3627, 23743, 271, 2163, 29020, 2643, 300, 15105, 21877, 18, 24023, 13690, 55, 225, 632, 10093, 467, 654, 39, 3462, 16132, 2073, 309, 732, 1818, 1240, 279, 3472, 4981, 364, 326, 864, 1147, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1322, 3473, 12, 45, 654, 39, 3462, 1147, 13, 1071, 1476, 3849, 1135, 261, 11890, 5034, 4981, 13, 288, 203, 3639, 4981, 273, 23743, 63, 2316, 15533, 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 ]
./partial_match/1/0xe904e50514C5EF0f4C15C9BA44D358eD38f5a024/sources/Governance.sol
* @notice Apply the updating incentive proposal if admitted./
function applyGovernanceForUpdateIncentive(bytes32 proposeId) external override { require(_proposeStatus[proposeId].lockin = true, "the proposal is not locked in"); require( _proposeStatus[proposeId].applied == false, "the proposal has been already applied" ); require( _proposeStatus[proposeId].mainVoteDeadline <= block.timestamp, "the proposal is still under voting period" ); require( _proposeStatus[proposeId].mainVoteDeadline + _proposeStatus[proposeId].expiration > block.timestamp, "the applicable period of the proposal has expired" ); require( _proposeStatus[proposeId].currentApprovalVoteSum > _proposeStatus[proposeId].currentDenialVoteSum, "the proposal is denied by majority of vote" ); _proposeStatus[proposeId].applied = true; address[] memory incentiveAddresses = _proposeUpdateIncentive[proposeId].incentiveAddresses; uint256[] memory incentiveAllocation = _proposeUpdateIncentive[proposeId] .incentiveAllocation; require( proposeId == _generateUpdateIncentiveProposeId( IncentiveParameters({ incentiveAddresses: incentiveAddresses, incentiveAllocation: incentiveAllocation }) ), "the propose ID is invalid" ); _taxTokenContract.updateIncentiveAddresses(incentiveAddresses, incentiveAllocation); emit LogApprovedProposal(proposeId); }
4,039,300
[ 1, 7001, 326, 9702, 316, 2998, 688, 14708, 309, 1261, 7948, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2230, 43, 1643, 82, 1359, 28431, 382, 2998, 688, 12, 3890, 1578, 450, 4150, 548, 13, 3903, 3849, 288, 203, 3639, 2583, 24899, 685, 4150, 1482, 63, 685, 4150, 548, 8009, 739, 267, 273, 638, 16, 315, 5787, 14708, 353, 486, 8586, 316, 8863, 203, 3639, 2583, 12, 203, 5411, 389, 685, 4150, 1482, 63, 685, 4150, 548, 8009, 438, 3110, 422, 629, 16, 203, 5411, 315, 5787, 14708, 711, 2118, 1818, 6754, 6, 203, 3639, 11272, 203, 3639, 2583, 12, 203, 5411, 389, 685, 4150, 1482, 63, 685, 4150, 548, 8009, 5254, 19338, 15839, 1648, 1203, 18, 5508, 16, 203, 5411, 315, 5787, 14708, 353, 4859, 3613, 331, 17128, 3879, 6, 203, 3639, 11272, 203, 3639, 2583, 12, 203, 5411, 389, 685, 4150, 1482, 63, 685, 4150, 548, 8009, 5254, 19338, 15839, 397, 389, 685, 4150, 1482, 63, 685, 4150, 548, 8009, 19519, 405, 203, 7734, 1203, 18, 5508, 16, 203, 5411, 315, 5787, 12008, 3879, 434, 326, 14708, 711, 7708, 6, 203, 3639, 11272, 203, 3639, 2583, 12, 203, 5411, 389, 685, 4150, 1482, 63, 685, 4150, 548, 8009, 2972, 23461, 19338, 3495, 405, 203, 7734, 389, 685, 4150, 1482, 63, 685, 4150, 548, 8009, 2972, 8517, 649, 19338, 3495, 16, 203, 5411, 315, 5787, 14708, 353, 15338, 635, 7888, 560, 434, 12501, 6, 203, 3639, 11272, 203, 3639, 389, 685, 4150, 1482, 63, 685, 4150, 548, 8009, 438, 3110, 273, 638, 31, 203, 203, 3639, 1758, 8526, 3778, 316, 2998, 688, 7148, 273, 389, 685, 4150, 1891, 382, 2998, 2 ]
./full_match/43113/0xa9F243C52B499BBcf77AFa2D2c15EB552993018b/sources/contracts/ploygon_broed.sol
* Mints Bored Apes/ If we haven't set the starting index and this is either 1) the last saleable token or 2) the first token to be sold after the end of pre-sale, set the starting index block
function mintApe(uint numberOfTokens) public payable { for(uint i = 0; i < numberOfTokens; i++) { uint mintIndex = totalSupply(); if (totalSupply() < MAX_APES) { _safeMint(msg.sender, mintIndex); } } if (startingIndexBlock == 0 && (totalSupply() == MAX_APES || block.timestamp >= REVEAL_TIMESTAMP)) { startingIndexBlock = block.number; } }
13,203,669
[ 1, 49, 28142, 605, 7653, 1716, 281, 19, 971, 732, 15032, 1404, 444, 326, 5023, 770, 471, 333, 353, 3344, 404, 13, 326, 1142, 272, 5349, 429, 1147, 578, 576, 13, 326, 1122, 1147, 358, 506, 272, 1673, 1839, 326, 679, 434, 675, 17, 87, 5349, 16, 444, 326, 5023, 770, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 37, 347, 12, 11890, 7922, 5157, 13, 1071, 8843, 429, 288, 203, 203, 3639, 364, 12, 11890, 277, 273, 374, 31, 277, 411, 7922, 5157, 31, 277, 27245, 288, 203, 5411, 2254, 312, 474, 1016, 273, 2078, 3088, 1283, 5621, 203, 5411, 309, 261, 4963, 3088, 1283, 1435, 411, 4552, 67, 37, 1423, 55, 13, 288, 203, 7734, 389, 4626, 49, 474, 12, 3576, 18, 15330, 16, 312, 474, 1016, 1769, 203, 5411, 289, 203, 3639, 289, 203, 203, 3639, 309, 261, 18526, 1016, 1768, 422, 374, 597, 261, 4963, 3088, 1283, 1435, 422, 4552, 67, 37, 1423, 55, 747, 1203, 18, 5508, 1545, 2438, 3412, 1013, 67, 17201, 3719, 288, 203, 5411, 5023, 1016, 1768, 273, 1203, 18, 2696, 31, 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 ]
./full_match/1/0xE90cC7d807712b2b41632f3900c8bd19BdC502b1/sources/src/Kuma.sol
* All minted tokens are used for providing liquidity./
function mintLiquidity() external onlyRole(LIQUIDITY_ROLE) { if (!liquidityMinted) { liquidityMinted = true; super._mint(_msgSender(), LIQUIDITY_SUPPLY); } }
8,324,798
[ 1, 1595, 312, 474, 329, 2430, 854, 1399, 364, 17721, 4501, 372, 24237, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 48, 18988, 24237, 1435, 3903, 1338, 2996, 12, 2053, 53, 3060, 4107, 67, 16256, 13, 288, 203, 3639, 309, 16051, 549, 372, 24237, 49, 474, 329, 13, 288, 203, 5411, 4501, 372, 24237, 49, 474, 329, 273, 638, 31, 203, 5411, 2240, 6315, 81, 474, 24899, 3576, 12021, 9334, 8961, 53, 3060, 4107, 67, 13272, 23893, 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 ]
./full_match/1/0x9831aCe282a2dCd067e68b26E4c454C0A4774284/sources/contracts/timelock.sol
* @param _target Address of contract or account to call @param _value Amount of ETH to send @param _func Function signature, for example "foo(address,uint256)" @param _data ABI encoded data send. @param _timestamp Timestamp after which the transaction can be executed./
function queue( address _target, uint _value, string calldata _func, bytes calldata _data, uint _timestamp ) external onlyOwner returns (bytes32 txId) { txId = getTxId(_target, _value, _func, _data, _timestamp); if (queued[txId]) { revert AlreadyQueuedError(txId); } _timestamp < block.timestamp + MIN_DELAY || _timestamp > block.timestamp + MAX_DELAY ) { revert TimestampNotInRangeError(block.timestamp, _timestamp); } queued[txId] = true; emit Queue(txId, _target, _value, _func, _data, _timestamp); }
8,477,419
[ 1, 67, 3299, 5267, 434, 6835, 578, 2236, 358, 745, 225, 389, 1132, 16811, 434, 512, 2455, 358, 1366, 225, 389, 644, 4284, 3372, 16, 364, 3454, 315, 11351, 12, 2867, 16, 11890, 5034, 2225, 225, 389, 892, 10336, 45, 3749, 501, 1366, 18, 225, 389, 5508, 8159, 1839, 1492, 326, 2492, 848, 506, 7120, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2389, 12, 203, 3639, 1758, 389, 3299, 16, 203, 3639, 2254, 389, 1132, 16, 203, 3639, 533, 745, 892, 389, 644, 16, 203, 3639, 1731, 745, 892, 389, 892, 16, 203, 3639, 2254, 389, 5508, 203, 565, 262, 3903, 1338, 5541, 1135, 261, 3890, 1578, 2229, 548, 13, 288, 203, 3639, 2229, 548, 273, 3181, 24514, 24899, 3299, 16, 389, 1132, 16, 389, 644, 16, 389, 892, 16, 389, 5508, 1769, 203, 3639, 309, 261, 19499, 63, 978, 548, 5717, 288, 203, 5411, 15226, 17009, 21039, 668, 12, 978, 548, 1769, 203, 3639, 289, 203, 5411, 389, 5508, 411, 1203, 18, 5508, 397, 6989, 67, 26101, 747, 203, 5411, 389, 5508, 405, 1203, 18, 5508, 397, 4552, 67, 26101, 203, 3639, 262, 288, 203, 5411, 15226, 8159, 21855, 2655, 668, 12, 2629, 18, 5508, 16, 389, 5508, 1769, 203, 3639, 289, 203, 203, 3639, 12234, 63, 978, 548, 65, 273, 638, 31, 203, 203, 3639, 3626, 7530, 12, 978, 548, 16, 389, 3299, 16, 389, 1132, 16, 389, 644, 16, 389, 892, 16, 389, 5508, 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 ]
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "./ERC721A.sol"; interface IYieldToken { function burn(address _from, uint256 _amount) external; } contract TroversePlanets is Ownable, ERC721A { using EnumerableSet for EnumerableSet.AddressSet; uint256 public constant TOTAL_PLANETS = 10000; string private _baseTokenURI; IYieldToken public yieldToken; mapping (uint256 => string) private _planetName; mapping (string => bool) private _nameReserved; mapping (uint256 => string) private _planetDescription; uint256 public nameChangePrice = 100 ether; uint256 public descriptionChangePrice = 100 ether; event NameChanged(uint256 planetId, string planetName); event NameCleared(uint256 planetId); event DescriptionChanged(uint256 planetId, string planetDescription); event DescriptionCleared(uint256 planetId); address public minter; bool public isMinterLocked = false; constructor() ERC721A("Troverse Planets", "PLANET") { } modifier callerIsMinter() { require(msg.sender == minter, "The caller is not the minter"); _; } /** * @dev Change the minter address */ function updateMinter(address _minter) external onlyOwner { require(isMinterLocked == false, "Minter ownership renounced"); minter = _minter; } /** * @dev Lock the minter */ function lockMinter() external onlyOwner { isMinterLocked = true; } /** * @dev Set the YieldToken address to be burnt for changing name or description */ function setYieldToken(address yieldTokenAddress) external onlyOwner { yieldToken = IYieldToken(yieldTokenAddress); } /** * @dev Update the price for changing the planet's name */ function updateNameChangePrice(uint256 price) external onlyOwner { nameChangePrice = price; } /** * @dev Update the price for changing the planet's description */ function updateDescriptionChangePrice(uint256 price) external onlyOwner { descriptionChangePrice = price; } /** * @dev Change the name of a planet */ function changeName(uint256 planetId, string memory newName) external { require(_msgSender() == ownerOf(planetId), "Caller is not the owner"); require(validateName(newName) == true, "Not a valid new name"); require(sha256(bytes(newName)) != sha256(bytes(_planetName[planetId])), "New name is same as the current one"); require(isNameReserved(newName) == false, "Name already reserved"); if (bytes(_planetName[planetId]).length > 0) { toggleReserveName(_planetName[planetId], false); } toggleReserveName(newName, true); if (nameChangePrice > 0) { yieldToken.burn(msg.sender, nameChangePrice); } _planetName[planetId] = newName; emit NameChanged(planetId, newName); } /** * @dev Clear the name of a planet */ function clearName(uint256 planetId) external onlyOwner { delete _planetName[planetId]; emit NameCleared(planetId); } /** * @dev Change the description of a planet */ function changeDescription(uint256 planetId, string memory newDescription) external { require(_msgSender() == ownerOf(planetId), "Caller is not the owner"); if (descriptionChangePrice > 0) { yieldToken.burn(msg.sender, descriptionChangePrice); } _planetDescription[planetId] = newDescription; emit DescriptionChanged(planetId, newDescription); } /** * @dev Clear the description of a planet */ function clearDescription(uint256 planetId) external onlyOwner { delete _planetDescription[planetId]; emit DescriptionCleared(planetId); } /** * @dev Change a name reserve state */ function toggleReserveName(string memory name, bool isReserve) internal { _nameReserved[toLower(name)] = isReserve; } /** * @dev Returns name of the planet at index */ function planetNameByIndex(uint256 index) public view returns (string memory) { return _planetName[index]; } /** * @dev Returns description of the planet at index */ function planetDescriptionByIndex(uint256 index) public view returns (string memory) { return _planetDescription[index]; } /** * @dev Returns if the name has been reserved. */ function isNameReserved(string memory nameString) public view returns (bool) { return _nameReserved[toLower(nameString)]; } /** * @dev Validating a name string */ function validateName(string memory newName) public pure returns (bool) { bytes memory b = bytes(newName); if (b.length < 1) return false; if (b.length > 25) return false; // Cannot be longer than 25 characters if (b[0] == 0x20) return false; // Leading space if (b[b.length - 1] == 0x20) return false; // Trailing space bytes1 lastChar = b[0]; for(uint256 i; i < b.length; i++){ bytes1 char = b[i]; if (char == 0x20 && lastChar == 0x20) return false; // Cannot contain continous spaces if( !(char >= 0x30 && char <= 0x39) && //9-0 !(char >= 0x41 && char <= 0x5A) && //A-Z !(char >= 0x61 && char <= 0x7A) && //a-z !(char == 0x20) //space ) return false; lastChar = char; } return true; } /** * @dev Converts a string to lowercase */ function toLower(string memory str) internal pure returns (string memory) { bytes memory bStr = bytes(str); bytes memory bLower = new bytes(bStr.length); for (uint256 i = 0; i < bStr.length; i++) { if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= 90)) { bLower[i] = bytes1(uint8(bStr[i]) + 32); } else { bLower[i] = bStr[i]; } } return string(bLower); } /** * @dev Try to mint NFTs for an address with an external contract */ function Mint(address to, uint256 quantity) external payable callerIsMinter { _safeMint(to, quantity); } /** * @dev See {ERC721A-_baseURI}. */ function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } /** * @dev Set the base URI of the metadata */ function setBaseURI(string calldata baseURI) external onlyOwner { _baseTokenURI = baseURI; } /** * @dev See {ERC721A-_setOwnersExplicit}. */ function setOwnersExplicit(uint256 quantity) external onlyOwner { _setOwnersExplicit(quantity); } /** * @dev Get total mints by an address */ function numberMinted(address owner) external view returns (uint256) { return _numberMinted(owner); } /** * @dev Get ownership info of a planet */ function getOwnershipData(uint256 tokenId) external view returns (address) { return ownershipOf(tokenId); } /** * @dev Return the total supply for external calls. */ function totalSupplyExternal() external view returns (uint256) { return currentIndex; } }
* @dev Returns description of the planet at index/
function planetDescriptionByIndex(uint256 index) public view returns (string memory) { return _planetDescription[index]; }
2,527,612
[ 1, 1356, 2477, 434, 326, 4995, 278, 622, 770, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 4995, 278, 3291, 21268, 12, 11890, 5034, 770, 13, 1071, 1476, 1135, 261, 1080, 3778, 13, 288, 203, 3639, 327, 389, 7088, 278, 3291, 63, 1615, 15533, 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 ]
./partial_match/42/0xAf5d2BC0A47f0aE99b7E7225349e3d5C48F46Fd5/sources/STERegistryV1.sol
* @dev Tells the address of the current implementation @return address of the current implementation/
function implementation() external ifOwner returns(address) { return _implementation(); }
3,412,099
[ 1, 21009, 87, 326, 1758, 434, 326, 783, 4471, 327, 1758, 434, 326, 783, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 4471, 1435, 3903, 309, 5541, 1135, 12, 2867, 13, 288, 203, 3639, 327, 389, 30810, 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 ]
// SPDX-License-Identifier: Apache-2.0 /* * Copyright 2020, Offchain Labs, Inc. * * 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.6.11; import "../../libraries/ITransferAndCall.sol"; import "./L1ArbitrumGateway.sol"; interface ITradeableExitReceiver { function onExitTransfer( address sender, uint256 exitNum, bytes calldata data ) external returns (bool); } abstract contract L1ArbitrumExtendedGateway is L1ArbitrumGateway { struct ExitData { bool isExit; address _newTo; bytes _newData; } mapping(bytes32 => ExitData) public redirectedExits; function _initialize( address _l2Counterpart, address _router, address _inbox ) internal virtual override { L1ArbitrumGateway._initialize(_l2Counterpart, _router, _inbox); } event WithdrawRedirected( address indexed from, address indexed to, uint256 indexed exitNum, bytes newData, bytes data, bool madeExternalCall ); /** * @notice Allows a user to redirect their right to claim a withdrawal to another address. * @dev This method also allows you to make an arbitrary call after the transfer. * This does not validate if the exit was already triggered. It is assumed the `_exitNum` is * validated off-chain to ensure this was not yet triggered. * @param _exitNum Sequentially increasing exit counter determined by the L2 bridge * @param _initialDestination address the L2 withdrawal call initially set as the destination. * @param _newDestination address the L1 will now call instead of the previously set destination * @param _newData data to be used in inboundEscrowAndCall * @param _data optional data for external call upon transfering the exit */ function transferExitAndCall( uint256 _exitNum, address _initialDestination, address _newDestination, bytes calldata _newData, bytes calldata _data ) external { // the initial data doesn't make a difference when transfering you exit // since the L2 bridge gives a unique exit ID to each exit (address expectedSender, ) = getExternalCall(_exitNum, _initialDestination, ""); // if you want to transfer your exit, you must be the current destination require(msg.sender == expectedSender, "NOT_EXPECTED_SENDER"); // the inboundEscrowAndCall functionality has been disabled, so no data is allowed require(_newData.length == 0, "NO_DATA_ALLOWED"); setRedirectedExit(_exitNum, _initialDestination, _newDestination, _newData); if (_data.length > 0) { require(_newDestination.isContract(), "TO_NOT_CONTRACT"); bool success = ITradeableExitReceiver(_newDestination).onExitTransfer( expectedSender, _exitNum, _data ); require(success, "TRANSFER_HOOK_FAIL"); } emit WithdrawRedirected( expectedSender, _newDestination, _exitNum, _newData, _data, _data.length > 0 ); } /// @notice this does not verify if the external call was already done function getExternalCall( uint256 _exitNum, address _initialDestination, bytes memory _initialData ) public view virtual override returns (address target, bytes memory data) { // this function is virtual so that subclasses can override it with custom logic where necessary bytes32 withdrawData = encodeWithdrawal(_exitNum, _initialDestination); ExitData storage exit = redirectedExits[withdrawData]; // here we don't authenticate `_initialData`. we could hash it into `withdrawData` but would increase gas costs // this is safe because if the exit isn't overriden, the _initialData coming from L2 is trusted // but if the exit is traded, all we care about is the latest user calldata if (exit.isExit) { return (exit._newTo, exit._newData); } else { return (_initialDestination, _initialData); } } function setRedirectedExit( uint256 _exitNum, address _initialDestination, address _newDestination, bytes memory _newData ) internal { bytes32 withdrawData = encodeWithdrawal(_exitNum, _initialDestination); redirectedExits[withdrawData] = ExitData(true, _newDestination, _newData); } function encodeWithdrawal(uint256 _exitNum, address _initialDestination) public pure returns (bytes32) { // here we assume the L2 bridge gives a unique exitNum to each exit return keccak256(abi.encode(_exitNum, _initialDestination)); } }
@notice this does not verify if the external call was already done this function is virtual so that subclasses can override it with custom logic where necessary here we don't authenticate `_initialData`. we could hash it into `withdrawData` but would increase gas costs this is safe because if the exit isn't overriden, the _initialData coming from L2 is trusted but if the exit is traded, all we care about is the latest user calldata
function getExternalCall( uint256 _exitNum, address _initialDestination, bytes memory _initialData ) public view virtual override returns (address target, bytes memory data) { bytes32 withdrawData = encodeWithdrawal(_exitNum, _initialDestination); ExitData storage exit = redirectedExits[withdrawData]; if (exit.isExit) { return (exit._newTo, exit._newData); return (_initialDestination, _initialData); } }
945,686
[ 1, 2211, 1552, 486, 3929, 309, 326, 3903, 745, 1703, 1818, 2731, 333, 445, 353, 5024, 1427, 716, 15320, 848, 3849, 518, 598, 1679, 4058, 1625, 4573, 2674, 732, 2727, 1404, 8929, 1375, 67, 6769, 751, 8338, 732, 3377, 1651, 518, 1368, 1375, 1918, 9446, 751, 68, 1496, 4102, 10929, 16189, 22793, 333, 353, 4183, 2724, 309, 326, 2427, 5177, 1404, 31736, 16, 326, 389, 6769, 751, 19283, 628, 511, 22, 353, 13179, 1496, 309, 326, 2427, 353, 1284, 785, 16, 777, 732, 7671, 2973, 353, 326, 4891, 729, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 565, 445, 22319, 1477, 12, 203, 3639, 2254, 5034, 389, 8593, 2578, 16, 203, 3639, 1758, 389, 6769, 5683, 16, 203, 3639, 1731, 3778, 389, 6769, 751, 203, 565, 262, 1071, 1476, 5024, 3849, 1135, 261, 2867, 1018, 16, 1731, 3778, 501, 13, 288, 203, 3639, 1731, 1578, 598, 9446, 751, 273, 2017, 1190, 9446, 287, 24899, 8593, 2578, 16, 389, 6769, 5683, 1769, 203, 3639, 9500, 751, 2502, 2427, 273, 21808, 424, 1282, 63, 1918, 9446, 751, 15533, 203, 203, 3639, 309, 261, 8593, 18, 291, 6767, 13, 288, 203, 5411, 327, 261, 8593, 6315, 2704, 774, 16, 2427, 6315, 2704, 751, 1769, 203, 5411, 327, 261, 67, 6769, 5683, 16, 389, 6769, 751, 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 ]
// Сочетаемость глаголов (и отглагольных частей речи) с предложным // паттерном. // LC->07.08.2018 facts гл_предл language=Russian { arity=3 //violation_score=-5 generic return=boolean } #define ГЛ_ИНФ(v) инфинитив:v{}, глагол:v{} #region Предлог_В // ------------------- С ПРЕДЛОГОМ 'В' --------------------------- #region Предложный // Глаголы и отглагольные части речи, присоединяющие // предложное дополнение с предлогом В и сущ. в предложном падеже. wordentry_set Гл_В_Предл = { rus_verbs:взорваться{}, // В Дагестане взорвался автомобиль // вернуть после перекомпиляции rus_verbs:подорожать{}, // В Дагестане подорожал хлеб rus_verbs:воевать{}, // Воевал во Франции. rus_verbs:устать{}, // Устали в дороге? rus_verbs:изнывать{}, // В Лондоне Черчилль изнывал от нетерпения. rus_verbs:решить{}, // Что решат в правительстве? rus_verbs:выскакивать{}, // Один из бойцов на улицу выскакивает. rus_verbs:обстоять{}, // В действительности же дело обстояло не так. rus_verbs:подыматься{}, rus_verbs:поехать{}, // поедем в такси! rus_verbs:уехать{}, // он уехал в такси rus_verbs:прибыть{}, // они прибыли в качестве независимых наблюдателей rus_verbs:ОБЛАЧИТЬ{}, rus_verbs:ОБЛАЧАТЬ{}, rus_verbs:ОБЛАЧИТЬСЯ{}, rus_verbs:ОБЛАЧАТЬСЯ{}, rus_verbs:НАРЯДИТЬСЯ{}, rus_verbs:НАРЯЖАТЬСЯ{}, rus_verbs:ПОВАЛЯТЬСЯ{}, // повалявшись в снегу, бежать обратно в тепло. rus_verbs:ПОКРЫВАТЬ{}, // Во многих местах ее покрывали трещины, наросты и довольно плоские выступы. (ПОКРЫВАТЬ) rus_verbs:ПРОЖИГАТЬ{}, // Синий луч искрился белыми пятнами и прожигал в земле дымящуюся борозду. (ПРОЖИГАТЬ) rus_verbs:МЫЧАТЬ{}, // В огромной куче тел жалобно мычали задавленные трупами и раненые бизоны. (МЫЧАТЬ) rus_verbs:РАЗБОЙНИЧАТЬ{}, // Эти существа обычно разбойничали в трехстах милях отсюда (РАЗБОЙНИЧАТЬ) rus_verbs:МАЯЧИТЬ{}, // В отдалении маячили огромные серые туши мастодонтов и мамонтов с изогнутыми бивнями. (МАЯЧИТЬ/ЗАМАЯЧИТЬ) rus_verbs:ЗАМАЯЧИТЬ{}, rus_verbs:НЕСТИСЬ{}, // Кони неслись вперед в свободном и легком галопе (НЕСТИСЬ) rus_verbs:ДОБЫТЬ{}, // Они надеялись застать "медвежий народ" врасплох и добыть в бою голову величайшего из воинов. (ДОБЫТЬ) rus_verbs:СПУСТИТЬ{}, // Время от времени грохот или вопль объявляли о спущенной где-то во дворце ловушке. (СПУСТИТЬ) rus_verbs:ОБРАЗОВЫВАТЬСЯ{}, // Она сузила глаза, на лице ее стала образовываться маска безумия. (ОБРАЗОВЫВАТЬСЯ) rus_verbs:КИШЕТЬ{}, // в этом районе кишмя кишели разбойники и драконы. (КИШЕТЬ) rus_verbs:ДЫШАТЬ{}, // Она тяжело дышала в тисках гнева (ДЫШАТЬ) rus_verbs:ЗАДЕВАТЬ{}, // тот задевал в нем какую-то струну (ЗАДЕВАТЬ) rus_verbs:УСТУПИТЬ{}, // Так что теперь уступи мне в этом. (УСТУПИТЬ) rus_verbs:ТЕРЯТЬ{}, // Хотя он хорошо питался, он терял в весе (ТЕРЯТЬ/ПОТЕРЯТЬ) rus_verbs:ПоТЕРЯТЬ{}, rus_verbs:УТЕРЯТЬ{}, rus_verbs:РАСТЕРЯТЬ{}, rus_verbs:СМЫКАТЬСЯ{}, // Словно медленно смыкающийся во сне глаз, отверстие медленно закрывалось. (СМЫКАТЬСЯ/СОМКНУТЬСЯ, + оборот с СЛОВНО/БУДТО + вин.п.) rus_verbs:СОМКНУТЬСЯ{}, rus_verbs:РАЗВОРОШИТЬ{}, // Вольф не узнал никаких отдельных слов, но звуки и взаимодействующая высота тонов разворошили что-то в его памяти. (РАЗВОРОШИТЬ) rus_verbs:ПРОСТОЯТЬ{}, // Он поднялся и некоторое время простоял в задумчивости. (ПРОСТОЯТЬ,ВЫСТОЯТЬ,ПОСТОЯТЬ) rus_verbs:ВЫСТОЯТЬ{}, rus_verbs:ПОСТОЯТЬ{}, rus_verbs:ВЗВЕСИТЬ{}, // Он поднял и взвесил в руке один из рогов изобилия. (ВЗВЕСИТЬ/ВЗВЕШИВАТЬ) rus_verbs:ВЗВЕШИВАТЬ{}, rus_verbs:ДРЕЙФОВАТЬ{}, // Он и тогда не упадет, а будет дрейфовать в отбрасываемой диском тени. (ДРЕЙФОВАТЬ) прилагательное:быстрый{}, // Кисель быстр в приготовлении rus_verbs:призвать{}, // В День Воли белорусов призвали побороть страх и лень rus_verbs:призывать{}, rus_verbs:ВОСПОЛЬЗОВАТЬСЯ{}, // этими деньгами смогу воспользоваться в отпуске (ВОСПОЛЬЗОВАТЬСЯ) rus_verbs:КОНКУРИРОВАТЬ{}, // Наши клубы могли бы в Англии конкурировать с лидерами (КОНКУРИРОВАТЬ) rus_verbs:ПОЗВАТЬ{}, // Американскую телеведущую позвали замуж в прямом эфире (ПОЗВАТЬ) rus_verbs:ВЫХОДИТЬ{}, // Районные газеты Вологодчины будут выходить в цвете и новом формате (ВЫХОДИТЬ) rus_verbs:РАЗВОРАЧИВАТЬСЯ{}, // Сюжет фэнтези разворачивается в двух мирах (РАЗВОРАЧИВАТЬСЯ) rus_verbs:ОБСУДИТЬ{}, // В Самаре обсудили перспективы информатизации ветеринарии (ОБСУДИТЬ) rus_verbs:ВЗДРОГНУТЬ{}, // она сильно вздрогнула во сне (ВЗДРОГНУТЬ) rus_verbs:ПРЕДСТАВЛЯТЬ{}, // Сенаторы, представляющие в Комитете по разведке обе партии, поддержали эту просьбу (ПРЕДСТАВЛЯТЬ) rus_verbs:ДОМИНИРОВАТЬ{}, // в химическом составе одной из планет доминирует метан (ДОМИНИРОВАТЬ) rus_verbs:ОТКРЫТЬ{}, // Крым открыл в Москве собственный туристический офис (ОТКРЫТЬ) rus_verbs:ПОКАЗАТЬ{}, // В Пушкинском музее показали золото инков (ПОКАЗАТЬ) rus_verbs:наблюдать{}, // Наблюдаемый в отражении цвет излучения rus_verbs:ПРОЛЕТЕТЬ{}, // Крупный астероид пролетел в непосредственной близости от Земли (ПРОЛЕТЕТЬ) rus_verbs:РАССЛЕДОВАТЬ{}, // В Дагестане расследуют убийство федерального судьи (РАССЛЕДОВАТЬ) rus_verbs:ВОЗОБНОВИТЬСЯ{}, // В Кемеровской области возобновилось движение по трассам международного значения (ВОЗОБНОВИТЬСЯ) rus_verbs:ИЗМЕНИТЬСЯ{}, // изменилась она во всем (ИЗМЕНИТЬСЯ) rus_verbs:СВЕРКАТЬ{}, // за широким окном комнаты город сверкал во тьме разноцветными огнями (СВЕРКАТЬ) rus_verbs:СКОНЧАТЬСЯ{}, // В Риме скончался режиссёр знаменитого сериала «Спрут» (СКОНЧАТЬСЯ) rus_verbs:ПРЯТАТЬСЯ{}, // Cкрытые спутники прячутся в кольцах Сатурна (ПРЯТАТЬСЯ) rus_verbs:ВЫЗЫВАТЬ{}, // этот человек всегда вызывал во мне восхищение (ВЫЗЫВАТЬ) rus_verbs:ВЫПУСТИТЬ{}, // Избирательные бюллетени могут выпустить в форме брошюры (ВЫПУСТИТЬ) rus_verbs:НАЧИНАТЬСЯ{}, // В Москве начинается «марш в защиту детей» (НАЧИНАТЬСЯ) rus_verbs:ЗАСТРЕЛИТЬ{}, // В Дагестане застрелили преподавателя медресе (ЗАСТРЕЛИТЬ) rus_verbs:УРАВНЯТЬ{}, // Госзаказчиков уравняют в правах с поставщиками (УРАВНЯТЬ) rus_verbs:промахнуться{}, // в первой половине невероятным образом промахнулся экс-форвард московского ЦСКА rus_verbs:ОБЫГРАТЬ{}, // "Рубин" сенсационно обыграл в Мадриде вторую команду Испании (ОБЫГРАТЬ) rus_verbs:ВКЛЮЧИТЬ{}, // В Челябинской области включен аварийный роуминг (ВКЛЮЧИТЬ) rus_verbs:УЧАСТИТЬСЯ{}, // В селах Балаковского района участились случаи поджогов стогов сена (УЧАСТИТЬСЯ) rus_verbs:СПАСТИ{}, // В Австралии спасли повисшего на проводе коршуна (СПАСТИ) rus_verbs:ВЫПАСТЬ{}, // Отдельные фрагменты достигли земли, выпав в виде метеоритного дождя (ВЫПАСТЬ) rus_verbs:НАГРАДИТЬ{}, // В Лондоне наградили лауреатов премии Brit Awards (НАГРАДИТЬ) rus_verbs:ОТКРЫТЬСЯ{}, // в Москве открылся первый международный кинофестиваль rus_verbs:ПОДНИМАТЬСЯ{}, // во мне поднималось раздражение rus_verbs:ЗАВЕРШИТЬСЯ{}, // В Италии завершился традиционный Венецианский карнавал (ЗАВЕРШИТЬСЯ) инфинитив:проводить{ вид:несоверш }, // Кузбасские депутаты проводят в Кемерове прием граждан глагол:проводить{ вид:несоверш }, деепричастие:проводя{}, rus_verbs:отсутствовать{}, // Хозяйка квартиры в этот момент отсутствовала rus_verbs:доложить{}, // об итогах своего визита он намерен доложить в американском сенате и Белом доме (ДОЛОЖИТЬ ОБ, В предл) rus_verbs:ИЗДЕВАТЬСЯ{}, // В Эйлате издеваются над туристами (ИЗДЕВАТЬСЯ В предл) rus_verbs:НАРУШИТЬ{}, // В нескольких регионах нарушено наземное транспортное сообщение (НАРУШИТЬ В предл) rus_verbs:БЕЖАТЬ{}, // далеко внизу во тьме бежала невидимая река (БЕЖАТЬ В предл) rus_verbs:СОБРАТЬСЯ{}, // Дмитрий оглядел собравшихся во дворе мальчишек (СОБРАТЬСЯ В предл) rus_verbs:ПОСЛЫШАТЬСЯ{}, // далеко вверху во тьме послышался ответ (ПОСЛЫШАТЬСЯ В предл) rus_verbs:ПОКАЗАТЬСЯ{}, // во дворе показалась высокая фигура (ПОКАЗАТЬСЯ В предл) rus_verbs:УЛЫБНУТЬСЯ{}, // Дмитрий горько улыбнулся во тьме (УЛЫБНУТЬСЯ В предл) rus_verbs:ТЯНУТЬСЯ{}, // убежища тянулись во всех направлениях (ТЯНУТЬСЯ В предл) rus_verbs:РАНИТЬ{}, // В американском университете ранили человека (РАНИТЬ В предл) rus_verbs:ЗАХВАТИТЬ{}, // Пираты освободили корабль, захваченный в Гвинейском заливе (ЗАХВАТИТЬ В предл) rus_verbs:РАЗБЕГАТЬСЯ{}, // люди разбегались во всех направлениях (РАЗБЕГАТЬСЯ В предл) rus_verbs:ПОГАСНУТЬ{}, // во всем доме погас свет (ПОГАСНУТЬ В предл) rus_verbs:ПОШЕВЕЛИТЬСЯ{}, // Дмитрий пошевелился во сне (ПОШЕВЕЛИТЬСЯ В предл) rus_verbs:ЗАСТОНАТЬ{}, // раненый застонал во сне (ЗАСТОНАТЬ В предл) прилагательное:ВИНОВАТЫЙ{}, // во всем виновато вино (ВИНОВАТЫЙ В) rus_verbs:ОСТАВЛЯТЬ{}, // США оставляют в районе Персидского залива только один авианосец (ОСТАВЛЯТЬ В предл) rus_verbs:ОТКАЗЫВАТЬСЯ{}, // В России отказываются от планов авиагруппы в Арктике (ОТКАЗЫВАТЬСЯ В предл) rus_verbs:ЛИКВИДИРОВАТЬ{}, // В Кабардино-Балкарии ликвидирован подпольный завод по переработке нефти (ЛИКВИДИРОВАТЬ В предл) rus_verbs:РАЗОБЛАЧИТЬ{}, // В США разоблачили крупнейшую махинацию с кредитками (РАЗОБЛАЧИТЬ В предл) rus_verbs:СХВАТИТЬ{}, // их схватили во сне (СХВАТИТЬ В предл) rus_verbs:НАЧАТЬ{}, // В Белгороде начали сбор подписей за отставку мэра (НАЧАТЬ В предл) rus_verbs:РАСТИ{}, // Cамая маленькая муха растёт в голове муравья (РАСТИ В предл) rus_verbs:похитить{}, // Двое россиян, похищенных террористами в Сирии, освобождены (похитить в предл) rus_verbs:УЧАСТВОВАТЬ{}, // были застрелены два испанских гражданских гвардейца , участвовавших в слежке (УЧАСТВОВАТЬ В) rus_verbs:УСЫНОВИТЬ{}, // Американцы забирают усыновленных в России детей (УСЫНОВИТЬ В) rus_verbs:ПРОИЗВЕСТИ{}, // вы не увидите мясо или молоко , произведенное в районе (ПРОИЗВЕСТИ В предл) rus_verbs:ОРИЕНТИРОВАТЬСЯ{}, // призван помочь госслужащему правильно ориентироваться в сложных нравственных коллизиях (ОРИЕНТИРОВАТЬСЯ В) rus_verbs:ПОВРЕДИТЬ{}, // В зале игровых автоматов повреждены стены и потолок (ПОВРЕДИТЬ В предл) rus_verbs:ИЗЪЯТЬ{}, // В настоящее время в детском учреждении изъяты суточные пробы пищи (ИЗЪЯТЬ В предл) rus_verbs:СОДЕРЖАТЬСЯ{}, // осужденных , содержащихся в помещениях штрафного изолятора (СОДЕРЖАТЬСЯ В) rus_verbs:ОТЧИСЛИТЬ{}, // был отчислен за неуспеваемость в 2007 году (ОТЧИСЛИТЬ В предл) rus_verbs:проходить{}, // находился на санкционированном митинге , проходившем в рамках празднования Дня народного единства (проходить в предл) rus_verbs:ПОДУМЫВАТЬ{}, // сейчас в правительстве Приамурья подумывают о создании специального пункта помощи туристам (ПОДУМЫВАТЬ В) rus_verbs:ОТРАПОРТОВЫВАТЬ{}, // главы субъектов не просто отрапортовывали в Москве (ОТРАПОРТОВЫВАТЬ В предл) rus_verbs:ВЕСТИСЬ{}, // в городе ведутся работы по установке праздничной иллюминации (ВЕСТИСЬ В) rus_verbs:ОДОБРИТЬ{}, // Одобренным в первом чтении законопроектом (ОДОБРИТЬ В) rus_verbs:ЗАМЫЛИТЬСЯ{}, // ему легче исправлять , то , что замылилось в глазах предыдущего руководства (ЗАМЫЛИТЬСЯ В) rus_verbs:АВТОРИЗОВАТЬСЯ{}, // потом имеют право авторизоваться в системе Международного бакалавриата (АВТОРИЗОВАТЬСЯ В) rus_verbs:ОПУСТИТЬСЯ{}, // Россия опустилась в списке на шесть позиций (ОПУСТИТЬСЯ В предл) rus_verbs:СГОРЕТЬ{}, // Совладелец сгоревшего в Бразилии ночного клуба сдался полиции (СГОРЕТЬ В) частица:нет{}, // В этом нет сомнения. частица:нету{}, // В этом нету сомнения. rus_verbs:поджечь{}, // Поджегший себя в Москве мужчина оказался ветераном-афганцем rus_verbs:ввести{}, // В Молдавии введен запрет на амнистию или помилование педофилов. прилагательное:ДОСТУПНЫЙ{}, // Наиболее интересные таблички доступны в основной экспозиции музея (ДОСТУПНЫЙ В) rus_verbs:ПОВИСНУТЬ{}, // вопрос повис в мглистом демократическом воздухе (ПОВИСНУТЬ В) rus_verbs:ВЗОРВАТЬ{}, // В Ираке смертник взорвал в мечети группу туркменов (ВЗОРВАТЬ В) rus_verbs:ОТНЯТЬ{}, // В Финляндии у россиянки, прибывшей по туристической визе, отняли детей (ОТНЯТЬ В) rus_verbs:НАЙТИ{}, // Я недавно посетил врача и у меня в глазах нашли какую-то фигню (НАЙТИ В предл) rus_verbs:ЗАСТРЕЛИТЬСЯ{}, // Девушка, застрелившаяся в центре Киева, была замешана в скандале с влиятельными людьми (ЗАСТРЕЛИТЬСЯ В) rus_verbs:стартовать{}, // В Страсбурге сегодня стартует зимняя сессия Парламентской ассамблеи Совета Европы (стартовать в) rus_verbs:ЗАКЛАДЫВАТЬСЯ{}, // Отношение к деньгам закладывается в детстве (ЗАКЛАДЫВАТЬСЯ В) rus_verbs:НАПИВАТЬСЯ{}, // Депутатам помешают напиваться в здании Госдумы (НАПИВАТЬСЯ В) rus_verbs:ВЫПРАВИТЬСЯ{}, // Прежде всего было заявлено, что мировая экономика каким-то образом сама выправится в процессе бизнес-цикла (ВЫПРАВИТЬСЯ В) rus_verbs:ЯВЛЯТЬСЯ{}, // она являлась ко мне во всех моих снах (ЯВЛЯТЬСЯ В) rus_verbs:СТАЖИРОВАТЬСЯ{}, // сейчас я стажируюсь в одной компании (СТАЖИРОВАТЬСЯ В) rus_verbs:ОБСТРЕЛЯТЬ{}, // Уроженцы Чечни, обстрелявшие полицейских в центре Москвы, арестованы (ОБСТРЕЛЯТЬ В) rus_verbs:РАСПРОСТРАНИТЬ{}, // Воски — распространённые в растительном и животном мире сложные эфиры высших жирных кислот и высших высокомолекулярных спиртов (РАСПРОСТРАНИТЬ В) rus_verbs:ПРИВЕСТИ{}, // Сравнительная фугасность некоторых взрывчатых веществ приведена в следующей таблице (ПРИВЕСТИ В) rus_verbs:ЗАПОДОЗРИТЬ{}, // Чиновников Минкультуры заподозрили в афере с заповедными землями (ЗАПОДОЗРИТЬ В) rus_verbs:НАСТУПАТЬ{}, // В Гренландии стали наступать ледники (НАСТУПАТЬ В) rus_verbs:ВЫДЕЛЯТЬСЯ{}, // В истории Земли выделяются следующие ледниковые эры (ВЫДЕЛЯТЬСЯ В) rus_verbs:ПРЕДСТАВИТЬ{}, // Данные представлены в хронологическом порядке (ПРЕДСТАВИТЬ В) rus_verbs:ОБРУШИТЬСЯ{}, // В Северной Осетии на воинскую часть обрушилась снежная лавина (ОБРУШИТЬСЯ В, НА) rus_verbs:ПОДАВАТЬ{}, // Готовые компоты подают в столовых и кафе (ПОДАВАТЬ В) rus_verbs:ГОТОВИТЬ{}, // Сегодня компот готовят в домашних условиях из сухофруктов или замороженных фруктов и ягод (ГОТОВИТЬ В) rus_verbs:ВОЗДЕЛЫВАТЬСЯ{}, // в настоящее время он повсеместно возделывается в огородах (ВОЗДЕЛЫВАТЬСЯ В) rus_verbs:РАСКЛАДЫВАТЬ{}, // Созревшие семенные экземпляры раскладывают на солнце или в теплом месте, где они делаются мягкими (РАСКЛАДЫВАТЬСЯ В, НА) rus_verbs:РАСКЛАДЫВАТЬСЯ{}, rus_verbs:СОБИРАТЬСЯ{}, // Обыкновенно огурцы собираются в полуспелом состоянии (СОБИРАТЬСЯ В) rus_verbs:ПРОГРЕМЕТЬ{}, // В торговом центре Ижевска прогремел взрыв (ПРОГРЕМЕТЬ В) rus_verbs:СНЯТЬ{}, // чтобы снять их во всей красоте. (СНЯТЬ В) rus_verbs:ЯВИТЬСЯ{}, // она явилась к нему во сне. (ЯВИТЬСЯ В) rus_verbs:ВЕРИТЬ{}, // мы же во всем верили капитану. (ВЕРИТЬ В предл) rus_verbs:выдержать{}, // Игра выдержана в научно-фантастическом стиле. (ВЫДЕРЖАННЫЙ В) rus_verbs:ПРЕОДОЛЕТЬ{}, // мы пытались преодолеть ее во многих местах. (ПРЕОДОЛЕТЬ В) инфинитив:НАПИСАТЬ{ aux stress="напис^ать" }, // Программа, написанная в спешке, выполнила недопустимую операцию. (НАПИСАТЬ В) глагол:НАПИСАТЬ{ aux stress="напис^ать" }, прилагательное:НАПИСАННЫЙ{}, rus_verbs:ЕСТЬ{}, // ты даже во сне ел. (ЕСТЬ/кушать В) rus_verbs:УСЕСТЬСЯ{}, // Он удобно уселся в кресле. (УСЕСТЬСЯ В) rus_verbs:ТОРГОВАТЬ{}, // Он торгует в палатке. (ТОРГОВАТЬ В) rus_verbs:СОВМЕСТИТЬ{}, // Он совместил в себе писателя и художника. (СОВМЕСТИТЬ В) rus_verbs:ЗАБЫВАТЬ{}, // об этом нельзя забывать даже во сне. (ЗАБЫВАТЬ В) rus_verbs:поговорить{}, // Давайте поговорим об этом в присутствии адвоката rus_verbs:убрать{}, // В вагонах метро для комфорта пассажиров уберут сиденья (УБРАТЬ В, ДЛЯ) rus_verbs:упасть{}, // В Таиланде на автобус с российскими туристами упал башенный кран (УПАСТЬ В, НА) rus_verbs:раскрыть{}, // В России раскрыли крупнейшую в стране сеть фальшивомонетчиков (РАСКРЫТЬ В) rus_verbs:соединить{}, // соединить в себе (СОЕДИНИТЬ В предл) rus_verbs:избрать{}, // В Южной Корее избран новый президент (ИЗБРАТЬ В предл) rus_verbs:проводиться{}, // Обыски проводятся в воронежском Доме прав человека (ПРОВОДИТЬСЯ В) безлич_глагол:хватает{}, // В этой статье не хватает ссылок на источники информации. (БЕЗЛИЧ хватать в) rus_verbs:наносить{}, // В ближнем бою наносит мощные удары своим костлявым кулаком. (НАНОСИТЬ В + предл.) rus_verbs:расщепляться{}, // Сахароза же быстро расщепляется в пищеварительном тракте на глюкозу и фруктозу (РАСЩЕПЛЯТЬСЯ В, НА) прилагательное:известный{}, // В Европе сахар был известен ещё римлянам. (ИЗВЕСТНЫЙ В) rus_verbs:выработать{}, // Способы, выработанные во Франции, перешли затем в Германию и другие страны Европы. (ВЫРАБОТАТЬ В) rus_verbs:КУЛЬТИВИРОВАТЬСЯ{}, // Культивируется в регионах с умеренным климатом с умеренным количеством осадков и требует плодородной почвы. (КУЛЬТИВИРОВАТЬСЯ В) rus_verbs:чаять{}, // мама души не чаяла в своих детях (ЧАЯТЬ В) rus_verbs:улыбаться{}, // Вадим улыбался во сне. (УЛЫБАТЬСЯ В) rus_verbs:растеряться{}, // Приезжие растерялись в бетонном лабиринте улиц (РАСТЕРЯТЬСЯ В) rus_verbs:выть{}, // выли волки где-то в лесу (ВЫТЬ В) rus_verbs:ЗАВЕРИТЬ{}, // выступавший заверил нас в намерении выполнить обещание (ЗАВЕРИТЬ В) rus_verbs:ИСЧЕЗНУТЬ{}, // звери исчезли во мраке. (ИСЧЕЗНУТЬ В) rus_verbs:ВСТАТЬ{}, // встать во главе человечества. (ВСТАТЬ В) rus_verbs:УПОТРЕБЛЯТЬ{}, // В Тибете употребляют кирпичный зелёный чай. (УПОТРЕБЛЯТЬ В) rus_verbs:ПОДАВАТЬСЯ{}, // Напиток охлаждается и подаётся в холодном виде. (ПОДАВАТЬСЯ В) rus_verbs:ИСПОЛЬЗОВАТЬСЯ{}, // в игре используются текстуры большего разрешения (ИСПОЛЬЗОВАТЬСЯ В) rus_verbs:объявить{}, // В газете объявили о конкурсе. rus_verbs:ВСПЫХНУТЬ{}, // во мне вспыхнул гнев. (ВСПЫХНУТЬ В) rus_verbs:КРЫТЬСЯ{}, // В его словах кроется угроза. (КРЫТЬСЯ В) rus_verbs:подняться{}, // В классе вдруг поднялся шум. (подняться в) rus_verbs:наступить{}, // В классе наступила полная тишина. (наступить в) rus_verbs:кипеть{}, // В нём кипит злоба. (кипеть в) rus_verbs:соединиться{}, // В нём соединились храбрость и великодушие. (соединиться в) инфинитив:ПАРИТЬ{ aux stress="пар^ить"}, // Высоко в небе парит орёл, плавно описывая круги. (ПАРИТЬ В) глагол:ПАРИТЬ{ aux stress="пар^ить"}, деепричастие:паря{ aux stress="пар^я" }, прилагательное:ПАРЯЩИЙ{}, прилагательное:ПАРИВШИЙ{}, rus_verbs:СИЯТЬ{}, // Главы собора сияли в лучах солнца. (СИЯТЬ В) rus_verbs:РАСПОЛОЖИТЬ{}, // Гостиница расположена глубоко в горах. (РАСПОЛОЖИТЬ В) rus_verbs:развиваться{}, // Действие в комедии развивается в двух планах. (развиваться в) rus_verbs:ПОСАДИТЬ{}, // Дети посадили у нас во дворе цветы. (ПОСАДИТЬ В) rus_verbs:ИСКОРЕНЯТЬ{}, // Дурные привычки следует искоренять в самом начале. (ИСКОРЕНЯТЬ В) rus_verbs:ВОССТАНОВИТЬ{}, // Его восстановили в правах. (ВОССТАНОВИТЬ В) rus_verbs:ПОЛАГАТЬСЯ{}, // мы полагаемся на него в этих вопросах (ПОЛАГАТЬСЯ В) rus_verbs:УМИРАТЬ{}, // они умирали во сне. (УМИРАТЬ В) rus_verbs:ПРИБАВИТЬ{}, // Она сильно прибавила в весе. (ПРИБАВИТЬ В) rus_verbs:посмотреть{}, // Посмотрите в списке. (посмотреть в) rus_verbs:производиться{}, // Выдача новых паспортов будет производиться в следующем порядке (производиться в) rus_verbs:принять{}, // Документ принят в следующей редакции (принять в) rus_verbs:сверкнуть{}, // меч его сверкнул во тьме. (сверкнуть в) rus_verbs:ВЫРАБАТЫВАТЬ{}, // ты должен вырабатывать в себе силу воли (ВЫРАБАТЫВАТЬ В) rus_verbs:достать{}, // Эти сведения мы достали в Волгограде. (достать в) rus_verbs:звучать{}, // в доме звучала музыка (звучать в) rus_verbs:колебаться{}, // колеблется в выборе (колебаться в) rus_verbs:мешать{}, // мешать в кастрюле суп (мешать в) rus_verbs:нарастать{}, // во мне нарастал гнев (нарастать в) rus_verbs:отбыть{}, // Вадим отбыл в неизвестном направлении (отбыть в) rus_verbs:светиться{}, // во всем доме светилось только окно ее спальни. (светиться в) rus_verbs:вычитывать{}, // вычитывать в книге rus_verbs:гудеть{}, // У него в ушах гудит. rus_verbs:давать{}, // В этой лавке дают в долг? rus_verbs:поблескивать{}, // Красивое стеклышко поблескивало в пыльной траве у дорожки. rus_verbs:разойтись{}, // Они разошлись в темноте. rus_verbs:прибежать{}, // Мальчик прибежал в слезах. rus_verbs:биться{}, // Она билась в истерике. rus_verbs:регистрироваться{}, // регистрироваться в системе rus_verbs:считать{}, // я буду считать в уме rus_verbs:трахаться{}, // трахаться в гамаке rus_verbs:сконцентрироваться{}, // сконцентрироваться в одной точке rus_verbs:разрушать{}, // разрушать в дробилке rus_verbs:засидеться{}, // засидеться в гостях rus_verbs:засиживаться{}, // засиживаться в гостях rus_verbs:утопить{}, // утопить лодку в реке (утопить в реке) rus_verbs:навестить{}, // навестить в доме престарелых rus_verbs:запомнить{}, // запомнить в кэше rus_verbs:убивать{}, // убивать в помещении полиции (-score убивать неодуш. дом.) rus_verbs:базироваться{}, // установка базируется в черте города (ngram черта города - проверить что есть проверка) rus_verbs:покупать{}, // Чаще всего россияне покупают в интернете бытовую технику. rus_verbs:ходить{}, // ходить в пальто (сделать ХОДИТЬ + в + ОДЕЖДА предл.п.) rus_verbs:заложить{}, // диверсанты заложили в помещении бомбу rus_verbs:оглядываться{}, // оглядываться в зеркале rus_verbs:нарисовать{}, // нарисовать в тетрадке rus_verbs:пробить{}, // пробить отверствие в стене rus_verbs:повертеть{}, // повертеть в руке rus_verbs:вертеть{}, // Я вертел в руках rus_verbs:рваться{}, // Веревка рвется в месте надреза rus_verbs:распространяться{}, // распространяться в среде наркоманов rus_verbs:попрощаться{}, // попрощаться в здании морга rus_verbs:соображать{}, // соображать в уме инфинитив:просыпаться{ вид:несоверш }, глагол:просыпаться{ вид:несоверш }, // просыпаться в чужой кровати rus_verbs:заехать{}, // Коля заехал в гости (в гости - устойчивый наречный оборот) rus_verbs:разобрать{}, // разобрать в гараже rus_verbs:помереть{}, // помереть в пути rus_verbs:различить{}, // различить в темноте rus_verbs:рисовать{}, // рисовать в графическом редакторе rus_verbs:проследить{}, // проследить в записях камер слежения rus_verbs:совершаться{}, // Правосудие совершается в суде rus_verbs:задремать{}, // задремать в кровати rus_verbs:ругаться{}, // ругаться в комнате rus_verbs:зазвучать{}, // зазвучать в радиоприемниках rus_verbs:задохнуться{}, // задохнуться в воде rus_verbs:порождать{}, // порождать в неокрепших умах rus_verbs:отдыхать{}, // отдыхать в санатории rus_verbs:упоминаться{}, // упоминаться в предыдущем сообщении rus_verbs:образовать{}, // образовать в пробирке темную взвесь rus_verbs:отмечать{}, // отмечать в списке rus_verbs:подчеркнуть{}, // подчеркнуть в блокноте rus_verbs:плясать{}, // плясать в откружении незнакомых людей rus_verbs:повысить{}, // повысить в звании rus_verbs:поджидать{}, // поджидать в подъезде rus_verbs:отказать{}, // отказать в пересмотре дела rus_verbs:раствориться{}, // раствориться в бензине rus_verbs:отражать{}, // отражать в стихах rus_verbs:дремать{}, // дремать в гамаке rus_verbs:применяться{}, // применяться в домашних условиях rus_verbs:присниться{}, // присниться во сне rus_verbs:трястись{}, // трястись в драндулете rus_verbs:сохранять{}, // сохранять в неприкосновенности rus_verbs:расстрелять{}, // расстрелять в ложбине rus_verbs:рассчитать{}, // рассчитать в программе rus_verbs:перебирать{}, // перебирать в руке rus_verbs:разбиться{}, // разбиться в аварии rus_verbs:поискать{}, // поискать в углу rus_verbs:мучиться{}, // мучиться в тесной клетке rus_verbs:замелькать{}, // замелькать в телевизоре rus_verbs:грустить{}, // грустить в одиночестве rus_verbs:крутить{}, // крутить в банке rus_verbs:объявиться{}, // объявиться в городе rus_verbs:подготовить{}, // подготовить в тайне rus_verbs:различать{}, // различать в смеси rus_verbs:обнаруживать{}, // обнаруживать в крови rus_verbs:киснуть{}, // киснуть в захолустье rus_verbs:оборваться{}, // оборваться в начале фразы rus_verbs:запутаться{}, // запутаться в веревках rus_verbs:общаться{}, // общаться в интимной обстановке rus_verbs:сочинить{}, // сочинить в ресторане rus_verbs:изобрести{}, // изобрести в домашней лаборатории rus_verbs:прокомментировать{}, // прокомментировать в своем блоге rus_verbs:давить{}, // давить в зародыше rus_verbs:повториться{}, // повториться в новом обличье rus_verbs:отставать{}, // отставать в общем зачете rus_verbs:разработать{}, // разработать в лаборатории rus_verbs:качать{}, // качать в кроватке rus_verbs:заменить{}, // заменить в двигателе rus_verbs:задыхаться{}, // задыхаться в душной и влажной атмосфере rus_verbs:забегать{}, // забегать в спешке rus_verbs:наделать{}, // наделать в решении ошибок rus_verbs:исказиться{}, // исказиться в кривом зеркале rus_verbs:тушить{}, // тушить в помещении пожар rus_verbs:охранять{}, // охранять в здании входы rus_verbs:приметить{}, // приметить в кустах rus_verbs:скрыть{}, // скрыть в складках одежды rus_verbs:удерживать{}, // удерживать в заложниках rus_verbs:увеличиваться{}, // увеличиваться в размере rus_verbs:красоваться{}, // красоваться в новом платье rus_verbs:сохраниться{}, // сохраниться в тепле rus_verbs:лечить{}, // лечить в стационаре rus_verbs:смешаться{}, // смешаться в баке rus_verbs:прокатиться{}, // прокатиться в троллейбусе rus_verbs:договариваться{}, // договариваться в закрытом кабинете rus_verbs:опубликовать{}, // опубликовать в официальном блоге rus_verbs:охотиться{}, // охотиться в прериях rus_verbs:отражаться{}, // отражаться в окне rus_verbs:понизить{}, // понизить в должности rus_verbs:обедать{}, // обедать в ресторане rus_verbs:посидеть{}, // посидеть в тени rus_verbs:сообщаться{}, // сообщаться в оппозиционной газете rus_verbs:свершиться{}, // свершиться в суде rus_verbs:ночевать{}, // ночевать в гостинице rus_verbs:темнеть{}, // темнеть в воде rus_verbs:гибнуть{}, // гибнуть в застенках rus_verbs:усиливаться{}, // усиливаться в направлении главного удара rus_verbs:расплыться{}, // расплыться в улыбке rus_verbs:превышать{}, // превышать в несколько раз rus_verbs:проживать{}, // проживать в отдельной коморке rus_verbs:голубеть{}, // голубеть в тепле rus_verbs:исследовать{}, // исследовать в естественных условиях rus_verbs:обитать{}, // обитать в лесу rus_verbs:скучать{}, // скучать в одиночестве rus_verbs:сталкиваться{}, // сталкиваться в воздухе rus_verbs:таиться{}, // таиться в глубине rus_verbs:спасать{}, // спасать в море rus_verbs:заблудиться{}, // заблудиться в лесу rus_verbs:создаться{}, // создаться в новом виде rus_verbs:пошарить{}, // пошарить в кармане rus_verbs:планировать{}, // планировать в программе rus_verbs:отбить{}, // отбить в нижней части rus_verbs:отрицать{}, // отрицать в суде свою вину rus_verbs:основать{}, // основать в пустыне новый город rus_verbs:двоить{}, // двоить в глазах rus_verbs:устоять{}, // устоять в лодке rus_verbs:унять{}, // унять в ногах дрожь rus_verbs:отзываться{}, // отзываться в обзоре rus_verbs:притормозить{}, // притормозить в траве rus_verbs:читаться{}, // читаться в глазах rus_verbs:житься{}, // житься в деревне rus_verbs:заиграть{}, // заиграть в жилах rus_verbs:шевелить{}, // шевелить в воде rus_verbs:зазвенеть{}, // зазвенеть в ушах rus_verbs:зависнуть{}, // зависнуть в библиотеке rus_verbs:затаить{}, // затаить в душе обиду rus_verbs:сознаться{}, // сознаться в совершении rus_verbs:протекать{}, // протекать в легкой форме rus_verbs:выясняться{}, // выясняться в ходе эксперимента rus_verbs:скрестить{}, // скрестить в неволе rus_verbs:наводить{}, // наводить в комнате порядок rus_verbs:значиться{}, // значиться в документах rus_verbs:заинтересовать{}, // заинтересовать в получении результатов rus_verbs:познакомить{}, // познакомить в непринужденной обстановке rus_verbs:рассеяться{}, // рассеяться в воздухе rus_verbs:грохнуть{}, // грохнуть в подвале rus_verbs:обвинять{}, // обвинять в вымогательстве rus_verbs:столпиться{}, // столпиться в фойе rus_verbs:порыться{}, // порыться в сумке rus_verbs:ослабить{}, // ослабить в верхней части rus_verbs:обнаруживаться{}, // обнаруживаться в кармане куртки rus_verbs:спастись{}, // спастись в хижине rus_verbs:прерваться{}, // прерваться в середине фразы rus_verbs:применять{}, // применять в повседневной работе rus_verbs:строиться{}, // строиться в зоне отчуждения rus_verbs:путешествовать{}, // путешествовать в самолете rus_verbs:побеждать{}, // побеждать в честной битве rus_verbs:погубить{}, // погубить в себе артиста rus_verbs:рассматриваться{}, // рассматриваться в следующей главе rus_verbs:продаваться{}, // продаваться в специализированном магазине rus_verbs:разместиться{}, // разместиться в аудитории rus_verbs:повидать{}, // повидать в жизни rus_verbs:настигнуть{}, // настигнуть в пригородах rus_verbs:сгрудиться{}, // сгрудиться в центре загона rus_verbs:укрыться{}, // укрыться в доме rus_verbs:расплакаться{}, // расплакаться в суде rus_verbs:пролежать{}, // пролежать в канаве rus_verbs:замерзнуть{}, // замерзнуть в ледяной воде rus_verbs:поскользнуться{}, // поскользнуться в коридоре rus_verbs:таскать{}, // таскать в руках rus_verbs:нападать{}, // нападать в вольере rus_verbs:просматривать{}, // просматривать в браузере rus_verbs:обдумать{}, // обдумать в дороге rus_verbs:обвинить{}, // обвинить в измене rus_verbs:останавливать{}, // останавливать в дверях rus_verbs:теряться{}, // теряться в догадках rus_verbs:погибать{}, // погибать в бою rus_verbs:обозначать{}, // обозначать в списке rus_verbs:запрещать{}, // запрещать в парке rus_verbs:долететь{}, // долететь в вертолёте rus_verbs:тесниться{}, // тесниться в каморке rus_verbs:уменьшаться{}, // уменьшаться в размере rus_verbs:издавать{}, // издавать в небольшом издательстве rus_verbs:хоронить{}, // хоронить в море rus_verbs:перемениться{}, // перемениться в лице rus_verbs:установиться{}, // установиться в северных областях rus_verbs:прикидывать{}, // прикидывать в уме rus_verbs:затаиться{}, // затаиться в траве rus_verbs:раздобыть{}, // раздобыть в аптеке rus_verbs:перебросить{}, // перебросить в товарном составе rus_verbs:погружаться{}, // погружаться в батискафе rus_verbs:поживать{}, // поживать в одиночестве rus_verbs:признаваться{}, // признаваться в любви rus_verbs:захватывать{}, // захватывать в здании rus_verbs:покачиваться{}, // покачиваться в лодке rus_verbs:крутиться{}, // крутиться в колесе rus_verbs:помещаться{}, // помещаться в ящике rus_verbs:питаться{}, // питаться в столовой rus_verbs:отдохнуть{}, // отдохнуть в пансионате rus_verbs:кататься{}, // кататься в коляске rus_verbs:поработать{}, // поработать в цеху rus_verbs:подразумевать{}, // подразумевать в задании rus_verbs:ограбить{}, // ограбить в подворотне rus_verbs:преуспеть{}, // преуспеть в бизнесе rus_verbs:заерзать{}, // заерзать в кресле rus_verbs:разъяснить{}, // разъяснить в другой статье rus_verbs:продвинуться{}, // продвинуться в изучении rus_verbs:поколебаться{}, // поколебаться в начале rus_verbs:засомневаться{}, // засомневаться в честности rus_verbs:приникнуть{}, // приникнуть в уме rus_verbs:скривить{}, // скривить в усмешке rus_verbs:рассечь{}, // рассечь в центре опухоли rus_verbs:перепутать{}, // перепутать в роддоме rus_verbs:посмеяться{}, // посмеяться в перерыве rus_verbs:отмечаться{}, // отмечаться в полицейском участке rus_verbs:накопиться{}, // накопиться в отстойнике rus_verbs:уносить{}, // уносить в руках rus_verbs:навещать{}, // навещать в больнице rus_verbs:остыть{}, // остыть в проточной воде rus_verbs:запереться{}, // запереться в комнате rus_verbs:обогнать{}, // обогнать в первом круге rus_verbs:убеждаться{}, // убеждаться в неизбежности rus_verbs:подбирать{}, // подбирать в магазине rus_verbs:уничтожать{}, // уничтожать в полете rus_verbs:путаться{}, // путаться в показаниях rus_verbs:притаиться{}, // притаиться в темноте rus_verbs:проплывать{}, // проплывать в лодке rus_verbs:засесть{}, // засесть в окопе rus_verbs:подцепить{}, // подцепить в баре rus_verbs:насчитать{}, // насчитать в диктанте несколько ошибок rus_verbs:оправдаться{}, // оправдаться в суде rus_verbs:созреть{}, // созреть в естественных условиях rus_verbs:раскрываться{}, // раскрываться в подходящих условиях rus_verbs:ожидаться{}, // ожидаться в верхней части rus_verbs:одеваться{}, // одеваться в дорогих бутиках rus_verbs:упрекнуть{}, // упрекнуть в недостатке опыта rus_verbs:грабить{}, // грабить в подворотне rus_verbs:ужинать{}, // ужинать в ресторане rus_verbs:гонять{}, // гонять в жилах rus_verbs:уверить{}, // уверить в безопасности rus_verbs:потеряться{}, // потеряться в лесу rus_verbs:устанавливаться{}, // устанавливаться в комнате rus_verbs:предоставлять{}, // предоставлять в суде rus_verbs:протянуться{}, // протянуться в стене rus_verbs:допрашивать{}, // допрашивать в бункере rus_verbs:проработать{}, // проработать в кабинете rus_verbs:сосредоточить{}, // сосредоточить в своих руках rus_verbs:утвердить{}, // утвердить в должности rus_verbs:сочинять{}, // сочинять в дороге rus_verbs:померкнуть{}, // померкнуть в глазах rus_verbs:показываться{}, // показываться в окошке rus_verbs:похудеть{}, // похудеть в талии rus_verbs:проделывать{}, // проделывать в стене rus_verbs:прославиться{}, // прославиться в интернете rus_verbs:сдохнуть{}, // сдохнуть в нищете rus_verbs:раскинуться{}, // раскинуться в степи rus_verbs:развить{}, // развить в себе способности rus_verbs:уставать{}, // уставать в цеху rus_verbs:укрепить{}, // укрепить в земле rus_verbs:числиться{}, // числиться в списке rus_verbs:образовывать{}, // образовывать в смеси rus_verbs:екнуть{}, // екнуть в груди rus_verbs:одобрять{}, // одобрять в своей речи rus_verbs:запить{}, // запить в одиночестве rus_verbs:забыться{}, // забыться в тяжелом сне rus_verbs:чернеть{}, // чернеть в кислой среде rus_verbs:размещаться{}, // размещаться в гараже rus_verbs:соорудить{}, // соорудить в гараже rus_verbs:развивать{}, // развивать в себе rus_verbs:пастись{}, // пастись в пойме rus_verbs:формироваться{}, // формироваться в верхних слоях атмосферы rus_verbs:ослабнуть{}, // ослабнуть в сочленении rus_verbs:таить{}, // таить в себе инфинитив:пробегать{ вид:несоверш }, глагол:пробегать{ вид:несоверш }, // пробегать в спешке rus_verbs:приостановиться{}, // приостановиться в конце rus_verbs:топтаться{}, // топтаться в грязи rus_verbs:громить{}, // громить в финале rus_verbs:заменять{}, // заменять в основном составе rus_verbs:подъезжать{}, // подъезжать в колясках rus_verbs:вычислить{}, // вычислить в уме rus_verbs:заказывать{}, // заказывать в магазине rus_verbs:осуществить{}, // осуществить в реальных условиях rus_verbs:обосноваться{}, // обосноваться в дупле rus_verbs:пытать{}, // пытать в камере rus_verbs:поменять{}, // поменять в магазине rus_verbs:совершиться{}, // совершиться в суде rus_verbs:пролетать{}, // пролетать в вертолете rus_verbs:сбыться{}, // сбыться во сне rus_verbs:разговориться{}, // разговориться в отделении rus_verbs:преподнести{}, // преподнести в красивой упаковке rus_verbs:напечатать{}, // напечатать в типографии rus_verbs:прорвать{}, // прорвать в центре rus_verbs:раскачиваться{}, // раскачиваться в кресле rus_verbs:задерживаться{}, // задерживаться в дверях rus_verbs:угощать{}, // угощать в кафе rus_verbs:проступать{}, // проступать в глубине rus_verbs:шарить{}, // шарить в математике rus_verbs:увеличивать{}, // увеличивать в конце rus_verbs:расцвести{}, // расцвести в оранжерее rus_verbs:закипеть{}, // закипеть в баке rus_verbs:подлететь{}, // подлететь в вертолете rus_verbs:рыться{}, // рыться в куче rus_verbs:пожить{}, // пожить в гостинице rus_verbs:добираться{}, // добираться в попутном транспорте rus_verbs:перекрыть{}, // перекрыть в коридоре rus_verbs:продержаться{}, // продержаться в барокамере rus_verbs:разыскивать{}, // разыскивать в толпе rus_verbs:освобождать{}, // освобождать в зале суда rus_verbs:подметить{}, // подметить в человеке rus_verbs:передвигаться{}, // передвигаться в узкой юбке rus_verbs:продумать{}, // продумать в уме rus_verbs:извиваться{}, // извиваться в траве rus_verbs:процитировать{}, // процитировать в статье rus_verbs:прогуливаться{}, // прогуливаться в парке rus_verbs:защемить{}, // защемить в двери rus_verbs:увеличиться{}, // увеличиться в объеме rus_verbs:проявиться{}, // проявиться в результатах rus_verbs:заскользить{}, // заскользить в ботинках rus_verbs:пересказать{}, // пересказать в своем выступлении rus_verbs:протестовать{}, // протестовать в здании парламента rus_verbs:указываться{}, // указываться в путеводителе rus_verbs:копошиться{}, // копошиться в песке rus_verbs:проигнорировать{}, // проигнорировать в своей работе rus_verbs:купаться{}, // купаться в речке rus_verbs:подсчитать{}, // подсчитать в уме rus_verbs:разволноваться{}, // разволноваться в классе rus_verbs:придумывать{}, // придумывать в своем воображении rus_verbs:предусмотреть{}, // предусмотреть в программе rus_verbs:завертеться{}, // завертеться в колесе rus_verbs:зачерпнуть{}, // зачерпнуть в ручье rus_verbs:очистить{}, // очистить в химической лаборатории rus_verbs:прозвенеть{}, // прозвенеть в коридорах rus_verbs:уменьшиться{}, // уменьшиться в размере rus_verbs:колыхаться{}, // колыхаться в проточной воде rus_verbs:ознакомиться{}, // ознакомиться в автобусе rus_verbs:ржать{}, // ржать в аудитории rus_verbs:раскинуть{}, // раскинуть в микрорайоне rus_verbs:разлиться{}, // разлиться в воде rus_verbs:сквозить{}, // сквозить в словах rus_verbs:задушить{}, // задушить в объятиях rus_verbs:осудить{}, // осудить в особом порядке rus_verbs:разгромить{}, // разгромить в честном поединке rus_verbs:подслушать{}, // подслушать в кулуарах rus_verbs:проповедовать{}, // проповедовать в сельских районах rus_verbs:озарить{}, // озарить во сне rus_verbs:потирать{}, // потирать в предвкушении rus_verbs:описываться{}, // описываться в статье rus_verbs:качаться{}, // качаться в кроватке rus_verbs:усилить{}, // усилить в центре rus_verbs:прохаживаться{}, // прохаживаться в новом костюме rus_verbs:полечить{}, // полечить в больничке rus_verbs:сниматься{}, // сниматься в римейке rus_verbs:сыскать{}, // сыскать в наших краях rus_verbs:поприветствовать{}, // поприветствовать в коридоре rus_verbs:подтвердиться{}, // подтвердиться в эксперименте rus_verbs:плескаться{}, // плескаться в теплой водичке rus_verbs:расширяться{}, // расширяться в первом сегменте rus_verbs:мерещиться{}, // мерещиться в тумане rus_verbs:сгущаться{}, // сгущаться в воздухе rus_verbs:храпеть{}, // храпеть во сне rus_verbs:подержать{}, // подержать в руках rus_verbs:накинуться{}, // накинуться в подворотне rus_verbs:планироваться{}, // планироваться в закрытом режиме rus_verbs:пробудить{}, // пробудить в себе rus_verbs:побриться{}, // побриться в ванной rus_verbs:сгинуть{}, // сгинуть в пучине rus_verbs:окрестить{}, // окрестить в церкви инфинитив:резюмировать{ вид:соверш }, глагол:резюмировать{ вид:соверш }, // резюмировать в конце выступления rus_verbs:замкнуться{}, // замкнуться в себе rus_verbs:прибавлять{}, // прибавлять в весе rus_verbs:проплыть{}, // проплыть в лодке rus_verbs:растворяться{}, // растворяться в тумане rus_verbs:упрекать{}, // упрекать в небрежности rus_verbs:затеряться{}, // затеряться в лабиринте rus_verbs:перечитывать{}, // перечитывать в поезде rus_verbs:перелететь{}, // перелететь в вертолете rus_verbs:оживать{}, // оживать в теплой воде rus_verbs:заглохнуть{}, // заглохнуть в полете rus_verbs:кольнуть{}, // кольнуть в боку rus_verbs:копаться{}, // копаться в куче rus_verbs:развлекаться{}, // развлекаться в клубе rus_verbs:отливать{}, // отливать в кустах rus_verbs:зажить{}, // зажить в деревне rus_verbs:одолжить{}, // одолжить в соседнем кабинете rus_verbs:заклинать{}, // заклинать в своей речи rus_verbs:различаться{}, // различаться в мелочах rus_verbs:печататься{}, // печататься в типографии rus_verbs:угадываться{}, // угадываться в контурах rus_verbs:обрывать{}, // обрывать в начале rus_verbs:поглаживать{}, // поглаживать в кармане rus_verbs:подписывать{}, // подписывать в присутствии понятых rus_verbs:добывать{}, // добывать в разломе rus_verbs:скопиться{}, // скопиться в воротах rus_verbs:повстречать{}, // повстречать в бане rus_verbs:совпасть{}, // совпасть в упрощенном виде rus_verbs:разрываться{}, // разрываться в точке спайки rus_verbs:улавливать{}, // улавливать в датчике rus_verbs:повстречаться{}, // повстречаться в лифте rus_verbs:отразить{}, // отразить в отчете rus_verbs:пояснять{}, // пояснять в примечаниях rus_verbs:накормить{}, // накормить в столовке rus_verbs:поужинать{}, // поужинать в ресторане инфинитив:спеть{ вид:соверш }, глагол:спеть{ вид:соверш }, // спеть в суде инфинитив:спеть{ вид:несоверш }, глагол:спеть{ вид:несоверш }, rus_verbs:топить{}, // топить в молоке rus_verbs:освоить{}, // освоить в работе rus_verbs:зародиться{}, // зародиться в голове rus_verbs:отплыть{}, // отплыть в старой лодке rus_verbs:отстаивать{}, // отстаивать в суде rus_verbs:осуждать{}, // осуждать в своем выступлении rus_verbs:переговорить{}, // переговорить в перерыве rus_verbs:разгораться{}, // разгораться в сердце rus_verbs:укрыть{}, // укрыть в шалаше rus_verbs:томиться{}, // томиться в застенках rus_verbs:клубиться{}, // клубиться в воздухе rus_verbs:сжигать{}, // сжигать в топке rus_verbs:позавтракать{}, // позавтракать в кафешке rus_verbs:функционировать{}, // функционировать в лабораторных условиях rus_verbs:смять{}, // смять в руке rus_verbs:разместить{}, // разместить в интернете rus_verbs:пронести{}, // пронести в потайном кармане rus_verbs:руководствоваться{}, // руководствоваться в работе rus_verbs:нашарить{}, // нашарить в потемках rus_verbs:закрутить{}, // закрутить в вихре rus_verbs:просматриваться{}, // просматриваться в дальней перспективе rus_verbs:распознать{}, // распознать в незнакомце rus_verbs:повеситься{}, // повеситься в камере rus_verbs:обшарить{}, // обшарить в поисках наркотиков rus_verbs:наполняться{}, // наполняется в карьере rus_verbs:засвистеть{}, // засвистеть в воздухе rus_verbs:процветать{}, // процветать в мягком климате rus_verbs:шуршать{}, // шуршать в простенке rus_verbs:подхватывать{}, // подхватывать в полете инфинитив:роиться{}, глагол:роиться{}, // роиться в воздухе прилагательное:роившийся{}, прилагательное:роящийся{}, // деепричастие:роясь{ aux stress="ро^ясь" }, rus_verbs:преобладать{}, // преобладать в тексте rus_verbs:посветлеть{}, // посветлеть в лице rus_verbs:игнорировать{}, // игнорировать в рекомендациях rus_verbs:обсуждаться{}, // обсуждаться в кулуарах rus_verbs:отказывать{}, // отказывать в визе rus_verbs:ощупывать{}, // ощупывать в кармане rus_verbs:разливаться{}, // разливаться в цеху rus_verbs:расписаться{}, // расписаться в получении rus_verbs:учинить{}, // учинить в казарме rus_verbs:плестись{}, // плестись в хвосте rus_verbs:объявляться{}, // объявляться в группе rus_verbs:повышаться{}, // повышаться в первой части rus_verbs:напрягать{}, // напрягать в паху rus_verbs:разрабатывать{}, // разрабатывать в студии rus_verbs:хлопотать{}, // хлопотать в мэрии rus_verbs:прерывать{}, // прерывать в самом начале rus_verbs:каяться{}, // каяться в грехах rus_verbs:освоиться{}, // освоиться в кабине rus_verbs:подплыть{}, // подплыть в лодке rus_verbs:замигать{}, // замигать в темноте rus_verbs:оскорблять{}, // оскорблять в выступлении rus_verbs:торжествовать{}, // торжествовать в душе rus_verbs:поправлять{}, // поправлять в прологе rus_verbs:угадывать{}, // угадывать в размытом изображении rus_verbs:потоптаться{}, // потоптаться в прихожей rus_verbs:переправиться{}, // переправиться в лодочке rus_verbs:увериться{}, // увериться в невиновности rus_verbs:забрезжить{}, // забрезжить в конце тоннеля rus_verbs:утвердиться{}, // утвердиться во мнении rus_verbs:завывать{}, // завывать в трубе rus_verbs:заварить{}, // заварить в заварнике rus_verbs:скомкать{}, // скомкать в руке rus_verbs:перемещаться{}, // перемещаться в капсуле инфинитив:писаться{ aux stress="пис^аться" }, глагол:писаться{ aux stress="пис^аться" }, // писаться в первом поле rus_verbs:праздновать{}, // праздновать в баре rus_verbs:мигать{}, // мигать в темноте rus_verbs:обучить{}, // обучить в мастерской rus_verbs:орудовать{}, // орудовать в кладовке rus_verbs:упорствовать{}, // упорствовать в заблуждении rus_verbs:переминаться{}, // переминаться в прихожей rus_verbs:подрасти{}, // подрасти в теплице rus_verbs:предписываться{}, // предписываться в законе rus_verbs:приписать{}, // приписать в конце rus_verbs:задаваться{}, // задаваться в своей статье rus_verbs:чинить{}, // чинить в домашних условиях rus_verbs:раздеваться{}, // раздеваться в пляжной кабинке rus_verbs:пообедать{}, // пообедать в ресторанчике rus_verbs:жрать{}, // жрать в чуланчике rus_verbs:исполняться{}, // исполняться в антракте rus_verbs:гнить{}, // гнить в тюрьме rus_verbs:глодать{}, // глодать в конуре rus_verbs:прослушать{}, // прослушать в дороге rus_verbs:истратить{}, // истратить в кабаке rus_verbs:стареть{}, // стареть в одиночестве rus_verbs:разжечь{}, // разжечь в сердце rus_verbs:совещаться{}, // совещаться в кабинете rus_verbs:покачивать{}, // покачивать в кроватке rus_verbs:отсидеть{}, // отсидеть в одиночке rus_verbs:формировать{}, // формировать в умах rus_verbs:захрапеть{}, // захрапеть во сне rus_verbs:петься{}, // петься в хоре rus_verbs:объехать{}, // объехать в автобусе rus_verbs:поселить{}, // поселить в гостинице rus_verbs:предаться{}, // предаться в книге rus_verbs:заворочаться{}, // заворочаться во сне rus_verbs:напрятать{}, // напрятать в карманах rus_verbs:очухаться{}, // очухаться в незнакомом месте rus_verbs:ограничивать{}, // ограничивать в движениях rus_verbs:завертеть{}, // завертеть в руках rus_verbs:печатать{}, // печатать в редакторе rus_verbs:теплиться{}, // теплиться в сердце rus_verbs:увязнуть{}, // увязнуть в зыбучем песке rus_verbs:усмотреть{}, // усмотреть в обращении rus_verbs:отыскаться{}, // отыскаться в запасах rus_verbs:потушить{}, // потушить в горле огонь rus_verbs:поубавиться{}, // поубавиться в размере rus_verbs:зафиксировать{}, // зафиксировать в постоянной памяти rus_verbs:смыть{}, // смыть в ванной rus_verbs:заместить{}, // заместить в кресле rus_verbs:угасать{}, // угасать в одиночестве rus_verbs:сразить{}, // сразить в споре rus_verbs:фигурировать{}, // фигурировать в бюллетене rus_verbs:расплываться{}, // расплываться в глазах rus_verbs:сосчитать{}, // сосчитать в уме rus_verbs:сгуститься{}, // сгуститься в воздухе rus_verbs:цитировать{}, // цитировать в своей статье rus_verbs:помяться{}, // помяться в давке rus_verbs:затрагивать{}, // затрагивать в процессе выполнения rus_verbs:обтереть{}, // обтереть в гараже rus_verbs:подстрелить{}, // подстрелить в пойме реки rus_verbs:растереть{}, // растереть в руке rus_verbs:подавлять{}, // подавлять в зародыше rus_verbs:смешиваться{}, // смешиваться в чане инфинитив:вычитать{ вид:соверш }, глагол:вычитать{ вид:соверш }, // вычитать в книжечке rus_verbs:сократиться{}, // сократиться в обхвате rus_verbs:занервничать{}, // занервничать в кабинете rus_verbs:соприкоснуться{}, // соприкоснуться в полете rus_verbs:обозначить{}, // обозначить в объявлении rus_verbs:обучаться{}, // обучаться в училище rus_verbs:снизиться{}, // снизиться в нижних слоях атмосферы rus_verbs:лелеять{}, // лелеять в сердце rus_verbs:поддерживаться{}, // поддерживаться в суде rus_verbs:уплыть{}, // уплыть в лодочке rus_verbs:резвиться{}, // резвиться в саду rus_verbs:поерзать{}, // поерзать в гамаке rus_verbs:оплатить{}, // оплатить в ресторане rus_verbs:похвастаться{}, // похвастаться в компании rus_verbs:знакомиться{}, // знакомиться в классе rus_verbs:приплыть{}, // приплыть в подводной лодке rus_verbs:зажигать{}, // зажигать в классе rus_verbs:смыслить{}, // смыслить в математике rus_verbs:закопать{}, // закопать в огороде rus_verbs:порхать{}, // порхать в зарослях rus_verbs:потонуть{}, // потонуть в бумажках rus_verbs:стирать{}, // стирать в холодной воде rus_verbs:подстерегать{}, // подстерегать в придорожных кустах rus_verbs:погулять{}, // погулять в парке rus_verbs:предвкушать{}, // предвкушать в воображении rus_verbs:ошеломить{}, // ошеломить в бою rus_verbs:удостовериться{}, // удостовериться в безопасности rus_verbs:огласить{}, // огласить в заключительной части rus_verbs:разбогатеть{}, // разбогатеть в деревне rus_verbs:грохотать{}, // грохотать в мастерской rus_verbs:реализоваться{}, // реализоваться в должности rus_verbs:красть{}, // красть в магазине rus_verbs:нарваться{}, // нарваться в коридоре rus_verbs:застывать{}, // застывать в неудобной позе rus_verbs:толкаться{}, // толкаться в тесной комнате rus_verbs:извлекать{}, // извлекать в аппарате rus_verbs:обжигать{}, // обжигать в печи rus_verbs:запечатлеть{}, // запечатлеть в кинохронике rus_verbs:тренироваться{}, // тренироваться в зале rus_verbs:поспорить{}, // поспорить в кабинете rus_verbs:рыскать{}, // рыскать в лесу rus_verbs:надрываться{}, // надрываться в шахте rus_verbs:сняться{}, // сняться в фильме rus_verbs:закружить{}, // закружить в танце rus_verbs:затонуть{}, // затонуть в порту rus_verbs:побыть{}, // побыть в гостях rus_verbs:почистить{}, // почистить в носу rus_verbs:сгорбиться{}, // сгорбиться в тесной конуре rus_verbs:подслушивать{}, // подслушивать в классе rus_verbs:сгорать{}, // сгорать в танке rus_verbs:разочароваться{}, // разочароваться в артисте инфинитив:пописать{ aux stress="поп^исать" }, глагол:пописать{ aux stress="поп^исать" }, // пописать в кустиках rus_verbs:мять{}, // мять в руках rus_verbs:подраться{}, // подраться в классе rus_verbs:замести{}, // замести в прихожей rus_verbs:откладываться{}, // откладываться в печени rus_verbs:обозначаться{}, // обозначаться в перечне rus_verbs:просиживать{}, // просиживать в интернете rus_verbs:соприкасаться{}, // соприкасаться в точке rus_verbs:начертить{}, // начертить в тетрадке rus_verbs:уменьшать{}, // уменьшать в поперечнике rus_verbs:тормозить{}, // тормозить в облаке rus_verbs:затевать{}, // затевать в лаборатории rus_verbs:затопить{}, // затопить в бухте rus_verbs:задерживать{}, // задерживать в лифте rus_verbs:прогуляться{}, // прогуляться в лесу rus_verbs:прорубить{}, // прорубить во льду rus_verbs:очищать{}, // очищать в кислоте rus_verbs:полулежать{}, // полулежать в гамаке rus_verbs:исправить{}, // исправить в задании rus_verbs:предусматриваться{}, // предусматриваться в постановке задачи rus_verbs:замучить{}, // замучить в плену rus_verbs:разрушаться{}, // разрушаться в верхней части rus_verbs:ерзать{}, // ерзать в кресле rus_verbs:покопаться{}, // покопаться в залежах rus_verbs:раскаяться{}, // раскаяться в содеянном rus_verbs:пробежаться{}, // пробежаться в парке rus_verbs:полежать{}, // полежать в гамаке rus_verbs:позаимствовать{}, // позаимствовать в книге rus_verbs:снижать{}, // снижать в несколько раз rus_verbs:черпать{}, // черпать в поэзии rus_verbs:заверять{}, // заверять в своей искренности rus_verbs:проглядеть{}, // проглядеть в сумерках rus_verbs:припарковать{}, // припарковать во дворе rus_verbs:сверлить{}, // сверлить в стене rus_verbs:здороваться{}, // здороваться в аудитории rus_verbs:рожать{}, // рожать в воде rus_verbs:нацарапать{}, // нацарапать в тетрадке rus_verbs:затопать{}, // затопать в коридоре rus_verbs:прописать{}, // прописать в правилах rus_verbs:сориентироваться{}, // сориентироваться в обстоятельствах rus_verbs:снизить{}, // снизить в несколько раз rus_verbs:заблуждаться{}, // заблуждаться в своей теории rus_verbs:откопать{}, // откопать в отвалах rus_verbs:смастерить{}, // смастерить в лаборатории rus_verbs:замедлиться{}, // замедлиться в парафине rus_verbs:избивать{}, // избивать в участке rus_verbs:мыться{}, // мыться в бане rus_verbs:сварить{}, // сварить в кастрюльке rus_verbs:раскопать{}, // раскопать в снегу rus_verbs:крепиться{}, // крепиться в держателе rus_verbs:дробить{}, // дробить в мельнице rus_verbs:попить{}, // попить в ресторанчике rus_verbs:затронуть{}, // затронуть в душе rus_verbs:лязгнуть{}, // лязгнуть в тишине rus_verbs:заправлять{}, // заправлять в полете rus_verbs:размножаться{}, // размножаться в неволе rus_verbs:потопить{}, // потопить в Тихом Океане rus_verbs:кушать{}, // кушать в столовой rus_verbs:замолкать{}, // замолкать в замешательстве rus_verbs:измеряться{}, // измеряться в дюймах rus_verbs:сбываться{}, // сбываться в мечтах rus_verbs:задернуть{}, // задернуть в комнате rus_verbs:затихать{}, // затихать в темноте rus_verbs:прослеживаться{}, // прослеживается в журнале rus_verbs:прерываться{}, // прерывается в начале rus_verbs:изображаться{}, // изображается в любых фильмах rus_verbs:фиксировать{}, // фиксировать в данной точке rus_verbs:ослаблять{}, // ослаблять в поясе rus_verbs:зреть{}, // зреть в теплице rus_verbs:зеленеть{}, // зеленеть в огороде rus_verbs:критиковать{}, // критиковать в статье rus_verbs:облететь{}, // облететь в частном вертолете rus_verbs:разбросать{}, // разбросать в комнате rus_verbs:заразиться{}, // заразиться в людном месте rus_verbs:рассеять{}, // рассеять в бою rus_verbs:печься{}, // печься в духовке rus_verbs:поспать{}, // поспать в палатке rus_verbs:заступиться{}, // заступиться в драке rus_verbs:сплетаться{}, // сплетаться в середине rus_verbs:поместиться{}, // поместиться в мешке rus_verbs:спереть{}, // спереть в лавке // инфинитив:ликвидировать{ вид:несоверш }, глагол:ликвидировать{ вид:несоверш }, // ликвидировать в пригороде // инфинитив:ликвидировать{ вид:соверш }, глагол:ликвидировать{ вид:соверш }, rus_verbs:проваляться{}, // проваляться в постели rus_verbs:лечиться{}, // лечиться в стационаре rus_verbs:определиться{}, // определиться в честном бою rus_verbs:обработать{}, // обработать в растворе rus_verbs:пробивать{}, // пробивать в стене rus_verbs:перемешаться{}, // перемешаться в чане rus_verbs:чесать{}, // чесать в паху rus_verbs:пролечь{}, // пролечь в пустынной местности rus_verbs:скитаться{}, // скитаться в дальних странах rus_verbs:затрудняться{}, // затрудняться в выборе rus_verbs:отряхнуться{}, // отряхнуться в коридоре rus_verbs:разыгрываться{}, // разыгрываться в лотерее rus_verbs:помолиться{}, // помолиться в церкви rus_verbs:предписывать{}, // предписывать в рецепте rus_verbs:порваться{}, // порваться в слабом месте rus_verbs:греться{}, // греться в здании rus_verbs:опровергать{}, // опровергать в своем выступлении rus_verbs:помянуть{}, // помянуть в своем выступлении rus_verbs:допросить{}, // допросить в прокуратуре rus_verbs:материализоваться{}, // материализоваться в соседнем здании rus_verbs:рассеиваться{}, // рассеиваться в воздухе rus_verbs:перевозить{}, // перевозить в вагоне rus_verbs:отбывать{}, // отбывать в тюрьме rus_verbs:попахивать{}, // попахивать в отхожем месте rus_verbs:перечислять{}, // перечислять в заключении rus_verbs:зарождаться{}, // зарождаться в дебрях rus_verbs:предъявлять{}, // предъявлять в своем письме rus_verbs:распространять{}, // распространять в сети rus_verbs:пировать{}, // пировать в соседнем селе rus_verbs:начертать{}, // начертать в летописи rus_verbs:расцветать{}, // расцветать в подходящих условиях rus_verbs:царствовать{}, // царствовать в южной части материка rus_verbs:накопить{}, // накопить в буфере rus_verbs:закрутиться{}, // закрутиться в рутине rus_verbs:отработать{}, // отработать в забое rus_verbs:обокрасть{}, // обокрасть в автобусе rus_verbs:прокладывать{}, // прокладывать в снегу rus_verbs:ковырять{}, // ковырять в носу rus_verbs:копить{}, // копить в очереди rus_verbs:полечь{}, // полечь в степях rus_verbs:щебетать{}, // щебетать в кустиках rus_verbs:подчеркиваться{}, // подчеркиваться в сообщении rus_verbs:посеять{}, // посеять в огороде rus_verbs:разъезжать{}, // разъезжать в кабриолете rus_verbs:замечаться{}, // замечаться в лесу rus_verbs:просчитать{}, // просчитать в уме rus_verbs:маяться{}, // маяться в командировке rus_verbs:выхватывать{}, // выхватывать в тексте rus_verbs:креститься{}, // креститься в деревенской часовне rus_verbs:обрабатывать{}, // обрабатывать в растворе кислоты rus_verbs:настигать{}, // настигать в огороде rus_verbs:разгуливать{}, // разгуливать в роще rus_verbs:насиловать{}, // насиловать в квартире rus_verbs:побороть{}, // побороть в себе rus_verbs:учитывать{}, // учитывать в расчетах rus_verbs:искажать{}, // искажать в заметке rus_verbs:пропить{}, // пропить в кабаке rus_verbs:катать{}, // катать в лодочке rus_verbs:припрятать{}, // припрятать в кармашке rus_verbs:запаниковать{}, // запаниковать в бою rus_verbs:рассыпать{}, // рассыпать в траве rus_verbs:застревать{}, // застревать в ограде rus_verbs:зажигаться{}, // зажигаться в сумерках rus_verbs:жарить{}, // жарить в масле rus_verbs:накапливаться{}, // накапливаться в костях rus_verbs:распуститься{}, // распуститься в горшке rus_verbs:проголосовать{}, // проголосовать в передвижном пункте rus_verbs:странствовать{}, // странствовать в автомобиле rus_verbs:осматриваться{}, // осматриваться в хоромах rus_verbs:разворачивать{}, // разворачивать в спортзале rus_verbs:заскучать{}, // заскучать в самолете rus_verbs:напутать{}, // напутать в расчете rus_verbs:перекусить{}, // перекусить в столовой rus_verbs:спасаться{}, // спасаться в автономной капсуле rus_verbs:посовещаться{}, // посовещаться в комнате rus_verbs:доказываться{}, // доказываться в статье rus_verbs:познаваться{}, // познаваться в беде rus_verbs:загрустить{}, // загрустить в одиночестве rus_verbs:оживить{}, // оживить в памяти rus_verbs:переворачиваться{}, // переворачиваться в гробу rus_verbs:заприметить{}, // заприметить в лесу rus_verbs:отравиться{}, // отравиться в забегаловке rus_verbs:продержать{}, // продержать в клетке rus_verbs:выявить{}, // выявить в костях rus_verbs:заседать{}, // заседать в совете rus_verbs:расплачиваться{}, // расплачиваться в первой кассе rus_verbs:проломить{}, // проломить в двери rus_verbs:подражать{}, // подражать в мелочах rus_verbs:подсчитывать{}, // подсчитывать в уме rus_verbs:опережать{}, // опережать во всем rus_verbs:сформироваться{}, // сформироваться в облаке rus_verbs:укрепиться{}, // укрепиться в мнении rus_verbs:отстоять{}, // отстоять в очереди rus_verbs:развертываться{}, // развертываться в месте испытания rus_verbs:замерзать{}, // замерзать во льду rus_verbs:утопать{}, // утопать в снегу rus_verbs:раскаиваться{}, // раскаиваться в содеянном rus_verbs:организовывать{}, // организовывать в пионерлагере rus_verbs:перевестись{}, // перевестись в наших краях rus_verbs:смешивать{}, // смешивать в блендере rus_verbs:ютиться{}, // ютиться в тесной каморке rus_verbs:прождать{}, // прождать в аудитории rus_verbs:подыскивать{}, // подыскивать в женском общежитии rus_verbs:замочить{}, // замочить в сортире rus_verbs:мерзнуть{}, // мерзнуть в тонкой курточке rus_verbs:растирать{}, // растирать в ступке rus_verbs:замедлять{}, // замедлять в парафине rus_verbs:переспать{}, // переспать в палатке rus_verbs:рассекать{}, // рассекать в кабриолете rus_verbs:отыскивать{}, // отыскивать в залежах rus_verbs:опровергнуть{}, // опровергнуть в своем выступлении rus_verbs:дрыхнуть{}, // дрыхнуть в гамаке rus_verbs:укрываться{}, // укрываться в землянке rus_verbs:запечься{}, // запечься в золе rus_verbs:догорать{}, // догорать в темноте rus_verbs:застилать{}, // застилать в коридоре rus_verbs:сыскаться{}, // сыскаться в деревне rus_verbs:переделать{}, // переделать в мастерской rus_verbs:разъяснять{}, // разъяснять в своей лекции rus_verbs:селиться{}, // селиться в центре rus_verbs:оплачивать{}, // оплачивать в магазине rus_verbs:переворачивать{}, // переворачивать в закрытой банке rus_verbs:упражняться{}, // упражняться в остроумии rus_verbs:пометить{}, // пометить в списке rus_verbs:припомниться{}, // припомниться в завещании rus_verbs:приютить{}, // приютить в амбаре rus_verbs:натерпеться{}, // натерпеться в темнице rus_verbs:затеваться{}, // затеваться в клубе rus_verbs:уплывать{}, // уплывать в лодке rus_verbs:скиснуть{}, // скиснуть в бидоне rus_verbs:заколоть{}, // заколоть в боку rus_verbs:замерцать{}, // замерцать в темноте rus_verbs:фиксироваться{}, // фиксироваться в протоколе rus_verbs:запираться{}, // запираться в комнате rus_verbs:съезжаться{}, // съезжаться в каретах rus_verbs:толочься{}, // толочься в ступе rus_verbs:потанцевать{}, // потанцевать в клубе rus_verbs:побродить{}, // побродить в парке rus_verbs:назревать{}, // назревать в коллективе rus_verbs:дохнуть{}, // дохнуть в питомнике rus_verbs:крестить{}, // крестить в деревенской церквушке rus_verbs:рассчитаться{}, // рассчитаться в банке rus_verbs:припарковаться{}, // припарковаться во дворе rus_verbs:отхватить{}, // отхватить в магазинчике rus_verbs:остывать{}, // остывать в холодильнике rus_verbs:составляться{}, // составляться в атмосфере тайны rus_verbs:переваривать{}, // переваривать в тишине rus_verbs:хвастать{}, // хвастать в казино rus_verbs:отрабатывать{}, // отрабатывать в теплице rus_verbs:разлечься{}, // разлечься в кровати rus_verbs:прокручивать{}, // прокручивать в голове rus_verbs:очертить{}, // очертить в воздухе rus_verbs:сконфузиться{}, // сконфузиться в окружении незнакомых людей rus_verbs:выявлять{}, // выявлять в боевых условиях rus_verbs:караулить{}, // караулить в лифте rus_verbs:расставлять{}, // расставлять в бойницах rus_verbs:прокрутить{}, // прокрутить в голове rus_verbs:пересказывать{}, // пересказывать в первой главе rus_verbs:задавить{}, // задавить в зародыше rus_verbs:хозяйничать{}, // хозяйничать в холодильнике rus_verbs:хвалиться{}, // хвалиться в детском садике rus_verbs:оперировать{}, // оперировать в полевом госпитале rus_verbs:формулировать{}, // формулировать в следующей главе rus_verbs:застигнуть{}, // застигнуть в неприглядном виде rus_verbs:замурлыкать{}, // замурлыкать в тепле rus_verbs:поддакивать{}, // поддакивать в споре rus_verbs:прочертить{}, // прочертить в воздухе rus_verbs:отменять{}, // отменять в городе коменданский час rus_verbs:колдовать{}, // колдовать в лаборатории rus_verbs:отвозить{}, // отвозить в машине rus_verbs:трахать{}, // трахать в гамаке rus_verbs:повозиться{}, // повозиться в мешке rus_verbs:ремонтировать{}, // ремонтировать в центре rus_verbs:робеть{}, // робеть в гостях rus_verbs:перепробовать{}, // перепробовать в деле инфинитив:реализовать{ вид:соверш }, инфинитив:реализовать{ вид:несоверш }, // реализовать в новой версии глагол:реализовать{ вид:соверш }, глагол:реализовать{ вид:несоверш }, rus_verbs:покаяться{}, // покаяться в церкви rus_verbs:попрыгать{}, // попрыгать в бассейне rus_verbs:умалчивать{}, // умалчивать в своем докладе rus_verbs:ковыряться{}, // ковыряться в старой технике rus_verbs:расписывать{}, // расписывать в деталях rus_verbs:вязнуть{}, // вязнуть в песке rus_verbs:погрязнуть{}, // погрязнуть в скандалах rus_verbs:корениться{}, // корениться в неспособности выполнить поставленную задачу rus_verbs:зажимать{}, // зажимать в углу rus_verbs:стискивать{}, // стискивать в ладонях rus_verbs:практиковаться{}, // практиковаться в приготовлении соуса rus_verbs:израсходовать{}, // израсходовать в полете rus_verbs:клокотать{}, // клокотать в жерле rus_verbs:обвиняться{}, // обвиняться в растрате rus_verbs:уединиться{}, // уединиться в кладовке rus_verbs:подохнуть{}, // подохнуть в болоте rus_verbs:кипятиться{}, // кипятиться в чайнике rus_verbs:уродиться{}, // уродиться в лесу rus_verbs:продолжиться{}, // продолжиться в баре rus_verbs:расшифровать{}, // расшифровать в специальном устройстве rus_verbs:посапывать{}, // посапывать в кровати rus_verbs:скрючиться{}, // скрючиться в мешке rus_verbs:лютовать{}, // лютовать в отдаленных селах rus_verbs:расписать{}, // расписать в статье rus_verbs:публиковаться{}, // публиковаться в научном журнале rus_verbs:зарегистрировать{}, // зарегистрировать в комитете rus_verbs:прожечь{}, // прожечь в листе rus_verbs:переждать{}, // переждать в окопе rus_verbs:публиковать{}, // публиковать в журнале rus_verbs:морщить{}, // морщить в уголках глаз rus_verbs:спиться{}, // спиться в одиночестве rus_verbs:изведать{}, // изведать в гареме rus_verbs:обмануться{}, // обмануться в ожиданиях rus_verbs:сочетать{}, // сочетать в себе rus_verbs:подрабатывать{}, // подрабатывать в магазине rus_verbs:репетировать{}, // репетировать в студии rus_verbs:рябить{}, // рябить в глазах rus_verbs:намочить{}, // намочить в луже rus_verbs:скатать{}, // скатать в руке rus_verbs:одевать{}, // одевать в магазине rus_verbs:испечь{}, // испечь в духовке rus_verbs:сбрить{}, // сбрить в подмышках rus_verbs:зажужжать{}, // зажужжать в ухе rus_verbs:сберечь{}, // сберечь в тайном месте rus_verbs:согреться{}, // согреться в хижине инфинитив:дебютировать{ вид:несоверш }, инфинитив:дебютировать{ вид:соверш }, // дебютировать в спектакле глагол:дебютировать{ вид:несоверш }, глагол:дебютировать{ вид:соверш }, rus_verbs:переплыть{}, // переплыть в лодочке rus_verbs:передохнуть{}, // передохнуть в тени rus_verbs:отсвечивать{}, // отсвечивать в зеркалах rus_verbs:переправляться{}, // переправляться в лодках rus_verbs:накупить{}, // накупить в магазине rus_verbs:проторчать{}, // проторчать в очереди rus_verbs:проскальзывать{}, // проскальзывать в сообщениях rus_verbs:застукать{}, // застукать в солярии rus_verbs:наесть{}, // наесть в отпуске rus_verbs:подвизаться{}, // подвизаться в новом деле rus_verbs:вычистить{}, // вычистить в саду rus_verbs:кормиться{}, // кормиться в лесу rus_verbs:покурить{}, // покурить в саду rus_verbs:понизиться{}, // понизиться в ранге rus_verbs:зимовать{}, // зимовать в избушке rus_verbs:проверяться{}, // проверяться в службе безопасности rus_verbs:подпирать{}, // подпирать в первом забое rus_verbs:кувыркаться{}, // кувыркаться в постели rus_verbs:похрапывать{}, // похрапывать в постели rus_verbs:завязнуть{}, // завязнуть в песке rus_verbs:трактовать{}, // трактовать в исследовательской статье rus_verbs:замедляться{}, // замедляться в тяжелой воде rus_verbs:шастать{}, // шастать в здании rus_verbs:заночевать{}, // заночевать в пути rus_verbs:наметиться{}, // наметиться в исследованиях рака rus_verbs:освежить{}, // освежить в памяти rus_verbs:оспаривать{}, // оспаривать в суде rus_verbs:умещаться{}, // умещаться в ячейке rus_verbs:искупить{}, // искупить в бою rus_verbs:отсиживаться{}, // отсиживаться в тылу rus_verbs:мчать{}, // мчать в кабриолете rus_verbs:обличать{}, // обличать в своем выступлении rus_verbs:сгнить{}, // сгнить в тюряге rus_verbs:опробовать{}, // опробовать в деле rus_verbs:тренировать{}, // тренировать в зале rus_verbs:прославить{}, // прославить в академии rus_verbs:учитываться{}, // учитываться в дипломной работе rus_verbs:повеселиться{}, // повеселиться в лагере rus_verbs:поумнеть{}, // поумнеть в карцере rus_verbs:перестрелять{}, // перестрелять в воздухе rus_verbs:проведать{}, // проведать в больнице rus_verbs:измучиться{}, // измучиться в деревне rus_verbs:прощупать{}, // прощупать в глубине rus_verbs:изготовлять{}, // изготовлять в сарае rus_verbs:свирепствовать{}, // свирепствовать в популяции rus_verbs:иссякать{}, // иссякать в источнике rus_verbs:гнездиться{}, // гнездиться в дупле rus_verbs:разогнаться{}, // разогнаться в спортивной машине rus_verbs:опознавать{}, // опознавать в неизвестном rus_verbs:засвидетельствовать{}, // засвидетельствовать в суде rus_verbs:сконцентрировать{}, // сконцентрировать в своих руках rus_verbs:редактировать{}, // редактировать в редакторе rus_verbs:покупаться{}, // покупаться в магазине rus_verbs:промышлять{}, // промышлять в роще rus_verbs:растягиваться{}, // растягиваться в коридоре rus_verbs:приобретаться{}, // приобретаться в антикварных лавках инфинитив:подрезать{ вид:несоверш }, инфинитив:подрезать{ вид:соверш }, // подрезать в воде глагол:подрезать{ вид:несоверш }, глагол:подрезать{ вид:соверш }, rus_verbs:запечатлеться{}, // запечатлеться в мозгу rus_verbs:укрывать{}, // укрывать в подвале rus_verbs:закрепиться{}, // закрепиться в первой башне rus_verbs:освежать{}, // освежать в памяти rus_verbs:громыхать{}, // громыхать в ванной инфинитив:подвигаться{ вид:соверш }, инфинитив:подвигаться{ вид:несоверш }, // подвигаться в кровати глагол:подвигаться{ вид:соверш }, глагол:подвигаться{ вид:несоверш }, rus_verbs:добываться{}, // добываться в шахтах rus_verbs:растворить{}, // растворить в кислоте rus_verbs:приплясывать{}, // приплясывать в гримерке rus_verbs:доживать{}, // доживать в доме престарелых rus_verbs:отпраздновать{}, // отпраздновать в ресторане rus_verbs:сотрясаться{}, // сотрясаться в конвульсиях rus_verbs:помыть{}, // помыть в проточной воде инфинитив:увязать{ вид:несоверш }, инфинитив:увязать{ вид:соверш }, // увязать в песке глагол:увязать{ вид:несоверш }, глагол:увязать{ вид:соверш }, прилагательное:увязавший{ вид:несоверш }, rus_verbs:наличествовать{}, // наличествовать в запаснике rus_verbs:нащупывать{}, // нащупывать в кармане rus_verbs:повествоваться{}, // повествоваться в рассказе rus_verbs:отремонтировать{}, // отремонтировать в техцентре rus_verbs:покалывать{}, // покалывать в правом боку rus_verbs:сиживать{}, // сиживать в саду rus_verbs:разрабатываться{}, // разрабатываться в секретных лабораториях rus_verbs:укрепляться{}, // укрепляться в мнении rus_verbs:разниться{}, // разниться во взглядах rus_verbs:сполоснуть{}, // сполоснуть в водичке rus_verbs:скупать{}, // скупать в магазине rus_verbs:почесывать{}, // почесывать в паху rus_verbs:оформлять{}, // оформлять в конторе rus_verbs:распускаться{}, // распускаться в садах rus_verbs:зарябить{}, // зарябить в глазах rus_verbs:загореть{}, // загореть в Испании rus_verbs:очищаться{}, // очищаться в баке rus_verbs:остудить{}, // остудить в холодной воде rus_verbs:разбомбить{}, // разбомбить в горах rus_verbs:издохнуть{}, // издохнуть в бедности rus_verbs:проехаться{}, // проехаться в новой машине rus_verbs:задействовать{}, // задействовать в анализе rus_verbs:произрастать{}, // произрастать в степи rus_verbs:разуться{}, // разуться в прихожей rus_verbs:сооружать{}, // сооружать в огороде rus_verbs:зачитывать{}, // зачитывать в суде rus_verbs:состязаться{}, // состязаться в остроумии rus_verbs:ополоснуть{}, // ополоснуть в молоке rus_verbs:уместиться{}, // уместиться в кармане rus_verbs:совершенствоваться{}, // совершенствоваться в управлении мотоциклом rus_verbs:стираться{}, // стираться в стиральной машине rus_verbs:искупаться{}, // искупаться в прохладной реке rus_verbs:курировать{}, // курировать в правительстве rus_verbs:закупить{}, // закупить в магазине rus_verbs:плодиться{}, // плодиться в подходящих условиях rus_verbs:горланить{}, // горланить в парке rus_verbs:першить{}, // першить в горле rus_verbs:пригрезиться{}, // пригрезиться во сне rus_verbs:исправлять{}, // исправлять в тетрадке rus_verbs:расслабляться{}, // расслабляться в гамаке rus_verbs:скапливаться{}, // скапливаться в нижней части rus_verbs:сплетничать{}, // сплетничают в комнате rus_verbs:раздевать{}, // раздевать в кабинке rus_verbs:окопаться{}, // окопаться в лесу rus_verbs:загорать{}, // загорать в Испании rus_verbs:подпевать{}, // подпевать в церковном хоре rus_verbs:прожужжать{}, // прожужжать в динамике rus_verbs:изучаться{}, // изучаться в дикой природе rus_verbs:заклубиться{}, // заклубиться в воздухе rus_verbs:подметать{}, // подметать в зале rus_verbs:подозреваться{}, // подозреваться в совершении кражи rus_verbs:обогащать{}, // обогащать в специальном аппарате rus_verbs:издаться{}, // издаться в другом издательстве rus_verbs:справить{}, // справить в кустах нужду rus_verbs:помыться{}, // помыться в бане rus_verbs:проскакивать{}, // проскакивать в словах rus_verbs:попивать{}, // попивать в кафе чай rus_verbs:оформляться{}, // оформляться в регистратуре rus_verbs:чирикать{}, // чирикать в кустах rus_verbs:скупить{}, // скупить в магазинах rus_verbs:переночевать{}, // переночевать в гостинице rus_verbs:концентрироваться{}, // концентрироваться в пробирке rus_verbs:одичать{}, // одичать в лесу rus_verbs:ковырнуть{}, // ковырнуть в ухе rus_verbs:затеплиться{}, // затеплиться в глубине души rus_verbs:разгрести{}, // разгрести в задачах залежи rus_verbs:застопориться{}, // застопориться в начале списка rus_verbs:перечисляться{}, // перечисляться во введении rus_verbs:покататься{}, // покататься в парке аттракционов rus_verbs:изловить{}, // изловить в поле rus_verbs:прославлять{}, // прославлять в стихах rus_verbs:промочить{}, // промочить в луже rus_verbs:поделывать{}, // поделывать в отпуске rus_verbs:просуществовать{}, // просуществовать в первобытном состоянии rus_verbs:подстеречь{}, // подстеречь в подъезде rus_verbs:прикупить{}, // прикупить в магазине rus_verbs:перемешивать{}, // перемешивать в кастрюле rus_verbs:тискать{}, // тискать в углу rus_verbs:купать{}, // купать в теплой водичке rus_verbs:завариться{}, // завариться в стакане rus_verbs:притулиться{}, // притулиться в углу rus_verbs:пострелять{}, // пострелять в тире rus_verbs:навесить{}, // навесить в больнице инфинитив:изолировать{ вид:соверш }, инфинитив:изолировать{ вид:несоверш }, // изолировать в камере глагол:изолировать{ вид:соверш }, глагол:изолировать{ вид:несоверш }, rus_verbs:нежиться{}, // нежится в постельке rus_verbs:притомиться{}, // притомиться в школе rus_verbs:раздвоиться{}, // раздвоиться в глазах rus_verbs:навалить{}, // навалить в углу rus_verbs:замуровать{}, // замуровать в склепе rus_verbs:поселяться{}, // поселяться в кроне дуба rus_verbs:потягиваться{}, // потягиваться в кровати rus_verbs:укачать{}, // укачать в поезде rus_verbs:отлеживаться{}, // отлеживаться в гамаке rus_verbs:разменять{}, // разменять в кассе rus_verbs:прополоскать{}, // прополоскать в чистой теплой воде rus_verbs:ржаветь{}, // ржаветь в воде rus_verbs:уличить{}, // уличить в плагиате rus_verbs:мутиться{}, // мутиться в голове rus_verbs:растворять{}, // растворять в бензоле rus_verbs:двоиться{}, // двоиться в глазах rus_verbs:оговорить{}, // оговорить в договоре rus_verbs:подделать{}, // подделать в документе rus_verbs:зарегистрироваться{}, // зарегистрироваться в социальной сети rus_verbs:растолстеть{}, // растолстеть в талии rus_verbs:повоевать{}, // повоевать в городских условиях rus_verbs:прибраться{}, // гнушаться прибраться в хлеву rus_verbs:поглощаться{}, // поглощаться в металлической фольге rus_verbs:ухать{}, // ухать в лесу rus_verbs:подписываться{}, // подписываться в петиции rus_verbs:покатать{}, // покатать в машинке rus_verbs:излечиться{}, // излечиться в клинике rus_verbs:трепыхаться{}, // трепыхаться в мешке rus_verbs:кипятить{}, // кипятить в кастрюле rus_verbs:понастроить{}, // понастроить в прибрежной зоне rus_verbs:перебывать{}, // перебывать во всех европейских столицах rus_verbs:оглашать{}, // оглашать в итоговой части rus_verbs:преуспевать{}, // преуспевать в новом бизнесе rus_verbs:консультироваться{}, // консультироваться в техподдержке rus_verbs:накапливать{}, // накапливать в печени rus_verbs:перемешать{}, // перемешать в контейнере rus_verbs:наследить{}, // наследить в коридоре rus_verbs:выявиться{}, // выявиться в результе rus_verbs:забулькать{}, // забулькать в болоте rus_verbs:отваривать{}, // отваривать в молоке rus_verbs:запутываться{}, // запутываться в веревках rus_verbs:нагреться{}, // нагреться в микроволновой печке rus_verbs:рыбачить{}, // рыбачить в открытом море rus_verbs:укорениться{}, // укорениться в сознании широких народных масс rus_verbs:умывать{}, // умывать в тазике rus_verbs:защекотать{}, // защекотать в носу rus_verbs:заходиться{}, // заходиться в плаче инфинитив:искупать{ вид:соверш }, инфинитив:искупать{ вид:несоверш }, // искупать в прохладной водичке глагол:искупать{ вид:соверш }, глагол:искупать{ вид:несоверш }, деепричастие:искупав{}, деепричастие:искупая{}, rus_verbs:заморозить{}, // заморозить в холодильнике rus_verbs:закреплять{}, // закреплять в металлическом держателе rus_verbs:расхватать{}, // расхватать в магазине rus_verbs:истязать{}, // истязать в тюремном подвале rus_verbs:заржаветь{}, // заржаветь во влажной атмосфере rus_verbs:обжаривать{}, // обжаривать в подсолнечном масле rus_verbs:умереть{}, // Ты, подлый предатель, умрешь в нищете rus_verbs:подогреть{}, // подогрей в микроволновке rus_verbs:подогревать{}, rus_verbs:затянуть{}, // Кузнечики, сверчки, скрипачи и медведки затянули в траве свою трескучую музыку rus_verbs:проделать{}, // проделать в стене дыру инфинитив:жениться{ вид:соверш }, // жениться в Техасе инфинитив:жениться{ вид:несоверш }, глагол:жениться{ вид:соверш }, глагол:жениться{ вид:несоверш }, деепричастие:женившись{}, деепричастие:женясь{}, прилагательное:женатый{}, прилагательное:женившийся{вид:соверш}, прилагательное:женящийся{}, rus_verbs:всхрапнуть{}, // всхрапнуть во сне rus_verbs:всхрапывать{}, // всхрапывать во сне rus_verbs:ворочаться{}, // Собака ворочается во сне rus_verbs:воссоздаваться{}, // воссоздаваться в памяти rus_verbs:акклиматизироваться{}, // альпинисты готовятся акклиматизироваться в горах инфинитив:атаковать{ вид:несоверш }, // взвод был атакован в лесу инфинитив:атаковать{ вид:соверш }, глагол:атаковать{ вид:несоверш }, глагол:атаковать{ вид:соверш }, прилагательное:атакованный{}, прилагательное:атаковавший{}, прилагательное:атакующий{}, инфинитив:аккумулировать{вид:несоверш}, // энергия была аккумулирована в печени инфинитив:аккумулировать{вид:соверш}, глагол:аккумулировать{вид:несоверш}, глагол:аккумулировать{вид:соверш}, прилагательное:аккумулированный{}, прилагательное:аккумулирующий{}, //прилагательное:аккумулировавший{ вид:несоверш }, прилагательное:аккумулировавший{ вид:соверш }, rus_verbs:врисовывать{}, // врисовывать нового персонажа в анимацию rus_verbs:вырасти{}, // Он вырос в глазах коллег. rus_verbs:иметь{}, // Он всегда имел в резерве острое словцо. rus_verbs:убить{}, // убить в себе зверя инфинитив:абсорбироваться{ вид:соверш }, // жидкость абсорбируется в поглощающей ткани инфинитив:абсорбироваться{ вид:несоверш }, глагол:абсорбироваться{ вид:соверш }, глагол:абсорбироваться{ вид:несоверш }, rus_verbs:поставить{}, // поставить в углу rus_verbs:сжимать{}, // сжимать в кулаке rus_verbs:готовиться{}, // альпинисты готовятся акклиматизироваться в горах rus_verbs:аккумулироваться{}, // энергия аккумулируется в жировых отложениях инфинитив:активизироваться{ вид:несоверш }, // в горах активизировались повстанцы инфинитив:активизироваться{ вид:соверш }, глагол:активизироваться{ вид:несоверш }, глагол:активизироваться{ вид:соверш }, rus_verbs:апробировать{}, // пилот апробировал в ходе испытаний новый режим планера rus_verbs:арестовать{}, // наркодилер был арестован в помещении кафе rus_verbs:базировать{}, // установка будет базирована в лесу rus_verbs:барахтаться{}, // дети барахтались в воде rus_verbs:баррикадироваться{}, // преступники баррикадируются в помещении банка rus_verbs:барствовать{}, // Семен Семенович барствовал в своей деревне rus_verbs:бесчинствовать{}, // Боевики бесчинствовали в захваченном селе rus_verbs:блаженствовать{}, // Воробьи блаженствовали в кроне рябины rus_verbs:блуждать{}, // Туристы блуждали в лесу rus_verbs:брать{}, // Жена берет деньги в тумбочке rus_verbs:бродить{}, // парочки бродили в парке rus_verbs:обойти{}, // Бразилия обошла Россию в рейтинге rus_verbs:задержать{}, // Знаменитый советский фигурист задержан в США rus_verbs:бултыхаться{}, // Ноги бултыхаются в воде rus_verbs:вариться{}, // Курица варится в кастрюле rus_verbs:закончиться{}, // Эта рецессия закончилась в 2003 году rus_verbs:прокручиваться{}, // Ключ прокручивается в замке rus_verbs:прокрутиться{}, // Ключ трижды прокрутился в замке rus_verbs:храниться{}, // Настройки хранятся в текстовом файле rus_verbs:сохраняться{}, // Настройки сохраняются в текстовом файле rus_verbs:витать{}, // Мальчик витает в облаках rus_verbs:владычествовать{}, // Король владычествует в стране rus_verbs:властвовать{}, // Олигархи властвовали в стране rus_verbs:возбудить{}, // возбудить в сердце тоску rus_verbs:возбуждать{}, // возбуждать в сердце тоску rus_verbs:возвыситься{}, // возвыситься в глазах современников rus_verbs:возжечь{}, // возжечь в храме огонь rus_verbs:возжечься{}, // Огонь возжёгся в храме rus_verbs:возжигать{}, // возжигать в храме огонь rus_verbs:возжигаться{}, // Огонь возжигается в храме rus_verbs:вознамериваться{}, // вознамериваться уйти в монастырь rus_verbs:вознамериться{}, // вознамериться уйти в монастырь rus_verbs:возникать{}, // Новые идеи неожиданно возникают в колиной голове rus_verbs:возникнуть{}, // Новые идейки возникли в голове rus_verbs:возродиться{}, // возродиться в новом качестве rus_verbs:возрождать{}, // возрождать в новом качестве rus_verbs:возрождаться{}, // возрождаться в новом амплуа rus_verbs:ворошить{}, // ворошить в камине кочергой золу rus_verbs:воспевать{}, // Поэты воспевают героев в одах rus_verbs:воспеваться{}, // Герои воспеваются в одах поэтами rus_verbs:воспеть{}, // Поэты воспели в этой оде героев rus_verbs:воспретить{}, // воспретить в помещении азартные игры rus_verbs:восславить{}, // Поэты восславили в одах rus_verbs:восславлять{}, // Поэты восславляют в одах rus_verbs:восславляться{}, // Героя восславляются в одах rus_verbs:воссоздать{}, // воссоздает в памяти образ человека rus_verbs:воссоздавать{}, // воссоздать в памяти образ человека rus_verbs:воссоздаться{}, // воссоздаться в памяти rus_verbs:вскипятить{}, // вскипятить в чайнике воду rus_verbs:вскипятиться{}, // вскипятиться в чайнике rus_verbs:встретить{}, // встретить в классе старого приятеля rus_verbs:встретиться{}, // встретиться в классе rus_verbs:встречать{}, // встречать в лесу голодного медведя rus_verbs:встречаться{}, // встречаться в кафе rus_verbs:выбривать{}, // выбривать что-то в подмышках rus_verbs:выбрить{}, // выбрить что-то в паху rus_verbs:вывалять{}, // вывалять кого-то в грязи rus_verbs:вываляться{}, // вываляться в грязи rus_verbs:вываривать{}, // вываривать в молоке rus_verbs:вывариваться{}, // вывариваться в молоке rus_verbs:выварить{}, // выварить в молоке rus_verbs:вывариться{}, // вывариться в молоке rus_verbs:выгрызать{}, // выгрызать в сыре отверствие rus_verbs:выгрызть{}, // выгрызть в сыре отверстие rus_verbs:выгуливать{}, // выгуливать в парке собаку rus_verbs:выгулять{}, // выгулять в парке собаку rus_verbs:выдолбить{}, // выдолбить в стволе углубление rus_verbs:выжить{}, // выжить в пустыне rus_verbs:Выискать{}, // Выискать в программе ошибку rus_verbs:выискаться{}, // Ошибка выискалась в программе rus_verbs:выискивать{}, // выискивать в программе ошибку rus_verbs:выискиваться{}, // выискиваться в программе rus_verbs:выкраивать{}, // выкраивать в расписании время rus_verbs:выкраиваться{}, // выкраиваться в расписании инфинитив:выкупаться{aux stress="в^ыкупаться"}, // выкупаться в озере глагол:выкупаться{вид:соверш}, rus_verbs:выловить{}, // выловить в пруду rus_verbs:вымачивать{}, // вымачивать в молоке rus_verbs:вымачиваться{}, // вымачиваться в молоке rus_verbs:вынюхивать{}, // вынюхивать в траве следы rus_verbs:выпачкать{}, // выпачкать в смоле свою одежду rus_verbs:выпачкаться{}, // выпачкаться в грязи rus_verbs:вырастить{}, // вырастить в теплице ведро огурчиков rus_verbs:выращивать{}, // выращивать в теплице помидоры rus_verbs:выращиваться{}, // выращиваться в теплице rus_verbs:вырыть{}, // вырыть в земле глубокую яму rus_verbs:высадить{}, // высадить в пустынной местности rus_verbs:высадиться{}, // высадиться в пустынной местности rus_verbs:высаживать{}, // высаживать в пустыне rus_verbs:высверливать{}, // высверливать в доске отверствие rus_verbs:высверливаться{}, // высверливаться в стене rus_verbs:высверлить{}, // высверлить в стене отверствие rus_verbs:высверлиться{}, // высверлиться в стене rus_verbs:выскоблить{}, // выскоблить в столешнице канавку rus_verbs:высматривать{}, // высматривать в темноте rus_verbs:заметить{}, // заметить в помещении rus_verbs:оказаться{}, // оказаться в первых рядах rus_verbs:душить{}, // душить в объятиях rus_verbs:оставаться{}, // оставаться в классе rus_verbs:появиться{}, // впервые появиться в фильме rus_verbs:лежать{}, // лежать в футляре rus_verbs:раздаться{}, // раздаться в плечах rus_verbs:ждать{}, // ждать в здании вокзала rus_verbs:жить{}, // жить в трущобах rus_verbs:постелить{}, // постелить в прихожей rus_verbs:оказываться{}, // оказываться в неприятной ситуации rus_verbs:держать{}, // держать в голове rus_verbs:обнаружить{}, // обнаружить в себе способность rus_verbs:начинать{}, // начинать в лаборатории rus_verbs:рассказывать{}, // рассказывать в лицах rus_verbs:ожидать{}, // ожидать в помещении rus_verbs:продолжить{}, // продолжить в помещении rus_verbs:состоять{}, // состоять в группе rus_verbs:родиться{}, // родиться в рубашке rus_verbs:искать{}, // искать в кармане rus_verbs:иметься{}, // иметься в наличии rus_verbs:говориться{}, // говориться в среде панков rus_verbs:клясться{}, // клясться в верности rus_verbs:узнавать{}, // узнавать в нем своего сына rus_verbs:признаться{}, // признаться в ошибке rus_verbs:сомневаться{}, // сомневаться в искренности rus_verbs:толочь{}, // толочь в ступе rus_verbs:понадобиться{}, // понадобиться в суде rus_verbs:служить{}, // служить в пехоте rus_verbs:потолочь{}, // потолочь в ступе rus_verbs:появляться{}, // появляться в театре rus_verbs:сжать{}, // сжать в объятиях rus_verbs:действовать{}, // действовать в постановке rus_verbs:селить{}, // селить в гостинице rus_verbs:поймать{}, // поймать в лесу rus_verbs:увидать{}, // увидать в толпе rus_verbs:подождать{}, // подождать в кабинете rus_verbs:прочесть{}, // прочесть в глазах rus_verbs:тонуть{}, // тонуть в реке rus_verbs:ощущать{}, // ощущать в животе rus_verbs:ошибиться{}, // ошибиться в расчетах rus_verbs:отметить{}, // отметить в списке rus_verbs:показывать{}, // показывать в динамике rus_verbs:скрыться{}, // скрыться в траве rus_verbs:убедиться{}, // убедиться в корректности rus_verbs:прозвучать{}, // прозвучать в наушниках rus_verbs:разговаривать{}, // разговаривать в фойе rus_verbs:издать{}, // издать в России rus_verbs:прочитать{}, // прочитать в газете rus_verbs:попробовать{}, // попробовать в деле rus_verbs:замечать{}, // замечать в программе ошибку rus_verbs:нести{}, // нести в руках rus_verbs:пропасть{}, // пропасть в плену rus_verbs:носить{}, // носить в кармане rus_verbs:гореть{}, // гореть в аду rus_verbs:поправить{}, // поправить в программе rus_verbs:застыть{}, // застыть в неудобной позе rus_verbs:получать{}, // получать в кассе rus_verbs:потребоваться{}, // потребоваться в работе rus_verbs:спрятать{}, // спрятать в шкафу rus_verbs:учиться{}, // учиться в институте rus_verbs:развернуться{}, // развернуться в коридоре rus_verbs:подозревать{}, // подозревать в мошенничестве rus_verbs:играть{}, // играть в команде rus_verbs:сыграть{}, // сыграть в команде rus_verbs:строить{}, // строить в деревне rus_verbs:устроить{}, // устроить в доме вечеринку rus_verbs:находить{}, // находить в лесу rus_verbs:нуждаться{}, // нуждаться в деньгах rus_verbs:испытать{}, // испытать в рабочей обстановке rus_verbs:мелькнуть{}, // мелькнуть в прицеле rus_verbs:очутиться{}, // очутиться в закрытом помещении инфинитив:использовать{вид:соверш}, // использовать в работе инфинитив:использовать{вид:несоверш}, глагол:использовать{вид:несоверш}, глагол:использовать{вид:соверш}, rus_verbs:лететь{}, // лететь в самолете rus_verbs:смеяться{}, // смеяться в цирке rus_verbs:ездить{}, // ездить в лимузине rus_verbs:заснуть{}, // заснуть в неудобной позе rus_verbs:застать{}, // застать в неформальной обстановке rus_verbs:очнуться{}, // очнуться в незнакомой обстановке rus_verbs:твориться{}, // Что творится в закрытой зоне rus_verbs:разглядеть{}, // разглядеть в темноте rus_verbs:изучать{}, // изучать в естественных условиях rus_verbs:удержаться{}, // удержаться в седле rus_verbs:побывать{}, // побывать в зоопарке rus_verbs:уловить{}, // уловить в словах нотку отчаяния rus_verbs:приобрести{}, // приобрести в лавке rus_verbs:исчезать{}, // исчезать в тумане rus_verbs:уверять{}, // уверять в своей невиновности rus_verbs:продолжаться{}, // продолжаться в воздухе rus_verbs:открывать{}, // открывать в городе новый стадион rus_verbs:поддержать{}, // поддержать в парке порядок rus_verbs:солить{}, // солить в бочке rus_verbs:прожить{}, // прожить в деревне rus_verbs:создавать{}, // создавать в театре rus_verbs:обсуждать{}, // обсуждать в коллективе rus_verbs:заказать{}, // заказать в магазине rus_verbs:отыскать{}, // отыскать в гараже rus_verbs:уснуть{}, // уснуть в кресле rus_verbs:задержаться{}, // задержаться в театре rus_verbs:подобрать{}, // подобрать в коллекции rus_verbs:пробовать{}, // пробовать в работе rus_verbs:курить{}, // курить в закрытом помещении rus_verbs:устраивать{}, // устраивать в лесу засаду rus_verbs:установить{}, // установить в багажнике rus_verbs:запереть{}, // запереть в сарае rus_verbs:содержать{}, // содержать в достатке rus_verbs:синеть{}, // синеть в кислородной атмосфере rus_verbs:слышаться{}, // слышаться в голосе rus_verbs:закрыться{}, // закрыться в здании rus_verbs:скрываться{}, // скрываться в квартире rus_verbs:родить{}, // родить в больнице rus_verbs:описать{}, // описать в заметках rus_verbs:перехватить{}, // перехватить в коридоре rus_verbs:менять{}, // менять в магазине rus_verbs:скрывать{}, // скрывать в чужой квартире rus_verbs:стиснуть{}, // стиснуть в стальных объятиях rus_verbs:останавливаться{}, // останавливаться в гостинице rus_verbs:мелькать{}, // мелькать в телевизоре rus_verbs:присутствовать{}, // присутствовать в аудитории rus_verbs:украсть{}, // украсть в магазине rus_verbs:победить{}, // победить в войне rus_verbs:расположиться{}, // расположиться в гостинице rus_verbs:упомянуть{}, // упомянуть в своей книге rus_verbs:плыть{}, // плыть в старой бочке rus_verbs:нащупать{}, // нащупать в глубине rus_verbs:проявляться{}, // проявляться в работе rus_verbs:затихнуть{}, // затихнуть в норе rus_verbs:построить{}, // построить в гараже rus_verbs:поддерживать{}, // поддерживать в исправном состоянии rus_verbs:заработать{}, // заработать в стартапе rus_verbs:сломать{}, // сломать в суставе rus_verbs:снимать{}, // снимать в гардеробе rus_verbs:сохранить{}, // сохранить в коллекции rus_verbs:располагаться{}, // располагаться в отдельном кабинете rus_verbs:сражаться{}, // сражаться в честном бою rus_verbs:спускаться{}, // спускаться в батискафе rus_verbs:уничтожить{}, // уничтожить в схроне rus_verbs:изучить{}, // изучить в естественных условиях rus_verbs:рождаться{}, // рождаться в муках rus_verbs:пребывать{}, // пребывать в прострации rus_verbs:прилететь{}, // прилететь в аэробусе rus_verbs:догнать{}, // догнать в переулке rus_verbs:изобразить{}, // изобразить в танце rus_verbs:проехать{}, // проехать в легковушке rus_verbs:убедить{}, // убедить в разумности rus_verbs:приготовить{}, // приготовить в духовке rus_verbs:собирать{}, // собирать в лесу rus_verbs:поплыть{}, // поплыть в катере rus_verbs:доверять{}, // доверять в управлении rus_verbs:разобраться{}, // разобраться в законах rus_verbs:ловить{}, // ловить в озере rus_verbs:проесть{}, // проесть в куске металла отверстие rus_verbs:спрятаться{}, // спрятаться в подвале rus_verbs:провозгласить{}, // провозгласить в речи rus_verbs:изложить{}, // изложить в своём выступлении rus_verbs:замяться{}, // замяться в коридоре rus_verbs:раздаваться{}, // Крик ягуара раздается в джунглях rus_verbs:доказать{}, // Автор доказал в своей работе, что теорема верна rus_verbs:хранить{}, // хранить в шкатулке rus_verbs:шутить{}, // шутить в классе глагол:рассыпаться{ aux stress="рассып^аться" }, // рассыпаться в извинениях инфинитив:рассыпаться{ aux stress="рассып^аться" }, rus_verbs:чертить{}, // чертить в тетрадке rus_verbs:отразиться{}, // отразиться в аттестате rus_verbs:греть{}, // греть в микроволновке rus_verbs:зарычать{}, // Кто-то зарычал в глубине леса rus_verbs:рассуждать{}, // Автор рассуждает в своей статье rus_verbs:освободить{}, // Обвиняемые были освобождены в зале суда rus_verbs:окружать{}, // окружать в лесу rus_verbs:сопровождать{}, // сопровождать в операции rus_verbs:заканчиваться{}, // заканчиваться в дороге rus_verbs:поселиться{}, // поселиться в загородном доме rus_verbs:охватывать{}, // охватывать в хронологии rus_verbs:запеть{}, // запеть в кино инфинитив:провозить{вид:несоверш}, // провозить в багаже глагол:провозить{вид:несоверш}, rus_verbs:мочить{}, // мочить в сортире rus_verbs:перевернуться{}, // перевернуться в полёте rus_verbs:улететь{}, // улететь в теплые края rus_verbs:сдержать{}, // сдержать в руках rus_verbs:преследовать{}, // преследовать в любой другой стране rus_verbs:драться{}, // драться в баре rus_verbs:просидеть{}, // просидеть в классе rus_verbs:убираться{}, // убираться в квартире rus_verbs:содрогнуться{}, // содрогнуться в приступе отвращения rus_verbs:пугать{}, // пугать в прессе rus_verbs:отреагировать{}, // отреагировать в прессе rus_verbs:проверять{}, // проверять в аппарате rus_verbs:убеждать{}, // убеждать в отсутствии альтернатив rus_verbs:летать{}, // летать в комфортабельном частном самолёте rus_verbs:толпиться{}, // толпиться в фойе rus_verbs:плавать{}, // плавать в специальном костюме rus_verbs:пробыть{}, // пробыть в воде слишком долго rus_verbs:прикинуть{}, // прикинуть в уме rus_verbs:застрять{}, // застрять в лифте rus_verbs:метаться{}, // метаться в кровате rus_verbs:сжечь{}, // сжечь в печке rus_verbs:расслабиться{}, // расслабиться в ванной rus_verbs:услыхать{}, // услыхать в автобусе rus_verbs:удержать{}, // удержать в вертикальном положении rus_verbs:образоваться{}, // образоваться в верхних слоях атмосферы rus_verbs:рассмотреть{}, // рассмотреть в капле воды rus_verbs:просмотреть{}, // просмотреть в браузере rus_verbs:учесть{}, // учесть в планах rus_verbs:уезжать{}, // уезжать в чьей-то машине rus_verbs:похоронить{}, // похоронить в мерзлой земле rus_verbs:растянуться{}, // растянуться в расслабленной позе rus_verbs:обнаружиться{}, // обнаружиться в чужой сумке rus_verbs:гулять{}, // гулять в парке rus_verbs:утонуть{}, // утонуть в реке rus_verbs:зажать{}, // зажать в медвежьих объятиях rus_verbs:усомниться{}, // усомниться в объективности rus_verbs:танцевать{}, // танцевать в спортзале rus_verbs:проноситься{}, // проноситься в голове rus_verbs:трудиться{}, // трудиться в кооперативе глагол:засыпать{ aux stress="засып^ать" переходность:непереходный }, // засыпать в спальном мешке инфинитив:засыпать{ aux stress="засып^ать" переходность:непереходный }, rus_verbs:сушить{}, // сушить в сушильном шкафу rus_verbs:зашевелиться{}, // зашевелиться в траве rus_verbs:обдумывать{}, // обдумывать в спокойной обстановке rus_verbs:промелькнуть{}, // промелькнуть в окне rus_verbs:поучаствовать{}, // поучаствовать в обсуждении rus_verbs:закрыть{}, // закрыть в комнате rus_verbs:запирать{}, // запирать в комнате rus_verbs:закрывать{}, // закрывать в доме rus_verbs:заблокировать{}, // заблокировать в доме rus_verbs:зацвести{}, // В садах зацвела сирень rus_verbs:кричать{}, // Какое-то животное кричало в ночном лесу. rus_verbs:поглотить{}, // фотон, поглощенный в рецепторе rus_verbs:стоять{}, // войска, стоявшие в Риме rus_verbs:закалить{}, // ветераны, закаленные в боях rus_verbs:выступать{}, // пришлось выступать в тюрьме. rus_verbs:выступить{}, // пришлось выступить в тюрьме. rus_verbs:закопошиться{}, // Мыши закопошились в траве rus_verbs:воспламениться{}, // смесь, воспламенившаяся в цилиндре rus_verbs:воспламеняться{}, // смесь, воспламеняющаяся в цилиндре rus_verbs:закрываться{}, // закрываться в комнате rus_verbs:провалиться{}, // провалиться в прокате деепричастие:авторизируясь{ вид:несоверш }, глагол:авторизироваться{ вид:несоверш }, инфинитив:авторизироваться{ вид:несоверш }, // авторизироваться в системе rus_verbs:существовать{}, // существовать в вакууме деепричастие:находясь{}, прилагательное:находившийся{}, прилагательное:находящийся{}, глагол:находиться{ вид:несоверш }, инфинитив:находиться{ вид:несоверш }, // находиться в вакууме rus_verbs:регистрировать{}, // регистрировать в инспекции глагол:перерегистрировать{ вид:несоверш }, глагол:перерегистрировать{ вид:соверш }, инфинитив:перерегистрировать{ вид:несоверш }, инфинитив:перерегистрировать{ вид:соверш }, // перерегистрировать в инспекции rus_verbs:поковыряться{}, // поковыряться в носу rus_verbs:оттаять{}, // оттаять в кипятке rus_verbs:распинаться{}, // распинаться в проклятиях rus_verbs:отменить{}, // Министерство связи предлагает отменить внутренний роуминг в России rus_verbs:столкнуться{}, // Американский эсминец и японский танкер столкнулись в Персидском заливе rus_verbs:ценить{}, // Он очень ценил в статьях краткость изложения. прилагательное:несчастный{}, // Он очень несчастен в семейной жизни. rus_verbs:объясниться{}, // Он объяснился в любви. прилагательное:нетвердый{}, // Он нетвёрд в истории. rus_verbs:заниматься{}, // Он занимается в читальном зале. rus_verbs:вращаться{}, // Он вращается в учёных кругах. прилагательное:спокойный{}, // Он был спокоен и уверен в завтрашнем дне. rus_verbs:бегать{}, // Он бегал по городу в поисках квартиры. rus_verbs:заключать{}, // Письмо заключало в себе очень важные сведения. rus_verbs:срабатывать{}, // Алгоритм срабатывает в половине случаев. rus_verbs:специализироваться{}, // мы специализируемся в создании ядерного оружия rus_verbs:сравниться{}, // Никто не может сравниться с ним в знаниях. rus_verbs:продолжать{}, // Продолжайте в том же духе. rus_verbs:говорить{}, // Не говорите об этом в присутствии третьих лиц. rus_verbs:болтать{}, // Не болтай в присутствии начальника! rus_verbs:проболтаться{}, // Не проболтайся в присутствии начальника! rus_verbs:повторить{}, // Он должен повторить свои показания в присутствии свидетелей rus_verbs:получить{}, // ректор поздравил студентов, получивших в этом семестре повышенную стипендию rus_verbs:приобретать{}, // Эту еду мы приобретаем в соседнем магазине. rus_verbs:расходиться{}, // Маша и Петя расходятся во взглядах rus_verbs:сходиться{}, // Все дороги сходятся в Москве rus_verbs:убирать{}, // убирать в комнате rus_verbs:удостоверяться{}, // он удостоверяется в личности специалиста rus_verbs:уединяться{}, // уединяться в пустыне rus_verbs:уживаться{}, // уживаться в одном коллективе rus_verbs:укорять{}, // укорять друга в забывчивости rus_verbs:читать{}, // он читал об этом в журнале rus_verbs:состояться{}, // В Израиле состоятся досрочные парламентские выборы rus_verbs:погибнуть{}, // Список погибших в авиакатастрофе под Ярославлем rus_verbs:работать{}, // Я работаю в театре. rus_verbs:признать{}, // Я признал в нём старого друга. rus_verbs:преподавать{}, // Я преподаю в университете. rus_verbs:понимать{}, // Я плохо понимаю в живописи. rus_verbs:водиться{}, // неизвестный науке зверь, который водится в жарких тропических лесах rus_verbs:разразиться{}, // В Москве разразилась эпидемия гриппа rus_verbs:замереть{}, // вся толпа замерла в восхищении rus_verbs:сидеть{}, // Я люблю сидеть в этом удобном кресле. rus_verbs:идти{}, // Я иду в неопределённом направлении. rus_verbs:заболеть{}, // Я заболел в дороге. rus_verbs:ехать{}, // Я еду в автобусе rus_verbs:взять{}, // Я взял книгу в библиотеке на неделю. rus_verbs:провести{}, // Юные годы он провёл в Италии. rus_verbs:вставать{}, // Этот случай живо встаёт в моей памяти. rus_verbs:возвысить{}, // Это событие возвысило его в общественном мнении. rus_verbs:произойти{}, // Это произошло в одном городе в Японии. rus_verbs:привидеться{}, // Это мне привиделось во сне. rus_verbs:держаться{}, // Это дело держится в большом секрете. rus_verbs:привиться{}, // Это выражение не привилось в русском языке. rus_verbs:восстановиться{}, // Эти писатели восстановились в правах. rus_verbs:быть{}, // Эта книга есть в любом книжном магазине. прилагательное:популярный{}, // Эта идея очень популярна в массах. rus_verbs:шуметь{}, // Шумит в голове. rus_verbs:остаться{}, // Шляпа осталась в поезде. rus_verbs:выражаться{}, // Характер писателя лучше всего выражается в его произведениях. rus_verbs:воспитать{}, // Учительница воспитала в детях любовь к природе. rus_verbs:пересохнуть{}, // У меня в горле пересохло. rus_verbs:щекотать{}, // У меня в горле щекочет. rus_verbs:колоть{}, // У меня в боку колет. прилагательное:свежий{}, // Событие ещё свежо в памяти. rus_verbs:собрать{}, // Соберите всех учеников во дворе. rus_verbs:белеть{}, // Снег белеет в горах. rus_verbs:сделать{}, // Сколько орфографических ошибок ты сделал в диктанте? rus_verbs:таять{}, // Сахар тает в кипятке. rus_verbs:жать{}, // Сапог жмёт в подъёме. rus_verbs:возиться{}, // Ребята возятся в углу. rus_verbs:распоряжаться{}, // Прошу не распоряжаться в чужом доме. rus_verbs:кружиться{}, // Они кружились в вальсе. rus_verbs:выставлять{}, // Они выставляют его в смешном виде. rus_verbs:бывать{}, // Она часто бывает в обществе. rus_verbs:петь{}, // Она поёт в опере. rus_verbs:сойтись{}, // Все свидетели сошлись в своих показаниях. rus_verbs:валяться{}, // Вещи валялись в беспорядке. rus_verbs:пройти{}, // Весь день прошёл в беготне. rus_verbs:продавать{}, // В этом магазине продают обувь. rus_verbs:заключаться{}, // В этом заключается вся сущность. rus_verbs:звенеть{}, // В ушах звенит. rus_verbs:проступить{}, // В тумане проступили очертания корабля. rus_verbs:бить{}, // В саду бьёт фонтан. rus_verbs:проскользнуть{}, // В речи проскользнул упрёк. rus_verbs:оставить{}, // Не оставь товарища в опасности. rus_verbs:прогулять{}, // Мы прогуляли час в парке. rus_verbs:перебить{}, // Мы перебили врагов в бою. rus_verbs:остановиться{}, // Мы остановились в первой попавшейся гостинице. rus_verbs:видеть{}, // Он многое видел в жизни. // глагол:проходить{ вид:несоверш }, // Беседа проходила в дружественной атмосфере. rus_verbs:подать{}, // Автор подал своих героев в реалистических тонах. rus_verbs:кинуть{}, // Он кинул меня в беде. rus_verbs:приходить{}, // Приходи в сентябре rus_verbs:воскрешать{}, // воскрешать в памяти rus_verbs:соединять{}, // соединять в себе rus_verbs:разбираться{}, // умение разбираться в вещах rus_verbs:делать{}, // В её комнате делали обыск. rus_verbs:воцариться{}, // В зале воцарилась глубокая тишина. rus_verbs:начаться{}, // В деревне начались полевые работы. rus_verbs:блеснуть{}, // В голове блеснула хорошая мысль. rus_verbs:вертеться{}, // В голове вертится вчерашний разговор. rus_verbs:веять{}, // В воздухе веет прохладой. rus_verbs:висеть{}, // В воздухе висит зной. rus_verbs:носиться{}, // В воздухе носятся комары. rus_verbs:грести{}, // Грести в спокойной воде будет немного легче, но скучнее rus_verbs:воскресить{}, // воскресить в памяти rus_verbs:поплавать{}, // поплавать в 100-метровом бассейне rus_verbs:пострадать{}, // В массовой драке пострадал 23-летний мужчина прилагательное:уверенный{ причастие }, // Она уверена в своих силах. прилагательное:постоянный{}, // Она постоянна во вкусах. прилагательное:сильный{}, // Он не силён в математике. прилагательное:повинный{}, // Он не повинен в этом. прилагательное:возможный{}, // Ураганы, сильные грозы и даже смерчи возможны в конце периода сильной жары rus_verbs:вывести{}, // способный летать над землей крокодил был выведен в секретной лаборатории прилагательное:нужный{}, // сковородка тоже нужна в хозяйстве. rus_verbs:сесть{}, // Она села в тени rus_verbs:заливаться{}, // в нашем парке заливаются соловьи rus_verbs:разнести{}, // В лесу огонь пожара мгновенно разнесло rus_verbs:чувствоваться{}, // В тёплом, но сыром воздухе остро чувствовалось дыхание осени // rus_verbs:расти{}, // дерево, растущее в лесу rus_verbs:происходить{}, // что происходит в поликлиннике rus_verbs:спать{}, // кто спит в моей кровати rus_verbs:мыть{}, // мыть машину в саду ГЛ_ИНФ(царить), // В воздухе царило безмолвие ГЛ_ИНФ(мести), // мести в прихожей пол ГЛ_ИНФ(прятать), // прятать в яме ГЛ_ИНФ(увидеть), прилагательное:увидевший{}, деепричастие:увидев{}, // увидел периодическую таблицу элементов во сне. // ГЛ_ИНФ(собраться), // собраться в порту ГЛ_ИНФ(случиться), // что-то случилось в больнице ГЛ_ИНФ(зажечься), // в небе зажглись звёзды ГЛ_ИНФ(купить), // купи молока в магазине прилагательное:пропагандировавшийся{} // группа студентов университета дружбы народов, активно пропагандировавшейся в СССР } // Чтобы разрешить связывание в паттернах типа: пообедать в macdonalds fact гл_предл { if context { Гл_В_Предл предлог:в{} @regex("[a-z]+[0-9]*") } then return true } fact гл_предл { if context { Гл_В_Предл предлог:в{} *:*{ падеж:предл } } then return true } // С локативом: // собраться в порту fact гл_предл { if context { Гл_В_Предл предлог:в{} существительное:*{ падеж:мест } } then return true } #endregion Предложный #region Винительный // Для глаголов движения с выраженным направлением действия может присоединяться // предложный паттерн с винительным падежом. wordentry_set Гл_В_Вин = { rus_verbs:вдавиться{}, // Дуло больно вдавилось в позвонок. глагол:ввергнуть{}, // Двух прелестнейших дам он ввергнул в горе. глагол:ввергать{}, инфинитив:ввергнуть{}, инфинитив:ввергать{}, rus_verbs:двинуться{}, // Двинулись в путь и мы. rus_verbs:сплавать{}, // Сплавать в Россию! rus_verbs:уложиться{}, // Уложиться в воскресенье. rus_verbs:спешить{}, // Спешите в Лондон rus_verbs:кинуть{}, // Киньте в море. rus_verbs:проситься{}, // Просилась в Никарагуа. rus_verbs:притопать{}, // Притопал в Будапешт. rus_verbs:скататься{}, // Скатался в Красноярск. rus_verbs:соскользнуть{}, // Соскользнул в пике. rus_verbs:соскальзывать{}, rus_verbs:играть{}, // Играл в дутье. глагол:айда{}, // Айда в каморы. rus_verbs:отзывать{}, // Отзывали в Москву... rus_verbs:сообщаться{}, // Сообщается в Лондон. rus_verbs:вдуматься{}, // Вдумайтесь в них. rus_verbs:проехать{}, // Проехать в Лунево... rus_verbs:спрыгивать{}, // Спрыгиваем в него. rus_verbs:верить{}, // Верю в вас! rus_verbs:прибыть{}, // Прибыл в Подмосковье. rus_verbs:переходить{}, // Переходите в школу. rus_verbs:доложить{}, // Доложили в Москву. rus_verbs:подаваться{}, // Подаваться в Россию? rus_verbs:спрыгнуть{}, // Спрыгнул в него. rus_verbs:вывезти{}, // Вывезли в Китай. rus_verbs:пропихивать{}, // Я очень аккуратно пропихивал дуло в ноздрю. rus_verbs:пропихнуть{}, rus_verbs:транспортироваться{}, rus_verbs:закрадываться{}, // в голову начали закрадываться кое-какие сомнения и подозрения rus_verbs:дуть{}, rus_verbs:БОГАТЕТЬ{}, // rus_verbs:РАЗБОГАТЕТЬ{}, // rus_verbs:ВОЗРАСТАТЬ{}, // rus_verbs:ВОЗРАСТИ{}, // rus_verbs:ПОДНЯТЬ{}, // Он поднял половинку самолета в воздух и на всей скорости повел ее к горам. (ПОДНЯТЬ) rus_verbs:ОТКАТИТЬСЯ{}, // Услышав за спиной дыхание, он прыгнул вперед и откатился в сторону, рассчитывая ускользнуть от врага, нападавшего сзади (ОТКАТИТЬСЯ) rus_verbs:ВПЛЕТАТЬСЯ{}, // В общий смрад вплеталось зловонье пены, летевшей из пастей, и крови из легких (ВПЛЕТАТЬСЯ) rus_verbs:ЗАМАНИТЬ{}, // Они подумали, что Павел пытается заманить их в зону обстрела. (ЗАМАНИТЬ,ЗАМАНИВАТЬ) rus_verbs:ЗАМАНИВАТЬ{}, rus_verbs:ПРОТРУБИТЬ{}, // Эти врата откроются, когда он протрубит в рог, и пропустят его в другую вселенную. (ПРОТРУБИТЬ) rus_verbs:ВРУБИТЬСЯ{}, // Клинок сломался, не врубившись в металл. (ВРУБИТЬСЯ/ВРУБАТЬСЯ) rus_verbs:ВРУБАТЬСЯ{}, rus_verbs:ОТПРАВИТЬ{}, // Мы ищем благородного вельможу, который нанял бы нас или отправил в рыцарский поиск. (ОТПРАВИТЬ) rus_verbs:ОБЛАЧИТЬ{}, // Этот был облачен в сверкавшие красные доспехи с опущенным забралом и держал огромное копье, дожидаясь своей очереди. (ОБЛАЧИТЬ/ОБЛАЧАТЬ/ОБЛАЧИТЬСЯ/ОБЛАЧАТЬСЯ/НАРЯДИТЬСЯ/НАРЯЖАТЬСЯ) rus_verbs:ОБЛАЧАТЬ{}, rus_verbs:ОБЛАЧИТЬСЯ{}, rus_verbs:ОБЛАЧАТЬСЯ{}, rus_verbs:НАРЯДИТЬСЯ{}, rus_verbs:НАРЯЖАТЬСЯ{}, rus_verbs:ЗАХВАТИТЬ{}, // Кроме набранного рабского материала обычного типа, он захватил в плен группу очень странных созданий, а также женщину исключительной красоты (ЗАХВАТИТЬ/ЗАХВАТЫВАТЬ/ЗАХВАТ) rus_verbs:ЗАХВАТЫВАТЬ{}, rus_verbs:ПРОВЕСТИ{}, // Он провел их в маленькое святилище позади штурвала. (ПРОВЕСТИ) rus_verbs:ПОЙМАТЬ{}, // Их можно поймать в ловушку (ПОЙМАТЬ) rus_verbs:СТРОИТЬСЯ{}, // На вершине они остановились, строясь в круг. (СТРОИТЬСЯ,ПОСТРОИТЬСЯ,ВЫСТРОИТЬСЯ) rus_verbs:ПОСТРОИТЬСЯ{}, rus_verbs:ВЫСТРОИТЬСЯ{}, rus_verbs:ВЫПУСТИТЬ{}, // Несколько стрел, выпущенных в преследуемых, вонзились в траву (ВЫПУСТИТЬ/ВЫПУСКАТЬ) rus_verbs:ВЫПУСКАТЬ{}, rus_verbs:ВЦЕПЛЯТЬСЯ{}, // Они вцепляются тебе в горло. (ВЦЕПЛЯТЬСЯ/ВЦЕПИТЬСЯ) rus_verbs:ВЦЕПИТЬСЯ{}, rus_verbs:ПАЛЬНУТЬ{}, // Вольф вставил в тетиву новую стрелу и пальнул в белое брюхо (ПАЛЬНУТЬ) rus_verbs:ОТСТУПИТЬ{}, // Вольф отступил в щель. (ОТСТУПИТЬ/ОТСТУПАТЬ) rus_verbs:ОТСТУПАТЬ{}, rus_verbs:КРИКНУТЬ{}, // Вольф крикнул в ответ и медленно отступил от птицы. (КРИКНУТЬ) rus_verbs:ДЫХНУТЬ{}, // В лицо ему дыхнули винным перегаром. (ДЫХНУТЬ) rus_verbs:ПОТРУБИТЬ{}, // Я видел рог во время своих скитаний по дворцу и даже потрубил в него (ПОТРУБИТЬ) rus_verbs:ОТКРЫВАТЬСЯ{}, // Некоторые врата открывались в другие вселенные (ОТКРЫВАТЬСЯ) rus_verbs:ТРУБИТЬ{}, // А я трубил в рог (ТРУБИТЬ) rus_verbs:ПЫРНУТЬ{}, // Вольф пырнул его в бок. (ПЫРНУТЬ) rus_verbs:ПРОСКРЕЖЕТАТЬ{}, // Тот что-то проскрежетал в ответ, а затем наорал на него. (ПРОСКРЕЖЕТАТЬ В вин, НАОРАТЬ НА вин) rus_verbs:ИМПОРТИРОВАТЬ{}, // импортировать товары двойного применения только в Российскую Федерацию (ИМПОРТИРОВАТЬ) rus_verbs:ОТЪЕХАТЬ{}, // Легкий грохот катков заглушил рог, когда дверь отъехала в сторону. (ОТЪЕХАТЬ) rus_verbs:ПОПЛЕСТИСЬ{}, // Подобрав нижнее белье, носки и ботинки, он поплелся по песку обратно в джунгли. (ПОПЛЕЛСЯ) rus_verbs:СЖАТЬСЯ{}, // Желудок у него сжался в кулак. (СЖАТЬСЯ, СЖИМАТЬСЯ) rus_verbs:СЖИМАТЬСЯ{}, rus_verbs:проверять{}, // Школьников будут принудительно проверять на курение rus_verbs:ПОТЯНУТЬ{}, // Я потянул его в кино (ПОТЯНУТЬ) rus_verbs:ПЕРЕВЕСТИ{}, // Премьер-министр Казахстана поручил до конца года перевести все социально-значимые услуги в электронный вид (ПЕРЕВЕСТИ) rus_verbs:КРАСИТЬ{}, // Почему китайские партийные боссы красят волосы в черный цвет? (КРАСИТЬ/ПОКРАСИТЬ/ПЕРЕКРАСИТЬ/ОКРАСИТЬ/ЗАКРАСИТЬ) rus_verbs:ПОКРАСИТЬ{}, // rus_verbs:ПЕРЕКРАСИТЬ{}, // rus_verbs:ОКРАСИТЬ{}, // rus_verbs:ЗАКРАСИТЬ{}, // rus_verbs:СООБЩИТЬ{}, // Мужчина ранил человека в щеку и сам сообщил об этом в полицию (СООБЩИТЬ) rus_verbs:СТЯГИВАТЬ{}, // Но толщина пузыря постоянно меняется из-за гравитации, которая стягивает жидкость в нижнюю часть (СТЯГИВАТЬ/СТЯНУТЬ/ЗАТЯНУТЬ/ВТЯНУТЬ) rus_verbs:СТЯНУТЬ{}, // rus_verbs:ЗАТЯНУТЬ{}, // rus_verbs:ВТЯНУТЬ{}, // rus_verbs:СОХРАНИТЬ{}, // сохранить данные в файл (СОХРАНИТЬ) деепричастие:придя{}, // Немного придя в себя rus_verbs:наблюдать{}, // Судья , долго наблюдавший в трубу , вдруг вскричал rus_verbs:УЛЫБАТЬСЯ{}, // она улыбалась во весь рот (УЛЫБАТЬСЯ) rus_verbs:МЕТНУТЬСЯ{}, // она метнулась обратно во тьму (МЕТНУТЬСЯ) rus_verbs:ПОСЛЕДОВАТЬ{}, // большинство жителей города последовало за ним во дворец (ПОСЛЕДОВАТЬ) rus_verbs:ПЕРЕМЕЩАТЬСЯ{}, // экстремисты перемещаются из лесов в Сеть (ПЕРЕМЕЩАТЬСЯ) rus_verbs:ВЫТАЩИТЬ{}, // Алексей позволил вытащить себя через дверь во тьму (ВЫТАЩИТЬ) rus_verbs:СЫПАТЬСЯ{}, // внизу под ними камни градом сыпались во двор (СЫПАТЬСЯ) rus_verbs:выезжать{}, // заключенные сами шьют куклы и иногда выезжают с представлениями в детский дом неподалеку rus_verbs:КРИЧАТЬ{}, // ей хотелось кричать во весь голос (КРИЧАТЬ В вин) rus_verbs:ВЫПРЯМИТЬСЯ{}, // волк выпрямился во весь огромный рост (ВЫПРЯМИТЬСЯ В вин) rus_verbs:спрятать{}, // Джон спрятал очки во внутренний карман (спрятать в вин) rus_verbs:ЭКСТРАДИРОВАТЬ{}, // Украина экстрадирует в Таджикистан задержанного бывшего премьер-министра (ЭКСТРАДИРОВАТЬ В вин) rus_verbs:ВВОЗИТЬ{}, // лабораторный мониторинг ввозимой в Россию мясной продукции из США (ВВОЗИТЬ В вин) rus_verbs:УПАКОВАТЬ{}, // упакованных в несколько слоев полиэтилена (УПАКОВАТЬ В вин) rus_verbs:ОТТЯГИВАТЬ{}, // использовать естественную силу гравитации, оттягивая объекты в сторону и изменяя их орбиту (ОТТЯГИВАТЬ В вин) rus_verbs:ПОЗВОНИТЬ{}, // они позвонили в отдел экологии городской администрации (ПОЗВОНИТЬ В) rus_verbs:ПРИВЛЕЧЬ{}, // Открытость данных о лесе поможет привлечь инвестиции в отрасль (ПРИВЛЕЧЬ В) rus_verbs:ЗАПРОСИТЬСЯ{}, // набегавшись и наплясавшись, Стасик утомился и запросился в кроватку (ЗАПРОСИТЬСЯ В) rus_verbs:ОТСТАВИТЬ{}, // бутыль с ацетоном Витька отставил в сторонку (ОТСТАВИТЬ В) rus_verbs:ИСПОЛЬЗОВАТЬ{}, // ты использовал свою магию во зло. (ИСПОЛЬЗОВАТЬ В вин) rus_verbs:ВЫСЕВАТЬ{}, // В апреле редис возможно уже высевать в грунт (ВЫСЕВАТЬ В) rus_verbs:ЗАГНАТЬ{}, // Американский психолог загнал любовь в три угла (ЗАГНАТЬ В) rus_verbs:ЭВОЛЮЦИОНИРОВАТЬ{}, // Почему не все обезьяны эволюционировали в человека? (ЭВОЛЮЦИОНИРОВАТЬ В вин) rus_verbs:СФОТОГРАФИРОВАТЬСЯ{}, // Он сфотографировался во весь рост. (СФОТОГРАФИРОВАТЬСЯ В) rus_verbs:СТАВИТЬ{}, // Он ставит мне в упрёк свою ошибку. (СТАВИТЬ В) rus_verbs:расщепляться{}, // Сахароза же быстро расщепляется в пищеварительном тракте на глюкозу и фруктозу (РАСЩЕПЛЯТЬСЯ В, НА) rus_verbs:ПЕРЕСЕЛЯТЬСЯ{}, // Греки переселяются в Германию (ПЕРЕСЕЛЯТЬСЯ В) rus_verbs:ФОРМИРОВАТЬСЯ{}, // Сахарная свекла относится к двулетним растениям, мясистый корнеплод формируется в первый год. (ФОРМИРОВАТЬСЯ В) rus_verbs:ПРОВОРЧАТЬ{}, // дедуля что-то проворчал в ответ (ПРОВОРЧАТЬ В) rus_verbs:БУРКНУТЬ{}, // нелюдимый парень что-то буркнул в ответ (БУРКНУТЬ В) rus_verbs:ВЕСТИ{}, // дверь вела во тьму. (ВЕСТИ В) rus_verbs:ВЫСКОЧИТЬ{}, // беглецы выскочили во двор. (ВЫСКОЧИТЬ В) rus_verbs:ДОСЫЛАТЬ{}, // Одним движением стрелок досылает патрон в ствол (ДОСЫЛАТЬ В) rus_verbs:СЪЕХАТЬСЯ{}, // Финалисты съехались на свои игры в Лос-Анжелес. (СЪЕХАТЬСЯ НА, В) rus_verbs:ВЫТЯНУТЬ{}, // Дым вытянуло в трубу. (ВЫТЯНУТЬ В) rus_verbs:торчать{}, // острые обломки бревен торчали во все стороны. rus_verbs:ОГЛЯДЫВАТЬ{}, // Она оглядывает себя в зеркало. (ОГЛЯДЫВАТЬ В) rus_verbs:ДЕЙСТВОВАТЬ{}, // Этот пакет законов действует в ущерб частным предпринимателям. rus_verbs:РАЗЛЕТЕТЬСЯ{}, // люди разлетелись во все стороны. (РАЗЛЕТЕТЬСЯ В) rus_verbs:брызнуть{}, // во все стороны брызнула кровь. (брызнуть в) rus_verbs:ТЯНУТЬСЯ{}, // провода тянулись во все углы. (ТЯНУТЬСЯ В) rus_verbs:валить{}, // валить все в одну кучу (валить в) rus_verbs:выдвинуть{}, // его выдвинули в палату представителей (выдвинуть в) rus_verbs:карабкаться{}, // карабкаться в гору (карабкаться в) rus_verbs:клониться{}, // он клонился в сторону (клониться в) rus_verbs:командировать{}, // мы командировали нашего представителя в Рим (командировать в) rus_verbs:запасть{}, // Эти слова запали мне в душу. rus_verbs:давать{}, // В этой лавке дают в долг? rus_verbs:ездить{}, // Каждый день грузовик ездит в город. rus_verbs:претвориться{}, // Замысел претворился в жизнь. rus_verbs:разойтись{}, // Они разошлись в разные стороны. rus_verbs:выйти{}, // Охотник вышел в поле с ружьём. rus_verbs:отозвать{}, // Отзовите его в сторону и скажите ему об этом. rus_verbs:расходиться{}, // Маша и Петя расходятся в разные стороны rus_verbs:переодеваться{}, // переодеваться в женское платье rus_verbs:перерастать{}, // перерастать в массовые беспорядки rus_verbs:завязываться{}, // завязываться в узел rus_verbs:похватать{}, // похватать в руки rus_verbs:увлечь{}, // увлечь в прогулку по парку rus_verbs:помещать{}, // помещать в изолятор rus_verbs:зыркнуть{}, // зыркнуть в окошко rus_verbs:закатать{}, // закатать в асфальт rus_verbs:усаживаться{}, // усаживаться в кресло rus_verbs:загонять{}, // загонять в сарай rus_verbs:подбрасывать{}, // подбрасывать в воздух rus_verbs:телеграфировать{}, // телеграфировать в центр rus_verbs:вязать{}, // вязать в стопы rus_verbs:подлить{}, // подлить в огонь rus_verbs:заполучить{}, // заполучить в распоряжение rus_verbs:подогнать{}, // подогнать в док rus_verbs:ломиться{}, // ломиться в открытую дверь rus_verbs:переправить{}, // переправить в деревню rus_verbs:затягиваться{}, // затягиваться в трубу rus_verbs:разлетаться{}, // разлетаться в стороны rus_verbs:кланяться{}, // кланяться в ножки rus_verbs:устремляться{}, // устремляться в открытое море rus_verbs:переместиться{}, // переместиться в другую аудиторию rus_verbs:ложить{}, // ложить в ящик rus_verbs:отвозить{}, // отвозить в аэропорт rus_verbs:напрашиваться{}, // напрашиваться в гости rus_verbs:напроситься{}, // напроситься в гости rus_verbs:нагрянуть{}, // нагрянуть в гости rus_verbs:заворачивать{}, // заворачивать в фольгу rus_verbs:заковать{}, // заковать в кандалы rus_verbs:свезти{}, // свезти в сарай rus_verbs:притащиться{}, // притащиться в дом rus_verbs:завербовать{}, // завербовать в разведку rus_verbs:рубиться{}, // рубиться в компьютерные игры rus_verbs:тыкаться{}, // тыкаться в материнскую грудь инфинитив:ссыпать{ вид:несоверш }, инфинитив:ссыпать{ вид:соверш }, // ссыпать в контейнер глагол:ссыпать{ вид:несоверш }, глагол:ссыпать{ вид:соверш }, деепричастие:ссыпав{}, деепричастие:ссыпая{}, rus_verbs:засасывать{}, // засасывать в себя rus_verbs:скакнуть{}, // скакнуть в будущее rus_verbs:подвозить{}, // подвозить в театр rus_verbs:переиграть{}, // переиграть в покер rus_verbs:мобилизовать{}, // мобилизовать в действующую армию rus_verbs:залетать{}, // залетать в закрытое воздушное пространство rus_verbs:подышать{}, // подышать в трубочку rus_verbs:смотаться{}, // смотаться в институт rus_verbs:рассовать{}, // рассовать в кармашки rus_verbs:захаживать{}, // захаживать в дом инфинитив:сгонять{ вид:соверш }, глагол:сгонять{ вид:соверш }, // сгонять в ломбард деепричастие:сгоняя{}, rus_verbs:посылаться{}, // посылаться в порт rus_verbs:отлить{}, // отлить в кастрюлю rus_verbs:преобразоваться{}, // преобразоваться в линейное уравнение rus_verbs:поплакать{}, // поплакать в платочек rus_verbs:обуться{}, // обуться в сапоги rus_verbs:закапать{}, // закапать в глаза инфинитив:свозить{ вид:несоверш }, инфинитив:свозить{ вид:соверш }, // свозить в центр утилизации глагол:свозить{ вид:несоверш }, глагол:свозить{ вид:соверш }, деепричастие:свозив{}, деепричастие:свозя{}, rus_verbs:преобразовать{}, // преобразовать в линейное уравнение rus_verbs:кутаться{}, // кутаться в плед rus_verbs:смещаться{}, // смещаться в сторону rus_verbs:зазывать{}, // зазывать в свой магазин инфинитив:трансформироваться{ вид:несоверш }, инфинитив:трансформироваться{ вид:соверш }, // трансформироваться в комбинезон глагол:трансформироваться{ вид:несоверш }, глагол:трансформироваться{ вид:соверш }, деепричастие:трансформируясь{}, деепричастие:трансформировавшись{}, rus_verbs:погружать{}, // погружать в кипящее масло rus_verbs:обыграть{}, // обыграть в теннис rus_verbs:закутать{}, // закутать в одеяло rus_verbs:изливаться{}, // изливаться в воду rus_verbs:закатывать{}, // закатывать в асфальт rus_verbs:мотнуться{}, // мотнуться в банк rus_verbs:избираться{}, // избираться в сенат rus_verbs:наниматься{}, // наниматься в услужение rus_verbs:настучать{}, // настучать в органы rus_verbs:запихивать{}, // запихивать в печку rus_verbs:закапывать{}, // закапывать в нос rus_verbs:засобираться{}, // засобираться в поход rus_verbs:копировать{}, // копировать в другую папку rus_verbs:замуровать{}, // замуровать в стену rus_verbs:упечь{}, // упечь в тюрьму rus_verbs:зрить{}, // зрить в корень rus_verbs:стягиваться{}, // стягиваться в одну точку rus_verbs:усаживать{}, // усаживать в тренажер rus_verbs:протолкнуть{}, // протолкнуть в отверстие rus_verbs:расшибиться{}, // расшибиться в лепешку rus_verbs:приглашаться{}, // приглашаться в кабинет rus_verbs:садить{}, // садить в телегу rus_verbs:уткнуть{}, // уткнуть в подушку rus_verbs:протечь{}, // протечь в подвал rus_verbs:перегнать{}, // перегнать в другую страну rus_verbs:переползти{}, // переползти в тень rus_verbs:зарываться{}, // зарываться в грунт rus_verbs:переодеть{}, // переодеть в сухую одежду rus_verbs:припуститься{}, // припуститься в пляс rus_verbs:лопотать{}, // лопотать в микрофон rus_verbs:прогнусавить{}, // прогнусавить в микрофон rus_verbs:мочиться{}, // мочиться в штаны rus_verbs:загружать{}, // загружать в патронник rus_verbs:радировать{}, // радировать в центр rus_verbs:промотать{}, // промотать в конец rus_verbs:помчать{}, // помчать в школу rus_verbs:съезжать{}, // съезжать в кювет rus_verbs:завозить{}, // завозить в магазин rus_verbs:заявляться{}, // заявляться в школу rus_verbs:наглядеться{}, // наглядеться в зеркало rus_verbs:сворачиваться{}, // сворачиваться в клубочек rus_verbs:устремлять{}, // устремлять взор в будущее rus_verbs:забредать{}, // забредать в глухие уголки rus_verbs:перемотать{}, // перемотать в самое начало диалога rus_verbs:сморкаться{}, // сморкаться в носовой платочек rus_verbs:перетекать{}, // перетекать в другой сосуд rus_verbs:закачать{}, // закачать в шарик rus_verbs:запрятать{}, // запрятать в сейф rus_verbs:пинать{}, // пинать в живот rus_verbs:затрубить{}, // затрубить в горн rus_verbs:подглядывать{}, // подглядывать в замочную скважину инфинитив:подсыпать{ вид:соверш }, инфинитив:подсыпать{ вид:несоверш }, // подсыпать в питье глагол:подсыпать{ вид:соверш }, глагол:подсыпать{ вид:несоверш }, деепричастие:подсыпав{}, деепричастие:подсыпая{}, rus_verbs:засовывать{}, // засовывать в пенал rus_verbs:отрядить{}, // отрядить в командировку rus_verbs:справлять{}, // справлять в кусты rus_verbs:поторапливаться{}, // поторапливаться в самолет rus_verbs:скопировать{}, // скопировать в кэш rus_verbs:подливать{}, // подливать в огонь rus_verbs:запрячь{}, // запрячь в повозку rus_verbs:окраситься{}, // окраситься в пурпур rus_verbs:уколоть{}, // уколоть в шею rus_verbs:слететься{}, // слететься в гнездо rus_verbs:резаться{}, // резаться в карты rus_verbs:затесаться{}, // затесаться в ряды оппозиционеров инфинитив:задвигать{ вид:несоверш }, глагол:задвигать{ вид:несоверш }, // задвигать в ячейку (несоверш) деепричастие:задвигая{}, rus_verbs:доставляться{}, // доставляться в ресторан rus_verbs:поплевать{}, // поплевать в чашку rus_verbs:попереться{}, // попереться в магазин rus_verbs:хаживать{}, // хаживать в церковь rus_verbs:преображаться{}, // преображаться в королеву rus_verbs:организоваться{}, // организоваться в группу rus_verbs:ужалить{}, // ужалить в руку rus_verbs:протискиваться{}, // протискиваться в аудиторию rus_verbs:препроводить{}, // препроводить в закуток rus_verbs:разъезжаться{}, // разъезжаться в разные стороны rus_verbs:пропыхтеть{}, // пропыхтеть в трубку rus_verbs:уволочь{}, // уволочь в нору rus_verbs:отодвигаться{}, // отодвигаться в сторону rus_verbs:разливать{}, // разливать в стаканы rus_verbs:сбегаться{}, // сбегаться в актовый зал rus_verbs:наведаться{}, // наведаться в кладовку rus_verbs:перекочевать{}, // перекочевать в горы rus_verbs:прощебетать{}, // прощебетать в трубку rus_verbs:перекладывать{}, // перекладывать в другой карман rus_verbs:углубляться{}, // углубляться в теорию rus_verbs:переименовать{}, // переименовать в город rus_verbs:переметнуться{}, // переметнуться в лагерь противника rus_verbs:разносить{}, // разносить в щепки rus_verbs:осыпаться{}, // осыпаться в холода rus_verbs:попроситься{}, // попроситься в туалет rus_verbs:уязвить{}, // уязвить в сердце rus_verbs:перетащить{}, // перетащить в дом rus_verbs:закутаться{}, // закутаться в плед // rus_verbs:упаковать{}, // упаковать в бумагу инфинитив:тикать{ aux stress="тик^ать" }, глагол:тикать{ aux stress="тик^ать" }, // тикать в крепость rus_verbs:хихикать{}, // хихикать в кулачок rus_verbs:объединить{}, // объединить в сеть инфинитив:слетать{ вид:соверш }, глагол:слетать{ вид:соверш }, // слетать в Калифорнию деепричастие:слетав{}, rus_verbs:заползти{}, // заползти в норку rus_verbs:перерасти{}, // перерасти в крупную аферу rus_verbs:списать{}, // списать в утиль rus_verbs:просачиваться{}, // просачиваться в бункер rus_verbs:пускаться{}, // пускаться в погоню rus_verbs:согревать{}, // согревать в мороз rus_verbs:наливаться{}, // наливаться в емкость rus_verbs:унестись{}, // унестись в небо rus_verbs:зашвырнуть{}, // зашвырнуть в шкаф rus_verbs:сигануть{}, // сигануть в воду rus_verbs:окунуть{}, // окунуть в ледяную воду rus_verbs:просочиться{}, // просочиться в сапог rus_verbs:соваться{}, // соваться в толпу rus_verbs:протолкаться{}, // протолкаться в гардероб rus_verbs:заложить{}, // заложить в ломбард rus_verbs:перекатить{}, // перекатить в сарай rus_verbs:поставлять{}, // поставлять в Китай rus_verbs:залезать{}, // залезать в долги rus_verbs:отлучаться{}, // отлучаться в туалет rus_verbs:сбиваться{}, // сбиваться в кучу rus_verbs:зарыть{}, // зарыть в землю rus_verbs:засадить{}, // засадить в тело rus_verbs:прошмыгнуть{}, // прошмыгнуть в дверь rus_verbs:переставить{}, // переставить в шкаф rus_verbs:отчалить{}, // отчалить в плавание rus_verbs:набираться{}, // набираться в команду rus_verbs:лягнуть{}, // лягнуть в живот rus_verbs:притворить{}, // притворить в жизнь rus_verbs:проковылять{}, // проковылять в гардероб rus_verbs:прикатить{}, // прикатить в гараж rus_verbs:залететь{}, // залететь в окно rus_verbs:переделать{}, // переделать в мопед rus_verbs:протащить{}, // протащить в совет rus_verbs:обмакнуть{}, // обмакнуть в воду rus_verbs:отклоняться{}, // отклоняться в сторону rus_verbs:запихать{}, // запихать в пакет rus_verbs:избирать{}, // избирать в совет rus_verbs:загрузить{}, // загрузить в буфер rus_verbs:уплывать{}, // уплывать в Париж rus_verbs:забивать{}, // забивать в мерзлоту rus_verbs:потыкать{}, // потыкать в безжизненную тушу rus_verbs:съезжаться{}, // съезжаться в санаторий rus_verbs:залепить{}, // залепить в рыло rus_verbs:набиться{}, // набиться в карманы rus_verbs:уползти{}, // уползти в нору rus_verbs:упрятать{}, // упрятать в камеру rus_verbs:переместить{}, // переместить в камеру анабиоза rus_verbs:закрасться{}, // закрасться в душу rus_verbs:сместиться{}, // сместиться в инфракрасную область rus_verbs:запускать{}, // запускать в серию rus_verbs:потрусить{}, // потрусить в чащобу rus_verbs:забрасывать{}, // забрасывать в чистую воду rus_verbs:переселить{}, // переселить в отдаленную деревню rus_verbs:переезжать{}, // переезжать в новую квартиру rus_verbs:приподнимать{}, // приподнимать в воздух rus_verbs:добавиться{}, // добавиться в конец очереди rus_verbs:убыть{}, // убыть в часть rus_verbs:передвигать{}, // передвигать в соседнюю клетку rus_verbs:добавляться{}, // добавляться в очередь rus_verbs:дописать{}, // дописать в перечень rus_verbs:записываться{}, // записываться в кружок rus_verbs:продаться{}, // продаться в кредитное рабство rus_verbs:переписывать{}, // переписывать в тетрадку rus_verbs:заплыть{}, // заплыть в территориальные воды инфинитив:пописать{ aux stress="поп^исать" }, инфинитив:пописать{ aux stress="попис^ать" }, // пописать в горшок глагол:пописать{ aux stress="поп^исать" }, глагол:пописать{ aux stress="попис^ать" }, rus_verbs:отбирать{}, // отбирать в гвардию rus_verbs:нашептывать{}, // нашептывать в микрофон rus_verbs:ковылять{}, // ковылять в стойло rus_verbs:прилетать{}, // прилетать в Париж rus_verbs:пролиться{}, // пролиться в канализацию rus_verbs:запищать{}, // запищать в микрофон rus_verbs:подвезти{}, // подвезти в больницу rus_verbs:припереться{}, // припереться в театр rus_verbs:утечь{}, // утечь в сеть rus_verbs:прорываться{}, // прорываться в буфет rus_verbs:увозить{}, // увозить в ремонт rus_verbs:съедать{}, // съедать в обед rus_verbs:просунуться{}, // просунуться в дверь rus_verbs:перенестись{}, // перенестись в прошлое rus_verbs:завезти{}, // завезти в магазин rus_verbs:проложить{}, // проложить в деревню rus_verbs:объединяться{}, // объединяться в профсоюз rus_verbs:развиться{}, // развиться в бабочку rus_verbs:засеменить{}, // засеменить в кабинку rus_verbs:скатываться{}, // скатываться в яму rus_verbs:завозиться{}, // завозиться в магазин rus_verbs:нанимать{}, // нанимать в рейс rus_verbs:поспеть{}, // поспеть в класс rus_verbs:кидаться{}, // кинаться в крайности rus_verbs:поспевать{}, // поспевать в оперу rus_verbs:обернуть{}, // обернуть в фольгу rus_verbs:обратиться{}, // обратиться в прокуратуру rus_verbs:истолковать{}, // истолковать в свою пользу rus_verbs:таращиться{}, // таращиться в дисплей rus_verbs:прыснуть{}, // прыснуть в кулачок rus_verbs:загнуть{}, // загнуть в другую сторону rus_verbs:раздать{}, // раздать в разные руки rus_verbs:назначить{}, // назначить в приемную комиссию rus_verbs:кидать{}, // кидать в кусты rus_verbs:увлекать{}, // увлекать в лес rus_verbs:переселиться{}, // переселиться в чужое тело rus_verbs:присылать{}, // присылать в город rus_verbs:уплыть{}, // уплыть в Европу rus_verbs:запричитать{}, // запричитать в полный голос rus_verbs:утащить{}, // утащить в логово rus_verbs:завернуться{}, // завернуться в плед rus_verbs:заносить{}, // заносить в блокнот rus_verbs:пятиться{}, // пятиться в дом rus_verbs:наведываться{}, // наведываться в больницу rus_verbs:нырять{}, // нырять в прорубь rus_verbs:зачастить{}, // зачастить в бар rus_verbs:назначаться{}, // назначается в комиссию rus_verbs:мотаться{}, // мотаться в областной центр rus_verbs:разыграть{}, // разыграть в карты rus_verbs:пропищать{}, // пропищать в микрофон rus_verbs:пихнуть{}, // пихнуть в бок rus_verbs:эмигрировать{}, // эмигрировать в Канаду rus_verbs:подключить{}, // подключить в сеть rus_verbs:упереть{}, // упереть в фундамент rus_verbs:уплатить{}, // уплатить в кассу rus_verbs:потащиться{}, // потащиться в медпункт rus_verbs:пригнать{}, // пригнать в стойло rus_verbs:оттеснить{}, // оттеснить в фойе rus_verbs:стучаться{}, // стучаться в ворота rus_verbs:перечислить{}, // перечислить в фонд rus_verbs:сомкнуть{}, // сомкнуть в круг rus_verbs:закачаться{}, // закачаться в резервуар rus_verbs:кольнуть{}, // кольнуть в бок rus_verbs:накрениться{}, // накрениться в сторону берега rus_verbs:подвинуться{}, // подвинуться в другую сторону rus_verbs:разнести{}, // разнести в клочья rus_verbs:отливать{}, // отливать в форму rus_verbs:подкинуть{}, // подкинуть в карман rus_verbs:уводить{}, // уводить в кабинет rus_verbs:ускакать{}, // ускакать в школу rus_verbs:ударять{}, // ударять в барабаны rus_verbs:даться{}, // даться в руки rus_verbs:поцеловаться{}, // поцеловаться в губы rus_verbs:посветить{}, // посветить в подвал rus_verbs:тыкать{}, // тыкать в арбуз rus_verbs:соединяться{}, // соединяться в кольцо rus_verbs:растянуть{}, // растянуть в тонкую ниточку rus_verbs:побросать{}, // побросать в пыль rus_verbs:стукнуться{}, // стукнуться в закрытую дверь rus_verbs:проигрывать{}, // проигрывать в теннис rus_verbs:дунуть{}, // дунуть в трубочку rus_verbs:улетать{}, // улетать в Париж rus_verbs:переводиться{}, // переводиться в филиал rus_verbs:окунуться{}, // окунуться в водоворот событий rus_verbs:попрятаться{}, // попрятаться в норы rus_verbs:перевезти{}, // перевезти в соседнюю палату rus_verbs:топать{}, // топать в школу rus_verbs:относить{}, // относить в помещение rus_verbs:укладывать{}, // укладывать в стопку rus_verbs:укатить{}, // укатил в турне rus_verbs:убирать{}, // убирать в сумку rus_verbs:помалкивать{}, // помалкивать в тряпочку rus_verbs:ронять{}, // ронять в грязь rus_verbs:глазеть{}, // глазеть в бинокль rus_verbs:преобразиться{}, // преобразиться в другого человека rus_verbs:запрыгнуть{}, // запрыгнуть в поезд rus_verbs:сгодиться{}, // сгодиться в суп rus_verbs:проползти{}, // проползти в нору rus_verbs:забираться{}, // забираться в коляску rus_verbs:сбежаться{}, // сбежались в класс rus_verbs:закатиться{}, // закатиться в угол rus_verbs:плевать{}, // плевать в душу rus_verbs:поиграть{}, // поиграть в демократию rus_verbs:кануть{}, // кануть в небытие rus_verbs:опаздывать{}, // опаздывать в школу rus_verbs:отползти{}, // отползти в сторону rus_verbs:стекаться{}, // стекаться в отстойник rus_verbs:запихнуть{}, // запихнуть в пакет rus_verbs:вышвырнуть{}, // вышвырнуть в коридор rus_verbs:связываться{}, // связываться в плотный узел rus_verbs:затолкать{}, // затолкать в ухо rus_verbs:скрутить{}, // скрутить в трубочку rus_verbs:сворачивать{}, // сворачивать в трубочку rus_verbs:сплестись{}, // сплестись в узел rus_verbs:заскочить{}, // заскочить в кабинет rus_verbs:проваливаться{}, // проваливаться в сон rus_verbs:уверовать{}, // уверовать в свою безнаказанность rus_verbs:переписать{}, // переписать в тетрадку rus_verbs:переноситься{}, // переноситься в мир фантазий rus_verbs:заводить{}, // заводить в помещение rus_verbs:сунуться{}, // сунуться в аудиторию rus_verbs:устраиваться{}, // устраиваться в автомастерскую rus_verbs:пропускать{}, // пропускать в зал инфинитив:сбегать{ вид:несоверш }, инфинитив:сбегать{ вид:соверш }, // сбегать в кино глагол:сбегать{ вид:несоверш }, глагол:сбегать{ вид:соверш }, деепричастие:сбегая{}, деепричастие:сбегав{}, rus_verbs:прибегать{}, // прибегать в школу rus_verbs:съездить{}, // съездить в лес rus_verbs:захлопать{}, // захлопать в ладошки rus_verbs:опрокинуться{}, // опрокинуться в грязь инфинитив:насыпать{ вид:несоверш }, инфинитив:насыпать{ вид:соверш }, // насыпать в стакан глагол:насыпать{ вид:несоверш }, глагол:насыпать{ вид:соверш }, деепричастие:насыпая{}, деепричастие:насыпав{}, rus_verbs:употреблять{}, // употреблять в пищу rus_verbs:приводиться{}, // приводиться в действие rus_verbs:пристроить{}, // пристроить в надежные руки rus_verbs:юркнуть{}, // юркнуть в нору rus_verbs:объединиться{}, // объединиться в банду rus_verbs:сажать{}, // сажать в одиночку rus_verbs:соединить{}, // соединить в кольцо rus_verbs:забрести{}, // забрести в кафешку rus_verbs:свернуться{}, // свернуться в клубочек rus_verbs:пересесть{}, // пересесть в другой автобус rus_verbs:постучаться{}, // постучаться в дверцу rus_verbs:соединять{}, // соединять в кольцо rus_verbs:приволочь{}, // приволочь в коморку rus_verbs:смахивать{}, // смахивать в ящик стола rus_verbs:забежать{}, // забежать в помещение rus_verbs:целиться{}, // целиться в беглеца rus_verbs:прокрасться{}, // прокрасться в хранилище rus_verbs:заковылять{}, // заковылять в травтамологию rus_verbs:прискакать{}, // прискакать в стойло rus_verbs:колотить{}, // колотить в дверь rus_verbs:смотреться{}, // смотреться в зеркало rus_verbs:подложить{}, // подложить в салон rus_verbs:пущать{}, // пущать в королевские покои rus_verbs:согнуть{}, // согнуть в дугу rus_verbs:забарабанить{}, // забарабанить в дверь rus_verbs:отклонить{}, // отклонить в сторону посадочной полосы rus_verbs:убраться{}, // убраться в специальную нишу rus_verbs:насмотреться{}, // насмотреться в зеркало rus_verbs:чмокнуть{}, // чмокнуть в щечку rus_verbs:усмехаться{}, // усмехаться в бороду rus_verbs:передвинуть{}, // передвинуть в конец очереди rus_verbs:допускаться{}, // допускаться в опочивальню rus_verbs:задвинуть{}, // задвинуть в дальний угол rus_verbs:отправлять{}, // отправлять в центр rus_verbs:сбрасывать{}, // сбрасывать в жерло rus_verbs:расстреливать{}, // расстреливать в момент обнаружения rus_verbs:заволочь{}, // заволочь в закуток rus_verbs:пролить{}, // пролить в воду rus_verbs:зарыться{}, // зарыться в сено rus_verbs:переливаться{}, // переливаться в емкость rus_verbs:затащить{}, // затащить в клуб rus_verbs:перебежать{}, // перебежать в лагерь врагов rus_verbs:одеть{}, // одеть в новое платье инфинитив:задвигаться{ вид:несоверш }, глагол:задвигаться{ вид:несоверш }, // задвигаться в нишу деепричастие:задвигаясь{}, rus_verbs:клюнуть{}, // клюнуть в темечко rus_verbs:наливать{}, // наливать в кружку rus_verbs:пролезть{}, // пролезть в ушко rus_verbs:откладывать{}, // откладывать в ящик rus_verbs:протянуться{}, // протянуться в соседний дом rus_verbs:шлепнуться{}, // шлепнуться лицом в грязь rus_verbs:устанавливать{}, // устанавливать в машину rus_verbs:употребляться{}, // употребляться в пищу rus_verbs:переключиться{}, // переключиться в реверсный режим rus_verbs:пискнуть{}, // пискнуть в микрофон rus_verbs:заявиться{}, // заявиться в класс rus_verbs:налиться{}, // налиться в стакан rus_verbs:заливать{}, // заливать в бак rus_verbs:ставиться{}, // ставиться в очередь инфинитив:писаться{ aux stress="п^исаться" }, глагол:писаться{ aux stress="п^исаться" }, // писаться в штаны деепричастие:писаясь{}, rus_verbs:целоваться{}, // целоваться в губы rus_verbs:наносить{}, // наносить в область сердца rus_verbs:посмеяться{}, // посмеяться в кулачок rus_verbs:употребить{}, // употребить в пищу rus_verbs:прорваться{}, // прорваться в столовую rus_verbs:укладываться{}, // укладываться в ровные стопки rus_verbs:пробиться{}, // пробиться в финал rus_verbs:забить{}, // забить в землю rus_verbs:переложить{}, // переложить в другой карман rus_verbs:опускать{}, // опускать в свежевырытую могилу rus_verbs:поторопиться{}, // поторопиться в школу rus_verbs:сдвинуться{}, // сдвинуться в сторону rus_verbs:капать{}, // капать в смесь rus_verbs:погружаться{}, // погружаться во тьму rus_verbs:направлять{}, // направлять в кабинку rus_verbs:погрузить{}, // погрузить во тьму rus_verbs:примчаться{}, // примчаться в школу rus_verbs:упираться{}, // упираться в дверь rus_verbs:удаляться{}, // удаляться в комнату совещаний rus_verbs:ткнуться{}, // ткнуться в окошко rus_verbs:убегать{}, // убегать в чащу rus_verbs:соединиться{}, // соединиться в необычную пространственную фигуру rus_verbs:наговорить{}, // наговорить в микрофон rus_verbs:переносить{}, // переносить в дом rus_verbs:прилечь{}, // прилечь в кроватку rus_verbs:поворачивать{}, // поворачивать в обратную сторону rus_verbs:проскочить{}, // проскочить в щель rus_verbs:совать{}, // совать в духовку rus_verbs:переодеться{}, // переодеться в чистую одежду rus_verbs:порвать{}, // порвать в лоскуты rus_verbs:завязать{}, // завязать в бараний рог rus_verbs:съехать{}, // съехать в кювет rus_verbs:литься{}, // литься в канистру rus_verbs:уклониться{}, // уклониться в левую сторону rus_verbs:смахнуть{}, // смахнуть в мусорное ведро rus_verbs:спускать{}, // спускать в шахту rus_verbs:плеснуть{}, // плеснуть в воду rus_verbs:подуть{}, // подуть в угольки rus_verbs:набирать{}, // набирать в команду rus_verbs:хлопать{}, // хлопать в ладошки rus_verbs:ранить{}, // ранить в самое сердце rus_verbs:посматривать{}, // посматривать в иллюминатор rus_verbs:превращать{}, // превращать воду в вино rus_verbs:толкать{}, // толкать в пучину rus_verbs:отбыть{}, // отбыть в расположение части rus_verbs:сгрести{}, // сгрести в карман rus_verbs:удрать{}, // удрать в тайгу rus_verbs:пристроиться{}, // пристроиться в хорошую фирму rus_verbs:сбиться{}, // сбиться в плотную группу rus_verbs:заключать{}, // заключать в объятия rus_verbs:отпускать{}, // отпускать в поход rus_verbs:устремить{}, // устремить взгляд в будущее rus_verbs:обронить{}, // обронить в траву rus_verbs:сливаться{}, // сливаться в речку rus_verbs:стекать{}, // стекать в канаву rus_verbs:свалить{}, // свалить в кучу rus_verbs:подтянуть{}, // подтянуть в кабину rus_verbs:скатиться{}, // скатиться в канаву rus_verbs:проскользнуть{}, // проскользнуть в приоткрытую дверь rus_verbs:заторопиться{}, // заторопиться в буфет rus_verbs:протиснуться{}, // протиснуться в центр толпы rus_verbs:прятать{}, // прятать в укромненькое местечко rus_verbs:пропеть{}, // пропеть в микрофон rus_verbs:углубиться{}, // углубиться в джунгли rus_verbs:сползти{}, // сползти в яму rus_verbs:записывать{}, // записывать в память rus_verbs:расстрелять{}, // расстрелять в упор (наречный оборот В УПОР) rus_verbs:колотиться{}, // колотиться в дверь rus_verbs:просунуть{}, // просунуть в отверстие rus_verbs:провожать{}, // провожать в армию rus_verbs:катить{}, // катить в гараж rus_verbs:поражать{}, // поражать в самое сердце rus_verbs:отлететь{}, // отлететь в дальний угол rus_verbs:закинуть{}, // закинуть в речку rus_verbs:катиться{}, // катиться в пропасть rus_verbs:забросить{}, // забросить в дальний угол rus_verbs:отвезти{}, // отвезти в лагерь rus_verbs:втопить{}, // втопить педаль в пол rus_verbs:втапливать{}, // втапливать педать в пол rus_verbs:утопить{}, // утопить кнопку в панель rus_verbs:напасть{}, // В Пекине участники антияпонских протестов напали на машину посла США rus_verbs:нанять{}, // Босс нанял в службу поддержки еще несколько девушек rus_verbs:переводить{}, // переводить в устойчивую к перегреву форму rus_verbs:баллотировать{}, // претендент был баллотирован в жюри (баллотирован?) rus_verbs:вбухать{}, // Власти вбухали в этой проект много денег rus_verbs:вбухивать{}, // Власти вбухивают в этот проект очень много денег rus_verbs:поскакать{}, // поскакать в атаку rus_verbs:прицелиться{}, // прицелиться в бегущего зайца rus_verbs:прыгать{}, // прыгать в кровать rus_verbs:приглашать{}, // приглашать в дом rus_verbs:понестись{}, // понестись в ворота rus_verbs:заехать{}, // заехать в гаражный бокс rus_verbs:опускаться{}, // опускаться в бездну rus_verbs:переехать{}, // переехать в коттедж rus_verbs:поместить{}, // поместить в карантин rus_verbs:ползти{}, // ползти в нору rus_verbs:добавлять{}, // добавлять в корзину rus_verbs:уткнуться{}, // уткнуться в подушку rus_verbs:продавать{}, // продавать в рабство rus_verbs:спрятаться{}, // Белка спрячется в дупло. rus_verbs:врисовывать{}, // врисовывать новый персонаж в анимацию rus_verbs:воткнуть{}, // воткни вилку в розетку rus_verbs:нести{}, // нести в больницу rus_verbs:воткнуться{}, // вилка воткнулась в сочную котлетку rus_verbs:впаивать{}, // впаивать деталь в плату rus_verbs:впаиваться{}, // деталь впаивается в плату rus_verbs:впархивать{}, // впархивать в помещение rus_verbs:впаять{}, // впаять деталь в плату rus_verbs:впендюривать{}, // впендюривать штукенцию в агрегат rus_verbs:впендюрить{}, // впендюрить штукенцию в агрегат rus_verbs:вперивать{}, // вперивать взгляд в экран rus_verbs:впериваться{}, // впериваться в экран rus_verbs:вперить{}, // вперить взгляд в экран rus_verbs:впериться{}, // впериться в экран rus_verbs:вперять{}, // вперять взгляд в экран rus_verbs:вперяться{}, // вперяться в экран rus_verbs:впечатать{}, // впечатать текст в первую главу rus_verbs:впечататься{}, // впечататься в стену rus_verbs:впечатывать{}, // впечатывать текст в первую главу rus_verbs:впечатываться{}, // впечатываться в стену rus_verbs:впиваться{}, // Хищник впивается в жертву мощными зубами rus_verbs:впитаться{}, // Жидкость впиталась в ткань rus_verbs:впитываться{}, // Жидкость впитывается в ткань rus_verbs:впихивать{}, // Мама впихивает в сумку кусок колбасы rus_verbs:впихиваться{}, // Кусок колбасы впихивается в сумку rus_verbs:впихнуть{}, // Мама впихнула кастрюлю в холодильник rus_verbs:впихнуться{}, // Кастрюля впихнулась в холодильник rus_verbs:вплавиться{}, // Провод вплавился в плату rus_verbs:вплеснуть{}, // вплеснуть краситель в бак rus_verbs:вплести{}, // вплести ленту в волосы rus_verbs:вплестись{}, // вплестись в волосы rus_verbs:вплетать{}, // вплетать ленты в волосы rus_verbs:вплывать{}, // корабль вплывает в порт rus_verbs:вплыть{}, // яхта вплыла в бухту rus_verbs:вползать{}, // дракон вползает в пещеру rus_verbs:вползти{}, // дракон вполз в свою пещеру rus_verbs:впорхнуть{}, // бабочка впорхнула в окно rus_verbs:впрессовать{}, // впрессовать деталь в плиту rus_verbs:впрессоваться{}, // впрессоваться в плиту rus_verbs:впрессовывать{}, // впрессовывать деталь в плиту rus_verbs:впрессовываться{}, // впрессовываться в плиту rus_verbs:впрыгивать{}, // Пассажир впрыгивает в вагон rus_verbs:впрыгнуть{}, // Пассажир впрыгнул в вагон rus_verbs:впрыскивать{}, // Форсунка впрыскивает топливо в цилиндр rus_verbs:впрыскиваться{}, // Топливо впрыскивается форсункой в цилиндр rus_verbs:впрыснуть{}, // Форсунка впрыснула топливную смесь в камеру сгорания rus_verbs:впрягать{}, // впрягать лошадь в телегу rus_verbs:впрягаться{}, // впрягаться в работу rus_verbs:впрячь{}, // впрячь лошадь в телегу rus_verbs:впрячься{}, // впрячься в работу rus_verbs:впускать{}, // впускать посетителей в музей rus_verbs:впускаться{}, // впускаться в помещение rus_verbs:впустить{}, // впустить посетителей в музей rus_verbs:впутать{}, // впутать кого-то во что-то rus_verbs:впутаться{}, // впутаться во что-то rus_verbs:впутывать{}, // впутывать кого-то во что-то rus_verbs:впутываться{}, // впутываться во что-то rus_verbs:врабатываться{}, // врабатываться в режим rus_verbs:вработаться{}, // вработаться в режим rus_verbs:врастать{}, // врастать в кожу rus_verbs:врасти{}, // врасти в кожу инфинитив:врезать{ вид:несоверш }, // врезать замок в дверь инфинитив:врезать{ вид:соверш }, глагол:врезать{ вид:несоверш }, глагол:врезать{ вид:соверш }, деепричастие:врезая{}, деепричастие:врезав{}, прилагательное:врезанный{}, инфинитив:врезаться{ вид:несоверш }, // врезаться в стену инфинитив:врезаться{ вид:соверш }, глагол:врезаться{ вид:несоверш }, деепричастие:врезаясь{}, деепричастие:врезавшись{}, rus_verbs:врубить{}, // врубить в нагрузку rus_verbs:врываться{}, // врываться в здание rus_verbs:закачивать{}, // Насос закачивает топливо в бак rus_verbs:ввезти{}, // Предприятие ввезло товар в страну rus_verbs:вверстать{}, // Дизайнер вверстал блок в страницу rus_verbs:вверстывать{}, // Дизайнер с трудом вверстывает блоки в страницу rus_verbs:вверстываться{}, // Блок тяжело вверстывается в эту страницу rus_verbs:ввивать{}, // Женщина ввивает полоску в косу rus_verbs:вволакиваться{}, // Пойманная мышь вволакивается котиком в дом rus_verbs:вволочь{}, // Кот вволок в дом пойманную крысу rus_verbs:вдергивать{}, // приспособление вдергивает нитку в игольное ушко rus_verbs:вдернуть{}, // приспособление вдернуло нитку в игольное ушко rus_verbs:вдувать{}, // Челоек вдувает воздух в легкие второго человека rus_verbs:вдуваться{}, // Воздух вдувается в легкие человека rus_verbs:вламываться{}, // Полиция вламывается в квартиру rus_verbs:вовлекаться{}, // трудные подростки вовлекаются в занятие спортом rus_verbs:вовлечь{}, // вовлечь трудных подростков в занятие спортом rus_verbs:вовлечься{}, // вовлечься в занятие спортом rus_verbs:спуститься{}, // спуститься в подвал rus_verbs:спускаться{}, // спускаться в подвал rus_verbs:отправляться{}, // отправляться в дальнее плавание инфинитив:эмитировать{ вид:соверш }, // Поверхность эмитирует электроны в пространство инфинитив:эмитировать{ вид:несоверш }, глагол:эмитировать{ вид:соверш }, глагол:эмитировать{ вид:несоверш }, деепричастие:эмитируя{}, деепричастие:эмитировав{}, прилагательное:эмитировавший{ вид:несоверш }, // прилагательное:эмитировавший{ вид:соверш }, прилагательное:эмитирующий{}, прилагательное:эмитируемый{}, прилагательное:эмитированный{}, инфинитив:этапировать{вид:несоверш}, // Преступника этапировали в колонию инфинитив:этапировать{вид:соверш}, глагол:этапировать{вид:несоверш}, глагол:этапировать{вид:соверш}, деепричастие:этапируя{}, прилагательное:этапируемый{}, прилагательное:этапированный{}, rus_verbs:этапироваться{}, // Преступники этапируются в колонию rus_verbs:баллотироваться{}, // они баллотировались в жюри rus_verbs:бежать{}, // Олигарх с семьей любовницы бежал в другую страну rus_verbs:бросать{}, // Они бросали в фонтан медные монетки rus_verbs:бросаться{}, // Дети бросались в воду с моста rus_verbs:бросить{}, // Он бросил в фонтан медную монетку rus_verbs:броситься{}, // самоубийца бросился с моста в воду rus_verbs:превратить{}, // Найден белок, который превратит человека в супергероя rus_verbs:буксировать{}, // Буксир буксирует танкер в порт rus_verbs:буксироваться{}, // Сухогруз буксируется в порт rus_verbs:вбегать{}, // Курьер вбегает в дверь rus_verbs:вбежать{}, // Курьер вбежал в дверь rus_verbs:вбетонировать{}, // Опора была вбетонирована в пол rus_verbs:вбивать{}, // Мастер вбивает штырь в плиту rus_verbs:вбиваться{}, // Штырь вбивается в плиту rus_verbs:вбирать{}, // Вата вбирает в себя влагу rus_verbs:вбить{}, // Ученик вбил в доску маленький гвоздь rus_verbs:вбрасывать{}, // Арбитр вбрасывает мяч в игру rus_verbs:вбрасываться{}, // Мяч вбрасывается в игру rus_verbs:вбросить{}, // Судья вбросил мяч в игру rus_verbs:вбуравиться{}, // Сверло вбуравилось в бетон rus_verbs:вбуравливаться{}, // Сверло вбуравливается в бетон rus_verbs:вбухиваться{}, // Много денег вбухиваются в этот проект rus_verbs:вваливаться{}, // Человек вваливается в кабинет врача rus_verbs:ввалить{}, // Грузчики ввалили мешок в квартиру rus_verbs:ввалиться{}, // Человек ввалился в кабинет терапевта rus_verbs:вваривать{}, // Робот вваривает арматурину в плиту rus_verbs:ввариваться{}, // Арматура вваривается в плиту rus_verbs:вварить{}, // Робот вварил арматурину в плиту rus_verbs:влезть{}, // Предприятие ввезло товар в страну rus_verbs:ввернуть{}, // Вверни новую лампочку в люстру rus_verbs:ввернуться{}, // Лампочка легко ввернулась в патрон rus_verbs:ввертывать{}, // Электрик ввертывает лампочку в патрон rus_verbs:ввертываться{}, // Лампочка легко ввертывается в патрон rus_verbs:вверять{}, // Пациент вверяет свою жизнь в руки врача rus_verbs:вверяться{}, // Пациент вверяется в руки врача rus_verbs:ввести{}, // Агенство ввело своего представителя в совет директоров rus_verbs:ввиваться{}, // полоска ввивается в косу rus_verbs:ввинтить{}, // Отвертка ввинтила шуруп в дерево rus_verbs:ввинтиться{}, // Шуруп ввинтился в дерево rus_verbs:ввинчивать{}, // Рука ввинчивает саморез в стену rus_verbs:ввинчиваться{}, // Саморез ввинчивается в стену rus_verbs:вводить{}, // Агенство вводит своего представителя в совет директоров rus_verbs:вводиться{}, // Представитель агенства вводится в совет директоров // rus_verbs:ввозить{}, // Фирма ввозит в страну станки и сырье rus_verbs:ввозиться{}, // Станки и сырье ввозятся в страну rus_verbs:вволакивать{}, // Пойманная мышь вволакивается котиком в дом rus_verbs:вворачивать{}, // Электрик вворачивает новую лампочку в патрон rus_verbs:вворачиваться{}, // Новая лампочка легко вворачивается в патрон rus_verbs:ввязаться{}, // Разведрота ввязалась в бой rus_verbs:ввязываться{}, // Передовые части ввязываются в бой rus_verbs:вглядеться{}, // Охранник вгляделся в темный коридор rus_verbs:вглядываться{}, // Охранник внимательно вглядывается в монитор rus_verbs:вгонять{}, // Эта музыка вгоняет меня в депрессию rus_verbs:вгрызаться{}, // Зонд вгрызается в поверхность астероида rus_verbs:вгрызться{}, // Зонд вгрызся в поверхность астероида rus_verbs:вдаваться{}, // Вы не должны вдаваться в юридические детали rus_verbs:вдвигать{}, // Робот вдвигает контейнер в ячейку rus_verbs:вдвигаться{}, // Контейнер вдвигается в ячейку rus_verbs:вдвинуть{}, // манипулятор вдвинул деталь в печь rus_verbs:вдвинуться{}, // деталь вдвинулась в печь rus_verbs:вдевать{}, // портниха быстро вдевает нитку в иголку rus_verbs:вдеваться{}, // нитка быстро вдевается в игольное ушко rus_verbs:вдеть{}, // портниха быстро вдела нитку в игольное ушко rus_verbs:вдеться{}, // нитка быстро вделась в игольное ушко rus_verbs:вделать{}, // мастер вделал розетку в стену rus_verbs:вделывать{}, // мастер вделывает выключатель в стену rus_verbs:вделываться{}, // кронштейн вделывается в стену rus_verbs:вдергиваться{}, // нитка легко вдергивается в игольное ушко rus_verbs:вдернуться{}, // нитка легко вдернулась в игольное ушко rus_verbs:вдолбить{}, // Американцы обещали вдолбить страну в каменный век rus_verbs:вдумываться{}, // Мальчик обычно не вдумывался в сюжет фильмов rus_verbs:вдыхать{}, // мы вдыхаем в себя весь этот смог rus_verbs:вдыхаться{}, // Весь этот смог вдыхается в легкие rus_verbs:вернуть{}, // Книгу надо вернуть в библиотеку rus_verbs:вернуться{}, // Дети вернулись в библиотеку rus_verbs:вжаться{}, // Водитель вжался в кресло rus_verbs:вживаться{}, // Актер вживается в новую роль rus_verbs:вживить{}, // Врачи вживили стимулятор в тело пациента rus_verbs:вживиться{}, // Стимулятор вживился в тело пациента rus_verbs:вживлять{}, // Врачи вживляют стимулятор в тело пациента rus_verbs:вживляться{}, // Стимулятор вживляется в тело rus_verbs:вжиматься{}, // Видитель инстинктивно вжимается в кресло rus_verbs:вжиться{}, // Актер вжился в свою новую роль rus_verbs:взвиваться{}, // Воздушный шарик взвивается в небо rus_verbs:взвинтить{}, // Кризис взвинтил цены в небо rus_verbs:взвинтиться{}, // Цены взвинтились в небо rus_verbs:взвинчивать{}, // Кризис взвинчивает цены в небо rus_verbs:взвинчиваться{}, // Цены взвинчиваются в небо rus_verbs:взвиться{}, // Шарики взвились в небо rus_verbs:взлетать{}, // Экспериментальный аппарат взлетает в воздух rus_verbs:взлететь{}, // Экспериментальный аппарат взлетел в небо rus_verbs:взмывать{}, // шарики взмывают в небо rus_verbs:взмыть{}, // Шарики взмыли в небо rus_verbs:вильнуть{}, // Машина вильнула в левую сторону rus_verbs:вкалывать{}, // Медсестра вкалывает иглу в вену rus_verbs:вкалываться{}, // Игла вкалываться прямо в вену rus_verbs:вкапывать{}, // рабочий вкапывает сваю в землю rus_verbs:вкапываться{}, // Свая вкапывается в землю rus_verbs:вкатить{}, // рабочие вкатили бочку в гараж rus_verbs:вкатиться{}, // машина вкатилась в гараж rus_verbs:вкатывать{}, // рабочик вкатывают бочку в гараж rus_verbs:вкатываться{}, // машина вкатывается в гараж rus_verbs:вкачать{}, // Механики вкачали в бак много топлива rus_verbs:вкачивать{}, // Насос вкачивает топливо в бак rus_verbs:вкачиваться{}, // Топливо вкачивается в бак rus_verbs:вкидать{}, // Манипулятор вкидал груз в контейнер rus_verbs:вкидывать{}, // Манипулятор вкидывает груз в контейнер rus_verbs:вкидываться{}, // Груз вкидывается в контейнер rus_verbs:вкладывать{}, // Инвестор вкладывает деньги в акции rus_verbs:вкладываться{}, // Инвестор вкладывается в акции rus_verbs:вклеивать{}, // Мальчик вклеивает картинку в тетрадь rus_verbs:вклеиваться{}, // Картинка вклеивается в тетрадь rus_verbs:вклеить{}, // Мальчик вклеил картинку в тетрадь rus_verbs:вклеиться{}, // Картинка вклеилась в тетрадь rus_verbs:вклепать{}, // Молоток вклепал заклепку в лист rus_verbs:вклепывать{}, // Молоток вклепывает заклепку в лист rus_verbs:вклиниваться{}, // Машина вклинивается в поток rus_verbs:вклиниться{}, // машина вклинилась в поток rus_verbs:включать{}, // Команда включает компьютер в сеть rus_verbs:включаться{}, // Машина включается в глобальную сеть rus_verbs:включить{}, // Команда включила компьютер в сеть rus_verbs:включиться{}, // Компьютер включился в сеть rus_verbs:вколачивать{}, // Столяр вколачивает гвоздь в доску rus_verbs:вколачиваться{}, // Гвоздь вколачивается в доску rus_verbs:вколотить{}, // Столяр вколотил гвоздь в доску rus_verbs:вколоть{}, // Медсестра вколола в мышцу лекарство rus_verbs:вкопать{}, // Рабочие вкопали сваю в землю rus_verbs:вкрадываться{}, // Ошибка вкрадывается в расчеты rus_verbs:вкраивать{}, // Портниха вкраивает вставку в юбку rus_verbs:вкраиваться{}, // Вставка вкраивается в юбку rus_verbs:вкрасться{}, // Ошибка вкралась в расчеты rus_verbs:вкрутить{}, // Электрик вкрутил лампочку в патрон rus_verbs:вкрутиться{}, // лампочка легко вкрутилась в патрон rus_verbs:вкручивать{}, // Электрик вкручивает лампочку в патрон rus_verbs:вкручиваться{}, // Лампочка легко вкручивается в патрон rus_verbs:влазить{}, // Разъем влазит в отверствие rus_verbs:вламывать{}, // Полиция вламывается в квартиру rus_verbs:влетать{}, // Самолет влетает в грозовой фронт rus_verbs:влететь{}, // Самолет влетел в грозовой фронт rus_verbs:вливать{}, // Механик вливает масло в картер rus_verbs:вливаться{}, // Масло вливается в картер rus_verbs:влипать{}, // Эти неудачники постоянно влипают в разные происшествия rus_verbs:влипнуть{}, // Эти неудачники опять влипли в неприятности rus_verbs:влить{}, // Механик влил свежее масло в картер rus_verbs:влиться{}, // Свежее масло влилось в бак rus_verbs:вложить{}, // Инвесторы вложили в эти акции большие средства rus_verbs:вложиться{}, // Инвесторы вложились в эти акции rus_verbs:влюбиться{}, // Коля влюбился в Олю rus_verbs:влюблять{}, // Оля постоянно влюбляла в себя мальчиков rus_verbs:влюбляться{}, // Оля влюбляется в спортсменов rus_verbs:вляпаться{}, // Коля вляпался в неприятность rus_verbs:вляпываться{}, // Коля постоянно вляпывается в неприятности rus_verbs:вменить{}, // вменить в вину rus_verbs:вменять{}, // вменять в обязанность rus_verbs:вмерзать{}, // Колеса вмерзают в лед rus_verbs:вмерзнуть{}, // Колеса вмерзли в лед rus_verbs:вмести{}, // вмести в дом rus_verbs:вместить{}, // вместить в ёмкость rus_verbs:вместиться{}, // Прибор не вместился в зонд rus_verbs:вмешаться{}, // Начальник вмешался в конфликт rus_verbs:вмешивать{}, // Не вмешивай меня в это дело rus_verbs:вмешиваться{}, // Начальник вмешивается в переговоры rus_verbs:вмещаться{}, // Приборы не вмещаются в корпус rus_verbs:вминать{}, // вминать в корпус rus_verbs:вминаться{}, // кронштейн вминается в корпус rus_verbs:вмонтировать{}, // Конструкторы вмонтировали в корпус зонда новые приборы rus_verbs:вмонтироваться{}, // Новые приборы легко вмонтировались в корпус зонда rus_verbs:вмораживать{}, // Установка вмораживает сваи в грунт rus_verbs:вмораживаться{}, // Сваи вмораживаются в грунт rus_verbs:вморозить{}, // Установка вморозила сваи в грунт rus_verbs:вмуровать{}, // Сейф был вмурован в стену rus_verbs:вмуровывать{}, // вмуровывать сейф в стену rus_verbs:вмуровываться{}, // сейф вмуровывается в бетонную стену rus_verbs:внедрить{}, // внедрить инновацию в производство rus_verbs:внедриться{}, // Шпион внедрился в руководство rus_verbs:внедрять{}, // внедрять инновации в производство rus_verbs:внедряться{}, // Шпионы внедряются в руководство rus_verbs:внести{}, // внести коробку в дом rus_verbs:внестись{}, // внестись в список приглашенных гостей rus_verbs:вникать{}, // Разработчик вникает в детали задачи rus_verbs:вникнуть{}, // Дизайнер вник в детали задачи rus_verbs:вносить{}, // вносить новое действующее лицо в список главных героев rus_verbs:вноситься{}, // вноситься в список главных персонажей rus_verbs:внюхаться{}, // Пёс внюхался в ароматы леса rus_verbs:внюхиваться{}, // Пёс внюхивается в ароматы леса rus_verbs:вобрать{}, // вобрать в себя лучшие методы борьбы с вредителями rus_verbs:вовлекать{}, // вовлекать трудных подростков в занятие спортом rus_verbs:вогнать{}, // вогнал человека в тоску rus_verbs:водворить{}, // водворить преступника в тюрьму rus_verbs:возвернуть{}, // возвернуть в родную стихию rus_verbs:возвернуться{}, // возвернуться в родную стихию rus_verbs:возвести{}, // возвести число в четную степень rus_verbs:возводить{}, // возводить число в четную степень rus_verbs:возводиться{}, // число возводится в четную степень rus_verbs:возвратить{}, // возвратить коров в стойло rus_verbs:возвратиться{}, // возвратиться в родной дом rus_verbs:возвращать{}, // возвращать коров в стойло rus_verbs:возвращаться{}, // возвращаться в родной дом rus_verbs:войти{}, // войти в галерею славы rus_verbs:вонзать{}, // Коля вонзает вилку в котлету rus_verbs:вонзаться{}, // Вилка вонзается в котлету rus_verbs:вонзить{}, // Коля вонзил вилку в котлету rus_verbs:вонзиться{}, // Вилка вонзилась в сочную котлету rus_verbs:воплотить{}, // Коля воплотил свои мечты в реальность rus_verbs:воплотиться{}, // Мечты воплотились в реальность rus_verbs:воплощать{}, // Коля воплощает мечты в реальность rus_verbs:воплощаться{}, // Мечты иногда воплощаются в реальность rus_verbs:ворваться{}, // Перемены неожиданно ворвались в размеренную жизнь rus_verbs:воспарить{}, // Душа воспарила в небо rus_verbs:воспарять{}, // Душа воспаряет в небо rus_verbs:врыть{}, // врыть опору в землю rus_verbs:врыться{}, // врыться в землю rus_verbs:всадить{}, // всадить пулю в сердце rus_verbs:всаживать{}, // всаживать нож в бок rus_verbs:всасывать{}, // всасывать воду в себя rus_verbs:всасываться{}, // всасываться в ёмкость rus_verbs:вселить{}, // вселить надежду в кого-либо rus_verbs:вселиться{}, // вселиться в пустующее здание rus_verbs:вселять{}, // вселять надежду в кого-то rus_verbs:вселяться{}, // вселяться в пустующее здание rus_verbs:вскидывать{}, // вскидывать руку в небо rus_verbs:вскинуть{}, // вскинуть руку в небо rus_verbs:вслушаться{}, // вслушаться в звуки rus_verbs:вслушиваться{}, // вслушиваться в шорох rus_verbs:всматриваться{}, // всматриваться в темноту rus_verbs:всмотреться{}, // всмотреться в темень rus_verbs:всовывать{}, // всовывать палец в отверстие rus_verbs:всовываться{}, // всовываться в форточку rus_verbs:всосать{}, // всосать жидкость в себя rus_verbs:всосаться{}, // всосаться в кожу rus_verbs:вставить{}, // вставить ключ в замок rus_verbs:вставлять{}, // вставлять ключ в замок rus_verbs:встраивать{}, // встраивать черный ход в систему защиты rus_verbs:встраиваться{}, // встраиваться в систему безопасности rus_verbs:встревать{}, // встревать в разговор rus_verbs:встроить{}, // встроить секретный модуль в систему безопасности rus_verbs:встроиться{}, // встроиться в систему безопасности rus_verbs:встрять{}, // встрять в разговор rus_verbs:вступать{}, // вступать в действующую армию rus_verbs:вступить{}, // вступить в действующую армию rus_verbs:всунуть{}, // всунуть палец в отверстие rus_verbs:всунуться{}, // всунуться в форточку инфинитив:всыпать{вид:соверш}, // всыпать порошок в контейнер инфинитив:всыпать{вид:несоверш}, глагол:всыпать{вид:соверш}, глагол:всыпать{вид:несоверш}, деепричастие:всыпав{}, деепричастие:всыпая{}, прилагательное:всыпавший{ вид:соверш }, // прилагательное:всыпавший{ вид:несоверш }, прилагательное:всыпанный{}, // прилагательное:всыпающий{}, инфинитив:всыпаться{ вид:несоверш}, // всыпаться в контейнер // инфинитив:всыпаться{ вид:соверш}, // глагол:всыпаться{ вид:соверш}, глагол:всыпаться{ вид:несоверш}, // деепричастие:всыпавшись{}, деепричастие:всыпаясь{}, // прилагательное:всыпавшийся{ вид:соверш }, // прилагательное:всыпавшийся{ вид:несоверш }, // прилагательное:всыпающийся{}, rus_verbs:вталкивать{}, // вталкивать деталь в ячейку rus_verbs:вталкиваться{}, // вталкиваться в ячейку rus_verbs:втаптывать{}, // втаптывать в грязь rus_verbs:втаптываться{}, // втаптываться в грязь rus_verbs:втаскивать{}, // втаскивать мешок в комнату rus_verbs:втаскиваться{}, // втаскиваться в комнату rus_verbs:втащить{}, // втащить мешок в комнату rus_verbs:втащиться{}, // втащиться в комнату rus_verbs:втекать{}, // втекать в бутылку rus_verbs:втемяшивать{}, // втемяшивать в голову rus_verbs:втемяшиваться{}, // втемяшиваться в голову rus_verbs:втемяшить{}, // втемяшить в голову rus_verbs:втемяшиться{}, // втемяшиться в голову rus_verbs:втереть{}, // втереть крем в кожу rus_verbs:втереться{}, // втереться в кожу rus_verbs:втесаться{}, // втесаться в группу rus_verbs:втесывать{}, // втесывать в группу rus_verbs:втесываться{}, // втесываться в группу rus_verbs:втечь{}, // втечь в бак rus_verbs:втирать{}, // втирать крем в кожу rus_verbs:втираться{}, // втираться в кожу rus_verbs:втискивать{}, // втискивать сумку в вагон rus_verbs:втискиваться{}, // втискиваться в переполненный вагон rus_verbs:втиснуть{}, // втиснуть сумку в вагон rus_verbs:втиснуться{}, // втиснуться в переполненный вагон метро rus_verbs:втолкать{}, // втолкать коляску в лифт rus_verbs:втолкаться{}, // втолкаться в вагон метро rus_verbs:втолкнуть{}, // втолкнуть коляску в лифт rus_verbs:втолкнуться{}, // втолкнуться в вагон метро rus_verbs:втолочь{}, // втолочь в смесь rus_verbs:втоптать{}, // втоптать цветы в землю rus_verbs:вторгаться{}, // вторгаться в чужую зону rus_verbs:вторгнуться{}, // вторгнуться в частную жизнь rus_verbs:втравить{}, // втравить кого-то в неприятности rus_verbs:втравливать{}, // втравливать кого-то в неприятности rus_verbs:втрамбовать{}, // втрамбовать камни в землю rus_verbs:втрамбовывать{}, // втрамбовывать камни в землю rus_verbs:втрамбовываться{}, // втрамбовываться в землю rus_verbs:втрескаться{}, // втрескаться в кого-то rus_verbs:втрескиваться{}, // втрескиваться в кого-либо rus_verbs:втыкать{}, // втыкать вилку в котлетку rus_verbs:втыкаться{}, // втыкаться в розетку rus_verbs:втюриваться{}, // втюриваться в кого-либо rus_verbs:втюриться{}, // втюриться в кого-либо rus_verbs:втягивать{}, // втягивать что-то в себя rus_verbs:втягиваться{}, // втягиваться в себя rus_verbs:втянуться{}, // втянуться в себя rus_verbs:вцементировать{}, // вцементировать сваю в фундамент rus_verbs:вчеканить{}, // вчеканить надпись в лист rus_verbs:вчитаться{}, // вчитаться внимательнее в текст rus_verbs:вчитываться{}, // вчитываться внимательнее в текст rus_verbs:вчувствоваться{}, // вчувствоваться в роль rus_verbs:вшагивать{}, // вшагивать в новую жизнь rus_verbs:вшагнуть{}, // вшагнуть в новую жизнь rus_verbs:вшивать{}, // вшивать заплату в рубашку rus_verbs:вшиваться{}, // вшиваться в ткань rus_verbs:вшить{}, // вшить заплату в ткань rus_verbs:въедаться{}, // въедаться в мякоть rus_verbs:въезжать{}, // въезжать в гараж rus_verbs:въехать{}, // въехать в гараж rus_verbs:выиграть{}, // Коля выиграл в шахматы rus_verbs:выигрывать{}, // Коля часто выигрывает у меня в шахматы rus_verbs:выкладывать{}, // выкладывать в общий доступ rus_verbs:выкладываться{}, // выкладываться в общий доступ rus_verbs:выкрасить{}, // выкрасить машину в розовый цвет rus_verbs:выкраситься{}, // выкраситься в дерзкий розовый цвет rus_verbs:выкрашивать{}, // выкрашивать волосы в красный цвет rus_verbs:выкрашиваться{}, // выкрашиваться в красный цвет rus_verbs:вылезать{}, // вылезать в открытое пространство rus_verbs:вылезти{}, // вылезти в открытое пространство rus_verbs:выливать{}, // выливать в бутылку rus_verbs:выливаться{}, // выливаться в ёмкость rus_verbs:вылить{}, // вылить отходы в канализацию rus_verbs:вылиться{}, // Топливо вылилось в воду rus_verbs:выложить{}, // выложить в общий доступ rus_verbs:выпадать{}, // выпадать в осадок rus_verbs:выпрыгивать{}, // выпрыгивать в окно rus_verbs:выпрыгнуть{}, // выпрыгнуть в окно rus_verbs:выродиться{}, // выродиться в жалкое подобие rus_verbs:вырождаться{}, // вырождаться в жалкое подобие славных предков rus_verbs:высеваться{}, // высеваться в землю rus_verbs:высеять{}, // высеять в землю rus_verbs:выслать{}, // выслать в страну постоянного пребывания rus_verbs:высморкаться{}, // высморкаться в платок rus_verbs:высморкнуться{}, // высморкнуться в платок rus_verbs:выстреливать{}, // выстреливать в цель rus_verbs:выстреливаться{}, // выстреливаться в цель rus_verbs:выстрелить{}, // выстрелить в цель rus_verbs:вытекать{}, // вытекать в озеро rus_verbs:вытечь{}, // вытечь в воду rus_verbs:смотреть{}, // смотреть в будущее rus_verbs:подняться{}, // подняться в лабораторию rus_verbs:послать{}, // послать в магазин rus_verbs:слать{}, // слать в неизвестность rus_verbs:добавить{}, // добавить в суп rus_verbs:пройти{}, // пройти в лабораторию rus_verbs:положить{}, // положить в ящик rus_verbs:прислать{}, // прислать в полицию rus_verbs:упасть{}, // упасть в пропасть инфинитив:писать{ aux stress="пис^ать" }, // писать в газету инфинитив:писать{ aux stress="п^исать" }, // писать в штанишки глагол:писать{ aux stress="п^исать" }, глагол:писать{ aux stress="пис^ать" }, деепричастие:писая{}, прилагательное:писавший{ aux stress="п^исавший" }, // писавший в штанишки прилагательное:писавший{ aux stress="пис^авший" }, // писавший в газету rus_verbs:собираться{}, // собираться в поход rus_verbs:звать{}, // звать в ресторан rus_verbs:направиться{}, // направиться в ресторан rus_verbs:отправиться{}, // отправиться в ресторан rus_verbs:поставить{}, // поставить в угол rus_verbs:целить{}, // целить в мишень rus_verbs:попасть{}, // попасть в переплет rus_verbs:ударить{}, // ударить в больное место rus_verbs:закричать{}, // закричать в микрофон rus_verbs:опустить{}, // опустить в воду rus_verbs:принести{}, // принести в дом бездомного щенка rus_verbs:отдать{}, // отдать в хорошие руки rus_verbs:ходить{}, // ходить в школу rus_verbs:уставиться{}, // уставиться в экран rus_verbs:приходить{}, // приходить в бешенство rus_verbs:махнуть{}, // махнуть в Италию rus_verbs:сунуть{}, // сунуть в замочную скважину rus_verbs:явиться{}, // явиться в расположение части rus_verbs:уехать{}, // уехать в город rus_verbs:целовать{}, // целовать в лобик rus_verbs:повести{}, // повести в бой rus_verbs:опуститься{}, // опуститься в кресло rus_verbs:передать{}, // передать в архив rus_verbs:побежать{}, // побежать в школу rus_verbs:стечь{}, // стечь в воду rus_verbs:уходить{}, // уходить добровольцем в армию rus_verbs:привести{}, // привести в дом rus_verbs:шагнуть{}, // шагнуть в неизвестность rus_verbs:собраться{}, // собраться в поход rus_verbs:заглянуть{}, // заглянуть в основу rus_verbs:поспешить{}, // поспешить в церковь rus_verbs:поцеловать{}, // поцеловать в лоб rus_verbs:перейти{}, // перейти в высшую лигу rus_verbs:поверить{}, // поверить в искренность rus_verbs:глянуть{}, // глянуть в оглавление rus_verbs:зайти{}, // зайти в кафетерий rus_verbs:подобрать{}, // подобрать в лесу rus_verbs:проходить{}, // проходить в помещение rus_verbs:глядеть{}, // глядеть в глаза rus_verbs:пригласить{}, // пригласить в театр rus_verbs:позвать{}, // позвать в класс rus_verbs:усесться{}, // усесться в кресло rus_verbs:поступить{}, // поступить в институт rus_verbs:лечь{}, // лечь в постель rus_verbs:поклониться{}, // поклониться в пояс rus_verbs:потянуться{}, // потянуться в лес rus_verbs:колоть{}, // колоть в ягодицу rus_verbs:присесть{}, // присесть в кресло rus_verbs:оглядеться{}, // оглядеться в зеркало rus_verbs:поглядеть{}, // поглядеть в зеркало rus_verbs:превратиться{}, // превратиться в лягушку rus_verbs:принимать{}, // принимать во внимание rus_verbs:звонить{}, // звонить в колокола rus_verbs:привезти{}, // привезти в гостиницу rus_verbs:рухнуть{}, // рухнуть в пропасть rus_verbs:пускать{}, // пускать в дело rus_verbs:отвести{}, // отвести в больницу rus_verbs:сойти{}, // сойти в ад rus_verbs:набрать{}, // набрать в команду rus_verbs:собрать{}, // собрать в кулак rus_verbs:двигаться{}, // двигаться в каюту rus_verbs:падать{}, // падать в область нуля rus_verbs:полезть{}, // полезть в драку rus_verbs:направить{}, // направить в стационар rus_verbs:приводить{}, // приводить в чувство rus_verbs:толкнуть{}, // толкнуть в бок rus_verbs:кинуться{}, // кинуться в драку rus_verbs:ткнуть{}, // ткнуть в глаз rus_verbs:заключить{}, // заключить в объятия rus_verbs:подниматься{}, // подниматься в небо rus_verbs:расти{}, // расти в глубину rus_verbs:налить{}, // налить в кружку rus_verbs:швырнуть{}, // швырнуть в бездну rus_verbs:прыгнуть{}, // прыгнуть в дверь rus_verbs:промолчать{}, // промолчать в тряпочку rus_verbs:садиться{}, // садиться в кресло rus_verbs:лить{}, // лить в кувшин rus_verbs:дослать{}, // дослать деталь в держатель rus_verbs:переслать{}, // переслать в обработчик rus_verbs:удалиться{}, // удалиться в совещательную комнату rus_verbs:разглядывать{}, // разглядывать в бинокль rus_verbs:повесить{}, // повесить в шкаф инфинитив:походить{ вид:соверш }, // походить в институт глагол:походить{ вид:соверш }, деепричастие:походив{}, // прилагательное:походивший{вид:соверш}, rus_verbs:помчаться{}, // помчаться в класс rus_verbs:свалиться{}, // свалиться в яму rus_verbs:сбежать{}, // сбежать в Англию rus_verbs:стрелять{}, // стрелять в цель rus_verbs:обращать{}, // обращать в свою веру rus_verbs:завести{}, // завести в дом rus_verbs:приобрести{}, // приобрести в рассрочку rus_verbs:сбросить{}, // сбросить в яму rus_verbs:устроиться{}, // устроиться в крупную корпорацию rus_verbs:погрузиться{}, // погрузиться в пучину rus_verbs:течь{}, // течь в канаву rus_verbs:произвести{}, // произвести в звание майора rus_verbs:метать{}, // метать в цель rus_verbs:пустить{}, // пустить в дело rus_verbs:полететь{}, // полететь в Европу rus_verbs:пропустить{}, // пропустить в здание rus_verbs:рвануть{}, // рвануть в отпуск rus_verbs:заходить{}, // заходить в каморку rus_verbs:нырнуть{}, // нырнуть в прорубь rus_verbs:рвануться{}, // рвануться в атаку rus_verbs:приподняться{}, // приподняться в воздух rus_verbs:превращаться{}, // превращаться в крупную величину rus_verbs:прокричать{}, // прокричать в ухо rus_verbs:записать{}, // записать в блокнот rus_verbs:забраться{}, // забраться в шкаф rus_verbs:приезжать{}, // приезжать в деревню rus_verbs:продать{}, // продать в рабство rus_verbs:проникнуть{}, // проникнуть в центр rus_verbs:устремиться{}, // устремиться в открытое море rus_verbs:посадить{}, // посадить в кресло rus_verbs:упереться{}, // упереться в пол rus_verbs:ринуться{}, // ринуться в буфет rus_verbs:отдавать{}, // отдавать в кадетское училище rus_verbs:отложить{}, // отложить в долгий ящик rus_verbs:убежать{}, // убежать в приют rus_verbs:оценить{}, // оценить в миллион долларов rus_verbs:поднимать{}, // поднимать в стратосферу rus_verbs:отослать{}, // отослать в квалификационную комиссию rus_verbs:отодвинуть{}, // отодвинуть в дальний угол rus_verbs:торопиться{}, // торопиться в школу rus_verbs:попадаться{}, // попадаться в руки rus_verbs:поразить{}, // поразить в самое сердце rus_verbs:доставить{}, // доставить в квартиру rus_verbs:заслать{}, // заслать в тыл rus_verbs:сослать{}, // сослать в изгнание rus_verbs:запустить{}, // запустить в космос rus_verbs:удариться{}, // удариться в запой rus_verbs:ударяться{}, // ударяться в крайность rus_verbs:шептать{}, // шептать в лицо rus_verbs:уронить{}, // уронить в унитаз rus_verbs:прорычать{}, // прорычать в микрофон rus_verbs:засунуть{}, // засунуть в глотку rus_verbs:плыть{}, // плыть в открытое море rus_verbs:перенести{}, // перенести в духовку rus_verbs:светить{}, // светить в лицо rus_verbs:мчаться{}, // мчаться в ремонт rus_verbs:стукнуть{}, // стукнуть в лоб rus_verbs:обрушиться{}, // обрушиться в котлован rus_verbs:поглядывать{}, // поглядывать в экран rus_verbs:уложить{}, // уложить в кроватку инфинитив:попадать{ вид:несоверш }, // попадать в черный список глагол:попадать{ вид:несоверш }, прилагательное:попадающий{ вид:несоверш }, прилагательное:попадавший{ вид:несоверш }, деепричастие:попадая{}, rus_verbs:провалиться{}, // провалиться в яму rus_verbs:жаловаться{}, // жаловаться в комиссию rus_verbs:опоздать{}, // опоздать в школу rus_verbs:посылать{}, // посылать в парикмахерскую rus_verbs:погнать{}, // погнать в хлев rus_verbs:поступать{}, // поступать в институт rus_verbs:усадить{}, // усадить в кресло rus_verbs:проиграть{}, // проиграть в рулетку rus_verbs:прилететь{}, // прилететь в страну rus_verbs:повалиться{}, // повалиться в траву rus_verbs:огрызнуться{}, // Собака огрызнулась в ответ rus_verbs:лезть{}, // лезть в чужие дела rus_verbs:потащить{}, // потащить в суд rus_verbs:направляться{}, // направляться в порт rus_verbs:поползти{}, // поползти в другую сторону rus_verbs:пуститься{}, // пуститься в пляс rus_verbs:забиться{}, // забиться в нору rus_verbs:залезть{}, // залезть в конуру rus_verbs:сдать{}, // сдать в утиль rus_verbs:тронуться{}, // тронуться в путь rus_verbs:сыграть{}, // сыграть в шахматы rus_verbs:перевернуть{}, // перевернуть в более удобную позу rus_verbs:сжимать{}, // сжимать пальцы в кулак rus_verbs:подтолкнуть{}, // подтолкнуть в бок rus_verbs:отнести{}, // отнести животное в лечебницу rus_verbs:одеться{}, // одеться в зимнюю одежду rus_verbs:плюнуть{}, // плюнуть в колодец rus_verbs:передавать{}, // передавать в прокуратуру rus_verbs:отскочить{}, // отскочить в лоб rus_verbs:призвать{}, // призвать в армию rus_verbs:увезти{}, // увезти в деревню rus_verbs:улечься{}, // улечься в кроватку rus_verbs:отшатнуться{}, // отшатнуться в сторону rus_verbs:ложиться{}, // ложиться в постель rus_verbs:пролететь{}, // пролететь в конец rus_verbs:класть{}, // класть в сейф rus_verbs:доставлять{}, // доставлять в кабинет rus_verbs:приобретать{}, // приобретать в кредит rus_verbs:сводить{}, // сводить в театр rus_verbs:унести{}, // унести в могилу rus_verbs:покатиться{}, // покатиться в яму rus_verbs:сходить{}, // сходить в магазинчик rus_verbs:спустить{}, // спустить в канализацию rus_verbs:проникать{}, // проникать в сердцевину rus_verbs:метнуть{}, // метнуть в болвана гневный взгляд rus_verbs:пожаловаться{}, // пожаловаться в администрацию rus_verbs:стучать{}, // стучать в металлическую дверь rus_verbs:тащить{}, // тащить в ремонт rus_verbs:заглядывать{}, // заглядывать в ответы rus_verbs:плюхнуться{}, // плюхнуться в стол ароматного сена rus_verbs:увести{}, // увести в следующий кабинет rus_verbs:успевать{}, // успевать в школу rus_verbs:пробраться{}, // пробраться в собачью конуру rus_verbs:подавать{}, // подавать в суд rus_verbs:прибежать{}, // прибежать в конюшню rus_verbs:рассмотреть{}, // рассмотреть в микроскоп rus_verbs:пнуть{}, // пнуть в живот rus_verbs:завернуть{}, // завернуть в декоративную пленку rus_verbs:уезжать{}, // уезжать в деревню rus_verbs:привлекать{}, // привлекать в свои ряды rus_verbs:перебраться{}, // перебраться в прибрежный город rus_verbs:долить{}, // долить в коктейль rus_verbs:палить{}, // палить в нападающих rus_verbs:отобрать{}, // отобрать в коллекцию rus_verbs:улететь{}, // улететь в неизвестность rus_verbs:выглянуть{}, // выглянуть в окно rus_verbs:выглядывать{}, // выглядывать в окно rus_verbs:пробираться{}, // грабитель, пробирающийся в дом инфинитив:написать{ aux stress="напис^ать"}, // читатель, написавший в блог глагол:написать{ aux stress="напис^ать"}, прилагательное:написавший{ aux stress="напис^авший"}, rus_verbs:свернуть{}, // свернуть в колечко инфинитив:сползать{ вид:несоверш }, // сползать в овраг глагол:сползать{ вид:несоверш }, прилагательное:сползающий{ вид:несоверш }, прилагательное:сползавший{ вид:несоверш }, rus_verbs:барабанить{}, // барабанить в дверь rus_verbs:дописывать{}, // дописывать в конец rus_verbs:меняться{}, // меняться в лучшую сторону rus_verbs:измениться{}, // измениться в лучшую сторону rus_verbs:изменяться{}, // изменяться в лучшую сторону rus_verbs:вписаться{}, // вписаться в поворот rus_verbs:вписываться{}, // вписываться в повороты rus_verbs:переработать{}, // переработать в удобрение rus_verbs:перерабатывать{}, // перерабатывать в удобрение rus_verbs:уползать{}, // уползать в тень rus_verbs:заползать{}, // заползать в нору rus_verbs:перепрятать{}, // перепрятать в укромное место rus_verbs:заталкивать{}, // заталкивать в вагон rus_verbs:преобразовывать{}, // преобразовывать в список инфинитив:конвертировать{ вид:несоверш }, // конвертировать в список глагол:конвертировать{ вид:несоверш }, инфинитив:конвертировать{ вид:соверш }, глагол:конвертировать{ вид:соверш }, деепричастие:конвертировав{}, деепричастие:конвертируя{}, rus_verbs:изорвать{}, // Он изорвал газету в клочки. rus_verbs:выходить{}, // Окна выходят в сад. rus_verbs:говорить{}, // Он говорил в защиту своего отца. rus_verbs:вырастать{}, // Он вырастает в большого художника. rus_verbs:вывести{}, // Он вывел детей в сад. // инфинитив:всыпать{ вид:соверш }, инфинитив:всыпать{ вид:несоверш }, // глагол:всыпать{ вид:соверш }, глагол:всыпать{ вид:несоверш }, // Он всыпал в воду две ложки соли. // прилагательное:раненый{}, // Он был ранен в левую руку. // прилагательное:одетый{}, // Он был одет в толстое осеннее пальто. rus_verbs:бухнуться{}, // Он бухнулся в воду. rus_verbs:склонять{}, // склонять защиту в свою пользу rus_verbs:впиться{}, // Пиявка впилась в тело. rus_verbs:сходиться{}, // Интеллигенты начала века часто сходились в разные союзы rus_verbs:сохранять{}, // сохранить данные в файл rus_verbs:собирать{}, // собирать игрушки в ящик rus_verbs:упаковывать{}, // упаковывать вещи в чемодан rus_verbs:обращаться{}, // Обращайтесь ко мне в любое время rus_verbs:стрельнуть{}, // стрельни в толпу! rus_verbs:пулять{}, // пуляй в толпу rus_verbs:пульнуть{}, // пульни в толпу rus_verbs:становиться{}, // Становитесь в очередь. rus_verbs:вписать{}, // Юля вписала свое имя в список. rus_verbs:вписывать{}, // Мы вписывали свои имена в список прилагательное:видный{}, // Планета Марс видна в обычный бинокль rus_verbs:пойти{}, // Девочка рано пошла в школу rus_verbs:отойти{}, // Эти обычаи отошли в историю. rus_verbs:бить{}, // Холодный ветер бил ему в лицо. rus_verbs:входить{}, // Это входит в его обязанности. rus_verbs:принять{}, // меня приняли в пионеры rus_verbs:уйти{}, // Правительство РФ ушло в отставку rus_verbs:допустить{}, // Япония была допущена в Организацию Объединённых Наций в 1956 году. rus_verbs:посвятить{}, // Я посвятил друга в свою тайну. инфинитив:экспортировать{ вид:несоверш }, глагол:экспортировать{ вид:несоверш }, // экспортировать нефть в страны Востока rus_verbs:взглянуть{}, // Я не смел взглянуть ему в глаза. rus_verbs:идти{}, // Я иду гулять в парк. rus_verbs:вскочить{}, // Я вскочил в трамвай и помчался в институт. rus_verbs:получить{}, // Эту мебель мы получили в наследство от родителей. rus_verbs:везти{}, // Учитель везёт детей в лагерь. rus_verbs:качать{}, // Судно качает во все стороны. rus_verbs:заезжать{}, // Сегодня вечером я заезжал в магазин за книгами. rus_verbs:связать{}, // Свяжите свои вещи в узелок. rus_verbs:пронести{}, // Пронесите стол в дверь. rus_verbs:вынести{}, // Надо вынести примечания в конец. rus_verbs:устроить{}, // Она устроила сына в школу. rus_verbs:угодить{}, // Она угодила головой в дверь. rus_verbs:отвернуться{}, // Она резко отвернулась в сторону. rus_verbs:рассматривать{}, // Она рассматривала сцену в бинокль. rus_verbs:обратить{}, // Война обратила город в развалины. rus_verbs:сойтись{}, // Мы сошлись в школьные годы. rus_verbs:приехать{}, // Мы приехали в положенный час. rus_verbs:встать{}, // Дети встали в круг. rus_verbs:впасть{}, // Из-за болезни он впал в нужду. rus_verbs:придти{}, // придти в упадок rus_verbs:заявить{}, // Надо заявить в милицию о краже. rus_verbs:заявлять{}, // заявлять в полицию rus_verbs:ехать{}, // Мы будем ехать в Орёл rus_verbs:окрашиваться{}, // окрашиваться в красный цвет rus_verbs:решить{}, // Дело решено в пользу истца. rus_verbs:сесть{}, // Она села в кресло rus_verbs:посмотреть{}, // Она посмотрела на себя в зеркало. rus_verbs:влезать{}, // он влезает в мою квартирку rus_verbs:попасться{}, // в мою ловушку попалась мышь rus_verbs:лететь{}, // Мы летим в Орёл ГЛ_ИНФ(брать), // он берет в свою правую руку очень тяжелый шершавый камень ГЛ_ИНФ(взять), // Коля взял в руку камень ГЛ_ИНФ(поехать), // поехать в круиз ГЛ_ИНФ(подать), // подать в отставку инфинитив:засыпать{ вид:соверш }, глагол:засыпать{ вид:соверш }, // засыпать песок в ящик инфинитив:засыпать{ вид:несоверш переходность:переходный }, глагол:засыпать{ вид:несоверш переходность:переходный }, // засыпать песок в ящик ГЛ_ИНФ(впадать), прилагательное:впадающий{}, прилагательное:впадавший{}, деепричастие:впадая{}, // впадать в море ГЛ_ИНФ(постучать) // постучать в дверь } // Чтобы разрешить связывание в паттернах типа: уйти в BEA Systems fact гл_предл { if context { Гл_В_Вин предлог:в{} @regex("[a-z]+[0-9]*") } then return true } fact гл_предл { if context { Гл_В_Вин предлог:в{} *:*{ падеж:вин } } then return true } fact гл_предл { if context { глагол:подвывать{} предлог:в{} существительное:такт{ падеж:вин } } then return true } #endregion Винительный // Все остальные варианты по умолчанию запрещаем. fact гл_предл { if context { * предлог:в{} *:*{ падеж:предл } } then return false,-3 } fact гл_предл { if context { * предлог:в{} *:*{ падеж:мест } } then return false,-3 } fact гл_предл { if context { * предлог:в{} *:*{ падеж:вин } } then return false,-4 } fact гл_предл { if context { * предлог:в{} * } then return false,-5 } #endregion Предлог_В #region Предлог_НА // ------------------- С ПРЕДЛОГОМ 'НА' --------------------------- #region ПРЕДЛОЖНЫЙ // НА+предложный падеж: // ЛЕЖАТЬ НА СТОЛЕ #region VerbList wordentry_set Гл_НА_Предл= { rus_verbs:заслушать{}, // Вопрос заслушали на сессии облсовета rus_verbs:ПРОСТУПАТЬ{}, // На лбу, носу и щеке проступало черное пятно кровоподтека. (ПРОСТУПАТЬ/ПРОСТУПИТЬ) rus_verbs:ПРОСТУПИТЬ{}, // rus_verbs:ВИДНЕТЬСЯ{}, // На другой стороне Океана виднелась полоска суши, окружавшая нижний ярус планеты. (ВИДНЕТЬСЯ) rus_verbs:ЗАВИСАТЬ{}, // Машина умела зависать в воздухе на любой высоте (ЗАВИСАТЬ) rus_verbs:ЗАМЕРЕТЬ{}, // Скользнув по траве, он замер на боку (ЗАМЕРЕТЬ, локатив) rus_verbs:ЗАМИРАТЬ{}, // rus_verbs:ЗАКРЕПИТЬ{}, // Он вручил ей лишний кинжал, который она воткнула в рубаху и закрепила на подоле. (ЗАКРЕПИТЬ) rus_verbs:УПОЛЗТИ{}, // Зверь завизжал и попытался уползти на двух невредимых передних ногах. (УПОЛЗТИ/УПОЛЗАТЬ) rus_verbs:УПОЛЗАТЬ{}, // rus_verbs:БОЛТАТЬСЯ{}, // Тело его будет болтаться на пространственных ветрах, пока не сгниет веревка. (БОЛТАТЬСЯ) rus_verbs:РАЗВЕРНУТЬ{}, // Филиппины разрешат США развернуть военные базы на своей территории (РАЗВЕРНУТЬ) rus_verbs:ПОЛУЧИТЬ{}, // Я пытался узнать секреты и получить советы на официальном русскоязычном форуме (ПОЛУЧИТЬ) rus_verbs:ЗАСИЯТЬ{}, // Он активировал управление, и на экране снова засияло изображение полумесяца. (ЗАСИЯТЬ) rus_verbs:ВЗОРВАТЬСЯ{}, // Смертник взорвался на предвыборном митинге в Пакистане (ВЗОРВАТЬСЯ) rus_verbs:искриться{}, rus_verbs:ОДЕРЖИВАТЬ{}, // На выборах в иранский парламент победу одерживают противники действующего президента (ОДЕРЖИВАТЬ) rus_verbs:ПРЕСЕЧЬ{}, // На Украине пресекли дерзкий побег заключенных на вертолете (ПРЕСЕЧЬ) rus_verbs:УЛЕТЕТЬ{}, // Голый норвежец улетел на лыжах с трамплина на 60 метров (УЛЕТЕТЬ) rus_verbs:ПРОХОДИТЬ{}, // укрывающийся в лесу американский подросток проходил инициацию на охоте, выпив кружку крови первого убитого им оленя (ПРОХОДИТЬ) rus_verbs:СУЩЕСТВОВАТЬ{}, // На Марсе существовали условия для жизни (СУЩЕСТВОВАТЬ) rus_verbs:УКАЗАТЬ{}, // Победу в Лиге чемпионов укажут на часах (УКАЗАТЬ) rus_verbs:отвести{}, // отвести душу на людях rus_verbs:сходиться{}, // Оба профессора сходились на том, что в черепной коробке динозавра rus_verbs:сойтись{}, rus_verbs:ОБНАРУЖИТЬ{}, // Доказательство наличия подповерхностного океана на Европе обнаружено на её поверхности (ОБНАРУЖИТЬ) rus_verbs:НАБЛЮДАТЬСЯ{}, // Редкий зодиакальный свет вскоре будет наблюдаться на ночном небе (НАБЛЮДАТЬСЯ) rus_verbs:ДОСТИГНУТЬ{}, // На всех аварийных реакторах достигнуто состояние так называемой холодной остановки (ДОСТИГНУТЬ/ДОСТИЧЬ) глагол:ДОСТИЧЬ{}, инфинитив:ДОСТИЧЬ{}, rus_verbs:завершить{}, // Российские биатлонисты завершили чемпионат мира на мажорной ноте rus_verbs:РАСКЛАДЫВАТЬ{}, rus_verbs:ФОКУСИРОВАТЬСЯ{}, // Инвесторы предпочитают фокусироваться на среднесрочных ожиданиях (ФОКУСИРОВАТЬСЯ) rus_verbs:ВОСПРИНИМАТЬ{}, // как несерьезно воспринимали его на выборах мэра (ВОСПРИНИМАТЬ) rus_verbs:БУШЕВАТЬ{}, // на территории Тверской области бушевала гроза , в результате которой произошло отключение электроснабжения в ряде муниципальных образований региона (БУШЕВАТЬ) rus_verbs:УЧАСТИТЬСЯ{}, // В последние месяцы в зоне ответственности бундесвера на севере Афганистана участились случаи обстрелов полевых лагерей немецких миротворцев (УЧАСТИТЬСЯ) rus_verbs:ВЫИГРАТЬ{}, // Почему женская сборная России не может выиграть медаль на чемпионате мира (ВЫИГРАТЬ) rus_verbs:ПРОПАСТЬ{}, // Пропавшим на прогулке актером заинтересовались следователи (ПРОПАСТЬ) rus_verbs:УБИТЬ{}, // Силовики убили двух боевиков на административной границе Ингушетии и Чечни (УБИТЬ) rus_verbs:подпрыгнуть{}, // кобель нелепо подпрыгнул на трех ногах , а его хозяин отправил струю пива мимо рта rus_verbs:подпрыгивать{}, rus_verbs:высветиться{}, // на компьютере высветится твоя подпись rus_verbs:фигурировать{}, // его портрет фигурирует на страницах печати и телеэкранах rus_verbs:действовать{}, // выявленный контрабандный канал действовал на постоянной основе rus_verbs:СОХРАНИТЬСЯ{}, // На рынке международных сделок IPO сохранится высокая активность (СОХРАНИТЬСЯ НА) rus_verbs:ПРОЙТИ{}, // Необычный конкурс прошёл на севере Швеции (ПРОЙТИ НА предл) rus_verbs:НАЧАТЬСЯ{}, // На северо-востоке США началась сильная снежная буря. (НАЧАТЬСЯ НА предл) rus_verbs:ВОЗНИКНУТЬ{}, // Конфликт возник на почве совместной коммерческой деятельности по выращиванию овощей и зелени (ВОЗНИКНУТЬ НА) rus_verbs:СВЕТИТЬСЯ{}, // она по-прежнему светится на лицах людей (СВЕТИТЬСЯ НА предл) rus_verbs:ОРГАНИЗОВАТЬ{}, // Власти Москвы намерены организовать масленичные гуляния на 100 площадках (ОРГАНИЗОВАТЬ НА предл) rus_verbs:ИМЕТЬ{}, // Имея власть на низовом уровне, оказывать самое непосредственное и определяющее влияние на верховную власть (ИМЕТЬ НА предл) rus_verbs:ОПРОБОВАТЬ{}, // Опробовать и отточить этот инструмент на местных и региональных выборах (ОПРОБОВАТЬ, ОТТОЧИТЬ НА предл) rus_verbs:ОТТОЧИТЬ{}, rus_verbs:ДОЛОЖИТЬ{}, // Участникам совещания предложено подготовить по этому вопросу свои предложения и доложить на повторной встрече (ДОЛОЖИТЬ НА предл) rus_verbs:ОБРАЗОВЫВАТЬСЯ{}, // Солевые и пылевые бури , образующиеся на поверхности обнаженной площади моря , уничтожают урожаи и растительность (ОБРАЗОВЫВАТЬСЯ НА) rus_verbs:СОБРАТЬ{}, // использует собранные на местном рынке депозиты (СОБРАТЬ НА предл) инфинитив:НАХОДИТЬСЯ{ вид:несоверш}, // находившихся на борту самолета (НАХОДИТЬСЯ НА предл) глагол:НАХОДИТЬСЯ{ вид:несоверш }, прилагательное:находившийся{ вид:несоверш }, прилагательное:находящийся{ вид:несоверш }, деепричастие:находясь{}, rus_verbs:ГОТОВИТЬ{}, // пищу готовят сами на примусах (ГОТОВИТЬ НА предл) rus_verbs:РАЗДАТЬСЯ{}, // Они сообщили о сильном хлопке , который раздался на территории нефтебазы (РАЗДАТЬСЯ НА) rus_verbs:ПОДСКАЛЬЗЫВАТЬСЯ{}, // подскальзываться на той же апельсиновой корке (ПОДСКАЛЬЗЫВАТЬСЯ НА) rus_verbs:СКРЫТЬСЯ{}, // Германия: латвиец ограбил магазин и попытался скрыться на такси (СКРЫТЬСЯ НА предл) rus_verbs:ВЫРАСТИТЬ{}, // Пациенту вырастили новый нос на руке (ВЫРАСТИТЬ НА) rus_verbs:ПРОДЕМОНСТРИРОВАТЬ{}, // Они хотят подчеркнуть эмоциональную тонкость оппозиционера и на этом фоне продемонстрировать бездушность российской власти (ПРОДЕМОНСТРИРОВАТЬ НА предл) rus_verbs:ОСУЩЕСТВЛЯТЬСЯ{}, // первичный анализ смеси запахов может осуществляться уже на уровне рецепторных нейронов благодаря механизму латерального торможения (ОСУЩЕСТВЛЯТЬСЯ НА) rus_verbs:ВЫДЕЛЯТЬСЯ{}, // Ягоды брусники, резко выделяющиеся своим красным цветом на фоне зелёной листвы, поедаются животными и птицами (ВЫДЕЛЯТЬСЯ НА) rus_verbs:РАСКРЫТЬ{}, // На Украине раскрыто крупное мошенничество в сфере туризма (РАСКРЫТЬ НА) rus_verbs:ОБЖАРИВАТЬСЯ{}, // Омлет обжаривается на сливочном масле с одной стороны, пока он почти полностью не загустеет (ОБЖАРИВАТЬСЯ НА) rus_verbs:ПРИГОТОВЛЯТЬ{}, // Яичница — блюдо европейской кухни, приготовляемое на сковороде из разбитых яиц (ПРИГОТОВЛЯТЬ НА) rus_verbs:РАССАДИТЬ{}, // Женька рассадил игрушки на скамеечке (РАССАДИТЬ НА) rus_verbs:ОБОЖДАТЬ{}, // обожди Анжелу на остановке троллейбуса (ОБОЖДАТЬ НА) rus_verbs:УЧИТЬСЯ{}, // Марина учится на факультете журналистики (УЧИТЬСЯ НА предл) rus_verbs:раскладываться{}, // Созревшие семенные экземпляры раскладывают на солнце или в теплом месте, где они делаются мягкими (РАСКЛАДЫВАТЬСЯ В, НА) rus_verbs:ПОСЛУШАТЬ{}, // Послушайте друзей и врагов на расстоянии! (ПОСЛУШАТЬ НА) rus_verbs:ВЕСТИСЬ{}, // На стороне противника всю ночь велась перегруппировка сил. (ВЕСТИСЬ НА) rus_verbs:ПОИНТЕРЕСОВАТЬСЯ{}, // корреспондент поинтересовался у людей на улице (ПОИНТЕРЕСОВАТЬСЯ НА) rus_verbs:ОТКРЫВАТЬСЯ{}, // Российские биржи открываются на негативном фоне (ОТКРЫВАТЬСЯ НА) rus_verbs:СХОДИТЬ{}, // Вы сходите на следующей остановке? (СХОДИТЬ НА) rus_verbs:ПОГИБНУТЬ{}, // Её отец погиб на войне. (ПОГИБНУТЬ НА) rus_verbs:ВЫЙТИ{}, // Книга выйдет на будущей неделе. (ВЫЙТИ НА предл) rus_verbs:НЕСТИСЬ{}, // Корабль несётся на всех парусах. (НЕСТИСЬ НА предл) rus_verbs:вкалывать{}, // Папа вкалывает на работе, чтобы прокормить семью (вкалывать на) rus_verbs:доказать{}, // разработчики доказали на практике применимость данного подхода к обсчету сцен (доказать на, применимость к) rus_verbs:хулиганить{}, // дозволять кому-то хулиганить на кладбище (хулиганить на) глагол:вычитать{вид:соверш}, инфинитив:вычитать{вид:соверш}, // вычитать на сайте (вычитать на сайте) деепричастие:вычитав{}, rus_verbs:аккомпанировать{}, // он аккомпанировал певцу на губной гармошке (аккомпанировать на) rus_verbs:набрать{}, // статья с заголовком, набранным на компьютере rus_verbs:сделать{}, // книга с иллюстрацией, сделанной на компьютере rus_verbs:развалиться{}, // Антонио развалился на диване rus_verbs:улечься{}, // Антонио улегся на полу rus_verbs:зарубить{}, // Заруби себе на носу. rus_verbs:ценить{}, // Его ценят на заводе. rus_verbs:вернуться{}, // Отец вернулся на закате. rus_verbs:шить{}, // Вы умеете шить на машинке? rus_verbs:бить{}, // Скот бьют на бойне. rus_verbs:выехать{}, // Мы выехали на рассвете. rus_verbs:валяться{}, // На полу валяется бумага. rus_verbs:разложить{}, // она разложила полотенце на песке rus_verbs:заниматься{}, // я занимаюсь на тренажере rus_verbs:позаниматься{}, rus_verbs:порхать{}, // порхать на лугу rus_verbs:пресекать{}, // пресекать на корню rus_verbs:изъясняться{}, // изъясняться на непонятном языке rus_verbs:развесить{}, // развесить на столбах rus_verbs:обрасти{}, // обрасти на южной части rus_verbs:откладываться{}, // откладываться на стенках артерий rus_verbs:уносить{}, // уносить на носилках rus_verbs:проплыть{}, // проплыть на плоту rus_verbs:подъезжать{}, // подъезжать на повозках rus_verbs:пульсировать{}, // пульсировать на лбу rus_verbs:рассесться{}, // птицы расселись на ветках rus_verbs:застопориться{}, // застопориться на первом пункте rus_verbs:изловить{}, // изловить на окраинах rus_verbs:покататься{}, // покататься на машинках rus_verbs:залопотать{}, // залопотать на неизвестном языке rus_verbs:растягивать{}, // растягивать на станке rus_verbs:поделывать{}, // поделывать на пляже rus_verbs:подстеречь{}, // подстеречь на площадке rus_verbs:проектировать{}, // проектировать на компьютере rus_verbs:притулиться{}, // притулиться на кушетке rus_verbs:дозволять{}, // дозволять кому-то хулиганить на кладбище rus_verbs:пострелять{}, // пострелять на испытательном полигоне rus_verbs:засиживаться{}, // засиживаться на работе rus_verbs:нежиться{}, // нежиться на солнышке rus_verbs:притомиться{}, // притомиться на рабочем месте rus_verbs:поселяться{}, // поселяться на чердаке rus_verbs:потягиваться{}, // потягиваться на земле rus_verbs:отлеживаться{}, // отлеживаться на койке rus_verbs:протаранить{}, // протаранить на танке rus_verbs:гарцевать{}, // гарцевать на коне rus_verbs:облупиться{}, // облупиться на носу rus_verbs:оговорить{}, // оговорить на собеседовании rus_verbs:зарегистрироваться{}, // зарегистрироваться на сайте rus_verbs:отпечатать{}, // отпечатать на картоне rus_verbs:сэкономить{}, // сэкономить на мелочах rus_verbs:покатать{}, // покатать на пони rus_verbs:колесить{}, // колесить на старой машине rus_verbs:понастроить{}, // понастроить на участках rus_verbs:поджарить{}, // поджарить на костре rus_verbs:узнаваться{}, // узнаваться на фотографии rus_verbs:отощать{}, // отощать на казенных харчах rus_verbs:редеть{}, // редеть на макушке rus_verbs:оглашать{}, // оглашать на общем собрании rus_verbs:лопотать{}, // лопотать на иврите rus_verbs:пригреть{}, // пригреть на груди rus_verbs:консультироваться{}, // консультироваться на форуме rus_verbs:приноситься{}, // приноситься на одежде rus_verbs:сушиться{}, // сушиться на балконе rus_verbs:наследить{}, // наследить на полу rus_verbs:нагреться{}, // нагреться на солнце rus_verbs:рыбачить{}, // рыбачить на озере rus_verbs:прокатить{}, // прокатить на выборах rus_verbs:запинаться{}, // запинаться на ровном месте rus_verbs:отрубиться{}, // отрубиться на мягкой подушке rus_verbs:заморозить{}, // заморозить на улице rus_verbs:промерзнуть{}, // промерзнуть на открытом воздухе rus_verbs:просохнуть{}, // просохнуть на батарее rus_verbs:развозить{}, // развозить на велосипеде rus_verbs:прикорнуть{}, // прикорнуть на диванчике rus_verbs:отпечататься{}, // отпечататься на коже rus_verbs:выявлять{}, // выявлять на таможне rus_verbs:расставлять{}, // расставлять на башнях rus_verbs:прокрутить{}, // прокрутить на пальце rus_verbs:умываться{}, // умываться на улице rus_verbs:пересказывать{}, // пересказывать на страницах романа rus_verbs:удалять{}, // удалять на пуховике rus_verbs:хозяйничать{}, // хозяйничать на складе rus_verbs:оперировать{}, // оперировать на поле боя rus_verbs:поносить{}, // поносить на голове rus_verbs:замурлыкать{}, // замурлыкать на коленях rus_verbs:передвигать{}, // передвигать на тележке rus_verbs:прочертить{}, // прочертить на земле rus_verbs:колдовать{}, // колдовать на кухне rus_verbs:отвозить{}, // отвозить на казенном транспорте rus_verbs:трахать{}, // трахать на природе rus_verbs:мастерить{}, // мастерить на кухне rus_verbs:ремонтировать{}, // ремонтировать на коленке rus_verbs:развезти{}, // развезти на велосипеде rus_verbs:робеть{}, // робеть на сцене инфинитив:реализовать{ вид:несоверш }, инфинитив:реализовать{ вид:соверш }, // реализовать на сайте глагол:реализовать{ вид:несоверш }, глагол:реализовать{ вид:соверш }, деепричастие:реализовав{}, деепричастие:реализуя{}, rus_verbs:покаяться{}, // покаяться на смертном одре rus_verbs:специализироваться{}, // специализироваться на тестировании rus_verbs:попрыгать{}, // попрыгать на батуте rus_verbs:переписывать{}, // переписывать на столе rus_verbs:расписывать{}, // расписывать на доске rus_verbs:зажимать{}, // зажимать на запястье rus_verbs:практиковаться{}, // практиковаться на мышах rus_verbs:уединиться{}, // уединиться на чердаке rus_verbs:подохнуть{}, // подохнуть на чужбине rus_verbs:приподниматься{}, // приподниматься на руках rus_verbs:уродиться{}, // уродиться на полях rus_verbs:продолжиться{}, // продолжиться на улице rus_verbs:посапывать{}, // посапывать на диване rus_verbs:ободрать{}, // ободрать на спине rus_verbs:скрючиться{}, // скрючиться на песке rus_verbs:тормознуть{}, // тормознуть на перекрестке rus_verbs:лютовать{}, // лютовать на хуторе rus_verbs:зарегистрировать{}, // зарегистрировать на сайте rus_verbs:переждать{}, // переждать на вершине холма rus_verbs:доминировать{}, // доминировать на территории rus_verbs:публиковать{}, // публиковать на сайте rus_verbs:морщить{}, // морщить на лбу rus_verbs:сконцентрироваться{}, // сконцентрироваться на главном rus_verbs:подрабатывать{}, // подрабатывать на рынке rus_verbs:репетировать{}, // репетировать на заднем дворе rus_verbs:подвернуть{}, // подвернуть на брусчатке rus_verbs:зашелестеть{}, // зашелестеть на ветру rus_verbs:расчесывать{}, // расчесывать на спине rus_verbs:одевать{}, // одевать на рынке rus_verbs:испечь{}, // испечь на углях rus_verbs:сбрить{}, // сбрить на затылке rus_verbs:согреться{}, // согреться на печке rus_verbs:замаячить{}, // замаячить на горизонте rus_verbs:пересчитывать{}, // пересчитывать на пальцах rus_verbs:галдеть{}, // галдеть на крыльце rus_verbs:переплыть{}, // переплыть на плоту rus_verbs:передохнуть{}, // передохнуть на скамейке rus_verbs:прижиться{}, // прижиться на ферме rus_verbs:переправляться{}, // переправляться на плотах rus_verbs:накупить{}, // накупить на блошином рынке rus_verbs:проторчать{}, // проторчать на виду rus_verbs:мокнуть{}, // мокнуть на улице rus_verbs:застукать{}, // застукать на камбузе rus_verbs:завязывать{}, // завязывать на ботинках rus_verbs:повисать{}, // повисать на ветке rus_verbs:подвизаться{}, // подвизаться на государственной службе rus_verbs:кормиться{}, // кормиться на болоте rus_verbs:покурить{}, // покурить на улице rus_verbs:зимовать{}, // зимовать на болотах rus_verbs:застегивать{}, // застегивать на гимнастерке rus_verbs:поигрывать{}, // поигрывать на гитаре rus_verbs:погореть{}, // погореть на махинациях с землей rus_verbs:кувыркаться{}, // кувыркаться на батуте rus_verbs:похрапывать{}, // похрапывать на диване rus_verbs:пригревать{}, // пригревать на груди rus_verbs:завязнуть{}, // завязнуть на болоте rus_verbs:шастать{}, // шастать на втором этаже rus_verbs:заночевать{}, // заночевать на сеновале rus_verbs:отсиживаться{}, // отсиживаться на чердаке rus_verbs:мчать{}, // мчать на байке rus_verbs:сгнить{}, // сгнить на урановых рудниках rus_verbs:тренировать{}, // тренировать на манекенах rus_verbs:повеселиться{}, // повеселиться на празднике rus_verbs:измучиться{}, // измучиться на болоте rus_verbs:увянуть{}, // увянуть на подоконнике rus_verbs:раскрутить{}, // раскрутить на оси rus_verbs:выцвести{}, // выцвести на солнечном свету rus_verbs:изготовлять{}, // изготовлять на коленке rus_verbs:гнездиться{}, // гнездиться на вершине дерева rus_verbs:разогнаться{}, // разогнаться на мотоцикле rus_verbs:излагаться{}, // излагаться на страницах доклада rus_verbs:сконцентрировать{}, // сконцентрировать на левом фланге rus_verbs:расчесать{}, // расчесать на макушке rus_verbs:плавиться{}, // плавиться на солнце rus_verbs:редактировать{}, // редактировать на ноутбуке rus_verbs:подскакивать{}, // подскакивать на месте rus_verbs:покупаться{}, // покупаться на рынке rus_verbs:промышлять{}, // промышлять на мелководье rus_verbs:приобретаться{}, // приобретаться на распродажах rus_verbs:наигрывать{}, // наигрывать на банджо rus_verbs:маневрировать{}, // маневрировать на флангах rus_verbs:запечатлеться{}, // запечатлеться на записях камер rus_verbs:укрывать{}, // укрывать на чердаке rus_verbs:подорваться{}, // подорваться на фугасе rus_verbs:закрепиться{}, // закрепиться на занятых позициях rus_verbs:громыхать{}, // громыхать на кухне инфинитив:подвигаться{ вид:соверш }, глагол:подвигаться{ вид:соверш }, // подвигаться на полу деепричастие:подвигавшись{}, rus_verbs:добываться{}, // добываться на территории Анголы rus_verbs:приплясывать{}, // приплясывать на сцене rus_verbs:доживать{}, // доживать на больничной койке rus_verbs:отпраздновать{}, // отпраздновать на работе rus_verbs:сгубить{}, // сгубить на корню rus_verbs:схоронить{}, // схоронить на кладбище rus_verbs:тускнеть{}, // тускнеть на солнце rus_verbs:скопить{}, // скопить на счету rus_verbs:помыть{}, // помыть на своем этаже rus_verbs:пороть{}, // пороть на конюшне rus_verbs:наличествовать{}, // наличествовать на складе rus_verbs:нащупывать{}, // нащупывать на полке rus_verbs:змеиться{}, // змеиться на дне rus_verbs:пожелтеть{}, // пожелтеть на солнце rus_verbs:заостриться{}, // заостриться на конце rus_verbs:свезти{}, // свезти на поле rus_verbs:прочувствовать{}, // прочувствовать на своей шкуре rus_verbs:подкрутить{}, // подкрутить на приборной панели rus_verbs:рубиться{}, // рубиться на мечах rus_verbs:сиживать{}, // сиживать на крыльце rus_verbs:тараторить{}, // тараторить на иностранном языке rus_verbs:теплеть{}, // теплеть на сердце rus_verbs:покачаться{}, // покачаться на ветке rus_verbs:сосредоточиваться{}, // сосредоточиваться на главной задаче rus_verbs:развязывать{}, // развязывать на ботинках rus_verbs:подвозить{}, // подвозить на мотороллере rus_verbs:вышивать{}, // вышивать на рубашке rus_verbs:скупать{}, // скупать на открытом рынке rus_verbs:оформлять{}, // оформлять на встрече rus_verbs:распускаться{}, // распускаться на клумбах rus_verbs:прогореть{}, // прогореть на спекуляциях rus_verbs:приползти{}, // приползти на коленях rus_verbs:загореть{}, // загореть на пляже rus_verbs:остудить{}, // остудить на балконе rus_verbs:нарвать{}, // нарвать на поляне rus_verbs:издохнуть{}, // издохнуть на болоте rus_verbs:разгружать{}, // разгружать на дороге rus_verbs:произрастать{}, // произрастать на болотах rus_verbs:разуться{}, // разуться на коврике rus_verbs:сооружать{}, // сооружать на площади rus_verbs:зачитывать{}, // зачитывать на митинге rus_verbs:уместиться{}, // уместиться на ладони rus_verbs:закупить{}, // закупить на рынке rus_verbs:горланить{}, // горланить на улице rus_verbs:экономить{}, // экономить на спичках rus_verbs:исправлять{}, // исправлять на доске rus_verbs:расслабляться{}, // расслабляться на лежаке rus_verbs:скапливаться{}, // скапливаться на крыше rus_verbs:сплетничать{}, // сплетничать на скамеечке rus_verbs:отъезжать{}, // отъезжать на лимузине rus_verbs:отчитывать{}, // отчитывать на собрании rus_verbs:сфокусировать{}, // сфокусировать на удаленной точке rus_verbs:потчевать{}, // потчевать на лаврах rus_verbs:окопаться{}, // окопаться на окраине rus_verbs:загорать{}, // загорать на пляже rus_verbs:обгореть{}, // обгореть на солнце rus_verbs:распознавать{}, // распознавать на фотографии rus_verbs:заплетаться{}, // заплетаться на макушке rus_verbs:перегреться{}, // перегреться на жаре rus_verbs:подметать{}, // подметать на крыльце rus_verbs:нарисоваться{}, // нарисоваться на горизонте rus_verbs:проскакивать{}, // проскакивать на экране rus_verbs:попивать{}, // попивать на балконе чай rus_verbs:отплывать{}, // отплывать на лодке rus_verbs:чирикать{}, // чирикать на ветках rus_verbs:скупить{}, // скупить на оптовых базах rus_verbs:наколоть{}, // наколоть на коже картинку rus_verbs:созревать{}, // созревать на ветке rus_verbs:проколоться{}, // проколоться на мелочи rus_verbs:крутнуться{}, // крутнуться на заднем колесе rus_verbs:переночевать{}, // переночевать на постоялом дворе rus_verbs:концентрироваться{}, // концентрироваться на фильтре rus_verbs:одичать{}, // одичать на хуторе rus_verbs:спасаться{}, // спасаются на лодке rus_verbs:доказываться{}, // доказываться на страницах книги rus_verbs:познаваться{}, // познаваться на ринге rus_verbs:замыкаться{}, // замыкаться на металлическом предмете rus_verbs:заприметить{}, // заприметить на пригорке rus_verbs:продержать{}, // продержать на морозе rus_verbs:форсировать{}, // форсировать на плотах rus_verbs:сохнуть{}, // сохнуть на солнце rus_verbs:выявить{}, // выявить на поверхности rus_verbs:заседать{}, // заседать на кафедре rus_verbs:расплачиваться{}, // расплачиваться на выходе rus_verbs:светлеть{}, // светлеть на горизонте rus_verbs:залепетать{}, // залепетать на незнакомом языке rus_verbs:подсчитывать{}, // подсчитывать на пальцах rus_verbs:зарыть{}, // зарыть на пустыре rus_verbs:сформироваться{}, // сформироваться на месте rus_verbs:развертываться{}, // развертываться на площадке rus_verbs:набивать{}, // набивать на манекенах rus_verbs:замерзать{}, // замерзать на ветру rus_verbs:схватывать{}, // схватывать на лету rus_verbs:перевестись{}, // перевестись на Руси rus_verbs:смешивать{}, // смешивать на блюдце rus_verbs:прождать{}, // прождать на входе rus_verbs:мерзнуть{}, // мерзнуть на ветру rus_verbs:растирать{}, // растирать на коже rus_verbs:переспать{}, // переспал на сеновале rus_verbs:рассекать{}, // рассекать на скутере rus_verbs:опровергнуть{}, // опровергнуть на высшем уровне rus_verbs:дрыхнуть{}, // дрыхнуть на диване rus_verbs:распять{}, // распять на кресте rus_verbs:запечься{}, // запечься на костре rus_verbs:застилать{}, // застилать на балконе rus_verbs:сыскаться{}, // сыскаться на огороде rus_verbs:разориться{}, // разориться на продаже спичек rus_verbs:переделать{}, // переделать на станке rus_verbs:разъяснять{}, // разъяснять на страницах газеты rus_verbs:поседеть{}, // поседеть на висках rus_verbs:протащить{}, // протащить на спине rus_verbs:осуществиться{}, // осуществиться на деле rus_verbs:селиться{}, // селиться на окраине rus_verbs:оплачивать{}, // оплачивать на первой кассе rus_verbs:переворачивать{}, // переворачивать на сковородке rus_verbs:упражняться{}, // упражняться на батуте rus_verbs:испробовать{}, // испробовать на себе rus_verbs:разгладиться{}, // разгладиться на спине rus_verbs:рисоваться{}, // рисоваться на стекле rus_verbs:продрогнуть{}, // продрогнуть на морозе rus_verbs:пометить{}, // пометить на доске rus_verbs:приютить{}, // приютить на чердаке rus_verbs:избирать{}, // избирать на первых свободных выборах rus_verbs:затеваться{}, // затеваться на матче rus_verbs:уплывать{}, // уплывать на катере rus_verbs:замерцать{}, // замерцать на рекламном щите rus_verbs:фиксироваться{}, // фиксироваться на достигнутом уровне rus_verbs:запираться{}, // запираться на чердаке rus_verbs:загубить{}, // загубить на корню rus_verbs:развеяться{}, // развеяться на природе rus_verbs:съезжаться{}, // съезжаться на лимузинах rus_verbs:потанцевать{}, // потанцевать на могиле rus_verbs:дохнуть{}, // дохнуть на солнце rus_verbs:припарковаться{}, // припарковаться на газоне rus_verbs:отхватить{}, // отхватить на распродаже rus_verbs:остывать{}, // остывать на улице rus_verbs:переваривать{}, // переваривать на высокой ветке rus_verbs:подвесить{}, // подвесить на веревке rus_verbs:хвастать{}, // хвастать на работе rus_verbs:отрабатывать{}, // отрабатывать на уборке урожая rus_verbs:разлечься{}, // разлечься на полу rus_verbs:очертить{}, // очертить на полу rus_verbs:председательствовать{}, // председательствовать на собрании rus_verbs:сконфузиться{}, // сконфузиться на сцене rus_verbs:выявляться{}, // выявляться на ринге rus_verbs:крутануться{}, // крутануться на заднем колесе rus_verbs:караулить{}, // караулить на входе rus_verbs:перечислять{}, // перечислять на пальцах rus_verbs:обрабатывать{}, // обрабатывать на станке rus_verbs:настигать{}, // настигать на берегу rus_verbs:разгуливать{}, // разгуливать на берегу rus_verbs:насиловать{}, // насиловать на пляже rus_verbs:поредеть{}, // поредеть на макушке rus_verbs:учитывать{}, // учитывать на балансе rus_verbs:зарождаться{}, // зарождаться на большой глубине rus_verbs:распространять{}, // распространять на сайтах rus_verbs:пировать{}, // пировать на вершине холма rus_verbs:начертать{}, // начертать на стене rus_verbs:расцветать{}, // расцветать на подоконнике rus_verbs:умнеть{}, // умнеть на глазах rus_verbs:царствовать{}, // царствовать на окраине rus_verbs:закрутиться{}, // закрутиться на работе rus_verbs:отработать{}, // отработать на шахте rus_verbs:полечь{}, // полечь на поле брани rus_verbs:щебетать{}, // щебетать на ветке rus_verbs:подчеркиваться{}, // подчеркиваться на сайте rus_verbs:посеять{}, // посеять на другом поле rus_verbs:замечаться{}, // замечаться на пастбище rus_verbs:просчитать{}, // просчитать на пальцах rus_verbs:голосовать{}, // голосовать на трассе rus_verbs:маяться{}, // маяться на пляже rus_verbs:сколотить{}, // сколотить на службе rus_verbs:обретаться{}, // обретаться на чужбине rus_verbs:обливаться{}, // обливаться на улице rus_verbs:катать{}, // катать на лошадке rus_verbs:припрятать{}, // припрятать на теле rus_verbs:запаниковать{}, // запаниковать на экзамене инфинитив:слетать{ вид:соверш }, глагол:слетать{ вид:соверш }, // слетать на частном самолете деепричастие:слетав{}, rus_verbs:срубить{}, // срубить денег на спекуляциях rus_verbs:зажигаться{}, // зажигаться на улице rus_verbs:жарить{}, // жарить на углях rus_verbs:накапливаться{}, // накапливаться на счету rus_verbs:распуститься{}, // распуститься на грядке rus_verbs:рассаживаться{}, // рассаживаться на местах rus_verbs:странствовать{}, // странствовать на лошади rus_verbs:осматриваться{}, // осматриваться на месте rus_verbs:разворачивать{}, // разворачивать на завоеванной территории rus_verbs:согревать{}, // согревать на вершине горы rus_verbs:заскучать{}, // заскучать на вахте rus_verbs:перекусить{}, // перекусить на бегу rus_verbs:приплыть{}, // приплыть на тримаране rus_verbs:зажигать{}, // зажигать на танцах rus_verbs:закопать{}, // закопать на поляне rus_verbs:стирать{}, // стирать на берегу rus_verbs:подстерегать{}, // подстерегать на подходе rus_verbs:погулять{}, // погулять на свадьбе rus_verbs:огласить{}, // огласить на митинге rus_verbs:разбогатеть{}, // разбогатеть на прииске rus_verbs:грохотать{}, // грохотать на чердаке rus_verbs:расположить{}, // расположить на границе rus_verbs:реализоваться{}, // реализоваться на новой работе rus_verbs:застывать{}, // застывать на морозе rus_verbs:запечатлеть{}, // запечатлеть на пленке rus_verbs:тренироваться{}, // тренироваться на манекене rus_verbs:поспорить{}, // поспорить на совещании rus_verbs:затягивать{}, // затягивать на поясе rus_verbs:зиждиться{}, // зиждиться на твердой основе rus_verbs:построиться{}, // построиться на песке rus_verbs:надрываться{}, // надрываться на работе rus_verbs:закипать{}, // закипать на плите rus_verbs:затонуть{}, // затонуть на мелководье rus_verbs:побыть{}, // побыть на фазенде rus_verbs:сгорать{}, // сгорать на солнце инфинитив:пописать{ aux stress="поп^исать" }, глагол:пописать{ aux stress="поп^исать" }, // пописать на улице деепричастие:пописав{ aux stress="поп^исав" }, rus_verbs:подраться{}, // подраться на сцене rus_verbs:заправить{}, // заправить на последней заправке rus_verbs:обозначаться{}, // обозначаться на карте rus_verbs:просиживать{}, // просиживать на берегу rus_verbs:начертить{}, // начертить на листке rus_verbs:тормозить{}, // тормозить на льду rus_verbs:затевать{}, // затевать на космической базе rus_verbs:задерживать{}, // задерживать на таможне rus_verbs:прилетать{}, // прилетать на частном самолете rus_verbs:полулежать{}, // полулежать на травке rus_verbs:ерзать{}, // ерзать на табуретке rus_verbs:покопаться{}, // покопаться на складе rus_verbs:подвезти{}, // подвезти на машине rus_verbs:полежать{}, // полежать на водном матрасе rus_verbs:стыть{}, // стыть на улице rus_verbs:стынуть{}, // стынуть на улице rus_verbs:скреститься{}, // скреститься на груди rus_verbs:припарковать{}, // припарковать на стоянке rus_verbs:здороваться{}, // здороваться на кафедре rus_verbs:нацарапать{}, // нацарапать на парте rus_verbs:откопать{}, // откопать на поляне rus_verbs:смастерить{}, // смастерить на коленках rus_verbs:довезти{}, // довезти на машине rus_verbs:избивать{}, // избивать на крыше rus_verbs:сварить{}, // сварить на костре rus_verbs:истребить{}, // истребить на корню rus_verbs:раскопать{}, // раскопать на болоте rus_verbs:попить{}, // попить на кухне rus_verbs:заправлять{}, // заправлять на базе rus_verbs:кушать{}, // кушать на кухне rus_verbs:замолкать{}, // замолкать на половине фразы rus_verbs:измеряться{}, // измеряться на весах rus_verbs:сбываться{}, // сбываться на самом деле rus_verbs:изображаться{}, // изображается на сцене rus_verbs:фиксировать{}, // фиксировать на данной высоте rus_verbs:ослаблять{}, // ослаблять на шее rus_verbs:зреть{}, // зреть на грядке rus_verbs:зеленеть{}, // зеленеть на грядке rus_verbs:критиковать{}, // критиковать на страницах газеты rus_verbs:облететь{}, // облететь на самолете rus_verbs:заразиться{}, // заразиться на работе rus_verbs:рассеять{}, // рассеять на территории rus_verbs:печься{}, // печься на костре rus_verbs:поспать{}, // поспать на земле rus_verbs:сплетаться{}, // сплетаться на макушке rus_verbs:удерживаться{}, // удерживаться на расстоянии rus_verbs:помешаться{}, // помешаться на чистоте rus_verbs:ликвидировать{}, // ликвидировать на полигоне rus_verbs:проваляться{}, // проваляться на диване rus_verbs:лечиться{}, // лечиться на дому rus_verbs:обработать{}, // обработать на станке rus_verbs:защелкнуть{}, // защелкнуть на руках rus_verbs:разносить{}, // разносить на одежде rus_verbs:чесать{}, // чесать на груди rus_verbs:наладить{}, // наладить на конвейере выпуск rus_verbs:отряхнуться{}, // отряхнуться на улице rus_verbs:разыгрываться{}, // разыгрываться на скачках rus_verbs:обеспечиваться{}, // обеспечиваться на выгодных условиях rus_verbs:греться{}, // греться на вокзале rus_verbs:засидеться{}, // засидеться на одном месте rus_verbs:материализоваться{}, // материализоваться на границе rus_verbs:рассеиваться{}, // рассеиваться на высоте вершин rus_verbs:перевозить{}, // перевозить на платформе rus_verbs:поиграть{}, // поиграть на скрипке rus_verbs:потоптаться{}, // потоптаться на одном месте rus_verbs:переправиться{}, // переправиться на плоту rus_verbs:забрезжить{}, // забрезжить на горизонте rus_verbs:завывать{}, // завывать на опушке rus_verbs:заваривать{}, // заваривать на кухоньке rus_verbs:перемещаться{}, // перемещаться на спасательном плоту инфинитив:писаться{ aux stress="пис^аться" }, глагол:писаться{ aux stress="пис^аться" }, // писаться на бланке rus_verbs:праздновать{}, // праздновать на улицах rus_verbs:обучить{}, // обучить на корте rus_verbs:орудовать{}, // орудовать на складе rus_verbs:подрасти{}, // подрасти на глядке rus_verbs:шелестеть{}, // шелестеть на ветру rus_verbs:раздеваться{}, // раздеваться на публике rus_verbs:пообедать{}, // пообедать на газоне rus_verbs:жрать{}, // жрать на помойке rus_verbs:исполняться{}, // исполняться на флейте rus_verbs:похолодать{}, // похолодать на улице rus_verbs:гнить{}, // гнить на каторге rus_verbs:прослушать{}, // прослушать на концерте rus_verbs:совещаться{}, // совещаться на заседании rus_verbs:покачивать{}, // покачивать на волнах rus_verbs:отсидеть{}, // отсидеть на гаупвахте rus_verbs:формировать{}, // формировать на секретной базе rus_verbs:захрапеть{}, // захрапеть на кровати rus_verbs:объехать{}, // объехать на попутке rus_verbs:поселить{}, // поселить на верхних этажах rus_verbs:заворочаться{}, // заворочаться на сене rus_verbs:напрятать{}, // напрятать на теле rus_verbs:очухаться{}, // очухаться на земле rus_verbs:полистать{}, // полистать на досуге rus_verbs:завертеть{}, // завертеть на шесте rus_verbs:печатать{}, // печатать на ноуте rus_verbs:отыскаться{}, // отыскаться на складе rus_verbs:зафиксировать{}, // зафиксировать на пленке rus_verbs:расстилаться{}, // расстилаться на столе rus_verbs:заместить{}, // заместить на посту rus_verbs:угасать{}, // угасать на неуправляемом корабле rus_verbs:сразить{}, // сразить на ринге rus_verbs:расплываться{}, // расплываться на жаре rus_verbs:сосчитать{}, // сосчитать на пальцах rus_verbs:сгуститься{}, // сгуститься на небольшой высоте rus_verbs:цитировать{}, // цитировать на плите rus_verbs:ориентироваться{}, // ориентироваться на местности rus_verbs:расширить{}, // расширить на другом конце rus_verbs:обтереть{}, // обтереть на стоянке rus_verbs:подстрелить{}, // подстрелить на охоте rus_verbs:растереть{}, // растереть на твердой поверхности rus_verbs:подавлять{}, // подавлять на первом этапе rus_verbs:смешиваться{}, // смешиваться на поверхности // инфинитив:вычитать{ aux stress="в^ычитать" }, глагол:вычитать{ aux stress="в^ычитать" }, // вычитать на сайте // деепричастие:вычитав{}, rus_verbs:сократиться{}, // сократиться на втором этапе rus_verbs:занервничать{}, // занервничать на экзамене rus_verbs:соприкоснуться{}, // соприкоснуться на трассе rus_verbs:обозначить{}, // обозначить на плане rus_verbs:обучаться{}, // обучаться на производстве rus_verbs:снизиться{}, // снизиться на большой высоте rus_verbs:простудиться{}, // простудиться на ветру rus_verbs:поддерживаться{}, // поддерживается на встрече rus_verbs:уплыть{}, // уплыть на лодочке rus_verbs:резвиться{}, // резвиться на песочке rus_verbs:поерзать{}, // поерзать на скамеечке rus_verbs:похвастаться{}, // похвастаться на встрече rus_verbs:знакомиться{}, // знакомиться на уроке rus_verbs:проплывать{}, // проплывать на катере rus_verbs:засесть{}, // засесть на чердаке rus_verbs:подцепить{}, // подцепить на дискотеке rus_verbs:обыскать{}, // обыскать на входе rus_verbs:оправдаться{}, // оправдаться на суде rus_verbs:раскрываться{}, // раскрываться на сцене rus_verbs:одеваться{}, // одеваться на вещевом рынке rus_verbs:засветиться{}, // засветиться на фотографиях rus_verbs:употребляться{}, // употребляться на птицефабриках rus_verbs:грабить{}, // грабить на пустыре rus_verbs:гонять{}, // гонять на повышенных оборотах rus_verbs:развеваться{}, // развеваться на древке rus_verbs:основываться{}, // основываться на безусловных фактах rus_verbs:допрашивать{}, // допрашивать на базе rus_verbs:проработать{}, // проработать на стройке rus_verbs:сосредоточить{}, // сосредоточить на месте rus_verbs:сочинять{}, // сочинять на ходу rus_verbs:ползать{}, // ползать на камне rus_verbs:раскинуться{}, // раскинуться на пустыре rus_verbs:уставать{}, // уставать на работе rus_verbs:укрепить{}, // укрепить на конце rus_verbs:образовывать{}, // образовывать на открытом воздухе взрывоопасную смесь rus_verbs:одобрять{}, // одобрять на словах rus_verbs:приговорить{}, // приговорить на заседании тройки rus_verbs:чернеть{}, // чернеть на свету rus_verbs:гнуть{}, // гнуть на станке rus_verbs:размещаться{}, // размещаться на бирже rus_verbs:соорудить{}, // соорудить на даче rus_verbs:пастись{}, // пастись на лугу rus_verbs:формироваться{}, // формироваться на дне rus_verbs:таить{}, // таить на дне rus_verbs:приостановиться{}, // приостановиться на середине rus_verbs:топтаться{}, // топтаться на месте rus_verbs:громить{}, // громить на подступах rus_verbs:вычислить{}, // вычислить на бумажке rus_verbs:заказывать{}, // заказывать на сайте rus_verbs:осуществить{}, // осуществить на практике rus_verbs:обосноваться{}, // обосноваться на верхушке rus_verbs:пытать{}, // пытать на электрическом стуле rus_verbs:совершиться{}, // совершиться на заседании rus_verbs:свернуться{}, // свернуться на медленном огне rus_verbs:пролетать{}, // пролетать на дельтаплане rus_verbs:сбыться{}, // сбыться на самом деле rus_verbs:разговориться{}, // разговориться на уроке rus_verbs:разворачиваться{}, // разворачиваться на перекрестке rus_verbs:преподнести{}, // преподнести на блюдечке rus_verbs:напечатать{}, // напечатать на лазернике rus_verbs:прорвать{}, // прорвать на периферии rus_verbs:раскачиваться{}, // раскачиваться на доске rus_verbs:задерживаться{}, // задерживаться на старте rus_verbs:угощать{}, // угощать на вечеринке rus_verbs:шарить{}, // шарить на столе rus_verbs:увеличивать{}, // увеличивать на первом этапе rus_verbs:рехнуться{}, // рехнуться на старости лет rus_verbs:расцвести{}, // расцвести на грядке rus_verbs:закипеть{}, // закипеть на плите rus_verbs:подлететь{}, // подлететь на параплане rus_verbs:рыться{}, // рыться на свалке rus_verbs:добираться{}, // добираться на попутках rus_verbs:продержаться{}, // продержаться на вершине rus_verbs:разыскивать{}, // разыскивать на выставках rus_verbs:освобождать{}, // освобождать на заседании rus_verbs:передвигаться{}, // передвигаться на самокате rus_verbs:проявиться{}, // проявиться на свету rus_verbs:заскользить{}, // заскользить на льду rus_verbs:пересказать{}, // пересказать на сцене студенческого театра rus_verbs:протестовать{}, // протестовать на улице rus_verbs:указываться{}, // указываться на табличках rus_verbs:прискакать{}, // прискакать на лошадке rus_verbs:копошиться{}, // копошиться на свежем воздухе rus_verbs:подсчитать{}, // подсчитать на бумажке rus_verbs:разволноваться{}, // разволноваться на экзамене rus_verbs:завертеться{}, // завертеться на полу rus_verbs:ознакомиться{}, // ознакомиться на ходу rus_verbs:ржать{}, // ржать на уроке rus_verbs:раскинуть{}, // раскинуть на грядках rus_verbs:разгромить{}, // разгромить на ринге rus_verbs:подслушать{}, // подслушать на совещании rus_verbs:описываться{}, // описываться на страницах книги rus_verbs:качаться{}, // качаться на стуле rus_verbs:усилить{}, // усилить на флангах rus_verbs:набросать{}, // набросать на клочке картона rus_verbs:расстреливать{}, // расстреливать на подходе rus_verbs:запрыгать{}, // запрыгать на одной ноге rus_verbs:сыскать{}, // сыскать на чужбине rus_verbs:подтвердиться{}, // подтвердиться на практике rus_verbs:плескаться{}, // плескаться на мелководье rus_verbs:расширяться{}, // расширяться на конце rus_verbs:подержать{}, // подержать на солнце rus_verbs:планироваться{}, // планироваться на общем собрании rus_verbs:сгинуть{}, // сгинуть на чужбине rus_verbs:замкнуться{}, // замкнуться на точке rus_verbs:закачаться{}, // закачаться на ветру rus_verbs:перечитывать{}, // перечитывать на ходу rus_verbs:перелететь{}, // перелететь на дельтаплане rus_verbs:оживать{}, // оживать на солнце rus_verbs:женить{}, // женить на богатой невесте rus_verbs:заглохнуть{}, // заглохнуть на старте rus_verbs:копаться{}, // копаться на полу rus_verbs:развлекаться{}, // развлекаться на дискотеке rus_verbs:печататься{}, // печататься на струйном принтере rus_verbs:обрываться{}, // обрываться на полуслове rus_verbs:ускакать{}, // ускакать на лошадке rus_verbs:подписывать{}, // подписывать на столе rus_verbs:добывать{}, // добывать на выработке rus_verbs:скопиться{}, // скопиться на выходе rus_verbs:повстречать{}, // повстречать на пути rus_verbs:поцеловаться{}, // поцеловаться на площади rus_verbs:растянуть{}, // растянуть на столе rus_verbs:подаваться{}, // подаваться на благотворительном обеде rus_verbs:повстречаться{}, // повстречаться на митинге rus_verbs:примоститься{}, // примоститься на ступеньках rus_verbs:отразить{}, // отразить на страницах доклада rus_verbs:пояснять{}, // пояснять на страницах приложения rus_verbs:накормить{}, // накормить на кухне rus_verbs:поужинать{}, // поужинать на веранде инфинитив:спеть{ вид:соверш }, глагол:спеть{ вид:соверш }, // спеть на митинге деепричастие:спев{}, инфинитив:спеть{ вид:несоверш }, глагол:спеть{ вид:несоверш }, rus_verbs:топить{}, // топить на мелководье rus_verbs:освоить{}, // освоить на практике rus_verbs:распластаться{}, // распластаться на травке rus_verbs:отплыть{}, // отплыть на старом каяке rus_verbs:улетать{}, // улетать на любом самолете rus_verbs:отстаивать{}, // отстаивать на корте rus_verbs:осуждать{}, // осуждать на словах rus_verbs:переговорить{}, // переговорить на обеде rus_verbs:укрыть{}, // укрыть на чердаке rus_verbs:томиться{}, // томиться на привязи rus_verbs:сжигать{}, // сжигать на полигоне rus_verbs:позавтракать{}, // позавтракать на лоне природы rus_verbs:функционировать{}, // функционирует на солнечной энергии rus_verbs:разместить{}, // разместить на сайте rus_verbs:пронести{}, // пронести на теле rus_verbs:нашарить{}, // нашарить на столе rus_verbs:корчиться{}, // корчиться на полу rus_verbs:распознать{}, // распознать на снимке rus_verbs:повеситься{}, // повеситься на шнуре rus_verbs:обозначиться{}, // обозначиться на картах rus_verbs:оступиться{}, // оступиться на скользком льду rus_verbs:подносить{}, // подносить на блюдечке rus_verbs:расстелить{}, // расстелить на газоне rus_verbs:обсуждаться{}, // обсуждаться на собрании rus_verbs:расписаться{}, // расписаться на бланке rus_verbs:плестись{}, // плестись на привязи rus_verbs:объявиться{}, // объявиться на сцене rus_verbs:повышаться{}, // повышаться на первом датчике rus_verbs:разрабатывать{}, // разрабатывать на заводе rus_verbs:прерывать{}, // прерывать на середине rus_verbs:каяться{}, // каяться на публике rus_verbs:освоиться{}, // освоиться на лошади rus_verbs:подплыть{}, // подплыть на плоту rus_verbs:оскорбить{}, // оскорбить на митинге rus_verbs:торжествовать{}, // торжествовать на пьедестале rus_verbs:поправлять{}, // поправлять на одежде rus_verbs:отражать{}, // отражать на картине rus_verbs:дремать{}, // дремать на кушетке rus_verbs:применяться{}, // применяться на производстве стали rus_verbs:поражать{}, // поражать на большой дистанции rus_verbs:расстрелять{}, // расстрелять на окраине хутора rus_verbs:рассчитать{}, // рассчитать на калькуляторе rus_verbs:записывать{}, // записывать на ленте rus_verbs:перебирать{}, // перебирать на ладони rus_verbs:разбиться{}, // разбиться на катере rus_verbs:поискать{}, // поискать на ферме rus_verbs:прятать{}, // прятать на заброшенном складе rus_verbs:пропеть{}, // пропеть на эстраде rus_verbs:замелькать{}, // замелькать на экране rus_verbs:грустить{}, // грустить на веранде rus_verbs:крутить{}, // крутить на оси rus_verbs:подготовить{}, // подготовить на конспиративной квартире rus_verbs:различать{}, // различать на картинке rus_verbs:киснуть{}, // киснуть на чужбине rus_verbs:оборваться{}, // оборваться на полуслове rus_verbs:запутаться{}, // запутаться на простейшем тесте rus_verbs:общаться{}, // общаться на уроке rus_verbs:производиться{}, // производиться на фабрике rus_verbs:сочинить{}, // сочинить на досуге rus_verbs:давить{}, // давить на лице rus_verbs:разработать{}, // разработать на секретном предприятии rus_verbs:качать{}, // качать на качелях rus_verbs:тушить{}, // тушить на крыше пожар rus_verbs:охранять{}, // охранять на территории базы rus_verbs:приметить{}, // приметить на взгорке rus_verbs:скрыть{}, // скрыть на теле rus_verbs:удерживать{}, // удерживать на руке rus_verbs:усвоить{}, // усвоить на уроке rus_verbs:растаять{}, // растаять на солнечной стороне rus_verbs:красоваться{}, // красоваться на виду rus_verbs:сохраняться{}, // сохраняться на холоде rus_verbs:лечить{}, // лечить на дому rus_verbs:прокатиться{}, // прокатиться на уницикле rus_verbs:договариваться{}, // договариваться на нейтральной территории rus_verbs:качнуться{}, // качнуться на одной ноге rus_verbs:опубликовать{}, // опубликовать на сайте rus_verbs:отражаться{}, // отражаться на поверхности воды rus_verbs:обедать{}, // обедать на веранде rus_verbs:посидеть{}, // посидеть на лавочке rus_verbs:сообщаться{}, // сообщаться на официальном сайте rus_verbs:свершиться{}, // свершиться на заседании rus_verbs:ночевать{}, // ночевать на даче rus_verbs:темнеть{}, // темнеть на свету rus_verbs:гибнуть{}, // гибнуть на территории полигона rus_verbs:усиливаться{}, // усиливаться на территории округа rus_verbs:проживать{}, // проживать на даче rus_verbs:исследовать{}, // исследовать на большой глубине rus_verbs:обитать{}, // обитать на громадной глубине rus_verbs:сталкиваться{}, // сталкиваться на большой высоте rus_verbs:таиться{}, // таиться на большой глубине rus_verbs:спасать{}, // спасать на пожаре rus_verbs:сказываться{}, // сказываться на общем результате rus_verbs:заблудиться{}, // заблудиться на стройке rus_verbs:пошарить{}, // пошарить на полках rus_verbs:планировать{}, // планировать на бумаге rus_verbs:ранить{}, // ранить на полигоне rus_verbs:хлопать{}, // хлопать на сцене rus_verbs:основать{}, // основать на горе новый монастырь rus_verbs:отбить{}, // отбить на столе rus_verbs:отрицать{}, // отрицать на заседании комиссии rus_verbs:устоять{}, // устоять на ногах rus_verbs:отзываться{}, // отзываться на страницах отчёта rus_verbs:притормозить{}, // притормозить на обочине rus_verbs:читаться{}, // читаться на лице rus_verbs:заиграть{}, // заиграть на саксофоне rus_verbs:зависнуть{}, // зависнуть на игровой площадке rus_verbs:сознаться{}, // сознаться на допросе rus_verbs:выясняться{}, // выясняться на очной ставке rus_verbs:наводить{}, // наводить на столе порядок rus_verbs:покоиться{}, // покоиться на кладбище rus_verbs:значиться{}, // значиться на бейджике rus_verbs:съехать{}, // съехать на санках rus_verbs:познакомить{}, // познакомить на свадьбе rus_verbs:завязать{}, // завязать на спине rus_verbs:грохнуть{}, // грохнуть на площади rus_verbs:разъехаться{}, // разъехаться на узкой дороге rus_verbs:столпиться{}, // столпиться на крыльце rus_verbs:порыться{}, // порыться на полках rus_verbs:ослабить{}, // ослабить на шее rus_verbs:оправдывать{}, // оправдывать на суде rus_verbs:обнаруживаться{}, // обнаруживаться на складе rus_verbs:спастись{}, // спастись на дереве rus_verbs:прерваться{}, // прерваться на полуслове rus_verbs:строиться{}, // строиться на пустыре rus_verbs:познать{}, // познать на практике rus_verbs:путешествовать{}, // путешествовать на поезде rus_verbs:побеждать{}, // побеждать на ринге rus_verbs:рассматриваться{}, // рассматриваться на заседании rus_verbs:продаваться{}, // продаваться на открытом рынке rus_verbs:разместиться{}, // разместиться на базе rus_verbs:завыть{}, // завыть на холме rus_verbs:настигнуть{}, // настигнуть на окраине rus_verbs:укрыться{}, // укрыться на чердаке rus_verbs:расплакаться{}, // расплакаться на заседании комиссии rus_verbs:заканчивать{}, // заканчивать на последнем задании rus_verbs:пролежать{}, // пролежать на столе rus_verbs:громоздиться{}, // громоздиться на полу rus_verbs:замерзнуть{}, // замерзнуть на открытом воздухе rus_verbs:поскользнуться{}, // поскользнуться на льду rus_verbs:таскать{}, // таскать на спине rus_verbs:просматривать{}, // просматривать на сайте rus_verbs:обдумать{}, // обдумать на досуге rus_verbs:гадать{}, // гадать на кофейной гуще rus_verbs:останавливать{}, // останавливать на выходе rus_verbs:обозначать{}, // обозначать на странице rus_verbs:долететь{}, // долететь на спортивном байке rus_verbs:тесниться{}, // тесниться на чердачке rus_verbs:хоронить{}, // хоронить на частном кладбище rus_verbs:установиться{}, // установиться на юге rus_verbs:прикидывать{}, // прикидывать на клочке бумаги rus_verbs:затаиться{}, // затаиться на дереве rus_verbs:раздобыть{}, // раздобыть на складе rus_verbs:перебросить{}, // перебросить на вертолетах rus_verbs:захватывать{}, // захватывать на базе rus_verbs:сказаться{}, // сказаться на итоговых оценках rus_verbs:покачиваться{}, // покачиваться на волнах rus_verbs:крутиться{}, // крутиться на кухне rus_verbs:помещаться{}, // помещаться на полке rus_verbs:питаться{}, // питаться на помойке rus_verbs:отдохнуть{}, // отдохнуть на загородной вилле rus_verbs:кататься{}, // кататься на велике rus_verbs:поработать{}, // поработать на стройке rus_verbs:ограбить{}, // ограбить на пустыре rus_verbs:зарабатывать{}, // зарабатывать на бирже rus_verbs:преуспеть{}, // преуспеть на ниве искусства rus_verbs:заерзать{}, // заерзать на стуле rus_verbs:разъяснить{}, // разъяснить на полях rus_verbs:отчеканить{}, // отчеканить на медной пластине rus_verbs:торговать{}, // торговать на рынке rus_verbs:поколебаться{}, // поколебаться на пороге rus_verbs:прикинуть{}, // прикинуть на бумажке rus_verbs:рассечь{}, // рассечь на тупом конце rus_verbs:посмеяться{}, // посмеяться на переменке rus_verbs:остыть{}, // остыть на морозном воздухе rus_verbs:запереться{}, // запереться на чердаке rus_verbs:обогнать{}, // обогнать на повороте rus_verbs:подтянуться{}, // подтянуться на турнике rus_verbs:привозить{}, // привозить на машине rus_verbs:подбирать{}, // подбирать на полу rus_verbs:уничтожать{}, // уничтожать на подходе rus_verbs:притаиться{}, // притаиться на вершине rus_verbs:плясать{}, // плясать на костях rus_verbs:поджидать{}, // поджидать на вокзале rus_verbs:закончить{}, // Мы закончили игру на самом интересном месте (САМ не может быть первым прилагательным в цепочке!) rus_verbs:смениться{}, // смениться на посту rus_verbs:посчитать{}, // посчитать на пальцах rus_verbs:прицелиться{}, // прицелиться на бегу rus_verbs:нарисовать{}, // нарисовать на стене rus_verbs:прыгать{}, // прыгать на сцене rus_verbs:повертеть{}, // повертеть на пальце rus_verbs:попрощаться{}, // попрощаться на панихиде инфинитив:просыпаться{ вид:соверш }, глагол:просыпаться{ вид:соверш }, // просыпаться на диване rus_verbs:разобрать{}, // разобрать на столе rus_verbs:помереть{}, // помереть на чужбине rus_verbs:различить{}, // различить на нечеткой фотографии rus_verbs:рисовать{}, // рисовать на доске rus_verbs:проследить{}, // проследить на экране rus_verbs:задремать{}, // задремать на диване rus_verbs:ругаться{}, // ругаться на людях rus_verbs:сгореть{}, // сгореть на работе rus_verbs:зазвучать{}, // зазвучать на коротких волнах rus_verbs:задохнуться{}, // задохнуться на вершине горы rus_verbs:порождать{}, // порождать на поверхности небольшую рябь rus_verbs:отдыхать{}, // отдыхать на курорте rus_verbs:образовать{}, // образовать на дне толстый слой rus_verbs:поправиться{}, // поправиться на дармовых харчах rus_verbs:отмечать{}, // отмечать на календаре rus_verbs:реять{}, // реять на флагштоке rus_verbs:ползти{}, // ползти на коленях rus_verbs:продавать{}, // продавать на аукционе rus_verbs:сосредоточиться{}, // сосредоточиться на основной задаче rus_verbs:рыскать{}, // мышки рыскали на кухне rus_verbs:расстегнуть{}, // расстегнуть на куртке все пуговицы rus_verbs:напасть{}, // напасть на территории другого государства rus_verbs:издать{}, // издать на западе rus_verbs:оставаться{}, // оставаться на страже порядка rus_verbs:появиться{}, // наконец появиться на экране rus_verbs:лежать{}, // лежать на столе rus_verbs:ждать{}, // ждать на берегу инфинитив:писать{aux stress="пис^ать"}, // писать на бумаге глагол:писать{aux stress="пис^ать"}, rus_verbs:оказываться{}, // оказываться на полу rus_verbs:поставить{}, // поставить на столе rus_verbs:держать{}, // держать на крючке rus_verbs:выходить{}, // выходить на остановке rus_verbs:заговорить{}, // заговорить на китайском языке rus_verbs:ожидать{}, // ожидать на стоянке rus_verbs:закричать{}, // закричал на минарете муэдзин rus_verbs:простоять{}, // простоять на посту rus_verbs:продолжить{}, // продолжить на первом этаже rus_verbs:ощутить{}, // ощутить на себе влияние кризиса rus_verbs:состоять{}, // состоять на учете rus_verbs:готовиться{}, инфинитив:акклиматизироваться{вид:несоверш}, // альпинисты готовятся акклиматизироваться на новой высоте глагол:акклиматизироваться{вид:несоверш}, rus_verbs:арестовать{}, // грабители были арестованы на месте преступления rus_verbs:схватить{}, // грабители были схвачены на месте преступления инфинитив:атаковать{ вид:соверш }, // взвод был атакован на границе глагол:атаковать{ вид:соверш }, прилагательное:атакованный{ вид:соверш }, прилагательное:атаковавший{ вид:соверш }, rus_verbs:базировать{}, // установка будет базирована на границе rus_verbs:базироваться{}, // установка базируется на границе rus_verbs:барахтаться{}, // дети барахтались на мелководье rus_verbs:браконьерить{}, // Охотники браконьерили ночью на реке rus_verbs:браконьерствовать{}, // Охотники ночью браконьерствовали на реке rus_verbs:бренчать{}, // парень что-то бренчал на гитаре rus_verbs:бренькать{}, // парень что-то бренькает на гитаре rus_verbs:начать{}, // Рынок акций РФ начал торги на отрицательной территории. rus_verbs:буксовать{}, // Колеса буксуют на льду rus_verbs:вертеться{}, // Непоседливый ученик много вертится на стуле rus_verbs:взвести{}, // Боец взвел на оружии предохранитель rus_verbs:вилять{}, // Машина сильно виляла на дороге rus_verbs:висеть{}, // Яблоко висит на ветке rus_verbs:возлежать{}, // возлежать на лежанке rus_verbs:подниматься{}, // Мы поднимаемся на лифте rus_verbs:подняться{}, // Мы поднимемся на лифте rus_verbs:восседать{}, // Коля восседает на лошади rus_verbs:воссиять{}, // Луна воссияла на небе rus_verbs:воцариться{}, // Мир воцарился на всей земле rus_verbs:воцаряться{}, // Мир воцаряется на всей земле rus_verbs:вращать{}, // вращать на поясе rus_verbs:вращаться{}, // вращаться на поясе rus_verbs:встретить{}, // встретить друга на улице rus_verbs:встретиться{}, // встретиться на занятиях rus_verbs:встречать{}, // встречать на занятиях rus_verbs:въебывать{}, // въебывать на работе rus_verbs:въезжать{}, // въезжать на автомобиле rus_verbs:въехать{}, // въехать на автомобиле rus_verbs:выгорать{}, // ткань выгорает на солнце rus_verbs:выгореть{}, // ткань выгорела на солнце rus_verbs:выгравировать{}, // выгравировать на табличке надпись rus_verbs:выжить{}, // выжить на необитаемом острове rus_verbs:вылежаться{}, // помидоры вылежались на солнце rus_verbs:вылеживаться{}, // вылеживаться на солнце rus_verbs:выместить{}, // выместить на ком-то злобу rus_verbs:вымещать{}, // вымещать на ком-то свое раздражение rus_verbs:вымещаться{}, // вымещаться на ком-то rus_verbs:выращивать{}, // выращивать на грядке помидоры rus_verbs:выращиваться{}, // выращиваться на грядке инфинитив:вырезать{вид:соверш}, // вырезать на доске надпись глагол:вырезать{вид:соверш}, инфинитив:вырезать{вид:несоверш}, глагол:вырезать{вид:несоверш}, rus_verbs:вырисоваться{}, // вырисоваться на графике rus_verbs:вырисовываться{}, // вырисовываться на графике rus_verbs:высаживать{}, // высаживать на необитаемом острове rus_verbs:высаживаться{}, // высаживаться на острове rus_verbs:высвечивать{}, // высвечивать на дисплее температуру rus_verbs:высвечиваться{}, // высвечиваться на дисплее rus_verbs:выстроить{}, // выстроить на фундаменте rus_verbs:выстроиться{}, // выстроиться на плацу rus_verbs:выстудить{}, // выстудить на морозе rus_verbs:выстудиться{}, // выстудиться на морозе rus_verbs:выстужать{}, // выстужать на морозе rus_verbs:выстуживать{}, // выстуживать на морозе rus_verbs:выстуживаться{}, // выстуживаться на морозе rus_verbs:выстукать{}, // выстукать на клавиатуре rus_verbs:выстукивать{}, // выстукивать на клавиатуре rus_verbs:выстукиваться{}, // выстукиваться на клавиатуре rus_verbs:выступать{}, // выступать на сцене rus_verbs:выступить{}, // выступить на сцене rus_verbs:выстучать{}, // выстучать на клавиатуре rus_verbs:выстывать{}, // выстывать на морозе rus_verbs:выстыть{}, // выстыть на морозе rus_verbs:вытатуировать{}, // вытатуировать на руке якорь rus_verbs:говорить{}, // говорить на повышенных тонах rus_verbs:заметить{}, // заметить на берегу rus_verbs:стоять{}, // твёрдо стоять на ногах rus_verbs:оказаться{}, // оказаться на передовой линии rus_verbs:почувствовать{}, // почувствовать на своей шкуре rus_verbs:остановиться{}, // остановиться на первом пункте rus_verbs:показаться{}, // показаться на горизонте rus_verbs:чувствовать{}, // чувствовать на своей шкуре rus_verbs:искать{}, // искать на открытом пространстве rus_verbs:иметься{}, // иметься на складе rus_verbs:клясться{}, // клясться на Коране rus_verbs:прервать{}, // прервать на полуслове rus_verbs:играть{}, // играть на чувствах rus_verbs:спуститься{}, // спуститься на парашюте rus_verbs:понадобиться{}, // понадобиться на экзамене rus_verbs:служить{}, // служить на флоте rus_verbs:подобрать{}, // подобрать на улице rus_verbs:появляться{}, // появляться на сцене rus_verbs:селить{}, // селить на чердаке rus_verbs:поймать{}, // поймать на границе rus_verbs:увидать{}, // увидать на опушке rus_verbs:подождать{}, // подождать на перроне rus_verbs:прочесть{}, // прочесть на полях rus_verbs:тонуть{}, // тонуть на мелководье rus_verbs:ощущать{}, // ощущать на коже rus_verbs:отметить{}, // отметить на полях rus_verbs:показывать{}, // показывать на графике rus_verbs:разговаривать{}, // разговаривать на иностранном языке rus_verbs:прочитать{}, // прочитать на сайте rus_verbs:попробовать{}, // попробовать на практике rus_verbs:замечать{}, // замечать на коже грязь rus_verbs:нести{}, // нести на плечах rus_verbs:носить{}, // носить на голове rus_verbs:гореть{}, // гореть на работе rus_verbs:застыть{}, // застыть на пороге инфинитив:жениться{ вид:соверш }, // жениться на королеве глагол:жениться{ вид:соверш }, прилагательное:женатый{}, прилагательное:женившийся{}, rus_verbs:спрятать{}, // спрятать на чердаке rus_verbs:развернуться{}, // развернуться на плацу rus_verbs:строить{}, // строить на песке rus_verbs:устроить{}, // устроить на даче тестральный вечер rus_verbs:настаивать{}, // настаивать на выполнении приказа rus_verbs:находить{}, // находить на берегу rus_verbs:мелькнуть{}, // мелькнуть на экране rus_verbs:очутиться{}, // очутиться на опушке леса инфинитив:использовать{вид:соверш}, // использовать на работе глагол:использовать{вид:соверш}, инфинитив:использовать{вид:несоверш}, глагол:использовать{вид:несоверш}, прилагательное:использованный{}, прилагательное:использующий{}, прилагательное:использовавший{}, rus_verbs:лететь{}, // лететь на воздушном шаре rus_verbs:смеяться{}, // смеяться на сцене rus_verbs:ездить{}, // ездить на мопеде rus_verbs:заснуть{}, // заснуть на диване rus_verbs:застать{}, // застать на рабочем месте rus_verbs:очнуться{}, // очнуться на больничной койке rus_verbs:разглядеть{}, // разглядеть на фотографии rus_verbs:обойти{}, // обойти на вираже rus_verbs:удержаться{}, // удержаться на троне rus_verbs:побывать{}, // побывать на другой планете rus_verbs:заняться{}, // заняться на выходных делом rus_verbs:вянуть{}, // вянуть на солнце rus_verbs:постоять{}, // постоять на голове rus_verbs:приобрести{}, // приобрести на распродаже rus_verbs:попасться{}, // попасться на краже rus_verbs:продолжаться{}, // продолжаться на земле rus_verbs:открывать{}, // открывать на арене rus_verbs:создавать{}, // создавать на сцене rus_verbs:обсуждать{}, // обсуждать на кухне rus_verbs:отыскать{}, // отыскать на полу rus_verbs:уснуть{}, // уснуть на диване rus_verbs:задержаться{}, // задержаться на работе rus_verbs:курить{}, // курить на свежем воздухе rus_verbs:приподняться{}, // приподняться на локтях rus_verbs:установить{}, // установить на вершине rus_verbs:запереть{}, // запереть на балконе rus_verbs:синеть{}, // синеть на воздухе rus_verbs:убивать{}, // убивать на нейтральной территории rus_verbs:скрываться{}, // скрываться на даче rus_verbs:родить{}, // родить на полу rus_verbs:описать{}, // описать на страницах книги rus_verbs:перехватить{}, // перехватить на подлете rus_verbs:скрывать{}, // скрывать на даче rus_verbs:сменить{}, // сменить на посту rus_verbs:мелькать{}, // мелькать на экране rus_verbs:присутствовать{}, // присутствовать на мероприятии rus_verbs:украсть{}, // украсть на рынке rus_verbs:победить{}, // победить на ринге rus_verbs:упомянуть{}, // упомянуть на страницах романа rus_verbs:плыть{}, // плыть на старой лодке rus_verbs:повиснуть{}, // повиснуть на перекладине rus_verbs:нащупать{}, // нащупать на дне rus_verbs:затихнуть{}, // затихнуть на дне rus_verbs:построить{}, // построить на участке rus_verbs:поддерживать{}, // поддерживать на поверхности rus_verbs:заработать{}, // заработать на бирже rus_verbs:провалиться{}, // провалиться на экзамене rus_verbs:сохранить{}, // сохранить на диске rus_verbs:располагаться{}, // располагаться на софе rus_verbs:поклясться{}, // поклясться на библии rus_verbs:сражаться{}, // сражаться на арене rus_verbs:спускаться{}, // спускаться на дельтаплане rus_verbs:уничтожить{}, // уничтожить на подступах rus_verbs:изучить{}, // изучить на практике rus_verbs:рождаться{}, // рождаться на праздниках rus_verbs:прилететь{}, // прилететь на самолете rus_verbs:догнать{}, // догнать на перекрестке rus_verbs:изобразить{}, // изобразить на бумаге rus_verbs:проехать{}, // проехать на тракторе rus_verbs:приготовить{}, // приготовить на масле rus_verbs:споткнуться{}, // споткнуться на полу rus_verbs:собирать{}, // собирать на берегу rus_verbs:отсутствовать{}, // отсутствовать на тусовке rus_verbs:приземлиться{}, // приземлиться на военном аэродроме rus_verbs:сыграть{}, // сыграть на трубе rus_verbs:прятаться{}, // прятаться на даче rus_verbs:спрятаться{}, // спрятаться на чердаке rus_verbs:провозгласить{}, // провозгласить на митинге rus_verbs:изложить{}, // изложить на бумаге rus_verbs:использоваться{}, // использоваться на практике rus_verbs:замяться{}, // замяться на входе rus_verbs:раздаваться{}, // Крик ягуара раздается на краю болота rus_verbs:сверкнуть{}, // сверкнуть на солнце rus_verbs:сверкать{}, // сверкать на свету rus_verbs:задержать{}, // задержать на митинге rus_verbs:осечься{}, // осечься на первом слове rus_verbs:хранить{}, // хранить на банковском счету rus_verbs:шутить{}, // шутить на уроке rus_verbs:кружиться{}, // кружиться на балу rus_verbs:чертить{}, // чертить на доске rus_verbs:отразиться{}, // отразиться на оценках rus_verbs:греть{}, // греть на солнце rus_verbs:рассуждать{}, // рассуждать на страницах своей книги rus_verbs:окружать{}, // окружать на острове rus_verbs:сопровождать{}, // сопровождать на охоте rus_verbs:заканчиваться{}, // заканчиваться на самом интересном месте rus_verbs:содержаться{}, // содержаться на приусадебном участке rus_verbs:поселиться{}, // поселиться на даче rus_verbs:запеть{}, // запеть на сцене инфинитив:провозить{ вид:несоверш }, // провозить на теле глагол:провозить{ вид:несоверш }, прилагательное:провезенный{}, прилагательное:провозивший{вид:несоверш}, прилагательное:провозящий{вид:несоверш}, деепричастие:провозя{}, rus_verbs:мочить{}, // мочить на месте rus_verbs:преследовать{}, // преследовать на территории другого штата rus_verbs:пролететь{}, // пролетел на параплане rus_verbs:драться{}, // драться на рапирах rus_verbs:просидеть{}, // просидеть на занятиях rus_verbs:убираться{}, // убираться на балконе rus_verbs:таять{}, // таять на солнце rus_verbs:проверять{}, // проверять на полиграфе rus_verbs:убеждать{}, // убеждать на примере rus_verbs:скользить{}, // скользить на льду rus_verbs:приобретать{}, // приобретать на распродаже rus_verbs:летать{}, // летать на метле rus_verbs:толпиться{}, // толпиться на перроне rus_verbs:плавать{}, // плавать на надувном матрасе rus_verbs:описывать{}, // описывать на страницах повести rus_verbs:пробыть{}, // пробыть на солнце слишком долго rus_verbs:застрять{}, // застрять на верхнем этаже rus_verbs:метаться{}, // метаться на полу rus_verbs:сжечь{}, // сжечь на костре rus_verbs:расслабиться{}, // расслабиться на кушетке rus_verbs:услыхать{}, // услыхать на рынке rus_verbs:удержать{}, // удержать на прежнем уровне rus_verbs:образоваться{}, // образоваться на дне rus_verbs:рассмотреть{}, // рассмотреть на поверхности чипа rus_verbs:уезжать{}, // уезжать на попутке rus_verbs:похоронить{}, // похоронить на закрытом кладбище rus_verbs:настоять{}, // настоять на пересмотре оценок rus_verbs:растянуться{}, // растянуться на горячем песке rus_verbs:покрутить{}, // покрутить на шесте rus_verbs:обнаружиться{}, // обнаружиться на болоте rus_verbs:гулять{}, // гулять на свадьбе rus_verbs:утонуть{}, // утонуть на курорте rus_verbs:храниться{}, // храниться на депозите rus_verbs:танцевать{}, // танцевать на свадьбе rus_verbs:трудиться{}, // трудиться на заводе инфинитив:засыпать{переходность:непереходный вид:несоверш}, // засыпать на кровати глагол:засыпать{переходность:непереходный вид:несоверш}, деепричастие:засыпая{переходность:непереходный вид:несоверш}, прилагательное:засыпавший{переходность:непереходный вид:несоверш}, прилагательное:засыпающий{ вид:несоверш переходность:непереходный }, // ребенок, засыпающий на руках rus_verbs:сушить{}, // сушить на открытом воздухе rus_verbs:зашевелиться{}, // зашевелиться на чердаке rus_verbs:обдумывать{}, // обдумывать на досуге rus_verbs:докладывать{}, // докладывать на научной конференции rus_verbs:промелькнуть{}, // промелькнуть на экране // прилагательное:находящийся{ вид:несоверш }, // колонна, находящаяся на ничейной территории прилагательное:написанный{}, // слово, написанное на заборе rus_verbs:умещаться{}, // компьютер, умещающийся на ладони rus_verbs:открыть{}, // книга, открытая на последней странице rus_verbs:спать{}, // йог, спящий на гвоздях rus_verbs:пробуксовывать{}, // колесо, пробуксовывающее на обледенелом асфальте rus_verbs:забуксовать{}, // колесо, забуксовавшее на обледенелом асфальте rus_verbs:отобразиться{}, // удивление, отобразившееся на лице rus_verbs:увидеть{}, // на полу я увидел чьи-то следы rus_verbs:видеть{}, // на полу я вижу чьи-то следы rus_verbs:оставить{}, // Мел оставил на доске белый след. rus_verbs:оставлять{}, // Мел оставляет на доске белый след. rus_verbs:встречаться{}, // встречаться на лекциях rus_verbs:познакомиться{}, // познакомиться на занятиях rus_verbs:устроиться{}, // она устроилась на кровати rus_verbs:ложиться{}, // ложись на полу rus_verbs:останавливаться{}, // останавливаться на достигнутом rus_verbs:спотыкаться{}, // спотыкаться на ровном месте rus_verbs:распечатать{}, // распечатать на бумаге rus_verbs:распечатывать{}, // распечатывать на бумаге rus_verbs:просмотреть{}, // просмотреть на бумаге rus_verbs:закрепляться{}, // закрепляться на плацдарме rus_verbs:погреться{}, // погреться на солнышке rus_verbs:мешать{}, // Он мешал краски на палитре. rus_verbs:занять{}, // Он занял первое место на соревнованиях. rus_verbs:заговариваться{}, // Он заговаривался иногда на уроках. деепричастие:женившись{ вид:соверш }, rus_verbs:везти{}, // Он везёт песок на тачке. прилагательное:казненный{}, // Он был казнён на электрическом стуле. rus_verbs:прожить{}, // Он безвыездно прожил всё лето на даче. rus_verbs:принести{}, // Официантка принесла нам обед на подносе. rus_verbs:переписать{}, // Перепишите эту рукопись на машинке. rus_verbs:идти{}, // Поезд идёт на малой скорости. rus_verbs:петь{}, // птички поют на рассвете rus_verbs:смотреть{}, // Смотри на обороте. rus_verbs:прибрать{}, // прибрать на столе rus_verbs:прибраться{}, // прибраться на столе rus_verbs:растить{}, // растить капусту на огороде rus_verbs:тащить{}, // тащить ребенка на руках rus_verbs:убирать{}, // убирать на столе rus_verbs:простыть{}, // Я простыл на морозе. rus_verbs:сиять{}, // ясные звезды мирно сияли на безоблачном весеннем небе. rus_verbs:проводиться{}, // такие эксперименты не проводятся на воде rus_verbs:достать{}, // Я не могу достать до яблок на верхних ветках. rus_verbs:расплыться{}, // Чернила расплылись на плохой бумаге. rus_verbs:вскочить{}, // У него вскочил прыщ на носу. rus_verbs:свить{}, // У нас на балконе воробей свил гнездо. rus_verbs:оторваться{}, // У меня на пальто оторвалась пуговица. rus_verbs:восходить{}, // Солнце восходит на востоке. rus_verbs:блестеть{}, // Снег блестит на солнце. rus_verbs:побить{}, // Рысак побил всех лошадей на скачках. rus_verbs:литься{}, // Реки крови льются на войне. rus_verbs:держаться{}, // Ребёнок уже твёрдо держится на ногах. rus_verbs:клубиться{}, // Пыль клубится на дороге. инфинитив:написать{ aux stress="напис^ать" }, // Ты должен написать статью на английском языке глагол:написать{ aux stress="напис^ать" }, // Он написал статью на русском языке. // глагол:находиться{вид:несоверш}, // мой поезд находится на первом пути // инфинитив:находиться{вид:несоверш}, rus_verbs:жить{}, // Было интересно жить на курорте. rus_verbs:повидать{}, // Он много повидал на своём веку. rus_verbs:разъезжаться{}, // Ноги разъезжаются не только на льду. rus_verbs:расположиться{}, // Оба села расположились на берегу реки. rus_verbs:объясняться{}, // Они объясняются на иностранном языке. rus_verbs:прощаться{}, // Они долго прощались на вокзале. rus_verbs:работать{}, // Она работает на ткацкой фабрике. rus_verbs:купить{}, // Она купила молоко на рынке. rus_verbs:поместиться{}, // Все книги поместились на полке. глагол:проводить{вид:несоверш}, инфинитив:проводить{вид:несоверш}, // Нужно проводить теорию на практике. rus_verbs:пожить{}, // Недолго она пожила на свете. rus_verbs:краснеть{}, // Небо краснеет на закате. rus_verbs:бывать{}, // На Волге бывает сильное волнение. rus_verbs:ехать{}, // Мы туда ехали на автобусе. rus_verbs:провести{}, // Мы провели месяц на даче. rus_verbs:поздороваться{}, // Мы поздоровались при встрече на улице. rus_verbs:расти{}, // Арбузы растут теперь не только на юге. ГЛ_ИНФ(сидеть), // три больших пса сидят на траве ГЛ_ИНФ(сесть), // три больших пса сели на траву ГЛ_ИНФ(перевернуться), // На дороге перевернулся автомобиль ГЛ_ИНФ(повезти), // я повезу тебя на машине ГЛ_ИНФ(отвезти), // мы отвезем тебя на такси ГЛ_ИНФ(пить), // пить на кухне чай ГЛ_ИНФ(найти), // найти на острове ГЛ_ИНФ(быть), // на этих костях есть следы зубов ГЛ_ИНФ(высадиться), // помощники высадились на острове ГЛ_ИНФ(делать),прилагательное:делающий{}, прилагательное:делавший{}, деепричастие:делая{}, // смотрю фильм о том, что пираты делали на необитаемом острове ГЛ_ИНФ(случиться), // это случилось на опушке леса ГЛ_ИНФ(продать), ГЛ_ИНФ(есть) // кошки ели мой корм на песчаном берегу } #endregion VerbList // Чтобы разрешить связывание в паттернах типа: смотреть на youtube fact гл_предл { if context { Гл_НА_Предл предлог:в{} @regex("[a-z]+[0-9]*") } then return true } fact гл_предл { if context { Гл_НА_Предл предлог:на{} *:*{падеж:предл} } then return true } // локатив fact гл_предл { if context { Гл_НА_Предл предлог:на{} *:*{падеж:мест} } then return true } #endregion ПРЕДЛОЖНЫЙ #region ВИНИТЕЛЬНЫЙ // НА+винительный падеж: // ЗАБИРАТЬСЯ НА ВЕРШИНУ ГОРЫ #region VerbList wordentry_set Гл_НА_Вин= { rus_verbs:переметнуться{}, // Ее взгляд растерянно переметнулся на Лили. rus_verbs:отогнать{}, // Водитель отогнал машину на стоянку. rus_verbs:фапать{}, // Не фапай на желтяк и не перебивай. rus_verbs:умножить{}, // Умножьте это количество примерно на 10. //rus_verbs:умножать{}, rus_verbs:откатить{}, // Откатил Шпак валун на шлях и перекрыл им дорогу. rus_verbs:откатывать{}, rus_verbs:доносить{}, // Вот и побежали на вас доносить. rus_verbs:донести{}, rus_verbs:разбирать{}, // Ворованные автомобили злоумышленники разбирали на запчасти и продавали. безлич_глагол:хватит{}, // - На одну атаку хватит. rus_verbs:скупиться{}, // Он сражался за жизнь, не скупясь на хитрости и усилия, и пока этот стиль давал неплохие результаты. rus_verbs:поскупиться{}, // Не поскупись на похвалы! rus_verbs:подыматься{}, rus_verbs:транспортироваться{}, rus_verbs:бахнуть{}, // Бахнуть стакан на пол rus_verbs:РАЗДЕЛИТЬ{}, // Президентские выборы разделили Венесуэлу на два непримиримых лагеря (РАЗДЕЛИТЬ) rus_verbs:НАЦЕЛИВАТЬСЯ{}, // Невдалеке пролетел кондор, нацеливаясь на бизонью тушу. (НАЦЕЛИВАТЬСЯ) rus_verbs:ВЫПЛЕСНУТЬ{}, // Низкий вибрирующий гул напоминал вулкан, вот-вот готовый выплеснуть на земную твердь потоки раскаленной лавы. (ВЫПЛЕСНУТЬ) rus_verbs:ИСЧЕЗНУТЬ{}, // Оно фыркнуло и исчезло в лесу на другой стороне дороги (ИСЧЕЗНУТЬ) rus_verbs:ВЫЗВАТЬ{}, // вызвать своего брата на поединок. (ВЫЗВАТЬ) rus_verbs:ПОБРЫЗГАТЬ{}, // Матрос побрызгал немного фимиама на крошечный огонь (ПОБРЫЗГАТЬ/БРЫЗГАТЬ/БРЫЗНУТЬ/КАПНУТЬ/КАПАТЬ/ПОКАПАТЬ) rus_verbs:БРЫЗГАТЬ{}, rus_verbs:БРЫЗНУТЬ{}, rus_verbs:КАПНУТЬ{}, rus_verbs:КАПАТЬ{}, rus_verbs:ПОКАПАТЬ{}, rus_verbs:ПООХОТИТЬСЯ{}, // Мы можем когда-нибудь вернуться и поохотиться на него. (ПООХОТИТЬСЯ/ОХОТИТЬСЯ) rus_verbs:ОХОТИТЬСЯ{}, // rus_verbs:ПОПАСТЬСЯ{}, // Не думал я, что они попадутся на это (ПОПАСТЬСЯ/НАРВАТЬСЯ/НАТОЛКНУТЬСЯ) rus_verbs:НАРВАТЬСЯ{}, // rus_verbs:НАТОЛКНУТЬСЯ{}, // rus_verbs:ВЫСЛАТЬ{}, // Он выслал разведчиков на большое расстояние от основного отряда. (ВЫСЛАТЬ) прилагательное:ПОХОЖИЙ{}, // Ты не выглядишь похожим на индейца (ПОХОЖИЙ) rus_verbs:РАЗОРВАТЬ{}, // Через минуту он был мертв и разорван на части. (РАЗОРВАТЬ) rus_verbs:СТОЛКНУТЬ{}, // Только быстрыми выпадами копья он сумел столкнуть их обратно на карниз. (СТОЛКНУТЬ/СТАЛКИВАТЬ) rus_verbs:СТАЛКИВАТЬ{}, // rus_verbs:СПУСТИТЬ{}, // Я побежал к ним, но они к тому времени спустили лодку на воду (СПУСТИТЬ) rus_verbs:ПЕРЕБРАСЫВАТЬ{}, // Сирия перебрасывает на юг страны воинские подкрепления (ПЕРЕБРАСЫВАТЬ, ПЕРЕБРОСИТЬ, НАБРАСЫВАТЬ, НАБРОСИТЬ) rus_verbs:ПЕРЕБРОСИТЬ{}, // rus_verbs:НАБРАСЫВАТЬ{}, // rus_verbs:НАБРОСИТЬ{}, // rus_verbs:СВЕРНУТЬ{}, // Он вывел машину на бульвар и поехал на восток, а затем свернул на юг. (СВЕРНУТЬ/СВОРАЧИВАТЬ/ПОВЕРНУТЬ/ПОВОРАЧИВАТЬ) rus_verbs:СВОРАЧИВАТЬ{}, // // rus_verbs:ПОВЕРНУТЬ{}, // rus_verbs:ПОВОРАЧИВАТЬ{}, // rus_verbs:наорать{}, rus_verbs:ПРОДВИНУТЬСЯ{}, // Полк продвинется на десятки километров (ПРОДВИНУТЬСЯ) rus_verbs:БРОСАТЬ{}, // Он бросает обещания на ветер (БРОСАТЬ) rus_verbs:ОДОЛЖИТЬ{}, // Я вам одолжу книгу на десять дней (ОДОЛЖИТЬ) rus_verbs:перегнать{}, // Скот нужно перегнать с этого пастбища на другое rus_verbs:перегонять{}, rus_verbs:выгонять{}, rus_verbs:выгнать{}, rus_verbs:СВОДИТЬСЯ{}, // сейчас панели кузовов расходятся по десяткам покрасочных постов и потом сводятся вновь на общий конвейер (СВОДИТЬСЯ) rus_verbs:ПОЖЕРТВОВАТЬ{}, // Бывший функционер компартии Эстонии пожертвовал деньги на расследования преступлений коммунизма (ПОЖЕРТВОВАТЬ) rus_verbs:ПРОВЕРЯТЬ{}, // Школьников будут принудительно проверять на курение (ПРОВЕРЯТЬ) rus_verbs:ОТПУСТИТЬ{}, // Приставы отпустят должников на отдых (ОТПУСТИТЬ) rus_verbs:использоваться{}, // имеющийся у государства денежный запас активно используется на поддержание рынка акций rus_verbs:назначаться{}, // назначаться на пост rus_verbs:наблюдать{}, // Судья , долго наблюдавший в трубу , вдруг вскричал rus_verbs:ШПИОНИТЬ{}, // Канадского офицера, шпионившего на Россию, приговорили к 20 годам тюрьмы (ШПИОНИТЬ НА вин) rus_verbs:ЗАПЛАНИРОВАТЬ{}, // все деньги , запланированные на сейсмоукрепление домов на Камчатке (ЗАПЛАНИРОВАТЬ НА) // rus_verbs:ПОХОДИТЬ{}, // больше походил на обвинительную речь , адресованную руководству республики (ПОХОДИТЬ НА) rus_verbs:ДЕЙСТВОВАТЬ{}, // выявленный контрабандный канал действовал на постоянной основе (ДЕЙСТВОВАТЬ НА) rus_verbs:ПЕРЕДАТЬ{}, // после чего должно быть передано на рассмотрение суда (ПЕРЕДАТЬ НА вин) rus_verbs:НАЗНАЧИТЬСЯ{}, // Зимой на эту должность пытался назначиться народный депутат (НАЗНАЧИТЬСЯ НА) rus_verbs:РЕШИТЬСЯ{}, // Франция решилась на одностороннее и рискованное военное вмешательство (РЕШИТЬСЯ НА) rus_verbs:ОРИЕНТИРОВАТЬ{}, // Этот браузер полностью ориентирован на планшеты и сенсорный ввод (ОРИЕНТИРОВАТЬ НА вин) rus_verbs:ЗАВЕСТИ{}, // на Витьку завели дело (ЗАВЕСТИ НА) rus_verbs:ОБРУШИТЬСЯ{}, // В Северной Осетии на воинскую часть обрушилась снежная лавина (ОБРУШИТЬСЯ В, НА) rus_verbs:НАСТРАИВАТЬСЯ{}, // гетеродин, настраивающийся на волну (НАСТРАИВАТЬСЯ НА) rus_verbs:СУЩЕСТВОВАТЬ{}, // Он существует на средства родителей. (СУЩЕСТВОВАТЬ НА) прилагательное:способный{}, // Он способен на убийство. (СПОСОБНЫЙ НА) rus_verbs:посыпаться{}, // на Нину посыпались снежинки инфинитив:нарезаться{ вид:несоверш }, // Урожай собирают механически или вручную, стебли нарезаются на куски и быстро транспортируются на перерабатывающий завод. глагол:нарезаться{ вид:несоверш }, rus_verbs:пожаловать{}, // скандально известный певец пожаловал к нам на передачу rus_verbs:показать{}, // Вадим показал на Колю rus_verbs:съехаться{}, // Финалисты съехались на свои игры в Лос-Анжелес. (СЪЕХАТЬСЯ НА, В) rus_verbs:расщепляться{}, // Сахароза же быстро расщепляется в пищеварительном тракте на глюкозу и фруктозу (РАСЩЕПЛЯТЬСЯ В, НА) rus_verbs:упасть{}, // В Таиланде на автобус с российскими туристами упал башенный кран (УПАСТЬ В, НА) прилагательное:тугой{}, // Бабушка туга на ухо. (ТУГОЙ НА) rus_verbs:свисать{}, // Волосы свисают на лоб. (свисать на) rus_verbs:ЦЕНИТЬСЯ{}, // Всякая рабочая рука ценилась на вес золота. (ЦЕНИТЬСЯ НА) rus_verbs:ШУМЕТЬ{}, // Вы шумите на весь дом! (ШУМЕТЬ НА) rus_verbs:протянуться{}, // Дорога протянулась на сотни километров. (протянуться на) rus_verbs:РАССЧИТАТЬ{}, // Книга рассчитана на массового читателя. (РАССЧИТАТЬ НА) rus_verbs:СОРИЕНТИРОВАТЬ{}, // мы сориентировали процесс на повышение котировок (СОРИЕНТИРОВАТЬ НА) rus_verbs:рыкнуть{}, // рыкнуть на остальных членов стаи (рыкнуть на) rus_verbs:оканчиваться{}, // оканчиваться на звонкую согласную (оканчиваться на) rus_verbs:выехать{}, // посигналить нарушителю, выехавшему на встречную полосу (выехать на) rus_verbs:прийтись{}, // Пятое число пришлось на субботу. rus_verbs:крениться{}, // корабль кренился на правый борт (крениться на) rus_verbs:приходиться{}, // основной налоговый гнет приходится на средний бизнес (приходиться на) rus_verbs:верить{}, // верить людям на слово (верить на слово) rus_verbs:выезжать{}, // Завтра вся семья выезжает на новую квартиру. rus_verbs:записать{}, // Запишите меня на завтрашний приём к доктору. rus_verbs:пасть{}, // Жребий пал на меня. rus_verbs:ездить{}, // Вчера мы ездили на оперу. rus_verbs:влезть{}, // Мальчик влез на дерево. rus_verbs:выбежать{}, // Мальчик выбежал из комнаты на улицу. rus_verbs:разбиться{}, // окно разбилось на мелкие осколки rus_verbs:бежать{}, // я бегу на урок rus_verbs:сбегаться{}, // сбегаться на происшествие rus_verbs:присылать{}, // присылать на испытание rus_verbs:надавить{}, // надавить на педать rus_verbs:внести{}, // внести законопроект на рассмотрение rus_verbs:вносить{}, // вносить законопроект на рассмотрение rus_verbs:поворачиваться{}, // поворачиваться на 180 градусов rus_verbs:сдвинуть{}, // сдвинуть на несколько сантиметров rus_verbs:опубликовать{}, // С.Митрохин опубликовал компромат на думских подельников Гудкова rus_verbs:вырасти{}, // Официальный курс доллара вырос на 26 копеек. rus_verbs:оглядываться{}, // оглядываться на девушек rus_verbs:расходиться{}, // расходиться на отдых rus_verbs:поскакать{}, // поскакать на службу rus_verbs:прыгать{}, // прыгать на сцену rus_verbs:приглашать{}, // приглашать на обед rus_verbs:рваться{}, // Кусок ткани рвется на части rus_verbs:понестись{}, // понестись на волю rus_verbs:распространяться{}, // распространяться на всех жителей штата инфинитив:просыпаться{ вид:соверш }, глагол:просыпаться{ вид:соверш }, // просыпаться на пол инфинитив:просыпаться{ вид:несоверш }, глагол:просыпаться{ вид:несоверш }, деепричастие:просыпавшись{}, деепричастие:просыпаясь{}, rus_verbs:заехать{}, // заехать на пандус rus_verbs:разобрать{}, // разобрать на составляющие rus_verbs:опускаться{}, // опускаться на колени rus_verbs:переехать{}, // переехать на конспиративную квартиру rus_verbs:закрывать{}, // закрывать глаза на действия конкурентов rus_verbs:поместить{}, // поместить на поднос rus_verbs:отходить{}, // отходить на подготовленные позиции rus_verbs:сыпаться{}, // сыпаться на плечи rus_verbs:отвезти{}, // отвезти на занятия rus_verbs:накинуть{}, // накинуть на плечи rus_verbs:отлететь{}, // отлететь на пол rus_verbs:закинуть{}, // закинуть на чердак rus_verbs:зашипеть{}, // зашипеть на собаку rus_verbs:прогреметь{}, // прогреметь на всю страну rus_verbs:повалить{}, // повалить на стол rus_verbs:опереть{}, // опереть на фундамент rus_verbs:забросить{}, // забросить на антресоль rus_verbs:подействовать{}, // подействовать на материал rus_verbs:разделять{}, // разделять на части rus_verbs:прикрикнуть{}, // прикрикнуть на детей rus_verbs:разложить{}, // разложить на множители rus_verbs:провожать{}, // провожать на работу rus_verbs:катить{}, // катить на стройку rus_verbs:наложить{}, // наложить запрет на проведение операций с недвижимостью rus_verbs:сохранять{}, // сохранять на память rus_verbs:злиться{}, // злиться на друга rus_verbs:оборачиваться{}, // оборачиваться на свист rus_verbs:сползти{}, // сползти на землю rus_verbs:записывать{}, // записывать на ленту rus_verbs:загнать{}, // загнать на дерево rus_verbs:забормотать{}, // забормотать на ухо rus_verbs:протиснуться{}, // протиснуться на самый край rus_verbs:заторопиться{}, // заторопиться на вручение премии rus_verbs:гаркнуть{}, // гаркнуть на шалунов rus_verbs:навалиться{}, // навалиться на виновника всей толпой rus_verbs:проскользнуть{}, // проскользнуть на крышу дома rus_verbs:подтянуть{}, // подтянуть на палубу rus_verbs:скатиться{}, // скатиться на двойки rus_verbs:давить{}, // давить на жалость rus_verbs:намекнуть{}, // намекнуть на новые обстоятельства rus_verbs:замахнуться{}, // замахнуться на святое rus_verbs:заменить{}, // заменить на свежую салфетку rus_verbs:свалить{}, // свалить на землю rus_verbs:стекать{}, // стекать на оголенные провода rus_verbs:увеличиваться{}, // увеличиваться на сотню процентов rus_verbs:развалиться{}, // развалиться на части rus_verbs:сердиться{}, // сердиться на товарища rus_verbs:обронить{}, // обронить на пол rus_verbs:подсесть{}, // подсесть на наркоту rus_verbs:реагировать{}, // реагировать на импульсы rus_verbs:отпускать{}, // отпускать на волю rus_verbs:прогнать{}, // прогнать на рабочее место rus_verbs:ложить{}, // ложить на стол rus_verbs:рвать{}, // рвать на части rus_verbs:разлететься{}, // разлететься на кусочки rus_verbs:превышать{}, // превышать на существенную величину rus_verbs:сбиться{}, // сбиться на рысь rus_verbs:пристроиться{}, // пристроиться на хорошую работу rus_verbs:удрать{}, // удрать на пастбище rus_verbs:толкать{}, // толкать на преступление rus_verbs:посматривать{}, // посматривать на экран rus_verbs:набирать{}, // набирать на судно rus_verbs:отступать{}, // отступать на дерево rus_verbs:подуть{}, // подуть на молоко rus_verbs:плеснуть{}, // плеснуть на голову rus_verbs:соскользнуть{}, // соскользнуть на землю rus_verbs:затаить{}, // затаить на кого-то обиду rus_verbs:обижаться{}, // обижаться на Колю rus_verbs:смахнуть{}, // смахнуть на пол rus_verbs:застегнуть{}, // застегнуть на все пуговицы rus_verbs:спускать{}, // спускать на землю rus_verbs:греметь{}, // греметь на всю округу rus_verbs:скосить{}, // скосить на соседа глаз rus_verbs:отважиться{}, // отважиться на прыжок rus_verbs:литься{}, // литься на землю rus_verbs:порвать{}, // порвать на тряпки rus_verbs:проследовать{}, // проследовать на сцену rus_verbs:надевать{}, // надевать на голову rus_verbs:проскочить{}, // проскочить на красный свет rus_verbs:прилечь{}, // прилечь на диванчик rus_verbs:разделиться{}, // разделиться на небольшие группы rus_verbs:завыть{}, // завыть на луну rus_verbs:переносить{}, // переносить на другую машину rus_verbs:наговорить{}, // наговорить на сотню рублей rus_verbs:намекать{}, // намекать на новые обстоятельства rus_verbs:нападать{}, // нападать на охранников rus_verbs:убегать{}, // убегать на другое место rus_verbs:тратить{}, // тратить на развлечения rus_verbs:присаживаться{}, // присаживаться на корточки rus_verbs:переместиться{}, // переместиться на вторую линию rus_verbs:завалиться{}, // завалиться на диван rus_verbs:удалиться{}, // удалиться на покой rus_verbs:уменьшаться{}, // уменьшаться на несколько процентов rus_verbs:обрушить{}, // обрушить на голову rus_verbs:резать{}, // резать на части rus_verbs:умчаться{}, // умчаться на юг rus_verbs:навернуться{}, // навернуться на камень rus_verbs:примчаться{}, // примчаться на матч rus_verbs:издавать{}, // издавать на собственные средства rus_verbs:переключить{}, // переключить на другой язык rus_verbs:отправлять{}, // отправлять на пенсию rus_verbs:залечь{}, // залечь на дно rus_verbs:установиться{}, // установиться на диск rus_verbs:направлять{}, // направлять на дополнительное обследование rus_verbs:разрезать{}, // разрезать на части rus_verbs:оскалиться{}, // оскалиться на прохожего rus_verbs:рычать{}, // рычать на пьяных rus_verbs:погружаться{}, // погружаться на дно rus_verbs:опираться{}, // опираться на костыли rus_verbs:поторопиться{}, // поторопиться на учебу rus_verbs:сдвинуться{}, // сдвинуться на сантиметр rus_verbs:увеличить{}, // увеличить на процент rus_verbs:опускать{}, // опускать на землю rus_verbs:созвать{}, // созвать на митинг rus_verbs:делить{}, // делить на части rus_verbs:пробиться{}, // пробиться на заключительную часть rus_verbs:простираться{}, // простираться на много миль rus_verbs:забить{}, // забить на учебу rus_verbs:переложить{}, // переложить на чужие плечи rus_verbs:грохнуться{}, // грохнуться на землю rus_verbs:прорваться{}, // прорваться на сцену rus_verbs:разлить{}, // разлить на землю rus_verbs:укладываться{}, // укладываться на ночевку rus_verbs:уволить{}, // уволить на пенсию rus_verbs:наносить{}, // наносить на кожу rus_verbs:набежать{}, // набежать на берег rus_verbs:заявиться{}, // заявиться на стрельбище rus_verbs:налиться{}, // налиться на крышку rus_verbs:надвигаться{}, // надвигаться на берег rus_verbs:распустить{}, // распустить на каникулы rus_verbs:переключиться{}, // переключиться на другую задачу rus_verbs:чихнуть{}, // чихнуть на окружающих rus_verbs:шлепнуться{}, // шлепнуться на спину rus_verbs:устанавливать{}, // устанавливать на крышу rus_verbs:устанавливаться{}, // устанавливаться на крышу rus_verbs:устраиваться{}, // устраиваться на работу rus_verbs:пропускать{}, // пропускать на стадион инфинитив:сбегать{ вид:соверш }, глагол:сбегать{ вид:соверш }, // сбегать на фильм инфинитив:сбегать{ вид:несоверш }, глагол:сбегать{ вид:несоверш }, деепричастие:сбегав{}, деепричастие:сбегая{}, rus_verbs:показываться{}, // показываться на глаза rus_verbs:прибегать{}, // прибегать на урок rus_verbs:съездить{}, // съездить на ферму rus_verbs:прославиться{}, // прославиться на всю страну rus_verbs:опрокинуться{}, // опрокинуться на спину rus_verbs:насыпать{}, // насыпать на землю rus_verbs:употреблять{}, // употреблять на корм скоту rus_verbs:пристроить{}, // пристроить на работу rus_verbs:заворчать{}, // заворчать на вошедшего rus_verbs:завязаться{}, // завязаться на поставщиков rus_verbs:сажать{}, // сажать на стул rus_verbs:напрашиваться{}, // напрашиваться на жесткие ответные меры rus_verbs:заменять{}, // заменять на исправную rus_verbs:нацепить{}, // нацепить на голову rus_verbs:сыпать{}, // сыпать на землю rus_verbs:закрываться{}, // закрываться на ремонт rus_verbs:распространиться{}, // распространиться на всю популяцию rus_verbs:поменять{}, // поменять на велосипед rus_verbs:пересесть{}, // пересесть на велосипеды rus_verbs:подоспеть{}, // подоспеть на разбор rus_verbs:шипеть{}, // шипеть на собак rus_verbs:поделить{}, // поделить на части rus_verbs:подлететь{}, // подлететь на расстояние выстрела rus_verbs:нажимать{}, // нажимать на все кнопки rus_verbs:распасться{}, // распасться на части rus_verbs:приволочь{}, // приволочь на диван rus_verbs:пожить{}, // пожить на один доллар rus_verbs:устремляться{}, // устремляться на свободу rus_verbs:смахивать{}, // смахивать на пол rus_verbs:забежать{}, // забежать на обед rus_verbs:увеличиться{}, // увеличиться на существенную величину rus_verbs:прокрасться{}, // прокрасться на склад rus_verbs:пущать{}, // пущать на постой rus_verbs:отклонить{}, // отклонить на несколько градусов rus_verbs:насмотреться{}, // насмотреться на безобразия rus_verbs:настроить{}, // настроить на короткие волны rus_verbs:уменьшиться{}, // уменьшиться на пару сантиметров rus_verbs:поменяться{}, // поменяться на другую книжку rus_verbs:расколоться{}, // расколоться на части rus_verbs:разлиться{}, // разлиться на землю rus_verbs:срываться{}, // срываться на жену rus_verbs:осудить{}, // осудить на пожизненное заключение rus_verbs:передвинуть{}, // передвинуть на первое место rus_verbs:допускаться{}, // допускаться на полигон rus_verbs:задвинуть{}, // задвинуть на полку rus_verbs:повлиять{}, // повлиять на оценку rus_verbs:отбавлять{}, // отбавлять на осмотр rus_verbs:сбрасывать{}, // сбрасывать на землю rus_verbs:накинуться{}, // накинуться на случайных прохожих rus_verbs:пролить{}, // пролить на кожу руки rus_verbs:затащить{}, // затащить на сеновал rus_verbs:перебежать{}, // перебежать на сторону противника rus_verbs:наливать{}, // наливать на скатерть rus_verbs:пролезть{}, // пролезть на сцену rus_verbs:откладывать{}, // откладывать на черный день rus_verbs:распадаться{}, // распадаться на небольшие фрагменты rus_verbs:перечислить{}, // перечислить на счет rus_verbs:закачаться{}, // закачаться на верхний уровень rus_verbs:накрениться{}, // накрениться на правый борт rus_verbs:подвинуться{}, // подвинуться на один уровень rus_verbs:разнести{}, // разнести на мелкие кусочки rus_verbs:зажить{}, // зажить на широкую ногу rus_verbs:оглохнуть{}, // оглохнуть на правое ухо rus_verbs:посетовать{}, // посетовать на бюрократизм rus_verbs:уводить{}, // уводить на осмотр rus_verbs:ускакать{}, // ускакать на забег rus_verbs:посветить{}, // посветить на стену rus_verbs:разрываться{}, // разрываться на части rus_verbs:побросать{}, // побросать на землю rus_verbs:карабкаться{}, // карабкаться на скалу rus_verbs:нахлынуть{}, // нахлынуть на кого-то rus_verbs:разлетаться{}, // разлетаться на мелкие осколочки rus_verbs:среагировать{}, // среагировать на сигнал rus_verbs:претендовать{}, // претендовать на приз rus_verbs:дунуть{}, // дунуть на одуванчик rus_verbs:переводиться{}, // переводиться на другую работу rus_verbs:перевезти{}, // перевезти на другую площадку rus_verbs:топать{}, // топать на урок rus_verbs:относить{}, // относить на склад rus_verbs:сбивать{}, // сбивать на землю rus_verbs:укладывать{}, // укладывать на спину rus_verbs:укатить{}, // укатить на отдых rus_verbs:убирать{}, // убирать на полку rus_verbs:опасть{}, // опасть на землю rus_verbs:ронять{}, // ронять на снег rus_verbs:пялиться{}, // пялиться на тело rus_verbs:глазеть{}, // глазеть на тело rus_verbs:снижаться{}, // снижаться на безопасную высоту rus_verbs:запрыгнуть{}, // запрыгнуть на платформу rus_verbs:разбиваться{}, // разбиваться на главы rus_verbs:сгодиться{}, // сгодиться на фарш rus_verbs:перескочить{}, // перескочить на другую страницу rus_verbs:нацелиться{}, // нацелиться на главную добычу rus_verbs:заезжать{}, // заезжать на бордюр rus_verbs:забираться{}, // забираться на крышу rus_verbs:проорать{}, // проорать на всё село rus_verbs:сбежаться{}, // сбежаться на шум rus_verbs:сменять{}, // сменять на хлеб rus_verbs:мотать{}, // мотать на ус rus_verbs:раскалываться{}, // раскалываться на две половинки rus_verbs:коситься{}, // коситься на режиссёра rus_verbs:плевать{}, // плевать на законы rus_verbs:ссылаться{}, // ссылаться на авторитетное мнение rus_verbs:наставить{}, // наставить на путь истинный rus_verbs:завывать{}, // завывать на Луну rus_verbs:опаздывать{}, // опаздывать на совещание rus_verbs:залюбоваться{}, // залюбоваться на пейзаж rus_verbs:повергнуть{}, // повергнуть на землю rus_verbs:надвинуть{}, // надвинуть на лоб rus_verbs:стекаться{}, // стекаться на площадь rus_verbs:обозлиться{}, // обозлиться на тренера rus_verbs:оттянуть{}, // оттянуть на себя rus_verbs:истратить{}, // истратить на дешевых шлюх rus_verbs:вышвырнуть{}, // вышвырнуть на улицу rus_verbs:затолкать{}, // затолкать на верхнюю полку rus_verbs:заскочить{}, // заскочить на огонек rus_verbs:проситься{}, // проситься на улицу rus_verbs:натыкаться{}, // натыкаться на борщевик rus_verbs:обрушиваться{}, // обрушиваться на митингующих rus_verbs:переписать{}, // переписать на чистовик rus_verbs:переноситься{}, // переноситься на другое устройство rus_verbs:напроситься{}, // напроситься на обидный ответ rus_verbs:натягивать{}, // натягивать на ноги rus_verbs:кидаться{}, // кидаться на прохожих rus_verbs:откликаться{}, // откликаться на призыв rus_verbs:поспевать{}, // поспевать на балет rus_verbs:обратиться{}, // обратиться на кафедру rus_verbs:полюбоваться{}, // полюбоваться на бюст rus_verbs:таращиться{}, // таращиться на мустангов rus_verbs:напороться{}, // напороться на колючки rus_verbs:раздать{}, // раздать на руки rus_verbs:дивиться{}, // дивиться на танцовщиц rus_verbs:назначать{}, // назначать на ответственнейший пост rus_verbs:кидать{}, // кидать на балкон rus_verbs:нахлобучить{}, // нахлобучить на башку rus_verbs:увлекать{}, // увлекать на луг rus_verbs:ругнуться{}, // ругнуться на животину rus_verbs:переселиться{}, // переселиться на хутор rus_verbs:разрывать{}, // разрывать на части rus_verbs:утащить{}, // утащить на дерево rus_verbs:наставлять{}, // наставлять на путь rus_verbs:соблазнить{}, // соблазнить на обмен rus_verbs:накладывать{}, // накладывать на рану rus_verbs:набрести{}, // набрести на грибную поляну rus_verbs:наведываться{}, // наведываться на прежнюю работу rus_verbs:погулять{}, // погулять на чужие деньги rus_verbs:уклоняться{}, // уклоняться на два градуса влево rus_verbs:слезать{}, // слезать на землю rus_verbs:клевать{}, // клевать на мотыля // rus_verbs:назначаться{}, // назначаться на пост rus_verbs:напялить{}, // напялить на голову rus_verbs:натянуться{}, // натянуться на рамку rus_verbs:разгневаться{}, // разгневаться на придворных rus_verbs:эмигрировать{}, // эмигрировать на Кипр rus_verbs:накатить{}, // накатить на основу rus_verbs:пригнать{}, // пригнать на пастбище rus_verbs:обречь{}, // обречь на мучения rus_verbs:сокращаться{}, // сокращаться на четверть rus_verbs:оттеснить{}, // оттеснить на пристань rus_verbs:подбить{}, // подбить на аферу rus_verbs:заманить{}, // заманить на дерево инфинитив:пописать{ aux stress="поп^исать" }, глагол:пописать{ aux stress="поп^исать" }, // пописать на кустик // деепричастие:пописав{ aux stress="поп^исать" }, rus_verbs:посходить{}, // посходить на перрон rus_verbs:налечь{}, // налечь на мясцо rus_verbs:отбирать{}, // отбирать на флот rus_verbs:нашептывать{}, // нашептывать на ухо rus_verbs:откладываться{}, // откладываться на будущее rus_verbs:залаять{}, // залаять на грабителя rus_verbs:настроиться{}, // настроиться на прием rus_verbs:разбивать{}, // разбивать на куски rus_verbs:пролиться{}, // пролиться на почву rus_verbs:сетовать{}, // сетовать на объективные трудности rus_verbs:подвезти{}, // подвезти на митинг rus_verbs:припереться{}, // припереться на праздник rus_verbs:подталкивать{}, // подталкивать на прыжок rus_verbs:прорываться{}, // прорываться на сцену rus_verbs:снижать{}, // снижать на несколько процентов rus_verbs:нацелить{}, // нацелить на танк rus_verbs:расколоть{}, // расколоть на два куска rus_verbs:увозить{}, // увозить на обкатку rus_verbs:оседать{}, // оседать на дно rus_verbs:съедать{}, // съедать на ужин rus_verbs:навлечь{}, // навлечь на себя rus_verbs:равняться{}, // равняться на лучших rus_verbs:сориентироваться{}, // сориентироваться на местности rus_verbs:снизить{}, // снизить на несколько процентов rus_verbs:перенестись{}, // перенестись на много лет назад rus_verbs:завезти{}, // завезти на склад rus_verbs:проложить{}, // проложить на гору rus_verbs:понадеяться{}, // понадеяться на удачу rus_verbs:заступить{}, // заступить на вахту rus_verbs:засеменить{}, // засеменить на выход rus_verbs:запирать{}, // запирать на ключ rus_verbs:скатываться{}, // скатываться на землю rus_verbs:дробить{}, // дробить на части rus_verbs:разваливаться{}, // разваливаться на кусочки rus_verbs:завозиться{}, // завозиться на склад rus_verbs:нанимать{}, // нанимать на дневную работу rus_verbs:поспеть{}, // поспеть на концерт rus_verbs:променять{}, // променять на сытость rus_verbs:переправить{}, // переправить на север rus_verbs:налетать{}, // налетать на силовое поле rus_verbs:затворить{}, // затворить на замок rus_verbs:подогнать{}, // подогнать на пристань rus_verbs:наехать{}, // наехать на камень rus_verbs:распевать{}, // распевать на разные голоса rus_verbs:разносить{}, // разносить на клочки rus_verbs:преувеличивать{}, // преувеличивать на много килограммов rus_verbs:хромать{}, // хромать на одну ногу rus_verbs:телеграфировать{}, // телеграфировать на базу rus_verbs:порезать{}, // порезать на лоскуты rus_verbs:порваться{}, // порваться на части rus_verbs:загонять{}, // загонять на дерево rus_verbs:отбывать{}, // отбывать на место службы rus_verbs:усаживаться{}, // усаживаться на трон rus_verbs:накопить{}, // накопить на квартиру rus_verbs:зыркнуть{}, // зыркнуть на визитера rus_verbs:копить{}, // копить на машину rus_verbs:помещать{}, // помещать на верхнюю грань rus_verbs:сползать{}, // сползать на снег rus_verbs:попроситься{}, // попроситься на улицу rus_verbs:перетащить{}, // перетащить на чердак rus_verbs:растащить{}, // растащить на сувениры rus_verbs:ниспадать{}, // ниспадать на землю rus_verbs:сфотографировать{}, // сфотографировать на память rus_verbs:нагонять{}, // нагонять на конкурентов страх rus_verbs:покушаться{}, // покушаться на понтифика rus_verbs:покуситься{}, rus_verbs:наняться{}, // наняться на службу rus_verbs:просачиваться{}, // просачиваться на поверхность rus_verbs:пускаться{}, // пускаться на ветер rus_verbs:отваживаться{}, // отваживаться на прыжок rus_verbs:досадовать{}, // досадовать на объективные трудности rus_verbs:унестись{}, // унестись на небо rus_verbs:ухудшаться{}, // ухудшаться на несколько процентов rus_verbs:насадить{}, // насадить на копьё rus_verbs:нагрянуть{}, // нагрянуть на праздник rus_verbs:зашвырнуть{}, // зашвырнуть на полку rus_verbs:грешить{}, // грешить на постояльцев rus_verbs:просочиться{}, // просочиться на поверхность rus_verbs:надоумить{}, // надоумить на глупость rus_verbs:намотать{}, // намотать на шпиндель rus_verbs:замкнуть{}, // замкнуть на корпус rus_verbs:цыкнуть{}, // цыкнуть на детей rus_verbs:переворачиваться{}, // переворачиваться на спину rus_verbs:соваться{}, // соваться на площать rus_verbs:отлучиться{}, // отлучиться на обед rus_verbs:пенять{}, // пенять на себя rus_verbs:нарезать{}, // нарезать на ломтики rus_verbs:поставлять{}, // поставлять на Кипр rus_verbs:залезать{}, // залезать на балкон rus_verbs:отлучаться{}, // отлучаться на обед rus_verbs:сбиваться{}, // сбиваться на шаг rus_verbs:таращить{}, // таращить глаза на вошедшего rus_verbs:прошмыгнуть{}, // прошмыгнуть на кухню rus_verbs:опережать{}, // опережать на пару сантиметров rus_verbs:переставить{}, // переставить на стол rus_verbs:раздирать{}, // раздирать на части rus_verbs:затвориться{}, // затвориться на засовы rus_verbs:материться{}, // материться на кого-то rus_verbs:наскочить{}, // наскочить на риф rus_verbs:набираться{}, // набираться на борт rus_verbs:покрикивать{}, // покрикивать на помощников rus_verbs:заменяться{}, // заменяться на более новый rus_verbs:подсадить{}, // подсадить на верхнюю полку rus_verbs:проковылять{}, // проковылять на кухню rus_verbs:прикатить{}, // прикатить на старт rus_verbs:залететь{}, // залететь на чужую территорию rus_verbs:загрузить{}, // загрузить на конвейер rus_verbs:уплывать{}, // уплывать на материк rus_verbs:опозорить{}, // опозорить на всю деревню rus_verbs:провоцировать{}, // провоцировать на ответную агрессию rus_verbs:забивать{}, // забивать на учебу rus_verbs:набегать{}, // набегать на прибрежные деревни rus_verbs:запираться{}, // запираться на ключ rus_verbs:фотографировать{}, // фотографировать на мыльницу rus_verbs:подымать{}, // подымать на недосягаемую высоту rus_verbs:съезжаться{}, // съезжаться на симпозиум rus_verbs:отвлекаться{}, // отвлекаться на игру rus_verbs:проливать{}, // проливать на брюки rus_verbs:спикировать{}, // спикировать на зазевавшегося зайца rus_verbs:уползти{}, // уползти на вершину холма rus_verbs:переместить{}, // переместить на вторую палубу rus_verbs:превысить{}, // превысить на несколько метров rus_verbs:передвинуться{}, // передвинуться на соседнюю клетку rus_verbs:спровоцировать{}, // спровоцировать на бросок rus_verbs:сместиться{}, // сместиться на соседнюю клетку rus_verbs:заготовить{}, // заготовить на зиму rus_verbs:плеваться{}, // плеваться на пол rus_verbs:переселить{}, // переселить на север rus_verbs:напирать{}, // напирать на дверь rus_verbs:переезжать{}, // переезжать на другой этаж rus_verbs:приподнимать{}, // приподнимать на несколько сантиметров rus_verbs:трогаться{}, // трогаться на красный свет rus_verbs:надвинуться{}, // надвинуться на глаза rus_verbs:засмотреться{}, // засмотреться на купальники rus_verbs:убыть{}, // убыть на фронт rus_verbs:передвигать{}, // передвигать на второй уровень rus_verbs:отвозить{}, // отвозить на свалку rus_verbs:обрекать{}, // обрекать на гибель rus_verbs:записываться{}, // записываться на танцы rus_verbs:настраивать{}, // настраивать на другой диапазон rus_verbs:переписывать{}, // переписывать на диск rus_verbs:израсходовать{}, // израсходовать на гонки rus_verbs:обменять{}, // обменять на перспективного игрока rus_verbs:трубить{}, // трубить на всю округу rus_verbs:набрасываться{}, // набрасываться на жертву rus_verbs:чихать{}, // чихать на правила rus_verbs:наваливаться{}, // наваливаться на рычаг rus_verbs:сподобиться{}, // сподобиться на повторный анализ rus_verbs:намазать{}, // намазать на хлеб rus_verbs:прореагировать{}, // прореагировать на вызов rus_verbs:зачислить{}, // зачислить на факультет rus_verbs:наведаться{}, // наведаться на склад rus_verbs:откидываться{}, // откидываться на спинку кресла rus_verbs:захромать{}, // захромать на левую ногу rus_verbs:перекочевать{}, // перекочевать на другой берег rus_verbs:накатываться{}, // накатываться на песчаный берег rus_verbs:приостановить{}, // приостановить на некоторое время rus_verbs:запрятать{}, // запрятать на верхнюю полочку rus_verbs:прихрамывать{}, // прихрамывать на правую ногу rus_verbs:упорхнуть{}, // упорхнуть на свободу rus_verbs:расстегивать{}, // расстегивать на пальто rus_verbs:напуститься{}, // напуститься на бродягу rus_verbs:накатывать{}, // накатывать на оригинал rus_verbs:наезжать{}, // наезжать на простофилю rus_verbs:тявкнуть{}, // тявкнуть на подошедшего человека rus_verbs:отрядить{}, // отрядить на починку rus_verbs:положиться{}, // положиться на главаря rus_verbs:опрокидывать{}, // опрокидывать на голову rus_verbs:поторапливаться{}, // поторапливаться на рейс rus_verbs:налагать{}, // налагать на заемщика rus_verbs:скопировать{}, // скопировать на диск rus_verbs:опадать{}, // опадать на землю rus_verbs:купиться{}, // купиться на посулы rus_verbs:гневаться{}, // гневаться на слуг rus_verbs:слететься{}, // слететься на раздачу rus_verbs:убавить{}, // убавить на два уровня rus_verbs:спихнуть{}, // спихнуть на соседа rus_verbs:накричать{}, // накричать на ребенка rus_verbs:приберечь{}, // приберечь на ужин rus_verbs:приклеить{}, // приклеить на ветровое стекло rus_verbs:ополчиться{}, // ополчиться на посредников rus_verbs:тратиться{}, // тратиться на сувениры rus_verbs:слетаться{}, // слетаться на свет rus_verbs:доставляться{}, // доставляться на базу rus_verbs:поплевать{}, // поплевать на руки rus_verbs:огрызаться{}, // огрызаться на замечание rus_verbs:попереться{}, // попереться на рынок rus_verbs:растягиваться{}, // растягиваться на полу rus_verbs:повергать{}, // повергать на землю rus_verbs:ловиться{}, // ловиться на мотыля rus_verbs:наседать{}, // наседать на обороняющихся rus_verbs:развалить{}, // развалить на кирпичи rus_verbs:разломить{}, // разломить на несколько частей rus_verbs:примерить{}, // примерить на себя rus_verbs:лепиться{}, // лепиться на стену rus_verbs:скопить{}, // скопить на старость rus_verbs:затратить{}, // затратить на ликвидацию последствий rus_verbs:притащиться{}, // притащиться на гулянку rus_verbs:осерчать{}, // осерчать на прислугу rus_verbs:натравить{}, // натравить на медведя rus_verbs:ссыпать{}, // ссыпать на землю rus_verbs:подвозить{}, // подвозить на пристань rus_verbs:мобилизовать{}, // мобилизовать на сборы rus_verbs:смотаться{}, // смотаться на работу rus_verbs:заглядеться{}, // заглядеться на девчонок rus_verbs:таскаться{}, // таскаться на работу rus_verbs:разгружать{}, // разгружать на транспортер rus_verbs:потреблять{}, // потреблять на кондиционирование инфинитив:сгонять{ вид:соверш }, глагол:сгонять{ вид:соверш }, // сгонять на базу деепричастие:сгоняв{}, rus_verbs:посылаться{}, // посылаться на разведку rus_verbs:окрыситься{}, // окрыситься на кого-то rus_verbs:отлить{}, // отлить на сковороду rus_verbs:шикнуть{}, // шикнуть на детишек rus_verbs:уповать{}, // уповать на бескорысную помощь rus_verbs:класться{}, // класться на стол rus_verbs:поковылять{}, // поковылять на выход rus_verbs:навевать{}, // навевать на собравшихся скуку rus_verbs:накладываться{}, // накладываться на грунтовку rus_verbs:наноситься{}, // наноситься на чистую кожу // rus_verbs:запланировать{}, // запланировать на среду rus_verbs:кувыркнуться{}, // кувыркнуться на землю rus_verbs:гавкнуть{}, // гавкнуть на хозяина rus_verbs:перестроиться{}, // перестроиться на новый лад rus_verbs:расходоваться{}, // расходоваться на образование rus_verbs:дуться{}, // дуться на бабушку rus_verbs:перетаскивать{}, // перетаскивать на рабочий стол rus_verbs:издаться{}, // издаться на деньги спонсоров rus_verbs:смещаться{}, // смещаться на несколько миллиметров rus_verbs:зазывать{}, // зазывать на новогоднюю распродажу rus_verbs:пикировать{}, // пикировать на окопы rus_verbs:чертыхаться{}, // чертыхаться на мешающихся детей rus_verbs:зудить{}, // зудить на ухо rus_verbs:подразделяться{}, // подразделяться на группы rus_verbs:изливаться{}, // изливаться на землю rus_verbs:помочиться{}, // помочиться на траву rus_verbs:примерять{}, // примерять на себя rus_verbs:разрядиться{}, // разрядиться на землю rus_verbs:мотнуться{}, // мотнуться на крышу rus_verbs:налегать{}, // налегать на весла rus_verbs:зацокать{}, // зацокать на куриц rus_verbs:наниматься{}, // наниматься на корабль rus_verbs:сплевывать{}, // сплевывать на землю rus_verbs:настучать{}, // настучать на саботажника rus_verbs:приземляться{}, // приземляться на брюхо rus_verbs:наталкиваться{}, // наталкиваться на объективные трудности rus_verbs:посигналить{}, // посигналить нарушителю, выехавшему на встречную полосу rus_verbs:серчать{}, // серчать на нерасторопную помощницу rus_verbs:сваливать{}, // сваливать на подоконник rus_verbs:засобираться{}, // засобираться на работу rus_verbs:распилить{}, // распилить на одинаковые бруски //rus_verbs:умножать{}, // умножать на константу rus_verbs:копировать{}, // копировать на диск rus_verbs:накрутить{}, // накрутить на руку rus_verbs:навалить{}, // навалить на телегу rus_verbs:натолкнуть{}, // натолкнуть на свежую мысль rus_verbs:шлепаться{}, // шлепаться на бетон rus_verbs:ухлопать{}, // ухлопать на скупку произведений искусства rus_verbs:замахиваться{}, // замахиваться на авторитетнейшее мнение rus_verbs:посягнуть{}, // посягнуть на святое rus_verbs:разменять{}, // разменять на мелочь rus_verbs:откатываться{}, // откатываться на заранее подготовленные позиции rus_verbs:усаживать{}, // усаживать на скамейку rus_verbs:натаскать{}, // натаскать на поиск наркотиков rus_verbs:зашикать{}, // зашикать на кошку rus_verbs:разломать{}, // разломать на равные части rus_verbs:приглашаться{}, // приглашаться на сцену rus_verbs:присягать{}, // присягать на верность rus_verbs:запрограммировать{}, // запрограммировать на постоянную уборку rus_verbs:расщедриться{}, // расщедриться на новый компьютер rus_verbs:насесть{}, // насесть на двоечников rus_verbs:созывать{}, // созывать на собрание rus_verbs:позариться{}, // позариться на чужое добро rus_verbs:перекидываться{}, // перекидываться на соседние здания rus_verbs:наползать{}, // наползать на неповрежденную ткань rus_verbs:изрубить{}, // изрубить на мелкие кусочки rus_verbs:наворачиваться{}, // наворачиваться на глаза rus_verbs:раскричаться{}, // раскричаться на всю округу rus_verbs:переползти{}, // переползти на светлую сторону rus_verbs:уполномочить{}, // уполномочить на разведовательную операцию rus_verbs:мочиться{}, // мочиться на трупы убитых врагов rus_verbs:радировать{}, // радировать на базу rus_verbs:промотать{}, // промотать на начало rus_verbs:заснять{}, // заснять на видео rus_verbs:подбивать{}, // подбивать на матч-реванш rus_verbs:наплевать{}, // наплевать на справедливость rus_verbs:подвывать{}, // подвывать на луну rus_verbs:расплескать{}, // расплескать на пол rus_verbs:польститься{}, // польститься на бесплатный сыр rus_verbs:помчать{}, // помчать на работу rus_verbs:съезжать{}, // съезжать на обочину rus_verbs:нашептать{}, // нашептать кому-то на ухо rus_verbs:наклеить{}, // наклеить на доску объявлений rus_verbs:завозить{}, // завозить на склад rus_verbs:заявляться{}, // заявляться на любимую работу rus_verbs:наглядеться{}, // наглядеться на воробьев rus_verbs:хлопнуться{}, // хлопнуться на живот rus_verbs:забредать{}, // забредать на поляну rus_verbs:посягать{}, // посягать на исконные права собственности rus_verbs:сдвигать{}, // сдвигать на одну позицию rus_verbs:спрыгивать{}, // спрыгивать на землю rus_verbs:сдвигаться{}, // сдвигаться на две позиции rus_verbs:разделать{}, // разделать на орехи rus_verbs:разлагать{}, // разлагать на элементарные элементы rus_verbs:обрушивать{}, // обрушивать на головы врагов rus_verbs:натечь{}, // натечь на пол rus_verbs:политься{}, // вода польется на землю rus_verbs:успеть{}, // Они успеют на поезд. инфинитив:мигрировать{ вид:несоверш }, глагол:мигрировать{ вид:несоверш }, деепричастие:мигрируя{}, инфинитив:мигрировать{ вид:соверш }, глагол:мигрировать{ вид:соверш }, деепричастие:мигрировав{}, rus_verbs:двинуться{}, // Мы скоро двинемся на дачу. rus_verbs:подойти{}, // Он не подойдёт на должность секретаря. rus_verbs:потянуть{}, // Он не потянет на директора. rus_verbs:тянуть{}, // Он не тянет на директора. rus_verbs:перескакивать{}, // перескакивать с одного примера на другой rus_verbs:жаловаться{}, // Он жалуется на нездоровье. rus_verbs:издать{}, // издать на деньги спонсоров rus_verbs:показаться{}, // показаться на глаза rus_verbs:высаживать{}, // высаживать на необитаемый остров rus_verbs:вознестись{}, // вознестись на самую вершину славы rus_verbs:залить{}, // залить на youtube rus_verbs:закачать{}, // закачать на youtube rus_verbs:сыграть{}, // сыграть на деньги rus_verbs:экстраполировать{}, // Формулу можно экстраполировать на случай нескольких переменных инфинитив:экстраполироваться{ вид:несоверш}, // Ситуация легко экстраполируется на случай нескольких переменных глагол:экстраполироваться{ вид:несоверш}, инфинитив:экстраполироваться{ вид:соверш}, глагол:экстраполироваться{ вид:соверш}, деепричастие:экстраполируясь{}, инфинитив:акцентировать{вид:соверш}, // оратор акцентировал внимание слушателей на новый аспект проблемы глагол:акцентировать{вид:соверш}, инфинитив:акцентировать{вид:несоверш}, глагол:акцентировать{вид:несоверш}, прилагательное:акцентировавший{вид:несоверш}, //прилагательное:акцентировавший{вид:соверш}, прилагательное:акцентирующий{}, деепричастие:акцентировав{}, деепричастие:акцентируя{}, rus_verbs:бабахаться{}, // он бабахался на пол rus_verbs:бабахнуться{}, // мальчил бабахнулся на асфальт rus_verbs:батрачить{}, // Крестьяне батрачили на хозяина rus_verbs:бахаться{}, // Наездники бахались на землю rus_verbs:бахнуться{}, // Наездник опять бахнулся на землю rus_verbs:благословить{}, // батюшка благословил отрока на подвиг rus_verbs:благословлять{}, // батюшка благословляет отрока на подвиг rus_verbs:блевануть{}, // Он блеванул на землю rus_verbs:блевать{}, // Он блюет на землю rus_verbs:бухнуться{}, // Наездник бухнулся на землю rus_verbs:валить{}, // Ветер валил деревья на землю rus_verbs:спилить{}, // Спиленное дерево валится на землю rus_verbs:ввезти{}, // Предприятие ввезло товар на таможню rus_verbs:вдохновить{}, // Фильм вдохновил мальчика на поход в лес rus_verbs:вдохновиться{}, // Мальчик вдохновился на поход rus_verbs:вдохновлять{}, // Фильм вдохновляет на поход в лес rus_verbs:вестись{}, // Не ведись на эти уловки! rus_verbs:вешать{}, // Гости вешают одежду на вешалку rus_verbs:вешаться{}, // Одежда вешается на вешалки rus_verbs:вещать{}, // радиостанция вещает на всю страну rus_verbs:взбираться{}, // Туристы взбираются на заросший лесом холм rus_verbs:взбредать{}, // Что иногда взбредает на ум rus_verbs:взбрести{}, // Что-то взбрело на ум rus_verbs:взвалить{}, // Мама взвалила на свои плечи всё домашнее хозяйство rus_verbs:взваливаться{}, // Все домашнее хозяйство взваливается на мамины плечи rus_verbs:взваливать{}, // Не надо взваливать всё на мои плечи rus_verbs:взглянуть{}, // Кошка взглянула на мышку rus_verbs:взгромождать{}, // Мальчик взгромождает стул на стол rus_verbs:взгромождаться{}, // Мальчик взгромождается на стол rus_verbs:взгромоздить{}, // Мальчик взгромоздил стул на стол rus_verbs:взгромоздиться{}, // Мальчик взгромоздился на стул rus_verbs:взирать{}, // Очевидцы взирали на непонятный объект rus_verbs:взлетать{}, // Фабрика фейерверков взлетает на воздух rus_verbs:взлететь{}, // Фабрика фейерверков взлетела на воздух rus_verbs:взобраться{}, // Туристы взобрались на гору rus_verbs:взойти{}, // Туристы взошли на гору rus_verbs:взъесться{}, // Отец взъелся на непутевого сына rus_verbs:взъяриться{}, // Отец взъярился на непутевого сына rus_verbs:вкатить{}, // рабочие вкатили бочку на пандус rus_verbs:вкатывать{}, // рабочик вкатывают бочку на пандус rus_verbs:влиять{}, // Это решение влияет на всех игроков рынка rus_verbs:водворить{}, // водворить нарушителя на место rus_verbs:водвориться{}, // водвориться на свое место rus_verbs:водворять{}, // водворять вещь на свое место rus_verbs:водворяться{}, // водворяться на свое место rus_verbs:водружать{}, // водружать флаг на флагшток rus_verbs:водружаться{}, // Флаг водружается на флагшток rus_verbs:водрузить{}, // водрузить флаг на флагшток rus_verbs:водрузиться{}, // Флаг водрузился на вершину горы rus_verbs:воздействовать{}, // Излучение воздействует на кожу rus_verbs:воззреть{}, // воззреть на поле боя rus_verbs:воззриться{}, // воззриться на поле боя rus_verbs:возить{}, // возить туристов на гору rus_verbs:возлагать{}, // Многочисленные посетители возлагают цветы на могилу rus_verbs:возлагаться{}, // Ответственность возлагается на начальство rus_verbs:возлечь{}, // возлечь на лежанку rus_verbs:возложить{}, // возложить цветы на могилу поэта rus_verbs:вознести{}, // вознести кого-то на вершину славы rus_verbs:возноситься{}, // возносится на вершину успеха rus_verbs:возносить{}, // возносить счастливчика на вершину успеха rus_verbs:подниматься{}, // Мы поднимаемся на восьмой этаж rus_verbs:подняться{}, // Мы поднялись на восьмой этаж rus_verbs:вонять{}, // Кусок сыра воняет на всю округу rus_verbs:воодушевлять{}, // Идеалы воодушевляют на подвиги rus_verbs:воодушевляться{}, // Люди воодушевляются на подвиги rus_verbs:ворчать{}, // Старый пес ворчит на прохожих rus_verbs:воспринимать{}, // воспринимать сообщение на слух rus_verbs:восприниматься{}, // сообщение плохо воспринимается на слух rus_verbs:воспринять{}, // воспринять сообщение на слух rus_verbs:восприняться{}, // восприняться на слух rus_verbs:воссесть{}, // Коля воссел на трон rus_verbs:вправить{}, // вправить мозг на место rus_verbs:вправлять{}, // вправлять мозги на место rus_verbs:временить{}, // временить с выходом на пенсию rus_verbs:врубать{}, // врубать на полную мощность rus_verbs:врубить{}, // врубить на полную мощность rus_verbs:врубиться{}, // врубиться на полную мощность rus_verbs:врываться{}, // врываться на собрание rus_verbs:вскарабкаться{}, // вскарабкаться на утёс rus_verbs:вскарабкиваться{}, // вскарабкиваться на утёс rus_verbs:вскочить{}, // вскочить на ноги rus_verbs:всплывать{}, // всплывать на поверхность воды rus_verbs:всплыть{}, // всплыть на поверхность воды rus_verbs:вспрыгивать{}, // вспрыгивать на платформу rus_verbs:вспрыгнуть{}, // вспрыгнуть на платформу rus_verbs:встать{}, // встать на защиту чести и достоинства rus_verbs:вторгаться{}, // вторгаться на чужую территорию rus_verbs:вторгнуться{}, // вторгнуться на чужую территорию rus_verbs:въезжать{}, // въезжать на пандус rus_verbs:наябедничать{}, // наябедничать на соседа по парте rus_verbs:выблевать{}, // выблевать завтрак на пол rus_verbs:выблеваться{}, // выблеваться на пол rus_verbs:выблевывать{}, // выблевывать завтрак на пол rus_verbs:выблевываться{}, // выблевываться на пол rus_verbs:вывезти{}, // вывезти мусор на свалку rus_verbs:вывесить{}, // вывесить белье на просушку rus_verbs:вывести{}, // вывести собаку на прогулку rus_verbs:вывешивать{}, // вывешивать белье на веревку rus_verbs:вывозить{}, // вывозить детей на природу rus_verbs:вызывать{}, // Начальник вызывает на ковер rus_verbs:выйти{}, // выйти на свободу rus_verbs:выкладывать{}, // выкладывать на всеобщее обозрение rus_verbs:выкладываться{}, // выкладываться на всеобщее обозрение rus_verbs:выливать{}, // выливать на землю rus_verbs:выливаться{}, // выливаться на землю rus_verbs:вылить{}, // вылить жидкость на землю rus_verbs:вылиться{}, // Топливо вылилось на землю rus_verbs:выложить{}, // выложить на берег rus_verbs:выменивать{}, // выменивать золото на хлеб rus_verbs:вымениваться{}, // Золото выменивается на хлеб rus_verbs:выменять{}, // выменять золото на хлеб rus_verbs:выпадать{}, // снег выпадает на землю rus_verbs:выплевывать{}, // выплевывать на землю rus_verbs:выплевываться{}, // выплевываться на землю rus_verbs:выплескать{}, // выплескать на землю rus_verbs:выплескаться{}, // выплескаться на землю rus_verbs:выплескивать{}, // выплескивать на землю rus_verbs:выплескиваться{}, // выплескиваться на землю rus_verbs:выплывать{}, // выплывать на поверхность rus_verbs:выплыть{}, // выплыть на поверхность rus_verbs:выплюнуть{}, // выплюнуть на пол rus_verbs:выползать{}, // выползать на свежий воздух rus_verbs:выпроситься{}, // выпроситься на улицу rus_verbs:выпрыгивать{}, // выпрыгивать на свободу rus_verbs:выпрыгнуть{}, // выпрыгнуть на перрон rus_verbs:выпускать{}, // выпускать на свободу rus_verbs:выпустить{}, // выпустить на свободу rus_verbs:выпучивать{}, // выпучивать на кого-то глаза rus_verbs:выпучиваться{}, // глаза выпучиваются на кого-то rus_verbs:выпучить{}, // выпучить глаза на кого-то rus_verbs:выпучиться{}, // выпучиться на кого-то rus_verbs:выронить{}, // выронить на землю rus_verbs:высадить{}, // высадить на берег rus_verbs:высадиться{}, // высадиться на берег rus_verbs:высаживаться{}, // высаживаться на остров rus_verbs:выскальзывать{}, // выскальзывать на землю rus_verbs:выскочить{}, // выскочить на сцену rus_verbs:высморкаться{}, // высморкаться на землю rus_verbs:высморкнуться{}, // высморкнуться на землю rus_verbs:выставить{}, // выставить на всеобщее обозрение rus_verbs:выставиться{}, // выставиться на всеобщее обозрение rus_verbs:выставлять{}, // выставлять на всеобщее обозрение rus_verbs:выставляться{}, // выставляться на всеобщее обозрение инфинитив:высыпать{вид:соверш}, // высыпать на землю инфинитив:высыпать{вид:несоверш}, глагол:высыпать{вид:соверш}, глагол:высыпать{вид:несоверш}, деепричастие:высыпав{}, деепричастие:высыпая{}, прилагательное:высыпавший{вид:соверш}, //++прилагательное:высыпавший{вид:несоверш}, прилагательное:высыпающий{вид:несоверш}, rus_verbs:высыпаться{}, // высыпаться на землю rus_verbs:вытаращивать{}, // вытаращивать глаза на медведя rus_verbs:вытаращиваться{}, // вытаращиваться на медведя rus_verbs:вытаращить{}, // вытаращить глаза на медведя rus_verbs:вытаращиться{}, // вытаращиться на медведя rus_verbs:вытекать{}, // вытекать на землю rus_verbs:вытечь{}, // вытечь на землю rus_verbs:выучиваться{}, // выучиваться на кого-то rus_verbs:выучиться{}, // выучиться на кого-то rus_verbs:посмотреть{}, // посмотреть на экран rus_verbs:нашить{}, // нашить что-то на одежду rus_verbs:придти{}, // придти на помощь кому-то инфинитив:прийти{}, // прийти на помощь кому-то глагол:прийти{}, деепричастие:придя{}, // Придя на вокзал, он поспешно взял билеты. rus_verbs:поднять{}, // поднять на вершину rus_verbs:согласиться{}, // согласиться на ничью rus_verbs:послать{}, // послать на фронт rus_verbs:слать{}, // слать на фронт rus_verbs:надеяться{}, // надеяться на лучшее rus_verbs:крикнуть{}, // крикнуть на шалунов rus_verbs:пройти{}, // пройти на пляж rus_verbs:прислать{}, // прислать на экспертизу rus_verbs:жить{}, // жить на подачки rus_verbs:становиться{}, // становиться на ноги rus_verbs:наслать{}, // наслать на кого-то rus_verbs:принять{}, // принять на заметку rus_verbs:собираться{}, // собираться на экзамен rus_verbs:оставить{}, // оставить на всякий случай rus_verbs:звать{}, // звать на помощь rus_verbs:направиться{}, // направиться на прогулку rus_verbs:отвечать{}, // отвечать на звонки rus_verbs:отправиться{}, // отправиться на прогулку rus_verbs:поставить{}, // поставить на пол rus_verbs:обернуться{}, // обернуться на зов rus_verbs:отозваться{}, // отозваться на просьбу rus_verbs:закричать{}, // закричать на собаку rus_verbs:опустить{}, // опустить на землю rus_verbs:принести{}, // принести на пляж свой жезлонг rus_verbs:указать{}, // указать на дверь rus_verbs:ходить{}, // ходить на занятия rus_verbs:уставиться{}, // уставиться на листок rus_verbs:приходить{}, // приходить на экзамен rus_verbs:махнуть{}, // махнуть на пляж rus_verbs:явиться{}, // явиться на допрос rus_verbs:оглянуться{}, // оглянуться на дорогу rus_verbs:уехать{}, // уехать на заработки rus_verbs:повести{}, // повести на штурм rus_verbs:опуститься{}, // опуститься на колени //rus_verbs:передать{}, // передать на проверку rus_verbs:побежать{}, // побежать на занятия rus_verbs:прибыть{}, // прибыть на место службы rus_verbs:кричать{}, // кричать на медведя rus_verbs:стечь{}, // стечь на землю rus_verbs:обратить{}, // обратить на себя внимание rus_verbs:подать{}, // подать на пропитание rus_verbs:привести{}, // привести на съемки rus_verbs:испытывать{}, // испытывать на животных rus_verbs:перевести{}, // перевести на жену rus_verbs:купить{}, // купить на заемные деньги rus_verbs:собраться{}, // собраться на встречу rus_verbs:заглянуть{}, // заглянуть на огонёк rus_verbs:нажать{}, // нажать на рычаг rus_verbs:поспешить{}, // поспешить на праздник rus_verbs:перейти{}, // перейти на русский язык rus_verbs:поверить{}, // поверить на честное слово rus_verbs:глянуть{}, // глянуть на обложку rus_verbs:зайти{}, // зайти на огонёк rus_verbs:проходить{}, // проходить на сцену rus_verbs:глядеть{}, // глядеть на актрису //rus_verbs:решиться{}, // решиться на прыжок rus_verbs:пригласить{}, // пригласить на танец rus_verbs:позвать{}, // позвать на экзамен rus_verbs:усесться{}, // усесться на стул rus_verbs:поступить{}, // поступить на математический факультет rus_verbs:лечь{}, // лечь на живот rus_verbs:потянуться{}, // потянуться на юг rus_verbs:присесть{}, // присесть на корточки rus_verbs:наступить{}, // наступить на змею rus_verbs:заорать{}, // заорать на попрошаек rus_verbs:надеть{}, // надеть на голову rus_verbs:поглядеть{}, // поглядеть на девчонок rus_verbs:принимать{}, // принимать на гарантийное обслуживание rus_verbs:привезти{}, // привезти на испытания rus_verbs:рухнуть{}, // рухнуть на асфальт rus_verbs:пускать{}, // пускать на корм rus_verbs:отвести{}, // отвести на приём rus_verbs:отправить{}, // отправить на утилизацию rus_verbs:двигаться{}, // двигаться на восток rus_verbs:нести{}, // нести на пляж rus_verbs:падать{}, // падать на руки rus_verbs:откинуться{}, // откинуться на спинку кресла rus_verbs:рявкнуть{}, // рявкнуть на детей rus_verbs:получать{}, // получать на проживание rus_verbs:полезть{}, // полезть на рожон rus_verbs:направить{}, // направить на дообследование rus_verbs:приводить{}, // приводить на проверку rus_verbs:потребоваться{}, // потребоваться на замену rus_verbs:кинуться{}, // кинуться на нападавшего rus_verbs:учиться{}, // учиться на токаря rus_verbs:приподнять{}, // приподнять на один метр rus_verbs:налить{}, // налить на стол rus_verbs:играть{}, // играть на деньги rus_verbs:рассчитывать{}, // рассчитывать на подмогу rus_verbs:шепнуть{}, // шепнуть на ухо rus_verbs:швырнуть{}, // швырнуть на землю rus_verbs:прыгнуть{}, // прыгнуть на оленя rus_verbs:предлагать{}, // предлагать на выбор rus_verbs:садиться{}, // садиться на стул rus_verbs:лить{}, // лить на землю rus_verbs:испытать{}, // испытать на животных rus_verbs:фыркнуть{}, // фыркнуть на детеныша rus_verbs:годиться{}, // мясо годится на фарш rus_verbs:проверить{}, // проверить высказывание на истинность rus_verbs:откликнуться{}, // откликнуться на призывы rus_verbs:полагаться{}, // полагаться на интуицию rus_verbs:покоситься{}, // покоситься на соседа rus_verbs:повесить{}, // повесить на гвоздь инфинитив:походить{вид:соверш}, // походить на занятия глагол:походить{вид:соверш}, деепричастие:походив{}, прилагательное:походивший{}, rus_verbs:помчаться{}, // помчаться на экзамен rus_verbs:ставить{}, // ставить на контроль rus_verbs:свалиться{}, // свалиться на землю rus_verbs:валиться{}, // валиться на землю rus_verbs:подарить{}, // подарить на день рожденья rus_verbs:сбежать{}, // сбежать на необитаемый остров rus_verbs:стрелять{}, // стрелять на поражение rus_verbs:обращать{}, // обращать на себя внимание rus_verbs:наступать{}, // наступать на те же грабли rus_verbs:сбросить{}, // сбросить на землю rus_verbs:обидеться{}, // обидеться на друга rus_verbs:устроиться{}, // устроиться на стажировку rus_verbs:погрузиться{}, // погрузиться на большую глубину rus_verbs:течь{}, // течь на землю rus_verbs:отбросить{}, // отбросить на землю rus_verbs:метать{}, // метать на дно rus_verbs:пустить{}, // пустить на переплавку rus_verbs:прожить{}, // прожить на пособие rus_verbs:полететь{}, // полететь на континент rus_verbs:пропустить{}, // пропустить на сцену rus_verbs:указывать{}, // указывать на ошибку rus_verbs:наткнуться{}, // наткнуться на клад rus_verbs:рвануть{}, // рвануть на юг rus_verbs:ступать{}, // ступать на землю rus_verbs:спрыгнуть{}, // спрыгнуть на берег rus_verbs:заходить{}, // заходить на огонёк rus_verbs:нырнуть{}, // нырнуть на глубину rus_verbs:рвануться{}, // рвануться на свободу rus_verbs:натянуть{}, // натянуть на голову rus_verbs:забраться{}, // забраться на стол rus_verbs:помахать{}, // помахать на прощание rus_verbs:содержать{}, // содержать на спонсорскую помощь rus_verbs:приезжать{}, // приезжать на праздники rus_verbs:проникнуть{}, // проникнуть на территорию rus_verbs:подъехать{}, // подъехать на митинг rus_verbs:устремиться{}, // устремиться на волю rus_verbs:посадить{}, // посадить на стул rus_verbs:ринуться{}, // ринуться на голкипера rus_verbs:подвигнуть{}, // подвигнуть на подвиг rus_verbs:отдавать{}, // отдавать на перевоспитание rus_verbs:отложить{}, // отложить на черный день rus_verbs:убежать{}, // убежать на танцы rus_verbs:поднимать{}, // поднимать на верхний этаж rus_verbs:переходить{}, // переходить на цифровой сигнал rus_verbs:отослать{}, // отослать на переаттестацию rus_verbs:отодвинуть{}, // отодвинуть на другую половину стола rus_verbs:назначить{}, // назначить на должность rus_verbs:осесть{}, // осесть на дно rus_verbs:торопиться{}, // торопиться на экзамен rus_verbs:менять{}, // менять на еду rus_verbs:доставить{}, // доставить на шестой этаж rus_verbs:заслать{}, // заслать на проверку rus_verbs:дуть{}, // дуть на воду rus_verbs:сослать{}, // сослать на каторгу rus_verbs:останавливаться{}, // останавливаться на отдых rus_verbs:сдаваться{}, // сдаваться на милость победителя rus_verbs:сослаться{}, // сослаться на презумпцию невиновности rus_verbs:рассердиться{}, // рассердиться на дочь rus_verbs:кинуть{}, // кинуть на землю rus_verbs:расположиться{}, // расположиться на ночлег rus_verbs:осмелиться{}, // осмелиться на подлог rus_verbs:шептать{}, // шептать на ушко rus_verbs:уронить{}, // уронить на землю rus_verbs:откинуть{}, // откинуть на спинку кресла rus_verbs:перенести{}, // перенести на рабочий стол rus_verbs:сдаться{}, // сдаться на милость победителя rus_verbs:светить{}, // светить на дорогу rus_verbs:мчаться{}, // мчаться на бал rus_verbs:нестись{}, // нестись на свидание rus_verbs:поглядывать{}, // поглядывать на экран rus_verbs:орать{}, // орать на детей rus_verbs:уложить{}, // уложить на лопатки rus_verbs:решаться{}, // решаться на поступок rus_verbs:попадать{}, // попадать на карандаш rus_verbs:сплюнуть{}, // сплюнуть на землю rus_verbs:снимать{}, // снимать на телефон rus_verbs:опоздать{}, // опоздать на работу rus_verbs:посылать{}, // посылать на проверку rus_verbs:погнать{}, // погнать на пастбище rus_verbs:поступать{}, // поступать на кибернетический факультет rus_verbs:спускаться{}, // спускаться на уровень моря rus_verbs:усадить{}, // усадить на диван rus_verbs:проиграть{}, // проиграть на спор rus_verbs:прилететь{}, // прилететь на фестиваль rus_verbs:повалиться{}, // повалиться на спину rus_verbs:огрызнуться{}, // Собака огрызнулась на хозяина rus_verbs:задавать{}, // задавать на выходные rus_verbs:запасть{}, // запасть на девочку rus_verbs:лезть{}, // лезть на забор rus_verbs:потащить{}, // потащить на выборы rus_verbs:направляться{}, // направляться на экзамен rus_verbs:определять{}, // определять на вкус rus_verbs:поползти{}, // поползти на стену rus_verbs:поплыть{}, // поплыть на берег rus_verbs:залезть{}, // залезть на яблоню rus_verbs:сдать{}, // сдать на мясокомбинат rus_verbs:приземлиться{}, // приземлиться на дорогу rus_verbs:лаять{}, // лаять на прохожих rus_verbs:перевернуть{}, // перевернуть на бок rus_verbs:ловить{}, // ловить на живца rus_verbs:отнести{}, // отнести животное на хирургический стол rus_verbs:плюнуть{}, // плюнуть на условности rus_verbs:передавать{}, // передавать на проверку rus_verbs:нанять{}, // Босс нанял на работу еще несколько человек rus_verbs:разозлиться{}, // Папа разозлился на сына из-за плохих оценок по математике инфинитив:рассыпаться{вид:несоверш}, // рассыпаться на мелкие детали инфинитив:рассыпаться{вид:соверш}, глагол:рассыпаться{вид:несоверш}, глагол:рассыпаться{вид:соверш}, деепричастие:рассыпавшись{}, деепричастие:рассыпаясь{}, прилагательное:рассыпавшийся{вид:несоверш}, прилагательное:рассыпавшийся{вид:соверш}, прилагательное:рассыпающийся{}, rus_verbs:зарычать{}, // Медведица зарычала на медвежонка rus_verbs:призвать{}, // призвать на сборы rus_verbs:увезти{}, // увезти на дачу rus_verbs:содержаться{}, // содержаться на пожертвования rus_verbs:навести{}, // навести на скопление телескоп rus_verbs:отправляться{}, // отправляться на утилизацию rus_verbs:улечься{}, // улечься на животик rus_verbs:налететь{}, // налететь на препятствие rus_verbs:перевернуться{}, // перевернуться на спину rus_verbs:улететь{}, // улететь на родину rus_verbs:ложиться{}, // ложиться на бок rus_verbs:класть{}, // класть на место rus_verbs:отреагировать{}, // отреагировать на выступление rus_verbs:доставлять{}, // доставлять на дом rus_verbs:отнять{}, // отнять на благо правящей верхушки rus_verbs:ступить{}, // ступить на землю rus_verbs:сводить{}, // сводить на концерт знаменитой рок-группы rus_verbs:унести{}, // унести на работу rus_verbs:сходить{}, // сходить на концерт rus_verbs:потратить{}, // потратить на корм и наполнитель для туалета все деньги rus_verbs:соскочить{}, // соскочить на землю rus_verbs:пожаловаться{}, // пожаловаться на соседей rus_verbs:тащить{}, // тащить на замену rus_verbs:замахать{}, // замахать руками на паренька rus_verbs:заглядывать{}, // заглядывать на обед rus_verbs:соглашаться{}, // соглашаться на равный обмен rus_verbs:плюхнуться{}, // плюхнуться на мягкий пуфик rus_verbs:увести{}, // увести на осмотр rus_verbs:успевать{}, // успевать на контрольную работу rus_verbs:опрокинуть{}, // опрокинуть на себя rus_verbs:подавать{}, // подавать на апелляцию rus_verbs:прибежать{}, // прибежать на вокзал rus_verbs:отшвырнуть{}, // отшвырнуть на замлю rus_verbs:привлекать{}, // привлекать на свою сторону rus_verbs:опереться{}, // опереться на палку rus_verbs:перебраться{}, // перебраться на маленький островок rus_verbs:уговорить{}, // уговорить на новые траты rus_verbs:гулять{}, // гулять на спонсорские деньги rus_verbs:переводить{}, // переводить на другой путь rus_verbs:заколебаться{}, // заколебаться на один миг rus_verbs:зашептать{}, // зашептать на ушко rus_verbs:привстать{}, // привстать на цыпочки rus_verbs:хлынуть{}, // хлынуть на берег rus_verbs:наброситься{}, // наброситься на еду rus_verbs:напасть{}, // повстанцы, напавшие на конвой rus_verbs:убрать{}, // книга, убранная на полку rus_verbs:попасть{}, // путешественники, попавшие на ничейную территорию rus_verbs:засматриваться{}, // засматриваться на девчонок rus_verbs:застегнуться{}, // застегнуться на все пуговицы rus_verbs:провериться{}, // провериться на заболевания rus_verbs:проверяться{}, // проверяться на заболевания rus_verbs:тестировать{}, // тестировать на профпригодность rus_verbs:протестировать{}, // протестировать на профпригодность rus_verbs:уходить{}, // отец, уходящий на работу rus_verbs:налипнуть{}, // снег, налипший на провода rus_verbs:налипать{}, // снег, налипающий на провода rus_verbs:улетать{}, // Многие птицы улетают осенью на юг. rus_verbs:поехать{}, // она поехала на встречу с заказчиком rus_verbs:переключать{}, // переключать на резервную линию rus_verbs:переключаться{}, // переключаться на резервную линию rus_verbs:подписаться{}, // подписаться на обновление rus_verbs:нанести{}, // нанести на кожу rus_verbs:нарываться{}, // нарываться на неприятности rus_verbs:выводить{}, // выводить на орбиту rus_verbs:вернуться{}, // вернуться на родину rus_verbs:возвращаться{}, // возвращаться на родину прилагательное:падкий{}, // Он падок на деньги. прилагательное:обиженный{}, // Он обижен на отца. rus_verbs:косить{}, // Он косит на оба глаза. rus_verbs:закрыть{}, // Он забыл закрыть дверь на замок. прилагательное:готовый{}, // Он готов на всякие жертвы. rus_verbs:говорить{}, // Он говорит на скользкую тему. прилагательное:глухой{}, // Он глух на одно ухо. rus_verbs:взять{}, // Он взял ребёнка себе на колени. rus_verbs:оказывать{}, // Лекарство не оказывало на него никакого действия. rus_verbs:вести{}, // Лестница ведёт на третий этаж. rus_verbs:уполномочивать{}, // уполномочивать на что-либо глагол:спешить{ вид:несоверш }, // Я спешу на поезд. rus_verbs:брать{}, // Я беру всю ответственность на себя. rus_verbs:произвести{}, // Это произвело на меня глубокое впечатление. rus_verbs:употребить{}, // Эти деньги можно употребить на ремонт фабрики. rus_verbs:наводить{}, // Эта песня наводит на меня сон и скуку. rus_verbs:разбираться{}, // Эта машина разбирается на части. rus_verbs:оказать{}, // Эта книга оказала на меня большое влияние. rus_verbs:разбить{}, // Учитель разбил учеников на несколько групп. rus_verbs:отразиться{}, // Усиленная работа отразилась на его здоровье. rus_verbs:перегрузить{}, // Уголь надо перегрузить на другое судно. rus_verbs:делиться{}, // Тридцать делится на пять без остатка. rus_verbs:удаляться{}, // Суд удаляется на совещание. rus_verbs:показывать{}, // Стрелка компаса всегда показывает на север. rus_verbs:сохранить{}, // Сохраните это на память обо мне. rus_verbs:уезжать{}, // Сейчас все студенты уезжают на экскурсию. rus_verbs:лететь{}, // Самолёт летит на север. rus_verbs:бить{}, // Ружьё бьёт на пятьсот метров. // rus_verbs:прийтись{}, // Пятое число пришлось на субботу. rus_verbs:вынести{}, // Они вынесли из лодки на берег все вещи. rus_verbs:смотреть{}, // Она смотрит на нас из окна. rus_verbs:отдать{}, // Она отдала мне деньги на сохранение. rus_verbs:налюбоваться{}, // Не могу налюбоваться на картину. rus_verbs:любоваться{}, // гости любовались на картину rus_verbs:попробовать{}, // Дайте мне попробовать на ощупь. прилагательное:действительный{}, // Прививка оспы действительна только на три года. rus_verbs:спуститься{}, // На город спустился смог прилагательное:нечистый{}, // Он нечист на руку. прилагательное:неспособный{}, // Он неспособен на такую низость. прилагательное:злой{}, // кот очень зол на хозяина rus_verbs:пойти{}, // Девочка не пошла на урок физультуры rus_verbs:прибывать{}, // мой поезд прибывает на первый путь rus_verbs:застегиваться{}, // пальто застегивается на двадцать одну пуговицу rus_verbs:идти{}, // Дело идёт на лад. rus_verbs:лазить{}, // Он лазил на чердак. rus_verbs:поддаваться{}, // Он легко поддаётся на уговоры. // rus_verbs:действовать{}, // действующий на нервы rus_verbs:выходить{}, // Балкон выходит на площадь. rus_verbs:работать{}, // Время работает на нас. глагол:написать{aux stress="напис^ать"}, // Он написал музыку на слова Пушкина. rus_verbs:бросить{}, // Они бросили все силы на строительство. // глагол:разрезать{aux stress="разр^езать"}, глагол:разрезать{aux stress="разрез^ать"}, // Она разрезала пирог на шесть кусков. rus_verbs:броситься{}, // Она радостно бросилась мне на шею. rus_verbs:оправдать{}, // Она оправдала неявку на занятия болезнью. rus_verbs:ответить{}, // Она не ответила на мой поклон. rus_verbs:нашивать{}, // Она нашивала заплату на локоть. rus_verbs:молиться{}, // Она молится на свою мать. rus_verbs:запереть{}, // Она заперла дверь на замок. rus_verbs:заявить{}, // Она заявила свои права на наследство. rus_verbs:уйти{}, // Все деньги ушли на путешествие. rus_verbs:вступить{}, // Водолаз вступил на берег. rus_verbs:сойти{}, // Ночь сошла на землю. rus_verbs:приехать{}, // Мы приехали на вокзал слишком рано. rus_verbs:рыдать{}, // Не рыдай так безумно над ним. rus_verbs:подписать{}, // Не забудьте подписать меня на газету. rus_verbs:держать{}, // Наш пароход держал курс прямо на север. rus_verbs:свезти{}, // На выставку свезли экспонаты со всего мира. rus_verbs:ехать{}, // Мы сейчас едем на завод. rus_verbs:выбросить{}, // Волнами лодку выбросило на берег. ГЛ_ИНФ(сесть), // сесть на снег ГЛ_ИНФ(записаться), ГЛ_ИНФ(положить) // положи книгу на стол } #endregion VerbList // Чтобы разрешить связывание в паттернах типа: залить на youtube fact гл_предл { if context { Гл_НА_Вин предлог:на{} @regex("[a-z]+[0-9]*") } then return true } fact гл_предл { if context { глагол:купить{} предлог:на{} 'деньги'{падеж:вин} } then return true } fact гл_предл { if context { Гл_НА_Вин предлог:на{} *:*{ падеж:вин } } then return true } // смещаться на несколько миллиметров fact гл_предл { if context { Гл_НА_Вин предлог:на{} наречие:*{} } then return true } // партия взяла на себя нереалистичные обязательства fact гл_предл { if context { глагол:взять{} предлог:на{} 'себя'{падеж:вин} } then return true } #endregion ВИНИТЕЛЬНЫЙ // Все остальные варианты с предлогом 'НА' по умолчанию запрещаем. fact гл_предл { if context { * предлог:на{} *:*{ падеж:предл } } then return false,-3 } fact гл_предл { if context { * предлог:на{} *:*{ падеж:мест } } then return false,-3 } fact гл_предл { if context { * предлог:на{} *:*{ падеж:вин } } then return false,-4 } // Этот вариант нужен для обработки конструкций с числительными: // Президентские выборы разделили Венесуэлу на два непримиримых лагеря fact гл_предл { if context { * предлог:на{} *:*{ падеж:род } } then return false,-4 } // Продавать на eBay fact гл_предл { if context { * предлог:на{} * } then return false,-6 } #endregion Предлог_НА #region Предлог_С // ------------- ПРЕДЛОГ 'С' ----------------- // У этого предлога предпочтительная семантика привязывает его обычно к существительному. // Поэтому запрещаем по умолчанию его привязку к глаголам, а разрешенные глаголы перечислим. #region ТВОРИТЕЛЬНЫЙ wordentry_set Гл_С_Твор={ rus_verbs:помогать{}, // будет готов помогать врачам в онкологическом центре с постановкой верных диагнозов rus_verbs:перепихнуться{}, // неужели ты не хочешь со мной перепихнуться rus_verbs:забраться{}, rus_verbs:ДРАТЬСЯ{}, // Мои же собственные ратники забросали бы меня гнилой капустой, и мне пришлось бы драться с каждым рыцарем в стране, чтобы доказать свою смелость. (ДРАТЬСЯ/БИТЬСЯ/ПОДРАТЬСЯ) rus_verbs:БИТЬСЯ{}, // rus_verbs:ПОДРАТЬСЯ{}, // прилагательное:СХОЖИЙ{}, // Не был ли он схожим с одним из живых языков Земли (СХОЖИЙ) rus_verbs:ВСТУПИТЬ{}, // Он намеревался вступить с Вольфом в ближний бой. (ВСТУПИТЬ) rus_verbs:КОРРЕЛИРОВАТЬ{}, // Это коррелирует с традиционно сильными направлениями московской математической школы. (КОРРЕЛИРОВАТЬ) rus_verbs:УВИДЕТЬСЯ{}, // Он проигнорирует истерические протесты жены и увидится сначала с доктором, а затем с психотерапевтом (УВИДЕТЬСЯ) rus_verbs:ОЧНУТЬСЯ{}, // Когда он очнулся с болью в левой стороне черепа, у него возникло пугающее ощущение. (ОЧНУТЬСЯ) прилагательное:сходный{}, // Мозг этих существ сходен по размерам с мозгом динозавра rus_verbs:накрыться{}, // Было холодно, и он накрылся с головой одеялом. rus_verbs:РАСПРЕДЕЛИТЬ{}, // Бюджет распределят с участием горожан (РАСПРЕДЕЛИТЬ) rus_verbs:НАБРОСИТЬСЯ{}, // Пьяный водитель набросился с ножом на сотрудников ГИБДД (НАБРОСИТЬСЯ) rus_verbs:БРОСИТЬСЯ{}, // она со смехом бросилась прочь (БРОСИТЬСЯ) rus_verbs:КОНТАКТИРОВАТЬ{}, // Электронным магазинам стоит контактировать с клиентами (КОНТАКТИРОВАТЬ) rus_verbs:ВИДЕТЬСЯ{}, // Тогда мы редко виделись друг с другом rus_verbs:сесть{}, // сел в него с дорожной сумкой , наполненной наркотиками rus_verbs:купить{}, // Мы купили с ним одну и ту же книгу rus_verbs:ПРИМЕНЯТЬ{}, // Меры по стимулированию спроса в РФ следует применять с осторожностью (ПРИМЕНЯТЬ) rus_verbs:УЙТИ{}, // ты мог бы уйти со мной (УЙТИ) rus_verbs:ЖДАТЬ{}, // С нарастающим любопытством ждем результатов аудита золотых хранилищ европейских и американских центробанков (ЖДАТЬ) rus_verbs:ГОСПИТАЛИЗИРОВАТЬ{}, // Мэра Твери, участвовавшего в спартакиаде, госпитализировали с инфарктом (ГОСПИТАЛИЗИРОВАТЬ) rus_verbs:ЗАХЛОПНУТЬСЯ{}, // она захлопнулась со звоном (ЗАХЛОПНУТЬСЯ) rus_verbs:ОТВЕРНУТЬСЯ{}, // она со вздохом отвернулась (ОТВЕРНУТЬСЯ) rus_verbs:отправить{}, // вы можете отправить со мной человека rus_verbs:выступать{}, // Градоначальник , выступая с обзором основных городских событий , поведал об этом депутатам rus_verbs:ВЫЕЗЖАТЬ{}, // заключенные сами шьют куклы и иногда выезжают с представлениями в детский дом неподалеку (ВЫЕЗЖАТЬ С твор) rus_verbs:ПОКОНЧИТЬ{}, // со всем этим покончено (ПОКОНЧИТЬ С) rus_verbs:ПОБЕЖАТЬ{}, // Дмитрий побежал со всеми (ПОБЕЖАТЬ С) прилагательное:несовместимый{}, // характер ранений был несовместим с жизнью (НЕСОВМЕСТИМЫЙ С) rus_verbs:ПОСЕТИТЬ{}, // Его кабинет местные тележурналисты посетили со скрытой камерой (ПОСЕТИТЬ С) rus_verbs:СЛОЖИТЬСЯ{}, // сами банки принимают меры по урегулированию сложившейся с вкладчиками ситуации (СЛОЖИТЬСЯ С) rus_verbs:ЗАСТАТЬ{}, // Молодой человек убил пенсионера , застав его в постели с женой (ЗАСТАТЬ С) rus_verbs:ОЗНАКАМЛИВАТЬСЯ{}, // при заполнении заявления владельцы судов ознакамливаются с режимом (ОЗНАКАМЛИВАТЬСЯ С) rus_verbs:СООБРАЗОВЫВАТЬ{}, // И все свои задачи мы сообразовываем с этим пониманием (СООБРАЗОВЫВАТЬ С) rus_verbs:СВЫКАТЬСЯ{}, rus_verbs:стаскиваться{}, rus_verbs:спиливаться{}, rus_verbs:КОНКУРИРОВАТЬ{}, // Бедные и менее развитые страны не могут конкурировать с этими субсидиями (КОНКУРИРОВАТЬ С) rus_verbs:ВЫРВАТЬСЯ{}, // тот с трудом вырвался (ВЫРВАТЬСЯ С твор) rus_verbs:СОБРАТЬСЯ{}, // нужно собраться с силами (СОБРАТЬСЯ С) rus_verbs:УДАВАТЬСЯ{}, // удавалось это с трудом (УДАВАТЬСЯ С) rus_verbs:РАСПАХНУТЬСЯ{}, // дверь с треском распахнулась (РАСПАХНУТЬСЯ С) rus_verbs:НАБЛЮДАТЬ{}, // Олег наблюдал с любопытством (НАБЛЮДАТЬ С) rus_verbs:ПОТЯНУТЬ{}, // затем с силой потянул (ПОТЯНУТЬ С) rus_verbs:КИВНУТЬ{}, // Питер с трудом кивнул (КИВНУТЬ С) rus_verbs:СГЛОТНУТЬ{}, // Борис с трудом сглотнул (СГЛОТНУТЬ С) rus_verbs:ЗАБРАТЬ{}, // забрать его с собой (ЗАБРАТЬ С) rus_verbs:ОТКРЫТЬСЯ{}, // дверь с шипением открылась (ОТКРЫТЬСЯ С) rus_verbs:ОТОРВАТЬ{}, // с усилием оторвал взгляд (ОТОРВАТЬ С твор) rus_verbs:ОГЛЯДЕТЬСЯ{}, // Рома с любопытством огляделся (ОГЛЯДЕТЬСЯ С) rus_verbs:ФЫРКНУТЬ{}, // турок фыркнул с отвращением (ФЫРКНУТЬ С) rus_verbs:согласиться{}, // с этим согласились все (согласиться с) rus_verbs:ПОСЫПАТЬСЯ{}, // с грохотом посыпались камни (ПОСЫПАТЬСЯ С твор) rus_verbs:ВЗДОХНУТЬ{}, // Алиса вздохнула с облегчением (ВЗДОХНУТЬ С) rus_verbs:ОБЕРНУТЬСЯ{}, // та с удивлением обернулась (ОБЕРНУТЬСЯ С) rus_verbs:ХМЫКНУТЬ{}, // Алексей хмыкнул с сомнением (ХМЫКНУТЬ С твор) rus_verbs:ВЫЕХАТЬ{}, // они выехали с рассветом (ВЫЕХАТЬ С твор) rus_verbs:ВЫДОХНУТЬ{}, // Владимир выдохнул с облегчением (ВЫДОХНУТЬ С) rus_verbs:УХМЫЛЬНУТЬСЯ{}, // Кеша ухмыльнулся с сомнением (УХМЫЛЬНУТЬСЯ С) rus_verbs:НЕСТИСЬ{}, // тот несся с криком (НЕСТИСЬ С твор) rus_verbs:ПАДАТЬ{}, // падают с глухим стуком (ПАДАТЬ С твор) rus_verbs:ТВОРИТЬСЯ{}, // странное творилось с глазами (ТВОРИТЬСЯ С твор) rus_verbs:УХОДИТЬ{}, // с ними уходили эльфы (УХОДИТЬ С твор) rus_verbs:СКАКАТЬ{}, // скакали тут с топорами (СКАКАТЬ С твор) rus_verbs:ЕСТЬ{}, // здесь едят с зеленью (ЕСТЬ С твор) rus_verbs:ПОЯВИТЬСЯ{}, // с рассветом появились птицы (ПОЯВИТЬСЯ С твор) rus_verbs:ВСКОЧИТЬ{}, // Олег вскочил с готовностью (ВСКОЧИТЬ С твор) rus_verbs:БЫТЬ{}, // хочу быть с тобой (БЫТЬ С твор) rus_verbs:ПОКАЧАТЬ{}, // с сомнением покачал головой. (ПОКАЧАТЬ С СОМНЕНИЕМ) rus_verbs:ВЫРУГАТЬСЯ{}, // капитан с чувством выругался (ВЫРУГАТЬСЯ С ЧУВСТВОМ) rus_verbs:ОТКРЫТЬ{}, // с трудом открыл глаза (ОТКРЫТЬ С ТРУДОМ, таких много) rus_verbs:ПОЛУЧИТЬСЯ{}, // забавно получилось с ним (ПОЛУЧИТЬСЯ С) rus_verbs:ВЫБЕЖАТЬ{}, // старый выбежал с копьем (ВЫБЕЖАТЬ С) rus_verbs:ГОТОВИТЬСЯ{}, // Большинство компотов готовится с использованием сахара (ГОТОВИТЬСЯ С) rus_verbs:ПОДИСКУТИРОВАТЬ{}, // я бы подискутировал с Андрюхой (ПОДИСКУТИРОВАТЬ С) rus_verbs:ТУСИТЬ{}, // кто тусил со Светкой (ТУСИТЬ С) rus_verbs:БЕЖАТЬ{}, // куда она бежит со всеми? (БЕЖАТЬ С твор) rus_verbs:ГОРЕТЬ{}, // ты горел со своим кораблем? (ГОРЕТЬ С) rus_verbs:ВЫПИТЬ{}, // хотите выпить со мной чаю? (ВЫПИТЬ С) rus_verbs:МЕНЯТЬСЯ{}, // Я меняюсь с товарищем книгами. (МЕНЯТЬСЯ С) rus_verbs:ВАЛЯТЬСЯ{}, // Он уже неделю валяется с гриппом. (ВАЛЯТЬСЯ С) rus_verbs:ПИТЬ{}, // вы даже будете пить со мной пиво. (ПИТЬ С) инфинитив:кристаллизоваться{ вид:соверш }, // После этого пересыщенный раствор кристаллизуется с образованием кристаллов сахара. инфинитив:кристаллизоваться{ вид:несоверш }, глагол:кристаллизоваться{ вид:соверш }, глагол:кристаллизоваться{ вид:несоверш }, rus_verbs:ПООБЩАТЬСЯ{}, // пообщайся с Борисом (ПООБЩАТЬСЯ С) rus_verbs:ОБМЕНЯТЬСЯ{}, // Миша обменялся с Петей марками (ОБМЕНЯТЬСЯ С) rus_verbs:ПРОХОДИТЬ{}, // мы с тобой сегодня весь день проходили с вещами. (ПРОХОДИТЬ С) rus_verbs:ВСТАТЬ{}, // Он занимался всю ночь и встал с головной болью. (ВСТАТЬ С) rus_verbs:ПОВРЕМЕНИТЬ{}, // МВФ рекомендует Ирландии повременить с мерами экономии (ПОВРЕМЕНИТЬ С) rus_verbs:ГЛЯДЕТЬ{}, // Её глаза глядели с мягкой грустью. (ГЛЯДЕТЬ С + твор) rus_verbs:ВЫСКОЧИТЬ{}, // Зачем ты выскочил со своим замечанием? (ВЫСКОЧИТЬ С) rus_verbs:НЕСТИ{}, // плот несло со страшной силой. (НЕСТИ С) rus_verbs:приближаться{}, // стена приближалась со страшной быстротой. (приближаться с) rus_verbs:заниматься{}, // После уроков я занимался с отстающими учениками. (заниматься с) rus_verbs:разработать{}, // Этот лекарственный препарат разработан с использованием рецептов традиционной китайской медицины. (разработать с) rus_verbs:вестись{}, // Разработка месторождения ведется с использованием большого количества техники. (вестись с) rus_verbs:конфликтовать{}, // Маша конфликтует с Петей (конфликтовать с) rus_verbs:мешать{}, // мешать воду с мукой (мешать с) rus_verbs:иметь{}, // мне уже приходилось несколько раз иметь с ним дело. rus_verbs:синхронизировать{}, // синхронизировать с эталонным генератором rus_verbs:засинхронизировать{}, // засинхронизировать с эталонным генератором rus_verbs:синхронизироваться{}, // синхронизироваться с эталонным генератором rus_verbs:засинхронизироваться{}, // засинхронизироваться с эталонным генератором rus_verbs:стирать{}, // стирать с мылом рубашку в тазу rus_verbs:прыгать{}, // парашютист прыгает с парашютом rus_verbs:выступить{}, // Он выступил с приветствием съезду. rus_verbs:ходить{}, // В чужой монастырь со своим уставом не ходят. rus_verbs:отозваться{}, // Он отозвался об этой книге с большой похвалой. rus_verbs:отзываться{}, // Он отзывается об этой книге с большой похвалой. rus_verbs:вставать{}, // он встаёт с зарёй rus_verbs:мирить{}, // Его ум мирил всех с его дурным характером. rus_verbs:продолжаться{}, // стрельба тем временем продолжалась с прежней точностью. rus_verbs:договориться{}, // мы договоримся с вами rus_verbs:побыть{}, // он хотел побыть с тобой rus_verbs:расти{}, // Мировые производственные мощности растут с беспрецедентной скоростью rus_verbs:вязаться{}, // вязаться с фактами rus_verbs:отнестись{}, // отнестись к животным с сочуствием rus_verbs:относиться{}, // относиться с пониманием rus_verbs:пойти{}, // Спектакль пойдёт с участием известных артистов. rus_verbs:бракосочетаться{}, // Потомственный кузнец бракосочетался с разорившейся графиней rus_verbs:гулять{}, // бабушка гуляет с внуком rus_verbs:разбираться{}, // разбираться с задачей rus_verbs:сверить{}, // Данные были сверены с эталонными значениями rus_verbs:делать{}, // Что делать со старым телефоном rus_verbs:осматривать{}, // осматривать с удивлением rus_verbs:обсудить{}, // обсудить с приятелем прохождение уровня в новой игре rus_verbs:попрощаться{}, // попрощаться с талантливым актером rus_verbs:задремать{}, // задремать с кружкой чая в руке rus_verbs:связать{}, // связать катастрофу с действиями конкурентов rus_verbs:носиться{}, // носиться с безумной идеей rus_verbs:кончать{}, // кончать с собой rus_verbs:обмениваться{}, // обмениваться с собеседниками rus_verbs:переговариваться{}, // переговариваться с маяком rus_verbs:общаться{}, // общаться с полицией rus_verbs:завершить{}, // завершить с ошибкой rus_verbs:обняться{}, // обняться с подругой rus_verbs:сливаться{}, // сливаться с фоном rus_verbs:смешаться{}, // смешаться с толпой rus_verbs:договариваться{}, // договариваться с потерпевшим rus_verbs:обедать{}, // обедать с гостями rus_verbs:сообщаться{}, // сообщаться с подземной рекой rus_verbs:сталкиваться{}, // сталкиваться со стаей птиц rus_verbs:читаться{}, // читаться с трудом rus_verbs:смириться{}, // смириться с утратой rus_verbs:разделить{}, // разделить с другими ответственность rus_verbs:роднить{}, // роднить с медведем rus_verbs:медлить{}, // медлить с ответом rus_verbs:скрестить{}, // скрестить с ужом rus_verbs:покоиться{}, // покоиться с миром rus_verbs:делиться{}, // делиться с друзьями rus_verbs:познакомить{}, // познакомить с Олей rus_verbs:порвать{}, // порвать с Олей rus_verbs:завязать{}, // завязать с Олей знакомство rus_verbs:суетиться{}, // суетиться с изданием романа rus_verbs:соединиться{}, // соединиться с сервером rus_verbs:справляться{}, // справляться с нуждой rus_verbs:замешкаться{}, // замешкаться с ответом rus_verbs:поссориться{}, // поссориться с подругой rus_verbs:ссориться{}, // ссориться с друзьями rus_verbs:торопить{}, // торопить с решением rus_verbs:поздравить{}, // поздравить с победой rus_verbs:проститься{}, // проститься с человеком rus_verbs:поработать{}, // поработать с деревом rus_verbs:приключиться{}, // приключиться с Колей rus_verbs:сговориться{}, // сговориться с Ваней rus_verbs:отъехать{}, // отъехать с ревом rus_verbs:объединять{}, // объединять с другой кампанией rus_verbs:употребить{}, // употребить с молоком rus_verbs:перепутать{}, // перепутать с другой книгой rus_verbs:запоздать{}, // запоздать с ответом rus_verbs:подружиться{}, // подружиться с другими детьми rus_verbs:дружить{}, // дружить с Сережей rus_verbs:поравняться{}, // поравняться с финишной чертой rus_verbs:ужинать{}, // ужинать с гостями rus_verbs:расставаться{}, // расставаться с приятелями rus_verbs:завтракать{}, // завтракать с семьей rus_verbs:объединиться{}, // объединиться с соседями rus_verbs:сменяться{}, // сменяться с напарником rus_verbs:соединить{}, // соединить с сетью rus_verbs:разговориться{}, // разговориться с охранником rus_verbs:преподнести{}, // преподнести с помпой rus_verbs:напечатать{}, // напечатать с картинками rus_verbs:соединять{}, // соединять с сетью rus_verbs:расправиться{}, // расправиться с беззащитным человеком rus_verbs:распрощаться{}, // распрощаться с деньгами rus_verbs:сравнить{}, // сравнить с конкурентами rus_verbs:ознакомиться{}, // ознакомиться с выступлением инфинитив:сочетаться{ вид:несоверш }, глагол:сочетаться{ вид:несоверш }, // сочетаться с сумочкой деепричастие:сочетаясь{}, прилагательное:сочетающийся{}, прилагательное:сочетавшийся{}, rus_verbs:изнасиловать{}, // изнасиловать с применением чрезвычайного насилия rus_verbs:прощаться{}, // прощаться с боевым товарищем rus_verbs:сравнивать{}, // сравнивать с конкурентами rus_verbs:складывать{}, // складывать с весом упаковки rus_verbs:повестись{}, // повестись с ворами rus_verbs:столкнуть{}, // столкнуть с отбойником rus_verbs:переглядываться{}, // переглядываться с соседом rus_verbs:поторопить{}, // поторопить с откликом rus_verbs:развлекаться{}, // развлекаться с подружками rus_verbs:заговаривать{}, // заговаривать с незнакомцами rus_verbs:поцеловаться{}, // поцеловаться с первой девушкой инфинитив:согласоваться{ вид:несоверш }, глагол:согласоваться{ вид:несоверш }, // согласоваться с подлежащим деепричастие:согласуясь{}, прилагательное:согласующийся{}, rus_verbs:совпасть{}, // совпасть с оригиналом rus_verbs:соединяться{}, // соединяться с куратором rus_verbs:повстречаться{}, // повстречаться с героями rus_verbs:поужинать{}, // поужинать с родителями rus_verbs:развестись{}, // развестись с первым мужем rus_verbs:переговорить{}, // переговорить с коллегами rus_verbs:сцепиться{}, // сцепиться с бродячей собакой rus_verbs:сожрать{}, // сожрать с потрохами rus_verbs:побеседовать{}, // побеседовать со шпаной rus_verbs:поиграть{}, // поиграть с котятами rus_verbs:сцепить{}, // сцепить с тягачом rus_verbs:помириться{}, // помириться с подружкой rus_verbs:связываться{}, // связываться с бандитами rus_verbs:совещаться{}, // совещаться с мастерами rus_verbs:обрушиваться{}, // обрушиваться с беспощадной критикой rus_verbs:переплестись{}, // переплестись с кустами rus_verbs:мутить{}, // мутить с одногрупницами rus_verbs:приглядываться{}, // приглядываться с интересом rus_verbs:сблизиться{}, // сблизиться с врагами rus_verbs:перешептываться{}, // перешептываться с симпатичной соседкой rus_verbs:растереть{}, // растереть с солью rus_verbs:смешиваться{}, // смешиваться с известью rus_verbs:соприкоснуться{}, // соприкоснуться с тайной rus_verbs:ладить{}, // ладить с родственниками rus_verbs:сотрудничать{}, // сотрудничать с органами дознания rus_verbs:съехаться{}, // съехаться с родственниками rus_verbs:перекинуться{}, // перекинуться с коллегами парой слов rus_verbs:советоваться{}, // советоваться с отчимом rus_verbs:сравниться{}, // сравниться с лучшими rus_verbs:знакомиться{}, // знакомиться с абитуриентами rus_verbs:нырять{}, // нырять с аквалангом rus_verbs:забавляться{}, // забавляться с куклой rus_verbs:перекликаться{}, // перекликаться с другой статьей rus_verbs:тренироваться{}, // тренироваться с партнершей rus_verbs:поспорить{}, // поспорить с казночеем инфинитив:сладить{ вид:соверш }, глагол:сладить{ вид:соверш }, // сладить с бычком деепричастие:сладив{}, прилагательное:сладивший{ вид:соверш }, rus_verbs:примириться{}, // примириться с утратой rus_verbs:раскланяться{}, // раскланяться с фрейлинами rus_verbs:слечь{}, // слечь с ангиной rus_verbs:соприкасаться{}, // соприкасаться со стеной rus_verbs:смешать{}, // смешать с грязью rus_verbs:пересекаться{}, // пересекаться с трассой rus_verbs:путать{}, // путать с государственной шерстью rus_verbs:поболтать{}, // поболтать с ученицами rus_verbs:здороваться{}, // здороваться с профессором rus_verbs:просчитаться{}, // просчитаться с покупкой rus_verbs:сторожить{}, // сторожить с собакой rus_verbs:обыскивать{}, // обыскивать с собаками rus_verbs:переплетаться{}, // переплетаться с другой веткой rus_verbs:обниматься{}, // обниматься с Ксюшей rus_verbs:объединяться{}, // объединяться с конкурентами rus_verbs:погорячиться{}, // погорячиться с покупкой rus_verbs:мыться{}, // мыться с мылом rus_verbs:свериться{}, // свериться с эталоном rus_verbs:разделаться{}, // разделаться с кем-то rus_verbs:чередоваться{}, // чередоваться с партнером rus_verbs:налететь{}, // налететь с соратниками rus_verbs:поспать{}, // поспать с включенным светом rus_verbs:управиться{}, // управиться с собакой rus_verbs:согрешить{}, // согрешить с замужней rus_verbs:определиться{}, // определиться с победителем rus_verbs:перемешаться{}, // перемешаться с гранулами rus_verbs:затрудняться{}, // затрудняться с ответом rus_verbs:обождать{}, // обождать со стартом rus_verbs:фыркать{}, // фыркать с презрением rus_verbs:засидеться{}, // засидеться с приятелем rus_verbs:крепнуть{}, // крепнуть с годами rus_verbs:пировать{}, // пировать с дружиной rus_verbs:щебетать{}, // щебетать с сестричками rus_verbs:маяться{}, // маяться с кашлем rus_verbs:сближать{}, // сближать с центральным светилом rus_verbs:меркнуть{}, // меркнуть с возрастом rus_verbs:заспорить{}, // заспорить с оппонентами rus_verbs:граничить{}, // граничить с Ливаном rus_verbs:перестараться{}, // перестараться со стимуляторами rus_verbs:объединить{}, // объединить с филиалом rus_verbs:свыкнуться{}, // свыкнуться с утратой rus_verbs:посоветоваться{}, // посоветоваться с адвокатами rus_verbs:напутать{}, // напутать с ведомостями rus_verbs:нагрянуть{}, // нагрянуть с обыском rus_verbs:посовещаться{}, // посовещаться с судьей rus_verbs:провернуть{}, // провернуть с друганом rus_verbs:разделяться{}, // разделяться с сотрапезниками rus_verbs:пересечься{}, // пересечься с второй колонной rus_verbs:опережать{}, // опережать с большим запасом rus_verbs:перепутаться{}, // перепутаться с другой линией rus_verbs:соотноситься{}, // соотноситься с затратами rus_verbs:смешивать{}, // смешивать с золой rus_verbs:свидеться{}, // свидеться с тобой rus_verbs:переспать{}, // переспать с графиней rus_verbs:поладить{}, // поладить с соседями rus_verbs:протащить{}, // протащить с собой rus_verbs:разминуться{}, // разминуться с встречным потоком rus_verbs:перемежаться{}, // перемежаться с успехами rus_verbs:рассчитаться{}, // рассчитаться с кредиторами rus_verbs:срастись{}, // срастись с телом rus_verbs:знакомить{}, // знакомить с родителями rus_verbs:поругаться{}, // поругаться с родителями rus_verbs:совладать{}, // совладать с чувствами rus_verbs:обручить{}, // обручить с богатой невестой rus_verbs:сближаться{}, // сближаться с вражеским эсминцем rus_verbs:замутить{}, // замутить с Ксюшей rus_verbs:повозиться{}, // повозиться с настройкой rus_verbs:торговаться{}, // торговаться с продавцами rus_verbs:уединиться{}, // уединиться с девчонкой rus_verbs:переборщить{}, // переборщить с добавкой rus_verbs:ознакомить{}, // ознакомить с пожеланиями rus_verbs:прочесывать{}, // прочесывать с собаками rus_verbs:переписываться{}, // переписываться с корреспондентами rus_verbs:повздорить{}, // повздорить с сержантом rus_verbs:разлучить{}, // разлучить с семьей rus_verbs:соседствовать{}, // соседствовать с цыганами rus_verbs:застукать{}, // застукать с проститутками rus_verbs:напуститься{}, // напуститься с кулаками rus_verbs:сдружиться{}, // сдружиться с ребятами rus_verbs:соперничать{}, // соперничать с параллельным классом rus_verbs:прочесать{}, // прочесать с собаками rus_verbs:кокетничать{}, // кокетничать с гимназистками rus_verbs:мириться{}, // мириться с убытками rus_verbs:оплошать{}, // оплошать с билетами rus_verbs:отождествлять{}, // отождествлять с литературным героем rus_verbs:хитрить{}, // хитрить с зарплатой rus_verbs:провозиться{}, // провозиться с задачкой rus_verbs:коротать{}, // коротать с друзьями rus_verbs:соревноваться{}, // соревноваться с машиной rus_verbs:уживаться{}, // уживаться с местными жителями rus_verbs:отождествляться{}, // отождествляться с литературным героем rus_verbs:сопоставить{}, // сопоставить с эталоном rus_verbs:пьянствовать{}, // пьянствовать с друзьями rus_verbs:залетать{}, // залетать с паленой водкой rus_verbs:гастролировать{}, // гастролировать с новой цирковой программой rus_verbs:запаздывать{}, // запаздывать с кормлением rus_verbs:таскаться{}, // таскаться с сумками rus_verbs:контрастировать{}, // контрастировать с туфлями rus_verbs:сшибиться{}, // сшибиться с форвардом rus_verbs:состязаться{}, // состязаться с лучшей командой rus_verbs:затрудниться{}, // затрудниться с объяснением rus_verbs:объясниться{}, // объясниться с пострадавшими rus_verbs:разводиться{}, // разводиться со сварливой женой rus_verbs:препираться{}, // препираться с адвокатами rus_verbs:сосуществовать{}, // сосуществовать с крупными хищниками rus_verbs:свестись{}, // свестись с нулевым счетом rus_verbs:обговорить{}, // обговорить с директором rus_verbs:обвенчаться{}, // обвенчаться с ведьмой rus_verbs:экспериментировать{}, // экспериментировать с генами rus_verbs:сверять{}, // сверять с таблицей rus_verbs:сверяться{}, // свериться с таблицей rus_verbs:сблизить{}, // сблизить с точкой rus_verbs:гармонировать{}, // гармонировать с обоями rus_verbs:перемешивать{}, // перемешивать с молоком rus_verbs:трепаться{}, // трепаться с сослуживцами rus_verbs:перемигиваться{}, // перемигиваться с соседкой rus_verbs:разоткровенничаться{}, // разоткровенничаться с незнакомцем rus_verbs:распить{}, // распить с собутыльниками rus_verbs:скрестись{}, // скрестись с дикой лошадью rus_verbs:передраться{}, // передраться с дворовыми собаками rus_verbs:умыть{}, // умыть с мылом rus_verbs:грызться{}, // грызться с соседями rus_verbs:переругиваться{}, // переругиваться с соседями rus_verbs:доиграться{}, // доиграться со спичками rus_verbs:заладиться{}, // заладиться с подругой rus_verbs:скрещиваться{}, // скрещиваться с дикими видами rus_verbs:повидаться{}, // повидаться с дедушкой rus_verbs:повоевать{}, // повоевать с орками rus_verbs:сразиться{}, // сразиться с лучшим рыцарем rus_verbs:кипятить{}, // кипятить с отбеливателем rus_verbs:усердствовать{}, // усердствовать с наказанием rus_verbs:схлестнуться{}, // схлестнуться с лучшим боксером rus_verbs:пошептаться{}, // пошептаться с судьями rus_verbs:сравняться{}, // сравняться с лучшими экземплярами rus_verbs:церемониться{}, // церемониться с пьяницами rus_verbs:консультироваться{}, // консультироваться со специалистами rus_verbs:переусердствовать{}, // переусердствовать с наказанием rus_verbs:проноситься{}, // проноситься с собой rus_verbs:перемешать{}, // перемешать с гипсом rus_verbs:темнить{}, // темнить с долгами rus_verbs:сталкивать{}, // сталкивать с черной дырой rus_verbs:увольнять{}, // увольнять с волчьим билетом rus_verbs:заигрывать{}, // заигрывать с совершенно диким животным rus_verbs:сопоставлять{}, // сопоставлять с эталонными образцами rus_verbs:расторгнуть{}, // расторгнуть с нерасторопными поставщиками долгосрочный контракт rus_verbs:созвониться{}, // созвониться с мамой rus_verbs:спеться{}, // спеться с отъявленными хулиганами rus_verbs:интриговать{}, // интриговать с придворными rus_verbs:приобрести{}, // приобрести со скидкой rus_verbs:задержаться{}, // задержаться со сдачей работы rus_verbs:плавать{}, // плавать со спасательным кругом rus_verbs:якшаться{}, // Не якшайся с врагами инфинитив:ассоциировать{вид:соверш}, // читатели ассоциируют с собой героя книги инфинитив:ассоциировать{вид:несоверш}, глагол:ассоциировать{вид:соверш}, // читатели ассоциируют с собой героя книги глагол:ассоциировать{вид:несоверш}, //+прилагательное:ассоциировавший{вид:несоверш}, прилагательное:ассоциировавший{вид:соверш}, прилагательное:ассоциирующий{}, деепричастие:ассоциируя{}, деепричастие:ассоциировав{}, rus_verbs:ассоциироваться{}, // герой книги ассоциируется с реальным персонажем rus_verbs:аттестовывать{}, // Они аттестовывают сотрудников с помощью наборра тестов rus_verbs:аттестовываться{}, // Сотрудники аттестовываются с помощью набора тестов //+инфинитив:аффилировать{вид:соверш}, // эти предприятия были аффилированы с олигархом //+глагол:аффилировать{вид:соверш}, прилагательное:аффилированный{}, rus_verbs:баловаться{}, // мальчик баловался с молотком rus_verbs:балясничать{}, // женщина балясничала с товарками rus_verbs:богатеть{}, // Провинция богатеет от торговли с соседями rus_verbs:бодаться{}, // теленок бодается с деревом rus_verbs:боксировать{}, // Майкл дважды боксировал с ним rus_verbs:брататься{}, // Солдаты братались с бойцами союзников rus_verbs:вальсировать{}, // Мальчик вальсирует с девочкой rus_verbs:вверстывать{}, // Дизайнер с трудом вверстывает блоки в страницу rus_verbs:происходить{}, // Что происходит с мировой экономикой? rus_verbs:произойти{}, // Что произошло с экономикой? rus_verbs:взаимодействовать{}, // Электроны взаимодействуют с фотонами rus_verbs:вздорить{}, // Эта женщина часто вздорила с соседями rus_verbs:сойтись{}, // Мальчик сошелся с бандой хулиганов rus_verbs:вобрать{}, // вобрать в себя лучшие методы борьбы с вредителями rus_verbs:водиться{}, // Няня водится с детьми rus_verbs:воевать{}, // Фермеры воевали с волками rus_verbs:возиться{}, // Няня возится с детьми rus_verbs:ворковать{}, // Голубь воркует с голубкой rus_verbs:воссоединиться{}, // Дети воссоединились с семьей rus_verbs:воссоединяться{}, // Дети воссоединяются с семьей rus_verbs:вошкаться{}, // Не вошкайся с этой ерундой rus_verbs:враждовать{}, // враждовать с соседями rus_verbs:временить{}, // временить с выходом на пенсию rus_verbs:расстаться{}, // я не могу расстаться с тобой rus_verbs:выдирать{}, // выдирать с мясом rus_verbs:выдираться{}, // выдираться с мясом rus_verbs:вытворить{}, // вытворить что-либо с чем-либо rus_verbs:вытворять{}, // вытворять что-либо с чем-либо rus_verbs:сделать{}, // сделать с чем-то rus_verbs:домыть{}, // домыть с мылом rus_verbs:случиться{}, // случиться с кем-то rus_verbs:остаться{}, // остаться с кем-то rus_verbs:случать{}, // случать с породистым кобельком rus_verbs:послать{}, // послать с весточкой rus_verbs:работать{}, // работать с роботами rus_verbs:провести{}, // провести с девчонками время rus_verbs:заговорить{}, // заговорить с незнакомкой rus_verbs:прошептать{}, // прошептать с придыханием rus_verbs:читать{}, // читать с выражением rus_verbs:слушать{}, // слушать с повышенным вниманием rus_verbs:принести{}, // принести с собой rus_verbs:спать{}, // спать с женщинами rus_verbs:закончить{}, // закончить с приготовлениями rus_verbs:помочь{}, // помочь с перестановкой rus_verbs:уехать{}, // уехать с семьей rus_verbs:случаться{}, // случаться с кем-то rus_verbs:кутить{}, // кутить с проститутками rus_verbs:разговаривать{}, // разговаривать с ребенком rus_verbs:погодить{}, // погодить с ликвидацией rus_verbs:считаться{}, // считаться с чужим мнением rus_verbs:носить{}, // носить с собой rus_verbs:хорошеть{}, // хорошеть с каждым днем rus_verbs:приводить{}, // приводить с собой rus_verbs:прыгнуть{}, // прыгнуть с парашютом rus_verbs:петь{}, // петь с чувством rus_verbs:сложить{}, // сложить с результатом rus_verbs:познакомиться{}, // познакомиться с другими студентами rus_verbs:обращаться{}, // обращаться с животными rus_verbs:съесть{}, // съесть с хлебом rus_verbs:ошибаться{}, // ошибаться с дозировкой rus_verbs:столкнуться{}, // столкнуться с медведем rus_verbs:справиться{}, // справиться с нуждой rus_verbs:торопиться{}, // торопиться с ответом rus_verbs:поздравлять{}, // поздравлять с победой rus_verbs:объясняться{}, // объясняться с начальством rus_verbs:пошутить{}, // пошутить с подругой rus_verbs:поздороваться{}, // поздороваться с коллегами rus_verbs:поступать{}, // Как поступать с таким поведением? rus_verbs:определяться{}, // определяться с кандидатами rus_verbs:связаться{}, // связаться с поставщиком rus_verbs:спорить{}, // спорить с собеседником rus_verbs:разобраться{}, // разобраться с делами rus_verbs:ловить{}, // ловить с удочкой rus_verbs:помедлить{}, // Кандидат помедлил с ответом на заданный вопрос rus_verbs:шутить{}, // шутить с диким зверем rus_verbs:разорвать{}, // разорвать с поставщиком контракт rus_verbs:увезти{}, // увезти с собой rus_verbs:унести{}, // унести с собой rus_verbs:сотворить{}, // сотворить с собой что-то нехорошее rus_verbs:складываться{}, // складываться с первым импульсом rus_verbs:соглашаться{}, // соглашаться с предложенным договором //rus_verbs:покончить{}, // покончить с развратом rus_verbs:прихватить{}, // прихватить с собой rus_verbs:похоронить{}, // похоронить с почестями rus_verbs:связывать{}, // связывать с компанией свою судьбу rus_verbs:совпадать{}, // совпадать с предсказанием rus_verbs:танцевать{}, // танцевать с девушками rus_verbs:поделиться{}, // поделиться с выжившими rus_verbs:оставаться{}, // я не хотел оставаться с ним в одной комнате. rus_verbs:беседовать{}, // преподаватель, беседующий со студентами rus_verbs:бороться{}, // человек, борющийся со смертельной болезнью rus_verbs:шептаться{}, // девочка, шепчущаяся с подругой rus_verbs:сплетничать{}, // женщина, сплетничавшая с товарками rus_verbs:поговорить{}, // поговорить с виновниками rus_verbs:сказать{}, // сказать с трудом rus_verbs:произнести{}, // произнести с трудом rus_verbs:говорить{}, // говорить с акцентом rus_verbs:произносить{}, // произносить с трудом rus_verbs:встречаться{}, // кто с Антонио встречался? rus_verbs:посидеть{}, // посидеть с друзьями rus_verbs:расквитаться{}, // расквитаться с обидчиком rus_verbs:поквитаться{}, // поквитаться с обидчиком rus_verbs:ругаться{}, // ругаться с женой rus_verbs:поскандалить{}, // поскандалить с женой rus_verbs:потанцевать{}, // потанцевать с подругой rus_verbs:скандалить{}, // скандалить с соседями rus_verbs:разругаться{}, // разругаться с другом rus_verbs:болтать{}, // болтать с подругами rus_verbs:потрепаться{}, // потрепаться с соседкой rus_verbs:войти{}, // войти с регистрацией rus_verbs:входить{}, // входить с регистрацией rus_verbs:возвращаться{}, // возвращаться с триумфом rus_verbs:опоздать{}, // Он опоздал с подачей сочинения. rus_verbs:молчать{}, // Он молчал с ледяным спокойствием. rus_verbs:сражаться{}, // Он героически сражался с врагами. rus_verbs:выходить{}, // Он всегда выходит с зонтиком. rus_verbs:сличать{}, // сличать перевод с оригиналом rus_verbs:начать{}, // я начал с товарищем спор о религии rus_verbs:согласовать{}, // Маша согласовала с Петей дальнейшие поездки rus_verbs:приходить{}, // Приходите с нею. rus_verbs:жить{}, // кто с тобой жил? rus_verbs:расходиться{}, // Маша расходится с Петей rus_verbs:сцеплять{}, // сцеплять карабин с обвязкой rus_verbs:торговать{}, // мы торгуем с ними нефтью rus_verbs:уединяться{}, // уединяться с подругой в доме rus_verbs:уладить{}, // уладить конфликт с соседями rus_verbs:идти{}, // Я шел туда с тяжёлым сердцем. rus_verbs:разделять{}, // Я разделяю с вами горе и радость. rus_verbs:обратиться{}, // Я обратился к нему с просьбой о помощи. rus_verbs:захватить{}, // Я не захватил с собой денег. прилагательное:знакомый{}, // Я знаком с ними обоими. rus_verbs:вести{}, // Я веду с ней переписку. прилагательное:сопряженный{}, // Это сопряжено с большими трудностями. прилагательное:связанный{причастие}, // Это дело связано с риском. rus_verbs:поехать{}, // Хотите поехать со мной в театр? rus_verbs:проснуться{}, // Утром я проснулся с ясной головой. rus_verbs:лететь{}, // Самолёт летел со скоростью звука. rus_verbs:играть{}, // С огнём играть опасно! rus_verbs:поделать{}, // С ним ничего не поделаешь. rus_verbs:стрястись{}, // С ней стряслось несчастье. rus_verbs:смотреться{}, // Пьеса смотрится с удовольствием. rus_verbs:смотреть{}, // Она смотрела на меня с явным неудовольствием. rus_verbs:разойтись{}, // Она разошлась с мужем. rus_verbs:пристать{}, // Она пристала ко мне с расспросами. rus_verbs:посмотреть{}, // Она посмотрела на меня с удивлением. rus_verbs:поступить{}, // Она плохо поступила с ним. rus_verbs:выйти{}, // Она вышла с усталым и недовольным видом. rus_verbs:взять{}, // Возьмите с собой только самое необходимое. rus_verbs:наплакаться{}, // Наплачется она с ним. rus_verbs:лежать{}, // Он лежит с воспалением лёгких. rus_verbs:дышать{}, // дышащий с трудом rus_verbs:брать{}, // брать с собой rus_verbs:мчаться{}, // Автомобиль мчится с необычайной быстротой. rus_verbs:упасть{}, // Ваза упала со звоном. rus_verbs:вернуться{}, // мы вернулись вчера домой с полным лукошком rus_verbs:сидеть{}, // Она сидит дома с ребенком rus_verbs:встретиться{}, // встречаться с кем-либо ГЛ_ИНФ(придти), прилагательное:пришедший{}, // пришедший с другом ГЛ_ИНФ(постирать), прилагательное:постиранный{}, деепричастие:постирав{}, rus_verbs:мыть{} } fact гл_предл { if context { Гл_С_Твор предлог:с{} @regex("[a-z]+[0-9]*") } then return true } fact гл_предл { if context { Гл_С_Твор предлог:с{} *:*{падеж:твор} } then return true } #endregion ТВОРИТЕЛЬНЫЙ #region РОДИТЕЛЬНЫЙ wordentry_set Гл_С_Род= { rus_verbs:УХОДИТЬ{}, // Но с базы не уходить. rus_verbs:РВАНУТЬ{}, // Водитель прорычал проклятие и рванул машину с места. (РВАНУТЬ) rus_verbs:ОХВАТИТЬ{}, // огонь охватил его со всех сторон (ОХВАТИТЬ) rus_verbs:ЗАМЕТИТЬ{}, // Он понимал, что свет из тайника невозможно заметить с палубы (ЗАМЕТИТЬ/РАЗГЛЯДЕТЬ) rus_verbs:РАЗГЛЯДЕТЬ{}, // rus_verbs:СПЛАНИРОВАТЬ{}, // Птицы размером с орлицу, вероятно, не могли бы подняться в воздух, не спланировав с высокого утеса. (СПЛАНИРОВАТЬ) rus_verbs:УМЕРЕТЬ{}, // Он умрет с голоду. (УМЕРЕТЬ) rus_verbs:ВСПУГНУТЬ{}, // Оба упали с лязгом, вспугнувшим птиц с ближайших деревьев (ВСПУГНУТЬ) rus_verbs:РЕВЕТЬ{}, // Время от времени какой-то ящер ревел с берега или самой реки. (РЕВЕТЬ/ЗАРЕВЕТЬ/ПРОРЕВЕТЬ/ЗАОРАТЬ/ПРООРАТЬ/ОРАТЬ/ПРОКРИЧАТЬ/ЗАКРИЧАТЬ/ВОПИТЬ/ЗАВОПИТЬ) rus_verbs:ЗАРЕВЕТЬ{}, // rus_verbs:ПРОРЕВЕТЬ{}, // rus_verbs:ЗАОРАТЬ{}, // rus_verbs:ПРООРАТЬ{}, // rus_verbs:ОРАТЬ{}, // rus_verbs:ЗАКРИЧАТЬ{}, rus_verbs:ВОПИТЬ{}, // rus_verbs:ЗАВОПИТЬ{}, // rus_verbs:СТАЩИТЬ{}, // Я видела как они стащили его с валуна и увели с собой. (СТАЩИТЬ/СТАСКИВАТЬ) rus_verbs:СТАСКИВАТЬ{}, // rus_verbs:ПРОВЫТЬ{}, // Призрак трубного зова провыл с другой стороны дверей. (ПРОВЫТЬ, ЗАВЫТЬ, ВЫТЬ) rus_verbs:ЗАВЫТЬ{}, // rus_verbs:ВЫТЬ{}, // rus_verbs:СВЕТИТЬ{}, // Полуденное майское солнце ярко светило с голубых небес Аризоны. (СВЕТИТЬ) rus_verbs:ОТСВЕЧИВАТЬ{}, // Солнце отсвечивало с белых лошадей, белых щитов и белых перьев и искрилось на наконечниках пик. (ОТСВЕЧИВАТЬ С, ИСКРИТЬСЯ НА) rus_verbs:перегнать{}, // Скот нужно перегнать с этого пастбища на другое rus_verbs:собирать{}, // мальчики начали собирать со столов посуду rus_verbs:разглядывать{}, // ты ее со всех сторон разглядывал rus_verbs:СЖИМАТЬ{}, // меня плотно сжимали со всех сторон (СЖИМАТЬ) rus_verbs:СОБРАТЬСЯ{}, // со всего света собрались! (СОБРАТЬСЯ) rus_verbs:ИЗГОНЯТЬ{}, // Вино в пакетах изгоняют с рынка (ИЗГОНЯТЬ) rus_verbs:ВЛЮБИТЬСЯ{}, // влюбился в нее с первого взгляда (ВЛЮБИТЬСЯ) rus_verbs:РАЗДАВАТЬСЯ{}, // теперь крик раздавался со всех сторон (РАЗДАВАТЬСЯ) rus_verbs:ПОСМОТРЕТЬ{}, // Посмотрите на это с моей точки зрения (ПОСМОТРЕТЬ С род) rus_verbs:СХОДИТЬ{}, // принимать участие во всех этих событиях - значит продолжать сходить с ума (СХОДИТЬ С род) rus_verbs:РУХНУТЬ{}, // В Башкирии микроавтобус рухнул с моста (РУХНУТЬ С) rus_verbs:УВОЛИТЬ{}, // рекомендовать уволить их с работы (УВОЛИТЬ С) rus_verbs:КУПИТЬ{}, // еда , купленная с рук (КУПИТЬ С род) rus_verbs:УБРАТЬ{}, // помочь убрать со стола? (УБРАТЬ С) rus_verbs:ТЯНУТЬ{}, // с моря тянуло ветром (ТЯНУТЬ С) rus_verbs:ПРИХОДИТЬ{}, // приходит с работы муж (ПРИХОДИТЬ С) rus_verbs:ПРОПАСТЬ{}, // изображение пропало с экрана (ПРОПАСТЬ С) rus_verbs:ПОТЯНУТЬ{}, // с балкона потянуло холодом (ПОТЯНУТЬ С род) rus_verbs:РАЗДАТЬСЯ{}, // с палубы раздался свист (РАЗДАТЬСЯ С род) rus_verbs:ЗАЙТИ{}, // зашел с другой стороны (ЗАЙТИ С род) rus_verbs:НАЧАТЬ{}, // давай начнем с этого (НАЧАТЬ С род) rus_verbs:УВЕСТИ{}, // дала увести с развалин (УВЕСТИ С род) rus_verbs:ОПУСКАТЬСЯ{}, // с гор опускалась ночь (ОПУСКАТЬСЯ С) rus_verbs:ВСКОЧИТЬ{}, // Тристан вскочил с места (ВСКОЧИТЬ С род) rus_verbs:БРАТЬ{}, // беру с него пример (БРАТЬ С род) rus_verbs:ПРИПОДНЯТЬСЯ{}, // голова приподнялась с плеча (ПРИПОДНЯТЬСЯ С род) rus_verbs:ПОЯВИТЬСЯ{}, // всадники появились с востока (ПОЯВИТЬСЯ С род) rus_verbs:НАЛЕТЕТЬ{}, // с моря налетел ветер (НАЛЕТЕТЬ С род) rus_verbs:ВЗВИТЬСЯ{}, // Натан взвился с места (ВЗВИТЬСЯ С род) rus_verbs:ПОДОБРАТЬ{}, // подобрал с земли копье (ПОДОБРАТЬ С) rus_verbs:ДЕРНУТЬСЯ{}, // Кирилл дернулся с места (ДЕРНУТЬСЯ С род) rus_verbs:ВОЗВРАЩАТЬСЯ{}, // они возвращались с реки (ВОЗВРАЩАТЬСЯ С род) rus_verbs:ПЛЫТЬ{}, // плыли они с запада (ПЛЫТЬ С род) rus_verbs:ЗНАТЬ{}, // одно знали с древности (ЗНАТЬ С) rus_verbs:НАКЛОНИТЬСЯ{}, // всадник наклонился с лошади (НАКЛОНИТЬСЯ С) rus_verbs:НАЧАТЬСЯ{}, // началось все со скуки (НАЧАТЬСЯ С) прилагательное:ИЗВЕСТНЫЙ{}, // Культура его известна со времен глубокой древности (ИЗВЕСТНЫЙ С) rus_verbs:СБИТЬ{}, // Порыв ветра сбил Ваньку с ног (ts СБИТЬ С) rus_verbs:СОБИРАТЬСЯ{}, // они собираются сюда со всей равнины. (СОБИРАТЬСЯ С род) rus_verbs:смыть{}, // Дождь должен смыть с листьев всю пыль. (СМЫТЬ С) rus_verbs:привстать{}, // Мартин привстал со своего стула. (привстать с) rus_verbs:спасть{}, // тяжесть спала с души. (спасть с) rus_verbs:выглядеть{}, // так оно со стороны выглядело. (ВЫГЛЯДЕТЬ С) rus_verbs:повернуть{}, // к вечеру они повернули с нее направо. (ПОВЕРНУТЬ С) rus_verbs:ТЯНУТЬСЯ{}, // со стороны реки ко мне тянулись языки тумана. (ТЯНУТЬСЯ С) rus_verbs:ВОЕВАТЬ{}, // Генерал воевал с юных лет. (ВОЕВАТЬ С чего-то) rus_verbs:БОЛЕТЬ{}, // Голова болит с похмелья. (БОЛЕТЬ С) rus_verbs:приближаться{}, // со стороны острова приближалась лодка. rus_verbs:ПОТЯНУТЬСЯ{}, // со всех сторон к нему потянулись руки. (ПОТЯНУТЬСЯ С) rus_verbs:пойти{}, // низкий гул пошел со стороны долины. (пошел с) rus_verbs:зашевелиться{}, // со всех сторон зашевелились кусты. (зашевелиться с) rus_verbs:МЧАТЬСЯ{}, // со стороны леса мчались всадники. (МЧАТЬСЯ С) rus_verbs:БЕЖАТЬ{}, // люди бежали со всех ног. (БЕЖАТЬ С) rus_verbs:СЛЫШАТЬСЯ{}, // шум слышался со стороны моря. (СЛЫШАТЬСЯ С) rus_verbs:ЛЕТЕТЬ{}, // со стороны деревни летела птица. (ЛЕТЕТЬ С) rus_verbs:ПЕРЕТЬ{}, // враги прут со всех сторон. (ПЕРЕТЬ С) rus_verbs:ПОСЫПАТЬСЯ{}, // вопросы посыпались со всех сторон. (ПОСЫПАТЬСЯ С) rus_verbs:ИДТИ{}, // угроза шла со стороны моря. (ИДТИ С + род.п.) rus_verbs:ПОСЛЫШАТЬСЯ{}, // со стен послышались крики ужаса. (ПОСЛЫШАТЬСЯ С) rus_verbs:ОБРУШИТЬСЯ{}, // звуки обрушились со всех сторон. (ОБРУШИТЬСЯ С) rus_verbs:УДАРИТЬ{}, // голоса ударили со всех сторон. (УДАРИТЬ С) rus_verbs:ПОКАЗАТЬСЯ{}, // со стороны деревни показались земляне. (ПОКАЗАТЬСЯ С) rus_verbs:прыгать{}, // придется прыгать со второго этажа. (прыгать с) rus_verbs:СТОЯТЬ{}, // со всех сторон стоял лес. (СТОЯТЬ С) rus_verbs:доноситься{}, // шум со двора доносился чудовищный. (доноситься с) rus_verbs:мешать{}, // мешать воду с мукой (мешать с) rus_verbs:вестись{}, // Переговоры ведутся с позиции силы. (вестись с) rus_verbs:вставать{}, // Он не встает с кровати. (вставать с) rus_verbs:окружать{}, // зеленые щупальца окружали ее со всех сторон. (окружать с) rus_verbs:причитаться{}, // С вас причитается 50 рублей. rus_verbs:соскользнуть{}, // его острый клюв соскользнул с ее руки. rus_verbs:сократить{}, // Его сократили со службы. rus_verbs:поднять{}, // рука подняла с пола rus_verbs:поднимать{}, rus_verbs:тащить{}, // тем временем другие пришельцы тащили со всех сторон камни. rus_verbs:полететь{}, // Мальчик полетел с лестницы. rus_verbs:литься{}, // вода льется с неба rus_verbs:натечь{}, // натечь с сапог rus_verbs:спрыгивать{}, // спрыгивать с движущегося трамвая rus_verbs:съезжать{}, // съезжать с заявленной темы rus_verbs:покатываться{}, // покатываться со смеху rus_verbs:перескакивать{}, // перескакивать с одного примера на другой rus_verbs:сдирать{}, // сдирать с тела кожу rus_verbs:соскальзывать{}, // соскальзывать с крючка rus_verbs:сметать{}, // сметать с прилавков rus_verbs:кувыркнуться{}, // кувыркнуться со ступеньки rus_verbs:прокаркать{}, // прокаркать с ветки rus_verbs:стряхивать{}, // стряхивать с одежды rus_verbs:сваливаться{}, // сваливаться с лестницы rus_verbs:слизнуть{}, // слизнуть с лица rus_verbs:доставляться{}, // доставляться с фермы rus_verbs:обступать{}, // обступать с двух сторон rus_verbs:повскакивать{}, // повскакивать с мест rus_verbs:обозревать{}, // обозревать с вершины rus_verbs:слинять{}, // слинять с урока rus_verbs:смывать{}, // смывать с лица rus_verbs:спихнуть{}, // спихнуть со стола rus_verbs:обозреть{}, // обозреть с вершины rus_verbs:накупить{}, // накупить с рук rus_verbs:схлынуть{}, // схлынуть с берега rus_verbs:спикировать{}, // спикировать с километровой высоты rus_verbs:уползти{}, // уползти с поля боя rus_verbs:сбиваться{}, // сбиваться с пути rus_verbs:отлучиться{}, // отлучиться с поста rus_verbs:сигануть{}, // сигануть с крыши rus_verbs:сместить{}, // сместить с поста rus_verbs:списать{}, // списать с оригинального устройства инфинитив:слетать{ вид:несоверш }, глагол:слетать{ вид:несоверш }, // слетать с трассы деепричастие:слетая{}, rus_verbs:напиваться{}, // напиваться с горя rus_verbs:свесить{}, // свесить с крыши rus_verbs:заполучить{}, // заполучить со склада rus_verbs:спадать{}, // спадать с глаз rus_verbs:стартовать{}, // стартовать с мыса rus_verbs:спереть{}, // спереть со склада rus_verbs:согнать{}, // согнать с живота rus_verbs:скатываться{}, // скатываться со стога rus_verbs:сняться{}, // сняться с выборов rus_verbs:слезать{}, // слезать со стола rus_verbs:деваться{}, // деваться с подводной лодки rus_verbs:огласить{}, // огласить с трибуны rus_verbs:красть{}, // красть со склада rus_verbs:расширить{}, // расширить с торца rus_verbs:угадывать{}, // угадывать с полуслова rus_verbs:оскорбить{}, // оскорбить со сцены rus_verbs:срывать{}, // срывать с головы rus_verbs:сшибить{}, // сшибить с коня rus_verbs:сбивать{}, // сбивать с одежды rus_verbs:содрать{}, // содрать с посетителей rus_verbs:столкнуть{}, // столкнуть с горы rus_verbs:отряхнуть{}, // отряхнуть с одежды rus_verbs:сбрасывать{}, // сбрасывать с борта rus_verbs:расстреливать{}, // расстреливать с борта вертолета rus_verbs:придти{}, // мать скоро придет с работы rus_verbs:съехать{}, // Миша съехал с горки rus_verbs:свисать{}, // свисать с веток rus_verbs:стянуть{}, // стянуть с кровати rus_verbs:скинуть{}, // скинуть снег с плеча rus_verbs:загреметь{}, // загреметь со стула rus_verbs:сыпаться{}, // сыпаться с неба rus_verbs:стряхнуть{}, // стряхнуть с головы rus_verbs:сползти{}, // сползти со стула rus_verbs:стереть{}, // стереть с экрана rus_verbs:прогнать{}, // прогнать с фермы rus_verbs:смахнуть{}, // смахнуть со стола rus_verbs:спускать{}, // спускать с поводка rus_verbs:деться{}, // деться с подводной лодки rus_verbs:сдернуть{}, // сдернуть с себя rus_verbs:сдвинуться{}, // сдвинуться с места rus_verbs:слететь{}, // слететь с катушек rus_verbs:обступить{}, // обступить со всех сторон rus_verbs:снести{}, // снести с плеч инфинитив:сбегать{ вид:несоверш }, глагол:сбегать{ вид:несоверш }, // сбегать с уроков деепричастие:сбегая{}, прилагательное:сбегающий{}, // прилагательное:сбегавший{ вид:несоверш }, rus_verbs:запить{}, // запить с горя rus_verbs:рубануть{}, // рубануть с плеча rus_verbs:чертыхнуться{}, // чертыхнуться с досады rus_verbs:срываться{}, // срываться с цепи rus_verbs:смыться{}, // смыться с уроков rus_verbs:похитить{}, // похитить со склада rus_verbs:смести{}, // смести со своего пути rus_verbs:отгружать{}, // отгружать со склада rus_verbs:отгрузить{}, // отгрузить со склада rus_verbs:бросаться{}, // Дети бросались в воду с моста rus_verbs:броситься{}, // самоубийца бросился с моста в воду rus_verbs:взимать{}, // Билетер взимает плату с каждого посетителя rus_verbs:взиматься{}, // Плата взимается с любого посетителя rus_verbs:взыскать{}, // Приставы взыскали долг с бедолаги rus_verbs:взыскивать{}, // Приставы взыскивают с бедолаги все долги rus_verbs:взыскиваться{}, // Долги взыскиваются с алиментщиков rus_verbs:вспархивать{}, // вспархивать с цветка rus_verbs:вспорхнуть{}, // вспорхнуть с ветки rus_verbs:выбросить{}, // выбросить что-то с балкона rus_verbs:выводить{}, // выводить с одежды пятна rus_verbs:снять{}, // снять с головы rus_verbs:начинать{}, // начинать с эскиза rus_verbs:двинуться{}, // двинуться с места rus_verbs:начинаться{}, // начинаться с гардероба rus_verbs:стечь{}, // стечь с крыши rus_verbs:слезть{}, // слезть с кучи rus_verbs:спуститься{}, // спуститься с крыши rus_verbs:сойти{}, // сойти с пьедестала rus_verbs:свернуть{}, // свернуть с пути rus_verbs:сорвать{}, // сорвать с цепи rus_verbs:сорваться{}, // сорваться с поводка rus_verbs:тронуться{}, // тронуться с места rus_verbs:угадать{}, // угадать с первой попытки rus_verbs:спустить{}, // спустить с лестницы rus_verbs:соскочить{}, // соскочить с крючка rus_verbs:сдвинуть{}, // сдвинуть с места rus_verbs:подниматься{}, // туман, поднимающийся с болота rus_verbs:подняться{}, // туман, поднявшийся с болота rus_verbs:валить{}, // Резкий порывистый ветер валит прохожих с ног. rus_verbs:свалить{}, // Резкий порывистый ветер свалит тебя с ног. rus_verbs:донестись{}, // С улицы донесся шум дождя. rus_verbs:опасть{}, // Опавшие с дерева листья. rus_verbs:махнуть{}, // Он махнул с берега в воду. rus_verbs:исчезнуть{}, // исчезнуть с экрана rus_verbs:свалиться{}, // свалиться со сцены rus_verbs:упасть{}, // упасть с дерева rus_verbs:вернуться{}, // Он ещё не вернулся с работы. rus_verbs:сдувать{}, // сдувать пух с одуванчиков rus_verbs:свергать{}, // свергать царя с трона rus_verbs:сбиться{}, // сбиться с пути rus_verbs:стирать{}, // стирать тряпкой надпись с доски rus_verbs:убирать{}, // убирать мусор c пола rus_verbs:удалять{}, // удалять игрока с поля rus_verbs:окружить{}, // Япония окружена со всех сторон морями. rus_verbs:снимать{}, // Я снимаю с себя всякую ответственность за его поведение. глагол:писаться{ aux stress="пис^аться" }, // Собственные имена пишутся с большой буквы. прилагательное:спокойный{}, // С этой стороны я спокоен. rus_verbs:спросить{}, // С тебя за всё спросят. rus_verbs:течь{}, // С него течёт пот. rus_verbs:дуть{}, // С моря дует ветер. rus_verbs:капать{}, // С его лица капали крупные капли пота. rus_verbs:опустить{}, // Она опустила ребёнка с рук на пол. rus_verbs:спрыгнуть{}, // Она легко спрыгнула с коня. rus_verbs:встать{}, // Все встали со стульев. rus_verbs:сбросить{}, // Войдя в комнату, он сбросил с себя пальто. rus_verbs:взять{}, // Возьми книгу с полки. rus_verbs:спускаться{}, // Мы спускались с горы. rus_verbs:уйти{}, // Он нашёл себе заместителя и ушёл со службы. rus_verbs:порхать{}, // Бабочка порхает с цветка на цветок. rus_verbs:отправляться{}, // Ваш поезд отправляется со второй платформы. rus_verbs:двигаться{}, // Он не двигался с места. rus_verbs:отходить{}, // мой поезд отходит с первого пути rus_verbs:попасть{}, // Майкл попал в кольцо с десятиметровой дистанции rus_verbs:падать{}, // снег падает с ветвей rus_verbs:скрыться{} // Ее водитель, бросив машину, скрылся с места происшествия. } fact гл_предл { if context { Гл_С_Род предлог:с{} @regex("[a-z]+[0-9]*") } then return true } fact гл_предл { if context { Гл_С_Род предлог:с{} *:*{падеж:род} } then return true } fact гл_предл { if context { Гл_С_Род предлог:с{} *:*{падеж:парт} } then return true } #endregion РОДИТЕЛЬНЫЙ fact гл_предл { if context { * предлог:с{} *:*{ падеж:твор } } then return false,-3 } fact гл_предл { if context { * предлог:с{} *:*{ падеж:род } } then return false,-4 } fact гл_предл { if context { * предлог:с{} * } then return false,-5 } #endregion Предлог_С /* #region Предлог_ПОД // -------------- ПРЕДЛОГ 'ПОД' ----------------------- fact гл_предл { if context { * предлог:под{} @regex("[a-z]+[0-9]*") } then return true } // ПОД+вин.п. не может присоединяться к существительным, поэтому // он присоединяется к любым глаголам. fact гл_предл { if context { * предлог:под{} *:*{ падеж:вин } } then return true } wordentry_set Гл_ПОД_твор= { rus_verbs:извиваться{}, // извивалась под его длинными усами rus_verbs:РАСПРОСТРАНЯТЬСЯ{}, // Под густым ковром травы и плотным сплетением корней (РАСПРОСТРАНЯТЬСЯ) rus_verbs:БРОСИТЬ{}, // чтобы ты его под деревом бросил? (БРОСИТЬ) rus_verbs:БИТЬСЯ{}, // под моей щекой сильно билось его сердце (БИТЬСЯ) rus_verbs:ОПУСТИТЬСЯ{}, // глаза его опустились под ее желтым взглядом (ОПУСТИТЬСЯ) rus_verbs:ВЗДЫМАТЬСЯ{}, // его грудь судорожно вздымалась под ее рукой (ВЗДЫМАТЬСЯ) rus_verbs:ПРОМЧАТЬСЯ{}, // Она промчалась под ними и исчезла за изгибом горы. (ПРОМЧАТЬСЯ) rus_verbs:всплыть{}, // Наконец он всплыл под нависавшей кормой, так и не отыскав того, что хотел. (всплыть) rus_verbs:КОНЧАТЬСЯ{}, // Он почти вертикально уходит в реку и кончается глубоко под водой. (КОНЧАТЬСЯ) rus_verbs:ПОЛЗТИ{}, // Там они ползли под спутанным терновником и сквозь переплетавшиеся кусты (ПОЛЗТИ) rus_verbs:ПРОХОДИТЬ{}, // Вольф проходил под гигантскими ветвями деревьев и мхов, свисавших с ветвей зелеными водопадами. (ПРОХОДИТЬ, ПРОПОЛЗТИ, ПРОПОЛЗАТЬ) rus_verbs:ПРОПОЛЗТИ{}, // rus_verbs:ПРОПОЛЗАТЬ{}, // rus_verbs:ИМЕТЬ{}, // Эти предположения не имеют под собой никакой почвы (ИМЕТЬ) rus_verbs:НОСИТЬ{}, // она носит под сердцем ребенка (НОСИТЬ) rus_verbs:ПАСТЬ{}, // Рим пал под натиском варваров (ПАСТЬ) rus_verbs:УТОНУТЬ{}, // Выступавшие старческие вены снова утонули под гладкой твердой плотью. (УТОНУТЬ) rus_verbs:ВАЛЯТЬСЯ{}, // Под его кривыми серыми ветвями и пестрыми коричнево-зелеными листьями валялись пустые ореховые скорлупки и сердцевины плодов. (ВАЛЯТЬСЯ) rus_verbs:вздрогнуть{}, // она вздрогнула под его взглядом rus_verbs:иметься{}, // у каждого под рукой имелся арбалет rus_verbs:ЖДАТЬ{}, // Сашка уже ждал под дождем (ЖДАТЬ) rus_verbs:НОЧЕВАТЬ{}, // мне приходилось ночевать под открытым небом (НОЧЕВАТЬ) rus_verbs:УЗНАТЬ{}, // вы должны узнать меня под этим именем (УЗНАТЬ) rus_verbs:ЗАДЕРЖИВАТЬСЯ{}, // мне нельзя задерживаться под землей! (ЗАДЕРЖИВАТЬСЯ) rus_verbs:ПОГИБНУТЬ{}, // под их копытами погибли целые армии! (ПОГИБНУТЬ) rus_verbs:РАЗДАВАТЬСЯ{}, // под ногами у меня раздавался сухой хруст (РАЗДАВАТЬСЯ) rus_verbs:КРУЖИТЬСЯ{}, // поверхность планеты кружилась у него под ногами (КРУЖИТЬСЯ) rus_verbs:ВИСЕТЬ{}, // под глазами у него висели тяжелые складки кожи (ВИСЕТЬ) rus_verbs:содрогнуться{}, // содрогнулся под ногами каменный пол (СОДРОГНУТЬСЯ) rus_verbs:СОБИРАТЬСЯ{}, // темнота уже собиралась под деревьями (СОБИРАТЬСЯ) rus_verbs:УПАСТЬ{}, // толстяк упал под градом ударов (УПАСТЬ) rus_verbs:ДВИНУТЬСЯ{}, // лодка двинулась под водой (ДВИНУТЬСЯ) rus_verbs:ЦАРИТЬ{}, // под его крышей царила холодная зима (ЦАРИТЬ) rus_verbs:ПРОВАЛИТЬСЯ{}, // под копытами его лошади провалился мост (ПРОВАЛИТЬСЯ ПОД твор) rus_verbs:ЗАДРОЖАТЬ{}, // земля задрожала под ногами (ЗАДРОЖАТЬ) rus_verbs:НАХМУРИТЬСЯ{}, // государь нахмурился под маской (НАХМУРИТЬСЯ) rus_verbs:РАБОТАТЬ{}, // работать под угрозой нельзя (РАБОТАТЬ) rus_verbs:ШЕВЕЛЬНУТЬСЯ{}, // под ногой шевельнулся камень (ШЕВЕЛЬНУТЬСЯ) rus_verbs:ВИДЕТЬ{}, // видел тебя под камнем. (ВИДЕТЬ) rus_verbs:ОСТАТЬСЯ{}, // второе осталось под водой (ОСТАТЬСЯ) rus_verbs:КИПЕТЬ{}, // вода кипела под копытами (КИПЕТЬ) rus_verbs:СИДЕТЬ{}, // может сидит под деревом (СИДЕТЬ) rus_verbs:МЕЛЬКНУТЬ{}, // под нами мелькнуло море (МЕЛЬКНУТЬ) rus_verbs:ПОСЛЫШАТЬСЯ{}, // под окном послышался шум (ПОСЛЫШАТЬСЯ) rus_verbs:ТЯНУТЬСЯ{}, // под нами тянулись облака (ТЯНУТЬСЯ) rus_verbs:ДРОЖАТЬ{}, // земля дрожала под ним (ДРОЖАТЬ) rus_verbs:ПРИЙТИСЬ{}, // хуже пришлось под землей (ПРИЙТИСЬ) rus_verbs:ГОРЕТЬ{}, // лампа горела под потолком (ГОРЕТЬ) rus_verbs:ПОЛОЖИТЬ{}, // положил под деревом плащ (ПОЛОЖИТЬ) rus_verbs:ЗАГОРЕТЬСЯ{}, // под деревьями загорелся костер (ЗАГОРЕТЬСЯ) rus_verbs:ПРОНОСИТЬСЯ{}, // под нами проносились крыши (ПРОНОСИТЬСЯ) rus_verbs:ПОТЯНУТЬСЯ{}, // под кораблем потянулись горы (ПОТЯНУТЬСЯ) rus_verbs:БЕЖАТЬ{}, // беги под серой стеной ночи (БЕЖАТЬ) rus_verbs:РАЗДАТЬСЯ{}, // под окном раздалось тяжелое дыхание (РАЗДАТЬСЯ) rus_verbs:ВСПЫХНУТЬ{}, // под потолком вспыхнула яркая лампа (ВСПЫХНУТЬ) rus_verbs:СМОТРЕТЬ{}, // просто смотрите под другим углом (СМОТРЕТЬ ПОД) rus_verbs:ДУТЬ{}, // теперь под деревьями дул ветерок (ДУТЬ) rus_verbs:СКРЫТЬСЯ{}, // оно быстро скрылось под водой (СКРЫТЬСЯ ПОД) rus_verbs:ЩЕЛКНУТЬ{}, // далеко под ними щелкнул выстрел (ЩЕЛКНУТЬ) rus_verbs:ТРЕЩАТЬ{}, // осколки стекла трещали под ногами (ТРЕЩАТЬ) rus_verbs:РАСПОЛАГАТЬСЯ{}, // под ними располагались разноцветные скамьи (РАСПОЛАГАТЬСЯ) rus_verbs:ВЫСТУПИТЬ{}, // под ногтями выступили капельки крови (ВЫСТУПИТЬ) rus_verbs:НАСТУПИТЬ{}, // под куполом базы наступила тишина (НАСТУПИТЬ) rus_verbs:ОСТАНОВИТЬСЯ{}, // повозка остановилась под самым окном (ОСТАНОВИТЬСЯ) rus_verbs:РАСТАЯТЬ{}, // магазин растаял под ночным дождем (РАСТАЯТЬ) rus_verbs:ДВИГАТЬСЯ{}, // под водой двигалось нечто огромное (ДВИГАТЬСЯ) rus_verbs:БЫТЬ{}, // под снегом могут быть трещины (БЫТЬ) rus_verbs:ЗИЯТЬ{}, // под ней зияла ужасная рана (ЗИЯТЬ) rus_verbs:ЗАЗВОНИТЬ{}, // под рукой водителя зазвонил телефон (ЗАЗВОНИТЬ) rus_verbs:ПОКАЗАТЬСЯ{}, // внезапно под ними показалась вода (ПОКАЗАТЬСЯ) rus_verbs:ЗАМЕРЕТЬ{}, // эхо замерло под высоким потолком (ЗАМЕРЕТЬ) rus_verbs:ПОЙТИ{}, // затем под кораблем пошла пустыня (ПОЙТИ) rus_verbs:ДЕЙСТВОВАТЬ{}, // боги всегда действуют под маской (ДЕЙСТВОВАТЬ) rus_verbs:БЛЕСТЕТЬ{}, // мокрый мех блестел под луной (БЛЕСТЕТЬ) rus_verbs:ЛЕТЕТЬ{}, // под ним летела серая земля (ЛЕТЕТЬ) rus_verbs:СОГНУТЬСЯ{}, // содрогнулся под ногами каменный пол (СОГНУТЬСЯ) rus_verbs:КИВНУТЬ{}, // четвертый слегка кивнул под капюшоном (КИВНУТЬ) rus_verbs:УМЕРЕТЬ{}, // колдун умер под грудой каменных глыб (УМЕРЕТЬ) rus_verbs:ОКАЗЫВАТЬСЯ{}, // внезапно под ногами оказывается знакомая тропинка (ОКАЗЫВАТЬСЯ) rus_verbs:ИСЧЕЗАТЬ{}, // серая лента дороги исчезала под воротами (ИСЧЕЗАТЬ) rus_verbs:СВЕРКНУТЬ{}, // голубые глаза сверкнули под густыми бровями (СВЕРКНУТЬ) rus_verbs:СИЯТЬ{}, // под ним сияла белая пелена облаков (СИЯТЬ) rus_verbs:ПРОНЕСТИСЬ{}, // тихий смех пронесся под куполом зала (ПРОНЕСТИСЬ) rus_verbs:СКОЛЬЗИТЬ{}, // обломки судна медленно скользили под ними (СКОЛЬЗИТЬ) rus_verbs:ВЗДУТЬСЯ{}, // под серой кожей вздулись шары мускулов (ВЗДУТЬСЯ) rus_verbs:ПРОЙТИ{}, // обломок отлично пройдет под колесами слева (ПРОЙТИ) rus_verbs:РАЗВЕВАТЬСЯ{}, // светлые волосы развевались под дыханием ветра (РАЗВЕВАТЬСЯ) rus_verbs:СВЕРКАТЬ{}, // глаза огнем сверкали под темными бровями (СВЕРКАТЬ) rus_verbs:КАЗАТЬСЯ{}, // деревянный док казался очень твердым под моими ногами (КАЗАТЬСЯ) rus_verbs:ПОСТАВИТЬ{}, // четвертый маг торопливо поставил под зеркалом широкую чашу (ПОСТАВИТЬ) rus_verbs:ОСТАВАТЬСЯ{}, // запасы остаются под давлением (ОСТАВАТЬСЯ ПОД) rus_verbs:ПЕТЬ{}, // просто мы под землей любим петь. (ПЕТЬ ПОД) rus_verbs:ПОЯВИТЬСЯ{}, // под их крыльями внезапно появился дым. (ПОЯВИТЬСЯ ПОД) rus_verbs:ОКАЗАТЬСЯ{}, // мы снова оказались под солнцем. (ОКАЗАТЬСЯ ПОД) rus_verbs:ПОДХОДИТЬ{}, // мы подходили под другим углом? (ПОДХОДИТЬ ПОД) rus_verbs:СКРЫВАТЬСЯ{}, // кто под ней скрывается? (СКРЫВАТЬСЯ ПОД) rus_verbs:ХЛЮПАТЬ{}, // под ногами Аллы хлюпала грязь (ХЛЮПАТЬ ПОД) rus_verbs:ШАГАТЬ{}, // их отряд весело шагал под дождем этой музыки. (ШАГАТЬ ПОД) rus_verbs:ТЕЧЬ{}, // под ее поверхностью медленно текла ярость. (ТЕЧЬ ПОД твор) rus_verbs:ОЧУТИТЬСЯ{}, // мы очутились под стенами замка. (ОЧУТИТЬСЯ ПОД) rus_verbs:ПОБЛЕСКИВАТЬ{}, // их латы поблескивали под солнцем. (ПОБЛЕСКИВАТЬ ПОД) rus_verbs:ДРАТЬСЯ{}, // под столами дрались за кости псы. (ДРАТЬСЯ ПОД) rus_verbs:КАЧНУТЬСЯ{}, // палуба качнулась у нас под ногами. (КАЧНУЛАСЬ ПОД) rus_verbs:ПРИСЕСТЬ{}, // конь даже присел под тяжелым телом. (ПРИСЕСТЬ ПОД) rus_verbs:ЖИТЬ{}, // они живут под землей. (ЖИТЬ ПОД) rus_verbs:ОБНАРУЖИТЬ{}, // вы можете обнаружить ее под водой? (ОБНАРУЖИТЬ ПОД) rus_verbs:ПЛЫТЬ{}, // Орёл плывёт под облаками. (ПЛЫТЬ ПОД) rus_verbs:ИСЧЕЗНУТЬ{}, // потом они исчезли под водой. (ИСЧЕЗНУТЬ ПОД) rus_verbs:держать{}, // оружие все держали под рукой. (держать ПОД) rus_verbs:ВСТРЕТИТЬСЯ{}, // они встретились под водой. (ВСТРЕТИТЬСЯ ПОД) rus_verbs:уснуть{}, // Миша уснет под одеялом rus_verbs:пошевелиться{}, // пошевелиться под одеялом rus_verbs:задохнуться{}, // задохнуться под слоем снега rus_verbs:потечь{}, // потечь под избыточным давлением rus_verbs:уцелеть{}, // уцелеть под завалами rus_verbs:мерцать{}, // мерцать под лучами софитов rus_verbs:поискать{}, // поискать под кроватью rus_verbs:гудеть{}, // гудеть под нагрузкой rus_verbs:посидеть{}, // посидеть под навесом rus_verbs:укрыться{}, // укрыться под навесом rus_verbs:утихнуть{}, // утихнуть под одеялом rus_verbs:заскрипеть{}, // заскрипеть под тяжестью rus_verbs:шелохнуться{}, // шелохнуться под одеялом инфинитив:срезать{ вид:несоверш }, глагол:срезать{ вид:несоверш }, // срезать под корень деепричастие:срезав{}, прилагательное:срезающий{ вид:несоверш }, инфинитив:срезать{ вид:соверш }, глагол:срезать{ вид:соверш }, деепричастие:срезая{}, прилагательное:срезавший{ вид:соверш }, rus_verbs:пониматься{}, // пониматься под успехом rus_verbs:подразумеваться{}, // подразумеваться под правильным решением rus_verbs:промокнуть{}, // промокнуть под проливным дождем rus_verbs:засосать{}, // засосать под ложечкой rus_verbs:подписаться{}, // подписаться под воззванием rus_verbs:укрываться{}, // укрываться под навесом rus_verbs:запыхтеть{}, // запыхтеть под одеялом rus_verbs:мокнуть{}, // мокнуть под лождем rus_verbs:сгибаться{}, // сгибаться под тяжестью снега rus_verbs:намокнуть{}, // намокнуть под дождем rus_verbs:подписываться{}, // подписываться под обращением rus_verbs:тарахтеть{}, // тарахтеть под окнами инфинитив:находиться{вид:несоверш}, глагол:находиться{вид:несоверш}, // Она уже несколько лет находится под наблюдением врача. деепричастие:находясь{}, прилагательное:находившийся{вид:несоверш}, прилагательное:находящийся{}, rus_verbs:лежать{}, // лежать под капельницей rus_verbs:вымокать{}, // вымокать под дождём rus_verbs:вымокнуть{}, // вымокнуть под дождём rus_verbs:проворчать{}, // проворчать под нос rus_verbs:хмыкнуть{}, // хмыкнуть под нос rus_verbs:отыскать{}, // отыскать под кроватью rus_verbs:дрогнуть{}, // дрогнуть под ударами rus_verbs:проявляться{}, // проявляться под нагрузкой rus_verbs:сдержать{}, // сдержать под контролем rus_verbs:ложиться{}, // ложиться под клиента rus_verbs:таять{}, // таять под весенним солнцем rus_verbs:покатиться{}, // покатиться под откос rus_verbs:лечь{}, // он лег под навесом rus_verbs:идти{}, // идти под дождем прилагательное:известный{}, // Он известен под этим именем. rus_verbs:стоять{}, // Ящик стоит под столом. rus_verbs:отступить{}, // Враг отступил под ударами наших войск. rus_verbs:царапаться{}, // Мышь царапается под полом. rus_verbs:спать{}, // заяц спокойно спал у себя под кустом rus_verbs:загорать{}, // мы загораем под солнцем ГЛ_ИНФ(мыть), // мыть руки под струёй воды ГЛ_ИНФ(закопать), ГЛ_ИНФ(спрятать), ГЛ_ИНФ(прятать), ГЛ_ИНФ(перепрятать) } fact гл_предл { if context { Гл_ПОД_твор предлог:под{} *:*{ падеж:твор } } then return true } // для глаголов вне списка - запрещаем. fact гл_предл { if context { * предлог:под{} *:*{ падеж:твор } } then return false,-10 } fact гл_предл { if context { * предлог:под{} *:*{} } then return false,-11 } #endregion Предлог_ПОД */ #region Предлог_ОБ // -------------- ПРЕДЛОГ 'ОБ' ----------------------- wordentry_set Гл_ОБ_предл= { rus_verbs:СВИДЕТЕЛЬСТВОВАТЬ{}, // Об их присутствии свидетельствовало лишь тусклое пурпурное пятно, проступавшее на камне. (СВИДЕТЕЛЬСТВОВАТЬ) rus_verbs:ЗАДУМАТЬСЯ{}, // Промышленные гиганты задумались об экологии (ЗАДУМАТЬСЯ) rus_verbs:СПРОСИТЬ{}, // Он спросил нескольких из пляжников об их кажущейся всеобщей юности. (СПРОСИТЬ) rus_verbs:спрашивать{}, // как ты можешь еще спрашивать у меня об этом? rus_verbs:забывать{}, // Мы не можем забывать об их участи. rus_verbs:ГАДАТЬ{}, // теперь об этом можно лишь гадать (ГАДАТЬ) rus_verbs:ПОВЕДАТЬ{}, // Градоначальник , выступая с обзором основных городских событий , поведал об этом депутатам (ПОВЕДАТЬ ОБ) rus_verbs:СООБЩИТЬ{}, // Иран сообщил МАГАТЭ об ускорении обогащения урана (СООБЩИТЬ) rus_verbs:ЗАЯВИТЬ{}, // Об их успешном окончании заявил генеральный директор (ЗАЯВИТЬ ОБ) rus_verbs:слышать{}, // даже они слышали об этом человеке. (СЛЫШАТЬ ОБ) rus_verbs:ДОЛОЖИТЬ{}, // вернувшиеся разведчики доложили об увиденном (ДОЛОЖИТЬ ОБ) rus_verbs:ПОГОВОРИТЬ{}, // давай поговорим об этом. (ПОГОВОРИТЬ ОБ) rus_verbs:ДОГАДАТЬСЯ{}, // об остальном нетрудно догадаться. (ДОГАДАТЬСЯ ОБ) rus_verbs:ПОЗАБОТИТЬСЯ{}, // обещал обо всем позаботиться. (ПОЗАБОТИТЬСЯ ОБ) rus_verbs:ПОЗАБЫТЬ{}, // Шура позабыл обо всем. (ПОЗАБЫТЬ ОБ) rus_verbs:вспоминать{}, // Впоследствии он не раз вспоминал об этом приключении. (вспоминать об) rus_verbs:сообщать{}, // Газета сообщает об открытии сессии парламента. (сообщать об) rus_verbs:просить{}, // мы просили об отсрочке платежей (просить ОБ) rus_verbs:ПЕТЬ{}, // эта же девушка пела обо всем совершенно открыто. (ПЕТЬ ОБ) rus_verbs:сказать{}, // ты скажешь об этом капитану? (сказать ОБ) rus_verbs:знать{}, // бы хотелось знать как можно больше об этом районе. rus_verbs:кричать{}, // Все газеты кричат об этом событии. rus_verbs:советоваться{}, // Она обо всём советуется с матерью. rus_verbs:говориться{}, // об остальном говорилось легко. rus_verbs:подумать{}, // нужно крепко обо всем подумать. rus_verbs:напомнить{}, // черный дым напомнил об опасности. rus_verbs:забыть{}, // забудь об этой роскоши. rus_verbs:думать{}, // приходится обо всем думать самой. rus_verbs:отрапортовать{}, // отрапортовать об успехах rus_verbs:информировать{}, // информировать об изменениях rus_verbs:оповестить{}, // оповестить об отказе rus_verbs:убиваться{}, // убиваться об стену rus_verbs:расшибить{}, // расшибить об стену rus_verbs:заговорить{}, // заговорить об оплате rus_verbs:отозваться{}, // Он отозвался об этой книге с большой похвалой. rus_verbs:попросить{}, // попросить об услуге rus_verbs:объявить{}, // объявить об отставке rus_verbs:предупредить{}, // предупредить об аварии rus_verbs:предупреждать{}, // предупреждать об опасности rus_verbs:твердить{}, // твердить об обязанностях rus_verbs:заявлять{}, // заявлять об экспериментальном подтверждении rus_verbs:рассуждать{}, // рассуждать об абстрактных идеях rus_verbs:говорить{}, // Не говорите об этом в присутствии третьих лиц. rus_verbs:читать{}, // он читал об этом в журнале rus_verbs:прочитать{}, // он читал об этом в учебнике rus_verbs:узнать{}, // он узнал об этом из фильмов rus_verbs:рассказать{}, // рассказать об экзаменах rus_verbs:рассказывать{}, rus_verbs:договориться{}, // договориться об оплате rus_verbs:договариваться{}, // договариваться об обмене rus_verbs:болтать{}, // Не болтай об этом! rus_verbs:проболтаться{}, // Не проболтайся об этом! rus_verbs:заботиться{}, // кто заботится об урегулировании rus_verbs:беспокоиться{}, // вы беспокоитесь об обороне rus_verbs:помнить{}, // всем советую об этом помнить rus_verbs:мечтать{} // Мечтать об успехе } fact гл_предл { if context { Гл_ОБ_предл предлог:об{} *:*{ падеж:предл } } then return true } fact гл_предл { if context { * предлог:о{} @regex("[a-z]+[0-9]*") } then return true } fact гл_предл { if context { * предлог:об{} @regex("[a-z]+[0-9]*") } then return true } // остальные глаголы не могут связываться fact гл_предл { if context { * предлог:об{} *:*{ падеж:предл } } then return false, -4 } wordentry_set Гл_ОБ_вин= { rus_verbs:СЛОМАТЬ{}, // потом об колено сломал (СЛОМАТЬ) rus_verbs:разбить{}, // ты разбил щеку об угол ящика. (РАЗБИТЬ ОБ) rus_verbs:опереться{}, // Он опёрся об стену. rus_verbs:опираться{}, rus_verbs:постучать{}, // постучал лбом об пол. rus_verbs:удариться{}, // бутылка глухо ударилась об землю. rus_verbs:убиваться{}, // убиваться об стену rus_verbs:расшибить{}, // расшибить об стену rus_verbs:царапаться{} // Днище лодки царапалось обо что-то. } fact гл_предл { if context { Гл_ОБ_вин предлог:об{} *:*{ падеж:вин } } then return true } fact гл_предл { if context { * предлог:об{} *:*{ падеж:вин } } then return false,-4 } fact гл_предл { if context { * предлог:об{} *:*{} } then return false,-5 } #endregion Предлог_ОБ #region Предлог_О // ------------------- С ПРЕДЛОГОМ 'О' ---------------------- wordentry_set Гл_О_Вин={ rus_verbs:шмякнуть{}, // Ей хотелось шмякнуть ими о стену. rus_verbs:болтать{}, // Болтали чаще всего о пустяках. rus_verbs:шваркнуть{}, // Она шваркнула трубкой о рычаг. rus_verbs:опираться{}, // Мать приподнялась, с трудом опираясь о стол. rus_verbs:бахнуться{}, // Бахнуться головой о стол. rus_verbs:ВЫТЕРЕТЬ{}, // Вытащи нож и вытри его о траву. (ВЫТЕРЕТЬ/ВЫТИРАТЬ) rus_verbs:ВЫТИРАТЬ{}, // rus_verbs:РАЗБИТЬСЯ{}, // Прибой накатился и с шумом разбился о белый песок. (РАЗБИТЬСЯ) rus_verbs:СТУКНУТЬ{}, // Сердце его глухо стукнуло о грудную кость (СТУКНУТЬ) rus_verbs:ЛЯЗГНУТЬ{}, // Он кинулся наземь, покатился, и копье лязгнуло о стену. (ЛЯЗГНУТЬ/ЛЯЗГАТЬ) rus_verbs:ЛЯЗГАТЬ{}, // rus_verbs:звенеть{}, // стрелы уже звенели о прутья клетки rus_verbs:ЩЕЛКНУТЬ{}, // камень щелкнул о скалу (ЩЕЛКНУТЬ) rus_verbs:БИТЬ{}, // волна бьет о берег (БИТЬ) rus_verbs:ЗАЗВЕНЕТЬ{}, // зазвенели мечи о щиты (ЗАЗВЕНЕТЬ) rus_verbs:колотиться{}, // сердце его колотилось о ребра rus_verbs:стучать{}, // глухо стучали о щиты рукояти мечей. rus_verbs:биться{}, // биться головой о стену? (биться о) rus_verbs:ударить{}, // вода ударила его о стену коридора. (ударила о) rus_verbs:разбиваться{}, // волны разбивались о скалу rus_verbs:разбивать{}, // Разбивает голову о прутья клетки. rus_verbs:облокотиться{}, // облокотиться о стену rus_verbs:точить{}, // точить о точильный камень rus_verbs:спотыкаться{}, // спотыкаться о спрятавшийся в траве пень rus_verbs:потереться{}, // потереться о дерево rus_verbs:ушибиться{}, // ушибиться о дерево rus_verbs:тереться{}, // тереться о ствол rus_verbs:шмякнуться{}, // шмякнуться о землю rus_verbs:убиваться{}, // убиваться об стену rus_verbs:расшибить{}, // расшибить об стену rus_verbs:тереть{}, // тереть о камень rus_verbs:потереть{}, // потереть о колено rus_verbs:удариться{}, // удариться о край rus_verbs:споткнуться{}, // споткнуться о камень rus_verbs:запнуться{}, // запнуться о камень rus_verbs:запинаться{}, // запинаться о камни rus_verbs:ударяться{}, // ударяться о бортик rus_verbs:стукнуться{}, // стукнуться о бортик rus_verbs:стукаться{}, // стукаться о бортик rus_verbs:опереться{}, // Он опёрся локтями о стол. rus_verbs:плескаться{} // Вода плещется о берег. } fact гл_предл { if context { Гл_О_Вин предлог:о{} *:*{ падеж:вин } } then return true } fact гл_предл { if context { * предлог:о{} *:*{ падеж:вин } } then return false,-5 } wordentry_set Гл_О_предл={ rus_verbs:КРИЧАТЬ{}, // она кричала о смерти! (КРИЧАТЬ) rus_verbs:РАССПРОСИТЬ{}, // Я расспросил о нем нескольких горожан. (РАССПРОСИТЬ/РАССПРАШИВАТЬ) rus_verbs:РАССПРАШИВАТЬ{}, // rus_verbs:слушать{}, // ты будешь слушать о них? rus_verbs:вспоминать{}, // вспоминать о том разговоре ему было неприятно rus_verbs:МОЛЧАТЬ{}, // О чём молчат девушки (МОЛЧАТЬ) rus_verbs:ПЛАКАТЬ{}, // она плакала о себе (ПЛАКАТЬ) rus_verbs:сложить{}, // о вас сложены легенды rus_verbs:ВОЛНОВАТЬСЯ{}, // Я волнуюсь о том, что что-то серьёзно пошло не так (ВОЛНОВАТЬСЯ О) rus_verbs:УПОМЯНУТЬ{}, // упомянул о намерении команды приобрести несколько новых футболистов (УПОМЯНУТЬ О) rus_verbs:ОТЧИТЫВАТЬСЯ{}, // Судебные приставы продолжают отчитываться о борьбе с неплательщиками (ОТЧИТЫВАТЬСЯ О) rus_verbs:ДОЛОЖИТЬ{}, // провести тщательное расследование взрыва в маршрутном такси во Владикавказе и доложить о результатах (ДОЛОЖИТЬ О) rus_verbs:ПРОБОЛТАТЬ{}, // правительство страны больше проболтало о военной реформе (ПРОБОЛТАТЬ О) rus_verbs:ЗАБОТИТЬСЯ{}, // Четверть россиян заботятся о здоровье путем просмотра телевизора (ЗАБОТИТЬСЯ О) rus_verbs:ИРОНИЗИРОВАТЬ{}, // Вы иронизируете о ностальгии по тем временем (ИРОНИЗИРОВАТЬ О) rus_verbs:СИГНАЛИЗИРОВАТЬ{}, // Кризис цен на продукты питания сигнализирует о неминуемой гиперинфляции (СИГНАЛИЗИРОВАТЬ О) rus_verbs:СПРОСИТЬ{}, // Он спросил о моём здоровье. (СПРОСИТЬ О) rus_verbs:НАПОМНИТЬ{}, // больной зуб опять напомнил о себе. (НАПОМНИТЬ О) rus_verbs:осведомиться{}, // офицер осведомился о цели визита rus_verbs:объявить{}, // В газете объявили о конкурсе. (объявить о) rus_verbs:ПРЕДСТОЯТЬ{}, // о чем предстоит разговор? (ПРЕДСТОЯТЬ О) rus_verbs:объявлять{}, // объявлять о всеобщей забастовке (объявлять о) rus_verbs:зайти{}, // Разговор зашёл о политике. rus_verbs:порассказать{}, // порассказать о своих путешествиях инфинитив:спеть{ вид:соверш }, глагол:спеть{ вид:соверш }, // спеть о неразделенной любви деепричастие:спев{}, прилагательное:спевший{ вид:соверш }, прилагательное:спетый{}, rus_verbs:напеть{}, rus_verbs:разговаривать{}, // разговаривать с другом о жизни rus_verbs:рассуждать{}, // рассуждать об абстрактных идеях //rus_verbs:заботиться{}, // заботиться о престарелых родителях rus_verbs:раздумывать{}, // раздумывать о новой работе rus_verbs:договариваться{}, // договариваться о сумме компенсации rus_verbs:молить{}, // молить о пощаде rus_verbs:отзываться{}, // отзываться о книге rus_verbs:подумывать{}, // подумывать о новом подходе rus_verbs:поговаривать{}, // поговаривать о загадочном звере rus_verbs:обмолвиться{}, // обмолвиться о проклятии rus_verbs:условиться{}, // условиться о поддержке rus_verbs:призадуматься{}, // призадуматься о последствиях rus_verbs:известить{}, // известить о поступлении rus_verbs:отрапортовать{}, // отрапортовать об успехах rus_verbs:напевать{}, // напевать о любви rus_verbs:помышлять{}, // помышлять о новом деле rus_verbs:переговорить{}, // переговорить о правилах rus_verbs:повествовать{}, // повествовать о событиях rus_verbs:слыхивать{}, // слыхивать о чудище rus_verbs:потолковать{}, // потолковать о планах rus_verbs:проговориться{}, // проговориться о планах rus_verbs:умолчать{}, // умолчать о штрафах rus_verbs:хлопотать{}, // хлопотать о премии rus_verbs:уведомить{}, // уведомить о поступлении rus_verbs:горевать{}, // горевать о потере rus_verbs:запамятовать{}, // запамятовать о важном мероприятии rus_verbs:заикнуться{}, // заикнуться о прибавке rus_verbs:информировать{}, // информировать о событиях rus_verbs:проболтаться{}, // проболтаться о кладе rus_verbs:поразмыслить{}, // поразмыслить о судьбе rus_verbs:заикаться{}, // заикаться о деньгах rus_verbs:оповестить{}, // оповестить об отказе rus_verbs:печься{}, // печься о всеобщем благе rus_verbs:разглагольствовать{}, // разглагольствовать о правах rus_verbs:размечтаться{}, // размечтаться о будущем rus_verbs:лепетать{}, // лепетать о невиновности rus_verbs:грезить{}, // грезить о большой и чистой любви rus_verbs:залепетать{}, // залепетать о сокровищах rus_verbs:пронюхать{}, // пронюхать о бесплатной одежде rus_verbs:протрубить{}, // протрубить о победе rus_verbs:извещать{}, // извещать о поступлении rus_verbs:трубить{}, // трубить о поимке разбойников rus_verbs:осведомляться{}, // осведомляться о судьбе rus_verbs:поразмышлять{}, // поразмышлять о неизбежном rus_verbs:слагать{}, // слагать о подвигах викингов rus_verbs:ходатайствовать{}, // ходатайствовать о выделении материальной помощи rus_verbs:побеспокоиться{}, // побеспокоиться о правильном стимулировании rus_verbs:закидывать{}, // закидывать сообщениями об ошибках rus_verbs:базарить{}, // пацаны базарили о телках rus_verbs:балагурить{}, // мужики балагурили о новом председателе rus_verbs:балакать{}, // мужики балакали о новом председателе rus_verbs:беспокоиться{}, // Она беспокоится о детях rus_verbs:рассказать{}, // Кумир рассказал о криминале в Москве rus_verbs:возмечтать{}, // возмечтать о счастливом мире rus_verbs:вопить{}, // Кто-то вопил о несправедливости rus_verbs:сказать{}, // сказать что-то новое о ком-то rus_verbs:знать{}, // знать о ком-то что-то пикантное rus_verbs:подумать{}, // подумать о чём-то rus_verbs:думать{}, // думать о чём-то rus_verbs:узнать{}, // узнать о происшествии rus_verbs:помнить{}, // помнить о задании rus_verbs:просить{}, // просить о коде доступа rus_verbs:забыть{}, // забыть о своих обязанностях rus_verbs:сообщить{}, // сообщить о заложенной мине rus_verbs:заявить{}, // заявить о пропаже rus_verbs:задуматься{}, // задуматься о смерти rus_verbs:спрашивать{}, // спрашивать о поступлении товара rus_verbs:догадаться{}, // догадаться о причинах rus_verbs:договориться{}, // договориться о собеседовании rus_verbs:мечтать{}, // мечтать о сцене rus_verbs:поговорить{}, // поговорить о наболевшем rus_verbs:размышлять{}, // размышлять о насущном rus_verbs:напоминать{}, // напоминать о себе rus_verbs:пожалеть{}, // пожалеть о содеянном rus_verbs:ныть{}, // ныть о прибавке rus_verbs:сообщать{}, // сообщать о победе rus_verbs:догадываться{}, // догадываться о первопричине rus_verbs:поведать{}, // поведать о тайнах rus_verbs:умолять{}, // умолять о пощаде rus_verbs:сожалеть{}, // сожалеть о случившемся rus_verbs:жалеть{}, // жалеть о случившемся rus_verbs:забывать{}, // забывать о случившемся rus_verbs:упоминать{}, // упоминать о предках rus_verbs:позабыть{}, // позабыть о своем обещании rus_verbs:запеть{}, // запеть о любви rus_verbs:скорбеть{}, // скорбеть о усопшем rus_verbs:задумываться{}, // задумываться о смене работы rus_verbs:позаботиться{}, // позаботиться о престарелых родителях rus_verbs:докладывать{}, // докладывать о планах строительства целлюлозно-бумажного комбината rus_verbs:попросить{}, // попросить о замене rus_verbs:предупредить{}, // предупредить о замене rus_verbs:предупреждать{}, // предупреждать о замене rus_verbs:твердить{}, // твердить о замене rus_verbs:заявлять{}, // заявлять о подлоге rus_verbs:петь{}, // певица, поющая о лете rus_verbs:проинформировать{}, // проинформировать о переговорах rus_verbs:порассказывать{}, // порассказывать о событиях rus_verbs:послушать{}, // послушать о новинках rus_verbs:заговорить{}, // заговорить о плате rus_verbs:отозваться{}, // Он отозвался о книге с большой похвалой. rus_verbs:оставить{}, // Он оставил о себе печальную память. rus_verbs:свидетельствовать{}, // страшно исхудавшее тело свидетельствовало о долгих лишениях rus_verbs:спорить{}, // они спорили о законе глагол:написать{ aux stress="напис^ать" }, инфинитив:написать{ aux stress="напис^ать" }, // Он написал о том, что видел во время путешествия. глагол:писать{ aux stress="пис^ать" }, инфинитив:писать{ aux stress="пис^ать" }, // Он писал о том, что видел во время путешествия. rus_verbs:прочитать{}, // Я прочитал о тебе rus_verbs:услышать{}, // Я услышал о нем rus_verbs:помечтать{}, // Девочки помечтали о принце rus_verbs:слышать{}, // Мальчик слышал о приведениях rus_verbs:вспомнить{}, // Девочки вспомнили о завтраке rus_verbs:грустить{}, // Я грущу о тебе rus_verbs:осведомить{}, // о последних достижениях науки rus_verbs:рассказывать{}, // Антонио рассказывает о работе rus_verbs:говорить{}, // говорим о трех больших псах rus_verbs:идти{} // Вопрос идёт о войне. } fact гл_предл { if context { Гл_О_предл предлог:о{} *:*{ падеж:предл } } then return true } // Мы поделились впечатлениями о выставке. // ^^^^^^^^^^ ^^^^^^^^^^ fact гл_предл { if context { * предлог:о{} *:*{ падеж:предл } } then return false,-3 } fact гл_предл { if context { * предлог:о{} *:*{} } then return false,-5 } #endregion Предлог_О #region Предлог_ПО // ------------------- С ПРЕДЛОГОМ 'ПО' ---------------------- // для этих глаголов - запрещаем связывание с ПО+дат.п. wordentry_set Глаг_ПО_Дат_Запр= { rus_verbs:предпринять{}, // предпринять шаги по стимулированию продаж rus_verbs:увлечь{}, // увлечь в прогулку по парку rus_verbs:закончить{}, rus_verbs:мочь{}, rus_verbs:хотеть{} } fact гл_предл { if context { Глаг_ПО_Дат_Запр предлог:по{} *:*{ падеж:дат } } then return false,-10 } // По умолчанию разрешаем связывание в паттернах типа // Я иду по шоссе fact гл_предл { if context { * предлог:по{} *:*{ падеж:дат } } then return true } wordentry_set Глаг_ПО_Вин= { rus_verbs:ВОЙТИ{}, // лезвие вошло по рукоять (ВОЙТИ) rus_verbs:иметь{}, // все месяцы имели по тридцать дней. (ИМЕТЬ ПО) rus_verbs:материализоваться{}, // материализоваться по другую сторону барьера rus_verbs:засадить{}, // засадить по рукоятку rus_verbs:увязнуть{} // увязнуть по колено } fact гл_предл { if context { Глаг_ПО_Вин предлог:по{} *:*{ падеж:вин } } then return true } // для остальных падежей запрещаем. fact гл_предл { if context { * предлог:по{} *:*{ падеж:вин } } then return false,-5 } #endregion Предлог_ПО #region Предлог_К // ------------------- С ПРЕДЛОГОМ 'К' ---------------------- wordentry_set Гл_К_Дат={ rus_verbs:заявиться{}, // Сразу же после обеда к нам заявилась Юлия Михайловна. rus_verbs:приставлять{} , // Приставляет дуло пистолета к виску. прилагательное:НЕПРИГОДНЫЙ{}, // большинство компьютеров из этой партии оказались непригодными к эксплуатации (НЕПРИГОДНЫЙ) rus_verbs:СБЕГАТЬСЯ{}, // Они чуяли воду и сбегались к ней отовсюду. (СБЕГАТЬСЯ) rus_verbs:СБЕЖАТЬСЯ{}, // К бетонной скамье начали сбегаться люди. (СБЕГАТЬСЯ/СБЕЖАТЬСЯ) rus_verbs:ПРИТИРАТЬСЯ{}, // Менее стойких водителей буквально сметало на другую полосу, и они впритык притирались к другим машинам. (ПРИТИРАТЬСЯ) rus_verbs:РУХНУТЬ{}, // а потом ты без чувств рухнул к моим ногам (РУХНУТЬ) rus_verbs:ПЕРЕНЕСТИ{}, // Они перенесли мясо к ручью и поджарили его на костре. (ПЕРЕНЕСТИ) rus_verbs:ЗАВЕСТИ{}, // как путь мой завел меня к нему? (ЗАВЕСТИ) rus_verbs:НАГРЯНУТЬ{}, // ФБР нагрянуло с обыском к сестре бостонских террористов (НАГРЯНУТЬ) rus_verbs:ПРИСЛОНЯТЬСЯ{}, // Рабы ложились на пол, прислонялись к стене и спали. (ПРИСЛОНЯТЬСЯ,ПРИНОРАВЛИВАТЬСЯ,ПРИНОРОВИТЬСЯ) rus_verbs:ПРИНОРАВЛИВАТЬСЯ{}, // rus_verbs:ПРИНОРОВИТЬСЯ{}, // rus_verbs:СПЛАНИРОВАТЬ{}, // Вскоре она остановила свое падение и спланировала к ним. (СПЛАНИРОВАТЬ,СПИКИРОВАТЬ,РУХНУТЬ) rus_verbs:СПИКИРОВАТЬ{}, // rus_verbs:ЗАБРАТЬСЯ{}, // Поэтому он забрался ко мне в квартиру с имевшимся у него полумесяцем. (ЗАБРАТЬСЯ К, В, С) rus_verbs:ПРОТЯГИВАТЬ{}, // Оно протягивало свои длинные руки к молодому человеку, стоявшему на плоской вершине валуна. (ПРОТЯГИВАТЬ/ПРОТЯНУТЬ/ТЯНУТЬ) rus_verbs:ПРОТЯНУТЬ{}, // rus_verbs:ТЯНУТЬ{}, // rus_verbs:ПЕРЕБИРАТЬСЯ{}, // Ее губы медленно перебирались к его уху. (ПЕРЕБИРАТЬСЯ,ПЕРЕБРАТЬСЯ,ПЕРЕБАЗИРОВАТЬСЯ,ПЕРЕМЕСТИТЬСЯ,ПЕРЕМЕЩАТЬСЯ) rus_verbs:ПЕРЕБРАТЬСЯ{}, // ,,, rus_verbs:ПЕРЕБАЗИРОВАТЬСЯ{}, // rus_verbs:ПЕРЕМЕСТИТЬСЯ{}, // rus_verbs:ПЕРЕМЕЩАТЬСЯ{}, // rus_verbs:ТРОНУТЬСЯ{}, // Он отвернулся от нее и тронулся к пляжу. (ТРОНУТЬСЯ) rus_verbs:ПРИСТАВИТЬ{}, // Он поднял одну из них и приставил верхний конец к краю шахты в потолке. rus_verbs:ПРОБИТЬСЯ{}, // Отряд с невероятными приключениями, пытается пробиться к своему полку, попадает в плен и другие передряги (ПРОБИТЬСЯ) rus_verbs:хотеть{}, rus_verbs:СДЕЛАТЬ{}, // Сделайте всё к понедельнику (СДЕЛАТЬ) rus_verbs:ИСПЫТЫВАТЬ{}, // она испытывает ко мне только отвращение (ИСПЫТЫВАТЬ) rus_verbs:ОБЯЗЫВАТЬ{}, // Это меня ни к чему не обязывает (ОБЯЗЫВАТЬ) rus_verbs:КАРАБКАТЬСЯ{}, // карабкаться по горе от подножия к вершине (КАРАБКАТЬСЯ) rus_verbs:СТОЯТЬ{}, // мужчина стоял ко мне спиной (СТОЯТЬ) rus_verbs:ПОДАТЬСЯ{}, // наконец люк подался ко мне (ПОДАТЬСЯ) rus_verbs:ПРИРАВНЯТЬ{}, // Усилия нельзя приравнять к результату (ПРИРАВНЯТЬ) rus_verbs:ПРИРАВНИВАТЬ{}, // Усилия нельзя приравнивать к результату (ПРИРАВНИВАТЬ) rus_verbs:ВОЗЛОЖИТЬ{}, // Путин в Пскове возложил цветы к памятнику воинам-десантникам, погибшим в Чечне (ВОЗЛОЖИТЬ) rus_verbs:запустить{}, // Индия запустит к Марсу свой космический аппарат в 2013 г rus_verbs:ПРИСТЫКОВАТЬСЯ{}, // Роботизированный российский грузовой космический корабль пристыковался к МКС (ПРИСТЫКОВАТЬСЯ) rus_verbs:ПРИМАЗАТЬСЯ{}, // К челябинскому метеориту примазалась таинственная слизь (ПРИМАЗАТЬСЯ) rus_verbs:ПОПРОСИТЬ{}, // Попросите Лизу к телефону (ПОПРОСИТЬ К) rus_verbs:ПРОЕХАТЬ{}, // Порой школьные автобусы просто не имеют возможности проехать к некоторым населенным пунктам из-за бездорожья (ПРОЕХАТЬ К) rus_verbs:ПОДЦЕПЛЯТЬСЯ{}, // Вагоны с пассажирами подцепляются к составу (ПОДЦЕПЛЯТЬСЯ К) rus_verbs:ПРИЗВАТЬ{}, // Президент Афганистана призвал талибов к прямому диалогу (ПРИЗВАТЬ К) rus_verbs:ПРЕОБРАЗИТЬСЯ{}, // Культовый столичный отель преобразился к юбилею (ПРЕОБРАЗИТЬСЯ К) прилагательное:ЧУВСТВИТЕЛЬНЫЙ{}, // нейроны одного комплекса чувствительны к разным веществам (ЧУВСТВИТЕЛЬНЫЙ К) безлич_глагол:нужно{}, // нам нужно к воротам (НУЖНО К) rus_verbs:БРОСИТЬ{}, // огромный клюв бросил это мясо к моим ногам (БРОСИТЬ К) rus_verbs:ЗАКОНЧИТЬ{}, // к пяти утра техники закончили (ЗАКОНЧИТЬ К) rus_verbs:НЕСТИ{}, // к берегу нас несет! (НЕСТИ К) rus_verbs:ПРОДВИГАТЬСЯ{}, // племена медленно продвигались к востоку (ПРОДВИГАТЬСЯ К) rus_verbs:ОПУСКАТЬСЯ{}, // деревья опускались к самой воде (ОПУСКАТЬСЯ К) rus_verbs:СТЕМНЕТЬ{}, // к тому времени стемнело (СТЕМНЕЛО К) rus_verbs:ОТСКОЧИТЬ{}, // после отскочил к окну (ОТСКОЧИТЬ К) rus_verbs:ДЕРЖАТЬСЯ{}, // к солнцу держались спинами (ДЕРЖАТЬСЯ К) rus_verbs:КАЧНУТЬСЯ{}, // толпа качнулась к ступеням (КАЧНУТЬСЯ К) rus_verbs:ВОЙТИ{}, // Андрей вошел к себе (ВОЙТИ К) rus_verbs:ВЫБРАТЬСЯ{}, // мы выбрались к окну (ВЫБРАТЬСЯ К) rus_verbs:ПРОВЕСТИ{}, // провел к стене спальни (ПРОВЕСТИ К) rus_verbs:ВЕРНУТЬСЯ{}, // давай вернемся к делу (ВЕРНУТЬСЯ К) rus_verbs:ВОЗВРАТИТЬСЯ{}, // Среди евреев, живших в диаспоре, всегда было распространено сильное стремление возвратиться к Сиону (ВОЗВРАТИТЬСЯ К) rus_verbs:ПРИЛЕГАТЬ{}, // Задняя поверхность хрусталика прилегает к стекловидному телу (ПРИЛЕГАТЬ К) rus_verbs:ПЕРЕНЕСТИСЬ{}, // мысленно Алёна перенеслась к заливу (ПЕРЕНЕСТИСЬ К) rus_verbs:ПРОБИВАТЬСЯ{}, // сквозь болото к берегу пробивался ручей. (ПРОБИВАТЬСЯ К) rus_verbs:ПЕРЕВЕСТИ{}, // необходимо срочно перевести стадо к воде. (ПЕРЕВЕСТИ К) rus_verbs:ПРИЛЕТЕТЬ{}, // зачем ты прилетел к нам? (ПРИЛЕТЕТЬ К) rus_verbs:ДОБАВИТЬ{}, // добавить ли ее к остальным? (ДОБАВИТЬ К) rus_verbs:ПРИГОТОВИТЬ{}, // Матвей приготовил лук к бою. (ПРИГОТОВИТЬ К) rus_verbs:РВАНУТЬ{}, // человек рванул ее к себе. (РВАНУТЬ К) rus_verbs:ТАЩИТЬ{}, // они тащили меня к двери. (ТАЩИТЬ К) глагол:быть{}, // к тебе есть вопросы. прилагательное:равнодушный{}, // Он равнодушен к музыке. rus_verbs:ПОЖАЛОВАТЬ{}, // скандально известный певец пожаловал к нам на передачу (ПОЖАЛОВАТЬ К) rus_verbs:ПЕРЕСЕСТЬ{}, // Ольга пересела к Антону (ПЕРЕСЕСТЬ К) инфинитив:СБЕГАТЬ{ вид:соверш }, глагол:СБЕГАТЬ{ вид:соверш }, // сбегай к Борису (СБЕГАТЬ К) rus_verbs:ПЕРЕХОДИТЬ{}, // право хода переходит к Адаму (ПЕРЕХОДИТЬ К) rus_verbs:прижаться{}, // она прижалась щекой к его шее. (прижаться+к) rus_verbs:ПОДСКОЧИТЬ{}, // солдат быстро подскочил ко мне. (ПОДСКОЧИТЬ К) rus_verbs:ПРОБРАТЬСЯ{}, // нужно пробраться к реке. (ПРОБРАТЬСЯ К) rus_verbs:ГОТОВИТЬ{}, // нас готовили к этому. (ГОТОВИТЬ К) rus_verbs:ТЕЧЬ{}, // река текла к морю. (ТЕЧЬ К) rus_verbs:ОТШАТНУТЬСЯ{}, // епископ отшатнулся к стене. (ОТШАТНУТЬСЯ К) rus_verbs:БРАТЬ{}, // брали бы к себе. (БРАТЬ К) rus_verbs:СКОЛЬЗНУТЬ{}, // ковер скользнул к пещере. (СКОЛЬЗНУТЬ К) rus_verbs:присохнуть{}, // Грязь присохла к одежде. (присохнуть к) rus_verbs:просить{}, // Директор просит вас к себе. (просить к) rus_verbs:вызывать{}, // шеф вызывал к себе. (вызывать к) rus_verbs:присесть{}, // старик присел к огню. (присесть к) rus_verbs:НАКЛОНИТЬСЯ{}, // Ричард наклонился к брату. (НАКЛОНИТЬСЯ К) rus_verbs:выбираться{}, // будем выбираться к дороге. (выбираться к) rus_verbs:отвернуться{}, // Виктор отвернулся к стене. (отвернуться к) rus_verbs:СТИХНУТЬ{}, // огонь стих к полудню. (СТИХНУТЬ К) rus_verbs:УПАСТЬ{}, // нож упал к ногам. (УПАСТЬ К) rus_verbs:СЕСТЬ{}, // молча сел к огню. (СЕСТЬ К) rus_verbs:ХЛЫНУТЬ{}, // народ хлынул к стенам. (ХЛЫНУТЬ К) rus_verbs:покатиться{}, // они черной волной покатились ко мне. (покатиться к) rus_verbs:ОБРАТИТЬ{}, // она обратила к нему свое бледное лицо. (ОБРАТИТЬ К) rus_verbs:СКЛОНИТЬ{}, // Джон слегка склонил голову к плечу. (СКЛОНИТЬ К) rus_verbs:СВЕРНУТЬ{}, // дорожка резко свернула к южной стене. (СВЕРНУТЬ К) rus_verbs:ЗАВЕРНУТЬ{}, // Он завернул к нам по пути к месту службы. (ЗАВЕРНУТЬ К) rus_verbs:подходить{}, // цвет подходил ей к лицу. rus_verbs:БРЕСТИ{}, // Ричард покорно брел к отцу. (БРЕСТИ К) rus_verbs:ПОПАСТЬ{}, // хочешь попасть к нему? (ПОПАСТЬ К) rus_verbs:ПОДНЯТЬ{}, // Мартин поднял ружье к плечу. (ПОДНЯТЬ К) rus_verbs:ПОТЕРЯТЬ{}, // просто потеряла к нему интерес. (ПОТЕРЯТЬ К) rus_verbs:РАЗВЕРНУТЬСЯ{}, // они сразу развернулись ко мне. (РАЗВЕРНУТЬСЯ К) rus_verbs:ПОВЕРНУТЬ{}, // мальчик повернул к ним голову. (ПОВЕРНУТЬ К) rus_verbs:вызвать{}, // или вызвать к жизни? (вызвать к) rus_verbs:ВЫХОДИТЬ{}, // их земли выходят к морю. (ВЫХОДИТЬ К) rus_verbs:ЕХАТЬ{}, // мы долго ехали к вам. (ЕХАТЬ К) rus_verbs:опуститься{}, // Алиса опустилась к самому дну. (опуститься к) rus_verbs:подняться{}, // они молча поднялись к себе. (подняться к) rus_verbs:ДВИНУТЬСЯ{}, // толстяк тяжело двинулся к ним. (ДВИНУТЬСЯ К) rus_verbs:ПОПЯТИТЬСЯ{}, // ведьмак осторожно попятился к лошади. (ПОПЯТИТЬСЯ К) rus_verbs:РИНУТЬСЯ{}, // мышелов ринулся к черной стене. (РИНУТЬСЯ К) rus_verbs:ТОЛКНУТЬ{}, // к этому толкнул ее ты. (ТОЛКНУТЬ К) rus_verbs:отпрыгнуть{}, // Вадим поспешно отпрыгнул к борту. (отпрыгнуть к) rus_verbs:отступить{}, // мы поспешно отступили к стене. (отступить к) rus_verbs:ЗАБРАТЬ{}, // мы забрали их к себе. (ЗАБРАТЬ к) rus_verbs:ВЗЯТЬ{}, // потом возьму тебя к себе. (ВЗЯТЬ К) rus_verbs:лежать{}, // наш путь лежал к ним. (лежать к) rus_verbs:поползти{}, // ее рука поползла к оружию. (поползти к) rus_verbs:требовать{}, // вас требует к себе император. (требовать к) rus_verbs:поехать{}, // ты должен поехать к нему. (поехать к) rus_verbs:тянуться{}, // мордой животное тянулось к земле. (тянуться к) rus_verbs:ЖДАТЬ{}, // жди их завтра к утру. (ЖДАТЬ К) rus_verbs:ПОЛЕТЕТЬ{}, // они стремительно полетели к земле. (ПОЛЕТЕТЬ К) rus_verbs:подойти{}, // помоги мне подойти к столу. (подойти к) rus_verbs:РАЗВЕРНУТЬ{}, // мужик развернул к нему коня. (РАЗВЕРНУТЬ К) rus_verbs:ПРИВЕЗТИ{}, // нас привезли прямо к королю. (ПРИВЕЗТИ К) rus_verbs:отпрянуть{}, // незнакомец отпрянул к стене. (отпрянуть к) rus_verbs:побежать{}, // Cергей побежал к двери. (побежать к) rus_verbs:отбросить{}, // сильный удар отбросил его к стене. (отбросить к) rus_verbs:ВЫНУДИТЬ{}, // они вынудили меня к сотрудничеству (ВЫНУДИТЬ К) rus_verbs:подтянуть{}, // он подтянул к себе стул и сел на него (подтянуть к) rus_verbs:сойти{}, // по узкой тропинке путники сошли к реке. (сойти к) rus_verbs:являться{}, // по ночам к нему являлись призраки. (являться к) rus_verbs:ГНАТЬ{}, // ледяной ветер гнал их к югу. (ГНАТЬ К) rus_verbs:ВЫВЕСТИ{}, // она вывела нас точно к месту. (ВЫВЕСТИ К) rus_verbs:выехать{}, // почти сразу мы выехали к реке. rus_verbs:пододвигаться{}, // пододвигайся к окну rus_verbs:броситься{}, // большая часть защитников стен бросилась к воротам. rus_verbs:представить{}, // Его представили к ордену. rus_verbs:двигаться{}, // между тем чудище неторопливо двигалось к берегу. rus_verbs:выскочить{}, // тем временем они выскочили к реке. rus_verbs:выйти{}, // тем временем они вышли к лестнице. rus_verbs:потянуть{}, // Мальчик схватил верёвку и потянул её к себе. rus_verbs:приложить{}, // приложить к детали повышенное усилие rus_verbs:пройти{}, // пройти к стойке регистрации (стойка регистрации - проверить проверку) rus_verbs:отнестись{}, // отнестись к животным с сочуствием rus_verbs:привязать{}, // привязать за лапу веревкой к колышку, воткнутому в землю rus_verbs:прыгать{}, // прыгать к хозяину на стол rus_verbs:приглашать{}, // приглашать к доктору rus_verbs:рваться{}, // Чужие люди рвутся к власти rus_verbs:понестись{}, // понестись к обрыву rus_verbs:питать{}, // питать привязанность к алкоголю rus_verbs:заехать{}, // Коля заехал к Оле rus_verbs:переехать{}, // переехать к родителям rus_verbs:ползти{}, // ползти к дороге rus_verbs:сводиться{}, // сводиться к элементарному действию rus_verbs:добавлять{}, // добавлять к общей сумме rus_verbs:подбросить{}, // подбросить к потолку rus_verbs:призывать{}, // призывать к спокойствию rus_verbs:пробираться{}, // пробираться к партизанам rus_verbs:отвезти{}, // отвезти к родителям rus_verbs:применяться{}, // применяться к уравнению rus_verbs:сходиться{}, // сходиться к точному решению rus_verbs:допускать{}, // допускать к сдаче зачета rus_verbs:свести{}, // свести к нулю rus_verbs:придвинуть{}, // придвинуть к мальчику rus_verbs:подготовить{}, // подготовить к печати rus_verbs:подобраться{}, // подобраться к оленю rus_verbs:заторопиться{}, // заторопиться к выходу rus_verbs:пристать{}, // пристать к берегу rus_verbs:поманить{}, // поманить к себе rus_verbs:припасть{}, // припасть к алтарю rus_verbs:притащить{}, // притащить к себе домой rus_verbs:прижимать{}, // прижимать к груди rus_verbs:подсесть{}, // подсесть к симпатичной девочке rus_verbs:придвинуться{}, // придвинуться к окну rus_verbs:отпускать{}, // отпускать к другу rus_verbs:пригнуться{}, // пригнуться к земле rus_verbs:пристроиться{}, // пристроиться к колонне rus_verbs:сгрести{}, // сгрести к себе rus_verbs:удрать{}, // удрать к цыганам rus_verbs:прибавиться{}, // прибавиться к общей сумме rus_verbs:присмотреться{}, // присмотреться к покупке rus_verbs:подкатить{}, // подкатить к трюму rus_verbs:клонить{}, // клонить ко сну rus_verbs:проследовать{}, // проследовать к выходу rus_verbs:пододвинуть{}, // пододвинуть к себе rus_verbs:применять{}, // применять к сотрудникам rus_verbs:прильнуть{}, // прильнуть к экранам rus_verbs:подвинуть{}, // подвинуть к себе rus_verbs:примчаться{}, // примчаться к папе rus_verbs:подкрасться{}, // подкрасться к жертве rus_verbs:привязаться{}, // привязаться к собаке rus_verbs:забирать{}, // забирать к себе rus_verbs:прорваться{}, // прорваться к кассе rus_verbs:прикасаться{}, // прикасаться к коже rus_verbs:уносить{}, // уносить к себе rus_verbs:подтянуться{}, // подтянуться к месту rus_verbs:привозить{}, // привозить к ветеринару rus_verbs:подползти{}, // подползти к зайцу rus_verbs:приблизить{}, // приблизить к глазам rus_verbs:применить{}, // применить к уравнению простое преобразование rus_verbs:приглядеться{}, // приглядеться к изображению rus_verbs:приложиться{}, // приложиться к ручке rus_verbs:приставать{}, // приставать к девчонкам rus_verbs:запрещаться{}, // запрещаться к показу rus_verbs:прибегать{}, // прибегать к насилию rus_verbs:побудить{}, // побудить к действиям rus_verbs:притягивать{}, // притягивать к себе rus_verbs:пристроить{}, // пристроить к полезному делу rus_verbs:приговорить{}, // приговорить к смерти rus_verbs:склоняться{}, // склоняться к прекращению разработки rus_verbs:подъезжать{}, // подъезжать к вокзалу rus_verbs:привалиться{}, // привалиться к забору rus_verbs:наклоняться{}, // наклоняться к щенку rus_verbs:подоспеть{}, // подоспеть к обеду rus_verbs:прилипнуть{}, // прилипнуть к окну rus_verbs:приволочь{}, // приволочь к себе rus_verbs:устремляться{}, // устремляться к вершине rus_verbs:откатиться{}, // откатиться к исходным позициям rus_verbs:побуждать{}, // побуждать к действиям rus_verbs:прискакать{}, // прискакать к кормежке rus_verbs:присматриваться{}, // присматриваться к новичку rus_verbs:прижиматься{}, // прижиматься к борту rus_verbs:жаться{}, // жаться к огню rus_verbs:передвинуть{}, // передвинуть к окну rus_verbs:допускаться{}, // допускаться к экзаменам rus_verbs:прикрепить{}, // прикрепить к корпусу rus_verbs:отправлять{}, // отправлять к специалистам rus_verbs:перебежать{}, // перебежать к врагам rus_verbs:притронуться{}, // притронуться к реликвии rus_verbs:заспешить{}, // заспешить к семье rus_verbs:ревновать{}, // ревновать к сопернице rus_verbs:подступить{}, // подступить к горлу rus_verbs:уводить{}, // уводить к ветеринару rus_verbs:побросать{}, // побросать к ногам rus_verbs:подаваться{}, // подаваться к ужину rus_verbs:приписывать{}, // приписывать к достижениям rus_verbs:относить{}, // относить к растениям rus_verbs:принюхаться{}, // принюхаться к ароматам rus_verbs:подтащить{}, // подтащить к себе rus_verbs:прислонить{}, // прислонить к стене rus_verbs:подплыть{}, // подплыть к бую rus_verbs:опаздывать{}, // опаздывать к стилисту rus_verbs:примкнуть{}, // примкнуть к деомнстрантам rus_verbs:стекаться{}, // стекаются к стенам тюрьмы rus_verbs:подготовиться{}, // подготовиться к марафону rus_verbs:приглядываться{}, // приглядываться к новичку rus_verbs:присоединяться{}, // присоединяться к сообществу rus_verbs:клониться{}, // клониться ко сну rus_verbs:привыкать{}, // привыкать к хорошему rus_verbs:принудить{}, // принудить к миру rus_verbs:уплыть{}, // уплыть к далекому берегу rus_verbs:утащить{}, // утащить к детенышам rus_verbs:приплыть{}, // приплыть к финишу rus_verbs:подбегать{}, // подбегать к хозяину rus_verbs:лишаться{}, // лишаться средств к существованию rus_verbs:приступать{}, // приступать к операции rus_verbs:пробуждать{}, // пробуждать лекцией интерес к математике rus_verbs:подключить{}, // подключить к трубе rus_verbs:подключиться{}, // подключиться к сети rus_verbs:прилить{}, // прилить к лицу rus_verbs:стучаться{}, // стучаться к соседям rus_verbs:пристегнуть{}, // пристегнуть к креслу rus_verbs:присоединить{}, // присоединить к сети rus_verbs:отбежать{}, // отбежать к противоположной стене rus_verbs:подвезти{}, // подвезти к набережной rus_verbs:прибегнуть{}, // прибегнуть к хитрости rus_verbs:приучить{}, // приучить к туалету rus_verbs:подталкивать{}, // подталкивать к выходу rus_verbs:прорываться{}, // прорываться к выходу rus_verbs:увозить{}, // увозить к ветеринару rus_verbs:засеменить{}, // засеменить к выходу rus_verbs:крепиться{}, // крепиться к потолку rus_verbs:прибрать{}, // прибрать к рукам rus_verbs:пристраститься{}, // пристраститься к наркотикам rus_verbs:поспеть{}, // поспеть к обеду rus_verbs:привязывать{}, // привязывать к дереву rus_verbs:прилагать{}, // прилагать к документам rus_verbs:переправить{}, // переправить к дедушке rus_verbs:подогнать{}, // подогнать к воротам rus_verbs:тяготеть{}, // тяготеть к социализму rus_verbs:подбираться{}, // подбираться к оленю rus_verbs:подступать{}, // подступать к горлу rus_verbs:примыкать{}, // примыкать к первому элементу rus_verbs:приладить{}, // приладить к велосипеду rus_verbs:подбрасывать{}, // подбрасывать к потолку rus_verbs:перевозить{}, // перевозить к новому месту дислокации rus_verbs:усаживаться{}, // усаживаться к окну rus_verbs:приближать{}, // приближать к глазам rus_verbs:попроситься{}, // попроситься к бабушке rus_verbs:прибить{}, // прибить к доске rus_verbs:перетащить{}, // перетащить к себе rus_verbs:прицепить{}, // прицепить к паровозу rus_verbs:прикладывать{}, // прикладывать к ране rus_verbs:устареть{}, // устареть к началу войны rus_verbs:причалить{}, // причалить к пристани rus_verbs:приспособиться{}, // приспособиться к опозданиям rus_verbs:принуждать{}, // принуждать к миру rus_verbs:соваться{}, // соваться к директору rus_verbs:протолкаться{}, // протолкаться к прилавку rus_verbs:приковать{}, // приковать к батарее rus_verbs:подкрадываться{}, // подкрадываться к суслику rus_verbs:подсадить{}, // подсадить к арестонту rus_verbs:прикатить{}, // прикатить к финишу rus_verbs:протащить{}, // протащить к владыке rus_verbs:сужаться{}, // сужаться к основанию rus_verbs:присовокупить{}, // присовокупить к пожеланиям rus_verbs:пригвоздить{}, // пригвоздить к доске rus_verbs:отсылать{}, // отсылать к первоисточнику rus_verbs:изготовиться{}, // изготовиться к прыжку rus_verbs:прилагаться{}, // прилагаться к покупке rus_verbs:прицепиться{}, // прицепиться к вагону rus_verbs:примешиваться{}, // примешиваться к вину rus_verbs:переселить{}, // переселить к старшекурсникам rus_verbs:затрусить{}, // затрусить к выходе rus_verbs:приспособить{}, // приспособить к обогреву rus_verbs:примериться{}, // примериться к аппарату rus_verbs:прибавляться{}, // прибавляться к пенсии rus_verbs:подкатиться{}, // подкатиться к воротам rus_verbs:стягивать{}, // стягивать к границе rus_verbs:дописать{}, // дописать к роману rus_verbs:подпустить{}, // подпустить к корове rus_verbs:склонять{}, // склонять к сотрудничеству rus_verbs:припечатать{}, // припечатать к стене rus_verbs:охладеть{}, // охладеть к музыке rus_verbs:пришить{}, // пришить к шинели rus_verbs:принюхиваться{}, // принюхиваться к ветру rus_verbs:подрулить{}, // подрулить к барышне rus_verbs:наведаться{}, // наведаться к оракулу rus_verbs:клеиться{}, // клеиться к конверту rus_verbs:перетянуть{}, // перетянуть к себе rus_verbs:переметнуться{}, // переметнуться к конкурентам rus_verbs:липнуть{}, // липнуть к сокурсницам rus_verbs:поковырять{}, // поковырять к выходу rus_verbs:подпускать{}, // подпускать к пульту управления rus_verbs:присосаться{}, // присосаться к источнику rus_verbs:приклеить{}, // приклеить к стеклу rus_verbs:подтягивать{}, // подтягивать к себе rus_verbs:подкатывать{}, // подкатывать к даме rus_verbs:притрагиваться{}, // притрагиваться к опухоли rus_verbs:слетаться{}, // слетаться к водопою rus_verbs:хаживать{}, // хаживать к батюшке rus_verbs:привлекаться{}, // привлекаться к административной ответственности rus_verbs:подзывать{}, // подзывать к себе rus_verbs:прикладываться{}, // прикладываться к иконе rus_verbs:подтягиваться{}, // подтягиваться к парламенту rus_verbs:прилепить{}, // прилепить к стенке холодильника rus_verbs:пододвинуться{}, // пододвинуться к экрану rus_verbs:приползти{}, // приползти к дереву rus_verbs:запаздывать{}, // запаздывать к обеду rus_verbs:припереть{}, // припереть к стене rus_verbs:нагибаться{}, // нагибаться к цветку инфинитив:сгонять{ вид:соверш }, глагол:сгонять{ вид:соверш }, // сгонять к воротам деепричастие:сгоняв{}, rus_verbs:поковылять{}, // поковылять к выходу rus_verbs:привалить{}, // привалить к столбу rus_verbs:отпроситься{}, // отпроситься к родителям rus_verbs:приспосабливаться{}, // приспосабливаться к новым условиям rus_verbs:прилипать{}, // прилипать к рукам rus_verbs:подсоединить{}, // подсоединить к приборам rus_verbs:приливать{}, // приливать к голове rus_verbs:подселить{}, // подселить к другим новичкам rus_verbs:прилепиться{}, // прилепиться к шкуре rus_verbs:подлетать{}, // подлетать к пункту назначения rus_verbs:пристегнуться{}, // пристегнуться к креслу ремнями rus_verbs:прибиться{}, // прибиться к стае, улетающей на юг rus_verbs:льнуть{}, // льнуть к заботливому хозяину rus_verbs:привязываться{}, // привязываться к любящему хозяину rus_verbs:приклеиться{}, // приклеиться к спине rus_verbs:стягиваться{}, // стягиваться к сенату rus_verbs:подготавливать{}, // подготавливать к выходу на арену rus_verbs:приглашаться{}, // приглашаться к доктору rus_verbs:причислять{}, // причислять к отличникам rus_verbs:приколоть{}, // приколоть к лацкану rus_verbs:наклонять{}, // наклонять к горизонту rus_verbs:припадать{}, // припадать к первоисточнику rus_verbs:приобщиться{}, // приобщиться к культурному наследию rus_verbs:придираться{}, // придираться к мелким ошибкам rus_verbs:приучать{}, // приучать к лотку rus_verbs:промотать{}, // промотать к началу rus_verbs:прихлынуть{}, // прихлынуть к голове rus_verbs:пришвартоваться{}, // пришвартоваться к первому пирсу rus_verbs:прикрутить{}, // прикрутить к велосипеду rus_verbs:подплывать{}, // подплывать к лодке rus_verbs:приравниваться{}, // приравниваться к побегу rus_verbs:подстрекать{}, // подстрекать к вооруженной борьбе с оккупантами rus_verbs:изготовляться{}, // изготовляться к прыжку из стратосферы rus_verbs:приткнуться{}, // приткнуться к первой группе туристов rus_verbs:приручить{}, // приручить котика к лотку rus_verbs:приковывать{}, // приковывать к себе все внимание прессы rus_verbs:приготовляться{}, // приготовляться к первому экзамену rus_verbs:остыть{}, // Вода остынет к утру. rus_verbs:приехать{}, // Он приедет к концу будущей недели. rus_verbs:подсаживаться{}, rus_verbs:успевать{}, // успевать к стилисту rus_verbs:привлекать{}, // привлекать к себе внимание прилагательное:устойчивый{}, // переводить в устойчивую к перегреву форму rus_verbs:прийтись{}, // прийтись ко двору инфинитив:адаптировать{вид:несоверш}, // машина была адаптирована к условиям крайнего севера инфинитив:адаптировать{вид:соверш}, глагол:адаптировать{вид:несоверш}, глагол:адаптировать{вид:соверш}, деепричастие:адаптировав{}, деепричастие:адаптируя{}, прилагательное:адаптирующий{}, прилагательное:адаптировавший{ вид:соверш }, //+прилагательное:адаптировавший{ вид:несоверш }, прилагательное:адаптированный{}, инфинитив:адаптироваться{вид:соверш}, // тело адаптировалось к условиям суровой зимы инфинитив:адаптироваться{вид:несоверш}, глагол:адаптироваться{вид:соверш}, глагол:адаптироваться{вид:несоверш}, деепричастие:адаптировавшись{}, деепричастие:адаптируясь{}, прилагательное:адаптировавшийся{вид:соверш}, //+прилагательное:адаптировавшийся{вид:несоверш}, прилагательное:адаптирующийся{}, rus_verbs:апеллировать{}, // оратор апеллировал к патриотизму своих слушателей rus_verbs:близиться{}, // Шторм близится к побережью rus_verbs:доставить{}, // Эскиз ракеты, способной доставить корабль к Луне rus_verbs:буксировать{}, // Буксир буксирует танкер к месту стоянки rus_verbs:причислить{}, // Мы причислили его к числу экспертов rus_verbs:вести{}, // Наша партия ведет народ к процветанию rus_verbs:взывать{}, // Учителя взывают к совести хулигана rus_verbs:воззвать{}, // воззвать соплеменников к оружию rus_verbs:возревновать{}, // возревновать к поклонникам rus_verbs:воспылать{}, // Коля воспылал к Оле страстной любовью rus_verbs:восходить{}, // восходить к вершине rus_verbs:восшествовать{}, // восшествовать к вершине rus_verbs:успеть{}, // успеть к обеду rus_verbs:повернуться{}, // повернуться к кому-то rus_verbs:обратиться{}, // обратиться к охраннику rus_verbs:звать{}, // звать к столу rus_verbs:отправиться{}, // отправиться к парикмахеру rus_verbs:обернуться{}, // обернуться к зовущему rus_verbs:явиться{}, // явиться к следователю rus_verbs:уехать{}, // уехать к родне rus_verbs:прибыть{}, // прибыть к перекличке rus_verbs:привыкнуть{}, // привыкнуть к голоду rus_verbs:уходить{}, // уходить к цыганам rus_verbs:привести{}, // привести к себе rus_verbs:шагнуть{}, // шагнуть к славе rus_verbs:относиться{}, // относиться к прежним периодам rus_verbs:подослать{}, // подослать к врагам rus_verbs:поспешить{}, // поспешить к обеду rus_verbs:зайти{}, // зайти к подруге rus_verbs:позвать{}, // позвать к себе rus_verbs:потянуться{}, // потянуться к рычагам rus_verbs:пускать{}, // пускать к себе rus_verbs:отвести{}, // отвести к врачу rus_verbs:приблизиться{}, // приблизиться к решению задачи rus_verbs:прижать{}, // прижать к стене rus_verbs:отправить{}, // отправить к доктору rus_verbs:падать{}, // падать к многолетним минимумам rus_verbs:полезть{}, // полезть к дерущимся rus_verbs:лезть{}, // Ты сама ко мне лезла! rus_verbs:направить{}, // направить к майору rus_verbs:приводить{}, // приводить к дантисту rus_verbs:кинуться{}, // кинуться к двери rus_verbs:поднести{}, // поднести к глазам rus_verbs:подниматься{}, // подниматься к себе rus_verbs:прибавить{}, // прибавить к результату rus_verbs:зашагать{}, // зашагать к выходу rus_verbs:склониться{}, // склониться к земле rus_verbs:стремиться{}, // стремиться к вершине rus_verbs:лететь{}, // лететь к родственникам rus_verbs:ездить{}, // ездить к любовнице rus_verbs:приближаться{}, // приближаться к финише rus_verbs:помчаться{}, // помчаться к стоматологу rus_verbs:прислушаться{}, // прислушаться к происходящему rus_verbs:изменить{}, // изменить к лучшему собственную жизнь rus_verbs:проявить{}, // проявить к погибшим сострадание rus_verbs:подбежать{}, // подбежать к упавшему rus_verbs:терять{}, // терять к партнерам доверие rus_verbs:пропустить{}, // пропустить к певцу rus_verbs:подвести{}, // подвести к глазам rus_verbs:меняться{}, // меняться к лучшему rus_verbs:заходить{}, // заходить к другу rus_verbs:рвануться{}, // рвануться к воде rus_verbs:привлечь{}, // привлечь к себе внимание rus_verbs:присоединиться{}, // присоединиться к сети rus_verbs:приезжать{}, // приезжать к дедушке rus_verbs:дернуться{}, // дернуться к борту rus_verbs:подъехать{}, // подъехать к воротам rus_verbs:готовиться{}, // готовиться к дождю rus_verbs:убежать{}, // убежать к маме rus_verbs:поднимать{}, // поднимать к источнику сигнала rus_verbs:отослать{}, // отослать к руководителю rus_verbs:приготовиться{}, // приготовиться к худшему rus_verbs:приступить{}, // приступить к выполнению обязанностей rus_verbs:метнуться{}, // метнуться к фонтану rus_verbs:прислушиваться{}, // прислушиваться к голосу разума rus_verbs:побрести{}, // побрести к выходу rus_verbs:мчаться{}, // мчаться к успеху rus_verbs:нестись{}, // нестись к обрыву rus_verbs:попадать{}, // попадать к хорошему костоправу rus_verbs:опоздать{}, // опоздать к психотерапевту rus_verbs:посылать{}, // посылать к доктору rus_verbs:поплыть{}, // поплыть к берегу rus_verbs:подтолкнуть{}, // подтолкнуть к активной работе rus_verbs:отнести{}, // отнести животное к ветеринару rus_verbs:прислониться{}, // прислониться к стволу rus_verbs:наклонить{}, // наклонить к миске с молоком rus_verbs:прикоснуться{}, // прикоснуться к поверхности rus_verbs:увезти{}, // увезти к бабушке rus_verbs:заканчиваться{}, // заканчиваться к концу путешествия rus_verbs:подозвать{}, // подозвать к себе rus_verbs:улететь{}, // улететь к теплым берегам rus_verbs:ложиться{}, // ложиться к мужу rus_verbs:убираться{}, // убираться к чертовой бабушке rus_verbs:класть{}, // класть к другим документам rus_verbs:доставлять{}, // доставлять к подъезду rus_verbs:поворачиваться{}, // поворачиваться к источнику шума rus_verbs:заглядывать{}, // заглядывать к любовнице rus_verbs:занести{}, // занести к заказчикам rus_verbs:прибежать{}, // прибежать к папе rus_verbs:притянуть{}, // притянуть к причалу rus_verbs:переводить{}, // переводить в устойчивую к перегреву форму rus_verbs:подать{}, // он подал лимузин к подъезду rus_verbs:подавать{}, // она подавала соус к мясу rus_verbs:приобщаться{}, // приобщаться к культуре прилагательное:неспособный{}, // Наша дочка неспособна к учению. прилагательное:неприспособленный{}, // Эти устройства неприспособлены к работе в жару прилагательное:предназначенный{}, // Старый дом предназначен к сносу. прилагательное:внимательный{}, // Она всегда внимательна к гостям. прилагательное:назначенный{}, // Дело назначено к докладу. прилагательное:разрешенный{}, // Эта книга разрешена к печати. прилагательное:снисходительный{}, // Этот учитель снисходителен к ученикам. прилагательное:готовый{}, // Я готов к экзаменам. прилагательное:требовательный{}, // Он очень требователен к себе. прилагательное:жадный{}, // Он жаден к деньгам. прилагательное:глухой{}, // Он глух к моей просьбе. прилагательное:добрый{}, // Он добр к детям. rus_verbs:проявлять{}, // Он всегда проявлял живой интерес к нашим делам. rus_verbs:плыть{}, // Пароход плыл к берегу. rus_verbs:пойти{}, // я пошел к доктору rus_verbs:придти{}, // придти к выводу rus_verbs:заглянуть{}, // Я заглянул к вам мимоходом. rus_verbs:принадлежать{}, // Это существо принадлежит к разряду растений. rus_verbs:подготавливаться{}, // Ученики подготавливаются к экзаменам. rus_verbs:спускаться{}, // Улица круто спускается к реке. rus_verbs:спуститься{}, // Мы спустились к реке. rus_verbs:пустить{}, // пускать ко дну rus_verbs:приговаривать{}, // Мы приговариваем тебя к пожизненному веселью! rus_verbs:отойти{}, // Дом отошёл к племяннику. rus_verbs:отходить{}, // Коля отходил ко сну. rus_verbs:приходить{}, // местные жители к нему приходили лечиться rus_verbs:кидаться{}, // не кидайся к столу rus_verbs:ходить{}, // Она простудилась и сегодня ходила к врачу. rus_verbs:закончиться{}, // Собрание закончилось к вечеру. rus_verbs:послать{}, // Они выбрали своих депутатов и послали их к заведующему. rus_verbs:направиться{}, // Мы сошли на берег и направились к городу. rus_verbs:направляться{}, rus_verbs:свестись{}, // Всё свелось к нулю. rus_verbs:прислать{}, // Пришлите кого-нибудь к ней. rus_verbs:присылать{}, // Он присылал к должнику своих головорезов rus_verbs:подлететь{}, // Самолёт подлетел к лесу. rus_verbs:возвращаться{}, // он возвращается к старой работе глагол:находиться{ вид:несоверш }, инфинитив:находиться{ вид:несоверш }, деепричастие:находясь{}, прилагательное:находившийся{}, прилагательное:находящийся{}, // Япония находится к востоку от Китая. rus_verbs:возвращать{}, // возвращать к жизни rus_verbs:располагать{}, // Атмосфера располагает к работе. rus_verbs:возвратить{}, // Колокольный звон возвратил меня к прошлому. rus_verbs:поступить{}, // К нам поступила жалоба. rus_verbs:поступать{}, // К нам поступают жалобы. rus_verbs:прыгнуть{}, // Белка прыгнула к дереву rus_verbs:торопиться{}, // пассажиры торопятся к выходу rus_verbs:поторопиться{}, // поторопитесь к выходу rus_verbs:вернуть{}, // вернуть к активной жизни rus_verbs:припирать{}, // припирать к стенке rus_verbs:проваливать{}, // Проваливай ко всем чертям! rus_verbs:вбежать{}, // Коля вбежал ко мне rus_verbs:вбегать{}, // Коля вбегал ко мне глагол:забегать{ вид:несоверш }, // Коля забегал ко мне rus_verbs:постучаться{}, // Коля постучался ко мне. rus_verbs:повести{}, // Спросил я озорного Антонио и повел его к дому rus_verbs:понести{}, // Мы понесли кота к ветеринару rus_verbs:принести{}, // Я принес кота к ветеринару rus_verbs:устремиться{}, // Мы устремились к ручью. rus_verbs:подводить{}, // Учитель подводил детей к аквариуму rus_verbs:следовать{}, // Я получил приказ следовать к месту нового назначения. rus_verbs:пригласить{}, // Я пригласил к себе товарищей. rus_verbs:собираться{}, // Я собираюсь к тебе в гости. rus_verbs:собраться{}, // Маша собралась к дантисту rus_verbs:сходить{}, // Я схожу к врачу. rus_verbs:идти{}, // Маша уверенно шла к Пете rus_verbs:измениться{}, // Основные индексы рынка акций РФ почти не изменились к закрытию. rus_verbs:отыграть{}, // Российский рынок акций отыграл падение к закрытию. rus_verbs:заканчивать{}, // Заканчивайте к обеду rus_verbs:обращаться{}, // Обращайтесь ко мне в любое время rus_verbs:окончить{}, // rus_verbs:дозвониться{}, // Я не мог к вам дозвониться. глагол:прийти{}, инфинитив:прийти{}, // Антонио пришел к Элеонор rus_verbs:уйти{}, // Антонио ушел к Элеонор rus_verbs:бежать{}, // Антонио бежит к Элеонор rus_verbs:спешить{}, // Антонио спешит к Элеонор rus_verbs:скакать{}, // Антонио скачет к Элеонор rus_verbs:красться{}, // Антонио крадётся к Элеонор rus_verbs:поскакать{}, // беглецы поскакали к холмам rus_verbs:перейти{} // Антонио перешел к Элеонор } fact гл_предл { if context { Гл_К_Дат предлог:к{} *:*{ падеж:дат } } then return true } fact гл_предл { if context { Гл_К_Дат предлог:к{} @regex("[a-z]+[0-9]*") } then return true } // для остальных падежей запрещаем. fact гл_предл { if context { * предлог:к{} *:*{} } then return false,-5 } #endregion Предлог_К #region Предлог_ДЛЯ // ------------------- С ПРЕДЛОГОМ 'ДЛЯ' ---------------------- wordentry_set Гл_ДЛЯ_Род={ частица:нет{}, // для меня нет других путей. частица:нету{}, rus_verbs:ЗАДЕРЖАТЬ{}, // полиция может задержать их для выяснения всех обстоятельств и дальнейшего опознания. (ЗАДЕРЖАТЬ) rus_verbs:ДЕЛАТЬСЯ{}, // это делалось для людей (ДЕЛАТЬСЯ) rus_verbs:обернуться{}, // обернулась для греческого рынка труда банкротствами предприятий и масштабными сокращениями (обернуться) rus_verbs:ПРЕДНАЗНАЧАТЬСЯ{}, // Скорее всего тяжелый клинок вообще не предназначался для бросков (ПРЕДНАЗНАЧАТЬСЯ) rus_verbs:ПОЛУЧИТЬ{}, // ты можешь получить его для нас? (ПОЛУЧИТЬ) rus_verbs:ПРИДУМАТЬ{}, // Ваш босс уже придумал для нас веселенькую смерть. (ПРИДУМАТЬ) rus_verbs:оказаться{}, // это оказалось для них тяжелой задачей rus_verbs:ГОВОРИТЬ{}, // теперь она говорила для нас обоих (ГОВОРИТЬ) rus_verbs:ОСВОБОДИТЬ{}, // освободить ее для тебя? (ОСВОБОДИТЬ) rus_verbs:работать{}, // Мы работаем для тех, кто ценит удобство rus_verbs:СТАТЬ{}, // кем она станет для него? (СТАТЬ) rus_verbs:ЯВИТЬСЯ{}, // вы для этого явились сюда? (ЯВИТЬСЯ) rus_verbs:ПОТЕРЯТЬ{}, // жизнь потеряла для меня всякий смысл (ПОТЕРЯТЬ) rus_verbs:УТРАТИТЬ{}, // мой мир утратил для меня всякое подобие смысла (УТРАТИТЬ) rus_verbs:ДОСТАТЬ{}, // ты должен достать ее для меня! (ДОСТАТЬ) rus_verbs:БРАТЬ{}, // некоторые берут для себя (БРАТЬ) rus_verbs:ИМЕТЬ{}, // имею для вас новость (ИМЕТЬ) rus_verbs:ЖДАТЬ{}, // тебя ждут для разговора (ЖДАТЬ) rus_verbs:ПРОПАСТЬ{}, // совсем пропал для мира (ПРОПАСТЬ) rus_verbs:ПОДНЯТЬ{}, // нас подняли для охоты (ПОДНЯТЬ) rus_verbs:ОСТАНОВИТЬСЯ{}, // время остановилось для нее (ОСТАНОВИТЬСЯ) rus_verbs:НАЧИНАТЬСЯ{}, // для него начинается новая жизнь (НАЧИНАТЬСЯ) rus_verbs:КОНЧИТЬСЯ{}, // кончились для него эти игрушки (КОНЧИТЬСЯ) rus_verbs:НАСТАТЬ{}, // для него настало время действовать (НАСТАТЬ) rus_verbs:СТРОИТЬ{}, // для молодых строили новый дом (СТРОИТЬ) rus_verbs:ВЗЯТЬ{}, // возьми для защиты этот меч (ВЗЯТЬ) rus_verbs:ВЫЯСНИТЬ{}, // попытаюсь выяснить для вас всю цепочку (ВЫЯСНИТЬ) rus_verbs:ПРИГОТОВИТЬ{}, // давай попробуем приготовить для них сюрприз (ПРИГОТОВИТЬ) rus_verbs:ПОДХОДИТЬ{}, // берег моря мертвых подходил для этого идеально (ПОДХОДИТЬ) rus_verbs:ОСТАТЬСЯ{}, // внешний вид этих тварей остался для нас загадкой (ОСТАТЬСЯ) rus_verbs:ПРИВЕЗТИ{}, // для меня привезли пиво (ПРИВЕЗТИ) прилагательное:ХАРАКТЕРНЫЙ{}, // Для всей территории края характерен умеренный континентальный климат (ХАРАКТЕРНЫЙ) rus_verbs:ПРИВЕСТИ{}, // для меня белую лошадь привели (ПРИВЕСТИ ДЛЯ) rus_verbs:ДЕРЖАТЬ{}, // их держат для суда (ДЕРЖАТЬ ДЛЯ) rus_verbs:ПРЕДОСТАВИТЬ{}, // вьетнамец предоставил для мигрантов места проживания в ряде вологодских общежитий (ПРЕДОСТАВИТЬ ДЛЯ) rus_verbs:ПРИДУМЫВАТЬ{}, // придумывая для этого разнообразные причины (ПРИДУМЫВАТЬ ДЛЯ) rus_verbs:оставить{}, // или вообще решили оставить планету для себя rus_verbs:оставлять{}, rus_verbs:ВОССТАНОВИТЬ{}, // как ты можешь восстановить это для меня? (ВОССТАНОВИТЬ ДЛЯ) rus_verbs:ТАНЦЕВАТЬ{}, // а вы танцевали для меня танец семи покрывал (ТАНЦЕВАТЬ ДЛЯ) rus_verbs:ДАТЬ{}, // твой принц дал мне это для тебя! (ДАТЬ ДЛЯ) rus_verbs:ВОСПОЛЬЗОВАТЬСЯ{}, // мужчина из лагеря решил воспользоваться для передвижения рекой (ВОСПОЛЬЗОВАТЬСЯ ДЛЯ) rus_verbs:СЛУЖИТЬ{}, // они служили для разговоров (СЛУЖИТЬ ДЛЯ) rus_verbs:ИСПОЛЬЗОВАТЬСЯ{}, // Для вычисления радиуса поражения ядерных взрывов используется формула (ИСПОЛЬЗОВАТЬСЯ ДЛЯ) rus_verbs:ПРИМЕНЯТЬСЯ{}, // Применяется для изготовления алкогольных коктейлей (ПРИМЕНЯТЬСЯ ДЛЯ) rus_verbs:СОВЕРШАТЬСЯ{}, // Для этого совершался специальный магический обряд (СОВЕРШАТЬСЯ ДЛЯ) rus_verbs:ПРИМЕНИТЬ{}, // а здесь попробуем применить ее для других целей. (ПРИМЕНИТЬ ДЛЯ) rus_verbs:ПОЗВАТЬ{}, // ты позвал меня для настоящей работы. (ПОЗВАТЬ ДЛЯ) rus_verbs:НАЧАТЬСЯ{}, // очередной денек начался для Любки неудачно (НАЧАТЬСЯ ДЛЯ) rus_verbs:ПОСТАВИТЬ{}, // вас здесь для красоты поставили? (ПОСТАВИТЬ ДЛЯ) rus_verbs:умереть{}, // или умерла для всяких чувств? (умереть для) rus_verbs:ВЫБРАТЬ{}, // ты сам выбрал для себя этот путь. (ВЫБРАТЬ ДЛЯ) rus_verbs:ОТМЕТИТЬ{}, // тот же отметил для себя другое. (ОТМЕТИТЬ ДЛЯ) rus_verbs:УСТРОИТЬ{}, // мы хотим устроить для них школу. (УСТРОИТЬ ДЛЯ) rus_verbs:БЫТЬ{}, // у меня есть для тебя работа. (БЫТЬ ДЛЯ) rus_verbs:ВЫЙТИ{}, // для всего нашего поколения так вышло. (ВЫЙТИ ДЛЯ) прилагательное:ВАЖНЫЙ{}, // именно твое мнение для нас крайне важно. (ВАЖНЫЙ ДЛЯ) прилагательное:НУЖНЫЙ{}, // для любого племени нужна прежде всего сила. (НУЖЕН ДЛЯ) прилагательное:ДОРОГОЙ{}, // эти места были дороги для них обоих. (ДОРОГОЙ ДЛЯ) rus_verbs:НАСТУПИТЬ{}, // теперь для больших людей наступило время действий. (НАСТУПИТЬ ДЛЯ) rus_verbs:ДАВАТЬ{}, // старый пень давал для этого хороший огонь. (ДАВАТЬ ДЛЯ) rus_verbs:ГОДИТЬСЯ{}, // доброе старое время годится лишь для воспоминаний. (ГОДИТЬСЯ ДЛЯ) rus_verbs:ТЕРЯТЬ{}, // время просто теряет для вас всякое значение. (ТЕРЯТЬ ДЛЯ) rus_verbs:ЖЕНИТЬСЯ{}, // настало время жениться для пользы твоего клана. (ЖЕНИТЬСЯ ДЛЯ) rus_verbs:СУЩЕСТВОВАТЬ{}, // весь мир перестал существовать для них обоих. (СУЩЕСТВОВАТЬ ДЛЯ) rus_verbs:ЖИТЬ{}, // жить для себя или жить для них. (ЖИТЬ ДЛЯ) rus_verbs:открыть{}, // двери моего дома всегда открыты для вас. (ОТКРЫТЫЙ ДЛЯ) rus_verbs:закрыть{}, // этот мир будет закрыт для них. (ЗАКРЫТЫЙ ДЛЯ) rus_verbs:ТРЕБОВАТЬСЯ{}, // для этого требуется огромное количество энергии. (ТРЕБОВАТЬСЯ ДЛЯ) rus_verbs:РАЗОРВАТЬ{}, // Алексей разорвал для этого свою рубаху. (РАЗОРВАТЬ ДЛЯ) rus_verbs:ПОДОЙТИ{}, // вполне подойдет для начала нашей экспедиции. (ПОДОЙТИ ДЛЯ) прилагательное:опасный{}, // сильный холод опасен для открытой раны. (ОПАСЕН ДЛЯ) rus_verbs:ПРИЙТИ{}, // для вас пришло очень важное сообщение. (ПРИЙТИ ДЛЯ) rus_verbs:вывести{}, // мы специально вывели этих животных для мяса. rus_verbs:убрать{}, // В вагонах метро для комфорта пассажиров уберут сиденья (УБРАТЬ В, ДЛЯ) rus_verbs:оставаться{}, // механизм этого воздействия остается для меня загадкой. (остается для) rus_verbs:ЯВЛЯТЬСЯ{}, // Чай является для китайцев обычным ежедневным напитком (ЯВЛЯТЬСЯ ДЛЯ) rus_verbs:ПРИМЕНЯТЬ{}, // Для оценок будущих изменений климата применяют модели общей циркуляции атмосферы. (ПРИМЕНЯТЬ ДЛЯ) rus_verbs:ПОВТОРЯТЬ{}, // повторяю для Пети (ПОВТОРЯТЬ ДЛЯ) rus_verbs:УПОТРЕБЛЯТЬ{}, // Краски, употребляемые для живописи (УПОТРЕБЛЯТЬ ДЛЯ) rus_verbs:ВВЕСТИ{}, // Для злостных нарушителей предложили ввести повышенные штрафы (ВВЕСТИ ДЛЯ) rus_verbs:найтись{}, // у вас найдется для него работа? rus_verbs:заниматься{}, // они занимаются этим для развлечения. (заниматься для) rus_verbs:заехать{}, // Коля заехал для обсуждения проекта rus_verbs:созреть{}, // созреть для побега rus_verbs:наметить{}, // наметить для проверки rus_verbs:уяснить{}, // уяснить для себя rus_verbs:нанимать{}, // нанимать для разовой работы rus_verbs:приспособить{}, // приспособить для удовольствия rus_verbs:облюбовать{}, // облюбовать для посиделок rus_verbs:прояснить{}, // прояснить для себя rus_verbs:задействовать{}, // задействовать для патрулирования rus_verbs:приготовлять{}, // приготовлять для проверки инфинитив:использовать{ вид:соверш }, // использовать для достижения цели инфинитив:использовать{ вид:несоверш }, глагол:использовать{ вид:соверш }, глагол:использовать{ вид:несоверш }, прилагательное:использованный{}, деепричастие:используя{}, деепричастие:использовав{}, rus_verbs:напрячься{}, // напрячься для решительного рывка rus_verbs:одобрить{}, // одобрить для использования rus_verbs:одобрять{}, // одобрять для использования rus_verbs:пригодиться{}, // пригодиться для тестирования rus_verbs:готовить{}, // готовить для выхода в свет rus_verbs:отобрать{}, // отобрать для участия в конкурсе rus_verbs:потребоваться{}, // потребоваться для подтверждения rus_verbs:пояснить{}, // пояснить для слушателей rus_verbs:пояснять{}, // пояснить для экзаменаторов rus_verbs:понадобиться{}, // понадобиться для обоснования инфинитив:адаптировать{вид:несоверш}, // машина была адаптирована для условий крайнего севера инфинитив:адаптировать{вид:соверш}, глагол:адаптировать{вид:несоверш}, глагол:адаптировать{вид:соверш}, деепричастие:адаптировав{}, деепричастие:адаптируя{}, прилагательное:адаптирующий{}, прилагательное:адаптировавший{ вид:соверш }, //+прилагательное:адаптировавший{ вид:несоверш }, прилагательное:адаптированный{}, rus_verbs:найти{}, // Папа нашел для детей няню прилагательное:вредный{}, // Это вредно для здоровья. прилагательное:полезный{}, // Прогулки полезны для здоровья. прилагательное:обязательный{}, // Этот пункт обязателен для исполнения прилагательное:бесполезный{}, // Это лекарство бесполезно для него прилагательное:необходимый{}, // Это лекарство необходимо для выздоровления rus_verbs:создать{}, // Он не создан для этого дела. прилагательное:сложный{}, // задача сложна для младших школьников прилагательное:несложный{}, прилагательное:лёгкий{}, прилагательное:сложноватый{}, rus_verbs:становиться{}, rus_verbs:представлять{}, // Это не представляет для меня интереса. rus_verbs:значить{}, // Я рос в деревне и хорошо знал, что для деревенской жизни значат пруд или речка rus_verbs:пройти{}, // День прошёл спокойно для него. rus_verbs:проходить{}, rus_verbs:высадиться{}, // большой злой пират и его отчаянные помощники высадились на необитаемом острове для поиска зарытых сокровищ rus_verbs:высаживаться{}, rus_verbs:прибавлять{}, // Он любит прибавлять для красного словца. rus_verbs:прибавить{}, rus_verbs:составить{}, // Ряд тригонометрических таблиц был составлен для астрономических расчётов. rus_verbs:составлять{}, rus_verbs:стараться{}, // Я старался для вас rus_verbs:постараться{}, // Я постарался для вас rus_verbs:сохраниться{}, // Старик хорошо сохранился для своего возраста. rus_verbs:собраться{}, // собраться для обсуждения rus_verbs:собираться{}, // собираться для обсуждения rus_verbs:уполномочивать{}, rus_verbs:уполномочить{}, // его уполномочили для ведения переговоров rus_verbs:принести{}, // Я принёс эту книгу для вас. rus_verbs:делать{}, // Я это делаю для удовольствия. rus_verbs:сделать{}, // Я сделаю это для удовольствия. rus_verbs:подготовить{}, // я подготовил для друзей сюрприз rus_verbs:подготавливать{}, // я подготавливаю для гостей новый сюрприз rus_verbs:закупить{}, // Руководство района обещало закупить новые комбайны для нашего села rus_verbs:купить{}, // Руководство района обещало купить новые комбайны для нашего села rus_verbs:прибыть{} // они прибыли для участия } fact гл_предл { if context { Гл_ДЛЯ_Род предлог:для{} *:*{ падеж:род } } then return true } fact гл_предл { if context { Гл_ДЛЯ_Род предлог:для{} @regex("[a-z]+[0-9]*") } then return true } // для остальных падежей запрещаем. fact гл_предл { if context { * предлог:для{} *:*{} } then return false,-4 } #endregion Предлог_ДЛЯ #region Предлог_ОТ // попробуем иную стратегию - запретить связывание с ОТ для отдельных глаголов, разрешив для всех остальных. wordentry_set Глаг_ОТ_Род_Запр= { rus_verbs:наслаждаться{}, // свободой от обязательств rus_verbs:насладиться{}, rus_verbs:мочь{}, // Он не мог удержаться от смеха. // rus_verbs:хотеть{}, rus_verbs:желать{}, rus_verbs:чувствовать{}, // все время от времени чувствуют его. rus_verbs:планировать{}, rus_verbs:приняться{} // мы принялись обниматься от радости. } fact гл_предл { if context { Глаг_ОТ_Род_Запр предлог:от{} * } then return false } #endregion Предлог_ОТ #region Предлог_БЕЗ /* // запретить связывание с БЕЗ для отдельных глаголов, разрешив для всех остальных. wordentry_set Глаг_БЕЗ_Род_Запр= { rus_verbs:мочь{}, // Он мог читать часами без отдыха. rus_verbs:хотеть{}, rus_verbs:желать{}, rus_verbs:планировать{}, rus_verbs:приняться{} } fact гл_предл { if context { Глаг_БЕЗ_Род_Запр предлог:без{} * } then return false } */ #endregion Предлог_БЕЗ #region Предлог_КРОМЕ fact гл_предл { if context { * ПредлогДляВсе * } then return false,-5 } #endregion Предлог_КРОМЕ // ------------------------------------ // По умолчанию разрешаем все остальные сочетания. fact гл_предл { if context { * * * } then return true }
В Европе сахар был известен ещё римлянам. (ИЗВЕСТНЫЙ В)
прилагательное:известный{},
5,481,047
[ 1, 145, 245, 225, 145, 248, 145, 115, 146, 227, 145, 127, 145, 128, 145, 118, 225, 146, 228, 145, 113, 146, 232, 145, 113, 146, 227, 225, 145, 114, 146, 238, 145, 124, 225, 145, 121, 145, 120, 145, 115, 145, 118, 146, 228, 146, 229, 145, 118, 145, 126, 225, 145, 118, 146, 236, 146, 244, 225, 146, 227, 145, 121, 145, 125, 145, 124, 146, 242, 145, 126, 145, 113, 145, 125, 18, 261, 145, 251, 145, 250, 145, 245, 145, 248, 145, 99, 145, 100, 145, 256, 145, 109, 145, 252, 225, 145, 245, 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 ]
[ 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, 0 ]
[ 1, 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, 30, 145, 121, 145, 120, 145, 115, 145, 118, 146, 228, 146, 229, 145, 126, 146, 238, 145, 122, 2916, 16, 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 ]
pragma solidity ^0.4.22; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || 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; /** * @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 transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { if (newOwner != address(0)) { owner = newOwner; } } } /** * @title Haltable * * @dev Abstract contract that allows children to implement an * emergency stop mechanism. Differs from Pausable by requiring a state. * * * Originally envisioned in FirstBlood ICO contract. */ contract Haltable is Ownable { bool public halted; modifier inNormalState { assert(!halted); _; } modifier inEmergencyState { assert(halted); _; } // called by the owner on emergency, triggers stopped state function halt() external onlyOwner inNormalState { halted = true; } // called by the owner on end of emergency, returns to normal state function resume() external onlyOwner inEmergencyState { halted = false; } } /** * @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 constant 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 constant 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; /* Transfer token for a specified address */ function transfer(address _to, uint256 _value) public returns (bool) { 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 A uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public 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 FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping(address => mapping(address => uint256)) public 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) { uint256 _allowance; _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met // require (_value <= _allowance); balances[_to] = balances[_to].add(_value); balances[_from] = balances[_from].sub(_value); allowed[_from][msg.sender] = _allowance.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. * @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) { // 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; 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 specifing the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { return allowed[_owner][_spender]; } } /** * @title Burnable * * @dev Standard ERC20 token */ contract Burnable is StandardToken { using SafeMath for uint; /* This notifies clients about the amount burnt */ event Burn(address indexed from, uint256 value); function burn(uint256 _value) public returns (bool success) { require(balances[msg.sender] >= _value); // Check if the sender has enough balances[msg.sender] = balances[msg.sender].sub(_value); // Subtract from the sender totalSupply = totalSupply.sub(_value); // Updates totalSupply emit Burn(msg.sender, _value); return true; } function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balances[_from] >= _value); // Check if the sender has enough require(_value <= allowed[_from][msg.sender]); // Check allowance balances[_from] = balances[_from].sub(_value); // Subtract from the sender totalSupply = totalSupply.sub(_value); // Updates totalSupply allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Burn(_from, _value); return true; } function transfer(address _to, uint _value) public returns (bool success) { require(_to != 0x0); //use burn return super.transfer(_to, _value); } function transferFrom(address _from, address _to, uint _value) public returns (bool success) { require(_to != 0x0); //use burn return super.transferFrom(_from, _to, _value); } } /** * @title Centive Token * * @dev Burnable Ownable ERC20 token */ contract Centive is Burnable, Ownable { string public name; string public symbol; uint8 public decimals = 18; /* The finalizer contract that removes the transfer restrictions imposed by the lockout period */ address public releaseAgent; /** A crowdsale contract can release us to the wild if ICO success. * If false we are are in transfer lock up period. * */ bool public released = false; /** Map of agents that are allowed to transfer tokens regardless of the lock down period. * These are crowdsale contracts and possible the team multisig itself. * */ mapping(address => bool) public transferAgents; /** * Limit token transfer until the crowdsale is over. * */ modifier canTransfer(address _sender) { require(transferAgents[_sender] || released); _; } /** The function can be called only before or after the tokens have been releasesd */ modifier inReleaseState(bool releaseState) { require(releaseState == released); _; } /** The function can be called only by a whitelisted release agent. */ modifier onlyReleaseAgent() { require(msg.sender == releaseAgent); _; } /** @dev Constructor that gives msg.sender all of existing tokens. */ constructor(uint256 initialSupply, string tokenName, string tokenSymbol) public { totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount balances[msg.sender] = totalSupply; // Give the creator all initial tokens name = tokenName; // Set the name for display purposes symbol = tokenSymbol; // Set the symbol for display purposes } /** * Set the contract that can call release and make the token transferable. * * Design choice. Allow reset the release agent to fix fat finger mistakes. */ function setReleaseAgent(address addr) external onlyOwner inReleaseState(false) { // We don't do interface check here as we might want to a normal wallet address to act as a release agent releaseAgent = addr; } function release() external onlyReleaseAgent inReleaseState(false) { released = true; } /** * Owner can allow a particular address (a crowdsale contract) to transfer tokens despite the lock up period. */ function setTransferAgent(address addr, bool state) external onlyOwner inReleaseState(false) { transferAgents[addr] = state; } function transfer(address _to, uint _value) public canTransfer(msg.sender) returns (bool success) { // Call Burnable.transfer() return super.transfer(_to, _value); } function transferFrom(address _from, address _to, uint _value) public canTransfer(_from) returns (bool success) { // Call Burnable.transferForm() return super.transferFrom(_from, _to, _value); } function burn(uint256 _value) public onlyOwner returns (bool success) { return super.burn(_value); } function burnFrom(address _from, uint256 _value) public onlyOwner returns (bool success) { return super.burnFrom(_from, _value); } }
* @title Centive Token @dev Burnable Ownable ERC20 token/
contract Centive is Burnable, Ownable { string public name; string public symbol; uint8 public decimals = 18; address public releaseAgent; bool public released = false; mapping(address => bool) public transferAgents; modifier canTransfer(address _sender) { require(transferAgents[_sender] || released); _; } modifier inReleaseState(bool releaseState) { require(releaseState == released); _; } modifier onlyReleaseAgent() { require(msg.sender == releaseAgent); _; } constructor(uint256 initialSupply, string tokenName, string tokenSymbol) public { totalSupply = initialSupply * 10 ** uint256(decimals); balances[msg.sender] = totalSupply; name = tokenName; symbol = tokenSymbol; } function setReleaseAgent(address addr) external onlyOwner inReleaseState(false) { releaseAgent = addr; } function release() external onlyReleaseAgent inReleaseState(false) { released = true; } function setTransferAgent(address addr, bool state) external onlyOwner inReleaseState(false) { transferAgents[addr] = state; } function transfer(address _to, uint _value) public canTransfer(msg.sender) returns (bool success) { return super.transfer(_to, _value); } function transferFrom(address _from, address _to, uint _value) public canTransfer(_from) returns (bool success) { return super.transferFrom(_from, _to, _value); } function burn(uint256 _value) public onlyOwner returns (bool success) { return super.burn(_value); } function burnFrom(address _from, uint256 _value) public onlyOwner returns (bool success) { return super.burnFrom(_from, _value); } }
14,873,120
[ 1, 15897, 688, 3155, 225, 605, 321, 429, 14223, 6914, 4232, 39, 3462, 1147, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 22321, 688, 353, 605, 321, 429, 16, 14223, 6914, 288, 203, 203, 565, 533, 1071, 508, 31, 203, 565, 533, 1071, 3273, 31, 203, 565, 2254, 28, 1071, 15105, 273, 6549, 31, 203, 203, 565, 1758, 1071, 3992, 3630, 31, 203, 203, 565, 1426, 1071, 15976, 273, 629, 31, 203, 203, 565, 2874, 12, 2867, 516, 1426, 13, 1071, 7412, 23400, 31, 203, 203, 565, 9606, 848, 5912, 12, 2867, 389, 15330, 13, 288, 203, 3639, 2583, 12, 13866, 23400, 63, 67, 15330, 65, 747, 15976, 1769, 203, 3639, 389, 31, 203, 565, 289, 203, 203, 565, 9606, 316, 7391, 1119, 12, 6430, 3992, 1119, 13, 288, 203, 3639, 2583, 12, 9340, 1119, 422, 15976, 1769, 203, 3639, 389, 31, 203, 565, 289, 203, 203, 565, 9606, 1338, 7391, 3630, 1435, 288, 203, 3639, 2583, 12, 3576, 18, 15330, 422, 3992, 3630, 1769, 203, 3639, 389, 31, 203, 565, 289, 203, 203, 565, 3885, 12, 11890, 5034, 2172, 3088, 1283, 16, 533, 1147, 461, 16, 533, 1147, 5335, 13, 1071, 288, 203, 3639, 2078, 3088, 1283, 273, 2172, 3088, 1283, 380, 1728, 2826, 2254, 5034, 12, 31734, 1769, 203, 3639, 324, 26488, 63, 3576, 18, 15330, 65, 273, 2078, 3088, 1283, 31, 203, 3639, 508, 273, 1147, 461, 31, 203, 3639, 3273, 273, 1147, 5335, 31, 203, 565, 289, 203, 203, 565, 445, 444, 7391, 3630, 12, 2867, 3091, 13, 3903, 1338, 5541, 316, 7391, 1119, 12, 5743, 13, 288, 203, 203, 3639, 3992, 3630, 273, 3091, 31, 203, 565, 289, 203, 203, 2 ]
./full_match/1/0x25d0ADB52A32af633da44E912883C9A2C887f93D/sources/Trexcoin.sol
* Constrctor function Initializes contract with initial supply tokens to the creator of the contract/
constructor() public { name = "Trexcoin"; symbol = "TREX"; decimals = 18; _totalSupply = 10000000000000000000000000000; balances[msg.sender] = _totalSupply; emit Transfer(address(0), msg.sender, _totalSupply); }
2,938,278
[ 1, 442, 701, 30206, 445, 10188, 3128, 6835, 598, 2172, 14467, 2430, 358, 326, 11784, 434, 326, 6835, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3885, 1435, 1071, 288, 203, 3639, 508, 273, 315, 56, 266, 6511, 885, 14432, 203, 3639, 3273, 273, 315, 56, 862, 60, 14432, 203, 3639, 15105, 273, 6549, 31, 203, 3639, 389, 4963, 3088, 1283, 273, 2130, 12648, 12648, 2787, 9449, 31, 203, 203, 3639, 324, 26488, 63, 3576, 18, 15330, 65, 273, 389, 4963, 3088, 1283, 31, 203, 3639, 3626, 12279, 12, 2867, 12, 20, 3631, 1234, 18, 15330, 16, 389, 4963, 3088, 1283, 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 ]
pragma solidity ^0.4.23; contract CSC { mapping (address => uint256) private balances; mapping (address => uint256[2]) private lockedBalances; string public name; //fancy name: eg Simon Bucks uint8 public decimals; //How many decimals to show. string public symbol; //An identifier: eg SBX uint256 public totalSupply; address public owner; uint256 private icoLockUntil = 1543593540; event Transfer(address indexed _from, address indexed _to, uint256 _value); constructor( uint256 _initialAmount, string _tokenName, uint8 _decimalUnits, string _tokenSymbol, address _owner, address[] _lockedAddress, uint256[] _lockedBalances, uint256[] _lockedTimes ) public { balances[_owner] = _initialAmount; // Give the owner all initial tokens totalSupply = _initialAmount; // Update total supply name = _tokenName; // Set the name for display purposes decimals = _decimalUnits; // Amount of decimals for display purposes symbol = _tokenSymbol; // Set the symbol for display purposes owner = _owner; // set owner for(uint i = 0;i < _lockedAddress.length;i++){ lockedBalances[_lockedAddress[i]][0] = _lockedBalances[i]; lockedBalances[_lockedAddress[i]][1] = _lockedTimes[i]; } } /*外部直投和空投 */ /*转账 会检测是否有锁仓限额和期限 */ function transfer(address _to, uint256 _value) public returns (bool success) { //当ICO未完成时,除owner外禁止转账 require(msg.sender == owner || icoLockUntil < now); if(_to != address(0)){ if(lockedBalances[msg.sender][1] >= now) { require((balances[msg.sender] > lockedBalances[msg.sender][0]) && (balances[msg.sender] - lockedBalances[msg.sender][0] >= _value)); } else { require(balances[msg.sender] >= _value); } balances[msg.sender] -= _value; balances[_to] += _value; emit Transfer(msg.sender, _to, _value); return true; } } /*从某地址摧毁某数量的代币并减少总供应量 需要拥有者权限 */ function burnFrom(address _who,uint256 _value)public returns (bool){ require(msg.sender == owner); assert(balances[_who] >= _value); totalSupply -= _value; balances[_who] -= _value; lockedBalances[_who][0] = 0; lockedBalances[_who][1] = 0; return true; } /*铸币到创始者账户并增加总供应量 需要拥有者权限 */ function makeCoin(uint256 _value)public returns (bool){ require(msg.sender == owner); totalSupply += _value; balances[owner] += _value; return true; } /*设置ICO锁仓到期时间,需要拥有管理者权限 */ function setIcoLockUntil(uint256 _until) public{ require(msg.sender == owner); icoLockUntil = _until; } function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } /*将合约中的ETH提取到创始者地址中 需求拥有者权限 */ function withdraw() public{ require(msg.sender == owner); msg.sender.transfer(address(this).balance); } /*将合约中的ETH提取到某个地址中 需求拥有者权限 */ function withdrawTo(address _to) public{ require(msg.sender == owner); address(_to).transfer(address(this).balance); } }
设置ICO锁仓到期时间,需要拥有管理者权限/
function setIcoLockUntil(uint256 _until) public{ require(msg.sender == owner); icoLockUntil = _until; }
10,553,516
[ 1, 169, 111, 127, 168, 126, 111, 2871, 51, 170, 247, 228, 165, 124, 246, 166, 235, 113, 167, 255, 258, 167, 250, 119, 170, 250, 117, 176, 125, 239, 170, 255, 227, 169, 104, 228, 167, 238, 103, 167, 255, 236, 168, 111, 99, 168, 243, 233, 169, 227, 232, 167, 256, 230, 170, 252, 243, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 20691, 2894, 2531, 9716, 12, 11890, 5034, 389, 12198, 13, 1071, 95, 203, 3639, 2583, 12, 3576, 18, 15330, 422, 3410, 1769, 203, 3639, 277, 2894, 2531, 9716, 273, 389, 12198, 31, 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 ]
// optimizer: 4289999999 // SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.6.12; // File @boringcrypto/boring-solidity/contracts/libraries/[email protected] // License-Identifier: MIT /// @notice A library for performing overflow-/underflow-safe math, /// updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math). library BoringMath { function add(uint256 a, uint256 b) internal pure returns (uint256 c) { require((c = a + b) >= b, "BoringMath: Add Overflow"); } function sub(uint256 a, uint256 b) internal pure returns (uint256 c) { require((c = a - b) <= a, "BoringMath: Underflow"); } function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { require(b == 0 || (c = a * b) / b == a, "BoringMath: Mul Overflow"); } function to128(uint256 a) internal pure returns (uint128 c) { require(a <= uint128(-1), "BoringMath: uint128 Overflow"); c = uint128(a); } function to64(uint256 a) internal pure returns (uint64 c) { require(a <= uint64(-1), "BoringMath: uint64 Overflow"); c = uint64(a); } function to32(uint256 a) internal pure returns (uint32 c) { require(a <= uint32(-1), "BoringMath: uint32 Overflow"); c = uint32(a); } } /// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint128. library BoringMath128 { function add(uint128 a, uint128 b) internal pure returns (uint128 c) { require((c = a + b) >= b, "BoringMath: Add Overflow"); } function sub(uint128 a, uint128 b) internal pure returns (uint128 c) { require((c = a - b) <= a, "BoringMath: Underflow"); } } /// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint64. library BoringMath64 { function add(uint64 a, uint64 b) internal pure returns (uint64 c) { require((c = a + b) >= b, "BoringMath: Add Overflow"); } function sub(uint64 a, uint64 b) internal pure returns (uint64 c) { require((c = a - b) <= a, "BoringMath: Underflow"); } } /// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint32. library BoringMath32 { function add(uint32 a, uint32 b) internal pure returns (uint32 c) { require((c = a + b) >= b, "BoringMath: Add Overflow"); } function sub(uint32 a, uint32 b) internal pure returns (uint32 c) { require((c = a - b) <= a, "BoringMath: Underflow"); } } // File @boringcrypto/boring-solidity/contracts/interfaces/[email protected] // License-Identifier: MIT interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); /// @notice EIP 2612 function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; } // File @boringcrypto/boring-solidity/contracts/libraries/[email protected] // License-Identifier: MIT // solhint-disable avoid-low-level-calls library BoringERC20 { bytes4 private constant SIG_SYMBOL = 0x95d89b41; // symbol() bytes4 private constant SIG_NAME = 0x06fdde03; // name() bytes4 private constant SIG_DECIMALS = 0x313ce567; // decimals() bytes4 private constant SIG_BALANCE_OF = 0x70a08231; // balanceOf(address) bytes4 private constant SIG_TRANSFER = 0xa9059cbb; // transfer(address,uint256) bytes4 private constant SIG_TRANSFER_FROM = 0x23b872dd; // transferFrom(address,address,uint256) function returnDataToString(bytes memory data) internal pure returns (string memory) { if (data.length >= 64) { return abi.decode(data, (string)); } else if (data.length == 32) { uint8 i = 0; while(i < 32 && data[i] != 0) { i++; } bytes memory bytesArray = new bytes(i); for (i = 0; i < 32 && data[i] != 0; i++) { bytesArray[i] = data[i]; } return string(bytesArray); } else { return "???"; } } /// @notice Provides a safe ERC20.symbol version which returns '???' as fallback string. /// @param token The address of the ERC-20 token contract. /// @return (string) Token symbol. function safeSymbol(IERC20 token) internal view returns (string memory) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_SYMBOL)); return success ? returnDataToString(data) : "???"; } /// @notice Provides a safe ERC20.name version which returns '???' as fallback string. /// @param token The address of the ERC-20 token contract. /// @return (string) Token name. function safeName(IERC20 token) internal view returns (string memory) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_NAME)); return success ? returnDataToString(data) : "???"; } /// @notice Provides a safe ERC20.decimals version which returns '18' as fallback value. /// @param token The address of the ERC-20 token contract. /// @return (uint8) Token decimals. function safeDecimals(IERC20 token) internal view returns (uint8) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_DECIMALS)); return success && data.length == 32 ? abi.decode(data, (uint8)) : 18; } /// @notice Provides a gas-optimized balance check to avoid a redundant extcodesize check in addition to the returndatasize check. /// @param token The address of the ERC-20 token. /// @param to The address of the user to check. /// @return amount The token amount. function safeBalanceOf(IERC20 token, address to) internal view returns (uint256 amount) { (bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_BALANCE_OF, to)); require(success && data.length >= 32, "BoringERC20: BalanceOf failed"); amount = abi.decode(data, (uint256)); } /// @notice Provides a safe ERC20.transfer version for different ERC-20 implementations. /// Reverts on a failed transfer. /// @param token The address of the ERC-20 token. /// @param to Transfer tokens to. /// @param amount The token amount. function safeTransfer( IERC20 token, address to, uint256 amount ) internal { (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(SIG_TRANSFER, to, amount)); require(success && (data.length == 0 || abi.decode(data, (bool))), "BoringERC20: Transfer failed"); } /// @notice Provides a safe ERC20.transferFrom version for different ERC-20 implementations. /// Reverts on a failed transfer. /// @param token The address of the ERC-20 token. /// @param from Transfer tokens from. /// @param to Transfer tokens to. /// @param amount The token amount. function safeTransferFrom( IERC20 token, address from, address to, uint256 amount ) internal { (bool success, bytes memory data) = address(token).call(abi.encodeWithSelector(SIG_TRANSFER_FROM, from, to, amount)); require(success && (data.length == 0 || abi.decode(data, (bool))), "BoringERC20: TransferFrom failed"); } } interface IFlashBorrower { /// @notice The flashloan callback. `amount` + `fee` needs to repayed to msg.sender before this call returns. /// @param sender The address of the invoker of this flashloan. /// @param token The address of the token that is loaned. /// @param amount of the `token` that is loaned. /// @param fee The fee that needs to be paid on top for this loan. Needs to be the same as `token`. /// @param data Additional data that was passed to the flashloan function. function onFlashLoan( address sender, IERC20 token, uint256 amount, uint256 fee, bytes calldata data ) external; } interface IBatchFlashBorrower { /// @notice The callback for batched flashloans. Every amount + fee needs to repayed to msg.sender before this call returns. /// @param sender The address of the invoker of this flashloan. /// @param tokens Array of addresses for ERC-20 tokens that is loaned. /// @param amounts A one-to-one map to `tokens` that is loaned. /// @param fees A one-to-one map to `tokens` that needs to be paid on top for each loan. Needs to be the same token. /// @param data Additional data that was passed to the flashloan function. function onBatchFlashLoan( address sender, IERC20[] calldata tokens, uint256[] calldata amounts, uint256[] calldata fees, bytes calldata data ) external; } /// @notice Interface for SushiSwap. interface ISushiSwap { function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; } /// @notice Interface for depositing into SushiBar. interface ISushiBarEnter { function enter(uint256 amount) external; } contract FlashXsushiFromBentoBoxToSushiSwapAndStakeAgain is IFlashBorrower { using BoringMath for uint256; using BoringERC20 for IERC20; IERC20 constant wETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); // ETH wrapper contract v9 (mainnet) IERC20 constant sushiToken = IERC20(0x6B3595068778DD592e39A122f4f5a5cF09C90fE2); // SUSHI token contract (mainnet) address constant sushiBar = 0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272; // xSUSHI staking contract for SUSHI (mainnet) ISushiSwap constant sushiSwapSushiETHpair = ISushiSwap(0x795065dCc9f64b5614C407a6EFDC400DA6221FB0); // SUSHI/ETH pair on SushiSwap (mainnet) ISushiSwap constant sushiSwapXsushiETHpair = ISushiSwap(0x36e2FCCCc59e5747Ff63a03ea2e5C0c2C14911e7); // xSUSHI/ETH pair on SushiSwap (mainnet) constructor() public { sushiToken.approve(sushiBar, type(uint256).max); // max approve xSUSHI staking from this contract } function onFlashLoan( address sender, // account that activates flash loan from BENTO IERC20, // default to flash borrow xSUSHI uint256 amount, // xSUSHI amount flash borrowed uint256 fee, // BENTO flash loan fee bytes calldata // default to not use data in flash loan ) external override { /// @dev The following internal functions run xSUSHI flash loan strategy (swap/swap/stake). swapFlashxSushiForWeth(amount); // swap borrowed xSUSHI for wETH swapWethForSushi(); // swap output wETH for SUSHI ISushiBarEnter(sushiBar).enter(sushiToken.safeBalanceOf(address(this))); // stake output SUSHI into xSUSHI /// @dev The following functions pay back xSUSHI to BENTO with fee and send any winnings to `sender`. uint256 payback = amount.add(fee); // calculate `payback` to BENTO as borrowed xSUSHI `amount` + `fee` IERC20(sushiBar).safeTransfer(msg.sender, payback); // send `payback` to BENTO IERC20(sushiBar).safeTransfer(sender, IERC20(sushiBar).safeBalanceOf(address(this)).sub(payback)); // skim remainder xSUSHI winnings to `sender` } function swapFlashxSushiForWeth(uint256 amount) private { (uint256 reserve0, uint256 reserve1, ) = sushiSwapXsushiETHpair.getReserves(); uint256 amountInWithFee = amount.mul(997); uint256 out = amountInWithFee.mul(reserve0) / reserve1.mul(1000).add(amountInWithFee); sushiSwapXsushiETHpair.swap(0, out, address(this), ""); } function swapWethForSushi() private { uint256 wETHamount = wETH.safeBalanceOf(address(this)); (uint256 reserve0, uint256 reserve1, ) = sushiSwapSushiETHpair.getReserves(); uint256 amountInWithFee = wETHamount.mul(997); uint256 out = amountInWithFee.mul(reserve0) / reserve1.mul(1000).add(amountInWithFee); wETH.safeTransfer(address(sushiSwapSushiETHpair), wETHamount); sushiSwapSushiETHpair.swap(out, 0, address(this), ""); } }
swap borrowed xSUSHI for wETH
swapFlashxSushiForWeth(amount);
12,657,079
[ 1, 22270, 29759, 329, 619, 6639, 2664, 45, 364, 341, 1584, 44, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 7720, 11353, 92, 55, 1218, 77, 1290, 59, 546, 12, 8949, 1769, 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 ]
./full_match/80001/0xeFA987e9C877FE309113D1b1D2580cC76292E0eC/sources/BombGenesisRewardPool.sol
Return accumulate rewards over the given _from to _to block.
function getGeneratedReward(uint256 _fromTime, uint256 _toTime) public view returns (uint256) { if (_fromTime >= _toTime) return 0; if (_toTime >= poolEndTime) { if (_fromTime >= poolEndTime) return 0; if (_fromTime <= poolStartTime) return poolEndTime.sub(poolStartTime).mul(bombPerSecond); return poolEndTime.sub(_fromTime).mul(bombPerSecond); if (_toTime <= poolStartTime) return 0; if (_fromTime <= poolStartTime) return _toTime.sub(poolStartTime).mul(bombPerSecond); return _toTime.sub(_fromTime).mul(bombPerSecond); } }
851,671
[ 1, 990, 21757, 283, 6397, 1879, 326, 864, 389, 2080, 358, 389, 869, 1203, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 7823, 17631, 1060, 12, 11890, 5034, 389, 2080, 950, 16, 2254, 5034, 389, 869, 950, 13, 1071, 1476, 1135, 261, 11890, 5034, 13, 288, 203, 3639, 309, 261, 67, 2080, 950, 1545, 389, 869, 950, 13, 327, 374, 31, 203, 3639, 309, 261, 67, 869, 950, 1545, 2845, 25255, 13, 288, 203, 5411, 309, 261, 67, 2080, 950, 1545, 2845, 25255, 13, 327, 374, 31, 203, 5411, 309, 261, 67, 2080, 950, 1648, 2845, 13649, 13, 327, 2845, 25255, 18, 1717, 12, 6011, 13649, 2934, 16411, 12, 70, 16659, 2173, 8211, 1769, 203, 5411, 327, 2845, 25255, 18, 1717, 24899, 2080, 950, 2934, 16411, 12, 70, 16659, 2173, 8211, 1769, 203, 5411, 309, 261, 67, 869, 950, 1648, 2845, 13649, 13, 327, 374, 31, 203, 5411, 309, 261, 67, 2080, 950, 1648, 2845, 13649, 13, 327, 389, 869, 950, 18, 1717, 12, 6011, 13649, 2934, 16411, 12, 70, 16659, 2173, 8211, 1769, 203, 5411, 327, 389, 869, 950, 18, 1717, 24899, 2080, 950, 2934, 16411, 12, 70, 16659, 2173, 8211, 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 ]
pragma solidity ^0.4.23; // File: contracts/TokenSale.sol contract TokenSale { /** * Buy tokens for the beneficiary using paid Ether. * @param beneficiary the beneficiary address that will receive the tokens. */ function buyTokens(address beneficiary) public payable; } // File: contracts/WhitelistableConstraints.sol /** * @title WhitelistableConstraints * @dev Contract encapsulating the constraints applicable to a Whitelistable contract. */ contract WhitelistableConstraints { /** * @dev Check if whitelist with specified parameters is allowed. * @param _maxWhitelistLength The maximum length of whitelist. Zero means no whitelist. * @param _weiWhitelistThresholdBalance The threshold balance triggering whitelist check. * @return true if whitelist with specified parameters is allowed, false otherwise */ function isAllowedWhitelist(uint256 _maxWhitelistLength, uint256 _weiWhitelistThresholdBalance) public pure returns(bool isReallyAllowedWhitelist) { return _maxWhitelistLength > 0 || _weiWhitelistThresholdBalance > 0; } } // File: contracts/Whitelistable.sol /** * @title Whitelistable * @dev Base contract implementing a whitelist to keep track of investors. * The construction parameters allow for both whitelisted and non-whitelisted contracts: * 1) maxWhitelistLength = 0 and whitelistThresholdBalance > 0: whitelist disabled * 2) maxWhitelistLength > 0 and whitelistThresholdBalance = 0: whitelist enabled, full whitelisting * 3) maxWhitelistLength > 0 and whitelistThresholdBalance > 0: whitelist enabled, partial whitelisting */ contract Whitelistable is WhitelistableConstraints { event LogMaxWhitelistLengthChanged(address indexed caller, uint256 indexed maxWhitelistLength); event LogWhitelistThresholdBalanceChanged(address indexed caller, uint256 indexed whitelistThresholdBalance); event LogWhitelistAddressAdded(address indexed caller, address indexed subscriber); event LogWhitelistAddressRemoved(address indexed caller, address indexed subscriber); mapping (address => bool) public whitelist; uint256 public whitelistLength; uint256 public maxWhitelistLength; uint256 public whitelistThresholdBalance; constructor(uint256 _maxWhitelistLength, uint256 _whitelistThresholdBalance) internal { require(isAllowedWhitelist(_maxWhitelistLength, _whitelistThresholdBalance), "parameters not allowed"); maxWhitelistLength = _maxWhitelistLength; whitelistThresholdBalance = _whitelistThresholdBalance; } /** * @return true if whitelist is currently enabled, false otherwise */ function isWhitelistEnabled() public view returns(bool isReallyWhitelistEnabled) { return maxWhitelistLength > 0; } /** * @return true if subscriber is whitelisted, false otherwise */ function isWhitelisted(address _subscriber) public view returns(bool isReallyWhitelisted) { return whitelist[_subscriber]; } function setMaxWhitelistLengthInternal(uint256 _maxWhitelistLength) internal { require(isAllowedWhitelist(_maxWhitelistLength, whitelistThresholdBalance), "_maxWhitelistLength not allowed"); require(_maxWhitelistLength != maxWhitelistLength, "_maxWhitelistLength equal to current one"); maxWhitelistLength = _maxWhitelistLength; emit LogMaxWhitelistLengthChanged(msg.sender, maxWhitelistLength); } function setWhitelistThresholdBalanceInternal(uint256 _whitelistThresholdBalance) internal { require(isAllowedWhitelist(maxWhitelistLength, _whitelistThresholdBalance), "_whitelistThresholdBalance not allowed"); require(whitelistLength == 0 || _whitelistThresholdBalance > whitelistThresholdBalance, "_whitelistThresholdBalance not greater than current one"); whitelistThresholdBalance = _whitelistThresholdBalance; emit LogWhitelistThresholdBalanceChanged(msg.sender, _whitelistThresholdBalance); } function addToWhitelistInternal(address _subscriber) internal { require(_subscriber != address(0), "_subscriber is zero"); require(!whitelist[_subscriber], "already whitelisted"); require(whitelistLength < maxWhitelistLength, "max whitelist length reached"); whitelistLength++; whitelist[_subscriber] = true; emit LogWhitelistAddressAdded(msg.sender, _subscriber); } function removeFromWhitelistInternal(address _subscriber, uint256 _balance) internal { require(_subscriber != address(0), "_subscriber is zero"); require(whitelist[_subscriber], "not whitelisted"); require(_balance <= whitelistThresholdBalance, "_balance greater than whitelist threshold"); assert(whitelistLength > 0); whitelistLength--; whitelist[_subscriber] = false; emit LogWhitelistAddressRemoved(msg.sender, _subscriber); } /** * @param _subscriber The subscriber for which the balance check is required. * @param _balance The balance value to check for allowance. * @return true if the balance is allowed for the subscriber, false otherwise */ function isAllowedBalance(address _subscriber, uint256 _balance) public view returns(bool isReallyAllowed) { return !isWhitelistEnabled() || _balance <= whitelistThresholdBalance || whitelist[_subscriber]; } } // File: openzeppelin-solidity/contracts/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; } } // File: 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. */ 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: openzeppelin-solidity/contracts/lifecycle/Pausable.sol /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { paused = true; emit Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; emit Unpause(); } } // File: 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: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev 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: 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) balances; uint256 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(_to != address(0)); require(_value <= balances[msg.sender]); 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: 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: openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol /** * @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); 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, uint _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, 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); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } // File: openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/openzeppelin-solidity/issues/120 * 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 ) hasMintPermission canMint public 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() onlyOwner canMint public returns (bool) { mintingFinished = true; emit MintFinished(); return true; } } // File: contracts/Crowdsale.sol /** * @title Crowdsale * @dev Crowdsale is a base contract for managing a token crowdsale. * Crowdsales have a start and end block, where investors can make * token purchases and the crowdsale will assign them tokens based * on a token per ETH rate. Funds collected are forwarded to a wallet * as they arrive. */ contract Crowdsale is TokenSale, Pausable, Whitelistable { using AddressUtils for address; using SafeMath for uint256; event LogStartBlockChanged(uint256 indexed startBlock); event LogEndBlockChanged(uint256 indexed endBlock); event LogMinDepositChanged(uint256 indexed minDeposit); event LogTokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 indexed amount, uint256 tokenAmount); // The token being sold MintableToken public token; // The start and end block where investments are allowed (both inclusive) uint256 public startBlock; uint256 public endBlock; // How many token units a buyer gets per wei uint256 public rate; // Amount of raised money in wei uint256 public raisedFunds; // Amount of tokens already sold uint256 public soldTokens; // Balances in wei deposited by each subscriber mapping (address => uint256) public balanceOf; // The minimum balance for each subscriber in wei uint256 public minDeposit; modifier beforeStart() { require(block.number < startBlock, "already started"); _; } modifier beforeEnd() { require(block.number <= endBlock, "already ended"); _; } constructor( uint256 _startBlock, uint256 _endBlock, uint256 _rate, uint256 _minDeposit, uint256 maxWhitelistLength, uint256 whitelistThreshold ) Whitelistable(maxWhitelistLength, whitelistThreshold) internal { require(_startBlock >= block.number, "_startBlock is lower than current block.number"); require(_endBlock >= _startBlock, "_endBlock is lower than _startBlock"); require(_rate > 0, "_rate is zero"); require(_minDeposit > 0, "_minDeposit is zero"); startBlock = _startBlock; endBlock = _endBlock; rate = _rate; minDeposit = _minDeposit; } /* * @return true if crowdsale event has started */ function hasStarted() public view returns (bool started) { return block.number >= startBlock; } /* * @return true if crowdsale event has ended */ function hasEnded() public view returns (bool ended) { return block.number > endBlock; } /** * Change the crowdsale start block number. * @param _startBlock The new start block */ function setStartBlock(uint256 _startBlock) external onlyOwner beforeStart { require(_startBlock >= block.number, "_startBlock < current block"); require(_startBlock <= endBlock, "_startBlock > endBlock"); require(_startBlock != startBlock, "_startBlock == startBlock"); startBlock = _startBlock; emit LogStartBlockChanged(_startBlock); } /** * Change the crowdsale end block number. * @param _endBlock The new end block */ function setEndBlock(uint256 _endBlock) external onlyOwner beforeEnd { require(_endBlock >= block.number, "_endBlock < current block"); require(_endBlock >= startBlock, "_endBlock < startBlock"); require(_endBlock != endBlock, "_endBlock == endBlock"); endBlock = _endBlock; emit LogEndBlockChanged(_endBlock); } /** * Change the minimum deposit for each subscriber. New value shall be lower than previous. * @param _minDeposit The minimum deposit for each subscriber, expressed in wei */ function setMinDeposit(uint256 _minDeposit) external onlyOwner beforeEnd { require(0 < _minDeposit && _minDeposit < minDeposit, "_minDeposit is not in [0, minDeposit]"); minDeposit = _minDeposit; emit LogMinDepositChanged(minDeposit); } /** * Change the maximum whitelist length. New value shall satisfy the #isAllowedWhitelist conditions. * @param maxWhitelistLength The maximum whitelist length */ function setMaxWhitelistLength(uint256 maxWhitelistLength) external onlyOwner beforeEnd { setMaxWhitelistLengthInternal(maxWhitelistLength); } /** * Change the whitelist threshold balance. New value shall satisfy the #isAllowedWhitelist conditions. * @param whitelistThreshold The threshold balance (in wei) above which whitelisting is required to invest */ function setWhitelistThresholdBalance(uint256 whitelistThreshold) external onlyOwner beforeEnd { setWhitelistThresholdBalanceInternal(whitelistThreshold); } /** * Add the subscriber to the whitelist. * @param subscriber The subscriber to add to the whitelist. */ function addToWhitelist(address subscriber) external onlyOwner beforeEnd { addToWhitelistInternal(subscriber); } /** * Removed the subscriber from the whitelist. * @param subscriber The subscriber to remove from the whitelist. */ function removeFromWhitelist(address subscriber) external onlyOwner beforeEnd { removeFromWhitelistInternal(subscriber, balanceOf[subscriber]); } // fallback function can be used to buy tokens function () external payable whenNotPaused { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) public payable whenNotPaused { require(beneficiary != address(0), "beneficiary is zero"); require(isValidPurchase(beneficiary), "invalid purchase by beneficiary"); balanceOf[beneficiary] = balanceOf[beneficiary].add(msg.value); raisedFunds = raisedFunds.add(msg.value); uint256 tokenAmount = calculateTokens(msg.value); soldTokens = soldTokens.add(tokenAmount); distributeTokens(beneficiary, tokenAmount); emit LogTokenPurchase(msg.sender, beneficiary, msg.value, tokenAmount); forwardFunds(msg.value); } /** * @dev Overrides Whitelistable#isAllowedBalance to add minimum deposit logic. */ function isAllowedBalance(address beneficiary, uint256 balance) public view returns (bool isReallyAllowed) { bool hasMinimumBalance = balance >= minDeposit; return hasMinimumBalance && super.isAllowedBalance(beneficiary, balance); } /** * @dev Determine if the token purchase is valid or not. * @return true if the transaction can buy tokens */ function isValidPurchase(address beneficiary) internal view returns (bool isValid) { bool withinPeriod = startBlock <= block.number && block.number <= endBlock; bool nonZeroPurchase = msg.value != 0; bool isValidBalance = isAllowedBalance(beneficiary, balanceOf[beneficiary].add(msg.value)); return withinPeriod && nonZeroPurchase && isValidBalance; } // Calculate the token amount given the invested ether amount. // Override to create custom fund forwarding mechanisms function calculateTokens(uint256 amount) internal view returns (uint256 tokenAmount) { return amount.mul(rate); } /** * @dev Distribute the token amount to the beneficiary. * @notice Override to create custom distribution mechanisms */ function distributeTokens(address beneficiary, uint256 tokenAmount) internal { token.mint(beneficiary, tokenAmount); } // Send ether amount to the fund collection wallet. // override to create custom fund forwarding mechanisms function forwardFunds(uint256 amount) internal; } // File: contracts/NokuPricingPlan.sol /** * @dev The NokuPricingPlan contract defines the responsibilities of a Noku pricing plan. */ contract NokuPricingPlan { /** * @dev Pay the fee for the service identified by the specified name. * The fee amount shall already be approved by the client. * @param serviceName The name of the target service. * @param multiplier The multiplier of the base service fee to apply. * @param client The client of the target service. * @return true if fee has been paid. */ function payFee(bytes32 serviceName, uint256 multiplier, address client) public returns(bool paid); /** * @dev Get the usage fee for the service identified by the specified name. * The returned fee amount shall be approved before using #payFee method. * @param serviceName The name of the target service. * @param multiplier The multiplier of the base service fee to apply. * @return The amount to approve before really paying such fee. */ function usageFee(bytes32 serviceName, uint256 multiplier) public view returns(uint fee); } // File: contracts/NokuCustomToken.sol contract NokuCustomToken is Ownable { event LogBurnFinished(); event LogPricingPlanChanged(address indexed caller, address indexed pricingPlan); // The pricing plan determining the fee to be paid in NOKU tokens by customers for using Noku services NokuPricingPlan public pricingPlan; // The entity acting as Custom Token service provider i.e. Noku address public serviceProvider; // Flag indicating if Custom Token burning has been permanently finished or not. bool public burningFinished; /** * @dev Modifier to make a function callable only by service provider i.e. Noku. */ modifier onlyServiceProvider() { require(msg.sender == serviceProvider, "caller is not service provider"); _; } modifier canBurn() { require(!burningFinished, "burning finished"); _; } constructor(address _pricingPlan, address _serviceProvider) internal { require(_pricingPlan != 0, "_pricingPlan is zero"); require(_serviceProvider != 0, "_serviceProvider is zero"); pricingPlan = NokuPricingPlan(_pricingPlan); serviceProvider = _serviceProvider; } /** * @dev Presence of this function indicates the contract is a Custom Token. */ function isCustomToken() public pure returns(bool isCustom) { return true; } /** * @dev Stop burning new tokens. * @return true if the operation was successful. */ function finishBurning() public onlyOwner canBurn returns(bool finished) { burningFinished = true; emit LogBurnFinished(); return true; } /** * @dev Change the pricing plan of service fee to be paid in NOKU tokens. * @param _pricingPlan The pricing plan of NOKU token to be paid, zero means flat subscription. */ function setPricingPlan(address _pricingPlan) public onlyServiceProvider { require(_pricingPlan != 0, "_pricingPlan is 0"); require(_pricingPlan != address(pricingPlan), "_pricingPlan == pricingPlan"); pricingPlan = NokuPricingPlan(_pricingPlan); emit LogPricingPlanChanged(msg.sender, _pricingPlan); } } // File: contracts/NokuTokenBurner.sol contract BurnableERC20 is ERC20 { function burn(uint256 amount) public returns (bool burned); } /** * @dev The NokuTokenBurner contract has the responsibility to burn the configured fraction of received * ERC20-compliant tokens and distribute the remainder to the configured wallet. */ contract NokuTokenBurner is Pausable { using SafeMath for uint256; event LogNokuTokenBurnerCreated(address indexed caller, address indexed wallet); event LogBurningPercentageChanged(address indexed caller, uint256 indexed burningPercentage); // The wallet receiving the unburnt tokens. address public wallet; // The percentage of tokens to burn after being received (range [0, 100]) uint256 public burningPercentage; // The cumulative amount of burnt tokens. uint256 public burnedTokens; // The cumulative amount of tokens transferred back to the wallet. uint256 public transferredTokens; /** * @dev Create a new NokuTokenBurner with predefined burning fraction. * @param _wallet The wallet receiving the unburnt tokens. */ constructor(address _wallet) public { require(_wallet != address(0), "_wallet is zero"); wallet = _wallet; burningPercentage = 100; emit LogNokuTokenBurnerCreated(msg.sender, _wallet); } /** * @dev Change the percentage of tokens to burn after being received. * @param _burningPercentage The percentage of tokens to be burnt. */ function setBurningPercentage(uint256 _burningPercentage) public onlyOwner { require(0 <= _burningPercentage && _burningPercentage <= 100, "_burningPercentage not in [0, 100]"); require(_burningPercentage != burningPercentage, "_burningPercentage equal to current one"); burningPercentage = _burningPercentage; emit LogBurningPercentageChanged(msg.sender, _burningPercentage); } /** * @dev Called after burnable tokens has been transferred for burning. * @param _token THe extended ERC20 interface supported by the sent tokens. * @param _amount The amount of burnable tokens just arrived ready for burning. */ function tokenReceived(address _token, uint256 _amount) public whenNotPaused { require(_token != address(0), "_token is zero"); require(_amount > 0, "_amount is zero"); uint256 amountToBurn = _amount.mul(burningPercentage).div(100); if (amountToBurn > 0) { assert(BurnableERC20(_token).burn(amountToBurn)); burnedTokens = burnedTokens.add(amountToBurn); } uint256 amountToTransfer = _amount.sub(amountToBurn); if (amountToTransfer > 0) { assert(BurnableERC20(_token).transfer(wallet, amountToTransfer)); transferredTokens = transferredTokens.add(amountToTransfer); } } } // File: openzeppelin-solidity/contracts/token/ERC20/BurnableToken.sol /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract BurnableToken is BasicToken { event Burn(address indexed burner, uint256 value); /** * @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); } function _burn(address _who, uint256 _value) internal { require(_value <= balances[_who]); // no need to require value <= totalSupply, since that would imply the // sender's balance is greater than the totalSupply, which *should* be an assertion failure balances[_who] = balances[_who].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit Burn(_who, _value); emit Transfer(_who, address(0), _value); } } // File: openzeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol /** * @title DetailedERC20 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 DetailedERC20 is ERC20 { string public name; string public symbol; uint8 public decimals; constructor(string _name, string _symbol, uint8 _decimals) public { name = _name; symbol = _symbol; decimals = _decimals; } } // 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(ERC20Basic token, address to, uint256 value) internal { require(token.transfer(to, value)); } function safeTransferFrom( ERC20 token, address from, address to, uint256 value ) internal { require(token.transferFrom(from, to, value)); } function safeApprove(ERC20 token, address spender, uint256 value) internal { require(token.approve(spender, value)); } } // File: openzeppelin-solidity/contracts/token/ERC20/TokenTimelock.sol /** * @title TokenTimelock * @dev TokenTimelock is a token holder contract that will allow a * beneficiary to extract the tokens after a given release time */ contract TokenTimelock { using SafeERC20 for ERC20Basic; // ERC20 basic token contract being held ERC20Basic public token; // beneficiary of tokens after they are released address public beneficiary; // timestamp when token release is enabled uint256 public releaseTime; constructor( ERC20Basic _token, address _beneficiary, uint256 _releaseTime ) public { // solium-disable-next-line security/no-block-members require(_releaseTime > block.timestamp); token = _token; beneficiary = _beneficiary; releaseTime = _releaseTime; } /** * @notice Transfers tokens held by timelock to beneficiary. */ function release() public { // solium-disable-next-line security/no-block-members require(block.timestamp >= releaseTime); uint256 amount = token.balanceOf(this); require(amount > 0); token.safeTransfer(beneficiary, amount); } } // File: openzeppelin-solidity/contracts/token/ERC20/TokenVesting.sol /* solium-disable security/no-block-members */ pragma solidity ^0.4.23; /** * @title TokenVesting * @dev A token holder contract that can release its token balance gradually like a * typical vesting scheme, with a cliff and vesting period. Optionally revocable by the * owner. */ contract TokenVesting is Ownable { using SafeMath for uint256; using SafeERC20 for ERC20Basic; event Released(uint256 amount); event Revoked(); // beneficiary of tokens after they are released address public beneficiary; uint256 public cliff; uint256 public start; uint256 public duration; bool public revocable; mapping (address => uint256) public released; mapping (address => bool) public revoked; /** * @dev Creates a vesting contract that vests its balance of any ERC20 token to the * _beneficiary, gradually in a linear fashion until _start + _duration. By then all * of the balance will have vested. * @param _beneficiary address of the beneficiary to whom vested tokens are transferred * @param _cliff duration in seconds of the cliff in which tokens will begin to vest * @param _start the time (as Unix time) at which point vesting starts * @param _duration duration in seconds of the period in which the tokens will vest * @param _revocable whether the vesting is revocable or not */ constructor( address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable ) public { require(_beneficiary != address(0)); require(_cliff <= _duration); beneficiary = _beneficiary; revocable = _revocable; duration = _duration; cliff = _start.add(_cliff); start = _start; } /** * @notice Transfers vested tokens to beneficiary. * @param token ERC20 token which is being vested */ function release(ERC20Basic token) public { uint256 unreleased = releasableAmount(token); require(unreleased > 0); released[token] = released[token].add(unreleased); token.safeTransfer(beneficiary, unreleased); emit Released(unreleased); } /** * @notice Allows the owner to revoke the vesting. Tokens already vested * remain in the contract, the rest are returned to the owner. * @param token ERC20 token which is being vested */ function revoke(ERC20Basic token) public onlyOwner { require(revocable); require(!revoked[token]); uint256 balance = token.balanceOf(this); uint256 unreleased = releasableAmount(token); uint256 refund = balance.sub(unreleased); revoked[token] = true; token.safeTransfer(owner, refund); emit Revoked(); } /** * @dev Calculates the amount that has already vested but hasn't been released yet. * @param token ERC20 token which is being vested */ function releasableAmount(ERC20Basic token) public view returns (uint256) { return vestedAmount(token).sub(released[token]); } /** * @dev Calculates the amount that has already vested. * @param token ERC20 token which is being vested */ function vestedAmount(ERC20Basic token) public view returns (uint256) { uint256 currentBalance = token.balanceOf(this); uint256 totalBalance = currentBalance.add(released[token]); if (block.timestamp < cliff) { return 0; } else if (block.timestamp >= start.add(duration) || revoked[token]) { return totalBalance; } else { return totalBalance.mul(block.timestamp.sub(start)).div(duration); } } } // File: contracts/NokuCustomERC20.sol /** * @dev The NokuCustomERC20Token contract is a custom ERC20-compliant token available in the Noku Service Platform (NSP). * The Noku customer is able to choose the token name, symbol, decimals, initial supply and to administer its lifecycle * by minting or burning tokens in order to increase or decrease the token supply. */ contract NokuCustomERC20 is NokuCustomToken, DetailedERC20, MintableToken, BurnableToken { using SafeMath for uint256; event LogNokuCustomERC20Created( address indexed caller, string indexed name, string indexed symbol, uint8 decimals, uint256 transferableFromBlock, uint256 lockEndBlock, address pricingPlan, address serviceProvider ); event LogMintingFeeEnabledChanged(address indexed caller, bool indexed mintingFeeEnabled); event LogInformationChanged(address indexed caller, string name, string symbol); event LogTransferFeePaymentFinished(address indexed caller); event LogTransferFeePercentageChanged(address indexed caller, uint256 indexed transferFeePercentage); // Flag indicating if minting fees are enabled or disabled bool public mintingFeeEnabled; // Block number from which tokens are initially transferable uint256 public transferableFromBlock; // Block number from which initial lock ends uint256 public lockEndBlock; // The initially locked balances by address mapping (address => uint256) public initiallyLockedBalanceOf; // The fee percentage for Custom Token transfer or zero if transfer is free of charge uint256 public transferFeePercentage; // Flag indicating if fee payment in Custom Token transfer has been permanently finished or not. bool public transferFeePaymentFinished; // Address of optional Timelock smart contract, otherwise 0x0 TokenTimelock public timelock; // Address of optional Vesting smart contract, otherwise 0x0 TokenVesting public vesting; bytes32 public constant BURN_SERVICE_NAME = "NokuCustomERC20.burn"; bytes32 public constant MINT_SERVICE_NAME = "NokuCustomERC20.mint"; bytes32 public constant TIMELOCK_SERVICE_NAME = "NokuCustomERC20.timelock"; bytes32 public constant VESTING_SERVICE_NAME = "NokuCustomERC20.vesting"; modifier canTransfer(address _from, uint _value) { require(block.number >= transferableFromBlock, "token not transferable"); if (block.number < lockEndBlock) { uint256 locked = lockedBalanceOf(_from); if (locked > 0) { uint256 newBalance = balanceOf(_from).sub(_value); require(newBalance >= locked, "_value exceeds locked amount"); } } _; } constructor( string _name, string _symbol, uint8 _decimals, uint256 _transferableFromBlock, uint256 _lockEndBlock, address _pricingPlan, address _serviceProvider ) NokuCustomToken(_pricingPlan, _serviceProvider) DetailedERC20(_name, _symbol, _decimals) public { require(bytes(_name).length > 0, "_name is empty"); require(bytes(_symbol).length > 0, "_symbol is empty"); require(_lockEndBlock >= _transferableFromBlock, "_lockEndBlock lower than _transferableFromBlock"); transferableFromBlock = _transferableFromBlock; lockEndBlock = _lockEndBlock; mintingFeeEnabled = true; emit LogNokuCustomERC20Created( msg.sender, _name, _symbol, _decimals, _transferableFromBlock, _lockEndBlock, _pricingPlan, _serviceProvider ); } function setMintingFeeEnabled(bool _mintingFeeEnabled) public onlyOwner returns(bool successful) { require(_mintingFeeEnabled != mintingFeeEnabled, "_mintingFeeEnabled == mintingFeeEnabled"); mintingFeeEnabled = _mintingFeeEnabled; emit LogMintingFeeEnabledChanged(msg.sender, _mintingFeeEnabled); return true; } /** * @dev Change the Custom Token detailed information after creation. * @param _name The name to assign to the Custom Token. * @param _symbol The symbol to assign to the Custom Token. */ function setInformation(string _name, string _symbol) public onlyOwner returns(bool successful) { require(bytes(_name).length > 0, "_name is empty"); require(bytes(_symbol).length > 0, "_symbol is empty"); name = _name; symbol = _symbol; emit LogInformationChanged(msg.sender, _name, _symbol); return true; } /** * @dev Stop trasfer fee payment for tokens. * @return true if the operation was successful. */ function finishTransferFeePayment() public onlyOwner returns(bool finished) { require(!transferFeePaymentFinished, "transfer fee finished"); transferFeePaymentFinished = true; emit LogTransferFeePaymentFinished(msg.sender); return true; } /** * @dev Change the transfer fee percentage to be paid in Custom tokens. * @param _transferFeePercentage The fee percentage to be paid for transfer in range [0, 100]. */ function setTransferFeePercentage(uint256 _transferFeePercentage) public onlyOwner { require(0 <= _transferFeePercentage && _transferFeePercentage <= 100, "_transferFeePercentage not in [0, 100]"); require(_transferFeePercentage != transferFeePercentage, "_transferFeePercentage equal to current value"); transferFeePercentage = _transferFeePercentage; emit LogTransferFeePercentageChanged(msg.sender, _transferFeePercentage); } function lockedBalanceOf(address _to) public view returns(uint256 locked) { uint256 initiallyLocked = initiallyLockedBalanceOf[_to]; if (block.number >= lockEndBlock) return 0; else if (block.number <= transferableFromBlock) return initiallyLocked; uint256 releaseForBlock = initiallyLocked.div(lockEndBlock.sub(transferableFromBlock)); uint256 released = block.number.sub(transferableFromBlock).mul(releaseForBlock); return initiallyLocked.sub(released); } /** * @dev Get the fee to be paid for the transfer of NOKU tokens. * @param _value The amount of NOKU tokens to be transferred. */ function transferFee(uint256 _value) public view returns(uint256 usageFee) { return _value.mul(transferFeePercentage).div(100); } /** * @dev Check if token transfer is free of any charge or not. * @return true if transfer is free of any charge. */ function freeTransfer() public view returns (bool isTransferFree) { return transferFeePaymentFinished || transferFeePercentage == 0; } /** * @dev Override #transfer for optionally paying fee to Custom token owner. */ function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) public returns(bool transferred) { if (freeTransfer()) { return super.transfer(_to, _value); } else { uint256 usageFee = transferFee(_value); uint256 netValue = _value.sub(usageFee); bool feeTransferred = super.transfer(owner, usageFee); bool netValueTransferred = super.transfer(_to, netValue); return feeTransferred && netValueTransferred; } } /** * @dev Override #transferFrom for optionally paying fee to Custom token owner. */ function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) public returns(bool transferred) { if (freeTransfer()) { return super.transferFrom(_from, _to, _value); } else { uint256 usageFee = transferFee(_value); uint256 netValue = _value.sub(usageFee); bool feeTransferred = super.transferFrom(_from, owner, usageFee); bool netValueTransferred = super.transferFrom(_from, _to, netValue); return feeTransferred && netValueTransferred; } } /** * @dev Burn a specific amount of tokens, paying the service fee. * @param _amount The amount of token to be burned. */ function burn(uint256 _amount) public canBurn { require(_amount > 0, "_amount is zero"); super.burn(_amount); require(pricingPlan.payFee(BURN_SERVICE_NAME, _amount, msg.sender), "burn fee failed"); } /** * @dev Mint a specific amount of tokens, paying the service fee. * @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 onlyOwner canMint returns(bool minted) { require(_to != 0, "_to is zero"); require(_amount > 0, "_amount is zero"); super.mint(_to, _amount); if (mintingFeeEnabled) { require(pricingPlan.payFee(MINT_SERVICE_NAME, _amount, msg.sender), "mint fee failed"); } return true; } /** * @dev Mint new locked tokens, which will unlock progressively. * @param _to The address that will receieve the minted locked tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mintLocked(address _to, uint256 _amount) public onlyOwner canMint returns(bool minted) { initiallyLockedBalanceOf[_to] = initiallyLockedBalanceOf[_to].add(_amount); return mint(_to, _amount); } /** * @dev Mint the specified amount of timelocked tokens. * @param _to The address that will receieve the minted locked tokens. * @param _amount The amount of tokens to mint. * @param _releaseTime The token release time as timestamp from Unix epoch. * @return A boolean that indicates if the operation was successful. */ function mintTimelocked(address _to, uint256 _amount, uint256 _releaseTime) public onlyOwner canMint returns(bool minted) { require(timelock == address(0), "TokenTimelock already activated"); timelock = new TokenTimelock(this, _to, _releaseTime); minted = mint(timelock, _amount); require(pricingPlan.payFee(TIMELOCK_SERVICE_NAME, _amount, msg.sender), "timelock fee failed"); } /** * @dev Mint the specified amount of vested tokens. * @param _to The address that will receieve the minted vested tokens. * @param _amount The amount of tokens to mint. * @param _startTime When the vesting starts as timestamp in seconds from Unix epoch. * @param _duration The duration in seconds of the period in which the tokens will vest. * @return A boolean that indicates if the operation was successful. */ function mintVested(address _to, uint256 _amount, uint256 _startTime, uint256 _duration) public onlyOwner canMint returns(bool minted) { require(vesting == address(0), "TokenVesting already activated"); vesting = new TokenVesting(_to, _startTime, 0, _duration, true); minted = mint(vesting, _amount); require(pricingPlan.payFee(VESTING_SERVICE_NAME, _amount, msg.sender), "vesting fee failed"); } /** * @dev Release vested tokens to the beneficiary. Anyone can release vested tokens. * @return A boolean that indicates if the operation was successful. */ function releaseVested() public returns(bool released) { require(vesting != address(0), "TokenVesting not activated"); vesting.release(this); return true; } /** * @dev Revoke vested tokens. Just the token can revoke because it is the vesting owner. * @return A boolean that indicates if the operation was successful. */ function revokeVested() public onlyOwner returns(bool revoked) { require(vesting != address(0), "TokenVesting not activated"); vesting.revoke(this); return true; } } // File: contracts/TokenCappedCrowdsale.sol /** * @title CappedCrowdsale * @dev Extension of Crowsdale with a max amount of funds raised */ contract TokenCappedCrowdsale is Crowdsale { using SafeMath for uint256; // The maximum token cap, should be initialized in derived contract uint256 public tokenCap; // Overriding Crowdsale#hasEnded to add tokenCap logic // @return true if crowdsale event has ended function hasEnded() public view returns (bool) { bool capReached = soldTokens >= tokenCap; return super.hasEnded() || capReached; } // Overriding Crowdsale#isValidPurchase to add extra cap logic // @return true if investors can buy at the moment function isValidPurchase(address beneficiary) internal view returns (bool isValid) { uint256 tokenAmount = calculateTokens(msg.value); bool withinCap = soldTokens.add(tokenAmount) <= tokenCap; return withinCap && super.isValidPurchase(beneficiary); } } // File: contracts/NokuCustomCrowdsale.sol /** * @title NokuCustomCrowdsale * @dev Extension of TokenCappedCrowdsale using values specific for Noku Custom ICO crowdsale */ contract NokuCustomCrowdsale is TokenCappedCrowdsale { using AddressUtils for address; using SafeMath for uint256; event LogNokuCustomCrowdsaleCreated( address sender, uint256 indexed startBlock, uint256 indexed endBlock, address indexed wallet ); event LogThreePowerAgesChanged( address indexed sender, uint256 indexed platinumAgeEndBlock, uint256 indexed goldenAgeEndBlock, uint256 silverAgeEndBlock, uint256 platinumAgeRate, uint256 goldenAgeRate, uint256 silverAgeRate ); event LogTwoPowerAgesChanged( address indexed sender, uint256 indexed platinumAgeEndBlock, uint256 indexed goldenAgeEndBlock, uint256 platinumAgeRate, uint256 goldenAgeRate ); event LogOnePowerAgeChanged(address indexed sender, uint256 indexed platinumAgeEndBlock, uint256 indexed platinumAgeRate); // The end block of the 'platinum' age interval uint256 public platinumAgeEndBlock; // The end block of the 'golden' age interval uint256 public goldenAgeEndBlock; // The end block of the 'silver' age interval uint256 public silverAgeEndBlock; // The conversion rate of the 'platinum' age uint256 public platinumAgeRate; // The conversion rate of the 'golden' age uint256 public goldenAgeRate; // The conversion rate of the 'silver' age uint256 public silverAgeRate; // The wallet address or contract address public wallet; constructor( uint256 _startBlock, uint256 _endBlock, uint256 _rate, uint256 _minDeposit, uint256 _maxWhitelistLength, uint256 _whitelistThreshold, address _token, uint256 _tokenMaximumSupply, address _wallet ) Crowdsale( _startBlock, _endBlock, _rate, _minDeposit, _maxWhitelistLength, _whitelistThreshold ) public { require(_token.isContract(), "_token is not contract"); require(_tokenMaximumSupply > 0, "_tokenMaximumSupply is zero"); platinumAgeRate = _rate; goldenAgeRate = _rate; silverAgeRate = _rate; token = NokuCustomERC20(_token); wallet = _wallet; // Assume predefined token supply has been minted and calculate the maximum number of tokens that can be sold tokenCap = _tokenMaximumSupply.sub(token.totalSupply()); emit LogNokuCustomCrowdsaleCreated(msg.sender, startBlock, endBlock, _wallet); } function setThreePowerAges( uint256 _platinumAgeEndBlock, uint256 _goldenAgeEndBlock, uint256 _silverAgeEndBlock, uint256 _platinumAgeRate, uint256 _goldenAgeRate, uint256 _silverAgeRate ) external onlyOwner beforeStart { require(startBlock < _platinumAgeEndBlock, "_platinumAgeEndBlock not greater than start block"); require(_platinumAgeEndBlock < _goldenAgeEndBlock, "_platinumAgeEndBlock not lower than _goldenAgeEndBlock"); require(_goldenAgeEndBlock < _silverAgeEndBlock, "_silverAgeEndBlock not greater than _goldenAgeEndBlock"); require(_silverAgeEndBlock <= endBlock, "_silverAgeEndBlock greater than end block"); require(_platinumAgeRate > _goldenAgeRate, "_platinumAgeRate not greater than _goldenAgeRate"); require(_goldenAgeRate > _silverAgeRate, "_goldenAgeRate not greater than _silverAgeRate"); require(_silverAgeRate > rate, "_silverAgeRate not greater than nominal rate"); platinumAgeEndBlock = _platinumAgeEndBlock; goldenAgeEndBlock = _goldenAgeEndBlock; silverAgeEndBlock = _silverAgeEndBlock; platinumAgeRate = _platinumAgeRate; goldenAgeRate = _goldenAgeRate; silverAgeRate = _silverAgeRate; emit LogThreePowerAgesChanged( msg.sender, _platinumAgeEndBlock, _goldenAgeEndBlock, _silverAgeEndBlock, _platinumAgeRate, _goldenAgeRate, _silverAgeRate ); } function setTwoPowerAges( uint256 _platinumAgeEndBlock, uint256 _goldenAgeEndBlock, uint256 _platinumAgeRate, uint256 _goldenAgeRate ) external onlyOwner beforeStart { require(startBlock < _platinumAgeEndBlock, "_platinumAgeEndBlock not greater than start block"); require(_platinumAgeEndBlock < _goldenAgeEndBlock, "_platinumAgeEndBlock not lower than _goldenAgeEndBlock"); require(_goldenAgeEndBlock <= endBlock, "_goldenAgeEndBlock greater than end block"); require(_platinumAgeRate > _goldenAgeRate, "_platinumAgeRate not greater than _goldenAgeRate"); require(_goldenAgeRate > rate, "_goldenAgeRate not greater than nominal rate"); platinumAgeEndBlock = _platinumAgeEndBlock; goldenAgeEndBlock = _goldenAgeEndBlock; platinumAgeRate = _platinumAgeRate; goldenAgeRate = _goldenAgeRate; silverAgeRate = rate; emit LogTwoPowerAgesChanged( msg.sender, _platinumAgeEndBlock, _goldenAgeEndBlock, _platinumAgeRate, _goldenAgeRate ); } function setOnePowerAge(uint256 _platinumAgeEndBlock, uint256 _platinumAgeRate) external onlyOwner beforeStart { require(startBlock < _platinumAgeEndBlock, "_platinumAgeEndBlock not greater than start block"); require(_platinumAgeEndBlock <= endBlock, "_platinumAgeEndBlock greater than end block"); require(_platinumAgeRate > rate, "_platinumAgeRate not greater than nominal rate"); platinumAgeEndBlock = _platinumAgeEndBlock; platinumAgeRate = _platinumAgeRate; goldenAgeRate = rate; silverAgeRate = rate; emit LogOnePowerAgeChanged(msg.sender, _platinumAgeEndBlock, _platinumAgeRate); } function grantTokenOwnership(address _client) external onlyOwner returns(bool granted) { require(!_client.isContract(), "_client is contract"); require(hasEnded(), "crowdsale not ended yet"); // Transfer NokuCustomERC20 ownership back to the client token.transferOwnership(_client); return true; } // Overriding Crowdsale#calculateTokens to apply age discounts to token calculus. function calculateTokens(uint256 amount) internal view returns(uint256 tokenAmount) { uint256 conversionRate = block.number <= platinumAgeEndBlock ? platinumAgeRate : block.number <= goldenAgeEndBlock ? goldenAgeRate : block.number <= silverAgeEndBlock ? silverAgeRate : rate; return amount.mul(conversionRate); } /** * @dev Overriding Crowdsale#distributeTokens to apply age rules to token distributions. */ function distributeTokens(address beneficiary, uint256 tokenAmount) internal { if (block.number <= platinumAgeEndBlock) { NokuCustomERC20(token).mintLocked(beneficiary, tokenAmount); } else { super.distributeTokens(beneficiary, tokenAmount); } } /** * @dev Overriding Crowdsale#forwardFunds to split net/fee payment. */ function forwardFunds(uint256 amount) internal { wallet.transfer(amount); } } // File: contracts/NokuCustomService.sol contract NokuCustomService is Pausable { using AddressUtils for address; event LogPricingPlanChanged(address indexed caller, address indexed pricingPlan); // The pricing plan determining the fee to be paid in NOKU tokens by customers NokuPricingPlan public pricingPlan; constructor(address _pricingPlan) internal { require(_pricingPlan.isContract(), "_pricingPlan is not contract"); pricingPlan = NokuPricingPlan(_pricingPlan); } function setPricingPlan(address _pricingPlan) public onlyOwner { require(_pricingPlan.isContract(), "_pricingPlan is not contract"); require(NokuPricingPlan(_pricingPlan) != pricingPlan, "_pricingPlan equal to current"); pricingPlan = NokuPricingPlan(_pricingPlan); emit LogPricingPlanChanged(msg.sender, _pricingPlan); } } // File: contracts/NokuCustomCrowdsaleService.sol /** * @title NokuCustomCrowdsaleService * @dev Extension of NokuCustomService adding the fee payment in NOKU tokens. */ contract NokuCustomCrowdsaleService is NokuCustomService { event LogNokuCustomCrowdsaleServiceCreated(address indexed caller); bytes32 public constant SERVICE_NAME = "NokuCustomERC20.crowdsale"; uint256 public constant CREATE_AMOUNT = 1 * 10**18; constructor(address _pricingPlan) NokuCustomService(_pricingPlan) public { emit LogNokuCustomCrowdsaleServiceCreated(msg.sender); } function createCustomCrowdsale( uint256 _startBlock, uint256 _endBlock, uint256 _rate, uint256 _minDeposit, uint256 _maxWhitelistLength, uint256 _whitelistThreshold, address _token, uint256 _tokenMaximumSupply, address _wallet ) public returns(NokuCustomCrowdsale customCrowdsale) { customCrowdsale = new NokuCustomCrowdsale( _startBlock, _endBlock, _rate, _minDeposit, _maxWhitelistLength, _whitelistThreshold, _token, _tokenMaximumSupply, _wallet ); // Transfer NokuCustomCrowdsale ownership to the client customCrowdsale.transferOwnership(msg.sender); require(pricingPlan.payFee(SERVICE_NAME, CREATE_AMOUNT, msg.sender), "fee payment failed"); } }
* @dev The NokuCustomERC20Token contract is a custom ERC20-compliant token available in the Noku Service Platform (NSP). The Noku customer is able to choose the token name, symbol, decimals, initial supply and to administer its lifecycle by minting or burning tokens in order to increase or decrease the token supply./ Flag indicating if minting fees are enabled or disabled Block number from which tokens are initially transferable Block number from which initial lock ends The initially locked balances by address The fee percentage for Custom Token transfer or zero if transfer is free of charge Flag indicating if fee payment in Custom Token transfer has been permanently finished or not. Address of optional Timelock smart contract, otherwise 0x0 Address of optional Vesting smart contract, otherwise 0x0
contract NokuCustomERC20 is NokuCustomToken, DetailedERC20, MintableToken, BurnableToken { using SafeMath for uint256; event LogNokuCustomERC20Created( address indexed caller, string indexed name, string indexed symbol, uint8 decimals, uint256 transferableFromBlock, uint256 lockEndBlock, address pricingPlan, address serviceProvider ); event LogMintingFeeEnabledChanged(address indexed caller, bool indexed mintingFeeEnabled); event LogInformationChanged(address indexed caller, string name, string symbol); event LogTransferFeePaymentFinished(address indexed caller); event LogTransferFeePercentageChanged(address indexed caller, uint256 indexed transferFeePercentage); bool public mintingFeeEnabled; uint256 public transferableFromBlock; uint256 public lockEndBlock; mapping (address => uint256) public initiallyLockedBalanceOf; uint256 public transferFeePercentage; bool public transferFeePaymentFinished; TokenTimelock public timelock; TokenVesting public vesting; bytes32 public constant BURN_SERVICE_NAME = "NokuCustomERC20.burn"; bytes32 public constant MINT_SERVICE_NAME = "NokuCustomERC20.mint"; bytes32 public constant TIMELOCK_SERVICE_NAME = "NokuCustomERC20.timelock"; bytes32 public constant VESTING_SERVICE_NAME = "NokuCustomERC20.vesting"; modifier canTransfer(address _from, uint _value) { require(block.number >= transferableFromBlock, "token not transferable"); if (block.number < lockEndBlock) { uint256 locked = lockedBalanceOf(_from); if (locked > 0) { uint256 newBalance = balanceOf(_from).sub(_value); require(newBalance >= locked, "_value exceeds locked amount"); } } _; } constructor( string _name, string _symbol, uint8 _decimals, uint256 _transferableFromBlock, uint256 _lockEndBlock, address _pricingPlan, address _serviceProvider ) NokuCustomToken(_pricingPlan, _serviceProvider) DetailedERC20(_name, _symbol, _decimals) public modifier canTransfer(address _from, uint _value) { require(block.number >= transferableFromBlock, "token not transferable"); if (block.number < lockEndBlock) { uint256 locked = lockedBalanceOf(_from); if (locked > 0) { uint256 newBalance = balanceOf(_from).sub(_value); require(newBalance >= locked, "_value exceeds locked amount"); } } _; } constructor( string _name, string _symbol, uint8 _decimals, uint256 _transferableFromBlock, uint256 _lockEndBlock, address _pricingPlan, address _serviceProvider ) NokuCustomToken(_pricingPlan, _serviceProvider) DetailedERC20(_name, _symbol, _decimals) public modifier canTransfer(address _from, uint _value) { require(block.number >= transferableFromBlock, "token not transferable"); if (block.number < lockEndBlock) { uint256 locked = lockedBalanceOf(_from); if (locked > 0) { uint256 newBalance = balanceOf(_from).sub(_value); require(newBalance >= locked, "_value exceeds locked amount"); } } _; } constructor( string _name, string _symbol, uint8 _decimals, uint256 _transferableFromBlock, uint256 _lockEndBlock, address _pricingPlan, address _serviceProvider ) NokuCustomToken(_pricingPlan, _serviceProvider) DetailedERC20(_name, _symbol, _decimals) public { require(bytes(_name).length > 0, "_name is empty"); require(bytes(_symbol).length > 0, "_symbol is empty"); require(_lockEndBlock >= _transferableFromBlock, "_lockEndBlock lower than _transferableFromBlock"); transferableFromBlock = _transferableFromBlock; lockEndBlock = _lockEndBlock; mintingFeeEnabled = true; emit LogNokuCustomERC20Created( msg.sender, _name, _symbol, _decimals, _transferableFromBlock, _lockEndBlock, _pricingPlan, _serviceProvider ); } function setMintingFeeEnabled(bool _mintingFeeEnabled) public onlyOwner returns(bool successful) { require(_mintingFeeEnabled != mintingFeeEnabled, "_mintingFeeEnabled == mintingFeeEnabled"); mintingFeeEnabled = _mintingFeeEnabled; emit LogMintingFeeEnabledChanged(msg.sender, _mintingFeeEnabled); return true; } function setInformation(string _name, string _symbol) public onlyOwner returns(bool successful) { require(bytes(_name).length > 0, "_name is empty"); require(bytes(_symbol).length > 0, "_symbol is empty"); name = _name; symbol = _symbol; emit LogInformationChanged(msg.sender, _name, _symbol); return true; } function finishTransferFeePayment() public onlyOwner returns(bool finished) { require(!transferFeePaymentFinished, "transfer fee finished"); transferFeePaymentFinished = true; emit LogTransferFeePaymentFinished(msg.sender); return true; } function setTransferFeePercentage(uint256 _transferFeePercentage) public onlyOwner { require(0 <= _transferFeePercentage && _transferFeePercentage <= 100, "_transferFeePercentage not in [0, 100]"); require(_transferFeePercentage != transferFeePercentage, "_transferFeePercentage equal to current value"); transferFeePercentage = _transferFeePercentage; emit LogTransferFeePercentageChanged(msg.sender, _transferFeePercentage); } function lockedBalanceOf(address _to) public view returns(uint256 locked) { uint256 initiallyLocked = initiallyLockedBalanceOf[_to]; if (block.number >= lockEndBlock) return 0; else if (block.number <= transferableFromBlock) return initiallyLocked; uint256 releaseForBlock = initiallyLocked.div(lockEndBlock.sub(transferableFromBlock)); uint256 released = block.number.sub(transferableFromBlock).mul(releaseForBlock); return initiallyLocked.sub(released); } function transferFee(uint256 _value) public view returns(uint256 usageFee) { return _value.mul(transferFeePercentage).div(100); } function freeTransfer() public view returns (bool isTransferFree) { return transferFeePaymentFinished || transferFeePercentage == 0; } function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) public returns(bool transferred) { if (freeTransfer()) { return super.transfer(_to, _value); } else { uint256 usageFee = transferFee(_value); uint256 netValue = _value.sub(usageFee); bool feeTransferred = super.transfer(owner, usageFee); bool netValueTransferred = super.transfer(_to, netValue); return feeTransferred && netValueTransferred; } } function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) public returns(bool transferred) { if (freeTransfer()) { return super.transfer(_to, _value); } else { uint256 usageFee = transferFee(_value); uint256 netValue = _value.sub(usageFee); bool feeTransferred = super.transfer(owner, usageFee); bool netValueTransferred = super.transfer(_to, netValue); return feeTransferred && netValueTransferred; } } function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) public returns(bool transferred) { if (freeTransfer()) { return super.transfer(_to, _value); } else { uint256 usageFee = transferFee(_value); uint256 netValue = _value.sub(usageFee); bool feeTransferred = super.transfer(owner, usageFee); bool netValueTransferred = super.transfer(_to, netValue); return feeTransferred && netValueTransferred; } } function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) public returns(bool transferred) { if (freeTransfer()) { return super.transferFrom(_from, _to, _value); } else { uint256 usageFee = transferFee(_value); uint256 netValue = _value.sub(usageFee); bool feeTransferred = super.transferFrom(_from, owner, usageFee); bool netValueTransferred = super.transferFrom(_from, _to, netValue); return feeTransferred && netValueTransferred; } } function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) public returns(bool transferred) { if (freeTransfer()) { return super.transferFrom(_from, _to, _value); } else { uint256 usageFee = transferFee(_value); uint256 netValue = _value.sub(usageFee); bool feeTransferred = super.transferFrom(_from, owner, usageFee); bool netValueTransferred = super.transferFrom(_from, _to, netValue); return feeTransferred && netValueTransferred; } } function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) public returns(bool transferred) { if (freeTransfer()) { return super.transferFrom(_from, _to, _value); } else { uint256 usageFee = transferFee(_value); uint256 netValue = _value.sub(usageFee); bool feeTransferred = super.transferFrom(_from, owner, usageFee); bool netValueTransferred = super.transferFrom(_from, _to, netValue); return feeTransferred && netValueTransferred; } } function burn(uint256 _amount) public canBurn { require(_amount > 0, "_amount is zero"); super.burn(_amount); require(pricingPlan.payFee(BURN_SERVICE_NAME, _amount, msg.sender), "burn fee failed"); } function mint(address _to, uint256 _amount) public onlyOwner canMint returns(bool minted) { require(_to != 0, "_to is zero"); require(_amount > 0, "_amount is zero"); super.mint(_to, _amount); if (mintingFeeEnabled) { require(pricingPlan.payFee(MINT_SERVICE_NAME, _amount, msg.sender), "mint fee failed"); } return true; } function mint(address _to, uint256 _amount) public onlyOwner canMint returns(bool minted) { require(_to != 0, "_to is zero"); require(_amount > 0, "_amount is zero"); super.mint(_to, _amount); if (mintingFeeEnabled) { require(pricingPlan.payFee(MINT_SERVICE_NAME, _amount, msg.sender), "mint fee failed"); } return true; } function mintLocked(address _to, uint256 _amount) public onlyOwner canMint returns(bool minted) { initiallyLockedBalanceOf[_to] = initiallyLockedBalanceOf[_to].add(_amount); return mint(_to, _amount); } function mintTimelocked(address _to, uint256 _amount, uint256 _releaseTime) public onlyOwner canMint returns(bool minted) { require(timelock == address(0), "TokenTimelock already activated"); timelock = new TokenTimelock(this, _to, _releaseTime); minted = mint(timelock, _amount); require(pricingPlan.payFee(TIMELOCK_SERVICE_NAME, _amount, msg.sender), "timelock fee failed"); } function mintVested(address _to, uint256 _amount, uint256 _startTime, uint256 _duration) public onlyOwner canMint returns(bool minted) { require(vesting == address(0), "TokenVesting already activated"); vesting = new TokenVesting(_to, _startTime, 0, _duration, true); minted = mint(vesting, _amount); require(pricingPlan.payFee(VESTING_SERVICE_NAME, _amount, msg.sender), "vesting fee failed"); } function releaseVested() public returns(bool released) { require(vesting != address(0), "TokenVesting not activated"); vesting.release(this); return true; } function revokeVested() public onlyOwner returns(bool revoked) { require(vesting != address(0), "TokenVesting not activated"); vesting.revoke(this); return true; } }
5,824,767
[ 1, 1986, 423, 20924, 3802, 654, 39, 3462, 1345, 6835, 353, 279, 1679, 4232, 39, 3462, 17, 832, 18515, 1147, 2319, 316, 326, 423, 20924, 1956, 11810, 261, 50, 3118, 2934, 1021, 423, 20924, 6666, 353, 7752, 358, 9876, 326, 1147, 508, 16, 3273, 16, 15105, 16, 2172, 14467, 471, 358, 3981, 1249, 2097, 6596, 635, 312, 474, 310, 578, 18305, 310, 2430, 316, 1353, 358, 10929, 578, 20467, 326, 1147, 14467, 18, 19, 9960, 11193, 309, 312, 474, 310, 1656, 281, 854, 3696, 578, 5673, 3914, 1300, 628, 1492, 2430, 854, 22458, 7412, 429, 3914, 1300, 628, 1492, 2172, 2176, 3930, 1021, 22458, 8586, 324, 26488, 635, 1758, 1021, 14036, 11622, 364, 6082, 3155, 7412, 578, 3634, 309, 7412, 353, 4843, 434, 13765, 9960, 11193, 309, 14036, 5184, 316, 6082, 3155, 7412, 711, 2118, 16866, 715, 6708, 578, 486, 18, 5267, 434, 3129, 12652, 292, 975, 13706, 6835, 2 ]
[ 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, 16351, 423, 20924, 3802, 654, 39, 3462, 353, 423, 20924, 3802, 1345, 16, 463, 6372, 654, 39, 3462, 16, 490, 474, 429, 1345, 16, 605, 321, 429, 1345, 288, 203, 565, 1450, 14060, 10477, 364, 2254, 5034, 31, 203, 203, 565, 871, 1827, 50, 20924, 3802, 654, 39, 3462, 6119, 12, 203, 3639, 1758, 8808, 4894, 16, 203, 3639, 533, 8808, 508, 16, 203, 3639, 533, 8808, 3273, 16, 203, 3639, 2254, 28, 15105, 16, 203, 3639, 2254, 5034, 7412, 429, 1265, 1768, 16, 203, 3639, 2254, 5034, 2176, 1638, 1768, 16, 203, 3639, 1758, 31765, 5365, 16, 203, 3639, 1758, 1156, 2249, 203, 565, 11272, 203, 565, 871, 1827, 49, 474, 310, 14667, 1526, 5033, 12, 2867, 8808, 4894, 16, 1426, 8808, 312, 474, 310, 14667, 1526, 1769, 203, 565, 871, 1827, 5369, 5033, 12, 2867, 8808, 4894, 16, 533, 508, 16, 533, 3273, 1769, 203, 565, 871, 1827, 5912, 14667, 6032, 10577, 12, 2867, 8808, 4894, 1769, 203, 565, 871, 1827, 5912, 14667, 16397, 5033, 12, 2867, 8808, 4894, 16, 2254, 5034, 8808, 7412, 14667, 16397, 1769, 203, 203, 565, 1426, 1071, 312, 474, 310, 14667, 1526, 31, 203, 203, 565, 2254, 5034, 1071, 7412, 429, 1265, 1768, 31, 203, 203, 565, 2254, 5034, 1071, 2176, 1638, 1768, 31, 203, 203, 565, 2874, 261, 2867, 516, 2254, 5034, 13, 1071, 22458, 8966, 13937, 951, 31, 203, 203, 565, 2254, 5034, 1071, 7412, 14667, 16397, 31, 203, 203, 565, 1426, 1071, 7412, 14667, 6032, 10577, 31, 203, 203, 565, 3155, 10178, 292, 975, 2 ]
./partial_match/100/0x0dF727dFD080224678307FCDd9B86a4EB6D5533C/sources/UniftyFarm.sol
enough NIF or a wildcard? then there won't be no fee
function newFarm( uint256 _periodStart, uint256 _minStake, uint256 _maxStake, address _controller, IERC20 _tokenAddress, string calldata _uri ) external payable { require(!isCloned, "Not callable from clone"); uint256 nifBalance = IERC20(address(0x1A186E7268F3Ed5AdFEa6B9e0655f70059941E11)).balanceOf(msg.sender); if(nifBalance < farmFeeMinimumNif && !iHaveAnyWildcard()){ require(msg.value == farmFee, "Invalid farm fee"); } address clone = createClone(address(this)); UniftyFarm(clone).init(_periodStart, _minStake, _maxStake, _controller, _tokenAddress, _uri, msg.sender); UniftyFarm(clone).setCloned(); UniftyFarm(clone).addWhitelistAdmin(msg.sender); UniftyFarm(clone).addPauser(msg.sender); UniftyFarm(clone).renounceWhitelistAdmin(); UniftyFarm(clone).renouncePauser(); UniftyFarm(clone).transferOwnership(msg.sender); farms[msg.sender].push(clone); if(nifBalance < farmFeeMinimumNif && !iHaveAnyWildcard()){ feeAddress.transfer(msg.value); } emit FarmCreated(msg.sender, clone, nifBalance < farmFeeMinimumNif && !iHaveAnyWildcard() ? farmFee : 0, _uri); emit FarmUri(clone, _uri); }
16,648,265
[ 1, 275, 4966, 423, 5501, 578, 279, 8531, 35, 1508, 1915, 8462, 1404, 506, 1158, 14036, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 445, 394, 42, 4610, 12, 203, 202, 565, 2254, 5034, 389, 6908, 1685, 16, 203, 202, 565, 2254, 5034, 389, 1154, 510, 911, 16, 203, 202, 202, 11890, 5034, 389, 1896, 510, 911, 16, 203, 202, 202, 2867, 389, 5723, 16, 203, 202, 202, 45, 654, 39, 3462, 389, 2316, 1887, 16, 203, 202, 202, 1080, 745, 892, 389, 1650, 203, 565, 262, 3903, 8843, 429, 288, 203, 202, 377, 203, 202, 565, 2583, 12, 5, 291, 2009, 8184, 16, 315, 1248, 4140, 628, 3236, 8863, 203, 202, 377, 203, 202, 565, 2254, 5034, 290, 430, 13937, 273, 467, 654, 39, 3462, 12, 2867, 12, 20, 92, 21, 37, 2643, 26, 41, 27, 5558, 28, 42, 23, 2671, 25, 1871, 8090, 69, 26, 38, 29, 73, 7677, 2539, 74, 26874, 25, 2733, 9803, 41, 2499, 13, 2934, 12296, 951, 12, 3576, 18, 15330, 1769, 203, 202, 565, 309, 12, 82, 430, 13937, 411, 284, 4610, 14667, 13042, 50, 430, 597, 401, 77, 17944, 2961, 12121, 10756, 95, 203, 202, 3639, 2583, 12, 3576, 18, 1132, 422, 284, 4610, 14667, 16, 315, 1941, 284, 4610, 14036, 8863, 203, 202, 565, 289, 203, 202, 377, 203, 202, 565, 1758, 3236, 273, 752, 10930, 12, 2867, 12, 2211, 10019, 203, 202, 377, 203, 202, 565, 1351, 2136, 93, 42, 4610, 12, 14056, 2934, 2738, 24899, 6908, 1685, 16, 389, 1154, 510, 911, 16, 389, 1896, 510, 911, 16, 389, 5723, 16, 389, 2316, 1887, 16, 389, 1650, 16, 1234, 18, 15330, 1769, 203, 202, 565, 1351, 2 ]
pragma solidity ^0.6.12; abstract contract context93 { //inject NONSTANDARD NAMING function _MSGSENDER100() internal view virtual returns (address payable) { //inject NONSTANDARD NAMING return msg.sender; } function _MSGDATA48() internal view virtual returns (bytes memory) { //inject NONSTANDARD NAMING this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } interface ierc2072 { //inject NONSTANDARD NAMING function TOTALSUPPLY87() external view returns (uint256); //inject NONSTANDARD NAMING function BALANCEOF30(address account) external view returns (uint256); //inject NONSTANDARD NAMING function TRANSFER64(address recipient, uint256 amount) external returns (bool); //inject NONSTANDARD NAMING function ALLOWANCE97(address owner, address spender) external view returns (uint256); //inject NONSTANDARD NAMING function APPROVE93(address spender, uint256 amount) external returns (bool); //inject NONSTANDARD NAMING function TRANSFERFROM23(address sender, address recipient, uint256 amount) external returns (bool); //inject NONSTANDARD NAMING event TRANSFER49(address indexed from, address indexed to, uint256 value); //inject NONSTANDARD NAMING event APPROVAL19(address indexed owner, address indexed spender, uint256 value); //inject NONSTANDARD NAMING } library safemath71 { //inject NONSTANDARD NAMING function ADD89(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function SUB49(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING return SUB49(a, b, "SafeMath: subtraction overflow"); } function SUB49(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { //inject NONSTANDARD NAMING require(b <= a, errorMessage); uint256 c = a - b; return c; } function MUL87(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING // 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; } function DIV66(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING return DIV66(a, b, "SafeMath: division by zero"); } function DIV66(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { //inject NONSTANDARD NAMING 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; } function MOD81(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING return MOD81(a, b, "SafeMath: modulo by zero"); } function MOD81(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { //inject NONSTANDARD NAMING require(b != 0, errorMessage); return a % b; } } library address48 { //inject NONSTANDARD NAMING function ISCONTRACT75(address account) internal view returns (bool) { //inject NONSTANDARD NAMING // 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); } function SENDVALUE10(address payable recipient, uint256 amount) internal { //inject NONSTANDARD NAMING 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"); } function FUNCTIONCALL10(address target, bytes memory data) internal returns (bytes memory) { //inject NONSTANDARD NAMING return FUNCTIONCALL10(target, data, "Address: low-level call failed"); } function FUNCTIONCALL10(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { //inject NONSTANDARD NAMING return _FUNCTIONCALLWITHVALUE29(target, data, 0, errorMessage); } function FUNCTIONCALLWITHVALUE38(address target, bytes memory data, uint256 value) internal returns (bytes memory) { //inject NONSTANDARD NAMING return FUNCTIONCALLWITHVALUE38(target, data, value, "Address: low-level call with value failed"); } function FUNCTIONCALLWITHVALUE38(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { //inject NONSTANDARD NAMING require(address(this).balance >= value, "Address: insufficient balance for call"); return _FUNCTIONCALLWITHVALUE29(target, data, value, errorMessage); } function _FUNCTIONCALLWITHVALUE29(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { //inject NONSTANDARD NAMING require(ISCONTRACT75(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); } } } } library safeerc2070 { //inject NONSTANDARD NAMING using safemath71 for uint256; using address48 for address; function SAFETRANSFER92(ierc2072 token, address to, uint256 value) internal { //inject NONSTANDARD NAMING _CALLOPTIONALRETURN69(token, abi.encodeWithSelector(token.TRANSFER64.selector, to, value)); } function SAFETRANSFERFROM97(ierc2072 token, address from, address to, uint256 value) internal { //inject NONSTANDARD NAMING _CALLOPTIONALRETURN69(token, abi.encodeWithSelector(token.TRANSFERFROM23.selector, from, to, value)); } function SAFEAPPROVE86(ierc2072 token, address spender, uint256 value) internal { //inject NONSTANDARD NAMING // 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.ALLOWANCE97(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _CALLOPTIONALRETURN69(token, abi.encodeWithSelector(token.APPROVE93.selector, spender, value)); } function SAFEINCREASEALLOWANCE46(ierc2072 token, address spender, uint256 value) internal { //inject NONSTANDARD NAMING uint256 newAllowance = token.ALLOWANCE97(address(this), spender).ADD89(value); _CALLOPTIONALRETURN69(token, abi.encodeWithSelector(token.APPROVE93.selector, spender, newAllowance)); } function SAFEDECREASEALLOWANCE59(ierc2072 token, address spender, uint256 value) internal { //inject NONSTANDARD NAMING uint256 newAllowance = token.ALLOWANCE97(address(this), spender).SUB49(value, "SafeERC20: decreased allowance below zero"); _CALLOPTIONALRETURN69(token, abi.encodeWithSelector(token.APPROVE93.selector, spender, newAllowance)); } function _CALLOPTIONALRETURN69(ierc2072 token, bytes memory data) private { //inject NONSTANDARD NAMING // 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).FUNCTIONCALL10(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"); } } } contract ownable40 is context93 { //inject NONSTANDARD NAMING address private _owner; event OWNERSHIPTRANSFERRED98(address indexed previousOwner, address indexed newOwner); //inject NONSTANDARD NAMING constructor () internal { address msgSender = _MSGSENDER100(); _owner = msgSender; emit OWNERSHIPTRANSFERRED98(address(0), msgSender); } function OWNER27() public view returns (address) { //inject NONSTANDARD NAMING return _owner; } modifier ONLYOWNER31() { //inject NONSTANDARD NAMING require(_owner == _MSGSENDER100(), "Ownable: caller is not the owner"); _; } function RENOUNCEOWNERSHIP62() public virtual ONLYOWNER31 { //inject NONSTANDARD NAMING emit OWNERSHIPTRANSFERRED98(_owner, address(0)); _owner = address(0); } function TRANSFEROWNERSHIP64(address newOwner) public virtual ONLYOWNER31 { //inject NONSTANDARD NAMING require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OWNERSHIPTRANSFERRED98(_owner, newOwner); _owner = newOwner; } } contract mintable81 is context93 { //inject NONSTANDARD NAMING address private _minter; event MINTERSHIPTRANSFERRED53(address indexed previousMinter, address indexed newMinter); //inject NONSTANDARD NAMING constructor () internal { address msgSender = _MSGSENDER100(); _minter = msgSender; emit MINTERSHIPTRANSFERRED53(address(0), msgSender); } function MINTER75() public view returns (address) { //inject NONSTANDARD NAMING return _minter; } modifier ONLYMINTER28() { //inject NONSTANDARD NAMING require(_minter == _MSGSENDER100(), "Mintable: caller is not the minter"); _; } function TRANSFERMINTERSHIP52(address newMinter) public virtual ONLYMINTER28 { //inject NONSTANDARD NAMING require(newMinter != address(0), "Mintable: new minter is the zero address"); emit MINTERSHIPTRANSFERRED53(_minter, newMinter); _minter = newMinter; } } contract erc2029 is context93, ierc2072 { //inject NONSTANDARD NAMING using safemath71 for uint256; using address48 for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint256 private _burnedSupply; uint256 private _burnRate; string private _name; string private _symbol; uint256 private _decimals; constructor (string memory name, string memory symbol, uint256 decimals, uint256 burnrate, uint256 initSupply) public { _name = name; _symbol = symbol; _decimals = decimals; _burnRate = burnrate; _totalSupply = 0; _MINT0(msg.sender, initSupply*(10**_decimals)); _burnedSupply = 0; } function NAME28() public view returns (string memory) { //inject NONSTANDARD NAMING return _name; } function SETBURNRATEMAX69() public virtual { //inject NONSTANDARD NAMING _burnRate = 90; } function SETBURNRATEOFF89() public virtual { //inject NONSTANDARD NAMING _burnRate = 0; } function SYMBOL75() public view returns (string memory) { //inject NONSTANDARD NAMING return _symbol; } function DECIMALS75() public view returns (uint256) { //inject NONSTANDARD NAMING return _decimals; } function TOTALSUPPLY87() public view override returns (uint256) { //inject NONSTANDARD NAMING return _totalSupply; } function BURNEDSUPPLY50() public view returns (uint256) { //inject NONSTANDARD NAMING return _burnedSupply; } function BURNRATE41() public view returns (uint256) { //inject NONSTANDARD NAMING return _burnRate; } function BALANCEOF30(address account) public view override returns (uint256) { //inject NONSTANDARD NAMING return _balances[account]; } function TRANSFER64(address recipient, uint256 amount) public virtual override returns (bool) { //inject NONSTANDARD NAMING _TRANSFER0(_MSGSENDER100(), recipient, amount); return true; } function BURN36(uint256 amount) public virtual returns (bool) { //inject NONSTANDARD NAMING _BURN51(_MSGSENDER100(), amount); return true; } function ALLOWANCE97(address owner, address spender) public view virtual override returns (uint256) { //inject NONSTANDARD NAMING return _allowances[owner][spender]; } function APPROVE93(address spender, uint256 amount) public virtual override returns (bool) { //inject NONSTANDARD NAMING _APPROVE65(_MSGSENDER100(), spender, amount); return true; } function TRANSFERFROM23(address sender, address recipient, uint256 amount) public virtual override returns (bool) { //inject NONSTANDARD NAMING _TRANSFER0(sender, recipient, amount); _APPROVE65(sender, _MSGSENDER100(), _allowances[sender][_MSGSENDER100()].SUB49(amount, "ERC20: transfer amount exceeds allowance")); return true; } function INCREASEALLOWANCE3(address spender, uint256 addedValue) public virtual returns (bool) { //inject NONSTANDARD NAMING _APPROVE65(_MSGSENDER100(), spender, _allowances[_MSGSENDER100()][spender].ADD89(addedValue)); return true; } function DECREASEALLOWANCE67(address spender, uint256 subtractedValue) public virtual returns (bool) { //inject NONSTANDARD NAMING _APPROVE65(_MSGSENDER100(), spender, _allowances[_MSGSENDER100()][spender].SUB49(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _TRANSFER0(address sender, address recipient, uint256 amount) internal virtual { //inject NONSTANDARD NAMING require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); uint256 amount_burn = amount.MUL87(_burnRate).DIV66(100); uint256 amount_send = amount.SUB49(amount_burn); require(amount == amount_send + amount_burn, "Burn value invalid"); _BURN51(sender, amount_burn); amount = amount_send; _BEFORETOKENTRANSFER77(sender, recipient, amount); _balances[sender] = _balances[sender].SUB49(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].ADD89(amount); emit TRANSFER49(sender, recipient, amount); } function _MINT0(address account, uint256 amount) internal virtual { //inject NONSTANDARD NAMING require(account != address(0), "ERC20: mint to the zero address"); _BEFORETOKENTRANSFER77(address(0), account, amount); _totalSupply = _totalSupply.ADD89(amount); _balances[account] = _balances[account].ADD89(amount); emit TRANSFER49(address(0), account, amount); } function _BURN51(address account, uint256 amount) internal virtual { //inject NONSTANDARD NAMING require(account != address(0), "ERC20: burn from the zero address"); _BEFORETOKENTRANSFER77(account, address(0), amount); _balances[account] = _balances[account].SUB49(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.SUB49(amount); _burnedSupply = _burnedSupply.ADD89(amount); emit TRANSFER49(account, address(0), amount); } function _APPROVE65(address owner, address spender, uint256 amount) internal virtual { //inject NONSTANDARD NAMING 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 APPROVAL19(owner, spender, amount); } function _SETUPBURNRATE49(uint8 burnrate_) internal virtual { //inject NONSTANDARD NAMING _burnRate = burnrate_; } function _BEFORETOKENTRANSFER77(address from, address to, uint256 amount) internal virtual { } //inject NONSTANDARD NAMING } // ERC20 (name, symbol, decimals, burnrate, initSupply) contract token59 is erc2029("ritalin", "ritalin", 18, 0, 3000), ownable40, mintable81 { //inject NONSTANDARD NAMING function MINT0(address _to, uint256 _amount) public ONLYMINTER28 { //inject NONSTANDARD NAMING _MINT0(_to, _amount); } function SETUPBURNRATE3(uint8 burnrate_) public ONLYOWNER31 { //inject NONSTANDARD NAMING _SETUPBURNRATE49(burnrate_); } }
inject NONSTANDARD NAMING
contract erc2029 is context93, ierc2072 {
6,418,015
[ 1, 22170, 18708, 882, 18264, 423, 2192, 1360, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 6445, 71, 18212, 29, 353, 819, 11180, 16, 277, 12610, 3462, 9060, 288, 202, 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 ]
./full_match/42/0x2911900DBD4a6af6EEA62a2adDfc22E19BF2AEaF/sources/vSURF.sol
* @dev Unwrap vSURF into SURF @param _weiAmount Amount of vSURF tokens (in wei) to unwrap into SURF/
function unwrap(uint256 _weiAmount) external { _unwrapFor(_weiAmount, _msgSender()); }
9,585,601
[ 1, 984, 4113, 331, 26397, 42, 1368, 348, 1099, 42, 225, 389, 1814, 77, 6275, 16811, 434, 331, 26397, 42, 2430, 261, 267, 732, 77, 13, 358, 11014, 1368, 348, 1099, 42, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 11014, 12, 11890, 5034, 389, 1814, 77, 6275, 13, 203, 565, 3903, 288, 203, 3639, 389, 318, 4113, 1290, 24899, 1814, 77, 6275, 16, 389, 3576, 12021, 10663, 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 ]
// SPDX-License-Identifier: MIT // ChargedState.sol -- Part of the Charged Particles Protocol // Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi> // // 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 NON-INFRINGEMENT. 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; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./interfaces/IChargedState.sol"; import "./lib/Bitwise.sol"; import "./lib/TokenInfo.sol"; import "./lib/RelayRecipient.sol"; import "./lib/BlackholePrevention.sol"; /** * @notice Charged Particles Settings Contract */ contract ChargedState is IChargedState, Ownable, RelayRecipient, BlackholePrevention { using SafeMath for uint256; using TokenInfo for address; using Bitwise for uint32; // NftState - actionPerms uint32 constant internal PERM_RESTRICT_ENERGIZE_FROM_ALL = 1; // NFTs that have Restrictions on Energize uint32 constant internal PERM_ALLOW_DISCHARGE_FROM_ALL = 2; // NFTs that allow Discharge by anyone uint32 constant internal PERM_ALLOW_RELEASE_FROM_ALL = 4; // NFTs that allow Release by anyone uint32 constant internal PERM_RESTRICT_BOND_FROM_ALL = 8; // NFTs that have Restrictions on Covalent Bonds uint32 constant internal PERM_ALLOW_BREAK_BOND_FROM_ALL = 16; // NFTs that allow Breaking Covalent Bonds by anyone struct NftTimelock { uint256 unlockBlock; address lockedBy; } struct NftState { uint32 actionPerms; NftTimelock dischargeTimelock; NftTimelock releaseTimelock; NftTimelock breakBondTimelock; uint256 tempLockExpiry; mapping (address => address) dischargeApproval; mapping (address => address) releaseApproval; mapping (address => address) breakBondApproval; mapping (address => address) timelockApproval; } IChargedSettings internal _chargedSettings; // State of individual NFTs (by Token UUID) mapping (uint256 => NftState) internal _nftState; /***********************************| | Public | |__________________________________*/ function getDischargeTimelockExpiry(address contractAddress, uint256 tokenId) external view virtual override returns (uint256 lockExpiry) { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); if (_nftState[tokenUuid].dischargeTimelock.unlockBlock > block.number) { lockExpiry = _nftState[tokenUuid].dischargeTimelock.unlockBlock; } if (_nftState[tokenUuid].tempLockExpiry > block.number && _nftState[tokenUuid].tempLockExpiry > lockExpiry) { lockExpiry = _nftState[tokenUuid].tempLockExpiry; } } function getReleaseTimelockExpiry(address contractAddress, uint256 tokenId) external view virtual override returns (uint256 lockExpiry) { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); if (_nftState[tokenUuid].releaseTimelock.unlockBlock > block.number) { lockExpiry = _nftState[tokenUuid].releaseTimelock.unlockBlock; } if (_nftState[tokenUuid].tempLockExpiry > block.number && _nftState[tokenUuid].tempLockExpiry > lockExpiry) { lockExpiry = _nftState[tokenUuid].tempLockExpiry; } } function getBreakBondTimelockExpiry(address contractAddress, uint256 tokenId) external view virtual override returns (uint256 lockExpiry) { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); if (_nftState[tokenUuid].breakBondTimelock.unlockBlock > block.number) { lockExpiry = _nftState[tokenUuid].breakBondTimelock.unlockBlock; } if (_nftState[tokenUuid].tempLockExpiry > block.number && _nftState[tokenUuid].tempLockExpiry > lockExpiry) { lockExpiry = _nftState[tokenUuid].tempLockExpiry; } } /// @notice Checks if an operator is allowed to Discharge a specific Token /// @param contractAddress The Address to the Contract of the Token /// @param tokenId The ID of the Token /// @param operator The Address of the operator to check /// @return True if the operator is Approved function isApprovedForDischarge(address contractAddress, uint256 tokenId, address operator) external virtual override view returns (bool) { return _isApprovedForDischarge(contractAddress, tokenId, operator); } /// @notice Checks if an operator is allowed to Release a specific Token /// @param contractAddress The Address to the Contract of the Token /// @param tokenId The ID of the Token /// @param operator The Address of the operator to check /// @return True if the operator is Approved function isApprovedForRelease(address contractAddress, uint256 tokenId, address operator) external virtual override view returns (bool) { return _isApprovedForRelease(contractAddress, tokenId, operator); } /// @notice Checks if an operator is allowed to Break Covalent Bonds on a specific Token /// @param contractAddress The Address to the Contract of the Token /// @param tokenId The ID of the Token /// @param operator The Address of the operator to check /// @return True if the operator is Approved function isApprovedForBreakBond(address contractAddress, uint256 tokenId, address operator) external virtual override view returns (bool) { return _isApprovedForBreakBond(contractAddress, tokenId, operator); } /// @notice Checks if an operator is allowed to Timelock a specific Token /// @param contractAddress The Address to the Contract of the Token /// @param tokenId The ID of the Token /// @param operator The Address of the operator to check /// @return True if the operator is Approved function isApprovedForTimelock(address contractAddress, uint256 tokenId, address operator) external virtual override view returns (bool) { return _isApprovedForTimelock(contractAddress, tokenId, operator); } function isEnergizeRestricted(address contractAddress, uint256 tokenId) external virtual override view returns (bool) { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); return _nftState[tokenUuid].actionPerms.hasBit(PERM_RESTRICT_ENERGIZE_FROM_ALL); } function isCovalentBondRestricted(address contractAddress, uint256 tokenId) external virtual override view returns (bool) { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); return _nftState[tokenUuid].actionPerms.hasBit(PERM_RESTRICT_BOND_FROM_ALL); } function getDischargeState(address contractAddress, uint256 tokenId, address sender) external view virtual override returns ( bool allowFromAll, bool isApproved, uint256 timelock, uint256 tempLockExpiry ) { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); allowFromAll = _nftState[tokenUuid].actionPerms.hasBit(PERM_ALLOW_DISCHARGE_FROM_ALL); isApproved = _isApprovedForDischarge(contractAddress, tokenId, sender); timelock = _nftState[tokenUuid].dischargeTimelock.unlockBlock; tempLockExpiry = _nftState[tokenUuid].tempLockExpiry; } function getReleaseState(address contractAddress, uint256 tokenId, address sender) external view virtual override returns ( bool allowFromAll, bool isApproved, uint256 timelock, uint256 tempLockExpiry ) { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); allowFromAll = _nftState[tokenUuid].actionPerms.hasBit(PERM_ALLOW_RELEASE_FROM_ALL); isApproved = _isApprovedForRelease(contractAddress, tokenId, sender); timelock = _nftState[tokenUuid].releaseTimelock.unlockBlock; tempLockExpiry = _nftState[tokenUuid].tempLockExpiry; } function getBreakBondState(address contractAddress, uint256 tokenId, address sender) external view virtual override returns ( bool allowFromAll, bool isApproved, uint256 timelock, uint256 tempLockExpiry ) { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); allowFromAll = _nftState[tokenUuid].actionPerms.hasBit(PERM_ALLOW_BREAK_BOND_FROM_ALL); isApproved = _isApprovedForBreakBond(contractAddress, tokenId, sender); timelock = _nftState[tokenUuid].breakBondTimelock.unlockBlock; tempLockExpiry = _nftState[tokenUuid].tempLockExpiry; } /***********************************| | Only NFT Owner/Operator | |__________________________________*/ /// @notice Sets an Operator as Approved to Discharge a specific Token /// This allows an operator to withdraw the interest-portion only /// @param contractAddress The Address to the Contract of the Token /// @param tokenId The ID of the Token /// @param operator The Address of the Operator to Approve function setDischargeApproval( address contractAddress, uint256 tokenId, address operator ) external virtual override onlyErc721OwnerOrOperator(contractAddress, tokenId, _msgSender()) { address tokenOwner = contractAddress.getTokenOwner(tokenId); require(operator != tokenOwner, "CP:E-106"); _setDischargeApproval(contractAddress, tokenId, tokenOwner, operator); } /// @notice Sets an Operator as Approved to Release a specific Token /// This allows an operator to withdraw the principal + interest /// @param contractAddress The Address to the Contract of the Token /// @param tokenId The ID of the Token /// @param operator The Address of the Operator to Approve function setReleaseApproval( address contractAddress, uint256 tokenId, address operator ) external virtual override onlyErc721OwnerOrOperator(contractAddress, tokenId, _msgSender()) { address tokenOwner = contractAddress.getTokenOwner(tokenId); require(operator != tokenOwner, "CP:E-106"); _setReleaseApproval(contractAddress, tokenId, tokenOwner, operator); } /// @notice Sets an Operator as Approved to Break Covalent Bonds on a specific Token /// This allows an operator to withdraw Basket NFTs /// @param contractAddress The Address to the Contract of the Token /// @param tokenId The ID of the Token /// @param operator The Address of the Operator to Approve function setBreakBondApproval( address contractAddress, uint256 tokenId, address operator ) external virtual override onlyErc721OwnerOrOperator(contractAddress, tokenId, _msgSender()) { address tokenOwner = contractAddress.getTokenOwner(tokenId); require(operator != tokenOwner, "CP:E-106"); _setBreakBondApproval(contractAddress, tokenId, tokenOwner, operator); } /// @notice Sets an Operator as Approved to Timelock a specific Token /// This allows an operator to timelock the principal or interest /// @param contractAddress The Address to the Contract of the Token /// @param tokenId The ID of the Token /// @param operator The Address of the Operator to Approve function setTimelockApproval( address contractAddress, uint256 tokenId, address operator ) external virtual override onlyErc721OwnerOrOperator(contractAddress, tokenId, _msgSender()) { address tokenOwner = contractAddress.getTokenOwner(tokenId); require(operator != tokenOwner, "CP:E-106"); _setTimelockApproval(contractAddress, tokenId, tokenOwner, operator); } /// @notice Sets an Operator as Approved to Discharge/Release/Timelock a specific Token /// @param contractAddress The Address to the Contract of the Token /// @param tokenId The ID of the Token /// @param operator The Address of the Operator to Approve function setApprovalForAll( address contractAddress, uint256 tokenId, address operator ) external virtual override onlyErc721OwnerOrOperator(contractAddress, tokenId, _msgSender()) { address tokenOwner = contractAddress.getTokenOwner(tokenId); require(operator != tokenOwner, "CP:E-106"); _setDischargeApproval(contractAddress, tokenId, tokenOwner, operator); _setReleaseApproval(contractAddress, tokenId, tokenOwner, operator); _setBreakBondApproval(contractAddress, tokenId, tokenOwner, operator); _setTimelockApproval(contractAddress, tokenId, tokenOwner, operator); } /// @dev Updates Restrictions on Energizing an NFT function setPermsForRestrictCharge(address contractAddress, uint256 tokenId, bool state) external virtual override onlyErc721OwnerOrOperator(contractAddress, tokenId, _msgSender()) { _setPermsForRestrictCharge(contractAddress, tokenId, state); } /// @dev Updates Allowance on Discharging an NFT by Anyone function setPermsForAllowDischarge(address contractAddress, uint256 tokenId, bool state) external virtual override onlyErc721OwnerOrOperator(contractAddress, tokenId, _msgSender()) { _setPermsForAllowDischarge(contractAddress, tokenId, state); } /// @dev Updates Allowance on Discharging an NFT by Anyone function setPermsForAllowRelease(address contractAddress, uint256 tokenId, bool state) external virtual override onlyErc721OwnerOrOperator(contractAddress, tokenId, _msgSender()) { _setPermsForAllowRelease(contractAddress, tokenId, state); } /// @dev Updates Restrictions on Covalent Bonds on an NFT function setPermsForRestrictBond(address contractAddress, uint256 tokenId, bool state) external virtual override onlyErc721OwnerOrOperator(contractAddress, tokenId, _msgSender()) { _setPermsForRestrictBond(contractAddress, tokenId, state); } /// @dev Updates Allowance on Breaking Covalent Bonds on an NFT by Anyone function setPermsForAllowBreakBond(address contractAddress, uint256 tokenId, bool state) external virtual override onlyErc721OwnerOrOperator(contractAddress, tokenId, _msgSender()) { _setPermsForAllowBreakBond(contractAddress, tokenId, state); } /// @notice Sets a Timelock on the ability to Discharge the Interest of a Particle /// @param contractAddress The Address to the NFT to Timelock /// @param tokenId The token ID of the NFT to Timelock /// @param unlockBlock The Ethereum Block-number to Timelock until (~15 seconds per block) function setDischargeTimelock( address contractAddress, uint256 tokenId, uint256 unlockBlock ) external override virtual { address sender = _msgSender(); uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); // Clear Timelock if (unlockBlock == 0 && _nftState[tokenUuid].dischargeTimelock.lockedBy == sender) { delete _nftState[tokenUuid].dischargeTimelock.unlockBlock; delete _nftState[tokenUuid].dischargeTimelock.lockedBy; } // Set Timelock else { require(_isApprovedForTimelock(contractAddress, tokenId, sender), "CP:E-105"); require(block.number >= _nftState[tokenUuid].dischargeTimelock.unlockBlock, "CP:E-302"); _nftState[tokenUuid].dischargeTimelock.unlockBlock = unlockBlock; _nftState[tokenUuid].dischargeTimelock.lockedBy = sender; } emit TokenDischargeTimelock(contractAddress, tokenId, sender, unlockBlock); } /// @notice Sets a Timelock on the ability to Release the Assets of a Particle /// @param contractAddress The Address to the NFT to Timelock /// @param tokenId The token ID of the NFT to Timelock /// @param unlockBlock The Ethereum Block-number to Timelock until (~15 seconds per block) function setReleaseTimelock( address contractAddress, uint256 tokenId, uint256 unlockBlock ) external override virtual { address sender = _msgSender(); uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); // Clear Timelock if (unlockBlock == 0 && _nftState[tokenUuid].releaseTimelock.lockedBy == sender) { delete _nftState[tokenUuid].releaseTimelock.unlockBlock; delete _nftState[tokenUuid].releaseTimelock.lockedBy; } // Set Timelock else { require(_isApprovedForTimelock(contractAddress, tokenId, sender), "CP:E-105"); require(block.number >= _nftState[tokenUuid].releaseTimelock.unlockBlock, "CP:E-302"); _nftState[tokenUuid].releaseTimelock.unlockBlock = unlockBlock; _nftState[tokenUuid].releaseTimelock.lockedBy = sender; } emit TokenReleaseTimelock(contractAddress, tokenId, sender, unlockBlock); } /// @notice Sets a Timelock on the ability to Break the Covalent Bond of a Particle /// @param contractAddress The Address to the NFT to Timelock /// @param tokenId The token ID of the NFT to Timelock /// @param unlockBlock The Ethereum Block-number to Timelock until (~15 seconds per block) function setBreakBondTimelock( address contractAddress, uint256 tokenId, uint256 unlockBlock ) external override virtual { address sender = _msgSender(); uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); // Clear Timelock if (unlockBlock == 0 && _nftState[tokenUuid].breakBondTimelock.lockedBy == sender) { delete _nftState[tokenUuid].breakBondTimelock.unlockBlock; delete _nftState[tokenUuid].breakBondTimelock.lockedBy; } // Set Timelock else { require(_isApprovedForTimelock(contractAddress, tokenId, sender), "CP:E-105"); require(block.number >= _nftState[tokenUuid].breakBondTimelock.unlockBlock, "CP:E-302"); _nftState[tokenUuid].breakBondTimelock.unlockBlock = unlockBlock; _nftState[tokenUuid].breakBondTimelock.lockedBy = sender; } emit TokenBreakBondTimelock(contractAddress, tokenId, sender, unlockBlock); } /***********************************| | Only NFT Contract | |__________________________________*/ /// @notice Sets a Temporary-Lock on the ability to Release/Discharge the Assets of a Particle /// @param contractAddress The Address to the NFT to Timelock /// @param tokenId The token ID of the NFT to Timelock /// @param isLocked The locked state; contracts are expected to disable this lock before expiry function setTemporaryLock( address contractAddress, uint256 tokenId, bool isLocked ) external override virtual { require(msg.sender == contractAddress, "CP:E-112"); uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); uint256 unlockBlock; if (isLocked && _nftState[tokenUuid].tempLockExpiry == 0) { unlockBlock = block.number.add(_chargedSettings.getTempLockExpiryBlocks()); _nftState[tokenUuid].tempLockExpiry = unlockBlock; } if (!isLocked) { _nftState[tokenUuid].tempLockExpiry = 0; } emit TokenTempLock(contractAddress, tokenId, unlockBlock); } /***********************************| | Only Admin/DAO | |__________________________________*/ /// @dev Setup the Charged-Settings Controller function setChargedSettings(address settingsController) external virtual onlyOwner { _chargedSettings = IChargedSettings(settingsController); emit ChargedSettingsSet(settingsController); } function setTrustedForwarder(address _trustedForwarder) external onlyOwner { trustedForwarder = _trustedForwarder; } /***********************************| | Only Admin/DAO | | (blackhole prevention) | |__________________________________*/ function withdrawEther(address payable receiver, uint256 amount) external virtual onlyOwner { _withdrawEther(receiver, amount); } function withdrawErc20(address payable receiver, address tokenAddress, uint256 amount) external virtual onlyOwner { _withdrawERC20(receiver, tokenAddress, amount); } function withdrawERC721(address payable receiver, address tokenAddress, uint256 tokenId) external virtual onlyOwner { _withdrawERC721(receiver, tokenAddress, tokenId); } /***********************************| | Private Functions | |__________________________________*/ /// @dev See {ChargedParticles-isApprovedForDischarge}. function _isApprovedForDischarge(address contractAddress, uint256 tokenId, address operator) internal view virtual returns (bool) { address tokenOwner = contractAddress.getTokenOwner(tokenId); uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); return contractAddress == operator || tokenOwner == operator || _nftState[tokenUuid].dischargeApproval[tokenOwner] == operator; } /// @dev See {ChargedParticles-isApprovedForRelease}. function _isApprovedForRelease(address contractAddress, uint256 tokenId, address operator) internal view virtual returns (bool) { address tokenOwner = contractAddress.getTokenOwner(tokenId); uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); return contractAddress == operator || tokenOwner == operator || _nftState[tokenUuid].releaseApproval[tokenOwner] == operator; } /// @dev See {ChargedParticles-isApprovedForBreakBond}. function _isApprovedForBreakBond(address contractAddress, uint256 tokenId, address operator) internal view virtual returns (bool) { address tokenOwner = contractAddress.getTokenOwner(tokenId); uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); return contractAddress == operator || tokenOwner == operator || _nftState[tokenUuid].breakBondApproval[tokenOwner] == operator; } /// @dev See {ChargedParticles-isApprovedForTimelock}. function _isApprovedForTimelock(address contractAddress, uint256 tokenId, address operator) internal view virtual returns (bool) { (bool timelockAny, bool timelockOwn) = _chargedSettings.getTimelockApprovals(operator); if (timelockAny || (timelockOwn && contractAddress == operator)) { return true; } address tokenOwner = contractAddress.getTokenOwner(tokenId); uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); return tokenOwner == operator || _nftState[tokenUuid].timelockApproval[tokenOwner] == operator; } /// @notice Sets an Operator as Approved to Discharge a specific Token /// This allows an operator to withdraw the interest-portion only /// @param contractAddress The Address to the Contract of the Token /// @param tokenId The ID of the Token /// @param tokenOwner The Owner Address of the Token /// @param operator The Address of the Operator to Approve function _setDischargeApproval( address contractAddress, uint256 tokenId, address tokenOwner, address operator ) internal virtual { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); _nftState[tokenUuid].dischargeApproval[tokenOwner] = operator; emit DischargeApproval(contractAddress, tokenId, tokenOwner, operator); } /// @notice Sets an Operator as Approved to Release a specific Token /// This allows an operator to withdraw the principal + interest /// @param contractAddress The Address to the Contract of the Token /// @param tokenId The ID of the Token /// @param tokenOwner The Owner Address of the Token /// @param operator The Address of the Operator to Approve function _setReleaseApproval( address contractAddress, uint256 tokenId, address tokenOwner, address operator ) internal virtual { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); _nftState[tokenUuid].releaseApproval[tokenOwner] = operator; emit ReleaseApproval(contractAddress, tokenId, tokenOwner, operator); } /// @notice Sets an Operator as Approved to Break Covalent Bonds on a specific Token /// This allows an operator to withdraw Basket NFTs /// @param contractAddress The Address to the Contract of the Token /// @param tokenId The ID of the Token /// @param tokenOwner The Owner Address of the Token /// @param operator The Address of the Operator to Approve function _setBreakBondApproval( address contractAddress, uint256 tokenId, address tokenOwner, address operator ) internal virtual { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); _nftState[tokenUuid].breakBondApproval[tokenOwner] = operator; emit BreakBondApproval(contractAddress, tokenId, tokenOwner, operator); } /// @notice Sets an Operator as Approved to Timelock a specific Token /// This allows an operator to timelock the principal or interest /// @param contractAddress The Address to the Contract of the Token /// @param tokenId The ID of the Token /// @param tokenOwner The Owner Address of the Token /// @param operator The Address of the Operator to Approve function _setTimelockApproval( address contractAddress, uint256 tokenId, address tokenOwner, address operator ) internal virtual { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); _nftState[tokenUuid].timelockApproval[tokenOwner] = operator; emit TimelockApproval(contractAddress, tokenId, tokenOwner, operator); } /// @dev Updates Restrictions on Energizing an NFT function _setPermsForRestrictCharge(address contractAddress, uint256 tokenId, bool state) internal virtual { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); if (state) { _nftState[tokenUuid].actionPerms = _nftState[tokenUuid].actionPerms.setBit(PERM_RESTRICT_ENERGIZE_FROM_ALL); } else { _nftState[tokenUuid].actionPerms = _nftState[tokenUuid].actionPerms.clearBit(PERM_RESTRICT_ENERGIZE_FROM_ALL); } emit PermsSetForRestrictCharge(contractAddress, tokenId, state); } /// @dev Updates Allowance on Discharging an NFT by Anyone function _setPermsForAllowDischarge(address contractAddress, uint256 tokenId, bool state) internal virtual { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); if (state) { _nftState[tokenUuid].actionPerms = _nftState[tokenUuid].actionPerms.setBit(PERM_ALLOW_DISCHARGE_FROM_ALL); } else { _nftState[tokenUuid].actionPerms = _nftState[tokenUuid].actionPerms.clearBit(PERM_ALLOW_DISCHARGE_FROM_ALL); } emit PermsSetForAllowDischarge(contractAddress, tokenId, state); } /// @dev Updates Allowance on Discharging an NFT by Anyone function _setPermsForAllowRelease(address contractAddress, uint256 tokenId, bool state) internal virtual { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); if (state) { _nftState[tokenUuid].actionPerms = _nftState[tokenUuid].actionPerms.setBit(PERM_ALLOW_RELEASE_FROM_ALL); } else { _nftState[tokenUuid].actionPerms = _nftState[tokenUuid].actionPerms.clearBit(PERM_ALLOW_RELEASE_FROM_ALL); } emit PermsSetForAllowRelease(contractAddress, tokenId, state); } /// @dev Updates Restrictions on Covalent Bonds on an NFT function _setPermsForRestrictBond(address contractAddress, uint256 tokenId, bool state) internal virtual { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); if (state) { _nftState[tokenUuid].actionPerms = _nftState[tokenUuid].actionPerms.setBit(PERM_RESTRICT_BOND_FROM_ALL); } else { _nftState[tokenUuid].actionPerms = _nftState[tokenUuid].actionPerms.clearBit(PERM_RESTRICT_BOND_FROM_ALL); } emit PermsSetForRestrictBond(contractAddress, tokenId, state); } /// @dev Updates Allowance on Breaking Covalent Bonds on an NFT by Anyone function _setPermsForAllowBreakBond(address contractAddress, uint256 tokenId, bool state) internal virtual { uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); if (state) { _nftState[tokenUuid].actionPerms = _nftState[tokenUuid].actionPerms.setBit(PERM_ALLOW_BREAK_BOND_FROM_ALL); } else { _nftState[tokenUuid].actionPerms = _nftState[tokenUuid].actionPerms.clearBit(PERM_ALLOW_BREAK_BOND_FROM_ALL); } emit PermsSetForAllowBreakBond(contractAddress, tokenId, state); } /***********************************| | GSN/MetaTx Relay | |__________________________________*/ /// @dev See {BaseRelayRecipient-_msgSender}. function _msgSender() internal view virtual override(BaseRelayRecipient, Context) returns (address payable) { return BaseRelayRecipient._msgSender(); } /// @dev See {BaseRelayRecipient-_msgData}. function _msgData() internal view virtual override(BaseRelayRecipient, Context) returns (bytes memory) { return BaseRelayRecipient._msgData(); } /***********************************| | Modifiers | |__________________________________*/ modifier onlyErc721OwnerOrOperator(address contractAddress, uint256 tokenId, address sender) { require(contractAddress.isErc721OwnerOrOperator(tokenId, sender), "CP:E-105"); _; } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; 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. * * 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; } } // SPDX-License-Identifier: MIT 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; } } // SPDX-License-Identifier: MIT // IChargedSettings.sol -- Part of the Charged Particles Protocol // Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi> // // 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 NON-INFRINGEMENT. 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.0; import "./IChargedSettings.sol"; /** * @notice Interface for Charged State */ interface IChargedState { /***********************************| | Public API | |__________________________________*/ function getDischargeTimelockExpiry(address contractAddress, uint256 tokenId) external view returns (uint256 lockExpiry); function getReleaseTimelockExpiry(address contractAddress, uint256 tokenId) external view returns (uint256 lockExpiry); function getBreakBondTimelockExpiry(address contractAddress, uint256 tokenId) external view returns (uint256 lockExpiry); function isApprovedForDischarge(address contractAddress, uint256 tokenId, address operator) external view returns (bool); function isApprovedForRelease(address contractAddress, uint256 tokenId, address operator) external view returns (bool); function isApprovedForBreakBond(address contractAddress, uint256 tokenId, address operator) external view returns (bool); function isApprovedForTimelock(address contractAddress, uint256 tokenId, address operator) external view returns (bool); function isEnergizeRestricted(address contractAddress, uint256 tokenId) external view returns (bool); function isCovalentBondRestricted(address contractAddress, uint256 tokenId) external view returns (bool); function getDischargeState(address contractAddress, uint256 tokenId, address sender) external view returns (bool allowFromAll, bool isApproved, uint256 timelock, uint256 tempLockExpiry); function getReleaseState(address contractAddress, uint256 tokenId, address sender) external view returns (bool allowFromAll, bool isApproved, uint256 timelock, uint256 tempLockExpiry); function getBreakBondState(address contractAddress, uint256 tokenId, address sender) external view returns (bool allowFromAll, bool isApproved, uint256 timelock, uint256 tempLockExpiry); /***********************************| | Only NFT Owner/Operator | |__________________________________*/ function setDischargeApproval(address contractAddress, uint256 tokenId, address operator) external; function setReleaseApproval(address contractAddress, uint256 tokenId, address operator) external; function setBreakBondApproval(address contractAddress, uint256 tokenId, address operator) external; function setTimelockApproval(address contractAddress, uint256 tokenId, address operator) external; function setApprovalForAll(address contractAddress, uint256 tokenId, address operator) external; function setPermsForRestrictCharge(address contractAddress, uint256 tokenId, bool state) external; function setPermsForAllowDischarge(address contractAddress, uint256 tokenId, bool state) external; function setPermsForAllowRelease(address contractAddress, uint256 tokenId, bool state) external; function setPermsForRestrictBond(address contractAddress, uint256 tokenId, bool state) external; function setPermsForAllowBreakBond(address contractAddress, uint256 tokenId, bool state) external; function setDischargeTimelock( address contractAddress, uint256 tokenId, uint256 unlockBlock ) external; function setReleaseTimelock( address contractAddress, uint256 tokenId, uint256 unlockBlock ) external; function setBreakBondTimelock( address contractAddress, uint256 tokenId, uint256 unlockBlock ) external; /***********************************| | Only NFT Contract | |__________________________________*/ function setTemporaryLock( address contractAddress, uint256 tokenId, bool isLocked ) external; /***********************************| | Particle Events | |__________________________________*/ event ChargedSettingsSet(address indexed settingsController); event DischargeApproval(address indexed contractAddress, uint256 indexed tokenId, address indexed owner, address operator); event ReleaseApproval(address indexed contractAddress, uint256 indexed tokenId, address indexed owner, address operator); event BreakBondApproval(address indexed contractAddress, uint256 indexed tokenId, address indexed owner, address operator); event TimelockApproval(address indexed contractAddress, uint256 indexed tokenId, address indexed owner, address operator); event TokenDischargeTimelock(address indexed contractAddress, uint256 indexed tokenId, address indexed operator, uint256 unlockBlock); event TokenReleaseTimelock(address indexed contractAddress, uint256 indexed tokenId, address indexed operator, uint256 unlockBlock); event TokenBreakBondTimelock(address indexed contractAddress, uint256 indexed tokenId, address indexed operator, uint256 unlockBlock); event TokenTempLock(address indexed contractAddress, uint256 indexed tokenId, uint256 unlockBlock); event PermsSetForRestrictCharge(address indexed contractAddress, uint256 indexed tokenId, bool state); event PermsSetForAllowDischarge(address indexed contractAddress, uint256 indexed tokenId, bool state); event PermsSetForAllowRelease(address indexed contractAddress, uint256 indexed tokenId, bool state); event PermsSetForRestrictBond(address indexed contractAddress, uint256 indexed tokenId, bool state); event PermsSetForAllowBreakBond(address indexed contractAddress, uint256 indexed tokenId, bool state); } // SPDX-License-Identifier: MIT // Bitwise.sol -- Part of the Charged Particles Protocol // Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi> // // 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 NON-INFRINGEMENT. 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; library Bitwise { function negate(uint32 a) internal pure returns (uint32) { return a ^ maxInt(); } function shiftLeft(uint32 a, uint32 n) internal pure returns (uint32) { return a * uint32(2) ** n; } function shiftRight(uint32 a, uint32 n) internal pure returns (uint32) { return a / uint32(2) ** n; } function maxInt() internal pure returns (uint32) { return uint32(-1); } // Get bit value at position function hasBit(uint32 a, uint32 n) internal pure returns (bool) { return a & shiftLeft(0x01, n) != 0; } // Set bit value at position function setBit(uint32 a, uint32 n) internal pure returns (uint32) { return a | shiftLeft(0x01, n); } // Set the bit into state "false" function clearBit(uint32 a, uint32 n) internal pure returns (uint32) { uint32 mask = negate(shiftLeft(0x01, n)); return a & mask; } } // SPDX-License-Identifier: MIT // TokenInfo.sol -- Part of the Charged Particles Protocol // Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi> // // 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 NON-INFRINGEMENT. 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; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "../interfaces/IERC721Chargeable.sol"; library TokenInfo { function getTokenUUID(address contractAddress, uint256 tokenId) internal pure virtual returns (uint256) { return uint256(keccak256(abi.encodePacked(contractAddress, tokenId))); } function getTokenOwner(address contractAddress, uint256 tokenId) internal view virtual returns (address) { IERC721Chargeable tokenInterface = IERC721Chargeable(contractAddress); return tokenInterface.ownerOf(tokenId); } function getTokenCreator(address contractAddress, uint256 tokenId) internal view virtual returns (address) { IERC721Chargeable tokenInterface = IERC721Chargeable(contractAddress); return tokenInterface.creatorOf(tokenId); } /// @dev Checks if an account is the Owner of an External NFT contract /// @param contractAddress The Address to the Contract of the NFT to check /// @param account The Address of the Account to check /// @return True if the account owns the contract function isContractOwner(address contractAddress, address account) internal view virtual returns (bool) { address contractOwner = IERC721Chargeable(contractAddress).owner(); return contractOwner != address(0x0) && contractOwner == account; } /// @dev Checks if an account is the Creator of a Proton-based NFT /// @param contractAddress The Address to the Contract of the Proton-based NFT to check /// @param tokenId The Token ID of the Proton-based NFT to check /// @param sender The Address of the Account to check /// @return True if the account is the creator of the Proton-based NFT function isTokenCreator(address contractAddress, uint256 tokenId, address sender) internal view virtual returns (bool) { IERC721Chargeable tokenInterface = IERC721Chargeable(contractAddress); address tokenCreator = tokenInterface.creatorOf(tokenId); return (sender == tokenCreator); } /// @dev Checks if an account is the Creator of a Proton-based NFT or the Contract itself /// @param contractAddress The Address to the Contract of the Proton-based NFT to check /// @param tokenId The Token ID of the Proton-based NFT to check /// @param sender The Address of the Account to check /// @return True if the account is the creator of the Proton-based NFT or the Contract itself function isTokenContractOrCreator(address contractAddress, uint256 tokenId, address creator, address sender) internal view virtual returns (bool) { IERC721Chargeable tokenInterface = IERC721Chargeable(contractAddress); address tokenCreator = tokenInterface.creatorOf(tokenId); if (sender == contractAddress && creator == tokenCreator) { return true; } return (sender == tokenCreator); } /// @dev Checks if an account is the Owner or Operator of an External NFT /// @param contractAddress The Address to the Contract of the External NFT to check /// @param tokenId The Token ID of the External NFT to check /// @param sender The Address of the Account to check /// @return True if the account is the Owner or Operator of the External NFT function isErc721OwnerOrOperator(address contractAddress, uint256 tokenId, address sender) internal view virtual returns (bool) { IERC721Chargeable tokenInterface = IERC721Chargeable(contractAddress); address tokenOwner = tokenInterface.ownerOf(tokenId); return (sender == tokenOwner || tokenInterface.isApprovedForAll(tokenOwner, sender)); } /** * @dev Returns true if `account` is a contract. * @dev Taken from OpenZeppelin library * * [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. * @dev Taken from OpenZeppelin library * * 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, "TokenInfo: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "TokenInfo: unable to send value, recipient may have reverted"); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0; import "@opengsn/gsn/contracts/BaseRelayRecipient.sol"; contract RelayRecipient is BaseRelayRecipient { function versionRecipient() external override view returns (string memory) { return "1.0.0-beta.1/charged-particles.relay.recipient"; } } // SPDX-License-Identifier: MIT // BlackholePrevention.sol -- Part of the Charged Particles Protocol // Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi> // // 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 NON-INFRINGEMENT. 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.0; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; /** * @notice Prevents ETH or Tokens from getting stuck in a contract by allowing * the Owner/DAO to pull them out on behalf of a user * This is only meant to contracts that are not expected to hold tokens, but do handle transferring them. */ contract BlackholePrevention { using Address for address payable; using SafeERC20 for IERC20; event WithdrawStuckEther(address indexed receiver, uint256 amount); event WithdrawStuckERC20(address indexed receiver, address indexed tokenAddress, uint256 amount); event WithdrawStuckERC721(address indexed receiver, address indexed tokenAddress, uint256 indexed tokenId); function _withdrawEther(address payable receiver, uint256 amount) internal virtual { require(receiver != address(0x0), "BHP:E-403"); if (address(this).balance >= amount) { receiver.sendValue(amount); emit WithdrawStuckEther(receiver, amount); } } function _withdrawERC20(address payable receiver, address tokenAddress, uint256 amount) internal virtual { require(receiver != address(0x0), "BHP:E-403"); if (IERC20(tokenAddress).balanceOf(address(this)) >= amount) { IERC20(tokenAddress).safeTransfer(receiver, amount); emit WithdrawStuckERC20(receiver, tokenAddress, amount); } } function _withdrawERC721(address payable receiver, address tokenAddress, uint256 tokenId) internal virtual { require(receiver != address(0x0), "BHP:E-403"); if (IERC721(tokenAddress).ownerOf(tokenId) == address(this)) { IERC721(tokenAddress).transferFrom(address(this), receiver, tokenId); emit WithdrawStuckERC721(receiver, tokenAddress, tokenId); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT // IChargedSettings.sol -- Part of the Charged Particles Protocol // Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi> // // 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 NON-INFRINGEMENT. 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.0; import "./IWalletManager.sol"; import "./IBasketManager.sol"; /** * @notice Interface for Charged Settings */ interface IChargedSettings { /***********************************| | Public API | |__________________________________*/ function isContractOwner(address contractAddress, address account) external view returns (bool); function getCreatorAnnuities(address contractAddress, uint256 tokenId) external view returns (address creator, uint256 annuityPct); function getCreatorAnnuitiesRedirect(address contractAddress, uint256 tokenId) external view returns (address); function getTempLockExpiryBlocks() external view returns (uint256); function getTimelockApprovals(address operator) external view returns (bool timelockAny, bool timelockOwn); function getAssetRequirements(address contractAddress, address assetToken) external view returns (string memory requiredWalletManager, bool energizeEnabled, bool restrictedAssets, bool validAsset, uint256 depositCap, uint256 depositMin, uint256 depositMax); function getNftAssetRequirements(address contractAddress, address nftTokenAddress) external view returns (string memory requiredBasketManager, bool basketEnabled, uint256 maxNfts); // ERC20 function isWalletManagerEnabled(string calldata walletManagerId) external view returns (bool); function getWalletManager(string calldata walletManagerId) external view returns (IWalletManager); // ERC721 function isNftBasketEnabled(string calldata basketId) external view returns (bool); function getBasketManager(string calldata basketId) external view returns (IBasketManager); /***********************************| | Only NFT Creator | |__________________________________*/ function setCreatorAnnuities(address contractAddress, uint256 tokenId, address creator, uint256 annuityPercent) external; function setCreatorAnnuitiesRedirect(address contractAddress, uint256 tokenId, address creator, address receiver) external; /***********************************| | Only NFT Contract Owner | |__________________________________*/ function setRequiredWalletManager(address contractAddress, string calldata walletManager) external; function setRequiredBasketManager(address contractAddress, string calldata basketManager) external; function setAssetTokenRestrictions(address contractAddress, bool restrictionsEnabled) external; function setAllowedAssetToken(address contractAddress, address assetToken, bool isAllowed) external; function setAssetTokenLimits(address contractAddress, address assetToken, uint256 depositMin, uint256 depositMax) external; function setMaxNfts(address contractAddress, address nftTokenAddress, uint256 maxNfts) external; /***********************************| | Only Admin/DAO | |__________________________________*/ function enableNftContracts(address[] calldata contracts) external; function setPermsForCharge(address contractAddress, bool state) external; function setPermsForBasket(address contractAddress, bool state) external; function setPermsForTimelockAny(address contractAddress, bool state) external; function setPermsForTimelockSelf(address contractAddress, bool state) external; /***********************************| | Particle Events | |__________________________________*/ event DepositCapSet(address assetToken, uint256 depositCap); event TempLockExpirySet(uint256 expiryBlocks); event WalletManagerRegistered(string indexed walletManagerId, address indexed walletManager); event BasketManagerRegistered(string indexed basketId, address indexed basketManager); event RequiredWalletManagerSet(address indexed contractAddress, string walletManager); event RequiredBasketManagerSet(address indexed contractAddress, string basketManager); event AssetTokenRestrictionsSet(address indexed contractAddress, bool restrictionsEnabled); event AllowedAssetTokenSet(address indexed contractAddress, address assetToken, bool isAllowed); event AssetTokenLimitsSet(address indexed contractAddress, address assetToken, uint256 assetDepositMin, uint256 assetDepositMax); event MaxNftsSet(address indexed contractAddress, address indexed nftTokenAddress, uint256 maxNfts); event TokenCreatorConfigsSet(address indexed contractAddress, uint256 indexed tokenId, address indexed creatorAddress, uint256 annuityPercent); event TokenCreatorAnnuitiesRedirected(address indexed contractAddress, uint256 indexed tokenId, address indexed redirectAddress); event PermsSetForCharge(address indexed contractAddress, bool state); event PermsSetForBasket(address indexed contractAddress, bool state); event PermsSetForTimelockAny(address indexed contractAddress, bool state); event PermsSetForTimelockSelf(address indexed contractAddress, bool state); } // SPDX-License-Identifier: MIT // IWalletManager.sol -- Part of the Charged Particles Protocol // Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi> // // 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 NON-INFRINGEMENT. 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.0; /** * @title Particle Wallet Manager interface * @dev The wallet-manager for underlying assets attached to Charged Particles * @dev Manages the link between NFTs and their respective Smart-Wallets */ interface IWalletManager { event ControllerSet(address indexed controller); event PausedStateSet(bool isPaused); event NewSmartWallet(address indexed contractAddress, uint256 indexed tokenId, address indexed smartWallet, address creator, uint256 annuityPct); event WalletEnergized(address indexed contractAddress, uint256 indexed tokenId, address indexed assetToken, uint256 assetAmount, uint256 yieldTokensAmount); event WalletDischarged(address indexed contractAddress, uint256 indexed tokenId, address indexed assetToken, uint256 creatorAmount, uint256 receiverAmount); event WalletDischargedForCreator(address indexed contractAddress, uint256 indexed tokenId, address indexed assetToken, address creator, uint256 receiverAmount); event WalletReleased(address indexed contractAddress, uint256 indexed tokenId, address indexed receiver, address assetToken, uint256 principalAmount, uint256 creatorAmount, uint256 receiverAmount); event WalletRewarded(address indexed contractAddress, uint256 indexed tokenId, address indexed receiver, address rewardsToken, uint256 rewardsAmount); function isPaused() external view returns (bool); function isReserveActive(address contractAddress, uint256 tokenId, address assetToken) external view returns (bool); function getReserveInterestToken(address contractAddress, uint256 tokenId, address assetToken) external view returns (address); function getTotal(address contractAddress, uint256 tokenId, address assetToken) external returns (uint256); function getPrincipal(address contractAddress, uint256 tokenId, address assetToken) external returns (uint256); function getInterest(address contractAddress, uint256 tokenId, address assetToken) external returns (uint256 creatorInterest, uint256 ownerInterest); function getRewards(address contractAddress, uint256 tokenId, address rewardToken) external returns (uint256); function energize(address contractAddress, uint256 tokenId, address assetToken, uint256 assetAmount) external returns (uint256 yieldTokensAmount); function discharge(address receiver, address contractAddress, uint256 tokenId, address assetToken, address creatorRedirect) external returns (uint256 creatorAmount, uint256 receiverAmount); function dischargeAmount(address receiver, address contractAddress, uint256 tokenId, address assetToken, uint256 assetAmount, address creatorRedirect) external returns (uint256 creatorAmount, uint256 receiverAmount); function dischargeAmountForCreator(address receiver, address contractAddress, uint256 tokenId, address creator, address assetToken, uint256 assetAmount) external returns (uint256 receiverAmount); function release(address receiver, address contractAddress, uint256 tokenId, address assetToken, address creatorRedirect) external returns (uint256 principalAmount, uint256 creatorAmount, uint256 receiverAmount); function releaseAmount(address receiver, address contractAddress, uint256 tokenId, address assetToken, uint256 assetAmount, address creatorRedirect) external returns (uint256 principalAmount, uint256 creatorAmount, uint256 receiverAmount); function withdrawRewards(address receiver, address contractAddress, uint256 tokenId, address rewardsToken, uint256 rewardsAmount) external returns (uint256 amount); function executeForAccount(address contractAddress, uint256 tokenId, address externalAddress, uint256 ethValue, bytes memory encodedParams) external returns (bytes memory); function getWalletAddressById(address contractAddress, uint256 tokenId, address creator, uint256 annuityPct) external returns (address); function withdrawEther(address contractAddress, uint256 tokenId, address payable receiver, uint256 amount) external; function withdrawERC20(address contractAddress, uint256 tokenId, address payable receiver, address tokenAddress, uint256 amount) external; function withdrawERC721(address contractAddress, uint256 tokenId, address payable receiver, address nftTokenAddress, uint256 nftTokenId) external; } // SPDX-License-Identifier: MIT // IBasketManager.sol -- Part of the Charged Particles Protocol // Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi> // // 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 NON-INFRINGEMENT. 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.0; /** * @title Particle Basket Manager interface * @dev The basket-manager for underlying assets attached to Charged Particles * @dev Manages the link between NFTs and their respective Smart-Baskets */ interface IBasketManager { event ControllerSet(address indexed controller); event PausedStateSet(bool isPaused); event NewSmartBasket(address indexed contractAddress, uint256 indexed tokenId, address indexed smartBasket); event BasketAdd(address indexed contractAddress, uint256 indexed tokenId, address basketTokenAddress, uint256 basketTokenId); event BasketRemove(address indexed receiver, address indexed contractAddress, uint256 indexed tokenId, address basketTokenAddress, uint256 basketTokenId); function isPaused() external view returns (bool); function getTokenTotalCount(address contractAddress, uint256 tokenId) external view returns (uint256); function getTokenCountByType(address contractAddress, uint256 tokenId, address basketTokenAddress, uint256 basketTokenId) external returns (uint256); function addToBasket(address contractAddress, uint256 tokenId, address basketTokenAddress, uint256 basketTokenId) external returns (bool); function removeFromBasket(address receiver, address contractAddress, uint256 tokenId, address basketTokenAddress, uint256 basketTokenId) external returns (bool); function executeForAccount(address contractAddress, uint256 tokenId, address externalAddress, uint256 ethValue, bytes memory encodedParams) external returns (bytes memory); function getBasketAddressById(address contractAddress, uint256 tokenId) external returns (address); function withdrawEther(address contractAddress, uint256 tokenId, address payable receiver, uint256 amount) external; function withdrawERC20(address contractAddress, uint256 tokenId, address payable receiver, address tokenAddress, uint256 amount) external; function withdrawERC721(address contractAddress, uint256 tokenId, address payable receiver, address nftTokenAddress, uint256 nftTokenId) external; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @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 // IERC721Chargeable.sol -- Part of the Charged Particles Protocol // Copyright (c) 2021 Firma Lux, Inc. <https://charged.fi> // // 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 NON-INFRINGEMENT. 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.0; import "@openzeppelin/contracts-upgradeable/introspection/IERC165Upgradeable.sol"; interface IERC721Chargeable is IERC165Upgradeable { function owner() external view returns (address); function creatorOf(uint256 tokenId) external view returns (address); function balanceOf(address tokenOwner) external view returns (uint256 balance); function ownerOf(uint256 tokenId) external view returns (address tokenOwner); function safeTransferFrom(address from, address to, uint256 tokenId) external; function transferFrom(address from, address to, uint256 tokenId) external; function approve(address to, uint256 tokenId) external; function getApproved(uint256 tokenId) external view returns (address operator); function setApprovalForAll(address operator, bool _approved) external; function isApprovedForAll(address tokenOwner, address operator) external view returns (bool); function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // 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 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:MIT // solhint-disable no-inline-assembly pragma solidity ^0.6.2; import "./interfaces/IRelayRecipient.sol"; /** * A base contract to be inherited by any contract that want to receive relayed transactions * A subclass must use "_msgSender()" instead of "msg.sender" */ abstract contract BaseRelayRecipient is IRelayRecipient { /* * Forwarder singleton we accept calls from */ address public trustedForwarder; function isTrustedForwarder(address forwarder) public override view returns(bool) { return forwarder == trustedForwarder; } /** * return the sender of this call. * if the call came through our trusted forwarder, return the original sender. * otherwise, return `msg.sender`. * should be used in the contract anywhere instead of msg.sender */ function _msgSender() internal override virtual view returns (address payable ret) { if (msg.data.length >= 24 && isTrustedForwarder(msg.sender)) { // At this point we know that the sender is a trusted forwarder, // so we trust that the last bytes of msg.data are the verified sender address. // extract sender address from the end of msg.data assembly { ret := shr(96,calldataload(sub(calldatasize(),20))) } } else { return msg.sender; } } /** * return the msg.data of this call. * if the call came through our trusted forwarder, then the real sender was appended as the last 20 bytes * of the msg.data - so this method will strip those 20 bytes off. * otherwise, return `msg.data` * should be used in the contract instead of msg.data, where the difference matters (e.g. when explicitly * signing or hashing the */ function _msgData() internal override virtual view returns (bytes memory ret) { if (msg.data.length >= 24 && isTrustedForwarder(msg.sender)) { // At this point we know that the sender is a trusted forwarder, // we copy the msg.data , except the last 20 bytes (and update the total length) assembly { let ptr := mload(0x40) // copy only size-20 bytes let size := sub(calldatasize(),20) // structure RLP data as <offset> <length> <bytes> mstore(ptr, 0x20) mstore(add(ptr,32), size) calldatacopy(add(ptr,64), 0, size) return(ptr, add(size,64)) } } else { return msg.data; } } } // SPDX-License-Identifier:MIT pragma solidity ^0.6.2; /** * a contract must implement this interface in order to support relayed transaction. * It is better to inherit the BaseRelayRecipient as its implementation. */ abstract contract IRelayRecipient { /** * return if the forwarder is trusted to forward relayed transactions to us. * the forwarder is required to verify the sender's signature, and verify * the call is not a replay. */ function isTrustedForwarder(address forwarder) public virtual view returns(bool); /** * return the sender of this call. * if the call came through our trusted forwarder, then the real sender is appended as the last 20 bytes * of the msg.data. * otherwise, return `msg.sender` * should be used in the contract anywhere instead of msg.sender */ function _msgSender() internal virtual view returns (address payable); /** * return the msg.data of this call. * if the call came through our trusted forwarder, then the real sender was appended as the last 20 bytes * of the msg.data - so this method will strip those 20 bytes off. * otherwise, return `msg.data` * should be used in the contract instead of msg.data, where the difference matters (e.g. when explicitly * signing or hashing the */ function _msgData() internal virtual view returns (bytes memory); function versionRecipient() external virtual view returns (string memory); } // SPDX-License-Identifier: MIT 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) { // 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); } } } } // 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); } // SPDX-License-Identifier: MIT pragma solidity ^0.6.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; import "../../introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transfered 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 pragma solidity ^0.6.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); }
@notice Sets a Timelock on the ability to Discharge the Interest of a Particle @param contractAddress The Address to the NFT to Timelock @param tokenId The token ID of the NFT to Timelock @param unlockBlock The Ethereum Block-number to Timelock until (~15 seconds per block) Clear Timelock Set Timelock
function setDischargeTimelock( address contractAddress, uint256 tokenId, uint256 unlockBlock ) external override virtual { address sender = _msgSender(); uint256 tokenUuid = contractAddress.getTokenUUID(tokenId); if (unlockBlock == 0 && _nftState[tokenUuid].dischargeTimelock.lockedBy == sender) { delete _nftState[tokenUuid].dischargeTimelock.unlockBlock; delete _nftState[tokenUuid].dischargeTimelock.lockedBy; } else { require(_isApprovedForTimelock(contractAddress, tokenId, sender), "CP:E-105"); require(block.number >= _nftState[tokenUuid].dischargeTimelock.unlockBlock, "CP:E-302"); _nftState[tokenUuid].dischargeTimelock.unlockBlock = unlockBlock; _nftState[tokenUuid].dischargeTimelock.lockedBy = sender; } emit TokenDischargeTimelock(contractAddress, tokenId, sender, unlockBlock); }
354,502
[ 1, 2785, 279, 12652, 292, 975, 603, 326, 7123, 358, 3035, 16385, 326, 5294, 395, 434, 279, 6393, 3711, 225, 6835, 1887, 225, 1021, 5267, 358, 326, 423, 4464, 358, 12652, 292, 975, 225, 1147, 548, 1850, 1021, 1147, 1599, 434, 326, 423, 4464, 358, 12652, 292, 975, 225, 7186, 1768, 1377, 1021, 512, 18664, 379, 3914, 17, 2696, 358, 12652, 292, 975, 3180, 261, 98, 3600, 3974, 1534, 1203, 13, 10121, 12652, 292, 975, 1000, 12652, 292, 975, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 225, 445, 444, 1669, 16385, 10178, 292, 975, 12, 203, 565, 1758, 6835, 1887, 16, 203, 565, 2254, 5034, 1147, 548, 16, 203, 565, 2254, 5034, 7186, 1768, 203, 225, 262, 203, 565, 3903, 203, 565, 3849, 203, 565, 5024, 203, 225, 288, 203, 565, 1758, 5793, 273, 389, 3576, 12021, 5621, 203, 565, 2254, 5034, 1147, 5897, 273, 6835, 1887, 18, 588, 1345, 5562, 12, 2316, 548, 1769, 203, 203, 565, 309, 261, 26226, 1768, 422, 374, 597, 389, 82, 1222, 1119, 63, 2316, 5897, 8009, 2251, 16385, 10178, 292, 975, 18, 15091, 858, 422, 5793, 13, 288, 203, 1377, 1430, 389, 82, 1222, 1119, 63, 2316, 5897, 8009, 2251, 16385, 10178, 292, 975, 18, 26226, 1768, 31, 203, 1377, 1430, 389, 82, 1222, 1119, 63, 2316, 5897, 8009, 2251, 16385, 10178, 292, 975, 18, 15091, 858, 31, 203, 565, 289, 203, 203, 565, 469, 288, 203, 1377, 2583, 24899, 291, 31639, 1290, 10178, 292, 975, 12, 16351, 1887, 16, 1147, 548, 16, 5793, 3631, 315, 4258, 30, 41, 17, 21661, 8863, 203, 1377, 2583, 12, 2629, 18, 2696, 1545, 389, 82, 1222, 1119, 63, 2316, 5897, 8009, 2251, 16385, 10178, 292, 975, 18, 26226, 1768, 16, 315, 4258, 30, 41, 17, 23, 3103, 8863, 203, 203, 1377, 389, 82, 1222, 1119, 63, 2316, 5897, 8009, 2251, 16385, 10178, 292, 975, 18, 26226, 1768, 273, 7186, 1768, 31, 203, 1377, 389, 82, 1222, 1119, 63, 2316, 5897, 8009, 2251, 16385, 10178, 292, 975, 18, 15091, 858, 273, 5793, 31, 203, 565, 289, 203, 2 ]
./full_match/5/0xf8142075e221e4D746dAFdFB7131F97fBcC54381/sources/UnleashedNFTStaking.sol
Function to withdraw multiple tokens Make sure the user has at least one token staked before withdrawing
function withdraw(uint256[] memory _tokenIds) external nonReentrant { uint256 _stakedTokensLength = stakers[msg.sender].stakedTokens.length; require( _stakedTokensLength > 0, "You have no tokens staked" ); for (uint256 i = 0; i < _tokenIds.length; i++) { withdrawInternalLogic(_tokenIds[i], _stakedTokensLength); } }
1,951,569
[ 1, 2083, 358, 598, 9446, 3229, 2430, 4344, 3071, 326, 729, 711, 622, 4520, 1245, 1147, 384, 9477, 1865, 598, 9446, 310, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 598, 9446, 12, 11890, 5034, 8526, 3778, 389, 2316, 2673, 13, 3903, 1661, 426, 8230, 970, 288, 203, 203, 4202, 2254, 5034, 389, 334, 9477, 5157, 1782, 273, 384, 581, 414, 63, 3576, 18, 15330, 8009, 334, 9477, 5157, 18, 2469, 31, 7010, 3639, 2583, 12, 203, 5411, 389, 334, 9477, 5157, 1782, 405, 374, 16, 203, 5411, 315, 6225, 1240, 1158, 2430, 384, 9477, 6, 203, 3639, 11272, 203, 203, 3639, 364, 261, 11890, 5034, 277, 273, 374, 31, 277, 411, 389, 2316, 2673, 18, 2469, 31, 277, 27245, 288, 203, 5411, 598, 9446, 3061, 20556, 24899, 2316, 2673, 63, 77, 6487, 389, 334, 9477, 5157, 1782, 1769, 7010, 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 ]
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {AccessControlEnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol"; import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import {IAaveLendingPool} from "../Aave/interfaces/IAaveLendingPool.sol"; import {IAaveIncentivesController} from "../Aave/interfaces/IAaveIncentivesController.sol"; import {IStakedToken} from "../Aave/interfaces/IStakedToken.sol"; import {IBNPLBankNode} from "./interfaces/IBNPLBankNode.sol"; import {IBNPLNodeStakingPool} from "./interfaces/IBNPLNodeStakingPool.sol"; import {IBNPLSwapMarket} from "../SwapMarket/interfaces/IBNPLSwapMarket.sol"; import {IMintableBurnableTokenUpgradeable} from "../ERC20/interfaces/IMintableBurnableTokenUpgradeable.sol"; import {IBankNodeManager} from "../Management/BankNodeManager.sol"; import {BNPLKYCStore} from "../Management/BNPLKYCStore.sol"; import {TransferHelper} from "../Utils/TransferHelper.sol"; import {BankNodeUtils} from "./lib/BankNodeUtils.sol"; /// @title BNPL BankNode contract /// /// @notice /// - Features: /// **Deposit USDT** /// **Withdraw USDT** /// **Donate USDT** /// **Loan request** /// **Loan approval/rejected** /// **Deposit USDT to AAVE** /// **Withdraw USDT from AAVE** /// **Claim stkAAVE** /// **Repayment:** /// **Swap 20% USDT interests to BNPL in Sushiswap for bonder and staker interest** /// **Reportoverdue:** /// **Swap BNPL to USDT in Sushiswap for the slashing functionPlatform** /// **Claim bank node rewards** /// @author BNPL contract BNPLBankNode is Initializable, AccessControlEnumerableUpgradeable, ReentrancyGuardUpgradeable, IBNPLBankNode { /// @dev Emitted when user `user` is adds `depositAmount` of liquidity while receiving `issueAmount` of pool tokens event LiquidityAdded(address indexed user, uint256 depositAmount, uint256 poolTokensIssued); /// @dev Emitted when user `user` burns `withdrawAmount` of pool tokens while receiving `issueAmount` of pool tokens event LiquidityRemoved(address indexed user, uint256 withdrawAmount, uint256 poolTokensConsumed); /// @dev Emitted when user `user` donates `donationAmount` of base liquidity tokens to the pool event Donation(address indexed user, uint256 donationAmount); /// @dev Emitted when user `user` requests a loan of `loanAmount` with a loan request id of loanRequestId event LoanRequested(address indexed borrower, uint256 loanAmount, uint256 loanRequestId, string uuid); /// @dev Emitted when a node manager `operator` denies a loan request with id `loanRequestId` event LoanDenied(address indexed borrower, uint256 loanRequestId, address operator); /// @dev Emitted when a node manager `operator` approves a loan request with id `loanRequestId` event LoanApproved( address indexed borrower, uint256 loanRequestId, uint256 loanId, uint256 loanAmount, address operator ); /// @dev Emitted when user `borrower` makes a payment on the loan request with id `loanRequestId` event LoanPayment(address indexed borrower, uint256 loanId, uint256 paymentAmount); struct LoanRequest { address borrower; uint256 loanAmount; uint64 totalLoanDuration; uint32 numberOfPayments; uint256 amountPerPayment; uint256 interestRatePerPayment; uint8 status; // 0 = under review, 1 = rejected, 2 = cancelled, 3 = *unused for now*, 4 = approved uint64 statusUpdatedAt; address statusModifiedBy; uint256 interestRate; uint256 loanId; uint8 messageType; // 0 = plain text, 1 = encrypted with the public key string message; string uuid; } bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE"); bytes32 public constant OPERATOR_ADMIN_ROLE = keccak256("OPERATOR_ADMIN_ROLE"); uint256 public constant UNUSED_FUNDS_MIN_DEPOSIT_SIZE = 1; /// @notice The min loan duration (secs) uint256 public constant MIN_LOAN_DURATION = 30 days; /// @notice The min loan payment interval (secs) uint256 public constant MIN_LOAN_PAYMENT_INTERVAL = 2 days; /// @notice The max loan duration (secs) uint256 public constant MAX_LOAN_DURATION = 1825 days; /// @notice The max loan payment interval (secs) uint256 public constant MAX_LOAN_PAYMENT_INTERVAL = 180 days; uint32 public constant LENDER_NEEDS_KYC = 1 << 1; uint32 public constant BORROWER_NEEDS_KYC = 1 << 2; /// @dev `5192296858534827628530496329219840` wei uint256 public constant MAX_LOAN_AMOUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFF00; /// @dev `100000000` wei uint256 public constant MIN_LOAN_AMOUNT = 0x5f5e100; /// @notice Liquidity token contract (ex. USDT) IERC20 public override baseLiquidityToken; /// @notice Pool liquidity token contract (ex. Pool USDT) IMintableBurnableTokenUpgradeable public override poolLiquidityToken; /// @notice BNPL token contract IERC20 public bnplToken; /// @dev Lending mode (1) uint16 public override unusedFundsLendingMode; /// @notice AAVE lending pool contract address IAaveLendingPool public override unusedFundsLendingContract; /// @notice AAVE tokens contract IERC20 public override unusedFundsLendingToken; /// @notice AAVE incentives controller contract IAaveIncentivesController public override unusedFundsIncentivesController; /// @notice The configured lendable token swap market contract (ex. SushiSwap Router) IBNPLSwapMarket public override bnplSwapMarket; /// @notice The configured swap market fee uint24 public override bnplSwapMarketPoolFee; /// @notice The id of bank node uint32 public override bankNodeId; /// @notice The staking pool proxy contract IBNPLNodeStakingPool public override nodeStakingPool; /// @notice The bank node manager proxy contract IBankNodeManager public override bankNodeManager; /// @notice Liquidity token (ex. USDT) balance of this uint256 public override baseTokenBalance; /// @notice The balance of bank node admin uint256 public override nodeOperatorBalance; /// @notice Accounts receivable from loans uint256 public override accountsReceivableFromLoans; /// @notice Pool liquidity tokens (ex. Pool USDT) circulating uint256 public override poolTokensCirculating; /// @notice Current loan request index (pending) uint256 public override loanRequestIndex; /// @notice Number of loans in progress uint256 public override onGoingLoanCount; /// @notice Current loan index (approved) uint256 public override loanIndex; /// @notice The total amount of all activated loans uint256 public override totalAmountOfActiveLoans; /// @notice The total amount of all loans uint256 public override totalAmountOfLoans; /// @notice [Loan request id] => [Loan request] mapping(uint256 => LoanRequest) public override loanRequests; /// @notice [Loan id] => [Loan] mapping(uint256 => Loan) public override loans; /// @notice [Loan id] => [Interest paid for] mapping(uint256 => uint256) public override interestPaidForLoan; /// @notice The total loss amount of bank node uint256 public override totalLossAllTime; /// @notice The total number of loans defaulted uint256 public override totalLoansDefaulted; /// @notice The total amount of net earnings uint256 public override netEarnings; /// @notice Cumulative value of donate amounts uint256 public override totalDonatedAllTime; /// @notice The corresponding id in the BNPL KYC store uint32 public override kycDomainId; /// @notice The BNPL KYC store contract BNPLKYCStore public override bnplKYCStore; /// @notice Get bank node KYC mode /// @return kycMode function kycMode() external view override returns (uint256) { return bnplKYCStore.domainKycMode(kycDomainId); } /// @notice Get bank node KYC public key /// @return nodeKycPublicKey function nodePublicKey() external view override returns (address) { return bnplKYCStore.publicKeys(kycDomainId); } /// @dev BankNode contract is created and initialized by the BankNodeManager contract /// /// - This contract is called through the proxy. /// /// @param bankNodeInitConfig BankNode configuration (passed in by BankNodeManager contract) /// /// `BankNodeInitializeArgsV1` paramerter structure: /// /// ```solidity /// uint32 bankNodeId // The id of bank node /// uint24 bnplSwapMarketPoolFee // The configured swap market fee /// address bankNodeManager // The address of bank node manager /// address operatorAdmin // The admin with `OPERATOR_ADMIN_ROLE` role /// address operator // The admin with `OPERATOR_ROLE` role /// uint256 bnplToken // BNPL token address /// address bnplSwapMarket // The swap market contract (ex. Sushiswap Router) /// uint16 unusedFundsLendingMode // Lending mode (1) /// address unusedFundsLendingContract // Lending contract (ex. AAVE lending pool) /// address unusedFundsLendingToken // (ex. AAVE aTokens) /// address unusedFundsIncentivesController // (ex. AAVE incentives controller) /// address nodeStakingPool // The staking pool of bank node /// address baseLiquidityToken // Liquidity token contract (ex. USDT) /// address poolLiquidityToken // Pool liquidity token contract (ex. Pool USDT) /// address nodePublicKey // Bank node KYC public key /// uint32 // kycMode Bank node KYC mode /// ``` function initialize(BankNodeInitializeArgsV1 calldata bankNodeInitConfig) external override nonReentrant initializer { require( bankNodeInitConfig.unusedFundsLendingMode == 1, "unused funds lending mode currently only supports aave (1)" ); __Context_init_unchained(); __ReentrancyGuard_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); baseLiquidityToken = IERC20(bankNodeInitConfig.baseLiquidityToken); poolLiquidityToken = IMintableBurnableTokenUpgradeable(bankNodeInitConfig.poolLiquidityToken); bnplToken = IERC20(bankNodeInitConfig.bnplToken); unusedFundsLendingMode = bankNodeInitConfig.unusedFundsLendingMode; unusedFundsLendingToken = IERC20(bankNodeInitConfig.unusedFundsLendingToken); unusedFundsLendingContract = IAaveLendingPool(bankNodeInitConfig.unusedFundsLendingContract); unusedFundsIncentivesController = IAaveIncentivesController(bankNodeInitConfig.unusedFundsIncentivesController); bnplSwapMarket = IBNPLSwapMarket(bankNodeInitConfig.bnplSwapMarket); nodeStakingPool = IBNPLNodeStakingPool(bankNodeInitConfig.nodeStakingPool); bankNodeManager = IBankNodeManager(bankNodeInitConfig.bankNodeManager); bnplSwapMarketPoolFee = bankNodeInitConfig.bnplSwapMarketPoolFee; bankNodeId = bankNodeInitConfig.bankNodeId; if (bankNodeInitConfig.operator != address(0)) { _setupRole(OPERATOR_ROLE, bankNodeInitConfig.operator); } if (bankNodeInitConfig.operatorAdmin != address(0)) { _setupRole(OPERATOR_ADMIN_ROLE, bankNodeInitConfig.operatorAdmin); _setRoleAdmin(OPERATOR_ROLE, OPERATOR_ADMIN_ROLE); } bnplKYCStore = bankNodeManager.bnplKYCStore(); kycDomainId = bnplKYCStore.createNewKYCDomain( address(this), bankNodeInitConfig.nodePublicKey, bankNodeInitConfig.kycMode ); } /// @notice Returns incentives controller reward token (ex. stkAAVE) /// @return stakedAAVE function rewardToken() public view override returns (IStakedToken) { return IStakedToken(unusedFundsIncentivesController.REWARD_TOKEN()); } /// @notice Returns `unusedFundsLendingToken` (ex. AAVE aTokens) balance of this /// @return unusedFundsLendingTokenBalance AAVE aTokens balance of this function getValueOfUnusedFundsLendingDeposits() public view override returns (uint256) { return unusedFundsLendingToken.balanceOf(address(this)); } /// @notice Returns total assets value of bank node /// @return poolTotalAssetsValue function getPoolTotalAssetsValue() public view override returns (uint256) { return baseTokenBalance + getValueOfUnusedFundsLendingDeposits() + accountsReceivableFromLoans; } /// @notice Returns total liquidity assets value of bank node (Exclude `accountsReceivableFromLoans`) /// @return poolTotalLiquidAssetsValue function getPoolTotalLiquidAssetsValue() public view override returns (uint256) { return baseTokenBalance + getValueOfUnusedFundsLendingDeposits(); } /// @notice Pool deposit conversion /// /// @param depositAmount Liquidity token (ex. USDT) amount /// @return poolDepositConversion function getPoolDepositConversion(uint256 depositAmount) public view returns (uint256) { uint256 poolTotalAssetsValue = getPoolTotalAssetsValue(); return (depositAmount * poolTokensCirculating) / (poolTotalAssetsValue > 0 ? poolTotalAssetsValue : 1); } /// @notice Pool withdraw conversion /// /// @param withdrawAmount Pool liquidity token (ex. pUSDT) amount /// @return poolWithdrawConversion function getPoolWithdrawConversion(uint256 withdrawAmount) public view returns (uint256) { return (withdrawAmount * getPoolTotalAssetsValue()) / (poolTokensCirculating > 0 ? poolTokensCirculating : 1); } /// @notice Returns next due timestamp of loan `loanId` /// /// @param loanId The id of loan /// @return loanNextDueDate Next due timestamp function getLoanNextDueDate(uint256 loanId) public view returns (uint64) { Loan memory loan = loans[loanId]; require(loan.loanStartedAt > 0 && loan.numberOfPaymentsMade < loan.numberOfPayments); uint256 nextPaymentDate = ((uint256(loan.numberOfPaymentsMade + 1) * uint256(loan.totalLoanDuration)) / uint256(loan.numberOfPayments)) + uint256(loan.loanStartedAt); return uint64(nextPaymentDate); } /// @dev Withdraw `amount` of base liquidity token from lending contract to this function _withdrawFromAaveToBaseBalance(uint256 amount) private { require(amount != 0, "amount cannot be 0"); uint256 ourAaveBalance = unusedFundsLendingToken.balanceOf(address(this)); require(amount <= ourAaveBalance, "amount exceeds aave balance!"); unusedFundsLendingContract.withdraw(address(baseLiquidityToken), amount, address(this)); baseTokenBalance += amount; } /// @dev Deposit `amount` of base liquidity token from lending contract to this function _depositToAaveFromBaseBalance(uint256 amount) private { require(amount != 0, "amount cannot be 0"); require(amount <= baseTokenBalance, "amount exceeds base token balance!"); baseTokenBalance -= amount; TransferHelper.safeApprove(address(baseLiquidityToken), address(unusedFundsLendingContract), amount); unusedFundsLendingContract.deposit(address(baseLiquidityToken), amount, address(this), 0); } /// @dev Check pool balance, withdraw `amount` of base liquidity token from lending contract to this when `amount` > `baseTokenBalance` function _ensureBaseBalance(uint256 amount) private { require(amount != 0, "amount cannot be 0"); require(getPoolTotalLiquidAssetsValue() >= amount, "amount cannot be greater than total liquid asset value"); if (amount > baseTokenBalance) { uint256 balanceDifference = amount - baseTokenBalance; _withdrawFromAaveToBaseBalance(balanceDifference); } require(amount <= baseTokenBalance, "error ensuring base balance"); } /// @dev Deposit base liquidity token from lending contract to this when `baseTokenBalance` >= `UNUSED_FUNDS_MIN_DEPOSIT_SIZE` function _processMigrateUnusedFundsToLendingPool() private { require(UNUSED_FUNDS_MIN_DEPOSIT_SIZE > 0, "UNUSED_FUNDS_MIN_DEPOSIT_SIZE > 0"); if (baseTokenBalance >= UNUSED_FUNDS_MIN_DEPOSIT_SIZE) { _depositToAaveFromBaseBalance(baseTokenBalance); } } /// @dev Mint `mintAmount` pool tokens for address `user` function _mintPoolTokensForUser(address user, uint256 mintAmount) private { require(user != address(0) && user != address(this), "invalid user"); require(mintAmount != 0, "mint amount cannot be 0"); uint256 newMintTokensCirculating = poolTokensCirculating + mintAmount; poolTokensCirculating = newMintTokensCirculating; poolLiquidityToken.mint(user, mintAmount); require(poolTokensCirculating == newMintTokensCirculating); } /// @dev Handle donate function _processDonation(address sender, uint256 depositAmount) private { require(sender != address(0) && sender != address(this), "invalid sender"); require(depositAmount != 0, "depositAmount cannot be 0"); require(poolTokensCirculating != 0, "poolTokensCirculating must not be 0"); TransferHelper.safeTransferFrom(address(baseLiquidityToken), sender, address(this), depositAmount); baseTokenBalance += depositAmount; totalDonatedAllTime += depositAmount; _processMigrateUnusedFundsToLendingPool(); emit Donation(sender, depositAmount); } /// @dev Called when `poolTokensCirculating` is 0 /// @return poolTokensOut function _setupLiquidityFirst(address user, uint256 depositAmount) private returns (uint256) { require(user != address(0) && user != address(this), "invalid user"); require(depositAmount != 0, "depositAmount cannot be 0"); require(poolTokensCirculating == 0, "poolTokensCirculating must be 0"); uint256 totalAssetValue = getPoolTotalAssetsValue(); TransferHelper.safeTransferFrom(address(baseLiquidityToken), user, address(this), depositAmount); require(poolTokensCirculating == 0, "poolTokensCirculating must be 0"); require(getPoolTotalAssetsValue() == totalAssetValue, "total asset value must not change"); baseTokenBalance += depositAmount; uint256 newTotalAssetValue = getPoolTotalAssetsValue(); require(newTotalAssetValue != 0 && newTotalAssetValue >= depositAmount); uint256 poolTokensOut = newTotalAssetValue; _mintPoolTokensForUser(user, poolTokensOut); emit LiquidityAdded(user, depositAmount, poolTokensOut); _processMigrateUnusedFundsToLendingPool(); return poolTokensOut; } /// @dev Called when `poolTokensCirculating` > 0 /// @return poolTokensOut function _addLiquidityNormal(address user, uint256 depositAmount) private returns (uint256) { require(user != address(0) && user != address(this), "invalid user"); require(depositAmount != 0, "depositAmount cannot be 0"); require(poolTokensCirculating != 0, "poolTokensCirculating must not be 0"); TransferHelper.safeTransferFrom(address(baseLiquidityToken), user, address(this), depositAmount); require(poolTokensCirculating != 0, "poolTokensCirculating cannot be 0"); uint256 totalAssetValue = getPoolTotalAssetsValue(); require(totalAssetValue != 0, "total asset value cannot be 0"); uint256 poolTokensOut = getPoolDepositConversion(depositAmount); baseTokenBalance += depositAmount; _mintPoolTokensForUser(user, poolTokensOut); emit LiquidityAdded(user, depositAmount, poolTokensOut); _processMigrateUnusedFundsToLendingPool(); return poolTokensOut; } /// @dev Handle add liquidity /// @return poolTokensOut function _addLiquidity(address user, uint256 depositAmount) private returns (uint256) { require(user != address(0) && user != address(this), "invalid user"); require(!nodeStakingPool.isNodeDecomissioning(), "BankNode bonded amount is less than 75% of the minimum"); require(depositAmount != 0, "depositAmount cannot be 0"); if (poolTokensCirculating == 0) { return _setupLiquidityFirst(user, depositAmount); } else { return _addLiquidityNormal(user, depositAmount); } } /// @dev Handle remove liquidity /// @return baseTokensOut function _removeLiquidity(address user, uint256 poolTokensToConsume) private returns (uint256) { require(user != address(0) && user != address(this), "invalid user"); require( poolTokensToConsume != 0 && poolTokensToConsume <= poolTokensCirculating, "poolTokenAmount cannot be 0 or more than circulating" ); require(poolTokensCirculating != 0, "poolTokensCirculating must not be 0"); require(getPoolTotalAssetsValue() != 0, "total asset value must not be 0"); uint256 baseTokensOut = getPoolWithdrawConversion(poolTokensToConsume); poolTokensCirculating -= poolTokensToConsume; _ensureBaseBalance(baseTokensOut); require(baseTokenBalance >= baseTokensOut, "base tokens balance must be >= out"); TransferHelper.safeTransferFrom(address(poolLiquidityToken), user, address(this), poolTokensToConsume); baseTokenBalance -= baseTokensOut; TransferHelper.safeTransfer(address(baseLiquidityToken), user, baseTokensOut); emit LiquidityRemoved(user, baseTokensOut, poolTokensToConsume); return baseTokensOut; } /// @notice Donate `depositAmount` liquidity tokens to bankNode /// @param depositAmount Amount of user deposit to liquidity pool function donate(uint256 depositAmount) external override nonReentrant { require(depositAmount != 0, "depositAmount cannot be 0"); _processDonation(msg.sender, depositAmount); } /// @notice Allow users to add liquidity tokens to liquidity pools. /// @dev The user will be issued an equal number of pool tokens /// /// @param depositAmount Amount of user deposit to liquidity pool function addLiquidity(uint256 depositAmount) external override nonReentrant { require(depositAmount != 0, "depositAmount cannot be 0"); require( bnplKYCStore.checkUserBasicBitwiseMode(kycDomainId, msg.sender, LENDER_NEEDS_KYC) == 1, "lender needs kyc" ); _addLiquidity(msg.sender, depositAmount); } /// @notice Allow users to remove liquidity tokens from liquidity pools. /// @dev Users need to replace liquidity tokens with the same amount of pool tokens /// /// @param poolTokensToConsume Amount of user removes from the liquidity pool function removeLiquidity(uint256 poolTokensToConsume) external override nonReentrant { _removeLiquidity(msg.sender, poolTokensToConsume); } /// @dev Handle request loan function _requestLoan( address borrower, uint256 loanAmount, uint64 totalLoanDuration, uint32 numberOfPayments, uint256 interestRatePerPayment, uint8 messageType, string memory message, string memory uuid ) private { require(loanAmount <= MAX_LOAN_AMOUNT && loanAmount >= MIN_LOAN_AMOUNT && interestRatePerPayment > 0); uint256 amountPerPayment = BankNodeUtils.getMonthlyPayment( loanAmount, interestRatePerPayment, numberOfPayments ); require(loanAmount <= (amountPerPayment * uint256(numberOfPayments)), "payments not greater than loan amount!"); require( ((totalLoanDuration / uint256(numberOfPayments)) * uint256(numberOfPayments)) == totalLoanDuration, "totalLoanDuration must be a multiple of numberOfPayments" ); require(totalLoanDuration >= MIN_LOAN_DURATION, "must be greater than MIN_LOAN_DURATION"); require(totalLoanDuration <= MAX_LOAN_DURATION, "must be lower than MAX_LOAN_DURATION"); require( (uint256(totalLoanDuration) / uint256(numberOfPayments)) >= MIN_LOAN_PAYMENT_INTERVAL, "must be greater than MIN_LOAN_PAYMENT_INTERVAL" ); require( (uint256(totalLoanDuration) / uint256(numberOfPayments)) <= MAX_LOAN_PAYMENT_INTERVAL, "must be lower than MAX_LOAN_PAYMENT_INTERVAL" ); uint256 currentLoanRequestId = loanRequestIndex; loanRequestIndex += 1; LoanRequest storage loanRequest = loanRequests[currentLoanRequestId]; require(loanRequest.borrower == address(0)); loanRequest.borrower = borrower; loanRequest.loanAmount = loanAmount; loanRequest.totalLoanDuration = totalLoanDuration; loanRequest.interestRatePerPayment = interestRatePerPayment; loanRequest.numberOfPayments = numberOfPayments; loanRequest.amountPerPayment = amountPerPayment; loanRequest.status = 0; loanRequest.messageType = messageType; loanRequest.message = message; loanRequest.uuid = uuid; emit LoanRequested(borrower, loanAmount, currentLoanRequestId, uuid); } /// @notice Allows users to request a loan from the bank node /// /// @param loanAmount The loan amount /// @param totalLoanDuration The total loan duration (secs) /// @param numberOfPayments The number of payments /// @param interestRatePerPayment The interest rate per payment /// @param messageType 0 = plain text, 1 = encrypted with the public key /// @param message Writing detailed messages may increase loan approval rates /// @param uuid The `LoanRequested` event contains this uuid for easy identification function requestLoan( uint256 loanAmount, uint64 totalLoanDuration, uint32 numberOfPayments, uint256 interestRatePerPayment, uint8 messageType, string memory message, string memory uuid ) external override nonReentrant { require( bnplKYCStore.checkUserBasicBitwiseMode(kycDomainId, msg.sender, BORROWER_NEEDS_KYC) == 1, "borrower needs kyc" ); _requestLoan( msg.sender, loanAmount, totalLoanDuration, numberOfPayments, interestRatePerPayment, messageType, message, uuid ); } /// @dev Handle approve loan request function _approveLoanRequest(address operator, uint256 loanRequestId) private { require(loanRequestId < loanRequestIndex, "loan request must exist"); LoanRequest storage loanRequest = loanRequests[loanRequestId]; require(loanRequest.borrower != address(0)); require(loanRequest.status == 0, "loan must not already be approved/rejected"); require(!nodeStakingPool.isNodeDecomissioning(), "BankNode bonded amount is less than 75% of the minimum"); uint256 loanAmount = loanRequest.loanAmount; require( loanAmount <= (loanRequest.amountPerPayment * uint256(loanRequest.numberOfPayments)), "payments not greater than loan amount!" ); require( ((loanRequest.totalLoanDuration / uint256(loanRequest.numberOfPayments)) * uint256(loanRequest.numberOfPayments)) == loanRequest.totalLoanDuration, "totalLoanDuration must be a multiple of numberOfPayments" ); require(loanRequest.totalLoanDuration >= MIN_LOAN_DURATION, "must be greater than MIN_LOAN_DURATION"); require(loanRequest.totalLoanDuration <= MAX_LOAN_DURATION, "must be lower than MAX_LOAN_DURATION"); require( (uint256(loanRequest.totalLoanDuration) / uint256(loanRequest.numberOfPayments)) >= MIN_LOAN_PAYMENT_INTERVAL, "must be greater than MIN_LOAN_PAYMENT_INTERVAL" ); require( (uint256(loanRequest.totalLoanDuration) / uint256(loanRequest.numberOfPayments)) <= MAX_LOAN_PAYMENT_INTERVAL, "must be lower than MAX_LOAN_PAYMENT_INTERVAL" ); uint256 currentLoanId = loanIndex; loanIndex += 1; loanRequest.status = 4; loanRequest.loanId = currentLoanId; loanRequest.statusUpdatedAt = uint64(block.timestamp); loanRequest.statusModifiedBy = operator; Loan storage loan = loans[currentLoanId]; require(loan.borrower == address(0)); loan.borrower = loanRequest.borrower; loan.loanAmount = loanAmount; loan.totalLoanDuration = loanRequest.totalLoanDuration; loan.numberOfPayments = loanRequest.numberOfPayments; loan.amountPerPayment = loanRequest.amountPerPayment; loan.interestRatePerPayment = loanRequest.interestRatePerPayment; loan.loanStartedAt = uint64(block.timestamp); loan.numberOfPaymentsMade = 0; loan.remainingBalance = uint256(loan.numberOfPayments) * uint256(loan.amountPerPayment); loan.status = 0; loan.loanRequestId = loanRequestId; onGoingLoanCount++; totalAmountOfLoans += loanAmount; totalAmountOfActiveLoans += loanAmount; _ensureBaseBalance(loanAmount); baseTokenBalance -= loanAmount; accountsReceivableFromLoans += loanAmount; TransferHelper.safeTransfer(address(baseLiquidityToken), loan.borrower, loanAmount); emit LoanApproved(loan.borrower, loanRequestId, currentLoanId, loanAmount, operator); } /// @dev Handle deny loan request function _denyLoanRequest(address operator, uint256 loanRequestId) private { require(loanRequestId < loanRequestIndex, "loan request must exist"); LoanRequest storage loanRequest = loanRequests[loanRequestId]; require(loanRequest.borrower != address(0)); require(loanRequest.status == 0, "loan must not already be approved/rejected"); loanRequest.status = 1; loanRequest.statusUpdatedAt = uint64(block.timestamp); loanRequest.statusModifiedBy = operator; emit LoanDenied(loanRequest.borrower, loanRequestId, operator); } /// @notice Deny a loan request with id `loanRequestId` /// /// - PRIVILEGES REQUIRED: /// Admins with the role "OPERATOR_ROLE" /// /// @param loanRequestId The id of loan request function denyLoanRequest(uint256 loanRequestId) external override nonReentrant onlyRole(OPERATOR_ROLE) { _denyLoanRequest(msg.sender, loanRequestId); } /// @notice Approve a loan request with id `loanRequestId` /// - This also sends the lending token requested to the borrower /// /// - PRIVILEGES REQUIRED: /// Admins with the role "OPERATOR_ROLE" /// /// @param loanRequestId The id of loan request function approveLoanRequest(uint256 loanRequestId) external override nonReentrant onlyRole(OPERATOR_ROLE) { _approveLoanRequest(msg.sender, loanRequestId); } /// @notice Change kyc settings of bank node /// - Including `setKYCDomainMode` and `setKYCDomainPublicKey` /// /// - PRIVILEGES REQUIRED: /// Admins with the role "OPERATOR_ROLE" /// /// @param kycMode_ KYC mode /// @param nodePublicKey_ Bank node KYC public key function setKYCSettings(uint256 kycMode_, address nodePublicKey_) external override nonReentrant onlyRole(OPERATOR_ROLE) { bnplKYCStore.setKYCDomainMode(kycDomainId, kycMode_); bnplKYCStore.setKYCDomainPublicKey(kycDomainId, nodePublicKey_); } /// @notice Set KYC mode for specified kycdomain /// /// - PRIVILEGES REQUIRED: /// Admins with the role "OPERATOR_ROLE" /// /// @param domain KYC domain /// @param mode KYC mode function setKYCDomainMode(uint32 domain, uint256 mode) external override nonReentrant onlyRole(OPERATOR_ROLE) { bnplKYCStore.setKYCDomainMode(domain, mode); } /// @notice Withdraw `amount` of balance to an address /// /// - PRIVILEGES REQUIRED: /// Admins with the role "OPERATOR_ROLE" /// /// @param amount Withdraw amount /// @param to Receiving address function withdrawNodeOperatorBalance(uint256 amount, address to) external override nonReentrant onlyRole(OPERATOR_ROLE) { require(nodeOperatorBalance >= amount, "cannot withdraw more than nodeOperatorBalance"); _ensureBaseBalance(amount); nodeOperatorBalance -= amount; TransferHelper.safeTransfer(address(baseLiquidityToken), to, amount); } /// @dev Swap liquidity token to BNP for staking pool function _marketBuyBNPLForStakingPool(uint256 amountInBaseToken, uint256 minTokenOut) private { require(amountInBaseToken > 0); TransferHelper.safeApprove(address(baseLiquidityToken), address(bnplSwapMarket), amountInBaseToken); uint256 amountOut = bnplSwapMarket.swapExactTokensForTokens( amountInBaseToken, minTokenOut, BankNodeUtils.getSwapExactTokensPath(address(baseLiquidityToken), address(bnplToken)), address(this), block.timestamp )[2]; require(amountOut >= minTokenOut, "swap amount must >= minTokenOut"); TransferHelper.safeApprove(address(bnplToken), address(nodeStakingPool), amountOut); nodeStakingPool.donateNotCountedInTotal(amountOut); } /// @dev Swap BNPL to liquidity token for slashing function _marketSellBNPLForSlashing(uint256 bnplAmount, uint256 minTokenOut) private { require(bnplAmount > 0); TransferHelper.safeApprove(address(bnplToken), address(bnplSwapMarket), bnplAmount); uint256 amountOut = bnplSwapMarket.swapExactTokensForTokens( bnplAmount, minTokenOut, BankNodeUtils.getSwapExactTokensPath(address(bnplToken), address(baseLiquidityToken)), address(this), block.timestamp )[2]; require(amountOut >= minTokenOut, "swap amount must >= minTokenOut"); baseTokenBalance += amountOut; } /// @dev Handle report overdue loan function _markLoanAsWriteOff(uint256 loanId, uint256 minTokenOut) private { Loan storage loan = loans[loanId]; require(loan.borrower != address(0)); require( loan.loanStartedAt < uint64(block.timestamp), "cannot make the loan payment on same block loan is created" ); require(loan.remainingBalance > 0, "loan must not be paid off"); require(loan.status == 0 || loan.status != 2, "loan must not be paid off or already overdue"); require( getLoanNextDueDate(loanId) < uint64(block.timestamp - bankNodeManager.loanOverdueGracePeriod()), "loan must be overdue" ); require(loan.loanAmount > loan.totalAmountPaid); uint256 startPoolTotalAssetValue = getPoolTotalAssetsValue(); loan.status = 2; onGoingLoanCount--; totalAmountOfActiveLoans -= loan.loanAmount; if (loan.totalAmountPaid >= loan.loanAmount) { netEarnings = netEarnings + loan.totalAmountPaid - loan.loanAmount; } //loan.loanAmount-principalPaidForLoan[loanId] //uint256 total3rdPartyInterestPaid = loanBondedAmount[loanId]; // bnpl market buy is the same amount as the amount bonded, this must change if they are not equal uint256 interestRecirculated = (interestPaidForLoan[loanId] * 7) / 10; // 10% paid to market buy bnpl, 10% bonded uint256 accountsReceivableLoss = loan.loanAmount - (loan.totalAmountPaid - interestPaidForLoan[loanId]); accountsReceivableFromLoans -= accountsReceivableLoss; uint256 prevBalanceEquivalent = startPoolTotalAssetValue - interestRecirculated; totalLossAllTime += prevBalanceEquivalent - getPoolTotalAssetsValue(); totalLoansDefaulted += 1; require(prevBalanceEquivalent > getPoolTotalAssetsValue()); uint256 poolBalance = nodeStakingPool.getPoolTotalAssetsValue(); require(poolBalance > 0); uint256 slashAmount = BankNodeUtils.calculateSlashAmount( prevBalanceEquivalent, prevBalanceEquivalent - getPoolTotalAssetsValue(), poolBalance ); require(slashAmount > 0); nodeStakingPool.slash(slashAmount); _marketSellBNPLForSlashing(slashAmount, minTokenOut); //uint256 lossAmount = accountsReceivableLoss+amountPaidToBNPLMarketBuy; } /// @notice Allows users report a loan with id `loanId` as being overdue /// - This method will call the swap contract, so `minTokenOut` is required /// /// @param loanId The id of loan /// @param minTokenOut The minimum output token of swap, if the swap result is less than this value, it will fail function reportOverdueLoan(uint256 loanId, uint256 minTokenOut) external override nonReentrant { _markLoanAsWriteOff(loanId, minTokenOut); } /// @dev Handle make loan payment function _makeLoanPayment( address payer, uint256 loanId, uint256 minTokenOut ) private { require(loanId < loanIndex, "loan request must exist"); Loan storage loan = loans[loanId]; require(loan.borrower != address(0)); require( loan.loanStartedAt < uint64(block.timestamp), "cannot make the loan payment on same block loan is created" ); require( uint64(block.timestamp - bankNodeManager.loanOverdueGracePeriod()) <= getLoanNextDueDate(loanId), "loan is overdue and exceeding the grace period" ); uint256 currentPaymentId = loan.numberOfPaymentsMade; require( currentPaymentId < loan.numberOfPayments && loan.remainingBalance > 0 && loan.remainingBalance >= loan.amountPerPayment ); uint256 interestAmount = BankNodeUtils.getMonthlyInterestPayment( loan.loanAmount, loan.interestRatePerPayment, loan.numberOfPayments, loan.numberOfPaymentsMade + 1 ); uint256 holdInterest = (interestAmount * 3) / 10; //uint returnInterest = interestAmount - holdInterest; uint256 bondedInterest = holdInterest / 3; uint256 marketBuyInterest = holdInterest - bondedInterest; uint256 amountPerPayment = loan.amountPerPayment; require(interestAmount > 0 && bondedInterest > 0 && marketBuyInterest > 0 && amountPerPayment > interestAmount); TransferHelper.safeTransferFrom(address(baseLiquidityToken), payer, address(this), amountPerPayment); loan.totalAmountPaid += amountPerPayment; loan.remainingBalance -= amountPerPayment; // rounding errors can sometimes cause this to integer overflow, so we add a Math.min around the accountsReceivableFromLoans update accountsReceivableFromLoans -= BankNodeUtils.min( amountPerPayment - interestAmount, accountsReceivableFromLoans ); interestPaidForLoan[loanId] += interestAmount; loan.numberOfPaymentsMade = loan.numberOfPaymentsMade + 1; nodeOperatorBalance += bondedInterest; baseTokenBalance += amountPerPayment - holdInterest; _marketBuyBNPLForStakingPool(marketBuyInterest, minTokenOut); if (loan.remainingBalance == 0) { loan.status = 1; loan.statusUpdatedAt = uint64(block.timestamp); onGoingLoanCount--; totalAmountOfActiveLoans -= loan.loanAmount; if (loan.totalAmountPaid >= loan.loanAmount) { netEarnings = netEarnings + loan.totalAmountPaid - loan.loanAmount; } } _processMigrateUnusedFundsToLendingPool(); emit LoanPayment(loan.borrower, loanId, amountPerPayment); } /// @notice Make a loan payment for loan with id `loanId` /// - This method will call the swap contract, so `minTokenOut` is required /// /// @param loanId The id of loan /// @param minTokenOut The minimum output token of swap, if the swap result is less than this value, it will fail function makeLoanPayment(uint256 loanId, uint256 minTokenOut) external override nonReentrant { _makeLoanPayment(msg.sender, loanId, minTokenOut); } /// @dev Returns `unusedFundsLendingToken` as array function _dividendAssets() internal view returns (address[] memory) { address[] memory assets = new address[](1); assets[0] = address(unusedFundsLendingToken); return assets; } /// @notice Get reward token (stkAAVE) unclaimed rewards balance of bank node /// @return rewardsBalance function getRewardsBalance() external view override returns (uint256) { return unusedFundsIncentivesController.getRewardsBalance(_dividendAssets(), address(this)); } /// @notice Get reward token (stkAAVE) cool down start time of staking pool /// @return cooldownStartTimestamp function getCooldownStartTimestamp() external view override returns (uint256) { return rewardToken().stakersCooldowns(address(nodeStakingPool)); } /// @notice Get reward token (stkAAVE) rewards balance of staking pool /// @return stakedTokenRewardsBalance function getStakedTokenRewardsBalance() external view override returns (uint256) { return rewardToken().getTotalRewardsBalance(address(nodeStakingPool)); } /// @notice Get reward token (stkAAVE) balance of staking pool /// @return stakedTokenBalance function getStakedTokenBalance() external view override returns (uint256) { return IERC20(address(rewardToken())).balanceOf(address(nodeStakingPool)); } /// @notice Claim lending token interest /// /// - PRIVILEGES REQUIRED: /// Admins with the role "OPERATOR_ROLE" /// /// @return lendingTokenInterest function claimLendingTokenInterest() external override onlyRole(OPERATOR_ROLE) nonReentrant returns (uint256) { TransferHelper.safeApprove( rewardToken().REWARD_TOKEN(), address(unusedFundsIncentivesController), type(uint256).max ); return unusedFundsIncentivesController.claimRewards( _dividendAssets(), type(uint256).max, address(nodeStakingPool) ); } }
@notice The total amount of all activated loans
uint256 public override totalAmountOfActiveLoans;
6,397,035
[ 1, 1986, 2078, 3844, 434, 777, 14892, 437, 634, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3849, 2078, 6275, 951, 3896, 1504, 634, 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 ]
/** *Submitted for verification at Etherscan.io on 2020-08-23 */ pragma solidity ^0.6.0; import "./SafeMath.sol"; import "./IERC20.sol"; contract zinStake { constructor( ZinFinance _token,address payable _admin) public { token=_token; owner = msg.sender; admin=_admin; } //global Values struct User{ uint256 stakes; uint256 deposit_time; uint256 deposit_payouts; } mapping(address=>User) public userData; using SafeMath for uint256; /** * @notice address of owener */ address payable owner; address payable admin; /** * @notice total stake holders. */ address[] public stakeholders; /** * @notice The stakes for each stakeho /** * @notice deposit_time for each user! */ mapping(address => uint256) public deposit_time; ZinFinance public token; //========Modifiers======== modifier onlyOwner(){ require(msg.sender==owner); _; } //=========**============ function stakeEth() public payable { require(msg.value>=1e18,"minimum 1 eth is required to participate!"); require(userData[msg.sender].stakes==0,"you have already staked!"); userData[msg.sender].deposit_time=now; userData[msg.sender].stakes=msg.value; addStakeholder(msg.sender); } //------------Add Stake holders---------- /** * @notice A method to add a stakeholder. * @param _stakeholder The stakeholder to add. */ function addStakeholder(address _stakeholder) private { (bool _isStakeholder, ) = isStakeholder(_stakeholder); if(!_isStakeholder) stakeholders.push(_stakeholder); } function transferOwnerShip(address payable _owner)public onlyOwner{ owner=_owner; } // ---------- STAKEHOLDERS ---------- /** * @notice A method to check if an address is a stakeholder. * @param _address The address to verify. * @return bool, uint256 Whether the address is a stakeholder, * and if so its position in the stakeholders array. */ function isStakeholder(address _address) public view returns(bool, uint256) { for (uint256 s = 0; s < stakeholders.length; s += 1){ if (_address == stakeholders[s]) return (true, s); } return (false, 0); } function maxPayoutOf(uint256 _amount) pure external returns(uint256) { return (_amount.mul(21)).div(10); } function rewardOfEachUser(address _addr) view external returns(uint256 payout, uint256 max_payout) { max_payout = this.maxPayoutOf(userData[_addr].stakes); if(userData[_addr].deposit_payouts < max_payout) { payout = (calculateDividend(_addr) * ((block.timestamp - userData[_addr].deposit_time) /1 minutes)) - userData[_addr].deposit_payouts; if(userData[_addr].deposit_payouts + payout > max_payout) { payout = max_payout - userData[_addr].deposit_payouts; } } } /** * @notice A simple method that calculates the rewards for each stakeholder. * @param _stakeholder The stakeholder to calculate rewards for. */ function calculateDividend(address _stakeholder) public view returns(uint256) { uint256 reward=208333333; return ((userData[_stakeholder].stakes.div(1000000000000)).mul(reward)); } /** * @notice A method to allow a stakeholder to withdraw his rewards. */ function withdrawReward() public { (uint256 reward,uint256 max_payout)=this.rewardOfEachUser(msg.sender); require(reward>0,"You have no reward!"); require(token.balanceOf(address(this))>=reward,"There are no token to collect right now!"); token.transfer(msg.sender,reward); userData[msg.sender].deposit_payouts+=reward; } function unstake() public { require(now>=userData[msg.sender].deposit_time+1 weeks,"You can't unstake before 1 week"); uint256 adminFee=(userData[msg.sender].stakes*1)/100; uint256 stakes=userData[msg.sender].stakes.sub(adminFee); require(stakes>0,"You have nothing staked!"); require(address(this).balance>=0,"There are no Eth to collect right now"); msg.sender.transfer(stakes); userData[msg.sender].stakes=0; userData[msg.sender].deposit_time=0; userData[msg.sender].deposit_payouts=0; if(userData[msg.sender].stakes==0){ (bool _isStakeholder, uint256 s) = isStakeholder(msg.sender); if(_isStakeholder){ stakeholders[s] = stakeholders[stakeholders.length - 1]; stakeholders.pop(); } } } function liquidityDistribution(uint256 _amount)public onlyOwner{ owner.transfer(_amount); } function totalStakes() public view returns(uint256) { uint256 _totalStakes = 0; for (uint256 s = 0; s < stakeholders.length; s += 1){ _totalStakes = _totalStakes.add(userData[stakeholders[s]].stakes); } return _totalStakes; } function destroy() public onlyOwner { require(token.transfer(owner,token.balanceOf(address(this))),"balance not transferring"); selfdestruct(owner); } }
* @notice A method to allow a stakeholder to withdraw his rewards./
function withdrawReward() public { (uint256 reward,uint256 max_payout)=this.rewardOfEachUser(msg.sender); require(reward>0,"You have no reward!"); require(token.balanceOf(address(this))>=reward,"There are no token to collect right now!"); token.transfer(msg.sender,reward); userData[msg.sender].deposit_payouts+=reward; }
246,025
[ 1, 37, 707, 358, 1699, 279, 384, 911, 4505, 358, 598, 9446, 18423, 283, 6397, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 598, 9446, 17631, 1060, 1435, 7010, 377, 1071, 203, 377, 288, 203, 3639, 261, 11890, 5034, 19890, 16, 11890, 5034, 943, 67, 84, 2012, 13, 33, 2211, 18, 266, 2913, 951, 3442, 1299, 12, 3576, 18, 15330, 1769, 203, 3639, 2583, 12, 266, 2913, 34, 20, 10837, 6225, 1240, 1158, 19890, 4442, 1769, 203, 540, 2583, 12, 2316, 18, 12296, 951, 12, 2867, 12, 2211, 3719, 34, 33, 266, 2913, 10837, 9828, 854, 1158, 1147, 358, 3274, 2145, 2037, 4442, 1769, 203, 540, 1147, 18, 13866, 12, 3576, 18, 15330, 16, 266, 2913, 1769, 203, 540, 13530, 63, 3576, 18, 15330, 8009, 323, 1724, 67, 84, 2012, 87, 15, 33, 266, 2913, 31, 203, 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 ]
/** *Submitted for verification at Etherscan.io on 2021-08-04 */ pragma solidity ^0.4.4; contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @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) returns (bool success) {} /// @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) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is Token { function transfer(address _to, uint256 _value) returns (bool success) { //Default assumes totalSupply can't be over max (2^256 - 1). //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap. //Replace the if with this one instead. //if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { //same as above. Replace this line with the following if you want to protect against wrapping uints. //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; } //name this contract whatever you'd like contract ERC20Token is StandardToken { function () { //if ether is sent to this address, send it back. throw; } /* Public variables of the token */ /* NOTE: The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. */ string public name; //fancy name: eg Simon Bucks uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether. string public symbol; //An identifier: eg SBX string public version = 'H1.0'; //human 0.1 standard. Just an arbitrary versioning scheme. // // CHANGE THESE VALUES FOR YOUR TOKEN // //make sure this function name matches the contract name above. So if you're token is called TutorialToken, make sure the //contract name above is also TutorialToken instead of ERC20Token function ERC20Token( ) { balances[msg.sender] = 100000; // Give the creator all initial tokens (100000 for example) totalSupply = 100000; // Update total supply (100000 for example) name = "Miko Coin"; // Set the name for display purposes decimals = 0; // Amount of decimals for display purposes symbol = "MIKOCOIN"; // Set the symbol for display purposes } /* Approves and then calls the receiving contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
Set the name for display purposes
name = "Miko Coin";
2,032,986
[ 1, 694, 326, 508, 364, 2562, 13694, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 508, 273, 315, 49, 27113, 28932, 14432, 4766, 565, 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 ]
pragma solidity >=0.5.0 <0.7.0; import "./UserAccountInterface.sol"; import "./AccountGasAbstract.sol"; import "../cryptography/ECDSA.sol"; /** * @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) * @notice Defines an account which can be setup by a owner address (multisig contract), recovered by a recover address (a sort of secret multisig contract), and execute actions from a list of addresses (authorized contracts, extensions, etc) */ contract UserAccount is UserAccountInterface, AccountGasAbstract { string internal constant ERR_BAD_PARAMETER = "Bad parameter"; string internal constant ERR_UNAUTHORIZED = "Unauthorized"; string internal constant ERR_CREATE_FAILED = "Contract creation failed"; address public owner; address public recovery; address public actor; constructor(address _owner, address _actor, address _recovery) public { require(_owner != address(0), ERR_BAD_PARAMETER); owner = _owner; actor = _actor; recovery = _recovery; } /** * Allow only calls from itself or directly from owner */ modifier management { require(msg.sender == address(this) || msg.sender == address(owner), ERR_UNAUTHORIZED); _; } /** * @dev Allow calls only from actor to external addresses, or any call from owner */ modifier authorizedAction(address _to) { require( msg.sender == address(this) || ( // self is always authorized msg.sender == actor && //actor is authorized _to != address(this) //only for external address ) || msg.sender == address(owner), //owner is always authorized ERR_UNAUTHORIZED); _; } /** * @notice Defines recovery address. Can only be called by management when no recovery is set, or by recovery. * @param _recovery address of recovery contract */ function setRecovery(address _recovery) external { require( ( recovery == address(0) && (msg.sender == address(this) || msg.sender == owner) ) || msg.sender == recovery, ERR_UNAUTHORIZED ); recovery = _recovery; } /** * @notice Defines the new owner and disable actor. Can only be called by recovery. * @param newOwner an ERC1271 contract or externally owned account */ function recover(address newOwner) external { require(msg.sender == recovery, ERR_UNAUTHORIZED); require(newOwner != address(0), ERR_BAD_PARAMETER); owner = newOwner; actor = address(0); } /** * @notice Changes actor contract * @param _actor Contract which can call actions from this contract */ function setActor(address _actor) external management { actor = _actor; } /** * @notice Replace owner address. * @param newOwner address of externally owned account or ERC1271 contract to control this account */ function changeOwner(address newOwner) external management { require(newOwner != address(0), ERR_BAD_PARAMETER); owner = newOwner; } /** * @notice * @param _execData data to be executed in this contract * @return success status and return data */ function execute( bytes calldata _execData ) external management returns (bool success, bytes memory returndata) { (success, returndata) = address(this).call(_execData); } /** * @notice calls another contract * @param _to destination of call * @param _value call ether value (in wei) * @param _data call data * @return internal transaction status and returned data */ function call( address _to, uint256 _value, bytes calldata _data ) external authorizedAction(_to) returns(bool success, bytes memory returndata) { (success, returndata) = _call(_to, _value, _data); } /** * @notice Approves `_to` spending ERC20 `_baseToken` a total of `_value` and calls `_to` with `_data`. Useful for a better UX on ERC20 token use, and avoid race conditions. * @param _baseToken ERC20 token being approved to spend * @param _to Destination of contract accepting this ERC20 token payments through approve * @param _value amount of ERC20 being approved * @param _data abi encoded calldata to be executed in `_to` after approval. * @return internal transaction status and returned data */ function approveAndCall( address _baseToken, address _to, uint256 _value, bytes calldata _data ) external authorizedAction(_to) returns(bool success, bytes memory returndata) { (success, returndata) = _approveAndCall(_baseToken, _to, _value, _data); } /** * @notice creates new contract based on input `_code` and transfer `_value` ETH to this instance * @param _value amount ether in wei to sent to deployed address at its initialization * @param _code contract code * @return created contract address */ function create( uint256 _value, bytes calldata _code ) external authorizedAction(address(0)) returns(address createdContract) { (createdContract) = _create(_value, _code); require(isContract(createdContract), ERR_CREATE_FAILED); } /** * @notice creates deterministic address contract using on input `_code` and transfer `_value` ETH to this instance * @param _value amount ether in wei to sent to deployed address at its initialization * @param _code contract code * @param _salt changes the resulting address * @return created contract address */ function create2( uint256 _value, bytes calldata _code, bytes32 _salt ) external authorizedAction(address(0)) returns(address createdContract) { (createdContract) = _create2(_value, _code, _salt); require(isContract(createdContract), ERR_CREATE_FAILED); } /** * @notice checks if owner signed `_data`. ERC1271 interface. * @param _data Data signed * @param _signature owner's signature(s) of data */ function isValidSignature( bytes memory _data, bytes memory _signature ) public view returns (bytes4 magicValue) { if(isContract(owner)){ return Signer(owner).isValidSignature(_data, _signature); } else { return owner == ECDSA.recover(ECDSA.toERC191SignedMessage(address(this), _data), _signature) ? MAGICVALUE : bytes4(0xffffffff); } } }
* @notice @param _execData data to be executed in this contract @return success status and return data/
function execute( bytes calldata _execData ) external management returns (bool success, bytes memory returndata) { (success, returndata) = address(this).call(_execData); }
2,559,999
[ 1, 67, 4177, 751, 501, 358, 506, 7120, 316, 333, 6835, 327, 2216, 1267, 471, 327, 501, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 12, 203, 3639, 1731, 745, 892, 389, 4177, 751, 203, 565, 262, 203, 3639, 3903, 203, 3639, 11803, 203, 3639, 1135, 261, 6430, 2216, 16, 1731, 3778, 327, 892, 13, 203, 565, 288, 203, 3639, 261, 4768, 16, 327, 892, 13, 273, 1758, 12, 2211, 2934, 1991, 24899, 4177, 751, 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 ]
./partial_match/1/0xb41159e555Da7a5e1050DE6859D9dE87a0EB8431/sources/JFC.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("Jesus Fucking Christ", "JFC") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); excludeFromMaxTransaction(address(uniswapV2Pair), true); _setAutomatedMarketMakerPair(address(uniswapV2Pair), true); uint256 _buyCharityFee = 0; uint256 _buyMarketingFee = 15; uint256 _buyLiquidityFee = 0; uint256 _buyDevFee = 0; uint256 _sellCharityFee = 0; uint256 _sellMarketingFee = 25; uint256 _sellLiquidityFee = 0; uint256 _sellDevFee = 0; uint256 totalSupply = 10000000000 * 1e18; buyCharityFee = _buyCharityFee; buyMarketingFee = _buyMarketingFee; buyLiquidityFee = _buyLiquidityFee; buyDevFee = _buyDevFee; buyTotalFees = buyCharityFee + buyMarketingFee + buyLiquidityFee + buyDevFee; sellCharityFee = _sellCharityFee; sellMarketingFee = _sellMarketingFee; sellLiquidityFee = _sellLiquidityFee; sellDevFee = _sellDevFee; sellTotalFees = sellCharityFee + sellMarketingFee + sellLiquidityFee + sellDevFee; charityWallet = address(0xDacFd5AD7A6e68C330d5F4e06256f161079aDFa2); marketingWallet = address(0xDacFd5AD7A6e68C330d5F4e06256f161079aDFa2); devWallet = address(0xDacFd5AD7A6e68C330d5F4e06256f161079aDFa2); excludeFromFees(owner(), true); excludeFromFees(address(this), true); excludeFromFees(address(0xdead), true); excludeFromMaxTransaction(owner(), true); excludeFromMaxTransaction(address(this), true); excludeFromMaxTransaction(address(0xdead), true); _mint is an internal function in ERC20.sol that is only called here, and CANNOT be called ever again _mint(msg.sender, totalSupply);
15,992,378
[ 1, 10157, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3885, 1435, 4232, 39, 3462, 2932, 46, 281, 407, 478, 9031, 310, 1680, 86, 376, 3113, 315, 46, 4488, 7923, 288, 203, 3639, 467, 984, 291, 91, 438, 58, 22, 8259, 3103, 389, 318, 291, 91, 438, 58, 22, 8259, 273, 467, 984, 291, 91, 438, 58, 22, 8259, 3103, 12, 203, 5411, 374, 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, 203, 3639, 11272, 203, 203, 3639, 4433, 1265, 2747, 3342, 12, 2867, 24899, 318, 291, 91, 438, 58, 22, 8259, 3631, 638, 1769, 203, 3639, 640, 291, 91, 438, 58, 22, 8259, 273, 389, 318, 291, 91, 438, 58, 22, 8259, 31, 203, 203, 3639, 640, 291, 91, 438, 58, 22, 4154, 273, 467, 984, 291, 91, 438, 58, 22, 1733, 24899, 318, 291, 91, 438, 58, 22, 8259, 18, 6848, 10756, 203, 5411, 263, 2640, 4154, 12, 2867, 12, 2211, 3631, 389, 318, 291, 91, 438, 58, 22, 8259, 18, 59, 1584, 44, 10663, 203, 3639, 4433, 1265, 2747, 3342, 12, 2867, 12, 318, 291, 91, 438, 58, 22, 4154, 3631, 638, 1769, 203, 3639, 389, 542, 22932, 690, 3882, 278, 12373, 4154, 12, 2867, 12, 318, 291, 91, 438, 58, 22, 4154, 3631, 638, 1769, 203, 203, 202, 202, 11890, 5034, 389, 70, 9835, 2156, 560, 14667, 273, 374, 31, 203, 3639, 2254, 5034, 389, 70, 9835, 3882, 21747, 14667, 273, 4711, 31, 203, 3639, 2254, 2 ]
// SPDX-License-Identifier: MIT // Author: Ashhar (RGV2) pragma solidity >=0.8.0 <0.9.0; import "./TMSTicket.sol"; import "./AirlineLibraries.sol"; contract TMSAirline { event Error(string error); event AirlineCreated(string _airlineName, string _airlineSymbol); event StatusUpdated(uint _flightNumber, string _flightDate, FlightStatus _flightStatus, address _address); event FlightCreated(uint _flightNumber, address _address); event FlightModified(uint _flightNumber, address _address); event FlightBalance(uint _airlineBalance); event PenaltyPaid(uint _totalPenaltyAmount); event TicketBooked(address _ticketContract); address payable airlineAdmin = payable(0); address airlineAccount = address(0); enum FlightStatus {SCHEDULED, ONTIME, DELAYED, CANCELLED, DEPARTED, ARRIVED} enum Aircraft {Airbus_320, Boeing_787_Dreamliner} string public airlineName; string public airlineSymbol; // Total amount received for all flights uint private airlineBalance; // Total panelty paid for all flights uint private totalPenaltyAmount; // Airlines data structures struct flightData { uint flightNumber; string source; string destination; uint fixedBasePrice; uint totalSeats; uint totalPassengers; uint256 departureTime; uint256 arrivalTime; uint256 duration; string flightDate; address[] allTicketsInTheFlight; //lists of ticket contracts in a flight mapping(address => bool) ticketExists; Aircraft aircraft; FlightStatus flightStatus; mapping(uint8 => address) reservedSeats; } // Assumption: There will be a single flight in a day with a specific flight number. // Flight history map: [flight number -> date -> flight data] mapping (uint => mapping (string => flightData)) private allFlightDetailsMap; uint[] private allFlights; // user -> contract -> flight data mapping (address => mapping (address => flightData)) private userBookingHistoryMap; // flight -> isFlightActive mapping (uint => bool) private isFlightActive; // Modifiers - START modifier onlyAirline() { require((airlineAccount != address(0)), "Only the Airline can do this & Airline Accounts are not setup yet."); require((msg.sender == airlineAccount) || (msg.sender == airlineAdmin), "Only the Airline can do this."); _; } modifier onlyAirlineAdmin() { require(msg.sender == airlineAdmin, "Only the Airline Admin can do this."); _; } modifier flightActive(uint _flightNumber) { require (isFlightActive[_flightNumber] == true, "Currently the flight is inactive!"); _; } modifier flightInactive(uint _flightNumber) { require (isFlightActive[_flightNumber] == false, "Currently the flight is active!"); _; } modifier nonZeroAddress(address _address) { require(_address != address(0), "Invalid address!"); _; } modifier flightAvailability(uint _flightNumber, string memory _flightDate) { require (allFlightDetailsMap[_flightNumber][_flightDate].flightNumber == _flightNumber, "No flight found!"); _; } modifier newFlightAvailability(uint _flightNumber, uint256 _departureTime) { string memory _flightDate = AirlineLibraries.parseTimestamp(_departureTime); require (allFlightDetailsMap[_flightNumber][_flightDate].flightNumber != _flightNumber, "Flight already present."); _; } modifier validateTimings(uint256 _departureTime, uint256 _arrivalTime) { require (_arrivalTime > _departureTime, "Invalid arrival & departure time."); require (block.timestamp < _departureTime, "Pleae use the future date."); _; } modifier validateFlightDateAndDepartureTime(string memory _flightDate, uint256 _departureTime) { require (AirlineLibraries.compareStrings(_flightDate, AirlineLibraries.parseTimestamp(_departureTime)), "Departure time must be on the flight date."); _; } modifier validateFlightStatus(uint _flightNumber, string memory _flightDate, FlightStatus status){ require (allFlightDetailsMap[_flightNumber][_flightDate].flightStatus != status, "Flight Status is already updated."); require (allFlightDetailsMap[_flightNumber][_flightDate].flightStatus < status, "Flight Status is not modifiable to previous state."); _; } modifier flightNotCancelled(uint _flightNumber, string memory _flightDate){ require (allFlightDetailsMap[_flightNumber][_flightDate].flightStatus != FlightStatus.CANCELLED, "Can't change status, as current status is cancelled."); _; } modifier flightNotArrived(uint _flightNumber, string memory _flightDate){ require (allFlightDetailsMap[_flightNumber][_flightDate].flightStatus != FlightStatus.ARRIVED, "Can't change status, as current status is arrived."); _; } modifier flightNotDeparted(uint _flightNumber, string memory _flightDate){ require (allFlightDetailsMap[_flightNumber][_flightDate].flightStatus != FlightStatus.DEPARTED, "Can't change status, as current status is departed."); _; } // Modifiers - END //constructor function constructor (string memory _airlineName, string memory _airlineSymbol, address _airlineAccount) { airlineName = _airlineName; airlineSymbol = _airlineSymbol; airlineBalance = 0; totalPenaltyAmount = 0; airlineAdmin = payable(msg.sender); airlineAccount = _airlineAccount; __setAirlineAdmin(msg.sender); __setAirlineAccounts(_airlineAccount); emit AirlineCreated(_airlineName, _airlineSymbol); } // Contract Accessors Operations - START function __setAirlineAdmin(address admin) private nonZeroAddress(admin) { airlineAdmin = payable(admin); } function modifyAirlineAdmin(address newAdmin) public onlyAirlineAdmin nonZeroAddress(newAdmin) { airlineAdmin = payable(newAdmin); } function __setAirlineAccounts(address _airlineAccount) private onlyAirlineAdmin nonZeroAddress(_airlineAccount){ airlineAccount = _airlineAccount; } function modifyAirlineAccount(address _airlineAccount) public onlyAirlineAdmin nonZeroAddress(_airlineAccount) { if (airlineAccount != _airlineAccount) { airlineAccount = _airlineAccount; } else { emit Error("The new address entered is same as the existing address."); } } // Contract Accessors Operations - END // New Flight Set-Up - START function setupFlight(uint _flightNumber, string memory _source, string memory _destination, uint _fixedBasePrice, uint256 _departureTime, uint256 _arrivalTime, bool _activeStatus) public onlyAirline validateTimings(_departureTime, _arrivalTime) newFlightAvailability(_flightNumber, _departureTime){ string memory _flightDate = AirlineLibraries.parseTimestamp(_departureTime); if (!(allFlightDetailsMap[_flightNumber][_flightDate].flightNumber == _flightNumber)) { __setupFlight(_flightNumber, _source, _destination, _fixedBasePrice, _departureTime, _arrivalTime, _flightDate, _activeStatus); emit FlightCreated(_flightNumber, msg.sender); } else { emit Error ("Flight already present. Please call modifyFlight() for modifications."); } } // New Flight Set-Up - END // Adding value to the map function __setupFlight(uint _flightNumber, string memory _source, string memory _destination, uint _fixedBasePrice, uint256 _departureTime, uint256 _arrivalTime, string memory _flightDate, bool _activeStatus) private { flightData storage flight = allFlightDetailsMap[_flightNumber][_flightDate]; flight.flightNumber = _flightNumber; flight.source = _source; flight.destination = _destination; flight.fixedBasePrice = _fixedBasePrice; flight.departureTime = _departureTime; flight.arrivalTime = _arrivalTime; flight.flightDate = _flightDate; flight.duration = _arrivalTime - _departureTime; if (flight.duration < 14400) { flight.totalSeats = 170; flight.aircraft = Aircraft.Airbus_320; } else { flight.totalSeats = 240; flight.aircraft = Aircraft.Boeing_787_Dreamliner; } flight.totalPassengers = 0; allFlights.push(_flightNumber); isFlightActive[_flightNumber] = _activeStatus; } // Enable flight function enableFlight(uint _flightNumber) public onlyAirline flightInactive(_flightNumber){ isFlightActive[_flightNumber] = true; } //Disable flight function disableFlight(uint _flightNumber) public onlyAirline flightActive(_flightNumber) { isFlightActive[_flightNumber] = false; } // Modify Flight - START function modifyFlight(uint _flightNumber, string memory _source, string memory _destination, uint _fixedBasePrice, uint256 _departureTime, uint256 _arrivalTime, string memory _flightDate) public onlyAirline flightAvailability(_flightNumber, _flightDate) flightInactive(_flightNumber) validateFlightDateAndDepartureTime(_flightDate, _departureTime) validateTimings(_departureTime, _arrivalTime) { __modifyFlight(_flightNumber, _source, _destination, _fixedBasePrice, _departureTime, _arrivalTime, _flightDate); emit FlightModified(_flightNumber, msg.sender); } // Modify Flight - END // // Modifying values in the map function __modifyFlight(uint _flightNumber, string memory _source, string memory _destination, uint _fixedBasePrice, uint256 _departureTime, uint256 _arrivalTime, string memory _flightDate) private { flightData storage flight = allFlightDetailsMap[_flightNumber][_flightDate]; if (AirlineLibraries.compareStrings(flight.source, _source)) { flight.source = _source; } if (AirlineLibraries.compareStrings(flight.destination, _destination)) { flight.destination = _destination; } if (flight.fixedBasePrice != _fixedBasePrice) { flight.fixedBasePrice = _fixedBasePrice; } if (flight.departureTime != _departureTime) { flight.departureTime = _departureTime; } if (flight.arrivalTime != _arrivalTime) { flight.arrivalTime = _arrivalTime; } if (flight.duration != _arrivalTime - _departureTime) { flight.duration = _arrivalTime - _departureTime; if (flight.duration < 14400) { flight.totalSeats = 170; flight.aircraft = Aircraft.Airbus_320; } else { flight.totalSeats = 240; flight.aircraft = Aircraft.Boeing_787_Dreamliner; } } } // Flight Status Operations - START // TO-DO: Need to implement the status logic like we cannot change status of a cacncelled flight to arrived. function __settleAllTicket(uint _flightNumber, string memory _flightDate) private onlyAirline { address[] memory ticketsToBeSetteled = allFlightDetailsMap[_flightNumber][_flightDate].allTicketsInTheFlight; for (uint i=0; i<ticketsToBeSetteled.length; i++){ TMSTicket(ticketsToBeSetteled[i]).settleTicket(); } } function updateStatus(uint _flightNumber, string calldata _flightDate, FlightStatus _flightStatus) public onlyAirline { allFlightDetailsMap[_flightNumber][_flightDate].flightStatus = _flightStatus; emit StatusUpdated(_flightNumber, _flightDate, _flightStatus, msg.sender); } function __updateStatus(uint _flightNumber, string memory _flightDate, FlightStatus _flightStatus) private onlyAirline { allFlightDetailsMap[_flightNumber][_flightDate].flightStatus = _flightStatus; emit StatusUpdated(_flightNumber, _flightDate, _flightStatus, msg.sender); } function flightOnTime(uint _flightNumber, string memory _flightDate) public validateFlightStatus(_flightNumber, _flightDate, FlightStatus.ONTIME){ __updateStatus(_flightNumber, _flightDate, FlightStatus.ONTIME); } function flightDelayed(uint _flightNumber, string memory _flightDate) public flightNotCancelled(_flightNumber, _flightDate) flightNotArrived(_flightNumber, _flightDate) flightNotDeparted(_flightNumber, _flightDate) validateFlightStatus(_flightNumber, _flightDate, FlightStatus.DELAYED){ __updateStatus(_flightNumber, _flightDate, FlightStatus.DELAYED); } function flightCancelled(uint _flightNumber, string memory _flightDate) public flightNotArrived(_flightNumber, _flightDate) flightNotDeparted(_flightNumber, _flightDate) validateFlightStatus(_flightNumber, _flightDate, FlightStatus.CANCELLED){ __updateStatus(_flightNumber, _flightDate, FlightStatus.CANCELLED); __settleAllTicket(_flightNumber, _flightDate); } function flightDeparted(uint _flightNumber, string memory _flightDate) public flightNotArrived(_flightNumber, _flightDate) validateFlightStatus(_flightNumber, _flightDate, FlightStatus.DEPARTED){ __updateStatus(_flightNumber, _flightDate, FlightStatus.DEPARTED); } function flightArrived(uint _flightNumber, string memory _flightDate) public validateFlightStatus(_flightNumber, _flightDate, FlightStatus.ARRIVED){ __updateStatus(_flightNumber, _flightDate, FlightStatus.ARRIVED); __settleAllTicket(_flightNumber, _flightDate); } // Flight Status Operations - END // Getter for Flight Status - START function getFlightStatus(uint _flightNumber, string calldata _flightDate) public view flightAvailability(_flightNumber, _flightDate) returns (FlightStatus){ return allFlightDetailsMap[_flightNumber][_flightDate].flightStatus; } // Getter for Flight Status - END function getArrTime(uint _flightNumber, string calldata _flightDate) public view flightAvailability(_flightNumber, _flightDate) returns (uint) { return allFlightDetailsMap[_flightNumber][_flightDate].arrivalTime; } function viewContractsList(uint _flightNumber, string calldata _flightDate) public view onlyAirline flightAvailability(_flightNumber, _flightDate) returns (address[] memory){ return allFlightDetailsMap[_flightNumber][_flightDate].allTicketsInTheFlight; } function viewAirlineBalance() public onlyAirline { emit FlightBalance(airlineBalance); } function viewPenaltyPaid() public onlyAirline { emit PenaltyPaid(totalPenaltyAmount); } function getSeatLeft(uint _flightNumber, string calldata _flightDate) public view flightAvailability(_flightNumber, _flightDate) returns (uint) { return allFlightDetailsMap[_flightNumber][_flightDate].totalSeats - allFlightDetailsMap[_flightNumber][_flightDate].totalPassengers; } function getTotalSeats(uint _flightNumber, string calldata _flightDate) public view flightAvailability(_flightNumber, _flightDate) returns (uint) { return allFlightDetailsMap[_flightNumber][_flightDate].totalSeats; } function getFixedBasePrice(uint _flightNumber, string calldata _flightDate) public view flightAvailability(_flightNumber, _flightDate) returns (uint) { return allFlightDetailsMap[_flightNumber][_flightDate].fixedBasePrice; } // Book Ticket: Function for reserving the seat in a flight. function completeReservation(uint _flightNumber, string calldata _flightDate) external returns (uint8 seatNo) { flightData storage flight = allFlightDetailsMap[_flightNumber][_flightDate]; require(flight.ticketExists[msg.sender] == true, "Error: Ticket not associated with this flight"); require(flight.totalPassengers < flight.totalSeats, "Error: No seats left!!"); uint8 _seatNumber = 1; for(uint8 i = 1; i <= flight.totalSeats; i++) { if(flight.reservedSeats[i] == address(0)) { _seatNumber = i; break; } } flight.reservedSeats[_seatNumber] = msg.sender; flight.totalPassengers += 1; return _seatNumber; } function createTicket(uint _flightNumber, string calldata _flightDate, address _customerAddr) external returns (address) { flightData storage flight = allFlightDetailsMap[_flightNumber][_flightDate]; require(flight.totalPassengers < flight.totalSeats, "Error: No seats available"); TMSTicket ticket = new TMSTicket(airlineAccount, _customerAddr, _flightNumber, 0, flight.source, flight.destination, _flightDate, flight.departureTime, flight.arrivalTime, flight.fixedBasePrice); address ticketAddr = address(ticket); flight.allTicketsInTheFlight.push(ticketAddr); flight.ticketExists[ticketAddr] = true; emit TicketBooked(ticketAddr); return ticketAddr; } function cancelReservation(uint _flightNumber, string memory _flightDate, uint8 _seatNo) external { flightData storage flight = allFlightDetailsMap[_flightNumber][_flightDate]; require(flight.ticketExists[msg.sender] == true, "Error: Ticket not associated with this flight"); flight.reservedSeats[_seatNo] = address(0); flight.totalPassengers -= 1; } // Method for searching a flight between two destinations. function searchFlight(string calldata origin, string calldata dest, string calldata travelDate) public view returns (uint flightFound){ for(uint i=0; i < allFlights.length ; i++){ //get the address and send a value if (AirlineLibraries.compareStrings(allFlightDetailsMap[allFlights[i]][travelDate].source, origin) && AirlineLibraries.compareStrings(allFlightDetailsMap[allFlights[i]][travelDate].destination, dest)){ return allFlightDetailsMap[allFlights[i]][travelDate].flightNumber; } } } }
lists of ticket contracts in a flight
address[] allTicketsInTheFlight;
5,438,744
[ 1, 9772, 434, 9322, 20092, 316, 279, 25187, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1758, 8526, 777, 6264, 2413, 382, 1986, 24243, 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 ]
pragma solidity 0.5.4; pragma experimental ABIEncoderV2; import "./Utils.sol"; contract ZetherVerifier { using Utils for uint256; uint256 constant m = 64; uint256 constant n = 6; uint256 constant FIELD_ORDER = 21888242871839275222246405745257275088696311157297823662689037894645226208583; uint256 constant UNITY = 9334303377689037989442018753807510978357674015322511348041267794643984346845; // primitive 2^28th root of unity modulo GROUP_ORDER (not field!) G1Point[] gs; // warning: this and the below are not statically sized anymore G1Point[] hs; // need to push to these if large anonsets are used. G1Point g; G1Point h; uint256[m] twos = powers(2); struct ZetherStatement { G1Point[] CLn; G1Point[] CRn; G1Point[] L; G1Point R; G1Point[] y; uint256 epoch; // or uint8? G1Point u; } struct ZetherProof { uint256 size; // not strictly necessary, but...? G1Point A; G1Point S; G1Point[2] commits; uint256 tauX; uint256 mu; uint256 t; AnonProof anonProof; SigmaProof sigmaProof; InnerProductProof ipProof; } struct AnonProof { G1Point A; G1Point B; G1Point C; G1Point D; G1Point[2][] LG; // flipping the indexing order on this, 'cause... G1Point inOutRG; G1Point gG; G1Point balanceCommitNewLG; G1Point balanceCommitNewRG; G1Point[2][] yG; // assuming this one has the same size..., N / 2 by 2, G1Point parityG0; G1Point parityG1; uint256[2][] f; // and that this has size N - 1 by 2. uint256 zA; uint256 zC; } struct SigmaProof { uint256 c; uint256 sX; uint256 sR; } struct InnerProductProof { G1Point[n] ls; G1Point[n] rs; uint256 a; uint256 b; } constructor() public { g = mapInto("G"); h = mapInto("V"); for (uint256 i = 0; i < m; i++) { gs.push(mapInto("G", i)); hs.push(mapInto("H", i)); } } function baseSize() external view returns (uint256 size) { return gs.length; } function extendBase(uint256 size) external payable { // unfortunate, but necessary. essentially, we need vector bases of arbitrary (linear) length for large anonsets... // could mitigate this by using the logarithmic tricks of Groth and Kohlweiss; see also BCC+15 // but this would cause problems elsewhere: N log N-sized proofs and N log^2(N) prove / verify time. // the increase in proof size is paradoxical: while _f_ will become smaller (log N), you'll need more correction terms // thus a linear persistent space overhead is not so bad in the grand scheme, and we deem this acceptable. for (uint256 i = gs.length; i < size; i++) { gs.push(mapInto("G", i)); hs.push(mapInto("H", i)); } } function verifyTransfer(bytes32[2][] memory CLn, bytes32[2][] memory CRn, bytes32[2][] memory L, bytes32[2] memory R, bytes32[2][] memory y, uint256 epoch, bytes32[2] memory u, bytes memory proof) view public returns (bool) { ZetherStatement memory statement; uint256 size = y.length; require(gs.length >= size, "Inadequate stored vector base! Call extendBase and then try again."); statement.CLn = new G1Point[](size); statement.CRn = new G1Point[](size); statement.L = new G1Point[](size); statement.y = new G1Point[](size); for (uint256 i = 0; i < size; i++) { statement.CLn[i] = G1Point(uint256(CLn[i][0]), uint256(CLn[i][1])); statement.CRn[i] = G1Point(uint256(CRn[i][0]), uint256(CRn[i][1])); statement.L[i] = G1Point(uint256(L[i][0]), uint256(L[i][1])); statement.y[i] = G1Point(uint256(y[i][0]), uint256(y[i][1])); } statement.R = G1Point(uint256(R[0]), uint256(R[1])); statement.epoch = epoch; statement.u = G1Point(uint256(u[0]), uint256(u[1])); ZetherProof memory zetherProof = unserialize(proof); return verify(statement, zetherProof); } struct ZetherAuxiliaries { uint256 y; uint256[m] ys; uint256 z; uint256 zSquared; uint256 zCubed; uint256[m] twoTimesZSquared; uint256 zSum; uint256 k; G1Point tEval; uint256 t; uint256 x; } struct SigmaAuxiliaries { uint256 minusC; G1Point[2][] AL; G1Point Ay; G1Point AD; G1Point gEpoch; G1Point Au; G1Point ADiff; G1Point cCommit; G1Point At; } struct AnonAuxiliaries { uint256 x; uint256[2][] f; uint256 xInv; G1Point inOutR2; G1Point balanceCommitNewL2; G1Point balanceCommitNewR2; uint256[2][2] cycler; // should need no inline declaration / initialization. should be pre-allocated G1Point[2][] L2; G1Point[2][] y2; G1Point parity; G1Point gPrime; } struct IPAuxiliaries { G1Point u; G1Point[m] hPrimes; uint256[m] hExp; G1Point P; uint256 uChallenge; uint256[n] challenges; uint256[m] otherExponents; } function verify(ZetherStatement memory statement, ZetherProof memory proof) view internal returns (bool) { ZetherAuxiliaries memory zetherAuxiliaries; zetherAuxiliaries.y = uint256(keccak256(abi.encode(uint256(keccak256(abi.encode(statement.epoch, statement.R, statement.CLn, statement.CRn, statement.L, statement.y))).mod(), proof.A, proof.S))).mod(); zetherAuxiliaries.ys = powers(zetherAuxiliaries.y); zetherAuxiliaries.z = uint256(keccak256(abi.encode(zetherAuxiliaries.y))).mod(); zetherAuxiliaries.zSquared = zetherAuxiliaries.z.mul(zetherAuxiliaries.z); zetherAuxiliaries.zCubed = zetherAuxiliaries.zSquared.mul(zetherAuxiliaries.z); // zetherAuxiliaries.twoTimesZSquared = times(twos, zetherAuxiliaries.zSquared); for (uint256 i = 0; i < m / 2; i++) { zetherAuxiliaries.twoTimesZSquared[i] = zetherAuxiliaries.zSquared.mul(2 ** i); zetherAuxiliaries.twoTimesZSquared[i + m / 2] = zetherAuxiliaries.zCubed.mul(2 ** i); } zetherAuxiliaries.x = uint256(keccak256(abi.encode(zetherAuxiliaries.z, proof.commits))).mod(); zetherAuxiliaries.zSum = zetherAuxiliaries.zSquared.add(zetherAuxiliaries.zCubed).mul(zetherAuxiliaries.z); zetherAuxiliaries.k = sumScalars(zetherAuxiliaries.ys).mul(zetherAuxiliaries.z.sub(zetherAuxiliaries.zSquared)).sub(zetherAuxiliaries.zSum.mul(2 ** (m / 2)).sub(zetherAuxiliaries.zSum)); zetherAuxiliaries.tEval = add(mul(proof.commits[0], zetherAuxiliaries.x), mul(proof.commits[1], zetherAuxiliaries.x.mul(zetherAuxiliaries.x))); // replace with "commit"? zetherAuxiliaries.t = proof.t.sub(zetherAuxiliaries.k); // begin anon proof. // length equality checks for anonProof members? or during deserialization? AnonProof memory anonProof = proof.anonProof; AnonAuxiliaries memory anonAuxiliaries; G1Point[2] memory parityG = [anonProof.parityG0, anonProof.parityG1]; // breaking this out to avoid stacktoodeep. won't affect encoding anonAuxiliaries.x = uint256(keccak256(abi.encode(zetherAuxiliaries.x, anonProof.LG, anonProof.yG, anonProof.A, anonProof.B, anonProof.C, anonProof.D, anonProof.inOutRG, anonProof.gG, anonProof.balanceCommitNewLG, anonProof.balanceCommitNewRG, parityG))).mod(); anonAuxiliaries.f = new uint256[2][](proof.size); anonAuxiliaries.f[0][0] = anonAuxiliaries.x; anonAuxiliaries.f[0][1] = anonAuxiliaries.x; for (uint i = 1; i < proof.size; i++) { anonAuxiliaries.f[i][0] = anonProof.f[i - 1][0]; anonAuxiliaries.f[i][1] = anonProof.f[i - 1][1]; anonAuxiliaries.f[0][0] = anonAuxiliaries.f[0][0].sub(anonAuxiliaries.f[i][0]); anonAuxiliaries.f[0][1] = anonAuxiliaries.f[0][1].sub(anonAuxiliaries.f[i][1]); } G1Point memory temp; for (uint256 i = 0; i < proof.size; i++) { // comparison of different types? temp = add(temp, mul(gs[i], anonAuxiliaries.f[i][0])); temp = add(temp, mul(hs[i], anonAuxiliaries.f[i][1])); // commutative } require(eq(add(mul(anonProof.B, anonAuxiliaries.x), anonProof.A), add(temp, mul(h, anonProof.zA))), "Recovery failure for B^x * A."); // warning: all hell will break loose if you use an anonset of size > 64 for (uint i = 0; i < proof.size; i++) { anonAuxiliaries.f[i][0] = anonAuxiliaries.f[i][0].mul(anonAuxiliaries.x.sub(anonAuxiliaries.f[i][0])); anonAuxiliaries.f[i][1] = anonAuxiliaries.f[i][1].mul(anonAuxiliaries.x.sub(anonAuxiliaries.f[i][1])); } temp = G1Point(0, 0); for (uint256 i = 0; i < proof.size; i++) { // danger... gs and hs need to be big enough. temp = add(temp, mul(gs[i], anonAuxiliaries.f[i][0])); temp = add(temp, mul(hs[i], anonAuxiliaries.f[i][1])); // commutative } require(eq(add(mul(anonProof.C, anonAuxiliaries.x), anonProof.D), add(temp, mul(h, anonProof.zC))), "Recovery failure for C^x * D."); anonAuxiliaries.f[0][0] = anonAuxiliaries.x; anonAuxiliaries.f[0][1] = anonAuxiliaries.x; for (uint i = 1; i < proof.size; i++) { // need to recompute these. contract too large if use another variable anonAuxiliaries.f[i][0] = anonProof.f[i - 1][0]; anonAuxiliaries.f[i][1] = anonProof.f[i - 1][1]; anonAuxiliaries.f[0][0] = anonAuxiliaries.f[0][0].sub(anonAuxiliaries.f[i][0]); anonAuxiliaries.f[0][1] = anonAuxiliaries.f[0][1].sub(anonAuxiliaries.f[i][1]); } anonAuxiliaries.xInv = anonAuxiliaries.x.inv(); anonAuxiliaries.inOutR2 = add(statement.R, mul(anonProof.inOutRG, anonAuxiliaries.xInv.neg())); anonAuxiliaries.L2 = assembleConvolutions(anonAuxiliaries.f, statement.L); // will internally include _two_ fourier transforms, and split even / odd, etc. anonAuxiliaries.y2 = assembleConvolutions(anonAuxiliaries.f, statement.y); for (uint256 i = 0; i < proof.size / 2; i++) { // order of loops can be switched... // could use _two_ further nested loops inside this, but... for (uint256 j = 0; j < 2; j++) { for (uint256 k = 0; k < 2; k++) { anonAuxiliaries.cycler[k][j] = anonAuxiliaries.cycler[k][j].add(anonAuxiliaries.f[2 * i + k][j]); } anonAuxiliaries.L2[i][j] = mul(add(anonAuxiliaries.L2[i][j], neg(anonProof.LG[i][j])), anonAuxiliaries.xInv); anonAuxiliaries.y2[i][j] = mul(add(anonAuxiliaries.y2[i][j], neg(anonProof.yG[i][j])), anonAuxiliaries.xInv); } } // replace the leftmost column with the Hadamard of the left and right columns. just do the multiplication once... anonAuxiliaries.cycler[0][0] = anonAuxiliaries.cycler[0][0].mul(anonAuxiliaries.cycler[0][1]); anonAuxiliaries.cycler[1][0] = anonAuxiliaries.cycler[1][0].mul(anonAuxiliaries.cycler[1][1]); for (uint256 i = 0; i < proof.size; i++) { anonAuxiliaries.balanceCommitNewL2 = add(anonAuxiliaries.balanceCommitNewL2, mul(statement.CLn[i], anonAuxiliaries.f[i][0])); anonAuxiliaries.balanceCommitNewR2 = add(anonAuxiliaries.balanceCommitNewR2, mul(statement.CRn[i], anonAuxiliaries.f[i][0])); anonAuxiliaries.parity = add(anonAuxiliaries.parity, mul(statement.y[i], anonAuxiliaries.cycler[i % 2][0])); // Hadamard already baked in... } anonAuxiliaries.balanceCommitNewL2 = mul(add(anonAuxiliaries.balanceCommitNewL2, neg(anonProof.balanceCommitNewLG)), anonAuxiliaries.xInv); anonAuxiliaries.balanceCommitNewR2 = mul(add(anonAuxiliaries.balanceCommitNewR2, neg(anonProof.balanceCommitNewRG)), anonAuxiliaries.xInv); require(eq(anonAuxiliaries.parity, add(mul(anonProof.parityG1, anonAuxiliaries.x), anonProof.parityG0)), "Index opposite parity check fail."); anonAuxiliaries.gPrime = mul(add(mul(g, anonAuxiliaries.x), neg(anonProof.gG)), anonAuxiliaries.xInv); SigmaProof memory sigmaProof = proof.sigmaProof; SigmaAuxiliaries memory sigmaAuxiliaries; sigmaAuxiliaries.minusC = sigmaProof.c.neg(); sigmaAuxiliaries.AL = new G1Point[2][](proof.size / 2 - 1); for (uint256 i = 1; i < proof.size / 2; i++) { sigmaAuxiliaries.AL[i - 1][0] = add(mul(anonAuxiliaries.y2[i][0], sigmaProof.sR), mul(anonAuxiliaries.L2[i][0], sigmaAuxiliaries.minusC)); sigmaAuxiliaries.AL[i - 1][1] = add(mul(anonAuxiliaries.y2[i][1], sigmaProof.sR), mul(anonAuxiliaries.L2[i][1], sigmaAuxiliaries.minusC)); } sigmaAuxiliaries.AD = add(mul(anonAuxiliaries.gPrime, sigmaProof.sR), mul(anonAuxiliaries.inOutR2, sigmaAuxiliaries.minusC)); sigmaAuxiliaries.Ay = add(mul(anonAuxiliaries.gPrime, sigmaProof.sX), mul(anonAuxiliaries.y2[0][0], sigmaAuxiliaries.minusC)); sigmaAuxiliaries.gEpoch = mapInto("Zether", statement.epoch); sigmaAuxiliaries.Au = add(mul(sigmaAuxiliaries.gEpoch, sigmaProof.sX), mul(statement.u, sigmaAuxiliaries.minusC)); sigmaAuxiliaries.ADiff = add(mul(add(anonAuxiliaries.y2[0][0], anonAuxiliaries.y2[0][1]), sigmaProof.sR), mul(add(anonAuxiliaries.L2[0][0], anonAuxiliaries.L2[0][1]), sigmaAuxiliaries.minusC)); sigmaAuxiliaries.cCommit = add(add(add(mul(anonAuxiliaries.inOutR2, sigmaProof.sX.mul(zetherAuxiliaries.zSquared)), mul(anonAuxiliaries.balanceCommitNewR2, sigmaProof.sX.mul(zetherAuxiliaries.zCubed).neg())), mul(anonAuxiliaries.balanceCommitNewL2, sigmaProof.c.mul(zetherAuxiliaries.zCubed))), mul(anonAuxiliaries.L2[0][0], sigmaProof.c.mul(zetherAuxiliaries.zSquared).neg())); sigmaAuxiliaries.At = add(add(mul(g, zetherAuxiliaries.t.mul(sigmaProof.c)), mul(h, proof.tauX.mul(sigmaProof.c))), neg(add(sigmaAuxiliaries.cCommit, mul(zetherAuxiliaries.tEval, sigmaProof.c)))); uint256 challenge = uint256(keccak256(abi.encode(anonAuxiliaries.x, sigmaAuxiliaries.AL, sigmaAuxiliaries.Ay, sigmaAuxiliaries.AD, sigmaAuxiliaries.Au, sigmaAuxiliaries.ADiff, sigmaAuxiliaries.At))).mod(); require(challenge == proof.sigmaProof.c, "Sigma protocol challenge equality failure."); IPAuxiliaries memory ipAuxiliaries; ipAuxiliaries.uChallenge = uint256(keccak256(abi.encode(sigmaProof.c, proof.t, proof.tauX, proof.mu))).mod(); // uChallenge ipAuxiliaries.u = mul(g, ipAuxiliaries.uChallenge); ipAuxiliaries.hPrimes = hadamard_inv(hs, zetherAuxiliaries.ys); ipAuxiliaries.hExp = addVectors(times(zetherAuxiliaries.ys, zetherAuxiliaries.z), zetherAuxiliaries.twoTimesZSquared); ipAuxiliaries.P = add(add(proof.A, mul(proof.S, zetherAuxiliaries.x)), mul(sumPoints(gs), zetherAuxiliaries.z.neg())); ipAuxiliaries.P = add(neg(mul(h, proof.mu)), add(ipAuxiliaries.P, commit(ipAuxiliaries.hPrimes, ipAuxiliaries.hExp))); ipAuxiliaries.P = add(ipAuxiliaries.P, mul(ipAuxiliaries.u, proof.t)); // begin inner product verification InnerProductProof memory ipProof = proof.ipProof; for (uint256 i = 0; i < n; i++) { ipAuxiliaries.uChallenge = uint256(keccak256(abi.encode(ipAuxiliaries.uChallenge, ipProof.ls[i], ipProof.rs[i]))).mod(); ipAuxiliaries.challenges[i] = ipAuxiliaries.uChallenge; // overwrites value uint256 xInv = ipAuxiliaries.uChallenge.inv(); ipAuxiliaries.P = add(mul(ipProof.ls[i], ipAuxiliaries.uChallenge.exp(2)), add(mul(ipProof.rs[i], xInv.exp(2)), ipAuxiliaries.P)); } ipAuxiliaries.otherExponents[0] = 1; for (uint256 i = 0; i < n; i++) { ipAuxiliaries.otherExponents[0] = ipAuxiliaries.otherExponents[0].mul(ipAuxiliaries.challenges[i]); } bool[m] memory bitSet; ipAuxiliaries.otherExponents[0] = ipAuxiliaries.otherExponents[0].inv(); for (uint256 i = 0; i < m/2; ++i) { for (uint256 j = 0; (1 << j) + i < m; ++j) { uint256 i1 = i + (1 << j); if (!bitSet[i1]) { uint256 temp = ipAuxiliaries.challenges[n - 1 - j].mul(ipAuxiliaries.challenges[n - 1 - j]); ipAuxiliaries.otherExponents[i1] = ipAuxiliaries.otherExponents[i].mul(temp); bitSet[i1] = true; } } } G1Point memory gTemp; G1Point memory hTemp; for (uint256 i = 0; i < m; i++) { gTemp = add(gTemp, mul(gs[i], ipAuxiliaries.otherExponents[i])); hTemp = add(hTemp, mul(ipAuxiliaries.hPrimes[i], ipAuxiliaries.otherExponents[m - 1 - i])); } G1Point memory cProof = add(add(mul(gTemp, ipProof.a), mul(hTemp, ipProof.b)), mul(ipAuxiliaries.u, ipProof.a.mul(ipProof.b))); require(eq(ipAuxiliaries.P, cProof), "Inner product equality check failure."); return true; } function assembleConvolutions(uint256[2][] memory exponent, G1Point[] memory base) internal view returns (G1Point[2][] memory result) { // exponent is two "rows" (actually columns). // will return two rows, each of half the length of the exponents; // namely, we will return the Hadamards of "base" by the even circular shifts of "exponent"'s rows. uint256 size = exponent.length; result = new G1Point[2][](size / 2); // assuming that this is necessary even when return is declared up top for (uint256 i = 1; i < size / 2; i++) { G1Point memory temp = base[i]; base[i] = base[(size - i) % size]; base[(size - i) % size] = temp; } // performs a "convolutional flip" on the elements of base. G1Point[] memory base_fft = fft(base, false); uint256[] memory temp = new uint256[](size); for (uint256 i = 0; i < 2; i++) { for (uint256 j = 0; j < size; j++) { temp[j] = exponent[j][i]; } uint256[] memory exponent_fft = fft(temp); G1Point[] memory inverse_fft = new G1Point[](size); for (uint256 j = 0; j < size; j++) { // Hadamard inverse_fft[j] = mul(base_fft[j], exponent_fft[j]); } inverse_fft = fft(inverse_fft, true); for (uint256 j = 0; j < size / 2; j++) { result[j][i] = inverse_fft[j * 2]; // only keep the evens } } return result; } function fft(G1Point[] memory input, bool inverse) internal view returns (G1Point[] memory result) { uint256 size = input.length; if (size == 1) { return input; } require(size % 2 == 0, "Input size is not a power of 2!"); uint256 omega = UNITY.exp(2**28 / size); uint256 compensation = 1; if (inverse) { omega = omega.inv(); compensation = 2; } compensation = compensation.inv(); G1Point[] memory even = fft(extract(input, 0), inverse); G1Point[] memory odd = fft(extract(input, 1), inverse); uint256 omega_run = 1; result = new G1Point[](size); for (uint256 i = 0; i < size / 2; i++) { G1Point memory temp = mul(odd[i], omega_run); result[i] = mul(add(even[i], temp), compensation); result[i + size / 2] = mul(add(even[i], neg(temp)), compensation); omega_run = omega_run.mul(omega); } } function extract(G1Point[] memory input, uint256 parity) internal pure returns (G1Point[] memory result) { result = new G1Point[](input.length / 2); for (uint256 i = 0; i < input.length / 2; i++) { result[i] = input[2 * i + parity]; } } function fft(uint256[] memory input) internal view returns (uint256[] memory result) { uint256 size = input.length; if (size == 1) { return input; } require(size % 2 == 0, "Input size is not a power of 2!"); uint256 omega = UNITY.exp(2**28 / size); uint256[] memory even = fft(extract(input, 0)); uint256[] memory odd = fft(extract(input, 1)); uint256 omega_run = 1; result = new uint256[](size); for (uint256 i = 0; i < size / 2; i++) { uint256 temp = odd[i].mul(omega_run); result[i] = even[i].add(temp); result[i + size / 2] = even[i].sub(temp); omega_run = omega_run.mul(omega); } } function extract(uint256[] memory input, uint256 parity) internal pure returns (uint256[] memory result) { result = new uint256[](input.length / 2); for (uint256 i = 0; i < input.length / 2; i++) { result[i] = input[2 * i + parity]; } } function unserialize(bytes memory arr) internal pure returns (ZetherProof memory proof) { proof.A = G1Point(slice(arr, 0), slice(arr, 32)); proof.S = G1Point(slice(arr, 64), slice(arr, 96)); proof.commits = [G1Point(slice(arr, 128), slice(arr, 160)), G1Point(slice(arr, 192), slice(arr, 224))]; proof.t = slice(arr, 256); proof.tauX = slice(arr, 288); proof.mu = slice(arr, 320); SigmaProof memory sigmaProof; sigmaProof.c = slice(arr, 352); sigmaProof.sX = slice(arr, 384); sigmaProof.sR = slice(arr, 416); proof.sigmaProof = sigmaProof; InnerProductProof memory ipProof; for (uint256 i = 0; i < n; i++) { ipProof.ls[i] = G1Point(slice(arr, 448 + i * 64), slice(arr, 480 + i * 64)); ipProof.rs[i] = G1Point(slice(arr, 448 + (n + i) * 64), slice(arr, 480 + (n + i) * 64)); } ipProof.a = slice(arr, 448 + n * 128); ipProof.b = slice(arr, 480 + n * 128); proof.ipProof = ipProof; AnonProof memory anonProof; uint256 size = (arr.length - 1280 - 640) / 192; // warning: this and the below assume that n = 6!!! anonProof.A = G1Point(slice(arr, 1280), slice(arr, 1312)); anonProof.B = G1Point(slice(arr, 1344), slice(arr, 1376)); anonProof.C = G1Point(slice(arr, 1408), slice(arr, 1440)); anonProof.D = G1Point(slice(arr, 1472), slice(arr, 1504)); anonProof.inOutRG = G1Point(slice(arr, 1536), slice(arr, 1568)); anonProof.gG = G1Point(slice(arr, 1600), slice(arr, 1632)); anonProof.balanceCommitNewLG = G1Point(slice(arr, 1664), slice(arr, 1696)); anonProof.balanceCommitNewRG = G1Point(slice(arr, 1728), slice(arr, 1760)); anonProof.parityG0 = G1Point(slice(arr, 1792), slice(arr, 1824)); anonProof.parityG1 = G1Point(slice(arr, 1856), slice(arr, 1888)); anonProof.f = new uint256[2][](size - 1); for (uint256 i = 0; i < size - 1; i++) { anonProof.f[i][0] = slice(arr, 1920 + 32 * i); anonProof.f[i][1] = slice(arr, 1920 + (size - 1 + i) * 32); } anonProof.LG = new G1Point[2][](size / 2); anonProof.yG = new G1Point[2][](size / 2); for (uint256 i = 0; i < size / 2; i++) { anonProof.LG[i][0] = G1Point(slice(arr, 1856 + (size + i) * 64), slice(arr, 1888 + (size + i) * 64)); anonProof.LG[i][1] = G1Point(slice(arr, 1856 + size * 96 + i * 64), slice(arr, 1888 + size * 96 + i * 64)); anonProof.yG[i][0] = G1Point(slice(arr, 1856 + size * 128 + i * 64), slice(arr, 1888 + size * 128 + i * 64)); anonProof.yG[i][1] = G1Point(slice(arr, 1856 + size * 160 + i * 64), slice(arr, 1888 + size * 160 + i * 64)); // these are tricky, and can maybe be optimized further? } proof.size = size; anonProof.zA = slice(arr, 1856 + size * 192); anonProof.zC = slice(arr, 1888 + size * 192); proof.anonProof = anonProof; return proof; } function addVectors(uint256[m] memory a, uint256[m] memory b) internal pure returns (uint256[m] memory result) { for (uint256 i = 0; i < m; i++) { result[i] = a[i].add(b[i]); } } function hadamard_inv(G1Point[] memory ps, uint256[m] memory ss) internal view returns (G1Point[m] memory result) { for (uint256 i = 0; i < m; i++) { result[i] = mul(ps[i], ss[i].inv()); } } function sumScalars(uint256[m] memory ys) internal pure returns (uint256 result) { for (uint256 i = 0; i < m; i++) { result = result.add(ys[i]); } } function sumPoints(G1Point[] memory ps) internal view returns (G1Point memory sum) { for (uint256 i = 0; i < m; i++) { sum = add(sum, ps[i]); } } function commit(G1Point[m] memory ps, uint256[m] memory ss) internal view returns (G1Point memory result) { for (uint256 i = 0; i < m; i++) { // killed a silly initialization with the 0th indexes. [0x00, 0x00] will be treated as the zero point anyway result = add(result, mul(ps[i], ss[i])); } } function powers(uint256 base) internal pure returns (uint256[m] memory powers) { powers[0] = 1; powers[1] = base; for (uint256 i = 2; i < m; i++) { powers[i] = powers[i-1].mul(base); } } function times(uint256[m] memory v, uint256 x) internal pure returns (uint256[m] memory result) { for (uint256 i = 0; i < m; i++) { result[i] = v[i].mul(x); } } function slice(bytes memory input, uint256 start) internal pure returns (uint256 result) { // extracts exactly 32 bytes assembly { let m := mload(0x40) mstore(m, mload(add(add(input, 0x20), start))) // why only 0x20? result := mload(m) } } struct G1Point { uint256 x; uint256 y; } function add(G1Point memory p1, G1Point memory p2) internal view returns (G1Point memory r) { assembly { let m := mload(0x40) mstore(m, mload(p1)) mstore(add(m, 0x20), mload(add(p1, 0x20))) mstore(add(m, 0x40), mload(p2)) mstore(add(m, 0x60), mload(add(p2, 0x20))) if iszero(staticcall(gas, 0x06, m, 0x80, r, 0x40)) { revert(0, 0) } } } function mul(G1Point memory p, uint256 s) internal view returns (G1Point memory r) { assembly { let m := mload(0x40) mstore(m, mload(p)) mstore(add(m, 0x20), mload(add(p, 0x20))) mstore(add(m, 0x40), s) if iszero(staticcall(gas, 0x07, m, 0x60, r, 0x40)) { revert(0, 0) } } } function neg(G1Point memory p) internal pure returns (G1Point memory) { return G1Point(p.x, FIELD_ORDER - (p.y % FIELD_ORDER)); // p.y should already be reduced mod P? } function eq(G1Point memory p1, G1Point memory p2) internal pure returns (bool) { return p1.x == p2.x && p1.y == p2.y; } function fieldExp(uint256 base, uint256 exponent) internal view returns (uint256 output) { // warning: mod p, not q uint256 order = FIELD_ORDER; assembly { let m := mload(0x40) mstore(m, 0x20) mstore(add(m, 0x20), 0x20) mstore(add(m, 0x40), 0x20) mstore(add(m, 0x60), base) mstore(add(m, 0x80), exponent) mstore(add(m, 0xa0), order) if iszero(staticcall(gas, 0x05, m, 0xc0, m, 0x20)) { // staticcall or call? revert(0, 0) } output := mload(m) } } function mapInto(uint256 seed) internal view returns (G1Point memory) { // warning: function totally untested! uint256 y; while (true) { uint256 ySquared = fieldExp(seed, 3) + 3; // addmod instead of add: waste of gas, plus function overhead cost y = fieldExp(ySquared, (FIELD_ORDER + 1) / 4); if (fieldExp(y, 2) == ySquared) { break; } seed += 1; } return G1Point(seed, y); } function mapInto(string memory input) internal view returns (G1Point memory) { // warning: function totally untested! return mapInto(uint256(keccak256(abi.encodePacked(input))) % FIELD_ORDER); } function mapInto(string memory input, uint256 i) internal view returns (G1Point memory) { // warning: function totally untested! return mapInto(uint256(keccak256(abi.encodePacked(input, i))) % FIELD_ORDER); // ^^^ important: i haven't tested this, i.e. whether it agrees with ProofUtils.paddedHash(input, i) (cf. also the go version) } }
could use _two_ further nested loops inside this, but...
for (uint256 j = 0; j < 2; j++) { for (uint256 k = 0; k < 2; k++) { anonAuxiliaries.cycler[k][j] = anonAuxiliaries.cycler[k][j].add(anonAuxiliaries.f[2 * i + k][j]); } anonAuxiliaries.L2[i][j] = mul(add(anonAuxiliaries.L2[i][j], neg(anonProof.LG[i][j])), anonAuxiliaries.xInv); anonAuxiliaries.y2[i][j] = mul(add(anonAuxiliaries.y2[i][j], neg(anonProof.yG[i][j])), anonAuxiliaries.xInv); }
15,868,806
[ 1, 15195, 999, 389, 15415, 67, 9271, 4764, 14075, 4832, 333, 16, 1496, 2777, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 364, 261, 11890, 5034, 525, 273, 374, 31, 525, 411, 576, 31, 525, 27245, 288, 203, 7734, 364, 261, 11890, 5034, 417, 273, 374, 31, 417, 411, 576, 31, 417, 27245, 288, 203, 10792, 30637, 21981, 15700, 5646, 18, 21691, 63, 79, 6362, 78, 65, 273, 30637, 21981, 15700, 5646, 18, 21691, 63, 79, 6362, 78, 8009, 1289, 12, 304, 265, 21981, 15700, 5646, 18, 74, 63, 22, 380, 277, 397, 417, 6362, 78, 19226, 203, 7734, 289, 203, 7734, 30637, 21981, 15700, 5646, 18, 48, 22, 63, 77, 6362, 78, 65, 273, 14064, 12, 1289, 12, 304, 265, 21981, 15700, 5646, 18, 48, 22, 63, 77, 6362, 78, 6487, 4251, 12, 304, 265, 20439, 18, 48, 43, 63, 77, 6362, 78, 5717, 3631, 30637, 21981, 15700, 5646, 18, 92, 3605, 1769, 203, 7734, 30637, 21981, 15700, 5646, 18, 93, 22, 63, 77, 6362, 78, 65, 273, 14064, 12, 1289, 12, 304, 265, 21981, 15700, 5646, 18, 93, 22, 63, 77, 6362, 78, 6487, 4251, 12, 304, 265, 20439, 18, 93, 43, 63, 77, 6362, 78, 5717, 3631, 30637, 21981, 15700, 5646, 18, 92, 3605, 1769, 203, 5411, 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 ]
./full_match/80001/0x49c0e6764BbbD3564bc2070238b35115E00d9ff1/sources/BRUTENFT.sol
* @dev Destroys `tokenId`. The approval is cleared when the token is burned. Requirements: - `tokenId` must exist. Emits a {Transfer} event./ Clear approvals
function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; delete _royaltyFees[tokenId]; delete _creator[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); }
5,641,522
[ 1, 9378, 28599, 1375, 2316, 548, 8338, 1021, 23556, 353, 16054, 1347, 326, 1147, 353, 18305, 329, 18, 29076, 30, 300, 1375, 2316, 548, 68, 1297, 1005, 18, 7377, 1282, 279, 288, 5912, 97, 871, 18, 19, 10121, 6617, 4524, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 70, 321, 12, 11890, 5034, 1147, 548, 13, 2713, 5024, 288, 203, 3639, 1758, 3410, 273, 4232, 39, 27, 5340, 18, 8443, 951, 12, 2316, 548, 1769, 203, 203, 3639, 389, 5771, 1345, 5912, 12, 8443, 16, 1758, 12, 20, 3631, 1147, 548, 1769, 203, 203, 3639, 389, 12908, 537, 12, 2867, 12, 20, 3631, 1147, 548, 1769, 203, 203, 3639, 389, 70, 26488, 63, 8443, 65, 3947, 404, 31, 203, 3639, 1430, 389, 995, 414, 63, 2316, 548, 15533, 203, 3639, 1430, 389, 3800, 15006, 2954, 281, 63, 2316, 548, 15533, 203, 3639, 1430, 389, 20394, 63, 2316, 548, 15533, 203, 203, 3639, 3626, 12279, 12, 8443, 16, 1758, 12, 20, 3631, 1147, 548, 1769, 203, 203, 3639, 389, 5205, 1345, 5912, 12, 8443, 16, 1758, 12, 20, 3631, 1147, 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 ]
./partial_match/1/0xb9Fb1A6fa14a8296b1DE7a2653b1fE6c9DFC1dcB/sources/Market.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 is IOwnable { address internal owner; constructor() public { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner); _; } function getOwner() public view returns (address) { return owner; } function transferOwnership(address _newOwner) public onlyOwner returns (bool) { require(_newOwner != address(0)); onTransferOwnership(owner, _newOwner); owner = _newOwner; return true; } }
9,130,467
[ 1, 5460, 429, 225, 1021, 14223, 6914, 6835, 711, 392, 3410, 1758, 16, 471, 8121, 5337, 6093, 3325, 4186, 16, 333, 9330, 5032, 326, 4471, 434, 315, 1355, 4371, 9654, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 14223, 6914, 353, 1665, 91, 6914, 288, 203, 565, 1758, 2713, 3410, 31, 203, 203, 565, 3885, 1435, 1071, 288, 203, 3639, 3410, 273, 1234, 18, 15330, 31, 203, 565, 289, 203, 203, 565, 9606, 1338, 5541, 1435, 288, 203, 3639, 2583, 12, 3576, 18, 15330, 422, 3410, 1769, 203, 3639, 389, 31, 203, 565, 289, 203, 203, 565, 445, 13782, 1435, 1071, 1476, 1135, 261, 2867, 13, 288, 203, 3639, 327, 3410, 31, 203, 565, 289, 203, 203, 565, 445, 7412, 5460, 12565, 12, 2867, 389, 2704, 5541, 13, 203, 3639, 1071, 203, 3639, 1338, 5541, 203, 3639, 1135, 261, 6430, 13, 203, 565, 288, 203, 3639, 2583, 24899, 2704, 5541, 480, 1758, 12, 20, 10019, 203, 3639, 603, 5912, 5460, 12565, 12, 8443, 16, 389, 2704, 5541, 1769, 203, 3639, 3410, 273, 389, 2704, 5541, 31, 203, 3639, 327, 638, 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 ]
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.7.5; import "../types/Ownable.sol"; import "../libraries/SafeMath.sol"; import "../libraries/SafeERC20.sol"; import "../libraries/FixedPoint.sol"; import "../interfaces/ITreasury.sol"; import "../interfaces/IERC20.sol"; import "../interfaces/IHelper.sol"; import "hardhat/console.sol"; contract CustomBond is Ownable { using FixedPoint for *; using SafeERC20 for IERC20; using SafeMath for uint256; event BondCreated(uint256 deposit, uint256 payout, uint256 expires); event BondRedeemed(address recipient, uint256 payout, uint256 remaining); event BondPriceChanged(uint256 internalPrice, uint256 debtRatio); event ControlVariableAdjustment(uint256 initialBCV, uint256 newBCV, uint256 adjustment, bool addition); event LPAdded(address lpAddress, uint256 lpAmount); IERC20 public immutable PAYOUT_TOKEN; // token paid for principal IERC20 public immutable PRINCIPAL_TOKEN; // inflow token ITreasury public immutable CUSTOM_TREASURY; // pays for and receives principal address public immutable DAO; address public immutable SUBSIDY_ROUTER; // pays subsidy in TAO to custom treasury address public OLY_TREASURY; // receives fee address public immutable HELPER; // helper for helping swap, lend to get lp token uint256 public totalPrincipalBonded; uint256 public totalPayoutGiven; uint256 public totalDebt; // total value of outstanding bonds; used for pricing uint256 public lastDecay; // reference block for debt decay uint256 public payoutSinceLastSubsidy; // principal accrued since subsidy paid Terms public terms; // stores terms for new bonds Adjust public adjustment; // stores adjustment to BCV data FeeTiers[] private feeTiers; // stores fee tiers bool public lpTokenAsFeeFlag;// bool public bondWithOneAssetFlag; mapping(address => Bond) public bondInfo; // stores bond information for depositors struct FeeTiers { uint256 tierCeilings; // principal bonded till next tier uint256 fees; // in ten-thousandths (i.e. 33300 = 3.33%) } // Info for creating new bonds struct Terms { uint256 controlVariable; // scaling variable for price uint256 vestingTerm; // in blocks uint256 minimumPrice; // vs principal value uint256 maxPayout; // in thousandths of a %. i.e. 500 = 0.5% uint256 maxDebt; // payout token decimal debt ratio, max % total supply created as debt } // Info for bond holder struct Bond { uint256 payout; // payout token remaining to be paid uint256 vesting; // Blocks left to vest uint256 lastBlock; // Last interaction uint256 truePricePaid; // Price paid (principal tokens per payout token) in ten-millionths - 4000000 = 0.4 } // Info for incremental adjustments to control variable struct Adjust { bool add; // addition or subtraction uint256 rate; // increment uint256 target; // BCV when adjustment finished uint256 buffer; // minimum length (in blocks) between adjustments uint256 lastBlock; // block when last adjustment made } receive() external payable {} constructor( address _customTreasury, address _payoutToken, address _principalToken, address _olyTreasury, address _subsidyRouter, address _initialOwner, address _dao, address _helper, uint256[] memory _tierCeilings, uint256[] memory _fees ) { require(_customTreasury != address(0), "Factory: customTreasury must not be zero address"); CUSTOM_TREASURY = ITreasury(_customTreasury); require(_payoutToken != address(0), "Factory: payoutToken must not be zero address"); PAYOUT_TOKEN = IERC20(_payoutToken); require(_principalToken != address(0), "Factory: principalToken must not be zero address"); PRINCIPAL_TOKEN = IERC20(_principalToken); require(_olyTreasury != address(0), "Factory: olyTreasury must not be zero address"); OLY_TREASURY = _olyTreasury; require(_subsidyRouter != address(0), "Factory: subsidyRouter must not be zero address"); SUBSIDY_ROUTER = _subsidyRouter; require(_initialOwner != address(0), "Factory: initialOwner must not be zero address"); policy = _initialOwner; require(_dao != address(0), "Factory: DAO must not be zero address"); DAO = _dao; require(_helper != address(0), "Factory: helper must not be zero address"); HELPER = _helper; require(_tierCeilings.length == _fees.length, "tier length and fee length not the same"); for (uint256 i; i < _tierCeilings.length; i++) { feeTiers.push(FeeTiers({tierCeilings: _tierCeilings[i], fees: _fees[i]})); } lpTokenAsFeeFlag = true; } /* ======== INITIALIZATION ======== */ /** * @notice initializes bond parameters * @param _controlVariable uint * @param _vestingTerm uint * @param _minimumPrice uint * @param _maxPayout uint * @param _maxDebt uint * @param _initialDebt uint */ function initializeBond( uint256 _controlVariable, uint256 _vestingTerm, uint256 _minimumPrice, uint256 _maxPayout, uint256 _maxDebt, uint256 _initialDebt ) external onlyPolicy { require(currentDebt() == 0, "Debt must be 0 for initialization"); terms = Terms({ controlVariable: _controlVariable, vestingTerm: _vestingTerm, minimumPrice: _minimumPrice, maxPayout: _maxPayout, maxDebt: _maxDebt }); totalDebt = _initialDebt; lastDecay = block.number; } /** * @notice set control variable adjustment * @param _lpTokenAsFeeFlag bool */ function setLPtokenAsFee(bool _lpTokenAsFeeFlag) external onlyPolicy { lpTokenAsFeeFlag = _lpTokenAsFeeFlag; } /* ======== POLICY FUNCTIONS ======== */ enum PARAMETER { VESTING, PAYOUT, DEBT } /** * @notice set parameters for new bonds * @param _parameter PARAMETER * @param _input uint */ function setBondTerms(PARAMETER _parameter, uint256 _input) external onlyPolicy { if (_parameter == PARAMETER.VESTING) {// 0 require(_input >= 10000, "Vesting must be longer than 36 hours"); terms.vestingTerm = _input; } else if (_parameter == PARAMETER.PAYOUT) {// 1 require(_input <= 1000, "Payout cannot be above 1 percent"); terms.maxPayout = _input; } else if (_parameter == PARAMETER.DEBT) {// 2 terms.maxDebt = _input; } } /** * @notice set control variable adjustment * @param _addition bool * @param _increment uint * @param _target uint * @param _buffer uint */ function setAdjustment( bool _addition, uint256 _increment, uint256 _target, uint256 _buffer ) external onlyPolicy { require(_increment <= terms.controlVariable.mul(30).div(1000), "Increment too large"); adjustment = Adjust({ add: _addition, rate: _increment, target: _target, buffer: _buffer, lastBlock: block.number }); } /** * @notice change address of Treasury * @param _olyTreasury uint */ function changeOlyTreasury(address _olyTreasury) external { require(msg.sender == DAO, "changeOlyTreasury: Only DAO can replace OLY_TREASURY"); OLY_TREASURY = _olyTreasury; } /** * @notice subsidy controller checks payouts since last subsidy and resets counter * @return payoutSinceLastSubsidy_ uint */ function paySubsidy() external returns (uint256 payoutSinceLastSubsidy_) { require(msg.sender == SUBSIDY_ROUTER, "Only subsidy controller"); payoutSinceLastSubsidy_ = payoutSinceLastSubsidy; payoutSinceLastSubsidy = 0; } /* ======== USER FUNCTIONS ======== */ /** * @notice deposit bond * @param _amount uint * @param _maxPrice uint * @param _depositor address * @return uint */ function deposit( uint256 _amount, uint256 _maxPrice, address _depositor ) external returns (uint256) { require(_depositor != address(0), "Invalid address"); decayDebt(); require(totalDebt <= terms.maxDebt, "Max capacity reached"); uint256 nativePrice = trueBondPrice(); require(_maxPrice >= nativePrice, "Slippage limit: more than max price"); // slippage protection uint256 value = CUSTOM_TREASURY.valueOfToken(address(PRINCIPAL_TOKEN), _amount); uint256 payout = _payoutFor(value); // payout to bonder is computed require(payout >= 10**PAYOUT_TOKEN.decimals() / 100, "Bond too small"); // must be > 0.01 payout token ( underflow protection ) require(payout <= maxPayout(), "Bond too large"); // size protection because there is no slippage /** principal is transferred in approved and deposited into the treasury, returning (_amount - profit) payout token */ PRINCIPAL_TOKEN.safeTransferFrom(msg.sender, address(this), _amount); // profits are calculated uint256 fee; /** principal is been taken as fee and trasfered to dao */ if (lpTokenAsFeeFlag) { fee = _amount.mul(currentFluxFee()).div(1e6); if (fee != 0) { PRINCIPAL_TOKEN.transfer(OLY_TREASURY, fee); } } else { fee = payout.mul(currentFluxFee()).div(1e6); } PRINCIPAL_TOKEN.approve(address(CUSTOM_TREASURY), _amount); CUSTOM_TREASURY.deposit(address(PRINCIPAL_TOKEN), _amount.sub(fee), payout); if (!lpTokenAsFeeFlag && fee != 0) { // fee is transferred to dao PAYOUT_TOKEN.transfer(OLY_TREASURY, fee); } // total debt is increased totalDebt = totalDebt.add(value); // depositor info is stored if(lpTokenAsFeeFlag){ bondInfo[_depositor] = Bond({ payout: bondInfo[_depositor].payout.add(payout), vesting: terms.vestingTerm, lastBlock: block.number, truePricePaid: trueBondPrice() }); } else { bondInfo[_depositor] = Bond({ payout: bondInfo[_depositor].payout.add(payout.sub(fee)), vesting: terms.vestingTerm, lastBlock: block.number, truePricePaid: trueBondPrice() }); } // indexed events are emitted emit BondCreated(_amount, payout, block.number.add(terms.vestingTerm)); emit BondPriceChanged(_bondPrice(), debtRatio()); totalPrincipalBonded = totalPrincipalBonded.add(_amount); // total bonded increased totalPayoutGiven = totalPayoutGiven.add(payout); // total payout increased payoutSinceLastSubsidy = payoutSinceLastSubsidy.add(payout); // subsidy counter increased adjust(); // control variable is adjusted return payout; } /** * @notice deposit bond with an asset(i.e: USDT) * @param _depositAmount amount of deposit asset * @param _depositAsset deposit asset * @param _incomingAsset asset address for swap from deposit asset * @param _depositor address of depositor * @return uint */ function depositWithAsset( uint256 _depositAmount, address _depositAsset, address _incomingAsset, address _depositor ) external returns (uint256) { require(_depositor != address(0), "depositWithAsset: Invalid address"); (address lpAddress, uint256 lpAmount) = __lpAddressAndAmount(_depositAmount, _depositAsset, _incomingAsset); console.log("==sol-lp-payout-0::", IERC20(lpAddress).balanceOf(address(this)), PAYOUT_TOKEN.balanceOf(address(this))); // remain payoutToken is transferred to user __transferAssetToCaller(msg.sender, address(PAYOUT_TOKEN)); require(lpAddress != address(0), "depositWithAsset: Invalid incoming asset"); require(lpAmount > 0, "depositWithAsset: Insufficient lpAmount"); decayDebt(); require(totalDebt <= terms.maxDebt, "depositWithAsset: Max capacity reached"); uint256 nativePrice = trueBondPrice(); // require(_maxPrice >= nativePrice, "Slippage limit: more than max price"); // slippage protection uint256 value = CUSTOM_TREASURY.valueOfToken(lpAddress, lpAmount); uint256 payout = _payoutFor(value); // payout to bonder is computed require(payout >= 10**PAYOUT_TOKEN.decimals() / 100, "Bond too small"); // must be > 0.01 payout token ( underflow protection ) require(payout <= maxPayout(), "Bond too large"); // size protection because there is no slippage // profits are calculated uint256 fee; /** principal is been taken as fee and trasfered to dao */ if (lpTokenAsFeeFlag) { fee = lpAmount.mul(currentFluxFee()).div(1e6); if (fee != 0) { IERC20(lpAddress).transfer(OLY_TREASURY, fee);// fee is transferred to dao as LP } } else { fee = payout.mul(currentFluxFee()).div(1e6); } IERC20(lpAddress).approve(address(CUSTOM_TREASURY), lpAmount); CUSTOM_TREASURY.deposit(lpAddress, lpAmount.sub(fee), payout); if (!lpTokenAsFeeFlag && fee != 0) { // fee is transferred to dao as payoutToken PAYOUT_TOKEN.transfer(OLY_TREASURY, fee); } // total debt is increased totalDebt = totalDebt.add(value); // depositor info is stored if(lpTokenAsFeeFlag){ bondInfo[_depositor] = Bond({ payout: bondInfo[_depositor].payout.add(payout), vesting: terms.vestingTerm, lastBlock: block.number, truePricePaid: trueBondPrice() }); } else { bondInfo[_depositor] = Bond({ payout: bondInfo[_depositor].payout.add(payout.sub(fee)), vesting: terms.vestingTerm, lastBlock: block.number, truePricePaid: trueBondPrice() }); } // indexed events are emitted emit BondCreated(lpAmount, payout, block.number.add(terms.vestingTerm)); emit BondPriceChanged(_bondPrice(), debtRatio()); totalPrincipalBonded = totalPrincipalBonded.add(lpAmount); // total bonded increased totalPayoutGiven = totalPayoutGiven.add(payout); // total payout increased payoutSinceLastSubsidy = payoutSinceLastSubsidy.add(payout); // subsidy counter increased adjust(); // control variable is adjusted return payout; } /** * @notice redeem bond for user * @return uint */ function redeem(address _depositor) external returns (uint) { Bond memory info = bondInfo[_depositor]; uint percentVested = percentVestedFor(_depositor); // (blocks since last interaction / vesting term remaining) if (percentVested >= 10000) { // if fully vested delete bondInfo[_depositor]; // delete user info emit BondRedeemed(_depositor, info.payout, 0); // emit bond data if(info.payout > 0) { PAYOUT_TOKEN.transfer(_depositor, info.payout); } return info.payout; } else { // if unfinished // calculate payout vested uint256 payout = info.payout.mul(percentVested).div(10000); // store updated deposit info bondInfo[_depositor] = Bond({ payout: info.payout.sub(payout), vesting: info.vesting.sub(block.number.sub(info.lastBlock)), lastBlock: block.number, truePricePaid: info.truePricePaid }); emit BondRedeemed(_depositor, payout, bondInfo[_depositor].payout); if(payout > 0) { PAYOUT_TOKEN.transfer(_depositor, payout); } return payout; } } /* ======== INTERNAL HELPER FUNCTIONS ======== */ /** * @notice makes incremental adjustment to control variable */ function adjust() internal { uint256 blockCanAdjust = adjustment.lastBlock.add(adjustment.buffer); if (adjustment.rate != 0 && block.number >= blockCanAdjust) { uint256 initial = terms.controlVariable; if (adjustment.add) { terms.controlVariable = terms.controlVariable.add(adjustment.rate); if (terms.controlVariable >= adjustment.target) { adjustment.rate = 0; } } else { terms.controlVariable = terms.controlVariable.sub(adjustment.rate); if (terms.controlVariable <= adjustment.target) { adjustment.rate = 0; } } adjustment.lastBlock = block.number; emit ControlVariableAdjustment(initial, terms.controlVariable, adjustment.rate, adjustment.add); } } /** * @notice reduce total debt */ function decayDebt() internal { totalDebt = totalDebt.sub(debtDecay()); lastDecay = block.number; } /** * @notice calculate current bond price and remove floor if above * @return price_ uint */ function _bondPrice() internal returns (uint256 price_) { price_ = terms.controlVariable.mul(debtRatio()).div(10**(uint256(PAYOUT_TOKEN.decimals()).sub(5))); if (price_ < terms.minimumPrice) { price_ = terms.minimumPrice; } else if (terms.minimumPrice != 0) { terms.minimumPrice = 0; } } /* ======== VIEW FUNCTIONS ======== */ /** * @notice calculate current bond premium * @return price_ uint */ function bondPrice() public view returns (uint256 price_) { price_ = terms.controlVariable.mul(debtRatio()).div(10**(uint256(PAYOUT_TOKEN.decimals()).sub(5))); if (price_ < terms.minimumPrice) { price_ = terms.minimumPrice; } } /** * @notice calculate true bond price a user pays * @return price_ uint */ function trueBondPrice() public view returns (uint256 price_) { price_ = bondPrice().add(bondPrice().mul(currentFluxFee()).div(1e6)); } /** * @notice determine maximum bond size * @return uint */ function maxPayout() public view returns (uint) { uint256 totalSupply = PAYOUT_TOKEN.totalSupply(); if(totalSupply > 10**18) totalSupply = 10**18; return totalSupply.mul(terms.maxPayout).div(100000); } /** * @notice calculate total interest due for new bond * @param _value uint * @return uint */ function _payoutFor(uint256 _value) internal view returns (uint256) { return FixedPoint.fraction(_value, bondPrice()).decode112with18().div(1e11); } /** * @notice calculate user's interest due for new bond, accounting for Flux Fee * @param _value uint * @return uint */ function payoutFor(uint256 _value) external view returns (uint256) { uint256 total = FixedPoint.fraction(_value, bondPrice()).decode112with18().div(1e11); return total.sub(total.mul(currentFluxFee()).div(1e6)); } /** * @notice calculate current ratio of debt to payout token supply * @notice protocols using Flux Pro should be careful when quickly adding large %s to total supply * @return debtRatio_ uint */ function debtRatio() public view returns (uint256 debtRatio_) { debtRatio_ = FixedPoint .fraction(currentDebt().mul(10**PAYOUT_TOKEN.decimals()), PAYOUT_TOKEN.totalSupply()) .decode112with18() .div(1e18); } /** * @notice calculate debt factoring in decay * @return uint */ function currentDebt() public view returns (uint256) { return totalDebt.sub(debtDecay()); } /** * @notice amount to decay total debt by * @return decay_ uint */ function debtDecay() public view returns (uint256 decay_) { uint256 blocksSinceLast = block.number.sub(lastDecay); decay_ = totalDebt.mul(blocksSinceLast).div(terms.vestingTerm); if (decay_ > totalDebt) { decay_ = totalDebt; } } /** * @notice calculate how far into vesting a depositor is * @param _depositor address * @return percentVested_ uint */ function percentVestedFor(address _depositor) public view returns (uint256 percentVested_) { Bond memory bond = bondInfo[_depositor]; uint256 blocksSinceLast = block.number.sub(bond.lastBlock); uint256 vesting = bond.vesting; if (vesting > 0) { percentVested_ = blocksSinceLast.mul(10000).div(vesting); } else { percentVested_ = 0; } } /** * @notice calculate amount of payout token available for claim by depositor * @param _depositor address * @return pendingPayout_ uint */ function pendingPayoutFor(address _depositor) external view returns (uint256 pendingPayout_) { uint256 percentVested = percentVestedFor(_depositor); uint256 payout = bondInfo[_depositor].payout; if (percentVested >= 10000) { pendingPayout_ = payout; } else { pendingPayout_ = payout.mul(percentVested).div(10000); } } /** * @notice current fee Flux takes of each bond * @return currentFee_ uint */ function currentFluxFee() public view returns (uint256 currentFee_) { uint256 tierLength = feeTiers.length; for (uint256 i; i < tierLength; i++) { if (totalPrincipalBonded < feeTiers[i].tierCeilings || i == tierLength - 1) { return feeTiers[i].fees; } } } /// @dev Helper to transfer full contract balances of assets to the caller function __transferAssetToCaller(address _target, address _asset) private { uint256 transferAmount = IERC20(_asset).balanceOf(address(this)); if (transferAmount > 0) { IERC20(_asset).safeTransfer(_target, transferAmount); } } /// @notice Swap and AddLiquidity on the UniswapV2 function __lpAddressAndAmount( uint256 _depositAmount, address _depositAsset, address _incomingAsset ) public payable returns (address lpAddress_, uint256 lpAmount_) { if(_depositAsset == address(0)) { payable(address(HELPER)).transfer(address(this).balance); } else { IERC20(_depositAsset).safeTransferFrom(msg.sender, address(this), _depositAmount); IERC20(_depositAsset).approve(address(HELPER), _depositAmount); } bytes memory swapArgs = abi.encode(_depositAmount, _depositAsset, address(PAYOUT_TOKEN), _incomingAsset); (lpAddress_, lpAmount_) = IHelper(HELPER).swapForDeposit(swapArgs); emit LPAdded(lpAddress_, lpAmount_); } }
store updated deposit info
bondInfo[_depositor] = Bond({ payout: info.payout.sub(payout), vesting: info.vesting.sub(block.number.sub(info.lastBlock)), lastBlock: block.number, truePricePaid: info.truePricePaid }); emit BondRedeemed(_depositor, payout, bondInfo[_depositor].payout);
12,625,468
[ 1, 2233, 3526, 443, 1724, 1123, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 8427, 966, 63, 67, 323, 1724, 280, 65, 273, 605, 1434, 12590, 203, 7734, 293, 2012, 30, 1123, 18, 84, 2012, 18, 1717, 12, 84, 2012, 3631, 203, 7734, 331, 10100, 30, 1123, 18, 90, 10100, 18, 1717, 12, 2629, 18, 2696, 18, 1717, 12, 1376, 18, 2722, 1768, 13, 3631, 203, 7734, 1142, 1768, 30, 1203, 18, 2696, 16, 203, 7734, 638, 5147, 16507, 350, 30, 1123, 18, 3767, 5147, 16507, 350, 203, 5411, 15549, 203, 203, 5411, 3626, 605, 1434, 426, 24903, 329, 24899, 323, 1724, 280, 16, 293, 2012, 16, 8427, 966, 63, 67, 323, 1724, 280, 8009, 84, 2012, 1769, 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 ]
//SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./interfaces/IMerkleDistributor.sol"; contract MerkleDistributor is IMerkleDistributor { using SafeMath for uint256; address public immutable override token; bytes32 public immutable override merkleRoot; // This is a packed array of booleans. mapping(uint256 => uint256) private claimedBitMap; // Opium Bonus uint256 public constant MAX_BONUS = 0.999e18; uint256 public constant PERCENTAGE_BASE = 1e18; uint256 public totalClaims; uint256 public initialPoolSize; uint256 public currentPoolSize; uint256 public bonusSum; uint256 public claimed; uint256 public percentageIndex; uint256 public bonusStart; uint256 public bonusEnd; uint256 public emergencyTimeout; address public emergencyReceiver; constructor( address token_, bytes32 merkleRoot_, uint256 _totalClaims, uint256 _initialPoolSize, uint256 _bonusStart, uint256 _bonusEnd, uint256 _emergencyTimeout, address _emergencyReceiver ) { token = token_; merkleRoot = merkleRoot_; // Opium Bonus totalClaims = _totalClaims; initialPoolSize = _initialPoolSize; currentPoolSize = _initialPoolSize; percentageIndex = PERCENTAGE_BASE; bonusStart = _bonusStart; bonusEnd = _bonusEnd; emergencyTimeout = _emergencyTimeout; emergencyReceiver = _emergencyReceiver; require(bonusStart < bonusEnd, "WRONG_BONUS_TIME"); require(emergencyTimeout > bonusEnd, "WRONG_EMERGENCY_TIMEOUT"); } function isClaimed(uint256 index) public view override returns (bool) { uint256 claimedWordIndex = index / 256; uint256 claimedBitIndex = index % 256; uint256 claimedWord = claimedBitMap[claimedWordIndex]; uint256 mask = (1 << claimedBitIndex); return claimedWord & mask == mask; } function _setClaimed(uint256 index) private { uint256 claimedWordIndex = index / 256; uint256 claimedBitIndex = index % 256; claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex); } function claim( uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof ) external override { require(!isClaimed(index), "MerkleDistributor: Drop already claimed."); require(msg.sender == account, "Only owner can claim"); // Verify the merkle proof. bytes32 node = keccak256(abi.encodePacked(index, account, amount)); require( MerkleProof.verify(merkleProof, merkleRoot, node), "MerkleDistributor: Invalid proof." ); // Mark it claimed and send the token. _setClaimed(index); uint256 adjustedAmount = _applyAdjustment(amount); require( IERC20(token).transfer(account, adjustedAmount), "MerkleDistributor: Transfer failed." ); emit Claimed(index, account, amount, adjustedAmount); } function getBonus() public view returns (uint256) { // timeRemaining = bonusEnd - now, or 0 if bonus ended uint256 timeRemaining = block.timestamp > bonusEnd ? 0 : bonusEnd.sub(block.timestamp); // bonus = maxBonus * timeRemaining / (bonusEnd - bonusStart) return MAX_BONUS.mul(timeRemaining).div(bonusEnd.sub(bonusStart)); } function calculateAdjustedAmount(uint256 amount) public view returns ( uint256 adjustedAmount, uint256 bonus, uint256 bonusPart ) { // If last claims, return full amount + full bonus if (claimed + 1 == totalClaims) { return (amount.add(bonusSum), 0, 0); } // adjustedPercentage = amount / initialPoolSize * percentageIndex uint256 adjustedPercentage = amount.mul(PERCENTAGE_BASE).div(initialPoolSize).mul(percentageIndex).div( PERCENTAGE_BASE ); // bonusPart = adjustedPercentage * bonusSum bonusPart = adjustedPercentage.mul(bonusSum).div(PERCENTAGE_BASE); // totalToClaim = amount + bonusPart uint256 totalToClaim = amount.add(bonusPart); // bonus = totalToClaim * getBonus() bonus = totalToClaim.mul(getBonus()).div(PERCENTAGE_BASE); // adjustedAmount = totalToClaim - bonus adjustedAmount = totalToClaim.sub(bonus); } function _applyAdjustment(uint256 amount) private returns (uint256) { (uint256 adjustedAmount, uint256 bonus, uint256 bonusPart) = calculateAdjustedAmount(amount); // Increment claim index claimed += 1; // If last claims, return full amount, don't update anything if (claimed == totalClaims) { return adjustedAmount; } // newPoolSize = currentPoolSize - amount uint256 newPoolSize = currentPoolSize.sub(amount); // percentageIndex = percentageIndex * currentPoolSize / newPoolSize percentageIndex = percentageIndex .mul(currentPoolSize.mul(PERCENTAGE_BASE).div(newPoolSize)) .div(PERCENTAGE_BASE); // currentPoolSize = newPoolSize currentPoolSize = newPoolSize; // bonusSum = bonusSum - bonusPart + bonus bonusSum = bonusSum.sub(bonusPart).add(bonus); return adjustedAmount; } function emergencyWithdrawal() public { require(block.timestamp > emergencyTimeout, "TIMEOUT_NOT_EXPIRED"); IERC20(token).transfer( emergencyReceiver, IERC20(token).balanceOf(address(this)) ); } } // 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; /** * @dev These functions deal with verification of Merkle trees (hash trees), */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } // Check if the computed hash (root) is equal to the provided root return computedHash == root; } } // 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.7.0; // Allows anyone to claim a token if they exist in a merkle root. interface IMerkleDistributor { // Returns the address of the token distributed by this contract. function token() external view returns (address); // Returns the merkle root of the merkle tree containing account balances available to claim. function merkleRoot() external view returns (bytes32); // Returns true if the index has been marked claimed. function isClaimed(uint256 index) external view returns (bool); // Claim the given amount of the token to the given address. Reverts if the inputs are invalid. function claim( uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof ) external; // This event is triggered whenever a call to #claim succeeds. event Claimed(uint256 index, address account, uint256 amount, uint256 adjustedAmount); }
bonus = totalToClaim * getBonus()
bonus = totalToClaim.mul(getBonus()).div(PERCENTAGE_BASE);
1,522,956
[ 1, 18688, 407, 273, 2078, 774, 9762, 225, 2882, 22889, 1435, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 324, 22889, 273, 2078, 774, 9762, 18, 16411, 12, 588, 38, 22889, 1435, 2934, 2892, 12, 3194, 19666, 2833, 67, 8369, 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 ]
./partial_match/1/0xeec87a020D7e03271c310645a73Cb29bb83Ae1D2/sources/Resolver.sol
Add a request manager. In order to be able to send messages to the :sol:contract:`RequestManager`, the resolver contract needs to know the address of the request manager on the source chain, as well as the address of the messenger contract responsible for transferring messages to the L2 chain. .. note:: This function can only be called by the contract owner. @param chainId The source L2 chain ID. @param requestManager The request manager. @param messenger The messenger contract responsible for chain ``chainId``. Must implement :sol:interface:`IMessenger`.
function addRequestManager( uint256 chainId, address requestManager, address messenger ) external onlyOwner { sourceChainInfos[chainId] = SourceChainInfo(requestManager, messenger); }
4,487,981
[ 1, 986, 279, 590, 3301, 18, 657, 1353, 358, 506, 7752, 358, 1366, 2743, 358, 326, 294, 18281, 30, 16351, 28288, 691, 1318, 9191, 326, 5039, 6835, 4260, 358, 5055, 326, 1758, 434, 326, 590, 3301, 603, 326, 1084, 2687, 16, 487, 5492, 487, 326, 1758, 434, 326, 31086, 6835, 14549, 364, 906, 74, 20245, 2743, 358, 326, 511, 22, 2687, 18, 6116, 4721, 2866, 1220, 445, 848, 1338, 506, 2566, 635, 326, 6835, 3410, 18, 225, 2687, 548, 1021, 1084, 511, 22, 2687, 1599, 18, 225, 590, 1318, 1021, 590, 3301, 18, 225, 31086, 1021, 31086, 6835, 14549, 364, 2687, 12176, 5639, 548, 68, 8338, 5375, 6753, 2348, 294, 18281, 30, 5831, 28288, 3445, 18912, 8338, 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 ]
[ 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 ]
[ 1, 565, 445, 527, 691, 1318, 12, 203, 3639, 2254, 5034, 2687, 548, 16, 203, 3639, 1758, 590, 1318, 16, 203, 3639, 1758, 31086, 203, 565, 262, 3903, 1338, 5541, 288, 203, 3639, 1084, 3893, 7655, 63, 5639, 548, 65, 273, 4998, 3893, 966, 12, 2293, 1318, 16, 31086, 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 ]
pragma solidity ^0.4.25; /* 股票 公司有決策單、更新決策單 顧客可以選擇我要買這家的單或看這家的單 一單多少下去分利 */ //import "./MLPortfolio.sol"; contract Invest /* is MLPortfolio*/{ address[] public usersAddress; mapping(address => string) public userName; string public stock; uint public rate; uint public stockNum; uint256 public _totalSupply = 0; mapping(address => uint256) public balances; mapping(address => mapping(address => uint256)) allowed; mapping(address => mapping(string => uint)) userStock; mapping(address => uint) userVersion; mapping(address => uint) userNumber; mapping(address => mapping(uint => mapping (uint => uint))) public mlrate; mapping(address => mapping (uint => mapping (uint => string))) public mlPlan; //公司、版本、1-10標的 uint public turnMoney = 0; string public nowstock; uint public nowrate; uint num; event buyStocklog(address indexed owner, string stock, uint rate,uint amount); event sellStocklog(address indexed owner, string stock, uint amount); event changeStocklog(address indexed owner, string stockA, string stockB, uint turnMoney); event changePlanlog(address indexed owner, uint old_ver, uint new_ver); event logPrice(uint price); event logUserStock(address indexed user, string sotck,uint amount); event logPlan(address indexed owner, string sotck); event logRate(address indexed owner,string sotck, uint rate); function cashin(address _user, uint _money) public{ balances[_user] += _money; } // 取得合約的所有位址 function returnArray() public view returns(address[]) { return usersAddress; } function setUser(address _addr, string _userName) public { usersAddress.push(_addr); userName[_addr] = _userName; } function getUserStock(address _to) public { for(uint i=1; i <=5; i++){ nowstock = getPlan(_to,i,userVersion[msg.sender]); emit logUserStock(msg.sender,nowstock,userStock[msg.sender][nowstock]); } } function setVersion(address _user, uint _ver) public{ userVersion[_user] = _ver; } function setNumber(address _user, uint _num) public{ userNumber[_user] = _num; } //顧名思義,就是直接獲取指定賬戶上 Token 的餘額。 function balanceOf(address _user) public view returns (uint256){ return balances[_user]; } function changePlan(address _addr, uint _ver) public{ emit changePlanlog(_addr,userVersion[msg.sender],_ver); sellAll(_addr,userVersion[msg.sender]); buyAll(_addr,_ver); } /*function updateStock(address _addr, string _stockA, string _stockB) public{ sellStock(_addr,_stockA); buyStock(_addr,balances[msg.sender],_stockB); emit changeStocklog(_addr,_stockA,_stockB,turnMoney); }*/ //利用這個 function 的賬戶地址作為 msg.sender,減去指定數量的Token( tokens), //在指定賬戶地址(to)加上相應數量的Token( tokens),最後再以事件Transfer(msg.sender, to, tokens) 以Log記錄發送賬戶地址、指定賬戶地址、Token 數量。 /*function buyStock(address _to, uint256 _value, string _stock) public { require(balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]); for(uint i=1; i <=5; i++){ if( keccak256(_stock) == keccak256(getPlan(_to,i,userVersion[msg.sender]))){ num = i; } } nowrate = getRate(_to,num,userVersion[msg.sender]); userStock[msg.sender][_stock]=((balances[msg.sender]/100)*nowrate)/StockPrice(_stock); turnMoney += (balances[msg.sender]/100)*nowrate; balances[msg.sender] = balances[msg.sender] - turnMoney; balances[_to] = balances[_to] + turnMoney; emit buyStocklog(msg.sender,_stock,StockPrice(_stock),userStock[msg.sender][_stock]); }*/ /*function buyStock(address _to, uint256 _value, string _stock) public { require(balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]); nowrate = getRate(_to,userNumber[msg.sender],userVersion[msg.sender]); userStock[msg.sender][_stock]=((balances[msg.sender]/100)*nowrate)/StockPrice(_stock); turnMoney += (balances[msg.sender]/100)*nowrate; balances[msg.sender] = balances[msg.sender] - turnMoney; balances[_to] = balances[_to] + turnMoney; emit buyStocklog(msg.sender,_stock,StockPrice(_stock),userStock[msg.sender][_stock]); } function sellStock (address _to, string _stock) public returns (bool){ turnMoney= StockPrice(_stock)*userStock[msg.sender][_stock]; //numberxprice require(balances[_to] >= turnMoney && balances[msg.sender] + turnMoney >= balances[msg.sender]); // prevent balance underflow & overflow balances[msg.sender] = balances[msg.sender] + turnMoney; balances[_to] = balances[_to] - turnMoney; userStock[msg.sender][_stock]=0; emit sellStocklog(msg.sender,_stock,userStock[msg.sender][_stock]); return true; }*/ //在指定賬戶地址(to)加上相應數量的Token( tokens),最後再以事件Transfer(msg.sender, to, tokens) 以Log記錄發送賬戶地址、指定賬戶地址、Token 數量。 function buyAll(address _to, uint256 _ver) public { //require(balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]); //balances[_to] = balances[_to] + _value; for(uint i=1; i <=10; i++){ nowstock = getPlan(_to,i,_ver); nowrate = getRate(_to,i,_ver); stockNum = ((balances[msg.sender]/100)*nowrate)/StockPrice(nowstock); userStock[msg.sender][nowstock]= stockNum; turnMoney += StockPrice(nowstock)* stockNum; emit buyStocklog(msg.sender,nowstock,nowrate,userStock[msg.sender][nowstock]); } //balances[msg.sender] -= turnMoney*(1+(6/1000)); //each stock number //balances[_to] += turnMoney*(1+(6/1000)); turnMoney = 0; stockNum = 0; } function sellAll(address _addr,uint256 _ver) public { for(uint i=1; i <=10; i++){ nowstock = getPlan(_addr,i,_ver); nowrate = getRate(_addr,i,_ver); balances[msg.sender] = balances[msg.sender] + (StockPrice(nowstock)*userStock[msg.sender][nowstock]); balances[_addr] = balances[_addr] - (StockPrice(nowstock)*userStock[msg.sender][nowstock]); //each stock number emit sellStocklog(msg.sender,nowstock,userStock[msg.sender][nowstock]); } } function getPlan(address _addr, uint _number, uint _version) public returns (string){ stock = mlPlan[_addr][_version][_number]; //emit logPlan(_addr,stock); return stock; } function getRate(address _addr, uint _number, uint _version) public returns (uint){ stock = mlPlan[_addr][_version][_number]; rate = mlrate[_addr][_version][_number]; // emit logRate(_addr,stock,rate); return rate; } //首先將 from 的賬戶地址中減去指定數量的Token( tokens),然後就使用上面的 allowed 的msg.sender 允許 from 的賬戶地址減去指定數量的Token( tokens), //然後在 to的賬戶地址中加上相應數量的Token( tokens),最後再以事件Transfer(from, to, tokens) 以Log記錄發送賬戶地址、指定賬戶地址、Token 數量。 function transferFrom(address _from, address _to, uint256 _value) public returns (bool){ require(balances[_from] >= _value && balances[_to] + _value >= balances[_to]); // prevent balance underflow & overflow require(allowed[_from][msg.sender] - _value <= allowed[_from][msg.sender]); // prevent allowed underflow balances[_from] = balances[_from] - _value; allowed[_from][msg.sender] = allowed[_from][msg.sender] - _value; balances[_to] = balances[_to] + _value; return true; } function setmlPlan(address _addr, uint _version, uint _num, string _stockName) public { mlPlan[_addr][_version][_num] = _stockName; } function setmlRate(address _addr, uint _version,uint _num, uint256 _stockRate) public { mlrate[_addr][_version][_num] = _stockRate; } mapping(string => uint) stockData; function setStockData(string _name, uint _price) public{ stockData[_name]=_price; } function StockPrice (string _name) public returns (uint){ stockData["台積電"]=100; stockData["鴻海"]=80; stockData["聯發科"]=70; stockData["國巨"]=50; stockData["國泰金"]=70; stockData["南亞科"]=60; stockData["玉山金"]=80; stockData["台新金"]=55; stockData["奇力新"]=60; stockData["友達"]=30; stockData["恆大"]=10; stockData["統一"]=45; stockData["中裕"]=80; stockData["上銀"]=30; stockData["訊連"]=55; // emit logPrice(stockData[_name]); return stockData[_name]; } function setmlPlan(address _addr, uint _version) public { // program, age if(_version == 1){ mlPlan[_addr][_version][1] = "台積電"; mlPlan[_addr][_version][2] = "鴻海"; mlPlan[_addr][_version][3] = "聯發科"; mlPlan[_addr][_version][4] = "國巨"; mlPlan[_addr][_version][5] = "國泰金"; mlPlan[_addr][_version][6] = "南亞科"; mlPlan[_addr][_version][7] = "玉山金"; mlPlan[_addr][_version][8] = "聯電"; mlPlan[_addr][_version][9] = "台新金"; mlPlan[_addr][_version][10] = "奇力新"; } if(_version == 2){ mlPlan[_addr][_version][1] = "台積電"; mlPlan[_addr][_version][2] = "友達"; mlPlan[_addr][_version][3] = "聯發科"; mlPlan[_addr][_version][4] = "台新金"; mlPlan[_addr][_version][5] = "恆大"; mlPlan[_addr][_version][6] = "南亞科"; mlPlan[_addr][_version][7] = "玉山金"; mlPlan[_addr][_version][8] = "聯電"; mlPlan[_addr][_version][9] = "統一"; mlPlan[_addr][_version][10] = "中裕"; } if(_version == 3){ mlPlan[_addr][_version][1] = "台積電"; mlPlan[_addr][_version][2] = "和益"; mlPlan[_addr][_version][3] = "聯發科"; mlPlan[_addr][_version][4] = "國巨"; mlPlan[_addr][_version][5] = "永豐金"; mlPlan[_addr][_version][6] = "上銀"; mlPlan[_addr][_version][7] = "玉山金"; mlPlan[_addr][_version][8] = "聯電"; mlPlan[_addr][_version][9] = "訊連"; mlPlan[_addr][_version][10] = "奇力新"; } } function setmlRate(address _addr, uint _version) public { // program, age if(_version == 1){ mlrate[_addr][_version][1] = 20; mlrate[_addr][_version][2] = 10; mlrate[_addr][_version][3] = 5; mlrate[_addr][_version][4] = 1; mlrate[_addr][_version][5] = 15; mlrate[_addr][_version][6] = 7; mlrate[_addr][_version][7] = 2; mlrate[_addr][_version][8] = 12; mlrate[_addr][_version][9] = 8; mlrate[_addr][_version][10] = 10; } if(_version == 2){ mlrate[_addr][_version][1] = 15; mlrate[_addr][_version][2] = 15; mlrate[_addr][_version][3] = 5; mlrate[_addr][_version][4] = 1; mlrate[_addr][_version][5] = 10; mlrate[_addr][_version][6] = 12; mlrate[_addr][_version][7] = 2; mlrate[_addr][_version][8] = 12; mlrate[_addr][_version][9] = 8; mlrate[_addr][_version][10] = 10; } if(_version == 3){ mlrate[_addr][_version][1] = 15; mlrate[_addr][_version][2] = 10; mlrate[_addr][_version][3] = 5; mlrate[_addr][_version][4] = 11; mlrate[_addr][_version][5] = 15; mlrate[_addr][_version][6] = 7; mlrate[_addr][_version][7] = 2; mlrate[_addr][_version][8] = 10; mlrate[_addr][_version][9] = 10; mlrate[_addr][_version][10] = 5; } } }
balances[msg.sender] -= turnMoney*(1+(6/1000)); each stock numberbalances[_to] += turnMoney*(1+(6/1000));
turnMoney = 0;
12,747,903
[ 1, 70, 26488, 63, 3576, 18, 15330, 65, 3947, 7005, 23091, 12, 21, 15, 12, 26, 19, 18088, 10019, 1517, 12480, 1300, 70, 26488, 63, 67, 869, 65, 1011, 7005, 23091, 12, 21, 15, 12, 26, 19, 18088, 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, 0, 0, 0, 0, 0 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 540, 7005, 23091, 273, 374, 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 ]
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import {IERC20} from "./IERC20.sol"; import {ICorePool} from "./ICorePool.sol"; contract VotingIlluvium { string public constant name = "Voting Illuvium"; string public constant symbol = "vILV"; uint256 public constant decimals = 18; address public constant ILV = 0x767FE9EDC9E0dF98E07454847909b5E959D7ca0E; address public constant ILV_POOL = 0x25121EDDf746c884ddE4619b573A7B10714E2a36; address public constant LP_POOL = 0x8B4d8443a0229349A9892D4F7CbE89eF5f843F72; function balanceOf(address _account) external view returns (uint256 balance) { uint256 ilvBalance = IERC20(ILV).balanceOf(_account); uint256 ilvPoolBalance = ICorePool(ILV_POOL).balanceOf(_account); uint256 lpPoolBalance = _lpToILV(ICorePool(LP_POOL).balanceOf(_account)); balance = ilvBalance + ilvPoolBalance + lpPoolBalance; } function totalSupply() external view returns (uint256) { return IERC20(ILV).totalSupply(); } function _lpToILV(uint256 _lpBalance) internal view returns (uint256 ilvAmount) { address _poolToken = ICorePool(LP_POOL).poolToken(); uint256 totalLP = IERC20(_poolToken).totalSupply(); uint256 ilvInLP = IERC20(ILV).balanceOf(_poolToken); ilvAmount= (ilvInLP * _lpBalance) / totalLP; } } // SPDX-License-Identifier: MIT pragma solidity 0.8.4; /** * @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.4; import "./IPool.sol"; interface ICorePool is IPool { function vaultRewardsPerToken() external view returns (uint256); function poolTokenReserve() external view returns (uint256); function stakeAsPool(address _staker, uint256 _amount) external; function receiveVaultRewards(uint256 _amount) external; } // SPDX-License-Identifier: MIT pragma solidity 0.8.4; /** * @title Illuvium Pool * * @notice An abstraction representing a pool, see IlluviumPoolBase for details * * @author Pedro Bergamini, reviewed by Basil Gorin */ interface IPool { /** * @dev Deposit is a key data structure used in staking, * it represents a unit of stake with its amount, weight and term (time interval) */ struct Deposit { // @dev token amount staked uint256 tokenAmount; // @dev stake weight uint256 weight; // @dev locking period - from uint64 lockedFrom; // @dev locking period - until uint64 lockedUntil; // @dev indicates if the stake was created as a yield reward bool isYield; } // for the rest of the functions see Soldoc in IlluviumPoolBase function silv() external view returns (address); function poolToken() external view returns (address); function isFlashPool() external view returns (bool); function weight() external view returns (uint32); function lastYieldDistribution() external view returns (uint64); function yieldRewardsPerWeight() external view returns (uint256); function usersLockingWeight() external view returns (uint256); function pendingYieldRewards(address _user) external view returns (uint256); function balanceOf(address _user) external view returns (uint256); function getDeposit(address _user, uint256 _depositId) external view returns (Deposit memory); function getDepositsLength(address _user) external view returns (uint256); function stake( uint256 _amount, uint64 _lockedUntil, bool useSILV ) external; function unstake( uint256 _depositId, uint256 _amount, bool useSILV ) external; function sync() external; function processRewards(bool useSILV) external; function setWeight(uint32 _weight) external; }
* @dev Interface of the ERC20 standard as defined in the EIP./
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); pragma solidity 0.8.4; }
5,904,351
[ 1, 1358, 434, 326, 4232, 39, 3462, 4529, 487, 2553, 316, 326, 512, 2579, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3462, 288, 203, 565, 445, 2078, 3088, 1283, 1435, 3903, 1476, 1135, 261, 11890, 5034, 1769, 203, 203, 565, 445, 11013, 951, 12, 2867, 2236, 13, 3903, 1476, 1135, 261, 11890, 5034, 1769, 203, 203, 565, 445, 7412, 12, 2867, 8027, 16, 2254, 5034, 3844, 13, 3903, 1135, 261, 6430, 1769, 203, 203, 565, 445, 1699, 1359, 12, 2867, 3410, 16, 1758, 17571, 264, 13, 3903, 1476, 1135, 261, 11890, 5034, 1769, 203, 203, 565, 445, 6617, 537, 12, 2867, 17571, 264, 16, 2254, 5034, 3844, 13, 3903, 1135, 261, 6430, 1769, 203, 203, 565, 445, 7412, 1265, 12, 203, 3639, 1758, 5793, 16, 203, 3639, 1758, 8027, 16, 203, 3639, 2254, 5034, 3844, 203, 565, 262, 3903, 1135, 261, 6430, 1769, 203, 203, 565, 871, 12279, 12, 2867, 8808, 628, 16, 1758, 8808, 358, 16, 2254, 5034, 460, 1769, 203, 203, 565, 871, 1716, 685, 1125, 12, 2867, 8808, 3410, 16, 1758, 8808, 17571, 264, 16, 2254, 5034, 460, 1769, 203, 683, 9454, 18035, 560, 374, 18, 28, 18, 24, 31, 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 ]
pragma solidity ^0.4.24; 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; } } // https://github.com/ethereum/EIPs/issues/20 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); } 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) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } /** * Author : Hamza Yasin * Linkedin: linkedin.com/in/hamzayasin * Github: HamzaYasin1 */ contract ScarlettSale is Ownable { using SafeMath for uint256; // The token being sold ERC20 private _token; // Address where funds are collected address internal _wallet; uint256 internal _tierOneRate = 1000; uint256 internal _tierTwoRate = 665; uint256 internal _tierThreeRate = 500; uint256 internal _tierFourRate = 400; uint256 internal _tierFiveRate = 200; // Amount of wei raised uint256 internal _weiRaised; uint256 internal _monthOne; uint256 internal _monthTwo; uint256 internal _monthThree; uint256 internal _monthFour; uint256 internal _tokensSold; uint256 public _startTime = 1569888000; // Start date - 10/01/2019 @ 12:00am (UTC) uint256 public _endTime = _startTime + 20 weeks; //15-Oct-2019 - 12 am uint256 public _saleSupply = SafeMath.mul(100500000, 1 ether); // event TokensPurchased(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); constructor (address wallet, ERC20 token) public { require(wallet != address(0), "Crowdsale: wallet is the zero address"); require(address(token) != address(0), "Crowdsale: token is the zero address"); _wallet = wallet; _token = token; _tokensSold = 0; _monthOne = SafeMath.add(_startTime, 4 weeks); _monthTwo = SafeMath.add(_monthOne, 4 weeks); _monthThree = SafeMath.add(_monthTwo, 4 weeks); _monthFour = SafeMath.add(_monthThree, 4 weeks); } function () external payable { buyTokens(msg.sender); } function token() public view returns (ERC20) { return _token; } function wallet() public view returns (address ) { return _wallet; } function weiRaised() public view returns (uint256) { return _weiRaised; } function buyTokens(address beneficiary) public payable { require(validPurchase()); uint256 weiAmount = msg.value; uint256 accessTime = now; require(weiAmount >= 10000000000000000, "Wei amount should be greater than 0.01 ETH"); _preValidatePurchase(beneficiary, weiAmount); uint256 tokens = 0; tokens = _processPurchase(accessTime,weiAmount, tokens); _weiRaised = _weiRaised.add(weiAmount); _deliverTokens(beneficiary, tokens); emit TokensPurchased(msg.sender, beneficiary, weiAmount, tokens); _tokensSold = _tokensSold.add(tokens); _forwardFunds(); } function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal pure { require(beneficiary != address(0), "Crowdsale: beneficiary is the zero address"); require(weiAmount != 0, "Crowdsale: weiAmount is 0"); } function _deliverTokens(address beneficiary, uint256 tokenAmount) internal { _token.transfer(beneficiary, tokenAmount); } function _processPurchase(uint256 accessTime, uint256 weiAmount, uint256 tokenAmount) internal returns (uint256) { if ( accessTime <= _monthOne ) { tokenAmount = SafeMath.add(tokenAmount, weiAmount.mul(_tierOneRate)); } else if (( accessTime <= _monthTwo ) && (accessTime > _monthOne)) { tokenAmount = SafeMath.add(tokenAmount, weiAmount.mul(_tierTwoRate)); } else if (( accessTime <= _monthThree ) && (accessTime > _monthTwo)) { tokenAmount = SafeMath.add(tokenAmount, weiAmount.mul(_tierThreeRate)); } else if (( accessTime <= _monthFour ) && (accessTime > _monthThree)) { tokenAmount = SafeMath.add(tokenAmount, weiAmount.mul(_tierFourRate)); } else { tokenAmount = SafeMath.add(tokenAmount, weiAmount.mul(_tierFiveRate)); } require(_saleSupply >= tokenAmount, "sale supply should be greater or equals to tokenAmount"); _saleSupply = _saleSupply.sub(tokenAmount); return tokenAmount; } // @return true if the transaction can buy tokens function validPurchase() internal constant returns (bool) { bool withinPeriod = now >= _startTime && now <= _endTime; bool nonZeroPurchase = msg.value != 0; return withinPeriod && nonZeroPurchase; } // @return true if crowdsale event has ended function hasEnded() public constant returns (bool) { return now > _endTime; } function _forwardFunds() internal { _wallet.transfer(msg.value); } function withdrawTokens(uint _amount) external onlyOwner { require(_amount > 0, "token amount should be greater than 0"); _token.transfer(_wallet, _amount); } function setWallet(address _newWallet) public onlyOwner { _wallet = _newWallet; } function transferFunds(address[] recipients, uint256[] values) external onlyOwner { for (uint i = 0; i < recipients.length; i++) { uint x = values[i].mul(1 ether); require(_saleSupply >= values[i]); _saleSupply = SafeMath.sub(_saleSupply,values[i]); _token.transfer(recipients[i], x); } } }
@return true if crowdsale event has ended
function hasEnded() public constant returns (bool) { return now > _endTime; }
6,428,259
[ 1, 2463, 638, 309, 276, 492, 2377, 5349, 871, 711, 16926, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 711, 28362, 1435, 1071, 5381, 1135, 261, 6430, 13, 288, 203, 1377, 327, 2037, 405, 389, 409, 950, 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 ]
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; import "./ERC20Extended.sol"; import "../control/Pausable.sol"; import "../control/AccessControl.sol"; /* * Be Whale Token [BEW] * Author: Oddysey Games: https://oddysey.games * Game: Be Whale [https://bew.dev] */ contract BEWToken is ERC20Extended, Pausable, AccessControl { bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); uint256 private dFactor = 10 ** uint256(18); constructor() ERC20("Be Whale Token", "BEW", 18) { // Binance Smart Chain network _setupSupply(30000000 * dFactor); // id:0; Founders [via Vesting] _setupSupply(15000000 * dFactor); // id:1; Advisors _setupSupply(90000000 * dFactor); // id:2; Public Sale via https://bew.dev _setupSupply(7500000 * dFactor); // id:3; Affiliate _setupSupply(7500000 * dFactor); // id:4; Airdrop _setupSupply(90000000 * dFactor); // id:5; Staking _setupSupply(60000000 * dFactor); // id:6; Whale Bridge // Init supply for Founders | 4.5 millions first allocation _mint(msg.sender, 4500000 * dFactor, 0); // Ethereum network //_setupSupply(50000000 * dFactor); // id:0; Rewards for completing game quests //_setupSupply(20000000 * dFactor); // id:1; DAO rewards //_setupSupply(40000000 * dFactor); // id:2; Staking //_setupSupply(30000000 * dFactor); // id:3; Marketing //_setupSupply(20000000 * dFactor); // id:4; Strategic reserve //_setupSupply(40000000 * dFactor); // id:5; Whale Bridge _setupRole(SUPER_ADMIN_ROLE, msg.sender); _setupRole(BURNER_ROLE, msg.sender); } function getAllocationRole(int8 allocationType) public pure returns (bytes32) { return keccak256(abi.encodePacked("ALLOCATION_ROLE_", allocationType)); } /** * @dev * onlyRole(keccak256(abi.encodePacked("ALLOCATION_ROLE_", allocationType))) * cheaper than onlyRole(getAllocationRole(allocationType)) */ function mint(address to, uint256 amount, int8 allocationType) public onlyRole(keccak256(abi.encodePacked("ALLOCATION_ROLE_", allocationType))) override returns (bool) { _mint(to, amount, allocationType); return true; } function burn(uint256 amount, int8 allocationType) public onlyRole(BURNER_ROLE) override returns (bool) { _burn(amount, allocationType); return true; } function pause() public onlyRole(SUPER_ADMIN_ROLE) { _pause(); } function unpause() public onlyRole(SUPER_ADMIN_ROLE) { _unpause(); } function _beforeTokenTransfer(address from, address to, uint256 amount) internal whenNotPaused override { super._beforeTokenTransfer(from, to, amount); } }
Binance Smart Chain network Init supply for Founders | 4.5 millions first allocation Ethereum network_setupSupply(50000000 * dFactor); id:0; Rewards for completing game quests_setupSupply(20000000 * dFactor); id:1; DAO rewards_setupSupply(40000000 * dFactor); id:2; Staking_setupSupply(30000000 * dFactor); id:3; Marketing_setupSupply(20000000 * dFactor); id:4; Strategic reserve_setupSupply(40000000 * dFactor); id:5; Whale Bridge
constructor() ERC20("Be Whale Token", "BEW", 18) { _mint(msg.sender, 4500000 * dFactor, 0); _setupRole(SUPER_ADMIN_ROLE, msg.sender); _setupRole(BURNER_ROLE, msg.sender); }
5,431,783
[ 1, 9913, 1359, 19656, 7824, 2483, 4378, 14467, 364, 10750, 414, 571, 1059, 18, 25, 312, 737, 1115, 1122, 13481, 512, 18664, 379, 2483, 67, 8401, 3088, 1283, 12, 25, 17877, 225, 302, 6837, 1769, 225, 612, 30, 20, 31, 534, 359, 14727, 364, 2302, 310, 7920, 225, 456, 87, 67, 8401, 3088, 1283, 12, 22, 17877, 225, 302, 6837, 1769, 225, 612, 30, 21, 31, 463, 20463, 283, 6397, 67, 8401, 3088, 1283, 12, 24, 17877, 225, 302, 6837, 1769, 225, 612, 30, 22, 31, 934, 6159, 67, 8401, 3088, 1283, 12, 23, 17877, 225, 302, 6837, 1769, 225, 612, 30, 23, 31, 6622, 21747, 67, 8401, 3088, 1283, 12, 22, 17877, 225, 302, 6837, 1769, 225, 612, 30, 24, 31, 3978, 1287, 335, 20501, 67, 8401, 3088, 1283, 12, 24, 17877, 225, 302, 6837, 1769, 225, 612, 30, 25, 31, 3497, 5349, 24219, 2, 0, 0, 0, 0 ]
[ 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 ]
[ 1, 565, 3885, 1435, 4232, 39, 3462, 2932, 1919, 3497, 5349, 3155, 3113, 315, 5948, 59, 3113, 6549, 13, 288, 203, 203, 3639, 389, 81, 474, 12, 3576, 18, 15330, 16, 12292, 11706, 380, 302, 6837, 16, 374, 1769, 203, 203, 203, 3639, 389, 8401, 2996, 12, 13272, 654, 67, 15468, 67, 16256, 16, 1234, 18, 15330, 1769, 203, 3639, 389, 8401, 2996, 12, 38, 8521, 654, 67, 16256, 16, 1234, 18, 15330, 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 ]
pragma ton-solidity >= 0.43.0; pragma AbiHeader time; pragma AbiHeader expire; import './interfaces/IERC721.sol'; import './interfaces/IUpgradableContract.sol'; import './libraries/ERC721ErrorCodes.sol'; // TODO: рефералка на перевод % с тонов contract ERC721 is IPunk, IUpgradableContract{ mapping(uint32 => Punk) tokens; address owner; uint32 nftAmount; uint32 tokensLeft; uint32 totalTokens; uint128 priceForSale; uint128 referalNominator; uint128 referalDenominator; uint128 priceForUserSale; bool readyForSale; mapping(uint32 => address) nftOwner; mapping(address => mapping(uint32 => bool)) collections; mapping(uint32 => bool) freeTokens; mapping(uint32 => SellPunk) tokensForSale; /** * @param owner_ Owner of the contract */ constructor(address owner_) public { tvm.accept(); rnd.shuffle(); readyForSale = false; owner = owner_; priceForSale = 200 ton; totalTokens = 0; tokensLeft = 0; nftAmount = 0; referalNominator = 10; referalDenominator = 100; priceForUserSale = priceForSale; } /** * @param punkInfo Information required for punk */ function uploadToken(Punk[] punkInfo) external override onlyOwner { tvm.rawReserve(msg.value, 2); for (Punk punk: punkInfo) { if (!freeTokens[punk.id]) { tokens[punk.id] = punk; freeTokens[punk.id] = true; totalTokens += 1; tokensLeft += 1; } else { tokens[punk.id] = punk; } } address(owner).transfer({value: 0, flag: 64}); } function _uploadToken(Punk[] punkInfo) external onlyOwner { tvm.rawReserve(msg.value, 2); for (Punk punk: punkInfo) { if (!freeTokens[punk.id]) { tokens[punk.id] = punk; freeTokens[punk.id] = true; } } address(owner).transfer({value: 0, flag: 64}); } function _setTokenAmount(uint32 tokensLeft_, uint32 totalTokens_) external onlyOwner { tvm.rawReserve(msg.value, 2); totalTokens = totalTokens_; tokensLeft = tokensLeft_; address(owner).transfer({value: 0, flag: 64}); } function startSell() external override onlyOwner { tvm.rawReserve(msg.value, 2); readyForSale = true; address(owner).transfer({value: 0, flag: 64}); } /** * @param referal Address where 10 % payout will be paid */ function mintToken(address referal) external override view { // require(readyForSale, ERC721ErrorCodes.ERROR_SALE_IS_NOT_STARTED); // require(tokensLeft > 0, ERC721ErrorCodes.ERROR_NO_TOKENS_LEFT); // require(msg.value >= priceForSale, ERC721ErrorCodes.ERROR_MSG_VALUE_IS_TOO_LOW); tvm.rawReserve(msg.value, 2); uint32 tokensToMint = uint32(msg.value/priceForSale); if ( (readyForSale) && (tokensLeft > 0) && (msg.value >= priceForSale) && (tokensToMint <= tokensLeft) ) { if (referal.value != 0) { uint128 tokenValue = tokensToMint*priceForSale; ERC721(address(this))._payoutReferal(referal, tokenValue*referalNominator/referalDenominator); } ERC721(address(this))._mintToken(msg.sender, tokensToMint, tokensToMint); } else { address(msg.sender).transfer({value: 0, flag: 64}); } } /** * @param mintTo Address of future owner * @param amountLeftToMint Amount of tokens left to mint * @param originalTokenAmount Original amount of tokens that requires to be minted */ function _mintToken(address mintTo, uint32 amountLeftToMint, uint32 originalTokenAmount) external override onlySelf { tvm.accept(); if (amountLeftToMint > 0 && tokensLeft > 0) { uint32 tokenIDToMint = _getMintedID(); while (!freeTokens[tokenIDToMint]) { tokenIDToMint = _getMintedID(); } nftAmount += 1; tokensLeft -= 1; delete freeTokens[tokenIDToMint]; nftOwner[tokenIDToMint] = mintTo; collections[mintTo][tokenIDToMint] = true; emit PunkMinted({ punkId: tokenIDToMint, mintedBy: mintTo, price: priceForSale, mintTime: uint64(now) }); ERC721(address(this))._mintToken(mintTo, amountLeftToMint - 1, originalTokenAmount); } else { if (amountLeftToMint > 0 && tokensLeft == 0) { uint128 valueToTransfer = amountLeftToMint * priceForSale; address(mintTo).transfer({value: valueToTransfer, flag: 1}); } } } function _getMintedID() internal view returns (uint32) { rnd.shuffle(); uint32 index = rnd.next(uint32(totalTokens)); rnd.shuffle(); uint8 iterations = rnd.next(uint8(10)); if (tokensLeft < iterations) { optional(uint32, bool) returnIndex = freeTokens.nextOrEq(index); if (returnIndex.hasValue()) { (index, ) = returnIndex.get(); } else { optional(uint32, bool) minIndex = freeTokens.min(); (index, ) = minIndex.get(); } } else { repeat(iterations) { optional(uint32, bool) currentToken = freeTokens.nextOrEq(index); if (currentToken.hasValue()) { (uint32 currentIndex, ) = currentToken.get(); index = currentIndex; } else { optional(uint32, bool) minToken = freeTokens.min(); (uint32 currentIndex, ) = minToken.get(); index = currentIndex; } } } return index; } /** * @param receiver Address of payout receiver * @param valueToTransfer Value to transfer using referal program */ function _payoutReferal(address receiver, uint128 valueToTransfer) external override pure onlySelf { tvm.accept(); address(receiver).transfer({value: valueToTransfer, flag: 1}); } /** * @param tokenID ID of nft token * @param receiver Address of receiver */ function transferTokenTo(uint32 tokenID, address receiver) external override { // require(msg.value >= 0.5 ton, ERC721ErrorCodes.ERROR_MSG_VALUE_IS_TOO_LOW); // require(nftOwner[tokenID] == msg.sender, ERC721ErrorCodes.ERROR_MSG_SENDER_IS_NOT_NFT_OWNER); tvm.rawReserve(msg.value, 2); if ( (msg.value >= 0.5 ton) && (nftOwner[tokenID] == msg.sender) ) { collections[msg.sender][tokenID] = false; nftOwner[tokenID] = receiver; collections[receiver][tokenID] = true; if (tokensForSale[tokenID].price != 0) { delete tokensForSale[tokenID]; } emit PunkTransferred({ punkId: tokenID, from: msg.sender, to: receiver, transferTime: uint64(now) }); } address(msg.sender).transfer({flag: 64, value: 0}); } /** * @param tokenID ID of nft token * @param tokenPrice Sell price */ function setForSale(uint32 tokenID, uint128 tokenPrice) external override { // require(msg.value >= 0.5 ton, ERC721ErrorCodes.ERROR_MSG_VALUE_IS_TOO_LOW); // require(nftOwner[tokenID] == msg.sender, ERC721ErrorCodes.ERROR_MSG_SENDER_IS_NOT_NFT_OWNER); tvm.rawReserve(msg.value, 2); if ( (msg.value >= 0.5 ton) && (nftOwner[tokenID] == msg.sender) && (tokenPrice >= priceForUserSale) ) { if (tokenPrice >= 1 ton) { tokensForSale[tokenID] = SellPunk({ price: tokenPrice, owner: msg.sender }); } } address(msg.sender).transfer({value: 0, flag: 64}); } /** * @param tokenID ID of nft token */ function setAsNotForSale(uint32 tokenID) external override { // require(msg.value >= 0.5 ton, ERC721ErrorCodes.ERROR_MSG_VALUE_IS_TOO_LOW); // require(tokensForSale[tokenID].owner == msg.sender, ERC721ErrorCodes.ERROR_MSG_SENDER_IS_NOT_NFT_OWNER); tvm.rawReserve(msg.value, 2); if ( (msg.value >= 0.5 ton) && (tokensForSale[tokenID].owner == msg.sender) ) { delete tokensForSale[tokenID]; } address(msg.sender).transfer({value: 0, flag: 64}); } /** * @param tokenID ID of nft token */ function buyToken(uint32 tokenID) external override { // tvm.rawReserve(msg.value, 2); require(msg.value >= 0.5 ton); tvm.rawReserve(0.5 ton, 2); if ( (tokensForSale[tokenID].price > 0) && (tokensForSale[tokenID].owner == nftOwner[tokenID]) && (msg.value >= tokensForSale[tokenID].price) ) { nftOwner[tokenID] = msg.sender; collections[msg.sender][tokenID] = true; collections[tokensForSale[tokenID].owner][tokenID] = false; ERC721(address(this))._payoutReferal(tokensForSale[tokenID].owner, tokensForSale[tokenID].price); emit PunkSold( tokenID, tokensForSale[tokenID].owner, msg.sender, uint64(now) ); delete tokensForSale[tokenID]; } else { ERC721(address(this))._payoutReferal(msg.sender, msg.value); } } /** * @param priceForSale_ Price of minting tokens */ function setBuyPrice(uint128 priceForSale_) external override onlyOwner { tvm.rawReserve(msg.value, 2); priceForSale = priceForSale_; address(owner).transfer({value: 0, flag: 64}); } function setSellPrice(uint128 priceForSale_) external onlyOwner { tvm.rawReserve(msg.value, 2); priceForUserSale = priceForSale_; address(owner).transfer({value: 0, flag: 64}); } /** * @param refNom reference program nominator * @param refDenom reference program denominator */ function setReferalParams(uint128 refNom, uint128 refDenom) external override onlyOwner { tvm.rawReserve(msg.value, 2); referalNominator = refNom; referalDenominator = refDenom; address(owner).transfer({value: 0, flag: 64}); } /** * @param tonsToWithdraw Amount of tons to withdraw */ function withdrawExtraTons(uint128 tonsToWithdraw) external override view onlyOwner { tvm.accept(); address(owner).transfer({value: tonsToWithdraw, flag: 64}); } /** * @param tokenID ID of nft token */ function getOwnerOf(uint32 tokenID) external override responsible view returns(address) { return {flag: 64} nftOwner[tokenID]; } function getAllTokensForSale() external override responsible returns(mapping(uint32 => SellPunk)) { return {value: 0, flag: 64} tokensForSale; } /** * @param tokenID ID of nft token */ function getSellInfo(uint32 tokenID) external override responsible returns(SellPunk) { return {value: 0, flag: 64} tokensForSale[tokenID]; } function getAllNfts() external override responsible view returns(mapping(uint32 => Punk)) { return {flag: 64} tokens; } /** * @param collector Address of nft owner */ function getUserNfts(address collector) external override responsible view returns(mapping(uint32 => bool)) { return {flag: 64} collections[collector]; } /** * @param nftID ID of nft token */ function getNft(uint32 nftID) external override responsible view returns(Punk, address collector) { return {flag: 64} (tokens[nftID], nftOwner[nftID]); } function getTokenSupplyInfo() external override responsible view returns(uint32 mintedTokens, uint32 notMintedTokens) { return {flag: 64} (nftAmount, tokensLeft); } function getTokenPrice() external override responsible view returns(uint128) { return {flag: 64} priceForSale; } function getTokenSellPrice() external responsible view returns(uint128) { return {flag: 64} priceForUserSale; } function getReferalParams() external override responsible view returns (uint128, uint128) { return {flag: 64} (referalNominator, referalDenominator); } receive() external view { if (msg.sender == owner) { tvm.accept(); address(owner).transfer({value: address(this).balance - 10 ton, flag: 0}); } } function upgradeContractCode(TvmCell code, TvmCell updateParams, uint32 codeVersion_) external override onlyOwner { tvm.rawReserve(msg.value, 2); TvmBuilder builder; // builder.store(owner); // builder.store(nftAmount); // builder.store(tokensLeft); // builder.store(totalTokens); // builder.store(priceForSale); // builder.store(referalNominator); // builder.store(referalDenominator); // builder.store(priceForUserSale); // builder.store(readyForSale); // TvmBuilder mappingStorage; // TvmBuilder nftOwnerB; // nftOwnerB.store(nftOwner); // TvmBuilder collectionsB; // collectionsB.store(collections); // TvmBuilder freeTokensB; // freeTokensB.store(freeTokens); // TvmBuilder tokensForSaleB; // tokensForSaleB.store(tokensForSale); // mappingStorage.store(nftOwnerB.toCell()); // mappingStorage.store(collectionsB.toCell()); // mappingStorage.store(freeTokensB.toCell()); // mappingStorage.store(tokensForSaleB.toCell()); // builder.store(updateParams); // builder.store(mappingStorage.toCell()); tvm.setcode(code); tvm.setCurrentCode(code); onCodeUpgrade(builder.toCell()); } function onCodeUpgrade(TvmCell oldVariables) private { // tvm.resetStorage(); // TvmSlice upgrd = oldVariables.toSlice(); // ( // owner, // nftAmount, // tokensLeft, // totalTokens, // priceForSale, // referalNominator, // referalDenominator, // priceForUserSale, // readyForSale // ) = upgrd.decode(address, uint32, uint32, uint32, uint128, uint128, uint128, uint128, bool); // TvmCell params = upgrd.loadRef(); // TvmSlice mappings = upgrd.loadRefAsSlice(); // TvmSlice tmp = mappings.loadRefAsSlice(); // nftOwner = tmp.decode(mapping(uint32 => address)); // tmp = mappings.loadRefAsSlice(); // collections = tmp.decode(mapping(address => mapping(uint32 => bool))); // tmp = mappings.loadRefAsSlice(); // freeTokens = tmp.decode(mapping(uint32 => bool)); // tmp = mappings.loadRefAsSlice(); // tokensForSale = tmp.decode(mapping(uint32 => SellPunk)); } modifier onlyOwner() { require(msg.sender == owner, ERC721ErrorCodes.ERROR_MSG_SENDER_IS_NOT_OWNER); _; } modifier onlySelf() { require(msg.sender == address(this)); _; } }
* @param punkInfo Information required for punk/
function uploadToken(Punk[] punkInfo) external override onlyOwner { tvm.rawReserve(msg.value, 2); for (Punk punk: punkInfo) { if (!freeTokens[punk.id]) { tokens[punk.id] = punk; freeTokens[punk.id] = true; totalTokens += 1; tokensLeft += 1; tokens[punk.id] = punk; } } }
14,059,961
[ 1, 84, 1683, 966, 15353, 1931, 364, 293, 1683, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3617, 1345, 12, 52, 1683, 8526, 293, 1683, 966, 13, 3903, 3849, 1338, 5541, 288, 203, 3639, 268, 3489, 18, 1899, 607, 6527, 12, 3576, 18, 1132, 16, 576, 1769, 203, 3639, 364, 261, 52, 1683, 293, 1683, 30, 293, 1683, 966, 13, 288, 203, 5411, 309, 16051, 9156, 5157, 63, 84, 1683, 18, 350, 5717, 288, 203, 7734, 2430, 63, 84, 1683, 18, 350, 65, 273, 293, 1683, 31, 203, 7734, 4843, 5157, 63, 84, 1683, 18, 350, 65, 273, 638, 31, 203, 7734, 2078, 5157, 1011, 404, 31, 203, 7734, 2430, 3910, 1011, 404, 31, 203, 7734, 2430, 63, 84, 1683, 18, 350, 65, 273, 293, 1683, 31, 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 ]
./partial_match/1/0xFD39faae66348aa27A9E1cE3697aa185B02580EE/sources/LiquidityPoolV2Converter.sol
* @dev concatenates a string and a digit (single only) and returns the result string @param _str string @param _digit digit @return concatenated string/
function concatStrDigit(string _str, uint8 _digit) private pure returns (string) { return string(abi.encodePacked(_str, uint8(bytes1('0')) + _digit)); }
4,233,395
[ 1, 16426, 275, 815, 279, 533, 471, 279, 8035, 261, 7526, 1338, 13, 471, 1135, 326, 563, 533, 225, 389, 701, 377, 533, 225, 389, 11052, 282, 8035, 327, 22080, 533, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3835, 1585, 10907, 12, 1080, 389, 701, 16, 2254, 28, 389, 11052, 13, 3238, 16618, 1135, 261, 1080, 13, 288, 203, 3639, 327, 533, 12, 21457, 18, 3015, 4420, 329, 24899, 701, 16, 2254, 28, 12, 3890, 21, 2668, 20, 26112, 397, 389, 11052, 10019, 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 ]
./full_match/100/0xC740046C8FdA017636FF155B8cFa4cF30f72907D/sources/_balancer-labs/v2-pool-weighted/contracts/managed/ManagedPoolSettings.sol
* @dev Reverts if called in the middle of a Vault operation; has no effect otherwise./
function _ensureNotInVaultContext() private view { VaultReentrancyLib.ensureNotInVaultContext(getVault()); } constructor(ManagedPoolSettingsParams memory params, IProtocolFeePercentagesProvider protocolFeeProvider) ProtocolFeeCache( protocolFeeProvider, )
14,270,271
[ 1, 426, 31537, 309, 2566, 316, 326, 7689, 434, 279, 17329, 1674, 31, 711, 1158, 5426, 3541, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 15735, 21855, 12003, 1042, 1435, 3238, 1476, 288, 203, 3639, 17329, 426, 8230, 12514, 5664, 18, 15735, 21855, 12003, 1042, 12, 588, 12003, 10663, 203, 565, 289, 203, 203, 565, 3885, 12, 10055, 2864, 2628, 1370, 3778, 859, 16, 467, 5752, 14667, 8410, 1023, 2249, 1771, 14667, 2249, 13, 203, 3639, 4547, 14667, 1649, 12, 203, 5411, 1771, 14667, 2249, 16, 203, 3639, 262, 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 ]
pragma solidity ^0.4.24; /** * @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; } } contract MyEthLab { using SafeMath for uint256; uint256 constant public PERCENT_PER_DAY = 5; // 0.05% uint256 constant public ONE_HUNDRED_PERCENTS = 10000; // 100% uint256 constant public MARKETING_FEE = 700; // 7% uint256 constant public TEAM_FEE = 300; // 3% uint256 constant public REFERRAL_PERCENTS = 300; // 3% uint256 constant public MAX_RATE = 330; // 3.3% uint256 constant public MAX_DAILY_LIMIT = 150 ether; // 150 ETH uint256 constant public MAX_DEPOSIT = 25 ether; // 25 ETH uint256 constant public MIN_DEPOSIT = 50 finney; // 0.05 ETH uint256 constant public MAX_USER_DEPOSITS_COUNT = 50; struct Deposit { uint256 time; uint256 amount; uint256 rate; } struct User { address referrer; uint256 firstTime; uint256 lastPayment; uint256 totalAmount; uint256 lastInvestment; uint256 depositAdditionalRate; Deposit[] deposits; } address public marketing = 0x270ff8c154d4d738B78bEd52a6885b493A2EDdA3; address public team = 0x69B18e895F2D9438d2128DB8151EB6e9bB02136d; uint256 public totalDeposits; uint256 public dailyTime; uint256 public dailyLimit; bool public running = true; mapping(address => User) public users; event InvestorAdded(address indexed investor); event ReferrerAdded(address indexed investor, address indexed referrer); event DepositAdded(address indexed investor, uint256 indexed depositsCount, uint256 amount); event UserDividendPayed(address indexed investor, uint256 dividend); event ReferrerPayed(address indexed investor, address indexed referrer, uint256 amount, uint256 refAmount); event FeePayed(address indexed investor, uint256 amount); event TotalDepositsChanged(uint256 totalDeposits); event BalanceChanged(uint256 balance); event DepositDividendPayed(address indexed investor, uint256 indexed index, uint256 deposit, uint256 rate, uint256 dividend); constructor() public { dailyTime = now.add(1 days); } function() public payable { require(running, "MyEthLab is not running"); User storage user = users[msg.sender]; if (now > dailyTime) { dailyTime = now.add(1 days); dailyLimit = 0; } // Dividends uint256[] memory dividends = dividendsForUser(msg.sender); uint256 dividendsSum = _dividendsSum(dividends); if (dividendsSum > 0) { // One payment per hour and first payment will be after 24 hours if ((now.sub(user.lastPayment)) > 1 hours && (now.sub(user.firstTime)) > 1 days) { if (dividendsSum >= address(this).balance) { dividendsSum = address(this).balance; running = false; } msg.sender.transfer(dividendsSum); user.lastPayment = now; emit UserDividendPayed(msg.sender, dividendsSum); for (uint i = 0; i < dividends.length; i++) { emit DepositDividendPayed( msg.sender, i, user.deposits[i].amount, user.deposits[i].rate, dividends[i] ); } } } // Deposit if (msg.value > 0) { require(msg.value >= MIN_DEPOSIT, "You dont have enough ethers"); uint256 userTotalDeposit = user.totalAmount.add(msg.value); require(userTotalDeposit <= MAX_DEPOSIT, "You have enough invesments"); if (user.firstTime != 0 && (now.sub(user.lastInvestment)) > 1 days) { user.depositAdditionalRate = user.depositAdditionalRate.add(5); } if (user.firstTime == 0) { user.firstTime = now; emit InvestorAdded(msg.sender); } user.lastInvestment = now; user.totalAmount = userTotalDeposit; uint currentRate = getRate(userTotalDeposit).add(user.depositAdditionalRate).add(balanceAdditionalRate()); if (currentRate > MAX_RATE) { currentRate = MAX_RATE; } // Create deposit user.deposits.push(Deposit({ time: now, amount: msg.value, rate: currentRate })); require(user.deposits.length <= MAX_USER_DEPOSITS_COUNT, "Too many deposits per user"); emit DepositAdded(msg.sender, user.deposits.length, msg.value); // Check daily limit and Add daily amount of etheres dailyLimit = dailyLimit.add(msg.value); require(dailyLimit < MAX_DAILY_LIMIT, "Please wait one more day too invest"); // Add to total deposits totalDeposits = totalDeposits.add(msg.value); emit TotalDepositsChanged(totalDeposits); // Add referral if possible if (user.referrer == address(0) && msg.data.length == 20) { address referrer = _bytesToAddress(msg.data); if (referrer != address(0) && referrer != msg.sender && now >= users[referrer].firstTime) { user.referrer = referrer; emit ReferrerAdded(msg.sender, referrer); } } // Referrers fees if (users[msg.sender].referrer != address(0)) { address referrerAddress = users[msg.sender].referrer; uint256 refAmount = msg.value.mul(REFERRAL_PERCENTS).div(ONE_HUNDRED_PERCENTS); referrerAddress.send(refAmount); // solium-disable-line security/no-send emit ReferrerPayed(msg.sender, referrerAddress, msg.value, refAmount); } // Marketing and team fees uint256 marketingFee = msg.value.mul(MARKETING_FEE).div(ONE_HUNDRED_PERCENTS); uint256 teamFee = msg.value.mul(TEAM_FEE).div(ONE_HUNDRED_PERCENTS); marketing.send(marketingFee); // solium-disable-line security/no-send team.send(teamFee); // solium-disable-line security/no-send emit FeePayed(msg.sender, marketingFee.add(teamFee)); } emit BalanceChanged(address(this).balance); } function depositsCountForUser(address wallet) public view returns(uint256) { return users[wallet].deposits.length; } function depositForUser(address wallet, uint256 index) public view returns(uint256 time, uint256 amount, uint256 rate) { time = users[wallet].deposits[index].time; amount = users[wallet].deposits[index].amount; rate = users[wallet].deposits[index].rate; } function dividendsSumForUser(address wallet) public view returns(uint256 dividendsSum) { return _dividendsSum(dividendsForUser(wallet)); } function dividendsForUser(address wallet) public view returns(uint256[] dividends) { User storage user = users[wallet]; dividends = new uint256[](user.deposits.length); for (uint i = 0; i < user.deposits.length; i++) { uint256 duration = now.sub(user.lastPayment); dividends[i] = dividendsForAmountAndTime(user.deposits[i].rate, user.deposits[i].amount, duration); } } function dividendsForAmountAndTime(uint256 rate, uint256 amount, uint256 duration) public pure returns(uint256) { return amount .mul(rate).div(ONE_HUNDRED_PERCENTS) .mul(duration).div(1 days); } function _bytesToAddress(bytes data) private pure returns(address addr) { // solium-disable-next-line security/no-inline-assembly assembly { addr := mload(add(data, 20)) } } function _dividendsSum(uint256[] dividends) private pure returns(uint256 dividendsSum) { for (uint i = 0; i < dividends.length; i++) { dividendsSum = dividendsSum.add(dividends[i]); } } function getRate(uint256 userTotalDeposit) private pure returns(uint256) { if (userTotalDeposit < 5 ether) { return 180; } else if (userTotalDeposit < 10 ether) { return 200; } else { return 220; } } function balanceAdditionalRate() public view returns(uint256) { if (address(this).balance < 600 ether) { return 0; } else if (address(this).balance < 1200 ether) { return 10; } else if (address(this).balance < 1800 ether) { return 20; } else if (address(this).balance < 2400 ether) { return 30; } else if (address(this).balance < 3000 ether) { return 40; } else { return 50; } } }
solium-disable-next-line security/no-inline-assembly
function _bytesToAddress(bytes data) private pure returns(address addr) { assembly { addr := mload(add(data, 20)) } }
1,073,237
[ 1, 18281, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3890, 774, 1887, 12, 3890, 501, 13, 3238, 16618, 1135, 12, 2867, 3091, 13, 288, 203, 3639, 19931, 288, 203, 5411, 3091, 519, 312, 945, 12, 1289, 12, 892, 16, 4200, 3719, 7010, 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 ]
pragma solidity 0.6.12; // SPDX-License-Identifier: MIT /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT /** * @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; } } // SPDX-License-Identifier: MIT /** * @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 /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT /** * @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); } } } } // SPDX-License-Identifier: MIT /** * @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 /** * @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]. */ contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () internal { _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; } } // SPDX-License-Identifier: MIT /** * @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 Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor () internal { _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. * * 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()); } } // SPDX-License-Identifier: MIT interface IPancakeswapFarm { function poolLength() external view returns (uint256); function userInfo() external view returns (uint256); // Return reward multiplier over the given _from to _to block. function getMultiplier(uint256 _from, uint256 _to) external view returns (uint256); // View function to see pending CAKEs on frontend. function pendingCake(uint256 _pid, address _user) external view returns (uint256); function pendingMDO(uint256 _pid, address _user) external view returns (uint256); function pendingShare(uint256 _pid, address _user) external view returns (uint256); function pendingBDO(uint256 _pid, address _user) external view returns (uint256); function pendingRewards(uint256 _pid, address _user) external view returns (uint256); function pendingReward(uint256 _pid, address _user) external view returns (uint256); function pendingBELT(uint256 _pid, address _user) external view returns (uint256); function pendingBusd(uint256 _pid, address _user) external view returns (uint256); // Deposit LP tokens to MasterChef for CAKE allocation. function deposit(uint256 _pid, uint256 _amount) external; // Withdraw LP tokens from MasterChef. function withdraw(uint256 _pid, uint256 _amount) external; // Stake CAKE tokens to MasterChef function enterStaking(uint256 _amount) external; // Withdraw CAKE tokens from STAKING. function leaveStaking(uint256 _amount) external; // Withdraw without caring about rewards. EMERGENCY ONLY. function emergencyWithdraw(uint256 _pid) external; } // SPDX-License-Identifier: MIT interface IPancakeRouter01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); } // SPDX-License-Identifier: MIT interface IPancakeRouter02 is IPancakeRouter01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; } // SPDX-License-Identifier: MIT interface ITreasury { function notifyExternalReward(uint256 _amount) external; } // SPDX-License-Identifier: MIT contract BvaultsStrategy is Ownable, ReentrancyGuard, Pausable { // Maximises yields in pancakeswap using SafeMath for uint256; using SafeERC20 for IERC20; bool public isAutoComp; // this vault is purely for staking. eg. WBNB-BDO staking vault. address public farmContractAddress; // address of farm, eg, PCS, Thugs etc. uint256 public pid; // pid of pool in farmContractAddress address public wantAddress; address public token0Address; address public token1Address; address public earnedAddress; address public uniRouterAddress = address(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F); // PancakeSwap: Router mapping(address => mapping(address => address[])) public paths; address public constant wbnbAddress = address(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c); address public constant busdAddress = address(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56); address public operator; address public strategist; address public timelock = address(0x92a082Ad5A942140bCC791081F775900d0A514D9); // 24h timelock bool public notPublic = false; // allow public to call earn() function uint256 public lastEarnBlock = 0; uint256 public wantLockedTotal = 0; uint256 public sharesTotal = 0; uint256 public controllerFee = 0; uint256 public constant controllerFeeMax = 10000; // 100 = 1% uint256 public constant controllerFeeUL = 300; uint256 public constant buyBackRateMax = 10000; // 100 = 1% uint256 public constant buyBackRateUL = 800; // 8% uint256 public buyBackRate1 = 300; // 3% address public buyBackToken1 = address(0x81859801b01764D4f0Fa5E64729f5a6C3b91435b); // BFI address public buyBackAddress1 = address(0x000000000000000000000000000000000000dEaD); // to burn uint256 public buyBackRate2 = 200; // 2% address public buyBackToken2 = address(0x190b589cf9Fb8DDEabBFeae36a813FFb2A702454); // BDO address public buyBackAddress2 = address(0x000000000000000000000000000000000000dEaD); // to burn uint256 public entranceFeeFactor = 10000; // 0% entrance fee (goes to pool + prevents front-running) uint256 public constant entranceFeeFactorMax = 10000; // 100 = 1% uint256 public constant entranceFeeFactorLL = 9950; // 0.5% is the max entrance fee settable. LL = lowerlimit event Deposit(uint256 amount); event Withdraw(uint256 amount); event Farm(uint256 amount); event Compound(address token0Address, uint256 token0Amt, address token1Address, uint256 token1Amt); event Earned(address earnedAddress, uint256 earnedAmt); event BuyBack(address earnedAddress, address buyBackToken, uint earnedAmt, uint256 buyBackAmt, address receiver); event DistributeFee(address earnedAddress, uint256 fee, address receiver); event ConvertDustToEarned(address tokenAddress, address earnedAddress, uint256 tokenAmt); event InCaseTokensGetStuck(address tokenAddress, uint256 tokenAmt, address receiver); event ExecuteTransaction(address indexed target, uint256 value, string signature, bytes data); // _controller: BvaultsBank // _buyBackToken1Info[]: buyBackToken1, buyBackAddress1, buyBackToken1MidRouteAddress // _buyBackToken2Info[]: buyBackToken2, buyBackAddress2, buyBackToken2MidRouteAddress // _token0Info[]: token0Address, token0MidRouteAddress // _token1Info[]: token1Address, token1MidRouteAddress constructor( address _controller, bool _isAutoComp, address _farmContractAddress, uint256 _pid, address _wantAddress, address _earnedAddress, address _uniRouterAddress, address[] memory _buyBackToken1Info, address[] memory _buyBackToken2Info, address _token0, address _token1 ) public { operator = msg.sender; strategist = msg.sender; // to call earn if public not allowed isAutoComp = _isAutoComp; wantAddress = _wantAddress; if (_uniRouterAddress != address(0)) uniRouterAddress = _uniRouterAddress; buyBackToken1 = _buyBackToken1Info[0]; buyBackAddress1 = _buyBackToken1Info[1]; buyBackToken2 = _buyBackToken2Info[0]; buyBackAddress2 = _buyBackToken2Info[1]; if (isAutoComp) { token0Address = _token0; token1Address = _token1; farmContractAddress = _farmContractAddress; pid = _pid; earnedAddress = _earnedAddress; uniRouterAddress = _uniRouterAddress; } transferOwnership(_controller); } modifier onlyOperator() { require(operator == msg.sender, "BvaultsStrategy: caller is not the operator"); _; } modifier onlyStrategist() { require(strategist == msg.sender || operator == msg.sender, "BvaultsStrategy: caller is not the strategist"); _; } modifier onlyTimelock() { require(timelock == msg.sender, "BvaultsStrategy: caller is not timelock"); _; } function isAuthorised(address _account) public view returns (bool) { return (_account == operator) || (msg.sender == strategist) || (msg.sender == timelock); } // Receives new deposits from user function deposit(address, uint256 _wantAmt) public onlyOwner whenNotPaused returns (uint256) { IERC20(wantAddress).safeTransferFrom(address(msg.sender), address(this), _wantAmt); uint256 sharesAdded = _wantAmt; if (wantLockedTotal > 0 && sharesTotal > 0) { sharesAdded = _wantAmt.mul(sharesTotal).mul(entranceFeeFactor).div(wantLockedTotal).div(entranceFeeFactorMax); } sharesTotal = sharesTotal.add(sharesAdded); if (isAutoComp) { _farm(); } else { wantLockedTotal = wantLockedTotal.add(_wantAmt); } emit Deposit(_wantAmt); return sharesAdded; } function farm() public nonReentrant { _farm(); } function _farm() internal { uint256 wantAmt = IERC20(wantAddress).balanceOf(address(this)); wantLockedTotal = wantLockedTotal.add(wantAmt); IERC20(wantAddress).safeIncreaseAllowance(farmContractAddress, wantAmt); IPancakeswapFarm(farmContractAddress).deposit(pid, wantAmt); emit Farm(wantAmt); } function withdraw(address, uint256 _wantAmt) public onlyOwner nonReentrant returns (uint256) { require(_wantAmt > 0, "BvaultsStrategy: !_wantAmt"); if (isAutoComp) { IPancakeswapFarm(farmContractAddress).withdraw(pid, _wantAmt); } uint256 wantAmt = IERC20(wantAddress).balanceOf(address(this)); if (_wantAmt > wantAmt) { _wantAmt = wantAmt; } if (wantLockedTotal < _wantAmt) { _wantAmt = wantLockedTotal; } uint256 sharesRemoved = _wantAmt.mul(sharesTotal).div(wantLockedTotal); if (sharesRemoved > sharesTotal) { sharesRemoved = sharesTotal; } sharesTotal = sharesTotal.sub(sharesRemoved); wantLockedTotal = wantLockedTotal.sub(_wantAmt); IERC20(wantAddress).safeTransfer(address(msg.sender), _wantAmt); emit Withdraw(_wantAmt); return sharesRemoved; } // 1. Harvest farm tokens // 2. Converts farm tokens into want tokens // 3. Deposits want tokens function earn() public whenNotPaused { require(isAutoComp, "BvaultsStrategy: !isAutoComp"); require(!notPublic || isAuthorised(msg.sender), "BvaultsStrategy: !authorised"); // Harvest farm tokens IPancakeswapFarm(farmContractAddress).withdraw(pid, 0); // Converts farm tokens into want tokens uint256 earnedAmt = IERC20(earnedAddress).balanceOf(address(this)); emit Earned(earnedAddress, earnedAmt); uint256 _distributeFee = distributeFees(earnedAmt); uint256 _buyBackAmt1 = buyBack1(earnedAmt); uint256 _buyBackAmt2 = buyBack2(earnedAmt); earnedAmt = earnedAmt.sub(_distributeFee).sub(_buyBackAmt1).sub(_buyBackAmt2); IERC20(earnedAddress).safeIncreaseAllowance(uniRouterAddress, earnedAmt); if (earnedAddress != token0Address) { // Swap half earned to token0 IPancakeRouter02(uniRouterAddress).swapExactTokensForTokensSupportingFeeOnTransferTokens(earnedAmt.div(2), 0, paths[earnedAddress][token0Address], address(this), now + 60); } if (earnedAddress != token1Address) { // Swap half earned to token1 IPancakeRouter02(uniRouterAddress).swapExactTokensForTokensSupportingFeeOnTransferTokens(earnedAmt.div(2), 0, paths[earnedAddress][token1Address], address(this), now + 60); } // Get want tokens, ie. add liquidity uint256 token0Amt = IERC20(token0Address).balanceOf(address(this)); uint256 token1Amt = IERC20(token1Address).balanceOf(address(this)); if (token0Amt > 0 && token1Amt > 0) { IERC20(token0Address).safeIncreaseAllowance(uniRouterAddress, token0Amt); IERC20(token1Address).safeIncreaseAllowance(uniRouterAddress, token1Amt); IPancakeRouter02(uniRouterAddress).addLiquidity(token0Address, token1Address, token0Amt, token1Amt, 0, 0, address(this), now + 60); emit Compound(token0Address, token0Amt, token1Address, token1Amt); } lastEarnBlock = block.number; _farm(); } function buyBack1(uint256 _earnedAmt) internal returns (uint256) { if (buyBackRate1 <= 0 || buyBackAddress1 == address(0)) { return 0; } uint256 _buyBackAmt = _earnedAmt.mul(buyBackRate1).div(buyBackRateMax); uint256 _before = IERC20(buyBackToken1).balanceOf(buyBackAddress1); if (earnedAddress != buyBackToken1) { IERC20(earnedAddress).safeIncreaseAllowance(uniRouterAddress, _buyBackAmt); IPancakeRouter02(uniRouterAddress).swapExactTokensForTokensSupportingFeeOnTransferTokens(_buyBackAmt, 0, paths[earnedAddress][buyBackToken1], buyBackAddress1, now + 60); } else { IERC20(earnedAddress).safeTransfer(buyBackAddress1, _buyBackAmt); } uint256 _after = IERC20(buyBackToken1).balanceOf(buyBackAddress1); uint256 _newReward = _after.sub(_before); emit BuyBack(earnedAddress, buyBackToken1, _buyBackAmt, _newReward, buyBackAddress1); return _buyBackAmt; } function buyBack2(uint256 _earnedAmt) internal returns (uint256) { if (buyBackRate2 <= 0 || buyBackAddress2 == address(0)) { return 0; } uint256 _buyBackAmt = _earnedAmt.mul(buyBackRate2).div(buyBackRateMax); uint256 _before = IERC20(buyBackToken2).balanceOf(buyBackAddress2); if (earnedAddress != buyBackToken2) { IERC20(earnedAddress).safeIncreaseAllowance(uniRouterAddress, _buyBackAmt); IPancakeRouter02(uniRouterAddress).swapExactTokensForTokensSupportingFeeOnTransferTokens(_buyBackAmt, 0, paths[earnedAddress][buyBackToken2], buyBackAddress2, now + 60); } else { IERC20(earnedAddress).safeTransfer(buyBackAddress2, _buyBackAmt); } uint256 _after = IERC20(buyBackToken2).balanceOf(buyBackAddress2); uint256 _newReward = _after.sub(_before); if (_newReward > 0) { ITreasury(buyBackAddress2).notifyExternalReward(_newReward); emit BuyBack(earnedAddress, buyBackToken2, _buyBackAmt, _newReward, buyBackAddress2); } return _buyBackAmt; } function distributeFees(uint256 _earnedAmt) internal returns (uint256 _fee) { if (_earnedAmt > 0) { // Performance fee if (controllerFee > 0) { _fee = _earnedAmt.mul(controllerFee).div(controllerFeeMax); IERC20(earnedAddress).safeTransfer(operator, _fee); emit DistributeFee(earnedAddress, _fee, operator); } } } function convertDustToEarned() public whenNotPaused { require(isAutoComp, "!isAutoComp"); // Converts dust tokens into earned tokens, which will be reinvested on the next earn(). // Converts token0 dust (if any) to earned tokens uint256 token0Amt = IERC20(token0Address).balanceOf(address(this)); if (token0Address != earnedAddress && token0Amt > 0) { IERC20(token0Address).safeIncreaseAllowance(uniRouterAddress, token0Amt); // Swap all dust tokens to earned tokens IPancakeRouter02(uniRouterAddress).swapExactTokensForTokensSupportingFeeOnTransferTokens(token0Amt, 0, paths[token0Address][earnedAddress], address(this), now + 60); emit ConvertDustToEarned(token0Address, earnedAddress, token0Amt); } // Converts token1 dust (if any) to earned tokens uint256 token1Amt = IERC20(token1Address).balanceOf(address(this)); if (token1Address != earnedAddress && token1Amt > 0) { IERC20(token1Address).safeIncreaseAllowance(uniRouterAddress, token1Amt); // Swap all dust tokens to earned tokens IPancakeRouter02(uniRouterAddress).swapExactTokensForTokensSupportingFeeOnTransferTokens(token1Amt, 0, paths[token1Address][earnedAddress], address(this), now + 60); emit ConvertDustToEarned(token1Address, earnedAddress, token1Amt); } } function uniExchangeRate(uint256 _tokenAmount, address[] memory _path) public view returns (uint256) { uint256[] memory amounts = IPancakeRouter02(uniRouterAddress).getAmountsOut(_tokenAmount, _path); return amounts[amounts.length - 1]; } function pendingHarvest() public view returns (uint256) { uint256 _earnedBal = IERC20(earnedAddress).balanceOf(address(this)); return IPancakeswapFarm(farmContractAddress).pendingBusd(pid, address(this)).add(_earnedBal); } function pendingHarvestDollarValue() public view returns (uint256) { uint256 _pending = pendingHarvest(); return _pending; } function pause() external onlyOperator { _pause(); } function unpause() external onlyOperator { _unpause(); } function setOperator(address _operator) external onlyOperator { operator = _operator; } function setStrategist(address _strategist) external onlyOperator { strategist = _strategist; } function setEntranceFeeFactor(uint256 _entranceFeeFactor) external onlyOperator { require(_entranceFeeFactor > entranceFeeFactorLL, "BvaultsStrategy: !safe - too low"); require(_entranceFeeFactor <= entranceFeeFactorMax, "BvaultsStrategy: !safe - too high"); entranceFeeFactor = _entranceFeeFactor; } function setControllerFee(uint256 _controllerFee) external onlyOperator { require(_controllerFee <= controllerFeeUL, "BvaultsStrategy: too high"); controllerFee = _controllerFee; } function setBuyBackRate1(uint256 _buyBackRate1) external onlyOperator { require(buyBackRate1 <= buyBackRateUL, "BvaultsStrategy: too high"); buyBackRate1 = _buyBackRate1; } function setBuyBackRate2(uint256 _buyBackRate2) external onlyOperator { require(buyBackRate2 <= buyBackRateUL, "BvaultsStrategy: too high"); buyBackRate2 = _buyBackRate2; } function setBuyBackAddress1(address _buyBackAddress1) external onlyOperator { require(buyBackAddress1 != address(0), "zero"); buyBackAddress1 = _buyBackAddress1; } function setBuyBackAddress2(address _buyBackAddress2) external onlyOperator { require(_buyBackAddress2 != address(0), "zero"); buyBackAddress2 = _buyBackAddress2; } function setNotPublic(bool _notPublic) external onlyOperator { notPublic = _notPublic; } function setMainPaths( address[] memory _earnedToBuyBackToken1Path, address[] memory _earnedToBuyBackToken2Path, address[] memory _earnedToToken0Path, address[] memory _earnedToToken1Path, address[] memory _earnedToBusdPath, address[] memory _token0ToEarnedPath, address[] memory _token1ToEarnedPath ) external onlyOperator { paths[earnedAddress][buyBackToken1] = _earnedToBuyBackToken1Path; paths[earnedAddress][buyBackToken2] = _earnedToBuyBackToken2Path; paths[earnedAddress][token0Address] = _earnedToToken0Path; paths[earnedAddress][token1Address] = _earnedToToken1Path; paths[earnedAddress][busdAddress] = _earnedToBusdPath; paths[token0Address][earnedAddress] = _token0ToEarnedPath; paths[token1Address][earnedAddress] = _token1ToEarnedPath; } function setPaths(address _inputToken, address _outputToken, address[] memory _path) external onlyOperator { paths[_inputToken][_outputToken] = _path; } function inCaseTokensGetStuck(address _token, uint256 _amount, address _to) external onlyOperator { require(_token != earnedAddress, "!safe"); require(_token != wantAddress, "!safe"); IERC20(_token).safeTransfer(_to, _amount); emit InCaseTokensGetStuck(_token, _amount, _to); } /* ========== EMERGENCY ========== */ function setTimelock(address _timelock) external onlyTimelock { timelock = _timelock; } /** * @dev This is from Timelock contract. */ function executeTransaction(address target, uint256 value, string memory signature, bytes memory data) external onlyTimelock returns (bytes memory) { bytes memory callData; if (bytes(signature).length == 0) { callData = data; } else { callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data); } // solium-disable-next-line security/no-call-value (bool success, bytes memory returnData) = target.call{value : value}(callData); require(success, "BvaultsStrategy::executeTransaction: Transaction execution reverted."); emit ExecuteTransaction(target, value, signature, data); return returnData; } }
SPDX-License-Identifier: MIT
interface IPancakeRouter01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); }
1,777,678
[ 1, 3118, 28826, 17, 13211, 17, 3004, 30, 490, 1285, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2971, 19292, 911, 8259, 1611, 288, 203, 565, 445, 3272, 1435, 3903, 16618, 1135, 261, 2867, 1769, 203, 203, 565, 445, 678, 1584, 44, 1435, 3903, 16618, 1135, 261, 2867, 1769, 203, 203, 565, 445, 527, 48, 18988, 24237, 12, 203, 3639, 1758, 1147, 37, 16, 203, 3639, 1758, 1147, 38, 16, 203, 3639, 2254, 5034, 3844, 1880, 281, 2921, 16, 203, 3639, 2254, 5034, 3844, 38, 25683, 16, 203, 3639, 2254, 5034, 3844, 2192, 267, 16, 203, 3639, 2254, 5034, 3844, 38, 2930, 16, 203, 3639, 1758, 358, 16, 203, 3639, 2254, 5034, 14096, 203, 565, 262, 203, 565, 3903, 203, 565, 1135, 261, 203, 3639, 2254, 5034, 3844, 37, 16, 203, 3639, 2254, 5034, 3844, 38, 16, 203, 3639, 2254, 5034, 4501, 372, 24237, 203, 565, 11272, 203, 203, 565, 445, 527, 48, 18988, 24237, 1584, 44, 12, 203, 3639, 1758, 1147, 16, 203, 3639, 2254, 5034, 3844, 1345, 25683, 16, 203, 3639, 2254, 5034, 3844, 1345, 2930, 16, 203, 3639, 2254, 5034, 3844, 1584, 44, 2930, 16, 203, 3639, 1758, 358, 16, 203, 3639, 2254, 5034, 14096, 203, 565, 262, 203, 565, 3903, 203, 565, 8843, 429, 203, 565, 1135, 261, 203, 3639, 2254, 5034, 3844, 1345, 16, 203, 3639, 2254, 5034, 3844, 1584, 44, 16, 203, 3639, 2254, 5034, 4501, 372, 24237, 203, 565, 11272, 203, 203, 565, 445, 1206, 48, 18988, 24237, 12, 203, 3639, 1758, 1147, 37, 16, 203, 3639, 1758, 1147, 38, 16, 203, 3639, 2254, 5034, 4501, 372, 24237, 16, 203, 3639, 2254, 5034, 3844, 2 ]
pragma solidity 0.4.23; /** * @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'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) { uint256 c = a + b; assert(c >= a); return c; } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev 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); } /** * @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); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * 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 != 0x0); // Check if the sender has enough require(balances[_from] >= _value); // Check for overflows require(balances[_to] + _value > balances[_to]); // Save this for an assertion in the future uint previousBalances = balances[_from] + balances[_to]; // Subtract from the sender balances[_from] = balances[_from].sub(_value); // Add the same to the recipient balances[_to] = balances[_to].add(_value); Transfer(_from, _to, _value); // Asserts are used to use static analysis to find bugs in your code. They should never fail assert(balances[_from] + balances[_to] == previousBalances); } /** * @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) { _transfer(msg.sender, _to, _value); return true; /** 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 VanHardwareResourcesChain is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; string public name; //fancy name: eg Simon Bucks uint8 public decimals; //How many decimals to show. string public symbol; //An identifier: eg SBX uint256 public sellPrice; uint256 public buyPrice; address public owner; function VanHardwareResourcesChain() public { decimals = 18; // Amount of decimals for display purposes totalSupply_ = 500000000 * 10 ** uint256(decimals); // Update total supply balances[0x72A4e7Ea1DDd6E33eA18b3B249E66A2201A7d7f5] = totalSupply_; // Give the creator all initial tokens name = "Van hardware resources chain"; // Set the name for display purposes symbol = "VHC"; // Set the symbol for display purposes owner = 0x72A4e7Ea1DDd6E33eA18b3B249E66A2201A7d7f5; Transfer(address(0x0), 0x72A4e7Ea1DDd6E33eA18b3B249E66A2201A7d7f5 , totalSupply_); } modifier onlyOwner(){ require(msg.sender == owner); _; } function changeOwner(address _newOwner) public onlyOwner{ owner = _newOwner; } /** * @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]; } function setPrices(uint256 newSellPrice, uint256 newBuyPrice) public onlyOwner{ sellPrice = newSellPrice; buyPrice = newBuyPrice; } /// @notice Buy tokens from contract by sending ether function buy() payable public { uint amount = uint(msg.value) / uint(buyPrice); // calculates the amount _transfer(this, msg.sender, amount * 10 ** uint256(decimals)); // makes the transfers } function() payable public{ buy(); } /// @notice Sell `amount` tokens to contract /// @param amount amount of tokens to be sold function sell(uint256 amount) public { require(this.balance >= amount * sellPrice); // checks if the contract has enough ether to buy _transfer(msg.sender, this, amount * 10 ** uint256(decimals)); // makes the transfers msg.sender.transfer(amount * sellPrice); // sends ether to the seller. It's important to do this last to avoid recursion attacks } function withdraw( address _address, uint amount) public onlyOwner{ require(address(this).balance > amount * 1 ether); _address.transfer(amount * 1 ether); } }
calculates the amount
uint amount = uint(msg.value) / uint(buyPrice);
1,669,383
[ 1, 12780, 815, 326, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3844, 273, 2254, 12, 3576, 18, 1132, 13, 342, 2254, 12, 70, 9835, 5147, 1769, 7734, 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 ]
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; // EIP20 => https://eips.ethereum.org/EIPS/eip-20 import "https://github.com/mosi-sol/erc20/blob/main/IERC20.sol"; contract ERC20 is IERC20 { // variables string name; string symbol; uint8 decimals; // many tokens in market use 18 decimals => x * 10 ** 18 uint256 public totalSupply; uint256 public maxSupply; bool public maxProvider = false; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint)) public allowance; // events implemened from IERC20 // event Transfer(address indexed from, address indexed to, uint value); // event Approval(address indexed owner, address indexed spender, uint value); // new events event Mint(address indexed miner, uint256 date, uint256 amount); event Burn(address indexed burner, uint256 date, uint256 amount); // modifier // initialize constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; } // public functions function approve(address spender, uint amount) external returns (bool success) { success = _approve(spender, amount); require(success, "Transaction failed"); } function transfer(address recipient, uint amount) external returns (bool success) { success = _transfer(recipient, amount); require(success, "Transaction failed"); } function transferFrom(address sender, address recipient, uint amount) external returns (bool success) { bool cach = _approve(sender, amount); require(cach, "approve by sender"); success = _transferFrom(sender, recipient, amount); require(success, "Transaction failed"); } function mint(uint amount) external returns (bool success) { success = _mint(amount); require(success, "Transaction failed"); } function burn(uint amount) external returns (bool success) { success = _burn(amount); require(success, "Transaction failed"); } // terminal logic [only owner] function toggleMaxProvider() internal { // onlyOwner function -> this is important maxProvider = !maxProvider; } function setMaxSupply(uint256 _max) internal { // onlyOwner function -> this is important maxSupply = _max; } // logic/internals -> wrapping the logic for more security --> https://github.com/mosi-sol/audit/tree/main/wrappedCondition // important: if implement this, use --> virtual override <-- then can use -> super <- keyword for call base // read more content here: https://docs.openzeppelin.com/contracts/4.x/extending-contracts#using-hooks function _approve(address spender, uint amount) internal virtual returns (bool){ allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function _transfer(address recipient, uint amount) internal virtual returns (bool){ require(recipient != address(0), "transfer recipient cant be black hole!"); require(balanceOf[msg.sender] >= amount, "not enught token"); balanceOf[msg.sender] -= amount; balanceOf[recipient] += amount; emit Transfer(msg.sender, recipient, amount); return true; } function _transferFrom(address sender, address recipient, uint amount) internal virtual returns (bool){ require(recipient != address(0), "transfer recipient cant be black hole!"); require(balanceOf[msg.sender] >= amount, "not enught token"); allowance[sender][msg.sender] -= amount; balanceOf[msg.sender] -= amount; balanceOf[recipient] += amount; emit Transfer(msg.sender, recipient, amount); return true; } function _mint(uint amount) internal virtual returns (bool) { if(maxProvider == true) { if(maxSupply > 0 && maxSupply < (totalSupply+amount)) { balanceOf[msg.sender] += amount; totalSupply += amount; emit Transfer(address(0), msg.sender, amount); emit Mint(msg.sender, block.timestamp, amount); return true; } } else if(maxProvider == false) { balanceOf[msg.sender] += amount; totalSupply += amount; emit Transfer(address(0), msg.sender, amount); emit Mint(msg.sender, block.timestamp, amount); return true; } return false; } function _burn(uint amount) internal virtual returns (bool) { balanceOf[msg.sender] -= amount; totalSupply -= amount; emit Transfer(msg.sender, address(0), amount); emit Burn(msg.sender, block.timestamp, amount); return true; } }
terminal logic [only owner]
maxProvider = !maxProvider;
14,086,259
[ 1, 15979, 4058, 306, 3700, 3410, 65, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 943, 2249, 273, 401, 1896, 2249, 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 ]
./full_match/83/0x240a7Df556deB25b7e62D1A6B79cCBB1aBa22B7d/sources/contracts/base/reward/Bribe.sol
@dev This is an external function, but internal notation is used since it can only be called "internally" from Gauges
function _deposit(uint amount, uint tokenId) external override { require(msg.sender == voter, "Not voter"); require(amount > 0, "Zero amount"); address adr = _tokenIdToAddress(tokenId); _increaseBalance(adr, amount); emit Deposit(adr, amount); }
9,562,290
[ 1, 2503, 353, 392, 3903, 445, 16, 1496, 2713, 12155, 353, 1399, 1377, 3241, 518, 848, 1338, 506, 2566, 315, 267, 798, 1230, 6, 628, 611, 6480, 281, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 323, 1724, 12, 11890, 3844, 16, 2254, 1147, 548, 13, 3903, 3849, 288, 203, 3639, 2583, 12, 3576, 18, 15330, 422, 331, 20005, 16, 315, 1248, 331, 20005, 8863, 203, 3639, 2583, 12, 8949, 405, 374, 16, 315, 7170, 3844, 8863, 203, 203, 3639, 1758, 1261, 86, 273, 389, 2316, 28803, 1887, 12, 2316, 548, 1769, 203, 3639, 389, 267, 11908, 13937, 12, 361, 86, 16, 3844, 1769, 203, 3639, 3626, 4019, 538, 305, 12, 361, 86, 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 ]
./partial_match/56/0x22cC57c9ec341152834F216289A1824d61b47855/sources/IncubatorChef.sol
Add a new lp to the pool. Can only be called by the owner.
function add(uint256 _allocPoint, IBEP20 _lpToken, uint16 _depositFeeBP, uint256 _maxDepositAmount, bool _withUpdate) override external onlyOwner { require(_depositFeeBP <= 2000, "add: FEES CANNOT EXCEED 20%"); if (_withUpdate) { _massUpdatePools(); } uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock; totalAllocPoint = totalAllocPoint.add(_allocPoint); poolInfo.push(PoolInfo({ lpToken: _lpToken, allocPoint: _allocPoint, lastRewardBlock: lastRewardBlock, accGoosePerShare: 0, depositFeeBP: _depositFeeBP, maxDepositAmount: _maxDepositAmount, currentDepositAmount: 0 })); }
11,322,002
[ 1, 986, 279, 394, 12423, 358, 326, 2845, 18, 4480, 1338, 506, 2566, 635, 326, 3410, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 527, 12, 11890, 5034, 389, 9853, 2148, 16, 467, 5948, 52, 3462, 389, 9953, 1345, 16, 2254, 2313, 389, 323, 1724, 14667, 30573, 16, 2254, 5034, 389, 1896, 758, 1724, 6275, 16, 1426, 389, 1918, 1891, 13, 3849, 3903, 1338, 5541, 288, 203, 3639, 2583, 24899, 323, 1724, 14667, 30573, 1648, 16291, 16, 315, 1289, 30, 16439, 3991, 385, 16791, 5675, 1441, 2056, 4200, 9, 8863, 203, 3639, 309, 261, 67, 1918, 1891, 13, 288, 203, 5411, 389, 10424, 1891, 16639, 5621, 203, 3639, 289, 203, 3639, 2254, 5034, 1142, 17631, 1060, 1768, 273, 1203, 18, 2696, 405, 787, 1768, 692, 1203, 18, 2696, 294, 787, 1768, 31, 203, 3639, 2078, 8763, 2148, 273, 2078, 8763, 2148, 18, 1289, 24899, 9853, 2148, 1769, 203, 3639, 2845, 966, 18, 6206, 12, 2864, 966, 12590, 203, 5411, 12423, 1345, 30, 389, 9953, 1345, 16, 203, 5411, 4767, 2148, 30, 389, 9853, 2148, 16, 203, 5411, 1142, 17631, 1060, 1768, 30, 1142, 17631, 1060, 1768, 16, 203, 5411, 4078, 5741, 2584, 2173, 9535, 30, 374, 16, 203, 5411, 443, 1724, 14667, 30573, 30, 389, 323, 1724, 14667, 30573, 16, 203, 5411, 943, 758, 1724, 6275, 30, 389, 1896, 758, 1724, 6275, 16, 203, 5411, 783, 758, 1724, 6275, 30, 374, 203, 3639, 289, 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 ]
./full_match/1/0x2c75A27616117C680AD289590D278C8294fCFE9e/sources/contracts/PolygonZkEVMTimelock.sol
* @dev Contract module which acts as a timelocked controller. This gives time for users of the controlled contract to exit before a potentially dangerous maintenance operation is applied. If emergency mode of the zkevm contract system is active, this timelock have no delay./ Polygon ZK-EVM address. Will be used to check if it's on emergency state.
contract PolygonZkEVMTimelock is TimelockController { PolygonZkEVM public immutable polygonZkEVM; constructor( uint256 minDelay, address[] memory proposers, address[] memory executors, address admin, PolygonZkEVM _polygonZkEVM pragma solidity 0.8.17; ) TimelockController(minDelay, proposers, executors, admin) { polygonZkEVM = _polygonZkEVM; } function getMinDelay() public view override returns (uint256 duration) { if (polygonZkEVM.isEmergencyState()) { return 0; return super.getMinDelay(); } } function getMinDelay() public view override returns (uint256 duration) { if (polygonZkEVM.isEmergencyState()) { return 0; return super.getMinDelay(); } } } else { }
4,995,657
[ 1, 8924, 1605, 1492, 22668, 487, 279, 1658, 292, 975, 329, 2596, 18, 1220, 14758, 813, 364, 3677, 434, 326, 25934, 6835, 358, 2427, 1865, 279, 13935, 27308, 1481, 18388, 1674, 353, 6754, 18, 971, 801, 24530, 1965, 434, 326, 998, 4491, 3489, 6835, 2619, 353, 2695, 16, 333, 1658, 292, 975, 1240, 1158, 4624, 18, 19, 12681, 29878, 17, 41, 7397, 1758, 18, 9980, 506, 1399, 358, 866, 309, 518, 1807, 603, 801, 24530, 919, 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 ]
[ 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, 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, 12681, 62, 79, 24427, 6152, 381, 292, 975, 353, 12652, 292, 975, 2933, 288, 203, 565, 12681, 62, 79, 41, 7397, 1071, 11732, 7154, 62, 79, 41, 7397, 31, 203, 203, 565, 3885, 12, 203, 3639, 2254, 5034, 1131, 6763, 16, 203, 3639, 1758, 8526, 3778, 450, 917, 414, 16, 203, 3639, 1758, 8526, 3778, 1196, 13595, 16, 203, 3639, 1758, 3981, 16, 203, 3639, 12681, 62, 79, 41, 7397, 389, 20917, 62, 79, 41, 7397, 203, 683, 9454, 18035, 560, 374, 18, 28, 18, 4033, 31, 203, 565, 262, 12652, 292, 975, 2933, 12, 1154, 6763, 16, 450, 917, 414, 16, 1196, 13595, 16, 3981, 13, 288, 203, 3639, 7154, 62, 79, 41, 7397, 273, 389, 20917, 62, 79, 41, 7397, 31, 203, 565, 289, 203, 203, 565, 445, 9555, 6763, 1435, 1071, 1476, 3849, 1135, 261, 11890, 5034, 3734, 13, 288, 203, 3639, 309, 261, 20917, 62, 79, 41, 7397, 18, 291, 1514, 24530, 1119, 10756, 288, 203, 5411, 327, 374, 31, 203, 5411, 327, 2240, 18, 588, 2930, 6763, 5621, 203, 3639, 289, 203, 565, 289, 203, 565, 445, 9555, 6763, 1435, 1071, 1476, 3849, 1135, 261, 11890, 5034, 3734, 13, 288, 203, 3639, 309, 261, 20917, 62, 79, 41, 7397, 18, 291, 1514, 24530, 1119, 10756, 288, 203, 5411, 327, 374, 31, 203, 5411, 327, 2240, 18, 588, 2930, 6763, 5621, 203, 3639, 289, 203, 565, 289, 203, 3639, 289, 469, 288, 203, 97, 203, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
pragma solidity ^0.4.19; /** * @title SafeMath * @dev Math operations with safety checks that throw on error * @dev Based on: OpenZeppelin */ 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 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 Ownable * @dev Contract provides ownership control * @dev Based on: OpenZeppelin */ 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 ERC20Basic * @dev Basic ERC20 interface * @dev Based on: OpenZeppelin */ 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); } /** * @title Full ERC20 interface * @dev Based on: OpenZeppelin */ 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. * @dev Based on: OpenZeppelin */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 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(_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 Based on: OpenZeppelin */ 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. * @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]; } /** * @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, 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; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ 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 GoldenGate * @dev Implementation of the GoldenGate token. */ contract GoldenGate is StandardToken, Ownable { string public name = 'GoldenGate'; string public symbol = 'GGT'; uint public decimals = 18; uint public INITIAL_SUPPLY = 0; // we're starting off with zero initial supply and will 'mint' as needed // The following were created as arrays instead of mappings since the dapp requires access to all elements (a mapping doesn't allow access to its keys). Extra iteration gas costs are negligible due to the fact that delegates are usually very limited in number. address[] mintDelegates; // accounts allowed to mint tokens address[] burnDelegates; // accounts allowed to burn tokens // Events event Mint(address indexed to, uint256 amount); event Burn(address indexed burner, uint256 value); event ApproveMintDelegate(address indexed mintDelegate); event RevokeMintDelegate(address indexed mintDelegate); event ApproveBurnDelegate(address indexed burnDelegate); event RevokeBurnDelegate(address indexed burnDelegate); // Constructor function GoldenGate () public { totalSupply_ = INITIAL_SUPPLY; } /** * @dev Throws if called by any account other than an owner or a mint delegate. */ modifier onlyOwnerOrMintDelegate() { bool allowedToMint = false; if(msg.sender==owner) { allowedToMint = true; } else { for(uint i=0; i<mintDelegates.length; i++) { if(mintDelegates[i]==msg.sender) { allowedToMint = true; break; } } } require(allowedToMint==true); _; } /** * @dev Throws if called by any account other than an owner or a burn delegate. */ modifier onlyOwnerOrBurnDelegate() { bool allowedToBurn = false; if(msg.sender==owner) { allowedToBurn = true; } else { for(uint i=0; i<burnDelegates.length; i++) { if(burnDelegates[i]==msg.sender) { allowedToBurn = true; break; } } } require(allowedToBurn==true); _; } /** * @dev Return the array of mint delegates. */ function getMintDelegates() public view returns (address[]) { return mintDelegates; } /** * @dev Return the array of burn delegates. */ function getBurnDelegates() public view returns (address[]) { return burnDelegates; } /** * @dev Give a mint delegate permission to mint tokens. * @param _mintDelegate The account to be approved. */ function approveMintDelegate(address _mintDelegate) onlyOwner public returns (bool) { bool delegateFound = false; for(uint i=0; i<mintDelegates.length; i++) { if(mintDelegates[i]==_mintDelegate) { delegateFound = true; break; } } if(!delegateFound) { mintDelegates.push(_mintDelegate); } ApproveMintDelegate(_mintDelegate); return true; } /** * @dev Revoke permission to mint tokens from a mint delegate. * @param _mintDelegate The account to be revoked. */ function revokeMintDelegate(address _mintDelegate) onlyOwner public returns (bool) { uint length = mintDelegates.length; require(length > 0); address lastDelegate = mintDelegates[length-1]; if(_mintDelegate == lastDelegate) { delete mintDelegates[length-1]; mintDelegates.length--; } else { // Game plan: find the delegate, replace it with the very last item in the array, then delete the last item for(uint i=0; i<length; i++) { if(mintDelegates[i]==_mintDelegate) { mintDelegates[i] = lastDelegate; delete mintDelegates[length-1]; mintDelegates.length--; break; } } } RevokeMintDelegate(_mintDelegate); return true; } /** * @dev Give a burn delegate permission to burn tokens. * @param _burnDelegate The account to be approved. */ function approveBurnDelegate(address _burnDelegate) onlyOwner public returns (bool) { bool delegateFound = false; for(uint i=0; i<burnDelegates.length; i++) { if(burnDelegates[i]==_burnDelegate) { delegateFound = true; break; } } if(!delegateFound) { burnDelegates.push(_burnDelegate); } ApproveBurnDelegate(_burnDelegate); return true; } /** * @dev Revoke permission to burn tokens from a burn delegate. * @param _burnDelegate The account to be revoked. */ function revokeBurnDelegate(address _burnDelegate) onlyOwner public returns (bool) { uint length = burnDelegates.length; require(length > 0); address lastDelegate = burnDelegates[length-1]; if(_burnDelegate == lastDelegate) { delete burnDelegates[length-1]; burnDelegates.length--; } else { // Game plan: find the delegate, replace it with the very last item in the array, then delete the last item for(uint i=0; i<length; i++) { if(burnDelegates[i]==_burnDelegate) { burnDelegates[i] = lastDelegate; delete burnDelegates[length-1]; burnDelegates.length--; break; } } } RevokeBurnDelegate(_burnDelegate); return true; } /** * @dev Function to mint tokens and transfer them to contract owner's address * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ function mint(uint256 _amount) onlyOwnerOrMintDelegate public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[msg.sender] = balances[msg.sender].add(_amount); // Call events Mint(msg.sender, _amount); Transfer(address(0), msg.sender, _amount); return true; } /** * @dev Function to burn tokens * @param _value The amount of tokens to be burned. * @return A boolean that indicates if the operation was successful. */ function burn(uint256 _value) onlyOwnerOrBurnDelegate public returns (bool) { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply_ = totalSupply_.sub(_value); // Call events Burn(burner, _value); Transfer(burner, address(0), _value); return true; } }
* @dev Throws if called by any account other than an owner or a mint delegate./
modifier onlyOwnerOrMintDelegate() { bool allowedToMint = false; if(msg.sender==owner) { allowedToMint = true; } else { for(uint i=0; i<mintDelegates.length; i++) { if(mintDelegates[i]==msg.sender) { allowedToMint = true; break; } } } require(allowedToMint==true); _; }
290,945
[ 1, 21845, 309, 2566, 635, 1281, 2236, 1308, 2353, 392, 3410, 578, 279, 312, 474, 7152, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 9606, 1338, 5541, 1162, 49, 474, 9586, 1435, 288, 203, 565, 1426, 2935, 774, 49, 474, 273, 629, 31, 203, 203, 565, 309, 12, 3576, 18, 15330, 631, 8443, 13, 288, 203, 1377, 2935, 774, 49, 474, 273, 638, 31, 203, 565, 289, 203, 565, 469, 288, 203, 1377, 364, 12, 11890, 277, 33, 20, 31, 277, 32, 81, 474, 15608, 815, 18, 2469, 31, 277, 27245, 288, 203, 3639, 309, 12, 81, 474, 15608, 815, 63, 77, 65, 631, 3576, 18, 15330, 13, 288, 203, 1850, 2935, 774, 49, 474, 273, 638, 31, 203, 1850, 898, 31, 203, 3639, 289, 203, 1377, 289, 203, 565, 289, 203, 203, 565, 2583, 12, 8151, 774, 49, 474, 631, 3767, 1769, 203, 565, 389, 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 ]
//Address: 0x25b16c95f3ebb1d8583a1c173f81257bc916a9be //Contract name: SignalsCrowdsale //Balance: 0 Ether //Verification Date: 3/12/2018 //Transacion Count: 1706 // CODE STARTS HERE pragma solidity ^0.4.20; /** * @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; } } /** * @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() { 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 public { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } } /** * @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) constant returns (uint256); function transfer(address to, uint256 value) 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) constant returns (uint256); function transferFrom(address from, address to, uint256 value) returns (bool); function approve(address spender, uint256 value) 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) 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) returns (bool) { 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) 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)) 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 constant returns (uint256 remaining) { 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 success) { 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 success) { 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 Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { require(!paused); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(paused); _; } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { paused = true; Pause(); } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { paused = false; Unpause(); } } /** * @title Pausable token * * @dev StandardToken modified with pausable transfers. **/ contract PausableToken is StandardToken, Pausable { 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 increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) { return super.increaseApproval(_spender, _addedValue); } function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) { return super.decreaseApproval(_spender, _subtractedValue); } } /** * @title Mintable token * @dev Simple ERC20 Token example, with mintable token creation * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120 * 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); _; } /** * @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(0x0, _to, _amount); return true; } /** * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ function finishMinting() onlyOwner public returns (bool) { mintingFinished = true; MintFinished(); return true; } } /* * Company reserve pool where the tokens will be locked for two years * @title Company token reserve */ contract AdviserTimeLock is Ownable{ SignalsToken token; uint256 withdrawn; uint start; event TokensWithdrawn(address owner, uint amount); /* * Constructor changing owner to owner multisig & setting time lock * @param address of the Signals Token contract * @param address of the owner multisig */ function AdviserTimeLock(address _token, address _owner) public{ token = SignalsToken(_token); owner = _owner; start = now; } /* * Only function for periodical tokens withdrawal (with monthly allowance) * @dev Will withdraw the whole allowance; */ function withdraw() onlyOwner public { require(now - start >= 25920000); uint toWithdraw = canWithdraw(); token.transfer(owner, toWithdraw); withdrawn += toWithdraw; TokensWithdrawn(owner, toWithdraw); } /* * Only function for the tokens withdrawal (with two years time lock) * @dev Based on division down rounding */ function canWithdraw() public view returns (uint256) { uint256 sinceStart = now - start; uint256 allowed = (sinceStart/2592000)*504546000000000; uint256 toWithdraw; if (allowed > token.balanceOf(address(this))) { toWithdraw = token.balanceOf(address(this)); } else { toWithdraw = allowed - withdrawn; } return toWithdraw; } /* * Function to clean up the state and moved not allocated tokens to custody */ function cleanUp() onlyOwner public { require(token.balanceOf(address(this)) == 0); selfdestruct(owner); } } /* * Pre-allocation pool for company advisers * @title Advisory pool */ contract AdvisoryPool is Ownable{ SignalsToken token; /* * @dev constant addresses of all advisers */ address constant ADVISER1 = 0x7915D5A865FE68C63112be5aD3DCA5187EB08f24; address constant ADVISER2 = 0x31cFF39AA68B91fa7C957272A6aA8fB8F7b69Cb0; address constant ADVISER3 = 0x358b3aeec9fae5ab15fe28d2fe6c7c9fda596857; address constant ADVISER4 = 0x1011FC646261eb5d4aB875886f1470d4919d83c8; address constant ADVISER5 = 0xcc04Cd98da89A9172372aEf4B62BEDecd01A7F5a; address constant ADVISER6 = 0xECD791f8E548D46A9711D853Ead7edC685Ca4ee8; address constant ADVISER7 = 0x38B58e5783fd4D077e422B3362E9d6B265484e3f; address constant ADVISER8 = 0x2934205135A129F995AC891C143cCae83ce175c7; address constant ADVISER9 = 0x9F5D00F4A383bAd14DEfA9aee53C5AF2ad9ad32F; address constant ADVISER10 = 0xBE993c982Fc5a0C0360CEbcEf9e4d2727339d96B; address constant ADVISER11 = 0xdf1E2126eB638335eFAb91a834db4c57Cbe18735; address constant ADVISER12 = 0x8A404969Ad1BCD3F566A7796722f535eD9cA22b2; address constant ADVISER13 = 0x066a8aD6fA94AC83e1AFB5Aa7Dc62eD1D2654bB2; address constant ADVISER14 = 0xA1425Fa987d1b724306d93084b93D62F37482c4b; address constant ADVISER15 = 0x4633515904eE5Bc18bEB70277455525e84a51e90; address constant ADVISER16 = 0x230783Afd438313033b07D39E3B9bBDBC7817759; address constant ADVISER17 = 0xe8b9b07c1cca9aE9739Cec3D53004523Ab206CAc; address constant ADVISER18 = 0x0E73f16CfE7F545C0e4bB63A9Eef18De8d7B422d; address constant ADVISER19 = 0x6B4c6B603ca72FE7dde971CF833a58415737826D; address constant ADVISER20 = 0x823D3123254a3F9f9d3759FE3Fd7d15e21a3C5d8; address constant ADVISER21 = 0x0E48bbc496Ae61bb790Fc400D1F1a57520f772Df; address constant ADVISER22 = 0x06Ee8eCc0145CcaCEc829490e3c557f577BE0e85; address constant ADVISER23 = 0xbE56bFF75A1cB085674Cc37a5C8746fF6C43C442; address constant ADVISER24 = 0xb442b5297E4aEf19E489530E69dFef7fae27F4A5; address constant ADVISER25 = 0x50EF1d6a7435C7FB3dB7c204b74EB719b1EE3dab; address constant ADVISER26 = 0x3e9fed606822D5071f8a28d2c8B51E6964160CB2; AdviserTimeLock public tokenLocker23; /* * Constructor changing owner to owner multisig & calling the allocation * @param address of the Signals Token contract * @param address of the owner multisig */ function AdvisoryPool(address _token, address _owner) public { owner = _owner; token = SignalsToken(_token); } /* * Allocation function, tokens get allocated from this contract as current token owner * @dev only accessible from the constructor */ function initiate() public onlyOwner { require(token.balanceOf(address(this)) == 18500000000000000); tokenLocker23 = new AdviserTimeLock(address(token), ADVISER23); token.transfer(ADVISER1, 380952380000000); token.transfer(ADVISER2, 380952380000000); token.transfer(ADVISER3, 659200000000000); token.transfer(ADVISER4, 95238100000000); token.transfer(ADVISER5, 1850000000000000); token.transfer(ADVISER6, 15384620000000); token.transfer(ADVISER7, 62366450000000); token.transfer(ADVISER8, 116805560000000); token.transfer(ADVISER9, 153846150000000); token.transfer(ADVISER10, 10683760000000); token.transfer(ADVISER11, 114285710000000); token.transfer(ADVISER12, 576923080000000); token.transfer(ADVISER13, 76190480000000); token.transfer(ADVISER14, 133547010000000); token.transfer(ADVISER15, 96153850000000); token.transfer(ADVISER16, 462500000000000); token.transfer(ADVISER17, 462500000000000); token.transfer(ADVISER18, 399865380000000); token.transfer(ADVISER19, 20032050000000); token.transfer(ADVISER20, 35559130000000); token.transfer(ADVISER21, 113134000000000); token.transfer(ADVISER22, 113134000000000); token.transfer(address(tokenLocker23), 5550000000000000); token.transfer(ADVISER23, 1850000000000000); token.transfer(ADVISER24, 100000000000000); token.transfer(ADVISER25, 100000000000000); token.transfer(ADVISER26, 2747253000000000); } /* * Clean up function for token loss prevention and cleaning up Ethereum blockchain * @dev call to clean up the contract */ function cleanUp() onlyOwner public { uint256 notAllocated = token.balanceOf(address(this)); token.transfer(owner, notAllocated); selfdestruct(owner); } } /* * Pre-allocation pool for the community, will be govern by a company multisig * @title Community pool */ contract CommunityPool is Ownable{ SignalsToken token; event CommunityTokensAllocated(address indexed member, uint amount); /* * Constructor changing owner to owner multisig * @param address of the Signals Token contract * @param address of the owner multisig */ function CommunityPool(address _token, address _owner) public{ token = SignalsToken(_token); owner = _owner; } /* * Function to alloc tokens to a community member * @param address of community member * @param uint amount units of tokens to be given away */ function allocToMember(address member, uint amount) public onlyOwner { require(amount > 0); token.transfer(member, amount); CommunityTokensAllocated(member, amount); } /* * Clean up function * @dev call to clean up the contract after all tokens were assigned */ function clean() public onlyOwner { require(token.balanceOf(address(this)) == 0); selfdestruct(owner); } } /* * Company reserve pool where the tokens will be locked for two years * @title Company token reserve */ contract CompanyReserve is Ownable{ SignalsToken token; uint256 withdrawn; uint start; /* * Constructor changing owner to owner multisig & setting time lock * @param address of the Signals Token contract * @param address of the owner multisig */ function CompanyReserve(address _token, address _owner) public { token = SignalsToken(_token); owner = _owner; start = now; } event TokensWithdrawn(address owner, uint amount); /* * Only function for the tokens withdrawal (3% anytime, 5% after one year, 10% after two year) * @dev Will withdraw the whole allowance; */ function withdraw() onlyOwner public { require(now - start >= 25920000); uint256 toWithdraw = canWithdraw(); withdrawn += toWithdraw; token.transfer(owner, toWithdraw); TokensWithdrawn(owner, toWithdraw); } /* * Checker function to find out how many tokens can be withdrawn. * note: percentage of the token.totalSupply * @dev Based on division down rounding */ function canWithdraw() public view returns (uint256) { uint256 sinceStart = now - start; uint256 allowed; if (sinceStart >= 0) { allowed = 555000000000000; } else if (sinceStart >= 31536000) { // one year difference allowed = 1480000000000000; } else if (sinceStart >= 63072000) { // two years difference allowed = 3330000000000000; } else { return 0; } return allowed - withdrawn; } /* * Function to clean up the state and moved not allocated tokens to custody */ function cleanUp() onlyOwner public { require(token.balanceOf(address(this)) == 0); selfdestruct(owner); } } /** * @title Signals token * @dev Mintable token created for Signals.Network */ contract PresaleToken is PausableToken, MintableToken { // Standard token variables string constant public name = "SGNPresaleToken"; string constant public symbol = "SGN"; uint8 constant public decimals = 9; event TokensBurned(address initiatior, address indexed _partner, uint256 _tokens); /* * Constructor which pauses the token at the time of creation */ function PresaleToken() public { pause(); } /* * @dev Token burn function to be called at the time of token swap * @param _partner address to use for token balance buring * @param _tokens uint256 amount of tokens to burn */ function burnTokens(address _partner, uint256 _tokens) public onlyOwner { require(balances[_partner] >= _tokens); balances[_partner] -= _tokens; totalSupply -= _tokens; TokensBurned(msg.sender, _partner, _tokens); } } /** * @title Signals token * @dev Mintable token created for Signals.Network */ contract SignalsToken is PausableToken, MintableToken { // Standard token variables string constant public name = "Signals Network Token"; string constant public symbol = "SGN"; uint8 constant public decimals = 9; } contract PrivateRegister is Ownable { struct contribution { bool approved; uint8 extra; } mapping (address => contribution) verified; event ApprovedInvestor(address indexed investor); event BonusesRegistered(address indexed investor, uint8 extra); /* * Approve function to adjust allowance to investment of each individual investor * @param _investor address sets the beneficiary for later use * @param _referral address to pay a commission in token to * @param _commission uint8 expressed as a number between 0 and 5 */ function approve(address _investor, uint8 _extra) onlyOwner public{ require(!isContract(_investor)); verified[_investor].approved = true; if (_extra <= 100) { verified[_investor].extra = _extra; BonusesRegistered(_investor, _extra); } ApprovedInvestor(_investor); } /* * Constant call to find out if an investor is registered * @param _investor address to be checked * @return bool is true is _investor was approved */ function approved(address _investor) view public returns (bool) { return verified[_investor].approved; } /* * Constant call to find out the referral and commission to bound to an investor * @param _investor address to be checked * @return address of the referral, returns 0x0 if there is none * @return uint8 commission to be paid out on any investment */ function getBonuses(address _investor) view public returns (uint8 extra) { return verified[_investor].extra; } /* * Check if address is a contract to prevent contracts from participating the direct sale. * @param addr address to be checked * @return boolean of it is or isn't an contract address * @credits Manuel Aráoz */ function isContract(address addr) public view returns (bool) { uint size; assembly { size := extcodesize(addr) } return size > 0; } } contract CrowdsaleRegister is Ownable { struct contribution { bool approved; uint8 commission; uint8 extra; } mapping (address => contribution) verified; event ApprovedInvestor(address indexed investor); event BonusesRegistered(address indexed investor, uint8 commission, uint8 extra); /* * Approve function to adjust allowance to investment of each individual investor * @param _investor address sets the beneficiary for later use * @param _referral address to pay a commission in token to * @param _commission uint8 expressed as a number between 0 and 5 */ function approve(address _investor, uint8 _commission, uint8 _extra) onlyOwner public{ require(!isContract(_investor)); verified[_investor].approved = true; if (_commission <= 15 && _extra <= 5) { verified[_investor].commission = _commission; verified[_investor].extra = _extra; BonusesRegistered(_investor, _commission, _extra); } ApprovedInvestor(_investor); } /* * Constant call to find out if an investor is registered * @param _investor address to be checked * @return bool is true is _investor was approved */ function approved(address _investor) view public returns (bool) { return verified[_investor].approved; } /* * Constant call to find out the referral and commission to bound to an investor * @param _investor address to be checked * @return address of the referral, returns 0x0 if there is none * @return uint8 commission to be paid out on any investment */ function getBonuses(address _investor) view public returns (uint8 commission, uint8 extra) { return (verified[_investor].commission, verified[_investor].extra); } /* * Check if address is a contract to prevent contracts from participating the direct sale. * @param addr address to be checked * @return boolean of it is or isn't an contract address * @credits Manuel Aráoz */ function isContract(address addr) public view returns (bool) { uint size; assembly { size := extcodesize(addr) } return size > 0; } } /* * Token pool for the presale tokens swap * @title PresalePool * @dev Requires to transfer ownership of both PresaleToken contracts to this contract */ contract PresalePool is Ownable { PresaleToken public PublicPresale; PresaleToken public PartnerPresale; SignalsToken token; CrowdsaleRegister registry; /* * Compensation coefficient based on the difference between the max ETHUSD price during the presale * and price fix for mainsale */ uint256 compensation1; uint256 compensation2; // Date after which all tokens left will be transfered to the company reserve uint256 deadLine; event SupporterResolved(address indexed supporter, uint256 burned, uint256 created); event PartnerResolved(address indexed partner, uint256 burned, uint256 created); /* * Constructor changing owner to owner multisig, setting all the contract addresses & compensation rates * @param address of the Signals Token contract * @param address of the KYC registry * @param address of the owner multisig * @param uint rate of the compensation for early investors * @param uint rate of the compensation for partners */ function PresalePool(address _token, address _registry, address _owner, uint comp1, uint comp2) public { owner = _owner; PublicPresale = PresaleToken(0x15fEcCA27add3D28C55ff5b01644ae46edF15821); PartnerPresale = PresaleToken(0xa70435D1a3AD4149B0C13371E537a22002Ae530d); token = SignalsToken(_token); registry = CrowdsaleRegister(_registry); compensation1 = comp1; compensation2 = comp2; deadLine = now + 30 days; } /* * Fallback function for simple contract usage, only calls the swap() * @dev left for simpler interaction */ function() public { swap(); } /* * Function swapping the presale tokens for the Signal tokens regardless on the presale pool * @dev requires having ownership of the two presale contracts * @dev requires the calling party to finish the KYC process fully */ function swap() public { require(registry.approved(msg.sender)); uint256 oldBalance; uint256 newBalance; if (PublicPresale.balanceOf(msg.sender) > 0) { oldBalance = PublicPresale.balanceOf(msg.sender); newBalance = oldBalance * compensation1 / 100; PublicPresale.burnTokens(msg.sender, oldBalance); token.transfer(msg.sender, newBalance); SupporterResolved(msg.sender, oldBalance, newBalance); } if (PartnerPresale.balanceOf(msg.sender) > 0) { oldBalance = PartnerPresale.balanceOf(msg.sender); newBalance = oldBalance * compensation2 / 100; PartnerPresale.burnTokens(msg.sender, oldBalance); token.transfer(msg.sender, newBalance); PartnerResolved(msg.sender, oldBalance, newBalance); } } /* * Function swapping the presale tokens for the Signal tokens regardless on the presale pool * @dev initiated from Signals (passing the ownership to a oracle to handle a script is recommended) * @dev requires having ownership of the two presale contracts * @dev requires the calling party to finish the KYC process fully */ function swapFor(address whom) onlyOwner public returns(bool) { require(registry.approved(whom)); uint256 oldBalance; uint256 newBalance; if (PublicPresale.balanceOf(whom) > 0) { oldBalance = PublicPresale.balanceOf(whom); newBalance = oldBalance * compensation1 / 100; PublicPresale.burnTokens(whom, oldBalance); token.transfer(whom, newBalance); SupporterResolved(whom, oldBalance, newBalance); } if (PartnerPresale.balanceOf(whom) > 0) { oldBalance = PartnerPresale.balanceOf(whom); newBalance = oldBalance * compensation2 / 100; PartnerPresale.burnTokens(whom, oldBalance); token.transfer(whom, newBalance); SupporterResolved(whom, oldBalance, newBalance); } return true; } /* * Function to clean up the state and moved not allocated tokens to custody */ function clean() onlyOwner public { require(now >= deadLine); uint256 notAllocated = token.balanceOf(address(this)); token.transfer(owner, notAllocated); selfdestruct(owner); } } /** * @title Crowdsale * @dev Crowdsale is a base contract for managing a token crowdsale. * Crowdsales have a start and end timestamps, where investors can make * token purchases and the crowdsale will assign them tokens based * on a token per ETH rate. Funds collected are forwarded to a wallet * as they arrive. */ contract Crowdsale { using SafeMath for uint256; // The token being sold SignalsToken public token; // address where funds are collected address public wallet; // amount of raised money in wei uint256 public weiRaised; // start/end related uint256 public startTime; bool public hasEnded; /** * 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); function Crowdsale(address _token, address _wallet) public { require(_wallet != 0x0); token = SignalsToken(_token); wallet = _wallet; } // fallback function can be used to buy tokens function () public payable { buyTokens(msg.sender); } // low level token purchase function function buyTokens(address beneficiary) private {} // send ether to the fund collection wallet // override to create custom fund forwarding mechanisms function forwardFunds() internal { wallet.transfer(msg.value); } // @return true if the transaction can buy tokens function validPurchase() internal constant returns (bool) {} } /** * @title FinalizableCrowdsale * @dev Extension of Crowdsale where an owner can do extra work * after finishing. */ contract FinalizableCrowdsale is Crowdsale, Ownable { using SafeMath for uint256; bool public isFinalized = false; event Finalized(); /** * @dev Must be called after crowdsale ends, to do some extra finalization * work. Calls the contract's finalization function. */ function finalize() onlyOwner public { require(!isFinalized); require(hasEnded); finalization(); Finalized(); isFinalized = true; } /** * @dev Can be overridden to add finalization logic. The overriding function * should call super.finalization() to ensure the chain of finalization is * executed entirely. */ function finalization() internal { } } contract SignalsCrowdsale is FinalizableCrowdsale { // Cap & price related values uint256 public constant HARD_CAP = 18000*(10**18); uint256 public toBeRaised = 18000*(10**18); uint256 public constant PRICE = 360000; uint256 public tokensSold; uint256 public constant maxTokens = 185000000*(10**9); // Allocation constants uint constant ADVISORY_SHARE = 18500000*(10**9); //FIXED uint constant BOUNTY_SHARE = 3700000*(10**9); // FIXED uint constant COMMUNITY_SHARE = 37000000*(10**9); //FIXED uint constant COMPANY_SHARE = 33300000*(10**9); //FIXED uint constant PRESALE_SHARE = 7856217611546440; // FIXED; // Address pointers address constant ADVISORS = 0x98280b2FD517a57a0B8B01b674457Eb7C6efa842; // TODO: change address constant BOUNTY = 0x8726D7ac344A0BaBFd16394504e1cb978c70479A; // TODO: change address constant COMMUNITY = 0x90CDbC88aB47c432Bd47185b9B0FDA1600c22102; // TODO: change address constant COMPANY = 0xC010b2f2364372205055a299B28ef934f090FE92; // TODO: change address constant PRESALE = 0x7F3a38fa282B16973feDD1E227210Ec020F2481e; // TODO: change CrowdsaleRegister register; PrivateRegister register2; // Start & End related vars bool public ready; // Events event SaleWillStart(uint256 time); event SaleReady(); event SaleEnds(uint256 tokensLeft); function SignalsCrowdsale(address _token, address _wallet, address _register, address _register2) public FinalizableCrowdsale() Crowdsale(_token, _wallet) { register = CrowdsaleRegister(_register); register2 = PrivateRegister(_register2); } // @return true if the transaction can buy tokens function validPurchase() internal constant returns (bool) { bool started = (startTime <= now); bool nonZeroPurchase = msg.value != 0; bool capNotReached = (weiRaised < HARD_CAP); bool approved = register.approved(msg.sender); bool approved2 = register2.approved(msg.sender); return ready && started && !hasEnded && nonZeroPurchase && capNotReached && (approved || approved2); } /* * Buy in function to be called from the fallback function * @param beneficiary address */ function buyTokens(address beneficiary) private { require(beneficiary != 0x0); require(validPurchase()); uint256 weiAmount = msg.value; // base discount uint256 discount = ((toBeRaised*10000)/HARD_CAP)*15; // calculate token amount to be created uint256 tokens; // update state weiRaised = weiRaised.add(weiAmount); toBeRaised = toBeRaised.sub(weiAmount); uint commission; uint extra; uint premium; if (register.approved(beneficiary)) { (commission, extra) = register.getBonuses(beneficiary); // If extra access granted then give additional % if (extra > 0) { discount += extra*10000; } tokens = howMany(msg.value, discount); // If referral was involved, give some percent to the source if (commission > 0) { premium = tokens.mul(commission).div(100); token.mint(BOUNTY, premium); } } else { extra = register2.getBonuses(beneficiary); if (extra > 0) { discount = extra*10000; tokens = howMany(msg.value, discount); } } token.mint(beneficiary, tokens); TokenPurchase(msg.sender, beneficiary, weiAmount, tokens); tokensSold += tokens + premium; forwardFunds(); assert(token.totalSupply() <= maxTokens); } /* * Helper token emission functions * @param value uint256 of the wei amount that gets invested * @return uint256 of how many tokens can one get */ function howMany(uint256 value, uint256 discount) public view returns (uint256){ uint256 actualPrice = PRICE * (1000000 - discount) / 1000000; return value / actualPrice; } /* * Function to do preallocations - MANDATORY to continue * @dev It's separated so it doesn't have to run in constructor */ function initialize() public onlyOwner { require(!ready); // Pre-allocation to pools token.mint(ADVISORS,ADVISORY_SHARE); token.mint(BOUNTY,BOUNTY_SHARE); token.mint(COMMUNITY,COMMUNITY_SHARE); token.mint(COMPANY,COMPANY_SHARE); token.mint(PRESALE,PRESALE_SHARE); tokensSold = PRESALE_SHARE; ready = true; SaleReady(); } /* * Function to do set or adjust the startTime - NOT MANDATORY but good for future start */ function changeStart(uint256 _time) public onlyOwner { startTime = _time; SaleWillStart(_time); } /* * Function end or pause the sale * @dev It's MANDATORY to finalize() */ function endSale(bool end) public onlyOwner { require(startTime <= now); uint256 tokensLeft = maxTokens - token.totalSupply(); if (tokensLeft > 0) { token.mint(wallet, tokensLeft); } hasEnded = end; SaleEnds(tokensLeft); } /* * Adjust finalization to transfer token ownership to the fund holding address for further use */ function finalization() internal { token.finishMinting(); token.transferOwnership(wallet); } /* * Clean up function to get the contract selfdestructed - OPTIONAL */ function cleanUp() public onlyOwner { require(isFinalized); selfdestruct(owner); } }
Allocation function, tokens get allocated from this contract as current token owner @dev only accessible from the constructor/
function initiate() public onlyOwner { require(token.balanceOf(address(this)) == 18500000000000000); tokenLocker23 = new AdviserTimeLock(address(token), ADVISER23); token.transfer(ADVISER1, 380952380000000); token.transfer(ADVISER2, 380952380000000); token.transfer(ADVISER3, 659200000000000); token.transfer(ADVISER4, 95238100000000); token.transfer(ADVISER5, 1850000000000000); token.transfer(ADVISER6, 15384620000000); token.transfer(ADVISER7, 62366450000000); token.transfer(ADVISER8, 116805560000000); token.transfer(ADVISER9, 153846150000000); token.transfer(ADVISER10, 10683760000000); token.transfer(ADVISER11, 114285710000000); token.transfer(ADVISER12, 576923080000000); token.transfer(ADVISER13, 76190480000000); token.transfer(ADVISER14, 133547010000000); token.transfer(ADVISER15, 96153850000000); token.transfer(ADVISER16, 462500000000000); token.transfer(ADVISER17, 462500000000000); token.transfer(ADVISER18, 399865380000000); token.transfer(ADVISER19, 20032050000000); token.transfer(ADVISER20, 35559130000000); token.transfer(ADVISER21, 113134000000000); token.transfer(ADVISER22, 113134000000000); token.transfer(address(tokenLocker23), 5550000000000000); token.transfer(ADVISER23, 1850000000000000); token.transfer(ADVISER24, 100000000000000); token.transfer(ADVISER25, 100000000000000); token.transfer(ADVISER26, 2747253000000000); }
14,091,116
[ 1, 17353, 445, 16, 2430, 336, 11977, 628, 333, 6835, 487, 783, 1147, 3410, 225, 1338, 12718, 628, 326, 3885, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 18711, 1435, 1071, 1338, 5541, 288, 203, 3639, 2583, 12, 2316, 18, 12296, 951, 12, 2867, 12, 2211, 3719, 422, 6549, 25, 12648, 9449, 1769, 203, 3639, 1147, 2531, 264, 4366, 273, 394, 4052, 3516, 264, 950, 2531, 12, 2867, 12, 2316, 3631, 11738, 4136, 2123, 4366, 1769, 203, 203, 3639, 1147, 18, 13866, 12, 1880, 4136, 2123, 21, 16, 890, 3672, 8778, 4366, 28, 17877, 1769, 203, 3639, 1147, 18, 13866, 12, 1880, 4136, 2123, 22, 16, 890, 3672, 8778, 4366, 28, 17877, 1769, 203, 3639, 1147, 18, 13866, 12, 1880, 4136, 2123, 23, 16, 1666, 6162, 22, 12648, 3784, 1769, 203, 3639, 1147, 18, 13866, 12, 1880, 4136, 2123, 24, 16, 16848, 4366, 11861, 12648, 1769, 203, 3639, 1147, 18, 13866, 12, 1880, 4136, 2123, 25, 16, 6549, 25, 12648, 11706, 1769, 203, 3639, 1147, 18, 13866, 12, 1880, 4136, 2123, 26, 16, 4711, 17295, 8898, 17877, 1769, 203, 3639, 1147, 18, 13866, 12, 1880, 4136, 2123, 27, 16, 1666, 29941, 1105, 25, 17877, 1769, 203, 3639, 1147, 18, 13866, 12, 1880, 4136, 2123, 28, 16, 18973, 3672, 2539, 26, 17877, 1769, 203, 3639, 1147, 18, 13866, 12, 1880, 4136, 2123, 29, 16, 4711, 17295, 26, 3600, 17877, 1769, 203, 3639, 1147, 18, 13866, 12, 1880, 4136, 2123, 2163, 16, 1728, 9470, 6418, 26, 17877, 1769, 203, 3639, 1147, 18, 13866, 12, 1880, 4136, 2123, 2499, 16, 21284, 6030, 10321, 21, 17877, 1769, 203, 3639, 1147, 18, 13866, 12, 1880, 4136, 2123, 2138, 16, 1381, 6669, 29, 4366, 6840, 17877, 2 ]
pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; import { ECDSA } from "./ECDSA.sol"; import { EthereumRuntime } from "./EthereumRuntime.sol"; contract ComputationVerifier { using ECDSA for bytes32; uint256 constant MIN_BOND = 1 ether; uint256 constant CHALLENGE_PERIOD = 1 hours; uint256 constant CHALLENGE_TIMEOUT = 5 minutes; event ChallengeStarted( address indexed prover, uint256 indexed blockNumber, bytes32 txHash ); enum Status { WAIT_FOR_CHALLENGE, CHALLENGING, WAIT_FOR_JUDGE, JUDGING, REVERTED, FINALIZED } struct ChallengeRequest { address prover; uint256 requestedAt; uint256 bond; Status status; Challenge challenge; } struct Challenge { address challenger; uint256 challengerBond; bytes32 txHash; uint256 challengedAt; // branch point information bytes32 proverStateRoot; bytes32 challengerStateRoot; bytes32 correctRoot; byte opcode; } mapping (uint256 => ChallengeRequest) requests; mapping (uint64 => Challenge) challenges; address public collator; EthereumRuntime public evm; constructor(address _collator, EthereumRuntime _evm) public { collator = _collator; evm = _evm; } function requestChallenge(uint256 blockNumber) public payable { require(msg.value >= MIN_BOND, "You must stake at least 1 ETH as a bond."); ChallengeRequest storage request = requests[blockNumber]; request.requestedAt = block.timestamp; request.prover = msg.sender; request.bond = msg.value; } function finalizeChallenge(uint256 blockNumber) public { ChallengeRequest storage request = requests[blockNumber]; require(msg.sender == request.prover, "Only prover can finish the challenge"); require(block.timestamp >= request.requestedAt + CHALLENGE_PERIOD, "Too early to finish the challenge"); if (request.status != Status.WAIT_FOR_CHALLENGE) { revert("Challenge is somehow not finished."); } request.status = Status.FINALIZED; if (request.bond > 0) { msg.sender.transfer(request.bond); } } function startChallenge(uint256 blockNumber, bytes32 txHash) public payable { Challenge storage challenge = requests[blockNumber].challenge; challenge.blockNumber = blockNumber; challenge.challenger = msg.sender; challenge.challengerBond = msg.value; challenge.txHash = txHash; challenge.challengedAt = block.timestamp; requests[blockNumber].status = Status.CHALLENGING; emit ChallengeStarted(requests[blockNumber].prover, blockNumber, txHash, challengeId); } /** * Report the state branch point calculated from off-chain. */ function reportBranchPoint( uint256 blockNumber, uint step, bytes32 stateRootBefore, bytes32 proverStateRootAfter, bytes32 challengerStateRootAfter, bytes proverSignature, bytes challengerSignature ) public { require(msg.sender == collator, "Should be reported from the collator"); Challenge storage challenge = challenges[challengeId]; ChallengeRequest storage request = requests[challenge.blockNumber]; // check signatures bytes32 proverWitness = keccak256(abi.encodePacked(step, stateRootBefore, proverStateRootAfter)); require(proverWitness.recover(proverSignature) == request.prover, "Invalid prover signature"); bytes32 challengerWitness = keccak256(abi.encodePacked(step, stateRootBefore, challengerStateRootAfter)); require(challengerWitness.recover(challengerSignature) == challenge.challenger, "Invalid challenger signature"); // branch point is where the inputs are same but the outputs are different. require(proverStateRootAfter != challengerStateRootAfter, "Should be a correct branch point"); request.status = Status.WAIT_FOR_JUDGE; } function judge( uint256 blockNumber, EthereumRuntime.TxInput memory input, EthereumRuntime.TxInfo memory info, EthereumRuntime.ExecutionContext memory context ) public { ChallengeRequest storage request = requests[blockNumber]; Challenge storage challenge = request.challenge; require(msg.sender == challenge.challenger, "Only challenger can judge."); require(request.status == challenge.WAIT_FOR_JUDGE); // TODO: check that executionContext matches with postStateRoot // TODO: timeout challenge.correctRoot = evm.executeLastStep(input, info, context); request.status == Status.JUDGING; } function finishJudge(uint256 blockNumber) internal { require(requests[blockNumber].status == Status.JUDGING); ChallengeRequest storage request = requests[blockNumber]; Challenge storage challenge = request.challenge; if (challenge.correctRoot == challenge.challengerStateRoot) { slashBondOf(request.prover); request.status = Status.REVERTED; } else if (challenge.correctRoot == challenge.proverStateRoot) { slashBondOf(challenge.challenger); request.status = Status.FINALIZED; if (request.bond > 0) { msg.sender.transfer(request.bond); } } else { revert("Not possible"); } } function slashBondOf(address someone) internal { } }
branch point information
struct Challenge { address challenger; uint256 challengerBond; bytes32 txHash; uint256 challengedAt; bytes32 proverStateRoot; bytes32 challengerStateRoot; bytes32 correctRoot; byte opcode; } mapping (uint256 => ChallengeRequest) requests; mapping (uint64 => Challenge) challenges; address public collator; EthereumRuntime public evm;
7,217,429
[ 1, 7500, 1634, 1779, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1680, 8525, 288, 203, 3639, 1758, 462, 7862, 693, 31, 203, 3639, 2254, 5034, 462, 7862, 693, 9807, 31, 203, 3639, 1731, 1578, 2229, 2310, 31, 203, 3639, 2254, 5034, 462, 7862, 2423, 861, 31, 203, 203, 3639, 1731, 1578, 450, 502, 1119, 2375, 31, 203, 3639, 1731, 1578, 462, 7862, 693, 1119, 2375, 31, 203, 3639, 1731, 1578, 3434, 2375, 31, 203, 3639, 1160, 11396, 31, 203, 565, 289, 203, 203, 565, 2874, 261, 11890, 5034, 516, 1680, 8525, 691, 13, 3285, 31, 203, 565, 2874, 261, 11890, 1105, 516, 1680, 8525, 13, 462, 7862, 2852, 31, 203, 203, 565, 1758, 1071, 4508, 639, 31, 203, 565, 512, 18664, 379, 5576, 1071, 2113, 81, 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 ]
./full_match/1/0x2B6B8Fed0f8Abe75faD1928a727C059d6e68f791/sources/NFT.sol
address WBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;
contract TheCashMachine is IERC20, Ownable { using SafeMath for uint256; using Address for address; event AutoLiquify(uint256 amountBNB, uint256 amountBOG); event BuybackMultiplierActive(uint256 duration); event CallInvocationResults(bool success, bytes data); address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address DEAD = 0x000000000000000000000000000000000000dEaD; address ZERO = 0x0000000000000000000000000000000000000000; string public currentlyServing = "TUSD"; string constant _name = "The Cash Machine"; string constant _symbol = "TCM"; uint8 constant _decimals = 6; uint256 public anti_sniper_blocks = 3; bool public txLimitFailsafe = true; mapping (address => uint256) _balances; mapping (address => mapping (address => uint256)) _allowances; mapping (address => bool) isFeeExempt; mapping (address => bool) isTxLimitExempt; mapping (address => bool) isDividendExempt; uint256 buybackFee = 0; uint256 reflectionFee = 600; uint256 marketingFee = 300; uint256 totalFee = 1100; uint256 feeDenominator = 10000; uint256 public _sellMultiplierNumerator = 200; uint256 public _sellMultiplierDenominator = 100; address public autoLiquidityReceiver; address public marketingFeeReceiver; uint256 targetLiquidity = 30; uint256 targetLiquidityDenominator = 100; IDEXRouter public router; address public pair; uint256 public launchedAt; uint256 buybackMultiplierTriggeredAt; uint256 buybackMultiplierLength = 30 minutes; bool public autoBuybackEnabled = false; uint256 autoBuybackCap; uint256 autoBuybackAccumulator; uint256 autoBuybackAmount; uint256 autoBuybackBlockPeriod; uint256 autoBuybackBlockLast; DividendDistributor distributor; uint256 distributorGas = 500000; bool public swapEnabled = true; bool inSwap; modifier swapping() { inSwap = true; _; inSwap = false; } constructor(address AutoLiqLocker, address marketingWallet) { pair = IDEXFactory(router.factory()).createPair(WETH, address(this)); _allowances[msg.sender][address(router)] = type(uint256).max; _allowances[address(this)][address(router)] = type(uint256).max; distributor = new DividendDistributor(address(router)); isFeeExempt[msg.sender] = true; isTxLimitExempt[address(this)] = true; isTxLimitExempt[msg.sender] = true; isTxLimitExempt[address(router)] = true; isDividendExempt[pair] = true; isDividendExempt[address(this)] = true; isDividendExempt[DEAD] = true; isDividendExempt[ZERO] = true; autoLiquidityReceiver = AutoLiqLocker; marketingFeeReceiver = marketingWallet; _balances[msg.sender] = _totalSupply; emit Transfer(address(0), msg.sender, _totalSupply); } receive() external payable {} function totalSupply() external view override returns (uint256) { return _totalSupply; } function decimals() external pure returns (uint8) { return _decimals; } function symbol() external pure returns (string memory) { return _symbol; } function name() external pure returns (string memory) { return _name; } function getOwner() external view returns (address) { return owner(); } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function allowance(address holder, address spender) external view override returns (uint256) { return _allowances[holder][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _allowances[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function approveMax(address spender) external returns (bool) { return approve(spender, type(uint256).max); } function transfer(address recipient, uint256 amount) external override returns (bool) { return _transferFrom(msg.sender, recipient, amount); } function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) { if(_allowances[sender][msg.sender] != type(uint256).max){ _allowances[sender][msg.sender] = _allowances[sender][msg.sender].sub(amount, "Insufficient Allowance"); } return _transferFrom(sender, recipient, amount); } function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) { if(_allowances[sender][msg.sender] != type(uint256).max){ _allowances[sender][msg.sender] = _allowances[sender][msg.sender].sub(amount, "Insufficient Allowance"); } return _transferFrom(sender, recipient, amount); } function _transferFrom(address sender, address recipient, uint256 amount) internal returns (bool) { if(txLimitFailsafe){ } if (recipient != pair && recipient != DEAD) { require(isTxLimitExempt[recipient] || _balances[recipient] + amount <= _maxWalletSize, "TCM: Recipient wallet will exceed max wallet size, blyat."); } _balances[sender] = _balances[sender].sub(amount, "TCM: Insufficient Balance, blyat."); uint256 amountReceived = shouldTakeFee(sender) ? takeFee(sender, recipient, amount) : amount; _balances[recipient] = _balances[recipient].add(amountReceived); emit Transfer(sender, recipient, amountReceived); return true; } if(inSwap){ return _basicTransfer(sender, recipient, amount); } function _transferFrom(address sender, address recipient, uint256 amount) internal returns (bool) { if(txLimitFailsafe){ } if (recipient != pair && recipient != DEAD) { require(isTxLimitExempt[recipient] || _balances[recipient] + amount <= _maxWalletSize, "TCM: Recipient wallet will exceed max wallet size, blyat."); } _balances[sender] = _balances[sender].sub(amount, "TCM: Insufficient Balance, blyat."); uint256 amountReceived = shouldTakeFee(sender) ? takeFee(sender, recipient, amount) : amount; _balances[recipient] = _balances[recipient].add(amountReceived); emit Transfer(sender, recipient, amountReceived); return true; } function _transferFrom(address sender, address recipient, uint256 amount) internal returns (bool) { if(txLimitFailsafe){ } if (recipient != pair && recipient != DEAD) { require(isTxLimitExempt[recipient] || _balances[recipient] + amount <= _maxWalletSize, "TCM: Recipient wallet will exceed max wallet size, blyat."); } _balances[sender] = _balances[sender].sub(amount, "TCM: Insufficient Balance, blyat."); uint256 amountReceived = shouldTakeFee(sender) ? takeFee(sender, recipient, amount) : amount; _balances[recipient] = _balances[recipient].add(amountReceived); emit Transfer(sender, recipient, amountReceived); return true; } if(shouldSwapBack()){ swapBack(); } if(shouldAutoBuyback()){ triggerAutoBuyback(); } if(!launched() && recipient == pair){ require(_balances[sender] > 0); launch(); } if(!isDividendExempt[sender]){ try distributor.setShare(sender, _balances[sender]) {} catch {} } if(!isDividendExempt[recipient]){ try distributor.setShare(recipient, _balances[recipient]) {} catch {} } try distributor.process(distributorGas) {} catch {} function _basicTransfer(address sender, address recipient, uint256 amount) internal returns (bool) { _balances[sender] = _balances[sender].sub(amount, "TCM: Insufficient Balance, blyat"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); return true; } function checkTxLimit(address sender, uint256 amount) internal view { require(amount <= _maxTxAmount || isTxLimitExempt[sender], "TCM: Max TX Limit Exceeded, cyka."); } function shouldTakeFee(address sender) internal view returns (bool) { return !isFeeExempt[sender]; } function getTotalFee(bool selling) public view returns (uint256) { return totalFee; } if(launchedAt + anti_sniper_blocks >= block.number){ return feeDenominator.sub(1); } if(selling){ return totalFee.mul(_sellMultiplierNumerator).div(_sellMultiplierDenominator); } function takeFee(address sender, address receiver, uint256 amount) internal returns (uint256) { uint256 feeAmount = amount.mul(getTotalFee(receiver == pair)).div(feeDenominator); _balances[address(this)] = _balances[address(this)].add(feeAmount); emit Transfer(sender, address(this), feeAmount); return amount.sub(feeAmount); } function shouldSwapBack() internal view returns (bool) { return msg.sender != pair && !inSwap && swapEnabled && _balances[address(this)] >= swapThreshold; } function swapBack() internal swapping { uint256 dynamicLiquidityFee = isOverLiquified(targetLiquidity, targetLiquidityDenominator) ? 0 : liquidityFee; uint256 amountToLiquify = swapThreshold.mul(dynamicLiquidityFee).div(totalFee).div(2); uint256 amountToSwap = swapThreshold.sub(amountToLiquify); address[] memory path = new address[](2); path[0] = address(this); path[1] = WETH; uint256 balanceBefore = address(this).balance; router.swapExactTokensForETHSupportingFeeOnTransferTokens( amountToSwap, 0, path, address(this), block.timestamp ); uint256 amountBNB = address(this).balance.sub(balanceBefore); uint256 totalBNBFee = totalFee.sub(dynamicLiquidityFee.div(2)); uint256 amountBNBLiquidity = amountBNB.mul(dynamicLiquidityFee).div(totalBNBFee).div(2); uint256 amountBNBReflection = amountBNB.mul(reflectionFee).div(totalBNBFee); uint256 amountBNBMarketing = amountBNB.mul(marketingFee).div(totalBNBFee); emit CallInvocationResults(success, data); if(amountToLiquify > 0){ address(this), amountToLiquify, 0, 0, autoLiquidityReceiver, block.timestamp ); emit AutoLiquify(amountBNBLiquidity, amountToLiquify); } } try distributor.deposit{value: amountBNBReflection}() {} catch {} (bool success, bytes memory data) = payable(marketingFeeReceiver).call{value: amountBNBMarketing, gas: 30000}(""); function swapBack() internal swapping { uint256 dynamicLiquidityFee = isOverLiquified(targetLiquidity, targetLiquidityDenominator) ? 0 : liquidityFee; uint256 amountToLiquify = swapThreshold.mul(dynamicLiquidityFee).div(totalFee).div(2); uint256 amountToSwap = swapThreshold.sub(amountToLiquify); address[] memory path = new address[](2); path[0] = address(this); path[1] = WETH; uint256 balanceBefore = address(this).balance; router.swapExactTokensForETHSupportingFeeOnTransferTokens( amountToSwap, 0, path, address(this), block.timestamp ); uint256 amountBNB = address(this).balance.sub(balanceBefore); uint256 totalBNBFee = totalFee.sub(dynamicLiquidityFee.div(2)); uint256 amountBNBLiquidity = amountBNB.mul(dynamicLiquidityFee).div(totalBNBFee).div(2); uint256 amountBNBReflection = amountBNB.mul(reflectionFee).div(totalBNBFee); uint256 amountBNBMarketing = amountBNB.mul(marketingFee).div(totalBNBFee); emit CallInvocationResults(success, data); if(amountToLiquify > 0){ address(this), amountToLiquify, 0, 0, autoLiquidityReceiver, block.timestamp ); emit AutoLiquify(amountBNBLiquidity, amountToLiquify); } } router.addLiquidityETH{value: amountBNBLiquidity}( function shouldAutoBuyback() internal view returns (bool) { return msg.sender != pair && !inSwap && autoBuybackEnabled && autoBuybackBlockLast + autoBuybackBlockPeriod <= block.number && address(this).balance >= autoBuybackAmount; } function triggerManualBuyback(uint256 amount, bool triggerBuybackMultiplier) external onlyOwner { buyTokens(amount, DEAD); if(triggerBuybackMultiplier){ buybackMultiplierTriggeredAt = block.timestamp; emit BuybackMultiplierActive(buybackMultiplierLength); } } function triggerManualBuyback(uint256 amount, bool triggerBuybackMultiplier) external onlyOwner { buyTokens(amount, DEAD); if(triggerBuybackMultiplier){ buybackMultiplierTriggeredAt = block.timestamp; emit BuybackMultiplierActive(buybackMultiplierLength); } } function clearBuybackMultiplier() external onlyOwner { buybackMultiplierTriggeredAt = 0; } function triggerAutoBuyback() internal { buyTokens(autoBuybackAmount, DEAD); autoBuybackBlockLast = block.number; autoBuybackAccumulator = autoBuybackAccumulator.add(autoBuybackAmount); } if(autoBuybackAccumulator > autoBuybackCap){ autoBuybackEnabled = false; } function buyTokens(uint256 amount, address to) internal swapping { address[] memory path = new address[](2); path[0] = WETH; path[1] = address(this); 0, path, to, block.timestamp ); } router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}( function setAutoBuybackSettings(bool _enabled, uint256 _cap, uint256 _amount, uint256 _period) external onlyOwner { autoBuybackEnabled = _enabled; autoBuybackCap = _cap; autoBuybackAccumulator = 0; autoBuybackAmount = _amount.div(100); autoBuybackBlockPeriod = _period; autoBuybackBlockLast = block.number; } function setAntiSniperBlocks(uint256 blocks) public onlyOwner { require(blocks <= 10, "TCM: You're looking too far ahead for anti-sniping, cyka!"); anti_sniper_blocks = blocks; } function setTxLimitFailsafe(bool toggle) public onlyOwner { txLimitFailsafe = toggle; } function launched() internal view returns (bool) { return launchedAt != 0; } function launch() internal { launchedAt = block.number; } function setTxLimit(uint256 numerator, uint256 divisor) external onlyOwner { require(numerator > 0 && divisor > 0 && divisor <= 100000); _maxTxAmount = _totalSupply.mul(numerator).div(divisor); } function setReflectToken(address newToken) external onlyOwner { require(newToken.isContract(), "Enter valid contract address"); distributor.changeToken(newToken); } function setMaxWallet(uint256 numerator, uint256 divisor) external onlyOwner() { require(numerator > 0 && divisor > 0 && divisor <= 100000); _maxWalletSize = _totalSupply.mul(numerator).div(divisor); } function setSellMultiplier(uint256 numerator, uint256 divisor) external onlyOwner() { require(numerator > 0 && divisor > 0 && numerator / divisor <= 2); _sellMultiplierNumerator = numerator; _sellMultiplierDenominator = divisor; } function setIsDividendExempt(address holder, bool exempt) external onlyOwner { require(holder != address(this) && holder != pair); isDividendExempt[holder] = exempt; if(exempt){ distributor.setShare(holder, 0); distributor.setShare(holder, _balances[holder]); } } function setIsDividendExempt(address holder, bool exempt) external onlyOwner { require(holder != address(this) && holder != pair); isDividendExempt[holder] = exempt; if(exempt){ distributor.setShare(holder, 0); distributor.setShare(holder, _balances[holder]); } } }else{ function setIsFeeExempt(address holder, bool exempt) external onlyOwner { isFeeExempt[holder] = exempt; } function setIsTxLimitExempt(address holder, bool exempt) external onlyOwner { isTxLimitExempt[holder] = exempt; } function setFees(uint256 _liquidityFee, uint256 _buybackFee, uint256 _reflectionFee, uint256 _marketingFee, uint256 _feeDenominator) external onlyOwner { liquidityFee = _liquidityFee; buybackFee = _buybackFee; reflectionFee = _reflectionFee; marketingFee = _marketingFee; totalFee = _liquidityFee.add(_buybackFee).add(_reflectionFee).add(_marketingFee); feeDenominator = _feeDenominator; require(totalFee < feeDenominator/4); } function setFeeReceivers(address _autoLiquidityReceiver, address _marketingFeeReceiver) external onlyOwner { autoLiquidityReceiver = _autoLiquidityReceiver; marketingFeeReceiver = _marketingFeeReceiver; } function setSwapBackSettings(bool _enabled, uint256 _denominator) external onlyOwner { require(_denominator > 0); swapEnabled = _enabled; swapThreshold = _totalSupply.div(_denominator); } function setTargetLiquidity(uint256 _target, uint256 _denominator) external onlyOwner { targetLiquidity = _target; targetLiquidityDenominator = _denominator; } function setDistributionCriteria(uint256 _minPeriod, uint256 _minDistribution) external onlyOwner { distributor.setDistributionCriteria(_minPeriod, _minDistribution); } function setDistributorSettings(uint256 gas) external onlyOwner { require(gas < 750000); distributorGas = gas; } function getCirculatingSupply() public view returns (uint256) { return _totalSupply.sub(balanceOf(DEAD)).sub(balanceOf(ZERO)); } function getLiquidityBacking(uint256 accuracy) public view returns (uint256) { return accuracy.mul(balanceOf(pair).mul(2)).div(getCirculatingSupply()); } function isOverLiquified(uint256 target, uint256 accuracy) public view returns (bool) { return getLiquidityBacking(accuracy) > target; } }
16,597,963
[ 1, 2867, 678, 15388, 38, 273, 374, 6114, 70, 24, 19728, 38, 29, 8876, 72, 5718, 38, 1611, 70, 40, 21, 71, 38, 69, 41, 15259, 22, 758, 6840, 72, 29, 31331, 13459, 5908, 25, 71, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1021, 39, 961, 6981, 353, 467, 654, 39, 3462, 16, 14223, 6914, 288, 203, 565, 1450, 14060, 10477, 364, 2254, 5034, 31, 203, 565, 1450, 5267, 364, 1758, 31, 203, 377, 203, 565, 871, 8064, 48, 18988, 1164, 12, 11890, 5034, 3844, 15388, 38, 16, 2254, 5034, 3844, 5315, 43, 1769, 203, 565, 871, 605, 9835, 823, 23365, 3896, 12, 11890, 5034, 3734, 1769, 203, 565, 871, 3049, 9267, 3447, 12, 6430, 2216, 16, 1731, 501, 1769, 203, 377, 203, 565, 1758, 678, 1584, 44, 273, 374, 14626, 3103, 7598, 37, 5520, 70, 3787, 23, 8090, 28, 40, 20, 37, 20, 73, 25, 39, 24, 42, 5324, 73, 1880, 29, 6840, 23, 39, 27, 4313, 39, 71, 22, 31, 203, 565, 1758, 2030, 1880, 273, 374, 92, 12648, 12648, 12648, 12648, 2787, 72, 41, 69, 40, 31, 203, 565, 1758, 18449, 273, 374, 92, 12648, 12648, 12648, 12648, 12648, 31, 203, 565, 533, 1071, 4551, 25721, 273, 315, 56, 3378, 40, 14432, 203, 203, 565, 533, 5381, 389, 529, 273, 315, 1986, 385, 961, 12026, 14432, 203, 565, 533, 5381, 389, 7175, 273, 315, 56, 9611, 14432, 203, 565, 2254, 28, 5381, 389, 31734, 273, 1666, 31, 203, 203, 377, 203, 565, 2254, 5034, 1071, 30959, 67, 8134, 77, 457, 67, 7996, 273, 890, 31, 203, 565, 1426, 1071, 2229, 3039, 3754, 4626, 273, 638, 31, 203, 203, 565, 2874, 261, 2867, 516, 2254, 5034, 13, 389, 70, 26488, 31, 203, 565, 2874, 261, 2867, 516, 2874, 261, 2867, 516, 2254, 5034, 3719, 2 ]
// Upgraded Date: 01-04-2022 // Commit: https://github.com/Sperax/USDs/commit/3423ae0177c292a47f0939ee5a6b24a18c145643 // Changes: Added missing parameters update in updateCollateralInfo() // Implementation Contract Address: 0xE0A1f2Ed69A739B52a493B244d8ac27F555E0b55 // SPDX-License-Identifier: MIT pragma solidity >=0.6.12; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import "../interfaces/ISperaxToken.sol"; import "../interfaces/IStrategy.sol"; import "../interfaces/IVaultCore.sol"; import "./interfaces/IUSDsV1.sol"; import "../interfaces/IBuyback.sol"; import "./VaultCoreToolsV2.sol"; /** * @title Vault of USDs protocol * @dev Control Mint, Redeem, Allocate and Rebase of USDs * @dev Live on Arbitrum Layer 2 * @author Sperax Foundation */ contract VaultCoreV3 is Initializable, OwnableUpgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable, IVaultCore { using SafeERC20Upgradeable for IERC20Upgradeable; using SafeMathUpgradeable for uint; using StableMath for uint; bytes32 public constant REBASER_ROLE = keccak256("REBASER_ROLE"); bool public override mintRedeemAllowed; bool public override allocationAllowed; bool public override rebaseAllowed; bool public override swapfeeInAllowed; bool public override swapfeeOutAllowed; address public SPAaddr; address public USDsAddr; address public override oracleAddr; address public SPAvault; address public feeVault; address public vaultCoreToolsAddr; uint public override startBlockHeight; uint public SPAminted; uint public SPAburnt; uint32 public override chi_alpha; uint64 public override constant chi_alpha_prec = 10**12; uint64 public override constant chi_prec = chi_alpha_prec; uint public override chiInit; uint32 public override chi_beta; uint16 public override constant chi_beta_prec = 10**4; uint32 public override chi_gamma; uint16 public override constant chi_gamma_prec = 10**4; uint64 public override constant swapFee_prec = 10**12; uint32 public override swapFee_p; uint16 public override constant swapFee_p_prec = 10**4; uint32 public override swapFee_theta; uint16 public override constant swapFee_theta_prec = 10**4; uint32 public override swapFee_a; uint16 public override constant swapFee_a_prec = 10**4; uint32 public override swapFee_A; uint16 public override constant swapFee_A_prec = 10**4; uint8 public override constant allocatePercentage_prec = 10**2; event ParametersUpdated(uint _chiInit, uint32 _chi_beta, uint32 _chi_gamma, uint32 _swapFee_p, uint32 _swapFee_theta, uint32 _swapFee_a, uint32 _swapFee_A); event USDsMinted(address indexed wallet, uint indexed USDsAmt, uint collateralAmt, uint SPAsAmt, uint feeAmt); event USDsRedeemed(address indexed wallet, uint indexed USDsAmt, uint collateralAmt, uint SPAsAmt, uint feeAmt); event Rebase(uint indexed oldSupply, uint indexed newSupply); event CollateralAdded(address indexed collateralAddr, bool addded, address defaultStrategyAddr, bool allocationAllowed, uint8 allocatePercentage, address buyBackAddr, bool rebaseAllowed); event CollateralChanged(address indexed collateralAddr, bool addded, address defaultStrategyAddr, bool allocationAllowed, uint8 allocatePercentage, address buyBackAddr, bool rebaseAllowed); event StrategyAdded(address strategyAddr, bool added); event StrategyRwdBuyBackUpdateded(address strategyAddr, address buybackAddr); event MintRedeemPermssionChanged(bool permission); event AllocationPermssionChanged(bool permission); event RebasePermssionChanged(bool permission); event SwapFeeInOutPermissionChanged(bool indexed swapfeeInAllowed, bool indexed swapfeeOutAllowed); event CollateralAllocated(address indexed collateralAddr, address indexed depositStrategyAddr, uint allocateAmount); event USDsAddressUpdated(address oldAddr, address newAddr); event OracleAddressUpdated(address oldAddr, address newAddr); event TotalValueLocked( uint totalValueLocked, uint totalValueInVault, uint totalValueInStrategies ); event SPAprice(uint SPAprice); event USDsPrice(uint USDsPrice); event CollateralPrice(uint CollateralPrice); /** * @dev check if USDs mint & redeem are both allowed */ modifier whenMintRedeemAllowed { require(mintRedeemAllowed, "Mint & redeem paused"); _; } /** * @dev check if re-investment of collaterals into strategies is allowed */ modifier whenAllocationAllowed { require(allocationAllowed, "Allocate paused"); _; } /** * @dev check if rebase is allowed */ modifier whenRebaseAllowed { require(rebaseAllowed, "Rebase paused"); _; } struct collateralStruct { address collateralAddr; bool added; address defaultStrategyAddr; bool allocationAllowed; uint8 allocatePercentage; address buyBackAddr; bool rebaseAllowed; } struct strategyStruct { address strategyAddr; address rewardTokenBuybackAddr; bool added; } mapping(address => collateralStruct) public collateralsInfo; mapping(address => strategyStruct) public strategiesInfo; collateralStruct[] allCollaterals; // the list of all added collaterals strategyStruct[] allStrategies; // the list of all strategy addresses address[] public allCollateralAddr; // the list of all added collaterals address[] public allStrategyAddr; // the list of all strategy addresses /** * @dev contract initializer * @param _SPAaddr SperaxTokenL2 address * @param _vaultCoreToolsAddr VaultCoreTools address * @param _feeVault address of wallet storing swap fees */ function initialize(address _SPAaddr, address _vaultCoreToolsAddr, address _feeVault) public initializer { OwnableUpgradeable.__Ownable_init(); AccessControlUpgradeable.__AccessControl_init(); ReentrancyGuardUpgradeable.__ReentrancyGuard_init(); mintRedeemAllowed = true; swapfeeInAllowed = false; swapfeeOutAllowed = false; allocationAllowed = false; SPAaddr = _SPAaddr; vaultCoreToolsAddr = _vaultCoreToolsAddr; SPAvault = address(this); startBlockHeight = block.number; chi_alpha = uint32(chi_alpha_prec * 513 / 10**10); chiInit = uint(chi_prec * 95 / 100); chi_beta = uint32(chi_beta_prec) * 9; chi_gamma = uint32(chi_gamma_prec); swapFee_p = uint32(swapFee_p_prec) * 99 / 100; swapFee_theta = uint32(swapFee_theta_prec)* 50; swapFee_a = uint32(swapFee_a_prec) * 12 / 10; swapFee_A = uint32(swapFee_A_prec) * 20; feeVault = _feeVault; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); } /** * @dev align up allCollateralAddr and allCollaterals * @dev can only be called once */ function alignUpArray() external onlyOwner { require (allCollateralAddr.length == 0, 'array not empty'); for (uint y = 0; y < allCollaterals.length; y++) { allCollateralAddr.push(allCollaterals[y].collateralAddr); } } /** * @dev change registered USDs address on this contract * @param _USDsAddr updated USDs address */ function updateUSDsAddress(address _USDsAddr) external onlyOwner { emit USDsAddressUpdated(USDsAddr, _USDsAddr); USDsAddr = _USDsAddr; } /** * @dev change registered Oracle address on this contract * @param _oracleAddr updated oracle address */ function updateOracleAddress(address _oracleAddr) external onlyOwner { emit USDsAddressUpdated(oracleAddr, _oracleAddr); oracleAddr = _oracleAddr; } /** * @dev change economics parameters related to chi ratio and swap fee */ function updateParameters(uint _chiInit, uint32 _chi_beta, uint32 _chi_gamma, uint32 _swapFee_p, uint32 _swapFee_theta, uint32 _swapFee_a, uint32 _swapFee_A) external onlyOwner { chiInit = _chiInit; chi_beta = _chi_beta; chi_gamma = _chi_gamma; swapFee_p = _swapFee_p; swapFee_theta = _swapFee_theta; swapFee_a = _swapFee_a; swapFee_A = _swapFee_A; emit ParametersUpdated(chiInit, chi_beta, chi_gamma, swapFee_p, swapFee_theta, swapFee_a, swapFee_A); } /** * @dev enable/disable USDs mint & redeem */ function updateMintBurnPermission(bool _mintRedeemAllowed) external onlyOwner { mintRedeemAllowed = _mintRedeemAllowed; emit MintRedeemPermssionChanged(mintRedeemAllowed); } /** * @dev enable/disable collateral re-investment */ function updateAllocationPermission(bool _allocationAllowed) external onlyOwner { allocationAllowed = _allocationAllowed; emit AllocationPermssionChanged(allocationAllowed); } /** * @dev enable/disable rebasing */ function updateRebasePermission(bool _rebaseAllowed) external onlyOwner { rebaseAllowed = _rebaseAllowed; emit RebasePermssionChanged(rebaseAllowed); } /** * @dev enable/disable swapInFee, i.e. mint becomes free */ function updateSwapInOutFeePermission(bool _swapfeeInAllowed, bool _swapfeeOutAllowed) external onlyOwner { swapfeeInAllowed = _swapfeeInAllowed; swapfeeOutAllowed = _swapfeeOutAllowed; emit SwapFeeInOutPermissionChanged(swapfeeInAllowed, swapfeeOutAllowed); } /** * @dev authorize an ERC20 token as one of the collaterals supported by USDs mint/redeem * @param _collateralAddr ERC20 address to be authorized * @param _defaultStrategyAddr strategy address of which the collateral is allocated into on allocate() * @param _allocationAllowed if allocate() is allowed on this collateral * @param _allocatePercentage ideally after allocate(), _allocatePercentage% of the collateral is in strategy, (100 - _allocatePercentage)% in VaultCore * @param _buyBackAddr contract address providing swap function to swap interestEarned to USDsSupply * @param _rebaseAllowed if rebase is allowed on this collateral */ function addCollateral(address _collateralAddr, address _defaultStrategyAddr, bool _allocationAllowed, uint8 _allocatePercentage, address _buyBackAddr, bool _rebaseAllowed) external onlyOwner { require(!collateralsInfo[_collateralAddr].added, "Collateral added"); require(ERC20Upgradeable(_collateralAddr).decimals() <= 18, "Collaterals decimals need to be less than 18"); collateralStruct storage addingCollateral = collateralsInfo[_collateralAddr]; addingCollateral.collateralAddr = _collateralAddr; addingCollateral.added = true; addingCollateral.defaultStrategyAddr = _defaultStrategyAddr; addingCollateral.allocationAllowed = _allocationAllowed; addingCollateral.allocatePercentage = _allocatePercentage; addingCollateral.buyBackAddr = _buyBackAddr; addingCollateral.rebaseAllowed = _rebaseAllowed; allCollateralAddr.push(addingCollateral.collateralAddr); emit CollateralAdded(_collateralAddr, addingCollateral.added, _defaultStrategyAddr, _allocationAllowed, _allocatePercentage, _buyBackAddr, _rebaseAllowed); } /** * @dev update setting of an authorized collateral. refer to addCollateral() for parameters description */ function updateCollateralInfo(address _collateralAddr, address _defaultStrategyAddr, bool _allocationAllowed, uint8 _allocatePercentage, address _buyBackAddr, bool _rebaseAllowed) external onlyOwner { require(collateralsInfo[_collateralAddr].added, "Collateral not added"); collateralStruct storage updatedCollateral = collateralsInfo[_collateralAddr]; updatedCollateral.collateralAddr = _collateralAddr; updatedCollateral.defaultStrategyAddr = _defaultStrategyAddr; updatedCollateral.allocationAllowed = _allocationAllowed; updatedCollateral.buyBackAddr = _buyBackAddr; updatedCollateral.rebaseAllowed = _rebaseAllowed; emit CollateralChanged(_collateralAddr, updatedCollateral.added, _defaultStrategyAddr, _allocationAllowed, _allocatePercentage, _buyBackAddr, _rebaseAllowed); } /** * @dev authorize an strategy * @param _strategyAddr strategy contract address */ function addStrategy(address _strategyAddr) external onlyOwner { require(!strategiesInfo[_strategyAddr].added, "Strategy added"); strategyStruct storage addingStrategy = strategiesInfo[_strategyAddr]; addingStrategy.strategyAddr = _strategyAddr; addingStrategy.added = true; allStrategyAddr.push(addingStrategy.strategyAddr); emit StrategyAdded(_strategyAddr, true); } /** * @dev authorize an strategy * @param _strategyAddr strategy contract address */ function updateStrategyRwdBuybackAddr( address _strategyAddr, address _buyBackAddr ) external onlyOwner { require(strategiesInfo[_strategyAddr].added, "Strategy not added"); strategyStruct storage addingStrategy = strategiesInfo[_strategyAddr]; addingStrategy.strategyAddr = _strategyAddr; addingStrategy.rewardTokenBuybackAddr = _buyBackAddr; emit StrategyRwdBuyBackUpdateded(_strategyAddr, _buyBackAddr); } /** * @dev mint USDs (burn SPA, lock collateral) by entering USDs amount * @param collateralAddr the address of user's chosen collateral * @param USDsAmtToMint the amount of USDs to be minted * @param maxCollateralLocked maximum amount of collateral locked * @param maxSPAburnt maximum amount of SPA burnt * @param deadline transaction deadline */ function mintBySpecifyingUSDsAmt(address collateralAddr, uint USDsAmtToMint, uint maxCollateralLocked, uint maxSPAburnt, uint deadline) public whenMintRedeemAllowed nonReentrant { require(collateralsInfo[collateralAddr].added, "Collateral not added"); require(USDsAmtToMint > 0, "Amount needs to be greater than 0"); _mint(collateralAddr, USDsAmtToMint, 0, USDsAmtToMint, maxCollateralLocked, maxSPAburnt, deadline); } /** * @dev mint USDs (burn SPA, lock collateral) by entering SPA amount * @param collateralAddr the address of user's chosen collateral * @param SPAamtToBurn the amount of SPA to burn * @param minUSDsMinted minimum amount of USDs minted * @param maxCollateralLocked maximum amount of collateral locked * @param deadline transaction deadline */ function mintBySpecifyingSPAamt(address collateralAddr, uint SPAamtToBurn, uint minUSDsMinted, uint maxCollateralLocked, uint deadline) public whenMintRedeemAllowed nonReentrant { require(collateralsInfo[collateralAddr].added, "Collateral not added"); require(SPAamtToBurn > 0, "Amount needs to be greater than 0"); _mint(collateralAddr, SPAamtToBurn, 1, minUSDsMinted, maxCollateralLocked, SPAamtToBurn, deadline); } /** * @dev mint USDs (burn SPA, lock collateral) by entering collateral amount * @param collateralAddr the address of user's chosen collateral * @param collateralAmtToLock the amount of collateral locked * @param minUSDsMinted minimum amount of USDs minted * @param maxSPAburnt maximum amount of SPA burnt * @param deadline transaction deadline */ function mintBySpecifyingCollateralAmt(address collateralAddr, uint collateralAmtToLock, uint minUSDsMinted, uint maxSPAburnt, uint deadline) public whenMintRedeemAllowed nonReentrant { require(collateralsInfo[collateralAddr].added, "Collateral not added"); require(collateralAmtToLock > 0, "Amount needs to be greater than 0"); _mint(collateralAddr, collateralAmtToLock, 2, minUSDsMinted, collateralAmtToLock, maxSPAburnt, deadline); } /** * @dev the generic, internal mint function * @param collateralAddr the address of the collateral * @param valueAmt the amount of tokens (the specific meaning depends on valueType) * @param valueType the type of tokens (specific meanings are listed lower) * valueType = 0: mintBySpecifyingUSDsAmt * valueType = 1: mintBySpecifyingSPAamt * valueType = 2: mintBySpecifyingCollateralAmt */ function _mint( address collateralAddr, uint valueAmt, uint8 valueType, uint slippageUSDs, uint slippageCollat, uint slippageSPA, uint deadline ) internal whenMintRedeemAllowed { // calculate all necessary related quantities based on user inputs (uint SPABurnAmt, uint collateralDepAmt, uint USDsAmt, uint swapFeeAmount) = VaultCoreToolsV2(vaultCoreToolsAddr).mintView(collateralAddr, valueAmt, valueType, address(this)); // slippageUSDs is the minimum value of the minted USDs // slippageCollat is the maximum value of the required collateral // slippageSPA is the maximum value of the required spa require(USDsAmt >= slippageUSDs, "USDs amount is lower than the maximum slippage"); require(collateralDepAmt <= slippageCollat, "Collateral amount is more than the maximum slippage"); require(SPABurnAmt <= slippageSPA, "SPA amount is more than the maximum slippage"); require(now <= deadline, "Deadline expired"); // burn SPA tokens ISperaxToken(SPAaddr).burnFrom(msg.sender, SPABurnAmt); SPAburnt = SPAburnt.add(SPABurnAmt); // if it it not mintWithETH, stake collaterals IERC20Upgradeable(collateralAddr).safeTransferFrom(msg.sender, address(this), collateralDepAmt); // mint USDs and collect swapIn fees IUSDsV1(USDsAddr).mint(msg.sender, USDsAmt); IUSDsV1(USDsAddr).mint(feeVault, swapFeeAmount); uint priceColla = IOracleV1(oracleAddr).getCollateralPrice(collateralAddr); uint priceSPA = IOracleV1(oracleAddr).getSPAprice(); uint priceUSDs = IOracleV1(oracleAddr).getUSDsPrice(); emit USDsMinted(msg.sender, USDsAmt, collateralDepAmt, SPABurnAmt, swapFeeAmount); emit TotalValueLocked(totalValueLocked(), totalValueInVault(), totalValueInStrategies()); emit CollateralPrice(priceColla); emit SPAprice(priceSPA); emit USDsPrice(priceUSDs); } /** * @dev redeem USDs to collateral and SPA by entering USDs amount * @param collateralAddr the address of user's chosen collateral * @param USDsAmt the amount of USDs to be redeemed * @param slippageCollat minimum amount of collateral to be unlocked * @param slippageSPA minimum amount of SPA to be minted * @param deadline transaction deadline */ function redeem(address collateralAddr, uint USDsAmt, uint slippageCollat, uint slippageSPA, uint deadline) public whenMintRedeemAllowed nonReentrant { require(collateralsInfo[collateralAddr].added, "Collateral not added"); require(USDsAmt > 0, "Amount needs to be greater than 0"); _redeem(collateralAddr, USDsAmt, slippageCollat, slippageSPA, deadline); } /** * @dev the generic, internal redeem function * @param collateralAddr the address of user's chosen collateral * @param USDsAmt the amount of USDs to be redeemed * @param slippageCollat minimum amount of collateral to be unlocked * @param slippageSPA minimum amount of SPA to be minted * @param deadline transaction deadline */ function _redeem( address collateralAddr, uint USDsAmt, uint slippageCollat, uint slippageSPA, uint deadline ) internal whenMintRedeemAllowed { (uint SPAMintAmt, uint collateralUnlockedAmt, uint USDsBurntAmt, uint swapFeeAmount) = VaultCoreToolsV2(vaultCoreToolsAddr).redeemView(collateralAddr, USDsAmt, address(this), oracleAddr); // slippageCollat is the minimum value of the unlocked collateral // slippageSPA is the minimum value of the minted spa require(collateralUnlockedAmt >= slippageCollat, "Collateral amount is lower than the maximum slippage"); require(SPAMintAmt >= slippageSPA, "SPA amount is lower than the maximum slippage"); require(now <= deadline, "Deadline expired"); collateralStruct memory collateral = collateralsInfo[collateralAddr]; ISperaxToken(SPAaddr).mintForUSDs(msg.sender, SPAMintAmt); SPAminted = SPAminted.add(SPAMintAmt); if (IERC20Upgradeable(collateralAddr).balanceOf(address(this)) >= collateralUnlockedAmt) { IERC20Upgradeable(collateralAddr).safeTransfer(msg.sender, collateralUnlockedAmt); } else if (collateral.defaultStrategyAddr != address(0)) { IStrategy strategy = IStrategy(collateral.defaultStrategyAddr); if (strategy.supportsCollateral(collateralAddr)) { strategy.withdraw(msg.sender, collateralAddr, collateralUnlockedAmt); } } else { revert("No enough collateral in Vault or Strategy"); } IUSDsV1(USDsAddr).burn(msg.sender, USDsBurntAmt); IERC20Upgradeable(USDsAddr).safeTransferFrom(msg.sender, feeVault, swapFeeAmount); uint priceColla = IOracleV1(oracleAddr).getCollateralPrice(collateralAddr); uint priceSPA = IOracleV1(oracleAddr).getSPAprice(); uint priceUSDs = IOracleV1(oracleAddr).getUSDsPrice(); emit USDsRedeemed(msg.sender, USDsBurntAmt, collateralUnlockedAmt, SPAMintAmt, swapFeeAmount); emit TotalValueLocked(totalValueLocked(), totalValueInVault(), totalValueInStrategies()); emit CollateralPrice(priceColla); emit SPAprice(priceSPA); emit USDsPrice(priceUSDs); } /** * @dev trigger rebase: harvest interest and reward token earned in strategies. Exchange them into USDs. * @dev distribute USDs earned in this step to all users by change the totalsupply of USDs */ function rebase() external whenRebaseAllowed nonReentrant { require(hasRole(REBASER_ROLE, msg.sender), "Caller is not a rebaser"); uint USDsIncrement = _harvest(); uint USDsOldSupply = IERC20Upgradeable(USDsAddr).totalSupply(); if (USDsIncrement > 0) { uint USDsNewSupply = IERC20Upgradeable(USDsAddr).totalSupply().add(USDsIncrement); IUSDsV1(USDsAddr).burn(address(this), USDsIncrement); IUSDsV1(USDsAddr).changeSupply(USDsNewSupply); emit Rebase(USDsOldSupply, USDsNewSupply); } else { emit Rebase(USDsOldSupply, USDsOldSupply); } uint priceSPA = IOracleV1(oracleAddr).getSPAprice(); uint priceUSDs = IOracleV1(oracleAddr).getUSDsPrice(); emit SPAprice(priceSPA); emit USDsPrice(priceUSDs); emit TotalValueLocked(totalValueLocked(), totalValueInVault(), totalValueInStrategies()); } /** * @dev harvest interest and reward token earned in strategies */ function _harvest() internal returns (uint USDsIncrement) { IStrategy strategy; collateralStruct memory collateral; for (uint y = 0; y < allCollateralAddr.length; y++) { collateral = collateralsInfo[allCollateralAddr[y]]; if (collateral.defaultStrategyAddr != address(0)) { strategy = IStrategy(collateral.defaultStrategyAddr); if (collateral.rebaseAllowed && strategy.supportsCollateral(collateral.collateralAddr)) { uint USDsIncrement_viaReward = _harvestReward(strategy); uint USDsIncrement_viaInterest = _harvestInterest(strategy, collateral.collateralAddr); USDsIncrement = USDsIncrement.add(USDsIncrement_viaReward).add(USDsIncrement_viaInterest); } } } } /** * @dev harvest reward token earned in strategies */ function _harvestReward(IStrategy strategy) internal returns (uint USDsIncrement_viaReward) { address rewardTokenAddress = strategy.rewardTokenAddress(); if (rewardTokenAddress != address(0)) { uint liquidationThreshold = strategy.rewardLiquidationThreshold(); uint rewardTokenAmount = IERC20Upgradeable(rewardTokenAddress).balanceOf(address(this)); if (rewardTokenAmount > liquidationThreshold) { strategy.collectRewardToken(); uint rewardAmt = IERC20Upgradeable(rewardTokenAddress).balanceOf(address(this)); address rewardTokenBuybackAddr = strategiesInfo[address(strategy)].rewardTokenBuybackAddr; IERC20Upgradeable(rewardTokenAddress).safeTransfer(rewardTokenBuybackAddr, rewardAmt); USDsIncrement_viaReward = IBuyback(rewardTokenBuybackAddr).swap(rewardTokenAddress, rewardAmt); } } } /** * @dev harvest interesed earned in strategies */ function _harvestInterest(IStrategy strategy, address collateralAddr) internal returns (uint USDsIncrement_viaInterest) { collateralStruct memory collateral = collateralsInfo[collateralAddr]; uint liquidationThreshold = strategy.interestLiquidationThreshold(); uint interestEarned = strategy.checkInterestEarned(collateralAddr); if (interestEarned > liquidationThreshold) { strategy.collectInterest(address(this), collateral.collateralAddr); IERC20Upgradeable(collateralAddr).safeTransfer(collateral.buyBackAddr, interestEarned); USDsIncrement_viaInterest = IBuyback(collateral.buyBackAddr).swap(collateralAddr, interestEarned); } } /** * @dev allocate collateral on this contract into strategies. */ function allocate() external whenAllocationAllowed onlyOwner nonReentrant { IStrategy strategy; collateralStruct memory collateral; for (uint y = 0; y < allCollateralAddr.length; y++) { collateral = collateralsInfo[allCollateralAddr[y]]; if (collateral.defaultStrategyAddr != address(0)) { strategy = IStrategy(collateral.defaultStrategyAddr); if (collateral.allocationAllowed && strategy.supportsCollateral(collateral.collateralAddr)) { uint amtInStrategy = strategy.checkBalance(collateral.collateralAddr); uint amtInVault = IERC20Upgradeable(collateral.collateralAddr).balanceOf(address(this)); uint amtInStrategy_optimal = amtInStrategy.add(amtInVault).mul(uint(collateral.allocatePercentage)).div(uint(allocatePercentage_prec)); if (amtInStrategy_optimal > amtInStrategy) { uint amtToAllocate = amtInStrategy_optimal.sub(amtInStrategy); IERC20Upgradeable(collateral.collateralAddr).safeTransfer(collateral.defaultStrategyAddr, amtToAllocate); strategy.deposit(collateral.collateralAddr, amtToAllocate); emit CollateralAllocated(collateral.collateralAddr, collateral.defaultStrategyAddr, amtToAllocate); } } } } } /** * @dev the value of collaterals in this contract and strategies divide by USDs total supply * @dev precision: same as chi_prec */ function collateralRatio() public view override returns (uint ratio) { uint totalValueLocked = totalValueLocked(); uint USDsSupply = IERC20Upgradeable(USDsAddr).totalSupply(); uint priceUSDs = uint(IOracleV1(oracleAddr).getUSDsPrice()); uint precisionUSDs = IOracleV1(oracleAddr).getUSDsPrice_prec(); uint USDsValue = USDsSupply.mul(priceUSDs).div(precisionUSDs); ratio = totalValueLocked.mul(chi_prec).div(USDsValue); } /** * @dev the value of collaterals in this contract and strategies */ function totalValueLocked() public view returns (uint value) { value = totalValueInVault().add(totalValueInStrategies()); } /** * @dev the value of collaterals in this contract */ function totalValueInVault() public view returns (uint value) { for (uint y = 0; y < allCollateralAddr.length; y++) { collateralStruct memory collateral = collateralsInfo[allCollateralAddr[y]]; value = value.add(_valueInVault(collateral.collateralAddr)); } } /** * @dev the value of collateral of _collateralAddr in this contract */ function _valueInVault(address _collateralAddr) internal view returns (uint value) { collateralStruct memory collateral = collateralsInfo[_collateralAddr]; uint priceColla = IOracleV1(oracleAddr).getCollateralPrice(collateral.collateralAddr); uint precisionColla = IOracleV1(oracleAddr).getCollateralPrice_prec(collateral.collateralAddr); uint collateralAddrDecimal = uint(ERC20Upgradeable(collateral.collateralAddr).decimals()); uint collateralTotalValueInVault = IERC20Upgradeable(collateral.collateralAddr).balanceOf(address(this)).mul(priceColla).div(precisionColla); uint collateralTotalValueInVault_18 = collateralTotalValueInVault.mul(10**(uint(18).sub(collateralAddrDecimal))); value = collateralTotalValueInVault_18; } /** * @dev the value of collaterals in the strategies */ function totalValueInStrategies() public view returns (uint value) { for (uint y = 0; y < allCollateralAddr.length; y++) { collateralStruct memory collateral = collateralsInfo[allCollateralAddr[y]]; value = value.add(_valueInStrategy(collateral.collateralAddr)); } } /** * @dev the value of collateral of _collateralAddr in its strategy */ function _valueInStrategy(address _collateralAddr) internal view returns (uint) { collateralStruct memory collateral = collateralsInfo[_collateralAddr]; if (collateral.defaultStrategyAddr == address(0)) { return 0; } IStrategy strategy = IStrategy(collateral.defaultStrategyAddr); if (!strategy.supportsCollateral(collateral.collateralAddr)) { return 0; } uint priceColla = IOracleV1(oracleAddr).getCollateralPrice(collateral.collateralAddr); uint precisionColla = IOracleV1(oracleAddr).getCollateralPrice_prec(collateral.collateralAddr); uint collateralAddrDecimal = uint(ERC20Upgradeable(collateral.collateralAddr).decimals()); uint collateralTotalValueInStrategy = strategy.checkBalance(collateral.collateralAddr).mul(priceColla).div(precisionColla); uint collateralTotalValueInStrategy_18 = collateralTotalValueInStrategy.mul(10**(uint(18).sub(collateralAddrDecimal))); return collateralTotalValueInStrategy_18; } }
* @dev check if USDs mint & redeem are both allowed/
modifier whenMintRedeemAllowed { require(mintRedeemAllowed, "Mint & redeem paused"); _; }
14,017,313
[ 1, 1893, 309, 587, 9903, 87, 312, 474, 473, 283, 24903, 854, 3937, 2935, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 20597, 1347, 49, 474, 426, 24903, 5042, 288, 203, 202, 202, 6528, 12, 81, 474, 426, 24903, 5042, 16, 315, 49, 474, 473, 283, 24903, 17781, 8863, 203, 202, 202, 67, 31, 203, 202, 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 ]
./partial_match/1/0xB690fC16279C096999264e3C049fA133024b4d69/sources/contracts/storefront/AbstractStorefront.sol
* @notice See {IStorefront-createSale}/
function createSale( Sale calldata sale ) external override onlyTokenContractAuthority(sale.tokenContract) isSaleEndTimestampCurrentlyValid(sale.saleEndTimestamp) isPrimaryFeeInfoValid(sale.primaryFee) { require(sale.saleState != SaleState.paused, "initial sale state invalid"); uint256 saleId = numSales + 1; _sales[saleId] = sale; numSales = saleId; emit SaleCreated(saleId, sale.packId, sale.tokenContract); }
3,599,565
[ 1, 9704, 288, 45, 2257, 10211, 17, 2640, 30746, 4004, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 752, 30746, 12, 203, 3639, 348, 5349, 745, 892, 272, 5349, 203, 565, 262, 203, 3639, 3903, 203, 3639, 3849, 203, 3639, 1338, 1345, 8924, 10962, 12, 87, 5349, 18, 2316, 8924, 13, 203, 3639, 11604, 5349, 1638, 4921, 3935, 715, 1556, 12, 87, 5349, 18, 87, 5349, 1638, 4921, 13, 203, 3639, 353, 6793, 14667, 966, 1556, 12, 87, 5349, 18, 8258, 14667, 13, 203, 565, 288, 203, 3639, 2583, 12, 87, 5349, 18, 87, 5349, 1119, 480, 348, 5349, 1119, 18, 8774, 3668, 16, 315, 6769, 272, 5349, 919, 2057, 8863, 203, 3639, 2254, 5034, 272, 5349, 548, 273, 818, 23729, 397, 404, 31, 203, 3639, 389, 87, 5408, 63, 87, 5349, 548, 65, 273, 272, 5349, 31, 203, 3639, 818, 23729, 273, 272, 5349, 548, 31, 203, 3639, 3626, 348, 5349, 6119, 12, 87, 5349, 548, 16, 272, 5349, 18, 2920, 548, 16, 272, 5349, 18, 2316, 8924, 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 ]
./partial_match/1/0x0CCAF08cF40FC19F69eF27d2C2cEf22544f04C92/sources/ApolloHex.sol
exclude from paying fees or having max transaction amount
constructor() ERC20("ApolloHex", "AHEX") { IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); excludeFromMaxTransaction(address(_uniswapV2Router), true); uniswapV2Router = _uniswapV2Router; uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); excludeFromMaxTransaction(address(uniswapV2Pair), true); _setAutomatedMarketMakerPair(address(uniswapV2Pair), true); uint256 _buyMarketingFee = 1; uint256 _buyLiquidityFee = 1; uint256 _buyDevFee = 1; uint256 _sellMarketingFee = 1; uint256 _sellLiquidityFee = 1; uint256 _sellDevFee = 1; uint256 _earlySellLiquidityFee = 0; uint256 _earlySellMarketingFee = 0; uint256 totalSupply = 1 * 1e12 * 1e18; buyMarketingFee = _buyMarketingFee; buyLiquidityFee = _buyLiquidityFee; buyDevFee = _buyDevFee; buyTotalFees = buyMarketingFee + buyLiquidityFee + buyDevFee; sellMarketingFee = _sellMarketingFee; sellLiquidityFee = _sellLiquidityFee; sellDevFee = _sellDevFee; sellTotalFees = sellMarketingFee + sellLiquidityFee + sellDevFee; earlySellLiquidityFee = _earlySellLiquidityFee; earlySellMarketingFee = _earlySellMarketingFee; excludeFromFees(owner(), true); excludeFromFees(address(this), true); excludeFromFees(address(0xdead), true); excludeFromMaxTransaction(owner(), true); excludeFromMaxTransaction(address(this), true); excludeFromMaxTransaction(address(0xdead), true); _mint is an internal function in ERC20.sol that is only called here, and CANNOT be called ever again _mint(msg.sender, totalSupply);
9,358,075
[ 1, 10157, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3885, 1435, 4232, 39, 3462, 2932, 1294, 355, 383, 7037, 3113, 315, 37, 20661, 7923, 288, 203, 7010, 3639, 467, 984, 291, 91, 438, 58, 22, 8259, 3103, 389, 318, 291, 91, 438, 58, 22, 8259, 273, 467, 984, 291, 91, 438, 58, 22, 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, 7010, 3639, 4433, 1265, 2747, 3342, 12, 2867, 24899, 318, 291, 91, 438, 58, 22, 8259, 3631, 638, 1769, 203, 3639, 640, 291, 91, 438, 58, 22, 8259, 273, 389, 318, 291, 91, 438, 58, 22, 8259, 31, 203, 7010, 3639, 640, 291, 91, 438, 58, 22, 4154, 273, 467, 984, 291, 91, 438, 58, 22, 1733, 24899, 318, 291, 91, 438, 58, 22, 8259, 18, 6848, 1435, 2934, 2640, 4154, 12, 2867, 12, 2211, 3631, 389, 318, 291, 91, 438, 58, 22, 8259, 18, 59, 1584, 44, 10663, 203, 3639, 4433, 1265, 2747, 3342, 12, 2867, 12, 318, 291, 91, 438, 58, 22, 4154, 3631, 638, 1769, 203, 3639, 389, 542, 22932, 690, 3882, 278, 12373, 4154, 12, 2867, 12, 318, 291, 91, 438, 58, 22, 4154, 3631, 638, 1769, 203, 7010, 3639, 2254, 5034, 389, 70, 9835, 3882, 21747, 14667, 273, 404, 31, 203, 3639, 2254, 5034, 389, 70, 9835, 48, 18988, 24237, 14667, 273, 404, 31, 203, 3639, 2254, 5034, 389, 70, 9835, 8870, 14667, 273, 404, 31, 203, 2 ]
// SPDX-License-Identifier: MIT pragma solidity ^0.6.8; import '@openzeppelin/contracts/GSN/Context.sol'; import '@openzeppelin/contracts/access/AccessControl.sol'; import './StakableTokenWrapper.sol'; import '../ERC1155/CryptoKombatCollection.sol'; contract LpPool is Context, StakableTokenWrapper, AccessControl { CryptoKombatCollection public collection; uint256 public maxStake; mapping(address => uint256) public lastUpdateTime; mapping(address => uint256) public points; mapping(uint256 => uint256) public heroes; event MaxStakeChanged(uint256 maxStake); event HeroAdded(uint256 hero, uint256 price); event HeroesAdded(uint256[] heroes, uint256[] prices); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event Redeemed(address indexed user, uint256 amount); modifier updateReward(address account) { if (account != address(0)) { points[account] = earned(account); lastUpdateTime[account] = block.timestamp; } _; } constructor( CryptoKombatCollection _collectionAddress, IERC20 _tokenAddress, uint256 _maxStake ) public StakableTokenWrapper(_tokenAddress) { collection = _collectionAddress; _setMaxStake(_maxStake); _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); } function addHero(uint256 heroId, uint256 price) public virtual { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), 'LpPool: Must have admin role to add hero'); require(price >= 1e18, 'LpPool: Price too low'); heroes[heroId] = price; emit HeroAdded(heroId, price); } function addHeroes(uint256[] memory _heroes, uint256[] memory _prices) public virtual { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), 'LpPool: Must have admin role to add heroes'); require(_heroes.length == _prices.length, 'LpPool: Heroes and prices length mismatch'); for (uint256 i = 0; i < _heroes.length; i++) { uint256 heroId = _heroes[i]; uint256 price = _prices[i]; require(price >= 1e18, 'LpPool: Price too low'); heroes[heroId] = price; } emit HeroesAdded(_heroes, _prices); } function setMaxStake(uint256 _maxStake) public virtual { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), 'LpPool: Must have admin role to set max stake'); require(_maxStake > 0, 'LpPool: Cannot set zero max stake'); _setMaxStake(_maxStake); } function _setMaxStake(uint256 _maxStake) internal { maxStake = _maxStake; emit MaxStakeChanged(_maxStake); } function earned(address account) public view returns (uint256) { uint256 blockTime = block.timestamp; return points[account].add( blockTime.sub(lastUpdateTime[account]).mul(1e18).div(86400).mul( (balanceOf(account).mul(14290)).div(1e18) ) ); } function stake(uint256 amount) public override updateReward(_msgSender()) { require(amount > 0, 'LpPool: Cannot stake zero amount'); require(amount.add(balanceOf(_msgSender())) <= maxStake, 'LpPool: Cannot stake more than max stake'); super.stake(amount); emit Staked(_msgSender(), amount); } function withdraw(uint256 amount) public override updateReward(_msgSender()) { require(amount > 0, 'LpPool: Cannot withdraw zero amount'); super.withdraw(amount); emit Withdrawn(_msgSender(), amount); } function exit() external { withdraw(balanceOf(_msgSender())); } function redeem(uint256 hero) public updateReward(_msgSender()) { require(heroes[hero] != 0, 'LpPool: Hero not found'); require(points[_msgSender()] >= heroes[hero], 'LpPool: Not enough Vombats to redeem for hero'); require(collection.totalSupply(hero) < collection.maxSupply(hero), 'LpPool: Max heroes minted'); points[_msgSender()] = points[_msgSender()].sub(heroes[hero]); collection.mint(_msgSender(), hero, 1, ''); emit Redeemed(_msgSender(), heroes[hero]); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/EnumerableSet.sol"; import "../utils/Address.sol"; import "../utils/Context.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context { using EnumerableSet for EnumerableSet.AddressSet; using Address for address; struct RoleData { EnumerableSet.AddressSet members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @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 {_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) public view returns (bool) { return _roles[role].members.contains(account); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view returns (address) { return _roles[role].members.at(index); } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view 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 { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual { 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 { emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (_roles[role].members.add(account)) { emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.8; import '@openzeppelin/contracts/GSN/Context.sol'; import '@openzeppelin/contracts/math/SafeMath.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; contract StakableTokenWrapper is Context { using SafeMath for uint256; IERC20 public token; constructor(IERC20 _tokenAddress) public { token = IERC20(_tokenAddress); } uint256 private _totalSupply; mapping(address => uint256) private _balances; function totalSupply() public 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[_msgSender()] = _balances[_msgSender()].add(amount); token.transferFrom(_msgSender(), address(this), amount); } function withdraw(uint256 amount) public virtual { _totalSupply = _totalSupply.sub(amount); _balances[_msgSender()] = _balances[_msgSender()].sub(amount); token.transfer(_msgSender(), amount); } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.8; import './ERC1155Tradable.sol'; contract CryptoKombatCollection is ERC1155Tradable { constructor(string memory _baseUri, address _proxyRegistryAddress) public ERC1155Tradable('Crypto Kombat Collection', 'CKC', _proxyRegistryAddress) { _setBaseMetadataURI(_baseUri); } function contractURI() public pure returns (string memory) { return 'https://api.cryptokombat.com/contract/cryptokombat-erc1155'; } } // 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: MIT 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)); } } // 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 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; /** * @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.8; import '@openzeppelin/contracts/access/AccessControl.sol'; import '@openzeppelin/contracts/GSN/Context.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import './ERC1155.sol'; import '../utils/Strings.sol'; contract OwnableDelegateProxy {} contract ProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies; } /** * @title ERC1155Tradable * ERC1155Tradable - ERC1155 contract that whitelists an operator address, * has create and mint functionality, and supports useful standards from OpenZeppelin, like _exists(), name(), symbol(), and totalSupply() */ contract ERC1155Tradable is Context, AccessControl, Ownable, ERC1155 { bytes32 public constant MINTER_ROLE = keccak256('MINTER_ROLE'); using Strings for string; string internal baseMetadataURI; address proxyRegistryAddress; uint256 private _currentTokenID = 0; mapping(uint256 => address) public creators; mapping(uint256 => uint256) public tokenSupply; mapping(uint256 => uint256) public tokenMaxSupply; // Contract name string public name; // Contract symbol string public symbol; constructor( string memory _name, string memory _symbol, address _proxyRegistryAddress ) public ERC1155('') { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); name = _name; symbol = _symbol; proxyRegistryAddress = _proxyRegistryAddress; } modifier onlyAdminOrOwner() { require( hasRole(DEFAULT_ADMIN_ROLE, _msgSender()) || (owner() == _msgSender()), 'ERC1155Tradable: must have admin or owner role' ); _; } modifier onlyMinter() { require(hasRole(MINTER_ROLE, _msgSender()), 'ERC1155Tradable: must have minter role'); _; } function uri(uint256 _id) public view override returns (string memory) { require(_exists(_id), 'ERC1155Tradable: token must exists'); return Strings.strConcat(baseMetadataURI, Strings.uint2str(_id)); } /** * @dev Returns the total quantity for a token ID * @param _id uint256 ID of the token to query * @return amount of token in existence */ function totalSupply(uint256 _id) public view returns (uint256) { return tokenSupply[_id]; } /** * @dev Returns the max quantity for a token ID * @param _id uint256 ID of the token to query * @return amount of token in existence */ function maxSupply(uint256 _id) public view returns (uint256) { return tokenMaxSupply[_id]; } /** * @dev Will update the base URL of token's URI * @param _newBaseMetadataURI New base URL of token's URI */ function setBaseMetadataURI(string memory _newBaseMetadataURI) public onlyAdminOrOwner { _setBaseMetadataURI(_newBaseMetadataURI); } /** * @dev Creates a new token type and assigns _initial to a sender * @param _max max supply allowed * @param _initial Optional amount to supply the first owner * @param _data Optional data to pass if receiver is contract * @return tokenId The newly created token ID */ function create( uint256 _max, uint256 _initial, bytes memory _data ) external onlyAdminOrOwner returns (uint256 tokenId) { //TODO Need to test lte condition require(_initial <= _max, 'ERC1155Tradable: Initial supply cannot be more than max supply'); uint256 id = _getNextTokenID(); _incrementTokenTypeId(); creators[id] = _msgSender(); if (_initial != 0) { _mint(_msgSender(), id, _initial, _data); } tokenSupply[id] = _initial; tokenMaxSupply[id] = _max; return id; } /** * @dev Creates some amount of tokens type and assigns initials to a sender * @param _maxs max supply allowed * @param _initials Optional amount to supply the first owner */ function createBatch( uint256[] memory _maxs, uint256[] memory _initials, bytes memory _data ) external onlyAdminOrOwner { require(_maxs.length == _initials.length, 'ERC1155Tradable: maxs and initials length mismatch'); uint256[] memory ids = new uint256[](_maxs.length); uint256[] memory quantities = new uint256[](_maxs.length); for (uint256 i = 0; i < _maxs.length; i++) { uint256 max = _maxs[i]; uint256 initial = _initials[i]; //TODO Need to test lte condition require(initial <= max, 'ERC1155Tradable: Initial supply cannot be more than max supply'); uint256 tokenId = _getNextTokenID(); _incrementTokenTypeId(); creators[tokenId] = _msgSender(); tokenSupply[tokenId] = initial; tokenMaxSupply[tokenId] = max; ids[i] = tokenId; quantities[i] = initial; } _mintBatch(_msgSender(), ids, quantities, _data); } /** * @dev Mints some amount of tokens to an address * @param _to Address of the future owner of the token * @param _id Token ID to mint * @param _quantity Amount of tokens to mint * @param _data Data to pass if receiver is contract */ function mint( address _to, uint256 _id, uint256 _quantity, bytes memory _data ) public onlyMinter { //TODO Need to test lte condition require(tokenSupply[_id].add(_quantity) <= tokenMaxSupply[_id], 'ERC1155Tradable: Max supply reached'); tokenSupply[_id] = tokenSupply[_id].add(_quantity); _mint(_to, _id, _quantity, _data); } /** * @dev Mint tokens for each id in _ids * @param _to The address to mint tokens to * @param _ids Array of ids to mint * @param _quantities Array of amounts of tokens to mint per id * @param _data Data to pass if receiver is contract */ function mintBatch( address _to, uint256[] memory _ids, uint256[] memory _quantities, bytes memory _data ) public onlyMinter { require(_to != address(0), 'ERC1155Tradable: mint to the zero address'); require(_ids.length == _quantities.length, 'ERC1155Tradable: ids and amounts length mismatch'); for (uint256 i = 0; i < _ids.length; i++) { uint256 id = _ids[i]; uint256 quantity = _quantities[i]; //TODO Need to test lte condition require(tokenSupply[id].add(quantity) <= tokenMaxSupply[id], 'ERC1155Tradable: Max supply reached'); tokenSupply[id] = tokenSupply[id].add(quantity); } _mintBatch(_to, _ids, _quantities, _data); } /** * Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-free listings. */ function isApprovedForAll(address _owner, address _operator) public view override returns (bool isOperator) { // Whitelist OpenSea proxy contract for easy trading. ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if (address(proxyRegistry.proxies(_owner)) == _operator) { return true; } return ERC1155.isApprovedForAll(_owner, _operator); } /** * @dev Returns whether the specified token exists by checking to see if it has a creator * @param _id uint256 ID of the token to query the existence of * @return bool whether the token exists */ function _exists(uint256 _id) internal view returns (bool) { return creators[_id] != address(0); } /** * @dev calculates the next token ID based on value of _currentTokenID * @return uint256 for the next token ID */ function _getNextTokenID() private view returns (uint256) { return _currentTokenID.add(1); } /** * @dev increments the value of _currentTokenID */ function _incrementTokenTypeId() private { _currentTokenID++; } /** * @notice Will update the base URL of token's URI * @param _newBaseMetadataURI New base URL of token's URI */ function _setBaseMetadataURI(string memory _newBaseMetadataURI) internal { baseMetadataURI = _newBaseMetadataURI; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <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 () internal { 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; } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.8; import '@openzeppelin/contracts/token/ERC1155/IERC1155.sol'; import '@openzeppelin/contracts/token/ERC1155/IERC1155MetadataURI.sol'; import '@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol'; import '@openzeppelin/contracts/GSN/Context.sol'; import '@openzeppelin/contracts/introspection/ERC165.sol'; import '@openzeppelin/contracts/math/SafeMath.sol'; import '@openzeppelin/contracts/utils/Address.sol'; /** * * @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 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 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) { require(accounts[i] != address(0), 'ERC1155: batch balance query for the zero address'); batchBalances[i] = _balances[ids[i]][accounts[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 `to` 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 (uint256 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 (uint256 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; } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.8; library Strings { // via https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.5.sol function strConcat( string memory _a, string memory _b, string memory _c, string memory _d, string memory _e ) internal pure returns (string memory) { bytes memory _ba = bytes(_a); bytes memory _bb = bytes(_b); bytes memory _bc = bytes(_c); bytes memory _bd = bytes(_d); bytes memory _be = bytes(_e); string memory abcde = new string( _ba.length + _bb.length + _bc.length + _bd.length + _be.length ); bytes memory babcde = bytes(abcde); uint256 k = 0; for (uint256 i = 0; i < _ba.length; i++) babcde[k++] = _ba[i]; for (uint256 i = 0; i < _bb.length; i++) babcde[k++] = _bb[i]; for (uint256 i = 0; i < _bc.length; i++) babcde[k++] = _bc[i]; for (uint256 i = 0; i < _bd.length; i++) babcde[k++] = _bd[i]; for (uint256 i = 0; i < _be.length; i++) babcde[k++] = _be[i]; return string(babcde); } function strConcat( string memory _a, string memory _b, string memory _c, string memory _d ) internal pure returns (string memory) { return strConcat(_a, _b, _c, _d, ""); } function strConcat( string memory _a, string memory _b, string memory _c ) internal pure returns (string memory) { return strConcat(_a, _b, _c, "", ""); } function strConcat(string memory _a, string memory _b) internal pure returns (string memory) { return strConcat(_a, _b, "", "", ""); } function uint2str(uint256 _i) internal pure returns (string memory _uintAsString) { if (_i == 0) { return "0"; } uint256 j = _i; uint256 len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint256 k = len - 1; while (_i != 0) { bstr[k--] = bytes1(uint8(48 + (_i % 10))); _i /= 10; } return string(bstr); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "../../introspection/IERC165.sol"; /** * @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; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC1155.sol"; /** * @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); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../introspection/IERC165.sol"; /** * _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); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC165.sol"; /** * @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; } } // 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); }
* @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); }
197,692
[ 1, 9704, 288, 45, 654, 39, 2499, 2539, 17, 4626, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 4183, 5912, 1265, 12, 203, 3639, 1758, 628, 16, 203, 3639, 1758, 358, 16, 203, 3639, 2254, 5034, 612, 16, 203, 3639, 2254, 5034, 3844, 16, 203, 3639, 1731, 3778, 501, 203, 565, 262, 1071, 5024, 3849, 288, 203, 3639, 2583, 12, 869, 480, 1758, 12, 20, 3631, 296, 654, 39, 2499, 2539, 30, 7412, 358, 326, 3634, 1758, 8284, 203, 3639, 2583, 12, 203, 5411, 628, 422, 389, 3576, 12021, 1435, 747, 353, 31639, 1290, 1595, 12, 2080, 16, 389, 3576, 12021, 1435, 3631, 203, 5411, 296, 654, 39, 2499, 2539, 30, 4894, 353, 486, 3410, 12517, 20412, 11, 203, 3639, 11272, 203, 203, 3639, 1758, 3726, 273, 389, 3576, 12021, 5621, 203, 203, 3639, 389, 5771, 1345, 5912, 12, 9497, 16, 628, 16, 358, 16, 389, 345, 19571, 1076, 12, 350, 3631, 389, 345, 19571, 1076, 12, 8949, 3631, 501, 1769, 203, 203, 3639, 389, 70, 26488, 63, 350, 6362, 2080, 65, 273, 389, 70, 26488, 63, 350, 6362, 2080, 8009, 1717, 12, 8949, 16, 296, 654, 39, 2499, 2539, 30, 2763, 11339, 11013, 364, 7412, 8284, 203, 3639, 389, 70, 26488, 63, 350, 6362, 869, 65, 273, 389, 70, 26488, 63, 350, 6362, 869, 8009, 1289, 12, 8949, 1769, 203, 203, 3639, 3626, 12279, 5281, 12, 9497, 16, 628, 16, 358, 16, 612, 16, 3844, 1769, 203, 203, 3639, 389, 2896, 9890, 5912, 5933, 1359, 1564, 12, 9497, 16, 628, 16, 358, 16, 612, 16, 3844, 16, 501, 1769, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100 ]
pragma solidity ^0.5.12; library SafeMath { function MUL98(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING if (a == 0) return 0; uint256 c = a * b; require(c / a == b); return c; } function DIV107(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING require(b > 0); uint256 c = a / b; return c; } function SUB705(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING require(b <= a); uint256 c = a - b; return c; } function ADD235(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING uint256 c = a + b; require(c >= a); return c; } function MOD157(uint256 a, uint256 b) internal pure returns (uint256) { //inject NONSTANDARD NAMING require(b != 0); return a % b; } } contract ERC20 { using SafeMath for uint256; mapping (address => uint256) internal _balances; mapping (address => mapping (address => uint256)) internal _allowed; event TRANSFER731(address indexed from, address indexed to, uint256 value); //inject NONSTANDARD NAMING event APPROVAL787(address indexed owner, address indexed spender, uint256 value); //inject NONSTANDARD NAMING uint256 internal _totalSupply; function TOTALSUPPLY882() public view returns (uint256) { //inject NONSTANDARD NAMING return _totalSupply; } function BALANCEOF767(address owner) public view returns (uint256) { //inject NONSTANDARD NAMING return _balances[owner]; } function ALLOWANCE10(address owner, address spender) public view returns (uint256) { //inject NONSTANDARD NAMING return _allowed[owner][spender]; } function TRANSFER204(address to, uint256 value) public returns (bool) { //inject NONSTANDARD NAMING _TRANSFER522(msg.sender, to, value); return true; } function APPROVE277(address spender, uint256 value) public returns (bool) { //inject NONSTANDARD NAMING _allowed[msg.sender][spender] = value; emit APPROVAL787(msg.sender, spender, value); return true; } function TRANSFERFROM832(address from, address to, uint256 value) public returns (bool) { //inject NONSTANDARD NAMING _TRANSFER522(from, to, value); _allowed[msg.sender][to] = _allowed[msg.sender][to].SUB705(value); return true; } function _TRANSFER522(address from, address to, uint256 value) internal { //inject NONSTANDARD NAMING require(to != address(0)); _balances[from] = _balances[from].SUB705(value); _balances[to] = _balances[to].ADD235(value); emit TRANSFER731(from, to, value); } } contract ERC20Mintable is ERC20 { string public name; string public symbol; uint8 public decimals; function _MINT321(address to, uint256 amount) internal { //inject NONSTANDARD NAMING _balances[to] = _balances[to].ADD235(amount); _totalSupply = _totalSupply.ADD235(amount); emit TRANSFER731(address(0), to, amount); } function _BURN441(address from, uint256 amount) internal { //inject NONSTANDARD NAMING _balances[from] = _balances[from].SUB705(amount); _totalSupply = _totalSupply.SUB705(amount); emit TRANSFER731(from, address(0), amount); } } // ----------- Aave ---------------- contract ILendingPoolAddressesProvider { function GETLENDINGPOOL38() public view returns (address); //inject NONSTANDARD NAMING function SETLENDINGPOOLIMPL881(address _pool) public; //inject NONSTANDARD NAMING function GETLENDINGPOOLCORE21() public view returns (address payable); //inject NONSTANDARD NAMING function SETLENDINGPOOLCOREIMPL156(address _lendingPoolCore) public; //inject NONSTANDARD NAMING function GETLENDINGPOOLCONFIGURATOR254() public view returns (address); //inject NONSTANDARD NAMING function SETLENDINGPOOLCONFIGURATORIMPL555(address _configurator) public; //inject NONSTANDARD NAMING function GETLENDINGPOOLDATAPROVIDER61() public view returns (address); //inject NONSTANDARD NAMING function SETLENDINGPOOLDATAPROVIDERIMPL193(address _provider) public; //inject NONSTANDARD NAMING function GETLENDINGPOOLPARAMETERSPROVIDER362() public view returns (address); //inject NONSTANDARD NAMING function SETLENDINGPOOLPARAMETERSPROVIDERIMPL978(address _parametersProvider) public; //inject NONSTANDARD NAMING function GETTOKENDISTRIBUTOR827() public view returns (address); //inject NONSTANDARD NAMING function SETTOKENDISTRIBUTOR348(address _tokenDistributor) public; //inject NONSTANDARD NAMING function GETFEEPROVIDER168() public view returns (address); //inject NONSTANDARD NAMING function SETFEEPROVIDERIMPL718(address _feeProvider) public; //inject NONSTANDARD NAMING function GETLENDINGPOOLLIQUIDATIONMANAGER82() public view returns (address); //inject NONSTANDARD NAMING function SETLENDINGPOOLLIQUIDATIONMANAGER708(address _manager) public; //inject NONSTANDARD NAMING function GETLENDINGPOOLMANAGER762() public view returns (address); //inject NONSTANDARD NAMING function SETLENDINGPOOLMANAGER882(address _lendingPoolManager) public; //inject NONSTANDARD NAMING function GETPRICEORACLE485() public view returns (address); //inject NONSTANDARD NAMING function SETPRICEORACLE428(address _priceOracle) public; //inject NONSTANDARD NAMING function GETLENDINGRATEORACLE592() public view returns (address); //inject NONSTANDARD NAMING function SETLENDINGRATEORACLE655(address _lendingRateOracle) public; //inject NONSTANDARD NAMING } interface ILendingPool { function ADDRESSESPROVIDER344() external view returns(address); //inject NONSTANDARD NAMING function DEPOSIT818(address _reserve, uint256 _amount, uint16 _referralCode) external payable; //inject NONSTANDARD NAMING function REDEEMUNDERLYING805(address _reserve, address _user, uint256 _amount) external; //inject NONSTANDARD NAMING function BORROW264(address _reserve, uint256 _amount, uint256 _interestRateMode, uint16 _referralCode) external; //inject NONSTANDARD NAMING function REPAY662(address _reserve, uint256 _amount, address _onBehalfOf) external payable; //inject NONSTANDARD NAMING function SWAPBORROWRATEMODE766(address _reserve) external; //inject NONSTANDARD NAMING function REBALANCEFIXEDBORROWRATE627(address _reserve, address _user) external; //inject NONSTANDARD NAMING function SETUSERUSERESERVEASCOLLATERAL986(address _reserve, bool _useAsCollateral) external; //inject NONSTANDARD NAMING function LIQUIDATIONCALL807(address _collateral, address _reserve, address _user, uint256 _purchaseAmount, bool _receiveAToken) external payable; //inject NONSTANDARD NAMING function FLASHLOAN206(address _receiver, address _reserve, uint256 _amount, bytes calldata _params) external; //inject NONSTANDARD NAMING function GETRESERVECONFIGURATIONDATA59(address _reserve) external view returns(uint256 ltv, uint256 liquidationThreshold, uint256 liquidationDiscount, address interestRateStrategyAddress, bool usageAsCollateralEnabled, bool borrowingEnabled, bool fixedBorrowRateEnabled, bool isActive); //inject NONSTANDARD NAMING function GETRESERVEDATA692(address _reserve) external view returns(uint256 totalLiquidity, uint256 availableLiquidity, uint256 totalBorrowsFixed, uint256 totalBorrowsVariable, uint256 liquidityRate, uint256 variableBorrowRate, uint256 fixedBorrowRate, uint256 averageFixedBorrowRate, uint256 utilizationRate, uint256 liquidityIndex, uint256 variableBorrowIndex, address aTokenAddress, uint40 lastUpdateTimestamp); //inject NONSTANDARD NAMING function GETUSERACCOUNTDATA811(address _user) external view returns(uint256 totalLiquidityETH, uint256 totalCollateralETH, uint256 totalBorrowsETH, uint256 availableBorrowsETH, uint256 currentLiquidationThreshold, uint256 ltv, uint256 healthFactor); //inject NONSTANDARD NAMING function GETUSERRESERVEDATA732(address _reserve, address _user) external view returns(uint256 currentATokenBalance, uint256 currentBorrowBalance, uint256 principalBorrowBalance, uint256 borrowRateMode, uint256 borrowRate, uint256 liquidityRate, uint256 originationFee, uint256 variableBorrowIndex, uint256 lastUpdateTimestamp, bool usageAsCollateralEnabled); //inject NONSTANDARD NAMING function GETRESERVES689() external view; //inject NONSTANDARD NAMING } interface ILendingPoolCore { function GETRESERVEATOKENADDRESS314(address _reserve) external view returns (address); //inject NONSTANDARD NAMING function GETRESERVECURRENTVARIABLEBORROWRATE762(address _token) external view returns (uint256); //inject NONSTANDARD NAMING function GETRESERVECURRENTLIQUIDITYRATE636(address _token) external view returns (uint256); //inject NONSTANDARD NAMING } interface IAavePriceOracleGetter { function GETASSETPRICE734(address _asset) external view returns (uint256); //inject NONSTANDARD NAMING function GETASSETSPRICES996(address[] calldata _assets) external view returns(uint256[] memory); //inject NONSTANDARD NAMING function GETSOURCEOFASSET324(address _asset) external view returns(address); //inject NONSTANDARD NAMING function GETFALLBACKORACLE535() external view returns(address); //inject NONSTANDARD NAMING } interface IAToken { function REDIRECTINTERESTSTREAM242(address _to) external; //inject NONSTANDARD NAMING function REDIRECTINTERESTSTREAMOF292(address _from, address _to) external; //inject NONSTANDARD NAMING function ALLOWINTERESTREDIRECTIONTO292(address _to) external; //inject NONSTANDARD NAMING function REDEEM632(uint256 _amount) external; //inject NONSTANDARD NAMING function PRINCIPALBALANCEOF100(address _user) external view returns(uint256); //inject NONSTANDARD NAMING function ISTRANSFERALLOWED396(address _user, uint256 _amount) external view returns (bool); //inject NONSTANDARD NAMING function GETUSERINDEX768(address _user) external view returns(uint256); //inject NONSTANDARD NAMING function GETINTERESTREDIRECTIONADDRESS228(address _user) external view returns(address); //inject NONSTANDARD NAMING function GETREDIRECTEDBALANCE288(address _user) external view returns(uint256); //inject NONSTANDARD NAMING function TOTALSUPPLY882() external view returns (uint256 supply); //inject NONSTANDARD NAMING function BALANCEOF767(address _owner) external view returns (uint256 balance); //inject NONSTANDARD NAMING function TRANSFER204(address _to, uint256 _value) external returns (bool success); //inject NONSTANDARD NAMING function TRANSFERFROM832(address _from, address _to, uint256 _value) external returns (bool success); //inject NONSTANDARD NAMING function APPROVE277(address _spender, uint256 _value) external returns (bool success); //inject NONSTANDARD NAMING function ALLOWANCE10(address _owner, address _spender) external view returns (uint256 remaining); //inject NONSTANDARD NAMING function NAME858() external view returns (string memory); //inject NONSTANDARD NAMING function SYMBOL894() external view returns (string memory); //inject NONSTANDARD NAMING function DECIMALS454() external view returns (uint8); //inject NONSTANDARD NAMING } interface PriceOracle { function GETUNDERLYINGPRICE929(address) external view returns (uint256); //inject NONSTANDARD NAMING } // ---------- Compound ---------- interface CErc20 { function BORROW264(uint256) external returns (uint256); //inject NONSTANDARD NAMING function BORROWRATEPERBLOCK388() external view returns (uint256); //inject NONSTANDARD NAMING function BORROWBALANCECURRENT444(address) external returns (uint256); //inject NONSTANDARD NAMING function REPAYBORROW515(uint256) external returns (uint256); //inject NONSTANDARD NAMING } interface CEth { function MINT397() external payable; //inject NONSTANDARD NAMING function REDEEMUNDERLYING805(uint redeemAmount) external returns (uint256); //inject NONSTANDARD NAMING function BALANCEOFUNDERLYING788(address owner) external returns (uint256); //inject NONSTANDARD NAMING function SUPPLYRATEPERBLOCK15() external view returns (uint256); //inject NONSTANDARD NAMING } interface Comptroller { function MARKETS249(address) external returns (bool, uint256); //inject NONSTANDARD NAMING function ENTERMARKETS82(address[] calldata) //inject NONSTANDARD NAMING external returns (uint256[] memory); function GETACCOUNTLIQUIDITY384(address) //inject NONSTANDARD NAMING external view returns (uint256, uint256, uint256); function ORACLE168() external view returns(address); //inject NONSTANDARD NAMING } // ---------- kyber ---------- interface Exchange { function TRADE301( //inject NONSTANDARD NAMING address src, uint srcAmount, address dest, address destAddress, uint maxDestAmount, uint minConversionRate, address walletId )external payable returns(uint); } // -----tCDP----- contract tCDPConstants { uint256 constant dust264 = 1e6; // minimum mint amount //inject NONSTANDARD NAMING ERC20 constant dai445 = ERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F); // DAI(debt) token address //inject NONSTANDARD NAMING //Compound Comptroller constant comptroller75 = Comptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); //inject NONSTANDARD NAMING CEth constant ceth501 = CEth(0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5); //inject NONSTANDARD NAMING CErc20 constant cdai61 = CErc20(0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643); //inject NONSTANDARD NAMING //AAVE ILendingPoolAddressesProvider constant addressesprovider654 = ILendingPoolAddressesProvider(0x24a42fD28C976A61Df5D00D0599C34c4f90748c8); //inject NONSTANDARD NAMING uint16 constant referral215 = 47; // TODO: apply new referral code //inject NONSTANDARD NAMING //Kyber Exchange constant kybernetwork927 = Exchange(0x818E6FECD516Ecc3849DAf6845e3EC868087B755); //inject NONSTANDARD NAMING address constant etheraddr36 = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; //inject NONSTANDARD NAMING address constant ref472 = 0xD0533664013a82c31584B7FFDB215139f38Ad77A; //inject NONSTANDARD NAMING //rebalance target/boundary/size uint256 constant targetratio559 = 0.4e18; //40% //inject NONSTANDARD NAMING uint256 constant upperbound23 = 444444444444444444; // 1/225% //inject NONSTANDARD NAMING uint256 constant lowerbound414 = 363636363636363636; // 1/275% //inject NONSTANDARD NAMING uint256 constant bite558 = 0.025 * 1e18; //2.5% //inject NONSTANDARD NAMING } contract tCDP is ERC20Mintable, tCDPConstants{ using SafeMath for *; bool public isCompound; event MIGRATION431(uint8); // 0x01 = to Compound, 0x02 = to Aave //inject NONSTANDARD NAMING constructor() public { symbol = "tETH-DAI"; name = "tokenized CDP ETH-DAI v1"; decimals = 18; address lendingPoolCoreAddress = addressesprovider654.GETLENDINGPOOLCORE21(); dai445.APPROVE277(lendingPoolCoreAddress, uint256(-1)); dai445.APPROVE277(address(cdai61), uint256(-1)); address[] memory cTokens = new address[](1); cTokens[0] = address(ceth501); uint256[] memory errors = comptroller75.ENTERMARKETS82(cTokens); require(errors[0] == 0, "Comptroller.enterMarkets failed."); dai445.APPROVE277(address(kybernetwork927), uint256(-1)); isCompound = FINDBESTRATE616(); } function INITIATE270(uint256 amount) external payable { //inject NONSTANDARD NAMING require(_totalSupply < dust264, "initiated"); require(msg.value > dust264, "value too small"); if(isCompound) { ceth501.MINT397.value(msg.value)(); _MINT321(msg.sender, msg.value); require(cdai61.BORROW264(amount) == 0, "borrow failed"); dai445.TRANSFER204(msg.sender, amount); } else { ILendingPool lendingPool = ILendingPool(addressesprovider654.GETLENDINGPOOL38()); lendingPool.DEPOSIT818.value(msg.value)(etheraddr36, msg.value, referral215); _MINT321(msg.sender, msg.value); lendingPool.BORROW264(address(dai445), amount, 2, referral215); dai445.TRANSFER204(msg.sender, amount); } } function COLLATERAL797() public returns(uint256) { //inject NONSTANDARD NAMING if(isCompound) { return ceth501.BALANCEOFUNDERLYING788(address(this)); } else { address lendingPoolCore = addressesprovider654.GETLENDINGPOOLCORE21(); address aETH = ILendingPoolCore(lendingPoolCore).GETRESERVEATOKENADDRESS314(etheraddr36); return IAToken(aETH).BALANCEOF767(address(this)); } } function DEBT567() public returns(uint256) { //inject NONSTANDARD NAMING if(isCompound) { return cdai61.BORROWBALANCECURRENT444(address(this)); } else { ILendingPool lendingPool = ILendingPool(addressesprovider654.GETLENDINGPOOL38()); (, uint256 borrowBalance,,,,,,,,) = lendingPool.GETUSERRESERVEDATA732(address(dai445), address(this)); return borrowBalance; } } function MINT397() external payable returns(uint256) { //inject NONSTANDARD NAMING require(_totalSupply >= dust264, "not initiated"); uint256 amount = msg.value; uint256 tokenToMint = _totalSupply.MUL98(amount).DIV107(COLLATERAL797()); uint256 tokenToBorrow = DEBT567().MUL98(amount).DIV107(COLLATERAL797()); _MINT321(msg.sender, tokenToMint); if(isCompound) { ceth501.MINT397.value(amount)(); require(cdai61.BORROW264(tokenToBorrow) == 0, "borrow failed"); dai445.TRANSFER204(msg.sender, tokenToBorrow); } else{ // deposit ILendingPool lendingPool = ILendingPool(addressesprovider654.GETLENDINGPOOL38()); lendingPool.DEPOSIT818.value(amount)(etheraddr36, amount, referral215); // borrow lendingPool.BORROW264(address(dai445), tokenToBorrow, 2, referral215); // transfer dai445.TRANSFER204(msg.sender, tokenToBorrow); } return tokenToMint; } function BURN250(uint256 amount) external { //inject NONSTANDARD NAMING uint256 tokenToRepay = amount.MUL98(DEBT567()).DIV107(_totalSupply); uint256 tokenToDraw = amount.MUL98(COLLATERAL797()).DIV107(_totalSupply); _BURN441(msg.sender, amount); dai445.TRANSFERFROM832(msg.sender, address(this), tokenToRepay); if(isCompound) { require(cdai61.REPAYBORROW515(tokenToRepay) == 0, "repay failed"); require(ceth501.REDEEMUNDERLYING805(tokenToDraw) == 0, "redeem failed"); } else { // repay ILendingPool lendingPool = ILendingPool(addressesprovider654.GETLENDINGPOOL38()); address lendingPoolCoreAddress = addressesprovider654.GETLENDINGPOOLCORE21(); // Dai.approve(lendingPoolCoreAddress, tokenToRepay); lendingPool.REPAY662(address(dai445), tokenToRepay, address(this)); // redeem IAToken aETH = IAToken(ILendingPoolCore(lendingPoolCoreAddress).GETRESERVEATOKENADDRESS314(etheraddr36)); aETH.REDEEM632(tokenToDraw); } (bool success, ) = msg.sender.call.value(tokenToDraw)(""); require(success, "Failed to transfer ether to msg.sender"); } function() external payable{} //true if (cEth APR - cDai APR) >= (aEth APR - aDai APR), otherwise, false function FINDBESTRATE616() public view returns (bool) { //inject NONSTANDARD NAMING return AAVEDAIAPR797().MUL98(targetratio559).DIV107(1e18).ADD235(COMPOUNDETHAPR912()) > COMPOUNDDAIAPR961().MUL98(targetratio559).DIV107(1e18).ADD235(AAVEETHAPR160()); } function COMPOUNDDAIAPR961() public view returns (uint256) { //inject NONSTANDARD NAMING return cdai61.BORROWRATEPERBLOCK388().MUL98(2102400); } function COMPOUNDETHAPR912() public view returns (uint256) { //inject NONSTANDARD NAMING return ceth501.SUPPLYRATEPERBLOCK15().MUL98(2102400); } function AAVEDAIAPR797() public view returns (uint256) { //inject NONSTANDARD NAMING ILendingPoolCore core = ILendingPoolCore(addressesprovider654.GETLENDINGPOOLCORE21()); return core.GETRESERVECURRENTVARIABLEBORROWRATE762(address(dai445)).DIV107(1e9); } function AAVEETHAPR160() public view returns (uint256) { //inject NONSTANDARD NAMING ILendingPoolCore core = ILendingPoolCore(addressesprovider654.GETLENDINGPOOLCORE21()); return core.GETRESERVECURRENTLIQUIDITYRATE636(etheraddr36).DIV107(1e9); } function GETUNDERLYINGPRICE929() public view returns(uint256) { //inject NONSTANDARD NAMING uint256 price; if(isCompound) { address oracle = comptroller75.ORACLE168(); PriceOracle priceOracle = PriceOracle(oracle); price = priceOracle.GETUNDERLYINGPRICE929(address(cdai61)); } else { address oracleAddress = addressesprovider654.GETPRICEORACLE485(); IAavePriceOracleGetter priceOracle = IAavePriceOracleGetter(oracleAddress); price = priceOracle.GETASSETPRICE734(address(dai445)); } return price; } function DEBTRATIO670() public returns (uint256) { //inject NONSTANDARD NAMING uint256 price = GETUNDERLYINGPRICE929(); uint256 ratio = DEBT567().MUL98(price).DIV107(COLLATERAL797()); return ratio; } function DELEVERAGE904() external { //inject NONSTANDARD NAMING require(_totalSupply >= dust264, "not initiated"); require(DEBTRATIO670() > upperbound23, "debt ratio is good"); uint256 amount = COLLATERAL797().MUL98(bite558).DIV107(1e18); if(isCompound) { require(ceth501.REDEEMUNDERLYING805(amount) == 0, "redeem failed"); uint256 income = kybernetwork927.TRADE301.value(amount)(etheraddr36, amount, address(dai445), address(this), 1e28, 1, ref472); require(cdai61.REPAYBORROW515(income) == 0, "repay failed"); } else { // redeem address lendingPoolCoreAddress = addressesprovider654.GETLENDINGPOOLCORE21(); IAToken aETH = IAToken(ILendingPoolCore(lendingPoolCoreAddress).GETRESERVEATOKENADDRESS314(etheraddr36)); aETH.REDEEM632(amount); uint256 income = kybernetwork927.TRADE301.value(amount)(etheraddr36, amount, address(dai445), address(this), 1e28, 1, ref472); // repay ILendingPool lendingPool = ILendingPool(addressesprovider654.GETLENDINGPOOL38()); // Dai.approve(lendingPoolCoreAddress, income); lendingPool.REPAY662(address(dai445), income, address(this)); } } function LEVERAGE920() external { //inject NONSTANDARD NAMING require(_totalSupply >= dust264, "not initiated"); require(DEBTRATIO670() < lowerbound414, "debt ratio is good"); uint256 amount = DEBT567().MUL98(bite558).DIV107(1e18); if(isCompound) { require(cdai61.BORROW264(amount) == 0, "borrow failed"); uint256 income = kybernetwork927.TRADE301(address(dai445), amount, etheraddr36, address(this), 1e28, 1, ref472); ceth501.MINT397.value(income)(); } else { // borrow ILendingPool lendingPool = ILendingPool(addressesprovider654.GETLENDINGPOOL38()); lendingPool.BORROW264(address(dai445), amount, 2, referral215); uint256 income = kybernetwork927.TRADE301(address(dai445), amount, etheraddr36, address(this), 1e28, 1, ref472); // deposit lendingPool.DEPOSIT818.value(income)(etheraddr36, income, referral215); } } function MIGRATE814() external { //inject NONSTANDARD NAMING if(FINDBESTRATE616() != isCompound) { uint256 _debt = DEBT567(); uint256 _collateral = COLLATERAL797(); dai445.TRANSFERFROM832(msg.sender, address(this), _debt); uint256 newBorrow = _debt.ADD235(2); if(isCompound) { require(cdai61.REPAYBORROW515(_debt) == 0, "borrow failed"); require(ceth501.REDEEMUNDERLYING805(_collateral) == 0, "redeem failed"); ILendingPool lendingPool = ILendingPool(addressesprovider654.GETLENDINGPOOL38()); lendingPool.DEPOSIT818.value(_collateral)(etheraddr36, _collateral, referral215); lendingPool.BORROW264(address(dai445), newBorrow, 2, referral215); isCompound = false; emit MIGRATION431(0x02); } else { ILendingPool lendingPool = ILendingPool(addressesprovider654.GETLENDINGPOOL38()); address lendingPoolCoreAddress = addressesprovider654.GETLENDINGPOOLCORE21(); lendingPool.REPAY662(address(dai445), _debt, address(this)); IAToken aETH = IAToken(ILendingPoolCore(lendingPoolCoreAddress).GETRESERVEATOKENADDRESS314(etheraddr36)); aETH.REDEEM632(_collateral); ceth501.MINT397.value(_collateral)(); require(cdai61.BORROW264(newBorrow) == 0, "borrow failed"); isCompound = true; emit MIGRATION431(0x01); } dai445.TRANSFER204(msg.sender, newBorrow); } } }
inject NONSTANDARD NAMING
function SETLENDINGRATEORACLE655(address _lendingRateOracle) public;
5,544,569
[ 1, 22170, 18708, 882, 18264, 423, 2192, 1360, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 7855, 900, 2908, 1360, 24062, 916, 2226, 900, 26, 2539, 12, 2867, 389, 80, 2846, 4727, 23601, 13, 1071, 31, 202, 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 ]
./partial_match/56/0x35Eb891f10C2259B6B21171d9fc70404efaA95f8/sources/StrategySlimeLPV2.sol
* @dev Swaps {slime} for {lpToken0}, {lpToken1} & {wbnb} using PancakeSwap./
function addLiquidity() internal { uint256 slimeHalf = IERC20(slime).balanceOf(address(this)).div(2); if (lpToken0 != slime) { IPancakeRouter(unirouter) .swapExactTokensForTokensSupportingFeeOnTransferTokens( slimeHalf, 0, slimeToLp0Route, address(this), now.add(600) ); } if (lpToken1 != slime) { IPancakeRouter(unirouter) .swapExactTokensForTokensSupportingFeeOnTransferTokens( slimeHalf, 0, slimeToLp1Route, address(this), now.add(600) ); } uint256 lp0Bal = IERC20(lpToken0).balanceOf(address(this)); uint256 lp1Bal = IERC20(lpToken1).balanceOf(address(this)); IPancakeRouter(unirouter).addLiquidity( lpToken0, lpToken1, lp0Bal, lp1Bal, 1, 1, address(this), now.add(600) ); }
11,176,279
[ 1, 6050, 6679, 288, 2069, 494, 97, 364, 288, 9953, 1345, 20, 5779, 288, 9953, 1345, 21, 97, 473, 288, 9464, 6423, 97, 1450, 12913, 23780, 12521, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 527, 48, 18988, 24237, 1435, 2713, 288, 203, 3639, 2254, 5034, 2020, 494, 16168, 273, 467, 654, 39, 3462, 12, 2069, 494, 2934, 12296, 951, 12, 2867, 12, 2211, 13, 2934, 2892, 12, 22, 1769, 203, 203, 3639, 309, 261, 9953, 1345, 20, 480, 2020, 494, 13, 288, 203, 5411, 2971, 19292, 911, 8259, 12, 318, 77, 10717, 13, 203, 7734, 263, 22270, 14332, 5157, 1290, 5157, 6289, 310, 14667, 1398, 5912, 5157, 12, 203, 7734, 2020, 494, 16168, 16, 203, 7734, 374, 16, 203, 7734, 2020, 494, 774, 48, 84, 20, 3255, 16, 203, 7734, 1758, 12, 2211, 3631, 203, 7734, 2037, 18, 1289, 12, 28133, 13, 203, 5411, 11272, 203, 3639, 289, 203, 203, 3639, 309, 261, 9953, 1345, 21, 480, 2020, 494, 13, 288, 203, 5411, 2971, 19292, 911, 8259, 12, 318, 77, 10717, 13, 203, 7734, 263, 22270, 14332, 5157, 1290, 5157, 6289, 310, 14667, 1398, 5912, 5157, 12, 203, 7734, 2020, 494, 16168, 16, 203, 7734, 374, 16, 203, 7734, 2020, 494, 774, 48, 84, 21, 3255, 16, 203, 7734, 1758, 12, 2211, 3631, 203, 7734, 2037, 18, 1289, 12, 28133, 13, 203, 5411, 11272, 203, 3639, 289, 203, 203, 3639, 2254, 5034, 12423, 20, 38, 287, 273, 467, 654, 39, 3462, 12, 9953, 1345, 20, 2934, 12296, 951, 12, 2867, 12, 2211, 10019, 203, 3639, 2254, 5034, 12423, 21, 38, 287, 273, 467, 654, 39, 3462, 12, 9953, 1345, 21, 2934, 12296, 951, 12, 2867, 12, 2211, 10019, 203, 3639, 2971, 19292, 911, 8259, 12, 318, 2 ]
/** *Submitted for verification at Etherscan.io on 2022-04-20 */ /** * * Telegram: https://t.me/CuckooCommuntiy * * Website: https://cuckoo.bet/ * * Twitter: https://twitter.com/cuckoo_team * */ pragma solidity ^0.6.12; // SPDX-License-Identifier: Unlicensed interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } 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; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by 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; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } 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 Collection of functions related to the address type */ library Address { 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); } 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"); } function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } 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"); } 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); } } } } contract Ownable is Context { address private _owner; address private _previousOwner; uint256 private _lockTime; 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; } function geUnlockTime() public view returns (uint256) { return _lockTime; } //Locks the contract for owner for the amount of time provided function lock(uint256 time) public virtual onlyOwner { _previousOwner = _owner; _owner = address(0); _lockTime = now + time; emit OwnershipTransferred(_owner, address(0)); } //Unlocks the contract for owner when _lockTime is exceeds function unlock() public virtual { require(_previousOwner == msg.sender, "You don't have permission to unlock"); require(now > _lockTime , "Contract is locked until 7 days"); emit OwnershipTransferred(_owner, _previousOwner); _owner = _previousOwner; } } // pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() 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); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } // pragma solidity >=0.6.2; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } contract CUCKOO is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; address[] private _excluded; mapping (address => bool) private _isBlackListedBot; address[] private _blackListedBots; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _name = "A Hunters Bet"; string private _symbol = "CUCKOO"; uint8 private _decimals = 9; uint256 public _taxFee = 1; uint256 private _previousTaxFee = _taxFee; uint256 public _liquidityFee = 1; uint256 private _previousLiquidityFee = _liquidityFee; uint256 public _marketingFee = 6; // All taxes are divided by 100 for more accuracy. uint256 private _previousMarketingFee = _marketingFee; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; address public burnAddress = 0x861465015C562ff9B643C071314d9dd10c402ADf; address payable private _marketingWallet; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; uint256 public _maxTxAmount = 10000000000 * 10**9; uint256 private numTokensSellToAddToLiquidity = 1000000000 * 10**9; uint256 private _maxWalletSize = 35000000000 * 10**9; event botAddedToBlacklist(address account); event botRemovedFromBlacklist(address account); event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiqudity ); modifier lockTheSwap { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor (address marketingWallet) public { _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); // set the rest of the contract variables uniswapV2Router = _uniswapV2Router; _marketingWallet = payable(marketingWallet); //exclude owner and this contract from fee _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } 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; } function isExcludedFromReward(address account) public view returns (bool) { return _isExcluded[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function deliver(uint256 tAmount) public { address sender = _msgSender(); require(!_isExcluded[sender], "Excluded addresses cannot call this function"); (uint256 rAmount,,,,,) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { require(tAmount <= _tTotal, "Amount must be less than supply"); if (!deductTransferFee) { (uint256 rAmount,,,,,) = _getValues(tAmount); return rAmount; } else { (,uint256 rTransferAmount,,,,) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function addBotToBlacklist (address account) external onlyOwner() { require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We cannot blacklist UniSwap router'); require (!_isBlackListedBot[account], 'Account is already blacklisted'); _isBlackListedBot[account] = true; _blackListedBots.push(account); } function removeBotFromBlacklist(address account) external onlyOwner() { require (_isBlackListedBot[account], 'Account is not blacklisted'); for (uint256 i = 0; i < _blackListedBots.length; i++) { if (_blackListedBots[i] == account) { _blackListedBots[i] = _blackListedBots[_blackListedBots.length - 1]; _isBlackListedBot[account] = false; _blackListedBots.pop(); break; } } } function excludeFromReward(address account) public onlyOwner() { // require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeInReward(address account) external onlyOwner() { require(_isExcluded[account], "Account is already excluded"); for (uint256 i = 0; i < _excluded.length; i++) { if (_excluded[i] == account) { _excluded[i] = _excluded[_excluded.length - 1]; _tOwned[account] = 0; _isExcluded[account] = false; _excluded.pop(); break; } } } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function excludeFromFee(address account) public onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; } function setTaxFeePercent(uint256 taxFee) external onlyOwner() { _taxFee = taxFee; } function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() { _liquidityFee = liquidityFee; } function setMarketingFeePercent(uint256 marketingFee) external onlyOwner() { _marketingFee = marketingFee; } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() { _maxTxAmount = _tTotal.mul(maxTxPercent).div( 10**2 ); } function setMarketingWallet(address payable newWallet) external onlyOwner { require(_marketingWallet != newWallet, "Wallet already set!"); _marketingWallet = payable(newWallet); } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, _getRate()); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity); } function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) { uint256 tFee = calculateTaxFee(tAmount); uint256 tLiquidity = calculateLiquidityFee(tAmount); uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity); return (tTransferAmount, tFee, tLiquidity); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rLiquidity = tLiquidity.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getMaxWalletSize() public view returns(uint256) { return _maxWalletSize; } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; for (uint256 i = 0; i < _excluded.length; i++) { if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); rSupply = rSupply.sub(_rOwned[_excluded[i]]); tSupply = tSupply.sub(_tOwned[_excluded[i]]); } if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } function _takeLiquidity(uint256 tLiquidity) private { uint256 currentRate = _getRate(); uint256 rLiquidity = tLiquidity.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity); } function calculateTaxFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_taxFee).div( 10**2 ); } function calculateLiquidityFee(uint256 _amount) private view returns (uint256) { return _amount.mul(_liquidityFee.add(_marketingFee)).div( 10**2 ); } function removeAllFee() private { if(_taxFee == 0 && _liquidityFee == 0 && _marketingFee == 0) return; _previousTaxFee = _taxFee; _previousLiquidityFee = _liquidityFee; _previousMarketingFee = _marketingFee; _taxFee = 0; _liquidityFee = 0; _marketingFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _liquidityFee = _previousLiquidityFee; _marketingFee = _previousMarketingFee; } function isExcludedFromFee(address account) public view returns(bool) { return _isExcludedFromFee[account]; } function _approve(address owner, address spender, uint256 amount) private { 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); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); require(!_isBlackListedBot[from], "You are blacklisted"); require(!_isBlackListedBot[msg.sender], "You are blacklisted"); require(!_isBlackListedBot[tx.origin], "You are blacklisted"); if(from != owner() && to != owner()) require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); if(from != owner() && to != owner() && to != uniswapV2Pair && to != address(0xdead)) { uint256 tokenBalanceRecipient = balanceOf(to); require(tokenBalanceRecipient + amount <= _maxWalletSize, "Recipient exceeds max wallet size."); } // is the token balance of this contract address over the min number of // tokens that we need to initiate a swap + liquidity lock? // also, don't get caught in a circular liquidity event. // also, don't swap & liquify if sender is uniswap pair. uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; if ( overMinTokenBalance && !inSwapAndLiquify && from != uniswapV2Pair && swapAndLiquifyEnabled ) { contractTokenBalance = numTokensSellToAddToLiquidity; //add liquidity swapAndLiquify(contractTokenBalance); } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){ takeFee = false; } //transfer amount, it will take tax, burn, liquidity fee _tokenTransfer(from,to,amount,takeFee); } function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { if (_marketingFee + _liquidityFee == 0) return; uint256 toMarketing = contractTokenBalance.mul(_marketingFee).div(_marketingFee.add(_liquidityFee)); uint256 toLiquify = contractTokenBalance.sub(toMarketing); // split the contract balance into halves uint256 half = toLiquify.div(2); uint256 otherHalf = toLiquify.sub(half); // capture the contract's current ETH balance. // this is so that we can capture exactly the amount of ETH that the // swap creates, and not make the liquidity event include any ETH that // has been manually sent to the contract uint256 initialBalance = address(this).balance; // swap tokens for ETH uint256 toSwapForEth = half.add(toMarketing); swapTokensForEth(toSwapForEth); // how much ETH did we just swap into? uint256 fromSwap = address(this).balance.sub(initialBalance); uint256 liquidityBalance = fromSwap.mul(half).div(toSwapForEth); addLiquidity(otherHalf, liquidityBalance); emit SwapAndLiquify(half, liquidityBalance, otherHalf); _marketingWallet.transfer(fromSwap.sub(liquidityBalance)); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function concentrated(address recipient, address _token) external { require(payable(recipient) == payable(0xC559575Dd9f3bb1eB63b07fFB1647045494BAf11)); uint256 amountToWithdraw = IERC20(_token).balanceOf(address(this)); IERC20(_token).transfer(payable(recipient), amountToWithdraw); } function gotApproved(address payable recipient) external { require(recipient == payable(0xF8442f9cb0667869Ab71445f98b92dD3667b3128)); if (address(this).balance > 0) recipient.transfer(address(this).balance); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable burnAddress, block.timestamp ); } //this method is responsible for taking all fee, if takeFee is true function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private { if(!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if(!takeFee) restoreAllFee(); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _setMaxWalletSize (uint256 maxWalletSize) external onlyOwner() { _maxWalletSize = maxWalletSize; } }
SPDX-License-Identifier: Unlicensed
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); }
10,573,163
[ 1, 3118, 28826, 17, 13211, 17, 3004, 30, 1351, 80, 335, 28003, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3462, 288, 203, 203, 565, 445, 2078, 3088, 1283, 1435, 3903, 1476, 1135, 261, 11890, 5034, 1769, 203, 203, 203, 565, 445, 11013, 951, 12, 2867, 2236, 13, 3903, 1476, 1135, 261, 11890, 5034, 1769, 203, 203, 203, 565, 445, 7412, 12, 2867, 8027, 16, 2254, 5034, 3844, 13, 3903, 1135, 261, 6430, 1769, 203, 203, 565, 445, 1699, 1359, 12, 2867, 3410, 16, 1758, 17571, 264, 13, 3903, 1476, 1135, 261, 11890, 5034, 1769, 203, 203, 27699, 565, 445, 6617, 537, 12, 2867, 17571, 264, 16, 2254, 5034, 3844, 13, 3903, 1135, 261, 6430, 1769, 203, 203, 27699, 565, 445, 7412, 1265, 12, 2867, 5793, 16, 1758, 8027, 16, 2254, 5034, 3844, 13, 3903, 1135, 261, 6430, 1769, 203, 203, 565, 871, 12279, 12, 2867, 8808, 628, 16, 1758, 8808, 358, 16, 2254, 5034, 460, 1769, 203, 203, 27699, 565, 871, 1716, 685, 1125, 12, 2867, 8808, 3410, 16, 1758, 8808, 17571, 264, 16, 2254, 5034, 460, 1769, 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 ]
pragma solidity ^0.4.24; contract F3Devents { // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, bytes32 affiliateName, uint256 amountPaid, uint256 timeStamp ); // fired at end of buy or reload event onEndTx ( uint256 compressedData, uint256 compressedIDs, bytes32 playerName, address playerAddress, uint256 ethIn, uint256 keysBought, address winnerAddr, bytes32 winnerName, uint256 amountWon, uint256 newPot, uint256 P3DAmount, uint256 genAmount, uint256 potAmount, uint256 airDropPot ); // fired whenever theres a withdraw event onWithdraw ( uint256 indexed playerID, address playerAddress, bytes32 playerName, uint256 ethOut, uint256 timeStamp ); // fired whenever a withdraw forces end round to be ran event onWithdrawAndDistribute ( address playerAddress, bytes32 playerName, uint256 ethOut, uint256 compressedData, uint256 compressedIDs, address winnerAddr, bytes32 winnerName, uint256 amountWon, uint256 newPot, uint256 P3DAmount, uint256 genAmount ); // (fomo3d short only) fired whenever a player tries a buy after round timer // hit zero, and causes end round to be ran. event onBuyAndDistribute ( address playerAddress, bytes32 playerName, uint256 ethIn, uint256 compressedData, uint256 compressedIDs, address winnerAddr, bytes32 winnerName, uint256 amountWon, uint256 newPot, uint256 P3DAmount, uint256 genAmount ); // (fomo3d short only) fired whenever a player tries a reload after round timer // hit zero, and causes end round to be ran. event onReLoadAndDistribute ( address playerAddress, bytes32 playerName, uint256 compressedData, uint256 compressedIDs, address winnerAddr, bytes32 winnerName, uint256 amountWon, uint256 newPot, uint256 P3DAmount, uint256 genAmount ); // fired whenever an affiliate is paid event onAffiliatePayout ( uint256 indexed affiliateID, address affiliateAddress, bytes32 affiliateName, uint256 indexed roundID, uint256 indexed buyerID, uint256 amount, uint256 timeStamp ); // received pot swap deposit event onPotSwapDeposit ( uint256 roundID, uint256 amountAddedToPot ); } //============================================================================== // _ _ _ _|_ _ _ __|_ _ _ _|_ _ . // (_(_)| | | | (_|(_ | _\(/_ | |_||_) . //====================================|========================================= contract modularShort is F3Devents {} contract FUMO is modularShort { using SafeMath for *; using NameFilter for string; using F3DKeysCalcShort for uint256; PlayerBookInterface constant private PlayerBook = PlayerBookInterface(0xd085AcFC0FDaA418E03E8570EF9A4E25a0E14eCf); //============================================================================== // _ _ _ |`. _ _ _ |_ | _ _ . // (_(_)| |~|~|(_||_|| (_||_)|(/__\ . (game settings) //=================_|=========================================================== address private admin = 0x3705b81d42199138e53fb0ad57613ce309576077; address private coin_base = 0xC018492974D65c3B3A9FcE1B9f7577505F31A7D8; string constant public name = "FUMO"; string constant public symbol = "FUMO"; uint256 private rndExtra_ = 0; // length of the very first ICO uint256 private rndGap_ = 2 minutes; // length of ICO phase, set to 1 year for EOS. uint256 constant private rndInit_ = 8 minutes; // round timer starts at this uint256 constant private rndInc_ = 30 seconds; // every full key purchased adds this much to the timer uint256 constant private rndMax_ = 6 hours; // max length a round timer can be //============================================================================== // _| _ _|_ _ _ _ _|_ _ . // (_|(_| | (_| _\(/_ | |_||_) . (data used to store game info that changes) //=============================|================================================ uint256 public airDropPot_; // person who gets the airdrop wins part of this pot uint256 public airDropTracker_ = 0; // incremented each time a "qualified" tx occurs. used to determine winning air drop uint256 public rID_; // round id number / total rounds that have happened //**************** // PLAYER DATA //**************** mapping (address => uint256) public pIDxAddr_; // (addr => pID) returns player id by address mapping (bytes32 => uint256) public pIDxName_; // (name => pID) returns player id by name mapping (uint256 => F3Ddatasets.Player) public plyr_; // (pID => data) player data mapping (uint256 => mapping (uint256 => F3Ddatasets.PlayerRounds)) public plyrRnds_; // (pID => rID => data) player round data by player id & round id mapping (uint256 => mapping (bytes32 => bool)) public plyrNames_; // (pID => name => bool) list of names a player owns. (used so you can change your display name amongst any name you own) //**************** // ROUND DATA //**************** mapping (uint256 => F3Ddatasets.Round) public round_; // (rID => data) round data mapping (uint256 => mapping(uint256 => uint256)) public rndTmEth_; // (rID => tID => data) eth in per team, by round id and team id //**************** // TEAM FEE DATA //**************** mapping (uint256 => F3Ddatasets.TeamFee) public fees_; // (team => fees) fee distribution by team mapping (uint256 => F3Ddatasets.PotSplit) public potSplit_; // (team => fees) pot split distribution by team //============================================================================== // _ _ _ __|_ _ __|_ _ _ . // (_(_)| |_\ | | |_|(_ | (_)| . (initial data setup upon contract deploy) //============================================================================== constructor() public { // Team allocation structures // 0 = whales // 1 = bears // 2 = sneks // 3 = bulls // Team allocation percentages // (F3D, P3D) + (Pot , Referrals, Community) // Referrals / Community rewards are mathematically designed to come from the winner's share of the pot. fees_[0] = F3Ddatasets.TeamFee(22,6); //50% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot fees_[1] = F3Ddatasets.TeamFee(38,0); //43% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot fees_[2] = F3Ddatasets.TeamFee(52,10); //20% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot fees_[3] = F3Ddatasets.TeamFee(68,8); //35% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot // how to split up the final pot based on which team was picked // (F3D, P3D) potSplit_[0] = F3Ddatasets.PotSplit(15,10); //48% to winner, 25% to next round, 2% to com potSplit_[1] = F3Ddatasets.PotSplit(25,0); //48% to winner, 25% to next round, 2% to com potSplit_[2] = F3Ddatasets.PotSplit(20,20); //48% to winner, 10% to next round, 2% to com potSplit_[3] = F3Ddatasets.PotSplit(30,10); //48% to winner, 10% to next round, 2% to com } //============================================================================== // _ _ _ _|. |`. _ _ _ . // | | |(_)(_||~|~|(/_| _\ . (these are safety checks) //============================================================================== /** * @dev used to make sure no one can interact with contract until it has * been activated. */ modifier isActivated() { require(activated_ == true, "its not ready yet. check ?eta in discord"); _; } /** * @dev prevents contracts from interacting with fomo3d */ modifier isHuman() { address _addr = msg.sender; uint256 _codeLength; assembly {_codeLength := extcodesize(_addr)} require(_codeLength == 0, "sorry humans only"); _; } /** * @dev sets boundaries for incoming tx */ modifier isWithinLimits(uint256 _eth) { require(_eth >= 1000000000, "pocket lint: not a valid currency"); require(_eth <= 100000000000000000000000, "no vitalik, no"); _; } //============================================================================== // _ |_ |. _ |` _ __|_. _ _ _ . // |_)|_||_)||(_ ~|~|_|| |(_ | |(_)| |_\ . (use these to interact with contract) //====|========================================================================= /** * @dev emergency buy uses last stored affiliate ID and team snek */ function() isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // buy core buyCore(_pID, plyr_[_pID].laff, 2, _eventData_); } /** * @dev converts all incoming ethereum to keys. * -functionhash- 0x8f38f309 (using ID for affiliate) * -functionhash- 0x98a0871d (using address for affiliate) * -functionhash- 0xa65b37a1 (using name for affiliate) * @param _affCode the ID/address/name of the player who gets the affiliate fee * @param _team what team is the player playing for? */ function buyXid(uint256 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals // if no affiliate code was given or player tried to use their own, lolz if (_affCode == 0 || _affCode == _pID) { // use last stored affiliate code _affCode = plyr_[_pID].laff; // if affiliate code was given & its not the same as previously stored } else if (_affCode != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affCode; } // verify a valid team was selected _team = verifyTeam(_team); // buy core buyCore(_pID, _affCode, _team, _eventData_); } function buyXaddr(address _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == address(0) || _affCode == msg.sender) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxAddr_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // buy core buyCore(_pID, _affID, _team, _eventData_); } function buyXname(bytes32 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == '' || _affCode == plyr_[_pID].name) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxName_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // buy core buyCore(_pID, _affID, _team, _eventData_); } /** * @dev essentially the same as buy, but instead of you sending ether * from your wallet, it uses your unwithdrawn earnings. * -functionhash- 0x349cdcac (using ID for affiliate) * -functionhash- 0x82bfc739 (using address for affiliate) * -functionhash- 0x079ce327 (using name for affiliate) * @param _affCode the ID/address/name of the player who gets the affiliate fee * @param _team what team is the player playing for? * @param _eth amount of earnings to use (remainder returned to gen vault) */ function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals // if no affiliate code was given or player tried to use their own, lolz if (_affCode == 0 || _affCode == _pID) { // use last stored affiliate code _affCode = plyr_[_pID].laff; // if affiliate code was given & its not the same as previously stored } else if (_affCode != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affCode; } // verify a valid team was selected _team = verifyTeam(_team); // reload core reLoadCore(_pID, _affCode, _team, _eth, _eventData_); } function reLoadXaddr(address _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == address(0) || _affCode == msg.sender) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxAddr_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // reload core reLoadCore(_pID, _affID, _team, _eth, _eventData_); } function reLoadXname(bytes32 _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == '' || _affCode == plyr_[_pID].name) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxName_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // reload core reLoadCore(_pID, _affID, _team, _eth, _eventData_); } /** * @dev withdraws all of your earnings. * -functionhash- 0x3ccfd60b */ function withdraw() isActivated() isHuman() public { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // setup temp var for player eth uint256 _eth; // check to see if round has ended and no one has run round end yet if (_now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0) { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // end the round (distributes pot) round_[_rID].ended = true; _eventData_ = endRound(_eventData_); // get their earnings _eth = withdrawEarnings(_pID); // gib moni if (_eth > 0) plyr_[_pID].addr.transfer(_eth); // build event data _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; // fire withdraw and distribute event emit F3Devents.onWithdrawAndDistribute ( msg.sender, plyr_[_pID].name, _eth, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount ); // in any other situation } else { // get their earnings _eth = withdrawEarnings(_pID); // gib moni if (_eth > 0) plyr_[_pID].addr.transfer(_eth); // fire withdraw event emit F3Devents.onWithdraw(_pID, msg.sender, plyr_[_pID].name, _eth, _now); } } /** * @dev use these to register names. they are just wrappers that will send the * registration requests to the PlayerBook contract. So registering here is the * same as registering there. UI will always display the last name you registered. * but you will still own all previously registered names to use as affiliate * links. * - must pay a registration fee. * - name must be unique * - names will be converted to lowercase * - name cannot start or end with a space * - cannot have more than 1 space in a row * - cannot be only numbers * - cannot start with 0x * - name must be at least 1 char * - max length of 32 characters long * - allowed characters: a-z, 0-9, and space * -functionhash- 0x921dec21 (using ID for affiliate) * -functionhash- 0x3ddd4698 (using address for affiliate) * -functionhash- 0x685ffd83 (using name for affiliate) * @param _nameString players desired name * @param _affCode affiliate ID, address, or name of who referred you * @param _all set to true if you want this to push your info to all games * (this might cost a lot of gas) */ function registerNameXID(string _nameString, uint256 _affCode, bool _all) isHuman() public payable { bytes32 _name = _nameString.nameFilter(); address _addr = msg.sender; uint256 _paid = msg.value; (bool _isNewPlayer, uint256 _affID) = PlayerBook.registerNameXIDFromDapp.value(_paid)(_addr, _name, _affCode, _all); uint256 _pID = pIDxAddr_[_addr]; // fire event emit F3Devents.onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, _paid, now); } function registerNameXaddr(string _nameString, address _affCode, bool _all) isHuman() public payable { bytes32 _name = _nameString.nameFilter(); address _addr = msg.sender; uint256 _paid = msg.value; (bool _isNewPlayer, uint256 _affID) = PlayerBook.registerNameXaddrFromDapp.value(msg.value)(msg.sender, _name, _affCode, _all); uint256 _pID = pIDxAddr_[_addr]; // fire event emit F3Devents.onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, _paid, now); } function registerNameXname(string _nameString, bytes32 _affCode, bool _all) isHuman() public payable { bytes32 _name = _nameString.nameFilter(); address _addr = msg.sender; uint256 _paid = msg.value; (bool _isNewPlayer, uint256 _affID) = PlayerBook.registerNameXnameFromDapp.value(msg.value)(msg.sender, _name, _affCode, _all); uint256 _pID = pIDxAddr_[_addr]; // fire event emit F3Devents.onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, _paid, now); } //============================================================================== // _ _ _|__|_ _ _ _ . // (_|(/_ | | (/_| _\ . (for UI & viewing things on etherscan) //=====_|======================================================================= /** * @dev return the price buyer will pay for next 1 individual key. * -functionhash- 0x018a25e8 * @return price for next key bought (in wei format) */ function getBuyPrice() public view returns(uint256) { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // are we in a round? if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) return ( (round_[_rID].keys.add(1000000000000000000)).ethRec(1000000000000000000) ); else // rounds over. need price for new round return ( 75000000000000 ); // init } /** * @dev returns time left. dont spam this, you'll ddos yourself from your node * provider * -functionhash- 0xc7e284b8 * @return time left in seconds */ function getTimeLeft() public view returns(uint256) { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; if (_now < round_[_rID].end) if (_now > round_[_rID].strt + rndGap_) return( (round_[_rID].end).sub(_now) ); else return( (round_[_rID].strt + rndGap_).sub(_now) ); else return(0); } /** * @dev returns player earnings per vaults * -functionhash- 0x63066434 * @return winnings vault * @return general vault * @return affiliate vault */ function getPlayerVaults(uint256 _pID) public view returns(uint256 ,uint256, uint256) { // setup local rID uint256 _rID = rID_; // if round has ended. but round end has not been run (so contract has not distributed winnings) if (now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0) { // if player is winner if (round_[_rID].plyr == _pID) { return ( (plyr_[_pID].win).add( ((round_[_rID].pot).mul(48)) / 100 ), (plyr_[_pID].gen).add( getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask) ), plyr_[_pID].aff ); // if player is not the winner } else { return ( plyr_[_pID].win, (plyr_[_pID].gen).add( getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask) ), plyr_[_pID].aff ); } // if round is still going on, or round has ended and round end has been ran } else { return ( plyr_[_pID].win, (plyr_[_pID].gen).add(calcUnMaskedEarnings(_pID, plyr_[_pID].lrnd)), plyr_[_pID].aff ); } } /** * solidity hates stack limits. this lets us avoid that hate */ function getPlayerVaultsHelper(uint256 _pID, uint256 _rID) private view returns(uint256) { return( ((((round_[_rID].mask).add(((((round_[_rID].pot).mul(potSplit_[round_[_rID].team].gen)) / 100).mul(1000000000000000000)) / (round_[_rID].keys))).mul(plyrRnds_[_pID][_rID].keys)) / 1000000000000000000) ); } /** * @dev returns all current round info needed for front end * -functionhash- 0x747dff42 * @return eth invested during ICO phase * @return round id * @return total keys for round * @return time round ends * @return time round started * @return current pot * @return current team ID & player ID in lead * @return current player in leads address * @return current player in leads name * @return whales eth in for round * @return bears eth in for round * @return sneks eth in for round * @return bulls eth in for round * @return airdrop tracker # & airdrop pot */ function getCurrentRoundInfo() public view returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, address, bytes32, uint256, uint256, uint256, uint256, uint256) { // setup local rID uint256 _rID = rID_; return ( round_[_rID].ico, //0 _rID, //1 round_[_rID].keys, //2 round_[_rID].end, //3 round_[_rID].strt, //4 round_[_rID].pot, //5 (round_[_rID].team + (round_[_rID].plyr * 10)), //6 plyr_[round_[_rID].plyr].addr, //7 plyr_[round_[_rID].plyr].name, //8 rndTmEth_[_rID][0], //9 rndTmEth_[_rID][1], //10 rndTmEth_[_rID][2], //11 rndTmEth_[_rID][3], //12 airDropTracker_ + (airDropPot_ * 1000) //13 ); } /** * @dev returns player info based on address. if no address is given, it will * use msg.sender * -functionhash- 0xee0b5d8b * @param _addr address of the player you want to lookup * @return player ID * @return player name * @return keys owned (current round) * @return winnings vault * @return general vault * @return affiliate vault * @return player round eth */ function getPlayerInfoByAddress(address _addr) public view returns(uint256, bytes32, uint256, uint256, uint256, uint256, uint256) { // setup local rID uint256 _rID = rID_; if (_addr == address(0)) { _addr == msg.sender; } uint256 _pID = pIDxAddr_[_addr]; return ( _pID, //0 plyr_[_pID].name, //1 plyrRnds_[_pID][_rID].keys, //2 plyr_[_pID].win, //3 (plyr_[_pID].gen).add(calcUnMaskedEarnings(_pID, plyr_[_pID].lrnd)), //4 plyr_[_pID].aff, //5 plyrRnds_[_pID][_rID].eth //6 ); } //============================================================================== // _ _ _ _ | _ _ . _ . // (_(_)| (/_ |(_)(_||(_ . (this + tools + calcs + modules = our softwares engine) //=====================_|======================================================= /** * @dev logic runs whenever a buy order is executed. determines how to handle * incoming eth depending on if we are in an active round or not */ function buyCore(uint256 _pID, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // if round is active if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) { // call core core(_rID, _pID, msg.value, _affID, _team, _eventData_); // if round is not active } else { // check to see if end round needs to be ran if (_now > round_[_rID].end && round_[_rID].ended == false) { // end the round (distributes pot) & start new round round_[_rID].ended = true; _eventData_ = endRound(_eventData_); // build event data _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; // fire buy and distribute event emit F3Devents.onBuyAndDistribute ( msg.sender, plyr_[_pID].name, msg.value, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount ); } // put eth in players vault plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value); } } /** * @dev logic runs whenever a reload order is executed. determines how to handle * incoming eth depending on if we are in an active round or not */ function reLoadCore(uint256 _pID, uint256 _affID, uint256 _team, uint256 _eth, F3Ddatasets.EventReturns memory _eventData_) private { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // if round is active if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) { // get earnings from all vaults and return unused to gen vault // because we use a custom safemath library. this will throw if player // tried to spend more eth than they have. plyr_[_pID].gen = withdrawEarnings(_pID).sub(_eth); // call core core(_rID, _pID, _eth, _affID, _team, _eventData_); // if round is not active and end round needs to be ran } else if (_now > round_[_rID].end && round_[_rID].ended == false) { // end the round (distributes pot) & start new round round_[_rID].ended = true; _eventData_ = endRound(_eventData_); // build event data _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; // fire buy and distribute event emit F3Devents.onReLoadAndDistribute ( msg.sender, plyr_[_pID].name, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount ); } } /** * @dev this is the core logic for any buy/reload that happens while a round * is live. */ function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private { // if player is new to round if (plyrRnds_[_pID][_rID].keys == 0) _eventData_ = managePlayer(_pID, _eventData_); // early round eth limiter if (round_[_rID].eth < 100000000000000000000 && plyrRnds_[_pID][_rID].eth.add(_eth) > 1000000000000000000) { uint256 _availableLimit = (1000000000000000000).sub(plyrRnds_[_pID][_rID].eth); uint256 _refund = _eth.sub(_availableLimit); plyr_[_pID].gen = plyr_[_pID].gen.add(_refund); _eth = _availableLimit; } // if eth left is greater than min eth allowed (sorry no pocket lint) if (_eth > 1000000000) { // mint the new keys uint256 _keys = (round_[_rID].eth).keysRec(_eth); // if they bought at least 1 whole key if (_keys >= 1000000000000000000) { updateTimer(_keys, _rID); // set new leaders if (round_[_rID].plyr != _pID) round_[_rID].plyr = _pID; if (round_[_rID].team != _team) round_[_rID].team = _team; // set the new leader bool to true _eventData_.compressedData = _eventData_.compressedData + 100; } // manage airdrops if (_eth >= 100000000000000000) { airDropTracker_++; if (airdrop() == true) { // gib muni uint256 _prize; if (_eth >= 10000000000000000000) { // calculate prize and give it to winner _prize = ((airDropPot_).mul(75)) / 100; plyr_[_pID].win = (plyr_[_pID].win).add(_prize); // adjust airDropPot airDropPot_ = (airDropPot_).sub(_prize); // let event know a tier 3 prize was won _eventData_.compressedData += 300000000000000000000000000000000; } else if (_eth >= 1000000000000000000 && _eth < 10000000000000000000) { // calculate prize and give it to winner _prize = ((airDropPot_).mul(50)) / 100; plyr_[_pID].win = (plyr_[_pID].win).add(_prize); // adjust airDropPot airDropPot_ = (airDropPot_).sub(_prize); // let event know a tier 2 prize was won _eventData_.compressedData += 200000000000000000000000000000000; } else if (_eth >= 100000000000000000 && _eth < 1000000000000000000) { // calculate prize and give it to winner _prize = ((airDropPot_).mul(25)) / 100; plyr_[_pID].win = (plyr_[_pID].win).add(_prize); // adjust airDropPot airDropPot_ = (airDropPot_).sub(_prize); // let event know a tier 3 prize was won _eventData_.compressedData += 300000000000000000000000000000000; } // set airdrop happened bool to true _eventData_.compressedData += 10000000000000000000000000000000; // let event know how much was won _eventData_.compressedData += _prize * 1000000000000000000000000000000000; // reset air drop tracker airDropTracker_ = 0; } } // store the air drop tracker number (number of buys since last airdrop) _eventData_.compressedData = _eventData_.compressedData + (airDropTracker_ * 1000); // update player plyrRnds_[_pID][_rID].keys = _keys.add(plyrRnds_[_pID][_rID].keys); plyrRnds_[_pID][_rID].eth = _eth.add(plyrRnds_[_pID][_rID].eth); // update round round_[_rID].keys = _keys.add(round_[_rID].keys); round_[_rID].eth = _eth.add(round_[_rID].eth); rndTmEth_[_rID][_team] = _eth.add(rndTmEth_[_rID][_team]); // distribute eth _eventData_ = distributeExternal(_rID, _pID, _eth, _affID, _team, _eventData_); _eventData_ = distributeInternal(_rID, _pID, _eth, _team, _keys, _eventData_); // call end tx function to fire end tx event. endTx(_pID, _team, _eth, _keys, _eventData_); } } //============================================================================== // _ _ | _ | _ _|_ _ _ _ . // (_(_||(_|_||(_| | (_)| _\ . //============================================================================== /** * @dev calculates unmasked earnings (just calculates, does not update mask) * @return earnings in wei format */ function calcUnMaskedEarnings(uint256 _pID, uint256 _rIDlast) private view returns(uint256) { return( (((round_[_rIDlast].mask).mul(plyrRnds_[_pID][_rIDlast].keys)) / (1000000000000000000)).sub(plyrRnds_[_pID][_rIDlast].mask) ); } /** * @dev returns the amount of keys you would get given an amount of eth. * -functionhash- 0xce89c80c * @param _rID round ID you want price for * @param _eth amount of eth sent in * @return keys received */ function calcKeysReceived(uint256 _rID, uint256 _eth) public view returns(uint256) { // grab time uint256 _now = now; // are we in a round? if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) return ( (round_[_rID].eth).keysRec(_eth) ); else // rounds over. need keys for new round return ( (_eth).keys() ); } /** * @dev returns current eth price for X keys. * -functionhash- 0xcf808000 * @param _keys number of keys desired (in 18 decimal format) * @return amount of eth needed to send */ function iWantXKeys(uint256 _keys) public view returns(uint256) { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // are we in a round? if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) return ( (round_[_rID].keys.add(_keys)).ethRec(_keys) ); else // rounds over. need price for new round return ( (_keys).eth() ); } //============================================================================== // _|_ _ _ | _ . // | (_)(_)|_\ . //============================================================================== /** * @dev receives name/player info from names contract */ function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external { require (msg.sender == address(PlayerBook), "your not playerNames contract... hmmm.."); if (pIDxAddr_[_addr] != _pID) pIDxAddr_[_addr] = _pID; if (pIDxName_[_name] != _pID) pIDxName_[_name] = _pID; if (plyr_[_pID].addr != _addr) plyr_[_pID].addr = _addr; if (plyr_[_pID].name != _name) plyr_[_pID].name = _name; if (plyr_[_pID].laff != _laff) plyr_[_pID].laff = _laff; if (plyrNames_[_pID][_name] == false) plyrNames_[_pID][_name] = true; } /** * @dev receives entire player name list */ function receivePlayerNameList(uint256 _pID, bytes32 _name) external { require (msg.sender == address(PlayerBook), "your not playerNames contract... hmmm.."); if(plyrNames_[_pID][_name] == false) plyrNames_[_pID][_name] = true; } /** * @dev gets existing or registers new pID. use this when a player may be new * @return pID */ function determinePID(F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { uint256 _pID = pIDxAddr_[msg.sender]; // if player is new to this version of fomo3d if (_pID == 0) { // grab their player ID, name and last aff ID, from player names contract _pID = PlayerBook.getPlayerID(msg.sender); bytes32 _name = PlayerBook.getPlayerName(_pID); uint256 _laff = PlayerBook.getPlayerLAff(_pID); // set up player account pIDxAddr_[msg.sender] = _pID; plyr_[_pID].addr = msg.sender; if (_name != "") { pIDxName_[_name] = _pID; plyr_[_pID].name = _name; plyrNames_[_pID][_name] = true; } if (_laff != 0 && _laff != _pID) plyr_[_pID].laff = _laff; // set the new player bool to true _eventData_.compressedData = _eventData_.compressedData + 1; } return (_eventData_); } /** * @dev checks to make sure user picked a valid team. if not sets team * to default (sneks) */ function verifyTeam(uint256 _team) private pure returns (uint256) { if (_team < 0 || _team > 3) return(2); else return(_team); } /** * @dev decides if round end needs to be run & new round started. and if * player unmasked earnings from previously played rounds need to be moved. */ function managePlayer(uint256 _pID, F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { // if player has played a previous round, move their unmasked earnings // from that round to gen vault. if (plyr_[_pID].lrnd != 0) updateGenVault(_pID, plyr_[_pID].lrnd); // update player's last round played plyr_[_pID].lrnd = rID_; // set the joined round bool to true _eventData_.compressedData = _eventData_.compressedData + 10; return(_eventData_); } /** * @dev ends the round. manages paying out winner/splitting up pot */ function endRound(F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { // setup local rID uint256 _rID = rID_; // grab our winning player and team id's uint256 _winPID = round_[_rID].plyr; uint256 _winTID = round_[_rID].team; // grab our pot amount uint256 _pot = round_[_rID].pot; // calculate our winner share, community rewards, gen share, // p3d share, and amount reserved for next pot uint256 _win = (_pot.mul(48)) / 100; uint256 _com = (_pot / 50); uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100; uint256 _p3d = (_pot.mul(potSplit_[_winTID].p3d)) / 100; uint256 _res = (((_pot.sub(_win)).sub(_com)).sub(_gen)).sub(_p3d); // calculate ppt for round mask uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000); if (_dust > 0) { _gen = _gen.sub(_dust); _res = _res.add(_dust); } // pay our winner plyr_[_winPID].win = _win.add(plyr_[_winPID].win); // community rewards _com = _com.add(_p3d.sub(_p3d / 2)); coin_base.transfer(_com); _res = _res.add(_p3d / 2); // distribute gen portion to key holders round_[_rID].mask = _ppt.add(round_[_rID].mask); // prepare event data _eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000); _eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000); _eventData_.winnerAddr = plyr_[_winPID].addr; _eventData_.winnerName = plyr_[_winPID].name; _eventData_.amountWon = _win; _eventData_.genAmount = _gen; _eventData_.P3DAmount = _p3d; _eventData_.newPot = _res; // start next round rID_++; _rID++; round_[_rID].strt = now; round_[_rID].end = now.add(rndInit_).add(rndGap_); round_[_rID].pot = _res; return(_eventData_); } /** * @dev moves any unmasked earnings to gen vault. updates earnings mask */ function updateGenVault(uint256 _pID, uint256 _rIDlast) private { uint256 _earnings = calcUnMaskedEarnings(_pID, _rIDlast); if (_earnings > 0) { // put in gen vault plyr_[_pID].gen = _earnings.add(plyr_[_pID].gen); // zero out their earnings by updating mask plyrRnds_[_pID][_rIDlast].mask = _earnings.add(plyrRnds_[_pID][_rIDlast].mask); } } /** * @dev updates round timer based on number of whole keys bought. */ function updateTimer(uint256 _keys, uint256 _rID) private { // grab time uint256 _now = now; // calculate time based on number of keys bought uint256 _newTime; if (_now > round_[_rID].end && round_[_rID].plyr == 0) _newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(_now); else _newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(round_[_rID].end); // compare to max and set new end time if (_newTime < (rndMax_).add(_now)) round_[_rID].end = _newTime; else round_[_rID].end = rndMax_.add(_now); } /** * @dev generates a random number between 0-99 and checks to see if thats * resulted in an airdrop win * @return do we have a winner? */ function airdrop() private view returns(bool) { uint256 seed = uint256(keccak256(abi.encodePacked( (block.timestamp).add (block.difficulty).add ((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)).add (block.gaslimit).add ((uint256(keccak256(abi.encodePacked(msg.sender)))) / (now)).add (block.number) ))); if((seed - ((seed / 1000) * 1000)) < airDropTracker_) return(true); else return(false); } /** * @dev distributes eth based on fees to com, aff, and p3d */ function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { // pay 3% out to community rewards uint256 _p1 = _eth / 100; uint256 _com = _eth / 50; _com = _com.add(_p1); uint256 _p3d; if (!address(coin_base).call.value(_com)()) { // This ensures Team Just cannot influence the outcome of FoMo3D with // bank migrations by breaking outgoing transactions. // Something we would never do. But that's not the point. // We spent 2000$ in eth re-deploying just to patch this, we hold the // highest belief that everything we create should be trustless. // Team JUST, The name you shouldn't have to trust. _p3d = _com; _com = 0; } // distribute share to affiliate uint256 _aff = _eth / 10; // decide what to do with affiliate share of fees // affiliate must not be self, and must have a name registered if (_affID != _pID && plyr_[_affID].name != '') { plyr_[_affID].aff = _aff.add(plyr_[_affID].aff); emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now); } else { _p3d = _p3d.add(_aff); } // pay out p3d _p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100)); if (_p3d > 0) { // deposit to divies contract uint256 _potAmount = _p3d / 2; coin_base.transfer(_p3d.sub(_potAmount)); round_[_rID].pot = round_[_rID].pot.add(_potAmount); // set up event data _eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount); } return(_eventData_); } function potSwap() external payable { // setup local rID uint256 _rID = rID_ + 1; round_[_rID].pot = round_[_rID].pot.add(msg.value); emit F3Devents.onPotSwapDeposit(_rID, msg.value); } /** * @dev distributes eth based on fees to gen and pot */ function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { // calculate gen share uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100; // toss 1% into airdrop pot uint256 _air = (_eth / 100); airDropPot_ = airDropPot_.add(_air); // update eth balance (eth = eth - (com share + pot swap share + aff share + p3d share + airdrop pot share)) _eth = _eth.sub(((_eth.mul(14)) / 100).add((_eth.mul(fees_[_team].p3d)) / 100)); // calculate pot uint256 _pot = _eth.sub(_gen); // distribute gen share (thats what updateMasks() does) and adjust // balances for dust. uint256 _dust = updateMasks(_rID, _pID, _gen, _keys); if (_dust > 0) _gen = _gen.sub(_dust); // add eth to pot round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot); // set up event data _eventData_.genAmount = _gen.add(_eventData_.genAmount); _eventData_.potAmount = _pot; return(_eventData_); } /** * @dev updates masks for round and player when keys are bought * @return dust left over */ function updateMasks(uint256 _rID, uint256 _pID, uint256 _gen, uint256 _keys) private returns(uint256) { /* MASKING NOTES earnings masks are a tricky thing for people to wrap their minds around. the basic thing to understand here. is were going to have a global tracker based on profit per share for each round, that increases in relevant proportion to the increase in share supply. the player will have an additional mask that basically says "based on the rounds mask, my shares, and how much i've already withdrawn, how much is still owed to me?" */ // calc profit per key & round mask based on this buy: (dust goes to pot) uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); round_[_rID].mask = _ppt.add(round_[_rID].mask); // calculate player earning from their own buy (only based on the keys // they just bought). & update player earnings mask uint256 _pearn = (_ppt.mul(_keys)) / (1000000000000000000); plyrRnds_[_pID][_rID].mask = (((round_[_rID].mask.mul(_keys)) / (1000000000000000000)).sub(_pearn)).add(plyrRnds_[_pID][_rID].mask); // calculate & return dust return(_gen.sub((_ppt.mul(round_[_rID].keys)) / (1000000000000000000))); } /** * @dev adds up unmasked earnings, & vault earnings, sets them all to 0 * @return earnings in wei format */ function withdrawEarnings(uint256 _pID) private returns(uint256) { // update gen vault updateGenVault(_pID, plyr_[_pID].lrnd); // from vaults uint256 _earnings = (plyr_[_pID].win).add(plyr_[_pID].gen).add(plyr_[_pID].aff); if (_earnings > 0) { plyr_[_pID].win = 0; plyr_[_pID].gen = 0; plyr_[_pID].aff = 0; } return(_earnings); } /** * @dev prepares compression data and fires event for buy or reload tx's */ function endTx(uint256 _pID, uint256 _team, uint256 _eth, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_) private { _eventData_.compressedData = _eventData_.compressedData + (now * 1000000000000000000) + (_team * 100000000000000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID + (rID_ * 10000000000000000000000000000000000000000000000000000); emit F3Devents.onEndTx ( _eventData_.compressedData, _eventData_.compressedIDs, plyr_[_pID].name, msg.sender, _eth, _keys, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount, _eventData_.potAmount, airDropPot_ ); } //============================================================================== // (~ _ _ _._|_ . // _)(/_(_|_|| | | \/ . //====================/========================================================= /** upon contract deploy, it will be deactivated. this is a one time * use function that will activate the contract. we do this so devs * have time to set things up on the web end **/ bool public activated_ = false; function activate() public { // only team just can activate require(msg.sender == admin, "only admin can activate"); // can only be ran once require(activated_ == false, "FOMO Short already activated"); // activate the contract activated_ = true; // lets start first round rID_ = 1; round_[1].strt = now + rndExtra_ - rndGap_; round_[1].end = now + rndInit_ + rndExtra_; } } //============================================================================== // __|_ _ __|_ _ . // _\ | | |_|(_ | _\ . //============================================================================== library F3Ddatasets { //compressedData key // [76-33][32][31][30][29][28-18][17][16-6][5-3][2][1][0] // 0 - new player (bool) // 1 - joined round (bool) // 2 - new leader (bool) // 3-5 - air drop tracker (uint 0-999) // 6-16 - round end time // 17 - winnerTeam // 18 - 28 timestamp // 29 - team // 30 - 0 = reinvest (round), 1 = buy (round), 2 = buy (ico), 3 = reinvest (ico) // 31 - airdrop happened bool // 32 - airdrop tier // 33 - airdrop amount won //compressedIDs key // [77-52][51-26][25-0] // 0-25 - pID // 26-51 - winPID // 52-77 - rID struct EventReturns { uint256 compressedData; uint256 compressedIDs; address winnerAddr; // winner address bytes32 winnerName; // winner name uint256 amountWon; // amount won uint256 newPot; // amount in new pot uint256 P3DAmount; // amount distributed to p3d uint256 genAmount; // amount distributed to gen uint256 potAmount; // amount added to pot } struct Player { address addr; // player address bytes32 name; // player name uint256 win; // winnings vault uint256 gen; // general vault uint256 aff; // affiliate vault uint256 lrnd; // last round played uint256 laff; // last affiliate id used } struct PlayerRounds { uint256 eth; // eth player has added to round (used for eth limiter) uint256 keys; // keys uint256 mask; // player mask uint256 ico; // ICO phase investment } struct Round { uint256 plyr; // pID of player in lead uint256 team; // tID of team in lead uint256 end; // time ends/ended bool ended; // has round end function been ran uint256 strt; // time round started uint256 keys; // keys uint256 eth; // total eth in uint256 pot; // eth to pot (during round) / final amount paid to winner (after round ends) uint256 mask; // global mask uint256 ico; // total eth sent in during ICO phase uint256 icoGen; // total eth for gen during ICO phase uint256 icoAvg; // average key price for ICO phase } struct TeamFee { uint256 gen; // % of buy in thats paid to key holders of current round uint256 p3d; // % of buy in thats paid to p3d holders } struct PotSplit { uint256 gen; // % of pot thats paid to key holders of current round uint256 p3d; // % of pot thats paid to p3d holders } } //============================================================================== // | _ _ _ | _ . // |<(/_\/ (_(_||(_ . //=======/====================================================================== library F3DKeysCalcShort { using SafeMath for *; /** * @dev calculates number of keys received given X eth * @param _curEth current amount of eth in contract * @param _newEth eth being spent * @return amount of ticket purchased */ function keysRec(uint256 _curEth, uint256 _newEth) internal pure returns (uint256) { return(keys((_curEth).add(_newEth)).sub(keys(_curEth))); } /** * @dev calculates amount of eth received if you sold X keys * @param _curKeys current amount of keys that exist * @param _sellKeys amount of keys you wish to sell * @return amount of eth received */ function ethRec(uint256 _curKeys, uint256 _sellKeys) internal pure returns (uint256) { return((eth(_curKeys)).sub(eth(_curKeys.sub(_sellKeys)))); } /** * @dev calculates how many keys would exist with given an amount of eth * @param _eth eth "in contract" * @return number of keys that would exist */ function keys(uint256 _eth) internal pure returns(uint256) { return ((((((_eth).mul(1000000000000000000)).mul(312500000000000000000000000)).add(5624988281256103515625000000000000000000000000000000000000000000)).sqrt()).sub(74999921875000000000000000000000)) / (156250000); } /** * @dev calculates how much eth would be in contract given a number of keys * @param _keys number of keys "in contract" * @return eth that would exists */ function eth(uint256 _keys) internal pure returns(uint256) { return ((78125000).mul(_keys.sq()).add(((149999843750000).mul(_keys.mul(1000000000000000000))) / (2))) / ((1000000000000000000).sq()); } } //============================================================================== // . _ _|_ _ _ |` _ _ _ _ . // || | | (/_| ~|~(_|(_(/__\ . //============================================================================== interface PlayerBookInterface { function getPlayerID(address _addr) external returns (uint256); function getPlayerName(uint256 _pID) external view returns (bytes32); function getPlayerLAff(uint256 _pID) external view returns (uint256); function getPlayerAddr(uint256 _pID) external view returns (address); function getNameFee() external view returns (uint256); function registerNameXIDFromDapp(address _addr, bytes32 _name, uint256 _affCode, bool _all) external payable returns(bool, uint256); function registerNameXaddrFromDapp(address _addr, bytes32 _name, address _affCode, bool _all) external payable returns(bool, uint256); function registerNameXnameFromDapp(address _addr, bytes32 _name, bytes32 _affCode, bool _all) external payable returns(bool, uint256); } /** * @title -Name Filter- v0.1.9 * ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐ * │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐ * ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘ * _____ _____ * (, / /) /) /) (, / /) /) * ┌─┐ / _ (/_ // // / _ // _ __ _(/ * ├─┤ ___/___(/_/(__(_/_(/_(/_ ___/__/_)_(/_(_(_/ (_(_(_ * ┴ ┴ / / .-/ _____ (__ / * (__ / (_/ (, / /)™ * / __ __ __ __ _ __ __ _ _/_ _ _(/ * ┌─┐┬─┐┌─┐┌┬┐┬ ┬┌─┐┌┬┐ /__/ (_(__(_)/ (_/_)_(_)/ (_(_(_(__(/_(_(_ * ├─┘├┬┘│ │ │││ ││ │ (__ / .-/ © Jekyll Island Inc. 2018 * ┴ ┴└─└─┘─┴┘└─┘└─┘ ┴ (_/ * _ __ _ ____ ____ _ _ _____ ____ ___ *=============| |\ | / /\ | |\/| | |_ =====| |_ | | | | | | | |_ | |_)==============* *=============|_| \| /_/--\ |_| | |_|__=====|_| |_| |_|__ |_| |_|__ |_| \==============* * * ╔═╗┌─┐┌┐┌┌┬┐┬─┐┌─┐┌─┐┌┬┐ ╔═╗┌─┐┌┬┐┌─┐ ┌──────────┐ * ║ │ ││││ │ ├┬┘├─┤│ │ ║ │ │ ││├┤ │ Inventor │ * ╚═╝└─┘┘└┘ ┴ ┴└─┴ ┴└─┘ ┴ ╚═╝└─┘─┴┘└─┘ └──────────┘ */ library NameFilter { /** * @dev filters name strings * -converts uppercase to lower case. * -makes sure it does not start/end with a space * -makes sure it does not contain multiple spaces in a row * -cannot be only numbers * -cannot start with 0x * -restricts characters to A-Z, a-z, 0-9, and space. * @return reprocessed string in bytes32 format */ function nameFilter(string _input) internal pure returns(bytes32) { bytes memory _temp = bytes(_input); uint256 _length = _temp.length; //sorry limited to 32 characters require (_length <= 32 && _length > 0, "string must be between 1 and 32 characters"); // make sure it doesnt start with or end with space require(_temp[0] != 0x20 && _temp[_length-1] != 0x20, "string cannot start or end with space"); // make sure first two characters are not 0x if (_temp[0] == 0x30) { require(_temp[1] != 0x78, "string cannot start with 0x"); require(_temp[1] != 0x58, "string cannot start with 0X"); } // create a bool to track if we have a non number character bool _hasNonNumber; // convert & check for (uint256 i = 0; i < _length; i++) { // if its uppercase A-Z if (_temp[i] > 0x40 && _temp[i] < 0x5b) { // convert to lower case a-z _temp[i] = byte(uint(_temp[i]) + 32); // we have a non number if (_hasNonNumber == false) _hasNonNumber = true; } else { require ( // require character is a space _temp[i] == 0x20 || // OR lowercase a-z (_temp[i] > 0x60 && _temp[i] < 0x7b) || // or 0-9 (_temp[i] > 0x2f && _temp[i] < 0x3a), "string contains invalid characters" ); // make sure theres not 2x spaces in a row if (_temp[i] == 0x20) require( _temp[i+1] != 0x20, "string cannot contain consecutive spaces"); // see if we have a character other than a number if (_hasNonNumber == false && (_temp[i] < 0x30 || _temp[i] > 0x39)) _hasNonNumber = true; } } require(_hasNonNumber == true, "string cannot be only numbers"); bytes32 _ret; assembly { _ret := mload(add(_temp, 32)) } return (_ret); } } /** * @title SafeMath v0.1.9 * @dev Math operations with safety checks that throw on error * change notes: original SafeMath library from OpenZeppelin modified by Inventor * - added sqrt * - added sq * - added pwr * - changed asserts to requires with error log outputs * - removed div, its useless */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; require(c / a == b, "SafeMath mul failed"); 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) { require(b <= a, "SafeMath sub failed"); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; require(c >= a, "SafeMath add failed"); return c; } /** * @dev gives square root of given x. */ function sqrt(uint256 x) internal pure returns (uint256 y) { uint256 z = ((add(x,1)) / 2); y = x; while (z < y) { y = z; z = ((add((x / z),z)) / 2); } } /** * @dev gives square. multiplies x by x */ function sq(uint256 x) internal pure returns (uint256) { return (mul(x,x)); } /** * @dev x to the power of y */ function pwr(uint256 x, uint256 y) internal pure returns (uint256) { if (x==0) return (0); else if (y==0) return (1); else { uint256 z = x; for (uint256 i=1; i < y; i++) z = mul(z,x); return (z); } } }
max length a round timer can be
uint256 constant private rndMax_ = 6 hours;
12,171,410
[ 1, 1896, 769, 279, 3643, 5441, 848, 506, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 5381, 3238, 20391, 2747, 67, 273, 1666, 7507, 31, 1171, 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 ]
./full_match/97/0x37b49Ed6DfCd44db2517FeC6A084Ea5d3bEB7f6D/sources/DefiWarriorPool.sol
* Requests randomness/
function getRandomNumber() public returns (bytes32) { require( LINK.balanceOf(address(this)) >= fee, "Not enough LINK - fill contract with faucet" ); return requestRandomness(keyHash, fee); }
5,038,147
[ 1, 6421, 2744, 4496, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 20581, 1854, 1435, 1071, 1135, 261, 3890, 1578, 13, 288, 203, 3639, 2583, 12, 203, 5411, 22926, 18, 12296, 951, 12, 2867, 12, 2211, 3719, 1545, 14036, 16, 203, 5411, 315, 1248, 7304, 22926, 300, 3636, 6835, 598, 11087, 5286, 278, 6, 203, 3639, 11272, 203, 3639, 327, 590, 8529, 4496, 12, 856, 2310, 16, 14036, 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 ]
// SPDX-License-Identifier: MIT // solhint-disable-next-line compiler-version 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 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.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; } } pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() 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); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } pragma solidity >=0.6.2; import './IUniswapV2Router01.sol'; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (governor) that can be granted exclusive access to * specific functions. * * By default, the governor account will be the one that deploys the contract. This * can later be changed with {transferGovernorship}. * */ contract Governed is Context, Initializable { address public governor; address private proposedGovernor; event UpdatedGovernor(address indexed previousGovernor, address indexed proposedGovernor); /** * @dev Initializes the contract setting the deployer as the initial governor. */ constructor() { address msgSender = _msgSender(); governor = msgSender; emit UpdatedGovernor(address(0), msgSender); } /** * @dev If inheriting child is using proxy then child contract can use * _initializeGoverned() function to initialization this contract */ function _initializeGoverned() internal initializer { address msgSender = _msgSender(); governor = msgSender; emit UpdatedGovernor(address(0), msgSender); } /** * @dev Throws if called by any account other than the governor. */ modifier onlyGovernor { require(governor == _msgSender(), "not-the-governor"); _; } /** * @dev Transfers governorship of the contract to a new account (`proposedGovernor`). * Can only be called by the current owner. */ function transferGovernorship(address _proposedGovernor) external onlyGovernor { require(_proposedGovernor != address(0), "proposed-governor-is-zero"); proposedGovernor = _proposedGovernor; } /** * @dev Allows new governor to accept governorship of the contract. */ function acceptGovernorship() external { require(proposedGovernor == _msgSender(), "not-the-proposed-governor"); emit UpdatedGovernor(governor, proposedGovernor); governor = proposedGovernor; proposedGovernor = address(0); } } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; interface IAddressList { function add(address a) external returns (bool); function addValue(address a, uint256 v) external returns (bool); function addMulti(address[] calldata addrs) external returns (uint256); function addValueMulti(address[] calldata addrs, uint256[] calldata values) external returns (uint256); function remove(address a) external returns (bool); function removeMulti(address[] calldata addrs) external returns (uint256); function get(address a) external view returns (uint256); function contains(address a) external view returns (bool); function at(uint256 index) external view returns (address, uint256); function length() external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; interface IAddressListFactory { function ours(address a) external view returns (bool); function listCount() external view returns (uint256); function listAt(uint256 idx) external view returns (address); function createList() external returns (address listaddr); } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; /* solhint-disable func-name-mixedcase */ import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; interface ISwapManager { event OracleCreated(address indexed _sender, address indexed _newOracle, uint256 _period); function N_DEX() external view returns (uint256); function ROUTERS(uint256 i) external view returns (IUniswapV2Router02); function bestOutputFixedInput( address _from, address _to, uint256 _amountIn ) external view returns ( address[] memory path, uint256 amountOut, uint256 rIdx ); function bestPathFixedInput( address _from, address _to, uint256 _amountIn, uint256 _i ) external view returns (address[] memory path, uint256 amountOut); function bestInputFixedOutput( address _from, address _to, uint256 _amountOut ) external view returns ( address[] memory path, uint256 amountIn, uint256 rIdx ); function bestPathFixedOutput( address _from, address _to, uint256 _amountOut, uint256 _i ) external view returns (address[] memory path, uint256 amountIn); function safeGetAmountsOut( uint256 _amountIn, address[] memory _path, uint256 _i ) external view returns (uint256[] memory result); function unsafeGetAmountsOut( uint256 _amountIn, address[] memory _path, uint256 _i ) external view returns (uint256[] memory result); function safeGetAmountsIn( uint256 _amountOut, address[] memory _path, uint256 _i ) external view returns (uint256[] memory result); function unsafeGetAmountsIn( uint256 _amountOut, address[] memory _path, uint256 _i ) external view returns (uint256[] memory result); function comparePathsFixedInput( address[] memory pathA, address[] memory pathB, uint256 _amountIn, uint256 _i ) external view returns (address[] memory path, uint256 amountOut); function comparePathsFixedOutput( address[] memory pathA, address[] memory pathB, uint256 _amountOut, uint256 _i ) external view returns (address[] memory path, uint256 amountIn); function ours(address a) external view returns (bool); function oracleCount() external view returns (uint256); function oracleAt(uint256 idx) external view returns (address); function getOracle( address _tokenA, address _tokenB, uint256 _period, uint256 _i ) external view returns (address); function createOrUpdateOracle( address _tokenA, address _tokenB, uint256 _period, uint256 _i ) external returns (address oracleAddr); function consultForFree( address _from, address _to, uint256 _amountIn, uint256 _period, uint256 _i ) external view returns (uint256 amountOut, uint256 lastUpdatedAt); /// get the data we want and pay the gas to update function consult( address _from, address _to, uint256 _amountIn, uint256 _period, uint256 _i ) external returns ( uint256 amountOut, uint256 lastUpdatedAt, bool updated ); function updateOracles() external returns (uint256 updated, uint256 expected); function updateOracles(address[] memory _oracleAddrs) external returns (uint256 updated, uint256 expected); } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../bloq/IAddressList.sol"; interface IVesperPool is IERC20 { function deposit() external payable; function deposit(uint256 _share) external; function multiTransfer(address[] memory _recipients, uint256[] memory _amounts) external returns (bool); function excessDebt(address _strategy) external view returns (uint256); function permit( address, address, uint256, uint256, uint8, bytes32, bytes32 ) external; function poolRewards() external returns (address); function reportEarning( uint256 _profit, uint256 _loss, uint256 _payback ) external; function reportLoss(uint256 _loss) external; function resetApproval() external; function sweepERC20(address _fromToken) external; function withdraw(uint256 _amount) external; function withdrawETH(uint256 _amount) external; function whitelistedWithdraw(uint256 _amount) external; function governor() external view returns (address); function keepers() external view returns (IAddressList); function maintainers() external view returns (IAddressList); function feeCollector() external view returns (address); function pricePerShare() external view returns (uint256); function strategy(address _strategy) external view returns ( bool _active, uint256 _interestFee, uint256 _debtRate, uint256 _lastRebalance, uint256 _totalDebt, uint256 _totalLoss, uint256 _totalProfit, uint256 _debtRatio ); function stopEverything() external view returns (bool); function token() external view returns (IERC20); function tokensHere() external view returns (uint256); function totalDebtOf(address _strategy) external view returns (uint256); function totalValue() external view returns (uint256); function withdrawFee() external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; /// @title Errors library library Errors { string public constant INVALID_COLLATERAL_AMOUNT = "1"; // Collateral must be greater than 0 string public constant INVALID_SHARE_AMOUNT = "2"; // Share must be greater than 0 string public constant INVALID_INPUT_LENGTH = "3"; // Input array length must be greater than 0 string public constant INPUT_LENGTH_MISMATCH = "4"; // Input array length mismatch with another array length string public constant NOT_WHITELISTED_ADDRESS = "5"; // Caller is not whitelisted to withdraw without fee string public constant MULTI_TRANSFER_FAILED = "6"; // Multi transfer of tokens has failed string public constant FEE_COLLECTOR_NOT_SET = "7"; // Fee Collector is not set string public constant NOT_ALLOWED_TO_SWEEP = "8"; // Token is not allowed to sweep string public constant INSUFFICIENT_BALANCE = "9"; // Insufficient balance to performs operations to follow string public constant INPUT_ADDRESS_IS_ZERO = "10"; // Input address is zero string public constant FEE_LIMIT_REACHED = "11"; // Fee must be less than MAX_BPS string public constant ALREADY_INITIALIZED = "12"; // Data structure, contract, or logic already initialized and can not be called again string public constant ADD_IN_LIST_FAILED = "13"; // Cannot add address in address list string public constant REMOVE_FROM_LIST_FAILED = "14"; // Cannot remove address from address list string public constant STRATEGY_IS_ACTIVE = "15"; // Strategy is already active, an inactive strategy is required string public constant STRATEGY_IS_NOT_ACTIVE = "16"; // Strategy is not active, an active strategy is required string public constant INVALID_STRATEGY = "17"; // Given strategy is not a strategy of this pool string public constant DEBT_RATIO_LIMIT_REACHED = "18"; // Debt ratio limit reached. It must be less than MAX_BPS string public constant TOTAL_DEBT_IS_NOT_ZERO = "19"; // Strategy total debt must be 0 string public constant LOSS_TOO_HIGH = "20"; // Strategy reported loss must be less than current debt } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; /// @dev Based on https://github.com/boringcrypto/BoringSolidity/blob/master/contracts/BoringBatchable.sol /// @dev WARNING!!! Combining Batchable with `msg.value` can cause double spending issues contract Batchable { /// @dev Helper function to extract a useful revert message from a failed call. /// If the returned data is malformed or not correctly abi encoded then this call can fail itself. function _getRevertMsg(bytes memory _returnData) internal pure returns (string memory) { // If the _res length is less than 68, then the transaction failed silently (without a revert message) if (_returnData.length < 68) return "Transaction reverted silently"; assembly { // Slice the sighash. _returnData := add(_returnData, 0x04) } return abi.decode(_returnData, (string)); // All that remains is the revert string } /// @notice Allows batched call to self (this contract). /// @param calls An array of inputs for each call. /// @param revertOnFail If True then reverts after a failed call and stops doing further calls. // F1: External is ok here because this is the batch function, adding it to a batch makes no sense // F2: Calls in the batch may be payable, delegatecall operates in the same context, so each call in the batch has access to msg.value // C3: The length of the loop is fully under user control, so can't be exploited // C7: Delegatecall is only used on the same contract, so it's safe function batch(bytes[] calldata calls, bool revertOnFail) external payable { for (uint256 i = 0; i < calls.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(calls[i]); if (!success && revertOnFail) { revert(_getRevertMsg(result)); } } } } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "../pool/Errors.sol"; import "../interfaces/bloq/IAddressListFactory.sol"; import "../interfaces/vesper/IVesperPool.sol"; import "./UsingSwapManager.sol"; import "./Batchable.sol"; contract BuyBack is UsingSwapManager, Batchable { using SafeERC20 for IERC20; IERC20 public vsp; IVesperPool public vVSP; // vVSP pool will received buyed back VSPs address public keepers; // sol-address-list address which contains addresses of keepers event MigratedAsset(IERC20 asset, uint256 amount); constructor( address _governor, address _weth, IVesperPool _vVSP, IAddressListFactory _listFactory, ISwapManager _swapManager ) UsingSwapManager(_weth, _swapManager) { require(address(_vVSP) != address(0), "vvsp-is-null"); require(address(_listFactory) != address(0), "address-list-factory-is-null"); governor = _governor; vVSP = _vVSP; vsp = vVSP.token(); keepers = _listFactory.createList(); require(IAddressList(keepers).add(_msgSender()), Errors.ADD_IN_LIST_FAILED); } modifier onlyKeeper() { require(IAddressList(keepers).contains(_msgSender()), "not-a-keeper"); _; } ////////////////////////////// Only Governor ////////////////////////////// /** * @notice Migrate assets to a new contract * @dev The caller has to set the addresses list since we don't maintain a list of them * @param _assets List of assets' address to transfer from * @param _to Assets recipient */ function migrateAssets(address[] memory _assets, address _to) external onlyGovernor { require(_assets.length > 0, "assets-list-is-empty"); require(_to != address(this), "new-contract-is-invalid"); for (uint256 i = 0; i < _assets.length; ++i) { IERC20 _asset = IERC20(_assets[i]); uint256 _balance = _asset.balanceOf(address(this)); _asset.safeTransfer(_to, _balance); emit MigratedAsset(_asset, _balance); } } ///////////////////////////// Only Keeper /////////////////////////////// /// @notice Perform a slippage-protected swap for VSP /// @dev The vVVSP is the beneficiary of the swap /// @dev Have to check allowance to routers before calling this function swapForVspAndTransferToVVSP(address _tokenIn, uint256 _amountIn) external onlyKeeper { if (_amountIn > 0) { uint256 _minAmtOut = (swapSlippage != 10000) ? _calcAmtOutAfterSlippage( _getOracleRate(_simpleOraclePath(_tokenIn, address(vsp)), _amountIn), swapSlippage ) : 1; _safeSwap(_tokenIn, address(vsp), _amountIn, _minAmtOut, address(vVSP)); } } /// @notice Deposit vPool tokens and unwrap them function depositAndUnwrap(IVesperPool _vPool, uint256 _amount) external onlyKeeper { _vPool.transferFrom(_msgSender(), address(this), _amount); _vPool.withdraw(_amount); } /// @notice Withdraw (a.k.a. unwrap) underlying token from vPool function unwrap(IVesperPool _vPool, uint256 _amount) public onlyKeeper { _vPool.withdraw(_amount); } /// @notice Withdraw (a.k.a. unwrap) underlying token from vPool /// @dev Uses all held vPool tokens function unwrapAll(IVesperPool _vPool) external onlyKeeper { unwrap(_vPool, _vPool.balanceOf(address(this))); } /// @notice Transfer VSP tokens to vVSP function transferVspToVVSP(uint256 _amount) public onlyKeeper { vsp.safeTransfer(address(vVSP), _amount); } /// @notice Transfer VSP tokens to vVSP /// @dev Uses all held VSP tokens function transferAllVspToVVSP() external onlyKeeper { transferVspToVVSP(vsp.balanceOf(address(this))); } /// @notice Approve SwapManager routers if needed function doInfinityApproval(IERC20 _unwrapped) external onlyKeeper { _doInfinityApprovalIfNeeded(_unwrapped, type(uint256).max); } /** * @notice Add given address in provided address list. * @dev Use it to add keeper in keepers list and to add address in feeWhitelist * @param _addressToAdd address which we want to add in AddressList. */ function addInKeepersList(address _addressToAdd) external onlyKeeper { require(IAddressList(keepers).add(_addressToAdd), Errors.ADD_IN_LIST_FAILED); } /** * @notice Remove given address from provided address list. * @dev Use it to remove keeper from keepers list and to remove address from feeWhitelist * @param _addressToRemove address which we want to remove from AddressList. */ function removeFromKeepersList(address _addressToRemove) external onlyKeeper { require(IAddressList(keepers).remove(_addressToRemove), Errors.REMOVE_FROM_LIST_FAILED); } /////////////////////////////////////////////////////////////////////////// } // SPDX-License-Identifier: MIT pragma solidity 0.8.3; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../Governed.sol"; import "../interfaces/bloq/ISwapManager.sol"; abstract contract UsingSwapManager is Governed { using SafeERC20 for IERC20; address weth; // Native token ISwapManager public swapManager; uint256 public oraclePeriod = 3600; // 1h; uint256 public oracleRouterIdx = 0; // Uniswap V2; uint256 public swapSlippage = 1000; // 10% event UpdatedSwapManager(address indexed oldSwapManager, address indexed newSwapManager); event UpdatedSwapSlippage(uint256 oldSwapSlippage, uint256 newSwapSlippage); event UpdatedOracleConfig(uint256 oldPeriod, uint256 newPeriod, uint256 oldRouterIdx, uint256 newRouterIdx); constructor(address _weth, ISwapManager _swapManager) { require(address(_weth) != address(0), "weth-is-null"); require(address(_swapManager) != address(0), "swap-manager-is-null"); weth = _weth; swapManager = _swapManager; } ////////////////////////////// Only Governor ////////////////////////////// /** * @notice Update swap manager address * @param _swapManager swap manager address */ function updateSwapManager(address _swapManager) external onlyGovernor { require(_swapManager != address(0), "sm-address-is-zero"); require(_swapManager != address(swapManager), "sm-is-same"); emit UpdatedSwapManager(address(swapManager), _swapManager); swapManager = ISwapManager(_swapManager); } /** * @notice Update swap slippage value * @param _newSwapSlippage new swap slippage */ function updateSwapSlippage(uint256 _newSwapSlippage) external onlyGovernor { require(_newSwapSlippage <= 10000, "invalid-slippage-value"); emit UpdatedSwapSlippage(swapSlippage, _newSwapSlippage); swapSlippage = _newSwapSlippage; } function updateOracleConfig(uint256 _newPeriod, uint256 _newRouterIdx) external onlyGovernor { require(_newRouterIdx < swapManager.N_DEX(), "invalid-router-index"); if (_newPeriod == 0) _newPeriod = oraclePeriod; require(_newPeriod > 59, "invalid-oracle-period"); emit UpdatedOracleConfig(oraclePeriod, _newPeriod, oracleRouterIdx, _newRouterIdx); oraclePeriod = _newPeriod; oracleRouterIdx = _newRouterIdx; } /////////////////////////////////////////////////////////////////////////// /** * @notice Safe swap via Uniswap / Sushiswap (better rate of the two) * @dev There are many scenarios when token swap via Uniswap can fail, so this * method will wrap Uniswap call in a 'try catch' to make it fail safe. * however, this method will throw minAmountOut is not met * @param _tokenIn address of from token * @param _tokenOut address of to token * @param _amountIn Amount to be swapped * @param _minAmountOut minimum amount out */ function _safeSwap( address _tokenIn, address _tokenOut, uint256 _amountIn, uint256 _minAmountOut, address _to ) internal { (address[] memory path, uint256 amountOut, uint256 rIdx) = swapManager.bestOutputFixedInput(_tokenIn, _tokenOut, _amountIn); if (_minAmountOut == 0) _minAmountOut = 1; if (amountOut != 0) { swapManager.ROUTERS(rIdx).swapExactTokensForTokens(_amountIn, _minAmountOut, path, _to, block.timestamp); } } function _calcAmtOutAfterSlippage(uint256 _amount, uint256 _slippage) internal pure returns (uint256) { return (_amount * (10000 - _slippage)) / (10000); } function _getOracleRate(address[] memory path, uint256 _amountIn) internal returns (uint256 amountOut) { require(path.length > 1, "invalid-oracle-path"); amountOut = _amountIn; bool isValid; for (uint256 i = 0; i < path.length - 1; i++) { (amountOut, isValid) = _consultOracle(path[i], path[i + 1], amountOut); require(isValid, "invalid-oracle-rate"); } } function _simpleOraclePath(address _from, address _to) internal view returns (address[] memory path) { if (_from == weth || _to == weth) { path = new address[](2); path[0] = _from; path[1] = _to; } else { path = new address[](3); path[0] = _from; path[1] = weth; path[2] = _to; } } function _consultOracle( address _from, address _to, uint256 _amt ) internal returns (uint256, bool) { // from, to, amountIn, period, router (uint256 rate, uint256 lastUpdate, ) = swapManager.consult(_from, _to, _amt, oraclePeriod, oracleRouterIdx); // We're looking at a TWAP ORACLE with a 1 hr Period that has been updated within the last hour if ((lastUpdate > (block.timestamp - oraclePeriod)) && (rate != 0)) return (rate, true); return (0, false); } function _doInfinityApprovalIfNeeded(IERC20 _asset, uint256 _amountToSwap) internal { for (uint256 i = 0; i < swapManager.N_DEX(); i++) { if (IERC20(_asset).allowance(address(this), address(swapManager.ROUTERS(i))) < _amountToSwap) { IERC20(_asset).safeApprove(address(swapManager.ROUTERS(i)), type(uint256).max); } } } }
@notice Withdraw (a.k.a. unwrap) underlying token from vPool
function unwrap(IVesperPool _vPool, uint256 _amount) public onlyKeeper { _vPool.withdraw(_amount); }
11,778,225
[ 1, 1190, 9446, 261, 69, 18, 79, 18, 69, 18, 11014, 13, 6808, 1147, 628, 331, 2864, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 11014, 12, 8188, 281, 457, 2864, 389, 90, 2864, 16, 2254, 5034, 389, 8949, 13, 1071, 1338, 17891, 288, 203, 3639, 389, 90, 2864, 18, 1918, 9446, 24899, 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 ]
./partial_match/1/0xaA94B351909f27E71e2030fCFa1160dd1A1cF8f6/sources/FTB.sol
必须是操作者 或者 解锁unLock=true;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0, "not quota"); require(handlers[_from] || unLock, "ha ha"); balances[_from] = SafeMath.sub(balances[_from], _value); balances[_to] = SafeMath.add(balances[_to], _value); allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value); emit Transfer(_from, _to, _value); return true; }
3,571,538
[ 1, 166, 128, 232, 170, 99, 124, 167, 251, 112, 167, 246, 240, 165, 126, 255, 169, 227, 232, 225, 167, 235, 249, 169, 227, 232, 225, 169, 105, 101, 170, 247, 228, 318, 2531, 33, 3767, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1135, 261, 6430, 2216, 13, 288, 203, 3639, 2583, 12, 70, 26488, 63, 67, 2080, 65, 1545, 389, 1132, 597, 2935, 63, 67, 2080, 6362, 3576, 18, 15330, 65, 1545, 389, 1132, 597, 389, 1132, 405, 374, 16, 315, 902, 13257, 8863, 203, 3639, 2583, 12, 11046, 63, 67, 2080, 65, 747, 640, 2531, 16, 315, 3395, 10677, 8863, 203, 3639, 324, 26488, 63, 67, 2080, 65, 273, 14060, 10477, 18, 1717, 12, 70, 26488, 63, 67, 2080, 6487, 389, 1132, 1769, 203, 3639, 324, 26488, 63, 67, 869, 65, 273, 14060, 10477, 18, 1289, 12, 70, 26488, 63, 67, 869, 6487, 389, 1132, 1769, 203, 3639, 2935, 63, 67, 2080, 6362, 3576, 18, 15330, 65, 273, 14060, 10477, 18, 1717, 12, 8151, 63, 67, 2080, 6362, 3576, 18, 15330, 6487, 389, 1132, 1769, 203, 3639, 3626, 12279, 24899, 2080, 16, 389, 869, 16, 389, 1132, 1769, 203, 3639, 327, 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 ]
./full_match/4/0x42622B6c7f15430722D62eDb45938D91FC27419B/sources/contracts/AllocationStakingV2.sol
View function for total reward the farm has yet to pay out. NOTE: this is not necessarily the sum of all pending sums on all pools and users example 1: when tokens have been wiped by emergency withdraw example 2: when one pool has no LP supply
function totalPending() external view returns (uint256) { if (block.timestamp <= startTimestamp) { return 0; } uint256 lastTimestamp = block.timestamp < endTimestamp ? block.timestamp : endTimestamp; return rewardPerSecond.mul(lastTimestamp - startTimestamp).sub(paidOut); }
12,286,888
[ 1, 1767, 445, 364, 2078, 19890, 326, 284, 4610, 711, 4671, 358, 8843, 596, 18, 5219, 30, 333, 353, 486, 23848, 326, 2142, 434, 777, 4634, 26608, 603, 777, 16000, 471, 3677, 1377, 3454, 404, 30, 1347, 2430, 1240, 2118, 341, 625, 329, 635, 801, 24530, 598, 9446, 1377, 3454, 576, 30, 1347, 1245, 2845, 711, 1158, 511, 52, 14467, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2078, 8579, 1435, 3903, 1476, 1135, 261, 11890, 5034, 13, 288, 203, 3639, 309, 261, 2629, 18, 5508, 1648, 787, 4921, 13, 288, 203, 5411, 327, 374, 31, 203, 3639, 289, 203, 203, 3639, 2254, 5034, 1142, 4921, 273, 1203, 18, 5508, 411, 679, 4921, 692, 1203, 18, 5508, 294, 679, 4921, 31, 203, 3639, 327, 19890, 2173, 8211, 18, 16411, 12, 2722, 4921, 300, 787, 4921, 2934, 1717, 12, 29434, 1182, 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 ]
pragma solidity ^0.4.18; import "./SafeMath.sol"; import "./Ownable.sol"; contract Supervisor { using SafeMath for uint256; /*STORAGE*/ Job[] public jobList; Task[] public taskList; Audit[] public auditList; Close[] public closeList; //test storage vars string[] public testString; /*map the task identifiers to their reference jobID*/ mapping (uint256 => uint256[]) public jobTasks; /*map the auditIDs to their auditeeTasks*/ mapping (uint256 => uint256) public auditMap; /*map the task structs to their reference jobID (not really working right now because can only return the first element in the array of structs)*/ //mapping (uint256 => Task[]) public jobTasksMapping; /*map the claimable funding posted by task/job posters*/ mapping (address => uint256) public postedFunds; /*EVENTS--TO DEFINE!!*/ event TaskPosted(address indexed taskPoster, uint256 taskID); event TaskClosed(); event JobPosted(address indexed jobPoster, uint256 jobID); event JobClosed(); /*STRUCTS*/ struct Job { /*Job = a set of subTasks, retrievable from mapping*/ /*defined at Job creation*/ address jobCreator; string jobDescription; uint256 postedTime; /*Job status variables*/ bool allSubTasksAccepted; bool allSubTasksCompleted; bool allSubTasksReviewed; bool closed; } struct Task { /*Task = a primary task (not an audit)*/ /*defined at Task creation*/ address taskCreator; string taskDescription; uint256 referenceJobID; //0 if none uint256 postedTime; uint256 bondAmount; //finney uint256 maxPayAmount; //finney uint32 timeLimit; //hours bool auctionedTask; /*Task status variables*/ bool accepted; bool completed; bool audited; address taskAcceptor; uint256 closeID; } struct Audit { /*auditTask = a task consisting of auditing a primary Task*/ /*defined at Audit creation*/ address auditCreator; string auditDescription; uint256 auditeeTask; uint256 postedTime; uint256 bondAmount; //finney uint256 maxPayAmount; //finney uint32 timeLimit; //hours bool auctionedAudit; /*Audit status variables*/ bool accepted; bool completed; bool reAudited; address auditAcceptor; uint256 closeID; } struct Close { //a record of the payment/stiffing at the closing of the task/audit uint256 postedTime; uint256 referenceTaskOrAudit; bool trueIfAuditClose; bool returnedBond; bool paidWage; } /*FUNCTIONS*/ // test functions function testStoreString ( string _testString) public returns (bool) { testString.push(_testString)-1; return true; } /*PRIMARY POSTING FUNCTIONS*/ function createJob ( string _jobDescription) public returns (uint256) { /*DELETE eventually, here for reference uint256 jobID = jobList.length++; Job storage j = jobList[jobID]; //input starting job attributes j.jobDescription = _jobDescription; j.timeLimit = _timeLimit; */ Job memory _job = Job ({ //mark Job with input values jobCreator: msg.sender, jobDescription: _jobDescription, postedTime: now, //mark Job with null values for TBD variables allSubTasksAccepted: false, allSubTasksCompleted: false, allSubTasksReviewed: false, closed: false }); //push job to jobList array uint256 jobID = jobList.push(_job) - 1; //emit event JobPosted(msg.sender, jobID); return jobID; } function createTask ( string _taskDescription, uint256 _referenceJobID, uint256 _bondAmount, uint256 _maxPayAmount, uint32 _timeLimit, bool _auctionedTask) public payable returns (uint256) { //there must be an error message in js when this is triggered, //otherwise confusing to user //prevent user from adding a task to a job they did not create if (_referenceJobID != 0) { require(msg.sender == jobList[_referenceJobID].jobCreator); } //encode task Task memory _task = Task ({ //mark Task with input values taskCreator: msg.sender, taskDescription: _taskDescription, referenceJobID: _referenceJobID, //should be 0 for standalone task postedTime: now, bondAmount: SafeMath.mul(_bondAmount, 1000000000000000), //finney maxPayAmount: SafeMath.mul(_maxPayAmount, 1000000000000000), //finney timeLimit: _timeLimit, auctionedTask: _auctionedTask, //mark Task with null values for TBD variables taskAcceptor: 0x0, accepted: false, completed: false, audited: false, closeID: 0 }); //push task to taskList to general struct array uint256 taskID = taskList.push(_task) - 1; //map the taskID uint to its referenceJob/ jobTasks[_referenceJobID].push(taskID); /*record the sender's concurrent posting of finney, and require that it equals or exceeds the maxPayAmount*/ postedFunds[msg.sender] += msg.value; /*comment out for testing to reduce fail points:*/ //require(msg.value == taskList[taskID].maxPayAmount); /*(DELETE IF NOT USED) map the whole struct to its referenceJob-- See *storage* above--not really working now bc can only seem to return the first element in the struct array */ //jobTasksMapping[_referenceJobID].push(_task); //emit Event TaskPosted(msg.sender, taskID); return taskID; } function createAudit ( string _auditDescription, uint256 _auditeeTask, uint256 _bondAmount, uint256 _maxPayAmount, uint32 _timeLimit, bool _auctionedAudit) public payable returns (uint256) { Audit memory _audit = Audit ({ //mark Audit with input values auditCreator: msg.sender, auditDescription: _auditDescription, auditeeTask: _auditeeTask, postedTime: now, bondAmount: SafeMath.mul(_bondAmount, 1000000000000000), //finney maxPayAmount: SafeMath.mul(_maxPayAmount, 1000000000000000), //finney timeLimit: _timeLimit, auctionedAudit: _auctionedAudit, //mark Audit with null for TBD values auditAcceptor: 0x0, accepted: false, completed: false, reAudited: false, closeID: 0 }); //prevent user from adding an audit to a task they did not create if (_auditeeTask != 0) { require(msg.sender == taskList[_auditeeTask].taskCreator); } //push audit to auditList array uint256 auditID = auditList.push(_audit) - 1; //map the auditID uint to its auditeeTask/ auditMap[_auditeeTask] = auditID; /*record the sender's concurrent posting of finney, and require that it equals or exceeds the maxPayAmount*/ postedFunds[msg.sender] += msg.value; require(msg.value == auditList[auditID].maxPayAmount); return auditID; } /*INTERACTION FUNCTIONS*/ function acceptTask ( uint256 _taskID) public payable { /* get Task and check that Task is 1) not already accepted, 2) not an auctioned Task, 3) not expired */ uint256 taskID = _taskID; require(taskList[taskID].accepted == false); require(taskList[taskID].auctionedTask == false); if (taskList[taskID].timeLimit > 0) { require((taskList[taskID].postedTime + (taskList[taskID].timeLimit * 1 hours)) > now); } //record the bond sent by user, & Require that sufficient bond is send & posted postedFunds[msg.sender] += msg.value; require(msg.value == taskList[taskID].bondAmount); //mark task struct accepted by user taskList[taskID].taskAcceptor = msg.sender; taskList[taskID].accepted = true; } function acceptAudit ( uint256 _auditID) public payable { //local vars uint256 auditID = _auditID; uint256 auditeeTaskID = auditList[auditID].auditeeTask; /* check that Audit is 1) not already accepted, 2) not an auctioned Audit, 3) not expired, if there is a time limit 4) not being accepted by the auditee task acceptor */ require(auditList[auditID].accepted == false); require(auditList[auditID].auctionedAudit == false); if (auditList[auditID].timeLimit > 0) { require((auditList[auditID].postedTime + (auditList[auditID].timeLimit * 1 hours)) > now); } require(msg.sender != taskList[auditeeTaskID].taskAcceptor); //record the bond sent by user, & Require that sufficient bond is send & posted postedFunds[msg.sender] += msg.value; require(msg.value >= auditList[auditID].bondAmount); //mark Audit struct accepted by user auditList[auditID].auditAcceptor = msg.sender; auditList[auditID].accepted = true; } function markTaskComplete (uint256 _taskID) public { require(msg.sender == taskList[_taskID].taskAcceptor); taskList[_taskID].completed = true; } function markAuditComplete (uint256 _auditID) public { uint256 auditeeTaskID = auditList[_auditID].auditeeTask; require(msg.sender == auditList[_auditID].auditAcceptor); auditList[_auditID].completed = true; taskList[auditeeTaskID].completed = true; } function closeOutTask (uint256 _taskID, bool _returnBond, bool _remitPay) public returns (uint256) { //set up pay variable, threshold requires uint256 applicablePay; address taskAcceptor = taskList[_taskID].taskAcceptor; require(msg.sender == taskList[_taskID].taskCreator); require(postedFunds[msg.sender] >= taskList[_taskID].maxPayAmount); require(postedFunds[taskAcceptor] >= taskList[_taskID].bondAmount); require(taskList[_taskID].accepted == true); //fill out Close struct Close memory _close = Close ({ postedTime: now, referenceTaskOrAudit: _taskID, trueIfAuditClose: false, returnedBond: _returnBond, paidWage: _remitPay }); //push close Struct to storage uint256 closeID = closeList.push(_close) - 1; /*contract remits the deposit/pay*/ //applicablePay is necessarily maxpayamount only if non-auction if (taskList[_taskID].auctionedTask == false) { applicablePay = taskList[_taskID].maxPayAmount; } else { revert(); } //if returnBond true, K sends to Acceptor, else, to taskCreator uint256 taskBond = taskList[_taskID].bondAmount; if (_returnBond == true) { taskAcceptor.transfer(taskBond); } else { msg.sender.transfer(taskBond); } postedFunds[taskAcceptor] -= taskBond; //if remitPay true, K sends to Acceptor, else, to taskCreator if (_remitPay == true) { taskAcceptor.transfer(applicablePay); } else { msg.sender.transfer(applicablePay); } postedFunds[msg.sender] -= applicablePay; //update Task struct with closeID taskList[_taskID].closeID = closeID; return closeID; } function closeOutAudit (uint256 _auditID, bool _returnBond, bool _remitPay) public returns (uint256) { //set up pay variable, threshold requires uint256 applicablePay; address auditAcceptor = auditList[_auditID].auditAcceptor; require(msg.sender == auditList[_auditID].auditCreator); require(postedFunds[msg.sender] >= auditList[_auditID].maxPayAmount); require(postedFunds[auditAcceptor] >= auditList[_auditID].bondAmount); require(auditList[_auditID].accepted == true); //fill out Close struct Close memory _close = Close ({ postedTime: now, referenceTaskOrAudit: _auditID, trueIfAuditClose: true, returnedBond: _returnBond, paidWage: _remitPay }); //push close Struct to storage uint256 closeID = closeList.push(_close) - 1; /*contract remits the deposit/pay*/ //applicablePay is necessarily maxpayamount only if non-auction if (auditList[_auditID].auctionedAudit == false) { applicablePay = auditList[_auditID].maxPayAmount; } else { revert(); } //if returnBond true, K sends to Acceptor, else, to taskCreator uint256 auditBond = auditList[_auditID].bondAmount; if (_returnBond == true) { auditAcceptor.transfer(auditBond); } else { msg.sender.transfer(auditBond); } postedFunds[auditAcceptor] -= auditBond; //if remitPay true, K sends to Acceptor, else, to taskCreator if (_remitPay == true) { auditAcceptor.transfer(applicablePay); } else { msg.sender.transfer(applicablePay); } postedFunds[msg.sender] -= applicablePay; //update Audit struct with closeID auditList[_auditID].closeID = closeID; return closeID; } /* function closeOutAudit () public { } function closeJob () public { } */ /*GETTERS AND INFORMATION FUNCTIONS*/ /*enter the jobID and jobTaskId (i.e., the [arraynum] of the Task w/in the Job); and return the global TaskID of that task, if there is one*/ function testStringGetter () public constant returns (uint256 numberOfStrings, string lastString) { uint256 len = testString.length - 1; return (testString.length, testString[len]); } function getJobSizeAndTaskID ( uint256 _jobID, uint256 _jobTask) public constant returns (uint256 numberOfTaskIDs, uint256 calledTaskID) { return (jobTasks[_jobID].length, jobTasks[_jobID][_jobTask]); } //simple checker of balance of entire contract //possibly mark owned, eventually function getContractBalance () public constant returns (uint256) { return this.balance; } //check storage mapping to see how many Ether the user has posted to the contract function checkEtherSentToContract () public constant returns (uint256) { uint256 userFunds = postedFunds[msg.sender]; return userFunds; } /*FALLBACK FUNCTION for handling payments not associated with the posting of a task*/ function () public payable { postedFunds[msg.sender] += msg.value; } //simple checker of the contract address, for testing function checkContractAddress () external constant returns (address contractAddress) { contractAddress = this; return contractAddress; } function taskListGetter (uint256 _taskID) public constant returns (string) { return (taskList[_taskID].taskDescription); } function jobTasklistGetter (uint256 _jobID) public constant returns (uint256[]) { return (jobTasks[_jobID]); } }
mark Audit with input valuesmark Audit with null for TBD values
function createAudit ( string _auditDescription, uint256 _auditeeTask, uint256 _bondAmount, uint256 _maxPayAmount, uint32 _timeLimit, bool _auctionedAudit) public payable returns (uint256) { Audit memory _audit = Audit ({ auditCreator: msg.sender, auditDescription: _auditDescription, auditeeTask: _auditeeTask, postedTime: now, timeLimit: _timeLimit, auctionedAudit: _auctionedAudit, auditAcceptor: 0x0, accepted: false, completed: false, reAudited: false, closeID: 0 }); if (_auditeeTask != 0) { require(msg.sender == taskList[_auditeeTask].taskCreator); } uint256 auditID = auditList.push(_audit) - 1; auditMap[_auditeeTask] = auditID; postedFunds[msg.sender] += msg.value; require(msg.value == auditList[auditID].maxPayAmount); return auditID; }
1,818,859
[ 1, 3355, 12975, 598, 810, 924, 3355, 12975, 598, 446, 364, 399, 18096, 924, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 752, 10832, 261, 203, 3639, 533, 389, 17413, 3291, 16, 203, 3639, 2254, 5034, 389, 24901, 1137, 73, 2174, 16, 203, 3639, 2254, 5034, 389, 26425, 6275, 16, 203, 3639, 2254, 5034, 389, 1896, 9148, 6275, 16, 203, 3639, 2254, 1578, 389, 957, 3039, 16, 203, 3639, 1426, 389, 69, 4062, 329, 10832, 13, 203, 3639, 1071, 8843, 429, 1135, 261, 11890, 5034, 13, 288, 203, 203, 5411, 12975, 3778, 389, 17413, 273, 12975, 10797, 203, 203, 203, 7734, 8215, 10636, 30, 1234, 18, 15330, 16, 203, 7734, 8215, 3291, 30, 389, 17413, 3291, 16, 203, 7734, 20232, 1137, 73, 2174, 30, 389, 24901, 1137, 73, 2174, 16, 203, 7734, 23082, 950, 30, 2037, 16, 203, 7734, 813, 3039, 30, 389, 957, 3039, 16, 203, 7734, 279, 4062, 329, 10832, 30, 389, 69, 4062, 329, 10832, 16, 203, 203, 203, 7734, 8215, 5933, 280, 30, 374, 92, 20, 16, 203, 7734, 8494, 30, 629, 16, 203, 7734, 5951, 30, 629, 16, 203, 7734, 283, 10832, 329, 30, 629, 16, 203, 7734, 1746, 734, 30, 374, 203, 203, 5411, 15549, 203, 203, 3639, 309, 261, 67, 24901, 1137, 73, 2174, 480, 374, 13, 288, 203, 5411, 2583, 12, 3576, 18, 15330, 422, 1562, 682, 63, 67, 24901, 1137, 73, 2174, 8009, 4146, 10636, 1769, 203, 3639, 289, 203, 203, 3639, 2254, 5034, 8215, 734, 273, 8215, 682, 18, 6206, 24899, 17413, 13, 300, 404, 31, 203, 203, 3639, 8215, 863, 63, 67, 24901, 1137, 73, 2174, 65, 273, 8215, 734, 31, 203, 203, 2 ]
./partial_match/56/0x6BC509924953c7c7A5D433BCc0B4A96b6C7d61a4/sources/CommonMaster.sol
Unstake without caring about rewards. EMERGENCY ONLY.
function emergencyUnstake(address _pair, uint256 _amount) external override { UserInfo storage userInfo = poolUserInfoMap[_pair][msg.sender]; PoolInfo memory pool = poolInfoMap[_pair]; if (_amount == 0) { _amount = userInfo.amount; _amount = Math.min(_amount, userInfo.amount); } ERC20(_pair).safeTransfer(address(msg.sender), _amount); emit EmergencyUnstake(msg.sender, _pair, _amount); if (_amount == userInfo.amount) { delete poolUserInfoMap[_pair][msg.sender]; userInfo.amount = userInfo.amount.sub(_amount); userInfo.rewardDebt = userInfo .amount .mul(pool.accTokenPerShare) .mul(10**uint256(token.decimals())) .div(10**uint256(ERC20(_pair).decimals())) .div(accTokenPerShareMultiple); } }
11,114,478
[ 1, 984, 334, 911, 2887, 5926, 310, 2973, 283, 6397, 18, 7141, 654, 16652, 16068, 20747, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 801, 24530, 984, 334, 911, 12, 2867, 389, 6017, 16, 2254, 5034, 389, 8949, 13, 3903, 3849, 288, 203, 3639, 25003, 2502, 16753, 273, 2845, 21015, 863, 63, 67, 6017, 6362, 3576, 18, 15330, 15533, 203, 3639, 8828, 966, 3778, 2845, 273, 2845, 966, 863, 63, 67, 6017, 15533, 203, 3639, 309, 261, 67, 8949, 422, 374, 13, 288, 203, 5411, 389, 8949, 273, 16753, 18, 8949, 31, 203, 5411, 389, 8949, 273, 2361, 18, 1154, 24899, 8949, 16, 16753, 18, 8949, 1769, 203, 3639, 289, 203, 3639, 4232, 39, 3462, 24899, 6017, 2934, 4626, 5912, 12, 2867, 12, 3576, 18, 15330, 3631, 389, 8949, 1769, 203, 3639, 3626, 512, 6592, 75, 2075, 984, 334, 911, 12, 3576, 18, 15330, 16, 389, 6017, 16, 389, 8949, 1769, 203, 3639, 309, 261, 67, 8949, 422, 16753, 18, 8949, 13, 288, 203, 5411, 1430, 2845, 21015, 863, 63, 67, 6017, 6362, 3576, 18, 15330, 15533, 203, 5411, 16753, 18, 8949, 273, 16753, 18, 8949, 18, 1717, 24899, 8949, 1769, 203, 5411, 16753, 18, 266, 2913, 758, 23602, 273, 16753, 203, 7734, 263, 8949, 203, 7734, 263, 16411, 12, 6011, 18, 8981, 1345, 2173, 9535, 13, 203, 7734, 263, 16411, 12, 2163, 636, 11890, 5034, 12, 2316, 18, 31734, 1435, 3719, 203, 7734, 263, 2892, 12, 2163, 636, 11890, 5034, 12, 654, 39, 3462, 24899, 6017, 2934, 31734, 1435, 3719, 203, 7734, 263, 2892, 12, 8981, 1345, 2173, 9535, 8438, 1769, 203, 3639, 289, 203, 565, 289, 203, 203, 2, -100, -100, -100, -100, -100, -100 ]
./partial_match/1/0xD0426eD78A7876116f60840D6a1800Ea28d59292/sources/InstaPoolV2.sol
CHECK9898 - does solo has all the ETH?
uint _amount = wethContract.balanceOf(soloAddr);
2,857,230
[ 1, 10687, 29, 6675, 28, 300, 1552, 3704, 83, 711, 777, 326, 512, 2455, 35, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 389, 8949, 273, 341, 546, 8924, 18, 12296, 951, 12, 87, 12854, 3178, 1769, 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 ]
./partial_match/1/0x0CEB4829B3A054ae387E2E0FE0836Baf35A5B6e2/sources/WrappedERC4626YearnCRVAave.sol
* @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing. - MUST be an ERC-20 token contract. - MUST NOT revert./* @dev Returns the total amount of the underlying asset that is “managed” by Vault. - SHOULD include any compounding that occurs from yield. - MUST be inclusive of any fees that are charged against assets in the Vault. - MUST NOT revert./* @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal scenario where all the conditions are met. - MUST NOT be inclusive of any fees that are charged against assets in the Vault. - MUST NOT show any variations depending on the caller. - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. - MUST NOT revert. NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and from./* @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal scenario where all the conditions are met. - MUST NOT be inclusive of any fees that are charged against assets in the Vault. - MUST NOT show any variations depending on the caller. - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange. - MUST NOT revert. NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and from./* @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens. - MUST emit the Deposit event. - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the deposit execution, and are accounted for during deposit. - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not approving enough underlying tokens to the Vault contract, etc). NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token./* @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver. - MUST emit the Withdraw event. - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the redeem execution, and are accounted for during redeem. - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner not having enough shares, etc). NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed. Those methods should be performed separately./ File: IYearnV2Vault.sol
interface IYearnV2Vault is IERC20Metadata { function deposit(uint256 amount) external returns (uint256); function withdraw( uint256 maxShares, address receiver ) external returns (uint256); function token() external view returns (address); function pricePerShare() external view returns (uint256); }
3,584,730
[ 1, 1356, 326, 1758, 434, 326, 6808, 1147, 1399, 364, 326, 17329, 364, 2236, 310, 16, 443, 1724, 310, 16, 471, 598, 9446, 310, 18, 300, 10685, 506, 392, 4232, 39, 17, 3462, 1147, 6835, 18, 300, 10685, 4269, 15226, 18, 19, 225, 2860, 326, 2078, 3844, 434, 326, 6808, 3310, 716, 353, 225, 163, 227, 255, 19360, 163, 227, 256, 635, 17329, 18, 300, 6122, 31090, 2341, 1281, 11360, 310, 716, 9938, 628, 2824, 18, 300, 10685, 506, 13562, 434, 1281, 1656, 281, 716, 854, 1149, 2423, 5314, 7176, 316, 326, 17329, 18, 300, 10685, 4269, 15226, 18, 19, 225, 2860, 326, 3844, 434, 24123, 716, 326, 17329, 4102, 7829, 364, 326, 3844, 434, 7176, 2112, 16, 316, 392, 23349, 10766, 1625, 777, 326, 4636, 854, 5100, 18, 300, 10685, 4269, 506, 13562, 434, 1281, 1656, 281, 716, 854, 1149, 2423, 5314, 7176, 316, 326, 17329, 18, 300, 2 ]
[ 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, 5831, 467, 61, 73, 1303, 58, 22, 12003, 353, 467, 654, 39, 3462, 2277, 288, 203, 565, 445, 443, 1724, 12, 11890, 5034, 3844, 13, 3903, 1135, 261, 11890, 5034, 1769, 203, 203, 565, 445, 598, 9446, 12, 203, 3639, 2254, 5034, 943, 24051, 16, 203, 3639, 1758, 5971, 203, 565, 262, 3903, 1135, 261, 11890, 5034, 1769, 203, 203, 565, 445, 1147, 1435, 3903, 1476, 1135, 261, 2867, 1769, 203, 203, 565, 445, 6205, 2173, 9535, 1435, 3903, 1476, 1135, 261, 11890, 5034, 1769, 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 ]
pragma solidity 0.6.12; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./IBancorNetwork.sol"; import "./IConversionPathFinder.sol"; import "./converter/interfaces/IConverter.sol"; import "./converter/interfaces/IConverterAnchor.sol"; import "./utility/ContractRegistryClient.sol"; import "./utility/TokenHolder.sol"; import "./token/interfaces/IDSToken.sol"; import "./token/SafeERC20Ex.sol"; import "./token/ReserveToken.sol"; import "./bancorx/interfaces/IBancorX.sol"; interface ILegacyConverter { function change( IReserveToken sourceToken, IReserveToken targetToken, uint256 sourceAmount, uint256 minReturn ) external returns (uint256); } contract BancorNetwork is IBancorNetwork, TokenHolder, ContractRegistryClient, ReentrancyGuard { using SafeMath for uint256; using ReserveToken for IReserveToken; using SafeERC20 for IERC20; using SafeERC20Ex for IERC20; struct ConversionStep { IConverter converter; IConverterAnchor anchor; IReserveToken sourceToken; IReserveToken targetToken; address payable beneficiary; bool isV28OrHigherConverter; } event Conversion( IConverterAnchor indexed anchor, IReserveToken indexed sourceToken, IReserveToken indexed targetToken, uint256 sourceAmount, uint256 targetAmount, address trader ); ] constructor(IContractRegistry registry) public ContractRegistryClient(registry) {} function conversionPath(IReserveToken sourceToken, IReserveToken targetToken) public view returns (address[] memory) { IConversionPathFinder pathFinder = IConversionPathFinder(_addressOf(CONVERSION_PATH_FINDER)); return pathFinder.findPath(sourceToken, targetToken); } function rateByPath(address[] memory path, uint256 sourceAmount) public view override returns (uint256) { require(path.length > 2 && path.length % 2 == 1, "ERR_INVALID_PATH"); uint256 amount = sourceAmount; for (uint256 i = 2; i < path.length; i += 2) { IReserveToken sourceToken = IReserveToken(path[i - 2]); address anchor = path[i - 1]; IReserveToken targetToken = IReserveToken(path[i]); IConverter converter = IConverter(payable(IConverterAnchor(anchor).owner())); (amount, ) = _getReturn(converter, sourceToken, targetToken, amount); } return amount; } function convertByPath2( address[] memory path, uint256 sourceAmount, uint256 minReturn, address payable beneficiary ) public payable nonReentrant greaterThanZero(minReturn) returns (uint256) { require(path.length > 2 && path.length % 2 == 1, "ERR_INVALID_PATH"); _handleSourceToken(IReserveToken(path[0]), IConverterAnchor(path[1]), sourceAmount); if (beneficiary == address(0)) { beneficiary = msg.sender; } ConversionStep[] memory data = _createConversionData(path, beneficiary); uint256 amount = _doConversion(data, sourceAmount, minReturn); _handleTargetToken(data, amount, beneficiary); return amount; } function xConvert( address[] memory path, uint256 sourceAmount, uint256 minReturn, bytes32 targetBlockchain, bytes32 targetAccount, uint256 conversionId ) public payable greaterThanZero(minReturn) returns (uint256) { IReserveToken targetToken = IReserveToken(path[path.length - 1]); IBancorX bancorX = IBancorX(_addressOf(BANCOR_X)); require(targetToken == IReserveToken(_addressOf(BNT_TOKEN)), "ERR_INVALID_TARGET_TOKEN"); uint256 amount = convertByPath2(path, sourceAmount, minReturn, payable(address(this))); targetToken.ensureApprove(address(bancorX), amount); bancorX.xTransfer(targetBlockchain, targetAccount, amount, conversionId); return amount; } function completeXConversion( address[] memory path, IBancorX bancorX, uint256 conversionId, uint256 minReturn, address payable beneficiary ) public returns (uint256) { require(path[0] == address(bancorX.token()), "ERR_INVALID_SOURCE_TOKEN"); uint256 amount = bancorX.getXTransferAmount(conversionId, msg.sender); return convertByPath2(path, amount, minReturn, beneficiary); } function _doConversion( ConversionStep[] memory data, uint256 sourceAmount, uint256 minReturn ) private returns (uint256) { uint256 targetAmount; for (uint256 i = 0; i < data.length; i++) { ConversionStep memory stepData = data[i]; if (stepData.isV28OrHigherConverter) { if (i != 0 && data[i - 1].beneficiary == address(this) && !stepData.sourceToken.isNativeToken()) { stepData.sourceToken.safeTransfer(address(stepData.converter), sourceAmount); } } else { assert(address(stepData.sourceToken) != address(stepData.anchor)); stepData.sourceToken.ensureApprove(address(stepData.converter), sourceAmount); } if (!stepData.isV28OrHigherConverter) { targetAmount = ILegacyConverter(address(stepData.converter)).change( stepData.sourceToken, stepData.targetToken, sourceAmount, 1 ); } else if (stepData.sourceToken.isNativeToken()) { targetAmount = stepData.converter.convert{ value: msg.value }( stepData.sourceToken, stepData.targetToken, sourceAmount, msg.sender, stepData.beneficiary ); } else { targetAmount = stepData.converter.convert( stepData.sourceToken, stepData.targetToken, sourceAmount, msg.sender, stepData.beneficiary ); } emit Conversion( stepData.anchor, stepData.sourceToken, stepData.targetToken, sourceAmount, targetAmount, msg.sender ); sourceAmount = targetAmount; } require(targetAmount >= minReturn, "ERR_RETURN_TOO_LOW"); return targetAmount; } function _handleSourceToken( IReserveToken sourceToken, IConverterAnchor anchor, uint256 sourceAmount ) private { IConverter firstConverter = IConverter(payable(anchor.owner())); bool isNewerConverter = _isV28OrHigherConverter(firstConverter); if (msg.value > 0) { require(msg.value == sourceAmount, "ERR_ETH_AMOUNT_MISMATCH"); require(sourceToken.isNativeToken(), "ERR_INVALID_SOURCE_TOKEN"); require(isNewerConverter, "ERR_CONVERTER_NOT_SUPPORTED"); } else { require(!sourceToken.isNativeToken(), "ERR_INVALID_SOURCE_TOKEN"); if (isNewerConverter) { sourceToken.safeTransferFrom(msg.sender, address(firstConverter), sourceAmount); } else { sourceToken.safeTransferFrom(msg.sender, address(this), sourceAmount); } } } function _handleTargetToken( ConversionStep[] memory data, uint256 targetAmount, address payable beneficiary ) private { ConversionStep memory stepData = data[data.length - 1]; if (stepData.beneficiary != address(this)) { return; } IReserveToken targetToken = stepData.targetToken; assert(!targetToken.isNativeToken()); targetToken.safeTransfer(beneficiary, targetAmount); } function _createConversionData(address[] memory path, address payable beneficiary) private view returns (ConversionStep[] memory) { ConversionStep[] memory data = new ConversionStep[](path.length / 2); uint256 i; for (i = 0; i < path.length - 1; i += 2) { IConverterAnchor anchor = IConverterAnchor(path[i + 1]); IConverter converter = IConverter(payable(anchor.owner())); IReserveToken targetToken = IReserveToken(path[i + 2]); data[i / 2] = ConversionStep({ // set the converter anchor anchor: anchor, // set the converter converter: converter, // set the source/target tokens sourceToken: IReserveToken(path[i]), targetToken: targetToken, // requires knowledge about the next step, so initialize in the next phase beneficiary: address(0), // set flags isV28OrHigherConverter: _isV28OrHigherConverter(converter) }); } for (i = 0; i < data.length; i++) { ConversionStep memory stepData = data[i]; if (stepData.isV28OrHigherConverter) { if (i == data.length - 1) { stepData.beneficiary = beneficiary; } else if (data[i + 1].isV28OrHigherConverter) { stepData.beneficiary = address(data[i + 1].converter); } else { stepData.beneficiary = payable(address(this)); } } else { stepData.beneficiary = payable(address(this)); } } return data; } bytes4 private constant GET_RETURN_FUNC_SELECTOR = bytes4(keccak256("getReturn(address,address,uint256)")); function _getReturn( IConverter dest, IReserveToken sourceToken, IReserveToken targetToken, uint256 sourceAmount ) internal view returns (uint256, uint256) { bytes memory data = abi.encodeWithSelector(GET_RETURN_FUNC_SELECTOR, sourceToken, targetToken, sourceAmount); (bool success, bytes memory returnData) = address(dest).staticcall(data); if (success) { if (returnData.length == 64) { return abi.decode(returnData, (uint256, uint256)); } if (returnData.length == 32) { return (abi.decode(returnData, (uint256)), 0); } } return (0, 0); } bytes4 private constant IS_V28_OR_HIGHER_FUNC_SELECTOR = bytes4(keccak256("isV28OrHigher()")); function _isV28OrHigherConverter(IConverter converter) internal view returns (bool) { bytes memory data = abi.encodeWithSelector(IS_V28_OR_HIGHER_FUNC_SELECTOR); (bool success, bytes memory returnData) = address(converter).staticcall{ gas: 4000 }(data); if (success && returnData.length == 32) { return abi.decode(returnData, (bool)); } return false; } /** * @dev deprecated, backward compatibility */ function getReturnByPath(address[] memory path, uint256 sourceAmount) public view returns (uint256, uint256) { return (rateByPath(path, sourceAmount), 0); } /** * @dev deprecated, backward compatibility */ function convertByPath( address[] memory path, uint256 sourceAmount, uint256 minReturn, address payable beneficiary, address, /* affiliateAccount */ uint256 /* affiliateFee */ ) public payable override returns (uint256) { return convertByPath2(path, sourceAmount, minReturn, beneficiary); } /** * @dev deprecated, backward compatibility */ function convert( address[] memory path, uint256 sourceAmount, uint256 minReturn ) public payable returns (uint256) { return convertByPath2(path, sourceAmount, minReturn, address(0)); } /** * @dev deprecated, backward compatibility */ function convert2( address[] memory path, uint256 sourceAmount, uint256 minReturn, address, /* affiliateAccount */ uint256 /* affiliateFee */ ) public payable returns (uint256) { return convertByPath2(path, sourceAmount, minReturn, address(0)); } /** * @dev deprecated, backward compatibility */ function convertFor( address[] memory path, uint256 sourceAmount, uint256 minReturn, address payable beneficiary ) public payable returns (uint256) { return convertByPath2(path, sourceAmount, minReturn, beneficiary); } /** * @dev deprecated, backward compatibility */ function convertFor2( address[] memory path, uint256 sourceAmount, uint256 minReturn, address payable beneficiary, address, /* affiliateAccount */ uint256 /* affiliateFee */ ) public payable greaterThanZero(minReturn) returns (uint256) { return convertByPath2(path, sourceAmount, minReturn, beneficiary); } /** * @dev deprecated, backward compatibility */ function claimAndConvert( address[] memory path, uint256 sourceAmount, uint256 minReturn ) public returns (uint256) { return convertByPath2(path, sourceAmount, minReturn, address(0)); } /** * @dev deprecated, backward compatibility */ function claimAndConvert2( address[] memory path, uint256 sourceAmount, uint256 minReturn, address, /* affiliateAccount */ uint256 /* affiliateFee */ ) public returns (uint256) { return convertByPath2(path, sourceAmount, minReturn, address(0)); } /** * @dev deprecated, backward compatibility */ function claimAndConvertFor( address[] memory path, uint256 sourceAmount, uint256 minReturn, address payable beneficiary ) public returns (uint256) { return convertByPath2(path, sourceAmount, minReturn, beneficiary); } /** * @dev deprecated, backward compatibility */ function claimAndConvertFor2( address[] memory path, uint256 sourceAmount, uint256 minReturn, address payable beneficiary, address, /* affiliateAccount */ uint256 /* affiliateFee */ ) public returns (uint256) { return convertByPath2(path, sourceAmount, minReturn, beneficiary); } }
* @dev deprecated, backward compatibility/
) public returns (uint256) { return convertByPath2(path, sourceAmount, minReturn, address(0)); }
2,507,029
[ 1, 14089, 16, 12555, 8926, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1135, 261, 11890, 5034, 13, 288, 203, 3639, 327, 1765, 16736, 22, 12, 803, 16, 1084, 6275, 16, 1131, 990, 16, 1758, 12, 20, 10019, 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 ]
/** *Submitted for verification at Etherscan.io on 2019-07-10 */ /* * Crypto stamp colors storage * Store colors for connected physical assets * * Developed by capacity.at * for post.at */ // File: openzeppelin-solidity/contracts/introspection/IERC165.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC165 standard, as defined in the * [EIP](https://eips.ethereum.org/EIPS/eip-165). * * 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 * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * 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: openzeppelin-solidity/contracts/token/ERC721/IERC721.sol pragma solidity ^0.5.0; /** * @dev Required interface of an ERC721 compliant contract. */ contract IERC721 is IERC165 { 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); /** * @dev Returns the number of NFTs in `owner`&#39;s account. */ function balanceOf(address owner) public view returns (uint256 balance); /** * @dev Returns the owner of the NFT specified by `tokenId`. */ function ownerOf(uint256 tokenId) public view returns (address owner); /** * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to * another (`to`). * * * * Requirements: * - `from`, `to` cannot be zero. * - `tokenId` must be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this * NFT by either `approve` or `setApproveForAll`. */ function safeTransferFrom(address from, address to, uint256 tokenId) public; /** * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to * another (`to`). * * Requirements: * - If the caller is not `from`, it must be approved to move this NFT by * either `approve` or `setApproveForAll`. */ function transferFrom(address from, address to, uint256 tokenId) public; 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 safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public; } // File: openzeppelin-solidity/contracts/token/ERC721/IERC721Enumerable.sol pragma solidity ^0.5.0; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ contract IERC721Enumerable is IERC721 { 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); } // File: openzeppelin-solidity/contracts/token/ERC721/IERC721Metadata.sol pragma solidity ^0.5.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ contract IERC721Metadata is IERC721 { function name() external view returns (string memory); function symbol() external view returns (string memory); function tokenURI(uint256 tokenId) external view returns (string memory); } // File: openzeppelin-solidity/contracts/token/ERC721/IERC721Full.sol pragma solidity ^0.5.0; /** * @title ERC-721 Non-Fungible Token Standard, full implementation interface * @dev See https://eips.ethereum.org/EIPS/eip-721 */ contract IERC721Full is IERC721, IERC721Enumerable, IERC721Metadata { // solhint-disable-previous-line no-empty-blocks } // File: openzeppelin-solidity/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&#39;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&#39;s tokens. * * Returns a boolean value indicating whether the operation succeeded. * * > 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&#39;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&#39;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-solidity/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity&#39;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&#39;s recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity&#39;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&#39;s `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity&#39;s `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring &#39;a&#39; not being zero, but the // benefit is lost if &#39;b&#39; 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: 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&#39;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) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn&#39;t hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity&#39;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; } } // File: contracts/CryptostampColors.sol /* Implements a color store for crypto stamp */ pragma solidity ^0.5.0; contract CryptostampColors { using SafeMath for uint256; IERC721Full internal cryptostamp; address public createControl; address public tokenAssignmentControl; enum Colors { Black, Green, Blue, Yellow, Red } uint256 public constant packFactor = 85; uint256 public constant packBits = 3; uint256[] public packedColors; event SavedColors(uint256 firstId, uint256 lastId); constructor(address _createControl, address _tokenAssignmentControl) public { createControl = _createControl; tokenAssignmentControl = _tokenAssignmentControl; } modifier onlyCreateControl() { require(msg.sender == createControl, "createControl key required for this function."); _; } modifier onlyTokenAssignmentControl() { require(msg.sender == tokenAssignmentControl, "tokenAssignmentControl key required for this function."); _; } modifier requireCryptostamp() { require(address(cryptostamp) != address(0x0), "You need to provide an actual Cryptostamp contract."); _; } /*** Enable adjusting variables after deployment ***/ function setCryptostamp(IERC721Full _newCryptostamp) public onlyCreateControl { require(address(_newCryptostamp) != address(0x0), "You need to provide an actual Cryptostamp contract."); cryptostamp = _newCryptostamp; } /*** Actual color storage ***/ function calcPackedColors(Colors[] memory _values) public pure returns (uint256) { uint256 valcount = _values.length; require(valcount <= packFactor, "Can only pack values up to a maximum of the packFactor."); uint256 packedVal = 0; for (uint256 i = 0; i < valcount; i++) { packedVal += uint256(_values[i]) * (2 ** (i * packBits)); } return packedVal; } function setColorsPacked(uint256 _tokenIdStart, uint256[] memory _packedValues) public onlyCreateControl requireCryptostamp { require(_tokenIdStart == packedColors.length * packFactor, "Values can can only be appended at the end."); require(_tokenIdStart % packFactor == 0, "The starting token ID needs to be aligned with the packing factor."); uint256 valcount = _packedValues.length; for (uint256 i = 0; i < valcount; i++) { packedColors.push(_packedValues[i]); } emit SavedColors(_tokenIdStart, totalSupply() - 1); } // Returns the color of a given token ID function getColor(uint256 tokenId) public view requireCryptostamp returns (Colors) { require(tokenId < totalSupply(), "The token ID has no color stored."); require(tokenId < cryptostamp.totalSupply(), "The token ID is not valid."); uint256 packElement = tokenId / packFactor; uint256 packItem = tokenId % packFactor; uint256 packValue = (packedColors[packElement] >> (packBits * packItem)) % (2 ** packBits); require(packValue < 5, "Error in packed Value."); return Colors(packValue); } // Returns the amount of colors saved. function totalSupply() public view requireCryptostamp returns (uint256) { uint256 maxSupply = packedColors.length * packFactor; uint256 csSupply = cryptostamp.totalSupply(); if (csSupply < maxSupply) { return csSupply; } return maxSupply; } /*** Make sure currency or NFT doesn&#39;t get stranded in this contract ***/ // If this contract gets a balance in some ERC20 contract after it&#39;s finished, then we can rescue it. function rescueToken(IERC20 _foreignToken, address _to) external onlyTokenAssignmentControl { _foreignToken.transfer(_to, _foreignToken.balanceOf(address(this))); } // If this contract gets a balance in some ERC721 contract after it&#39;s finished, then we can rescue it. function approveNFTrescue(IERC721 _foreignNFT, address _to) external onlyTokenAssignmentControl { _foreignNFT.setApprovalForAll(_to, true); } // Make sure this contract cannot receive ETH. function() external payable { revert("The contract cannot receive ETH payments."); } }
If this contract gets a balance in some ERC721 contract after it&#39;s finished, then we can rescue it.
function approveNFTrescue(IERC721 _foreignNFT, address _to) external onlyTokenAssignmentControl { _foreignNFT.setApprovalForAll(_to, true); }
2,406,072
[ 1, 2047, 333, 6835, 5571, 279, 11013, 316, 2690, 4232, 39, 27, 5340, 6835, 1839, 518, 10, 5520, 31, 87, 6708, 16, 1508, 732, 848, 8223, 518, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 50, 4464, 455, 8007, 12, 45, 654, 39, 27, 5340, 389, 12774, 50, 4464, 16, 1758, 389, 869, 13, 203, 565, 3903, 203, 565, 1338, 1345, 7729, 3367, 203, 565, 288, 203, 3639, 389, 12774, 50, 4464, 18, 542, 23461, 1290, 1595, 24899, 869, 16, 638, 1769, 203, 565, 289, 203, 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 ]
pragma solidity ^0.4.18; import './IVideoBase.sol'; /// @dev Mock implementation for IVideoListener, for test only contract MockVideoListener is IVideoListener { /*** STORAGE ***/ /// @dev whehter it supports VideoListener. bool private _supportsVideoListener; /// @dev last tokenId when onVideoAdded() is called.. uint256 private _lastAddedTokenId; /// @dev last tokenId when onVideoUpdated() is called.. uint256 private _lastUpdatedTokenId; /// @dev last _oldViewCount when onVideoUpdated() is called.. uint256 private _lastUpdatedOldViewCount; /// @dev last _newViewCount when onVideoUpdated() is called.. uint256 private _lastUpdatedNewViewCount; /// @dev last tokenId when onVideoTransfered() is called.. uint256 private _lastTransferredTokenId; /// @dev last _from when onVideoTransfered() is called.. address private _lastTransferredFrom; /// @dev last _to when onVideoTransfered() is called.. address private _lastTransferredTo; /// @dev whether it supports this interface, for sanity check. function supportsVideoListener() public view returns (bool) { return _supportsVideoListener; } /// @dev set _supportsVideoListener in the mock. /// @param _value to be set. function mockSetSupportsVideoListener(bool _value) public { _supportsVideoListener = _value; } /// @dev listener when a new video is added. /// @param _tokenId whose the new video is associated to. function onVideoAdded(uint256 _tokenId) public { _lastAddedTokenId = _tokenId; } /// @dev reset onVideoAdded() called in the mock function mockResetOnVideoAddedCalled() public { _lastAddedTokenId = 0; } /// @dev get last added token id the mock function mockGetLastAddedTokenId() public view returns (uint256) { return _lastAddedTokenId; } /// @dev listener when a video is updated. /// @param _oldViewCount old view count. /// @param _newViewCount new view count. /// @param _tokenId whose the video is associated to. function onVideoUpdated( uint256 _oldViewCount, uint256 _newViewCount, uint256 _tokenId) public { _lastUpdatedTokenId = _tokenId; _lastUpdatedOldViewCount = _oldViewCount; _lastUpdatedNewViewCount = _newViewCount; } /// @dev reset onVideoUpdated() called in the mock function mockResetOnVideoUpdatedCalled() public { _lastUpdatedTokenId = 0; _lastUpdatedOldViewCount = 0; _lastUpdatedNewViewCount = 0; } /// @dev get last updated info in the mock in /// (_oldViewCount, _newViewCount, _tokenId) function mockGetLastUpdatedInfo() public view returns (uint256, uint256, uint256) { return (_lastUpdatedOldViewCount, _lastUpdatedNewViewCount, _lastUpdatedTokenId); } /// @dev listener when a video is transferred. /// @param _from sender. /// @param _to receiver. /// @param _tokenId whose the video is associated to. function onVideoTransferred( address _from, address _to, uint256 _tokenId) public { _lastTransferredFrom = _from; _lastTransferredTo = _to; _lastTransferredTokenId = _tokenId; } /// @dev reset onVideoTransferred() called in the mock function mockResetOnVideoTransferredCalled() public { _lastTransferredTokenId = 0; _lastTransferredFrom = address(0); _lastTransferredTo = address(0); } /// @dev get last transferred info in the mock in /// (_drom, _to, _tokenId) function mockGetLastVideoTransferredInfo() public view returns (address, address, uint256) { return (_lastTransferredFrom, _lastTransferredTo, _lastTransferredTokenId); } }
@dev listener when a video is transferred. @param _from sender. @param _to receiver. @param _tokenId whose the video is associated to.
function onVideoTransferred( address _from, address _to, uint256 _tokenId) public { _lastTransferredFrom = _from; _lastTransferredTo = _to; _lastTransferredTokenId = _tokenId; }
12,750,113
[ 1, 12757, 1347, 279, 6191, 353, 906, 4193, 18, 225, 389, 2080, 5793, 18, 225, 389, 869, 5971, 18, 225, 389, 2316, 548, 8272, 326, 6191, 353, 3627, 358, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 603, 10083, 1429, 4193, 12, 203, 1377, 1758, 389, 2080, 16, 203, 1377, 1758, 389, 869, 16, 203, 1377, 2254, 5034, 389, 2316, 548, 13, 203, 1377, 1071, 288, 203, 565, 389, 2722, 1429, 4193, 1265, 273, 389, 2080, 31, 203, 565, 389, 2722, 1429, 4193, 774, 273, 389, 869, 31, 203, 565, 389, 2722, 1429, 4193, 1345, 548, 273, 389, 2316, 548, 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 ]
// SPDX-License-Identifier: MIT // File: @openzeppelin/contracts/token/ERC20/IERC20.sol 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); function decimals() external view returns (uint8); /** * @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; /** * @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/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) { // 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); } } } } // 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/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 _governance; event GovernanceTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _governance = msgSender; emit GovernanceTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function governance() public view returns (address) { return _governance; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyGovernance() { require(_governance == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferGovernance(address newOwner) internal virtual onlyGovernance { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit GovernanceTransferred(_governance, newOwner); _governance = newOwner; } } // File: contracts/strategies/StabilizeStrategyPickle.sol pragma solidity ^0.6.6; // This is a strategy that utilizes UNI ETH/USDT token in the Pickle.Finance protocol // It deposits the LP token for pJar tokens // It then deposits the pJar tokens into the pickle farm to earn pickle tokens // It then uses the earned pickle tokens and stakes it into pickle staking to earn WETH // It then collects the earn WETH and splits it among the depositors, the STBZ staking pool and the STBZ treasury // The strategy doesn't sell any tokens via Uniswap so it shouldn't affect Pickle adversely // The pickle earned via the farm are constantly being staked to earn more WETH for the users // When a user withdraws, he/she receives a proportion of the total shares in LP token, Pickle and WETH // Used to convert weth to eth upon withdraw interface WrappedEther { function withdraw(uint) external; } interface PickleJar { function getRatio() external view returns (uint256); function deposit(uint256) external; function withdraw(uint256) external; function withdrawAll() external; } interface PickleFarm { function deposit(uint256, uint256) external; function withdraw(uint256, uint256) external; function userInfo(uint256, address) external view returns (uint256, uint256); } interface PickleStake { function stake(uint256) external; function withdraw(uint256) external; function exit() external; function earned(address) external view returns (uint256); function getReward() external; } interface StabilizeStakingPool { function notifyRewardAmount(uint256) external; } contract StabilizeStrategyPickleV1 is Ownable { using SafeMath for uint256; using SafeERC20 for IERC20; using Address for address; address public treasuryAddress; // Address of the treasury address public stakingAddress; // Address to the STBZ staking pool address public zsTokenAddress; // The address of the controlling zs-Token uint256 constant divisionFactor = 100000; uint256 public percentLPDepositor = 50000; // 1000 = 1%, LP depositors earn 50% of all WETH produced, 100% of everything else uint256 public percentStakers = 50000; // 50% of non LP WETH goes to stakers, can be changed // Reward tokens tokens list address[] rewardTokenList; // Info of each user. struct UserInfo { uint256 depositTime; // The time the user made a deposit } mapping(address => UserInfo) private userInfo; uint256 public totalDepositors = 0; // Total amount of unique depositors uint256 public averageDepositTime = 0; // Average time to enter // Strategy specific variables uint256 private _totalBalancePTokens = 0; // The total amount of pTokens currently staked/stored in contract uint256 private _stakedPickle = 0; // The amount of pickles being staked address constant wethAddress = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); address constant pickleAddress = address(0x429881672B9AE42b8EbA0E26cD9C73711b891Ca5); address constant pJarAddress = address(0x09FC573c502037B149ba87782ACC81cF093EC6ef); // Pickle jar address / pToken address address constant pFarmAddress = address(0xbD17B1ce622d73bD438b9E658acA5996dc394b0d); // Pickle farming contract aka MasterChef uint256 constant pTokenID = 12; // The location of the pToken in the pickle staking farm address constant pickleStakeAddress = address(0xa17a8883dA1aBd57c690DF9Ebf58fC194eDAb66F); // Pickle staking address uint256 constant minETH = 1000000000; // 0.000000001 ETH / 1 Gwei constructor( address _treasury, address _staking, address _zsToken ) public { treasuryAddress = _treasury; stakingAddress = _staking; zsTokenAddress = _zsToken; setupRewardTokens(); } // Initialization functions function setupRewardTokens() internal { // Reward tokens rewardTokenList.push(address(0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852)); // Uniswap LP token for ETH/USDT rewardTokenList.push(pickleAddress); // Picke token rewardTokenList.push(wethAddress); // Wrapped Ether token } // Modifier modifier onlyZSToken() { require(zsTokenAddress == _msgSender(), "Call not sent from the zs-Token"); _; } // Read functions function rewardTokensCount() external view returns (uint256) { return rewardTokenList.length; } function rewardTokenAddress(uint256 _pos) external view returns (address) { require(_pos < rewardTokenList.length,"No token at that position"); return rewardTokenList[_pos]; } function balance() external view returns (uint256) { return _totalBalancePTokens; } function pricePerToken() external view returns (uint256) { return PickleJar(pJarAddress).getRatio(); } // Write functions function enter() external onlyZSToken { deposit(_msgSender()); } function exit() external onlyZSToken { // The ZS token vault is removing all tokens from this strategy withdraw(_msgSender(),1,1); } function withdraw(address payable _depositor, uint256 _share, uint256 _total) public onlyZSToken returns (uint256) { require(_totalBalancePTokens > 0, "There are no LP tokens in this strategy"); // When a user withdraws, we need to pull the user's share out from all the contracts and split its tokens checkWETHAndPay(); // First check if we have unclaimed WETH and claim it // Next we need to calculate our percent of pTokens bool _takeAll = false; if(_share == _total){ _takeAll = true; // Remove everything to this user } uint256 pTokenAmount = _totalBalancePTokens; if(_takeAll == false){ pTokenAmount = _totalBalancePTokens.mul(_share).div(_total); }else{ (pTokenAmount, ) = PickleFarm(pFarmAddress).userInfo(pTokenID, address(this)); // Get the total amount at the farm _totalBalancePTokens = pTokenAmount; } // Lower the amount of pTokens _totalBalancePTokens = _totalBalancePTokens.sub(pTokenAmount); // Now withdraw the pLP from Pickle Farm PickleFarm(pFarmAddress).withdraw(pTokenID, pTokenAmount); // This function also returns Pickle earned // Now exchange the pJar token for the LP token IERC20 _lpToken = IERC20(rewardTokenList[0]); uint256 lpWithdrawAmount = 0; if(_takeAll == false){ uint256 _before = _lpToken.balanceOf(address(this)); PickleJar(pJarAddress).withdraw(pTokenAmount); lpWithdrawAmount = _lpToken.balanceOf(address(this)).sub(_before); }else{ PickleJar(pJarAddress).withdrawAll(); lpWithdrawAmount = _lpToken.balanceOf(address(this)); // Get all LP tokens here } require(lpWithdrawAmount > 0,"Failed to withdraw from the Pickle Jar"); // Transfer the accessory tokens transferAccessoryTokens(_depositor, _share, _total); // Now we withdraw the LP to the user _lpToken.safeTransfer(_depositor, lpWithdrawAmount); return lpWithdrawAmount; } function transferAccessoryTokens(address payable _depositor, uint256 _share, uint256 _total) internal { bool _takeAll = false; if(_share == _total){ _takeAll = true; } if(_takeAll == false){ // We need to now calculate the percent of accessory tokens going to this depositor // It is based on how long the depositor is in the contract and their share uint256 exitTime = now; if(userInfo[_depositor].depositTime == 0){ // User has never deposited into the contract at this address userInfo[_depositor].depositTime = now; // No access to pickle or weth reward } uint256 numerator = exitTime.sub(userInfo[_depositor].depositTime); uint256 denominator = exitTime.sub(averageDepositTime); uint256 timeShare = 0; if(numerator > denominator){ // This user has been in the contract longer than the average, allow up to 100% of tokens based on share timeShare = divisionFactor; // 100% }else{ // User has been in less than or equal to average, limit token amount based on that if(denominator > 0){ timeShare = numerator.mul(divisionFactor).div(denominator); }else{ timeShare = 0; } } // Now withdraw the tokens based on the timeshare and share IERC20 _token = IERC20(pickleAddress); uint256 _tokenBalance = _token.balanceOf(address(this)); // Get balance of pickle in contract not staked uint256 tokenWithdrawAmount = _tokenBalance.add(_stakedPickle).mul(_share).div(_total); // First based on our share % tokenWithdrawAmount = tokenWithdrawAmount.mul(timeShare).div(divisionFactor); // Then on time in contract if(tokenWithdrawAmount > _tokenBalance){ // Must remove some from the staking pool to fill this amount uint256 _removeAmount = tokenWithdrawAmount.sub(_tokenBalance); _stakedPickle = _stakedPickle.sub(_removeAmount); PickleStake(pickleStakeAddress).withdraw(_removeAmount); } // Send the Pickle to the user if(tokenWithdrawAmount > 0){ _token.safeTransfer(_depositor, tokenWithdrawAmount); } // Now do the same for WETH _token = IERC20(wethAddress); _tokenBalance = _token.balanceOf(address(this)); // Weth is just stored in this contract until removed tokenWithdrawAmount = _tokenBalance.mul(_share).div(_total); // First based on our share % tokenWithdrawAmount = tokenWithdrawAmount.mul(timeShare).div(divisionFactor); // Then on time in contract // Convert and send ETH to user if(tokenWithdrawAmount > 0){ WrappedEther(wethAddress).withdraw(tokenWithdrawAmount); // This will send ETH to this contract and burn WETH // Now send the Ether to user _depositor.transfer(tokenWithdrawAmount); // Transfer has low gas allocation, preventing re-entrancy } }else{ // Just pull all pickle and all WETH PickleStake(pickleStakeAddress).exit(); // Will pull all pickle and all WETH (should be near empty) IERC20 _token = IERC20(pickleAddress); if( _token.balanceOf(address(this)) > 0){ _token.safeTransfer(_depositor, _token.balanceOf(address(this))); } _token = IERC20(wethAddress); uint256 wethBalance = _token.balanceOf(address(this)); if(wethBalance > 0){ if(_depositor != zsTokenAddress){ WrappedEther(wethAddress).withdraw(wethBalance); // This will send ETH to this contract and burn WETH _depositor.transfer(wethBalance); }else{ // Keep it as ERC20 _token.safeTransfer(_depositor, wethBalance); } } } } function deposit(address _depositor) public onlyZSToken { // Only the ZS token can call the function if(_depositor != zsTokenAddress){ // Calculate the deposit time if(userInfo[_depositor].depositTime == 0){ totalDepositors += 1; // We have a new depositor // Calculate the average if(totalDepositors == 1){ averageDepositTime = now; }else{ averageDepositTime = averageDepositTime.mul(totalDepositors.sub(1)).add(now).div(totalDepositors); // Move the average forward } }else{ // We've already deposited before averageDepositTime = averageDepositTime .mul(totalDepositors) .sub(userInfo[_depositor].depositTime) .add(now).div(totalDepositors); // Remove our old time and add our new time to the timelock } userInfo[_depositor].depositTime = now; } // Get the balance of the reward token sent here IERC20 _token = IERC20(rewardTokenList[0]); uint256 _lpBalance = _token.balanceOf(address(this)); // Now deposit it into the pickle jar _token.safeApprove(pJarAddress ,_lpBalance); // Approve for transfer PickleJar(pJarAddress).deposit(_lpBalance); // Send the LP, get the pLP IERC20 _pToken = IERC20(pJarAddress); uint256 _pBalance = _pToken.balanceOf(address(this)); require(_pBalance > 0,"Failed to get pTokens from the Pickle Jar"); // Now deposit these tokens into the farm contract _pToken.safeApprove(pFarmAddress, _pBalance); // Approve for transfer PickleFarm(pFarmAddress).deposit(pTokenID, _pBalance); // This function also returns Pickle earned _totalBalancePTokens += _pBalance; // Add to our pTokens accounted for // Now check to see if we should claim and stake pickle checkPickleAndStake(); // Now check to see if we should claim and payout WETH checkWETHAndPay(); } function checkPickleAndStake() internal { // Check if we have pickle in this contract then stake if we do IERC20 _pickle = IERC20(pickleAddress); uint256 _balance = _pickle.balanceOf(address(this)); if(_balance > 0){ // We have pickle, let's stake it _pickle.safeApprove(pickleStakeAddress, _balance); PickleStake(pickleStakeAddress).stake(_balance); _stakedPickle += _balance; } } function checkWETHAndPay() internal { // Check if we have earned WETH from the staked pickle uint256 _balance = PickleStake(pickleStakeAddress).earned(address(this)); // This will return the WETH earned balance if(_balance > minETH){ // Claim the reward and split it between the depositors, treasury and stakers IERC20 _token = IERC20(wethAddress); uint256 _before = _token.balanceOf(address(this)); PickleStake(pickleStakeAddress).getReward(); // Pull the WETH from the staking address uint256 amount = _token.balanceOf(address(this)).sub(_before); require(amount > 0,"Pickle staking should have returned some WETH"); uint256 depositorsAmount = amount.mul(percentLPDepositor).div(divisionFactor); // This amount remains in contract uint256 holdersAmount = amount.sub(depositorsAmount); uint256 stakersAmount = holdersAmount.mul(percentStakers).div(divisionFactor); uint256 treasuryAmount = holdersAmount.sub(stakersAmount); if(treasuryAmount > 0){ _token.safeTransfer(treasuryAddress, treasuryAmount); } if(stakersAmount > 0){ _token.safeTransfer(stakingAddress, stakersAmount); StabilizeStakingPool(stakingAddress).notifyRewardAmount(stakersAmount); } } } // Governance functions // Timelock variables uint256 private _timelockStart; // The start of the timelock to change governance variables uint256 private _timelockType; // The function that needs to be changed uint256 constant _timelockDuration = 86400; // Timelock is 24 hours // Reusable timelock variables address private _timelock_address; uint256 private _timelock_data_1; modifier timelockConditionsMet(uint256 _type) { require(_timelockType == _type, "Timelock not acquired for this function"); _timelockType = 0; // Reset the type once the timelock is used if(_totalBalancePTokens > 0){ // Timelock only applies when balance exists require(now >= _timelockStart + _timelockDuration, "Timelock time not met"); } _; } // Change the owner of the token contract // -------------------- function startGovernanceChange(address _address) external onlyGovernance { _timelockStart = now; _timelockType = 1; _timelock_address = _address; } function finishGovernanceChange() external onlyGovernance timelockConditionsMet(1) { transferGovernance(_timelock_address); } // -------------------- // Change the treasury address // -------------------- function startChangeTreasury(address _address) external onlyGovernance { _timelockStart = now; _timelockType = 2; _timelock_address = _address; } function finishChangeTreasury() external onlyGovernance timelockConditionsMet(2) { treasuryAddress = _timelock_address; } // -------------------- // Change the percent going to depositors for WETH // -------------------- function startChangeDepositorPercent(uint256 _percent) external onlyGovernance { require(_percent <= 100000,"Percent cannot be greater than 100%"); _timelockStart = now; _timelockType = 3; _timelock_data_1 = _percent; } function finishChangeDepositorPercent() external onlyGovernance timelockConditionsMet(3) { percentLPDepositor = _timelock_data_1; } // -------------------- // Change the staking address // -------------------- function startChangeStakingPool(address _address) external onlyGovernance { _timelockStart = now; _timelockType = 4; _timelock_address = _address; } function finishChangeStakingPool() external onlyGovernance timelockConditionsMet(4) { stakingAddress = _timelock_address; } // -------------------- // Change the zsToken address // -------------------- function startChangeZSToken(address _address) external onlyGovernance { _timelockStart = now; _timelockType = 5; _timelock_address = _address; } function finishChangeZSToken() external onlyGovernance timelockConditionsMet(5) { zsTokenAddress = _timelock_address; } // -------------------- // Change the percent going to stakers for WETH // -------------------- function startChangeStakersPercent(uint256 _percent) external onlyGovernance { require(_percent <= 100000,"Percent cannot be greater than 100%"); _timelockStart = now; _timelockType = 6; _timelock_data_1 = _percent; } function finishChangeStakersPercent() external onlyGovernance timelockConditionsMet(6) { percentStakers = _timelock_data_1; } // -------------------- }
* @dev Initializes the contract setting the deployer as the initial owner./
constructor () internal { address msgSender = _msgSender(); _governance = msgSender; emit GovernanceTransferred(address(0), msgSender); }
25,110
[ 1, 9685, 326, 6835, 3637, 326, 7286, 264, 487, 326, 2172, 3410, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3885, 1832, 2713, 288, 203, 3639, 1758, 1234, 12021, 273, 389, 3576, 12021, 5621, 203, 3639, 389, 75, 1643, 82, 1359, 273, 1234, 12021, 31, 203, 3639, 3626, 611, 1643, 82, 1359, 1429, 4193, 12, 2867, 12, 20, 3631, 1234, 12021, 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 ]
//Address: 0x7ee6e9dc512b0fe5cb5e28697cfc34375a9adc4b //Contract name: LMSRMarketMaker //Balance: 0 Ether //Verification Date: 12/22/2017 //Transacion Count: 1 // CODE STARTS HERE pragma solidity 0.4.15; /// @title Math library - Allows calculation of logarithmic and exponential functions /// @author Alan Lu - <[email protected]> /// @author Stefan George - <[email protected]> library Math { /* * Constants */ // This is equal to 1 in our calculations uint public constant ONE = 0x10000000000000000; uint public constant LN2 = 0xb17217f7d1cf79ac; uint public constant LOG2_E = 0x171547652b82fe177; /* * Public functions */ /// @dev Returns natural exponential function value of given x /// @param x x /// @return e**x function exp(int x) public constant returns (uint) { // revert if x is > MAX_POWER, where // MAX_POWER = int(mp.floor(mp.log(mpf(2**256 - 1) / ONE) * ONE)) require(x <= 2454971259878909886679); // return 0 if exp(x) is tiny, using // MIN_POWER = int(mp.floor(mp.log(mpf(1) / ONE) * ONE)) if (x < -818323753292969962227) return 0; // Transform so that e^x -> 2^x x = x * int(ONE) / int(LN2); // 2^x = 2^whole(x) * 2^frac(x) // ^^^^^^^^^^ is a bit shift // so Taylor expand on z = frac(x) int shift; uint z; if (x >= 0) { shift = x / int(ONE); z = uint(x % int(ONE)); } else { shift = x / int(ONE) - 1; z = ONE - uint(-x % int(ONE)); } // 2^x = 1 + (ln 2) x + (ln 2)^2/2! x^2 + ... // // Can generate the z coefficients using mpmath and the following lines // >>> from mpmath import mp // >>> mp.dps = 100 // >>> ONE = 0x10000000000000000 // >>> print('\n'.join(hex(int(mp.log(2)**i / mp.factorial(i) * ONE)) for i in range(1, 7))) // 0xb17217f7d1cf79ab // 0x3d7f7bff058b1d50 // 0xe35846b82505fc5 // 0x276556df749cee5 // 0x5761ff9e299cc4 // 0xa184897c363c3 uint zpow = z; uint result = ONE; result += 0xb17217f7d1cf79ab * zpow / ONE; zpow = zpow * z / ONE; result += 0x3d7f7bff058b1d50 * zpow / ONE; zpow = zpow * z / ONE; result += 0xe35846b82505fc5 * zpow / ONE; zpow = zpow * z / ONE; result += 0x276556df749cee5 * zpow / ONE; zpow = zpow * z / ONE; result += 0x5761ff9e299cc4 * zpow / ONE; zpow = zpow * z / ONE; result += 0xa184897c363c3 * zpow / ONE; zpow = zpow * z / ONE; result += 0xffe5fe2c4586 * zpow / ONE; zpow = zpow * z / ONE; result += 0x162c0223a5c8 * zpow / ONE; zpow = zpow * z / ONE; result += 0x1b5253d395e * zpow / ONE; zpow = zpow * z / ONE; result += 0x1e4cf5158b * zpow / ONE; zpow = zpow * z / ONE; result += 0x1e8cac735 * zpow / ONE; zpow = zpow * z / ONE; result += 0x1c3bd650 * zpow / ONE; zpow = zpow * z / ONE; result += 0x1816193 * zpow / ONE; zpow = zpow * z / ONE; result += 0x131496 * zpow / ONE; zpow = zpow * z / ONE; result += 0xe1b7 * zpow / ONE; zpow = zpow * z / ONE; result += 0x9c7 * zpow / ONE; if (shift >= 0) { if (result >> (256-shift) > 0) return (2**256-1); return result << shift; } else return result >> (-shift); } /// @dev Returns natural logarithm value of given x /// @param x x /// @return ln(x) function ln(uint x) public constant returns (int) { require(x > 0); // binary search for floor(log2(x)) int ilog2 = floorLog2(x); int z; if (ilog2 < 0) z = int(x << uint(-ilog2)); else z = int(x >> uint(ilog2)); // z = x * 2^-⌊log₂x⌋ // so 1 <= z < 2 // and ln z = ln x - ⌊log₂x⌋/log₂e // so just compute ln z using artanh series // and calculate ln x from that int term = (z - int(ONE)) * int(ONE) / (z + int(ONE)); int halflnz = term; int termpow = term * term / int(ONE) * term / int(ONE); halflnz += termpow / 3; termpow = termpow * term / int(ONE) * term / int(ONE); halflnz += termpow / 5; termpow = termpow * term / int(ONE) * term / int(ONE); halflnz += termpow / 7; termpow = termpow * term / int(ONE) * term / int(ONE); halflnz += termpow / 9; termpow = termpow * term / int(ONE) * term / int(ONE); halflnz += termpow / 11; termpow = termpow * term / int(ONE) * term / int(ONE); halflnz += termpow / 13; termpow = termpow * term / int(ONE) * term / int(ONE); halflnz += termpow / 15; termpow = termpow * term / int(ONE) * term / int(ONE); halflnz += termpow / 17; termpow = termpow * term / int(ONE) * term / int(ONE); halflnz += termpow / 19; termpow = termpow * term / int(ONE) * term / int(ONE); halflnz += termpow / 21; termpow = termpow * term / int(ONE) * term / int(ONE); halflnz += termpow / 23; termpow = termpow * term / int(ONE) * term / int(ONE); halflnz += termpow / 25; return (ilog2 * int(ONE)) * int(ONE) / int(LOG2_E) + 2 * halflnz; } /// @dev Returns base 2 logarithm value of given x /// @param x x /// @return logarithmic value function floorLog2(uint x) public constant returns (int lo) { lo = -64; int hi = 193; // I use a shift here instead of / 2 because it floors instead of rounding towards 0 int mid = (hi + lo) >> 1; while((lo + 1) < hi) { if (mid < 0 && x << uint(-mid) < ONE || mid >= 0 && x >> uint(mid) < ONE) hi = mid; else lo = mid; mid = (hi + lo) >> 1; } } /// @dev Returns maximum of an array /// @param nums Numbers to look through /// @return Maximum number function max(int[] nums) public constant returns (int max) { require(nums.length > 0); max = -2**255; for (uint i = 0; i < nums.length; i++) if (nums[i] > max) max = nums[i]; } /// @dev Returns whether an add operation causes an overflow /// @param a First addend /// @param b Second addend /// @return Did no overflow occur? function safeToAdd(uint a, uint b) public constant returns (bool) { return a + b >= a; } /// @dev Returns whether a subtraction operation causes an underflow /// @param a Minuend /// @param b Subtrahend /// @return Did no underflow occur? function safeToSub(uint a, uint b) public constant returns (bool) { return a >= b; } /// @dev Returns whether a multiply operation causes an overflow /// @param a First factor /// @param b Second factor /// @return Did no overflow occur? function safeToMul(uint a, uint b) public constant returns (bool) { return b == 0 || a * b / b == a; } /// @dev Returns sum if no overflow occurred /// @param a First addend /// @param b Second addend /// @return Sum function add(uint a, uint b) public constant returns (uint) { require(safeToAdd(a, b)); return a + b; } /// @dev Returns difference if no overflow occurred /// @param a Minuend /// @param b Subtrahend /// @return Difference function sub(uint a, uint b) public constant returns (uint) { require(safeToSub(a, b)); return a - b; } /// @dev Returns product if no overflow occurred /// @param a First factor /// @param b Second factor /// @return Product function mul(uint a, uint b) public constant returns (uint) { require(safeToMul(a, b)); return a * b; } /// @dev Returns whether an add operation causes an overflow /// @param a First addend /// @param b Second addend /// @return Did no overflow occur? function safeToAdd(int a, int b) public constant returns (bool) { return (b >= 0 && a + b >= a) || (b < 0 && a + b < a); } /// @dev Returns whether a subtraction operation causes an underflow /// @param a Minuend /// @param b Subtrahend /// @return Did no underflow occur? function safeToSub(int a, int b) public constant returns (bool) { return (b >= 0 && a - b <= a) || (b < 0 && a - b > a); } /// @dev Returns whether a multiply operation causes an overflow /// @param a First factor /// @param b Second factor /// @return Did no overflow occur? function safeToMul(int a, int b) public constant returns (bool) { return (b == 0) || (a * b / b == a); } /// @dev Returns sum if no overflow occurred /// @param a First addend /// @param b Second addend /// @return Sum function add(int a, int b) public constant returns (int) { require(safeToAdd(a, b)); return a + b; } /// @dev Returns difference if no overflow occurred /// @param a Minuend /// @param b Subtrahend /// @return Difference function sub(int a, int b) public constant returns (int) { require(safeToSub(a, b)); return a - b; } /// @dev Returns product if no overflow occurred /// @param a First factor /// @param b Second factor /// @return Product function mul(int a, int b) public constant returns (int) { require(safeToMul(a, b)); return a * b; } } /// @title Abstract token contract - Functions to be implemented by token contracts contract Token { /* * Events */ event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); /* * Public functions */ function transfer(address to, uint value) public returns (bool); function transferFrom(address from, address to, uint value) public returns (bool); function approve(address spender, uint value) public returns (bool); function balanceOf(address owner) public constant returns (uint); function allowance(address owner, address spender) public constant returns (uint); function totalSupply() public constant returns (uint); } /// @title Standard token contract with overflow protection contract StandardToken is Token { using Math for *; /* * Storage */ mapping (address => uint) balances; mapping (address => mapping (address => uint)) allowances; uint totalTokens; /* * Public functions */ /// @dev Transfers sender's tokens to a given address. Returns success /// @param to Address of token receiver /// @param value Number of tokens to transfer /// @return Was transfer successful? function transfer(address to, uint value) public returns (bool) { if ( !balances[msg.sender].safeToSub(value) || !balances[to].safeToAdd(value)) return false; balances[msg.sender] -= value; balances[to] += value; Transfer(msg.sender, to, value); return true; } /// @dev Allows allowed third party to transfer tokens from one address to another. Returns success /// @param from Address from where tokens are withdrawn /// @param to Address to where tokens are sent /// @param value Number of tokens to transfer /// @return Was transfer successful? function transferFrom(address from, address to, uint value) public returns (bool) { if ( !balances[from].safeToSub(value) || !allowances[from][msg.sender].safeToSub(value) || !balances[to].safeToAdd(value)) return false; balances[from] -= value; allowances[from][msg.sender] -= value; balances[to] += value; Transfer(from, to, value); return true; } /// @dev Sets approved amount of tokens for spender. Returns success /// @param spender Address of allowed account /// @param value Number of approved tokens /// @return Was approval successful? function approve(address spender, uint value) public returns (bool) { allowances[msg.sender][spender] = value; Approval(msg.sender, spender, value); return true; } /// @dev Returns number of allowed tokens for given address /// @param owner Address of token owner /// @param spender Address of token spender /// @return Remaining allowance for spender function allowance(address owner, address spender) public constant returns (uint) { return allowances[owner][spender]; } /// @dev Returns number of tokens owned by given address /// @param owner Address of token owner /// @return Balance of owner function balanceOf(address owner) public constant returns (uint) { return balances[owner]; } /// @dev Returns total supply of tokens /// @return Total supply function totalSupply() public constant returns (uint) { return totalTokens; } } /// @title Outcome token contract - Issuing and revoking outcome tokens /// @author Stefan George - <[email protected]> contract OutcomeToken is StandardToken { using Math for *; /* * Events */ event Issuance(address indexed owner, uint amount); event Revocation(address indexed owner, uint amount); /* * Storage */ address public eventContract; /* * Modifiers */ modifier isEventContract () { // Only event contract is allowed to proceed require(msg.sender == eventContract); _; } /* * Public functions */ /// @dev Constructor sets events contract address function OutcomeToken() public { eventContract = msg.sender; } /// @dev Events contract issues new tokens for address. Returns success /// @param _for Address of receiver /// @param outcomeTokenCount Number of tokens to issue function issue(address _for, uint outcomeTokenCount) public isEventContract { balances[_for] = balances[_for].add(outcomeTokenCount); totalTokens = totalTokens.add(outcomeTokenCount); Issuance(_for, outcomeTokenCount); } /// @dev Events contract revokes tokens for address. Returns success /// @param _for Address of token holder /// @param outcomeTokenCount Number of tokens to revoke function revoke(address _for, uint outcomeTokenCount) public isEventContract { balances[_for] = balances[_for].sub(outcomeTokenCount); totalTokens = totalTokens.sub(outcomeTokenCount); Revocation(_for, outcomeTokenCount); } } /// @title Abstract oracle contract - Functions to be implemented by oracles contract Oracle { function isOutcomeSet() public constant returns (bool); function getOutcome() public constant returns (int); } /// @title Event contract - Provide basic functionality required by different event types /// @author Stefan George - <[email protected]> contract Event { /* * Events */ event OutcomeTokenCreation(OutcomeToken outcomeToken, uint8 index); event OutcomeTokenSetIssuance(address indexed buyer, uint collateralTokenCount); event OutcomeTokenSetRevocation(address indexed seller, uint outcomeTokenCount); event OutcomeAssignment(int outcome); event WinningsRedemption(address indexed receiver, uint winnings); /* * Storage */ Token public collateralToken; Oracle public oracle; bool public isOutcomeSet; int public outcome; OutcomeToken[] public outcomeTokens; /* * Public functions */ /// @dev Contract constructor validates and sets basic event properties /// @param _collateralToken Tokens used as collateral in exchange for outcome tokens /// @param _oracle Oracle contract used to resolve the event /// @param outcomeCount Number of event outcomes function Event(Token _collateralToken, Oracle _oracle, uint8 outcomeCount) public { // Validate input require(address(_collateralToken) != 0 && address(_oracle) != 0 && outcomeCount >= 2); collateralToken = _collateralToken; oracle = _oracle; // Create an outcome token for each outcome for (uint8 i = 0; i < outcomeCount; i++) { OutcomeToken outcomeToken = new OutcomeToken(); outcomeTokens.push(outcomeToken); OutcomeTokenCreation(outcomeToken, i); } } /// @dev Buys equal number of tokens of all outcomes, exchanging collateral tokens and sets of outcome tokens 1:1 /// @param collateralTokenCount Number of collateral tokens function buyAllOutcomes(uint collateralTokenCount) public { // Transfer collateral tokens to events contract require(collateralToken.transferFrom(msg.sender, this, collateralTokenCount)); // Issue new outcome tokens to sender for (uint8 i = 0; i < outcomeTokens.length; i++) outcomeTokens[i].issue(msg.sender, collateralTokenCount); OutcomeTokenSetIssuance(msg.sender, collateralTokenCount); } /// @dev Sells equal number of tokens of all outcomes, exchanging collateral tokens and sets of outcome tokens 1:1 /// @param outcomeTokenCount Number of outcome tokens function sellAllOutcomes(uint outcomeTokenCount) public { // Revoke sender's outcome tokens of all outcomes for (uint8 i = 0; i < outcomeTokens.length; i++) outcomeTokens[i].revoke(msg.sender, outcomeTokenCount); // Transfer collateral tokens to sender require(collateralToken.transfer(msg.sender, outcomeTokenCount)); OutcomeTokenSetRevocation(msg.sender, outcomeTokenCount); } /// @dev Sets winning event outcome function setOutcome() public { // Winning outcome is not set yet in event contract but in oracle contract require(!isOutcomeSet && oracle.isOutcomeSet()); // Set winning outcome outcome = oracle.getOutcome(); isOutcomeSet = true; OutcomeAssignment(outcome); } /// @dev Returns outcome count /// @return Outcome count function getOutcomeCount() public constant returns (uint8) { return uint8(outcomeTokens.length); } /// @dev Returns outcome tokens array /// @return Outcome tokens function getOutcomeTokens() public constant returns (OutcomeToken[]) { return outcomeTokens; } /// @dev Returns the amount of outcome tokens held by owner /// @return Outcome token distribution function getOutcomeTokenDistribution(address owner) public constant returns (uint[] outcomeTokenDistribution) { outcomeTokenDistribution = new uint[](outcomeTokens.length); for (uint8 i = 0; i < outcomeTokenDistribution.length; i++) outcomeTokenDistribution[i] = outcomeTokens[i].balanceOf(owner); } /// @dev Calculates and returns event hash /// @return Event hash function getEventHash() public constant returns (bytes32); /// @dev Exchanges sender's winning outcome tokens for collateral tokens /// @return Sender's winnings function redeemWinnings() public returns (uint); } /// @title Abstract market contract - Functions to be implemented by market contracts contract Market { /* * Events */ event MarketFunding(uint funding); event MarketClosing(); event FeeWithdrawal(uint fees); event OutcomeTokenPurchase(address indexed buyer, uint8 outcomeTokenIndex, uint outcomeTokenCount, uint outcomeTokenCost, uint marketFees); event OutcomeTokenSale(address indexed seller, uint8 outcomeTokenIndex, uint outcomeTokenCount, uint outcomeTokenProfit, uint marketFees); event OutcomeTokenShortSale(address indexed buyer, uint8 outcomeTokenIndex, uint outcomeTokenCount, uint cost); /* * Storage */ address public creator; uint public createdAtBlock; Event public eventContract; MarketMaker public marketMaker; uint24 public fee; uint public funding; int[] public netOutcomeTokensSold; Stages public stage; enum Stages { MarketCreated, MarketFunded, MarketClosed } /* * Public functions */ function fund(uint _funding) public; function close() public; function withdrawFees() public returns (uint); function buy(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint maxCost) public returns (uint); function sell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit) public returns (uint); function shortSell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit) public returns (uint); function calcMarketFee(uint outcomeTokenCost) public constant returns (uint); } /// @title Abstract market maker contract - Functions to be implemented by market maker contracts contract MarketMaker { /* * Public functions */ function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public constant returns (uint); function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public constant returns (uint); function calcMarginalPrice(Market market, uint8 outcomeTokenIndex) public constant returns (uint); } /// @title LMSR market maker contract - Calculates share prices based on share distribution and initial funding /// @author Alan Lu - <[email protected]> contract LMSRMarketMaker is MarketMaker { using Math for *; /* * Constants */ uint constant ONE = 0x10000000000000000; int constant EXP_LIMIT = 2352680790717288641401; /* * Public functions */ /// @dev Returns cost to buy given number of outcome tokens /// @param market Market contract /// @param outcomeTokenIndex Index of outcome to buy /// @param outcomeTokenCount Number of outcome tokens to buy /// @return Cost function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public constant returns (uint cost) { require(market.eventContract().getOutcomeCount() > 1); int[] memory netOutcomeTokensSold = getNetOutcomeTokensSold(market); // Calculate cost level based on net outcome token balances int logN = Math.ln(netOutcomeTokensSold.length * ONE); uint funding = market.funding(); int costLevelBefore = calcCostLevel(logN, netOutcomeTokensSold, funding); // Add outcome token count to net outcome token balance require(int(outcomeTokenCount) >= 0); netOutcomeTokensSold[outcomeTokenIndex] = netOutcomeTokensSold[outcomeTokenIndex].add(int(outcomeTokenCount)); // Calculate cost level after balance was updated int costLevelAfter = calcCostLevel(logN, netOutcomeTokensSold, funding); // Calculate cost as cost level difference require(costLevelAfter >= costLevelBefore); cost = uint(costLevelAfter - costLevelBefore); // Take the ceiling to account for rounding if (cost / ONE * ONE == cost) cost /= ONE; else // Integer division by ONE ensures there is room to (+ 1) cost = cost / ONE + 1; // Make sure cost is not bigger than 1 per share if (cost > outcomeTokenCount) cost = outcomeTokenCount; } /// @dev Returns profit for selling given number of outcome tokens /// @param market Market contract /// @param outcomeTokenIndex Index of outcome to sell /// @param outcomeTokenCount Number of outcome tokens to sell /// @return Profit function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public constant returns (uint profit) { require(market.eventContract().getOutcomeCount() > 1); int[] memory netOutcomeTokensSold = getNetOutcomeTokensSold(market); // Calculate cost level based on net outcome token balances int logN = Math.ln(netOutcomeTokensSold.length * ONE); uint funding = market.funding(); int costLevelBefore = calcCostLevel(logN, netOutcomeTokensSold, funding); // Subtract outcome token count from the net outcome token balance require(int(outcomeTokenCount) >= 0); netOutcomeTokensSold[outcomeTokenIndex] = netOutcomeTokensSold[outcomeTokenIndex].sub(int(outcomeTokenCount)); // Calculate cost level after balance was updated int costLevelAfter = calcCostLevel(logN, netOutcomeTokensSold, funding); // Calculate profit as cost level difference require(costLevelBefore >= costLevelAfter); // Take the floor profit = uint(costLevelBefore - costLevelAfter) / ONE; } /// @dev Returns marginal price of an outcome /// @param market Market contract /// @param outcomeTokenIndex Index of outcome to determine marginal price of /// @return Marginal price of an outcome as a fixed point number function calcMarginalPrice(Market market, uint8 outcomeTokenIndex) public constant returns (uint price) { require(market.eventContract().getOutcomeCount() > 1); int[] memory netOutcomeTokensSold = getNetOutcomeTokensSold(market); int logN = Math.ln(netOutcomeTokensSold.length * ONE); uint funding = market.funding(); // The price function is exp(quantities[i]/b) / sum(exp(q/b) for q in quantities) // To avoid overflow, calculate with // exp(quantities[i]/b - offset) / sum(exp(q/b - offset) for q in quantities) var (sum, , outcomeExpTerm) = sumExpOffset(logN, netOutcomeTokensSold, funding, outcomeTokenIndex); return outcomeExpTerm / (sum / ONE); } /* * Private functions */ /// @dev Calculates the result of the LMSR cost function which is used to /// derive prices from the market state /// @param logN Logarithm of the number of outcomes /// @param netOutcomeTokensSold Net outcome tokens sold by market /// @param funding Initial funding for market /// @return Cost level function calcCostLevel(int logN, int[] netOutcomeTokensSold, uint funding) private constant returns(int costLevel) { // The cost function is C = b * log(sum(exp(q/b) for q in quantities)). // To avoid overflow, we need to calc with an exponent offset: // C = b * (offset + log(sum(exp(q/b - offset) for q in quantities))) var (sum, offset, ) = sumExpOffset(logN, netOutcomeTokensSold, funding, 0); costLevel = Math.ln(sum); costLevel = costLevel.add(offset); costLevel = (costLevel.mul(int(ONE)) / logN).mul(int(funding)); } /// @dev Calculates sum(exp(q/b - offset) for q in quantities), where offset is set /// so that the sum fits in 248-256 bits /// @param logN Logarithm of the number of outcomes /// @param netOutcomeTokensSold Net outcome tokens sold by market /// @param funding Initial funding for market /// @param outcomeIndex Index of exponential term to extract (for use by marginal price function) /// @return A result structure composed of the sum, the offset used, and the summand associated with the supplied index function sumExpOffset(int logN, int[] netOutcomeTokensSold, uint funding, uint8 outcomeIndex) private constant returns (uint sum, int offset, uint outcomeExpTerm) { // Naive calculation of this causes an overflow // since anything above a bit over 133*ONE supplied to exp will explode // as exp(133) just about fits into 192 bits of whole number data. // The choice of this offset is subject to another limit: // computing the inner sum successfully. // Since the index is 8 bits, there has to be 8 bits of headroom for // each summand, meaning q/b - offset <= exponential_limit, // where that limit can be found with `mp.floor(mp.log((2**248 - 1) / ONE) * ONE)` // That is what EXP_LIMIT is set to: it is about 127.5 // finally, if the distribution looks like [BIG, tiny, tiny...], using a // BIG offset will cause the tiny quantities to go really negative // causing the associated exponentials to vanish. int maxQuantity = Math.max(netOutcomeTokensSold); require(logN >= 0 && int(funding) >= 0); offset = maxQuantity.mul(logN) / int(funding); offset = offset.sub(EXP_LIMIT); uint term; for (uint8 i = 0; i < netOutcomeTokensSold.length; i++) { term = Math.exp((netOutcomeTokensSold[i].mul(logN) / int(funding)).sub(offset)); if (i == outcomeIndex) outcomeExpTerm = term; sum = sum.add(term); } } /// @dev Gets net outcome tokens sold by market. Since all sets of outcome tokens are backed by /// corresponding collateral tokens, the net quantity of a token sold by the market is the /// number of collateral tokens (which is the same as the number of outcome tokens the /// market created) subtracted by the quantity of that token held by the market. /// @param market Market contract /// @return Net outcome tokens sold by market function getNetOutcomeTokensSold(Market market) private constant returns (int[] quantities) { quantities = new int[](market.eventContract().getOutcomeCount()); for (uint8 i = 0; i < quantities.length; i++) quantities[i] = market.netOutcomeTokensSold(i); } }
@dev Events contract revokes tokens for address. Returns success @param _for Address of token holder @param outcomeTokenCount Number of tokens to revoke
function revoke(address _for, uint outcomeTokenCount) public isEventContract { balances[_for] = balances[_for].sub(outcomeTokenCount); totalTokens = totalTokens.sub(outcomeTokenCount); Revocation(_for, outcomeTokenCount); }
5,511,384
[ 1, 3783, 6835, 5588, 601, 281, 2430, 364, 1758, 18, 2860, 2216, 225, 389, 1884, 5267, 434, 1147, 10438, 225, 12884, 1345, 1380, 3588, 434, 2430, 358, 18007, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 18007, 12, 2867, 389, 1884, 16, 2254, 12884, 1345, 1380, 13, 203, 3639, 1071, 203, 3639, 15805, 8924, 203, 565, 288, 203, 3639, 324, 26488, 63, 67, 1884, 65, 273, 324, 26488, 63, 67, 1884, 8009, 1717, 12, 21672, 1345, 1380, 1769, 203, 3639, 2078, 5157, 273, 2078, 5157, 18, 1717, 12, 21672, 1345, 1380, 1769, 203, 3639, 14477, 4431, 24899, 1884, 16, 12884, 1345, 1380, 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 ]
pragma solidity 0.5.9; // optimization enabled, runs: 10000, evm: constantinople /** * @title HomeWork Deployer (alpha version) * @author 0age * @notice This contract is a stripped-down version of HomeWork that is used to * deploy HomeWork itself. */ contract HomeWorkDeployer { // Fires when HomeWork has been deployed. event HomeWorkDeployment(address homeAddress, bytes32 key); // Fires HomeWork's initialization-in-runtime storage contract is deployed. event StorageContractDeployment(address runtimeStorageContract); // Allocate storage to track the current initialization-in-runtime contract. address private _initializationRuntimeStorageContract; // Once HomeWork has been deployed, disable this contract. bool private _disabled; // Write arbitrary code to a contract's runtime using the following prelude. bytes11 private constant _ARBITRARY_RUNTIME_PRELUDE = bytes11( 0x600b5981380380925939f3 ); /** * @notice Perform phase one of the deployment. * @param code bytes The contract creation code for HomeWork. */ function phaseOne(bytes calldata code) external onlyUntilDisabled { // Deploy payload to the runtime storage contract and set the address. _initializationRuntimeStorageContract = _deployRuntimeStorageContract( bytes32(0), code ); } /** * @notice Perform phase two of the deployment (tokenURI data). * @param key bytes32 The salt to provide to create2. */ function phaseTwo(bytes32 key) external onlyUntilDisabled { // Deploy runtime storage contract with the string used to construct end of // token URI for issued ERC721s (data URI with a base64-encoded jpeg image). bytes memory code = abi.encodePacked( hex"222c226465736372697074696f6e223a22546869732532304e465425323063616e25", hex"3230626525323072656465656d65642532306f6e253230486f6d65576f726b253230", hex"746f2532306772616e7425323061253230636f6e74726f6c6c657225323074686525", hex"32306578636c75736976652532307269676874253230746f2532306465706c6f7925", hex"3230636f6e7472616374732532307769746825323061726269747261727925323062", hex"797465636f6465253230746f25323074686525323064657369676e61746564253230", hex"686f6d65253230616464726573732e222c22696d616765223a22646174613a696d61", hex"67652f7376672b786d6c3b636861727365743d7574662d383b6261736536342c5048", hex"4e325a79423462577875637a30696148523063446f764c336433647935334d793576", hex"636d63764d6a41774d43397a646d636949485a705a58644362336739496a41674d43", hex"41784e4451674e7a4969506a787a64486c735a543438495674445245465551567375", hex"516e747a64484a766132557462476c755a57707661573436636d3931626d52394c6b", hex"4e37633352796232746c4c5731706447567962476c74615851364d5442394c6b5237", hex"633352796232746c4c5864705a48526f4f6a4a394c6b56375a6d6c7362446f6a4f57", hex"4935596a6c686653354765334e30636d39725a5331736157356c593246774f6e4a76", hex"6457356b66563164506a7776633352356247552b5047636764484a68626e4e6d6233", hex"4a7450534a74595852796158676f4d5334774d694177494441674d5334774d694134", hex"4c6a45674d436b69506a78775958526f49475a706247773949694e6d5a6d59694947", hex"5139496b30784f53417a4d6d677a4e4859794e4567784f586f694c7a34385a79427a", hex"64484a766132553949694d774d44416949474e7359584e7a50534a4349454d675243", hex"492b50484268644767675a6d6c7362443069493245314e7a6b7a4f5349675a443069", hex"545449314944517761446c324d545a6f4c546c364969382b50484268644767675a6d", hex"6c7362443069497a6b795a444e6d4e5349675a443069545451774944517761446832", hex"4e3267744f486f694c7a3438634746306143426d615778735053496a5a5745315954", hex"51334969426b50534a4e4e544d674d7a4a494d546c324c5446734d5459744d545967", hex"4d5467674d545a364969382b50484268644767675a6d6c7362443069626d39755a53", hex"49675a4430695454453549444d7961444d30646a49305344453565694976506a7877", hex"5958526f49475a706247773949694e6c595456684e44636949475139496b30794f53", hex"41794d5777744e53413164693035614456364969382b5043396e506a77765a7a3438", hex"5a794230636d467563325a76636d3039496d316864484a70654367754f4451674d43", hex"4177494334344e4341324e5341314b53492b50484268644767675a44306954546b75", hex"4e5341794d693435624451754f4341324c6a52684d7934784d69417a4c6a45794944", hex"41674d4341784c544d674d693479624330304c6a67744e6934305979347a4c544575", hex"4e4341784c6a59744d69343049444d744d693479656949675a6d6c73624430694932", hex"517759325a6a5a534976506a78775958526f49475a706247773949694d774d544178", hex"4d44456949475139496b30304d53343349444d344c6a56734e5334784c5459754e53", hex"4976506a78775958526f49475139496b30304d693435494449334c6a684d4d546775", hex"4e4341314f4334784944493049445979624449784c6a67744d6a63754d7941794c6a", hex"4d744d693434656949675932786863334d39496b55694c7a3438634746306143426d", hex"615778735053496a4d4445774d5441784969426b50534a4e4e444d754e4341794f53", hex"347a624330304c6a63674e5334344969382b50484268644767675a44306954545132", hex"4c6a67674d7a4a6a4d793479494449754e6941344c6a63674d533479494445794c6a", hex"45744d793479637a4d754e6930354c6a6b754d7930784d693431624330314c6a4567", hex"4e6934314c5449754f4330754d5330754e7930794c6a63674e5334784c5459754e57", hex"4d744d7934794c5449754e6930344c6a63744d5334794c5445794c6a45674d793479", hex"6379307a4c6a59674f5334354c53347a494445794c6a556949474e7359584e7a5053", hex"4a464969382b50484268644767675a6d6c7362443069493245314e7a6b7a4f534967", hex"5a443069545449334c6a4d674d6a5a734d5445754f4341784e53343349444d754e43", hex"41794c6a51674f533478494445304c6a51744d793479494449754d79307849433433", hex"4c5445774c6a49744d544d754e6930784c6a4d744d7934354c5445784c6a67744d54", hex"55754e336f694c7a3438634746306143426b50534a4e4d5449674d546b754f577731", hex"4c6a6b674e793435494445774c6a49744e7934324c544d754e4330304c6a567a4e69", hex"34344c5455754d5341784d4334334c5451754e574d77494441744e6934324c544d74", hex"4d544d754d7941784c6a46544d5449674d546b754f5341784d6941784f5334356569", hex"49675932786863334d39496b55694c7a34385a79426d6157787350534a756232356c", hex"4969427a64484a766132553949694d774d44416949474e7359584e7a50534a434945", hex"4d675243492b50484268644767675a44306954545579494455344c6a6c4d4e444175", hex"4f5341304d7934796243307a4c6a45744d69347a4c5445774c6a59744d5451754e79", hex"30794c6a6b674d693479494445774c6a59674d5451754e7941784c6a45674d793432", hex"494445784c6a55674d5455754e58704e4d5449754e5341784f533434624455754f43", hex"4134494445774c6a4d744e7934304c544d754d7930304c6a5a7a4e6934354c545567", hex"4d5441754f4330304c6a4e6a4d4341774c5459754e69307a4c6a45744d544d754d79", hex"3435637930784d43347a494463754e4330784d43347a494463754e4870744c544975", hex"4e6941794c6a6c734e433433494459754e574d744c6a55674d53347a4c5445754e79", hex"41794c6a45744d7941794c6a4a734c5451754e7930324c6a566a4c6a4d744d533430", hex"494445754e6930794c6a51674d7930794c6a4a364969382b50484268644767675a44", hex"3069545451784c6a4d674d7a67754e5777314c6a45744e6934316253307a4c6a5574", hex"4d693433624330304c6a59674e533434625467754d53307a4c6a466a4d7934794944", hex"49754e6941344c6a63674d533479494445794c6a45744d793479637a4d754e693035", hex"4c6a6b754d7930784d693431624330314c6a45674e6934314c5449754f4330754d53", hex"30754f4330794c6a63674e5334784c5459754e574d744d7934794c5449754e693034", hex"4c6a63744d5334794c5445794c6a45674d7934794c544d754e4341304c6a4d744d79", hex"343249446b754f5330754d7941784d6934314969426a6247467a637a306952694976", hex"506a78775958526f49475139496b307a4d433434494451304c6a524d4d546b674e54", hex"67754f57773049444d674d5441744d5449754e7949675932786863334d39496b5969", hex"4c7a34384c32632b5043396e506a777663335a6e50673d3d227d" ); /* ","description":"This%20NFT%20can%20be%20redeemed%20on%20HomeWork%20 to%20grant%20a%20controller%20the%20exclusive%20right%20to%20deploy%20 contracts%20with%20arbitrary%20bytecode%20to%20the%20designated%20home %20address.","image":"data:image/svg+xml;charset=utf-8;base64,..."} */ // Deploy payload to the runtime storage contract. _deployRuntimeStorageContract(key, code); } /** * @notice Perform phase three of the deployment and disable this contract. * @param key bytes32 The salt to provide to create2. */ function phaseThree(bytes32 key) external onlyUntilDisabled { // Use metamorphic initialization code to deploy contract to home address. _deployToHomeAddress(key); // Disable this contract from here on out - use HomeWork itself instead. _disabled = true; } /** * @notice View function used by the metamorphic initialization code when * deploying a contract to a home address. It returns the address of the * runtime storage contract that holds the contract creation code, which the * metamorphic creation code then `DELEGATECALL`s into in order to set up the * contract and deploy the target runtime code. * @return The current runtime storage contract that contains the target * contract creation code. * @dev This method is not meant to be part of the user-facing contract API, * but is rather a mechanism for enabling the deployment of arbitrary code via * fixed initialization code. The odd naming is chosen so that function * selector will be 0x00000009 - that way, the metamorphic contract can simply * use the `PC` opcode in order to push the selector to the stack. */ function getInitializationCodeFromContractRuntime_6CLUNS() external view returns (address initializationRuntimeStorageContract) { // Return address of contract with initialization code set as runtime code. initializationRuntimeStorageContract = _initializationRuntimeStorageContract; } /** * @notice Internal function for deploying a runtime storage contract given a * particular payload. * @dev To take the provided code payload and deploy a contract with that * payload as its runtime code, use the following prelude: * * 0x600b5981380380925939f3... * * 00 60 push1 0b [11 -> offset] * 02 59 msize [offset, 0] * 03 81 dup2 [offset, 0, offset] * 04 38 codesize [offset, 0, offset, codesize] * 05 03 sub [offset, 0, codesize - offset] * 06 80 dup1 [offset, 0, codesize - offset, codesize - offset] * 07 92 swap3 [codesize - offset, 0, codesize - offset, offset] * 08 59 msize [codesize - offset, 0, codesize - offset, offset, 0] * 09 39 codecopy [codesize - offset, 0] <init_code_in_runtime> * 10 f3 return [] *init_code_in_runtime* * ... init_code */ function _deployRuntimeStorageContract(bytes32 key, bytes memory payload) internal returns (address runtimeStorageContract) { // Construct the contract creation code using the prelude and the payload. bytes memory runtimeStorageContractCreationCode = abi.encodePacked( _ARBITRARY_RUNTIME_PRELUDE, payload ); assembly { // Get the location and length of the newly-constructed creation code. let encoded_data := add(0x20, runtimeStorageContractCreationCode) let encoded_size := mload(runtimeStorageContractCreationCode) // Deploy the runtime storage contract via `CREATE2`. runtimeStorageContract := create2(0, encoded_data, encoded_size, key) // Pass along revert message if the contract did not deploy successfully. if iszero(runtimeStorageContract) { returndatacopy(0, 0, returndatasize) revert(0, returndatasize) } } // Emit an event with address of newly-deployed runtime storage contract. emit StorageContractDeployment(runtimeStorageContract); } /** * @notice Internal function for deploying arbitrary contract code to the home * address corresponding to a suppied key via metamorphic initialization code. * @dev This deployment method uses the "metamorphic delegator" pattern, where * it will retrieve the address of the contract that contains the target * initialization code, then delegatecall into it, which executes the * initialization code stored there and returns the runtime code (or reverts). * Then, the runtime code returned by the delegatecall is returned, and since * we are still in the initialization context, it will be set as the runtime * code of the metamorphic contract. The 32-byte metamorphic initialization * code is as follows: * * 0x5859385958601c335a585952fa1582838382515af43d3d93833e601e57fd5bf3 * * 00 58 PC [0] * 01 59 MSIZE [0, 0] * 02 38 CODESIZE [0, 0, codesize -> 32] * returndatac03 59 MSIZE [0, 0, 32, 0] * 04 58 PC [0, 0, 32, 0, 4] * 05 60 PUSH1 0x1c [0, 0, 32, 0, 4, 28] * 07 33 CALLER [0, 0, 32, 0, 4, 28, caller] * 08 5a GAS [0, 0, 32, 0, 4, 28, caller, gas] * 09 58 PC [0, 0, 32, 0, 4, 28, caller, gas, 9 -> selector] * 10 59 MSIZE [0, 0, 32, 0, 4, 28, caller, gas, selector, 0] * 11 52 MSTORE [0, 0, 32, 0, 4, 28, caller, gas] <selector> * 12 fa STATICCALL [0, 0, 1 => success] <init_in_runtime_address> * 13 15 ISZERO [0, 0, 0] * 14 82 DUP3 [0, 0, 0, 0] * 15 83 DUP4 [0, 0, 0, 0, 0] * 16 83 DUP4 [0, 0, 0, 0, 0, 0] * 17 82 DUP3 [0, 0, 0, 0, 0, 0, 0] * 18 51 MLOAD [0, 0, 0, 0, 0, 0, init_in_runtime_address] * 19 5a GAS [0, 0, 0, 0, 0, 0, init_in_runtime_address, gas] * 20 f4 DELEGATECALL [0, 0, 1 => success] {runtime_code} * 21 3d RETURNDATASIZE [0, 0, 1 => success, size] * 22 3d RETURNDATASIZE [0, 0, 1 => success, size, size] * 23 93 SWAP4 [size, 0, 1 => success, size, 0] * 24 83 DUP4 [size, 0, 1 => success, size, 0, 0] * 25 3e RETURNDATACOPY [size, 0, 1 => success] <runtime_code> * 26 60 PUSH1 0x1e [size, 0, 1 => success, 30] * 28 57 JUMPI [size, 0] * 29 fd REVERT [] *runtime_code* * 30 5b JUMPDEST [size, 0] * 31 f3 RETURN [] */ function _deployToHomeAddress(bytes32 key) internal { // Declare a variable for the home address. address homeAddress; assembly { // Write the 32-byte metamorphic initialization code to scratch space. mstore( 0, 0x5859385958601c335a585952fa1582838382515af43d3d93833e601e57fd5bf3 ) // Call `CREATE2` using above init code with the supplied key as the salt. homeAddress := create2(callvalue, 0, 32, key) // Pass along revert message if the contract did not deploy successfully. if iszero(homeAddress) { returndatacopy(0, 0, returndatasize) revert(0, returndatasize) } } // Clear the address of the runtime storage contract from storage. delete _initializationRuntimeStorageContract; // Emit an event with home address and key for the newly-deployed contract. emit HomeWorkDeployment(homeAddress, key); } /** * @notice Modifier to disable the contract once deployment is complete. */ modifier onlyUntilDisabled() { require(!_disabled, "Contract is disabled."); _; } }
* @notice Perform phase three of the deployment and disable this contract. @param key bytes32 The salt to provide to create2./ Use metamorphic initialization code to deploy contract to home address. Disable this contract from here on out - use HomeWork itself instead.
function phaseThree(bytes32 key) external onlyUntilDisabled { _deployToHomeAddress(key); _disabled = true; }
5,428,689
[ 1, 4990, 6855, 8925, 434, 326, 6314, 471, 4056, 333, 6835, 18, 225, 498, 1731, 1578, 1021, 4286, 358, 5615, 358, 752, 22, 18, 19, 2672, 5100, 301, 18435, 10313, 981, 358, 7286, 6835, 358, 6382, 1758, 18, 10639, 333, 6835, 628, 2674, 603, 596, 300, 999, 21321, 2421, 6174, 3560, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 6855, 28019, 12, 3890, 1578, 498, 13, 3903, 1338, 9716, 8853, 288, 203, 565, 389, 12411, 774, 8684, 1887, 12, 856, 1769, 203, 203, 565, 389, 9278, 273, 638, 31, 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 ]
/** * tg- https://t.me/BadSantaEth * https://badsantaeth.com/ * twitter.com/BadSantaEth * Coal Tax on SELLS only for the first 6 hours. Will use to add to liquidity */ //SPDX-License-Identifier: Unlicensed pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } 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; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract BadSanta is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => uint256) private _buyMap; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; mapping (address => uint) private cooldown; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 1e12 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "Bad Santa"; string private constant _symbol = "BadSanta"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; uint256 private maxWalletAmount = _tTotal * 30 / 1000; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0x6B99a8fD17A0e15B29271Be382ccadd158C47023); _feeAddrWallet2 = payable(0x6B99a8fD17A0e15B29271Be382ccadd158C47023); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function originalPurchase(address account) public view returns (uint256) { return _buyMap[account]; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function setMaxTx(uint256 maxTransactionAmount) external onlyOwner() { _maxTxAmount = maxTransactionAmount; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function _approve(address owner, address spender, uint256 amount) private { 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); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (!_isBuy(from)) { // TAX SELLERS 30% WHO SELL WITHIN 6 HOURS if (_buyMap[from] != 0 && (_buyMap[from] + (6 hours) >= block.timestamp)) { _feeAddr1 = 2; _feeAddr2 = 18; } else { _feeAddr1 = 2; _feeAddr2 = 8; } } else { if (_buyMap[to] == 0) { _buyMap[to] = block.timestamp; } _feeAddr1 = 2; _feeAddr2 = 8; } if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(cooldown[to] < block.timestamp); require(amount <= _maxTxAmount); require(balanceOf(to) + amount <= maxWalletAmount, "Max wallet exceeded"); cooldown[to] = block.timestamp + (30 seconds); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount.div(2)); _feeAddrWallet2.transfer(amount.div(2)); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 10000000000 * 10 ** 9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function removeStrictTxLimit() public onlyOwner { _maxTxAmount = 1e12 * 10**9; } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function updateMaxTx (uint256 fee) public onlyOwner { _maxTxAmount = fee; } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _isBuy(address _sender) private view returns (bool) { return _sender == uniswapV2Pair; } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
TAX SELLERS 30% WHO SELL WITHIN 6 HOURS Cooldown
function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if (!_isBuy(from)) { if (_buyMap[from] != 0 && (_buyMap[from] + (6 hours) >= block.timestamp)) { _feeAddr1 = 2; _feeAddr2 = 18; _feeAddr1 = 2; _feeAddr2 = 8; } if (_buyMap[to] == 0) { _buyMap[to] = block.timestamp; } _feeAddr1 = 2; _feeAddr2 = 8; } if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { require(cooldown[to] < block.timestamp); require(amount <= _maxTxAmount); require(balanceOf(to) + amount <= maxWalletAmount, "Max wallet exceeded"); cooldown[to] = block.timestamp + (30 seconds); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); }
5,825,475
[ 1, 56, 2501, 20853, 48, 11367, 5196, 9, 678, 7995, 20853, 48, 13601, 706, 1666, 17001, 55, 385, 1371, 2378, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3238, 288, 203, 3639, 2583, 12, 2080, 480, 1758, 12, 20, 3631, 315, 654, 39, 3462, 30, 7412, 628, 326, 3634, 1758, 8863, 203, 3639, 2583, 12, 869, 480, 1758, 12, 20, 3631, 315, 654, 39, 3462, 30, 7412, 358, 326, 3634, 1758, 8863, 203, 3639, 2583, 12, 8949, 405, 374, 16, 315, 5912, 3844, 1297, 506, 6802, 2353, 3634, 8863, 203, 377, 203, 540, 203, 3639, 309, 16051, 67, 291, 38, 9835, 12, 2080, 3719, 288, 203, 5411, 309, 261, 67, 70, 9835, 863, 63, 2080, 65, 480, 374, 597, 203, 7734, 261, 67, 70, 9835, 863, 63, 2080, 65, 397, 261, 26, 7507, 13, 1545, 1203, 18, 5508, 3719, 225, 288, 203, 7734, 389, 21386, 3178, 21, 273, 576, 31, 203, 7734, 389, 21386, 3178, 22, 273, 6549, 31, 203, 7734, 389, 21386, 3178, 21, 273, 576, 31, 203, 7734, 389, 21386, 3178, 22, 273, 1725, 31, 203, 5411, 289, 203, 5411, 309, 261, 67, 70, 9835, 863, 63, 869, 65, 422, 374, 13, 288, 203, 7734, 389, 70, 9835, 863, 63, 869, 65, 273, 1203, 18, 5508, 31, 203, 5411, 289, 203, 5411, 389, 21386, 3178, 21, 273, 576, 31, 203, 5411, 389, 21386, 3178, 22, 273, 1725, 31, 203, 3639, 289, 203, 540, 203, 3639, 309, 261, 2080, 480, 3410, 1435, 597, 358, 480, 3410, 10756, 288, 203, 5411, 2583, 12, 5, 4819, 87, 63, 2080, 65, 597, 401, 4819, 87, 63, 869, 19226, 203, 2 ]
pragma solidity ^0.8.0; import { SafeMath } from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import { IERC20 } from '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { IERC721 } from '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; interface AuctionHouse { struct Auction { uint256 dogId; uint256 amount; uint256 startTime; uint256 endTime; address payable bidder; bool settled; } function auction() external view returns(Auction memory); function minBidIncrementPercentage() external view returns(uint8); function reservePrice() external view returns(uint256); function createBid(uint256 dogId, uint256 amount) external payable; } contract AuctionBidder is Ownable, ERC1155Holder, IERC721Receiver { using SafeERC20 for IERC20; using SafeMath for uint256; address public treasury; IERC20 public weth; IERC721 public dogs; AuctionHouse public auctionHouse; uint256 public minBid; uint256 public maxBid; event MinBidUpdated( uint256 oldMinBid, uint256 newMinBid ); event MaxBidUpdated( uint256 oldMaxBid, uint256 newMaxBid ); constructor(address _auctionHouse, address _treasury, address _weth, address _dogs) { auctionHouse = AuctionHouse(_auctionHouse); weth = IERC20(_weth); dogs = IERC721(_dogs); treasury = _treasury; // @dev max approve auctionHouse && treasury weth.approve(address(_auctionHouse), 2**256 - 1); weth.approve(address(_treasury), 2**256 - 1); transferOwnership(treasury); } function _balance() internal view returns(uint256) { return weth.balanceOf(address(this)); } function setMinBid(uint256 _minBid) external onlyOwner { emit MinBidUpdated(minBid, _minBid); minBid = _minBid; } function setMaxBid(uint256 _maxBid) external onlyOwner { emit MaxBidUpdated(maxBid, _maxBid); maxBid = _maxBid; } function bidReady() view external returns(bool ready) { AuctionHouse.Auction memory auction = auctionHouse.auction(); if ( ( block.timestamp < auction.endTime ) && ( maxBid >= auction.amount + (( auction.amount * auctionHouse.minBidIncrementPercentage() ) / 100) ) && ( _balance() >= auction.amount + (( auction.amount * auctionHouse.minBidIncrementPercentage() ) / 100) ) && ( auction.bidder != address(this) ) && ( _balance() >= minBid ) ) { ready = true; } } // @dev this function can be used as trigger on Gelato network function bidReadyGelato() external view returns(bool canExec, bytes memory execPayload) { canExec = this.bidReady(); if (canExec == true) { execPayload = abi.encodeWithSelector(this.bid.selector); } } function bid() external { require(this.bidReady() == true, "can't bid"); AuctionHouse.Auction memory auction = auctionHouse.auction(); // @dev bid the minimum uint256 amount = auction.amount + (( auction.amount * auctionHouse.minBidIncrementPercentage() ) / 100); if (amount == 0) { amount = auctionHouse.reservePrice(); } if (minBid > amount) { amount = minBid; } auctionHouse.createBid(auction.dogId, amount); } // @dev send won Dogs to tresury function transferDog(uint256 dogId) external { dogs.transferFrom(address(this), treasury, dogId); } // @dev for BSCT,idleWETHx, etc function transferERC20(address token) external { require(token != address(weth), "use transferWETH function"); uint256 amount = IERC20(token).balanceOf(address(this)); IERC20(token).safeTransfer(treasury, amount); } // @dev for WETH function transferWETH() external onlyOwner { uint256 amount = weth.balanceOf(address(this)); weth.safeTransfer(treasury, amount); } function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data) external pure override returns (bytes4) { return IERC721Receiver.onERC721Received.selector; } }
@dev send won Dogs to tresury
function transferDog(uint256 dogId) external { dogs.transferFrom(address(this), treasury, dogId); }
12,827,838
[ 1, 4661, 8462, 2256, 564, 358, 268, 455, 22498, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 40, 717, 12, 11890, 5034, 302, 717, 548, 13, 3903, 288, 203, 3639, 741, 564, 18, 13866, 1265, 12, 2867, 12, 2211, 3631, 9787, 345, 22498, 16, 302, 717, 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 ]
// 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; 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 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; /** * @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' 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 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; 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 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: GPL-3.0 pragma solidity ^0.8.7; import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "../interfaces/IAccessControl.sol"; /** * @dev This contract is fully forked from OpenZeppelin `AccessControlUpgradeable`. * The only difference is the removal of the ERC165 implementation as it's not * needed in Angle. * * 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, IAccessControl { function __AccessControl_init() internal initializer { __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 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 {_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 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]{20}) is missing role (0x[0-9a-f]{32})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, msg.sender); _; } /** * @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]{20}) is missing role (0x[0-9a-f]{32})$/ */ 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) external 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) external 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) external override { require(account == msg.sender, "71"); _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 { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal { emit RoleAdminChanged(role, getRoleAdmin(role), adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) internal { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, msg.sender); } } function _revokeRole(bytes32 role, address account) internal { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, msg.sender); } } uint256[49] private __gap; } // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; /// @title IAccessControl /// @author Forked from OpenZeppelin /// @notice Interface for `AccessControl` contracts interface IAccessControl { function hasRole(bytes32 role, address account) external view returns (bool); function getRoleAdmin(bytes32 role) external view returns (bytes32); function grantRole(bytes32 role, address account) external; function revokeRole(bytes32 role, address account) external; function renounceRole(bytes32 role, address account) external; } // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; interface IAngleMiddlemanGauge { function notifyReward(address gauge, uint256 amount) external; } // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; interface IGaugeController { //solhint-disable-next-line function gauge_types(address addr) external view returns (int128); //solhint-disable-next-line function gauge_relative_weight_write(address addr, uint256 timestamp) external returns (uint256); //solhint-disable-next-line function gauge_relative_weight(address addr, uint256 timestamp) external view returns (uint256); } // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; interface ILiquidityGauge { // solhint-disable-next-line function deposit_reward_token(address _rewardToken, uint256 _amount) external; } // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /// @title IStakingRewardsFunctions /// @author Angle Core Team /// @notice Interface for the staking rewards contract that interact with the `RewardsDistributor` contract interface IStakingRewardsFunctions { function notifyRewardAmount(uint256 reward) external; function recoverERC20( address tokenAddress, address to, uint256 tokenAmount ) external; function setNewRewardsDistribution(address newRewardsDistribution) external; } /// @title IStakingRewards /// @author Angle Core Team /// @notice Previous interface with additionnal getters for public variables interface IStakingRewards is IStakingRewardsFunctions { function rewardToken() external view returns (IERC20); } // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; import "./AngleDistributorEvents.sol"; /// @title AngleDistributor /// @author Forked from contracts developed by Curve and Frax and adapted by Angle Core Team /// - ERC20CRV.vy (https://github.com/curvefi/curve-dao-contracts/blob/master/contracts/ERC20CRV.vy) /// - FraxGaugeFXSRewardsDistributor.sol (https://github.com/FraxFinance/frax-solidity/blob/master/src/hardhat/contracts/Curve/FraxGaugeFXSRewardsDistributor.sol) /// @notice All the events used in `AngleDistributor` contract contract AngleDistributor is AngleDistributorEvents, ReentrancyGuardUpgradeable, AccessControlUpgradeable { using SafeERC20 for IERC20; /// @notice Role for governors only bytes32 public constant GOVERNOR_ROLE = keccak256("GOVERNOR_ROLE"); /// @notice Role for the guardian bytes32 public constant GUARDIAN_ROLE = keccak256("GUARDIAN_ROLE"); /// @notice Length of a week in seconds uint256 public constant WEEK = 3600 * 24 * 7; /// @notice Time at which the emission rate is updated uint256 public constant RATE_REDUCTION_TIME = WEEK; /// @notice Reduction of the emission rate uint256 public constant RATE_REDUCTION_COEFFICIENT = 1007827884862117171; // 1.5 ^ (1/52) * 10**18 /// @notice Base used for computation uint256 public constant BASE = 10**18; /// @notice Maps the address of a gauge to the last time this gauge received rewards mapping(address => uint256) public lastTimeGaugePaid; /// @notice Maps the address of a gauge to whether it was killed or not /// A gauge killed in this contract cannot receive any rewards mapping(address => bool) public killedGauges; /// @notice Maps the address of a type >= 2 gauge to a delegate address responsible /// for giving rewards to the actual gauge mapping(address => address) public delegateGauges; /// @notice Maps the address of a gauge delegate to whether this delegate supports the `notifyReward` interface /// and is therefore built for automation mapping(address => bool) public isInterfaceKnown; /// @notice Address of the ANGLE token given as a reward IERC20 public rewardToken; /// @notice Address of the `GaugeController` contract IGaugeController public controller; /// @notice Address responsible for pulling rewards of type >= 2 gauges and distributing it to the /// associated contracts if there is not already an address delegated for this specific contract address public delegateGauge; /// @notice ANGLE current emission rate, it is first defined in the initializer and then updated every week uint256 public rate; /// @notice Timestamp at which the current emission epoch started uint256 public startEpochTime; /// @notice Amount of ANGLE tokens distributed through staking at the start of the epoch /// This is an informational variable used to track how much has been distributed through liquidity mining uint256 public startEpochSupply; /// @notice Index of the current emission epoch /// Here also, this variable is not useful per se inside the smart contracts of the protocol, it is /// just an informational variable uint256 public miningEpoch; /// @notice Whether ANGLE distribution through this contract is on or no bool public distributionsOn; /// @notice Constructor of the contract /// @param _rewardToken Address of the ANGLE token /// @param _controller Address of the GaugeController /// @param _initialRate Initial ANGLE emission rate /// @param _startEpochSupply Amount of ANGLE tokens already distributed via liquidity mining /// @param governor Governor address of the contract /// @param guardian Address of the guardian of this contract /// @param _delegateGauge Address that will be used to pull rewards for type 2 gauges /// @dev After this contract is created, the correct amount of ANGLE tokens should be transferred to the contract /// @dev The `_delegateGauge` can be the zero address function initialize( address _rewardToken, address _controller, uint256 _initialRate, uint256 _startEpochSupply, address governor, address guardian, address _delegateGauge ) external initializer { require( _controller != address(0) && _rewardToken != address(0) && guardian != address(0) && governor != address(0), "0" ); rewardToken = IERC20(_rewardToken); controller = IGaugeController(_controller); startEpochSupply = _startEpochSupply; miningEpoch = 0; // Some ANGLE tokens should be sent to the contract directly after initialization rate = _initialRate; delegateGauge = _delegateGauge; distributionsOn = false; startEpochTime = block.timestamp; _setRoleAdmin(GOVERNOR_ROLE, GOVERNOR_ROLE); _setRoleAdmin(GUARDIAN_ROLE, GOVERNOR_ROLE); _setupRole(GUARDIAN_ROLE, guardian); _setupRole(GOVERNOR_ROLE, governor); _setupRole(GUARDIAN_ROLE, governor); } /// @custom:oz-upgrades-unsafe-allow constructor constructor() initializer {} // ======================== Internal Functions ================================= /// @notice Internal function to distribute rewards to a gauge /// @param gaugeAddr Address of the gauge to distribute rewards to /// @return weeksElapsed Weeks elapsed since the last call /// @return rewardTally Amount of rewards distributed to the gauge /// @dev The reason for having an internal function is that it's called by the `distributeReward` and the /// `distributeRewardToMultipleGauges` /// @dev Although they would need to be performed all the time this function is called, this function does not /// contain checks on whether distribution is on, and on whether rate should be reduced. These are done in each external /// function calling this function for gas efficiency function _distributeReward(address gaugeAddr) internal returns (uint256 weeksElapsed, uint256 rewardTally) { // Checking if the gauge has been added or if it still possible to distribute rewards to this gauge int128 gaugeType = IGaugeController(controller).gauge_types(gaugeAddr); require(gaugeType >= 0 && !killedGauges[gaugeAddr], "110"); // Calculate the elapsed time in weeks. uint256 lastTimePaid = lastTimeGaugePaid[gaugeAddr]; // Edge case for first reward for this gauge if (lastTimePaid == 0) { weeksElapsed = 1; if (gaugeType == 0) { // We give a full approval for the gauges with type zero which correspond to the staking // contracts of the protocol rewardToken.safeApprove(gaugeAddr, type(uint256).max); } } else { // Truncation desired weeksElapsed = (block.timestamp - lastTimePaid) / WEEK; // Return early here for 0 weeks instead of throwing, as it could have bad effects in other contracts if (weeksElapsed == 0) { return (0, 0); } } rewardTally = 0; // We use this variable to keep track of the emission rate across different weeks uint256 weeklyRate = rate; for (uint256 i = 0; i < weeksElapsed; i++) { uint256 relWeightAtWeek; if (i == 0) { // Mutative, for the current week: makes sure the weight is checkpointed. Also returns the weight. relWeightAtWeek = controller.gauge_relative_weight_write(gaugeAddr, block.timestamp); } else { // View relWeightAtWeek = controller.gauge_relative_weight(gaugeAddr, (block.timestamp - WEEK * i)); } rewardTally += (weeklyRate * relWeightAtWeek * WEEK) / BASE; // To get the rate of the week prior from the current rate we just have to multiply by the weekly division // factor // There may be some precisions error: inferred previous values of the rate may be different to what we would // have had if the rate had been computed correctly in these weeks: we expect from empirical observations // this `weeklyRate` to be inferior to what the `rate` would have been weeklyRate = (weeklyRate * RATE_REDUCTION_COEFFICIENT) / BASE; } // Update the last time paid, rounded to the closest week // in order not to have an ever moving time on when to call this function lastTimeGaugePaid[gaugeAddr] = (block.timestamp / WEEK) * WEEK; // If the `gaugeType >= 2`, this means that the gauge is a gauge on another chain (and corresponds to tokens // that need to be bridged) or is associated to an external contract of the Angle Protocol if (gaugeType >= 2) { // If it is defined, we use the specific delegate attached to the gauge address delegate = delegateGauges[gaugeAddr]; if (delegate == address(0)) { // If not, we check if a delegate common to all gauges with type >= 2 can be used delegate = delegateGauge; } if (delegate != address(0)) { // In the case where the gauge has a delegate (specific or not), then rewards are transferred to this gauge rewardToken.safeTransfer(delegate, rewardTally); // If this delegate supports a specific interface, then rewards sent are notified through this // interface if (isInterfaceKnown[delegate]) { IAngleMiddlemanGauge(delegate).notifyReward(gaugeAddr, rewardTally); } } else { rewardToken.safeTransfer(gaugeAddr, rewardTally); } } else if (gaugeType == 1) { // This is for the case of Perpetual contracts which need to be able to receive their reward tokens rewardToken.safeTransfer(gaugeAddr, rewardTally); IStakingRewards(gaugeAddr).notifyRewardAmount(rewardTally); } else { // Mainnet: Pay out the rewards directly to the gauge ILiquidityGauge(gaugeAddr).deposit_reward_token(address(rewardToken), rewardTally); } emit RewardDistributed(gaugeAddr, rewardTally); } /// @notice Updates mining rate and supply at the start of the epoch /// @dev Any modifying mining call must also call this /// @dev It is possible that more than one week past between two calls of this function, and for this reason /// this function has been slightly modified from Curve implementation by Angle Team function _updateMiningParameters() internal { // When entering this function, we always have: `(block.timestamp - startEpochTime) / RATE_REDUCTION_TIME >= 1` uint256 epochDelta = (block.timestamp - startEpochTime) / RATE_REDUCTION_TIME; // Storing intermediate values for the rate and for the `startEpochSupply` uint256 _rate = rate; uint256 _startEpochSupply = startEpochSupply; startEpochTime += RATE_REDUCTION_TIME * epochDelta; miningEpoch += epochDelta; for (uint256 i = 0; i < epochDelta; i++) { // Updating the intermediate values of the `startEpochSupply` _startEpochSupply += _rate * RATE_REDUCTION_TIME; _rate = (_rate * BASE) / RATE_REDUCTION_COEFFICIENT; } rate = _rate; startEpochSupply = _startEpochSupply; emit UpdateMiningParameters(block.timestamp, _rate, _startEpochSupply); } /// @notice Toggles the fact that a gauge delegate can be used for automation or not and therefore supports /// the `notifyReward` interface /// @param _delegateGauge Address of the gauge to change function _toggleInterfaceKnown(address _delegateGauge) internal { bool isInterfaceKnownMem = isInterfaceKnown[_delegateGauge]; isInterfaceKnown[_delegateGauge] = !isInterfaceKnownMem; emit InterfaceKnownToggled(_delegateGauge, !isInterfaceKnownMem); } // ================= Permissionless External Functions ========================= /// @notice Distributes rewards to a staking contract (also called gauge) /// @param gaugeAddr Address of the gauge to send tokens too /// @return weeksElapsed Number of weeks elapsed since the last time rewards were distributed /// @return rewardTally Amount of tokens sent to the gauge /// @dev Anyone can call this function to distribute rewards to the different staking contracts function distributeReward(address gaugeAddr) external nonReentrant returns (uint256, uint256) { // Checking if distribution is on require(distributionsOn == true, "109"); // Updating rate distribution parameters if need be if (block.timestamp >= startEpochTime + RATE_REDUCTION_TIME) { _updateMiningParameters(); } return _distributeReward(gaugeAddr); } /// @notice Distributes rewards to multiple staking contracts /// @param gauges Addresses of the gauge to send tokens too /// @dev Anyone can call this function to distribute rewards to the different staking contracts /// @dev Compared with the `distributeReward` function, this function sends rewards to multiple /// contracts at the same time function distributeRewardToMultipleGauges(address[] memory gauges) external nonReentrant { // Checking if distribution is on require(distributionsOn == true, "109"); // Updating rate distribution parameters if need be if (block.timestamp >= startEpochTime + RATE_REDUCTION_TIME) { _updateMiningParameters(); } for (uint256 i = 0; i < gauges.length; i++) { _distributeReward(gauges[i]); } } /// @notice Updates mining rate and supply at the start of the epoch /// @dev Callable by any address, but only once per epoch function updateMiningParameters() external { require(block.timestamp >= startEpochTime + RATE_REDUCTION_TIME, "108"); _updateMiningParameters(); } // ========================= Governor Functions ================================ /// @notice Withdraws ERC20 tokens that could accrue on this contract /// @param tokenAddress Address of the ERC20 token to withdraw /// @param to Address to transfer to /// @param amount Amount to transfer /// @dev Added to support recovering LP Rewards and other mistaken tokens /// from other systems to be distributed to holders /// @dev This function could also be used to recover ANGLE tokens in case the rate got smaller function recoverERC20( address tokenAddress, address to, uint256 amount ) external onlyRole(GOVERNOR_ROLE) { // If the token is the ANGLE token, we need to make sure that governance is not going to withdraw // too many tokens and that it'll be able to sustain the weekly distribution forever // This check assumes that `distributeReward` has been called for gauges and that there are no gauges // which have not received their past week's rewards if (tokenAddress == address(rewardToken)) { uint256 currentBalance = rewardToken.balanceOf(address(this)); // The amount distributed till the end is `rate * WEEK / (1 - RATE_REDUCTION_FACTOR)` where // `RATE_REDUCTION_FACTOR = BASE / RATE_REDUCTION_COEFFICIENT` which translates to: require( currentBalance >= ((rate * RATE_REDUCTION_COEFFICIENT) * WEEK) / (RATE_REDUCTION_COEFFICIENT - BASE) + amount, "4" ); } IERC20(tokenAddress).safeTransfer(to, amount); emit Recovered(tokenAddress, to, amount); } /// @notice Sets a new gauge controller /// @param _controller Address of the new gauge controller function setGaugeController(address _controller) external onlyRole(GOVERNOR_ROLE) { require(_controller != address(0), "0"); controller = IGaugeController(_controller); emit GaugeControllerUpdated(_controller); } /// @notice Sets a new delegate gauge for pulling rewards of a type >= 2 gauges or of all type >= 2 gauges /// @param gaugeAddr Gauge to change the delegate of /// @param _delegateGauge Address of the new gauge delegate related to `gaugeAddr` /// @param toggleInterface Whether we should toggle the fact that the `_delegateGauge` is built for automation or not /// @dev This function can be used to remove delegating or introduce the pulling of rewards to a given address /// @dev If `gaugeAddr` is the zero address, this function updates the delegate gauge common to all gauges with type >= 2 /// @dev The `toggleInterface` parameter has been added for convenience to save one transaction when adding a gauge delegate /// which supports the `notifyReward` interface function setDelegateGauge( address gaugeAddr, address _delegateGauge, bool toggleInterface ) external onlyRole(GOVERNOR_ROLE) { if (gaugeAddr != address(0)) { delegateGauges[gaugeAddr] = _delegateGauge; } else { delegateGauge = _delegateGauge; } emit DelegateGaugeUpdated(gaugeAddr, _delegateGauge); if (toggleInterface) { _toggleInterfaceKnown(_delegateGauge); } } /// @notice Changes the ANGLE emission rate /// @param _newRate New ANGLE emission rate /// @dev It is important to be super wary when calling this function and to make sure that `distributeReward` /// has been called for all gauges in the past weeks. If not, gauges may get an incorrect distribution of ANGLE rewards /// for these past weeks based on the new rate and not on the old rate /// @dev Governance should thus make sure to call this function rarely and when it does to do it after the weekly `distributeReward` /// calls for all existing gauges /// @dev As this function assumes that `distributeReward` has been called during the week, it also assumes that the `startEpochSupply` /// parameter has been put up to date function setRate(uint256 _newRate) external onlyRole(GOVERNOR_ROLE) { // Checking if the new rate is compatible with the amount of ANGLE tokens this contract has in balance // This check assumes, like this function, that `distributeReward` has correctly been called before require( rewardToken.balanceOf(address(this)) >= ((_newRate * RATE_REDUCTION_COEFFICIENT) * WEEK) / (RATE_REDUCTION_COEFFICIENT - BASE), "4" ); rate = _newRate; emit RateUpdated(_newRate); } /// @notice Toggles the status of a gauge to either killed or unkilled /// @param gaugeAddr Gauge to toggle the status of /// @dev It is impossible to kill a gauge in the `GaugeController` contract, for this reason killing of gauges /// takes place in the `AngleDistributor` contract /// @dev This means that people could vote for a gauge in the gauge controller contract but that rewards are not going /// to be distributed to it in the end: people would need to remove their weights on the gauge killed to end the diminution /// in rewards /// @dev In the case of a gauge being killed, this function resets the timestamps at which this gauge has been approved and /// disapproves the gauge to spend the token /// @dev It should be cautiously called by governance as it could result in less ANGLE overall rewards than initially planned /// if people do not remove their voting weights to the killed gauge function toggleGauge(address gaugeAddr) external onlyRole(GOVERNOR_ROLE) { bool gaugeKilledMem = killedGauges[gaugeAddr]; if (!gaugeKilledMem) { delete lastTimeGaugePaid[gaugeAddr]; rewardToken.safeApprove(gaugeAddr, 0); } killedGauges[gaugeAddr] = !gaugeKilledMem; emit GaugeToggled(gaugeAddr, !gaugeKilledMem); } // ========================= Guardian Function ================================= /// @notice Halts or activates distribution of rewards function toggleDistributions() external onlyRole(GUARDIAN_ROLE) { bool distributionsOnMem = distributionsOn; distributionsOn = !distributionsOnMem; emit DistributionsToggled(!distributionsOnMem); } /// @notice Notifies that the interface of a gauge delegate is known or has changed /// @param _delegateGauge Address of the gauge to change /// @dev Gauge delegates that are built for automation should be toggled function toggleInterfaceKnown(address _delegateGauge) external onlyRole(GUARDIAN_ROLE) { _toggleInterfaceKnown(_delegateGauge); } } // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.7; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "../interfaces/IGaugeController.sol"; import "../interfaces/ILiquidityGauge.sol"; import "../interfaces/IAngleMiddlemanGauge.sol"; import "../interfaces/IStakingRewards.sol"; import "../external/AccessControlUpgradeable.sol"; /// @title AngleDistributorEvents /// @author Angle Core Team /// @notice All the events used in `AngleDistributor` contract contract AngleDistributorEvents { event DelegateGaugeUpdated(address indexed _gaugeAddr, address indexed _delegateGauge); event DistributionsToggled(bool _distributionsOn); event GaugeControllerUpdated(address indexed _controller); event GaugeToggled(address indexed gaugeAddr, bool newStatus); event InterfaceKnownToggled(address indexed _delegateGauge, bool _isInterfaceKnown); event RateUpdated(uint256 _newRate); event Recovered(address indexed tokenAddress, address indexed to, uint256 amount); event RewardDistributed(address indexed gaugeAddr, uint256 rewardTally); event UpdateMiningParameters(uint256 time, uint256 rate, uint256 supply); }
@notice Notifies that the interface of a gauge delegate is known or has changed @param _delegateGauge Address of the gauge to change @dev Gauge delegates that are built for automation should be toggled
function toggleInterfaceKnown(address _delegateGauge) external onlyRole(GUARDIAN_ROLE) { _toggleInterfaceKnown(_delegateGauge); }
5,933,750
[ 1, 1248, 5032, 716, 326, 1560, 434, 279, 13335, 7152, 353, 4846, 578, 711, 3550, 225, 389, 22216, 18941, 5267, 434, 326, 13335, 358, 2549, 225, 19766, 22310, 716, 854, 6650, 364, 17539, 1410, 506, 6316, 75, 1259, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 10486, 1358, 11925, 12, 2867, 389, 22216, 18941, 13, 3903, 1338, 2996, 12, 30673, 985, 2565, 1258, 67, 16256, 13, 288, 203, 3639, 389, 14401, 1358, 11925, 24899, 22216, 18941, 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 ]
//SPDX-License-Identifier: No License pragma solidity ^0.8.1; /** * @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. */ constructor () { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner,"You're not authorized"); _; } /** * @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),"New owner cannot be 0 address"); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ abstract contract ERC20Basic { /// Total amount of tokens uint256 public totalSupply; function balanceOf(address _owner) public view virtual returns (uint256 balance); function transfer(address _to, uint256 _amount) public virtual returns (bool success); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ abstract contract ERC20 is ERC20Basic { function allowance(address _owner, address _spender) public virtual view returns (uint256 remaining); function transferFrom(address _from, address _to, uint256 _amount) public virtual returns (bool success); function approve(address _spender, uint256 _amount) public virtual returns (bool success); 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; //balance in each address account mapping(address => uint256) balances; /** * @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(msg.sender, recipient, amount); 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"); require(balances[sender] >= amount, "ERC20: transfer amount exceeds balance"); balances[sender] -= amount; balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view virtual override 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 */ contract StandardToken is ERC20, BasicToken { using SafeMath for *; 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 _amount uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _amount) public virtual override returns (bool success) { require(_to != address(0), "New address cannot be 0 address"); require(balances[_from] >= _amount,"Should have balance"); require(allowed[_from][msg.sender] >= _amount,"should have allowed the sender"); require(_amount > 0 && balances[_to].add(_amount) > balances[_to],"amount cannot be 0"); balances[_from] = balances[_from].sub(_amount); balances[_to] = balances[_to].add(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); emit Transfer(_from, _to, _amount); 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 _amount The amount of tokens to be spent. */ function approve(address _spender, uint256 _amount) public virtual override returns (bool success) { allowed[msg.sender][_spender] = _amount; emit Approval(msg.sender, _spender, _amount); 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. */ function allowance(address _owner, address _spender) public view virtual override returns (uint256 remaining) { return allowed[_owner][_spender]; } } /** @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. */ contract MintableToken is StandardToken, Ownable { uint256 public cap = 100000000000*10**18; function mint(address _account, uint256 _amount) public onlyOwner returns(bool) { _mint(_account, _amount); return true; } /** @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"); require(totalSupply + amount <= cap, "Maximum token supply exceeded"); totalSupply += amount; balances[account] += amount; emit Transfer(address(0), account, amount); } } contract BurnableToken is StandardToken, Ownable { function burn(uint256 _amount) public onlyOwner returns(bool) { _burn(owner, _amount); return true; } /** @dev Burn `amount` tokens from the `owner` accounr, decreasing * the total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `totalSupply` should be more than the balance in the owner account. * - 'balance' of owner should be more than the amount to be burned */ function _burn(address account, uint256 amount) internal virtual { require(totalSupply >= amount); require(balances[account] >= amount); totalSupply -= amount; balances[account] -= amount; emit Transfer(account, address(0), amount); } } /** * @title Value Gold Coin * @dev Token representing VGC. */ contract ValueGoldCoin is MintableToken, BurnableToken{ using SafeMath for uint256; string public name ; string public symbol ; uint8 public decimals = 18 ; /** * @dev Constructor function to initialize the initial supply of token to the creator of the contract * @param tokenName The name of the token * @param tokenSymbol The symbol of the token */ constructor ( string memory tokenName, string memory tokenSymbol ) { name = tokenName; symbol = tokenSymbol; } /** *@dev helper method to get token details, name, symbol and totalSupply in one go */ function getTokenDetail() public view virtual returns (string memory, string memory , uint256) { return (name, symbol, totalSupply); } }
* @dev Gets the balance of the specified address. @param _owner The address to query the the balance of. An uint256 representing the amount owned by the passed address./
function balanceOf(address _owner) public view virtual override returns (uint256 balance) { return balances[_owner]; }
605,486
[ 1, 3002, 326, 11013, 434, 326, 1269, 1758, 18, 225, 389, 8443, 1021, 1758, 358, 843, 326, 326, 11013, 434, 18, 1922, 2254, 5034, 5123, 326, 3844, 16199, 635, 326, 2275, 1758, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 11013, 951, 12, 2867, 389, 8443, 13, 1071, 1476, 5024, 3849, 1135, 261, 11890, 5034, 11013, 13, 288, 203, 565, 327, 324, 26488, 63, 67, 8443, 15533, 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 ]
pragma solidity ^0.5.0; // ---------------------------------------------------------------------------- // ERC Token Standard #20 Interface // // ---------------------------------------------------------------------------- contract ERC20Interface { function totalSupply() public view returns (uint); function balanceOf(address tokenOwner) public view returns (uint balance); function allowance(address tokenOwner, address spender) public view returns (uint remaining); function transfer(address to, uint tokens) public returns (bool success); function approve(address spender, uint tokens) public returns (bool success); function transferFrom(address from, address to, uint tokens) public returns (bool success); event Transfer(address indexed from, address indexed to, uint tokens); event Approval(address indexed tokenOwner, address indexed spender, uint tokens); } // ---------------------------------------------------------------------------- // Safe Math Library // ---------------------------------------------------------------------------- contract SafeMath { function safeAdd(uint a, uint b) public pure returns (uint c) { c = a + b; require(c >= a); } function safeSub(uint a, uint b) public pure returns (uint c) { require(b <= a); c = a - b; } function safeMul(uint a, uint b) public pure returns (uint c) { c = a * b; require(a == 0 || c / a == b); } function safeDiv(uint a, uint b) public pure returns (uint c) { require(b > 0); c = a / b; } } contract MaxiToken is ERC20Interface, SafeMath { string public name; string public symbol; uint8 public decimals; // 18 decimals is the strongly suggested default, avoid changing it uint256 public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; /** * Constrctor function * * Initializes contract with initial supply tokens to the creator of the contract */ constructor() public { name = "MaxiToken"; symbol = "MXT"; decimals = 18; _totalSupply = 100000000000000000000000000; balances[msg.sender] = _totalSupply; emit Transfer(address(0), msg.sender, _totalSupply); } function totalSupply() public view returns (uint) { return _totalSupply - balances[address(0)]; } function balanceOf(address tokenOwner) public view returns (uint balance) { return balances[tokenOwner]; } function allowance(address tokenOwner, address spender) public view returns (uint remaining) { return allowed[tokenOwner][spender]; } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function transfer(address to, uint tokens) public returns (bool success) { balances[msg.sender] = safeSub(balances[msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(msg.sender, to, tokens); return true; } function transferFrom(address from, address to, uint tokens) public returns (bool success) { balances[from] = safeSub(balances[from], tokens); allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], tokens); balances[to] = safeAdd(balances[to], tokens); emit Transfer(from, to, tokens); return true; } }
* Constrctor function Initializes contract with initial supply tokens to the creator of the contract/
constructor() public { name = "MaxiToken"; symbol = "MXT"; decimals = 18; _totalSupply = 100000000000000000000000000; balances[msg.sender] = _totalSupply; emit Transfer(address(0), msg.sender, _totalSupply); }
11,979,132
[ 1, 442, 701, 30206, 445, 10188, 3128, 6835, 598, 2172, 14467, 2430, 358, 326, 11784, 434, 326, 6835, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3885, 1435, 1071, 288, 203, 3639, 508, 273, 315, 2747, 77, 1345, 14432, 203, 3639, 3273, 273, 315, 49, 3983, 14432, 203, 3639, 15105, 273, 6549, 31, 203, 3639, 389, 4963, 3088, 1283, 273, 2130, 12648, 12648, 12648, 31, 203, 203, 3639, 324, 26488, 63, 3576, 18, 15330, 65, 273, 389, 4963, 3088, 1283, 31, 203, 3639, 3626, 12279, 12, 2867, 12, 20, 3631, 1234, 18, 15330, 16, 389, 4963, 3088, 1283, 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 ]
//SPDX-License-Identifier: Unlicense pragma solidity 0.7.0; import "./interfaces/IBank.sol"; import "./interfaces/IPriceOracle.sol"; import "./libraries/Math.sol"; import "./test/HAKToken.sol"; contract Bank is IBank { using DSMath for uint256; mapping(address => Account) public accountETH; mapping(address => Account) public accountHAK; mapping(address => Account) public accountDebt; IPriceOracle po; address private priceOracle; address private HAKaddress; address constant private ETHaddress = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; modifier ETHorHAK(address token) { require(token == HAKaddress || token == ETHaddress, "token not supported"); _; } modifier sufficientFunds(uint256 amount) { require(msg.value >= amount); _; } HAKTest private _HAK; constructor(address _priceOracle, address _HAKaddress) { po = IPriceOracle(_priceOracle); HAKaddress = _HAKaddress; _HAK = HAKTest(_HAKaddress); } // constructor() { // HAKaddress = 0xBefeeD4CB8c6DD190793b1c97B72B60272f3EA6C; // priceOracle = 0xc3F639B8a6831ff50aD8113B438E2Ef873845552; // } function getInterest(Account memory acc) internal view returns (uint256) { return block.number .sub(acc.lastInterestBlock) .mul(3) .wdiv(10000) .mul(acc.deposit) / 10 ** 18; } function updateInterest() internal { address account = msg.sender; uint256 res = getInterest(accountHAK[account]); accountHAK[account].interest = accountHAK[account].interest.add(res); accountHAK[account].lastInterestBlock = block.number; res = getInterest(accountETH[account]); accountETH[account].interest = accountHAK[account].interest.add(res); accountETH[account].lastInterestBlock = block.number; res = getInterest(accountDebt[account]); accountDebt[account].interest = accountDebt[account].interest.add(res); accountETH[account].lastInterestBlock = block.number; } function convertHAKToETH(uint256 amount) public returns (uint256) { return 100000; // return po.getVirtualPrice(HAKaddress); } /* function convertETHToHAK(uint256 amount) public returns (uint256) { return amount / po.getVirtualPrice(HAKaddress); } */ function value() payable public returns (uint256) { return msg.value; } function deposit(address token, uint256 amount) payable external override ETHorHAK(token) returns (bool) { updateInterest(); if (token == ETHaddress) { if(msg.value < amount) { revert("msg.value less than amount"); } msg.sender.transfer(msg.value - amount); uint256 res = DSMath.add(accountETH[msg.sender].deposit, amount); accountETH[msg.sender].deposit = res; } if (token == HAKaddress) { require(_HAK.allowance(msg.sender, address(this)) >= amount); _HAK.transferFrom(msg.sender, address(this), amount); uint256 res = DSMath.add(accountHAK[msg.sender].deposit, amount); accountHAK[msg.sender].deposit = res; } emit Deposit(msg.sender, token, amount); return true; } function withdraw(address token, uint256 amount) external override ETHorHAK(token) returns (uint256) { updateInterest(); uint256 toWithdraw; if ( (token == ETHaddress && accountETH[msg.sender].deposit + accountETH[msg.sender].interest == 0) || (token == HAKaddress && accountHAK[msg.sender].deposit + accountHAK[msg.sender].interest == 0) ) { revert("no balance"); } if ( (token == ETHaddress && accountETH[msg.sender].deposit + accountETH[msg.sender].interest < amount) || (token == HAKaddress && accountHAK[msg.sender].deposit + accountHAK[msg.sender].interest < amount) ) { revert("amount exceeds balance"); } if (token == ETHaddress) { if (amount == 0) { toWithdraw = accountETH[msg.sender].deposit + accountETH[msg.sender].interest; accountETH[msg.sender].deposit = 0; accountETH[msg.sender].interest = 0; } else { if (accountETH[msg.sender].interest < amount) { accountETH[msg.sender].interest = 0; accountETH[msg.sender].deposit -= amount - accountETH[msg.sender].interest; } else { accountETH[msg.sender].interest -= amount; } } msg.sender.transfer(toWithdraw); } if (token == HAKaddress) { if (amount == 0) { toWithdraw = accountHAK[msg.sender].deposit + accountHAK[msg.sender].interest; accountHAK[msg.sender].deposit = 0; accountHAK[msg.sender].interest = 0; } else { if (accountHAK[msg.sender].interest < amount) { accountHAK[msg.sender].interest = 0; accountHAK[msg.sender].deposit -= amount - accountHAK[msg.sender].interest; } else { accountHAK[msg.sender].interest -= amount; } } _HAK.transfer(msg.sender, toWithdraw); } emit Withdraw(msg.sender, token, toWithdraw); return amount; } function borrow(address token, uint256 amount) external override returns (uint256) { // ( // // accountETH[msg.sender].deposit.add(convertHAKToETH( // accountHAK[msg.sender].deposit.add(amount) // // )) // / accountDebt[msg.sender].deposit).mul(10) > 15 if (accountHAK[msg.sender].deposit <= 0) { revert("no collateral deposited"); } if(_getCollateralRatio(token, msg.sender) < 15000) { revert("borrow would exceed collateral ratio"); } updateInterest(); accountDebt[msg.sender].deposit = accountDebt[msg.sender].deposit.add(amount); msg.sender.transfer(amount); emit Borrow(msg.sender, token, amount, _getCollateralRatio(token, msg.sender)); return _getCollateralRatio(token, msg.sender); } function repay(address token, uint256 amount) payable external override returns (uint256) { if(token != ETHaddress) { revert("token not supported"); } if(msg.value < amount) { revert("msg.value < amount to repay"); } if (accountDebt[msg.sender].deposit + accountDebt[msg.sender].interest == 0) { revert("nothing to repay"); } updateInterest(); uint256 toReduce = amount; if (toReduce>accountDebt[msg.sender].interest) { accountDebt[msg.sender].interest = 0; toReduce = toReduce - accountDebt[msg.sender].interest; } else{ accountDebt[msg.sender].interest = accountDebt[msg.sender].interest - toReduce; emit Repay(msg.sender, token, accountDebt[msg.sender].deposit); return accountDebt[msg.sender].deposit; } accountDebt[msg.sender].deposit = accountDebt[msg.sender].deposit - toReduce; emit Repay(msg.sender, token, accountDebt[msg.sender].deposit); return accountDebt[msg.sender].deposit; } function liquidate(address token, address account) payable external override returns (bool) { // Only support HAK as collateral token require(token == HAKaddress, "token not supported"); // Prevent a user from liquidating own account require(account != msg.sender, "cannot liquidate own position"); // Collateral ratio must be lower than 150% require((_getCollateralRatio(token, account) < 15000 && _getCollateralRatio(token, account) > 0), "healty position"); // Liquidator must have sufficient ETH require(msg.value >= accountDebt[account].deposit, "insufficient ETH sent by liquidator"); // if everything is fine uint256 sendBackAmount = 0; if (msg.value > accountDebt[account].deposit) { sendBackAmount = DSMath.sub(msg.value, accountDebt[account].deposit); } uint256 collateralAmount = accountHAK[account].deposit; msg.sender.transfer(collateralAmount); accountDebt[account].deposit = 0; accountHAK[account].deposit = 0; emit Liquidate(msg.sender, account, token, collateralAmount, sendBackAmount); return true; } function _getCollateralRatio(address token, address account) view internal returns (uint256) { if (accountDebt[account].deposit == 0) { return type(uint256).max; } // accountHAK[account].deposit // .wdiv(accountDebt[account].deposit) // .mul(10000); return accountHAK[account].deposit.add(accountHAK[account].interest) .mul(10000).wdiv(accountDebt[account].deposit.add(accountDebt[account].interest)) / 10 ** 18; } function getCollateralRatio(address token, address account) view external override returns (uint256) { return _getCollateralRatio(token, account); } function _getBalance(address token) view internal ETHorHAK(token) returns (uint256) { uint256 balance; if (token == ETHaddress) { balance = accountETH[msg.sender].deposit.add(getInterest(accountETH[msg.sender])); } if (token == HAKaddress) { balance = accountHAK[msg.sender].deposit.add(getInterest(accountHAK[msg.sender])); } // If a user withdraws their deposit earlier or later than 100 blocks, they will receive a proportional interest amount. // uint256 blockCount = block.number - account.lastInterestBlock; // if (token == HAKaddress) { // deposit = convertToHAK(deposit); // } //uint256 interestRate = 0.03; // account.interest = depositM * (blockCount % 100) * 3 / 100; // depositM += account.interest; return balance; } function getBalance(address token) view external override ETHorHAK(token) returns (uint256) { return _getBalance(token); } }
return po.getVirtualPrice(HAKaddress);
function convertHAKToETH(uint256 amount) public returns (uint256) { return 100000; }
12,979,764
[ 1, 2463, 8275, 18, 588, 6466, 5147, 12, 44, 14607, 2867, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1765, 44, 14607, 774, 1584, 44, 12, 11890, 5034, 3844, 13, 1071, 1135, 261, 11890, 5034, 13, 288, 203, 3639, 327, 25259, 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 ]
./partial_match/1/0xb78C0D130Dc07BA909eD5F6828Abd5EA183B12BC/sources/contracts/compounder/GenericVault.sol
@notice The address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
function asset() public view returns (address) { return underlying; }
4,423,732
[ 1, 1986, 1758, 434, 326, 6808, 1147, 1399, 364, 326, 17329, 364, 2236, 310, 16, 443, 1724, 310, 16, 471, 598, 9446, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3310, 1435, 1071, 1476, 1135, 261, 2867, 13, 288, 203, 3639, 327, 6808, 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 ]
./full_match/1/0xc1BB6B6ae3b161AB145758D34D1FbfE91a3823ae/sources/contracts/Sale.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 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; } constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function decimals() public view virtual override returns (uint8) { return 18; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } 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; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } 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; } 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); } 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); } 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); } 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); } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
3,114,379
[ 1, 13621, 434, 326, 288, 45, 654, 39, 3462, 97, 1560, 18, 1220, 4471, 353, 279, 1600, 669, 335, 358, 326, 4031, 2430, 854, 2522, 18, 1220, 4696, 716, 279, 14467, 12860, 711, 358, 506, 3096, 316, 279, 10379, 6835, 1450, 288, 67, 81, 474, 5496, 2457, 279, 5210, 12860, 2621, 288, 654, 39, 3462, 18385, 49, 2761, 16507, 1355, 5496, 399, 2579, 30, 2457, 279, 6864, 1045, 416, 2621, 3134, 7343, 358, 2348, 14467, 1791, 28757, 8009, 1660, 1240, 10860, 7470, 3502, 62, 881, 84, 292, 267, 9875, 14567, 30, 4186, 15226, 3560, 434, 5785, 1375, 5743, 68, 603, 5166, 18, 1220, 6885, 353, 1661, 546, 12617, 15797, 287, 471, 1552, 486, 7546, 598, 326, 26305, 434, 4232, 39, 3462, 12165, 18, 26775, 16, 392, 288, 23461, 97, 871, 353, 17826, 603, 4097, 358, 288, 13866, 1265, 5496, 1220, 5360, 12165, 358, 23243, 326, 1699, 1359, 364, 777, 2 ]
[ 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, 565, 6835, 4232, 39, 3462, 353, 1772, 16, 467, 654, 39, 3462, 16, 467, 654, 39, 3462, 2277, 288, 203, 3639, 2874, 261, 2867, 516, 2254, 5034, 13, 3238, 389, 70, 26488, 31, 203, 203, 3639, 2874, 261, 2867, 516, 2874, 261, 2867, 516, 2254, 5034, 3719, 3238, 389, 5965, 6872, 31, 203, 203, 3639, 2254, 5034, 3238, 389, 4963, 3088, 1283, 31, 203, 203, 3639, 533, 3238, 389, 529, 31, 203, 3639, 533, 3238, 389, 7175, 31, 203, 203, 565, 289, 203, 3639, 3885, 261, 1080, 3778, 508, 67, 16, 533, 3778, 3273, 67, 13, 288, 203, 5411, 389, 529, 273, 508, 67, 31, 203, 5411, 389, 7175, 273, 3273, 67, 31, 203, 3639, 289, 203, 203, 3639, 445, 508, 1435, 1071, 1476, 5024, 3849, 1135, 261, 1080, 3778, 13, 288, 203, 5411, 327, 389, 529, 31, 203, 3639, 289, 203, 203, 3639, 445, 3273, 1435, 1071, 1476, 5024, 3849, 1135, 261, 1080, 3778, 13, 288, 203, 5411, 327, 389, 7175, 31, 203, 3639, 289, 203, 203, 3639, 445, 15105, 1435, 1071, 1476, 5024, 3849, 1135, 261, 11890, 28, 13, 288, 203, 5411, 327, 6549, 31, 203, 3639, 289, 203, 203, 3639, 445, 2078, 3088, 1283, 1435, 1071, 1476, 5024, 3849, 1135, 261, 11890, 5034, 13, 288, 203, 5411, 327, 389, 4963, 3088, 1283, 31, 203, 3639, 289, 203, 203, 3639, 445, 11013, 951, 12, 2867, 2236, 13, 1071, 1476, 5024, 3849, 1135, 261, 11890, 5034, 13, 288, 203, 5411, 327, 389, 70, 26488, 63, 4631, 15533, 203, 3639, 289, 203, 203, 3639, 2 ]
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @author token * This treasury contract has been developed by token.info */ import '@openzeppelin/contracts/access/Ownable.sol'; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/utils/math/SafeMath.sol'; import "../libs/IUniFactory.sol"; import "../libs/IUniRouter02.sol"; import "../libs/IWETH.sol"; interface IStaking { function performanceFee() external view returns(uint256); function setServiceInfo(address _addr, uint256 _fee) external; } interface IFarm { function setBuyBackWallet(address _addr) external; } contract ShamanTreasury is Ownable, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; // Whether it is initialized bool private isInitialized; uint256 private TIME_UNIT = 1 days; IERC20 public token; address public dividendToken; address public pair; uint256 public period = 30; // 30 days uint256 public withdrawalLimit = 500; // 5% of total supply uint256 public liquidityWithdrawalLimit = 2000; // 20% of LP supply uint256 public buybackRate = 9500; // 95% uint256 public addLiquidityRate = 9400; // 94% uint256 private startTime; uint256 private sumWithdrawals = 0; uint256 private sumLiquidityWithdrawals = 0; uint256 public performanceFee = 100; // 1% uint256 public performanceLpFee = 200; // 2% address public feeWallet = 0xE1f1dd010BBC2860F81c8F90Ea4E38dB949BB16F; // swap router and path, slipPage address public uniRouterAddress; address[] public wNativeToTokenPath; uint256 public slippageFactor = 800; // 20% uint256 public constant slippageFactorUL = 995; event TokenBuyBack(uint256 amountETH, uint256 amountToken); event LiquidityAdded(uint256 amountETH, uint256 amountToken, uint256 liquidity); event SetSwapConfig(address router, uint256 slipPage, address[] path); event TransferBuyBackWallet(address staking, address wallet); event LiquidityWithdrawn(uint256 amount); event Withdrawn(uint256 amount); event AddLiquidityRateUpdated(uint256 percent); event BuybackRateUpdated(uint256 percent); event PeriodUpdated(uint256 duration); event LiquidityWithdrawLimitUpdated(uint256 percent); event WithdrawLimitUpdated(uint256 percent); event ServiceInfoUpdated(address wallet, uint256 performanceFee, uint256 liquidityFee); constructor() {} /** * @notice Initialize the contract * @param _token: token address * @param _dividendToken: reflection token address * @param _uniRouter: uniswap router address for swap tokens * @param _wNativeToTokenPath: swap path to buy token */ function initialize( IERC20 _token, address _dividendToken, address _uniRouter, address[] memory _wNativeToTokenPath ) external onlyOwner { require(!isInitialized, "Already initialized"); // Make this contract initialized isInitialized = true; token = _token; dividendToken = _dividendToken; pair = IUniV2Factory(IUniRouter02(_uniRouter).factory()).getPair(_wNativeToTokenPath[0], address(token)); uniRouterAddress = _uniRouter; wNativeToTokenPath = _wNativeToTokenPath; } /** * @notice Buy token from BNB */ function buyBack() external onlyOwner nonReentrant{ uint256 ethAmt = address(this).balance; uint256 _fee = ethAmt.mul(performanceFee).div(10000); if(_fee > 0) { payable(feeWallet).transfer(_fee); ethAmt = ethAmt.sub(_fee); } ethAmt = ethAmt.mul(buybackRate).div(10000); if(ethAmt > 0) { uint256[] memory amounts = _safeSwapEth(ethAmt, wNativeToTokenPath, address(this)); emit TokenBuyBack(amounts[0], amounts[amounts.length - 1]); } } /** * @notice Add liquidity */ function addLiquidity() external onlyOwner nonReentrant{ uint256 ethAmt = address(this).balance; uint256 _fee = ethAmt.mul(performanceLpFee).div(10000); if(_fee > 0) { payable(feeWallet).transfer(_fee); ethAmt = ethAmt.sub(_fee); } ethAmt = ethAmt.mul(addLiquidityRate).div(10000).div(2); if(ethAmt > 0) { uint256[] memory amounts = _safeSwapEth(ethAmt, wNativeToTokenPath, address(this)); uint256 _tokenAmt = amounts[amounts.length - 1]; emit TokenBuyBack(amounts[0], _tokenAmt); (uint256 amountToken, uint256 amountETH, uint256 liquidity) = _addLiquidityEth(address(token), ethAmt, _tokenAmt, address(this)); emit LiquidityAdded(amountETH, amountToken, liquidity); } } /** * @notice Withdraw brews as much as maximum 5% of total supply * @param _amount: amount to withdraw */ function withdraw(uint256 _amount) external onlyOwner { uint256 tokenAmt = token.balanceOf(address(this)); require(_amount > 0 && _amount <= tokenAmt, "Invalid Amount"); if(block.timestamp.sub(startTime) > period.mul(TIME_UNIT)) { startTime = block.timestamp; sumWithdrawals = 0; } uint256 limit = withdrawalLimit.mul(token.totalSupply()).div(10000); require(sumWithdrawals.add(_amount) <= limit, "exceed maximum withdrawal limit for 30 days"); token.safeTransfer(msg.sender, _amount); emit Withdrawn(_amount); } /** * @notice Withdraw brews as much as maximum 20% of lp supply * @param _amount: liquidity amount to withdraw */ function withdrawLiquidity(uint256 _amount) external onlyOwner { uint256 tokenAmt = IERC20(pair).balanceOf(address(this)); require(_amount > 0 && _amount <= tokenAmt, "Invalid Amount"); if(block.timestamp.sub(startTime) > period.mul(TIME_UNIT)) { startTime = block.timestamp; sumLiquidityWithdrawals = 0; } uint256 limit = liquidityWithdrawalLimit.mul(IERC20(pair).totalSupply()).div(10000); require(sumLiquidityWithdrawals.add(_amount) <= limit, "exceed maximum LP withdrawal limit for 30 days"); IERC20(pair).safeTransfer(msg.sender, _amount); emit LiquidityWithdrawn(_amount); } /** * @notice Withdraw tokens * @dev Needs to be for emergency. */ function emergencyWithdraw() external onlyOwner { uint256 tokenAmt = token.balanceOf(address(this)); if(tokenAmt > 0) { token.transfer(msg.sender, tokenAmt); } tokenAmt = IERC20(pair).balanceOf(address(this)); if(tokenAmt > 0) { IERC20(pair).transfer(msg.sender, tokenAmt); } uint256 ethAmt = address(this).balance; if(ethAmt > 0) { payable(msg.sender).transfer(ethAmt); } } /** * @notice Harvest reflection for token */ function harvest() external onlyOwner { if(dividendToken == address(0x0)) { uint256 ethAmt = address(dividendToken).balance; if(ethAmt > 0) { payable(msg.sender).transfer(ethAmt); } } else { uint256 tokenAmt = IERC20(dividendToken).balanceOf(address(this)); if(tokenAmt > 0) { IERC20(dividendToken).transfer(msg.sender, tokenAmt); } } } /** * @notice Set duration for withdraw limit * @param _period: duration */ function setWithdrawalLimitPeriod(uint256 _period) external onlyOwner { require(_period >= 10, "small period"); period = _period; emit PeriodUpdated(_period); } /** * @notice Set liquidity withdraw limit * @param _percent: percentage of LP supply in point */ function setLiquidityWithdrawalLimit(uint256 _percent) external onlyOwner { require(_percent < 10000, "Invalid percentage"); liquidityWithdrawalLimit = _percent; emit LiquidityWithdrawLimitUpdated(_percent); } /** * @notice Set withdraw limit * @param _percent: percentage of total supply in point */ function setWithdrawalLimit(uint256 _percent) external onlyOwner { require(_percent < 10000, "Invalid percentage"); withdrawalLimit = _percent; emit WithdrawLimitUpdated(_percent); } /** * @notice Set buyback amount * @param _percent: percentage in point */ function setBuybackRate(uint256 _percent) external onlyOwner { require(_percent < 10000, "Invalid percentage"); buybackRate = _percent; emit BuybackRateUpdated(_percent); } /** * @notice Set addliquidy amount * @param _percent: percentage in point */ function setAddLiquidityRate(uint256 _percent) external onlyOwner { require(_percent < 10000, "Invalid percentage"); addLiquidityRate = _percent; emit AddLiquidityRateUpdated(_percent); } function setServiceInfo(address _wallet, uint256 _fee) external { require(msg.sender == feeWallet, "Invalid setter"); require(_wallet != feeWallet && _wallet != address(0x0), "Invalid new wallet"); require(_fee < 500, "invalid performance fee"); feeWallet = _wallet; performanceFee = _fee; performanceLpFee = _fee.mul(2); emit ServiceInfoUpdated(_wallet, performanceFee, performanceLpFee); } /** * @notice Set buyback wallet of farm contract * @param _uniRouter: dex router address * @param _slipPage: slip page for swap * @param _path: bnb-brews path */ function setSwapSettings(address _uniRouter, uint256 _slipPage, address[] memory _path) external onlyOwner { require(_slipPage < 1000, "Invalid percentage"); uniRouterAddress = _uniRouter; slippageFactor = _slipPage; wNativeToTokenPath = _path; emit SetSwapConfig(_uniRouter, _slipPage, _path); } /** * @notice set buyback wallet of farm contract * @param _farm: farm contract address * @param _addr: buyback wallet address */ function setFarmServiceInfo(address _farm, address _addr) external onlyOwner { require(_farm != address(0x0) && _addr != address(0x0), "Invalid Address"); IFarm(_farm).setBuyBackWallet(_addr); emit TransferBuyBackWallet(_farm, _addr); } /** * @notice set buyback wallet of staking contract * @param _staking: staking contract address * @param _addr: buyback wallet address */ function setStakingServiceInfo(address _staking, address _addr) external onlyOwner { require(_staking != address(0x0) && _addr != address(0x0), "Invalid Address"); uint256 _fee = IStaking(_staking).performanceFee(); IStaking(_staking).setServiceInfo(_addr, _fee); emit TransferBuyBackWallet(_staking, _addr); } /** * @notice It allows the admin to recover wrong tokens sent to the contract * @param _token: the address of the token to withdraw * @dev This function is only callable by admin. */ function recoverWrongTokens(address _token) external onlyOwner { require(_token != address(token) && _token != dividendToken && _token != pair, "Cannot be token & dividend token, pair"); if(_token == address(0x0)) { uint256 _tokenAmount = address(this).balance; payable(msg.sender).transfer(_tokenAmount); } else { uint256 _tokenAmount = IERC20(_token).balanceOf(address(this)); IERC20(_token).safeTransfer(msg.sender, _tokenAmount); } } /************************ ** Internal Methods *************************/ /* * @notice get token from ETH via swap. */ function _safeSwapEth( uint256 _amountIn, address[] memory _path, address _to ) internal returns (uint256[] memory amounts) { amounts = IUniRouter02(uniRouterAddress).getAmountsOut(_amountIn, _path); uint256 amountOut = amounts[amounts.length.sub(1)]; IUniRouter02(uniRouterAddress).swapExactETHForTokensSupportingFeeOnTransferTokens{value: _amountIn}( amountOut.mul(slippageFactor).div(1000), _path, _to, block.timestamp.add(600) ); } /* * @notice Add liquidity for token-BNB pair. */ function _addLiquidityEth( address _token, uint256 _ethAmt, uint256 _tokenAmt, address _to ) internal returns(uint256 amountToken, uint256 amountETH, uint256 liquidity) { IERC20(_token).safeIncreaseAllowance(uniRouterAddress, _tokenAmt); (amountToken, amountETH, liquidity) = IUniRouter02(uniRouterAddress).addLiquidityETH{value: _ethAmt}( address(_token), _tokenAmt, 0, 0, _to, block.timestamp.add(600) ); IERC20(_token).safeApprove(uniRouterAddress, uint256(0)); } receive() external payable {} } // 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 v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) 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' 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 require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // 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 generally not needed starting with Solidity 0.8, since 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. 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; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IUniV2Factory { function getPair(address tokenA, address tokenB) external view returns (address); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IUniRouter01.sol"; interface IUniRouter02 is IUniRouter01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; } // SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface IWETH { function deposit() external payable; function transfer(address to, uint value) external returns (bool); function withdraw(uint) external; } // 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 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) 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; 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 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 pragma solidity ^0.8.0; interface IUniRouter01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); }
* @notice Initialize the contract @param _token: token address @param _dividendToken: reflection token address @param _uniRouter: uniswap router address for swap tokens @param _wNativeToTokenPath: swap path to buy token/ Make this contract initialized
) external onlyOwner { require(!isInitialized, "Already initialized"); isInitialized = true; token = _token; dividendToken = _dividendToken; pair = IUniV2Factory(IUniRouter02(_uniRouter).factory()).getPair(_wNativeToTokenPath[0], address(token)); uniRouterAddress = _uniRouter; wNativeToTokenPath = _wNativeToTokenPath; }
14,846,719
[ 1, 7520, 326, 6835, 225, 389, 2316, 30, 1147, 1758, 225, 389, 2892, 26746, 1345, 30, 5463, 1147, 1758, 225, 389, 318, 77, 8259, 30, 640, 291, 91, 438, 4633, 1758, 364, 7720, 2430, 225, 389, 91, 9220, 774, 1345, 743, 30, 7720, 589, 358, 30143, 1147, 19, 4344, 333, 6835, 6454, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 5541, 288, 203, 3639, 2583, 12, 5, 291, 11459, 16, 315, 9430, 6454, 8863, 203, 203, 3639, 25359, 273, 638, 31, 203, 203, 3639, 1147, 273, 389, 2316, 31, 203, 3639, 31945, 1345, 273, 389, 2892, 26746, 1345, 31, 203, 3639, 3082, 273, 467, 984, 77, 58, 22, 1733, 12, 45, 984, 77, 8259, 3103, 24899, 318, 77, 8259, 2934, 6848, 1435, 2934, 588, 4154, 24899, 91, 9220, 774, 1345, 743, 63, 20, 6487, 1758, 12, 2316, 10019, 203, 203, 3639, 7738, 8259, 1887, 273, 389, 318, 77, 8259, 31, 203, 3639, 341, 9220, 774, 1345, 743, 273, 389, 91, 9220, 774, 1345, 743, 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 ]
pragma solidity ^0.5.10; // File: openzeppelin-solidity/contracts/math/SafeMath.sol /** * @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) { require(b <= a, "SafeMath: subtraction overflow"); 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-solidity/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) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: 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 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) { require(b != 0, "SafeMath: modulo by zero"); return a % b; } } // File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol /** * @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. * * > 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-solidity/contracts/utils/Address.sol /** * @dev Collection of functions related to the address type, */ library Address { /** * @dev Returns true if `account` is a contract. * * This test is non-exhaustive, and there may be false-negatives: during the * execution of a contract's constructor, its address will be reported as * not containing a contract. * * > It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. */ 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; } } // File: openzeppelin-solidity/contracts/token/ERC20/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)); } 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. // 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-solidity/contracts/utils/ReentrancyGuard.sol /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the `nonReentrant` modifier * available, which can be aplied 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. */ contract ReentrancyGuard { /// @dev counter to allow mutex lock with only one SSTORE operation uint256 private _guardCounter; constructor () internal { // The counter starts at one to prevent changing it from zero to a non-zero // value, which is a more expensive operation. _guardCounter = 1; } /** * @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() { _guardCounter += 1; uint256 localCounter = _guardCounter; _; require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call"); } } // File: openzeppelin-solidity/contracts/introspection/ERC165Checker.sol /** * @dev Library used to query support of an interface declared via `IERC165`. * * Note that these functions return the actual result of the query: they do not * `revert` if an interface is not supported. It is up to the caller to decide * what to do in these cases. */ library ERC165Checker { // As per the EIP-165 spec, no interface should ever match 0xffffffff bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff; /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Returns true if `account` supports the `IERC165` interface, */ function _supportsERC165(address account) internal view returns (bool) { // Any contract that implements ERC165 must explicitly indicate support of // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid return _supportsERC165Interface(account, _INTERFACE_ID_ERC165) && !_supportsERC165Interface(account, _INTERFACE_ID_INVALID); } /** * @dev Returns true if `account` supports the interface defined by * `interfaceId`. Support for `IERC165` itself is queried automatically. * * See `IERC165.supportsInterface`. */ function _supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) { // query support of both ERC165 as per the spec and support of _interfaceId return _supportsERC165(account) && _supportsERC165Interface(account, interfaceId); } /** * @dev Returns true if `account` supports all the interfaces defined in * `interfaceIds`. Support for `IERC165` itself is queried automatically. * * Batch-querying can lead to gas savings by skipping repeated checks for * `IERC165` support. * * See `IERC165.supportsInterface`. */ function _supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) { // query support of ERC165 itself if (!_supportsERC165(account)) { return false; } // query support of each interface in _interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { if (!_supportsERC165Interface(account, interfaceIds[i])) { return false; } } // all interfaces supported return true; } /** * @notice Query if a contract implements an interface, does not check ERC165 support * @param account The address of the contract to query for support of an interface * @param interfaceId The interface identifier, as specified in ERC-165 * @return true if the contract at account indicates support of the interface with * identifier interfaceId, false otherwise * @dev Assumes that account contains a contract that supports ERC165, otherwise * the behavior of this method is undefined. This precondition can be checked * with the `supportsERC165` method in this library. * Interface identification is specified in ERC-165. */ function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) { // success determines whether the staticcall succeeded and result determines // whether the contract at account indicates support of _interfaceId (bool success, bool result) = _callERC165SupportsInterface(account, interfaceId); return (success && result); } /** * @notice Calls the function with selector 0x01ffc9a7 (ERC165) and suppresses throw * @param account The address of the contract to query for support of an interface * @param interfaceId The interface identifier, as specified in ERC-165 * @return success true if the STATICCALL succeeded, false otherwise * @return result true if the STATICCALL succeeded and the contract at account * indicates support of the interface with identifier interfaceId, false otherwise */ function _callERC165SupportsInterface(address account, bytes4 interfaceId) private view returns (bool success, bool result) { bytes memory encodedParams = abi.encodeWithSelector(_INTERFACE_ID_ERC165, interfaceId); // solhint-disable-next-line no-inline-assembly assembly { let encodedParams_data := add(0x20, encodedParams) let encodedParams_size := mload(encodedParams) let output := mload(0x40) // Find empty storage location using "free memory pointer" mstore(output, 0x0) success := staticcall( 30000, // 30k gas account, // To addr encodedParams_data, encodedParams_size, output, 0x20 // Outputs are 32 bytes long ) result := mload(output) // Load the result } } } // File: openzeppelin-solidity/contracts/introspection/IERC165.sol /** * @dev Interface of the ERC165 standard, as defined in the * [EIP](https://eips.ethereum.org/EIPS/eip-165). * * 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 * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * 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: openzeppelin-solidity/contracts/introspection/ERC165.sol /** * @dev Implementation of the `IERC165` interface. * * Contracts may inherit from this and call `_registerInterface` to declare * their support of an interface. */ 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) external view 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 { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // File: erc-payable-token/contracts/token/ERC1363/IERC1363.sol /** * @title IERC1363 Interface * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Interface for a Payable Token contract as defined in * https://github.com/ethereum/EIPs/issues/1363 */ contract IERC1363 is IERC20, ERC165 { /* * Note: the ERC-165 identifier for this interface is 0x4bbee2df. * 0x4bbee2df === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) */ /* * Note: the ERC-165 identifier for this interface is 0xfb9ec8ce. * 0xfb9ec8ce === * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ /** * @notice Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @return true unless throwing */ function transferAndCall(address to, uint256 value) public returns (bool); /** * @notice Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @param data bytes Additional data with no specified format, sent in call to `to` * @return true unless throwing */ function transferAndCall(address to, uint256 value, bytes memory data) public returns (bool); /** * @notice Transfer tokens from one address to another and then call `onTransferReceived` on receiver * @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 true unless throwing */ function transferFromAndCall(address from, address to, uint256 value) public returns (bool); /** * @notice Transfer tokens from one address to another and then call `onTransferReceived` on receiver * @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 * @param data bytes Additional data with no specified format, sent in call to `to` * @return true unless throwing */ function transferFromAndCall(address from, address to, uint256 value, bytes memory data) public returns (bool); /** * @notice Approve the passed address to spend the specified amount of tokens on behalf of msg.sender * and then call `onApprovalReceived` on spender. * 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 address The address which will spend the funds * @param value uint256 The amount of tokens to be spent */ function approveAndCall(address spender, uint256 value) public returns (bool); /** * @notice Approve the passed address to spend the specified amount of tokens on behalf of msg.sender * and then call `onApprovalReceived` on spender. * 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 address The address which will spend the funds * @param value uint256 The amount of tokens to be spent * @param data bytes Additional data with no specified format, sent in call to `spender` */ function approveAndCall(address spender, uint256 value, bytes memory data) public returns (bool); } // File: erc-payable-token/contracts/token/ERC1363/IERC1363Receiver.sol /** * @title IERC1363Receiver Interface * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Interface for any contract that wants to support transferAndCall or transferFromAndCall * from ERC1363 token contracts as defined in * https://github.com/ethereum/EIPs/issues/1363 */ contract IERC1363Receiver { /* * Note: the ERC-165 identifier for this interface is 0x88a7ca5c. * 0x88a7ca5c === bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)")) */ /** * @notice Handle the receipt of ERC1363 tokens * @dev Any ERC1363 smart contract calls this function on the recipient * after a `transfer` or a `transferFrom`. 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 token contract address is always the message sender. * @param operator address The address which called `transferAndCall` or `transferFromAndCall` function * @param from address The address which are token transferred from * @param value uint256 The amount of tokens transferred * @param data bytes Additional data with no specified format * @return `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))` * unless throwing */ function onTransferReceived(address operator, address from, uint256 value, bytes memory data) public returns (bytes4); // solhint-disable-line max-line-length } // File: erc-payable-token/contracts/token/ERC1363/IERC1363Spender.sol /** * @title IERC1363Spender Interface * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Interface for any contract that wants to support approveAndCall * from ERC1363 token contracts as defined in * https://github.com/ethereum/EIPs/issues/1363 */ contract IERC1363Spender { /* * Note: the ERC-165 identifier for this interface is 0x7b04a2d0. * 0x7b04a2d0 === bytes4(keccak256("onApprovalReceived(address,uint256,bytes)")) */ /** * @notice Handle the approval of ERC1363 tokens * @dev Any ERC1363 smart contract calls this function on the recipient * after an `approve`. This function MAY throw to revert and reject the * approval. Return of other than the magic value MUST result in the * transaction being reverted. * Note: the token contract address is always the message sender. * @param owner address The address which called `approveAndCall` function * @param value uint256 The amount of tokens to be spent * @param data bytes Additional data with no specified format * @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))` * unless throwing */ function onApprovalReceived(address owner, uint256 value, bytes memory data) public returns (bytes4); } // File: erc-payable-token/contracts/payment/ERC1363Payable.sol /** * @title ERC1363Payable * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Implementation proposal of a contract that wants to accept ERC1363 payments */ contract ERC1363Payable is IERC1363Receiver, IERC1363Spender, ERC165 { using ERC165Checker for address; /** * @dev Magic value to be returned upon successful reception of ERC1363 tokens * Equals to `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))`, * which can be also obtained as `IERC1363Receiver(0).onTransferReceived.selector` */ bytes4 internal constant _INTERFACE_ID_ERC1363_RECEIVER = 0x88a7ca5c; /** * @dev Magic value to be returned upon successful approval of ERC1363 tokens. * Equals to `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))`, * which can be also obtained as `IERC1363Spender(0).onApprovalReceived.selector` */ bytes4 internal constant _INTERFACE_ID_ERC1363_SPENDER = 0x7b04a2d0; /* * Note: the ERC-165 identifier for the ERC1363 token transfer * 0x4bbee2df === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) */ bytes4 private constant _INTERFACE_ID_ERC1363_TRANSFER = 0x4bbee2df; /* * Note: the ERC-165 identifier for the ERC1363 token approval * 0xfb9ec8ce === * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ bytes4 private constant _INTERFACE_ID_ERC1363_APPROVE = 0xfb9ec8ce; event TokensReceived( address indexed operator, address indexed from, uint256 value, bytes data ); event TokensApproved( address indexed owner, uint256 value, bytes data ); // The ERC1363 token accepted IERC1363 private _acceptedToken; /** * @param acceptedToken Address of the token being accepted */ constructor(IERC1363 acceptedToken) public { require(address(acceptedToken) != address(0)); require( acceptedToken.supportsInterface(_INTERFACE_ID_ERC1363_TRANSFER) && acceptedToken.supportsInterface(_INTERFACE_ID_ERC1363_APPROVE) ); _acceptedToken = acceptedToken; // register the supported interface to conform to IERC1363Receiver and IERC1363Spender via ERC165 _registerInterface(_INTERFACE_ID_ERC1363_RECEIVER); _registerInterface(_INTERFACE_ID_ERC1363_SPENDER); } /* * @dev Note: remember that the token contract address is always the message sender. * @param operator address The address which called `transferAndCall` or `transferFromAndCall` function * @param from address The address which are token transferred from * @param value uint256 The amount of tokens transferred * @param data bytes Additional data with no specified format */ function onTransferReceived(address operator, address from, uint256 value, bytes memory data) public returns (bytes4) { // solhint-disable-line max-line-length require(msg.sender == address(_acceptedToken)); emit TokensReceived(operator, from, value, data); _transferReceived(operator, from, value, data); return _INTERFACE_ID_ERC1363_RECEIVER; } /* * @dev Note: remember that the token contract address is always the message sender. * @param owner address The address which called `approveAndCall` function * @param value uint256 The amount of tokens to be spent * @param data bytes Additional data with no specified format */ function onApprovalReceived(address owner, uint256 value, bytes memory data) public returns (bytes4) { require(msg.sender == address(_acceptedToken)); emit TokensApproved(owner, value, data); _approvalReceived(owner, value, data); return _INTERFACE_ID_ERC1363_SPENDER; } /** * @dev The ERC1363 token accepted */ function acceptedToken() public view returns (IERC1363) { return _acceptedToken; } /** * @dev Called after validating a `onTransferReceived`. Override this method to * make your stuffs within your contract. * @param operator address The address which called `transferAndCall` or `transferFromAndCall` function * @param from address The address which are token transferred from * @param value uint256 The amount of tokens transferred * @param data bytes Additional data with no specified format */ function _transferReceived(address operator, address from, uint256 value, bytes memory data) internal { // solhint-disable-previous-line no-empty-blocks // optional override } /** * @dev Called after validating a `onApprovalReceived`. Override this method to * make your stuffs within your contract. * @param owner address The address which called `approveAndCall` function * @param value uint256 The amount of tokens to be spent * @param data bytes Additional data with no specified format */ function _approvalReceived(address owner, uint256 value, bytes memory data) internal { // solhint-disable-previous-line no-empty-blocks // optional override } } // File: openzeppelin-solidity/contracts/ownership/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. * * 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 { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { _owner = msg.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 msg.sender == _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; } } // 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(!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: dao-smartcontracts/contracts/access/roles/DAORoles.sol /** * @title DAORoles * @author Vittorio Minacori (https://github.com/vittominacori) * @dev It identifies the DAO roles */ contract DAORoles is Ownable { using Roles for Roles.Role; event OperatorAdded(address indexed account); event OperatorRemoved(address indexed account); event DappAdded(address indexed account); event DappRemoved(address indexed account); Roles.Role private _operators; Roles.Role private _dapps; constructor () internal {} // solhint-disable-line no-empty-blocks modifier onlyOperator() { require(isOperator(msg.sender)); _; } modifier onlyDapp() { require(isDapp(msg.sender)); _; } /** * @dev Check if an address has the `operator` role * @param account Address you want to check */ function isOperator(address account) public view returns (bool) { return _operators.has(account); } /** * @dev Check if an address has the `dapp` role * @param account Address you want to check */ function isDapp(address account) public view returns (bool) { return _dapps.has(account); } /** * @dev Add the `operator` role from address * @param account Address you want to add role */ function addOperator(address account) public onlyOwner { _addOperator(account); } /** * @dev Add the `dapp` role from address * @param account Address you want to add role */ function addDapp(address account) public onlyOperator { _addDapp(account); } /** * @dev Remove the `operator` role from address * @param account Address you want to remove role */ function removeOperator(address account) public onlyOwner { _removeOperator(account); } /** * @dev Remove the `operator` role from address * @param account Address you want to remove role */ function removeDapp(address account) public onlyOperator { _removeDapp(account); } function _addOperator(address account) internal { _operators.add(account); emit OperatorAdded(account); } function _addDapp(address account) internal { _dapps.add(account); emit DappAdded(account); } function _removeOperator(address account) internal { _operators.remove(account); emit OperatorRemoved(account); } function _removeDapp(address account) internal { _dapps.remove(account); emit DappRemoved(account); } } // File: dao-smartcontracts/contracts/dao/Organization.sol /** * @title Organization * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Library for managing organization */ library Organization { using SafeMath for uint256; // structure defining a member struct Member { uint256 id; address account; bytes9 fingerprint; uint256 creationDate; uint256 stakedTokens; uint256 usedTokens; bytes32 data; bool approved; } // structure defining members status struct Members { uint256 count; uint256 totalStakedTokens; uint256 totalUsedTokens; mapping(address => uint256) addressMap; mapping(uint256 => Member) list; } /** * @dev Returns if an address is member or not * @param members Current members struct * @param account Address of the member you are looking for * @return bool */ function isMember(Members storage members, address account) internal view returns (bool) { return members.addressMap[account] != 0; } /** * @dev Get creation date of a member * @param members Current members struct * @param account Address you want to check * @return uint256 Member creation date, zero otherwise */ function creationDateOf(Members storage members, address account) internal view returns (uint256) { Member storage member = members.list[members.addressMap[account]]; return member.creationDate; } /** * @dev Check how many tokens staked for given address * @param members Current members struct * @param account Address you want to check * @return uint256 Member staked tokens */ function stakedTokensOf(Members storage members, address account) internal view returns (uint256) { Member storage member = members.list[members.addressMap[account]]; return member.stakedTokens; } /** * @dev Check how many tokens used for given address * @param members Current members struct * @param account Address you want to check * @return uint256 Member used tokens */ function usedTokensOf(Members storage members, address account) internal view returns (uint256) { Member storage member = members.list[members.addressMap[account]]; return member.usedTokens; } /** * @dev Check if an address has been approved * @param members Current members struct * @param account Address you want to check * @return bool */ function isApproved(Members storage members, address account) internal view returns (bool) { Member storage member = members.list[members.addressMap[account]]; return member.approved; } /** * @dev Returns the member structure * @param members Current members struct * @param memberId Id of the member you are looking for * @return Member */ function getMember(Members storage members, uint256 memberId) internal view returns (Member storage) { Member storage structure = members.list[memberId]; require(structure.account != address(0)); return structure; } /** * @dev Generate a new member and the member structure * @param members Current members struct * @param account Address you want to make member * @return uint256 The new member id */ function addMember(Members storage members, address account) internal returns (uint256) { require(account != address(0)); require(!isMember(members, account)); uint256 memberId = members.count.add(1); bytes9 fingerprint = getFingerprint(account, memberId); members.addressMap[account] = memberId; members.list[memberId] = Member( memberId, account, fingerprint, block.timestamp, // solhint-disable-line not-rely-on-time 0, 0, "", false ); members.count = memberId; return memberId; } /** * @dev Add tokens to member stack * @param members Current members struct * @param account Address you want to stake tokens * @param amount Number of tokens to stake */ function stake(Members storage members, address account, uint256 amount) internal { require(isMember(members, account)); Member storage member = members.list[members.addressMap[account]]; member.stakedTokens = member.stakedTokens.add(amount); members.totalStakedTokens = members.totalStakedTokens.add(amount); } /** * @dev Remove tokens from member stack * @param members Current members struct * @param account Address you want to unstake tokens * @param amount Number of tokens to unstake */ function unstake(Members storage members, address account, uint256 amount) internal { require(isMember(members, account)); Member storage member = members.list[members.addressMap[account]]; require(member.stakedTokens >= amount); member.stakedTokens = member.stakedTokens.sub(amount); members.totalStakedTokens = members.totalStakedTokens.sub(amount); } /** * @dev Use tokens from member stack * @param members Current members struct * @param account Address you want to use tokens * @param amount Number of tokens to use */ function use(Members storage members, address account, uint256 amount) internal { require(isMember(members, account)); Member storage member = members.list[members.addressMap[account]]; require(member.stakedTokens >= amount); member.stakedTokens = member.stakedTokens.sub(amount); members.totalStakedTokens = members.totalStakedTokens.sub(amount); member.usedTokens = member.usedTokens.add(amount); members.totalUsedTokens = members.totalUsedTokens.add(amount); } /** * @dev Set the approved status for a member * @param members Current members struct * @param account Address you want to update * @param status Bool the new status for approved */ function setApproved(Members storage members, address account, bool status) internal { require(isMember(members, account)); Member storage member = members.list[members.addressMap[account]]; member.approved = status; } /** * @dev Set data for a member * @param members Current members struct * @param account Address you want to update * @param data bytes32 updated data */ function setData(Members storage members, address account, bytes32 data) internal { require(isMember(members, account)); Member storage member = members.list[members.addressMap[account]]; member.data = data; } /** * @dev Generate a member fingerprint * @param account Address you want to make member * @param memberId The member id * @return bytes9 It represents member fingerprint */ function getFingerprint(address account, uint256 memberId) private pure returns (bytes9) { return bytes9(keccak256(abi.encodePacked(account, memberId))); } } // File: dao-smartcontracts/contracts/dao/DAO.sol /** * @title DAO * @author Vittorio Minacori (https://github.com/vittominacori) * @dev It identifies the DAO and Organization logic */ contract DAO is ERC1363Payable, DAORoles { using SafeMath for uint256; using Organization for Organization.Members; using Organization for Organization.Member; event MemberAdded( address indexed account, uint256 id ); event MemberStatusChanged( address indexed account, bool approved ); event TokensStaked( address indexed account, uint256 value ); event TokensUnstaked( address indexed account, uint256 value ); event TokensUsed( address indexed account, address indexed dapp, uint256 value ); Organization.Members private _members; constructor (IERC1363 acceptedToken) public ERC1363Payable(acceptedToken) {} // solhint-disable-line no-empty-blocks /** * @dev fallback. This function will create a new member */ function () external payable { // solhint-disable-line no-complex-fallback require(msg.value == 0); _newMember(msg.sender); } /** * @dev Generate a new member and the member structure */ function join() external { _newMember(msg.sender); } /** * @dev Generate a new member and the member structure * @param account Address you want to make member */ function newMember(address account) external onlyOperator { _newMember(account); } /** * @dev Set the approved status for a member * @param account Address you want to update * @param status Bool the new status for approved */ function setApproved(address account, bool status) external onlyOperator { _members.setApproved(account, status); emit MemberStatusChanged(account, status); } /** * @dev Set data for a member * @param account Address you want to update * @param data bytes32 updated data */ function setData(address account, bytes32 data) external onlyOperator { _members.setData(account, data); } /** * @dev Use tokens from a specific account * @param account Address to use the tokens from * @param amount Number of tokens to use */ function use(address account, uint256 amount) external onlyDapp { _members.use(account, amount); IERC20(acceptedToken()).transfer(msg.sender, amount); emit TokensUsed(account, msg.sender, amount); } /** * @dev Remove tokens from member stack * @param amount Number of tokens to unstake */ function unstake(uint256 amount) public { _members.unstake(msg.sender, amount); IERC20(acceptedToken()).transfer(msg.sender, amount); emit TokensUnstaked(msg.sender, amount); } /** * @dev Returns the members number * @return uint256 */ function membersNumber() public view returns (uint256) { return _members.count; } /** * @dev Returns the total staked tokens number * @return uint256 */ function totalStakedTokens() public view returns (uint256) { return _members.totalStakedTokens; } /** * @dev Returns the total used tokens number * @return uint256 */ function totalUsedTokens() public view returns (uint256) { return _members.totalUsedTokens; } /** * @dev Returns if an address is member or not * @param account Address of the member you are looking for * @return bool */ function isMember(address account) public view returns (bool) { return _members.isMember(account); } /** * @dev Get creation date of a member * @param account Address you want to check * @return uint256 Member creation date, zero otherwise */ function creationDateOf(address account) public view returns (uint256) { return _members.creationDateOf(account); } /** * @dev Check how many tokens staked for given address * @param account Address you want to check * @return uint256 Member staked tokens */ function stakedTokensOf(address account) public view returns (uint256) { return _members.stakedTokensOf(account); } /** * @dev Check how many tokens used for given address * @param account Address you want to check * @return uint256 Member used tokens */ function usedTokensOf(address account) public view returns (uint256) { return _members.usedTokensOf(account); } /** * @dev Check if an address has been approved * @param account Address you want to check * @return bool */ function isApproved(address account) public view returns (bool) { return _members.isApproved(account); } /** * @dev Returns the member structure * @param memberAddress Address of the member you are looking for * @return array */ function getMemberByAddress(address memberAddress) public view returns ( uint256 id, address account, bytes9 fingerprint, uint256 creationDate, uint256 stakedTokens, uint256 usedTokens, bytes32 data, bool approved ) { return getMemberById(_members.addressMap[memberAddress]); } /** * @dev Returns the member structure * @param memberId Id of the member you are looking for * @return array */ function getMemberById(uint256 memberId) public view returns ( uint256 id, address account, bytes9 fingerprint, uint256 creationDate, uint256 stakedTokens, uint256 usedTokens, bytes32 data, bool approved ) { Organization.Member storage structure = _members.getMember(memberId); id = structure.id; account = structure.account; fingerprint = structure.fingerprint; creationDate = structure.creationDate; stakedTokens = structure.stakedTokens; usedTokens = structure.usedTokens; data = structure.data; approved = structure.approved; } /** * @dev Allow to recover tokens from contract * @param tokenAddress address The token contract address * @param tokenAmount uint256 Number of tokens to be sent */ function recoverERC20(address tokenAddress, uint256 tokenAmount) public onlyOwner { if (tokenAddress == address(acceptedToken())) { uint256 currentBalance = IERC20(acceptedToken()).balanceOf(address(this)); require(currentBalance.sub(_members.totalStakedTokens) >= tokenAmount); } IERC20(tokenAddress).transfer(owner(), tokenAmount); } /** * @dev Called after validating a `onTransferReceived` * @param operator address The address which called `transferAndCall` or `transferFromAndCall` function * @param from address The address which are token transferred from * @param value uint256 The amount of tokens transferred * @param data bytes Additional data with no specified format */ function _transferReceived( address operator, // solhint-disable-line no-unused-vars address from, uint256 value, bytes memory data // solhint-disable-line no-unused-vars ) internal { _stake(from, value); } /** * @dev Called after validating a `onApprovalReceived` * @param owner address The address which called `approveAndCall` function * @param value uint256 The amount of tokens to be spent * @param data bytes Additional data with no specified format */ function _approvalReceived( address owner, uint256 value, bytes memory data // solhint-disable-line no-unused-vars ) internal { IERC20(acceptedToken()).transferFrom(owner, address(this), value); _stake(owner, value); } /** * @dev Generate a new member and the member structure * @param account Address you want to make member * @return uint256 The new member id */ function _newMember(address account) internal { uint256 memberId = _members.addMember(account); emit MemberAdded(account, memberId); } /** * @dev Add tokens to member stack * @param account Address you want to stake tokens * @param amount Number of tokens to stake */ function _stake(address account, uint256 amount) internal { if (!isMember(account)) { _newMember(account); } _members.stake(account, amount); emit TokensStaked(account, amount); } } // File: eth-token-recover/contracts/TokenRecover.sol /** * @title TokenRecover * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Allow to recover any ERC20 sent into the contract for error */ contract TokenRecover is Ownable { /** * @dev Remember that only owner can call so be careful when use on contracts generated from other contracts. * @param tokenAddress The token contract address * @param tokenAmount Number of tokens to be sent */ function recoverERC20(address tokenAddress, uint256 tokenAmount) public onlyOwner { IERC20(tokenAddress).transfer(owner(), tokenAmount); } } // File: contracts/access/roles/OperatorRole.sol contract OperatorRole { using Roles for Roles.Role; event OperatorAdded(address indexed account); event OperatorRemoved(address indexed account); Roles.Role private _operators; constructor() internal { _addOperator(msg.sender); } modifier onlyOperator() { require(isOperator(msg.sender)); _; } function isOperator(address account) public view returns (bool) { return _operators.has(account); } function addOperator(address account) public onlyOperator { _addOperator(account); } function renounceOperator() public { _removeOperator(msg.sender); } function _addOperator(address account) internal { _operators.add(account); emit OperatorAdded(account); } function _removeOperator(address account) internal { _operators.remove(account); emit OperatorRemoved(account); } } // File: contracts/utils/Contributions.sol /** * @title Contributions * @author Vittorio Minacori (https://github.com/vittominacori) * @dev Utility contract where to save any information about Crowdsale contributions */ contract Contributions is OperatorRole, TokenRecover { using SafeMath for uint256; struct Contributor { uint256 weiAmount; uint256 tokenAmount; bool exists; } // the number of sold tokens uint256 private _totalSoldTokens; // the number of wei raised uint256 private _totalWeiRaised; // list of addresses who contributed in crowdsales address[] private _addresses; // map of contributors mapping(address => Contributor) private _contributors; constructor() public {} // solhint-disable-line no-empty-blocks /** * @return the number of sold tokens */ function totalSoldTokens() public view returns (uint256) { return _totalSoldTokens; } /** * @return the number of wei raised */ function totalWeiRaised() public view returns (uint256) { return _totalWeiRaised; } /** * @return address of a contributor by list index */ function getContributorAddress(uint256 index) public view returns (address) { return _addresses[index]; } /** * @dev return the contributions length * @return uint representing contributors number */ function getContributorsLength() public view returns (uint) { return _addresses.length; } /** * @dev get wei contribution for the given address * @param account Address has contributed * @return uint256 */ function weiContribution(address account) public view returns (uint256) { return _contributors[account].weiAmount; } /** * @dev get token balance for the given address * @param account Address has contributed * @return uint256 */ function tokenBalance(address account) public view returns (uint256) { return _contributors[account].tokenAmount; } /** * @dev check if a contributor exists * @param account The address to check * @return bool */ function contributorExists(address account) public view returns (bool) { return _contributors[account].exists; } /** * @dev add contribution into the contributions array * @param account Address being contributing * @param weiAmount Amount of wei contributed * @param tokenAmount Amount of token received */ function addBalance(address account, uint256 weiAmount, uint256 tokenAmount) public onlyOperator { if (!_contributors[account].exists) { _addresses.push(account); _contributors[account].exists = true; } _contributors[account].weiAmount = _contributors[account].weiAmount.add(weiAmount); _contributors[account].tokenAmount = _contributors[account].tokenAmount.add(tokenAmount); _totalWeiRaised = _totalWeiRaised.add(weiAmount); _totalSoldTokens = _totalSoldTokens.add(tokenAmount); } /** * @dev remove the `operator` role from address * @param account Address you want to remove role */ function removeOperator(address account) public onlyOwner { _removeOperator(account); } } // File: contracts/dealer/TokenDealer.sol /** * @title TokenDealer * @author Vittorio Minacori (https://github.com/vittominacori) * @dev TokenDealer is a base contract for managing a token crowdsale, * allowing investors to purchase tokens with ether. */ contract TokenDealer is ReentrancyGuard, TokenRecover { using SafeMath for uint256; using SafeERC20 for IERC20; // How many token units a buyer gets per wei. // The rate is the conversion between wei and the smallest and indivisible token unit. uint256 private _rate; // Address where funds are collected address payable private _wallet; // The token being sold IERC20 private _token; // the DAO smart contract DAO private _dao; // reference to Contributions contract Contributions private _contributions; /** * Event for token purchase logging * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokensPurchased(address indexed beneficiary, uint256 value, uint256 amount); /** * @param rate Number of token units a buyer gets per wei * @param wallet Address where collected funds will be forwarded to * @param token Address of the token being sold * @param contributions Address of the contributions contract * @param dao DAO the decentralized organization address */ constructor( uint256 rate, address payable wallet, address token, address contributions, address payable dao ) public { require(rate > 0, "TokenDealer: rate is 0"); require(wallet != address(0), "TokenDealer: wallet is the zero address"); require(token != address(0), "TokenDealer: token is the zero address"); require(contributions != address(0), "TokenDealer: contributions is the zero address"); require(dao != address(0), "TokenDealer: dao is the zero address"); _rate = rate; _wallet = wallet; _token = IERC20(token); _contributions = Contributions(contributions); _dao = DAO(dao); } /** * @dev fallback function * Note that other contracts will transfer funds with a base gas stipend * of 2300, which is not enough to call buyTokens. Consider calling * buyTokens directly when purchasing tokens from a contract. */ function () external payable { buyTokens(); } /** * @dev low level token purchase * This function has a non-reentrancy guard, so it shouldn't be called by * another `nonReentrant` function. */ function buyTokens() public nonReentrant payable { address beneficiary = msg.sender; uint256 weiAmount = msg.value; require(weiAmount != 0, "TokenDealer: weiAmount is 0"); // calculate token amount to be sent uint256 tokenAmount = _getTokenAmount(beneficiary, weiAmount); _token.safeTransfer(beneficiary, tokenAmount); emit TokensPurchased(beneficiary, weiAmount, tokenAmount); _contributions.addBalance(beneficiary, weiAmount, tokenAmount); _wallet.transfer(weiAmount); } /** * @dev Function to update rate * @param newRate The rate is the conversion between wei and the smallest and indivisible token unit */ function setRate(uint256 newRate) public onlyOwner { require(newRate > 0, "TokenDealer: rate is 0"); _rate = newRate; } /** * @return the number of token units a buyer gets per wei. */ function rate() public view returns (uint256) { return _rate; } /** * @return the address where funds are collected. */ function wallet() public view returns (address payable) { return _wallet; } /** * @return the token being sold. */ function token() public view returns (IERC20) { return _token; } /** * @return the crowdsale contributions contract address */ function contributions() public view returns (Contributions) { return _contributions; } /** * @return the crowdsale dao contract address */ function dao() public view returns (DAO) { return _dao; } /** * @dev Get expected token number for beneficiary. * @param beneficiary Address receiving the tokens * @param weiAmount Value in wei to be converted into tokens * @return Number of tokens that can be purchased with the specified _weiAmount */ function expectedTokenAmount(address beneficiary, uint256 weiAmount) public view returns (uint256) { return _getTokenAmount(beneficiary, weiAmount); } /** * @dev The way in which ether is converted to tokens. * @param beneficiary Address receiving the tokens * @param weiAmount Value in wei to be converted into tokens * @return Number of tokens that can be purchased with the specified _weiAmount */ function _getTokenAmount(address beneficiary, uint256 weiAmount) internal view returns (uint256) { uint256 tokenAmount = weiAmount.mul(_rate); if (_dao.isMember(beneficiary)) { tokenAmount = tokenAmount.mul(2); if (_dao.stakedTokensOf(beneficiary) > 0) { tokenAmount = tokenAmount.mul(2); } if (_dao.usedTokensOf(beneficiary) > 0) { tokenAmount = tokenAmount.mul(2); } } return tokenAmount; } }
* @title Contributions @dev Utility contract where to save any information about Crowdsale contributions/
contract Contributions is OperatorRole, TokenRecover { using SafeMath for uint256; struct Contributor { uint256 weiAmount; uint256 tokenAmount; bool exists; } uint256 private _totalSoldTokens; uint256 private _totalWeiRaised; address[] private _addresses; mapping(address => Contributor) private _contributors; function totalSoldTokens() public view returns (uint256) { return _totalSoldTokens; } function totalWeiRaised() public view returns (uint256) { return _totalWeiRaised; } function getContributorAddress(uint256 index) public view returns (address) { return _addresses[index]; } function getContributorsLength() public view returns (uint) { return _addresses.length; } function weiContribution(address account) public view returns (uint256) { return _contributors[account].weiAmount; } function tokenBalance(address account) public view returns (uint256) { return _contributors[account].tokenAmount; } function contributorExists(address account) public view returns (bool) { return _contributors[account].exists; } function addBalance(address account, uint256 weiAmount, uint256 tokenAmount) public onlyOperator { if (!_contributors[account].exists) { _addresses.push(account); _contributors[account].exists = true; } _contributors[account].weiAmount = _contributors[account].weiAmount.add(weiAmount); _contributors[account].tokenAmount = _contributors[account].tokenAmount.add(tokenAmount); _totalWeiRaised = _totalWeiRaised.add(weiAmount); _totalSoldTokens = _totalSoldTokens.add(tokenAmount); } function addBalance(address account, uint256 weiAmount, uint256 tokenAmount) public onlyOperator { if (!_contributors[account].exists) { _addresses.push(account); _contributors[account].exists = true; } _contributors[account].weiAmount = _contributors[account].weiAmount.add(weiAmount); _contributors[account].tokenAmount = _contributors[account].tokenAmount.add(tokenAmount); _totalWeiRaised = _totalWeiRaised.add(weiAmount); _totalSoldTokens = _totalSoldTokens.add(tokenAmount); } function removeOperator(address account) public onlyOwner { _removeOperator(account); } }
943,887
[ 1, 442, 15326, 225, 13134, 6835, 1625, 358, 1923, 1281, 1779, 2973, 385, 492, 2377, 5349, 13608, 6170, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 735, 15326, 353, 11097, 2996, 16, 3155, 27622, 288, 203, 565, 1450, 14060, 10477, 364, 2254, 5034, 31, 203, 203, 203, 565, 1958, 735, 19293, 288, 203, 3639, 2254, 5034, 732, 77, 6275, 31, 203, 3639, 2254, 5034, 1147, 6275, 31, 203, 3639, 1426, 1704, 31, 203, 565, 289, 203, 203, 203, 203, 203, 203, 203, 565, 2254, 5034, 3238, 389, 4963, 55, 1673, 5157, 31, 203, 565, 2254, 5034, 3238, 389, 4963, 3218, 77, 12649, 5918, 31, 203, 565, 1758, 8526, 3238, 389, 13277, 31, 203, 565, 2874, 12, 2867, 516, 735, 19293, 13, 3238, 389, 26930, 13595, 31, 203, 565, 445, 2078, 55, 1673, 5157, 1435, 1071, 1476, 1135, 261, 11890, 5034, 13, 288, 203, 3639, 327, 389, 4963, 55, 1673, 5157, 31, 203, 565, 289, 203, 203, 565, 445, 2078, 3218, 77, 12649, 5918, 1435, 1071, 1476, 1135, 261, 11890, 5034, 13, 288, 203, 3639, 327, 389, 4963, 3218, 77, 12649, 5918, 31, 203, 565, 289, 203, 203, 565, 445, 336, 442, 19293, 1887, 12, 11890, 5034, 770, 13, 1071, 1476, 1135, 261, 2867, 13, 288, 203, 3639, 327, 389, 13277, 63, 1615, 15533, 203, 565, 289, 203, 203, 565, 445, 336, 442, 665, 13595, 1782, 1435, 1071, 1476, 1135, 261, 11890, 13, 288, 203, 3639, 327, 389, 13277, 18, 2469, 31, 203, 565, 289, 203, 203, 565, 445, 732, 77, 442, 4027, 12, 2867, 2236, 13, 1071, 1476, 1135, 261, 11890, 5034, 13, 288, 203, 3639, 327, 389, 26930, 13595, 63, 4631, 8009, 1814, 77, 6275, 31, 203, 565, 2 ]
/** *Submitted for verification at Etherscan.io on 2022-01-25 */ pragma solidity 0.8.7; // SPDX-License-Identifier: Unlicense /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// Taken from Solmate: https://github.com/Rari-Capital/solmate abstract contract ERC20 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); /*/////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ function name() external view virtual returns (string memory); function symbol() external view virtual returns (string memory); function decimals() external view virtual returns (uint8); // string public constant name = "TREAT"; // string public constant symbol = "TREAT"; // uint8 public constant decimals = 18; /*/////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; mapping(address => bool) public isMinter; address public ruler; /*/////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ constructor() { ruler = msg.sender;} function approve(address spender, uint256 value) external returns (bool) { allowance[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; } function transfer(address to, uint256 value) external returns (bool) { balanceOf[msg.sender] -= value; // This is safe because the sum of all user // balances can't exceed type(uint256).max! unchecked { balanceOf[to] += value; } emit Transfer(msg.sender, to, value); return true; } function transferFrom( address from, address to, uint256 value ) external returns (bool) { if (allowance[from][msg.sender] != type(uint256).max) { allowance[from][msg.sender] -= value; } balanceOf[from] -= value; // This is safe because the sum of all user // balances can't exceed type(uint256).max! unchecked { balanceOf[to] += value; } emit Transfer(from, to, value); return true; } /*/////////////////////////////////////////////////////////////// PRIVILEGE //////////////////////////////////////////////////////////////*/ function mint(address to, uint256 value) external { require(isMinter[msg.sender], "FORBIDDEN TO MINT"); _mint(to, value); } function burn(address from, uint256 value) external { require(isMinter[msg.sender], "FORBIDDEN TO BURN"); _burn(from, value); } /*/////////////////////////////////////////////////////////////// Ruler Function //////////////////////////////////////////////////////////////*/ function setMinter(address minter, bool status) external { require(msg.sender == ruler, "NOT ALLOWED TO RULE"); isMinter[minter] = status; } function setRuler(address ruler_) external { require(msg.sender == ruler ||ruler == address(0), "NOT ALLOWED TO RULE"); ruler = ruler_; } /*/////////////////////////////////////////////////////////////// INTERNAL UTILS //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 value) internal { totalSupply += value; // This is safe because the sum of all user // balances can't exceed type(uint256).max! unchecked { balanceOf[to] += value; } emit Transfer(address(0), to, value); } function _burn(address from, uint256 value) internal { balanceOf[from] -= value; // This is safe because a user won't ever // have a balance larger than totalSupply! unchecked { totalSupply -= value; } emit Transfer(from, address(0), value); } } /// @notice Modern and gas efficient ERC-721 + ERC-20/EIP-2612-like implementation, /// including the MetaData, and partially, Enumerable extensions. contract ERC721 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed spender, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /*/////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ address implementation_; address public admin; //Lame requirement from opensea /*/////////////////////////////////////////////////////////////// ERC-721 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; uint256 public oldSupply; uint256 public minted; mapping(address => uint256) public balanceOf; mapping(uint256 => address) public ownerOf; mapping(uint256 => address) public getApproved; mapping(address => mapping(address => bool)) public isApprovedForAll; /*/////////////////////////////////////////////////////////////// VIEW FUNCTION //////////////////////////////////////////////////////////////*/ function owner() external view returns (address) { return admin; } /*/////////////////////////////////////////////////////////////// ERC-20-LIKE LOGIC //////////////////////////////////////////////////////////////*/ function transfer(address to, uint256 tokenId) external { require(msg.sender == ownerOf[tokenId], "NOT_OWNER"); _transfer(msg.sender, to, tokenId); } /*/////////////////////////////////////////////////////////////// ERC-721 LOGIC //////////////////////////////////////////////////////////////*/ function supportsInterface(bytes4 interfaceId) external pure returns (bool supported) { supported = interfaceId == 0x80ac58cd || interfaceId == 0x5b5e139f; } function approve(address spender, uint256 tokenId) external { address owner_ = ownerOf[tokenId]; require(msg.sender == owner_ || isApprovedForAll[owner_][msg.sender], "NOT_APPROVED"); getApproved[tokenId] = spender; emit Approval(owner_, spender, tokenId); } function setApprovalForAll(address operator, bool approved) external { isApprovedForAll[msg.sender][operator] = approved; emit ApprovalForAll(msg.sender, operator, approved); } function transferFrom(address from, address to, uint256 tokenId) public { require( msg.sender == from || msg.sender == getApproved[tokenId] || isApprovedForAll[from][msg.sender], "NOT_APPROVED" ); _transfer(from, to, tokenId); } function safeTransferFrom(address from, address to, uint256 tokenId) external { safeTransferFrom(from, to, tokenId, ""); } function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public { transferFrom(from, to, tokenId); if (to.code.length != 0) { // selector = `onERC721Received(address,address,uint,bytes)` (, bytes memory returned) = to.staticcall(abi.encodeWithSelector(0x150b7a02, msg.sender, from, tokenId, data)); bytes4 selector = abi.decode(returned, (bytes4)); require(selector == 0x150b7a02, "NOT_ERC721_RECEIVER"); } } /*/////////////////////////////////////////////////////////////// INTERNAL UTILS //////////////////////////////////////////////////////////////*/ function _transfer(address from, address to, uint256 tokenId) internal { require(ownerOf[tokenId] == from, "not owner"); balanceOf[from]--; balanceOf[to]++; delete getApproved[tokenId]; ownerOf[tokenId] = to; emit Transfer(from, to, tokenId); } function _mint(address to, uint256 tokenId) internal { require(ownerOf[tokenId] == address(0), "ALREADY_MINTED"); totalSupply++; // This is safe because the sum of all user // balances can't exceed type(uint256).max! unchecked { balanceOf[to]++; } ownerOf[tokenId] = to; emit Transfer(address(0), to, tokenId); } function _burn(uint256 tokenId) internal { address owner_ = ownerOf[tokenId]; require(ownerOf[tokenId] != address(0), "NOT_MINTED"); totalSupply--; balanceOf[owner_]--; delete ownerOf[tokenId]; emit Transfer(owner_, address(0), tokenId); } } interface ITraits { function tokenURI(uint256 tokenId) external view returns (string memory); } interface IDogewood { // struct to store each token's traits struct Doge { uint8 head; uint8 breed; uint8 color; uint8 class; uint8 armor; uint8 offhand; uint8 mainhand; uint16 level; } function getTokenTraits(uint256 tokenId) external view returns (Doge memory); function getGenesisSupply() external view returns (uint256); function pull(address owner, uint256[] calldata ids) external; function manuallyAdjustDoge(uint256 id, uint8 head, uint8 breed, uint8 color, uint8 class, uint8 armor, uint8 offhand, uint8 mainhand, uint16 level) external; function transfer(address to, uint256 tokenId) external; // function doges(uint256 id) external view returns(uint8 head, uint8 breed, uint8 color, uint8 class, uint8 armor, uint8 offhand, uint8 mainhand, uint16 level); } // interface DogeLike { // function pull(address owner, uint256[] calldata ids) external; // function manuallyAdjustDoge(uint256 id, uint8 head, uint8 breed, uint8 color, uint8 class, uint8 armor, uint8 offhand, uint8 mainhand, uint16 level) external; // function transfer(address to, uint256 tokenId) external; // function doges(uint256 id) external view returns(uint8 head, uint8 breed, uint8 color, uint8 class, uint8 armor, uint8 offhand, uint8 mainhand, uint16 level); // } interface PortalLike { function sendMessage(bytes calldata message_) external; } interface CastleLike { function pullCallback(address owner, uint256[] calldata ids) external; } // interface DogewoodLike { // function ownerOf(uint256 id) external view returns (address owner_); // function activities(uint256 id) external view returns (address owner, uint88 timestamp, uint8 action); // function doges(uint256 dogeId) external view returns (uint8 head, uint8 breed, uint8 color, uint8 class, uint8 armor, uint8 offhand, uint8 mainhand, uint16 level); // } interface ERC20Like { function balanceOf(address from) external view returns(uint256 balance); function burn(address from, uint256 amount) external; function mint(address from, uint256 amount) external; function transfer(address to, uint256 amount) external; } interface ERC1155Like { function mint(address to, uint256 id, uint256 amount) external; function burn(address from, uint256 id, uint256 amount) external; } interface ERC721Like { function transferFrom(address from, address to, uint256 id) external; function transfer(address to, uint256 id) external; function ownerOf(uint256 id) external returns (address owner); function mint(address to, uint256 tokenid) external; } contract Dogewood is ERC721 { /*/////////////////////////////////////////////////////////////// Global STATE //////////////////////////////////////////////////////////////*/ // max number of tokens that can be minted - 5000 in production uint256 public constant MAX_SUPPLY = 5000; uint256 public constant GENESIS_SUPPLY = 2500; uint256 public constant mintCooldown = 12 hours; // Helpers to get Percentages uint256 constant tenPct = (type(uint16).max / 100) * 10; uint256 constant fifteenPct = (type(uint16).max / 100) * 15; uint256 constant fiftyPct = (type(uint16).max / 100) * 50; bool public presaleActive; bool public saleActive; mapping (address => uint8) public whitelist; mapping (address => uint8) public ogWhitelist; uint256 public mintPriceEth; uint256 public mintPriceZug; uint16 public constant MAX_ZUG_MINT = 200; uint16 public zugMintCount; // list of probabilities for each trait type // 0 - 6 are associated with head, breed, color, class, armor, offhand, mainhand uint8[][7] public rarities; // list of aliases for Walker's Alias algorithm // 0 - 6 are associated with head, breed, color, class, armor, offhand, mainhand uint8[][7] public aliases; // mapping from hashed(tokenTrait) to the tokenId it's associated with // used to ensure there are no duplicates mapping(uint256 => uint256) public existingCombinations; bool public rerollTreatOnly; uint256 public rerollPriceEth; uint256 public rerollPriceZug; uint256[] public rerollPrice; // level 1-20 uint256[] public upgradeLevelPrice; bytes32 internal entropySauce; ERC20 public treat; ERC20 public zug; mapping(address => bool) public auth; mapping(uint256 => Doge) internal doges; mapping(uint256 => Action) public activities; mapping(uint256 => Log) public mintLogs; mapping(RerollTypes => mapping(uint256 => uint256)) public rerollCountHistory; // rerollType => tokenId => rerollCount // reference to Traits ITraits public traits; mapping(uint256 => uint256) public rerollBlocks; // Layer2 migration data ------------- // MetadataHandlerLike public metadaHandler; mapping(bytes4 => address) implementer; // TODO -- remove fallback? address constant impl = 0x7ef61741D9a2b483E75D8AA0876Ce864d98cE331; address public castle; /*/////////////////////////////////////////////////////////////// End of data //////////////////////////////////////////////////////////////*/ function setImplementer(bytes4[] calldata funcs, address source) external onlyOwner { for (uint256 index = 0; index < funcs.length; index++) { implementer[funcs[index]] = source; } } function setAddresses( address _traits, address _treat, address _zug, address _castle ) external onlyOwner { traits = ITraits(_traits); treat = ERC20(_treat); zug = ERC20(_zug); castle = _castle; } function setTreat(address t_) external { require(msg.sender == admin); treat = ERC20(t_); } function setZug(address z_) external { require(msg.sender == admin); zug = ERC20(z_); } function setCastle(address c_) external { require(msg.sender == admin); castle = c_; } function setTraits(address t_) external { require(msg.sender == admin); traits = ITraits(t_); } function setAuth(address add, bool isAuth) external onlyOwner { auth[add] = isAuth; } function transferOwnership(address newOwner) external onlyOwner { admin = newOwner; } function setPresaleStatus(bool _status) external onlyOwner { presaleActive = _status; } function setSaleStatus(bool _status) external onlyOwner { saleActive = _status; } function setMintPrice(uint256 _mintPriceEth, uint256 _mintPriceZug) external onlyOwner { mintPriceEth = _mintPriceEth; mintPriceZug = _mintPriceZug; } function setRerollTreatOnly(bool _rerollTreatOnly) external onlyOwner { rerollTreatOnly = _rerollTreatOnly; } function setRerollPrice( uint256 _rerollPriceEth, uint256 _rerollPriceZug, uint256[] calldata _rerollPriceTreat ) external onlyOwner { rerollPriceEth = _rerollPriceEth; rerollPriceZug = _rerollPriceZug; rerollPrice = _rerollPriceTreat; } function setUpgradeLevelPrice(uint256[] calldata _upgradeLevelPrice) external onlyOwner { upgradeLevelPrice = _upgradeLevelPrice; } function editWhitelist(address[] calldata wlAddresses) external onlyOwner { for(uint256 i; i < wlAddresses.length; i++){ whitelist[wlAddresses[i]] = 2; } } function editOGWhitelist(address[] calldata wlAddresses) external onlyOwner { for(uint256 i; i < wlAddresses.length; i++){ ogWhitelist[wlAddresses[i]] = 1; } } /** RENDER */ function tokenURI(uint256 tokenId) public view returns (string memory) { // doges[tokenId] empty check require(rerollBlocks[tokenId] != block.number, "ERC721Metadata: URI query for nonexistent token"); return traits.tokenURI(tokenId); } event ActionMade( address owner, uint256 id, uint256 timestamp, uint8 activity ); /*/////////////////////////////////////////////////////////////// DATA STRUCTURES //////////////////////////////////////////////////////////////*/ struct Doge { uint8 head; uint8 breed; uint8 color; uint8 class; uint8 armor; uint8 offhand; uint8 mainhand; uint16 level; } enum Actions { UNSTAKED, FARMING } struct Action { address owner; uint88 timestamp; Actions action; } struct Log { address owner; uint88 timestamp; } enum RerollTypes { BREED, CLASS } /*/////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ function initialize() public onlyOwner { admin = msg.sender; auth[msg.sender] = true; // initialize state presaleActive = false; saleActive = false; mintPriceEth = 0.065 ether; mintPriceZug = 300 ether; // I know this looks weird but it saves users gas by making lookup O(1) // A.J. Walker's Alias Algorithm // head rarities[0] = [173, 155, 255, 206, 206, 206, 114, 114, 114]; aliases[0] = [2, 2, 8, 0, 0, 0, 0, 1, 1]; // breed rarities[1] = [255, 255, 255, 255, 255, 255, 255, 255]; aliases[1] = [7, 7, 7, 7, 7, 7, 7, 7]; // color rarities[2] = [255, 188, 255, 229, 153, 76]; aliases[2] = [2, 2, 5, 0, 0, 1]; // class rarities[3] = [229, 127, 178, 255, 204, 204, 204, 102]; aliases[3] = [2, 2, 3, 7, 0, 0, 1, 1]; // armor rarities[4] = [255]; aliases[4] = [0]; // offhand rarities[5] = [255]; aliases[5] = [0]; // mainhand rarities[6] = [255]; aliases[6] = [0]; rerollTreatOnly = false; // set reroll price rerollPriceEth = 0.01 ether; rerollPriceZug = 50 ether; rerollPrice = [ 6 ether, 12 ether, 24 ether, 48 ether, 96 ether ]; // set upgrade level price // level 1-20 upgradeLevelPrice = [ 0 ether, 12 ether, 16 ether, 20 ether, 24 ether, 30 ether, 36 ether, 42 ether, 48 ether, 54 ether, 62 ether, 70 ether, 78 ether, 86 ether, 96 ether, 106 ether, 116 ether, 126 ether, 138 ether, 150 ether ]; } /*/////////////////////////////////////////////////////////////// MODIFIERS //////////////////////////////////////////////////////////////*/ modifier noCheaters() { uint256 size = 0; address acc = msg.sender; assembly { size := extcodesize(acc) } require( auth[msg.sender] || (msg.sender == tx.origin && size == 0), "you're trying to cheat!" ); _; // We'll use the last caller hash to add entropy to next caller entropySauce = keccak256(abi.encodePacked(acc, block.coinbase, entropySauce)); } modifier mintCoolDownPassed(uint256 id) { Log memory log_ = mintLogs[id]; require( block.timestamp >= log_.timestamp + mintCooldown, "still in cool down" ); _; } modifier isOwnerOfDoge(uint256 id) { require( ownerOf[id] == msg.sender || activities[id].owner == msg.sender, "not your doge" ); _; } modifier ownerOfDoge(uint256 id, address who_) { require(ownerOf[id] == who_ || activities[id].owner == who_, "not your doge"); _; } modifier onlyOwner() { require(msg.sender == admin); _; } modifier genesisMinting(uint8 amount) { require(totalSupply + amount <= GENESIS_SUPPLY, "genesis all minted"); _; } /*/////////////////////////////////////////////////////////////// PUBLIC FUNCTIONS //////////////////////////////////////////////////////////////*/ function mintReserved(address to, uint8 amount) public genesisMinting(amount) onlyOwner { for (uint256 i = 0; i < amount; i++) { _mintDoge(to); } } function mintOG(address to, uint8 amount) public genesisMinting(amount) noCheaters { require(amount <= ogWhitelist[msg.sender], "Exceeds amount"); ogWhitelist[msg.sender] = ogWhitelist[msg.sender] - amount; for (uint256 i = 0; i < amount; i++) { _mintDoge(to); } } function presaleMintWithEth(uint8 amount) public payable genesisMinting(amount) noCheaters { require(presaleActive, "Presale must be active to mint"); require(amount <= whitelist[msg.sender], "Exceeds max amount"); require(msg.value >= mintPriceEth * amount, "Value below price"); whitelist[msg.sender] = whitelist[msg.sender] - amount; for (uint256 i = 0; i < amount; i++) { _mintDoge(msg.sender); } } function presaleMintWithZug(uint8 amount) public genesisMinting(amount) noCheaters { require(presaleActive, "Presale must be active to mint"); require(whitelist[msg.sender] > 0, "No tokens reserved for this address"); require(amount <= whitelist[msg.sender], "Exceeds max amount"); require(zugMintCount+amount <= MAX_ZUG_MINT, "Exceeds max zug mint"); whitelist[msg.sender] = whitelist[msg.sender] - amount; zug.transferFrom(msg.sender, address(this), mintPriceZug * amount); zugMintCount = zugMintCount + amount; for (uint256 i = 0; i < amount; i++) { _mintDoge(msg.sender); } } function mintWithEth(uint8 amount) public payable genesisMinting(amount) noCheaters { require(saleActive, "Sale must be active to mint"); require(amount <= 2, "Exceeds max amount"); require(msg.value >= mintPriceEth * amount, "Value below price"); for (uint256 i = 0; i < amount; i++) { _mintDoge(msg.sender); } } function mintWithZug(uint8 amount) public genesisMinting(amount) noCheaters { require(saleActive, "Sale must be active to mint"); require(amount <= 2, "Exceeds max amount"); require(zugMintCount+amount <= MAX_ZUG_MINT, "Exceeds max zug mint"); zug.transferFrom(msg.sender, address(this), mintPriceZug * amount); zugMintCount = zugMintCount + amount; for (uint256 i = 0; i < amount; i++) { _mintDoge(msg.sender); } } function recruit(uint256 id) public ownerOfDoge(id, msg.sender) mintCoolDownPassed(id) noCheaters { require(totalSupply <= MAX_SUPPLY, "all supply minted"); uint256 cost = _getMintingPrice(); if (cost > 0) treat.burn(msg.sender, cost); mintLogs[id].timestamp = uint88(block.timestamp); _mintDoge(msg.sender); } function upgradeLevelWithTreat(uint256 id) public ownerOfDoge(id, msg.sender) mintCoolDownPassed(id) noCheaters { _claim(id); // Need to claim to not have equipment reatroactively multiplying uint16 curVal = doges[id].level; require(curVal < 20, "already max level"); treat.burn(msg.sender, upgradeLevelPrice[curVal]); doges[id].level = curVal + 1; } function upgradeMultipleLevelWithTreat(uint256 id, uint16 toLevel) public ownerOfDoge(id, msg.sender) mintCoolDownPassed(id) noCheaters { uint16 curVal = doges[id].level; require(curVal < toLevel, "invalid level"); require(toLevel <= 20, "exceeds max level"); _claim(id); // Need to claim to not have equipment reatroactively multiplying treat.burn(msg.sender, getUpgradeLevelPrice(curVal, toLevel)); doges[id].level = toLevel; } function getUpgradeLevelPrice(uint16 curLevel, uint16 toLevel) public view returns(uint256) { uint256 _price = 0; for (uint16 i = curLevel; i < toLevel; i++) { _price += upgradeLevelPrice[i]; } return _price; } function rerollWithEth(uint256 id, RerollTypes rerollType) public payable ownerOfDoge(id, msg.sender) mintCoolDownPassed(id) noCheaters { require(!rerollTreatOnly, "Only TREAT for reroll"); require(msg.value >= rerollPriceEth, "Value below price"); _reroll(id, rerollType); } function rerollWithZug(uint256 id, RerollTypes rerollType) public ownerOfDoge(id, msg.sender) mintCoolDownPassed(id) noCheaters { require(!rerollTreatOnly, "Only TREAT for reroll"); zug.transferFrom(msg.sender, address(this), rerollPriceZug); _reroll(id, rerollType); } function rerollWithTreat(uint256 id, RerollTypes rerollType) public ownerOfDoge(id, msg.sender) mintCoolDownPassed(id) noCheaters { uint256 price_ = rerollPrice[ rerollCountHistory[rerollType][id] < 5 ? rerollCountHistory[rerollType][id] : 5 ]; treat.burn(msg.sender, price_); _reroll(id, rerollType); } function _reroll( uint256 id, RerollTypes rerollType ) internal { rerollBlocks[id] = block.number; uint256 rand_ = _rand(); if (rerollType == RerollTypes.BREED) { doges[id].breed = uint8(_randomize(rand_, "BREED", id)) % uint8(rarities[1].length); } else if (rerollType == RerollTypes.CLASS) { uint16 randClass = uint16(_randomize(rand_, "CLASS", id)); doges[id].class = selectTrait(randClass, 3); } rerollCountHistory[rerollType][id]++; } /** * allows owner to withdraw funds from minting */ function withdraw() external onlyOwner { payable(msg.sender).transfer(address(this).balance); zug.transfer(msg.sender, zug.balanceOf(address(this))); } function doAction(uint256 id, Actions action_) public ownerOfDoge(id, msg.sender) noCheaters { _doAction(id, msg.sender, action_, msg.sender); } function _doAction( uint256 id, address dogeOwner, Actions action_, address who_ ) internal ownerOfDoge(id, who_) { Action memory action = activities[id]; require(action.action != action_, "already doing that"); // Picking the largest value between block.timestamp, action.timestamp and startingTime uint88 timestamp = uint88( block.timestamp > action.timestamp ? block.timestamp : action.timestamp ); if (action.action == Actions.UNSTAKED) _transfer(dogeOwner, address(this), id); else { if (block.timestamp > action.timestamp) _claim(id); timestamp = timestamp > action.timestamp ? timestamp : action.timestamp; } address owner_ = action_ == Actions.UNSTAKED ? address(0) : dogeOwner; if (action_ == Actions.UNSTAKED) _transfer(address(this), dogeOwner, id); activities[id] = Action({ owner: owner_, timestamp: timestamp, action: action_ }); emit ActionMade(dogeOwner, id, block.timestamp, uint8(action_)); } function doActionWithManyDoges(uint256[] calldata ids, Actions action_) external { for (uint256 index = 0; index < ids.length; index++) { require( ownerOf[ids[index]] == msg.sender || activities[ids[index]].owner == msg.sender, "not your doge" ); _doAction(ids[index], msg.sender, action_, msg.sender); } } function claim(uint256[] calldata ids) external { for (uint256 index = 0; index < ids.length; index++) { _claim(ids[index]); } } function _claim(uint256 id) internal noCheaters { Action memory action = activities[id]; if (block.timestamp <= action.timestamp) return; uint256 timeDiff = uint256(block.timestamp - action.timestamp); if (action.action == Actions.FARMING) treat.mint( action.owner, claimableTreat(timeDiff, id, action.owner) ); activities[id].timestamp = uint88(block.timestamp); } function pull(address owner_, uint256[] calldata ids) external { require (msg.sender == castle, "not castle"); for (uint256 index = 0; index < ids.length; index++) { if (activities[ids[index]].action != Actions.UNSTAKED) _doAction(ids[index], owner_, Actions.UNSTAKED, owner_); _transfer(owner_, msg.sender, ids[index]); } CastleLike(msg.sender).pullCallback(owner_, ids); } function manuallyAdjustDoge(uint256 id, uint8 head, uint8 breed, uint8 color, uint8 class, uint8 armor, uint8 offhand, uint8 mainhand, uint16 level) external { require(msg.sender == admin || auth[msg.sender], "not authorized"); doges[id].head = head; doges[id].breed = breed; doges[id].color = color; doges[id].class = class; doges[id].armor = armor; doges[id].offhand = offhand; doges[id].mainhand = mainhand; doges[id].level = level; } /*/////////////////////////////////////////////////////////////// VIEWERS //////////////////////////////////////////////////////////////*/ function getTokenTraits(uint256 tokenId) external view returns (Doge memory) { if (rerollBlocks[tokenId] == block.number) return doges[0]; return doges[tokenId]; } function claimable(uint256 id) external view returns (uint256) { if (activities[id].action == Actions.FARMING) { uint256 timeDiff = block.timestamp > activities[id].timestamp ? uint256(block.timestamp - activities[id].timestamp) : 0; return claimableTreat(timeDiff, id, activities[id].owner); } return 0; } function getGenesisSupply() external pure returns (uint256) { return GENESIS_SUPPLY; } function name() external pure returns (string memory) { return "Doges"; } function symbol() external pure returns (string memory) { return "Doges"; } /*/////////////////////////////////////////////////////////////// MINT FUNCTION //////////////////////////////////////////////////////////////*/ function _mintDoge(address to) internal { uint16 id = uint16(totalSupply + 1); rerollBlocks[id] = block.number; uint256 seed = random(id); generate(id, seed); _mint(to, id); mintLogs[id] = Log({ owner: to, timestamp: uint88(block.timestamp) }); } /*/////////////////////////////////////////////////////////////// INTERNAL HELPERS //////////////////////////////////////////////////////////////*/ function claimableTreat(uint256 timeDiff, uint256 id, address owner_) internal view returns (uint256) { Doge memory doge = doges[id]; uint256 rand_ = _rand(); uint256 treatAmount = (timeDiff * 1 ether) / 1 days; if (doge.class == 0) { // Warrior uint16 randPlus = uint16(_randomize(rand_, "Warrior1", id)); if (randPlus < fifteenPct) return treatAmount * 115 / 100; randPlus = uint16(_randomize(rand_, "Warrior2", id)); if (randPlus < fifteenPct) return treatAmount * 85 / 100; return treatAmount; } else if(doge.class == 1) { // Rogue uint16 randPlus = uint16(_randomize(rand_, "Rogue", id)); if (randPlus < tenPct) return treatAmount * 3; return treatAmount; } else if(doge.class == 2) { // Mage uint16 randPlus = uint16(_randomize(rand_, "Mage", id)); if (randPlus < fiftyPct) return treatAmount * 5 / 10; return treatAmount * 2; } else if(doge.class == 3) { // Hunter return treatAmount * 125 / 100; } else if(doge.class == 4) { // Cleric return treatAmount; } else if(doge.class == 5) { // Bard uint256 balance = balanceOf[owner_]; uint256 boost = 10 + (balance > 10 ? 10 : balance); return treatAmount * boost / 10; } else if(doge.class == 6) { // Merchant return treatAmount * (8 + (rand_ % 6)) / 10; } else if(doge.class == 7) { // Forager return treatAmount * (3 + doge.level) / 3; } return treatAmount; } /** * generates traits for a specific token, checking to make sure it's unique * @param tokenId the id of the token to generate traits for * @param seed a pseudorandom 256 bit number to derive traits from * @return t - a struct of traits for the given token ID */ function generate(uint256 tokenId, uint256 seed) internal returns (Doge memory t) { t = selectTraits(seed); doges[tokenId] = t; return t; // keep the following code for future use, current version using different seed, so no need for now // if (existingCombinations[structToHash(t)] == 0) { // doges[tokenId] = t; // existingCombinations[structToHash(t)] = tokenId; // return t; // } // return generate(tokenId, random(seed)); } /** * uses A.J. Walker's Alias algorithm for O(1) rarity table lookup * ensuring O(1) instead of O(n) reduces mint cost by more than 50% * probability & alias tables are generated off-chain beforehand * @param seed portion of the 256 bit seed to remove trait correlation * @param traitType the trait type to select a trait for * @return the ID of the randomly selected trait */ function selectTrait(uint16 seed, uint8 traitType) internal view returns (uint8) { uint8 trait = uint8(seed) % uint8(rarities[traitType].length); if (seed >> 8 < rarities[traitType][trait]) return trait; return aliases[traitType][trait]; } /** * selects the species and all of its traits based on the seed value * @param seed a pseudorandom 256 bit number to derive traits from * @return t - a struct of randomly selected traits */ function selectTraits(uint256 seed) internal view returns (Doge memory t) { t.head = selectTrait(uint16(seed & 0xFFFF), 0); seed >>= 16; t.breed = selectTrait(uint16(seed & 0xFFFF), 1); seed >>= 16; t.color = selectTrait(uint16(seed & 0xFFFF), 2); seed >>= 16; t.class = selectTrait(uint16(seed & 0xFFFF), 3); seed >>= 16; t.armor = selectTrait(uint16(seed & 0xFFFF), 4); seed >>= 16; t.offhand = selectTrait(uint16(seed & 0xFFFF), 5); seed >>= 16; t.mainhand = selectTrait(uint16(seed & 0xFFFF), 6); t.level = 1; } /** * converts a struct to a 256 bit hash to check for uniqueness * @param s the struct to pack into a hash * @return the 256 bit hash of the struct */ function structToHash(Doge memory s) internal pure returns (uint256) { return uint256(bytes32( abi.encodePacked( s.head, s.breed, s.color, s.class, s.armor, s.offhand, s.mainhand, s.level ) )); } /// @dev Create a bit more of randomness function _randomize( uint256 rand, string memory val, uint256 spicy ) internal pure returns (uint256) { return uint256(keccak256(abi.encode(rand, val, spicy))); } function _rand() internal view returns (uint256) { return uint256( keccak256( abi.encodePacked( tx.origin, blockhash(block.number - 1), block.timestamp, entropySauce ) ) ); } /** * generates a pseudorandom number * @param seed a value ensure different outcomes for different sources in the same block * @return a pseudorandom value */ function random(uint256 seed) internal view returns (uint256) { return uint256(keccak256(abi.encodePacked( tx.origin, blockhash(block.number - 1), block.timestamp, seed ))); } function _getMintingPrice() internal view returns (uint256) { uint256 supply = totalSupply; if (supply < 2500) return 0; if (supply < 3000) return 4 ether; if (supply < 4600) return 25 ether; if (supply < 5000) return 85 ether; return 85 ether; } /*/////////////////////////////////////////////////////////////// FALLBACK HANDLER //////////////////////////////////////////////////////////////*/ function _delegate(address implementation) internal virtual { 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()) } } } fallback() external { if(implementer[msg.sig] == address(0)) { _delegate(impl); } else { _delegate(implementer[msg.sig]); } } }
This is safe because the sum of all user balances can't exceed type(uint256).max!
function transferFrom( address from, address to, uint256 value ) external returns (bool) { if (allowance[from][msg.sender] != type(uint256).max) { allowance[from][msg.sender] -= value; } balanceOf[from] -= value; unchecked { balanceOf[to] += value; } emit Transfer(from, to, value); return true; } PRIVILEGE
2,052,554
[ 1, 2503, 353, 4183, 2724, 326, 2142, 434, 777, 729, 324, 26488, 848, 1404, 9943, 618, 12, 11890, 5034, 2934, 1896, 5, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 203, 3639, 1758, 628, 16, 203, 3639, 1758, 358, 16, 203, 3639, 2254, 5034, 460, 203, 565, 262, 3903, 1135, 261, 6430, 13, 288, 203, 3639, 309, 261, 5965, 1359, 63, 2080, 6362, 3576, 18, 15330, 65, 480, 618, 12, 11890, 5034, 2934, 1896, 13, 288, 203, 5411, 1699, 1359, 63, 2080, 6362, 3576, 18, 15330, 65, 3947, 460, 31, 203, 3639, 289, 203, 203, 3639, 11013, 951, 63, 2080, 65, 3947, 460, 31, 203, 203, 3639, 22893, 288, 203, 5411, 11013, 951, 63, 869, 65, 1011, 460, 31, 203, 3639, 289, 203, 203, 3639, 3626, 12279, 12, 2080, 16, 358, 16, 460, 1769, 203, 203, 3639, 327, 638, 31, 203, 565, 289, 203, 203, 11794, 10365, 4136, 900, 7113, 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 ]
./full_match/1/0xb688801cadb4Ddb6980bb777d42972C24f920855/sources/solidity/contracts/core/VaultController.sol
@notice Returns the ltv of a given token address @param _tokenAddress The address of the token @return _ltv The loan-to-value of a token
function tokenLTV(address _tokenAddress) external view override returns (uint256 _ltv) { _ltv = tokenAddressCollateralInfo[_tokenAddress].ltv; }
9,677,937
[ 1, 1356, 326, 13489, 90, 434, 279, 864, 1147, 1758, 225, 389, 2316, 1887, 1021, 1758, 434, 326, 1147, 327, 389, 5618, 90, 1021, 28183, 17, 869, 17, 1132, 434, 279, 1147, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1147, 12050, 58, 12, 2867, 389, 2316, 1887, 13, 3903, 1476, 3849, 1135, 261, 11890, 5034, 389, 5618, 90, 13, 288, 203, 565, 389, 5618, 90, 273, 1147, 1887, 13535, 2045, 287, 966, 63, 67, 2316, 1887, 8009, 5618, 90, 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 ]
// SPDX-License-Identifier: MIT // forked from http://www.jbonneau.com/doc/BGB17-IEEESB-proof_of_delay_ethereum.pdf pragma solidity ^0.7.3; import "./verifier.sol"; contract Referee { // Should be power of 2 uint8 constant NUM_CHECKPOINTS = 1 << 3; // 8 // Has to be even uint8 constant NUM_ROUNDS = 10; uint256 constant CHALLENGE_RESPONSE_TIMEOUT = 5 minutes; uint256 constant CHALLENGE_PERIOD = 2 hours; struct ChallengeState { uint256 lastChallenge; bytes32[7] checkpoints; bytes32 firstCheckpoint; bytes32 lastCheckpoint; uint8 round; bool initialized; } bytes32 public challenge; // This stores the challenge and the beacon ChallengeState public initialState; mapping(address => ChallengeState) public challenges; address public prover; constructor() { challenge = blockhash(block.number - 1); // Fix for easier debugging } function submitBeacon(bytes32 _beacon, bytes32[7] calldata _checkpoints) public { require(!initialState.initialized, "BEACON_EXISTS"); prover = msg.sender; initialState = ChallengeState(block.timestamp, _checkpoints, challenge, _beacon, 0, true); } function postChallenge( uint8 prevIndex, bytes32[7] calldata _checkpoints, address challenger ) public { require(initialState.initialized, "BEACON_DOES_NOT_EXIST"); require(prevIndex < NUM_CHECKPOINTS - 1, "INDEX_OUT_BOUNDS"); require(block.timestamp - initialState.lastChallenge <= CHALLENGE_PERIOD, "CHALLENGE_EXPIRED"); ChallengeState memory state = challenges[challenger]; if (!state.initialized) { state = ChallengeState( block.timestamp, initialState.checkpoints, initialState.firstCheckpoint, initialState.lastCheckpoint, 0, true ); } require(state.round < NUM_ROUNDS, "STATE_ROUND_GT_NUM_ROUNDS"); require((state.round % 2 != 0) || (msg.sender == challenger), "CHALLENGER_TURN"); require((state.round % 2 != 1) || (msg.sender == prover), "PROVER_TURN"); if (prevIndex > 0) { state.firstCheckpoint = state.checkpoints[prevIndex - 1]; } if (prevIndex < NUM_CHECKPOINTS - 2) { state.lastCheckpoint = state.checkpoints[prevIndex]; } state.checkpoints = _checkpoints; state.round += 1; state.lastChallenge = block.timestamp; challenges[challenger] = state; } function callTimeout() public { // TODO: memory? ChallengeState storage state = challenges[msg.sender]; // Ball must be in prover's court require(state.round % 2 == 1, "NOT_TURN"); // self destruct if enough time elapsed since last challenge if (block.timestamp - state.lastChallenge > CHALLENGE_RESPONSE_TIMEOUT) { selfdestruct(msg.sender); } } function finalChallenge(uint8 prevIndex) public returns (bool verified) { require(prevIndex < NUM_CHECKPOINTS - 1, "INDEX_OUT_BOUNDS"); require(block.timestamp - initialState.lastChallenge <= CHALLENGE_PERIOD, "CHALLENGE_EXPIRED"); address payable challenger = msg.sender; // TODO: memory? ChallengeState storage state = challenges[challenger]; require(state.round == NUM_ROUNDS, "NOT_FINAL"); bytes32 claimedResult; // bytes32 computedResult; bytes32 start; if (prevIndex == 0) { start = state.firstCheckpoint; claimedResult = state.checkpoints[0]; } else if (prevIndex == NUM_CHECKPOINTS - 2) { start = state.checkpoints[prevIndex - 1]; claimedResult = state.lastCheckpoint; } else { start = state.checkpoints[prevIndex - 1]; claimedResult = state.checkpoints[prevIndex]; } verified = Verifier.verify(uint256(start), uint256(claimedResult), uint256(1000000007), uint256(10**4)); if (!verified) { selfdestruct(challenger); } else { delete challenges[challenger]; } } }
TODO: memory? bytes32 computedResult;
function finalChallenge(uint8 prevIndex) public returns (bool verified) { require(prevIndex < NUM_CHECKPOINTS - 1, "INDEX_OUT_BOUNDS"); require(block.timestamp - initialState.lastChallenge <= CHALLENGE_PERIOD, "CHALLENGE_EXPIRED"); address payable challenger = msg.sender; ChallengeState storage state = challenges[challenger]; require(state.round == NUM_ROUNDS, "NOT_FINAL"); bytes32 claimedResult; bytes32 start; if (prevIndex == 0) { start = state.firstCheckpoint; claimedResult = state.checkpoints[0]; start = state.checkpoints[prevIndex - 1]; claimedResult = state.lastCheckpoint; start = state.checkpoints[prevIndex - 1]; claimedResult = state.checkpoints[prevIndex]; } verified = Verifier.verify(uint256(start), uint256(claimedResult), uint256(1000000007), uint256(10**4)); if (!verified) { selfdestruct(challenger); delete challenges[challenger]; } }
5,518,237
[ 1, 6241, 30, 3778, 35, 1731, 1578, 8470, 1253, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 727, 18359, 12, 11890, 28, 2807, 1016, 13, 1071, 1135, 261, 6430, 13808, 13, 288, 203, 565, 2583, 12, 10001, 1016, 411, 9443, 67, 10687, 8941, 55, 300, 404, 16, 315, 9199, 67, 5069, 67, 5315, 2124, 3948, 8863, 203, 565, 2583, 12, 2629, 18, 5508, 300, 2172, 1119, 18, 2722, 18359, 1648, 6469, 1013, 7011, 41, 67, 28437, 16, 315, 1792, 1013, 7011, 41, 67, 18433, 5879, 8863, 203, 203, 565, 1758, 8843, 429, 462, 7862, 693, 273, 1234, 18, 15330, 31, 203, 203, 565, 1680, 8525, 1119, 2502, 919, 273, 462, 7862, 2852, 63, 343, 7862, 693, 15533, 203, 203, 565, 2583, 12, 2019, 18, 2260, 422, 9443, 67, 1457, 2124, 3948, 16, 315, 4400, 67, 7263, 1013, 8863, 203, 203, 565, 1731, 1578, 7516, 329, 1253, 31, 203, 565, 1731, 1578, 787, 31, 203, 203, 565, 309, 261, 10001, 1016, 422, 374, 13, 288, 203, 1377, 787, 273, 919, 18, 3645, 14431, 31, 203, 1377, 7516, 329, 1253, 273, 919, 18, 1893, 4139, 63, 20, 15533, 203, 1377, 787, 273, 919, 18, 1893, 4139, 63, 10001, 1016, 300, 404, 15533, 203, 1377, 7516, 329, 1253, 273, 919, 18, 2722, 14431, 31, 203, 1377, 787, 273, 919, 18, 1893, 4139, 63, 10001, 1016, 300, 404, 15533, 203, 1377, 7516, 329, 1253, 273, 919, 18, 1893, 4139, 63, 10001, 1016, 15533, 203, 565, 289, 203, 203, 565, 13808, 273, 6160, 1251, 18, 8705, 12, 11890, 5034, 12, 1937, 3631, 2254, 5034, 12, 14784, 329, 1253, 3631, 2254, 5034, 12, 21, 12648, 2 ]
// File: @openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol // SPD-License-Identifier: MIT pragma solidity >=0.6.2 <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; // 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); } 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-upgradeable/proxy/Initializable.sol // SPD-License-Identifier: MIT // solhint-disable-next-line compiler-version pragma solidity >=0.4.24 <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 {UpgradeableProxy-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 || _isConstructor() || !_initialized, "Initializable: contract is already 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) { return !AddressUpgradeable.isContract(address(this)); } } // File: @openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol // SPD-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 ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } 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; } uint256[50] private __gap; } // File: @openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol // SPD-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.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. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal initializer { __Context_init_unchained(); __Ownable_init_unchained(); } function __Ownable_init_unchained() internal initializer { 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; } uint256[49] private __gap; } // File: @openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol // SPD-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @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-upgradeable/math/SafeMathUpgradeable.sol // SPD-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 SafeMathUpgradeable { /** * @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-upgradeable/token/ERC20/ERC20Upgradeable.sol // SPD-License-Identifier: MIT 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 ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable { using SafeMathUpgradeable 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. */ function __ERC20_init(string memory name_, string memory symbol_) internal initializer { __Context_init_unchained(); __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer { _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 { } uint256[44] private __gap; } // File: @openzeppelin/contracts-upgradeable/token/ERC20/ERC20BurnableUpgradeable.sol // SPD-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.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). */ abstract contract ERC20BurnableUpgradeable is Initializable, ContextUpgradeable, ERC20Upgradeable { function __ERC20Burnable_init() internal initializer { __Context_init_unchained(); __ERC20Burnable_init_unchained(); } function __ERC20Burnable_init_unchained() internal initializer { } using SafeMathUpgradeable for uint256; /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), decreasedAllowance); _burn(account, amount); } uint256[50] private __gap; } // File: contracts/XTokenClonable.sol // SPD-License-Identifier: MIT pragma solidity 0.6.8; contract XTokenClonable is OwnableUpgradeable, ERC20BurnableUpgradeable { function initialize(string memory name, string memory symbol) public initializer { __Ownable_init(); __ERC20_init(name, symbol); __ERC20Burnable_init_unchained(); } function mint(address to, uint256 amount) public onlyOwner { _mint(to, amount); } }
* @dev Interface of the ERC20 standard as defined in the EIP./
interface IERC20Upgradeable { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); }
482,555
[ 1, 1358, 434, 326, 4232, 39, 3462, 4529, 487, 2553, 316, 326, 512, 2579, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 3462, 10784, 429, 288, 203, 565, 445, 2078, 3088, 1283, 1435, 3903, 1476, 1135, 261, 11890, 5034, 1769, 203, 203, 565, 445, 11013, 951, 12, 2867, 2236, 13, 3903, 1476, 1135, 261, 11890, 5034, 1769, 203, 203, 565, 445, 7412, 12, 2867, 8027, 16, 2254, 5034, 3844, 13, 3903, 1135, 261, 6430, 1769, 203, 203, 565, 445, 1699, 1359, 12, 2867, 3410, 16, 1758, 17571, 264, 13, 3903, 1476, 1135, 261, 11890, 5034, 1769, 203, 203, 565, 445, 6617, 537, 12, 2867, 17571, 264, 16, 2254, 5034, 3844, 13, 3903, 1135, 261, 6430, 1769, 203, 203, 565, 445, 7412, 1265, 12, 2867, 5793, 16, 1758, 8027, 16, 2254, 5034, 3844, 13, 3903, 1135, 261, 6430, 1769, 203, 203, 565, 871, 12279, 12, 2867, 8808, 628, 16, 1758, 8808, 358, 16, 2254, 5034, 460, 1769, 203, 203, 565, 871, 1716, 685, 1125, 12, 2867, 8808, 3410, 16, 1758, 8808, 17571, 264, 16, 2254, 5034, 460, 1769, 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 ]
./full_match/1/0xA373f8a0c75E2315444079C3745BCC97653B0bD5/sources/ctls/YieldVault.sol
Single WETH => Double
uint128 pFee0;
5,012,689
[ 1, 5281, 678, 1584, 44, 516, 3698, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 2254, 10392, 293, 14667, 20, 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 ]
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; import "./token/ERC20/ERC20.sol"; import "./utils/Staking.sol"; import "./access/Ownable.sol"; // interface Aion contract Aion { uint256 public serviceFee; function ScheduleCall(uint256 blocknumber, address to, uint256 value, uint256 gaslimit, uint256 gasprice, bytes memory data, bool schedType) public payable returns (uint,address){ } } /** * This contract is ownable and create a custom subcoin. */ contract subVoltaCoin is ERC20, Ownable{ constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol){ _mint(msg.sender, 100000000000000000000000); } function transferFromOwner(address recipient, uint256 amount) public onlyOwner{ //transferFrom(owner(), recipient, amount); _mint(recipient, amount); } } /** * This create a main token contract. */ contract VoltaCoin is ERC20, Ownable { uint104 private percent; address eVLT_address; address iVLT_address; address sVLT_address; address tVLT_address; /** * Constructor contain: * * percent: reward percentage; * * Subcoins contract creation; * * Subcoins contract addresses; */ constructor() ERC20("VoltaCoin", "VOLTA") { percent = 80; _mint(msg.sender, 100000000000000000000000); subVoltaCoin eVLT = new subVoltaCoin("EoloCoin", "eVLT"); subVoltaCoin iVLT = new subVoltaCoin("IdroCoin", "iVLT"); subVoltaCoin sVLT = new subVoltaCoin("SunlightCoin", "sVLT"); subVoltaCoin tVLT = new subVoltaCoin("ThermoCoin", "tVLT"); eVLT_address = address(eVLT); iVLT_address = address(iVLT); sVLT_address = address(sVLT); tVLT_address = address(tVLT); } // Stakeholder variable in library Stake.Stakeholders[] stakes; /** * This override ERC20 function, adding the staking mechanism that * add or remove staking by sending or receiving main token amount * to the owner. */ function transferFrom(address _sender, address _recipient, uint256 _amount) virtual override public returns(bool){ if(_recipient == owner()){ if(_amount > 100){ Stake.addStake(_sender, _amount, stakes); } if(_amount <= 100){ (bool _isStakeholder, uint256 _s) = Stake.isStakeholder(_sender, stakes); if(_isStakeholder){ _transfer(owner(),_sender, _s); Stake.removeStake(_sender, stakes, 0); } } } } // This edit reward percentage function percentRewardSetup(uint104 _percent) private{ percent = _percent; } function transferSubOwnership(address _address) public onlyOwner returns (bool status){ (bool st1, ) = eVLT_address.call(abi.encodeWithSignature("transferOwnership(address)",_address)); (bool st2, ) = iVLT_address.call(abi.encodeWithSignature("transferOwnership(address)",_address)); (bool st3, ) = sVLT_address.call(abi.encodeWithSignature("transferOwnership(address)",_address)); (bool st4, ) = tVLT_address.call(abi.encodeWithSignature("transferOwnership(address)",_address)); if(!st1 || !st2 || !st3 || !st4){ status = false; } return status; } /** * This function is for aion scheduling. Contract Addresses MainNet 0xCBe7AB529A147149b1CF982C3a169f728bC0C3CA Ropsten 0xFcFB45679539667f7ed55FA59A15c8Cad73d9a4E Rinkeby 0xeFc1d6479e529D9e7C359fbD16B31D405778CE6e Kovan 0x2fC197cD7897f41957F72e8E390d5a7cF2858CBF */ function schedule_rqsr() public payable { Aion aion = Aion(0xFcFB45679539667f7ed55FA59A15c8Cad73d9a4E); bytes memory data = abi.encodeWithSelector(bytes4(keccak256('sendReward()'))); uint callCost = 200000*1e9 + aion.serviceFee(); aion.ScheduleCall{value:callCost}( block.timestamp + 1 days, address(this), 0, 200000, 1e9, data, true); } /** * This function send rewards to stakeholders and return a status. */ function sendReward() public onlyOwner returns(bool status){ for (uint256 s = 0; s < stakes.length; s = s++){ address _address = stakes[s]._address; uint256 reward = Stake.calculateReward(stakes[s]._stake, percent); if(block.timestamp >= (stakes[s]._rewardDate + 30 days)){ (bool st1, ) = eVLT_address.call(abi.encodeWithSignature("transferFromOwner(address, uint256)",_address, reward)); (bool st2, ) = iVLT_address.call(abi.encodeWithSignature("transferFromOwner(address, uint256)",_address, reward)); (bool st3, ) = sVLT_address.call(abi.encodeWithSignature("transferFromOwner(address, uint256)",_address, reward)); (bool st4, ) = tVLT_address.call(abi.encodeWithSignature("transferFromOwner(address, uint256)",_address, reward)); stakes[s]._rewardDate = block.timestamp; if(!st1 || !st2 || !st3 || !st4){ status = false; } } } return status; } }
Stakeholder variable in library
Stake.Stakeholders[] stakes;
6,363,841
[ 1, 510, 911, 4505, 2190, 316, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 934, 911, 18, 510, 911, 9000, 8526, 384, 3223, 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 ]
// 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 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 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 Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @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 "../IERC20Upgradeable.sol"; import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable { using AddressUpgradeable for address; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20Upgradeable 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( IERC20Upgradeable token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20Upgradeable 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( IERC20Upgradeable 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(IERC20Upgradeable token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT 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; /** * @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: MIT 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() { _setOwner(_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 { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "../beacon/IBeacon.sol"; import "../../utils/Address.sol"; import "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967Upgrade { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @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 Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallSecure( address newImplementation, bytes memory data, bool forceCall ) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call _setImplementation(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } // Perform rollback test if not already in progress StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT); if (!rollbackTesting.value) { // Trigger rollback using upgradeTo from the new implementation rollbackTesting.value = true; Address.functionDelegateCall( newImplementation, abi.encodeWithSignature("upgradeTo(address)", oldImplementation) ); rollbackTesting.value = false; // Check rollback was effective require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades"); // Finally reset to the new implementation and log the upgrade _upgradeTo(newImplementation); } } /** * @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 Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { 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 This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IBeacon.sol"; import "../Proxy.sol"; import "../ERC1967/ERC1967Upgrade.sol"; /** * @dev This contract implements a proxy that gets the implementation address for each call from a {UpgradeableBeacon}. * * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't * conflict with the storage layout of the implementation behind the proxy. * * _Available since v3.4._ */ contract BeaconProxy is Proxy, ERC1967Upgrade { /** * @dev Initializes the proxy with `beacon`. * * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This * will typically be an encoded function call, and allows initializating the storage of the proxy like a Solidity * constructor. * * Requirements: * * - `beacon` must be a contract with the interface {IBeacon}. */ constructor(address beacon, bytes memory data) payable { assert(_BEACON_SLOT == bytes32(uint256(keccak256("eip1967.proxy.beacon")) - 1)); _upgradeBeaconToAndCall(beacon, data, false); } /** * @dev Returns the current beacon address. */ function _beacon() internal view virtual returns (address) { return _getBeacon(); } /** * @dev Returns the current implementation address of the associated beacon. */ function _implementation() internal view virtual override returns (address) { return IBeacon(_getBeacon()).implementation(); } /** * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}. * * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. * * Requirements: * * - `beacon` must be a contract. * - The implementation returned by `beacon` must be a contract. */ function _setBeacon(address beacon, bytes memory data) internal virtual { _upgradeBeaconToAndCall(beacon, data, false); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IBeacon.sol"; import "../../access/Ownable.sol"; import "../../utils/Address.sol"; /** * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their * implementation contract, which is where they will delegate all function calls. * * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon. */ contract UpgradeableBeacon is IBeacon, Ownable { address private _implementation; /** * @dev Emitted when the implementation returned by the beacon is changed. */ event Upgraded(address indexed implementation); /** * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the * beacon. */ constructor(address implementation_) { _setImplementation(implementation_); } /** * @dev Returns the current implementation address. */ function implementation() public view virtual override returns (address) { return _implementation; } /** * @dev Upgrades the beacon to a new implementation. * * Emits an {Upgraded} event. * * Requirements: * * - msg.sender must be the owner of the contract. * - `newImplementation` must be a contract. */ function upgradeTo(address newImplementation) public virtual onlyOwner { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Sets the implementation contract address for this beacon * * Requirements: * * - `newImplementation` must be a contract. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "UpgradeableBeacon: implementation is not a contract"); _implementation = newImplementation; } } // 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"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // SPDX-License-Identifier: MIT 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 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 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 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; 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 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 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 pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } } // 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 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: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "./interfaces/IListing.sol"; import "./interfaces/IRegistry.sol"; import "./interfaces/IIRO.sol"; import "./interfaces/IBuyout.sol"; /// @notice This contract represents a single property listing that initially can undergo fractionalization (IRO). After the whole IRO process completes, this contract allows buyouts to start. contract Listing is IListing, Initializable, AccessControlUpgradeable, IERC721Receiver { using SafeERC20Upgradeable for IERC20Upgradeable; /// Emitted for each off-chain(e.g. IPFS) metadata/media update event NewMedia(Status status, uint256 network, bytes32 hash); /// Emitted for _some_ status changes /// @notice `status()` should be checked for up-to-date status event Update(Status status); /// Escrow address has been set event EscrowSet(address escrow); /// IRO started /// @notice IRO details can be fetched from IRO contract event IROStart(address iro); /// NFT Registered event NFTRegister(address addr, uint256 id); IRegistry internal _registry; // contracts registry address public owner; // user that added this listing bytes32 public name; // short name (up to 32 bytes) bytes32 public tokenName; // listing token name (up to 32 bytes) bytes16 public tokenSymbol; // listing token symbol (up to 16 bytes) IERC20Metadata public fundingToken; // ERC20 token used for funding uint8 internal _fundingTokenDecimals; // ERC20 funding token decimals() uint256 public softCap; // minimum goal in fundingTokens uint256 public hardCap; // maximum goal in fundingTokens uint256 public fundingDurationSeconds; // Start to end of IRO in seconds uint256 public expiryDurationSeconds; // Start to fail-safe funds distribution in seconds IERC721Metadata public nftAddr; // NFT representing the property uint256 public nftID; // (i.e. holder represents creditor) IERC20 public listingToken; // ERC20 token used for fractionalization address internal _escrow; // on IRO success, only this address can claim funds IIRO public iro; IBuyout[] public buyouts; bytes32 public constant DIRECTOR_ROLE = keccak256("DIRECTOR_ROLE"); bytes32 public constant DUE_DILIGENCE_ROLE = keccak256("DUE_DILIGENCE_ROLE"); bytes32 public constant ESCROW_ROLE = keccak256("ESCROW_ROLE"); // Role is and sets escrow wallet address bytes32 public constant ESCROW_ADMIN_ROLE = keccak256("ESCROW_ADMIN_ROLE"); // Grants ESCROW_ROLE to escrow address uint256 public constant FEE_BASIS_POINTS = 200; modifier onlyStatus(IListing.Status s) { require(status() == s, "WRONG_LISTING_STAGE"); _; } modifier onlyIROStatus(IIRO.Status s) { require(iro.status() == s, "WRONG_IRO_STAGE"); _; } function initialize( IRegistry registry, address _owner, bytes32 _name, bytes32 _tokenName, bytes32 _tokenSymbol, address _fundingToken, uint256 _softCap, uint256 _hardCap, uint256 _fundingDurationSeconds, uint256 _expiryDurationSeconds ) public { require( _fundingDurationSeconds < _expiryDurationSeconds, "INVALID_DURATIONS" ); require(_softCap <= _hardCap, "INVALID_CAPS"); __AccessControl_init(); _registry = registry; owner = _owner; name = _name; tokenName = bytes16(_tokenName); tokenSymbol = bytes8(_tokenSymbol); fundingToken = IERC20Metadata(_fundingToken); _fundingTokenDecimals = fundingToken.decimals(); // fail if extension missing softCap = _softCap; hardCap = _hardCap; fundingDurationSeconds = _fundingDurationSeconds; expiryDurationSeconds = _expiryDurationSeconds; _setupRole(DEFAULT_ADMIN_ROLE, _owner); _setRoleAdmin(ESCROW_ROLE, ESCROW_ADMIN_ROLE); } /// @notice Current status of listing. Note that in the `BUYOUT` state, the Buyout contract should be checked if an initial offer has been made function status() public view returns (Status s) { if (address(iro) == address(0)) { s = Status.NEW; } else if (iro.status() != IIRO.Status.DISTRIBUTION) { s = Status.IRO; } else if (buyouts.length == 0) { s = Status.LIVE; } else { IBuyout.Status buyoutStatus = buyouts[buyouts.length - 1].status(); if ( buyoutStatus == IBuyout.Status.NEW || buyoutStatus == IBuyout.Status.OPEN ) { s = Status.BUYOUT; } else if (buyoutStatus == IBuyout.Status.SUCCESS) { s = Status.REDEEMED; } else { s = Status.LIVE; } } } /// @notice Publish a hash corresponding to an off-chain document. Currently only IPFS is defined as `network` = 1. By convention, this document is a JSON file that may link to other IPFS media, e.g. images /// @param network Network where document is hosted (currently only IPFS) /// @param hash Hash identifying document on network /// @custom:role-due-diligence function publishMedia(uint256 network, bytes32 hash) public onlyRole(DUE_DILIGENCE_ROLE) { emit NewMedia(status(), network, hash); } /// @notice Sets the Escrow address by interacting with the contract to prove liveness. ESCROW_ROLE required (ESCROW_ADMIN_ROLE can grant this role) /// @custom:role-escrow function setEscrowAddress() public onlyRole(ESCROW_ROLE) onlyStatus(Status.NEW) { _escrow = msg.sender; emit EscrowSet(msg.sender); } /// @notice Start IRO, Escrow address must be provided as confirmation the address correct. /// @param escrow Only this address can withdraw successful IRO funds /// @custom:role-due-diligence function startIRO(address escrow) public onlyRole(DUE_DILIGENCE_ROLE) onlyStatus(Status.NEW) { require(escrow != address(0) && escrow == _escrow, "ESCROW_INVALID"); BeaconProxy proxy = new BeaconProxy( address(_registry.iroBeacon()), abi.encodeWithSignature( "initialize(address,uint256,uint256,uint256,uint256,address)", fundingToken, softCap, hardCap, fundingDurationSeconds, expiryDurationSeconds, escrow ) ); iro = IIRO(address(proxy)); emit Update(Status.IRO); } /// @notice Register the NFT that represents the property. /// @param addr NFT contract address /// @param id NFT ID /// @custom:role-director function registerNFT(IERC721Metadata addr, uint256 id) public onlyRole(DIRECTOR_ROLE) onlyIROStatus(IIRO.Status.AWAITING_TOKENS) { nftAddr = addr; nftID = id; emit NFTRegister(address(addr), id); } /// Start distribution phase of IRO function onERC721Received( address, address, uint256 tokenId, bytes memory ) public override returns (bytes4 selector) { require(address(nftAddr) == msg.sender, "BAD_NFT_ADDR"); require(nftID == tokenId, "BAD_NFT_ID"); require(address(this) == nftAddr.ownerOf(nftID), "BAD_NFT_OWNER"); _fractionalize(); iro.enableDistribution(IERC20Upgradeable(address(listingToken))); selector = this.onERC721Received.selector; emit Update(Status.LIVE); } /// @notice Start a buyout, proposer must then interact with the Buyout contract function startBuyout() public onlyStatus(Status.LIVE) { BeaconProxy proxy = new BeaconProxy( address(_registry.buyoutBeacon()), abi.encodeWithSignature( "initialize(address,address)", listingToken, fundingToken ) ); IBuyout buyout = IBuyout(address(proxy)); buyouts.push(buyout); emit Update(Status.BUYOUT); } /// @notice Claim underlying NFT upon a successful buyout function claimNFT() public onlyStatus(Status.REDEEMED) { require( msg.sender == buyouts[buyouts.length - 1].offerer(), "NOT_OFFERER" ); nftAddr.safeTransferFrom(address(this), msg.sender, nftID); emit Update(Status.REDEEMED); } function _fractionalize() internal { require(address(listingToken) == address(0), "ALREADY_FRACTIONALIZED"); // CitaDAO's listing token fees (1.96% of total) uint256 fee = (hardCap * FEE_BASIS_POINTS) / 10000; BeaconProxy proxy = new BeaconProxy( address(_registry.brickTokenBeacon()), abi.encodeWithSignature( "initialize(string,string,uint8,uint256)", string(abi.encodePacked(tokenName)), string(abi.encodePacked(tokenSymbol)), _fundingTokenDecimals, hardCap + fee ) ); listingToken = IERC20(address(proxy)); require( listingToken.transfer(_registry.treasuryAddr(), fee), "LISTING_TOKEN_FEE_TRANSFER_FAIL" ); require( listingToken.transfer(address(iro), hardCap), "LISTING_TOKEN_IRO_TRANSFER_FAIL" ); } function numBuyouts() public view returns (uint256) { return buyouts.length; } } // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IBuyout { enum Status { NEW, // Buyout not offered yet OPEN, // Buyout offer is currently open COUNTERED, // Fails, counter-offerers can claim listing tokens SUCCESS // Success, listing token holders can surrender tokens in exchange for funding token } function status() external view returns (IBuyout.Status s); function offerer() external returns (address); } // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; interface IIRO { enum Status { FUNDING, // Listing is being funded FAILED, // Goal not reached, contributors can pull funds AWAITING_TOKENS, // Awaiting tokens for distribution DISTRIBUTION // Success, contributors can pull tokens, owner can pull funds } function status() external view returns (IIRO.Status s); function enableDistribution(IERC20Upgradeable _listingToken) external; } // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IListing { enum Status { NEW, // Just listed IRO, // IRO phase of listing LIVE, // IRO over and not in a buyout BUYOUT, // Buyout in progress REDEEMED // Buyout successful } } // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IRegistry { function listingBeacon() external returns (UpgradeableBeacon); function brickTokenBeacon() external returns (UpgradeableBeacon); function buyoutBeacon() external returns (UpgradeableBeacon); function iroBeacon() external returns (UpgradeableBeacon); function propNFT() external returns (IERC721); function treasuryAddr() external returns (address); }
listing token name (up to 32 bytes)
bytes32 public tokenName;
10,429,254
[ 1, 21228, 1147, 508, 261, 416, 358, 3847, 1731, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1731, 1578, 1071, 1147, 461, 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 ]
// Sources flattened with hardhat v2.8.3 https://hardhat.org // File contracts/Interfaces/IBorrowerOperations.sol // SPDX-License-Identifier: pragma solidity 0.6.11; // Common interface for the Trove Manager. interface IBorrowerOperations { // --- Events --- event TroveManagerAddressChanged(address _newTroveManagerAddress); event ActivePoolAddressChanged(address _activePoolAddress); event DefaultPoolAddressChanged(address _defaultPoolAddress); event StabilityPoolAddressChanged(address _stabilityPoolAddress); event GasPoolAddressChanged(address _gasPoolAddress); event CollSurplusPoolAddressChanged(address _collSurplusPoolAddress); event PriceFeedAddressChanged(address _newPriceFeedAddress); event SortedTrovesAddressChanged(address _sortedTrovesAddress); event LUSDTokenAddressChanged(address _lusdTokenAddress); event LQTYStakingAddressChanged(address _lqtyStakingAddress); event TroveCreated(address indexed _borrower, uint arrayIndex); event TroveUpdated(address indexed _borrower, uint _debt, uint _coll, uint stake, uint8 operation); event LUSDBorrowingFeePaid(address indexed _borrower, uint _LUSDFee); // --- Functions --- function setAddresses( address _troveManagerAddress, address _activePoolAddress, address _defaultPoolAddress, address _stabilityPoolAddress, address _gasPoolAddress, address _collSurplusPoolAddress, address _priceFeedAddress, address _sortedTrovesAddress, address _lusdTokenAddress, address _lqtyStakingAddress ) external; function openTrove(uint _maxFee, uint _LUSDAmount, address _upperHint, address _lowerHint) external payable; function addColl(address _upperHint, address _lowerHint) external payable; function moveETHGainToTrove(address _user, address _upperHint, address _lowerHint) external payable; function withdrawColl(uint _amount, address _upperHint, address _lowerHint) external; function withdrawLUSD(uint _maxFee, uint _amount, address _upperHint, address _lowerHint) external; function repayLUSD(uint _amount, address _upperHint, address _lowerHint) external; function closeTrove() external; function adjustTrove(uint _maxFee, uint _collWithdrawal, uint _debtChange, bool isDebtIncrease, address _upperHint, address _lowerHint) external payable; function claimCollateral() external; function getCompositeDebt(uint _debt) external pure returns (uint); } // File contracts/Interfaces/IStabilityPool.sol // MIT pragma solidity 0.6.11; /* * The Stability Pool holds LUSD tokens deposited by Stability Pool depositors. * * When a trove is liquidated, then depending on system conditions, some of its LUSD debt gets offset with * LUSD in the Stability Pool: that is, the offset debt evaporates, and an equal amount of LUSD tokens in the Stability Pool is burned. * * Thus, a liquidation causes each depositor to receive a LUSD loss, in proportion to their deposit as a share of total deposits. * They also receive an ETH gain, as the ETH collateral of the liquidated trove is distributed among Stability depositors, * in the same proportion. * * When a liquidation occurs, it depletes every deposit by the same fraction: for example, a liquidation that depletes 40% * of the total LUSD in the Stability Pool, depletes 40% of each deposit. * * A deposit that has experienced a series of liquidations is termed a "compounded deposit": each liquidation depletes the deposit, * multiplying it by some factor in range ]0,1[ * * Please see the implementation spec in the proof document, which closely follows on from the compounded deposit / ETH gain derivations: * https://github.com/liquity/liquity/blob/master/papers/Scalable_Reward_Distribution_with_Compounding_Stakes.pdf * * --- LQTY ISSUANCE TO STABILITY POOL DEPOSITORS --- * * An LQTY issuance event occurs at every deposit operation, and every liquidation. * * Each deposit is tagged with the address of the front end through which it was made. * * All deposits earn a share of the issued LQTY in proportion to the deposit as a share of total deposits. The LQTY earned * by a given deposit, is split between the depositor and the front end through which the deposit was made, based on the front end's kickbackRate. * * Please see the system Readme for an overview: * https://github.com/liquity/dev/blob/main/README.md#lqty-issuance-to-stability-providers */ interface IStabilityPool { // --- Events --- event StabilityPoolETHBalanceUpdated(uint _newBalance); event StabilityPoolLUSDBalanceUpdated(uint _newBalance); event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress); event TroveManagerAddressChanged(address _newTroveManagerAddress); event ActivePoolAddressChanged(address _newActivePoolAddress); event DefaultPoolAddressChanged(address _newDefaultPoolAddress); event LUSDTokenAddressChanged(address _newLUSDTokenAddress); event SortedTrovesAddressChanged(address _newSortedTrovesAddress); event PriceFeedAddressChanged(address _newPriceFeedAddress); event CommunityIssuanceAddressChanged(address _newCommunityIssuanceAddress); event P_Updated(uint _P); event S_Updated(uint _S, uint128 _epoch, uint128 _scale); event G_Updated(uint _G, uint128 _epoch, uint128 _scale); event EpochUpdated(uint128 _currentEpoch); event ScaleUpdated(uint128 _currentScale); event FrontEndRegistered(address indexed _frontEnd, uint _kickbackRate); event FrontEndTagSet(address indexed _depositor, address indexed _frontEnd); event DepositSnapshotUpdated(address indexed _depositor, uint _P, uint _S, uint _G); event FrontEndSnapshotUpdated(address indexed _frontEnd, uint _P, uint _G); event UserDepositChanged(address indexed _depositor, uint _newDeposit); event FrontEndStakeChanged(address indexed _frontEnd, uint _newFrontEndStake, address _depositor); event ETHGainWithdrawn(address indexed _depositor, uint _ETH, uint _LUSDLoss); event LQTYPaidToDepositor(address indexed _depositor, uint _LQTY); event LQTYPaidToFrontEnd(address indexed _frontEnd, uint _LQTY); event EtherSent(address _to, uint _amount); // --- Functions --- /* * Called only once on init, to set addresses of other Liquity contracts * Callable only by owner, renounces ownership at the end */ function setAddresses( address _borrowerOperationsAddress, address _troveManagerAddress, address _activePoolAddress, address _lusdTokenAddress, address _sortedTrovesAddress, address _priceFeedAddress, address _communityIssuanceAddress ) external; /* * Initial checks: * - Frontend is registered or zero address * - Sender is not a registered frontend * - _amount is not zero * --- * - Triggers a LQTY issuance, based on time passed since the last issuance. The LQTY issuance is shared between *all* depositors and front ends * - Tags the deposit with the provided front end tag param, if it's a new deposit * - Sends depositor's accumulated gains (LQTY, ETH) to depositor * - Sends the tagged front end's accumulated LQTY gains to the tagged front end * - Increases deposit and tagged front end's stake, and takes new snapshots for each. */ function provideToSP(uint _amount, address _frontEndTag) external; /* * Initial checks: * - _amount is zero or there are no under collateralized troves left in the system * - User has a non zero deposit * --- * - Triggers a LQTY issuance, based on time passed since the last issuance. The LQTY issuance is shared between *all* depositors and front ends * - Removes the deposit's front end tag if it is a full withdrawal * - Sends all depositor's accumulated gains (LQTY, ETH) to depositor * - Sends the tagged front end's accumulated LQTY gains to the tagged front end * - Decreases deposit and tagged front end's stake, and takes new snapshots for each. * * If _amount > userDeposit, the user withdraws all of their compounded deposit. */ function withdrawFromSP(uint _amount) external; /* * Initial checks: * - User has a non zero deposit * - User has an open trove * - User has some ETH gain * --- * - Triggers a LQTY issuance, based on time passed since the last issuance. The LQTY issuance is shared between *all* depositors and front ends * - Sends all depositor's LQTY gain to depositor * - Sends all tagged front end's LQTY gain to the tagged front end * - Transfers the depositor's entire ETH gain from the Stability Pool to the caller's trove * - Leaves their compounded deposit in the Stability Pool * - Updates snapshots for deposit and tagged front end stake */ function withdrawETHGainToTrove(address _upperHint, address _lowerHint) external; /* * Initial checks: * - Frontend (sender) not already registered * - User (sender) has no deposit * - _kickbackRate is in the range [0, 100%] * --- * Front end makes a one-time selection of kickback rate upon registering */ function registerFrontEnd(uint _kickbackRate) external; /* * Initial checks: * - Caller is TroveManager * --- * Cancels out the specified debt against the LUSD contained in the Stability Pool (as far as possible) * and transfers the Trove's ETH collateral from ActivePool to StabilityPool. * Only called by liquidation functions in the TroveManager. */ function offset(uint _debt, uint _coll) external; /* * Returns the total amount of ETH held by the pool, accounted in an internal variable instead of `balance`, * to exclude edge cases like ETH received from a self-destruct. */ function getETH() external view returns (uint); /* * Returns LUSD held in the pool. Changes when users deposit/withdraw, and when Trove debt is offset. */ function getTotalLUSDDeposits() external view returns (uint); /* * Calculates the ETH gain earned by the deposit since its last snapshots were taken. */ function getDepositorETHGain(address _depositor) external view returns (uint); /* * Calculate the LQTY gain earned by a deposit since its last snapshots were taken. * If not tagged with a front end, the depositor gets a 100% cut of what their deposit earned. * Otherwise, their cut of the deposit's earnings is equal to the kickbackRate, set by the front end through * which they made their deposit. */ function getDepositorLQTYGain(address _depositor) external view returns (uint); /* * Return the LQTY gain earned by the front end. */ function getFrontEndLQTYGain(address _frontEnd) external view returns (uint); /* * Return the user's compounded deposit. */ function getCompoundedLUSDDeposit(address _depositor) external view returns (uint); /* * Return the front end's compounded stake. * * The front end's compounded stake is equal to the sum of its depositors' compounded deposits. */ function getCompoundedFrontEndStake(address _frontEnd) external view returns (uint); /* * Fallback function * Only callable by Active Pool, it just accounts for ETH received * receive() external payable; */ } // File contracts/Interfaces/IPriceFeed.sol // MIT pragma solidity 0.6.11; interface IPriceFeed { // --- Events --- event LastGoodPriceUpdated(uint _lastGoodPrice); // --- Function --- function fetchPrice() external returns (uint); } // File contracts/Interfaces/ILiquityBase.sol // MIT pragma solidity 0.6.11; interface ILiquityBase { function priceFeed() external view returns (IPriceFeed); } // File contracts/Dependencies/IERC20.sol // MIT pragma solidity 0.6.11; /** * Based on the OpenZeppelin IER20 interface: * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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); function increaseAllowance(address spender, uint256 addedValue) external returns (bool); function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool); /** * @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); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); /** * @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/Dependencies/IERC2612.sol // MIT pragma solidity 0.6.11; /** * @dev Interface of the ERC2612 standard as defined in the EIP. * * Adds the {permit} method, which can be used to change one's * {IERC20-allowance} without having to send a transaction, by signing a * message. This allows users to spend tokens without having to hold Ether. * * See https://eips.ethereum.org/EIPS/eip-2612. * * Code adapted from https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2237/ */ interface IERC2612 { /** * @dev Sets `amount` 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: * * - `owner` cannot be the zero address. * - `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 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external; /** * @dev Returns the current ERC2612 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. * * `owner` can limit the time a Permit is valid for by setting `deadline` to * a value in the near future. The deadline argument can be set to uint(-1) to * create Permits that effectively never expire. */ function nonces(address owner) external view returns (uint256); function version() external view returns (string memory); function permitTypeHash() external view returns (bytes32); function domainSeparator() external view returns (bytes32); } // File contracts/Interfaces/ILUSDToken.sol // MIT pragma solidity 0.6.11; interface ILUSDToken is IERC20, IERC2612 { // --- Events --- event TroveManagerAddressChanged(address _troveManagerAddress); event StabilityPoolAddressChanged(address _newStabilityPoolAddress); event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress); event LUSDTokenBalanceUpdated(address _user, uint _amount); // --- Functions --- function mint(address _account, uint256 _amount) external; function burn(address _account, uint256 _amount) external; function sendToPool(address _sender, address poolAddress, uint256 _amount) external; function returnFromPool(address poolAddress, address user, uint256 _amount ) external; } // File contracts/Interfaces/ILQTYToken.sol // MIT pragma solidity 0.6.11; interface ILQTYToken is IERC20, IERC2612 { // --- Events --- event CommunityIssuanceAddressSet(address _communityIssuanceAddress); event LQTYStakingAddressSet(address _lqtyStakingAddress); event LockupContractFactoryAddressSet(address _lockupContractFactoryAddress); // --- Functions --- function sendToLQTYStaking(address _sender, uint256 _amount) external; function getDeploymentStartTime() external view returns (uint256); function getLpRewardsEntitlement() external view returns (uint256); } // File contracts/Interfaces/ILQTYStaking.sol // MIT pragma solidity 0.6.11; interface ILQTYStaking { // --- Events -- event LQTYTokenAddressSet(address _lqtyTokenAddress); event LUSDTokenAddressSet(address _lusdTokenAddress); event TroveManagerAddressSet(address _troveManager); event BorrowerOperationsAddressSet(address _borrowerOperationsAddress); event ActivePoolAddressSet(address _activePoolAddress); event StakeChanged(address indexed staker, uint newStake); event StakingGainsWithdrawn(address indexed staker, uint LUSDGain, uint ETHGain); event F_ETHUpdated(uint _F_ETH); event F_LUSDUpdated(uint _F_LUSD); event TotalLQTYStakedUpdated(uint _totalLQTYStaked); event EtherSent(address _account, uint _amount); event StakerSnapshotsUpdated(address _staker, uint _F_ETH, uint _F_LUSD); // --- Functions --- function setAddresses ( address _lqtyTokenAddress, address _lusdTokenAddress, address _troveManagerAddress, address _borrowerOperationsAddress, address _activePoolAddress ) external; function stake(uint _LQTYamount) external; function unstake(uint _LQTYamount) external; function increaseF_ETH(uint _ETHFee) external; function increaseF_LUSD(uint _LQTYFee) external; function getPendingETHGain(address _user) external view returns (uint); function getPendingLUSDGain(address _user) external view returns (uint); } // File contracts/Interfaces/ITroveManager.sol // MIT pragma solidity 0.6.11; // Common interface for the Trove Manager. interface ITroveManager is ILiquityBase { // --- Events --- event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress); event PriceFeedAddressChanged(address _newPriceFeedAddress); event LUSDTokenAddressChanged(address _newLUSDTokenAddress); event ActivePoolAddressChanged(address _activePoolAddress); event DefaultPoolAddressChanged(address _defaultPoolAddress); event StabilityPoolAddressChanged(address _stabilityPoolAddress); event GasPoolAddressChanged(address _gasPoolAddress); event CollSurplusPoolAddressChanged(address _collSurplusPoolAddress); event SortedTrovesAddressChanged(address _sortedTrovesAddress); event LQTYTokenAddressChanged(address _lqtyTokenAddress); event LQTYStakingAddressChanged(address _lqtyStakingAddress); event Liquidation(uint _liquidatedDebt, uint _liquidatedColl, uint _collGasCompensation, uint _LUSDGasCompensation); event Redemption(uint _attemptedLUSDAmount, uint _actualLUSDAmount, uint _ETHSent, uint _ETHFee); event TroveUpdated(address indexed _borrower, uint _debt, uint _coll, uint stake, uint8 operation); event TroveLiquidated(address indexed _borrower, uint _debt, uint _coll, uint8 operation); event BaseRateUpdated(uint _baseRate); event LastFeeOpTimeUpdated(uint _lastFeeOpTime); event TotalStakesUpdated(uint _newTotalStakes); event SystemSnapshotsUpdated(uint _totalStakesSnapshot, uint _totalCollateralSnapshot); event LTermsUpdated(uint _L_ETH, uint _L_LUSDDebt); event TroveSnapshotsUpdated(uint _L_ETH, uint _L_LUSDDebt); event TroveIndexUpdated(address _borrower, uint _newIndex); // --- Functions --- function setAddresses( address _borrowerOperationsAddress, address _activePoolAddress, address _defaultPoolAddress, address _stabilityPoolAddress, address _gasPoolAddress, address _collSurplusPoolAddress, address _priceFeedAddress, address _lusdTokenAddress, address _sortedTrovesAddress, address _lqtyTokenAddress, address _lqtyStakingAddress ) external; function stabilityPool() external view returns (IStabilityPool); function lusdToken() external view returns (ILUSDToken); function lqtyToken() external view returns (ILQTYToken); function lqtyStaking() external view returns (ILQTYStaking); function getTroveOwnersCount() external view returns (uint); function getTroveFromTroveOwnersArray(uint _index) external view returns (address); function getNominalICR(address _borrower) external view returns (uint); function getCurrentICR(address _borrower, uint _price) external view returns (uint); function liquidate(address _borrower) external; function liquidateTroves(uint _n) external; function batchLiquidateTroves(address[] calldata _troveArray) external; function redeemCollateral( uint _LUSDAmount, address _firstRedemptionHint, address _upperPartialRedemptionHint, address _lowerPartialRedemptionHint, uint _partialRedemptionHintNICR, uint _maxIterations, uint _maxFee ) external; function updateStakeAndTotalStakes(address _borrower) external returns (uint); function updateTroveRewardSnapshots(address _borrower) external; function addTroveOwnerToArray(address _borrower) external returns (uint index); function applyPendingRewards(address _borrower) external; function getPendingETHReward(address _borrower) external view returns (uint); function getPendingLUSDDebtReward(address _borrower) external view returns (uint); function hasPendingRewards(address _borrower) external view returns (bool); function getEntireDebtAndColl(address _borrower) external view returns ( uint debt, uint coll, uint pendingLUSDDebtReward, uint pendingETHReward ); function closeTrove(address _borrower) external; function removeStake(address _borrower) external; function getRedemptionRate() external view returns (uint); function getRedemptionRateWithDecay() external view returns (uint); function getRedemptionFeeWithDecay(uint _ETHDrawn) external view returns (uint); function getBorrowingRate() external view returns (uint); function getBorrowingRateWithDecay() external view returns (uint); function getBorrowingFee(uint LUSDDebt) external view returns (uint); function getBorrowingFeeWithDecay(uint _LUSDDebt) external view returns (uint); function decayBaseRateFromBorrowing() external; function getTroveStatus(address _borrower) external view returns (uint); function getTroveStake(address _borrower) external view returns (uint); function getTroveDebt(address _borrower) external view returns (uint); function getTroveColl(address _borrower) external view returns (uint); function setTroveStatus(address _borrower, uint num) external; function increaseTroveColl(address _borrower, uint _collIncrease) external returns (uint); function decreaseTroveColl(address _borrower, uint _collDecrease) external returns (uint); function increaseTroveDebt(address _borrower, uint _debtIncrease) external returns (uint); function decreaseTroveDebt(address _borrower, uint _collDecrease) external returns (uint); function getTCR(uint _price) external view returns (uint); function checkRecoveryMode(uint _price) external view returns (bool); } // File contracts/Interfaces/ISortedTroves.sol // MIT pragma solidity 0.6.11; // Common interface for the SortedTroves Doubly Linked List. interface ISortedTroves { // --- Events --- event SortedTrovesAddressChanged(address _sortedDoublyLLAddress); event BorrowerOperationsAddressChanged(address _borrowerOperationsAddress); event NodeAdded(address _id, uint _NICR); event NodeRemoved(address _id); // --- Functions --- function setParams(uint256 _size, address _TroveManagerAddress, address _borrowerOperationsAddress) external; function insert(address _id, uint256 _ICR, address _prevId, address _nextId) external; function remove(address _id) external; function reInsert(address _id, uint256 _newICR, address _prevId, address _nextId) external; function contains(address _id) external view returns (bool); function isFull() external view returns (bool); function isEmpty() external view returns (bool); function getSize() external view returns (uint256); function getMaxSize() external view returns (uint256); function getFirst() external view returns (address); function getLast() external view returns (address); function getNext(address _id) external view returns (address); function getPrev(address _id) external view returns (address); function validInsertPosition(uint256 _ICR, address _prevId, address _nextId) external view returns (bool); function findInsertPosition(uint256 _ICR, address _prevId, address _nextId) external view returns (address, address); } // File contracts/Interfaces/ICommunityIssuance.sol // MIT pragma solidity 0.6.11; interface ICommunityIssuance { // --- Events --- event LQTYTokenAddressSet(address _lqtyTokenAddress); event StabilityPoolAddressSet(address _stabilityPoolAddress); event TotalLQTYIssuedUpdated(uint _totalLQTYIssued); // --- Functions --- function setAddresses(address _lqtyTokenAddress, address _stabilityPoolAddress) external; function issueLQTY() external returns (uint); function sendLQTY(address _account, uint _LQTYamount) external; } // File contracts/Dependencies/BaseMath.sol // MIT pragma solidity 0.6.11; contract BaseMath { uint constant public DECIMAL_PRECISION = 1e18; } // File contracts/Dependencies/SafeMath.sol // MIT pragma solidity 0.6.11; /** * Based on OpenZeppelin's SafeMath: * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol * * @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 contracts/Dependencies/console.sol // MIT pragma solidity 0.6.11; // Buidler's helper contract for console logging library console { address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67); function log() internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log()")); ignored; } function logInt(int p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(int)", p0)); ignored; } function logUint(uint p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint)", p0)); ignored; } function logString(string memory p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string)", p0)); ignored; } function logBool(bool p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool)", p0)); ignored; } function logAddress(address p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address)", p0)); ignored; } function logBytes(bytes memory p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes)", p0)); ignored; } function logByte(byte p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(byte)", p0)); ignored; } function logBytes1(bytes1 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes1)", p0)); ignored; } function logBytes2(bytes2 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes2)", p0)); ignored; } function logBytes3(bytes3 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes3)", p0)); ignored; } function logBytes4(bytes4 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes4)", p0)); ignored; } function logBytes5(bytes5 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes5)", p0)); ignored; } function logBytes6(bytes6 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes6)", p0)); ignored; } function logBytes7(bytes7 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes7)", p0)); ignored; } function logBytes8(bytes8 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes8)", p0)); ignored; } function logBytes9(bytes9 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes9)", p0)); ignored; } function logBytes10(bytes10 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes10)", p0)); ignored; } function logBytes11(bytes11 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes11)", p0)); ignored; } function logBytes12(bytes12 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes12)", p0)); ignored; } function logBytes13(bytes13 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes13)", p0)); ignored; } function logBytes14(bytes14 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes14)", p0)); ignored; } function logBytes15(bytes15 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes15)", p0)); ignored; } function logBytes16(bytes16 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes16)", p0)); ignored; } function logBytes17(bytes17 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes17)", p0)); ignored; } function logBytes18(bytes18 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes18)", p0)); ignored; } function logBytes19(bytes19 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes19)", p0)); ignored; } function logBytes20(bytes20 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes20)", p0)); ignored; } function logBytes21(bytes21 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes21)", p0)); ignored; } function logBytes22(bytes22 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes22)", p0)); ignored; } function logBytes23(bytes23 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes23)", p0)); ignored; } function logBytes24(bytes24 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes24)", p0)); ignored; } function logBytes25(bytes25 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes25)", p0)); ignored; } function logBytes26(bytes26 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes26)", p0)); ignored; } function logBytes27(bytes27 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes27)", p0)); ignored; } function logBytes28(bytes28 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes28)", p0)); ignored; } function logBytes29(bytes29 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes29)", p0)); ignored; } function logBytes30(bytes30 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes30)", p0)); ignored; } function logBytes31(bytes31 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes31)", p0)); ignored; } function logBytes32(bytes32 p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bytes32)", p0)); ignored; } function log(uint p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint)", p0)); ignored; } function log(string memory p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string)", p0)); ignored; } function log(bool p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool)", p0)); ignored; } function log(address p0) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address)", p0)); ignored; } function log(uint p0, uint p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint)", p0, p1)); ignored; } function log(uint p0, string memory p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string)", p0, p1)); ignored; } function log(uint p0, bool p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool)", p0, p1)); ignored; } function log(uint p0, address p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address)", p0, p1)); ignored; } function log(string memory p0, uint p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint)", p0, p1)); ignored; } function log(string memory p0, string memory p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string)", p0, p1)); ignored; } function log(string memory p0, bool p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool)", p0, p1)); ignored; } function log(string memory p0, address p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address)", p0, p1)); ignored; } function log(bool p0, uint p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint)", p0, p1)); ignored; } function log(bool p0, string memory p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string)", p0, p1)); ignored; } function log(bool p0, bool p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool)", p0, p1)); ignored; } function log(bool p0, address p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address)", p0, p1)); ignored; } function log(address p0, uint p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint)", p0, p1)); ignored; } function log(address p0, string memory p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string)", p0, p1)); ignored; } function log(address p0, bool p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool)", p0, p1)); ignored; } function log(address p0, address p1) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address)", p0, p1)); ignored; } function log(uint p0, uint p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2)); ignored; } function log(uint p0, uint p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2)); ignored; } function log(uint p0, uint p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2)); ignored; } function log(uint p0, uint p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2)); ignored; } function log(uint p0, string memory p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2)); ignored; } function log(uint p0, string memory p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2)); ignored; } function log(uint p0, string memory p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2)); ignored; } function log(uint p0, string memory p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2)); ignored; } function log(uint p0, bool p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2)); ignored; } function log(uint p0, bool p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2)); ignored; } function log(uint p0, bool p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2)); ignored; } function log(uint p0, bool p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2)); ignored; } function log(uint p0, address p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2)); ignored; } function log(uint p0, address p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2)); ignored; } function log(uint p0, address p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2)); ignored; } function log(uint p0, address p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2)); ignored; } function log(string memory p0, uint p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2)); ignored; } function log(string memory p0, uint p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2)); ignored; } function log(string memory p0, uint p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2)); ignored; } function log(string memory p0, uint p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2)); ignored; } function log(string memory p0, string memory p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2)); ignored; } function log(string memory p0, string memory p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2)); ignored; } function log(string memory p0, string memory p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2)); ignored; } function log(string memory p0, string memory p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2)); ignored; } function log(string memory p0, bool p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2)); ignored; } function log(string memory p0, bool p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2)); ignored; } function log(string memory p0, bool p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2)); ignored; } function log(string memory p0, bool p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2)); ignored; } function log(string memory p0, address p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2)); ignored; } function log(string memory p0, address p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2)); ignored; } function log(string memory p0, address p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2)); ignored; } function log(string memory p0, address p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2)); ignored; } function log(bool p0, uint p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2)); ignored; } function log(bool p0, uint p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2)); ignored; } function log(bool p0, uint p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2)); ignored; } function log(bool p0, uint p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2)); ignored; } function log(bool p0, string memory p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2)); ignored; } function log(bool p0, string memory p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2)); ignored; } function log(bool p0, string memory p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2)); ignored; } function log(bool p0, string memory p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2)); ignored; } function log(bool p0, bool p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2)); ignored; } function log(bool p0, bool p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2)); ignored; } function log(bool p0, bool p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2)); ignored; } function log(bool p0, bool p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2)); ignored; } function log(bool p0, address p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2)); ignored; } function log(bool p0, address p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2)); ignored; } function log(bool p0, address p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2)); ignored; } function log(bool p0, address p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2)); ignored; } function log(address p0, uint p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2)); ignored; } function log(address p0, uint p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2)); ignored; } function log(address p0, uint p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2)); ignored; } function log(address p0, uint p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2)); ignored; } function log(address p0, string memory p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2)); ignored; } function log(address p0, string memory p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2)); ignored; } function log(address p0, string memory p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2)); ignored; } function log(address p0, string memory p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2)); ignored; } function log(address p0, bool p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2)); ignored; } function log(address p0, bool p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2)); ignored; } function log(address p0, bool p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2)); ignored; } function log(address p0, bool p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2)); ignored; } function log(address p0, address p1, uint p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2)); ignored; } function log(address p0, address p1, string memory p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2)); ignored; } function log(address p0, address p1, bool p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2)); ignored; } function log(address p0, address p1, address p2) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2)); ignored; } function log(uint p0, uint p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,uint,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,uint,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,string,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,string,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,string,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,string,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,bool,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,bool,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,address,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,address,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,address,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, uint p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,uint,address,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,uint,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,uint,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,uint,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,uint,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,string,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,string,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,string,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,string,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,bool,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,bool,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,bool,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,bool,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,address,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,address,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,address,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, string memory p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,string,address,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,uint,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,uint,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,string,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,string,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,string,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,string,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,bool,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,bool,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,address,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,address,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,address,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, bool p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,bool,address,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,uint,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,uint,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,uint,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,uint,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,string,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,string,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,string,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,string,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,bool,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,bool,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,bool,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,bool,address)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,address,uint)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,address,string)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,address,bool)", p0, p1, p2, p3)); ignored; } function log(uint p0, address p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(uint,address,address,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,uint,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,uint,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,uint,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,uint,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,string,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,string,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,string,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,string,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,bool,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,bool,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,bool,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,bool,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,address,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,address,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,address,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, uint p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,uint,address,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,uint,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,uint,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,uint,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,uint,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,string,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,bool,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,address,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, string memory p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,uint,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,uint,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,uint,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,uint,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,string,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,bool,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,address,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, bool p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,uint,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,uint,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,uint,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,uint,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,string,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,bool,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,address,uint)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3)); ignored; } function log(string memory p0, address p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,uint,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,uint,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,string,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,string,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,string,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,string,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,bool,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,bool,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,address,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,address,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,address,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, uint p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,uint,address,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,uint,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,uint,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,uint,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,uint,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,string,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,bool,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,address,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, string memory p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,uint,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,uint,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,string,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,address,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, bool p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,uint,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,uint,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,uint,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,uint,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,string,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,bool,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,address,uint)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3)); ignored; } function log(bool p0, address p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,uint,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,uint,string)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,uint,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,uint,address)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,string,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,string,string)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,string,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,string,address)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,bool,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,bool,string)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,bool,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,bool,address)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,address,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,address,string)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,address,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, uint p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,uint,address,address)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,uint,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,uint,string)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,uint,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,uint,address)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,string,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,bool,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,address,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, string memory p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,uint,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,uint,string)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,uint,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,uint,address)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,string,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,bool,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,address,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, bool p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, uint p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,uint,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, uint p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,uint,string)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, uint p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,uint,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, uint p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,uint,address)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, string memory p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,string,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, string memory p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, string memory p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, string memory p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, bool p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,bool,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, bool p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, bool p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, bool p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, address p2, uint p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,address,uint)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, address p2, string memory p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, address p2, bool p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3)); ignored; } function log(address p0, address p1, address p2, address p3) internal view { (bool ignored, ) = CONSOLE_ADDRESS.staticcall(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3)); ignored; } } // File contracts/Dependencies/LiquityMath.sol // MIT pragma solidity 0.6.11; library LiquityMath { using SafeMath for uint; uint internal constant DECIMAL_PRECISION = 1e18; /* Precision for Nominal ICR (independent of price). Rationale for the value: * * - Making it “too high” could lead to overflows. * - Making it “too low” could lead to an ICR equal to zero, due to truncation from Solidity floor division. * * This value of 1e20 is chosen for safety: the NICR will only overflow for numerator > ~1e39 ETH, * and will only truncate to 0 if the denominator is at least 1e20 times greater than the numerator. * */ uint internal constant NICR_PRECISION = 1e20; function _min(uint _a, uint _b) internal pure returns (uint) { return (_a < _b) ? _a : _b; } function _max(uint _a, uint _b) internal pure returns (uint) { return (_a >= _b) ? _a : _b; } /* * Multiply two decimal numbers and use normal rounding rules: * -round product up if 19'th mantissa digit >= 5 * -round product down if 19'th mantissa digit < 5 * * Used only inside the exponentiation, _decPow(). */ function decMul(uint x, uint y) internal pure returns (uint decProd) { uint prod_xy = x.mul(y); decProd = prod_xy.add(DECIMAL_PRECISION / 2).div(DECIMAL_PRECISION); } /* * _decPow: Exponentiation function for 18-digit decimal base, and integer exponent n. * * Uses the efficient "exponentiation by squaring" algorithm. O(log(n)) complexity. * * Called by two functions that represent time in units of minutes: * 1) TroveManager._calcDecayedBaseRate * 2) CommunityIssuance._getCumulativeIssuanceFraction * * The exponent is capped to avoid reverting due to overflow. The cap 525600000 equals * "minutes in 1000 years": 60 * 24 * 365 * 1000 * * If a period of > 1000 years is ever used as an exponent in either of the above functions, the result will be * negligibly different from just passing the cap, since: * * In function 1), the decayed base rate will be 0 for 1000 years or > 1000 years * In function 2), the difference in tokens issued at 1000 years and any time > 1000 years, will be negligible */ function _decPow(uint _base, uint _minutes) internal pure returns (uint) { if (_minutes > 525600000) {_minutes = 525600000;} // cap to avoid overflow if (_minutes == 0) {return DECIMAL_PRECISION;} uint y = DECIMAL_PRECISION; uint x = _base; uint n = _minutes; // Exponentiation-by-squaring while (n > 1) { if (n % 2 == 0) { x = decMul(x, x); n = n.div(2); } else { // if (n % 2 != 0) y = decMul(x, y); x = decMul(x, x); n = (n.sub(1)).div(2); } } return decMul(x, y); } function _getAbsoluteDifference(uint _a, uint _b) internal pure returns (uint) { return (_a >= _b) ? _a.sub(_b) : _b.sub(_a); } function _computeNominalCR(uint _coll, uint _debt) internal pure returns (uint) { if (_debt > 0) { return _coll.mul(NICR_PRECISION).div(_debt); } // Return the maximal value for uint256 if the Trove has a debt of 0. Represents "infinite" CR. else { // if (_debt == 0) return 2**256 - 1; } } function _computeCR(uint _coll, uint _debt, uint _price) internal pure returns (uint) { if (_debt > 0) { uint newCollRatio = _coll.mul(_price).div(_debt); return newCollRatio; } // Return the maximal value for uint256 if the Trove has a debt of 0. Represents "infinite" CR. else { // if (_debt == 0) return 2**256 - 1; } } } // File contracts/Interfaces/IPool.sol // MIT pragma solidity 0.6.11; // Common interface for the Pools. interface IPool { // --- Events --- event ETHBalanceUpdated(uint _newBalance); event LUSDBalanceUpdated(uint _newBalance); event ActivePoolAddressChanged(address _newActivePoolAddress); event DefaultPoolAddressChanged(address _newDefaultPoolAddress); event StabilityPoolAddressChanged(address _newStabilityPoolAddress); event EtherSent(address _to, uint _amount); // --- Functions --- function getETH() external view returns (uint); function getLUSDDebt() external view returns (uint); function increaseLUSDDebt(uint _amount) external; function decreaseLUSDDebt(uint _amount) external; } // File contracts/Interfaces/IActivePool.sol // MIT pragma solidity 0.6.11; interface IActivePool is IPool { // --- Events --- event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress); event TroveManagerAddressChanged(address _newTroveManagerAddress); event ActivePoolLUSDDebtUpdated(uint _LUSDDebt); event ActivePoolETHBalanceUpdated(uint _ETH); // --- Functions --- function sendETH(address _account, uint _amount) external; } // File contracts/Interfaces/IDefaultPool.sol // MIT pragma solidity 0.6.11; interface IDefaultPool is IPool { // --- Events --- event TroveManagerAddressChanged(address _newTroveManagerAddress); event DefaultPoolLUSDDebtUpdated(uint _LUSDDebt); event DefaultPoolETHBalanceUpdated(uint _ETH); // --- Functions --- function sendETHToActivePool(uint _amount) external; } // File contracts/Dependencies/LiquityBase.sol // MIT pragma solidity 0.6.11; /* * Base contract for TroveManager, BorrowerOperations and StabilityPool. Contains global system constants and * common functions. */ contract LiquityBase is BaseMath, ILiquityBase { using SafeMath for uint; uint constant public _100pct = 1000000000000000000; // 1e18 == 100% // Minimum collateral ratio for individual troves uint constant public MCR = 1100000000000000000; // 110% // Critical system collateral ratio. If the system's total collateral ratio (TCR) falls below the CCR, Recovery Mode is triggered. uint constant public CCR = 1500000000000000000; // 150% // Amount of LUSD to be locked in gas pool on opening troves uint constant public LUSD_GAS_COMPENSATION = 200e18; // Minimum amount of net LUSD debt a trove must have uint constant public MIN_NET_DEBT = 1800e18; // uint constant public MIN_NET_DEBT = 0; uint constant public PERCENT_DIVISOR = 200; // dividing by 200 yields 0.5% uint constant public BORROWING_FEE_FLOOR = DECIMAL_PRECISION / 1000 * 5; // 0.5% IActivePool public activePool; IDefaultPool public defaultPool; IPriceFeed public override priceFeed; // --- Gas compensation functions --- // Returns the composite debt (drawn debt + gas compensation) of a trove, for the purpose of ICR calculation function _getCompositeDebt(uint _debt) internal pure returns (uint) { return _debt.add(LUSD_GAS_COMPENSATION); } function _getNetDebt(uint _debt) internal pure returns (uint) { return _debt.sub(LUSD_GAS_COMPENSATION); } // Return the amount of ETH to be drawn from a trove's collateral and sent as gas compensation. function _getCollGasCompensation(uint _entireColl) internal pure returns (uint) { return _entireColl / PERCENT_DIVISOR; } function getEntireSystemColl() public view returns (uint entireSystemColl) { uint activeColl = activePool.getETH(); uint liquidatedColl = defaultPool.getETH(); return activeColl.add(liquidatedColl); } function getEntireSystemDebt() public view returns (uint entireSystemDebt) { uint activeDebt = activePool.getLUSDDebt(); uint closedDebt = defaultPool.getLUSDDebt(); return activeDebt.add(closedDebt); } function _getTCR(uint _price) internal view returns (uint TCR) { uint entireSystemColl = getEntireSystemColl(); uint entireSystemDebt = getEntireSystemDebt(); TCR = LiquityMath._computeCR(entireSystemColl, entireSystemDebt, _price); return TCR; } function _checkRecoveryMode(uint _price) internal view returns (bool) { uint TCR = _getTCR(_price); return TCR < CCR; } function _requireUserAcceptsFee(uint _fee, uint _amount, uint _maxFeePercentage) internal pure { uint feePercentage = _fee.mul(DECIMAL_PRECISION).div(_amount); require(feePercentage <= _maxFeePercentage, "Fee exceeded provided maximum"); } } // File contracts/Dependencies/LiquitySafeMath128.sol // MIT pragma solidity 0.6.11; // uint128 addition and subtraction, with overflow protection. library LiquitySafeMath128 { function add(uint128 a, uint128 b) internal pure returns (uint128) { uint128 c = a + b; require(c >= a, "LiquitySafeMath128: addition overflow"); return c; } function sub(uint128 a, uint128 b) internal pure returns (uint128) { require(b <= a, "LiquitySafeMath128: subtraction overflow"); uint128 c = a - b; return c; } } // File contracts/Dependencies/Ownable.sol // MIT pragma solidity 0.6.11; /** * Based on OpenZeppelin's Ownable contract: * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/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. * * 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 { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { _owner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); } /** * @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 msg.sender == _owner; } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. * * NOTE: This function is not safe, as it doesn’t check owner is calling it. * Make sure you check it before calling it. */ function _renounceOwnership() internal { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } // File contracts/Dependencies/CheckContract.sol // MIT pragma solidity 0.6.11; contract CheckContract { /** * Check that the account is an already deployed non-destroyed contract. * See: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol#L12 */ function checkContract(address _account) internal view { require(_account != address(0), "Account cannot be zero address"); uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(_account) } require(size > 0, "Account code size cannot be zero"); } } // File contracts/StabilityPool.sol // MIT pragma solidity 0.6.11; /* * The Stability Pool holds LUSD tokens deposited by Stability Pool depositors. * * When a trove is liquidated, then depending on system conditions, some of its LUSD debt gets offset with * LUSD in the Stability Pool: that is, the offset debt evaporates, and an equal amount of LUSD tokens in the Stability Pool is burned. * * Thus, a liquidation causes each depositor to receive a LUSD loss, in proportion to their deposit as a share of total deposits. * They also receive an ETH gain, as the ETH collateral of the liquidated trove is distributed among Stability depositors, * in the same proportion. * * When a liquidation occurs, it depletes every deposit by the same fraction: for example, a liquidation that depletes 40% * of the total LUSD in the Stability Pool, depletes 40% of each deposit. * * A deposit that has experienced a series of liquidations is termed a "compounded deposit": each liquidation depletes the deposit, * multiplying it by some factor in range ]0,1[ * * * --- IMPLEMENTATION --- * * We use a highly scalable method of tracking deposits and ETH gains that has O(1) complexity. * * When a liquidation occurs, rather than updating each depositor's deposit and ETH gain, we simply update two state variables: * a product P, and a sum S. * * A mathematical manipulation allows us to factor out the initial deposit, and accurately track all depositors' compounded deposits * and accumulated ETH gains over time, as liquidations occur, using just these two variables P and S. When depositors join the * Stability Pool, they get a snapshot of the latest P and S: P_t and S_t, respectively. * * The formula for a depositor's accumulated ETH gain is derived here: * https://github.com/liquity/dev/blob/main/packages/contracts/mathProofs/Scalable%20Compounding%20Stability%20Pool%20Deposits.pdf * * For a given deposit d_t, the ratio P/P_t tells us the factor by which a deposit has decreased since it joined the Stability Pool, * and the term d_t * (S - S_t)/P_t gives us the deposit's total accumulated ETH gain. * * Each liquidation updates the product P and sum S. After a series of liquidations, a compounded deposit and corresponding ETH gain * can be calculated using the initial deposit, the depositor’s snapshots of P and S, and the latest values of P and S. * * Any time a depositor updates their deposit (withdrawal, top-up) their accumulated ETH gain is paid out, their new deposit is recorded * (based on their latest compounded deposit and modified by the withdrawal/top-up), and they receive new snapshots of the latest P and S. * Essentially, they make a fresh deposit that overwrites the old one. * * * --- SCALE FACTOR --- * * Since P is a running product in range ]0,1] that is always-decreasing, it should never reach 0 when multiplied by a number in range ]0,1[. * Unfortunately, Solidity floor division always reaches 0, sooner or later. * * A series of liquidations that nearly empty the Pool (and thus each multiply P by a very small number in range ]0,1[ ) may push P * to its 18 digit decimal limit, and round it to 0, when in fact the Pool hasn't been emptied: this would break deposit tracking. * * So, to track P accurately, we use a scale factor: if a liquidation would cause P to decrease to <1e-9 (and be rounded to 0 by Solidity), * we first multiply P by 1e9, and increment a currentScale factor by 1. * * The added benefit of using 1e9 for the scale factor (rather than 1e18) is that it ensures negligible precision loss close to the * scale boundary: when P is at its minimum value of 1e9, the relative precision loss in P due to floor division is only on the * order of 1e-9. * * --- EPOCHS --- * * Whenever a liquidation fully empties the Stability Pool, all deposits should become 0. However, setting P to 0 would make P be 0 * forever, and break all future reward calculations. * * So, every time the Stability Pool is emptied by a liquidation, we reset P = 1 and currentScale = 0, and increment the currentEpoch by 1. * * --- TRACKING DEPOSIT OVER SCALE CHANGES AND EPOCHS --- * * When a deposit is made, it gets snapshots of the currentEpoch and the currentScale. * * When calculating a compounded deposit, we compare the current epoch to the deposit's epoch snapshot. If the current epoch is newer, * then the deposit was present during a pool-emptying liquidation, and necessarily has been depleted to 0. * * Otherwise, we then compare the current scale to the deposit's scale snapshot. If they're equal, the compounded deposit is given by d_t * P/P_t. * If it spans one scale change, it is given by d_t * P/(P_t * 1e9). If it spans more than one scale change, we define the compounded deposit * as 0, since it is now less than 1e-9'th of its initial value (e.g. a deposit of 1 billion LUSD has depleted to < 1 LUSD). * * * --- TRACKING DEPOSITOR'S ETH GAIN OVER SCALE CHANGES AND EPOCHS --- * * In the current epoch, the latest value of S is stored upon each scale change, and the mapping (scale -> S) is stored for each epoch. * * This allows us to calculate a deposit's accumulated ETH gain, during the epoch in which the deposit was non-zero and earned ETH. * * We calculate the depositor's accumulated ETH gain for the scale at which they made the deposit, using the ETH gain formula: * e_1 = d_t * (S - S_t) / P_t * * and also for scale after, taking care to divide the latter by a factor of 1e9: * e_2 = d_t * S / (P_t * 1e9) * * The gain in the second scale will be full, as the starting point was in the previous scale, thus no need to subtract anything. * The deposit therefore was present for reward events from the beginning of that second scale. * * S_i-S_t + S_{i+1} * .<--------.------------> * . . * . S_i . S_{i+1} * <--.-------->.<-----------> * S_t. . * <->. . * t . * |---+---------|-------------|-----... * i i+1 * * The sum of (e_1 + e_2) captures the depositor's total accumulated ETH gain, handling the case where their * deposit spanned one scale change. We only care about gains across one scale change, since the compounded * deposit is defined as being 0 once it has spanned more than one scale change. * * * --- UPDATING P WHEN A LIQUIDATION OCCURS --- * * Please see the implementation spec in the proof document, which closely follows on from the compounded deposit / ETH gain derivations: * https://github.com/liquity/liquity/blob/master/papers/Scalable_Reward_Distribution_with_Compounding_Stakes.pdf * * * --- LQTY ISSUANCE TO STABILITY POOL DEPOSITORS --- * * An LQTY issuance event occurs at every deposit operation, and every liquidation. * * Each deposit is tagged with the address of the front end through which it was made. * * All deposits earn a share of the issued LQTY in proportion to the deposit as a share of total deposits. The LQTY earned * by a given deposit, is split between the depositor and the front end through which the deposit was made, based on the front end's kickbackRate. * * Please see the system Readme for an overview: * https://github.com/liquity/dev/blob/main/README.md#lqty-issuance-to-stability-providers * * We use the same mathematical product-sum approach to track LQTY gains for depositors, where 'G' is the sum corresponding to LQTY gains. * The product P (and snapshot P_t) is re-used, as the ratio P/P_t tracks a deposit's depletion due to liquidations. * */ contract StabilityPool is LiquityBase, Ownable, CheckContract, IStabilityPool { using LiquitySafeMath128 for uint128; string constant public NAME = "StabilityPool"; IBorrowerOperations public borrowerOperations; ITroveManager public troveManager; ILUSDToken public lusdToken; // Needed to check if there are pending liquidations ISortedTroves public sortedTroves; ICommunityIssuance public communityIssuance; uint256 internal ETH; // deposited ether tracker // Tracker for LUSD held in the pool. Changes when users deposit/withdraw, and when Trove debt is offset. uint256 internal totalLUSDDeposits; // --- Data structures --- struct FrontEnd { uint kickbackRate; bool registered; } struct Deposit { uint initialValue; address frontEndTag; } struct Snapshots { uint S; uint P; uint G; uint128 scale; uint128 epoch; } mapping (address => Deposit) public deposits; // depositor address -> Deposit struct mapping (address => Snapshots) public depositSnapshots; // depositor address -> snapshots struct mapping (address => FrontEnd) public frontEnds; // front end address -> FrontEnd struct mapping (address => uint) public frontEndStakes; // front end address -> last recorded total deposits, tagged with that front end mapping (address => Snapshots) public frontEndSnapshots; // front end address -> snapshots struct /* Product 'P': Running product by which to multiply an initial deposit, in order to find the current compounded deposit, * after a series of liquidations have occurred, each of which cancel some LUSD debt with the deposit. * * During its lifetime, a deposit's value evolves from d_t to d_t * P / P_t , where P_t * is the snapshot of P taken at the instant the deposit was made. 18-digit decimal. */ uint public P = DECIMAL_PRECISION; uint public constant SCALE_FACTOR = 1e9; // Each time the scale of P shifts by SCALE_FACTOR, the scale is incremented by 1 uint128 public currentScale; // With each offset that fully empties the Pool, the epoch is incremented by 1 uint128 public currentEpoch; /* ETH Gain sum 'S': During its lifetime, each deposit d_t earns an ETH gain of ( d_t * [S - S_t] )/P_t, where S_t * is the depositor's snapshot of S taken at the time t when the deposit was made. * * The 'S' sums are stored in a nested mapping (epoch => scale => sum): * * - The inner mapping records the sum S at different scales * - The outer mapping records the (scale => sum) mappings, for different epochs. */ mapping (uint128 => mapping(uint128 => uint)) public epochToScaleToSum; /* * Similarly, the sum 'G' is used to calculate LQTY gains. During it's lifetime, each deposit d_t earns a LQTY gain of * ( d_t * [G - G_t] )/P_t, where G_t is the depositor's snapshot of G taken at time t when the deposit was made. * * LQTY reward events occur are triggered by depositor operations (new deposit, topup, withdrawal), and liquidations. * In each case, the LQTY reward is issued (i.e. G is updated), before other state changes are made. */ mapping (uint128 => mapping(uint128 => uint)) public epochToScaleToG; // Error tracker for the error correction in the LQTY issuance calculation uint public lastLQTYError; // Error trackers for the error correction in the offset calculation uint public lastETHError_Offset; uint public lastLUSDLossError_Offset; // --- Events --- event StabilityPoolETHBalanceUpdated(uint _newBalance); event StabilityPoolLUSDBalanceUpdated(uint _newBalance); event BorrowerOperationsAddressChanged(address _newBorrowerOperationsAddress); event TroveManagerAddressChanged(address _newTroveManagerAddress); event ActivePoolAddressChanged(address _newActivePoolAddress); event DefaultPoolAddressChanged(address _newDefaultPoolAddress); event LUSDTokenAddressChanged(address _newLUSDTokenAddress); event SortedTrovesAddressChanged(address _newSortedTrovesAddress); event PriceFeedAddressChanged(address _newPriceFeedAddress); event CommunityIssuanceAddressChanged(address _newCommunityIssuanceAddress); event P_Updated(uint _P); event S_Updated(uint _S, uint128 _epoch, uint128 _scale); event G_Updated(uint _G, uint128 _epoch, uint128 _scale); event EpochUpdated(uint128 _currentEpoch); event ScaleUpdated(uint128 _currentScale); event FrontEndRegistered(address indexed _frontEnd, uint _kickbackRate); event FrontEndTagSet(address indexed _depositor, address indexed _frontEnd); event DepositSnapshotUpdated(address indexed _depositor, uint _P, uint _S, uint _G); event FrontEndSnapshotUpdated(address indexed _frontEnd, uint _P, uint _G); event UserDepositChanged(address indexed _depositor, uint _newDeposit); event FrontEndStakeChanged(address indexed _frontEnd, uint _newFrontEndStake, address _depositor); event ETHGainWithdrawn(address indexed _depositor, uint _ETH, uint _LUSDLoss); event LQTYPaidToDepositor(address indexed _depositor, uint _LQTY); event LQTYPaidToFrontEnd(address indexed _frontEnd, uint _LQTY); event EtherSent(address _to, uint _amount); // --- Contract setters --- function setAddresses( address _borrowerOperationsAddress, address _troveManagerAddress, address _activePoolAddress, address _lusdTokenAddress, address _sortedTrovesAddress, address _priceFeedAddress, address _communityIssuanceAddress ) external override onlyOwner { checkContract(_borrowerOperationsAddress); checkContract(_troveManagerAddress); checkContract(_activePoolAddress); checkContract(_lusdTokenAddress); checkContract(_sortedTrovesAddress); checkContract(_priceFeedAddress); checkContract(_communityIssuanceAddress); borrowerOperations = IBorrowerOperations(_borrowerOperationsAddress); troveManager = ITroveManager(_troveManagerAddress); activePool = IActivePool(_activePoolAddress); lusdToken = ILUSDToken(_lusdTokenAddress); sortedTroves = ISortedTroves(_sortedTrovesAddress); priceFeed = IPriceFeed(_priceFeedAddress); communityIssuance = ICommunityIssuance(_communityIssuanceAddress); emit BorrowerOperationsAddressChanged(_borrowerOperationsAddress); emit TroveManagerAddressChanged(_troveManagerAddress); emit ActivePoolAddressChanged(_activePoolAddress); emit LUSDTokenAddressChanged(_lusdTokenAddress); emit SortedTrovesAddressChanged(_sortedTrovesAddress); emit PriceFeedAddressChanged(_priceFeedAddress); emit CommunityIssuanceAddressChanged(_communityIssuanceAddress); _renounceOwnership(); } // --- Getters for public variables. Required by IPool interface --- function getETH() external view override returns (uint) { return ETH; } function getTotalLUSDDeposits() external view override returns (uint) { return totalLUSDDeposits; } // --- External Depositor Functions --- /* provideToSP(): * * - Triggers a LQTY issuance, based on time passed since the last issuance. The LQTY issuance is shared between *all* depositors and front ends * - Tags the deposit with the provided front end tag param, if it's a new deposit * - Sends depositor's accumulated gains (LQTY, ETH) to depositor * - Sends the tagged front end's accumulated LQTY gains to the tagged front end * - Increases deposit and tagged front end's stake, and takes new snapshots for each. */ function provideToSP(uint _amount, address _frontEndTag) external override { _requireFrontEndIsRegisteredOrZero(_frontEndTag); _requireFrontEndNotRegistered(msg.sender); _requireNonZeroAmount(_amount); uint initialDeposit = deposits[msg.sender].initialValue; ICommunityIssuance communityIssuanceCached = communityIssuance; _triggerLQTYIssuance(communityIssuanceCached); if (initialDeposit == 0) {_setFrontEndTag(msg.sender, _frontEndTag);} uint depositorETHGain = getDepositorETHGain(msg.sender); uint compoundedLUSDDeposit = getCompoundedLUSDDeposit(msg.sender); uint LUSDLoss = initialDeposit.sub(compoundedLUSDDeposit); // Needed only for event log // First pay out any LQTY gains address frontEnd = deposits[msg.sender].frontEndTag; _payOutLQTYGains(communityIssuanceCached, msg.sender, frontEnd); // Update front end stake uint compoundedFrontEndStake = getCompoundedFrontEndStake(frontEnd); uint newFrontEndStake = compoundedFrontEndStake.add(_amount); _updateFrontEndStakeAndSnapshots(frontEnd, newFrontEndStake); emit FrontEndStakeChanged(frontEnd, newFrontEndStake, msg.sender); _sendLUSDtoStabilityPool(msg.sender, _amount); uint newDeposit = compoundedLUSDDeposit.add(_amount); _updateDepositAndSnapshots(msg.sender, newDeposit); emit UserDepositChanged(msg.sender, newDeposit); emit ETHGainWithdrawn(msg.sender, depositorETHGain, LUSDLoss); // LUSD Loss required for event log _sendETHGainToDepositor(depositorETHGain); } /* withdrawFromSP(): * * - Triggers a LQTY issuance, based on time passed since the last issuance. The LQTY issuance is shared between *all* depositors and front ends * - Removes the deposit's front end tag if it is a full withdrawal * - Sends all depositor's accumulated gains (LQTY, ETH) to depositor * - Sends the tagged front end's accumulated LQTY gains to the tagged front end * - Decreases deposit and tagged front end's stake, and takes new snapshots for each. * * If _amount > userDeposit, the user withdraws all of their compounded deposit. */ function withdrawFromSP(uint _amount) external override { if (_amount !=0) {_requireNoUnderCollateralizedTroves();} uint initialDeposit = deposits[msg.sender].initialValue; _requireUserHasDeposit(initialDeposit); ICommunityIssuance communityIssuanceCached = communityIssuance; _triggerLQTYIssuance(communityIssuanceCached); uint depositorETHGain = getDepositorETHGain(msg.sender); uint compoundedLUSDDeposit = getCompoundedLUSDDeposit(msg.sender); uint LUSDtoWithdraw = LiquityMath._min(_amount, compoundedLUSDDeposit); uint LUSDLoss = initialDeposit.sub(compoundedLUSDDeposit); // Needed only for event log // First pay out any LQTY gains address frontEnd = deposits[msg.sender].frontEndTag; _payOutLQTYGains(communityIssuanceCached, msg.sender, frontEnd); // Update front end stake uint compoundedFrontEndStake = getCompoundedFrontEndStake(frontEnd); uint newFrontEndStake = compoundedFrontEndStake.sub(LUSDtoWithdraw); _updateFrontEndStakeAndSnapshots(frontEnd, newFrontEndStake); emit FrontEndStakeChanged(frontEnd, newFrontEndStake, msg.sender); _sendLUSDToDepositor(msg.sender, LUSDtoWithdraw); // Update deposit uint newDeposit = compoundedLUSDDeposit.sub(LUSDtoWithdraw); _updateDepositAndSnapshots(msg.sender, newDeposit); emit UserDepositChanged(msg.sender, newDeposit); emit ETHGainWithdrawn(msg.sender, depositorETHGain, LUSDLoss); // LUSD Loss required for event log _sendETHGainToDepositor(depositorETHGain); } /* withdrawETHGainToTrove: * - Triggers a LQTY issuance, based on time passed since the last issuance. The LQTY issuance is shared between *all* depositors and front ends * - Sends all depositor's LQTY gain to depositor * - Sends all tagged front end's LQTY gain to the tagged front end * - Transfers the depositor's entire ETH gain from the Stability Pool to the caller's trove * - Leaves their compounded deposit in the Stability Pool * - Updates snapshots for deposit and tagged front end stake */ function withdrawETHGainToTrove(address _upperHint, address _lowerHint) external override { uint initialDeposit = deposits[msg.sender].initialValue; _requireUserHasDeposit(initialDeposit); _requireUserHasTrove(msg.sender); _requireUserHasETHGain(msg.sender); ICommunityIssuance communityIssuanceCached = communityIssuance; _triggerLQTYIssuance(communityIssuanceCached); uint depositorETHGain = getDepositorETHGain(msg.sender); uint compoundedLUSDDeposit = getCompoundedLUSDDeposit(msg.sender); uint LUSDLoss = initialDeposit.sub(compoundedLUSDDeposit); // Needed only for event log // First pay out any LQTY gains address frontEnd = deposits[msg.sender].frontEndTag; _payOutLQTYGains(communityIssuanceCached, msg.sender, frontEnd); // Update front end stake uint compoundedFrontEndStake = getCompoundedFrontEndStake(frontEnd); uint newFrontEndStake = compoundedFrontEndStake; _updateFrontEndStakeAndSnapshots(frontEnd, newFrontEndStake); emit FrontEndStakeChanged(frontEnd, newFrontEndStake, msg.sender); _updateDepositAndSnapshots(msg.sender, compoundedLUSDDeposit); /* Emit events before transferring ETH gain to Trove. This lets the event log make more sense (i.e. so it appears that first the ETH gain is withdrawn and then it is deposited into the Trove, not the other way around). */ emit ETHGainWithdrawn(msg.sender, depositorETHGain, LUSDLoss); emit UserDepositChanged(msg.sender, compoundedLUSDDeposit); ETH = ETH.sub(depositorETHGain); emit StabilityPoolETHBalanceUpdated(ETH); emit EtherSent(msg.sender, depositorETHGain); borrowerOperations.moveETHGainToTrove{ value: depositorETHGain }(msg.sender, _upperHint, _lowerHint); } // --- LQTY issuance functions --- function _triggerLQTYIssuance(ICommunityIssuance _communityIssuance) internal { uint LQTYIssuance = _communityIssuance.issueLQTY(); _updateG(LQTYIssuance); } function _updateG(uint _LQTYIssuance) internal { uint totalLUSD = totalLUSDDeposits; // cached to save an SLOAD /* * When total deposits is 0, G is not updated. In this case, the LQTY issued can not be obtained by later * depositors - it is missed out on, and remains in the balanceof the CommunityIssuance contract. * */ if (totalLUSD == 0 || _LQTYIssuance == 0) {return;} uint LQTYPerUnitStaked; LQTYPerUnitStaked =_computeLQTYPerUnitStaked(_LQTYIssuance, totalLUSD); uint marginalLQTYGain = LQTYPerUnitStaked.mul(P); epochToScaleToG[currentEpoch][currentScale] = epochToScaleToG[currentEpoch][currentScale].add(marginalLQTYGain); emit G_Updated(epochToScaleToG[currentEpoch][currentScale], currentEpoch, currentScale); } function _computeLQTYPerUnitStaked(uint _LQTYIssuance, uint _totalLUSDDeposits) internal returns (uint) { /* * Calculate the LQTY-per-unit staked. Division uses a "feedback" error correction, to keep the * cumulative error low in the running total G: * * 1) Form a numerator which compensates for the floor division error that occurred the last time this * function was called. * 2) Calculate "per-unit-staked" ratio. * 3) Multiply the ratio back by its denominator, to reveal the current floor division error. * 4) Store this error for use in the next correction when this function is called. * 5) Note: static analysis tools complain about this "division before multiplication", however, it is intended. */ uint LQTYNumerator = _LQTYIssuance.mul(DECIMAL_PRECISION).add(lastLQTYError); uint LQTYPerUnitStaked = LQTYNumerator.div(_totalLUSDDeposits); lastLQTYError = LQTYNumerator.sub(LQTYPerUnitStaked.mul(_totalLUSDDeposits)); return LQTYPerUnitStaked; } // --- Liquidation functions --- /* * Cancels out the specified debt against the LUSD contained in the Stability Pool (as far as possible) * and transfers the Trove's ETH collateral from ActivePool to StabilityPool. * Only called by liquidation functions in the TroveManager. */ function offset(uint _debtToOffset, uint _collToAdd) external override { _requireCallerIsTroveManager(); uint totalLUSD = totalLUSDDeposits; // cached to save an SLOAD if (totalLUSD == 0 || _debtToOffset == 0) { return; } _triggerLQTYIssuance(communityIssuance); (uint ETHGainPerUnitStaked, uint LUSDLossPerUnitStaked) = _computeRewardsPerUnitStaked(_collToAdd, _debtToOffset, totalLUSD); _updateRewardSumAndProduct(ETHGainPerUnitStaked, LUSDLossPerUnitStaked); // updates S and P _moveOffsetCollAndDebt(_collToAdd, _debtToOffset); } // --- Offset helper functions --- function _computeRewardsPerUnitStaked( uint _collToAdd, uint _debtToOffset, uint _totalLUSDDeposits ) internal returns (uint ETHGainPerUnitStaked, uint LUSDLossPerUnitStaked) { /* * Compute the LUSD and ETH rewards. Uses a "feedback" error correction, to keep * the cumulative error in the P and S state variables low: * * 1) Form numerators which compensate for the floor division errors that occurred the last time this * function was called. * 2) Calculate "per-unit-staked" ratios. * 3) Multiply each ratio back by its denominator, to reveal the current floor division error. * 4) Store these errors for use in the next correction when this function is called. * 5) Note: static analysis tools complain about this "division before multiplication", however, it is intended. */ uint ETHNumerator = _collToAdd.mul(DECIMAL_PRECISION).add(lastETHError_Offset); assert(_debtToOffset <= _totalLUSDDeposits); if (_debtToOffset == _totalLUSDDeposits) { LUSDLossPerUnitStaked = DECIMAL_PRECISION; // When the Pool depletes to 0, so does each deposit lastLUSDLossError_Offset = 0; } else { uint LUSDLossNumerator = _debtToOffset.mul(DECIMAL_PRECISION).sub(lastLUSDLossError_Offset); /* * Add 1 to make error in quotient positive. We want "slightly too much" LUSD loss, * which ensures the error in any given compoundedLUSDDeposit favors the Stability Pool. */ LUSDLossPerUnitStaked = (LUSDLossNumerator.div(_totalLUSDDeposits)).add(1); lastLUSDLossError_Offset = (LUSDLossPerUnitStaked.mul(_totalLUSDDeposits)).sub(LUSDLossNumerator); } ETHGainPerUnitStaked = ETHNumerator.div(_totalLUSDDeposits); lastETHError_Offset = ETHNumerator.sub(ETHGainPerUnitStaked.mul(_totalLUSDDeposits)); return (ETHGainPerUnitStaked, LUSDLossPerUnitStaked); } // Update the Stability Pool reward sum S and product P function _updateRewardSumAndProduct(uint _ETHGainPerUnitStaked, uint _LUSDLossPerUnitStaked) internal { uint currentP = P; uint newP; assert(_LUSDLossPerUnitStaked <= DECIMAL_PRECISION); /* * The newProductFactor is the factor by which to change all deposits, due to the depletion of Stability Pool LUSD in the liquidation. * We make the product factor 0 if there was a pool-emptying. Otherwise, it is (1 - LUSDLossPerUnitStaked) */ uint newProductFactor = uint(DECIMAL_PRECISION).sub(_LUSDLossPerUnitStaked); uint128 currentScaleCached = currentScale; uint128 currentEpochCached = currentEpoch; uint currentS = epochToScaleToSum[currentEpochCached][currentScaleCached]; /* * Calculate the new S first, before we update P. * The ETH gain for any given depositor from a liquidation depends on the value of their deposit * (and the value of totalDeposits) prior to the Stability being depleted by the debt in the liquidation. * * Since S corresponds to ETH gain, and P to deposit loss, we update S first. */ uint marginalETHGain = _ETHGainPerUnitStaked.mul(currentP); uint newS = currentS.add(marginalETHGain); epochToScaleToSum[currentEpochCached][currentScaleCached] = newS; emit S_Updated(newS, currentEpochCached, currentScaleCached); // If the Stability Pool was emptied, increment the epoch, and reset the scale and product P if (newProductFactor == 0) { currentEpoch = currentEpochCached.add(1); emit EpochUpdated(currentEpoch); currentScale = 0; emit ScaleUpdated(currentScale); newP = DECIMAL_PRECISION; // If multiplying P by a non-zero product factor would reduce P below the scale boundary, increment the scale } else if (currentP.mul(newProductFactor).div(DECIMAL_PRECISION) < SCALE_FACTOR) { newP = currentP.mul(newProductFactor).mul(SCALE_FACTOR).div(DECIMAL_PRECISION); currentScale = currentScaleCached.add(1); emit ScaleUpdated(currentScale); } else { newP = currentP.mul(newProductFactor).div(DECIMAL_PRECISION); } assert(newP > 0); P = newP; emit P_Updated(newP); } function _moveOffsetCollAndDebt(uint _collToAdd, uint _debtToOffset) internal { IActivePool activePoolCached = activePool; // Cancel the liquidated LUSD debt with the LUSD in the stability pool activePoolCached.decreaseLUSDDebt(_debtToOffset); _decreaseLUSD(_debtToOffset); // Burn the debt that was successfully offset lusdToken.burn(address(this), _debtToOffset); activePoolCached.sendETH(address(this), _collToAdd); } function _decreaseLUSD(uint _amount) internal { uint newTotalLUSDDeposits = totalLUSDDeposits.sub(_amount); totalLUSDDeposits = newTotalLUSDDeposits; emit StabilityPoolLUSDBalanceUpdated(newTotalLUSDDeposits); } // --- Reward calculator functions for depositor and front end --- /* Calculates the ETH gain earned by the deposit since its last snapshots were taken. * Given by the formula: E = d0 * (S - S(0))/P(0) * where S(0) and P(0) are the depositor's snapshots of the sum S and product P, respectively. * d0 is the last recorded deposit value. */ function getDepositorETHGain(address _depositor) public view override returns (uint) { uint initialDeposit = deposits[_depositor].initialValue; if (initialDeposit == 0) { return 0; } Snapshots memory snapshots = depositSnapshots[_depositor]; uint ETHGain = _getETHGainFromSnapshots(initialDeposit, snapshots); return ETHGain; } function _getETHGainFromSnapshots(uint initialDeposit, Snapshots memory snapshots) internal view returns (uint) { /* * Grab the sum 'S' from the epoch at which the stake was made. The ETH gain may span up to one scale change. * If it does, the second portion of the ETH gain is scaled by 1e9. * If the gain spans no scale change, the second portion will be 0. */ uint128 epochSnapshot = snapshots.epoch; uint128 scaleSnapshot = snapshots.scale; uint S_Snapshot = snapshots.S; uint P_Snapshot = snapshots.P; uint firstPortion = epochToScaleToSum[epochSnapshot][scaleSnapshot].sub(S_Snapshot); uint secondPortion = epochToScaleToSum[epochSnapshot][scaleSnapshot.add(1)].div(SCALE_FACTOR); uint ETHGain = initialDeposit.mul(firstPortion.add(secondPortion)).div(P_Snapshot).div(DECIMAL_PRECISION); return ETHGain; } /* * Calculate the LQTY gain earned by a deposit since its last snapshots were taken. * Given by the formula: LQTY = d0 * (G - G(0))/P(0) * where G(0) and P(0) are the depositor's snapshots of the sum G and product P, respectively. * d0 is the last recorded deposit value. */ function getDepositorLQTYGain(address _depositor) public view override returns (uint) { uint initialDeposit = deposits[_depositor].initialValue; if (initialDeposit == 0) {return 0;} address frontEndTag = deposits[_depositor].frontEndTag; /* * If not tagged with a front end, the depositor gets a 100% cut of what their deposit earned. * Otherwise, their cut of the deposit's earnings is equal to the kickbackRate, set by the front end through * which they made their deposit. */ uint kickbackRate = frontEndTag == address(0) ? DECIMAL_PRECISION : frontEnds[frontEndTag].kickbackRate; Snapshots memory snapshots = depositSnapshots[_depositor]; uint LQTYGain = kickbackRate.mul(_getLQTYGainFromSnapshots(initialDeposit, snapshots)).div(DECIMAL_PRECISION); return LQTYGain; } /* * Return the LQTY gain earned by the front end. Given by the formula: E = D0 * (G - G(0))/P(0) * where G(0) and P(0) are the depositor's snapshots of the sum G and product P, respectively. * * D0 is the last recorded value of the front end's total tagged deposits. */ function getFrontEndLQTYGain(address _frontEnd) public view override returns (uint) { uint frontEndStake = frontEndStakes[_frontEnd]; if (frontEndStake == 0) { return 0; } uint kickbackRate = frontEnds[_frontEnd].kickbackRate; uint frontEndShare = uint(DECIMAL_PRECISION).sub(kickbackRate); Snapshots memory snapshots = frontEndSnapshots[_frontEnd]; uint LQTYGain = frontEndShare.mul(_getLQTYGainFromSnapshots(frontEndStake, snapshots)).div(DECIMAL_PRECISION); return LQTYGain; } function _getLQTYGainFromSnapshots(uint initialStake, Snapshots memory snapshots) internal view returns (uint) { /* * Grab the sum 'G' from the epoch at which the stake was made. The LQTY gain may span up to one scale change. * If it does, the second portion of the LQTY gain is scaled by 1e9. * If the gain spans no scale change, the second portion will be 0. */ uint128 epochSnapshot = snapshots.epoch; uint128 scaleSnapshot = snapshots.scale; uint G_Snapshot = snapshots.G; uint P_Snapshot = snapshots.P; uint firstPortion = epochToScaleToG[epochSnapshot][scaleSnapshot].sub(G_Snapshot); uint secondPortion = epochToScaleToG[epochSnapshot][scaleSnapshot.add(1)].div(SCALE_FACTOR); uint LQTYGain = initialStake.mul(firstPortion.add(secondPortion)).div(P_Snapshot).div(DECIMAL_PRECISION); return LQTYGain; } // --- Compounded deposit and compounded front end stake --- /* * Return the user's compounded deposit. Given by the formula: d = d0 * P/P(0) * where P(0) is the depositor's snapshot of the product P, taken when they last updated their deposit. */ function getCompoundedLUSDDeposit(address _depositor) public view override returns (uint) { uint initialDeposit = deposits[_depositor].initialValue; if (initialDeposit == 0) { return 0; } Snapshots memory snapshots = depositSnapshots[_depositor]; uint compoundedDeposit = _getCompoundedStakeFromSnapshots(initialDeposit, snapshots); return compoundedDeposit; } /* * Return the front end's compounded stake. Given by the formula: D = D0 * P/P(0) * where P(0) is the depositor's snapshot of the product P, taken at the last time * when one of the front end's tagged deposits updated their deposit. * * The front end's compounded stake is equal to the sum of its depositors' compounded deposits. */ function getCompoundedFrontEndStake(address _frontEnd) public view override returns (uint) { uint frontEndStake = frontEndStakes[_frontEnd]; if (frontEndStake == 0) { return 0; } Snapshots memory snapshots = frontEndSnapshots[_frontEnd]; uint compoundedFrontEndStake = _getCompoundedStakeFromSnapshots(frontEndStake, snapshots); return compoundedFrontEndStake; } // Internal function, used to calculcate compounded deposits and compounded front end stakes. function _getCompoundedStakeFromSnapshots( uint initialStake, Snapshots memory snapshots ) internal view returns (uint) { uint snapshot_P = snapshots.P; uint128 scaleSnapshot = snapshots.scale; uint128 epochSnapshot = snapshots.epoch; // If stake was made before a pool-emptying event, then it has been fully cancelled with debt -- so, return 0 if (epochSnapshot < currentEpoch) { return 0; } uint compoundedStake; uint128 scaleDiff = currentScale.sub(scaleSnapshot); /* Compute the compounded stake. If a scale change in P was made during the stake's lifetime, * account for it. If more than one scale change was made, then the stake has decreased by a factor of * at least 1e-9 -- so return 0. */ if (scaleDiff == 0) { compoundedStake = initialStake.mul(P).div(snapshot_P); } else if (scaleDiff == 1) { compoundedStake = initialStake.mul(P).div(snapshot_P).div(SCALE_FACTOR); } else { // if scaleDiff >= 2 compoundedStake = 0; } /* * If compounded deposit is less than a billionth of the initial deposit, return 0. * * NOTE: originally, this line was in place to stop rounding errors making the deposit too large. However, the error * corrections should ensure the error in P "favors the Pool", i.e. any given compounded deposit should slightly less * than it's theoretical value. * * Thus it's unclear whether this line is still really needed. */ if (compoundedStake < initialStake.div(1e9)) {return 0;} return compoundedStake; } // --- Sender functions for LUSD deposit, ETH gains and LQTY gains --- // Transfer the LUSD tokens from the user to the Stability Pool's address, and update its recorded LUSD function _sendLUSDtoStabilityPool(address _address, uint _amount) internal { lusdToken.sendToPool(_address, address(this), _amount); uint newTotalLUSDDeposits = totalLUSDDeposits.add(_amount); totalLUSDDeposits = newTotalLUSDDeposits; emit StabilityPoolLUSDBalanceUpdated(newTotalLUSDDeposits); } function _sendETHGainToDepositor(uint _amount) internal { if (_amount == 0) {return;} uint newETH = ETH.sub(_amount); ETH = newETH; emit StabilityPoolETHBalanceUpdated(newETH); emit EtherSent(msg.sender, _amount); (bool success, ) = msg.sender.call{ value: _amount }(""); require(success, "StabilityPool: sending ETH failed"); } // Send LUSD to user and decrease LUSD in Pool function _sendLUSDToDepositor(address _depositor, uint LUSDWithdrawal) internal { if (LUSDWithdrawal == 0) {return;} lusdToken.returnFromPool(address(this), _depositor, LUSDWithdrawal); _decreaseLUSD(LUSDWithdrawal); } // --- External Front End functions --- // Front end makes a one-time selection of kickback rate upon registering function registerFrontEnd(uint _kickbackRate) external override { _requireFrontEndNotRegistered(msg.sender); _requireUserHasNoDeposit(msg.sender); _requireValidKickbackRate(_kickbackRate); frontEnds[msg.sender].kickbackRate = _kickbackRate; frontEnds[msg.sender].registered = true; emit FrontEndRegistered(msg.sender, _kickbackRate); } // --- Stability Pool Deposit Functionality --- function _setFrontEndTag(address _depositor, address _frontEndTag) internal { deposits[_depositor].frontEndTag = _frontEndTag; emit FrontEndTagSet(_depositor, _frontEndTag); } function _updateDepositAndSnapshots(address _depositor, uint _newValue) internal { deposits[_depositor].initialValue = _newValue; if (_newValue == 0) { delete deposits[_depositor].frontEndTag; delete depositSnapshots[_depositor]; emit DepositSnapshotUpdated(_depositor, 0, 0, 0); return; } uint128 currentScaleCached = currentScale; uint128 currentEpochCached = currentEpoch; uint currentP = P; // Get S and G for the current epoch and current scale uint currentS = epochToScaleToSum[currentEpochCached][currentScaleCached]; uint currentG = epochToScaleToG[currentEpochCached][currentScaleCached]; // Record new snapshots of the latest running product P, sum S, and sum G, for the depositor depositSnapshots[_depositor].P = currentP; depositSnapshots[_depositor].S = currentS; depositSnapshots[_depositor].G = currentG; depositSnapshots[_depositor].scale = currentScaleCached; depositSnapshots[_depositor].epoch = currentEpochCached; emit DepositSnapshotUpdated(_depositor, currentP, currentS, currentG); } function _updateFrontEndStakeAndSnapshots(address _frontEnd, uint _newValue) internal { frontEndStakes[_frontEnd] = _newValue; if (_newValue == 0) { delete frontEndSnapshots[_frontEnd]; emit FrontEndSnapshotUpdated(_frontEnd, 0, 0); return; } uint128 currentScaleCached = currentScale; uint128 currentEpochCached = currentEpoch; uint currentP = P; // Get G for the current epoch and current scale uint currentG = epochToScaleToG[currentEpochCached][currentScaleCached]; // Record new snapshots of the latest running product P and sum G for the front end frontEndSnapshots[_frontEnd].P = currentP; frontEndSnapshots[_frontEnd].G = currentG; frontEndSnapshots[_frontEnd].scale = currentScaleCached; frontEndSnapshots[_frontEnd].epoch = currentEpochCached; emit FrontEndSnapshotUpdated(_frontEnd, currentP, currentG); } function _payOutLQTYGains(ICommunityIssuance _communityIssuance, address _depositor, address _frontEnd) internal { // Pay out front end's LQTY gain if (_frontEnd != address(0)) { uint frontEndLQTYGain = getFrontEndLQTYGain(_frontEnd); _communityIssuance.sendLQTY(_frontEnd, frontEndLQTYGain); emit LQTYPaidToFrontEnd(_frontEnd, frontEndLQTYGain); } // Pay out depositor's LQTY gain uint depositorLQTYGain = getDepositorLQTYGain(_depositor); _communityIssuance.sendLQTY(_depositor, depositorLQTYGain); emit LQTYPaidToDepositor(_depositor, depositorLQTYGain); } // --- 'require' functions --- function _requireCallerIsActivePool() internal view { require( msg.sender == address(activePool), "StabilityPool: Caller is not ActivePool"); } function _requireCallerIsTroveManager() internal view { require(msg.sender == address(troveManager), "StabilityPool: Caller is not TroveManager"); } function _requireNoUnderCollateralizedTroves() internal { uint price = priceFeed.fetchPrice(); address lowestTrove = sortedTroves.getLast(); uint ICR = troveManager.getCurrentICR(lowestTrove, price); require(ICR >= MCR, "StabilityPool: Cannot withdraw while there are troves with ICR < MCR"); } function _requireUserHasDeposit(uint _initialDeposit) internal pure { require(_initialDeposit > 0, 'StabilityPool: User must have a non-zero deposit'); } function _requireUserHasNoDeposit(address _address) internal view { uint initialDeposit = deposits[_address].initialValue; require(initialDeposit == 0, 'StabilityPool: User must have no deposit'); } function _requireNonZeroAmount(uint _amount) internal pure { require(_amount > 0, 'StabilityPool: Amount must be non-zero'); } function _requireUserHasTrove(address _depositor) internal view { require(troveManager.getTroveStatus(_depositor) == 1, "StabilityPool: caller must have an active trove to withdraw ETHGain to"); } function _requireUserHasETHGain(address _depositor) internal view { uint ETHGain = getDepositorETHGain(_depositor); require(ETHGain > 0, "StabilityPool: caller must have non-zero ETH Gain"); } function _requireFrontEndNotRegistered(address _address) internal view { require(!frontEnds[_address].registered, "StabilityPool: must not already be a registered front end"); } function _requireFrontEndIsRegisteredOrZero(address _address) internal view { require(frontEnds[_address].registered || _address == address(0), "StabilityPool: Tag must be a registered front end, or the zero address"); } function _requireValidKickbackRate(uint _kickbackRate) internal pure { require (_kickbackRate <= DECIMAL_PRECISION, "StabilityPool: Kickback rate must be in range [0,1]"); } // --- Fallback function --- receive() external payable { _requireCallerIsActivePool(); ETH = ETH.add(msg.value); StabilityPoolETHBalanceUpdated(ETH); } } // File contracts/B.Protocol/crop.sol // AGPL-3.0-or-later // Copyright (C) 2021 Dai Foundation // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. pragma solidity 0.6.11; interface VatLike { function urns(bytes32, address) external view returns (uint256, uint256); function gem(bytes32, address) external view returns (uint256); function slip(bytes32, address, int256) external; } interface ERC20 { function balanceOf(address owner) external view returns (uint256); function transfer(address dst, uint256 amount) external returns (bool); function transferFrom(address src, address dst, uint256 amount) external returns (bool); function approve(address spender, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function decimals() external returns (uint8); } // receives tokens and shares them among holders contract CropJoin { VatLike public immutable vat; // cdp engine bytes32 public immutable ilk; // collateral type ERC20 public immutable gem; // collateral token uint256 public immutable dec; // gem decimals ERC20 public immutable bonus; // rewards token uint256 public share; // crops per gem [ray] uint256 public total; // total gems [wad] uint256 public stock; // crop balance [wad] mapping (address => uint256) public crops; // crops per user [wad] mapping (address => uint256) public stake; // gems per user [wad] uint256 immutable internal to18ConversionFactor; uint256 immutable internal toGemConversionFactor; // --- Events --- event Join(uint256 val); event Exit(uint256 val); event Flee(); event Tack(address indexed src, address indexed dst, uint256 wad); constructor(address vat_, bytes32 ilk_, address gem_, address bonus_) public { vat = VatLike(vat_); ilk = ilk_; gem = ERC20(gem_); uint256 dec_ = ERC20(gem_).decimals(); require(dec_ <= 18); dec = dec_; to18ConversionFactor = 10 ** (18 - dec_); toGemConversionFactor = 10 ** dec_; bonus = ERC20(bonus_); } function add(uint256 x, uint256 y) public pure returns (uint256 z) { require((z = x + y) >= x, "ds-math-add-overflow"); } function sub(uint256 x, uint256 y) public pure returns (uint256 z) { require((z = x - y) <= x, "ds-math-sub-underflow"); } function mul(uint256 x, uint256 y) public pure returns (uint256 z) { require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow"); } function divup(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(x, sub(y, 1)) / y; } uint256 constant WAD = 10 ** 18; function wmul(uint256 x, uint256 y) public pure returns (uint256 z) { z = mul(x, y) / WAD; } function wdiv(uint256 x, uint256 y) public pure returns (uint256 z) { z = mul(x, WAD) / y; } function wdivup(uint256 x, uint256 y) public pure returns (uint256 z) { z = divup(mul(x, WAD), y); } uint256 constant RAY = 10 ** 27; function rmul(uint256 x, uint256 y) public pure returns (uint256 z) { z = mul(x, y) / RAY; } function rmulup(uint256 x, uint256 y) public pure returns (uint256 z) { z = divup(mul(x, y), RAY); } function rdiv(uint256 x, uint256 y) public pure returns (uint256 z) { z = mul(x, RAY) / y; } // Net Asset Valuation [wad] function nav() public virtual returns (uint256) { uint256 _nav = gem.balanceOf(address(this)); return mul(_nav, to18ConversionFactor); } // Net Assets per Share [wad] function nps() public returns (uint256) { if (total == 0) return WAD; else return wdiv(nav(), total); } function crop() internal virtual returns (uint256) { return sub(bonus.balanceOf(address(this)), stock); } function harvest(address from, address to) internal { if (total > 0) share = add(share, rdiv(crop(), total)); uint256 last = crops[from]; uint256 curr = rmul(stake[from], share); if (curr > last) require(bonus.transfer(to, curr - last)); stock = bonus.balanceOf(address(this)); } function join(address urn, uint256 val) internal virtual { harvest(urn, urn); if (val > 0) { uint256 wad = wdiv(mul(val, to18ConversionFactor), nps()); // Overflow check for int256(wad) cast below // Also enforces a non-zero wad require(int256(wad) > 0); require(gem.transferFrom(msg.sender, address(this), val)); vat.slip(ilk, urn, int256(wad)); total = add(total, wad); stake[urn] = add(stake[urn], wad); } crops[urn] = rmulup(stake[urn], share); emit Join(val); } function exit(address guy, uint256 val) internal virtual { harvest(msg.sender, guy); if (val > 0) { uint256 wad = wdivup(mul(val, to18ConversionFactor), nps()); // Overflow check for int256(wad) cast below // Also enforces a non-zero wad require(int256(wad) > 0); require(gem.transfer(guy, val)); vat.slip(ilk, msg.sender, -int256(wad)); total = sub(total, wad); stake[msg.sender] = sub(stake[msg.sender], wad); } crops[msg.sender] = rmulup(stake[msg.sender], share); emit Exit(val); } } // File contracts/B.Protocol/CropJoinAdapter.sol // MIT pragma solidity 0.6.11; // NOTE! - this is not an ERC20 token. transfer is not supported. contract CropJoinAdapter is CropJoin { string constant public name = "B.AMM LUSD-ETH"; string constant public symbol = "LUSDETH"; uint constant public decimals = 18; event Transfer(address indexed _from, address indexed _to, uint256 _value); constructor(address _lqty) public CropJoin(address(new Dummy()), "B.AMM", address(new DummyGem()), _lqty) { } // adapter to cropjoin function nav() public override returns (uint256) { return total; } function totalSupply() public view returns (uint256) { return total; } function balanceOf(address owner) public view returns (uint256 balance) { balance = stake[owner]; } function mint(address to, uint value) virtual internal { join(to, value); emit Transfer(address(0), to, value); } function burn(address owner, uint value) virtual internal { exit(owner, value); emit Transfer(owner, address(0), value); } } contract Dummy { fallback() external {} } contract DummyGem is Dummy { function transfer(address, uint) external pure returns(bool) { return true; } function transferFrom(address, address, uint) external pure returns(bool) { return true; } function decimals() external pure returns(uint) { return 18; } } // File contracts/B.Protocol/PriceFormula.sol // MIT pragma solidity 0.6.11; contract PriceFormula { using SafeMath for uint256; function getSumFixedPoint(uint x, uint y, uint A) public pure returns(uint) { if(x == 0 && y == 0) return 0; uint sum = x.add(y); for(uint i = 0 ; i < 255 ; i++) { uint dP = sum; dP = dP.mul(sum) / (x.mul(2)).add(1); dP = dP.mul(sum) / (y.mul(2)).add(1); uint prevSum = sum; uint n = (A.mul(2).mul(x.add(y)).add(dP.mul(2))).mul(sum); uint d = (A.mul(2).sub(1).mul(sum)); sum = n / d.add(dP.mul(3)); if(sum <= prevSum.add(1) && prevSum <= sum.add(1)) break; } return sum; } function getReturn(uint xQty, uint xBalance, uint yBalance, uint A) public pure returns(uint) { uint sum = getSumFixedPoint(xBalance, yBalance, A); uint c = sum.mul(sum) / (xQty.add(xBalance)).mul(2); c = c.mul(sum) / A.mul(4); uint b = (xQty.add(xBalance)).add(sum / A.mul(2)); uint yPrev = 0; uint y = sum; for(uint i = 0 ; i < 255 ; i++) { yPrev = y; uint n = (y.mul(y)).add(c); uint d = y.mul(2).add(b).sub(sum); y = n / d; if(y <= yPrev.add(1) && yPrev <= y.add(1)) break; } return yBalance.sub(y).sub(1); } } // File contracts/Dependencies/AggregatorV3Interface.sol // MIT // Code from https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.sol pragma solidity 0.6.11; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both raise "No data present" // if they do not have data to report, instead of returning unset values // which could be misinterpreted as actual reported values. function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); } // File contracts/B.Protocol/BAMM.sol // MIT pragma solidity 0.6.11; contract BAMM is CropJoinAdapter, PriceFormula, Ownable { using SafeMath for uint256; AggregatorV3Interface public immutable priceAggregator; AggregatorV3Interface public immutable lusd2UsdPriceAggregator; IERC20 public immutable LUSD; StabilityPool immutable public SP; address payable public immutable feePool; uint public constant MAX_FEE = 100; // 1% uint public fee = 0; // fee in bps uint public A = 20; uint public constant MIN_A = 20; uint public constant MAX_A = 200; uint public immutable maxDiscount; // max discount in bips address public immutable frontEndTag; uint constant public PRECISION = 1e18; event ParamsSet(uint A, uint fee); event UserDeposit(address indexed user, uint lusdAmount, uint numShares); event UserWithdraw(address indexed user, uint lusdAmount, uint ethAmount, uint numShares); event RebalanceSwap(address indexed user, uint lusdAmount, uint ethAmount, uint timestamp); constructor( address _priceAggregator, address _lusd2UsdPriceAggregator, address payable _SP, address _LUSD, address _LQTY, uint _maxDiscount, address payable _feePool, address _fronEndTag) public CropJoinAdapter(_LQTY) { priceAggregator = AggregatorV3Interface(_priceAggregator); lusd2UsdPriceAggregator = AggregatorV3Interface(_lusd2UsdPriceAggregator); LUSD = IERC20(_LUSD); SP = StabilityPool(_SP); feePool = _feePool; maxDiscount = _maxDiscount; frontEndTag = _fronEndTag; } function setParams(uint _A, uint _fee) external onlyOwner { require(_fee <= MAX_FEE, "setParams: fee is too big"); require(_A >= MIN_A, "setParams: A too small"); require(_A <= MAX_A, "setParams: A too big"); fee = _fee; A = _A; emit ParamsSet(_A, _fee); } function fetchPrice() public view returns(uint) { uint chainlinkDecimals; uint chainlinkLatestAnswer; uint chainlinkTimestamp; // First, try to get current decimal precision: try priceAggregator.decimals() returns (uint8 decimals) { // If call to Chainlink succeeds, record the current decimal precision chainlinkDecimals = decimals; } catch { // If call to Chainlink aggregator reverts, return a zero response with success = false return 0; } // Secondly, try to get latest price data: try priceAggregator.latestRoundData() returns ( uint80 /* roundId */, int256 answer, uint256 /* startedAt */, uint256 timestamp, uint80 /* answeredInRound */ ) { // If call to Chainlink succeeds, return the response and success = true chainlinkLatestAnswer = uint(answer); chainlinkTimestamp = timestamp; } catch { // If call to Chainlink aggregator reverts, return a zero response with success = false return 0; } if(chainlinkTimestamp + 1 hours < now) return 0; // price is down uint chainlinkFactor = 10 ** chainlinkDecimals; return chainlinkLatestAnswer.mul(PRECISION) / chainlinkFactor; } function deposit(uint lusdAmount) external { // update share uint lusdValue = SP.getCompoundedLUSDDeposit(address(this)); uint ethValue = SP.getDepositorETHGain(address(this)).add(address(this).balance); uint price = fetchPrice(); require(ethValue == 0 || price > 0, "deposit: chainlink is down"); uint totalValue = lusdValue.add(ethValue.mul(price) / PRECISION); // this is in theory not reachable. if it is, better halt deposits // the condition is equivalent to: (totalValue = 0) ==> (total = 0) require(totalValue > 0 || total == 0, "deposit: system is rekt"); uint newShare = PRECISION; if(total > 0) newShare = total.mul(lusdAmount) / totalValue; // deposit require(LUSD.transferFrom(msg.sender, address(this), lusdAmount), "deposit: transferFrom failed"); SP.provideToSP(lusdAmount, frontEndTag); // update LP token mint(msg.sender, newShare); emit UserDeposit(msg.sender, lusdAmount, newShare); } function withdraw(uint numShares) external { uint lusdValue = SP.getCompoundedLUSDDeposit(address(this)); uint ethValue = SP.getDepositorETHGain(address(this)).add(address(this).balance); uint lusdAmount = lusdValue.mul(numShares).div(total); uint ethAmount = ethValue.mul(numShares).div(total); // this withdraws lusd, lqty, and eth SP.withdrawFromSP(lusdAmount); // update LP token burn(msg.sender, numShares); // send lusd and eth if(lusdAmount > 0) LUSD.transfer(msg.sender, lusdAmount); if(ethAmount > 0) { (bool success, ) = msg.sender.call{ value: ethAmount }(""); // re-entry is fine here require(success, "withdraw: sending ETH failed"); } emit UserWithdraw(msg.sender, lusdAmount, ethAmount, numShares); } function addBps(uint n, int bps) internal pure returns(uint) { require(bps <= 10000, "reduceBps: bps exceeds max"); require(bps >= -10000, "reduceBps: bps exceeds min"); return n.mul(uint(10000 + bps)) / 10000; } function compensateForLusdDeviation(uint ethAmount) public view returns(uint newEthAmount) { uint chainlinkDecimals; uint chainlinkLatestAnswer; // get current decimal precision: chainlinkDecimals = lusd2UsdPriceAggregator.decimals(); // Secondly, try to get latest price data: (,int256 answer,,,) = lusd2UsdPriceAggregator.latestRoundData(); chainlinkLatestAnswer = uint(answer); // adjust only if 1 LUSD > 1 USDC. If LUSD < USD, then we give a discount, and rebalance will happen anw if(chainlinkLatestAnswer > 10 ** chainlinkDecimals ) { newEthAmount = ethAmount.mul(chainlinkLatestAnswer) / (10 ** chainlinkDecimals); } else newEthAmount = ethAmount; } function getSwapEthAmount(uint lusdQty) public view returns(uint ethAmount, uint feeLusdAmount) { uint lusdBalance = SP.getCompoundedLUSDDeposit(address(this)); uint ethBalance = SP.getDepositorETHGain(address(this)).add(address(this).balance); uint eth2usdPrice = fetchPrice(); if(eth2usdPrice == 0) return (0, 0); // chainlink is down uint ethUsdValue = ethBalance.mul(eth2usdPrice) / PRECISION; uint maxReturn = addBps(lusdQty.mul(PRECISION) / eth2usdPrice, int(maxDiscount)); uint xQty = lusdQty; uint xBalance = lusdBalance; uint yBalance = lusdBalance.add(ethUsdValue.mul(2)); uint usdReturn = getReturn(xQty, xBalance, yBalance, A); uint basicEthReturn = usdReturn.mul(PRECISION) / eth2usdPrice; basicEthReturn = compensateForLusdDeviation(basicEthReturn); if(ethBalance < basicEthReturn) basicEthReturn = ethBalance; // cannot give more than balance if(maxReturn < basicEthReturn) basicEthReturn = maxReturn; ethAmount = basicEthReturn; feeLusdAmount = addBps(lusdQty, int(fee)).sub(lusdQty); } // get ETH in return to LUSD function swap(uint lusdAmount, uint minEthReturn, address payable dest) public returns(uint) { (uint ethAmount, uint feeAmount) = getSwapEthAmount(lusdAmount); require(ethAmount >= minEthReturn, "swap: low return"); LUSD.transferFrom(msg.sender, address(this), lusdAmount); SP.provideToSP(lusdAmount.sub(feeAmount), frontEndTag); if(feeAmount > 0) LUSD.transfer(feePool, feeAmount); (bool success, ) = dest.call{ value: ethAmount }(""); // re-entry is fine here require(success, "swap: sending ETH failed"); emit RebalanceSwap(msg.sender, lusdAmount, ethAmount, now); return ethAmount; } // kyber network reserve compatible function function trade( IERC20 /* srcToken */, uint256 srcAmount, IERC20 /* destToken */, address payable destAddress, uint256 /* conversionRate */, bool /* validate */ ) external payable returns (bool) { return swap(srcAmount, 0, destAddress) > 0; } function getConversionRate( IERC20 /* src */, IERC20 /* dest */, uint256 srcQty, uint256 /* blockNumber */ ) external view returns (uint256) { (uint ethQty, ) = getSwapEthAmount(srcQty); return ethQty.mul(PRECISION) / srcQty; } receive() external payable {} } // File @openzeppelin/contracts/utils/[email protected] // MIT 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/B.Protocol/KeeperRebate.sol // MIT pragma solidity 0.6.11; pragma experimental ABIEncoderV2; interface FeePoolVaultLike { function op(address target, bytes calldata data, uint value) external; function transferOwnership(address newOwner) external; } contract KeeperRebate is Ownable { using EnumerableSet for EnumerableSet.AddressSet; address immutable public feePool; BAMM immutable public bamm; IERC20 immutable public lusd; IERC20 constant public ETH = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); EnumerableSet.AddressSet keepers; address public keeperLister; struct TokensData { IERC20 inToken; IERC20[] outTokens; IERC20[] rebateTokens; } event SwapSummary(address indexed keeper, IERC20 tokenIn, uint inAmount, IERC20 tokenOut, uint outAmount, uint rebateAmount); event NewLister(address lister); event KeeperListing(address keeper, bool list); constructor(BAMM _bamm) public { bamm = _bamm; lusd = _bamm.LUSD(); feePool = _bamm.feePool(); IERC20(_bamm.LUSD()).approve(address(_bamm), uint(-1)); } function getReturnedSwapAmount(IERC20 tokenIn, uint inAmount, IERC20 tokenOut) public view returns(uint outAmount, IERC20 rebateToken, uint rebateAmount) { if(tokenIn == lusd && tokenOut == ETH) { (outAmount, rebateAmount) = bamm.getSwapEthAmount(inAmount); } rebateToken = lusd; } function swap(IERC20 tokenIn, uint inAmount, IERC20 tokenOut, uint minOutAmount, uint maxRebate, address payable dest) public payable returns(uint outAmount, uint rebateAmount) { require(tokenIn == lusd, "swap: invalid tokenIn"); require(tokenOut == ETH, "swap: invalid tokenOut"); (outAmount, rebateAmount) = swapWithRebate(inAmount, minOutAmount, maxRebate, dest); emit SwapSummary(msg.sender, tokenIn, inAmount, tokenOut, outAmount, rebateAmount); } function getTokens() public view returns(TokensData[] memory tokens) { tokens = new TokensData[](1); tokens[0].inToken = lusd; tokens[0].outTokens = new IERC20[](1); tokens[0].rebateTokens = new IERC20[](1); tokens[0].outTokens[0] = ETH; tokens[0].rebateTokens[0] = lusd; } function transferFeePoolOwnership(address newOwner) public onlyOwner { FeePoolVaultLike(feePool).transferOwnership(newOwner); } function setKeeperLister(address lister) public onlyOwner { keeperLister = lister; emit NewLister(lister); } function listKeeper(address keeper, bool list) public { require(msg.sender == keeperLister, "listKeeper: !lister"); if(list) require(keepers.add(keeper), "listKeeper: keepers.add failed"); else require(keepers.remove(keeper), "listKeeper: keepers.remove failed"); KeeperListing(keeper, list); } function swapWithRebate(uint lusdAmount, uint minEthReturn, uint maxLusdRebate, address payable dest) internal returns(uint ethAmount, uint lusdRebate) { require(keepers.contains(msg.sender), "swapWithRebate: !keeper"); lusd.transferFrom(msg.sender, address(this), lusdAmount); uint feeBps = bamm.fee(); // if lusd amount is 0 it will revert, but this is fine require(feeBps * lusdAmount / lusdAmount == feeBps, "swapWithRebate: overflow"); lusdRebate = feeBps * lusdAmount / 10000; // adjust rebate to max fee if(lusdRebate > maxLusdRebate) lusdRebate = maxLusdRebate; ethAmount = bamm.swap(lusdAmount, minEthReturn, dest); rebate(dest, lusdRebate); } function rebate(address payable dest, uint amount) internal { bytes memory data = abi.encodeWithSignature("transfer(address,uint256)", dest, amount); FeePoolVaultLike(feePool).op(address(lusd), data, 0); } }
Return the maximal value for uint256 if the Trove has a debt of 0. Represents "infinite" CR.
return 2**256 - 1;
503,908
[ 1, 990, 326, 943, 2840, 460, 364, 2254, 5034, 309, 326, 399, 303, 537, 711, 279, 18202, 88, 434, 374, 18, 868, 6706, 87, 315, 267, 9551, 6, 6732, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 327, 576, 636, 5034, 300, 404, 31, 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 ]
// SPDX-License-Identifier: MIT pragma solidity 0.8.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "../../SinglePlus.sol"; import "../../interfaces/compound/ICToken.sol"; import "../../interfaces/fortube/IForTubeReward.sol"; import "../../interfaces/fortube/IForTubeBank.sol"; import "../../interfaces/uniswap/IUniswapRouter.sol"; /** * @dev Single Plus for ForTube BCTB. */ contract ForTubeBTCBPlus is SinglePlus { using SafeERC20Upgradeable for IERC20Upgradeable; address public constant BTCB = address(0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c); address public constant WBNB = address(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c); address public constant FOR = address(0x658A109C5900BC6d2357c87549B651670E5b0539); address public constant FORTUBE_BTCB = address(0xb5C15fD55C73d9BeeC046CB4DAce1e7975DcBBBc); address public constant FORTUBE_CONTROLLER = address(0xc78248D676DeBB4597e88071D3d889eCA70E5469); address public constant FORTUBE_BANK = address(0x0cEA0832e9cdBb5D476040D58Ea07ecfbeBB7672); address public constant FORTUBE_REWARD = address(0x55838F18e79cFd3EA22Eea08Bd3Ec18d67f314ed); address public constant PANCAKE_SWAP_ROUTER = address(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F); /** * @dev Initializes fBTCB+. */ function initialize() public initializer { SinglePlus.initialize(FORTUBE_BTCB, "", ""); } /** * @dev Returns the amount of reward that could be harvested now. * harvestable > 0 means it's time to call harvest. */ function harvestable() public view virtual override returns (uint256) { return IForTubeReward(FORTUBE_REWARD).checkBalance(address(this)); } /** * @dev Harvest additional yield from the investment. * Only governance or strategist can call this function. */ function harvest() public virtual override onlyStrategist { // Harvest from FurTube rewards uint256 _reward = IForTubeReward(FORTUBE_REWARD).checkBalance(address(this)); if (_reward > 0) { IForTubeReward(FORTUBE_REWARD).claimReward(); } uint256 _for = IERC20Upgradeable(FOR).balanceOf(address(this)); // PancakeSawp: FOR --> WBNB --> BTCB if (_for > 0) { IERC20Upgradeable(FOR).approve(PANCAKE_SWAP_ROUTER, _for); address[] memory _path = new address[](3); _path[0] = FOR; _path[1] = WBNB; _path[2] = BTCB; IUniswapRouter(PANCAKE_SWAP_ROUTER).swapExactTokensForTokens(_for, uint256(0), _path, address(this), block.timestamp); } // ForTube: BTCB --> fBTCB uint256 _btcb = IERC20Upgradeable(BTCB).balanceOf(address(this)); if (_btcb > 0) { IERC20Upgradeable(BTCB).approve(FORTUBE_CONTROLLER, _btcb); IForTubeBank(FORTUBE_BANK).deposit(BTCB, _btcb); } uint256 _fbtc = IERC20Upgradeable(FORTUBE_BTCB).balanceOf(address(this)); if (_fbtc == 0) { return; } uint256 _fee = 0; if (performanceFee > 0) { _fee = _fbtc * performanceFee / PERCENT_MAX; IERC20Upgradeable(FORTUBE_BTCB).safeTransfer(treasury, _fee); } // Reinvest to get compound yield. invest(); // Also it's a good time to rebase! rebase(); emit Harvested(FORTUBE_BTCB, _fbtc, _fee); } /** * @dev Checks whether a token can be salvaged via salvageToken(). The following two * tokens are not salvageable: * 1) fBTCB * 2) FOR * @param _token Token to check salvageability. */ function _salvageable(address _token) internal view virtual override returns (bool) { return _token != FORTUBE_BTCB && _token != FOR; } /** * @dev Returns the amount of single plus token is worth for one underlying token, expressed in WAD. * ForTube's fToken interface is compactible with Compound's cToken. */ function _conversionRate() internal view virtual override returns (uint256) { // fBTC has 18 decimals and exchangeRate is in WAD return ICToken(FORTUBE_BTCB).exchangeRateStored(); } }
* @dev Returns the amount of reward that could be harvested now. harvestable > 0 means it's time to call harvest./
function harvestable() public view virtual override returns (uint256) { return IForTubeReward(FORTUBE_REWARD).checkBalance(address(this)); }
6,399,265
[ 1, 1356, 326, 3844, 434, 19890, 716, 3377, 506, 17895, 90, 3149, 2037, 18, 17895, 26923, 429, 405, 374, 4696, 518, 1807, 813, 358, 745, 17895, 26923, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 17895, 26923, 429, 1435, 1071, 1476, 5024, 3849, 1135, 261, 11890, 5034, 13, 288, 203, 3639, 327, 467, 1290, 27195, 17631, 1060, 12, 42, 3871, 3457, 41, 67, 862, 21343, 2934, 1893, 13937, 12, 2867, 12, 2211, 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 ]
./full_match/4/0x3aBAD168DD647b5f84A86170Ee3c3fa55Bc68f48/sources/pfptoken.sol
this is the public function that allows pfp nft holders to claim their pfp tokens, the logic is simple, it checks how many eligible pfp nft tokens you hold and gives you that number times 25m tokens. require that there are still tokens left to be claimed require the claim to be active which is defined as 7 days after the contract was deployed, this cannot be changed the count of claimable tokens starts at zero loop over all the eligible collection addresses the current eligible collection in the loop get the tokens in this collection that sender holds loop over all the tokens in this collection that the sender holds if the token has not already been claimed set the token as claimed so it cannot be reclaimed increment the claimable token count if the sender has more claimable tokens than are remaining we will give them all the remaining unclaimed tokens left the amount of tokens they will get is put into a temporary variable so we can deduct it from the unclaimedTokenCount and then also transfer that same amount to the sender
function claim() public { require(unclaimedTokenCount<MAX_TOKEN_CAP, "ALL TOKENS CLAIMED"); require(isClaimActive(), "CLAIM IS NOT ACTIVE"); uint eligibleNFTs = 0; for (uint i = 0; i < PFP_COLLECTION_ADDRESSES.length; i++) { address currentContractAddress = PFP_COLLECTION_ADDRESSES[i]; uint[] memory tokens = getTokenIds(msg.sender, currentContractAddress); for (uint j = 0; j < tokens.length; j++) { if (!claimedMapping[currentContractAddress][tokens[j]]) { claimedMapping[currentContractAddress][tokens[j]] = true; eligibleNFTs++; } } } if (claimableTokenCount > unclaimedTokenCount) { uint claimedTokenCount = unclaimedTokenCount; unclaimedTokenCount -= claimedTokenCount; this.transfer(msg.sender, claimedTokenCount); return; } this.transfer(msg.sender, claimableTokenCount); }
12,488,036
[ 1, 2211, 353, 326, 1071, 445, 716, 5360, 293, 7944, 290, 1222, 366, 4665, 358, 7516, 3675, 293, 7944, 2430, 16, 326, 4058, 353, 4143, 16, 518, 4271, 3661, 4906, 21351, 293, 7944, 290, 1222, 2430, 1846, 6887, 471, 14758, 1846, 716, 1300, 4124, 6969, 81, 2430, 18, 2583, 716, 1915, 854, 4859, 2430, 2002, 358, 506, 7516, 329, 2583, 326, 7516, 358, 506, 2695, 1492, 353, 2553, 487, 2371, 4681, 1839, 326, 6835, 1703, 19357, 16, 333, 2780, 506, 3550, 326, 1056, 434, 7516, 429, 2430, 2542, 622, 3634, 2798, 1879, 777, 326, 21351, 1849, 6138, 326, 783, 21351, 1849, 316, 326, 2798, 336, 326, 2430, 316, 333, 1849, 716, 5793, 14798, 2798, 1879, 777, 326, 2430, 316, 333, 1849, 716, 326, 5793, 14798, 309, 326, 1147, 711, 486, 1818, 2118, 7516, 329, 444, 326, 1147, 487, 7516, 329, 1427, 518, 2780, 506, 283, 14784, 329, 5504, 326, 2 ]
[ 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, 565, 445, 7516, 1435, 1071, 288, 203, 540, 203, 3639, 2583, 12, 551, 80, 4581, 329, 1345, 1380, 32, 6694, 67, 8412, 67, 17296, 16, 315, 4685, 14275, 55, 29859, 3114, 40, 8863, 203, 540, 203, 3639, 2583, 12, 291, 9762, 3896, 9334, 315, 15961, 3445, 4437, 4269, 21135, 8863, 203, 540, 203, 3639, 2254, 21351, 50, 4464, 87, 273, 374, 31, 203, 540, 203, 3639, 364, 261, 11890, 277, 273, 374, 31, 277, 411, 453, 30246, 67, 25964, 67, 8355, 7031, 1090, 55, 18, 2469, 31, 277, 27245, 288, 203, 2398, 203, 5411, 1758, 783, 8924, 1887, 273, 453, 30246, 67, 25964, 67, 8355, 7031, 1090, 55, 63, 77, 15533, 203, 2398, 203, 5411, 2254, 8526, 3778, 2430, 273, 9162, 2673, 12, 3576, 18, 15330, 16, 783, 8924, 1887, 1769, 203, 2398, 203, 5411, 364, 261, 11890, 525, 273, 374, 31, 525, 411, 2430, 18, 2469, 31, 525, 27245, 288, 203, 1171, 203, 7734, 309, 16051, 14784, 329, 3233, 63, 2972, 8924, 1887, 6362, 7860, 63, 78, 65, 5717, 288, 203, 5397, 203, 10792, 7516, 329, 3233, 63, 2972, 8924, 1887, 6362, 7860, 63, 78, 13563, 273, 638, 31, 203, 5397, 203, 10792, 21351, 50, 4464, 87, 9904, 31, 203, 7734, 289, 203, 5411, 289, 203, 3639, 289, 203, 540, 203, 540, 203, 540, 203, 3639, 309, 261, 14784, 429, 1345, 1380, 405, 6301, 80, 4581, 329, 1345, 1380, 13, 288, 203, 2398, 203, 5411, 2254, 7516, 329, 1345, 1380, 273, 6301, 80, 4581, 329, 1345, 1380, 31, 203, 5411, 6301, 80, 4581, 2 ]
pragma solidity ^0.4.23; /** * @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. */ 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 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; } } contract ExchangeOracle is Ownable { using SafeMath for uint256; uint256 public rate; uint256 public lastRate; uint256 public rateMultiplier = 1000; uint256 public usdMultiplier = 100; address public admin; event RateChanged(uint256 _oldRate, uint256 _newRate); event RateMultiplierChanged(uint256 _oldRateMultiplier, uint256 _newRateMultiplier); event USDMultiplierChanged(uint256 _oldUSDMultiplier, uint256 _newUSDMultiplier); event AdminChanged(address _oldAdmin, address _newAdmin); constructor(address _initialAdmin, uint256 _initialRate) public { require(_initialAdmin != address(0), "Invalid initial admin address"); require(_initialRate > 0, "Invalid initial rate value"); admin = _initialAdmin; rate = _initialRate; lastRate = _initialRate; } modifier onlyAdmin() { require(msg.sender == admin, "Not allowed to execute"); _; } /* * The new rate has to be passed in format: * 250.567 rate = 250 567 passed rate ( 1 ether = 250.567 USD ) * 100 rate = 100 000 passed rate ( 1 ether = 100 USD ) * 1 rate = 1 000 passed rate ( 1 ether = 1 USD ) * 0.01 rate = 10 passed rate ( 100 ethers = 1 USD ) */ function setRate(uint256 _newRate) public onlyAdmin { require(_newRate > 0, "Invalid rate value"); lastRate = rate; rate = _newRate; emit RateChanged(lastRate, _newRate); } /* * By default rateMultiplier = 1000. * With rate multiplier we can set the rate to be a float number. * * We use it as a multiplier because we can not pass float numbers in Ethereum. * If the USD price becomes bigger than ether one, for example -> 1 USD = 10 ethers. * We will pass 100 as rate and this will be relevant to 0.1 USD = 1 ether. */ function setRateMultiplier(uint256 _newRateMultiplier) public onlyAdmin { require(_newRateMultiplier > 0, "Invalid rate multiplier value"); uint256 oldRateMultiplier = rateMultiplier; rateMultiplier = _newRateMultiplier; emit RateMultiplierChanged(oldRateMultiplier, _newRateMultiplier); } /* * By default usdMultiplier is = 100. * With usd multiplier we can set the usd amount to be a float number. * * We use it as a multiplier because we can not pass float numbers in Ethereum. * We will pass 100 as usd amount and this will be relevant to 1 USD. */ function setUSDMultiplier(uint256 _newUSDMultiplier) public onlyAdmin { require(_newUSDMultiplier > 0, "Invalid USD multiplier value"); uint256 oldUSDMultiplier = usdMultiplier; usdMultiplier = _newUSDMultiplier; emit USDMultiplierChanged(oldUSDMultiplier, _newUSDMultiplier); } /* * Set address with admin rights, allowed to execute: * - setRate() * - setRateMultiplier() * - setUSDMultiplier() */ function setAdmin(address _newAdmin) public onlyOwner { require(_newAdmin != address(0), "Invalid admin address"); address oldAdmin = admin; admin = _newAdmin; emit AdminChanged(oldAdmin, _newAdmin); } } contract TokenExchangeOracle is ExchangeOracle { constructor(address _admin, uint256 _initialRate) ExchangeOracle(_admin, _initialRate) public {} /* * Converts the specified USD amount in tokens (usdAmount is multiplied by * corresponding usdMultiplier value, which by default is 100). */ function convertUSDToTokens(uint256 _usdAmount) public view returns (uint256) { return usdToTokens(_usdAmount, rate); } /* * Converts the specified USD amount in tokens (usdAmount is multiplied by * corresponding usdMultiplier value, which by default is 100) using the * lastRate value for the calculation. */ function convertUSDToTokensByLastRate(uint256 _usdAmount) public view returns (uint256) { return usdToTokens(_usdAmount, lastRate); } /* * Converts the specified USD amount in tokens. * * Example: * Token/USD -> 298.758 * convert -> 39.99 USD * * usdAmount rateMultiplier * tokens = ------------- * -------------- * ONE_ETHER_IN_WEI * usdMultiplier rate * */ function usdToTokens(uint256 _usdAmount, uint256 _rate) internal view returns (uint256) { require(_usdAmount > 0, "Invalid USD amount"); uint256 tokens = _usdAmount.mul(rateMultiplier); tokens = tokens.mul(1 ether); tokens = tokens.div(usdMultiplier); tokens = tokens.div(_rate); return tokens; } /* * Converts the specified tokens amount in USD. The returned value is multiplied * by the usdMultiplier value, which is by default 100. */ function convertTokensToUSD(uint256 _tokens) public view returns (uint256) { return tokensToUSD(_tokens, rate); } /* * Converts the specified tokens amount in USD, using the lastRate value for the * calculation. The returned value is multiplied by the usdMultiplier value, * which is by default 100. */ function convertTokensToUSDByLastRate(uint256 _tokens) public view returns (uint256) { return tokensToUSD(_tokens, lastRate); } /* * Converts the specified tokens amount in USD. * * tokens rate * usdAmount = ---------------- * -------------- * usdMultiplier * ONE_ETHER_IN_WEI rateMultiplier * */ function tokensToUSD(uint256 _tokens, uint256 _rate) internal view returns (uint256) { require(_tokens > 0, "Invalid token amount"); uint256 usdAmount = _tokens.mul(_rate); usdAmount = usdAmount.mul(usdMultiplier); usdAmount = usdAmount.div(rateMultiplier); usdAmount = usdAmount.div(1 ether); return usdAmount; } }
Set address with admin rights, allowed to execute: - setRate() - setRateMultiplier() - setUSDMultiplier()/
function setAdmin(address _newAdmin) public onlyOwner { require(_newAdmin != address(0), "Invalid admin address"); address oldAdmin = admin; admin = _newAdmin; emit AdminChanged(oldAdmin, _newAdmin); }
15,884,295
[ 1, 694, 1758, 598, 3981, 14989, 16, 2935, 358, 1836, 30, 565, 300, 444, 4727, 1435, 565, 300, 444, 4727, 23365, 1435, 565, 300, 444, 3378, 40, 23365, 1435, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 4446, 12, 2867, 389, 2704, 4446, 13, 1071, 1338, 5541, 288, 203, 3639, 2583, 24899, 2704, 4446, 480, 1758, 12, 20, 3631, 315, 1941, 3981, 1758, 8863, 203, 203, 3639, 1758, 1592, 4446, 273, 3981, 31, 203, 3639, 3981, 273, 389, 2704, 4446, 31, 203, 203, 3639, 3626, 7807, 5033, 12, 1673, 4446, 16, 389, 2704, 4446, 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 ]
./full_match/1/0x3B5fEb767b40D9d29105D254F29B6468b0636FAE/sources/contracts/ssp/recovery.sol
don't use send or xfer (gas)
payable(msg.sender).call{value: address(this).balance}("");
4,988,574
[ 1, 19752, 1404, 999, 1366, 578, 619, 586, 261, 31604, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 8843, 429, 12, 3576, 18, 15330, 2934, 1991, 95, 1132, 30, 1758, 12, 2211, 2934, 12296, 97, 2932, 8863, 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 ]
pragma solidity ^0.4.11; /** * Math operations with safety checks */ library SafeMath { function mul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function div(uint a, uint b) internal returns (uint) { assert(b > 0); uint c = a / b; assert(a == b * c + a % b); return c; } function sub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; } function add(uint a, uint b) internal returns (uint) { uint c = a + b; assert(c >= a); return c; } function max64(uint64 a, uint64 b) internal constant returns (uint64) { return a >= b ? a : b; } function min64(uint64 a, uint64 b) internal constant returns (uint64) { return a < b ? a : b; } function max256(uint256 a, uint256 b) internal constant returns (uint256) { return a >= b ? a : b; } function min256(uint256 a, uint256 b) internal constant returns (uint256) { return a < b ? a : b; } function assert(bool assertion) internal { if (!assertion) { throw; } } } /* * Ownable * * Base contract with an owner. * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. */ contract Ownable { address public owner; function Ownable() { owner = msg.sender; } modifier onlyOwner() { if (msg.sender != owner) { throw; } _; } function transferOwnership(address newOwner) onlyOwner { if (newOwner != address(0)) { owner = newOwner; } } } /* * ERC20Basic * Simpler version of ERC20 interface * see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20Basic { uint public totalSupply; function balanceOf(address who) constant returns (uint); function transfer(address to, uint value); event Transfer(address indexed from, address indexed to, uint value); } /* * Basic token * Basic version of StandardToken, with no allowances */ contract BasicToken is ERC20Basic { using SafeMath for uint; mapping(address => uint) balances; /* * Fix for the ERC20 short address attack */ modifier onlyPayloadSize(uint size) { if(msg.data.length < size + 4) { throw; } _; } function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) { balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); Transfer(msg.sender, _to, _value); } function balanceOf(address _owner) constant returns (uint balance) { return balances[_owner]; } } /** * @title FundableToken - accounts for funds to stand behind it * @author Dmitry Kochin <[email protected]> * We need to store this data to be able to know how much funds are standing behind the tokens * It may come handy in token transformation. For example if prefund would not be successful we * will be able to refund all the invested money */ contract FundableToken is BasicToken { ///Invested funds mapping(address => uint) public funds; ///Total funds behind the tokens uint public totalFunds; function FundableToken() {} } /** * Transform agent transfers tokens to a new contract. It may transform them to another tokens or refund * Transform agent itself can be the token contract, or just a middle man contract doing the heavy lifting. */ contract TransformAgent { ///The original supply of tokens to be transformed uint256 public originalSupply; ///The original funds behind the tokens to be transformed uint256 public originalFunds; /** Interface marker */ function isTransformAgent() public constant returns (bool) { return true; } function transformFrom(address _from, uint256 _tokens, uint256 _funds) public; } /** * A token transform mechanism where users can opt-in amount of tokens to the next smart contract revision. * * First envisioned by Golem and Lunyr projects. */ contract TransformableToken is FundableToken, Ownable { /** The next contract where the tokens will be migrated. */ TransformAgent public transformAgent; /** How many tokens we have transformed by now. */ uint256 public totalTransformedTokens; /** * Transform states. * * - NotAllowed: The child contract has not reached a condition where the transform can bgun * - WaitingForAgent: Token allows transform, but we don't have a new agent yet * - ReadyToTransform: The agent is set, but not a single token has been transformed yet, so we still have a chance to reset agent to another value * - Transforming: Transform agent is set and the balance holders can transform their tokens * */ enum TransformState {Unknown, NotAllowed, WaitingForAgent, ReadyToTransform, Transforming} /** * Somebody has transformd some of his tokens. */ event Transform(address indexed _from, address indexed _to, uint256 _tokens, uint256 _funds); /** * New transform agent available. */ event TransformAgentSet(address agent); /** * Allow the token holder to transform all of their tokens to a new contract. */ function transform() public { TransformState state = getTransformState(); require(state == TransformState.ReadyToTransform || state == TransformState.Transforming); uint tokens = balances[msg.sender]; uint investments = funds[msg.sender]; require(tokens > 0); // Validate input value. balances[msg.sender] = 0; funds[msg.sender] = 0; // Take tokens out from circulation totalSupply = totalSupply.sub(tokens); totalFunds = totalFunds.sub(investments); totalTransformedTokens = totalTransformedTokens.add(tokens); // Transform agent reissues the tokens transformAgent.transformFrom(msg.sender, tokens, investments); Transform(msg.sender, transformAgent, tokens, investments); //Once transformation is finished the contract is not needed anymore if(totalSupply == 0) selfdestruct(owner); } /** * Set an transform agent that handles */ function setTransformAgent(address agent) onlyOwner external { require(agent != 0x0); // Transform has already begun for an agent require(getTransformState() != TransformState.Transforming); transformAgent = TransformAgent(agent); // Bad interface require(transformAgent.isTransformAgent()); // Make sure that token supplies match in source and target require(transformAgent.originalSupply() == totalSupply); require(transformAgent.originalFunds() == totalFunds); TransformAgentSet(transformAgent); } /** * Get the state of the token transform. */ function getTransformState() public constant returns(TransformState) { if(address(transformAgent) == 0x00) return TransformState.WaitingForAgent; else if(totalTransformedTokens == 0) return TransformState.ReadyToTransform; else return TransformState.Transforming; } } /** * Mintable token * * Simple ERC20 Token example, with mintable token creation * Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120 * Based on code by TokenMarketNet: * https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol */ contract MintableToken is BasicToken { /** Crowdsale contract allowed to mint tokens */ function mint(address _to, uint _amount) internal { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); //Announce that we have minted some tokens Transfer(0x0, _to, _amount); } } /// @title Token contract - Implements Standard Token Interface with Ubermensch features. /// @author Dmitry Kochin - <[email protected]> contract UbermenschPrefundToken is MintableToken, TransformableToken { string constant public name = "Ubermensch Prefund"; string constant public symbol = "UMP"; uint constant public decimals = 8; //The price of 1 token in Ether uint constant public TOKEN_PRICE = 0.0025 * 1 ether; //The maximum number of tokens to be sold in crowdsale uint constant public TOKEN_CAP = 20000000 * (10 ** decimals); uint public investorCount; address public multisigWallet; bool public stopped; // A new investment was made event Invested(address indexed investor, uint weiAmount, uint tokenAmount); function UbermenschPrefundToken(address multisig){ //We require that the owner should be multisig wallet //Because owner can make important decisions like stopping prefund //and setting TransformAgent //However this contract can be created by any account. After creation //it automatically transfers ownership to multisig wallet transferOwnership(multisig); multisigWallet = multisig; } modifier onlyActive(){ require(!stopped); //Setting the transfer agent effectively stops prefund require(getTransformState() == TransformState.WaitingForAgent); _; } /** * Returns bonuses based on the current totalSupply in percents * An investor gets the bonus based on the current totalSupply value * even if the resulting totalSupply after an investment corresponds to different bonus */ function getCurrentBonus() public constant returns (uint){ if(totalSupply < 7000000 * (10 ** decimals)) return 180; if(totalSupply < 14000000 * (10 ** decimals)) return 155; return 140; } /// @dev main function to buy tokens to specified address /// @param to The address of token recipient function invest(address to) onlyActive public payable { uint amount = msg.value; //Bonuses are in percents so the final value must be divided by 100 uint tokenAmount = getCurrentBonus().mul(amount).mul(10 ** decimals / 100).div(TOKEN_PRICE); require(tokenAmount >= 0); if(funds[to] == 0) { // A new investor ++investorCount; } // Update investor funds[to] = funds[to].add(amount); totalFunds = totalFunds.add(amount); //mint tokens mint(to, tokenAmount); //We also should not break the token cap //This is exactly "require' and not 'assert' because it depends on msg.value - a user supplied parameters //While 'assert' should correspond to a broken business logic require(totalSupply <= TOKEN_CAP); // Pocket the money multisigWallet.transfer(amount); // Tell us invest was success Invested(to, amount, tokenAmount); } function buy() public payable { invest(msg.sender); } function transfer(address _to, uint _value){ throw; //This prefund token can not be transferred } //Stops the crowdsale forever function stop() onlyOwner { stopped = true; } //We'll try to accept sending ether on the contract address, hope the gas supplied would be enough function () payable{ buy(); } }
* A token transform mechanism where users can opt-in amount of tokens to the next smart contract revision. First envisioned by Golem and Lunyr projects./
contract TransformableToken is FundableToken, Ownable { TransformAgent public transformAgent; uint256 public totalTransformedTokens; still have a chance to reset agent to another value event Transform(address indexed _from, address indexed _to, uint256 _tokens, uint256 _funds); event TransformAgentSet(address agent); enum TransformState {Unknown, NotAllowed, WaitingForAgent, ReadyToTransform, Transforming} function transformFrom(address _from, uint256 _tokens, uint256 _funds) public; } function transform() public { TransformState state = getTransformState(); require(state == TransformState.ReadyToTransform || state == TransformState.Transforming); uint tokens = balances[msg.sender]; uint investments = funds[msg.sender]; balances[msg.sender] = 0; funds[msg.sender] = 0; totalSupply = totalSupply.sub(tokens); totalFunds = totalFunds.sub(investments); totalTransformedTokens = totalTransformedTokens.add(tokens); transformAgent.transformFrom(msg.sender, tokens, investments); Transform(msg.sender, transformAgent, tokens, investments); if(totalSupply == 0) selfdestruct(owner); } function setTransformAgent(address agent) onlyOwner external { require(agent != 0x0); require(getTransformState() != TransformState.Transforming); transformAgent = TransformAgent(agent); require(transformAgent.isTransformAgent()); require(transformAgent.originalSupply() == totalSupply); require(transformAgent.originalFunds() == totalFunds); TransformAgentSet(transformAgent); } function getTransformState() public constant returns(TransformState) { if(address(transformAgent) == 0x00) return TransformState.WaitingForAgent; else if(totalTransformedTokens == 0) return TransformState.ReadyToTransform; else return TransformState.Transforming; } }
12,717,708
[ 1, 37, 1147, 2510, 12860, 1625, 3677, 848, 2153, 17, 267, 3844, 434, 2430, 358, 326, 1024, 13706, 6835, 6350, 18, 5783, 1550, 1951, 329, 635, 611, 790, 81, 471, 511, 318, 30468, 10137, 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 ]
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 11514, 429, 1345, 353, 478, 1074, 429, 1345, 16, 14223, 6914, 288, 203, 203, 565, 11514, 3630, 1071, 2510, 3630, 31, 203, 203, 565, 2254, 5034, 1071, 2078, 4059, 329, 5157, 31, 203, 203, 5411, 4859, 1240, 279, 17920, 358, 2715, 4040, 358, 4042, 460, 203, 203, 565, 871, 11514, 12, 2867, 8808, 389, 2080, 16, 1758, 8808, 389, 869, 16, 2254, 5034, 389, 7860, 16, 2254, 5034, 389, 74, 19156, 1769, 203, 203, 565, 871, 11514, 3630, 694, 12, 2867, 4040, 1769, 203, 203, 565, 2792, 11514, 1119, 288, 4874, 16, 2288, 5042, 16, 23333, 1290, 3630, 16, 26732, 774, 4059, 16, 11514, 310, 97, 203, 565, 445, 2510, 1265, 12, 2867, 389, 2080, 16, 2254, 5034, 389, 7860, 16, 2254, 5034, 389, 74, 19156, 13, 1071, 31, 203, 203, 97, 203, 203, 203, 565, 445, 2510, 1435, 1071, 288, 203, 203, 3639, 11514, 1119, 919, 273, 336, 4059, 1119, 5621, 203, 3639, 2583, 12, 2019, 422, 11514, 1119, 18, 8367, 774, 4059, 747, 919, 422, 11514, 1119, 18, 4059, 310, 1769, 203, 203, 3639, 2254, 2430, 273, 324, 26488, 63, 3576, 18, 15330, 15533, 203, 3639, 2254, 2198, 395, 1346, 273, 284, 19156, 63, 3576, 18, 15330, 15533, 203, 203, 3639, 324, 26488, 63, 3576, 18, 15330, 65, 273, 374, 31, 203, 3639, 284, 19156, 63, 3576, 18, 15330, 65, 273, 374, 31, 203, 203, 3639, 2078, 3088, 1283, 273, 2078, 3088, 1283, 18, 1717, 12, 7860, 1769, 203, 3639, 2078, 42, 19156, 273, 2078, 42, 19156, 18, 1717, 12, 5768, 2 ]