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
18
// Mints a new call option for the assets deposited in a particular vault given strike price and expiration.
/// That vault must already have a registered entitlement for this contract with the an expiration equal to {expirationTime} /// @param vaultAddress the contract address of the vault currently holding the call option /// @param assetId the id of the asset within the vault /// @param strikePrice the strike price...
/// That vault must already have a registered entitlement for this contract with the an expiration equal to {expirationTime} /// @param vaultAddress the contract address of the vault currently holding the call option /// @param assetId the id of the asset within the vault /// @param strikePrice the strike price...
39,625
37
// Add all used certifications to dictionary
for (uint i = 0; i < parts.length; ++i) { var product = productIdToProductStruct[parts[i]]; bytes32[] memory partCerts = product.certificationsIds; for (uint j = 0; j < partCerts.length; ++j) { dic.increment(partCerts[j]); }
for (uint i = 0; i < parts.length; ++i) { var product = productIdToProductStruct[parts[i]]; bytes32[] memory partCerts = product.certificationsIds; for (uint j = 0; j < partCerts.length; ++j) { dic.increment(partCerts[j]); }
5,807
86
// counter to allow mutex lock with only one SSTORE operation
uint256 private _guardCounter;
uint256 private _guardCounter;
22,646
5
// Construct an empty delegate /
constructor() public {} /** * @notice Called by the delegator on a delegate to initialize it for duty * @param data The encoded bytes data for any initialization */ function _becomeImplementation(bytes memory data) public { // Shh -- currently unused data; // Shh -- ...
constructor() public {} /** * @notice Called by the delegator on a delegate to initialize it for duty * @param data The encoded bytes data for any initialization */ function _becomeImplementation(bytes memory data) public { // Shh -- currently unused data; // Shh -- ...
6,539
128
// What is this hero&39;s type? ex) John, Sally, Mark...
uint32 heroClassId;
uint32 heroClassId;
38,535
40
// Aggregating total stETH + wETH including revenue
totalAssets_ =
totalAssets_ =
12,804
2
// Indicates whether any token exist with a given id, or not. /
function exists(uint256 id) public view virtual returns (bool) { return totalSupply(id) > 0; }
function exists(uint256 id) public view virtual returns (bool) { return totalSupply(id) > 0; }
3,119
35
// Calculate mAPT amount for given pool's underlyer amount. amount Pool underlyer amount to be converted tokenPrice Pool underlyer's USD price (in wei) per underlyer token decimals Pool underlyer's number of decimals Price parameter is in units of wei per token ("big" unit), sinceattempting to express wei per token bit...
function _calculateDelta( uint256 amount, uint256 tokenPrice, uint8 decimals
function _calculateDelta( uint256 amount, uint256 tokenPrice, uint8 decimals
38,312
17
// Allow the boss to attack player
if (player.hp < bigBoss.attackDamage) { player.hp = 0; } else {
if (player.hp < bigBoss.attackDamage) { player.hp = 0; } else {
53,527
112
// Pull BPTs from StakeLocker.
IStakeLocker(stakeLocker).pull(address(this), bPool.balanceOf(stakeLocker));
IStakeLocker(stakeLocker).pull(address(this), bPool.balanceOf(stakeLocker));
59,707
32
// ____________________________________________________________________________________________________________________ -->MODULES (function) unpauseDeployedContract Call unpause on deployed contracts --------------------------------------------------------------------------------------------------------------------- m...
function unpauseDeployedContract(
function unpauseDeployedContract(
37,093
26
// approve and deposit into curve
IERC20(token).approve(address(curve3Pool), amount); uint256 curveAmount = curve3Pool.add_liquidity(curveToken, amounts, minAmount);
IERC20(token).approve(address(curve3Pool), amount); uint256 curveAmount = curve3Pool.add_liquidity(curveToken, amounts, minAmount);
82,156
112
// If canceling the tokens can free enough to delegate, cancel the batch and return true
if (amount <= (vars.availableBalance - (vars.delegatedBalance - vars.potentialCancelableBalance)) && nbToCancel > 0) { delegationBoost.batch_cancel_boosts(toCancel); return true; }
if (amount <= (vars.availableBalance - (vars.delegatedBalance - vars.potentialCancelableBalance)) && nbToCancel > 0) { delegationBoost.batch_cancel_boosts(toCancel); return true; }
32,831
141
// Set the hole size
setIlkMaxLiquidationAmount(co.ilk, co.maxLiquidationAmount);
setIlkMaxLiquidationAmount(co.ilk, co.maxLiquidationAmount);
50,704
110
// STEP 1: update the flow
int256 depositDelta; FlowData memory newFlowData; (depositDelta,,newFlowData) = _changeFlow( currentContext.timestamp, currentContext.appCreditToken, token, flowParams, oldFlowData);
int256 depositDelta; FlowData memory newFlowData; (depositDelta,,newFlowData) = _changeFlow( currentContext.timestamp, currentContext.appCreditToken, token, flowParams, oldFlowData);
35,661
0
// Change the token name _name address The new name of the Tokenreturn bool successful or not/
function setName(bytes32 _name) public onlyOwner returns (bool success) { require(_name != name); name = _name; return true; }
function setName(bytes32 _name) public onlyOwner returns (bool success) { require(_name != name); name = _name; return true; }
43,912
51
// Throws if called by any account that's not whitelisted./
modifier onlyWhitelisted() { require(whitelist[msg.sender]); _; }
modifier onlyWhitelisted() { require(whitelist[msg.sender]); _; }
39,187
9
// NOTE: We don't use SafeMath (or similar) in this function becauseall of our entry functions carefully cap the maximum values forcurrency (at 128-bits), and saleFee <= 10000 (see the require()statement in the ClockAuction constructor). The result of thisfunction is always guaranteed to be <= _price.
return _price * breedingSaleFee / 10000;
return _price * breedingSaleFee / 10000;
40,672
13
// get existence of a Prop i.e if Prop has been minted or not. _id Prop IDreturn bool/
function exists(uint256 _id) public view returns (bool) { return ( (props[_id].land == 0) && (props[_id].edition == 0) && (props[_id].rarity == 0) && (props[_id].serial == 0) ? false : true ); }
function exists(uint256 _id) public view returns (bool) { return ( (props[_id].land == 0) && (props[_id].edition == 0) && (props[_id].rarity == 0) && (props[_id].serial == 0) ? false : true ); }
17,400
94
// The number of buy tax checkpoints in the registry.
uint256 private _buyTaxPoints;
uint256 private _buyTaxPoints;
42,280
15
// Emitted when the minting limit is updated.//maximum The updated maximum minting limit./blocksThe updated number of blocks it will take for the maximum minting limit to be replenished when it is completely exhausted.
event MintingLimitUpdated(uint256 maximum, uint256 blocks);
event MintingLimitUpdated(uint256 maximum, uint256 blocks);
10,889
4
// constructor/ _name Vault's name/ _doc Allocated tos address
constructor( string memory _name, address _doc
constructor( string memory _name, address _doc
12,596
194
// Balancer Pool Token (representing shares of the pool)
string poolTokenSymbol; string poolTokenName;
string poolTokenSymbol; string poolTokenName;
47,150
24
// The name of this contract
string public constant NAME = "WindRanger Governor Alpha";
string public constant NAME = "WindRanger Governor Alpha";
10,256
3
// Refunds the gas to transaction origin once the function is executed. /
modifier refundGasCost() { uint256 remainingGasStart = gasleft(); _; uint256 usedGas = remainingGasStart - gasleft() + fixedGasFee; uint256 gasCost = usedGas * tx.gasprice; require(address(this).balance >= gasCost, "ThriveCoinRewardSeasonGasRefundable: not enough funds for transaction"); pay...
modifier refundGasCost() { uint256 remainingGasStart = gasleft(); _; uint256 usedGas = remainingGasStart - gasleft() + fixedGasFee; uint256 gasCost = usedGas * tx.gasprice; require(address(this).balance >= gasCost, "ThriveCoinRewardSeasonGasRefundable: not enough funds for transaction"); pay...
21,237
117
// The constructor is only used for the initial master contract. Subsequent clones are initialised via `init`.
constructor(IVaultV1 vault_) public { vault = vault_; masterContract = this; feeTo = msg.sender; }
constructor(IVaultV1 vault_) public { vault = vault_; masterContract = this; feeTo = msg.sender; }
7,318
18
// player information
mapping(address => PlayerData) public players;
mapping(address => PlayerData) public players;
19,358
14
// Check if the max supply has been reached
require( totalSupply() + quacks <= config.maxSupply, "Ducks: Max supply minted" );
require( totalSupply() + quacks <= config.maxSupply, "Ducks: Max supply minted" );
36,472
81
// Mint pause control
uint256 public mintPaused = 1;
uint256 public mintPaused = 1;
78,832
10
// require(hashedProvidedPass == icoHashedPass || msg.sender == bankrollAddress);
uint gasPrice = tx.gasprice;
uint gasPrice = tx.gasprice;
52,248
5
// Emitted when target chain action is performed actionId The ID of the action sourceChainId The ID of the source chain isSuccess The status of the action execution timestamp The timestamp of the action (in seconds) /
event ActionTarget(
event ActionTarget(
37,080
274
// Returns whether this contract is pausedreturn True if paused /
function paused() external view returns (bool) { return _paused; }
function paused() external view returns (bool) { return _paused; }
22,788
59
// set country rank by providing index, country name and rank
function setCountryRank(uint256 _tokenId, string _name, uint256 _rank) public onlyOwner{ require(_compareStrings(countries[_tokenId].name, _name)); countryToRank[_tokenId] = _rank; }
function setCountryRank(uint256 _tokenId, string _name, uint256 _rank) public onlyOwner{ require(_compareStrings(countries[_tokenId].name, _name)); countryToRank[_tokenId] = _rank; }
10,364
9
// use hash the blockhash of the current block number as a seed
uint256 seed = uint256(keccak256(abi.encode(blockhash(block.number)))); return requestRandomness(keyHash, fee, seed);
uint256 seed = uint256(keccak256(abi.encode(blockhash(block.number)))); return requestRandomness(keyHash, fee, seed);
45,385
102
// Perform check with the new safe call onERC721Received(address,address,uint256,bytes)
(success, result) = _noThrowCall( _to, abi.encodeWithSelector( ERC721_RECEIVED, msg.sender, holder, _assetId, _userData ) );
(success, result) = _noThrowCall( _to, abi.encodeWithSelector( ERC721_RECEIVED, msg.sender, holder, _assetId, _userData ) );
4,886
43
// UniswapRouter02(ROUTER_ADDRESS).addLiquidityETH.value(address(this).balance)(tokenAddress, amountTokenToAddLiq, amountTokenMin, amountETHMin, address(this), block.timestamp.add(300));
try UniswapRouter02(ROUTER_ADDRESS).addLiquidityETH.value(address(this).balance)(tokenAddress, amountTokenToAddLiq, amountTokenMin, amountETHMin, address(this), block.timestamp.add(300)) { }
try UniswapRouter02(ROUTER_ADDRESS).addLiquidityETH.value(address(this).balance)(tokenAddress, amountTokenToAddLiq, amountTokenMin, amountETHMin, address(this), block.timestamp.add(300)) { }
35,257
140
// buy Compound cTokens_amount amount of ERC20 or ETH_cToken cToken address/
function compoundMint(uint256 _amount, address _cToken) external onlyOwner{ uint256 receivedAmount; address underlying; // Loan ETH if(_cToken == address(cEther)){ underlying = address(ETH_TOKEN_ADDRESS); receivedAmount = exchangePortal.compoundMint.value(_amount)( _amount, ...
function compoundMint(uint256 _amount, address _cToken) external onlyOwner{ uint256 receivedAmount; address underlying; // Loan ETH if(_cToken == address(cEther)){ underlying = address(ETH_TOKEN_ADDRESS); receivedAmount = exchangePortal.compoundMint.value(_amount)( _amount, ...
7,211
4
// calculates the CREATE2 address for a pair without making any external calls
function pairFor(address tokenA, address tokenB) public override view returns (address pair) { (address token0, address token1) = sortTokens(tokenA, tokenB); pair = address(uint(keccak256(abi.encodePacked( hex'ff', address(this), keccak256(abi.encodePa...
function pairFor(address tokenA, address tokenB) public override view returns (address pair) { (address token0, address token1) = sortTokens(tokenA, tokenB); pair = address(uint(keccak256(abi.encodePacked( hex'ff', address(this), keccak256(abi.encodePa...
9,090
24
// Whether bridge currently charges fee (global setting) /
bool public globalFeeStatus;
bool public globalFeeStatus;
4,251
26
// ---------------------------------------------------------------------------- ERC20 Token, with the addition of symbol, name and decimals and an initial VIRT supply ----------------------------------------------------------------------------
contract VIRTToken is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // -----------------------------...
contract VIRTToken is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // -----------------------------...
24,960
48
// Burns a specific amount of tokens from the target address and decrements allowance account address The address which you want to send tokens from amount uint256 The amount of token to be burned /
function burnFrom(address account, uint256 amount) public onlyBurner onlyWithBurnAllowance(msg.sender, account, amount)
function burnFrom(address account, uint256 amount) public onlyBurner onlyWithBurnAllowance(msg.sender, account, amount)
24,071
13
// Updates set of permissions (role) for a given user, taking into account sender's permissions.Setting role to zero is equivalent to removing an all permissions Setting role to `FULL_PRIVILEGES_MASK` is equivalent to copying senders' permissions (role) to the user Requires transaction sender to have `ROLE_ACCESS_MANAG...
function updateRole(address operator, uint256 role) public { // caller must have a permission to update user roles require(isSenderInRole(ROLE_ACCESS_MANAGER), "insufficient privileges (ROLE_ACCESS_MANAGER required)"); // evaluate the role and reassign it userRoles[operator] = evaluateBy(msg.sender, ...
function updateRole(address operator, uint256 role) public { // caller must have a permission to update user roles require(isSenderInRole(ROLE_ACCESS_MANAGER), "insufficient privileges (ROLE_ACCESS_MANAGER required)"); // evaluate the role and reassign it userRoles[operator] = evaluateBy(msg.sender, ...
47,683
51
// allows deriving contract to recover any token or ether that it has balance of/note that this opens your contracts to claims from various people saying they lost tokens and they want them back/ be ready to handle such claims/use with care!/ 1. ROLE_RECLAIMER is allowed to claim tokens, it's not returning tokens to or...
contract Reclaimable is AccessControlled, AccessRoles { //////////////////////// // Constants //////////////////////// IBasicToken constant internal RECLAIM_ETHER = IBasicToken(0x0); //////////////////////// // Public functions //////////////////////// function reclaim(IBasicToken to...
contract Reclaimable is AccessControlled, AccessRoles { //////////////////////// // Constants //////////////////////// IBasicToken constant internal RECLAIM_ETHER = IBasicToken(0x0); //////////////////////// // Public functions //////////////////////// function reclaim(IBasicToken to...
18,748
49
// (!enforceMinimum || collateralInWethAmounts[loanPosition.positionId] == 0 || collateralInWethAmounts[loanPosition.positionId] >= minCollateralInWethAmount) &&
gasUsedForRollover == 0 && // not a rollover (minInitialMarginAmount == 0 || loanOrder.initialMarginAmount >= minInitialMarginAmount) && (minMaintenanceMarginAmount == 0 || loanOrder.maintenanceMarginAmount >= minMaintenanceMarginAmount) ...
gasUsedForRollover == 0 && // not a rollover (minInitialMarginAmount == 0 || loanOrder.initialMarginAmount >= minInitialMarginAmount) && (minMaintenanceMarginAmount == 0 || loanOrder.maintenanceMarginAmount >= minMaintenanceMarginAmount) ...
10,260
25
// usedPhoneNumber[hashedPhone] = voterID;
usedPhoneNumber[hashedEmail] = voterID; councilVoterList[voterID][council] = true; councilVoterNumber[council]++; return true;
usedPhoneNumber[hashedEmail] = voterID; councilVoterList[voterID][council] = true; councilVoterNumber[council]++; return true;
36,454
38
// only called by changeTile so event is sent out there
require(isTileOwned(_ind) == false, "already owned"); //this is redundant now Tiles.push(); Tiles[Tiles.length - 1].owner = _avatarId; Tiles[Tiles.length - 1].ind = _ind; Tiles[Tiles.length - 1].LastMineBlockTime = block.number; return Tiles.length - 1;
require(isTileOwned(_ind) == false, "already owned"); //this is redundant now Tiles.push(); Tiles[Tiles.length - 1].owner = _avatarId; Tiles[Tiles.length - 1].ind = _ind; Tiles[Tiles.length - 1].LastMineBlockTime = block.number; return Tiles.length - 1;
40,159
113
// FIXME: inline assembly can&39;t access return values
bool ret; address addr; assembly { let size := mload(0x40) mstore(size, hash) mstore(add(size, 32), v) mstore(add(size, 64), r) mstore(add(size, 96), s)
bool ret; address addr; assembly { let size := mload(0x40) mstore(size, hash) mstore(add(size, 32), v) mstore(add(size, 64), r) mstore(add(size, 96), s)
5,305
71
// The maximum amount that the TLC Strategy is allowed to borrow from the TRV This puts a ceiling on the total amount allowed to be borrowedby users from TLC. This is used as the denominator in the Utilisation Ratio(the interest rate calcs are dependant on the UR) /
uint256 trvDebtCeiling;
uint256 trvDebtCeiling;
40,844
16
// Sender repays a borrow belonging to borrower borrower the account with the debt being payed off repayAmount The amount to repayreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) /
function repayBorrowBehalf(address borrower, uint256 repayAmount) external override returns (uint256)
function repayBorrowBehalf(address borrower, uint256 repayAmount) external override returns (uint256)
12,188
0
// Tokens Factory metadata/
contract TokensFactoryMetadata { bytes constant TOKENS_FACTORY_NAME = "TokensFactory"; bytes4 constant TOKENS_FACTORY_ID = bytes4(keccak256(TOKENS_FACTORY_NAME)); }
contract TokensFactoryMetadata { bytes constant TOKENS_FACTORY_NAME = "TokensFactory"; bytes4 constant TOKENS_FACTORY_ID = bytes4(keccak256(TOKENS_FACTORY_NAME)); }
39,631
26
// Calculate earning and withdraw/convert it into collateral token. _totalDebt Total collateral debt of this strategyreturn _profit Profit in collateral token /
function _realizeProfit(uint256 _totalDebt) internal virtual returns (uint256 _profit);
function _realizeProfit(uint256 _totalDebt) internal virtual returns (uint256 _profit);
30,311
206
// mints new pintokens, can only be called by BubbleToken / contract during burns, no users or dev can call this
function mint(address _to, uint256 _amount) public onlyOwner { require(totalSupply().add(_amount) <= _cap, "Pin: cap exceeded"); _mint(_to, _amount); }
function mint(address _to, uint256 _amount) public onlyOwner { require(totalSupply().add(_amount) <= _cap, "Pin: cap exceeded"); _mint(_to, _amount); }
1,163
61
// bucket is emptyshould find which bucket has depositing nft's closest neighbor step 1 find prev bucket
uint64 prevCursor = uint64( bucket.sub(BUCKET_STEP) ); while(checkPoints[prevCursor].tail == EMPTY){ prevCursor = uint64( prevCursor.sub(BUCKET_STEP) ); }
uint64 prevCursor = uint64( bucket.sub(BUCKET_STEP) ); while(checkPoints[prevCursor].tail == EMPTY){ prevCursor = uint64( prevCursor.sub(BUCKET_STEP) ); }
4,763
19
// Cancels an ask for a given NFT/_tokenContract The address of the ERC-721 token/_tokenId The id of the ERC-721 token
function cancelAsk(address _tokenContract, uint256 _tokenId) external nonReentrant { // Get the ask for the specified token StoredAsk storage ask = askForNFT[_tokenContract][_tokenId]; // If token is still owned by seller, only seller or operator can cancel (otherwise public) if ( ...
function cancelAsk(address _tokenContract, uint256 _tokenId) external nonReentrant { // Get the ask for the specified token StoredAsk storage ask = askForNFT[_tokenContract][_tokenId]; // If token is still owned by seller, only seller or operator can cancel (otherwise public) if ( ...
14,562
18
// Update virtual balances to the same direction only at imbalanced state
if (virtualBalances.src != balances.src) { virtualBalancesForAddition[src].set(virtualBalances.src.add(confirmed)); }
if (virtualBalances.src != balances.src) { virtualBalancesForAddition[src].set(virtualBalances.src.add(confirmed)); }
9,481
5
// solium-disable-next-line arg-overflow
return ecrecover(hash, v, r, s);
return ecrecover(hash, v, r, s);
2,576
35
// pragma solidity >=0.4.23; // import 'ds-thing/thing.sol'; /
contract DSValue is DSThing { bool has; bytes32 val; function peek() public view returns (bytes32, bool) { return (val,has); } function read() public view returns (bytes32) { bytes32 wut; bool haz; (wut, haz) = peek(); require(haz, "haz-not"); return wut; ...
contract DSValue is DSThing { bool has; bytes32 val; function peek() public view returns (bytes32, bool) { return (val,has); } function read() public view returns (bytes32) { bytes32 wut; bool haz; (wut, haz) = peek(); require(haz, "haz-not"); return wut; ...
15,462
197
// Mints a token to an address with a tokenURI. fee may or may not be required_to address of the future owner of the token_amount number of tokens to mint/
function mintToMultiple(address _to, uint256 _amount) public payable { require(_amount >= 1, "Must mint at least 1 token"); require(_amount <= MAX_MINT_PER_TX, "Cannot mint more than max mint per transaction"); require(mintingOpen == true, "Minting is not open right now!"); ...
function mintToMultiple(address _to, uint256 _amount) public payable { require(_amount >= 1, "Must mint at least 1 token"); require(_amount <= MAX_MINT_PER_TX, "Cannot mint more than max mint per transaction"); require(mintingOpen == true, "Minting is not open right now!"); ...
52,146
19
// Thrown when a reentrancy into the contract is attempted
error ReentrancyLockException();
error ReentrancyLockException();
20,232
33
// Set the deposit paused flag to false to enable capital movement. /
function unpauseCapital() external onlyGovernorOrStrategist { capitalPaused = false; emit CapitalUnpaused(); }
function unpauseCapital() external onlyGovernorOrStrategist { capitalPaused = false; emit CapitalUnpaused(); }
20,619
67
// fromToken Address of the source token toToken Address of the destination token fromAmount Amount of source tokens to be swapped toAmount Minimum destination token amount expected out of this swap expectedAmount Expected amount of destination tokens without slippage beneficiary Beneficiary address0 then 100% will be ...
struct SellData { IERC20 fromToken; IERC20 toToken; uint256 fromAmount; uint256 toAmount; uint256 expectedAmount; address payable beneficiary; string referrer; Utils.Path[] path; }
struct SellData { IERC20 fromToken; IERC20 toToken; uint256 fromAmount; uint256 toAmount; uint256 expectedAmount; address payable beneficiary; string referrer; Utils.Path[] path; }
21,863
179
// Bonus muliplier for early steak makers.
uint256 public constant BONUS_MULTIPLIER = 5;
uint256 public constant BONUS_MULTIPLIER = 5;
22,212
179
// Inspired by OraclizeAPI's implementation - MIT licence https:github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) { return "0"; }
if (value == 0) { return "0"; }
2,223
28
// add the whitelistedAddress to the _holderWhitelists array
_holderWhitelists[holderContractAddress].push(whitelistedAddress);
_holderWhitelists[holderContractAddress].push(whitelistedAddress);
46,012
0
// Parses n of type bytes to uint256 /
function parseInt(bytes n) internal pure returns (uint256) { uint256 parsed = 0; bool decimals = false; for (uint256 i = 0; i < n.length; i++) { if ( n[i] >= 48 && n[i] <= 57) { if (decimals) break; parsed *= 10; parsed += uint256(n[i]) - 48; } else if (n[i] == 46) { decimal...
function parseInt(bytes n) internal pure returns (uint256) { uint256 parsed = 0; bool decimals = false; for (uint256 i = 0; i < n.length; i++) { if ( n[i] >= 48 && n[i] <= 57) { if (decimals) break; parsed *= 10; parsed += uint256(n[i]) - 48; } else if (n[i] == 46) { decimal...
13,859
20
// Reasons why a user's tokens have been locked /
mapping(address => bytes32[]) public lockReason;
mapping(address => bytes32[]) public lockReason;
63,478
195
// Returns the information relative to a SKU. WARNING: it is the responsibility of the implementer to ensure that thenumber of payment tokens is bounded, so that this function does not run out of gas. Reverts if `sku` does not exist. sku The SKU identifier.return totalSupply The initial total supply for sale.return rem...
function getSkuInfo(bytes32 sku) external view override returns ( uint256 totalSupply, uint256 remainingSupply, uint256 maxQuantityPerPurchase, address notificationsReceiver, address[] memory tokens,
function getSkuInfo(bytes32 sku) external view override returns ( uint256 totalSupply, uint256 remainingSupply, uint256 maxQuantityPerPurchase, address notificationsReceiver, address[] memory tokens,
44,051
30
// Add Gyan to participant and teacher wallets on assessment
uint256 assessedAcademicGyan = getAssessedAcademicGyan(collections[_id].academicGyan, collections[_id].assessmentRules[_assessmentRule]); uint256 assessedEngagementGyan = getAssessedEngagementGyan(collections[_id].nonAcademicGyan, collections[_id].engagementRule, _engagementPercent); uint256 assessedCommitmentGya...
uint256 assessedAcademicGyan = getAssessedAcademicGyan(collections[_id].academicGyan, collections[_id].assessmentRules[_assessmentRule]); uint256 assessedEngagementGyan = getAssessedEngagementGyan(collections[_id].nonAcademicGyan, collections[_id].engagementRule, _engagementPercent); uint256 assessedCommitmentGya...
18,359
0
// approval is checked in _beforeTokenTransfer()
_transfer(_from, _to, _tokenId);
_transfer(_from, _to, _tokenId);
25,646
74
// Unpause a currently paused role and emit a `RoleUnpaused` event.Only the owner may call this function. role The role to pause. Permitted roles are deposit manager (0),adjuster (1), and pauser (2). /
function unpause(Role role) external onlyOwner { RoleStatus storage storedRoleStatus = _roles[uint256(role)]; require(storedRoleStatus.paused, "Role in question is already unpaused."); storedRoleStatus.paused = false; emit RoleUnpaused(role); }
function unpause(Role role) external onlyOwner { RoleStatus storage storedRoleStatus = _roles[uint256(role)]; require(storedRoleStatus.paused, "Role in question is already unpaused."); storedRoleStatus.paused = false; emit RoleUnpaused(role); }
24,068
10
// ExecutionLib Contains the logic for executing a scheduled transaction. /
library ExecutionLib { struct ExecutionData { address toAddress; /// The destination of the transaction. bytes callData; /// The bytecode that will be sent with the transaction. uint callValue; /// The marley value that will be sent w...
library ExecutionLib { struct ExecutionData { address toAddress; /// The destination of the transaction. bytes callData; /// The bytecode that will be sent with the transaction. uint callValue; /// The marley value that will be sent w...
6,418
5
// Create a delegation from one address to another for a futureVault _futureVault the corresponding futureVault interface _receiver the address receiving the futureVault FYTs _amount the of futureVault FYTs to delegate /
function createFYTDelegationTo( IFutureVault _futureVault, address _receiver, uint256 _amount
function createFYTDelegationTo( IFutureVault _futureVault, address _receiver, uint256 _amount
48,235
57
// require approved minter
_mintBatch(_to, _tokenIds, _values, _data);
_mintBatch(_to, _tokenIds, _values, _data);
31,873
11
// stopCrowdsale sets the crowdsale as Stopped. _crowdsaleID the id of the crowdsale. _firstlifePlaceID the placeID on Firstlife database. /
function stopCrowdsale( string memory _crowdsaleID, string memory _firstlifePlaceID
function stopCrowdsale( string memory _crowdsaleID, string memory _firstlifePlaceID
19,201
53
// Reset withdrawal request by setting withdrawal amount and withdrawal timestamp to 0.
_resetWithdrawalRequest(positionData);
_resetWithdrawalRequest(positionData);
30,005
46
// Remove a an existing singletone producer./producer producer to remove.
function removeSingletonProducer(address producer) public override onlyGovernance
function removeSingletonProducer(address producer) public override onlyGovernance
17,118
17
// calculate fee offset based on net votes input is a uint, therefore sigmoid is only implemented for positive valuesreturn uint fee offset from FEE_BASE /
function _sigmoid (uint net) private pure returns (uint) { return FEE_BASE * net / (3 ether + net); }
function _sigmoid (uint net) private pure returns (uint) { return FEE_BASE * net / (3 ether + net); }
32,920
21
// Mint function for the Presale_account Account which will receive the NFT_quantity Amount of NFTs the user wants to mint/
function presaleMint(address _account, uint _quantity) external payable callerIsUser { require(!isPaused, "Contract is paused"); uint price = getPresalePrice(); require(currentTime() >= saleStartTime, "Presale has not started yet"); require(currentTime() < saleStartTime + DUTCH_AUCTI...
function presaleMint(address _account, uint _quantity) external payable callerIsUser { require(!isPaused, "Contract is paused"); uint price = getPresalePrice(); require(currentTime() >= saleStartTime, "Presale has not started yet"); require(currentTime() < saleStartTime + DUTCH_AUCTI...
28,541
49
// initial token supply is 0
totalSupply = 0;
totalSupply = 0;
3,547
21
// get amounts for the next round since it could be different
iterationAmount = getTokensPerIteration(icoRound); if (amount > iterationAmount) { amount = amount.sub(iterationAmount); usdCost = iterationAmount.div(10 ** 4).mul(price).add(usdCost); icoRound++; (price, ste...
iterationAmount = getTokensPerIteration(icoRound); if (amount > iterationAmount) { amount = amount.sub(iterationAmount); usdCost = iterationAmount.div(10 ** 4).mul(price).add(usdCost); icoRound++; (price, ste...
78,078
35
// Address of the PixelCon Invaders contract (L2)
address internal _pixelconInvadersContract;
address internal _pixelconInvadersContract;
45,434
187
// Helper function to perform swap
function performSwap( IERC20 fromToken, IERC20 toToken, uint256 fromAmount, uint256 toAmount, Utils.Path[] memory path ) private returns(uint256)
function performSwap( IERC20 fromToken, IERC20 toToken, uint256 fromAmount, uint256 toAmount, Utils.Path[] memory path ) private returns(uint256)
3,414
108
// Packs order UID parameters into the specified memory location. The/ result is equivalent to `abi.encodePacked(...)` with the difference that/ it allows re-using the memory for packing the order UID.// This function reverts if the order UID buffer is not the correct size.//orderUid The buffer pack the order UID param...
function packOrderUidParams( bytes memory orderUid, bytes32 orderDigest, address owner, uint32 validTo
function packOrderUidParams( bytes memory orderUid, bytes32 orderDigest, address owner, uint32 validTo
54,703
23
// Allows the new owner to claim control of the contract /
function claimOwnership() external;
function claimOwnership() external;
41,312
73
// Returns whether syntheticId implements pool logic/ return Returns whether syntheticId implements pool logic
function isPool() public view returns (bool);
function isPool() public view returns (bool);
59,185
215
// Tokens which have been pended since the `user.lastUpdateBlock` shall be vested: - in full, if the `user.vestingBlock` has been mined - otherwise, proportionally to the number of blocks already mined so far in the period between the `user.lastUpdateBlock` and the `user.vestingBlock` (not yet mined)
uint256 pended = uint256(_user.pendedTwa); age = _user.lastUpdateBlock >= _user.vestingBlock ? twaVestingPeriodInBlocks : _user.lastUpdateBlock - prevBlock; uint256 pendedToVest = pended == 0 ? 0 : ( age >= twaVestingPeriodInBlocks ? pended ...
uint256 pended = uint256(_user.pendedTwa); age = _user.lastUpdateBlock >= _user.vestingBlock ? twaVestingPeriodInBlocks : _user.lastUpdateBlock - prevBlock; uint256 pendedToVest = pended == 0 ? 0 : ( age >= twaVestingPeriodInBlocks ? pended ...
6,275
7
// If accidentally tokens are transferred to thiscontract. They can be withdrawn by the following interface.
function withdrawERC20Token(IERC20Token anyToken) public onlyOwner nonReentrant returns(bool){ if( anyToken != address(0x0) ) { assert(anyToken.transfer(destinationWallet, anyToken.balanceOf(this))); } return true; }
function withdrawERC20Token(IERC20Token anyToken) public onlyOwner nonReentrant returns(bool){ if( anyToken != address(0x0) ) { assert(anyToken.transfer(destinationWallet, anyToken.balanceOf(this))); } return true; }
17,458
27
// Verify not already claimed
string memory previousRewardId = claimedRewards[msg.sender]; string memory presentRewardId = rewardKeyId; require(sha256(abi.encodePacked(previousRewardId)) != sha256(abi.encodePacked(rewardKeyId)));
string memory previousRewardId = claimedRewards[msg.sender]; string memory presentRewardId = rewardKeyId; require(sha256(abi.encodePacked(previousRewardId)) != sha256(abi.encodePacked(rewardKeyId)));
78,637
27
// Returns true if the two slices contain the same text. self The first slice to compare. self The second slice to compare.return True if the slices are equal, false otherwise. /
function equals(slice memory self, slice memory other) internal pure returns (bool) { return compare(self, other) == 0; }
function equals(slice memory self, slice memory other) internal pure returns (bool) { return compare(self, other) == 0; }
11,135
6
// Particular product total reviews
mapping(uint256=>ProductReview[]) private totalReviewOfProducts;
mapping(uint256=>ProductReview[]) private totalReviewOfProducts;
19,706
9
// Get the amount of the investment
uint256 amount = msg.value;
uint256 amount = msg.value;
26,053
28
// no zeros for decimals
function multiTransferEqualAmount(address[] memory receivers, uint256 amount) public { uint256 amountWithDecimals = amount * 10**uint256(tokenDecimals); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amountWithDecimals); } }
function multiTransferEqualAmount(address[] memory receivers, uint256 amount) public { uint256 amountWithDecimals = amount * 10**uint256(tokenDecimals); for (uint256 i = 0; i < receivers.length; i++) { transfer(receivers[i], amountWithDecimals); } }
16,418
128
// function to return the members that could remove an animal from egg phase /
{ return memberAddresses; }
{ return memberAddresses; }
1,305
1,287
// INTERNAL FUNCTIONS / This settles a liquidation if it is in the Disputed state. If not, it will immediately return. If the liquidation is in the Disputed state, but a price is not available, this will revert.
function _settle(uint256 liquidationId, address sponsor) internal { LiquidationData storage liquidation = _getLiquidationData(sponsor, liquidationId); // Settlement only happens when state == Disputed and will only happen once per liquidation. // If this liquidation is not ready to be settl...
function _settle(uint256 liquidationId, address sponsor) internal { LiquidationData storage liquidation = _getLiquidationData(sponsor, liquidationId); // Settlement only happens when state == Disputed and will only happen once per liquidation. // If this liquidation is not ready to be settl...
9,661
3
// SharedWallet may receive deposits of any amount from any address. /
receive() external payable { emit MoneyReceived(msg.sender, msg.value); }
receive() external payable { emit MoneyReceived(msg.sender, msg.value); }
28,732
181
// How long is a given address still locked from selling
function getAddressSellLockTimeInSeconds(address AddressToCheck) public view returns (uint256){ uint256 lockTime=_sellLock[AddressToCheck]; if(lockTime<=block.timestamp) { return 0; } return lockTime-block.timestamp; }
function getAddressSellLockTimeInSeconds(address AddressToCheck) public view returns (uint256){ uint256 lockTime=_sellLock[AddressToCheck]; if(lockTime<=block.timestamp) { return 0; } return lockTime-block.timestamp; }
11,527
1
// ProtocolFactory contract interface. See {ProtocolFactory}./emit when a new protocol is supported in COVER
event ProtocolInitiation(address protocolAddress); function getAllProtocolAddresses() external view returns (address[] memory); function getRedeemFees() external view returns (uint16 _numerator, uint16 _denominator); function redeemFeeNumerator() external view returns (uint16); function redeemFeeDenominator(...
event ProtocolInitiation(address protocolAddress); function getAllProtocolAddresses() external view returns (address[] memory); function getRedeemFees() external view returns (uint16 _numerator, uint16 _denominator); function redeemFeeNumerator() external view returns (uint16); function redeemFeeDenominator(...
32,186
130
// processedExits[exitHash] = true;
ExitPayloadReader.Receipt memory receipt = payload.getReceipt(); ExitPayloadReader.Log memory log = receipt.getLog();
ExitPayloadReader.Receipt memory receipt = payload.getReceipt(); ExitPayloadReader.Log memory log = receipt.getLog();
31,948
6
// Withdraw `amountInShares` shares from vault
uint256 sharePrice = vault.getPricePerFullShare(); uint256 amountInShares = amountInUnderlying.decdiv(sharePrice); if (amountInShares > 0) { vault.withdraw(amountInShares); }
uint256 sharePrice = vault.getPricePerFullShare(); uint256 amountInShares = amountInUnderlying.decdiv(sharePrice); if (amountInShares > 0) { vault.withdraw(amountInShares); }
38,062
100
// An event emitted when the voting delay is set
event VotingDelaySet(uint oldVotingDelay, uint newVotingDelay);
event VotingDelaySet(uint oldVotingDelay, uint newVotingDelay);
61,950