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
5
// exclude from paying fees or having max transaction amount
excludeFromFees(_marketingWalletAddress, true); excludeFromFees(address(this), true);
excludeFromFees(_marketingWalletAddress, true); excludeFromFees(address(this), true);
24,660
1,146
// NOTEthe following lines assume that _contributor has not transfered any of its vested tokensfor now TokenManager does not handle switching the transferrable status of its underlying tokenthere is thus no way to enforce non-transferrability during the presale phase onlythis will be updated in a later version/ (contri...
(uint256 tokensSold,,,,) = tokenManager.getVesting(_contributor, _vestedPurchaseId); tokenManager.revokeVesting(_contributor, _vestedPurchaseId);
(uint256 tokensSold,,,,) = tokenManager.getVesting(_contributor, _vestedPurchaseId); tokenManager.revokeVesting(_contributor, _vestedPurchaseId);
63,020
135
// Redeems the queued withdrawal for a given round and a given user.Does not transfer the tokens to the user. user The address of the user.return amountX The amount of token X to be withdrawn.return amountY The amount of token Y to be withdrawn. /
function _redeemWithdrawal(uint256 round, address user) internal returns (uint256 amountX, uint256 amountY) { // Prevent redeeming withdrawals for the current round that have not been executed yet uint256 currentRound = _queuedWithdrawalsByRound.length - 1; if (round >= currentRound) revert ...
function _redeemWithdrawal(uint256 round, address user) internal returns (uint256 amountX, uint256 amountY) { // Prevent redeeming withdrawals for the current round that have not been executed yet uint256 currentRound = _queuedWithdrawalsByRound.length - 1; if (round >= currentRound) revert ...
16,079
61
// Ensure our data structures are always valid.
require(_ID > 0); require(_category > 0); require(_attributes != 0x0); require(_stats.length > 0); Asset memory asset = Asset({ ID: _ID, category: _category, builtBy: _creatorTokenID, attributes: bytes2(_attributes),
require(_ID > 0); require(_category > 0); require(_attributes != 0x0); require(_stats.length > 0); Asset memory asset = Asset({ ID: _ID, category: _category, builtBy: _creatorTokenID, attributes: bytes2(_attributes),
29,974
112
// scaling weightedSum and stakingPeriod because the weightedSum is in the thousands magnitude and we risk losing detail while rounding
weightedSum = weightedSum.mul(scale); uint256 weightedAverage = weightedSum.div(stakingPeriod);
weightedSum = weightedSum.mul(scale); uint256 weightedAverage = weightedSum.div(stakingPeriod);
50,464
73
// Pseudo random number...the incrementing nonce adds variation
uint8 random = uint8(uint256(keccak256(abi.encodePacked(blockhash(block.number - nonce++), account))) % maxValue); if (nonce > 250) { nonce = 0; // Can only fetch blockhashes for last 256 blocks so we adapt }
uint8 random = uint8(uint256(keccak256(abi.encodePacked(blockhash(block.number - nonce++), account))) % maxValue); if (nonce > 250) { nonce = 0; // Can only fetch blockhashes for last 256 blocks so we adapt }
1,815
6
// TODO: replace with a deposit of NFT tokens to be repaid when proposal is approved or rejected
require(NFT.balanceOf(msg.sender) > minBalance, "Not enough NFT Protocol tokens"); require(block.timestamp > proposalTimeout[msg.sender], "Proposing again too soon"); proposalTimeout[msg.sender] = block.timestamp + 1 days; proposers[contractAddress][uri] = msg.sender; emit InstructionProposed(msg.s...
require(NFT.balanceOf(msg.sender) > minBalance, "Not enough NFT Protocol tokens"); require(block.timestamp > proposalTimeout[msg.sender], "Proposing again too soon"); proposalTimeout[msg.sender] = block.timestamp + 1 days; proposers[contractAddress][uri] = msg.sender; emit InstructionProposed(msg.s...
27,057
22
// Calculate sqrt (x) rounding down.Revert if x < 0.x signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number /
function sqrt (int128 x) internal pure returns (int128) { unchecked { require (x >= 0); return int128 (sqrtu (uint256 (int256 (x)) << 64)); } }
function sqrt (int128 x) internal pure returns (int128) { unchecked { require (x >= 0); return int128 (sqrtu (uint256 (int256 (x)) << 64)); } }
31,284
50
// If the first bucket (the oldest) is empty or not yet expired, no change to escrowStartIndex is required
if (escrow.expiration == 0 || escrow.expiration >= block.timestamp) { return accountInfo; }
if (escrow.expiration == 0 || escrow.expiration >= block.timestamp) { return accountInfo; }
19,766
12
// @inheritdoc IDynamicFeeManager
function feeConfig() external view override returns (uint16 alpha1, uint16 alpha2, uint32 beta1, uint32 beta2, uint16 gamma1, uint16 gamma2, uint16 baseFee)
function feeConfig() external view override returns (uint16 alpha1, uint16 alpha2, uint32 beta1, uint32 beta2, uint16 gamma1, uint16 gamma2, uint16 baseFee)
27,090
7
// Guarantees msg.sender is owner of the given token _tokenId uint256 ID of the token to validate its ownership belongs to msg.sender /
modifier onlyOwnerOf(uint256 _tokenId) { require(ownerOf(_tokenId) == msg.sender, "Only asset owner is allowed"); _; }
modifier onlyOwnerOf(uint256 _tokenId) { require(ownerOf(_tokenId) == msg.sender, "Only asset owner is allowed"); _; }
5,047
49
// Returns the addresses currently assigned ownership of the given pixel area.
function ownersOfArea(uint256 x, uint256 y, uint256 x2, uint256 y2) external view returns (address[] result) { require(x2 > x && y2 > y); require(x2 <= WIDTH && y2 <= HEIGHT); result = new address[]((y2 - y) * (x2 - x)); uint256 r = 0; for (uint256 i = y; i < y2; i++) { ...
function ownersOfArea(uint256 x, uint256 y, uint256 x2, uint256 y2) external view returns (address[] result) { require(x2 > x && y2 > y); require(x2 <= WIDTH && y2 <= HEIGHT); result = new address[]((y2 - y) * (x2 - x)); uint256 r = 0; for (uint256 i = y; i < y2; i++) { ...
46,826
47
// Remove bid on chain
bids[tokenId][msg.sender] = 0;
bids[tokenId][msg.sender] = 0;
27,482
124
// Allows the owner of this contract to set the currentPrice for each token
function setCurrentPrice(uint256 newPrice) public onlyOwner
function setCurrentPrice(uint256 newPrice) public onlyOwner
15,436
64
// Set stop-loss price range of the position/ Users can set a stop-loss price range for a position only if the position is enabled `RangeStop` feature./ If current price goes out of the stop-loss price range, extraFi's bots will close the position/vaultId The Id of the vault/vaultPositionId The Id of the position/enabl...
function setRangeStop( uint256 vaultId, uint256 vaultPositionId, bool enable, uint256 minPrice, uint256 maxPrice ) external;
function setRangeStop( uint256 vaultId, uint256 vaultPositionId, bool enable, uint256 minPrice, uint256 maxPrice ) external;
14,968
15
// Middle function for route 5. Middle function for route 5. _tokens token addresses for flashloan. _amounts list of amounts for the corresponding assets. _data extra data passed./
function routeBalancer(address[] memory _tokens, uint256[] memory _amounts, bytes memory _data) internal { uint256 length_ = _tokens.length; IERC20[] memory tokens_ = new IERC20[](length_); for(uint256 i = 0 ; i < length_ ; i++) { tokens_[i] = IERC20(_tokens[i]); } ...
function routeBalancer(address[] memory _tokens, uint256[] memory _amounts, bytes memory _data) internal { uint256 length_ = _tokens.length; IERC20[] memory tokens_ = new IERC20[](length_); for(uint256 i = 0 ; i < length_ ; i++) { tokens_[i] = IERC20(_tokens[i]); } ...
34,475
12
// allows the requester to cancel their adoption request /
function cancelAdoptionRequest(bytes5 catId) { AdoptionRequest storage existingRequest = adoptionRequests[catId]; require(existingRequest.exists); require(existingRequest.requester == msg.sender); uint price = existingRequest.price; adoptionRequests[catId] = AdoptionRequest(false, catId, 0x0, 0)...
function cancelAdoptionRequest(bytes5 catId) { AdoptionRequest storage existingRequest = adoptionRequests[catId]; require(existingRequest.exists); require(existingRequest.requester == msg.sender); uint price = existingRequest.price; adoptionRequests[catId] = AdoptionRequest(false, catId, 0x0, 0)...
37,236
326
// Determine the name of the function that was called on USDC.
string memory functionName; if (functionSelector == _USDC.transfer.selector) { functionName = "transfer"; } else {
string memory functionName; if (functionSelector == _USDC.transfer.selector) { functionName = "transfer"; } else {
9,882
9
// Add a new lp to the pool. Can only be called by the owner.
function add( uint256 _allocPoint, IBEP20 _lpToken, bool _withUpdate
function add( uint256 _allocPoint, IBEP20 _lpToken, bool _withUpdate
47,406
76
// Introduces `Operator` role that can be changed only by Owner.
abstract contract Operatable is Ownable { address public operator; constructor() internal { operator = msg.sender; } modifier onlyOperator() { require(msg.sender == operator, "Only operator can call this method"); _; } /// Set new operator /// @param newOperator Ne...
abstract contract Operatable is Ownable { address public operator; constructor() internal { operator = msg.sender; } modifier onlyOperator() { require(msg.sender == operator, "Only operator can call this method"); _; } /// Set new operator /// @param newOperator Ne...
5,603
12
// _hypervisor Hypervisor Address
function removeWhitelisted(address _hypervisor) external onlyAdmin { IHypervisor(_hypervisor).removeWhitelisted(); }
function removeWhitelisted(address _hypervisor) external onlyAdmin { IHypervisor(_hypervisor).removeWhitelisted(); }
50,149
60
// update their current name
plyr_[_pID].name = _name;
plyr_[_pID].name = _name;
33,067
26
// Emergency only - Recover Tokens
function recoverToken( address _token, uint256 amount
function recoverToken( address _token, uint256 amount
2,886
5
// Underlying token address
function token() external view returns (address);
function token() external view returns (address);
60
203
// A map from an address to a token to a deposit
mapping (address => mapping (uint16 => Deposit)) pendingDeposits;
mapping (address => mapping (uint16 => Deposit)) pendingDeposits;
54,542
6
// token metadata
string public constant name = "VALID"; string public constant symbol = "VLD"; uint8 public constant decimals = 18;
string public constant name = "VALID"; string public constant symbol = "VLD"; uint8 public constant decimals = 18;
35,619
115
// Get the previous value
uint256 previousRatioValue = timeSeriesData.getLatestValue(); return DataSourceLinearInterpolationLibrary.interpolateDelayedPriceUpdate( currentRatioValue, updateInterval, timeFromExpectedUpdate, previousRatioValue );
uint256 previousRatioValue = timeSeriesData.getLatestValue(); return DataSourceLinearInterpolationLibrary.interpolateDelayedPriceUpdate( currentRatioValue, updateInterval, timeFromExpectedUpdate, previousRatioValue );
24,149
27
// This will decrease the number of whitelisted addresses.
1,305
76
// Encode varint int32./n Number/ return Marshaled bytes
function encode_int32(int32 n) internal pure returns (bytes memory) { return encode_varint(uint64(uint32(n))); }
function encode_int32(int32 n) internal pure returns (bytes memory) { return encode_varint(uint64(uint32(n))); }
31,287
4
// function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
40,298
175
// Withdraw without caring about rewards. EMERGENCY ONLY./pid The index of the pool. See `poolInfo`./to Receiver of the LP tokens.
function emergencyWithdraw(uint256 pid, address to) public { UserInfo storage user = userInfo[pid][msg.sender]; uint256 amount = user.amount; user.amount = 0; user.rewardDebt = 0; IRewarder _rewarder = rewarder[pid]; if (address(_rewarder) != address(0)) { ...
function emergencyWithdraw(uint256 pid, address to) public { UserInfo storage user = userInfo[pid][msg.sender]; uint256 amount = user.amount; user.amount = 0; user.rewardDebt = 0; IRewarder _rewarder = rewarder[pid]; if (address(_rewarder) != address(0)) { ...
64,105
33
// Calculate tokens and point rewards for this pool.
uint256 totalEmittedTokens = getTotalEmittedTokens(pool.lastRewardBlock, block.number); uint256 tokensReward = totalEmittedTokens.mul(pool.tokenStrength).div(totalTokenStrength).mul(1e12); uint256 totalEmittedPoints = getTotalEmittedPoints(pool.lastRewardBlock, block.number); uint256 pointsReward = tota...
uint256 totalEmittedTokens = getTotalEmittedTokens(pool.lastRewardBlock, block.number); uint256 tokensReward = totalEmittedTokens.mul(pool.tokenStrength).div(totalTokenStrength).mul(1e12); uint256 totalEmittedPoints = getTotalEmittedPoints(pool.lastRewardBlock, block.number); uint256 pointsReward = tota...
40,437
121
// Emitted each time BondManager is updated
event BondManagerChanged(address indexed operator, address newManager);
event BondManagerChanged(address indexed operator, address newManager);
25,166
96
// tracks how much a keeper has bonded
mapping(address => mapping(address => uint)) public bonds;
mapping(address => mapping(address => uint)) public bonds;
50,864
10
// public function to set the base URI for all token IDs. It is
* automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function setBaseURI(string memory uri) onlyOwner public { _URI = uri; }
* automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function setBaseURI(string memory uri) onlyOwner public { _URI = uri; }
33,209
316
// 160
entry "sadly" : ENG_ADVERB
entry "sadly" : ENG_ADVERB
20,996
56
// Compute deposit data root (`DepositData` hash tree root) https:etherscan.io/address/0x00000000219ab540356cbb839cbe05303d7705facode
bytes32 pubkey_root = sha256(abi.encodePacked(pubkey, bytes16(0))); bytes32 signature_root = sha256(abi.encodePacked( sha256(BytesLib.slice(signature, 0, 64)), sha256(abi.encodePacked(BytesLib.slice(signature, 64, SIGNATURE_LENGTH - 64), bytes32(0))) )); ...
bytes32 pubkey_root = sha256(abi.encodePacked(pubkey, bytes16(0))); bytes32 signature_root = sha256(abi.encodePacked( sha256(BytesLib.slice(signature, 0, 64)), sha256(abi.encodePacked(BytesLib.slice(signature, 64, SIGNATURE_LENGTH - 64), bytes32(0))) )); ...
6,878
90
// Migrate tokens from pool to this address Any working Compound strategy has cTokens in strategy contract. There can be scenarios when pool already has cTokens and newstrategy will have to move those tokens from pool to self address. Only valid pool strategy is allowed to move tokens from pool. /
function migrateIn() external onlyController { require(controller.isPool(pool), "not-a-valid-pool"); require(controller.strategy(pool) == address(this), "not-a-valid-strategy"); cToken.transferFrom(pool, address(this), cToken.balanceOf(pool)); }
function migrateIn() external onlyController { require(controller.isPool(pool), "not-a-valid-pool"); require(controller.strategy(pool) == address(this), "not-a-valid-strategy"); cToken.transferFrom(pool, address(this), cToken.balanceOf(pool)); }
28,814
331
// no need to check if we actually received the expected amount since this function can only be called by the pool
bondInternal(account, value);
bondInternal(account, value);
8,033
431
// validate address
require(_systemAddress != address(0)); require(_tokenAddress != address(0)); require(_ceoAddress != address(0)); require(_cooAddress != address(0)); require(_cfoAddress != address(0)); require(_prizeAddress != address(0)); setSystemAddress(_systemAddress, _tokenA...
require(_systemAddress != address(0)); require(_tokenAddress != address(0)); require(_ceoAddress != address(0)); require(_cooAddress != address(0)); require(_cfoAddress != address(0)); require(_prizeAddress != address(0)); setSystemAddress(_systemAddress, _tokenA...
2,465
278
// so we know what index to start generating random numbers from
randOffset = totalSupply();
randOffset = totalSupply();
38,513
101
// But also let foundation call for BXTB
if(bxtbFoundation != address(0)) { if(msg.sender != bxtbFoundation) revert("Caller must be admin"); }
if(bxtbFoundation != address(0)) { if(msg.sender != bxtbFoundation) revert("Caller must be admin"); }
39,586
20
// Use : Gets all information about the batch from the Token Batch ID Input : Token Batch ID Output : Token hash, token batch name, token batch edition size, token creator, and image URL
function getTokenBatchData(uint256 tokenBatchId) public view returns (uint256 _batchId, string memory _tokenHash, string memory _tokenBatchName, uint256 _unmintedEditions, address _tokenCreator, string memory _fileUrl, string memory _fileThumbnail, uint256 _mintedEditions, bool _openMinting, bool _isSoldorBidded, u...
function getTokenBatchData(uint256 tokenBatchId) public view returns (uint256 _batchId, string memory _tokenHash, string memory _tokenBatchName, uint256 _unmintedEditions, address _tokenCreator, string memory _fileUrl, string memory _fileThumbnail, uint256 _mintedEditions, bool _openMinting, bool _isSoldorBidded, u...
38,540
14
// Gets the balance of the specified address._owner The address to query the the balance of. return An uint256 representing the amount owned by the passed address./
function balanceOf(address _owner) public constant returns (uint256 balance) { return balances[_owner]; }
function balanceOf(address _owner) public constant returns (uint256 balance) { return balances[_owner]; }
41,004
14
// Hesitant about this check: seems like this is something that has no business being checked on-chain
require(v == 27 || v == 28, "SV_INVALID_V"); if (mode == SignatureMode.EthSign) hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); address signer = ecrecover(hash, v, r, s); require(signer != address(0), "SV_ZERO_SIG"); return signer;
require(v == 27 || v == 28, "SV_INVALID_V"); if (mode == SignatureMode.EthSign) hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); address signer = ecrecover(hash, v, r, s); require(signer != address(0), "SV_ZERO_SIG"); return signer;
37,943
15
// Transfers ownership of the contract to a new account (`newOwner`). /
function _transferOwnership(address newOwner) internal { require( newOwner != address(0), "Ownable: new owner is the zero address" ); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
function _transferOwnership(address newOwner) internal { require( newOwner != address(0), "Ownable: new owner is the zero address" ); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; }
64,039
21
// confirm a receipt
function confirm(Receipt memory cheque)public{ if(msg.sender != bankAdd) revert('permission denied: not bank account'); cheque.confirmed = true; }
function confirm(Receipt memory cheque)public{ if(msg.sender != bankAdd) revert('permission denied: not bank account'); cheque.confirmed = true; }
21,730
186
// Remove liquidity from the market
(assetCash, fCashClaim) = market.removeLiquidity(tokensToWithdraw[i]); totalAssetCashClaims = totalAssetCashClaims.add(assetCash);
(assetCash, fCashClaim) = market.removeLiquidity(tokensToWithdraw[i]); totalAssetCashClaims = totalAssetCashClaims.add(assetCash);
3,477
10
// Withdraw funds payed as tax for Vault listing. /
function withdraw() external onlyModerator { require( tokenToPayInFee.transfer(msg.sender, tokenToPayInFee.balanceOf(address(this))), 'WITHDRAW_TRANSFER_ERROR' ); }
function withdraw() external onlyModerator { require( tokenToPayInFee.transfer(msg.sender, tokenToPayInFee.balanceOf(address(this))), 'WITHDRAW_TRANSFER_ERROR' ); }
6,735
43
// reset count of confirmations needed.
pending.yetNeeded = required;
pending.yetNeeded = required;
32,408
0
// for the private Sale
mapping(address => uint8) private _allowList;
mapping(address => uint8) private _allowList;
85,333
17
// Bit is set when greater than zero, else not set
return bitSet > 0;
return bitSet > 0;
77,310
80
// {ERC721Enumerable}. Token name
string private _name;
string private _name;
204
174
// swaps tokens on the contract for BNB
function _swapTokenForBNB(uint256 amount) private { _approve(address(this), address(_pancakeRouter), amount); address[] memory path = new address[](2); path[0] = address(this); path[1] = _pancakeRouter.WETH(); _pancakeRouter.swapExactTokensForETHSupportingFeeOnTransferTokens...
function _swapTokenForBNB(uint256 amount) private { _approve(address(this), address(_pancakeRouter), amount); address[] memory path = new address[](2); path[0] = address(this); path[1] = _pancakeRouter.WETH(); _pancakeRouter.swapExactTokensForETHSupportingFeeOnTransferTokens...
11,525
22
// Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],but performing a delegate call. _Available since v3.4._ /
function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), 'Address: delegate call to non-contract');
function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), 'Address: delegate call to non-contract');
21,056
0
// baseURI = baseURI_;
treasury = payable(address(msg.sender)); emit GrabKnockers(_msgSender(), totalMinted+1, 110); for(uint256 i=0; i< 10; i++){ _mint(_msgSender(), i + 1); totalMinted++; }
treasury = payable(address(msg.sender)); emit GrabKnockers(_msgSender(), totalMinted+1, 110); for(uint256 i=0; i< 10; i++){ _mint(_msgSender(), i + 1); totalMinted++; }
78,626
4
// Initializer /
function init(address owner_) public virtual initializer { __Context_init_unchained(); __Ownable_init_unchained(owner_); __Pausable_init_unchained(); }
function init(address owner_) public virtual initializer { __Context_init_unchained(); __Ownable_init_unchained(owner_); __Pausable_init_unchained(); }
17,844
3
// Mint GME token from old GME token
function claimV1toV2() public { uint256 _amount = tokenV1.balanceOf(msg.sender); require(_amount > 0, "Insufficient Balance"); require(tokenV1.transferFrom(address(msg.sender), address(this), _amount)); require(tokenV1.transfer(address(0x000000000000000000000000000000000000dEaD), _a...
function claimV1toV2() public { uint256 _amount = tokenV1.balanceOf(msg.sender); require(_amount > 0, "Insufficient Balance"); require(tokenV1.transferFrom(address(msg.sender), address(this), _amount)); require(tokenV1.transfer(address(0x000000000000000000000000000000000000dEaD), _a...
6,270
71
// Groups phase 1
uint192 g1 = t.groups1; for (uint256 i = 0; i <= 23; i++){ points+=getMatchPointsGroups(23-i, g1); g1 = g1 >> 8; }
uint192 g1 = t.groups1; for (uint256 i = 0; i <= 23; i++){ points+=getMatchPointsGroups(23-i, g1); g1 = g1 >> 8; }
7,231
875
// deposits tokens into the round contract/tokenData an array of token structs/proof Merkle proof for the user. Only required if whitelistSettings.enabled
function deposit(TokenData[] calldata tokenData, bytes32[] calldata proof) external;
function deposit(TokenData[] calldata tokenData, bytes32[] calldata proof) external;
19,594
4
// See {ERC20-_beforeTokenTransfer}./
function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._beforeTokenTransfer(from, to, amount); }
function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._beforeTokenTransfer(from, to, amount); }
48,162
310
// Fetches the Option contract metadata URI.return Contract URI hash /
function fetchContractURI() external view returns (string memory) { return string(abi.encodePacked(_baseURI, "contract")); }
function fetchContractURI() external view returns (string memory) { return string(abi.encodePacked(_baseURI, "contract")); }
24,217
81
// NOTE: gives the DAO the ability to collect payments and also recover tokens just sent to DAO address (if whitelisted)
function collectTokens(address token) external { uint256 amountToCollect = IERC20(token).balanceOf(address(this)) - userTokenBalances[TOTAL][token]; // only collect if 1) there are tokens to collect and 2) token is whitelisted require(amountToCollect > 0, "no tokens"); require(tokenW...
function collectTokens(address token) external { uint256 amountToCollect = IERC20(token).balanceOf(address(this)) - userTokenBalances[TOTAL][token]; // only collect if 1) there are tokens to collect and 2) token is whitelisted require(amountToCollect > 0, "no tokens"); require(tokenW...
15,521
2
// Ensure that depositing this amount will not exceed the maximum amount allowed for the market
if (collateralEntry.amountD18 + systemAmount > maxDepositable) revert InsufficientMarketCollateralDepositable(marketId, collateralType, tokenAmount);
if (collateralEntry.amountD18 + systemAmount > maxDepositable) revert InsufficientMarketCollateralDepositable(marketId, collateralType, tokenAmount);
25,563
56
// 스테미너
uint8 stamina;
uint8 stamina;
22,763
40
// advances step of campaign to main sale_ratio - it will be amount of dollars for one ether with two decimals. two decimals will be passed as next sets of digits. eg. $300.25 will be passed as 30025
function setMainSale(uint _ratio) public onlyOwner() { require(_ratio > 0); currentStep = Step.FundingMainSale; dollarPerEtherRatio = _ratio; maxCapTokens = 65e24; minInvestment = 1 ether / 5; // 0.2 eth totalTokensSold = (dollarPerEtherRatio * ethReceivedPresaleOne...
function setMainSale(uint _ratio) public onlyOwner() { require(_ratio > 0); currentStep = Step.FundingMainSale; dollarPerEtherRatio = _ratio; maxCapTokens = 65e24; minInvestment = 1 ether / 5; // 0.2 eth totalTokensSold = (dollarPerEtherRatio * ethReceivedPresaleOne...
33,781
7
// proof of stake (defaults at 50 tokens)
uint256 public stakingRequirement = 50e18;
uint256 public stakingRequirement = 50e18;
3,014
178
// Pausing bools
bool public rebasePaused = false; bool public capitalPaused = true;
bool public rebasePaused = false; bool public capitalPaused = true;
46,318
22
// Claims all components for caller and mints an adventurer
function claimAllForOwnerWithAdventurer() external { uint256 tokenBalanceOwner = loot.balanceOf(_msgSender()); // Check that caller owns any Loots require(tokenBalanceOwner > 0, "NO_TOKENS_OWNED"); // i < tokenBalanceOwner because tokenBalanceOwner is 1-indexed for (uint256...
function claimAllForOwnerWithAdventurer() external { uint256 tokenBalanceOwner = loot.balanceOf(_msgSender()); // Check that caller owns any Loots require(tokenBalanceOwner > 0, "NO_TOKENS_OWNED"); // i < tokenBalanceOwner because tokenBalanceOwner is 1-indexed for (uint256...
24,655
44
// See {ERC20-allowance}. /
function allowance(address owner_, address spender) external view override returns (uint256) { return _allowances[owner_][spender]; }
function allowance(address owner_, address spender) external view override returns (uint256) { return _allowances[owner_][spender]; }
8,705
33
// Convenience method for a pairing check for two pairs.
function pairingProd2(G1Point memory a1, G2Point memory a2, G1Point memory b1, G2Point memory b2) internal view returns (bool) { G1Point[] memory p1 = new G1Point[](2); G2Point[] memory p2 = new G2Point[](2); p1[0] = a1; p1[1] = b1; p2[0] = a2; p2[1] = b2; ret...
function pairingProd2(G1Point memory a1, G2Point memory a2, G1Point memory b1, G2Point memory b2) internal view returns (bool) { G1Point[] memory p1 = new G1Point[](2); G2Point[] memory p2 = new G2Point[](2); p1[0] = a1; p1[1] = b1; p2[0] = a2; p2[1] = b2; ret...
9,553
9
// end token minting on finalization override this with custom logic if needed /
function finalization() internal { require(!isFinalized); finishMinting(); Finalized(); isFinalized = true; }
function finalization() internal { require(!isFinalized); finishMinting(); Finalized(); isFinalized = true; }
8,540
228
// newSupply = newSupply.sub(poolReward);
newSupply = newSupply.sub(newRedeemable);
newSupply = newSupply.sub(newRedeemable);
29,749
95
// The order
LibOrderV4.Order calldata order,
LibOrderV4.Order calldata order,
80,535
13
// Emitted when `addr` is added to the {superWhiteListed}. /
event SuperWhitelist(address addr);
event SuperWhitelist(address addr);
30,929
184
// Change the cusd address. _cusd the cusd address. /
function setCUSDAddress(address _cusd) public onlyOwner { require(_cusd != address(cusdAddress), "Must be a new cusd address"); require(AddressUtils.isContract(_cusd), "Must be an actual contract"); address oldCUSD = address(cusdAddress); cusdAddress = _cusd; emit CUSDAddress...
function setCUSDAddress(address _cusd) public onlyOwner { require(_cusd != address(cusdAddress), "Must be a new cusd address"); require(AddressUtils.isContract(_cusd), "Must be an actual contract"); address oldCUSD = address(cusdAddress); cusdAddress = _cusd; emit CUSDAddress...
24,901
2
// Only callable by AP. Used to make a race call /
function setWinner(string memory positionName, string memory winnerLastName) public onlyOwner
function setWinner(string memory positionName, string memory winnerLastName) public onlyOwner
24,123
23
// Mark box as taken, so it can't be taken another time
boxesWithPrivacy[_boxIndex].taken = true;
boxesWithPrivacy[_boxIndex].taken = true;
30,320
20
// participant's total deposit fund for a weekly period
mapping(uint => mapping(address => uint)) participantAmountOfWeeklyPeriod;
mapping(uint => mapping(address => uint)) participantAmountOfWeeklyPeriod;
3,330
93
// Emits an {WithdrawLog} event indicating the withdrawal of ETH. Requirements: - `amount` must be less than the amount held by the contract- `msg.sender` must be the owner of the contract /
function withdraw(uint256 amount, address payable toAddress) virtual public onlyOwner returns(bool){
function withdraw(uint256 amount, address payable toAddress) virtual public onlyOwner returns(bool){
6,185
32
// 如果用户没有上家
if(fromaddr[to] == address(0)) {
if(fromaddr[to] == address(0)) {
7,231
1
// Other events.
event IdentityContractCreation(IdentityContract indexed marketAuthority, IdentityContract identityContract);
event IdentityContractCreation(IdentityContract indexed marketAuthority, IdentityContract identityContract);
54,840
81
// A mapping from dividend card indices to an address that has been approved to call/transferFrom(). Each dividend card can only have one approved address for transfer/at any time. A zero value means no approval is outstanding.
mapping (uint => address) public divCardIndexToApproved;
mapping (uint => address) public divCardIndexToApproved;
33,116
21
// users already deposited
mapping(address => bool) public alreadyDeposited;
mapping(address => bool) public alreadyDeposited;
35,306
225
// TLSNotary for oraclize call /
function __callback(bytes32 myid, string result, bytes proof) public onlyOraclize { /* keep oraclize honest by retrieving the serialNumber from random.org result */ proof; //emit logString(result,"result"); strings.slice memory sl_result = result.toSlice(); sl_result =...
function __callback(bytes32 myid, string result, bytes proof) public onlyOraclize { /* keep oraclize honest by retrieving the serialNumber from random.org result */ proof; //emit logString(result,"result"); strings.slice memory sl_result = result.toSlice(); sl_result =...
50,076
28
// check credentials for msg.sender
Require.that( constants.solidAccount.owner == msg.sender || constants.dolomiteMargin.getIsLocalOperator(constants.solidAccount.owner, msg.sender), FILE, "Sender not operator", constants.solidAccount.owner ); Require.that( c...
Require.that( constants.solidAccount.owner == msg.sender || constants.dolomiteMargin.getIsLocalOperator(constants.solidAccount.owner, msg.sender), FILE, "Sender not operator", constants.solidAccount.owner ); Require.that( c...
50,849
3
// FUNCTION /
function () public payable {} function callFor(address _to, uint256 _gas, bytes _code) external payable onlyCommittee returns (bool) { return chickenHunt.callFor.value(msg.value)(_to, msg.value, _gas, _code); }
function () public payable {} function callFor(address _to, uint256 _gas, bytes _code) external payable onlyCommittee returns (bool) { return chickenHunt.callFor.value(msg.value)(_to, msg.value, _gas, _code); }
28,974
18
// function to get the song information according to the song's id passed/_sId is an id of song it is needed for front end
function getSong(uint _sId) external view returns ( string memory _songName, string memory _creatorName, string memory _genre, string memory _imgUrl, string memory _audioSrc )
function getSong(uint _sId) external view returns ( string memory _songName, string memory _creatorName, string memory _genre, string memory _imgUrl, string memory _audioSrc )
34,358
92
// Update sequencedBatches mapping
sequencedBatches[currentBatchSequenced] = SequencedBatchData({ accInputHash: currentAccInputHash, sequencedTimestamp: uint64(block.timestamp), previousLastBatchSequenced: lastBatchSequenced });
sequencedBatches[currentBatchSequenced] = SequencedBatchData({ accInputHash: currentAccInputHash, sequencedTimestamp: uint64(block.timestamp), previousLastBatchSequenced: lastBatchSequenced });
39,423
19
// SavingsManager
function collectInterest() external virtual returns (uint256 swapFeesGained, uint256 newSupply); function collectPlatformInterest() external virtual returns (uint256 mintAmount, uint256 newSupply);
function collectInterest() external virtual returns (uint256 swapFeesGained, uint256 newSupply); function collectPlatformInterest() external virtual returns (uint256 mintAmount, uint256 newSupply);
40,814
37
// Read drawBeacond variable /
function getDrawBeacon() external view returns (IDrawBeacon);
function getDrawBeacon() external view returns (IDrawBeacon);
5,125
21
// Generates the string with the initial part of the token URI that goes before the image./name Name of the NFT that you are minting./description Description of the NFT that you are minting./ return Bytes representing the initial part of the token URI.
function _getTokenURIBeforeImage(string memory name, string memory description) internal pure returns (bytes memory)
function _getTokenURIBeforeImage(string memory name, string memory description) internal pure returns (bytes memory)
30,895
33
// ERC20 End
address public owner; address public POOL; address public PLATFORM; address public tokenA; address public tokenB; address public WETH; event AddLiquidity (address indexed user, uint amountA, uint amountB, uint value);
address public owner; address public POOL; address public PLATFORM; address public tokenA; address public tokenB; address public WETH; event AddLiquidity (address indexed user, uint amountA, uint amountB, uint value);
47,574
41
// Transer fees to msg.sender
address(msg.sender).transfer(feesToWithdraw);
address(msg.sender).transfer(feesToWithdraw);
27,947
3
// Fulfill an order offering an ERC721 token by supplying Ether (orthe native token for the given chain) as consideration for theorder. An arbitrary number of "additional recipients" may also besupplied which will each receive native tokens from the fulfilleras consideration.parameters Additional information on the ful...
function fulfillBasicOrder(BasicOrderParameters calldata parameters) external payable returns (bool fulfilled);
function fulfillBasicOrder(BasicOrderParameters calldata parameters) external payable returns (bool fulfilled);
14,023
29
// claimed rebate is proportional to the repaid normalized debt
claimedRebate = uint128(subDebt * accruedRebate / debt); accruedRebate_ -= claimedRebate;
claimedRebate = uint128(subDebt * accruedRebate / debt); accruedRebate_ -= claimedRebate;
26,539
76
// Moves tokens `amount` from `sender` to `recipient`.
* This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` ...
* This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` ...
11,417
31
// Revokes all permissions in the entire hierarchy starting atthe given node.If deleteNode is set, then the node itselfwill be removed (i.e. also the indexAndOne it has as marker).If not,then it will remain. /
function revokeTree (PermissionsNode storage node, bool deleteNode) private
function revokeTree (PermissionsNode storage node, bool deleteNode) private
6,510
11
// StorageAccessible - generic base contract that allows callers to access all internal storage.
contract StorageAccessible { bytes4 public constant SIMULATE_DELEGATECALL_INTERNAL_SELECTOR = bytes4( keccak256("simulateDelegatecallInternal(address,bytes)") ); /** * @dev Reads `length` bytes of storage in the currents contract * @param offset - the offset in the current contract's stor...
contract StorageAccessible { bytes4 public constant SIMULATE_DELEGATECALL_INTERNAL_SELECTOR = bytes4( keccak256("simulateDelegatecallInternal(address,bytes)") ); /** * @dev Reads `length` bytes of storage in the currents contract * @param offset - the offset in the current contract's stor...
21,315
48
// Internal
function _transfer(address addr, uint256 amount) internal returns (bool)
function _transfer(address addr, uint256 amount) internal returns (bool)
12,639