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
28
// --------------------------- Withdrawal -------------------------- // Reverts when attempting to withdraw funds to a disallowed address /
error WithdrawRecipientInvalid();
error WithdrawRecipientInvalid();
15,114
23
// Increment the staker's amount staked
staker.amountStaked++;
staker.amountStaked++;
26,773
30
// Apply fill fraction to get offer item amount to transfer.
uint256 amount = _applyFraction( offerItem.startAmount, offerItem.endAmount, numerator, denominator, startTime, endTime, false ...
uint256 amount = _applyFraction( offerItem.startAmount, offerItem.endAmount, numerator, denominator, startTime, endTime, false ...
33,520
79
// Move the cash from the contract's cash balances account to the sender. This must happen before the call to insert the trade below in order for the free collateral check to work properly.
Escrow().withdrawFromMarket(account, CASH_GROUP, cash, fee);
Escrow().withdrawFromMarket(account, CASH_GROUP, cash, fee);
32,551
27
// Burn the canonical tokens
super._burn(msg.sender, token_amount);
super._burn(msg.sender, token_amount);
57,924
140
// debt ratio in same terms as reserve bonds return uint /
function standardizedDebtRatio() external view returns ( uint ) { return debtRatio().mul( uint( assetPrice() ) ).div( 1e8 ); // ETH feed is 8 decimals }
function standardizedDebtRatio() external view returns ( uint ) { return debtRatio().mul( uint( assetPrice() ) ).div( 1e8 ); // ETH feed is 8 decimals }
27,625
117
// Reverts if the auction is not complete. Auction is complete if there was a bid, and the time has run out.
modifier auctionComplete(uint256 tokenId) { require( // Auction is complete if there has been a bid, and the current time // is greater than the auction's end time. auctions[tokenId].firstBidTime > 0 && block.timestamp >= auctionEnds(tokenId), ...
modifier auctionComplete(uint256 tokenId) { require( // Auction is complete if there has been a bid, and the current time // is greater than the auction's end time. auctions[tokenId].firstBidTime > 0 && block.timestamp >= auctionEnds(tokenId), ...
25,357
351
// ManateezComic Extends ERC721 Non-Fungible Token Standard basic implementation /
contract ManateezComic is ERC721, Ownable { using SafeMath for uint256; uint256 public COMIC_PRICE = 0.01 ether; uint256 public TEAM_TOKEN_COUNT = 0; uint256 public constant TEAM_TOKEN_MAX = 500; uint256 public constant MAX_COMICS = 5000; uint256 constant public BASE_RATE = 5 ether; uint256...
contract ManateezComic is ERC721, Ownable { using SafeMath for uint256; uint256 public COMIC_PRICE = 0.01 ether; uint256 public TEAM_TOKEN_COUNT = 0; uint256 public constant TEAM_TOKEN_MAX = 500; uint256 public constant MAX_COMICS = 5000; uint256 constant public BASE_RATE = 5 ether; uint256...
7,693
5
// Mint tokens for each ids in _ids _to The address to mint tokens to _idsArray of ids to mint _amountsArray of amount of tokens to mint per id _dataData to pass if receiver is contract /
function _batchMint( address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data
function _batchMint( address _to, uint256[] memory _ids, uint256[] memory _amounts, bytes memory _data
29,644
126
// This function shows what the allowance is for a certain pair of addresses.
function allowance(address owner, address spender) external view override returns (uint256) { return wallets[owner].allowances[spender]; }
function allowance(address owner, address spender) external view override returns (uint256) { return wallets[owner].allowances[spender]; }
26,559
166
// Energy Gravitational
string public constant item225 = 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAM1BMVEUAAAAaI34oNZMwP585SasxG5JFJ6BRLahKFIxqG5pmCzyPeh6/uHaQilmIDk//9Z392DUxN+cPAAAAAXRSTlMAQObYZgAAAIFJREFUeAFiGAWAXshABWEYBqJelsRz067//7VaEcnknCCwB9AHKQ+4gwFs8smA718izxm7EV64X5s5/6gtoraBqla5qlqF0gu3WvursAgXOxQXSyoX68klX/sX/7g3OFfQjR...
string public constant item225 = 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAM1BMVEUAAAAaI34oNZMwP585SasxG5JFJ6BRLahKFIxqG5pmCzyPeh6/uHaQilmIDk//9Z392DUxN+cPAAAAAXRSTlMAQObYZgAAAIFJREFUeAFiGAWAXshABWEYBqJelsRz067//7VaEcnknCCwB9AHKQ+4gwFs8smA718izxm7EV64X5s5/6gtoraBqla5qlqF0gu3WvursAgXOxQXSyoX68klX/sX/7g3OFfQjR...
5,847
83
// external sales and private ico
return account == crowdsale || account == deferredKyc;
return account == crowdsale || account == deferredKyc;
36,561
6
// part_2 is 3 bytes 112 = 32 + 80(part_1)
mstore(add(txData, 112 ), mload(add(data, add(txDataOffset, 32))))
mstore(add(txData, 112 ), mload(add(data, add(txDataOffset, 32))))
27,593
51
// Price ceiling
uint256 public ceiling;
uint256 public ceiling;
49,813
7
// Returns the downcasted uint200 from uint256, reverting on overflow (when the input is greater than largest uint200). Counterpart to Solidity's `uint200` operator. Requirements: - input must fit into 200 bits _Available since v4.7._/
function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); }
function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); }
26,663
4
// Called by a freezer to mark an account as frozen account The account to be frozen /
function freeze(address account) public onlyFreezer { _frozen[account] = true; emit Freeze(account); }
function freeze(address account) public onlyFreezer { _frozen[account] = true; emit Freeze(account); }
33,277
13
// The USD/ETH UPDATE CHANGE RATE WITH CURRENT RATE WHEN DEPLOYING This value is given in USD CENTS
uint public usdPerEth = 1100 * 100;
uint public usdPerEth = 1100 * 100;
11,104
3
// ============ Constructor ============ //Set state variables_synthetixExchangerAddressAddress of Synthetix's Exchanger contract /
constructor(address _synthetixExchangerAddress) public { synthetixExchangerAddress = _synthetixExchangerAddress; }
constructor(address _synthetixExchangerAddress) public { synthetixExchangerAddress = _synthetixExchangerAddress; }
31,874
14
// The total amount of AION paid out (contract paid out)
uint public totalPaid;
uint public totalPaid;
11,921
10
// keeps track of the rent each user has paid for each card, for Safe mode payout
mapping(address => mapping(uint256 => uint256)) public override rentCollectedPerUserPerCard;
mapping(address => mapping(uint256 => uint256)) public override rentCollectedPerUserPerCard;
24,884
3
// Deposit funds into contract
function createBox(address _recipient, ERC20Interface _sendToken, uint _sendValue, ERC20Interface _requestToken, uint _requestValue, bytes32 _passHashHash) external payable
function createBox(address _recipient, ERC20Interface _sendToken, uint _sendValue, ERC20Interface _requestToken, uint _requestValue, bytes32 _passHashHash) external payable
56,271
206
// swap 4-byte long pairs
v = ((v & 0xFFFFFFFF00000000FFFFFFFF00000000) >> 32) | ((v & 0x00000000FFFFFFFF00000000FFFFFFFF) << 32);
v = ((v & 0xFFFFFFFF00000000FFFFFFFF00000000) >> 32) | ((v & 0x00000000FFFFFFFF00000000FFFFFFFF) << 32);
6,680
3
// Author : AAVE Function to calculate the interest using a compounded interest rate formulaTo avoid expensive exponentiation, the calculation is performed using a binomial approximation: (1+x)^n = 1+nx+[n/2(n-1)]x^2+[n/6(n-1)(n-2)x^3... The approximation slightly underpays liquidity providers and undercharges borrower...
) internal pure returns (uint256) { //solium-disable-next-line uint256 exp = currentTimestamp - lastUpdateTimestamp; if (exp == 0) { return WadRayMath.ray(); } uint256 expMinusOne = exp - 1; uint256 expMinusTwo = exp > 2 ? exp - 2 : 0; // loss of precision is endurable // sli...
) internal pure returns (uint256) { //solium-disable-next-line uint256 exp = currentTimestamp - lastUpdateTimestamp; if (exp == 0) { return WadRayMath.ray(); } uint256 expMinusOne = exp - 1; uint256 expMinusTwo = exp > 2 ? exp - 2 : 0; // loss of precision is endurable // sli...
3,172
104
// Utility; removes a prefix from a path. _path Path to remove the prefix from.return _unprefixedKey Unprefixed key. /
function _removeHexPrefix( bytes memory _path ) private pure returns ( bytes memory _unprefixedKey )
function _removeHexPrefix( bytes memory _path ) private pure returns ( bytes memory _unprefixedKey )
23,034
123
// the below allows for a consolidated handling of the necessary math to support the possible transfer+tax combinations
( uint256 reflectionsToDebit, // sender uint256 reflectionsToCredit, // recipient uint256 reflectionsToRemove, // to all the hodlers uint256 reflectionsForTreasury // to treasury ) = _getValues(amountOfTokens);
( uint256 reflectionsToDebit, // sender uint256 reflectionsToCredit, // recipient uint256 reflectionsToRemove, // to all the hodlers uint256 reflectionsForTreasury // to treasury ) = _getValues(amountOfTokens);
23,406
0
// IOriginsNFT Interface for OriginsNFT contract Amberfi /
interface IOriginsNFT { /** * @dev Mint NFT with ID `tokenId_` (called by MarketManager) * @param to_ (address) Mint to address * @param tokenId_ (uint256) Token ID to mint */ function mint(address to_, uint256 tokenId_) external; }
interface IOriginsNFT { /** * @dev Mint NFT with ID `tokenId_` (called by MarketManager) * @param to_ (address) Mint to address * @param tokenId_ (uint256) Token ID to mint */ function mint(address to_, uint256 tokenId_) external; }
35,019
27
// get the staking epoch
function _stakingEpochId(uint128 epochId) pure internal returns (uint128) { return epochId + EPOCHS_DELAYED_FROM_STAKING_CONTRACT; }
function _stakingEpochId(uint128 epochId) pure internal returns (uint128) { return epochId + EPOCHS_DELAYED_FROM_STAKING_CONTRACT; }
50,832
249
// ----------------- SETTERS ----------------- we put all together to save contract bytecode (!)
function setStrategyParams( uint16 _targetLTVMultiplier, uint16 _warningLTVMultiplier, uint256 _acceptableCostsRay, uint16 _aaveReferral, uint256 _maxTotalBorrowIT, bool _isWantIncentivised, bool _isInvestmentTokenIncentivised, bool _leaveDebtBehind, ...
function setStrategyParams( uint16 _targetLTVMultiplier, uint16 _warningLTVMultiplier, uint256 _acceptableCostsRay, uint16 _aaveReferral, uint256 _maxTotalBorrowIT, bool _isWantIncentivised, bool _isInvestmentTokenIncentivised, bool _leaveDebtBehind, ...
26,508
54
// Monthly transfer limit - hardcoded to 100,000
uint256 public constant MONTHLY_LIMIT = 100000 ether;
uint256 public constant MONTHLY_LIMIT = 100000 ether;
79,444
4
// Emitted when `tokenId` token is transferred from `from` to `to`. /
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
18,542
59
// Domain separator for EIP-712 signatures.
bytes32 internal _DOMAIN_SEPARATOR_;
bytes32 internal _DOMAIN_SEPARATOR_;
43,817
10
// Batch version of create function /
) external onlyGameContractOrOwner { require(initialSupply_.length > 0, "Args array can't be empty"); require(initialSupply_.length > 0 && initialSupply_.length == uri_.length, "Args length dont match"); uint256 id = nextId; uint256[] memory ids = new uint256[](initialSupply_.length...
) external onlyGameContractOrOwner { require(initialSupply_.length > 0, "Args array can't be empty"); require(initialSupply_.length > 0 && initialSupply_.length == uri_.length, "Args length dont match"); uint256 id = nextId; uint256[] memory ids = new uint256[](initialSupply_.length...
2,988
33
// Advisors & Mentors multisig wallet
address public _mentors = 0x589789B67aE612f47503E80ED14A18593C1C79BE;
address public _mentors = 0x589789B67aE612f47503E80ED14A18593C1C79BE;
14,815
9
// supposedly, send and transfer are discouraged since ether istanbul update
(bool sent,) = msg.sender.call{value: bnbToSend}("");
(bool sent,) = msg.sender.call{value: bnbToSend}("");
5,542
45
// result, user will get $skinsInBox skins
uint256[] memory selectedIds = new uint256[](skinsInBox); uint256[] memory amounts = new uint256[](skinsInBox); for (uint256 i = 0; i < skinsInBox; i++) {
uint256[] memory selectedIds = new uint256[](skinsInBox); uint256[] memory amounts = new uint256[](skinsInBox); for (uint256 i = 0; i < skinsInBox; i++) {
20,957
123
// "Consume a nonce": return the current value and increment. _Available since v4.1._ /
function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); }
function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); }
6,941
13
// if nothing is found we try at common rarity
if (rarirtyToPolliwogTraitIds[((_ageSexType * 10) + rarity)].length == 0) { rarity = 1; }
if (rarirtyToPolliwogTraitIds[((_ageSexType * 10) + rarity)].length == 0) { rarity = 1; }
25,347
45
// set a 1 ETH deposit limit until fully tested for security violations
require(_deposit <= 1 ether, 'deposit limit crossed');
require(_deposit <= 1 ether, 'deposit limit crossed');
6,438
2
// Move the last element to the index of array
_array[_index] = _array[_array.length - 1];
_array[_index] = _array[_array.length - 1];
35,214
71
// Adds a transaction that gets called for a downstream receiver of rebases destination Address of contract destination data Transaction data payload /
function addTransaction(address destination, bytes calldata data) external onlyOwner
function addTransaction(address destination, bytes calldata data) external onlyOwner
45,136
108
// address internal constant HelmetAddress = 0x948d2a81086A075b3130BAc19e4c6DEe1D2E3fE8;
address internal constant BurnAddress = 0x000000000000000000000000000000000000dEaD; uint private __lastUpdateTime3; // obsolete IERC20 private __rewardsToken3; // obsolete mapping(IERC20 => uint) public totalSupply3; ...
address internal constant BurnAddress = 0x000000000000000000000000000000000000dEaD; uint private __lastUpdateTime3; // obsolete IERC20 private __rewardsToken3; // obsolete mapping(IERC20 => uint) public totalSupply3; ...
65,820
321
// Allows the owner to withdraw tokens that have not been dripped yet./to The address to withdraw to/amount The amount to withdraw
function withdrawTo(address to, uint256 amount) external onlyOwner { drip(); uint256 assetTotalSupply = asset.balanceOf(address(this)); uint256 availableTotalSupply = assetTotalSupply.sub(totalUnclaimed); require(amount <= availableTotalSupply, "TokenFaucet/insufficient-funds"); asset.transfer(to,...
function withdrawTo(address to, uint256 amount) external onlyOwner { drip(); uint256 assetTotalSupply = asset.balanceOf(address(this)); uint256 availableTotalSupply = assetTotalSupply.sub(totalUnclaimed); require(amount <= availableTotalSupply, "TokenFaucet/insufficient-funds"); asset.transfer(to,...
36,057
72
// function to allow admin to claim other ERC20 tokens sent to this contract (by mistake) Admin cannot transfer out deposit tokens from this smart contract Admin can transfer out reward tokens from this address once adminClaimableTime has reached
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner { require(_tokenAddr != trustedDepositTokenAddress, "Admin cannot transfer out Deposit Tokens from this contract!"); require((_tokenAddr != trustedRewardTokenAddress) || (now > adminClaimableTime...
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner { require(_tokenAddr != trustedDepositTokenAddress, "Admin cannot transfer out Deposit Tokens from this contract!"); require((_tokenAddr != trustedRewardTokenAddress) || (now > adminClaimableTime...
53,574
0
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((len + 2) / 3);
uint256 encodedLen = 4 * ((len + 2) / 3);
13,904
1
// BToken error codes
bytes32 public constant BTOKEN_INVALID_DEPOSIT_ID = "300"; //"BToken: Invalid deposit ID!" bytes32 public constant BTOKEN_INVALID_BALANCE = "301"; //"BToken: Address balance should be always greater than the pool balance!" bytes32 public constant BTOKEN_INVALID_BURN_AMOUNT = "302"; //"BToken: The number of ...
bytes32 public constant BTOKEN_INVALID_DEPOSIT_ID = "300"; //"BToken: Invalid deposit ID!" bytes32 public constant BTOKEN_INVALID_BALANCE = "301"; //"BToken: Address balance should be always greater than the pool balance!" bytes32 public constant BTOKEN_INVALID_BURN_AMOUNT = "302"; //"BToken: The number of ...
25,884
30
// userDeposit-persentWithdraw-(userDeposit8/100)
uint withdrawalAmount = userDeposit[msg.sender].sub(persentWithdraw[msg.sender]).sub(userDeposit[msg.sender].mul(projectPercent).div(100));
uint withdrawalAmount = userDeposit[msg.sender].sub(persentWithdraw[msg.sender]).sub(userDeposit[msg.sender].mul(projectPercent).div(100));
16,293
2
// Track when a discount has been applied to an address.
mapping (address => bool) private discountsAppliedToAddresses; error WrongValue(); error BadID(); error NoAccess(); error SoldOut(); error NotEnoughCanto(); error WithdrawalFailed(); constructor(
mapping (address => bool) private discountsAppliedToAddresses; error WrongValue(); error BadID(); error NoAccess(); error SoldOut(); error NotEnoughCanto(); error WithdrawalFailed(); constructor(
14,053
8
// Cancel a specific order, marking it gone to disallow anyone to trade against it.
function cancel(Order memory ord) external nonReentrant { require(ord.maker == msg.sender, '!maker'); bytes32 mhash = makerSignHash(ord); require(!gone[mhash], '!gone'); gone[mhash] = true; }
function cancel(Order memory ord) external nonReentrant { require(ord.maker == msg.sender, '!maker'); bytes32 mhash = makerSignHash(ord); require(!gone[mhash], '!gone'); gone[mhash] = true; }
35,101
14
// coinbase => NTF Account map
mapping(address => Account) public account;
mapping(address => Account) public account;
9,896
345
// index of the gem within collection `source`
uint32 i = gem.index;
uint32 i = gem.index;
29,568
4
// Returns the total number of armies 부대의 총 개수를 반환합니다.
function getArmyCount() view external returns (uint);
function getArmyCount() view external returns (uint);
32,005
22
// Counter underflow is impossible as _burnCounter cannot be incremented more than `_currentIndex - _startTokenId()` times.
unchecked { return _currentIndex - _burnCounter - _startTokenId(); }
unchecked { return _currentIndex - _burnCounter - _startTokenId(); }
9,666
31
// air drop
if (offerInfo.offerAmount >= 1 finney) { airDropTracker_ = airDropTracker_ + FMAPMath.calcTrackerCount(offerInfo.offerAmount); if (airdrop() == true) { uint256 _airdrop = FMAPMath.calcAirDropAmount(offerInfo.offerAmount); players_[offerInfo.playerAddress]....
if (offerInfo.offerAmount >= 1 finney) { airDropTracker_ = airDropTracker_ + FMAPMath.calcTrackerCount(offerInfo.offerAmount); if (airdrop() == true) { uint256 _airdrop = FMAPMath.calcAirDropAmount(offerInfo.offerAmount); players_[offerInfo.playerAddress]....
52,007
17
// Returns if the NFT is owned(fractionalized) by this contract.return An bool representing whether the NFT is fractionalized by this contract /
function isRegistered(address token, uint256 tokenId) public view returns (bool) { return (_Ids[token][tokenId] != 0); }
function isRegistered(address token, uint256 tokenId) public view returns (bool) { return (_Ids[token][tokenId] != 0); }
46,954
37
// Call context callback level
uint8 appLevel;
uint8 appLevel;
10,386
73
// Mints `_amount` of tokens to the address `_to`/Allowed only for MasterManager/_to address to mint on it tokens/_amount amount of tokens to mint
function mint(address _to, uint256 _amount) external onlyRole(MASTER_MANAGER_ROLE)
function mint(address _to, uint256 _amount) external onlyRole(MASTER_MANAGER_ROLE)
2,712
7
// If x >= 2, then we compute the integer part of log2(x), which is larger than 0.
if (x >= FIXED_2) { uint8 count = floorLog2(x / FIXED_1); x >>= count; // now x < 2 res = count * FIXED_1; }
if (x >= FIXED_2) { uint8 count = floorLog2(x / FIXED_1); x >>= count; // now x < 2 res = count * FIXED_1; }
4,043
35
// Owner can allow a crowdsale contract to mint new tokens. /
function setMintAgent(address addr, bool state) onlyOwner canMint public { mintAgents[addr] = state; MintingAgentChanged(addr, state); }
function setMintAgent(address addr, bool state) onlyOwner canMint public { mintAgents[addr] = state; MintingAgentChanged(addr, state); }
42,197
169
// OVERRIDEremove account from white & create a snapshot of 0 balanceaccount address/
function removeWhitelisted(address account) public { super.removeWhitelisted(account); _createAccountSnapshot(account, 0); uint256 balance = balanceOf(account); uint256 newSupplyValue = totalSupplyAt(now).sub(balance); _createTotalSupplySnapshot(account, newSupplyValue); ...
function removeWhitelisted(address account) public { super.removeWhitelisted(account); _createAccountSnapshot(account, 0); uint256 balance = balanceOf(account); uint256 newSupplyValue = totalSupplyAt(now).sub(balance); _createTotalSupplySnapshot(account, newSupplyValue); ...
4,126
101
// limit access to the admin only /
modifier onlyAdmin() { require(msg.sender == admin); _; }
modifier onlyAdmin() { require(msg.sender == admin); _; }
44,721
98
// Transfer `value` attotokens from `from` to `to`./ Callable only by the relay contract.
function relayTransfer(address from, address to, uint256 value) external notPaused only(trustedRelayer) returns (bool)
function relayTransfer(address from, address to, uint256 value) external notPaused only(trustedRelayer) returns (bool)
42,180
8
// set mediaId
digitalAsset.mediaId = _mediaId; emit SetMediaId(msg.sender, _objectId, digitalAsset.mediaId);
digitalAsset.mediaId = _mediaId; emit SetMediaId(msg.sender, _objectId, digitalAsset.mediaId);
49,450
45
// Compute k = log2(x) - 96.
int256 k;
int256 k;
41,934
586
// If compounded deposit is less than a billionth of the initial deposit, return 0. NOTE: originally, this line was in place to stop rounding errors making the deposit too large. However, the error corrections should ensure the error in P "favors the Pool", i.e. any given compounded deposit should slightly less than it...
if (compoundedStake < initialStake.div(1e9)) {return 0;}
if (compoundedStake < initialStake.div(1e9)) {return 0;}
68,848
366
// onUpgrade(): called by previous ecliptic when upgradingin future ecliptics, this might perform more logic thanjust simple checks and verifications.when overriding this, make sure to call this original as well.
function onUpgrade() external
function onUpgrade() external
37,066
573
// lower debt cause burn
xtoken.lowerHasMinted(_childAmount);
xtoken.lowerHasMinted(_childAmount);
20,999
162
// Function to read the globalTokenSymbol field.
function globalTokenSymbol() external view returns(string memory);
function globalTokenSymbol() external view returns(string memory);
41,552
6
// constants injection
for (uint i=0; i<16; i++) { state[i] = state[i] ^ consts.injection_constants[index*16 + i]; }
for (uint i=0; i<16; i++) { state[i] = state[i] ^ consts.injection_constants[index*16 + i]; }
13,113
53
// ICO------------------------------------
if(now >= startICO && now < endICO){ tokenPrice = 7 ether; if(sum >= 151 ether){ tokenPrice = 40 * 100000000000000000; } else if(sum >= 66 ether){
if(now >= startICO && now < endICO){ tokenPrice = 7 ether; if(sum >= 151 ether){ tokenPrice = 40 * 100000000000000000; } else if(sum >= 66 ether){
16,655
30
// cancel offer2 and delete from outstandingPairsIDs as both orders are gone.
BathToken(bathQuoteAddress).cancel( outstandingPairIDs[x][1] );
BathToken(bathQuoteAddress).cancel( outstandingPairIDs[x][1] );
17,083
6,690
// 3347
entry "ophthalmoscopically" : ENG_ADVERB
entry "ophthalmoscopically" : ENG_ADVERB
24,183
0
// Indicates that the contract has been initialized. /
bool _initialized;
bool _initialized;
46,694
83
// Builds a prefixed hash to mimic the behavior of eth_sign.
function prefixed(bytes32 hash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); }
function prefixed(bytes32 hash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); }
31,273
282
// Imitates a Solidity high-level call (i.e. a regular function call to a contract),relaxing the requirement on the return value_contract The borrower contract that receives the approveRequest(bytes32) call _data The call data return success True if the call not revertsreturn result the result of the call /
function _safeCall( address _contract, bytes memory _data
function _safeCall( address _contract, bytes memory _data
25,645
128
// The users last claim time is updated with the current block timestamp.
lastClaimTime[account] = block.timestamp;
lastClaimTime[account] = block.timestamp;
31,419
372
// 4. Roll WBTC gained into want position
uint256 wbtcToDeposit = wbtcToken.balanceOf(address(this)); if (wbtcToDeposit > 0) { _add_liquidity_single_coin(curvePool.swap, want, wbtc, wbtcToDeposit, curvePool.wbtcPosition, curvePool.numElements, 0); uint256 wantGained = IERC20Upgradeable(want).balanceOf(address(this)).sub...
uint256 wbtcToDeposit = wbtcToken.balanceOf(address(this)); if (wbtcToDeposit > 0) { _add_liquidity_single_coin(curvePool.swap, want, wbtc, wbtcToDeposit, curvePool.wbtcPosition, curvePool.numElements, 0); uint256 wantGained = IERC20Upgradeable(want).balanceOf(address(this)).sub...
13,533
153
// Used for storing information about voting
struct VoteStateV1 { /// Taken from the DMG token implementation mapping(address => mapping(uint64 => Checkpoint)) ownerToCheckpointIndexToCheckpointMap; /// Taken from the DMG token implementation mapping(address => uint64) ownerToCheckpointCountMap; }
struct VoteStateV1 { /// Taken from the DMG token implementation mapping(address => mapping(uint64 => Checkpoint)) ownerToCheckpointIndexToCheckpointMap; /// Taken from the DMG token implementation mapping(address => uint64) ownerToCheckpointCountMap; }
6,217
1,085
// solhint-disable-next-line var-name-mixedcase
bytes32 private constant _CURRENCY_PERMIT_TYPEHASH = keccak256( "Permit(address currency,address spender,uint256 value,uint256 nonce,uint256 deadline)" ); /*/////////////////////////////////////////////////////////////// Events
bytes32 private constant _CURRENCY_PERMIT_TYPEHASH = keccak256( "Permit(address currency,address spender,uint256 value,uint256 nonce,uint256 deadline)" ); /*/////////////////////////////////////////////////////////////// Events
30,756
18
// Address where funds are collected
address public wallet;
address public wallet;
6,815
395
// Callback function /Called by the Chainlink oracle
function fulfill(bytes32 _requestId, uint256 result) public recordChainlinkFulfillment(_requestId)
function fulfill(bytes32 _requestId, uint256 result) public recordChainlinkFulfillment(_requestId)
12,194
214
// burn long option tokens from sender
_burn(holder, longTokenId, contractSize); if (exerciseValue > 0) { uint256 fee = _getFeeWithDiscount( holder, FEE_64x64.mulu(exerciseValue) ); totalFee += fee; _pushTo(holder, _getPoolToken(...
_burn(holder, longTokenId, contractSize); if (exerciseValue > 0) { uint256 fee = _getFeeWithDiscount( holder, FEE_64x64.mulu(exerciseValue) ); totalFee += fee; _pushTo(holder, _getPoolToken(...
48,329
103
// Logged when an operator is added or removed.
event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual; function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual; fun...
event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual; function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual; fun...
40,019
8
// The current amount of unsettled payouts distributed for the current bidding process
uint256 internal unsettledPayouts;
uint256 internal unsettledPayouts;
32,186
11
// privileged method to ban pool from submitting metadata.This does NOT affect the ability to manage the core Pool contract. pool address of pool to ban /
function ban(address pool) external { requireController(); banned[pool] = true; emit Banned(pool, true); }
function ban(address pool) external { requireController(); banned[pool] = true; emit Banned(pool, true); }
999
437
// Get whether a decrease request has been initiated for service provider _serviceProvider - address of service providerreturn Boolean of whether decrease request has been initiated /
function _decreaseRequestIsPending(address _serviceProvider) internal view returns (bool)
function _decreaseRequestIsPending(address _serviceProvider) internal view returns (bool)
38,514
52
// prize The prize to transfer. recipient The recipient of the prize. multiplier The multiplier to apply to the prize amount. /
function _transferPrize( Prize storage prize, address recipient, uint256 multiplier
function _transferPrize( Prize storage prize, address recipient, uint256 multiplier
40,822
183
// Info of total amount of staked LP tokens by all users
mapping (address => uint256) public totalStaked; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); event Treasury(...
mapping (address => uint256) public totalStaked; event Deposit(address indexed user, uint256 indexed pid, uint256 amount); event Withdraw(address indexed user, uint256 indexed pid, uint256 amount); event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount); event Treasury(...
48,174
13
// The total number of tokens in circulation /
function totalSupply() public view returns (uint8) { return _totalSupply; }
function totalSupply() public view returns (uint8) { return _totalSupply; }
2,507
4
// OPTIMAL RETAILERORDER QUANTITY
struct OptimalRetailOrder { address retailorordereraddress; bytes32 retailerordername; bytes32 retailerorderrole; uint optimalretailordervalue; uint optimalretailorordercount; mapping (address => OptimalRetailOrder[1000]) optimalretailordercollection...
struct OptimalRetailOrder { address retailorordereraddress; bytes32 retailerordername; bytes32 retailerorderrole; uint optimalretailordervalue; uint optimalretailorordercount; mapping (address => OptimalRetailOrder[1000]) optimalretailordercollection...
34,863
45
// deposit LP token function for msgSender _amount the total deposit amount /
function deposit(uint256 _amount) public { address msgSender = _msgSender(); UserInfo storage user = userInfo[msgSender]; updatePool(); if (user.amount > 0) { uint256 pending = user.amount.mul(farmInfo.accRewardPerShare).div(1e12).sub(user.rewardDebt); safeRewardTransfer(msgSender, pending...
function deposit(uint256 _amount) public { address msgSender = _msgSender(); UserInfo storage user = userInfo[msgSender]; updatePool(); if (user.amount > 0) { uint256 pending = user.amount.mul(farmInfo.accRewardPerShare).div(1e12).sub(user.rewardDebt); safeRewardTransfer(msgSender, pending...
19,387
15
// Register a contract.This can only be called from an account that is part of the nsadmins group/_key the bytestring of the contract name/_contract the address of the contract/ return _success if the operation is successful
function register_contract(bytes32 _key, address _contract) if_group("nsadmins") if_owner_origin() if_not_locked() locked_after_period() unless_registered(_key) public returns (bool _success)
function register_contract(bytes32 _key, address _contract) if_group("nsadmins") if_owner_origin() if_not_locked() locked_after_period() unless_registered(_key) public returns (bool _success)
10,233
332
// 1st order derivative
{
{
19,941
15
// encode adapterParams to specify more gas for the destination
uint16 version = 1; bytes memory adapterParams = abi.encodePacked( version , gasForDestinationLzReceive);
uint16 version = 1; bytes memory adapterParams = abi.encodePacked( version , gasForDestinationLzReceive);
18,432
11
// check the unhappy case
function testFailGreeting() public { greeter.greet("yo"); require(keccak256(abi.encodePacked(greeter.greeting())) == keccak256(abi.encodePacked("hi")), "not equal to `hi`"); }
function testFailGreeting() public { greeter.greet("yo"); require(keccak256(abi.encodePacked(greeter.greeting())) == keccak256(abi.encodePacked("hi")), "not equal to `hi`"); }
16,453
15
// string memory c1 = string(abi.encodePacked('hsl(', toString(tokenId), ', 45%', '80%'));
string memory suffix = ', 45%, 80%)'; if(index == 0) { suffix = ', 75%, 40%)'; }
string memory suffix = ', 45%, 80%)'; if(index == 0) { suffix = ', 75%, 40%)'; }
3,663
0
// hash code: 0x12 (SHA-2) and digest length: 0x20 (32 bytes / 256 bits)
bytes2 public constant MULTIHASH_PREFIX = 0x1220;
bytes2 public constant MULTIHASH_PREFIX = 0x1220;
45,371
65
// Interface of the ERC20 standard as defined in the EIP. /
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @de...
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @de...
147
116
// Checks it's a valid node
Validator val = Validator(validator); require(stakeManager_.getValidatorContract(val.validatorId()) == validator && !val.locked(), "CO10"); newPoints += points[i]; activeNodes.push(newCountNodes); stakingNodes[newCountNodes] = StakingNode(newCountNodes, valid...
Validator val = Validator(validator); require(stakeManager_.getValidatorContract(val.validatorId()) == validator && !val.locked(), "CO10"); newPoints += points[i]; activeNodes.push(newCountNodes); stakingNodes[newCountNodes] = StakingNode(newCountNodes, valid...
34,119
29
// UUPS proxy function
function _authorizeUpgrade(address) internal override onlyOwner {} function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external view override returns (bytes4) { from; tokenId; data; // supress solidity war...
function _authorizeUpgrade(address) internal override onlyOwner {} function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external view override returns (bytes4) { from; tokenId; data; // supress solidity war...
41,989
32
// Si el usuario debe
if (debtUser>0){
if (debtUser>0){
4,672