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
23
// Update game information
games[gameIndex].gameTotalBacklog -= valueAfterTax; games[gameIndex].gameTotalPaidOut += valueAfterTax;
games[gameIndex].gameTotalBacklog -= valueAfterTax; games[gameIndex].gameTotalPaidOut += valueAfterTax;
56,809
3
// Emitted when the implementation is finalized.
event FinalizedImplementation(address indexed implementation); using Addresses for address; string public constant PROXY_VERSION = "3.0.1";
event FinalizedImplementation(address indexed implementation); using Addresses for address; string public constant PROXY_VERSION = "3.0.1";
47,103
527
// update collateral reserve
reserves[_collateralReserve].updateCumulativeIndexes();
reserves[_collateralReserve].updateCumulativeIndexes();
35,112
355
// structure RLP data as <offset> <length> <bytes>
mstore(ptr, 0x20) mstore(add(ptr,32), size) calldatacopy(add(ptr,64), 0, size) return(ptr, add(size,64))
mstore(ptr, 0x20) mstore(add(ptr,32), size) calldatacopy(add(ptr,64), 0, size) return(ptr, add(size,64))
17,875
174
// Sets the LINK token address _link The address of the LINK token contract /
function setChainlinkToken(address _link) internal { link = LinkTokenInterface(_link); }
function setChainlinkToken(address _link) internal { link = LinkTokenInterface(_link); }
3,069
19
// Events
event Deposited(address indexed layer2, address depositor, uint256 amount); event WithdrawalRequested(address indexed layer2, address depositor, uint256 amount); event WithdrawalProcessed(address indexed layer2, address depositor, uint256 amount);
event Deposited(address indexed layer2, address depositor, uint256 amount); event WithdrawalRequested(address indexed layer2, address depositor, uint256 amount); event WithdrawalProcessed(address indexed layer2, address depositor, uint256 amount);
33,625
5
// COMPLETAR Si pedimos un flash loan, ¿qué hacemos con los ETH que llegan a esta función?
pool.deposit{value: msg.value}();
pool.deposit{value: msg.value}();
8,766
69
// Function which gets the tokens amount for current and next level. If we did not overflow the current level cap, the next level tokens will be zero. return _currentLevelTokensAmount and _nextLevelTokensAmount Returns the calculated tokens for the current and next level It is called by calculateAndCreateTokens functio...
function calculateAndCreateTokens(uint weiAmount) internal view returns (uint _currentLevelTokensAmount, uint _nextLevelTokensAmount) { if(block.timestamp < threeHotHoursEnd && totalSoldTokens < threeHotHoursTokensCap) { (_currentLevelTokensAmount, _nextLevelTokensAmount) = tokensCalculator(weiAmount, threeHo...
function calculateAndCreateTokens(uint weiAmount) internal view returns (uint _currentLevelTokensAmount, uint _nextLevelTokensAmount) { if(block.timestamp < threeHotHoursEnd && totalSoldTokens < threeHotHoursTokensCap) { (_currentLevelTokensAmount, _nextLevelTokensAmount) = tokensCalculator(weiAmount, threeHo...
5,583
166
// approve contract
_approve(address(this), address(pancakeRouter), 2 ** 256 - 1);
_approve(address(this), address(pancakeRouter), 2 ** 256 - 1);
1,054
94
// modified from OpenZeppelin ERC20
function _rawTransfer( address sender, address recipient, uint256 amount
function _rawTransfer( address sender, address recipient, uint256 amount
69,556
2
// Vesting duration and cliff
uint256 public duration; uint256 public cliff;
uint256 public duration; uint256 public cliff;
10,165
130
// NEXGEN dApp - The World's First Most Sustainable Decentralized Application //
contract Nexgen { /*================================= = MODIFIERS = =================================*/ // only people with tokens modifier onlybelievers () { require(myTokens() > 0); _; } // only people with profits modifier onlyhodler() {...
contract Nexgen { /*================================= = MODIFIERS = =================================*/ // only people with tokens modifier onlybelievers () { require(myTokens() > 0); _; } // only people with profits modifier onlyhodler() {...
7,961
119
// Returns the number of tokens minted by `owner`. /
function _numberMinted(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberMinted); }
function _numberMinted(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberMinted); }
1,419
138
// if round is not active and end round needs to be ran
} else if (_now > round_[_rID].end && round_[_rID].ended == false) {
} else if (_now > round_[_rID].end && round_[_rID].ended == false) {
7,668
9
// This is for me, all of it, it funds my habits
function lootDonationBox() public
function lootDonationBox() public
17,416
24
// Exactly like in real world, bees become hungry for honey so,after EPOCHS_BEFORE_INACTIVE_BEE epochs a bee needsto be fed to become active again and start collecting HoneyCorresponds with Revive Bees /
function activateBees(uint16[] calldata _beesIds) external nonReentrant { require(paused.pauseBee == 0, "Paused"); uint256 amountOfHoney = 0; for (uint16 i = 0; i < _beesIds.length; i++) { uint16 _beeId = _beesIds[i]; Bee storage bee = idsAndBees[_beeId]; ...
function activateBees(uint16[] calldata _beesIds) external nonReentrant { require(paused.pauseBee == 0, "Paused"); uint256 amountOfHoney = 0; for (uint16 i = 0; i < _beesIds.length; i++) { uint16 _beeId = _beesIds[i]; Bee storage bee = idsAndBees[_beeId]; ...
5,676
49
// Handle rounding errors by returning the full amount when the requested amount is greater
if (amount > lockedCollateral.quote) { amount = lockedCollateral.quote; }
if (amount > lockedCollateral.quote) { amount = lockedCollateral.quote; }
9,674
31
// Returns the contenthash associated with an ENS node. node The ENS node to query.return The associated contenthash. /
function contenthash(bytes32 node) external view returns (bytes memory) { return hashes[node]; }
function contenthash(bytes32 node) external view returns (bytes memory) { return hashes[node]; }
11,930
29
// if function does not exist then do nothing and return
require(_facetAddress == address(0), "LibDiamondCut: Remove facet address must be address(0)"); uint256 len = _functionSelectors.length; for (uint256 selectorIndex; selectorIndex < len; ) { bytes4 selector = _functionSelectors[selectorIndex]; require(selector != proposeSelector && selector != cu...
require(_facetAddress == address(0), "LibDiamondCut: Remove facet address must be address(0)"); uint256 len = _functionSelectors.length; for (uint256 selectorIndex; selectorIndex < len; ) { bytes4 selector = _functionSelectors[selectorIndex]; require(selector != proposeSelector && selector != cu...
30,086
8
// Check if passed amount is not zero Check for the pass of a non zero variable. amountnumber checked to be a non zero. /
modifier nonzeroAmount(uint256 amount) { require(amount > 0, "STRFStaker: Amount cannot be 0"); _; }
modifier nonzeroAmount(uint256 amount) { require(amount > 0, "STRFStaker: Amount cannot be 0"); _; }
2,707
60
// Gets the index of the account Returns -1 for missing accountsaddr The address of the account to get the index for return The index of the given account address /
function accountIndexOf(address addr) external view
function accountIndexOf(address addr) external view
30,878
5
// Draw collateral to repay the flash loan
drawCollateral(managerAddr, _saverData.safeId, _saverData.joinAddr, _saverData.flAmount, false); logger.Log(address(this), msg.sender, "RAIFlashBoost", abi.encode(_saverData.safeId, user, _exchangeData.srcAmount, swapedAmount));
drawCollateral(managerAddr, _saverData.safeId, _saverData.joinAddr, _saverData.flAmount, false); logger.Log(address(this), msg.sender, "RAIFlashBoost", abi.encode(_saverData.safeId, user, _exchangeData.srcAmount, swapedAmount));
16,176
5
// Get the underlying price of a jToken asset jToken The jToken to get the underlying price ofreturn The underlying asset price mantissa (scaled by 1e18). Zero means the price is unavailable. /
function getUnderlyingPrice(address jToken) external view returns (uint256);
function getUnderlyingPrice(address jToken) external view returns (uint256);
25,024
55
// Gets COIN balance of the handler in the safeEngine
uint coin = SAFEEngineLike(safeEngine).coinBalance(safeHandler);
uint coin = SAFEEngineLike(safeEngine).coinBalance(safeHandler);
32,280
74
// Modify the deviation from scale
function changeDeviationFromScale(uint256 num) public onlyOwner { _deviationFromScale = num; }
function changeDeviationFromScale(uint256 num) public onlyOwner { _deviationFromScale = num; }
10,694
77
// Query if a contract implements an interface _interfaceIDThe interface identifier, as specified in ERC-165return `true` if the contract implements `_interfaceID` and /
function supportsInterface(bytes4 _interfaceID) external view returns (bool)
function supportsInterface(bytes4 _interfaceID) external view returns (bool)
28,745
140
// transfer remaining tokens to the account
if (balanceOf(account, pool) > 0) { _rescuePoints(account, pool); }
if (balanceOf(account, pool) > 0) { _rescuePoints(account, pool); }
66,191
125
// remaining gu per total ethIn in the phrase
uint256 _gpe = (_remainGu.mul(1e18)) / phrase_[_phID].eth; phrase_[_phID].mask = _gpe.add(phrase_[_phID].mask); // should only added once
uint256 _gpe = (_remainGu.mul(1e18)) / phrase_[_phID].eth; phrase_[_phID].mask = _gpe.add(phrase_[_phID].mask); // should only added once
8,563
154
// Checks to see if request was made and if time elapsed
if(isAttached > 1 && block.timestamp - isAttached > detachmentTime) { isAttached = 0; } else if(isAttached > 1) {
if(isAttached > 1 && block.timestamp - isAttached > detachmentTime) { isAttached = 0; } else if(isAttached > 1) {
50,875
21
// Changes All Presale Roots /
function __ChangePresaleRootsAll ( uint SaleIndex, bytes32 RootEligibilityFullSet, bytes32 RootAmountsFullSet, bytes32 RootEligibilityCitizen, bytes32 RootAmountsCitizen
function __ChangePresaleRootsAll ( uint SaleIndex, bytes32 RootEligibilityFullSet, bytes32 RootAmountsFullSet, bytes32 RootEligibilityCitizen, bytes32 RootAmountsCitizen
36,268
22
// mint DSD
mintToAccount(msg.sender, amount); addRedeemedThisExpansion(msg.sender, amount); incrementTotalCDSDRedeemed(amount); emit CDSDRedeemed(msg.sender, amount);
mintToAccount(msg.sender, amount); addRedeemedThisExpansion(msg.sender, amount); incrementTotalCDSDRedeemed(amount); emit CDSDRedeemed(msg.sender, amount);
168
20
// footer functions
function transferAnyERC20Token(address tokenAddress, uint256 tokens) public returns (bool success) { require(isOwner()); return IERC20(tokenAddress).transfer(owner(), tokens); }
function transferAnyERC20Token(address tokenAddress, uint256 tokens) public returns (bool success) { require(isOwner()); return IERC20(tokenAddress).transfer(owner(), tokens); }
7,723
291
// Changes extra lock period for a cover, post its expiry. /
function _setLockTokenTimeAfterCoverExp(uint time) internal { lockTokenTimeAfterCoverExp = time; }
function _setLockTokenTimeAfterCoverExp(uint time) internal { lockTokenTimeAfterCoverExp = time; }
28,555
10
// For the quarter in which the stake was locked, we reduce the share amount to reflect the part of the quarter that has already passed. Note that this only happens when quarterIdx == currentQuarter.
if (quarterIdx == stake.lockQuarter) { newShare = newShare * (nextQuarterStart - stake.lockTime) / QUARTER_LENGTH; }
if (quarterIdx == stake.lockQuarter) { newShare = newShare * (nextQuarterStart - stake.lockTime) / QUARTER_LENGTH; }
2,705
185
// getter for recipients & their shares/ return recipients the recipients/ return shares their shares
function getSplit() public view returns (address[] memory recipients, uint256[] memory shares)
function getSplit() public view returns (address[] memory recipients, uint256[] memory shares)
26,823
11
// Add liquidity to pool position/manager must be approved for token A/B transfer/poolPosition PP to add liquidity to/recipient address where PoolPosition erc20 LP tokens are sent/desiredLpTokenAmount number of erc20 PP LP tokens to mint/minLpTokenAmount miniumum number of erc20 PP LP tokens to mint/addLimits struct of...
function addLiquidityToPoolPosition( IPoolPositionSlim poolPosition, address recipient, uint256 desiredLpTokenAmount, uint256 minLpTokenAmount, AddLimits calldata addLimits ) external payable returns (uint256 mintedPoolPositionTokenAmount, uint256 tokenAAmount, uint256 to...
function addLiquidityToPoolPosition( IPoolPositionSlim poolPosition, address recipient, uint256 desiredLpTokenAmount, uint256 minLpTokenAmount, AddLimits calldata addLimits ) external payable returns (uint256 mintedPoolPositionTokenAmount, uint256 tokenAAmount, uint256 to...
6,972
12
// Add multiple itemsAll for same priceThis saves sending 10 tickets to create 10 items.
function AddMultipleItems(uint256 price, uint8 howmuch) public { require(msg.sender == owner); require(price != 0); require(howmuch != 255); // this is to prevent an infinite for loop uint8 i=0; for (i; i<howmuch; i++){ AddItem(price); } }
function AddMultipleItems(uint256 price, uint8 howmuch) public { require(msg.sender == owner); require(price != 0); require(howmuch != 255); // this is to prevent an infinite for loop uint8 i=0; for (i; i<howmuch; i++){ AddItem(price); } }
23,149
54
// Mapping from Nifty type to IPFS hash of canonical artifcat file.
mapping(uint256 => string) private _niftyTypeIPFSHashes;
mapping(uint256 => string) private _niftyTypeIPFSHashes;
15,962
131
// The contract which interfaces with the exchange
OptionsExchange public optionsExchange; address public oracleAddress; event OptionsContractCreated(address addr); event AssetWhitelisted(address indexed asset);
OptionsExchange public optionsExchange; address public oracleAddress; event OptionsContractCreated(address addr); event AssetWhitelisted(address indexed asset);
51,269
18
// chainId Chain's id/maxLength OneFork max length
function initialize( mapping(bytes32 => Info) storage self, uint256 chainId, uint256 maxLength
function initialize( mapping(bytes32 => Info) storage self, uint256 chainId, uint256 maxLength
47,959
99
// third term
work_point = proof.T3; work_point.validateG1Point(); assembly { scalar_multiplier := mulmod(scalar_multiplier, scalar_multiplier, p) mstore(add(accumulator_ptr, 0x40), mload(work_point)) mstore(add(accumulator_ptr, 0x60), mload(add(work_point, 0x20))) ...
work_point = proof.T3; work_point.validateG1Point(); assembly { scalar_multiplier := mulmod(scalar_multiplier, scalar_multiplier, p) mstore(add(accumulator_ptr, 0x40), mload(work_point)) mstore(add(accumulator_ptr, 0x60), mload(add(work_point, 0x20))) ...
59,049
0
// IFantomMintCore defines the interface of the Fantom fMint core contract.
interface IFantomMintBalanceGuard { // rewardCanClaim checks if the account can claim accumulated rewards. function rewardCanClaim(address _account) external view returns (bool); // rewardIsEligible checks if the account is eligible to receive any reward. function rewardIsEligible(address _account) ext...
interface IFantomMintBalanceGuard { // rewardCanClaim checks if the account can claim accumulated rewards. function rewardCanClaim(address _account) external view returns (bool); // rewardIsEligible checks if the account is eligible to receive any reward. function rewardIsEligible(address _account) ext...
34,241
363
// Admin Functions // Sets a new price oracle for the comptroller Admin function to set a new price oraclereturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) /
function _setPriceOracle(PriceOracle newOracle) public returns (uint256) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK); } // Track the old oracle for the comptroller PriceOracle old...
function _setPriceOracle(PriceOracle newOracle) public returns (uint256) { // Check caller is admin if (msg.sender != admin) { return fail(Error.UNAUTHORIZED, FailureInfo.SET_PRICE_ORACLE_OWNER_CHECK); } // Track the old oracle for the comptroller PriceOracle old...
71,951
549
// fee related
uint256[] public feeLevel; // fixed length = 9 (unit without 10^18); [50,200,500,1000,2000,3500,6000,9000,11000] uint256[] public discountTable; // fixed length = 9; [9,19,28,40,50,60,70,80,90] uint256 public vaultFee; // divided by 10000 constructor( IMintableERC20 _token, IMintableERC20 _xtoken, ...
uint256[] public feeLevel; // fixed length = 9 (unit without 10^18); [50,200,500,1000,2000,3500,6000,9000,11000] uint256[] public discountTable; // fixed length = 9; [9,19,28,40,50,60,70,80,90] uint256 public vaultFee; // divided by 10000 constructor( IMintableERC20 _token, IMintableERC20 _xtoken, ...
59,426
45
// for managing the Raum Public and Private Sale /
contract RaumSale { using SafeMath for uint256; struct vault { uint256 privateSalebalance; uint256 privateSaleWithdrawDate; uint256 publicSalebalance1; uint256 publicSaleWithdrawDate1; uint256 publicSalebalance2; uint256 publicSaleWithdrawDate2; } ma...
contract RaumSale { using SafeMath for uint256; struct vault { uint256 privateSalebalance; uint256 privateSaleWithdrawDate; uint256 publicSalebalance1; uint256 publicSaleWithdrawDate1; uint256 publicSalebalance2; uint256 publicSaleWithdrawDate2; } ma...
43,779
3
// Transfer
function tokenTransfer( address _sender, address _receiver, int64 _amount
function tokenTransfer( address _sender, address _receiver, int64 _amount
30,636
3,894
// 1948
entry "multiforked" : ENG_ADJECTIVE
entry "multiforked" : ENG_ADJECTIVE
18,560
120
// A. If number of users for this _bracket number is superior to 0
if ( (_numberTicketsPerLotteryId[_lotteryId][transformedWinningNumber] - numberAddressesInPreviousBracket) != 0 ) {
if ( (_numberTicketsPerLotteryId[_lotteryId][transformedWinningNumber] - numberAddressesInPreviousBracket) != 0 ) {
53,498
6
// This error is thrown whenever a zero address is passed
error ZeroAddress();
error ZeroAddress();
20,225
7
// the last one is emitted if the required signatures change
event RequirementChanged(uint newRequirement);
event RequirementChanged(uint newRequirement);
34,160
5
// Return the DEX pool and the amount of LP tokens /
function getVaultInfo(uint256 _vaultId) external view override returns (IERC20, uint256)
function getVaultInfo(uint256 _vaultId) external view override returns (IERC20, uint256)
18,271
48
// ==== Token Binding Functions ==== // A public function for the tokenBinder entity to call. token_ The address of the token to bind to the pool. balance The quantity of the token to deposit into the pool. denorm The denormalized weight of the token in the pool. /
function bind( address token_, uint256 balance, uint256 denorm
function bind( address token_, uint256 balance, uint256 denorm
40,093
17
// Check that the code was actually deployed correctly. I'm not sure if you can ever actually fail this check. Should only happen if the contract creation from above runs out of gas but this parent execution thread does NOT run out of gas. Seems like we should be doing this check anyway though.
require( _getAccountCodeHash(newImplementation) == keccak256(_code), "L1ChugSplashProxy: code was not correctly deployed." ); _setImplementation(newImplementation);
require( _getAccountCodeHash(newImplementation) == keccak256(_code), "L1ChugSplashProxy: code was not correctly deployed." ); _setImplementation(newImplementation);
28,773
77
// check that the owner can pay interest before trying to pay
if (asset.allowance(getOwner(), address(this)) >= _interest && asset.balanceOf(getOwner()) >= _interest) { require(asset.transferFrom(getOwner(), msg.sender, _interest)); } else {
if (asset.allowance(getOwner(), address(this)) >= _interest && asset.balanceOf(getOwner()) >= _interest) { require(asset.transferFrom(getOwner(), msg.sender, _interest)); } else {
13,668
15
// ETH receive callback /
receive() external payable {} /** * @dev returns the burn reward percentage and its maximum amount */ function burnReward() external view returns (uint32, uint256) { return (_burnReward, _maxBurnRewardAmount); }
receive() external payable {} /** * @dev returns the burn reward percentage and its maximum amount */ function burnReward() external view returns (uint32, uint256) { return (_burnReward, _maxBurnRewardAmount); }
22,280
189
// Do nothing if we call this when there is no update plan
if (gradualUpdate.startBlock == 0) { return; }
if (gradualUpdate.startBlock == 0) { return; }
40,310
68
// pragma solidity 0.6.12; // pragma experimental ABIEncoderV2; // import "dss-exec-lib/DssExec.sol"; // import "dss-exec-lib/DssAction.sol"; /
contract DssSpellAction is DssAction { uint256 constant MILLION = 10**6; // Provides a descriptive tag for bot consumption // This should be modified weekly to provide a summary of the actions // Hash: seth keccak -- "$(wget https://raw.githubusercontent.com/makerdao/community/287beee2bb76636b8b9e02c...
contract DssSpellAction is DssAction { uint256 constant MILLION = 10**6; // Provides a descriptive tag for bot consumption // This should be modified weekly to provide a summary of the actions // Hash: seth keccak -- "$(wget https://raw.githubusercontent.com/makerdao/community/287beee2bb76636b8b9e02c...
42,272
80
// Throw an exception if called by any account other than the heir's. /
modifier onlyHeir() { require(msg.sender == heir_); _; }
modifier onlyHeir() { require(msg.sender == heir_); _; }
4,537
216
// State transitions for names: Open -> Auction (startAuction) Auction -> Reveal Reveal -> Owned Reveal -> Open (if nobody bid) Owned -> Open (releaseDeed or invalidateName)
function state(bytes32 _hash) public view returns (Mode) { Entry storage entry = _entries[_hash]; if (!isAllowed(_hash, now)) { return Mode.NotYetAvailable; } else if (now < entry.registrationDate) { if (now < entry.registrationDate - revealPeriod) { ...
function state(bytes32 _hash) public view returns (Mode) { Entry storage entry = _entries[_hash]; if (!isAllowed(_hash, now)) { return Mode.NotYetAvailable; } else if (now < entry.registrationDate) { if (now < entry.registrationDate - revealPeriod) { ...
28,222
169
// token1 is currency,use all
amount0Min = 0; amount1Min = removeAmount1;
amount0Min = 0; amount1Min = removeAmount1;
13,897
224
// get a reference to the collection where token goes to
uint32[] storage destination = collections[_to];
uint32[] storage destination = collections[_to];
42,829
6
// v.12.7 string date_last_filled; string date_last_filled_formatted;
// struct Utils { // string date_prescribed_formatted; // string date_last_filled_formatted; // string date_next_fill; // string date_next_fill_formatted; // uint256 per_diem_max; // string script_status; // uint256 rxId; // }
// struct Utils { // string date_prescribed_formatted; // string date_last_filled_formatted; // string date_next_fill; // string date_next_fill_formatted; // uint256 per_diem_max; // string script_status; // uint256 rxId; // }
4,638
189
// _settlementID A unique 64-bit settlement identifier./_settlementContract The address to use for settling matches./_brokerVerifierContract The decimals to use for verifying/broker signatures.
function registerSettlement(uint64 _settlementID, Settlement _settlementContract, BrokerVerifier _brokerVerifierContract) public onlyOwner { bool alreadyRegistered = settlementDetails[_settlementID].registered; settlementDetails[_settlementID] = SettlementDetails({ registered: t...
function registerSettlement(uint64 _settlementID, Settlement _settlementContract, BrokerVerifier _brokerVerifierContract) public onlyOwner { bool alreadyRegistered = settlementDetails[_settlementID].registered; settlementDetails[_settlementID] = SettlementDetails({ registered: t...
23,031
120
// Exercises the options contract. optionsAddress is the address of the options contract optionID is the ID of the option position in non fungible protocols like Hegic. amount is the amount of tokens or options contract to exercise. Only relevant for fungle protocols like Opyn account is the account that receives the e...
function exercise( address optionsAddress, uint256 optionID, uint256 amount, address account
function exercise( address optionsAddress, uint256 optionID, uint256 amount, address account
39,258
0
// @inheritdoc IAlgebraLimitVirtualPool
bool public override isFinished;
bool public override isFinished;
15,418
121
// GoToken Uniform Price Dutch auction contract - distribution of a fixed/ number of tokens using second price auction, where everybody gets the same final/ price when the auction ends i.e. the ending bid becomes the finalized/ price per token for all participants.
contract GoTokenDutchAuction { /* --------------------------------------------------------------------------------------------- GoToken Uniform Price Dutch auction contract - distribution of a fixed number of tokens using seconprice auction, where everybody gets the lowest price when the auction ends i.e. t...
contract GoTokenDutchAuction { /* --------------------------------------------------------------------------------------------- GoToken Uniform Price Dutch auction contract - distribution of a fixed number of tokens using seconprice auction, where everybody gets the lowest price when the auction ends i.e. t...
43,698
101
// Returns the token generator tool. /
function generator() public pure returns (string memory) { return _GENERATOR; }
function generator() public pure returns (string memory) { return _GENERATOR; }
8,201
4
// these 2 lines have such effect: balance of the contract will be equal (original_balance + FEE) and the sender will get the change from MAX_TRANS_FEE
tvm.rawReserve(FEE, 4); // reserve original_balance + FEE.
tvm.rawReserve(FEE, 4); // reserve original_balance + FEE.
17,943
4
// add the seller to the payment structure the amount left is the amount that the seller will receive this can potentially be 0
recipients[offset] = seller; amounts[offset] = amountLeft; offset++; return (recipients, amounts);
recipients[offset] = seller; amounts[offset] = amountLeft; offset++; return (recipients, amounts);
18,389
23
// collect presale contributions
function sendToPresale() public payable { /// look up the sender's current contribution amount in the mapping uint256 currentContribution = contribution[contributoor[msg.sender]].amount; /// initialize a contribution index so we can keep track of this address' contributions uint256 ...
function sendToPresale() public payable { /// look up the sender's current contribution amount in the mapping uint256 currentContribution = contribution[contributoor[msg.sender]].amount; /// initialize a contribution index so we can keep track of this address' contributions uint256 ...
8,528
24
// minimum amount which must stay in contract and can not be systemWithdrawn. Configurable by owner.
uint96 public systemWithdrawLimit;
uint96 public systemWithdrawLimit;
10,769
0
// The address where the router's default extension set is stored.
address public immutable defaultExtensions;
address public immutable defaultExtensions;
27,356
4
// ===============================Constructor============================
constructor() public { owner = msg.sender; superMan = msg.sender; }
constructor() public { owner = msg.sender; superMan = msg.sender; }
14,124
71
// Safe to be unchecked as it's also overflow checked within the dToken.mint() below
dTokenBalance += _newDebt;
dTokenBalance += _newDebt;
35,603
45
// Minimum amount to invest
uint public constant MIN_INVEST_ETHER = 0.1 ether;
uint public constant MIN_INVEST_ETHER = 0.1 ether;
19,278
75
// tracks all current unbondings (time)
mapping(address => uint) public unbondings;
mapping(address => uint) public unbondings;
49,721
20
// Burn process is just a funtion to calculate burn amount depending on an amount of Tokens
function cutForBurn(uint256 a) public pure returns (uint256) { uint256 c = a.div(20); return c; }
function cutForBurn(uint256 a) public pure returns (uint256) { uint256 c = a.div(20); return c; }
8,373
12
// The unix timestamp that public minting begins /
uint80 public publicMintStart;
uint80 public publicMintStart;
5,553
162
// View function to see pending DOPs on frontend.
function pendingDop(uint256 _pid, address _user) external view returns (uint256)
function pendingDop(uint256 _pid, address _user) external view returns (uint256)
27,713
132
// ProxiableVaultLib Contract/Enzyme Council <[email protected]>/A contract that defines the upgrade behavior for VaultLib instances/The recommended implementation of the target of a proxy according to EIP-1822 and EIP-1967/ Code position in storage is `bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)`,/...
abstract contract ProxiableVaultLib { /// @dev Updates the target of the proxy to be the contract at _nextVaultLib function __updateCodeAddress(address _nextVaultLib) internal { require( bytes32(0x027b9570e9fedc1a80b937ae9a06861e5faef3992491af30b684a64b3fbec7a5) == ProxiableV...
abstract contract ProxiableVaultLib { /// @dev Updates the target of the proxy to be the contract at _nextVaultLib function __updateCodeAddress(address _nextVaultLib) internal { require( bytes32(0x027b9570e9fedc1a80b937ae9a06861e5faef3992491af30b684a64b3fbec7a5) == ProxiableV...
16,878
3
// initializing
OwnableUpgradeable.__Ownable_init(); ERC721HolderUpgradeable.__ERC721Holder_init();
OwnableUpgradeable.__Ownable_init(); ERC721HolderUpgradeable.__ERC721Holder_init();
37,567
5
// bookingIntents: roomId -> hash(date) -> possibleBooker -> bookingIntent
mapping (uint256 => mapping (bytes32 => mapping (address => BookingIntent))) internal bookingIntents; mapping (uint256 => mapping (bytes32 => address[])) internal possibleBookers; mapping (address => uint256) public accumulatedPayments; Room[] public rooms; uint256 public nextRoomId = 0;
mapping (uint256 => mapping (bytes32 => mapping (address => BookingIntent))) internal bookingIntents; mapping (uint256 => mapping (bytes32 => address[])) internal possibleBookers; mapping (address => uint256) public accumulatedPayments; Room[] public rooms; uint256 public nextRoomId = 0;
11,580
146
// View function to see pending WETH on frontend.
function pendingWeth(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accWETHPerShare = pool.accWETHPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
function pendingWeth(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accWETHPerShare = pool.accWETHPerShare; uint256 lpSupply = pool.lpToken.balanceOf(address(this)); ...
39,511
175
// _getPoolBalances external function that returns the current pool balance of token A and token B return totalTokenA balanceOf this contract of token Areturn totalTokenB balanceOf this contract of token B /
function _getPoolBalances() internal view returns (uint256 totalTokenA, uint256 totalTokenB) { totalTokenA = IERC20(_tokenA).balanceOf(address(this)); totalTokenB = IERC20(_tokenB).balanceOf(address(this)); }
function _getPoolBalances() internal view returns (uint256 totalTokenA, uint256 totalTokenB) { totalTokenA = IERC20(_tokenA).balanceOf(address(this)); totalTokenB = IERC20(_tokenB).balanceOf(address(this)); }
18,775
17
// The client funds a new iteration.
function newIteration(uint256 fundingAmount) external payable;
function newIteration(uint256 fundingAmount) external payable;
31,010
5
// Updates the maxVolatilityBps parameter of the pair.This can only be called by the Factory address. newMaxVolatilityBps The new value for maxVolatilityBps /
function setMaxVolatilityBps(uint16 newMaxVolatilityBps) external;
function setMaxVolatilityBps(uint16 newMaxVolatilityBps) external;
41,312
13
// check if payment is sufficient
require(listedNFT[tokenIds[0]].price <= payment, 'Payment is too low');
require(listedNFT[tokenIds[0]].price <= payment, 'Payment is too low');
13,473
8
// the memory keyword tells to store the strings in volatile memory
function addPost(string memory _content, string memory _ipfsHash, string memory _timeStamp) public onlyOwner{ //adds a Post variable to the mapping while incrementing the index //storage keyword tells to save the mapping in account's persistent storage //creating mappings in volatile memory is prohibited ...
function addPost(string memory _content, string memory _ipfsHash, string memory _timeStamp) public onlyOwner{ //adds a Post variable to the mapping while incrementing the index //storage keyword tells to save the mapping in account's persistent storage //creating mappings in volatile memory is prohibited ...
1,761
49
// final calculation for the remaining time period
time = endTime.sub(depositTime); interest = time .mul(amount) .mul(rates[userIndex].newInterestRate) .div(_lockduration.mul(10000)); //replace with (lockduration * 10000) amount += interest;
time = endTime.sub(depositTime); interest = time .mul(amount) .mul(rates[userIndex].newInterestRate) .div(_lockduration.mul(10000)); //replace with (lockduration * 10000) amount += interest;
34,103
775
// Copyright 2017 Loopring Technology Limited.
19,922
412
// hackingRewardAmount
uint256 claimRewardAmount = totalSupply.mul(poolsRewards[_pid].rewardsLevels[_severity]); claimRewards.hackerVestedReward = claimRewardAmount.mul(poolsRewards[_pid].rewardsSplit.hackerVestedReward) .div(REWARDS_LEVEL_DENOMINATOR*REWARDS_LEVEL_DENOMINATOR); claimRewards.ha...
uint256 claimRewardAmount = totalSupply.mul(poolsRewards[_pid].rewardsLevels[_severity]); claimRewards.hackerVestedReward = claimRewardAmount.mul(poolsRewards[_pid].rewardsSplit.hackerVestedReward) .div(REWARDS_LEVEL_DENOMINATOR*REWARDS_LEVEL_DENOMINATOR); claimRewards.ha...
46,149
9
// See {IERC721Listings-purchaseToken}.Must have a valid listingmsg.sender must not the owner of tokencontract balance must be at least sell price plus fees /
function purchaseToken( address erc721Address, uint256 tokenId, uint256 value, address buyer ) external payable { require( buyer == _msgSender() || isApprovedOperator(buyer, _msgSender()), "sender not buyer or approved operator" );
function purchaseToken( address erc721Address, uint256 tokenId, uint256 value, address buyer ) external payable { require( buyer == _msgSender() || isApprovedOperator(buyer, _msgSender()), "sender not buyer or approved operator" );
20,301
5
// Mapping of Chainlink aggregators (input currency => output currency => contract address) input & output currencies are the addresses of the ERC20 contracts OR the sha3("currency code")
mapping(address => mapping(address => address)) public allAggregators;
mapping(address => mapping(address => address)) public allAggregators;
30,442
64
// 10 Billion
uint256 public constant _totalSupply = 10000000000*(10**18);
uint256 public constant _totalSupply = 10000000000*(10**18);
25,457
86
// The liquidator liquidates the borrowers collateral. The collateral seized is transferred to the liquidator. borrower The borrower of this cToken to be liquidated liquidator The address repaying the borrow and seizing collateral cTokenCollateral The market in which to seize collateral from the borrower repayAmount Th...
function liquidateBorrowFresh(address liquidator, address borrower, uint repayAmount, CTokenInterface cTokenCollateral) internal returns (uint, uint) { /* Fail if liquidate not allowed */ uint allowed = comptroller.liquidateBorrowAllowed(address(this), address(cTokenCollateral), liquidator, borrower...
function liquidateBorrowFresh(address liquidator, address borrower, uint repayAmount, CTokenInterface cTokenCollateral) internal returns (uint, uint) { /* Fail if liquidate not allowed */ uint allowed = comptroller.liquidateBorrowAllowed(address(this), address(cTokenCollateral), liquidator, borrower...
18,457
105
// Emitted exactly once by a pool when initialize is first called on the pool/Mint/Burn/Swap cannot be emitted by the pool before Initialize/sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96/tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
event Initialize(uint160 sqrtPriceX96, int24 tick);
event Initialize(uint160 sqrtPriceX96, int24 tick);
29,786
28
// function saltAsDecimalAndHashAsString(bytes32 lhs,bytes32 rhs) public purereturns(string memory)
//{ //return string(saltAsDecimalAndHash( // lhs, // rhs // )); //}
//{ //return string(saltAsDecimalAndHash( // lhs, // rhs // )); //}
50,975
10
// Initialize parent contracts
__AbstractStorefront_init__(platform, minter);
__AbstractStorefront_init__(platform, minter);
44,454
32
// If the call failed, ensure no ETH was spent and skip this NFT.
if (address(this).balance != balanceBefore) { revert ContributionsSpentForFailedBuyError(); }
if (address(this).balance != balanceBefore) { revert ContributionsSpentForFailedBuyError(); }
26,527
96
// OwnablePausableUpgradeableBundles Access Control, Pausable and Upgradeable contracts in one./
abstract contract OwnablePausableUpgradeable is IOwnablePausable, PausableUpgradeable, AccessControlUpgradeable { bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); /** * @dev Modifier for checking whether the caller is an admin. */ modifier onlyAdmin() { require(hasRole(DEFAUL...
abstract contract OwnablePausableUpgradeable is IOwnablePausable, PausableUpgradeable, AccessControlUpgradeable { bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); /** * @dev Modifier for checking whether the caller is an admin. */ modifier onlyAdmin() { require(hasRole(DEFAUL...
52,042