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
240
// Finalizes Token sale and launches LP.return liquidity Number of LPs. /
function finalize() external nonReentrant returns (uint256 liquidity) { // GP: Can we remove admin, let anyone can finalise and launch? // require(hasAdminRole(msg.sender) || hasOperatorRole(msg.sender), "PostAuction: Sender must be operator"); require(marketConnected(), "PostAuction: Auctio...
function finalize() external nonReentrant returns (uint256 liquidity) { // GP: Can we remove admin, let anyone can finalise and launch? // require(hasAdminRole(msg.sender) || hasOperatorRole(msg.sender), "PostAuction: Sender must be operator"); require(marketConnected(), "PostAuction: Auctio...
48,865
4
// Called in `createAccount`. Initializes the account contract created in `createAccount`.
function _initializeAccount( address _account, address _admin, bytes calldata _data
function _initializeAccount( address _account, address _admin, bytes calldata _data
27,100
5
// globally and across all auctions, the amount by which a bid has to increase
uint256 public minBidIncrement;
uint256 public minBidIncrement;
27,948
11
// Index subscribed eventtoken Super token addresspublisher Index publisherindexId The specified indexIdsubscriber The approved subscriberuserData The user provided data/
event IndexSubscribed(
event IndexSubscribed(
21,937
1
// Function to return list of all StakeHolders return returns the list/
function append(string memory _method, string memory _contractName) pure internal returns(string memory m) { return string(abi.encodePacked(_method, _contractName)); }
function append(string memory _method, string memory _contractName) pure internal returns(string memory m) { return string(abi.encodePacked(_method, _contractName)); }
22,641
24
// The new version of the validator set
address[] memory _newValidators, uint256[] memory _newPowers, uint256 _newValsetNonce,
address[] memory _newValidators, uint256[] memory _newPowers, uint256 _newValsetNonce,
40,135
69
// set reward ratecallable by admin /
function setRewardRate(uint256 _rewardRate) external onlyAdmin { require(_rewardRate <= TOTAL_RATE, "rewardRate cannot be more than 100%"); rewardRate = _rewardRate; treasuryRate = TOTAL_RATE.sub(_rewardRate); emit RatesUpdated(currentEpoch, rewardRate, treasuryRate); }
function setRewardRate(uint256 _rewardRate) external onlyAdmin { require(_rewardRate <= TOTAL_RATE, "rewardRate cannot be more than 100%"); rewardRate = _rewardRate; treasuryRate = TOTAL_RATE.sub(_rewardRate); emit RatesUpdated(currentEpoch, rewardRate, treasuryRate); }
38,649
22
// Destroy tokens from other account 蒸发别人的tokenRemove `_value` tokens from the system irreversibly on behalf of `_from`._from the address of the sender _value the amount of money to burn /
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // 检查别人的余额是否充足 Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // 检查限额是否充足 Check allowance balanceOf[_from] -= _va...
function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // 检查别人的余额是否充足 Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // 检查限额是否充足 Check allowance balanceOf[_from] -= _va...
37,019
15
// withdraw all x ERC20 tokens
IERC20(Token1).transfer(msg.sender, IERC20(Token1).balanceOf(address(this))); IERC20(Token2).transfer(msg.sender, IERC20(Token2).balanceOf(address(this)));
IERC20(Token1).transfer(msg.sender, IERC20(Token1).balanceOf(address(this))); IERC20(Token2).transfer(msg.sender, IERC20(Token2).balanceOf(address(this)));
30,461
15
// TODO: Is there a more gas efficient way than looping through this again and checking same condition
uint256 currentId = activeDepositIds[i]; if (_isUpkeepEligible(currentId)) { RecipientInfo storage currentrecipientInfo = recipientInfo[currentId]; currentrecipientInfo.lastUpkeepTimestamp = uint128(block.timestamp); currentrecipientInfo.unclaime...
uint256 currentId = activeDepositIds[i]; if (_isUpkeepEligible(currentId)) { RecipientInfo storage currentrecipientInfo = recipientInfo[currentId]; currentrecipientInfo.lastUpkeepTimestamp = uint128(block.timestamp); currentrecipientInfo.unclaime...
30,516
74
// ERC721 Non-Fungible Token Standard basic implementation /
contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic { using SafeMath for uint256; using AddressUtils for address; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` bytes4 privat...
contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic { using SafeMath for uint256; using AddressUtils for address; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `ERC721Receiver(0).onERC721Received.selector` bytes4 privat...
8,080
18
// Abort if capacity on participants was reached
if (cn == n) { curPhase = Phase.Commit; emit PhaseChange(Phase.Commit); }
if (cn == n) { curPhase = Phase.Commit; emit PhaseChange(Phase.Commit); }
18,679
1
// The amount of rewards earmarked for this user, but not yet collected.
uint256 pendingReward;
uint256 pendingReward;
25,153
31
// get user's remaining shares after fee
uint256 remainingUserAmount = _amount.sub(stakingFeeAmount); if(stakingFeeAmount > 0){
uint256 remainingUserAmount = _amount.sub(stakingFeeAmount); if(stakingFeeAmount > 0){
14,478
3
// Fee Set
uint public constant MANAGER_MIN_FEE = 0; uint public constant MANAGER_MAX_FEE = BONE / 10; uint public constant ISSUE_MIN_FEE = BONE / 1000; uint public constant ISSUE_MAX_FEE = BONE / 10; uint public constant REDEEM_MIN_FEE = 0; uint public constant REDEEM_MAX_FEE = BONE / 10; uint public ...
uint public constant MANAGER_MIN_FEE = 0; uint public constant MANAGER_MAX_FEE = BONE / 10; uint public constant ISSUE_MIN_FEE = BONE / 1000; uint public constant ISSUE_MAX_FEE = BONE / 10; uint public constant REDEEM_MIN_FEE = 0; uint public constant REDEEM_MAX_FEE = BONE / 10; uint public ...
9,268
6
// return The ongoing trade for a sell token, or the zero address
function trades(IERC20 sell) external view returns (ITrade);
function trades(IERC20 sell) external view returns (ITrade);
45,951
92
// Note: while the call failed, the nonce will still be incremented, which will invalidate all supplied signatures.
emit CallFailure(actionID, nonce, to, data, _decodeRevertReason(returnData));
emit CallFailure(actionID, nonce, to, data, _decodeRevertReason(returnData));
43,520
9
// Enable or disable lock_locked Status./
function lockSupply(bool _locked) onlyAdmin public { locked = _locked; LockedSupply(locked); }
function lockSupply(bool _locked) onlyAdmin public { locked = _locked; LockedSupply(locked); }
54,414
5
// minimum amount of token to hold to exclude fee
uint256 public discountMinimumAmount; event Fee(address token, uint256 amount); constructor( address _factoryV2, address factoryV3, address _positionManager, address _WETH9, address _flush
uint256 public discountMinimumAmount; event Fee(address token, uint256 amount); constructor( address _factoryV2, address factoryV3, address _positionManager, address _WETH9, address _flush
19,930
214
// Get last bid amount
uint256 _lastBid = (getBidCount(tokenId_) == 0) ? saleData[tokenId_].startPrice - 1 : auctionBids[tokenId_][getBidCount(tokenId_) - 1].amount; require( bidPrice_ > _lastBid && IERC20(saleData[tokenId_].token).allowance(msg....
uint256 _lastBid = (getBidCount(tokenId_) == 0) ? saleData[tokenId_].startPrice - 1 : auctionBids[tokenId_][getBidCount(tokenId_) - 1].amount; require( bidPrice_ > _lastBid && IERC20(saleData[tokenId_].token).allowance(msg....
40,328
22
// calling the transfer function of the base contract
super.transfer(to, tokens); // same as Cryptos.transfer(to, tokens); return true;
super.transfer(to, tokens); // same as Cryptos.transfer(to, tokens); return true;
16,143
121
// Increment the balance of `to`.
{ mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x1c) let toBalanceSlotPacked := add(sload(toBalanceSlot), 1) if iszero(and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE)) { mstore(0x00, 0x01336cea) // `AccountBalanceOve...
{ mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x1c) let toBalanceSlotPacked := add(sload(toBalanceSlot), 1) if iszero(and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE)) { mstore(0x00, 0x01336cea) // `AccountBalanceOve...
21,881
90
// honeyMint: Function to mint a specified number of bee NFTs for whitelisted users during the honeylist sale. Ensures that the sender is not a contract, the mint has started, and the transaction is authorized by checking the provided signature and custom data hash._amount uint16 - The number of bee NFTs to mint. _sign...
function honeyMint( uint16 _amount, bytes calldata _signature ) external payable beeCallerOnly // Ensures that the sender is not a contract maxHoneycombSupplyMint(_amount) // Ensures that the mint has started and the transaction doesn't exceed limits hiveB...
function honeyMint( uint16 _amount, bytes calldata _signature ) external payable beeCallerOnly // Ensures that the sender is not a contract maxHoneycombSupplyMint(_amount) // Ensures that the mint has started and the transaction doesn't exceed limits hiveB...
28,412
106
// Returns the current balance. Ignores COMP that was not liquidated and invested./
function investedUnderlyingBalance() public view returns (uint256) { // NOTE: The use of virtual price is okay for appreciating assets inside IDLE, // but would be wrong and exploitable if funds were lost by IDLE, indicated by // the virtualPrice being greater than the token price. if (protected) { ...
function investedUnderlyingBalance() public view returns (uint256) { // NOTE: The use of virtual price is okay for appreciating assets inside IDLE, // but would be wrong and exploitable if funds were lost by IDLE, indicated by // the virtualPrice being greater than the token price. if (protected) { ...
5,792
35
// MUTUAL UPGRADE & EMERGENCY ONLY: Replaces a module the operator has removed with`emergencyRemoveProtectedModule`. Operator and Methodologist must each call this function to execute the update. > Adds new module to SetToken.> Marks `_newModule` as protected and authorizes new extensions for it.> Adds `_newModule` to ...
function emergencyReplaceProtectedModule( address _module, address[] memory _extensions ) external mutualUpgrade(operator, methodologist) onlyEmergency
function emergencyReplaceProtectedModule( address _module, address[] memory _extensions ) external mutualUpgrade(operator, methodologist) onlyEmergency
45,562
22
// To get the rewards per block.
function sdaoPerBlock(uint256 _pid) public view returns (uint256 amount) { PoolInfo memory pool = poolInfo[_pid]; amount = pool.tokenPerBlock; }
function sdaoPerBlock(uint256 _pid) public view returns (uint256 amount) { PoolInfo memory pool = poolInfo[_pid]; amount = pool.tokenPerBlock; }
1,195
340
// write slot `i / 8`
sstore(add(loc, div(i, 8)), v256)
sstore(add(loc, div(i, 8)), v256)
50,534
57
// bot fees
if(botWallets[from] == true||botWallets[to]==true){ revert("No bots can trade"); }
if(botWallets[from] == true||botWallets[to]==true){ revert("No bots can trade"); }
36,223
21
// only recompute funding when market has positions, this check is important for initial setup
market.recomputeFunding();
market.recomputeFunding();
6,464
2
// Returns the addition of two unsigned integers, reverting on overflow. /
function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; require(c >= a, "StableMath: addition overflow"); }
function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; require(c >= a, "StableMath: addition overflow"); }
24,278
25
// Checks if a voter has already voted. _voterAddress The address of the voter.return Voted True if the voter has voted, false otherwise. /
function hasVoted(address _voterAddress) public view returns (bool Voted) { return voters[_voterAddress].hasVoted; }
function hasVoted(address _voterAddress) public view returns (bool Voted) { return voters[_voterAddress].hasVoted; }
17,738
244
// Set the quantity of tokens necessary for vault access creation newdeposit deposit (in tokens) for vault access creation /
function setVaultDeposit (uint newdeposit) public onlyOwner
function setVaultDeposit (uint newdeposit) public onlyOwner
13,452
40
// Used to prevent overflow when converting decimal places to decimal precision values via 10decimalPlaces. This is a safe value for int256 and uint256 variables. We apply this constraint when storing decimal places in governance.
uint256 internal constant MAX_DECIMAL_PLACES = 36;
uint256 internal constant MAX_DECIMAL_PLACES = 36;
29,030
15
// E8
function creamWithdraw_crFRAX(uint256 crFRAX_amount) public onlyByOwnGovCust { require(crFRAX.redeem(crFRAX_amount) == 0, 'Redeem failed'); }
function creamWithdraw_crFRAX(uint256 crFRAX_amount) public onlyByOwnGovCust { require(crFRAX.redeem(crFRAX_amount) == 0, 'Redeem failed'); }
29,333
78
// Calculate the Coins required for lock by Relayer based on requested license
uint256 requiredAmount = getFundRequiredForRelayer( maxUsers, maxCoins, maxTxThroughput );
uint256 requiredAmount = getFundRequiredForRelayer( maxUsers, maxCoins, maxTxThroughput );
45,204
68
// get stake
function stakeOf(address _stakeholder) public view returns (uint256) { return stakes[_stakeholder].amount; }
function stakeOf(address _stakeholder) public view returns (uint256) { return stakes[_stakeholder].amount; }
5,133
52
// Error if the account does not have the deployer role//account address to check
function onlyDeployer(address account) external view
function onlyDeployer(address account) external view
35,246
24
// Shift in bits from prod1 into prod0
prod0 |= prod1 * lpotdod;
prod0 |= prod1 * lpotdod;
9,924
23
// (dxy0 - dyx0p) / (1 - dyfee)
uint256 invertedPriceX96 = FullMath.mulDiv(Q96, Q96, priceX96); amountIn = FullMath.mulDiv( FullMath.mulDiv(currentAmounts[1], targetRatioOfToken0X96, Q96) - FullMath.mulDiv(targetRatioOfToken1X96, currentAmounts[0], invertedPriceX96), Q96, ...
uint256 invertedPriceX96 = FullMath.mulDiv(Q96, Q96, priceX96); amountIn = FullMath.mulDiv( FullMath.mulDiv(currentAmounts[1], targetRatioOfToken0X96, Q96) - FullMath.mulDiv(targetRatioOfToken1X96, currentAmounts[0], invertedPriceX96), Q96, ...
17,464
110
// Deprecated, use {ERC721-_burn} instead. owner owner of the token to burn tokenId uint256 ID of the token being burned /
function _burn(address owner, uint256 tokenId) internal { super._burn(owner, tokenId); _removeTokenFromOwnerEnumeration(owner, tokenId);
function _burn(address owner, uint256 tokenId) internal { super._burn(owner, tokenId); _removeTokenFromOwnerEnumeration(owner, tokenId);
11,479
188
// get the total liquidity of this pool
uint256 totalPoolLiquidity = totalActiveLiquidity.add(totalAvailableLiquidity);
uint256 totalPoolLiquidity = totalActiveLiquidity.add(totalAvailableLiquidity);
57,809
178
// by either {approve} or {setApprovalForAll}.- If `to` refers to a smart contract, it must implement{IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event. /
function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(lock[tokenId] != true, "token have been locked!"); transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, to...
function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(lock[tokenId] != true, "token have been locked!"); transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, to...
32,873
21
// Method for getting Max Supply for Token This method is for getting the Max Supply by token id _id The token id /
function maxSupply(uint256 _id) public pure returns (uint256 _maxSupply) { _maxSupply = 0; if ((_id == 1) || (_id == 5) || (_id == 9)) { _maxSupply = uint256(645); } else if ((_id == 2) || (_id == 6) || (_id == 10)) { _maxSupply = uint256(1263); } else if ((_id ==...
function maxSupply(uint256 _id) public pure returns (uint256 _maxSupply) { _maxSupply = 0; if ((_id == 1) || (_id == 5) || (_id == 9)) { _maxSupply = uint256(645); } else if ((_id == 2) || (_id == 6) || (_id == 10)) { _maxSupply = uint256(1263); } else if ((_id ==...
11,519
192
// removes minter role from an address. _address The address will be removed. /
function removeMinter(address _address) public
function removeMinter(address _address) public
40,934
67
// Add a team grant for tokens with a vesting schedule _receiver Grant receiver _amount Amount of tokens included in the grant _timeToCliff Seconds until the vesting cliff _vestingDuration Seconds starting from the vesting cliff until the end of the vesting schedule /
function addTeamGrant( address _receiver, uint256 _amount, uint256 _timeToCliff, uint256 _vestingDuration ) external onlyOwner atStage(Stages.GenesisStart)
function addTeamGrant( address _receiver, uint256 _amount, uint256 _timeToCliff, uint256 _vestingDuration ) external onlyOwner atStage(Stages.GenesisStart)
42,346
257
// @inheritdocIERC2981Royalties
function royaltyInfo(uint256, uint256 value) external view override returns (address receiver, uint256 royaltyAmount)
function royaltyInfo(uint256, uint256 value) external view override returns (address receiver, uint256 royaltyAmount)
13,712
43
// Reverts if `msg.sender` is not authorized to fulfill requests /
modifier onlyAuthorizedNode() { require(authorizedNodes[msg.sender] || msg.sender == owner, "Not an authorized node to fulfill requests"); _; }
modifier onlyAuthorizedNode() { require(authorizedNodes[msg.sender] || msg.sender == owner, "Not an authorized node to fulfill requests"); _; }
12,585
571
// -- Admins --/Sets the max time deposits have to wait before becoming withdrawable./newValue The new value./ returnThe old value.
function setMaxAgeDepositUntilWithdrawable( uint32 newValue ) external virtual returns (uint32);
function setMaxAgeDepositUntilWithdrawable( uint32 newValue ) external virtual returns (uint32);
29,274
23
// decrease total amount signaled by holder for all deposits by the holders signaled amount of the deposit
totalAmountSignaledByHolder[payee] = totalAmountSignaledByHolder[payee].sub(deposit.signaledAmounts[payee]); if (claim > 0) { require( IERC20(deposit.token).transfer(payee, claim), "Deposit.transferDeposit: TRANSFER_FAILED" ); }
totalAmountSignaledByHolder[payee] = totalAmountSignaledByHolder[payee].sub(deposit.signaledAmounts[payee]); if (claim > 0) { require( IERC20(deposit.token).transfer(payee, claim), "Deposit.transferDeposit: TRANSFER_FAILED" ); }
49,647
258
// Cancel Auction Admin can cancel the auction before it starts /
function cancelAuction() public nonReentrant
function cancelAuction() public nonReentrant
14,506
4
// Transform so that e^x -> 2^x
(uint lower, uint upper) = pow2Bounds(x * int(ONE) / int(LN2)); return (upper - lower) / 2 + lower;
(uint lower, uint upper) = pow2Bounds(x * int(ONE) / int(LN2)); return (upper - lower) / 2 + lower;
29,695
18
// To change the claim start time by the owner _claimStart new claim start time /
function changeClaimStart( uint256 _claimStart
function changeClaimStart( uint256 _claimStart
3,237
87
// The actual balance could be greater than totalBalances[token] because anyone can send tokens to the contract's address which cannot be accounted for
assert(TokenInteract.balanceOf(token, address(this)) >= totalBalances[token]);
assert(TokenInteract.balanceOf(token, address(this)) >= totalBalances[token]);
72,206
80
// Compute percentage of a value with the percentage represented by a fraction over PERC_DIVISOR _amount Amount to take the percentage of _fracNum Numerator of fraction representing the percentage with PERC_DIVISOR as the denominator /
function percOf(uint256 _amount, uint256 _fracNum) internal pure returns (uint256) { return _amount.mul(_fracNum).div(PERC_DIVISOR); }
function percOf(uint256 _amount, uint256 _fracNum) internal pure returns (uint256) { return _amount.mul(_fracNum).div(PERC_DIVISOR); }
40,258
5
// Used to allow other wallets to manage the KYC/Only callable by Perpetual Altruism/Other operators/_operator The address of the operator/_operating If the operator is allowed to operate
function setOperator(address _operator, bool _operating) external restrictedToOperators(){ authorizedOperators[_operator] = _operating; }
function setOperator(address _operator, bool _operating) external restrictedToOperators(){ authorizedOperators[_operator] = _operating; }
32,263
88
// Checks if the given withdrawal credentials are a valid 0x01 prefixed withdrawal address./See also/ https:github.com/ethereum/consensus-specs/blob/master/specs/phase0/validator.mdeth1_address_withdrawal_prefix
function _requireProtocolWithdrawalAccount(bytes calldata withdrawalCredentials) internal view { if (withdrawalCredentials.length != 32) { revert InvalidWithdrawalCredentialsWrongLength(withdrawalCredentials.length); } // Check the ETH1_ADDRESS_WITHDRAWAL_PREFIX and that all oth...
function _requireProtocolWithdrawalAccount(bytes calldata withdrawalCredentials) internal view { if (withdrawalCredentials.length != 32) { revert InvalidWithdrawalCredentialsWrongLength(withdrawalCredentials.length); } // Check the ETH1_ADDRESS_WITHDRAWAL_PREFIX and that all oth...
32,773
4
// /
function name() public pure returns (string memory) { return "InternetAccess"; }
function name() public pure returns (string memory) { return "InternetAccess"; }
4,517
9
// base uri that points to IPFS
string public baseURI = "https://hodlpigs.com/public/pig/";
string public baseURI = "https://hodlpigs.com/public/pig/";
50,107
24
// Enums Stage Status /
enum Stages { Deployed, SetUp, Started, Ended }
enum Stages { Deployed, SetUp, Started, Ended }
75,460
27
// ECDSA Address
using ECDSA for address; address public sam; address public samx; bool public pause;
using ECDSA for address; address public sam; address public samx; bool public pause;
45,663
22
// modified to continue distribution from 0x26FBb0FF7589A43C7d4B2Ff9A68A0519c474156c
startBlock = block.number;
startBlock = block.number;
27,261
8
// ===================public variables definition start==================
string public name; //Name of your Token string public symbol; //Symbol of your Token uint8 public decimals = 18; //Decimals of your Token uint256 public totalSupply; //Maximum amount of Token supplies
string public name; //Name of your Token string public symbol; //Symbol of your Token uint8 public decimals = 18; //Decimals of your Token uint256 public totalSupply; //Maximum amount of Token supplies
17,898
135
// Called by a pauser to pause, triggers stopped state. /
function pause() public onlyPauser whenNotPaused { _paused = true; emit Paused(_msgSender()); }
function pause() public onlyPauser whenNotPaused { _paused = true; emit Paused(_msgSender()); }
39,941
4
// deploys a proxy for ClearingHouse, and initialize it as well
clearingHouse = _deployProxyForClearingHouseAndInitialize( ClearingHouseDeployer.DeployClearingHouseParams( clearingHouseLogicAddress, settlementToken, settlementTokenOracle, insuranceFund, vQuote ) )...
clearingHouse = _deployProxyForClearingHouseAndInitialize( ClearingHouseDeployer.DeployClearingHouseParams( clearingHouseLogicAddress, settlementToken, settlementTokenOracle, insuranceFund, vQuote ) )...
44,548
106
// If the recommender can get reward
bool isRecommendOpen;
bool isRecommendOpen;
30,448
197
// Returns the downcasted int128 from int256, reverting onoverflow (when the input is less than smallest int128 orgreater than largest int128). Counterpart to Solidity's `int128` operator. Requirements: - input must fit into 128 bits _Available since v3.1._ /
function toInt128(int256 value) internal pure returns (int128) { require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits"); return int128(value); }
function toInt128(int256 value) internal pure returns (int128) { require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits"); return int128(value); }
2,901
3
// Mint Supply
uint256 public lastMint = 8000; uint256 public claimed = 0; bool public restricted = true; // Restrict claim to loot owners by default
uint256 public lastMint = 8000; uint256 public claimed = 0; bool public restricted = true; // Restrict claim to loot owners by default
3,968
2
// Address of EUR Price feed module. /
address public eurPriceFeed;
address public eurPriceFeed;
29,701
253
// return The target ETH balance of the gas account
function getGasAccountTargetEthBalance() external view returns (uint256);
function getGasAccountTargetEthBalance() external view returns (uint256);
22,640
101
// Destroys `amount` tokens from `account`.`amount` is then deductedfrom the caller's allowance.
* See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve( account, _msgSender(), _allowances[account][_msgSender()].sub(amount, 'BEP20: burn amount exceeds allowance') ); ...
* See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve( account, _msgSender(), _allowances[account][_msgSender()].sub(amount, 'BEP20: burn amount exceeds allowance') ); ...
9,332
58
// Verify claim validity. If not valid, revert. when there's allowlist present --> verifyClaimMerkleProof will verify the _proofMaxQuantityPerTransaction value with hashed leaf in the allowlist when there's no allowlist, this check is true --> verifyClaim will check for _quantity being less/equal than the limit
bool toVerifyMaxQuantityPerTransaction = _proofMaxQuantityPerTransaction == 0 || claimCondition.phases[activeConditionId].merkleRoot == bytes32(0); verifyClaim( activeConditionId, _msgSender(), _quantity, _currency, _pricePerToken, ...
bool toVerifyMaxQuantityPerTransaction = _proofMaxQuantityPerTransaction == 0 || claimCondition.phases[activeConditionId].merkleRoot == bytes32(0); verifyClaim( activeConditionId, _msgSender(), _quantity, _currency, _pricePerToken, ...
52,283
0
// https:github.com/ethereum/EIPs/issues/20
interface ethereum { function totalSupply() external view returns (uint supply); function balanceOf(address _owner) external view returns (uint balance); function transfer(address _to, uint _value) external returns (bool success); function transferFrom(address _from, address _to, uint _value) external r...
interface ethereum { function totalSupply() external view returns (uint supply); function balanceOf(address _owner) external view returns (uint balance); function transfer(address _to, uint _value) external returns (bool success); function transferFrom(address _from, address _to, uint _value) external r...
29,905
20
// xSUSHI voting power is the users SUSHI share in the bar
uint256 xsushi_powah = xsushi_totalSushi.mul(xsushi_balance).div(xsushi_total); return lp_powah.add(xsushi_powah);
uint256 xsushi_powah = xsushi_totalSushi.mul(xsushi_balance).div(xsushi_total); return lp_powah.add(xsushi_powah);
15,500
29
// ERC20Detailed/ Optional functions from the ERC20 standard. /
contract ERC20Detailed { string public _name; string public _symbol; uint8 private _decimals; /** * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of * these values are immutable: they can only be set once during * construction. */ constructor (string memor...
contract ERC20Detailed { string public _name; string public _symbol; uint8 private _decimals; /** * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of * these values are immutable: they can only be set once during * construction. */ constructor (string memor...
2,020
10
// A mapping from GirlIDs to an address that has been approved to call/transferFrom(). Each Girl can only have one approved address for transfer/at any time. A zero value means no approval is outstanding.
mapping (uint256 => address) public girlIndexToApproved;
mapping (uint256 => address) public girlIndexToApproved;
58,196
1,012
// Bots call this method to boost for user when conditions are met/If the contract ownes gas token it will try and use it for gas price reduction
function boostFor( DFSExchangeData.ExchangeData memory _exchangeData, uint _cdpId, uint _nextPrice, address _joinAddr
function boostFor( DFSExchangeData.ExchangeData memory _exchangeData, uint _cdpId, uint _nextPrice, address _joinAddr
26,112
91
// rusd balance of contract/ return rusd amount held
function rusdBalance() public view override returns (uint256) { return rusd().balanceOf(address(this)); }
function rusdBalance() public view override returns (uint256) { return rusd().balanceOf(address(this)); }
15,355
0
// solhint-disable-next-line modifiers/ensure-modifiers
function _setSender(address payable _sender) public { sender = _sender; }
function _setSender(address payable _sender) public { sender = _sender; }
18,915
101
// not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). Emits a {BeaconUpgraded} event. /
function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implement...
function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implement...
4,532
7
// _owner The address of the account owning tokens /_spender The address of the account able to transfer the tokens / return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
62,225
2
// When you're ready to leave Remix, change imports to follow this pattern: "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol";
import { IConstantFlowAgreementV1 } from "./IConstantFlowAgreementV1.sol";
import { IConstantFlowAgreementV1 } from "./IConstantFlowAgreementV1.sol";
45,797
8
// Returns the amount of tokens of token type `id` owned by `account`. Requirements: - `account` cannot be the zero address. /
function balanceOf(address account, uint256 id) external view returns (uint256);
function balanceOf(address account, uint256 id) external view returns (uint256);
9,045
12
// @Dev - Target needs to have a withdrawBalance functions
IMOLOCH(target).withdrawBalance(token, amount);
IMOLOCH(target).withdrawBalance(token, amount);
70,017
8
// make some changes for donation address originator bool isDonate
struct Offer { bool isForSale; uint256 tokenID; address originator; address seller; address organization; bool isBid; bool isDonated; uint256 minValue; uint256 endTime; uint256 reward; }
struct Offer { bool isForSale; uint256 tokenID; address originator; address seller; address organization; bool isBid; bool isDonated; uint256 minValue; uint256 endTime; uint256 reward; }
36,443
160
// use budget set by the accountant
uint256 budget = pool.accountant.calculateStrategyBudget();
uint256 budget = pool.accountant.calculateStrategyBudget();
16,351
30
// Transfer the bonus cost into the treasury and dev fund.
IERC20Metadata(_token).safeTransferFrom(msg.sender, devFund, devPortion); IERC20Metadata(_token).safeTransferFrom(msg.sender, treasury, actualCost - devPortion);
IERC20Metadata(_token).safeTransferFrom(msg.sender, devFund, devPortion); IERC20Metadata(_token).safeTransferFrom(msg.sender, treasury, actualCost - devPortion);
60,027
153
// Categories /
mapping(uint256 => IexecLib.Category) public m_categories; uint256 public m_categoriesCount; address public m_categoriesCreator; modifier onlyCategoriesCreator()
mapping(uint256 => IexecLib.Category) public m_categories; uint256 public m_categoriesCount; address public m_categoriesCreator; modifier onlyCategoriesCreator()
70,963
445
// Update fee settings./This function is only callable by the exchange owner./_accountCreationFeeETH The fee in ETH for account creation/_accountUpdateFeeETH The fee in ETH for account update/_depositFeeETH The fee in ETH for deposits/_withdrawalFeeETH The fee in ETH for onchain withdrawal requests
function setFees( uint _accountCreationFeeETH, uint _accountUpdateFeeETH, uint _depositFeeETH, uint _withdrawalFeeETH ) external;
function setFees( uint _accountCreationFeeETH, uint _accountUpdateFeeETH, uint _depositFeeETH, uint _withdrawalFeeETH ) external;
28,745
13
// Transfer
function _transfer(address _from, address _to, uint _value) internal { require(_to != address(0x0)); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value > balanceOf[_to]); uint previousBalances = balanceOf[_from] + balanceOf[_to]; balanceOf[_from] -= _value; ...
function _transfer(address _from, address _to, uint _value) internal { require(_to != address(0x0)); require(balanceOf[_from] >= _value); require(balanceOf[_to] + _value > balanceOf[_to]); uint previousBalances = balanceOf[_from] + balanceOf[_to]; balanceOf[_from] -= _value; ...
33,897
16
// Bid data for each separate auction
mapping (uint256 => Bid) public bids;
mapping (uint256 => Bid) public bids;
11,668
3
// Calculate the strike amount equivalent to pay for the underlying requested
uint256 strikeToSend = _strikeToTransfer(amountOfOptions);
uint256 strikeToSend = _strikeToTransfer(amountOfOptions);
36,026
5
// 1-to-1 mapping between gcId and voter account
mapping(uint256 => address) public override gcIdToVoter; mapping(address => uint256) public override voterToGCId;
mapping(uint256 => address) public override gcIdToVoter; mapping(address => uint256) public override voterToGCId;
32,711
9
// stake visibility is public as overriding LPTokenWrapper's stake() function
function stake(uint256 amount) public override updateReward(msg.sender) { require(amount > 0, "Cannot stake 0"); recordSmartContract(); super.stake(amount); emit Staked(msg.sender, amount); }
function stake(uint256 amount) public override updateReward(msg.sender) { require(amount > 0, "Cannot stake 0"); recordSmartContract(); super.stake(amount); emit Staked(msg.sender, amount); }
15,525
4
// See {ERC721A-tokenURI}
function tokenURI(uint256 tid) public view virtual override returns (string memory) { if (!_exists(tid)) revert URIQueryForNonexistentToken(); return string(abi.encodePacked(_baseURI(), "0")); }
function tokenURI(uint256 tid) public view virtual override returns (string memory) { if (!_exists(tid)) revert URIQueryForNonexistentToken(); return string(abi.encodePacked(_baseURI(), "0")); }
14,372
159
// INodeOperatorRegistry/2021 ShardLabs/Node operator registry interface
interface INodeOperatorRegistry { /// @notice Allows to add a new node operator to the system. /// @param _name the node operator name. /// @param _rewardAddress public address used for ACL and receive rewards. /// @param _signerPubkey public key used on heimdall len 64 bytes. function addOperator( ...
interface INodeOperatorRegistry { /// @notice Allows to add a new node operator to the system. /// @param _name the node operator name. /// @param _rewardAddress public address used for ACL and receive rewards. /// @param _signerPubkey public key used on heimdall len 64 bytes. function addOperator( ...
44,568
33
// Add a new input token. _addr Address of the token to be added. _rate USD price of the token (4 decimals - e.g. $1 = 1000, $0.95 = 950) /
function addInputToken(address _addr, uint256 _rate) external onlyOwner { require(inputs[_addr].usdRate == 0, "Input token already set."); require(_addr != address(0), "Cannot add input token with zero address."); require(_rate > 0, "Cannot add input token with zero rate."); ...
function addInputToken(address _addr, uint256 _rate) external onlyOwner { require(inputs[_addr].usdRate == 0, "Input token already set."); require(_addr != address(0), "Cannot add input token with zero address."); require(_rate > 0, "Cannot add input token with zero rate."); ...
3,159
1
// Deposit - deposit from an L1 address to an L2 address Transfer - transfer from one L2 address to another Withdraw - withdraw from an L2 address to an L1 address
enum Transaction {Deposit, Transfer, Withdraw}
enum Transaction {Deposit, Transfer, Withdraw}
18,975
22
// if lock already exists, increase amount
_locks[lockID].balance = _locks[lockID].balance.add(amount);
_locks[lockID].balance = _locks[lockID].balance.add(amount);
30,622
22
// Replaces the character with the given id with the last character in the array index the index of the character in the id array nchars the number of characters/
function replaceCharacter(uint16 index, uint16 nchars) internal { uint32 characterId = ids[index]; numCharactersXType[characters[characterId].characterType]--; if (characterId == oldest) oldest = 0; delete characters[characterId]; ids[index] = ids[nchars]; delete ids[nchars]; }
function replaceCharacter(uint16 index, uint16 nchars) internal { uint32 characterId = ids[index]; numCharactersXType[characters[characterId].characterType]--; if (characterId == oldest) oldest = 0; delete characters[characterId]; ids[index] = ids[nchars]; delete ids[nchars]; }
49,514
5
// Returns the number of remaining Beans that can be minted for Immunefi bug bounties.
function getBeansRemaining() external view returns (uint256) { return remainingBeans; }
function getBeansRemaining() external view returns (uint256) { return remainingBeans; }
27,583