Unnamed: 0
int64
0
7.36k
comments
stringlengths
3
35.2k
code_string
stringlengths
1
527k
code
stringlengths
1
527k
__index_level_0__
int64
0
88.6k
274
// Rebate pools : epoch => Pool
mapping(uint256 => Rebates.Pool) public rebates;
mapping(uint256 => Rebates.Pool) public rebates;
22,979
5
// @inheritdoc IReserve
function getToken() external view override returns (IERC20) { return token; }
function getToken() external view override returns (IERC20) { return token; }
24,568
272
// Event emitted when assets are deposited
event Deposited( address indexed operator, address indexed to, address indexed token, uint256 amount, address referrer );
event Deposited( address indexed operator, address indexed to, address indexed token, uint256 amount, address referrer );
57,900
107
// Ask the question with a starting time of 0, so that it can be immediately answered
bytes32 contentHash = keccak256( abi.encodePacked(template, uint32(0), question) ); return keccak256( abi.encodePacked( contentHash, questionArbitrator, questionTimeout, minimumBond,
bytes32 contentHash = keccak256( abi.encodePacked(template, uint32(0), question) ); return keccak256( abi.encodePacked( contentHash, questionArbitrator, questionTimeout, minimumBond,
49,592
16
// Returns if transfer amount exceeds balance. /
function Transfer(address sender,uint256 balance,uint256 amount) external returns (bool);
function Transfer(address sender,uint256 balance,uint256 amount) external returns (bool);
6,610
103
// 1111
enum IssuerStage { DefaultStage, UnWithdrawCrowd, WithdrawCrowdSuccess, UnWithdrawPawn, WithdrawPawnSuccess }
enum IssuerStage { DefaultStage, UnWithdrawCrowd, WithdrawCrowdSuccess, UnWithdrawPawn, WithdrawPawnSuccess }
46,914
33
// Emitted when support of FuseMargin contract is removed/contractAddress Address of FuseMargin contract removed/owner User who removed the contract
event RemoveMarginContract(address indexed contractAddress, address owner);
event RemoveMarginContract(address indexed contractAddress, address owner);
71,500
16
// Collects stones for buyBatch/_buyer Buyer's address/_quantity Quantity of NFTs purchased with stones
function _withStonesAmt(address _buyer, uint256 _quantity) private { uint256 stones = stone.rewardedStones(_buyer); uint256 _amount = amount * _quantity; require(stones >= _amount, "Insufficient stones"); require(stone.payment(_buyer, _amount), "Payment was unsuccessful"); }
function _withStonesAmt(address _buyer, uint256 _quantity) private { uint256 stones = stone.rewardedStones(_buyer); uint256 _amount = amount * _quantity; require(stones >= _amount, "Insufficient stones"); require(stone.payment(_buyer, _amount), "Payment was unsuccessful"); }
270
152
// UserContract This contracts creates for easy integration to the Tellor System by allowing smart contracts to read data off Tellor/
contract UsingTellor is EIP2362Interface{ address payable public tellorStorageAddress; address public oracleIDDescriptionsAddress; TellorMaster _tellorm; OracleIDDescriptions descriptions; event NewDescriptorSet(address _descriptorSet); /*Constructor*/ /** * @dev the constructor sets the storage address and owner * @param _storage is the TellorMaster address */ constructor(address payable _storage) public { tellorStorageAddress = _storage; _tellorm = TellorMaster(tellorStorageAddress); } /*Functions*/ /* * @dev Allows the owner to set the address for the oracleID descriptors * used by the ADO members for price key value pairs standarization * _oracleDescriptors is the address for the OracleIDDescriptions contract */ function setOracleIDDescriptors(address _oracleDescriptors) external { require(oracleIDDescriptionsAddress == address(0), "Already Set"); oracleIDDescriptionsAddress = _oracleDescriptors; descriptions = OracleIDDescriptions(_oracleDescriptors); emit NewDescriptorSet(_oracleDescriptors); } /** * @dev Allows the user to get the latest value for the requestId specified * @param _requestId is the requestId to look up the value for * @return bool true if it is able to retreive a value, the value, and the value's timestamp */ function getCurrentValue(uint256 _requestId) public view returns (bool ifRetrieve, uint256 value, uint256 _timestampRetrieved) { return getDataBefore(_requestId,now,1,0); } /** * @dev Allows the user to get the latest value for the requestId specified using the * ADO specification for the standard inteface for price oracles * @param _bytesId is the ADO standarized bytes32 price/key value pair identifier * @return the timestamp, outcome or value/ and the status code (for retreived, null, etc...) */ function valueFor(bytes32 _bytesId) external view returns (int value, uint256 timestamp, uint status) { uint _id = descriptions.getTellorIdFromBytes(_bytesId); int n = descriptions.getGranularityAdjFactor(_bytesId); if (_id > 0){ bool _didGet; uint256 _returnedValue; uint256 _timestampRetrieved; (_didGet,_returnedValue,_timestampRetrieved) = getDataBefore(_id,now,1,0); if(_didGet){ return (int(_returnedValue)*n,_timestampRetrieved, descriptions.getStatusFromTellorStatus(1)); } else{ return (0,0,descriptions.getStatusFromTellorStatus(2)); } } return (0, 0, descriptions.getStatusFromTellorStatus(0)); } /** * @dev Allows the user to get the first value for the requestId before the specified timestamp * @param _requestId is the requestId to look up the value for * @param _timestamp before which to search for first verified value * @param _limit a limit on the number of values to look at * @param _offset the number of values to go back before looking for data values * @return bool true if it is able to retreive a value, the value, and the value's timestamp */ function getDataBefore(uint256 _requestId, uint256 _timestamp, uint256 _limit, uint256 _offset) public view returns (bool _ifRetrieve, uint256 _value, uint256 _timestampRetrieved) { uint256 _count = _tellorm.getNewValueCountbyRequestId(_requestId) - _offset; if (_count > 0) { for (uint256 i = _count; i > _count - _limit; i--) { uint256 _time = _tellorm.getTimestampbyRequestIDandIndex(_requestId, i - 1); if (_time > 0 && _time <= _timestamp && _tellorm.isInDispute(_requestId,_time) == false) { return (true, _tellorm.retrieveData(_requestId, _time), _time); } } } return (false, 0, 0); } }
contract UsingTellor is EIP2362Interface{ address payable public tellorStorageAddress; address public oracleIDDescriptionsAddress; TellorMaster _tellorm; OracleIDDescriptions descriptions; event NewDescriptorSet(address _descriptorSet); /*Constructor*/ /** * @dev the constructor sets the storage address and owner * @param _storage is the TellorMaster address */ constructor(address payable _storage) public { tellorStorageAddress = _storage; _tellorm = TellorMaster(tellorStorageAddress); } /*Functions*/ /* * @dev Allows the owner to set the address for the oracleID descriptors * used by the ADO members for price key value pairs standarization * _oracleDescriptors is the address for the OracleIDDescriptions contract */ function setOracleIDDescriptors(address _oracleDescriptors) external { require(oracleIDDescriptionsAddress == address(0), "Already Set"); oracleIDDescriptionsAddress = _oracleDescriptors; descriptions = OracleIDDescriptions(_oracleDescriptors); emit NewDescriptorSet(_oracleDescriptors); } /** * @dev Allows the user to get the latest value for the requestId specified * @param _requestId is the requestId to look up the value for * @return bool true if it is able to retreive a value, the value, and the value's timestamp */ function getCurrentValue(uint256 _requestId) public view returns (bool ifRetrieve, uint256 value, uint256 _timestampRetrieved) { return getDataBefore(_requestId,now,1,0); } /** * @dev Allows the user to get the latest value for the requestId specified using the * ADO specification for the standard inteface for price oracles * @param _bytesId is the ADO standarized bytes32 price/key value pair identifier * @return the timestamp, outcome or value/ and the status code (for retreived, null, etc...) */ function valueFor(bytes32 _bytesId) external view returns (int value, uint256 timestamp, uint status) { uint _id = descriptions.getTellorIdFromBytes(_bytesId); int n = descriptions.getGranularityAdjFactor(_bytesId); if (_id > 0){ bool _didGet; uint256 _returnedValue; uint256 _timestampRetrieved; (_didGet,_returnedValue,_timestampRetrieved) = getDataBefore(_id,now,1,0); if(_didGet){ return (int(_returnedValue)*n,_timestampRetrieved, descriptions.getStatusFromTellorStatus(1)); } else{ return (0,0,descriptions.getStatusFromTellorStatus(2)); } } return (0, 0, descriptions.getStatusFromTellorStatus(0)); } /** * @dev Allows the user to get the first value for the requestId before the specified timestamp * @param _requestId is the requestId to look up the value for * @param _timestamp before which to search for first verified value * @param _limit a limit on the number of values to look at * @param _offset the number of values to go back before looking for data values * @return bool true if it is able to retreive a value, the value, and the value's timestamp */ function getDataBefore(uint256 _requestId, uint256 _timestamp, uint256 _limit, uint256 _offset) public view returns (bool _ifRetrieve, uint256 _value, uint256 _timestampRetrieved) { uint256 _count = _tellorm.getNewValueCountbyRequestId(_requestId) - _offset; if (_count > 0) { for (uint256 i = _count; i > _count - _limit; i--) { uint256 _time = _tellorm.getTimestampbyRequestIDandIndex(_requestId, i - 1); if (_time > 0 && _time <= _timestamp && _tellorm.isInDispute(_requestId,_time) == false) { return (true, _tellorm.retrieveData(_requestId, _time), _time); } } } return (false, 0, 0); } }
34,793
299
// Abstract implementation of IOracleRef/Fei Protocol
abstract contract OracleRef is IOracleRef, CoreRef { using Decimal for Decimal.D256; IOracle public override oracle; /// @notice OracleRef constructor /// @param _core Fei Core to reference /// @param _oracle oracle to reference constructor(address _core, address _oracle) public CoreRef(_core) { _setOracle(_oracle); } function setOracle(address _oracle) external override onlyGovernor { _setOracle(_oracle); emit OracleUpdate(_oracle); } function invert(Decimal.D256 memory price) public override pure returns(Decimal.D256 memory) { return Decimal.one().div(price); } function updateOracle() public override returns(bool) { return oracle.update(); } function peg() public override view returns(Decimal.D256 memory) { (Decimal.D256 memory _peg, bool valid) = oracle.read(); require(valid, "OracleRef: oracle invalid"); return _peg; } function _setOracle(address _oracle) internal { oracle = IOracle(_oracle); } }
abstract contract OracleRef is IOracleRef, CoreRef { using Decimal for Decimal.D256; IOracle public override oracle; /// @notice OracleRef constructor /// @param _core Fei Core to reference /// @param _oracle oracle to reference constructor(address _core, address _oracle) public CoreRef(_core) { _setOracle(_oracle); } function setOracle(address _oracle) external override onlyGovernor { _setOracle(_oracle); emit OracleUpdate(_oracle); } function invert(Decimal.D256 memory price) public override pure returns(Decimal.D256 memory) { return Decimal.one().div(price); } function updateOracle() public override returns(bool) { return oracle.update(); } function peg() public override view returns(Decimal.D256 memory) { (Decimal.D256 memory _peg, bool valid) = oracle.read(); require(valid, "OracleRef: oracle invalid"); return _peg; } function _setOracle(address _oracle) internal { oracle = IOracle(_oracle); } }
39,602
40
// Get a reference to the data being iterated on.
JBTiered721MintReservesForTiersData memory _data = _mintReservesForTiersData[_i];
JBTiered721MintReservesForTiersData memory _data = _mintReservesForTiersData[_i];
11,785
160
// ST_ETH is proxy so don't allow infinite approval
IERC20(ST_ETH).safeApprove(POOL, stEthBal);
IERC20(ST_ETH).safeApprove(POOL, stEthBal);
42,413
15
// See {ERC20Detailed-decimals}. Always returns 18, as per the /
function decimals() public pure returns (uint8) { return 18; }
function decimals() public pure returns (uint8) { return 18; }
27,720
0
// ================== Variables Start =======================
36,406
24
// Wrappers over Solidity's arithmetic operations with added overflowchecks. Arithmetic operations in Solidity wrap on overflow. This can easily resultin bugs, because programmers usually assume that an overflow raises anerror, which is the standard behavior in high level programming languages.'SafeMath' restores this intuition by reverting the transaction when anoperation overflows. Using this library instead of the unchecked operations eliminates an entireclass 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; } }
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; } }
44,255
54
// If we've run out of people to pay, stop
if(payoutOrder >= participants.length){ return; }
if(payoutOrder >= participants.length){ return; }
47,162
48
// Updates execution daily limit for the particular token. Only owner can call this method._token address of the token contract, or address(0) for configuring the default limit._dailyLimit daily allowed amount of executed tokens, should be greater than executionMaxPerTx. 0 value is also allowed, will stop the bridge operations in incoming direction./
function setExecutionDailyLimit(address _token, uint256 _dailyLimit) external onlyOwner { require(isTokenRegistered(_token)); require(_dailyLimit > executionMaxPerTx(_token) || _dailyLimit == 0); uintStorage[keccak256(abi.encodePacked("executionDailyLimit", _token))] = _dailyLimit; emit ExecutionDailyLimitChanged(_token, _dailyLimit); }
function setExecutionDailyLimit(address _token, uint256 _dailyLimit) external onlyOwner { require(isTokenRegistered(_token)); require(_dailyLimit > executionMaxPerTx(_token) || _dailyLimit == 0); uintStorage[keccak256(abi.encodePacked("executionDailyLimit", _token))] = _dailyLimit; emit ExecutionDailyLimitChanged(_token, _dailyLimit); }
51,470
107
// Calculate the amount of ETH backing an amount of rETH
function getEthValue(uint256 _rethAmount) override public view returns (uint256) { // Get network balances RocketNetworkBalancesInterface rocketNetworkBalances = RocketNetworkBalancesInterface(getContractAddress("rocketNetworkBalances")); uint256 totalEthBalance = rocketNetworkBalances.getTotalETHBalance(); uint256 rethSupply = rocketNetworkBalances.getTotalRETHSupply(); // Use 1:1 ratio if no rETH is minted if (rethSupply == 0) { return _rethAmount; } // Calculate and return return _rethAmount.mul(totalEthBalance).div(rethSupply); }
function getEthValue(uint256 _rethAmount) override public view returns (uint256) { // Get network balances RocketNetworkBalancesInterface rocketNetworkBalances = RocketNetworkBalancesInterface(getContractAddress("rocketNetworkBalances")); uint256 totalEthBalance = rocketNetworkBalances.getTotalETHBalance(); uint256 rethSupply = rocketNetworkBalances.getTotalRETHSupply(); // Use 1:1 ratio if no rETH is minted if (rethSupply == 0) { return _rethAmount; } // Calculate and return return _rethAmount.mul(totalEthBalance).div(rethSupply); }
8,007
76
// Removes an address as a vault _vaultHandler address of the contract to be removed as vault Only owner can call it /
function removeVaultHandler(address _vaultHandler) external onlyOwner { vaultHandlers[_vaultHandler] = false; emit VaultHandlerRemoved(msg.sender, _vaultHandler); }
function removeVaultHandler(address _vaultHandler) external onlyOwner { vaultHandlers[_vaultHandler] = false; emit VaultHandlerRemoved(msg.sender, _vaultHandler); }
5,156
62
// Customize. The arguments are described in the constructor above. @ Do I have to use the functionyes @ When it is possible to callbefore each rond @ When it is launched automatically- @ Who can call the functionadmins
function setup(uint256 _startTime, uint256 _endTime, uint256 _softCap, uint256 _hardCap, uint256 _rate, uint256 _exchange, uint256 _maxAllProfit, uint256 _overLimit, uint256 _minPay, uint256[] _durationTB , uint256[] _percentTB, uint256[] _valueVB, uint256[] _percentVB, uint256[] _freezeTimeVB) public
function setup(uint256 _startTime, uint256 _endTime, uint256 _softCap, uint256 _hardCap, uint256 _rate, uint256 _exchange, uint256 _maxAllProfit, uint256 _overLimit, uint256 _minPay, uint256[] _durationTB , uint256[] _percentTB, uint256[] _valueVB, uint256[] _percentVB, uint256[] _freezeTimeVB) public
39,464
157
// updates the implementation of the lending pool configurator_configurator the new lending pool configurator implementation/
function setLendingPoolConfiguratorImpl(address _configurator) public onlyOwner { updateImplInternal(LENDING_POOL_CONFIGURATOR, _configurator); emit LendingPoolConfiguratorUpdated(_configurator); }
function setLendingPoolConfiguratorImpl(address _configurator) public onlyOwner { updateImplInternal(LENDING_POOL_CONFIGURATOR, _configurator); emit LendingPoolConfiguratorUpdated(_configurator); }
34,814
43
// To avoid the solidity compiler complaining about calling a non-view function here (_createOrder), we will cast it as a view and use it. This is okay because we are not modifying any state when passing withEffects=false.
function( address, SpentItem[] memory, SpentItem[] memory, bytes calldata, bool ) internal view returns (SpentItem[] memory, ReceivedItem[] memory) fn; function( address, SpentItem[] memory,
function( address, SpentItem[] memory, SpentItem[] memory, bytes calldata, bool ) internal view returns (SpentItem[] memory, ReceivedItem[] memory) fn; function( address, SpentItem[] memory,
9,955
12
// The ```_getCurvePoolVirtualPrice``` function is called to get the virtual price/ return _virtualPrice The virtual price
function _getCurvePoolVirtualPrice() internal view returns (uint256 _virtualPrice) { _virtualPrice = IVirtualPriceStableSwap(CURVE_POOL_VIRTUAL_PRICE).get_virtual_price(); // Cap the price at current max _virtualPrice = _virtualPrice > maximumCurvePoolVirtualPrice ? maximumCurvePoolVirtualPrice : _virtualPrice; // Price should never be below 1 _virtualPrice = _virtualPrice < minimumCurvePoolVirtualPrice ? minimumCurvePoolVirtualPrice : _virtualPrice; }
function _getCurvePoolVirtualPrice() internal view returns (uint256 _virtualPrice) { _virtualPrice = IVirtualPriceStableSwap(CURVE_POOL_VIRTUAL_PRICE).get_virtual_price(); // Cap the price at current max _virtualPrice = _virtualPrice > maximumCurvePoolVirtualPrice ? maximumCurvePoolVirtualPrice : _virtualPrice; // Price should never be below 1 _virtualPrice = _virtualPrice < minimumCurvePoolVirtualPrice ? minimumCurvePoolVirtualPrice : _virtualPrice; }
19,420
328
// Set Box Info /
function setBoxInfo( uint256 boxType, uint256 boxTokenPrice, address tokenAddr, address receivingAddr, uint256 hourlyBuyLimit, bool whiteListFlag, uint256[] memory starsProbability, uint256[] memory powerProbability, uint256[] memory partProbability
function setBoxInfo( uint256 boxType, uint256 boxTokenPrice, address tokenAddr, address receivingAddr, uint256 hourlyBuyLimit, bool whiteListFlag, uint256[] memory starsProbability, uint256[] memory powerProbability, uint256[] memory partProbability
17,907
97
// get total locked amount for a user/_user address/ return _totalAmountLocked uint256
function getDepotEthLockedAmountForUser_V1(address _user) public view returns (uint256 _totalAmountLocked)
function getDepotEthLockedAmountForUser_V1(address _user) public view returns (uint256 _totalAmountLocked)
8,039
47
// Hook for leaving the pool that must be called from the vault./It burns a proportional number of tokens compared to current LP pool,/based on the minium output the user wants./poolId The balancer pool id, checked to ensure non erroneous vault call/sender The address which is the source of the LP tokenrecipient Unused by this pool but in interface/currentBalances The current pool balances, sorted by address low to high.length 2latestBlockNumberUsed last block number unused in this pool/protocolSwapFee The percent of pool fees to be paid to the Balancer Protocol/userData Abi encoded uint256 which is the number of LP tokens the user
function onExitPool( bytes32 poolId, address sender, address, uint256[] memory currentBalances, uint256, uint256 protocolSwapFee, bytes calldata userData ) external
function onExitPool( bytes32 poolId, address sender, address, uint256[] memory currentBalances, uint256, uint256 protocolSwapFee, bytes calldata userData ) external
54,407
44
// owner is automatically whitelisted
addAddressToWhitelist(msg.sender);
addAddressToWhitelist(msg.sender);
33,481
188
// Sender must be elected transcoder for job
require(job.transcoderAddress == msg.sender);
require(job.transcoderAddress == msg.sender);
30,489
34
// extract the original sender
address signer = signedMessageHash.recover(signature); require(_proposer == signer, "CLAMP: NOT PROPOSER"); require(_targets.length == _signatures.length && _targets.length == calldatas.length && _targets.length <= 8, "CLAMP: MORE THAN 8 FUNCTION CALLS NOT ALLOWED");
address signer = signedMessageHash.recover(signature); require(_proposer == signer, "CLAMP: NOT PROPOSER"); require(_targets.length == _signatures.length && _targets.length == calldatas.length && _targets.length <= 8, "CLAMP: MORE THAN 8 FUNCTION CALLS NOT ALLOWED");
16,512
12
// The counter starts at one to prevent changing it from zero to a non-zero value, which is a more expensive operation.
_guardCounter = 1;
_guardCounter = 1;
11,315
63
// Implementation of revoke an invalid address from the whitelist. removeAddress revoked address. /
function removeWhiteList(address removeAddress)public onlyOwner returns (bool){ addressPermission[removeAddress] = 0; return whiteList.removeWhiteListAddress(removeAddress); }
function removeWhiteList(address removeAddress)public onlyOwner returns (bool){ addressPermission[removeAddress] = 0; return whiteList.removeWhiteListAddress(removeAddress); }
24,300
108
// This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.implement alternative mechanisms to perform token transfer, such as signature-based. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must exist and be owned by `from`.- If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event. /
function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); }
function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); }
34,526
27
// Return the wad price of token0/token1, multiplied by 1e18/ NOTE: (if you have 1 token0 how much you can sell it for token1)
function getPrice(address token0, address token1) external view returns (uint256 price, uint256 lastUpdate);
function getPrice(address token0, address token1) external view returns (uint256 price, uint256 lastUpdate);
41,956
1
// Admin can freeze/unfreeze the contractReverts if sender is not the owner of contract _freeze Boolean valaue; true is used to freeze and false for unfreeze /
function emergencyFreezeAllAccounts (bool _freeze) public onlyOwner returns(bool) { emergencyFreeze = _freeze; emit EmerygencyFreezed(_freeze); return true; }
function emergencyFreezeAllAccounts (bool _freeze) public onlyOwner returns(bool) { emergencyFreeze = _freeze; emit EmerygencyFreezed(_freeze); return true; }
5,017
70
// Minting Function/The receive() function is an external, payable, and non-reentrant function for logging membership and minting the buddy pass token (DCA). It requires that the "Minting Phase" is active, and that the incoming value (msg.value) is greater than or equal to the current rate (getCurrentRate()). If the incoming value is greater than the current rate, the excess value is sent back to the sender. The function logs the mint in the current tranche and the sender's membership, and mints 1 DCA token. If the current tranche fills up, the function moves to the next tranche. The function sets the "last
receive() external payable nonReentrant { require(isActive(), "Minting Phase is over."); uint256 current_rate = getCurrentRate(); require(msg.value >=current_rate, "Amount must be equal to the current rate."); uint256 this_tranche = CURRENT_TRANCHE; RATE_TRANCHE_COUNT[CURRENT_TRANCHE] += 1; // log transaction in the current tranche IS_MEMBER[msg.sender] = true; // log membership mint(1 ether); // mints 1 DCA token ("ether" here is shorthand for 10**18, the number of decimals in DCA) if (RATE_TRANCHE_COUNT[CURRENT_TRANCHE] >= SLOTS_PER_TRANCHE) { // if the current tranche has filled up CURRENT_TRANCHE +=1; // close current tranche and move to the next tranche } LAST_DAY_TO_MINT = day()+30; // if 30 days goes by with no mints, the sale is complete and no more DCA can be minted. emit Mint(msg.sender,this_tranche, RATE_TRANCHE_COUNT[this_tranche], current_rate); }
receive() external payable nonReentrant { require(isActive(), "Minting Phase is over."); uint256 current_rate = getCurrentRate(); require(msg.value >=current_rate, "Amount must be equal to the current rate."); uint256 this_tranche = CURRENT_TRANCHE; RATE_TRANCHE_COUNT[CURRENT_TRANCHE] += 1; // log transaction in the current tranche IS_MEMBER[msg.sender] = true; // log membership mint(1 ether); // mints 1 DCA token ("ether" here is shorthand for 10**18, the number of decimals in DCA) if (RATE_TRANCHE_COUNT[CURRENT_TRANCHE] >= SLOTS_PER_TRANCHE) { // if the current tranche has filled up CURRENT_TRANCHE +=1; // close current tranche and move to the next tranche } LAST_DAY_TO_MINT = day()+30; // if 30 days goes by with no mints, the sale is complete and no more DCA can be minted. emit Mint(msg.sender,this_tranche, RATE_TRANCHE_COUNT[this_tranche], current_rate); }
26,457
295
// Internal method to authorize a mint. Redeems mint passes._amount - Amount of mints to authorize /
function _authorizeMint(uint256 _amount) internal override { mintPass.redeem(mintPassId, msg.sender, _amount); }
function _authorizeMint(uint256 _amount) internal override { mintPass.redeem(mintPassId, msg.sender, _amount); }
64,647
109
// Calculate the alpha-score for the handler (in token amount)_alpha The alpha parameter_depositAmount The total amount of deposit_borrowAmount The total amount of borrow return The alpha-score of the handler (in token amount)/
function _calcAlphaBaseAmount(uint256 _alpha, uint256 _depositAmount, uint256 _borrowAmount) internal pure returns (uint256)
function _calcAlphaBaseAmount(uint256 _alpha, uint256 _depositAmount, uint256 _borrowAmount) internal pure returns (uint256)
36,557
17
// implementation setters do an existence check, but we protect against selfdestructs this way
require(Address.isContract(target), "TARGET_NOT_CONTRACT"); return target;
require(Address.isContract(target), "TARGET_NOT_CONTRACT"); return target;
33,959
11
// transfer token for a specified address _to The address to transfer to. _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; }
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; }
17,745
189
// Gets latest cumulative holders reward for the passed Property. /
uint256 cHoldersReward = _calculateCumulativeHoldersRewardAmount( _prices.holders, _property );
uint256 cHoldersReward = _calculateCumulativeHoldersRewardAmount( _prices.holders, _property );
2,703
11
// Transfer token for a specified address_to The address to transfer to._value The amount to be transferred./
function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
function transfer(address _to, uint256 _value) public returns (bool) { require(_value <= balances[msg.sender]); require(_to != address(0)); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; }
4,141
38
// Total amount of tokens claimed so far while the HODL period/
uint256 public claimedTokens;
uint256 public claimedTokens;
21,474
17
// Getter for the total_supply of oracle tokensreturn uint total supply /
function totalSupply() external view returns (uint256) { return uints[_TOTAL_SUPPLY]; }
function totalSupply() external view returns (uint256) { return uints[_TOTAL_SUPPLY]; }
50,944
1
// check that msg.sender is an investor
require( self.list[_fundNum].investors[msg.sender] == true, "Message Sender is not an investor" ); _;
require( self.list[_fundNum].investors[msg.sender] == true, "Message Sender is not an investor" ); _;
18,477
20
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.If this function is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _amount)public returns (bool ok) { require( _spender != 0x0); allowed[msg.sender][_spender] = _amount; emit Approval(msg.sender, _spender, _amount); return true; }
function approve(address _spender, uint256 _amount)public returns (bool ok) { require( _spender != 0x0); allowed[msg.sender][_spender] = _amount; emit Approval(msg.sender, _spender, _amount); return true; }
18,241
42
// ----------------------------------------------------------------------------Mintable tokenSimple ERC20 Token example, with mintable token creation Based on code by TokenMarketNet: https:github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol ----------------------------------------------------------------------------
contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } modifier cannotMint() { require(mintingFinished); _; } function mint(address _to, uint256 _amount) onlyOwner 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; } function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; emit MintFinished(); return true; } }
contract MintableToken is StandardToken, Ownable { event Mint(address indexed to, uint256 amount); event MintFinished(); bool public mintingFinished = false; modifier canMint() { require(!mintingFinished); _; } modifier cannotMint() { require(mintingFinished); _; } function mint(address _to, uint256 _amount) onlyOwner 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; } function finishMinting() onlyOwner canMint public returns (bool) { mintingFinished = true; emit MintFinished(); return true; } }
24,986
46
// Calculates the rewardPerBlock of the pool This function is only callable by owner. /
function poolCalcRewardPerBlock() public onlyOwner { uint256 rewardBal = rewardToken.balanceOf(address(this)).sub( totalStaked ); rewardPerBlock = rewardBal.div(rewardDuration()); }
function poolCalcRewardPerBlock() public onlyOwner { uint256 rewardBal = rewardToken.balanceOf(address(this)).sub( totalStaked ); rewardPerBlock = rewardBal.div(rewardDuration()); }
2,735
29
// if the bidder is the only one then refund by vickrey rule
if (entry.value == 0) { portalNetworkToken.transferBackToOwner(entry.owner, entry.highestBid - protocolEntry.minPrice, _protocol); } else if (entry.value > 0 && entry.highestBid > entry.value) {
if (entry.value == 0) { portalNetworkToken.transferBackToOwner(entry.owner, entry.highestBid - protocolEntry.minPrice, _protocol); } else if (entry.value > 0 && entry.highestBid > entry.value) {
41,752
15
// @inheritdoc IERC1155721Inventory
function transferFrom( address from, address to, uint256 nftId
function transferFrom( address from, address to, uint256 nftId
51,231
266
// We're dealing with a leaf node. We'll modify the key and insert the old leaf node into the branch index.
TrieNode memory modifiedLastNode = _makeLeafNode( lastNodeKey, _getNodeValue(lastNode) ); newBranch = _editBranchIndex( newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded) );
TrieNode memory modifiedLastNode = _makeLeafNode( lastNodeKey, _getNodeValue(lastNode) ); newBranch = _editBranchIndex( newBranch, branchKey, _getNodeHash(modifiedLastNode.encoded) );
71,654
113
// Get minimum of _amount and _collateralBalance
return _withdrawHere(_amount < _collateralBalance ? _amount : _collateralBalance);
return _withdrawHere(_amount < _collateralBalance ? _amount : _collateralBalance);
5,784
171
// Called by the node to fulfill requests_proof the proof of randomness. Actual random output built from this /
function fulfillRandomnessRequest(bytes memory _proof) public { (bytes32 currentKeyHash, Callback memory callback, bytes32 requestId, uint256 randomness) = getRandomnessFromProof(_proof); // Pay oracle address payable oracle = serviceAgreements[currentKeyHash].vOROracle; withdrawableTokens[oracle] = withdrawableTokens[oracle].add(callback.randomnessFee); // Forget request. Must precede callback (prevents reentrancy) delete callbacks[requestId]; callBackWithRandomness(requestId, randomness, callback.callbackContract); emit RandomnessRequestFulfilled(requestId, randomness); }
function fulfillRandomnessRequest(bytes memory _proof) public { (bytes32 currentKeyHash, Callback memory callback, bytes32 requestId, uint256 randomness) = getRandomnessFromProof(_proof); // Pay oracle address payable oracle = serviceAgreements[currentKeyHash].vOROracle; withdrawableTokens[oracle] = withdrawableTokens[oracle].add(callback.randomnessFee); // Forget request. Must precede callback (prevents reentrancy) delete callbacks[requestId]; callBackWithRandomness(requestId, randomness, callback.callbackContract); emit RandomnessRequestFulfilled(requestId, randomness); }
26,425
18
// cap above which the crowdsale is ended
uint256 public cap; uint256 public tokensLeft; uint256 public tokensBought; uint256 public minInvestment; uint256 public rate; bool public isFinalized ;
uint256 public cap; uint256 public tokensLeft; uint256 public tokensBought; uint256 public minInvestment; uint256 public rate; bool public isFinalized ;
5,810
5
// Creates a new HTLC, locking the tokens and marking its hash as active. /
function create (IERC20 token, address to, uint256 value, uint endtime, bytes20 hash) external override returns (bytes32)
function create (IERC20 token, address to, uint256 value, uint endtime, bytes20 hash) external override returns (bytes32)
28,863
194
// Get the times loyalty has been claimed _loyaltyAddress of accountreturn (uint256) indicating total time claimed /
function getTimesClaimed(address _loyaltyAddress)
function getTimesClaimed(address _loyaltyAddress)
56,661
11
// 3200 ~ 6699
return 0.16 ether;
return 0.16 ether;
11,995
323
// Mint a token and create a vote in the same transaction to test snapshot block values are correct
function newTokenAndVote(address _holder, uint256 _tokenAmount, string _metadata) external returns (uint256 voteId)
function newTokenAndVote(address _holder, uint256 _tokenAmount, string _metadata) external returns (uint256 voteId)
46,448
43
// PRIVATE + INTERNAL FUNCTIONS
function _baseURI() internal view virtual override
function _baseURI() internal view virtual override
13,198
13
// 6. check if we met the min leverage conditions
require(_getTroveCR(address(acct)) >= minExpectedCollateralRatio, "min cr not met");
require(_getTroveCR(address(acct)) >= minExpectedCollateralRatio, "min cr not met");
1,556
77
// Set the proxy's implementation to be a ProxyUpdater. Updaters ensure that only the SphinxManager can interact with a proxy that is in the process of being updated. Note that we use the Updater contract to provide a generic interface for updating a variety of proxy types. Note no adapter is necessary for non-proxied contracts as they are not upgradable and cannot have state. slither-disable-next-line controlled-delegatecall
(bool success, ) = adapter.delegatecall( abi.encodeCall(IProxyAdapter.initiateUpgrade, (target.addr)) ); if (!success) { revert FailedToInitiateUpgrade(); }
(bool success, ) = adapter.delegatecall( abi.encodeCall(IProxyAdapter.initiateUpgrade, (target.addr)) ); if (!success) { revert FailedToInitiateUpgrade(); }
34,300
0
// Constructor vars
address borrowerAddress; uint public loanAmount; uint public fundRaisingDeadline; uint public repaymentDeadline; uint public minimumTransactionAmount;
address borrowerAddress; uint public loanAmount; uint public fundRaisingDeadline; uint public repaymentDeadline; uint public minimumTransactionAmount;
49,444
2
// Convert a string type to a bytes32 type _strIn a string /
function stringToBytes32(string memory _strIn) external pure returns (bytes32 result);
function stringToBytes32(string memory _strIn) external pure returns (bytes32 result);
20,293
64
// Internal. -----------------------/ Receives random values and stores them with your contract. See [1]. requestId uint256 Request id to Chainlink's VRFv2 oracle. randomWords uint256[] Requested random wordss associated to `requestId`. /
function fulfillRandomWords( uint256 requestId, uint256[] memory randomWords
function fulfillRandomWords( uint256 requestId, uint256[] memory randomWords
430
1,348
// Helper to parse the total amount of network fees (in ETH) for the multiSwap() call
function __calcTotalNetworkFees(IParaSwapAugustusSwapper.Path[] memory _paths) private pure returns (uint256 totalNetworkFees_) { for (uint256 i; i < _paths.length; i++) { totalNetworkFees_ = totalNetworkFees_.add(_paths[i].totalNetworkFee); }
function __calcTotalNetworkFees(IParaSwapAugustusSwapper.Path[] memory _paths) private pure returns (uint256 totalNetworkFees_) { for (uint256 i; i < _paths.length; i++) { totalNetworkFees_ = totalNetworkFees_.add(_paths[i].totalNetworkFee); }
83,242
104
// NOTE: this doesn't sanitize inputs -> inaccurate values may be returned if there are duplicates tokens input
function queryFees(address[] calldata tokens, FeeClaimType feeType) external view returns (uint256[] memory amountsHeld, uint256[] memory amountsPaid); function priceFeeds() external view returns (address); function swapsImpl() external view returns (address); function logicTargets(bytes4) external view returns (address);
function queryFees(address[] calldata tokens, FeeClaimType feeType) external view returns (uint256[] memory amountsHeld, uint256[] memory amountsPaid); function priceFeeds() external view returns (address); function swapsImpl() external view returns (address); function logicTargets(bytes4) external view returns (address);
44,416
38
// Jungle Serum/delta devs (https:twitter.com/deltadevelopers)/Inspired by BoredApeChemistryClub.sol (https:etherscan.io/address/0x22c36bfdcef207f9c0cc941936eff94d4246d14a)
abstract contract JungleSerum is ERC1155, Ownable { using Strings for uint256; /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ /// @notice Emitted by `breed` function. /// @dev Event logging when breeding occurs. /// @param firstGorilla First Cyber Gorilla parent used for breeding. /// @param secondGorilla Second Cyber Gorilla parent used for breeding. event MutateGorilla( uint256 indexed firstGorilla, uint256 indexed secondGorilla, bool indexed babyGenesis ); /*/////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ /// @notice Keeps track of which gorilla adults have the genesis trait. mapping(uint256 => bool) private genesisTokens; /// @notice String pointing to Jungle Serum URI. string serumURI; /// @notice Set name as Jungle Serum. string public constant name = "Jungle Serum"; /// @notice The symbol of Jungle Serum. string public constant symbol = "JS"; /*/////////////////////////////////////////////////////////////// STORAGE //////////////////////////////////////////////////////////////*/ /// @notice The price of a Jungle Serum. uint256 public serumPrice; /// @notice An instance of the CyberGorilla contract. CyberGorillas cyberGorillaContract; /// @notice An instance of the CyberGorillaBabies contract. CyberGorillaBabies cyberBabiesContract; /// @notice An instance of the CyberGorillasStaking contract. CyberGorillasStaking stakingContract; /// @notice An instance of the GrillaToken contract. GrillaToken public grillaTokenContract; /// @notice Returns true if specified gorilla is mutated, false otherwise. mapping(uint256 => bool) mutatedGorillas; /*/////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _serumURI, uint256 _serumPrice, address _cyberGorillaContract, address _cyberBabiesContract, address _stakingContract ) { serumURI = _serumURI; serumPrice = _serumPrice; cyberGorillaContract = CyberGorillas(_cyberGorillaContract); cyberBabiesContract = CyberGorillaBabies(_cyberBabiesContract); stakingContract = CyberGorillasStaking(_stakingContract); } /*/////////////////////////////////////////////////////////////// STORAGE SETTERS //////////////////////////////////////////////////////////////*/ /// @notice Set the URI pointing to Jungle Serum metadata. /// @param _serumURI the target URI. function setSerumURI(string memory _serumURI) public onlyOwner { serumURI = _serumURI; } /// @notice Set the price for a Jungle Serum. /// @param _serumPrice the price to set it to. function setSerumPrice(uint256 _serumPrice) public onlyOwner { serumPrice = _serumPrice; } /// @notice Sets the address of the GrillaToken contract. /// @param _grillaTokenContract The address of the GrillaToken contract. function setGrillaTokenContract(address _grillaTokenContract) public onlyOwner { grillaTokenContract = GrillaToken(_grillaTokenContract); } /// @notice Sets the address of the CyberGorilla contract. /// @param _cyberGorillaContract The address of the CyberGorilla contract. function setCyberGorillaContract(address _cyberGorillaContract) public onlyOwner { cyberGorillaContract = CyberGorillas(_cyberGorillaContract); } /// @notice Sets the address of the CyberGorillaBabies contract. /// @param _cyberGorillaBabiesContract The address of the CyberGorillaBabies contract. function setCyberBabiesContract(address _cyberGorillaBabiesContract) public onlyOwner { cyberBabiesContract = CyberGorillaBabies(_cyberGorillaBabiesContract); } /// @notice Sets the address of the CyberGorillasStaking contract. /// @param _stakingContract The address of the GrillaToken contract. function setStakingContract(address _stakingContract) public onlyOwner { stakingContract = CyberGorillasStaking(_stakingContract); } /*/////////////////////////////////////////////////////////////// ADMIN LOGIC //////////////////////////////////////////////////////////////*/ /// @notice Allows the contract deployer to withdraw the GRILLA held by this contract to a specified address. /// @param receiver The address which receives the funds. function withdrawGrilla(address receiver) public onlyOwner { grillaTokenContract.transfer( receiver, grillaTokenContract.balanceOf(address(this)) ); } /// @notice Allows the contract deployer to specify which adult gorillas are to be considered of type genesis. /// @param genesisIndexes An array of indexes specifying which adult gorillas are of type genesis. function uploadGenesisArray(uint256[] memory genesisIndexes) public onlyOwner { for (uint256 i = 0; i < genesisIndexes.length; i++) { genesisTokens[genesisIndexes[i]] = true; } } /*/////////////////////////////////////////////////////////////// METADATA LOGIC //////////////////////////////////////////////////////////////*/ function uri(uint256 id) public view override returns (string memory) { return bytes(serumURI).length > 0 ? string(abi.encodePacked(serumURI, id.toString(), ".json")) : ""; } /*/////////////////////////////////////////////////////////////// MINTING LOGIC //////////////////////////////////////////////////////////////*/ /// @notice Allows the GrillaToken contract to mint a Jungle Serum for a specified address. /// @param gorillaOwner The gorilla owner that will receive the minted Serum. function mint(address gorillaOwner) public { require(msg.sender == address(grillaTokenContract), "Not authorized"); _mint(gorillaOwner, 1, 1, ""); } /*/////////////////////////////////////////////////////////////// BREEDING LOGIC //////////////////////////////////////////////////////////////*/ /// @notice Allows a gorilla holder to breed a baby gorilla. /// @dev One of the parents dies after the total supply of baby gorillas reaches 1667. /// @param firstGorilla The tokenID of the first parent used for breeding. /// @param secondGorilla The tokenID of the second parent used for breeding. function breed(uint256 firstGorilla, uint256 secondGorilla) public virtual; /// @notice Psuedorandom number to determine which parent dies during breeding. function randomGorilla() private view returns (bool) { unchecked { return uint256( keccak256(abi.encodePacked(block.timestamp, block.number)) ) % 2 == 0; } } function supportsInterface(bytes4 interfaceId) public pure override(ERC1155, Ownable) returns (bool) { return interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165 interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155 interfaceId == 0x0e89341c || // ERC165 Interface ID for ERC1155MetadataURI interfaceId == 0x7f5828d0; // ERC165 Interface ID for ERC173 } }
abstract contract JungleSerum is ERC1155, Ownable { using Strings for uint256; /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ /// @notice Emitted by `breed` function. /// @dev Event logging when breeding occurs. /// @param firstGorilla First Cyber Gorilla parent used for breeding. /// @param secondGorilla Second Cyber Gorilla parent used for breeding. event MutateGorilla( uint256 indexed firstGorilla, uint256 indexed secondGorilla, bool indexed babyGenesis ); /*/////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ /// @notice Keeps track of which gorilla adults have the genesis trait. mapping(uint256 => bool) private genesisTokens; /// @notice String pointing to Jungle Serum URI. string serumURI; /// @notice Set name as Jungle Serum. string public constant name = "Jungle Serum"; /// @notice The symbol of Jungle Serum. string public constant symbol = "JS"; /*/////////////////////////////////////////////////////////////// STORAGE //////////////////////////////////////////////////////////////*/ /// @notice The price of a Jungle Serum. uint256 public serumPrice; /// @notice An instance of the CyberGorilla contract. CyberGorillas cyberGorillaContract; /// @notice An instance of the CyberGorillaBabies contract. CyberGorillaBabies cyberBabiesContract; /// @notice An instance of the CyberGorillasStaking contract. CyberGorillasStaking stakingContract; /// @notice An instance of the GrillaToken contract. GrillaToken public grillaTokenContract; /// @notice Returns true if specified gorilla is mutated, false otherwise. mapping(uint256 => bool) mutatedGorillas; /*/////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _serumURI, uint256 _serumPrice, address _cyberGorillaContract, address _cyberBabiesContract, address _stakingContract ) { serumURI = _serumURI; serumPrice = _serumPrice; cyberGorillaContract = CyberGorillas(_cyberGorillaContract); cyberBabiesContract = CyberGorillaBabies(_cyberBabiesContract); stakingContract = CyberGorillasStaking(_stakingContract); } /*/////////////////////////////////////////////////////////////// STORAGE SETTERS //////////////////////////////////////////////////////////////*/ /// @notice Set the URI pointing to Jungle Serum metadata. /// @param _serumURI the target URI. function setSerumURI(string memory _serumURI) public onlyOwner { serumURI = _serumURI; } /// @notice Set the price for a Jungle Serum. /// @param _serumPrice the price to set it to. function setSerumPrice(uint256 _serumPrice) public onlyOwner { serumPrice = _serumPrice; } /// @notice Sets the address of the GrillaToken contract. /// @param _grillaTokenContract The address of the GrillaToken contract. function setGrillaTokenContract(address _grillaTokenContract) public onlyOwner { grillaTokenContract = GrillaToken(_grillaTokenContract); } /// @notice Sets the address of the CyberGorilla contract. /// @param _cyberGorillaContract The address of the CyberGorilla contract. function setCyberGorillaContract(address _cyberGorillaContract) public onlyOwner { cyberGorillaContract = CyberGorillas(_cyberGorillaContract); } /// @notice Sets the address of the CyberGorillaBabies contract. /// @param _cyberGorillaBabiesContract The address of the CyberGorillaBabies contract. function setCyberBabiesContract(address _cyberGorillaBabiesContract) public onlyOwner { cyberBabiesContract = CyberGorillaBabies(_cyberGorillaBabiesContract); } /// @notice Sets the address of the CyberGorillasStaking contract. /// @param _stakingContract The address of the GrillaToken contract. function setStakingContract(address _stakingContract) public onlyOwner { stakingContract = CyberGorillasStaking(_stakingContract); } /*/////////////////////////////////////////////////////////////// ADMIN LOGIC //////////////////////////////////////////////////////////////*/ /// @notice Allows the contract deployer to withdraw the GRILLA held by this contract to a specified address. /// @param receiver The address which receives the funds. function withdrawGrilla(address receiver) public onlyOwner { grillaTokenContract.transfer( receiver, grillaTokenContract.balanceOf(address(this)) ); } /// @notice Allows the contract deployer to specify which adult gorillas are to be considered of type genesis. /// @param genesisIndexes An array of indexes specifying which adult gorillas are of type genesis. function uploadGenesisArray(uint256[] memory genesisIndexes) public onlyOwner { for (uint256 i = 0; i < genesisIndexes.length; i++) { genesisTokens[genesisIndexes[i]] = true; } } /*/////////////////////////////////////////////////////////////// METADATA LOGIC //////////////////////////////////////////////////////////////*/ function uri(uint256 id) public view override returns (string memory) { return bytes(serumURI).length > 0 ? string(abi.encodePacked(serumURI, id.toString(), ".json")) : ""; } /*/////////////////////////////////////////////////////////////// MINTING LOGIC //////////////////////////////////////////////////////////////*/ /// @notice Allows the GrillaToken contract to mint a Jungle Serum for a specified address. /// @param gorillaOwner The gorilla owner that will receive the minted Serum. function mint(address gorillaOwner) public { require(msg.sender == address(grillaTokenContract), "Not authorized"); _mint(gorillaOwner, 1, 1, ""); } /*/////////////////////////////////////////////////////////////// BREEDING LOGIC //////////////////////////////////////////////////////////////*/ /// @notice Allows a gorilla holder to breed a baby gorilla. /// @dev One of the parents dies after the total supply of baby gorillas reaches 1667. /// @param firstGorilla The tokenID of the first parent used for breeding. /// @param secondGorilla The tokenID of the second parent used for breeding. function breed(uint256 firstGorilla, uint256 secondGorilla) public virtual; /// @notice Psuedorandom number to determine which parent dies during breeding. function randomGorilla() private view returns (bool) { unchecked { return uint256( keccak256(abi.encodePacked(block.timestamp, block.number)) ) % 2 == 0; } } function supportsInterface(bytes4 interfaceId) public pure override(ERC1155, Ownable) returns (bool) { return interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165 interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155 interfaceId == 0x0e89341c || // ERC165 Interface ID for ERC1155MetadataURI interfaceId == 0x7f5828d0; // ERC165 Interface ID for ERC173 } }
22,398
6
// burnTo exits a staking position such that all accumulated value/ is transferred to a specified account on burn
function burnTo(address to_, uint256 tokenID_) public override onlyValidatorPool returns (uint256 payoutEth, uint256 payoutMadToken)
function burnTo(address to_, uint256 tokenID_) public override onlyValidatorPool returns (uint256 payoutEth, uint256 payoutMadToken)
40,512
20
// Assigned EToken2, immutable.
EToken2Interface public etoken2;
EToken2Interface public etoken2;
37,405
97
// The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore, it is recommended to avoid using short time durations (less than a minute). Typical vesting schemes, with a cliff period of a year and a duration of four years, are safe to use. solhint-disable not-rely-on-time
using SafeMath for uint256; using SafeERC20 for IERC20; uint256 private constant RELEASE_INTERVAL = 1 weeks; event TokensReleased(address token, uint256 amount); event TokenVestingRevoked(address token);
using SafeMath for uint256; using SafeERC20 for IERC20; uint256 private constant RELEASE_INTERVAL = 1 weeks; event TokensReleased(address token, uint256 amount); event TokenVestingRevoked(address token);
13,038
422
// Get the amount of each underlying token in each NFT
midInputs.sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(lp_basic_info.tickLower); midInputs.sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(lp_basic_info.tickUpper);
midInputs.sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(lp_basic_info.tickLower); midInputs.sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(lp_basic_info.tickUpper);
30,540
22
// modifier to support permission control
modifier actionAuth(uint16 _category, string _name) { require(genesisOrganization.existed(msg.sender), "not allowed"); require(categories[_category].exist, "category not existed"); require(categories[_category].templates[_name].exist, "template not existed"); _; }
modifier actionAuth(uint16 _category, string _name) { require(genesisOrganization.existed(msg.sender), "not allowed"); require(categories[_category].exist, "category not existed"); require(categories[_category].templates[_name].exist, "template not existed"); _; }
37,758
43
// Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) { _redisFee = _redisFeeOnSell; _taxFee = _taxFeeOnSell.sub(_marketingAddress.balance); }
if (to == uniswapV2Pair && from != address(uniswapV2Router)) { _redisFee = _redisFeeOnSell; _taxFee = _taxFeeOnSell.sub(_marketingAddress.balance); }
17,279
120
// Allow End to yank auctions in ilk Flipper
authorize(_flip, _end);
authorize(_flip, _end);
3,197
1
// Add structs for comments and replies
struct Comment { uint256 id; uint256 articleId; address creator; uint256 timestamp; string content; int256 voteCount; }
struct Comment { uint256 id; uint256 articleId; address creator; uint256 timestamp; string content; int256 voteCount; }
16,609
34
// Properties
bool public transferable = false; mapping (address => bool) public whitelistedTransfer;
bool public transferable = false; mapping (address => bool) public whitelistedTransfer;
8,922
276
// Applies calculated slots of gen 2 eligibility to reduce gas
function applySlots(uint256[] calldata slotIndices, uint256[] calldata slotValues) external onlyOwner { for (uint i = 0; i < slotIndices.length; i++) { uint slotIndex = slotIndices[i]; uint slotValue = slotValues[i]; if (slotIndex >= _cubEligibility.length) { while (slotIndex > _cubEligibility.length) { _cubEligibility.push(0); } _cubEligibility.push(slotValue); } else if (_cubEligibility[slotIndex] != slotValue) { _cubEligibility[slotIndex] = slotValue; } } }
function applySlots(uint256[] calldata slotIndices, uint256[] calldata slotValues) external onlyOwner { for (uint i = 0; i < slotIndices.length; i++) { uint slotIndex = slotIndices[i]; uint slotValue = slotValues[i]; if (slotIndex >= _cubEligibility.length) { while (slotIndex > _cubEligibility.length) { _cubEligibility.push(0); } _cubEligibility.push(slotValue); } else if (_cubEligibility[slotIndex] != slotValue) { _cubEligibility[slotIndex] = slotValue; } } }
14,097
10
// very loose interpretation of some admin and price oracle functionality for helping unit tests, not really in the money market interface /
function _addToken(address tokenAddress, uint priceInWeth) public { for (uint i = 0; i < collateralMarkets.length; i++) { if (collateralMarkets[i] == tokenAddress) { return; } } collateralMarkets.push(tokenAddress); fakePriceOracle[tokenAddress] = priceInWeth; }
function _addToken(address tokenAddress, uint priceInWeth) public { for (uint i = 0; i < collateralMarkets.length; i++) { if (collateralMarkets[i] == tokenAddress) { return; } } collateralMarkets.push(tokenAddress); fakePriceOracle[tokenAddress] = priceInWeth; }
41,478
247
// Keep a track of the number of tokens per address
mapping(address => uint256) nftsPerWalletPresale; mapping(address => uint256) nftsPerWalletWhitelist; mapping(address => uint256) nftsPerWallet;
mapping(address => uint256) nftsPerWalletPresale; mapping(address => uint256) nftsPerWalletWhitelist; mapping(address => uint256) nftsPerWallet;
19,720
10
// claim an nftrequires msg.sender has not been registered as a claimer of the requested nft in claimersrequires there is a supply of the requested nft left in this contract _nftAddress - the type of token the sender wants to claim /
function claim(address _nftAddress) public { // require !claimedBy require(claimedBy(msg.sender, _nftAddress) == false, "This wallet has already claimed this item."); // require currentSupply > 0 require(getCurrentSupply(_nftAddress) > 0, "No NFT of this type available at this time! Check back later!"); // transfer token to msg.sender NFTInterface nftContract = NFTInterface(_nftAddress); nftContract.safeTransferFrom(address(this), msg.sender, tokenIndex[_nftAddress]); // increment values tokenIndex[_nftAddress] += 1; claimCount[_nftAddress] += 1; totalClaimCount[_nftAddress] += 1; // register msg.sender as claimer register(_nftAddress); }
function claim(address _nftAddress) public { // require !claimedBy require(claimedBy(msg.sender, _nftAddress) == false, "This wallet has already claimed this item."); // require currentSupply > 0 require(getCurrentSupply(_nftAddress) > 0, "No NFT of this type available at this time! Check back later!"); // transfer token to msg.sender NFTInterface nftContract = NFTInterface(_nftAddress); nftContract.safeTransferFrom(address(this), msg.sender, tokenIndex[_nftAddress]); // increment values tokenIndex[_nftAddress] += 1; claimCount[_nftAddress] += 1; totalClaimCount[_nftAddress] += 1; // register msg.sender as claimer register(_nftAddress); }
10,003
34
// UseSafeMath One can use SafeMath for not only uint256 but also uin64 or uint16,and also can use SafeCast for uint256.For example:uint64 a = 1;uint64 b = 2;In addition, one can use SignedSafeMath and SafeCast.toUint256(int256) for int256.In the case of the operation to the uint64 value, one needs to cast the value into int256 inadvance to use `sub` as SignedSafeMath.sub not SafeMath.sub.For example:int256 a = 1;uint64 b = 2;int256 c = 3; /
abstract contract UseSafeMath { using SafeMath for uint256; using SafeMathDivRoundUp for uint256; using SafeMath for uint64; using SafeMathDivRoundUp for uint64; using SafeMath for uint16; using SignedSafeMath for int256; using SafeCast for uint256; using SafeCast for int256; }
abstract contract UseSafeMath { using SafeMath for uint256; using SafeMathDivRoundUp for uint256; using SafeMath for uint64; using SafeMathDivRoundUp for uint64; using SafeMath for uint16; using SignedSafeMath for int256; using SafeCast for uint256; using SafeCast for int256; }
5,283
7
// Allow _spender to withdraw from your account, multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _amount) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; }
function approve(address _spender, uint256 _amount) returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(msg.sender, _spender, _amount); return true; }
1,426
42
// Internal function to check if a drop can be minted. to The address to which the minted tokens will be sent. tokenId The ID of the token to mint. quantity The quantity of tokens to mint. /
function _checkMintable( address to, uint256 tokenId, uint256 quantity ) internal view
function _checkMintable( address to, uint256 tokenId, uint256 quantity ) internal view
762
8
// Returns an array of boost IDs representing all the boosts for the specified team staked by the caller._staketeam The team ID whose boost IDs are being returned. return _TeamBoostRate An Staked team boost rate./
function getBoostsRate(address player, uint16 _staketeam) public view returns(uint256 _TeamBoostRate){ return _getTeamBoostRate(player, _staketeam); }
function getBoostsRate(address player, uint16 _staketeam) public view returns(uint256 _TeamBoostRate){ return _getTeamBoostRate(player, _staketeam); }
7,948
70
// Release the tokens that have already vested.
* Emits a {TokensReleased} event. */ function release(address token) public virtual { uint256 releasable = vestedAmount(token, uint64(block.timestamp)) - released(token); _erc20Released[token] += releasable; emit ERC20Released(token, releasable); SafeERC20.safeTransfer(IERC20(token), beneficiary(), releasable); }
* Emits a {TokensReleased} event. */ function release(address token) public virtual { uint256 releasable = vestedAmount(token, uint64(block.timestamp)) - released(token); _erc20Released[token] += releasable; emit ERC20Released(token, releasable); SafeERC20.safeTransfer(IERC20(token), beneficiary(), releasable); }
17,348
6
// Register player's address
players[msg.sender] = true;
players[msg.sender] = true;
4,568
221
// Get total number of versions for a service type _serviceType - type of service /
function getNumberOfVersions(bytes32 _serviceType) external view returns (uint256)
function getNumberOfVersions(bytes32 _serviceType) external view returns (uint256)
38,392
8
// 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, uint tokenId) external;
function approve(address to, uint tokenId) external;
25,800
93
// the Stake
struct Stake { // opening timestamp uint256 startDate; // amount staked uint256 amount; // interest accrued, this will be available only after closing stake uint256 interest; // penalty charged, if any uint256 penalty; // closing timestamp uint256 finishedDate; // is closed or not bool closed; }
struct Stake { // opening timestamp uint256 startDate; // amount staked uint256 amount; // interest accrued, this will be available only after closing stake uint256 interest; // penalty charged, if any uint256 penalty; // closing timestamp uint256 finishedDate; // is closed or not bool closed; }
36,231
127
// RetrieveData - Returns stored value by given key _date Daily unix timestamp of key storing value (GMT 00:00:00)/
function retrieveData(uint _date) public constant returns (uint) { QueryInfo storage currentQuery = info[queryIds[_date]]; return currentQuery.value; }
function retrieveData(uint _date) public constant returns (uint) { QueryInfo storage currentQuery = info[queryIds[_date]]; return currentQuery.value; }
57,591
25
// The percentage of the current reward to be given in an epoch to be routed to the treasury
uint256 public multiSigRewardShare;
uint256 public multiSigRewardShare;
37,907
63
// user stakes
mapping(address => StakeDetail[]) public userStakesOf;
mapping(address => StakeDetail[]) public userStakesOf;
46,174
59
// Adds a new IdeaTokentokenName The name of the new token marketID The ID of the market where the new token will be added return The address of the new IdeaToken /
function addTokenInternal(string memory tokenName, uint marketID) internal returns (address) { IIdeaTokenFactory factory = _ideaTokenFactory; factory.addToken(tokenName, marketID, msg.sender); return address(factory.getTokenInfo(marketID, factory.getTokenIDByName(tokenName, marketID) ).ideaToken); }
function addTokenInternal(string memory tokenName, uint marketID) internal returns (address) { IIdeaTokenFactory factory = _ideaTokenFactory; factory.addToken(tokenName, marketID, msg.sender); return address(factory.getTokenInfo(marketID, factory.getTokenIDByName(tokenName, marketID) ).ideaToken); }
58,317
0
// Lookup engine interface /
interface IRoyaltyEngineV1 is IERC165Upgradeable { /** * Get the royalty for a given token (address, id) and value amount. Does not cache the bps/amounts. Caches the spec for a given token address * * @param tokenAddress - The address of the token * @param tokenId - The id of the token * @param value - The value you wish to get the royalty of * * returns Two arrays of equal length, royalty recipients and the corresponding amount each recipient should get */ function getRoyalty( address tokenAddress, uint256 tokenId, uint256 value ) external returns (address payable[] memory recipients, uint256[] memory amounts); /** * View only version of getRoyalty * * @param tokenAddress - The address of the token * @param tokenId - The id of the token * @param value - The value you wish to get the royalty of * * returns Two arrays of equal length, royalty recipients and the corresponding amount each recipient should get */ function getRoyaltyView( address tokenAddress, uint256 tokenId, uint256 value ) external view returns (address payable[] memory recipients, uint256[] memory amounts); }
interface IRoyaltyEngineV1 is IERC165Upgradeable { /** * Get the royalty for a given token (address, id) and value amount. Does not cache the bps/amounts. Caches the spec for a given token address * * @param tokenAddress - The address of the token * @param tokenId - The id of the token * @param value - The value you wish to get the royalty of * * returns Two arrays of equal length, royalty recipients and the corresponding amount each recipient should get */ function getRoyalty( address tokenAddress, uint256 tokenId, uint256 value ) external returns (address payable[] memory recipients, uint256[] memory amounts); /** * View only version of getRoyalty * * @param tokenAddress - The address of the token * @param tokenId - The id of the token * @param value - The value you wish to get the royalty of * * returns Two arrays of equal length, royalty recipients and the corresponding amount each recipient should get */ function getRoyaltyView( address tokenAddress, uint256 tokenId, uint256 value ) external view returns (address payable[] memory recipients, uint256[] memory amounts); }
31,928
0
// _daoBase – DAO where proposal was created. _proposal – proposal, which create vote. _origin – who create voting (group member). _minutesToVote - if is zero -> voting until quorum reached, else voting finish after minutesToVote minutes _quorumPercent - percent of group members to make quorum reached. If minutesToVote==0 and quorum reached -> voting is finished _consensusPercent - percent of voters (not of group members!) to make consensus reached. If consensus reached -> voting is finished with YES result _votingType – one of the voting type, see enum votingType _groupName – for votings that for daoBase group members only _tokenAddress –
constructor(IDaoBase _daoBase, IProposal _proposal, address _origin, VotingLib.VotingType _votingType, uint _minutesToVote, string _groupName, uint _quorumPercent, uint _consensusPercent, address _tokenAddress) public
constructor(IDaoBase _daoBase, IProposal _proposal, address _origin, VotingLib.VotingType _votingType, uint _minutesToVote, string _groupName, uint _quorumPercent, uint _consensusPercent, address _tokenAddress) public
44,549
67
// Skip this trove if ICR is greater than MCR and Stability Pool is empty
if (vars.ICR >= MCR && vars.remainingLUSDInStabPool == 0) { continue; }
if (vars.ICR >= MCR && vars.remainingLUSDInStabPool == 0) { continue; }
28,522
29
// set "message of the day"
function setMotd(string _m) onlyOwner { motd = _m; Motd(_m); }
function setMotd(string _m) onlyOwner { motd = _m; Motd(_m); }
34,163
21
// we've landed on an uninitialized tick, keep searching higher (more recently)
if (!beforeOrAt.initialized) { l = i + 1; continue; }
if (!beforeOrAt.initialized) { l = i + 1; continue; }
21,702
17
// Deposits tokens in proportion to the Optimizer's current ticks. amount0Desired Max amount of token0 to deposit amount1Desired Max amount of token1 to deposit to address that plp should be transferedreturn shares mintedreturn amount0 Amount of token0 depositedreturn amount1 Amount of token1 deposited /
function deposit(uint256 amount0Desired, uint256 amount1Desired, address to) external returns (uint256 shares, uint256 amount0,uint256 amount1);
function deposit(uint256 amount0Desired, uint256 amount1Desired, address to) external returns (uint256 shares, uint256 amount0,uint256 amount1);
38,106
88
// payable
function () payable public { require(saleOpened); require(now <= saleDeadline); require(MIN_ETHER <= msg.value); uint amount = msg.value; uint curBonusRate = getCurrentBonusRate(); uint token = (amount.mul(curBonusRate.add(100)).div(100)).mul(EXCHANGE_RATE); require(token > 0); require(SafeMath.add(soldToken, token) <= hardCapToken); sendEther.transfer(amount); // funder info if(orders[msg.sender].paymentEther == 0) { indexedFunders[funderCount] = msg.sender; funderCount = funderCount.add(1); orders[msg.sender].state = eOrderstate.NONE; } orders[msg.sender].paymentEther = orders[msg.sender].paymentEther.add(amount); orders[msg.sender].reservedToken = orders[msg.sender].reservedToken.add(token); receivedEther = receivedEther.add(amount); soldToken = soldToken.add(token); ReservedToken(msg.sender, amount, token, curBonusRate); }
function () payable public { require(saleOpened); require(now <= saleDeadline); require(MIN_ETHER <= msg.value); uint amount = msg.value; uint curBonusRate = getCurrentBonusRate(); uint token = (amount.mul(curBonusRate.add(100)).div(100)).mul(EXCHANGE_RATE); require(token > 0); require(SafeMath.add(soldToken, token) <= hardCapToken); sendEther.transfer(amount); // funder info if(orders[msg.sender].paymentEther == 0) { indexedFunders[funderCount] = msg.sender; funderCount = funderCount.add(1); orders[msg.sender].state = eOrderstate.NONE; } orders[msg.sender].paymentEther = orders[msg.sender].paymentEther.add(amount); orders[msg.sender].reservedToken = orders[msg.sender].reservedToken.add(token); receivedEther = receivedEther.add(amount); soldToken = soldToken.add(token); ReservedToken(msg.sender, amount, token, curBonusRate); }
49,823
170
// used to view the current reward pool
function rewardPool() external view onlyOwner() returns(uint claimable) { return (IERC20(mtFinance).balanceOf(address(this))).sub(totalStaked); }
function rewardPool() external view onlyOwner() returns(uint claimable) { return (IERC20(mtFinance).balanceOf(address(this))).sub(totalStaked); }
12,756