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
34
// address ringo = address(this);
address ringo = getReceiver(); address minter = _minters[_tokenId]; uint256 ringoFee = _calcRingoFee(price); uint256 minterReward = _calcMinterReward(price); uint256 rest = price - (ringoFee + minterReward); require( _usdtContract.allowance(_msgSender(), address(this)) >= price, "low allowance" );
address ringo = getReceiver(); address minter = _minters[_tokenId]; uint256 ringoFee = _calcRingoFee(price); uint256 minterReward = _calcMinterReward(price); uint256 rest = price - (ringoFee + minterReward); require( _usdtContract.allowance(_msgSender(), address(this)) >= price, "low allowance" );
8,562
28
// Returns the block timestamp truncated to 32 bits, i.e. mod 232. This method is overridden in tests.
function _blockTimestamp() internal view virtual returns (uint32) { return uint32(block.timestamp); // truncation is desired }
function _blockTimestamp() internal view virtual returns (uint32) { return uint32(block.timestamp); // truncation is desired }
27,569
8
// THIS makes sure we have enough mJFCIf yes, then send
if(mJFC >= vaultBalance){ revert("Not enough JFC in the vault to transfer"); }
if(mJFC >= vaultBalance){ revert("Not enough JFC in the vault to transfer"); }
24,499
36
// Create the subcourt.
uint96 subcourtID = uint96( courts.push(Court({ parent: _parent, children: new uint[](0), hiddenVotes: _hiddenVotes, minStake: _minStake, alpha: _alpha, feeForJuror: _feeForJuror, jurorsForCourtJump: _jurorsForCourtJump, timesPerPeriod: _timesPerPeriod
uint96 subcourtID = uint96( courts.push(Court({ parent: _parent, children: new uint[](0), hiddenVotes: _hiddenVotes, minStake: _minStake, alpha: _alpha, feeForJuror: _feeForJuror, jurorsForCourtJump: _jurorsForCourtJump, timesPerPeriod: _timesPerPeriod
16,318
1
// The purpose of this function is to retrieve the price of the given tokenin ETH. For example if the price of a HAK token is worth 0.5 ETH, thenthis function will return 500000000000000000 (5e17) because ETH has 18 decimals. Note that this price is not fixed and might change at any moment,according to the demand and supply on the open market. token - the ERC20 token for which you want to get the price in ETH.return - the price in ETH of the given token at that moment in time. /
function getVirtualPrice(address token) view external returns (uint256);
function getVirtualPrice(address token) view external returns (uint256);
14,841
65
// check empty pool
address pool = poolSigs[sig]; if (pool != address(0)) { IERC20 TP = IERC20(pool); if (TP.totalSupply() > minEffeciveXPT) { return (true, sig); } else {
address pool = poolSigs[sig]; if (pool != address(0)) { IERC20 TP = IERC20(pool); if (TP.totalSupply() > minEffeciveXPT) { return (true, sig); } else {
82,637
15
// Copy of _withdraw that is view-only and returns how much can be withdrawn from a stream, purely for convenience on frontend No need to review since this does nothing
function withdrawable(address from, address to, uint216 amountPerSec) external view returns (uint withdrawableAmount, uint lastUpdate, uint owed) { bytes32 streamId = getStreamId(from, to, amountPerSec); require(streamToStart[streamId] != 0, "stream doesn't exist"); Payer storage payer = payers[from]; uint totalPayerPayment; uint payerDelta = block.timestamp - payer.lastPayerUpdate; unchecked{ totalPayerPayment = payerDelta * uint(payer.totalPaidPerSec); } uint payerBalance = balances[from]; if(payerBalance >= totalPayerPayment){ lastUpdate = block.timestamp; } else { unchecked { uint timePaid = payerBalance/uint(payer.totalPaidPerSec); lastUpdate = payer.lastPayerUpdate + timePaid; } } uint delta = lastUpdate - streamToStart[streamId]; withdrawableAmount = (delta*uint(amountPerSec))/DECIMALS_DIVISOR; owed = ((block.timestamp - lastUpdate)*uint(amountPerSec))/DECIMALS_DIVISOR; }
function withdrawable(address from, address to, uint216 amountPerSec) external view returns (uint withdrawableAmount, uint lastUpdate, uint owed) { bytes32 streamId = getStreamId(from, to, amountPerSec); require(streamToStart[streamId] != 0, "stream doesn't exist"); Payer storage payer = payers[from]; uint totalPayerPayment; uint payerDelta = block.timestamp - payer.lastPayerUpdate; unchecked{ totalPayerPayment = payerDelta * uint(payer.totalPaidPerSec); } uint payerBalance = balances[from]; if(payerBalance >= totalPayerPayment){ lastUpdate = block.timestamp; } else { unchecked { uint timePaid = payerBalance/uint(payer.totalPaidPerSec); lastUpdate = payer.lastPayerUpdate + timePaid; } } uint delta = lastUpdate - streamToStart[streamId]; withdrawableAmount = (delta*uint(amountPerSec))/DECIMALS_DIVISOR; owed = ((block.timestamp - lastUpdate)*uint(amountPerSec))/DECIMALS_DIVISOR; }
54,177
67
// Transfer WETH to Liquidity Manager to be provided as liquidity on Uniswap V3. Liquidity Manager holds supply of DRVS ERC-20.
TransferHelper.safeTransferFrom( WETH9, address(this), derivswapLiqManagerAddress, initialLiqThreshold );
TransferHelper.safeTransferFrom( WETH9, address(this), derivswapLiqManagerAddress, initialLiqThreshold );
9,063
277
// Global values used by many contracts This is mostly used for access control /
contract Registry is IRegistry, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; bool private _paused; bool public override tokenMinting; uint256 public constant override denominator = 10000; IWETH public immutable override weth; EnumerableSet.AddressSet private deadTokens; address payable public fallbackRecipient; mapping(address => string) public strategistNames; modifier onlyRole(bytes32 _role) { require(hasRole(_role, msg.sender), "Unauthorized: Invalid role"); _; } constructor( address _governance, address payable _fallbackRecipient, address _weth ) { require( _fallbackRecipient != address(0) && _fallbackRecipient != address(this), "Invalid address" ); _setupRole(DEFAULT_ADMIN_ROLE, _governance); _setupRole(OLib.GOVERNANCE_ROLE, _governance); _setRoleAdmin(OLib.VAULT_ROLE, OLib.DEPLOYER_ROLE); _setRoleAdmin(OLib.ROLLOVER_ROLE, OLib.DEPLOYER_ROLE); _setRoleAdmin(OLib.STRATEGY_ROLE, OLib.DEPLOYER_ROLE); fallbackRecipient = _fallbackRecipient; weth = IWETH(_weth); } /** * @notice General ACL check * @param _role One of the predefined roles * @param _account Address to check * @return Access/Denied */ function authorized(bytes32 _role, address _account) public view override returns (bool) { return hasRole(_role, _account); } /** * @notice Add a new official strategist * @dev grantRole protects this ACL * @param _strategist Address of new strategist * @param _name Display name for UI */ function addStrategist(address _strategist, string calldata _name) external { grantRole(OLib.STRATEGIST_ROLE, _strategist); strategistNames[_strategist] = _name; } function enableTokens() external override onlyRole(OLib.GOVERNANCE_ROLE) { tokenMinting = true; } function disableTokens() external override onlyRole(OLib.GOVERNANCE_ROLE) { tokenMinting = false; } /** * @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); /* * @notice Helper to expose a Pausable interface to tools */ function paused() public view override returns (bool) { return _paused; } /** * @notice Turn on paused variable. Everything stops! */ function pause() external override onlyRole(OLib.PANIC_ROLE) { _paused = true; emit Paused(msg.sender); } /** * @notice Turn off paused variable. Everything resumes. */ function unpause() external override onlyRole(OLib.GUARDIAN_ROLE) { _paused = false; emit Unpaused(msg.sender); } /** * @notice Manually determine which TrancheToken instances can be recycled * @dev Move into another list where createVault can delete to save gas. Done manually for safety. * @param _tokens List of tokens */ function tokensDeclaredDead(address[] calldata _tokens) external onlyRole(OLib.GUARDIAN_ROLE) { for (uint256 i = 0; i < _tokens.length; i++) { deadTokens.add(_tokens[i]); } } /** * @notice Called by createVault to delete a few dead contracts * @param _tranches Number of tranches (really, number of contracts to delete) */ function recycleDeadTokens(uint256 _tranches) external override onlyRole(OLib.VAULT_ROLE) { uint256 toRecycle = deadTokens.length() >= _tranches ? _tranches : deadTokens.length(); while (toRecycle > 0) { address last = deadTokens.at(deadTokens.length() - 1); try ITrancheToken(last).destroy(fallbackRecipient) {} catch {} deadTokens.remove(last); toRecycle -= 1; } } /** * @notice Who will get any random eth from dead tranchetokens * @param _target Receipient of ETH */ function setFallbackRecipient(address payable _target) external onlyRole(OLib.GOVERNANCE_ROLE) { fallbackRecipient = _target; } }
contract Registry is IRegistry, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; bool private _paused; bool public override tokenMinting; uint256 public constant override denominator = 10000; IWETH public immutable override weth; EnumerableSet.AddressSet private deadTokens; address payable public fallbackRecipient; mapping(address => string) public strategistNames; modifier onlyRole(bytes32 _role) { require(hasRole(_role, msg.sender), "Unauthorized: Invalid role"); _; } constructor( address _governance, address payable _fallbackRecipient, address _weth ) { require( _fallbackRecipient != address(0) && _fallbackRecipient != address(this), "Invalid address" ); _setupRole(DEFAULT_ADMIN_ROLE, _governance); _setupRole(OLib.GOVERNANCE_ROLE, _governance); _setRoleAdmin(OLib.VAULT_ROLE, OLib.DEPLOYER_ROLE); _setRoleAdmin(OLib.ROLLOVER_ROLE, OLib.DEPLOYER_ROLE); _setRoleAdmin(OLib.STRATEGY_ROLE, OLib.DEPLOYER_ROLE); fallbackRecipient = _fallbackRecipient; weth = IWETH(_weth); } /** * @notice General ACL check * @param _role One of the predefined roles * @param _account Address to check * @return Access/Denied */ function authorized(bytes32 _role, address _account) public view override returns (bool) { return hasRole(_role, _account); } /** * @notice Add a new official strategist * @dev grantRole protects this ACL * @param _strategist Address of new strategist * @param _name Display name for UI */ function addStrategist(address _strategist, string calldata _name) external { grantRole(OLib.STRATEGIST_ROLE, _strategist); strategistNames[_strategist] = _name; } function enableTokens() external override onlyRole(OLib.GOVERNANCE_ROLE) { tokenMinting = true; } function disableTokens() external override onlyRole(OLib.GOVERNANCE_ROLE) { tokenMinting = false; } /** * @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); /* * @notice Helper to expose a Pausable interface to tools */ function paused() public view override returns (bool) { return _paused; } /** * @notice Turn on paused variable. Everything stops! */ function pause() external override onlyRole(OLib.PANIC_ROLE) { _paused = true; emit Paused(msg.sender); } /** * @notice Turn off paused variable. Everything resumes. */ function unpause() external override onlyRole(OLib.GUARDIAN_ROLE) { _paused = false; emit Unpaused(msg.sender); } /** * @notice Manually determine which TrancheToken instances can be recycled * @dev Move into another list where createVault can delete to save gas. Done manually for safety. * @param _tokens List of tokens */ function tokensDeclaredDead(address[] calldata _tokens) external onlyRole(OLib.GUARDIAN_ROLE) { for (uint256 i = 0; i < _tokens.length; i++) { deadTokens.add(_tokens[i]); } } /** * @notice Called by createVault to delete a few dead contracts * @param _tranches Number of tranches (really, number of contracts to delete) */ function recycleDeadTokens(uint256 _tranches) external override onlyRole(OLib.VAULT_ROLE) { uint256 toRecycle = deadTokens.length() >= _tranches ? _tranches : deadTokens.length(); while (toRecycle > 0) { address last = deadTokens.at(deadTokens.length() - 1); try ITrancheToken(last).destroy(fallbackRecipient) {} catch {} deadTokens.remove(last); toRecycle -= 1; } } /** * @notice Who will get any random eth from dead tranchetokens * @param _target Receipient of ETH */ function setFallbackRecipient(address payable _target) external onlyRole(OLib.GOVERNANCE_ROLE) { fallbackRecipient = _target; } }
15,293
155
// Read
function name() public view virtual returns (string memory) { return name_; }
function name() public view virtual returns (string memory) { return name_; }
47,248
229
// E.g. 1e18 - (1e1710e18)/5e18 = 8e17 (5e188e17) / 1e18 = 4e18 allocated from Vault
vaultBufferModifier = uint256(1e18).sub(vaultBufferModifier);
vaultBufferModifier = uint256(1e18).sub(vaultBufferModifier);
25,534
24
// Move smaller element
(arr[i], arr[j]) = (arr[j],arr[i]); i = i + 1;
(arr[i], arr[j]) = (arr[j],arr[i]); i = i + 1;
6,336
1
// Declare constructor. Set marketplace to be new instance of _contractToTest/_contractToTest A data type, of type Marketplace contract
constructor(Marketplace _contractToTest) public { marketplace = _contractToTest; }
constructor(Marketplace _contractToTest) public { marketplace = _contractToTest; }
10,806
7
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
uint256[] private _allTokens;
31,207
18
// This will be invoked by the owner, when owner wants to rescue tokens/token Token which will we rescue to the owner from the contract
function recoverTokens(ERC20Basic token) onlyOwner public { token.transfer(owner, tokensToBeReturned(token)); }
function recoverTokens(ERC20Basic token) onlyOwner public { token.transfer(owner, tokensToBeReturned(token)); }
23,966
0
// IStorageAccessible - generic base interface that allows callers to access all internal storage./See https:github.com/gnosis/util-contracts/blob/bb5fe5fb5df6d8400998094fb1b32a178a47c3a1/contracts/StorageAccessible.sol
interface IStorageAccessible { /// @notice Reads `length` bytes of storage in the currents contract. /// @param offset - the offset in the current contract's storage in words to start reading from. /// @param length - the number of words (32 bytes) of data to read. /// @return Bytes string of the bytes that were read. function getStorageAt(uint256 offset, uint256 length) external view returns (bytes memory); /// @notice Reads bytes of storage at different storage locations. /// @dev Returns a string with values regarless of where they are stored, i.e. variable, mapping or struct. /// @param slots The array of storage slots to query into. /// @return Bytes string composite of different storage locations' value. function getStorageSlotsAt(uint256[] memory slots) external view returns (bytes memory); }
interface IStorageAccessible { /// @notice Reads `length` bytes of storage in the currents contract. /// @param offset - the offset in the current contract's storage in words to start reading from. /// @param length - the number of words (32 bytes) of data to read. /// @return Bytes string of the bytes that were read. function getStorageAt(uint256 offset, uint256 length) external view returns (bytes memory); /// @notice Reads bytes of storage at different storage locations. /// @dev Returns a string with values regarless of where they are stored, i.e. variable, mapping or struct. /// @param slots The array of storage slots to query into. /// @return Bytes string composite of different storage locations' value. function getStorageSlotsAt(uint256[] memory slots) external view returns (bytes memory); }
4,518
28
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
_totalSupply += value;
3,283
280
// now this frame is completed, so the expected epoch should be advanced to the first epoch of the next frame
_clearReportingAndAdvanceTo(_epochId + _beaconSpec.epochsPerFrame);
_clearReportingAndAdvanceTo(_epochId + _beaconSpec.epochsPerFrame);
32,517
63
// Transfers tokens held by timelock to beneficiary. /
function release() public virtual { // solhint-disable-next-line not-rely-on-time require(block.timestamp >= _releaseTime, "TokenTimelock: current time is before release time"); uint256 amount = _token.balanceOf(address(this)); require(amount > 0, "TokenTimelock: no tokens to release"); _token.safeTransfer(_beneficiary, amount); }
function release() public virtual { // solhint-disable-next-line not-rely-on-time require(block.timestamp >= _releaseTime, "TokenTimelock: current time is before release time"); uint256 amount = _token.balanceOf(address(this)); require(amount > 0, "TokenTimelock: no tokens to release"); _token.safeTransfer(_beneficiary, amount); }
5,294
21
// Transfer the balance from owner&39;s account to another account
function transfer(address _to, uint256 _amount)public returns (bool success) { require( _to != 0x0); require(balances[msg.sender] >= _amount && _amount >= 0); balances[msg.sender] = (balances[msg.sender]).sub(_amount); balances[_to] = (balances[_to]).add(_amount); emit Transfer(msg.sender, _to, _amount); return true; }
function transfer(address _to, uint256 _amount)public returns (bool success) { require( _to != 0x0); require(balances[msg.sender] >= _amount && _amount >= 0); balances[msg.sender] = (balances[msg.sender]).sub(_amount); balances[_to] = (balances[_to]).add(_amount); emit Transfer(msg.sender, _to, _amount); return true; }
1,436
11
// --- Admin ---
function file(bytes32 what, uint data) external note auth { if (what == "beg") beg = data; else if (what == "ttl") ttl = uint48(data); else if (what == "tau") tau = uint48(data); else revert("Flapper/file-unrecognized-param"); }
function file(bytes32 what, uint data) external note auth { if (what == "beg") beg = data; else if (what == "ttl") ttl = uint48(data); else if (what == "tau") tau = uint48(data); else revert("Flapper/file-unrecognized-param"); }
9,452
13
// Amount of wei raised
uint256 public weiRaised; event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
uint256 public weiRaised; event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
11,620
21
// Emitted when a Pool registers tokens by calling `registerTokens`. /
event TokensRegistered(bytes32 indexed poolId, IERC20[] tokens, address[] assetManagers);
event TokensRegistered(bytes32 indexed poolId, IERC20[] tokens, address[] assetManagers);
21,210
20
// @inheritdoc IStrategy
function skim(uint256 amount) external override { _skim(amount); }
function skim(uint256 amount) external override { _skim(amount); }
27,250
18
// Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used toe.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 spender, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
8,783
6
// set a new owner for the contract/_newOwner owner to swap to
function setOwner(address _newOwner) external { if (msg.sender != owner) revert GuardErrors.NotOwner(); address previousOwner = msg.sender; owner = _newOwner; emit LogOwnershipTransferred(previousOwner, _newOwner); }
function setOwner(address _newOwner) external { if (msg.sender != owner) revert GuardErrors.NotOwner(); address previousOwner = msg.sender; owner = _newOwner; emit LogOwnershipTransferred(previousOwner, _newOwner); }
33,025
98
// Emitted when the beacon is upgraded. /
event BeaconUpgraded(address indexed beacon);
event BeaconUpgraded(address indexed beacon);
979
73
// | onReceive function signatures
bytes4 constant internal ERC1155_RECEIVED_VALUE = 0xf23a6e61; bytes4 constant internal ERC1155_BATCH_RECEIVED_VALUE = 0xbc197c81;
bytes4 constant internal ERC1155_RECEIVED_VALUE = 0xf23a6e61; bytes4 constant internal ERC1155_BATCH_RECEIVED_VALUE = 0xbc197c81;
23,036
67
// Send all tokens to founders.
function sendAllTokensToFounder(uint _round) onlyManager whenInitialized { require(roundData[_round].soldTokens>=1); uint icoToken = add(roundData[_round].soldTokens,roundData[_round].sendTokens); uint icoSupply = roundData[_round].supply; uint founderValue = sub(icoSupply, icoToken); roundData[_round].sendTokens = add(roundData[_round].sendTokens, founderValue); tokensToFunder = add(tokensToFunder,founderValue); robottradingToken.emitTokens(accFounder, founderValue); }
function sendAllTokensToFounder(uint _round) onlyManager whenInitialized { require(roundData[_round].soldTokens>=1); uint icoToken = add(roundData[_round].soldTokens,roundData[_round].sendTokens); uint icoSupply = roundData[_round].supply; uint founderValue = sub(icoSupply, icoToken); roundData[_round].sendTokens = add(roundData[_round].sendTokens, founderValue); tokensToFunder = add(tokensToFunder,founderValue); robottradingToken.emitTokens(accFounder, founderValue); }
40,171
15
// CO2 Certificate "struct"
contract CO2Certificate { using SafeMath for uint256; uint256 private _burnedTokens; uint256 private _certifiedKilometers; string private _ownerName; constructor (uint256 burnedTokens, uint256 certifiedKilometers, string ownerName) public { require (burnedTokens > 0, "You must burn at least one token"); require (certifiedKilometers >= 0, "Certified Kilometers must be positive"); _burnedTokens = burnedTokens; _certifiedKilometers = certifiedKilometers; _ownerName = ownerName; } // Getters function getBurnedTokens() public view returns(uint256) { return _burnedTokens; } function getCertifiedKilometers() public view returns(uint256) { return _certifiedKilometers; } function getOwnerName() public view returns(string) { return _ownerName; } }
contract CO2Certificate { using SafeMath for uint256; uint256 private _burnedTokens; uint256 private _certifiedKilometers; string private _ownerName; constructor (uint256 burnedTokens, uint256 certifiedKilometers, string ownerName) public { require (burnedTokens > 0, "You must burn at least one token"); require (certifiedKilometers >= 0, "Certified Kilometers must be positive"); _burnedTokens = burnedTokens; _certifiedKilometers = certifiedKilometers; _ownerName = ownerName; } // Getters function getBurnedTokens() public view returns(uint256) { return _burnedTokens; } function getCertifiedKilometers() public view returns(uint256) { return _certifiedKilometers; } function getOwnerName() public view returns(string) { return _ownerName; } }
1,406
1
// The earliest date owner/depositor can withdraw funds/withdrawalDate is set in the constructor, and can not be modified / return Returns uint the earliest withdrawal date in epoch format
uint public withdrawalDate;
uint public withdrawalDate;
4,365
33
// Voken2.0 public-sale interface. /
interface VokenPublicSale { function status() external view returns (uint16 stage, uint16 season, uint256 etherUsdPrice, uint256 vokenUsdPrice, uint256 shareholdersRatio); }
interface VokenPublicSale { function status() external view returns (uint16 stage, uint16 season, uint256 etherUsdPrice, uint256 vokenUsdPrice, uint256 shareholdersRatio); }
18,735
30
// Destroys `amount` tokens from `account`, reducing thetotal 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 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); }
function _burn(address account, uint256 value) internal { require(account != address(0), "ERC20: burn from the zero address"); _totalSupply = _totalSupply.sub(value); _balances[account] = _balances[account].sub(value); emit Transfer(account, address(0), value); }
5,839
48
// The wallet to receive payments here before initiating crowdsalewill overwrite old wallet address
function setPlatformFundsWallet(address _walletAddress) external
function setPlatformFundsWallet(address _walletAddress) external
18,953
16
// Cannot query the balance for the zero address. /
error BalanceQueryForZeroAddress();
error BalanceQueryForZeroAddress();
1,492
9
// ============ Incentivefunction ============
function triggerIncentive( address fromToken, address toToken, uint256 fromAmount, uint256 returnAmount, address assetTo
function triggerIncentive( address fromToken, address toToken, uint256 fromAmount, uint256 returnAmount, address assetTo
596
3
// view the amount of STK still available for sale /
function availableToken() external view returns (uint256);
function availableToken() external view returns (uint256);
6,530
148
// Unlock part of the locked balance, so user can make transfer to the superwhitelisted. Do not unlock everything - it would be too easy to exploit it to circumvent the delay. We unlock balance only when sending to SuperWhitelisted Otherwise the simple check `unlockedBalance(from) >= amount`
uint ub = unlockedBalance(from); if (ub < amount) { uint amountToUnlock = amount.sub(ub); removePendingDeposits(from, amountToUnlock); }
uint ub = unlockedBalance(from); if (ub < amount) { uint amountToUnlock = amount.sub(ub); removePendingDeposits(from, amountToUnlock); }
15,331
67
// Remaining Releayer penalty funds
uint256 remainingPenaltyFunds;
uint256 remainingPenaltyFunds;
45,193
250
// reserve token
address public reserveToken;
address public reserveToken;
2,985
132
// Optimized to fit into 64 bytes (2 slots)
struct Quota
struct Quota
9,541
29
// ------------------------------------------------------------------------ token minter function ------------------------------------------------------------------------
function () public payable whenNotPaused { if(now > endDate && isMintingFinished == false) { finishMinting(); msg.sender.transfer(msg.value); //return this transfer, as it is too late. } else { require(now >= startDate && now <= endDate && isMintingFinished == false); require(msg.value >= minAmountETH && msg.value <= maxAmountETH); require(msg.value + ethDeposits[msg.sender] <= maxAmountETH); require(kycAddressState[msg.sender] == true); uint tokens = getAmountToIssue(msg.value); require(safeAdd(soldSupply, tokens) <= maxSellable); soldSupply = safeAdd(soldSupply, tokens); _totalSupply = safeAdd(_totalSupply, tokens); balances[msg.sender] = safeAdd(balances[msg.sender], tokens); ethDeposits[msg.sender] = safeAdd(ethDeposits[msg.sender], msg.value); emit Transfer(address(0), msg.sender, tokens); ownerAPI.transfer(msg.value * 15 / 100); //transfer 15% of the ETH now, the other 85% at the end of the ICO process } }
function () public payable whenNotPaused { if(now > endDate && isMintingFinished == false) { finishMinting(); msg.sender.transfer(msg.value); //return this transfer, as it is too late. } else { require(now >= startDate && now <= endDate && isMintingFinished == false); require(msg.value >= minAmountETH && msg.value <= maxAmountETH); require(msg.value + ethDeposits[msg.sender] <= maxAmountETH); require(kycAddressState[msg.sender] == true); uint tokens = getAmountToIssue(msg.value); require(safeAdd(soldSupply, tokens) <= maxSellable); soldSupply = safeAdd(soldSupply, tokens); _totalSupply = safeAdd(_totalSupply, tokens); balances[msg.sender] = safeAdd(balances[msg.sender], tokens); ethDeposits[msg.sender] = safeAdd(ethDeposits[msg.sender], msg.value); emit Transfer(address(0), msg.sender, tokens); ownerAPI.transfer(msg.value * 15 / 100); //transfer 15% of the ETH now, the other 85% at the end of the ICO process } }
18,938
6
// The timestamp from the block when this dino came into existence.
uint256 bornAt;
uint256 bornAt;
32,621
8
// Whether `a` is greater than or equal to `b`. a a FixedPoint. b a FixedPoint.return True if `a >= b`, or False. /
function isGreaterThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) { return a.rawValue >= b.rawValue; }
function isGreaterThanOrEqual(Unsigned memory a, Unsigned memory b) internal pure returns (bool) { return a.rawValue >= b.rawValue; }
18,090
36
// for USDT
require(userUpdatedBalance.div(rate) <= allowedUserBalance, "Exceeded allowed user balance");
require(userUpdatedBalance.div(rate) <= allowedUserBalance, "Exceeded allowed user balance");
40,565
168
// the next line is the loop condition: while(uint256(mc < end) + cb == 2)
for {} eq(add(lt(mc, end), cb), 2) {
for {} eq(add(lt(mc, end), cb), 2) {
2,787
87
// Note that this application has a staking token as well as a distribution token, whichmay be different. This function is required by EIP-900.return The deposit token used for staking. /
function token() external view returns (address) { return address(getStakingToken()); }
function token() external view returns (address) { return address(getStakingToken()); }
17,419
15
// Update flow with userData cfaLibrary The cfaLibrary storage variable receiver The receiver of the flow token The token to flow flowRate The desired flowRate userData The user provided data /
function updateFlow( InitData storage cfaLibrary, address receiver, ISuperfluidToken token, int96 flowRate, bytes memory userData
function updateFlow( InitData storage cfaLibrary, address receiver, ISuperfluidToken token, int96 flowRate, bytes memory userData
10,766
30
// Safe cvp transfer function, just in case if rounding error causes pool to not have enough CVPs.
function safeCvpTransfer(address _to, uint256 _amount) internal { uint256 cvpBal = cvp.balanceOf(address(this)); if (_amount > cvpBal) { cvp.transfer(_to, cvpBal); } else { cvp.transfer(_to, _amount); } }
function safeCvpTransfer(address _to, uint256 _amount) internal { uint256 cvpBal = cvp.balanceOf(address(this)); if (_amount > cvpBal) { cvp.transfer(_to, cvpBal); } else { cvp.transfer(_to, _amount); } }
39,871
61
// Transfer token from taker to maker.
transferToken( finalTakerWallet, _order.maker.wallet, _order.taker.param, _order.taker.token, _order.taker.kind );
transferToken( finalTakerWallet, _order.maker.wallet, _order.taker.param, _order.taker.token, _order.taker.kind );
50,681
263
// Transfer to bankroll and div cards
if (toBankRoll != 0) {ZethrBankroll(bankrollAddress).receiveDividends.value(toBankRoll)();}
if (toBankRoll != 0) {ZethrBankroll(bankrollAddress).receiveDividends.value(toBankRoll)();}
24,405
6
// Check if user exists. If yes, return user name. If no, check if name was sent. If yes, create and return user.
if (users[msg.sender].name == 0x0) { users[msg.sender].name = name; return (users[msg.sender].name); }
if (users[msg.sender].name == 0x0) { users[msg.sender].name = name; return (users[msg.sender].name); }
49,778
13
// Burns debt of `user` user The address of the user getting his debt burned amount The amount of debt tokens getting burned /
function burn(address user, uint256 amount) external override onlyLendingPool { (, uint256 currentBalance, uint256 balanceIncrease) = _calculateBalanceIncrease(user); uint256 previousSupply = totalSupply(); uint256 newAvgStableRate = 0; uint256 nextSupply = 0; uint256 userStableRate = _usersStableRate[user]; // Since the total supply and each single user debt accrue separately, // there might be accumulation errors so that the last borrower repaying // mght actually try to repay more than the available debt supply. // In this case we simply set the total supply and the avg stable rate to 0 if (previousSupply <= amount) { _avgStableRate = 0; _totalSupply = 0; } else { nextSupply = _totalSupply = previousSupply.sub(amount); uint256 firstTerm = _avgStableRate.rayMul(previousSupply.wadToRay()); uint256 secondTerm = userStableRate.rayMul(amount.wadToRay()); // For the same reason described above, when the last user is repaying it might // happen that user rate * user balance > avg rate * total supply. In that case, // we simply set the avg rate to 0 if (secondTerm >= firstTerm) { newAvgStableRate = _avgStableRate = _totalSupply = 0; } else { newAvgStableRate = _avgStableRate = firstTerm.sub(secondTerm).rayDiv(nextSupply.wadToRay()); } } if (amount == currentBalance) { _usersStableRate[user] = 0; _timestamps[user] = 0; } else { //solium-disable-next-line _timestamps[user] = uint40(block.timestamp); } //solium-disable-next-line _totalSupplyTimestamp = uint40(block.timestamp); if (balanceIncrease > amount) { uint256 amountToMint = balanceIncrease.sub(amount); _mint(user, amountToMint, previousSupply); emit Mint( user, user, amountToMint, currentBalance, balanceIncrease, userStableRate, newAvgStableRate, nextSupply ); } else { uint256 amountToBurn = amount.sub(balanceIncrease); _burn(user, amountToBurn, previousSupply); emit Burn(user, amountToBurn, currentBalance, balanceIncrease, newAvgStableRate, nextSupply); } emit Transfer(user, address(0), amount); }
function burn(address user, uint256 amount) external override onlyLendingPool { (, uint256 currentBalance, uint256 balanceIncrease) = _calculateBalanceIncrease(user); uint256 previousSupply = totalSupply(); uint256 newAvgStableRate = 0; uint256 nextSupply = 0; uint256 userStableRate = _usersStableRate[user]; // Since the total supply and each single user debt accrue separately, // there might be accumulation errors so that the last borrower repaying // mght actually try to repay more than the available debt supply. // In this case we simply set the total supply and the avg stable rate to 0 if (previousSupply <= amount) { _avgStableRate = 0; _totalSupply = 0; } else { nextSupply = _totalSupply = previousSupply.sub(amount); uint256 firstTerm = _avgStableRate.rayMul(previousSupply.wadToRay()); uint256 secondTerm = userStableRate.rayMul(amount.wadToRay()); // For the same reason described above, when the last user is repaying it might // happen that user rate * user balance > avg rate * total supply. In that case, // we simply set the avg rate to 0 if (secondTerm >= firstTerm) { newAvgStableRate = _avgStableRate = _totalSupply = 0; } else { newAvgStableRate = _avgStableRate = firstTerm.sub(secondTerm).rayDiv(nextSupply.wadToRay()); } } if (amount == currentBalance) { _usersStableRate[user] = 0; _timestamps[user] = 0; } else { //solium-disable-next-line _timestamps[user] = uint40(block.timestamp); } //solium-disable-next-line _totalSupplyTimestamp = uint40(block.timestamp); if (balanceIncrease > amount) { uint256 amountToMint = balanceIncrease.sub(amount); _mint(user, amountToMint, previousSupply); emit Mint( user, user, amountToMint, currentBalance, balanceIncrease, userStableRate, newAvgStableRate, nextSupply ); } else { uint256 amountToBurn = amount.sub(balanceIncrease); _burn(user, amountToBurn, previousSupply); emit Burn(user, amountToBurn, currentBalance, balanceIncrease, newAvgStableRate, nextSupply); } emit Transfer(user, address(0), amount); }
5,662
11
// Emitted when permissions for a token are modified tokenId The id of the token permissions The set of permissions that were updated /
event Modified(uint256 tokenId, PermissionSet[] permissions);
event Modified(uint256 tokenId, PermissionSet[] permissions);
36,134
6
// Record the claim internally: This function does not check permissions: caller must verify the claim is valid!this function should not call any untrusted external contracts to avoid reentrancy /
function _executeClaim( address beneficiary, uint256 _totalAmount
function _executeClaim( address beneficiary, uint256 _totalAmount
14,997
13
// Initiates a rebasement proposal that has to be confirmed by another owner of the contract to be executed. Can't be called while another proposal is pending. _rebaseOne Price divergence. _rebaseTwo VXX difference. /
function initiateRebasement(int256 _rebaseOne, int256 _rebaseTwo) public isOwner
function initiateRebasement(int256 _rebaseOne, int256 _rebaseTwo) public isOwner
19,059
19
// rSupply always > tSupply (no precision loss)
uint256 rate = rSupply / tSupply; return rate;
uint256 rate = rSupply / tSupply; return rate;
18,709
117
// Where fees are pooled in pUSD.
address internal constant FEE_ADDRESS = 0xfeEFEEfeefEeFeefEEFEEfEeFeefEEFeeFEEFEeF; uint256 internal constant ACCOUNT_LOAN_LIMIT_CAP = 1000; bytes32 private constant pUSD = "pUSD"; bytes32 public constant COLLATERAL = "ETH";
address internal constant FEE_ADDRESS = 0xfeEFEEfeefEeFeefEEFEEfEeFeefEEFeeFEEFEeF; uint256 internal constant ACCOUNT_LOAN_LIMIT_CAP = 1000; bytes32 private constant pUSD = "pUSD"; bytes32 public constant COLLATERAL = "ETH";
14,097
7
// |/ Handle which method is being called on Token transfer `_data` must be encoded as follow: abi.encode(bytes4, MethodObj)where bytes4 argument is the MethodObj object signature passed as definedin the `Signatures for onReceive control logic` section above _operator The address which called the `safeTransferFrom` function _from The address which previously owned the token _id The id of the token being transferred _amount The amount of tokens being transferred _data Method signature and corresponding encoded arguments for method to call on this contractreturn `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` /
function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _amount, bytes calldata _data) external returns(bytes4);
function onERC1155Received(address _operator, address _from, uint256 _id, uint256 _amount, bytes calldata _data) external returns(bytes4);
39,786
249
// Updates: - `balance -= 1`. - `numberBurned += 1`. We can directly decrement the balance, and increment the number burned. This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
_packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;
_packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;
11,273
28
// We keep track of the last batch submitted by the sequencer so there's a window in which only the sequencer can publish state roots. A window like this just reduces the chance of "system breaking" state roots being published while we're still in testing mode. This window should be removed or significantly reduced in the future.
require( lastSequencerTimestamp + SEQUENCER_PUBLISH_WINDOW < block.timestamp, "Cannot publish state roots within the sequencer publication window." );
require( lastSequencerTimestamp + SEQUENCER_PUBLISH_WINDOW < block.timestamp, "Cannot publish state roots within the sequencer publication window." );
28,905
154
// Accrue tokens and MOMA to the market by updating the supply index mToken The market whose supply index to update marketBorrowIndex The market borrow index /
function updateFarmBorrowIndex(address mToken, uint marketBorrowIndex) internal { updateMomaBorrowIndex(mToken, marketBorrowIndex); for (uint i = 0; i < allTokens.length; i++) { address token = allTokens[i]; updateTokenBorrowIndex(token, mToken, marketBorrowIndex); } }
function updateFarmBorrowIndex(address mToken, uint marketBorrowIndex) internal { updateMomaBorrowIndex(mToken, marketBorrowIndex); for (uint i = 0; i < allTokens.length; i++) { address token = allTokens[i]; updateTokenBorrowIndex(token, mToken, marketBorrowIndex); } }
16,059
33
// Constrctor function Setup the owner /
function DoccoinPreICO( doccoin addressOfTokenUsedAsReward
function DoccoinPreICO( doccoin addressOfTokenUsedAsReward
8,386
11
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20Uniswap(token0).balanceOf(address(this)); uint balance1 = IERC20Uniswap(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { address migrator = IUniswapV2Factory(factory).migrator(); if (msg.sender == migrator) { liquidity = IMigrator(migrator).desiredLiquidity(); require(liquidity > 0 && liquidity != uint256(-1), "Bad desired liquidity"); } else { require(migrator == address(0), "Must not have migrator"); liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); }
function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20Uniswap(token0).balanceOf(address(this)); uint balance1 = IERC20Uniswap(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { address migrator = IUniswapV2Factory(factory).migrator(); if (msg.sender == migrator) { liquidity = IMigrator(migrator).desiredLiquidity(); require(liquidity > 0 && liquidity != uint256(-1), "Bad desired liquidity"); } else { require(migrator == address(0), "Must not have migrator"); liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); }
4,396
43
// Gets LP pair address from Uniswap.return LP pair address. /
function _setTokenPair() private returns (address) { address pair = factory.getPair(address(token1), address(token2)); if (pair == address(0)) { return _createPool(); } tokenPair = pair; return tokenPair; }
function _setTokenPair() private returns (address) { address pair = factory.getPair(address(token1), address(token2)); if (pair == address(0)) { return _createPool(); } tokenPair = pair; return tokenPair; }
8,734
177
// Realizable balance of our shares/ TODO: If this is wrong, it will overvalue our shares (we will get LESS for each share we redeem) This means the user will lose out.
function balanceOfPool() public override view returns (uint256) { uint256 vaultShares = IHarvestVault(harvestVault).balanceOf(address(this)); uint256 farmShares = IRewardPool(vaultFarm).balanceOf(address(this)); return _fromHarvestVaultTokens(vaultShares.add(farmShares)); }
function balanceOfPool() public override view returns (uint256) { uint256 vaultShares = IHarvestVault(harvestVault).balanceOf(address(this)); uint256 farmShares = IRewardPool(vaultFarm).balanceOf(address(this)); return _fromHarvestVaultTokens(vaultShares.add(farmShares)); }
88,569
3
// User informations to keep track of what is still to pay.
struct UserInfo { // Keeps track of all the weeks that have unclaimed rewards for this user. EnumerableSet.UintSet weeksToPay; // Record of the amount of reward due per week. mapping(uint256 => uint256) rewardsPerWeek; }
struct UserInfo { // Keeps track of all the weeks that have unclaimed rewards for this user. EnumerableSet.UintSet weeksToPay; // Record of the amount of reward due per week. mapping(uint256 => uint256) rewardsPerWeek; }
22,690
194
// update dividend tracker
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
76,545
358
// round 4
ark(i, q, 20360807315276763881209958738450444293273549928693737723235350358403012458514); sbox_partial(i, q); mix(i, q);
ark(i, q, 20360807315276763881209958738450444293273549928693737723235350358403012458514); sbox_partial(i, q); mix(i, q);
51,184
0
// constrct function
function ContractBase(string version_para) { version = version_para; }
function ContractBase(string version_para) { version = version_para; }
2,767
80
// return how many attoRSV `holder` has allowed `spender` to control.
function allowance(address holder, address spender) external view returns (uint256) { return trustedData.allowed(holder, spender); }
function allowance(address holder, address spender) external view returns (uint256) { return trustedData.allowed(holder, spender); }
21,546
361
// The version of Yvault
YvTokenVersion version;
YvTokenVersion version;
69,084
2
// Calculates the current supply interest rate per block cash The total amount of cash the market has borrows The total amount of borrows the market has outstanding reserves The total amount of reserves the market has reserveFactorMantissa The current reserve factor the market hasreturn The supply rate per block (as a percentage, and scaled by 1e18) /
function getSupplyRate( uint256 cash, uint256 borrows, uint256 reserves,
function getSupplyRate( uint256 cash, uint256 borrows, uint256 reserves,
27,544
13
// social network ids:01 : facebook; 02 : youtube 03 : instagram 04 : twitter 05 : url TLS Notary
event AskRequest(bytes32 indexed idRequest, uint8 typeSN, string idPost,string idUser); event AnswerRequest(bytes32 indexed idRequest, uint64 likes, uint64 shares, uint64 views); function ask (uint8 typeSN,string memory idPost,string memory idUser, bytes32 idRequest) public onlyCanAsk
event AskRequest(bytes32 indexed idRequest, uint8 typeSN, string idPost,string idUser); event AnswerRequest(bytes32 indexed idRequest, uint64 likes, uint64 shares, uint64 views); function ask (uint8 typeSN,string memory idPost,string memory idUser, bytes32 idRequest) public onlyCanAsk
47,892
28
// -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- /
struct Fee { uint8 reflection; uint8 marketing; uint8 lp; uint8 buyback; uint8 burn; uint128 total; }
struct Fee { uint8 reflection; uint8 marketing; uint8 lp; uint8 buyback; uint8 burn; uint128 total; }
342
52
// Updates to Cancelled state.
_state = IssuanceProperties.State.Cancelled; Transfers.Data memory transfers = Transfers.Data( new Transfer.Data[](2) );
_state = IssuanceProperties.State.Cancelled; Transfers.Data memory transfers = Transfers.Data( new Transfer.Data[](2) );
20,135
18
// Change atto-DNN to DNN
tokenCount = tokenCount * 1 ether;
tokenCount = tokenCount * 1 ether;
39,762
102
// calculate x before ^ a
uint256 xBeforePowA = LogExpMath.pow(reserveX, a);
uint256 xBeforePowA = LogExpMath.pow(reserveX, a);
60,248
3
// Underlying token address
address public override underlying;
address public override underlying;
6,203
1,303
// We are converting internal balances here so we know they have INTERNAL_TOKEN_PRECISION decimals internalDecimalsrateDecimals / rateDecimals
int256 result = balance.mul(er.rateDecimals).div(er.rate); return result;
int256 result = balance.mul(er.rateDecimals).div(er.rate); return result;
6,577
22
//
{ zethrAddress = _zethr; divCardAddress = _divcards; ZTHTKN = ZTHInterface(zethrAddress); }
{ zethrAddress = _zethr; divCardAddress = _divcards; ZTHTKN = ZTHInterface(zethrAddress); }
48,880
187
// all these 4 varialbes are less than 112 bits outAmount is sure to less than outpoolTokenReserve (which is ctx.reserveStock or ctx.reserveMoney)
uint outAmount = (outpoolTokenReserve*ctx.amountIntoPool)/(inpoolTokenReserve+ctx.amountIntoPool); if(ctx.amountIntoPool > 0) { _emitDealWithPool(uint112(ctx.amountIntoPool), uint112(outAmount), isBuy); }
uint outAmount = (outpoolTokenReserve*ctx.amountIntoPool)/(inpoolTokenReserve+ctx.amountIntoPool); if(ctx.amountIntoPool > 0) { _emitDealWithPool(uint112(ctx.amountIntoPool), uint112(outAmount), isBuy); }
53,550
26
// only ICO contract is allowed to proceed
require(msg.sender == icoContract); _;
require(msg.sender == icoContract); _;
27,668
1
// To be used for RFQ-m trades, verified by the router.
bytes32 internal constant QUOTE_TYPEHASH = keccak256( 'Quote(bytes32 txid,address trader,address pool,address externalAccount,address baseToken,address quoteToken,uint256 baseTokenAmount,uint256 quoteTokenAmount,uint256 quoteExpiry)' );
bytes32 internal constant QUOTE_TYPEHASH = keccak256( 'Quote(bytes32 txid,address trader,address pool,address externalAccount,address baseToken,address quoteToken,uint256 baseTokenAmount,uint256 quoteTokenAmount,uint256 quoteExpiry)' );
29,432
20
// start at max
what = 11; for(uint256 i = 0; i < 11; i++){ if(r <= FEATURESTEPS[i]){ what = i; break; }
what = 11; for(uint256 i = 0; i < 11; i++){ if(r <= FEATURESTEPS[i]){ what = i; break; }
44,604
68
// IInstantDistributionAgreementV1.deleteSubscription implementation
function deleteSubscription( ISuperfluidToken token, address publisher, uint32 indexId, address subscriber, bytes calldata ctx ) external override returns(bytes memory newCtx)
function deleteSubscription( ISuperfluidToken token, address publisher, uint32 indexId, address subscriber, bytes calldata ctx ) external override returns(bytes memory newCtx)
21,869
5
// Append the DB statement to Table Contract.return whether the operation success /
function appendLog( string calldata tableName, string calldata statement, uint8 operation
function appendLog( string calldata tableName, string calldata statement, uint8 operation
45,140
439
// Gets the validity date (timestamp) of a given cover.
function getValidityOfCover(uint _cid) external view returns(uint date) { date = allCovers[_cid].validUntil; }
function getValidityOfCover(uint _cid) external view returns(uint date) { date = allCovers[_cid].validUntil; }
22,387
184
// Sets the message of the NFT.
function setMessage(uint256 id, string calldata value) external { address sender = msg.sender; require(ownerOf(id) == sender, "Unauthorized!"); _messages[id] = value; }
function setMessage(uint256 id, string calldata value) external { address sender = msg.sender; require(ownerOf(id) == sender, "Unauthorized!"); _messages[id] = value; }
31,992
3
// An interface for notifying of stake change events (e.g., stake, unstake, partial unstake, restate, etc.).
contract RevertingStakeChangeNotifier is IStakeChangeNotifier{ function stakeChange(address, uint256, bool, uint256) external override { revert("RevertingStakeChangeNotifier: stakeChange reverted"); } function stakeChangeBatch(address[] calldata, uint256[] calldata, bool[] calldata, uint256[] calldata) external override { revert("RevertingStakeChangeNotifier: stakeChangeBatch reverted"); } function stakeMigration(address, uint256) external override { revert("RevertingStakeChangeNotifier: stakeMigration reverted"); } }
contract RevertingStakeChangeNotifier is IStakeChangeNotifier{ function stakeChange(address, uint256, bool, uint256) external override { revert("RevertingStakeChangeNotifier: stakeChange reverted"); } function stakeChangeBatch(address[] calldata, uint256[] calldata, bool[] calldata, uint256[] calldata) external override { revert("RevertingStakeChangeNotifier: stakeChangeBatch reverted"); } function stakeMigration(address, uint256) external override { revert("RevertingStakeChangeNotifier: stakeMigration reverted"); } }
28,587
6
// Decrease ethRemaining and transfer fee to corresponding feeRecipient
ethRemaining = ethRemaining.safeSub(ethFeeAmount); feeRecipients[i].transfer(ethFeeAmount);
ethRemaining = ethRemaining.safeSub(ethFeeAmount); feeRecipients[i].transfer(ethFeeAmount);
33,802
1
// Check the signature length
if (sig.length != 65) { return (address(0)); }
if (sig.length != 65) { return (address(0)); }
2,572
57
// Anounce it to the world!
TokenAuctionCompleted(tokenIndex, seller, buyer, sellPrice);
TokenAuctionCompleted(tokenIndex, seller, buyer, sellPrice);
16,495
1
// EIP 4337 Entrypoint contract.
IEntryPoint private immutable entrypointContract; /*/////////////////////////////////////////////////////////////// Constructor, Initializer, Modifiers
IEntryPoint private immutable entrypointContract; /*/////////////////////////////////////////////////////////////// Constructor, Initializer, Modifiers
29,757
0
// initialize init thecontract with the following parameters_owner contract's owner account address_conditionStoreManagerAddress condition store manager address_tokenAddress Ocean token contract address/
function initialize( address _owner, address _conditionStoreManagerAddress, address _tokenAddress ) external initializer()
function initialize( address _owner, address _conditionStoreManagerAddress, address _tokenAddress ) external initializer()
44,256
0
// racAddress address for the raising access controller. lacAddress address for the lowering access controller. /
constructor( address racAddress, address lacAddress
constructor( address racAddress, address lacAddress
19,557
239
// Update the weight of an existing token Notice Balance is not an input (like with rebind on BPool) since we will require prices not to change This is achieved by forcing balances to change proportionally to weights, so that prices don't change If prices could be changed, this would allow the controller to drain the pool by arbing price changes token - token to be reweighted newWeight - new weight of the token/
function updateWeight(address token, uint newWeight) external logs lock onlyOwner needsBPool virtual
function updateWeight(address token, uint newWeight) external logs lock onlyOwner needsBPool virtual
47,180
78
// Add a new vesting entry at a given time and quantity to an account's schedule. A call to this should accompany a previous successful call to synthetix.transfer(rewardEscrow, amount),to ensure that when the funds are withdrawn, there is enough balance.Note; although this function could technically be used to produce unboundedarrays, it's only withinn the 4 year period of the weekly inflation schedule. account The account to append a new vesting entry to. quantity The quantity of SNX that will be escrowed. /
function appendVestingEntry(address account, uint quantity) external onlyFeePool { _appendVestingEntry(account, quantity); }
function appendVestingEntry(address account, uint quantity) external onlyFeePool { _appendVestingEntry(account, quantity); }
16,407
36
// ---------------------------------- Helper Functions----------------------------------
function getPoolStatus_asString() private view
function getPoolStatus_asString() private view
27,830
178
// allows governance to assign delegate to self/
function _acceptGov() external
function _acceptGov() external
20,671