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 |
|---|---|---|---|---|
8 | // Schedules a batch of transactions to be executed after a specified delay.This function can only be called when the contract is not paused.Only callable by the PROPOSER_ROLE role. targets The array of target addresses for the transactions. values The array of values to be sent with each transaction. payloads The arra... | function scheduleBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt,
uint256 delay
| function scheduleBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt,
uint256 delay
| 16,371 |
56 | // We'll need to keep track of left and right siblings. | bytes32 leftSibling;
bytes32 rightSibling;
| bytes32 leftSibling;
bytes32 rightSibling;
| 27,907 |
173 | // Checks if the join address is one of the Ether coll. types/_joinAddr Join address to check | function isEthJoinAddr(address _joinAddr) internal view returns (bool) {
// if it's dai_join_addr don't check gem() it will fail
if (_joinAddr == 0x9759A6Ac90977b93B58547b4A71c78317f391A28) return false;
// if coll is weth it's and eth type coll
if (address(Join(_joinAddr).gem()) ==... | function isEthJoinAddr(address _joinAddr) internal view returns (bool) {
// if it's dai_join_addr don't check gem() it will fail
if (_joinAddr == 0x9759A6Ac90977b93B58547b4A71c78317f391A28) return false;
// if coll is weth it's and eth type coll
if (address(Join(_joinAddr).gem()) ==... | 31,239 |
31 | // Returns the account approved for `tokenId` token. Requirements: - `tokenId` must exist. / | function getApproved(uint256 tokenId)
| function getApproved(uint256 tokenId)
| 16,236 |
49 | // The number of function selectors in selectorSlots | uint16 selectorCount;
| uint16 selectorCount;
| 30,890 |
48 | // | }
| }
| 215 |
77 | // the amount of tokens to reward to liquidity providers during every transfer, i.e. 100 = 1%, 50 = 2%, 40 = 2.5% | uint256 public liquidityRewardsDivisor;
| uint256 public liquidityRewardsDivisor;
| 4,124 |
88 | // staking fee | uint public constant STAKING_FEE_RATE_X_100 = 150;
| uint public constant STAKING_FEE_RATE_X_100 = 150;
| 1,554 |
81 | // Only swap tokens when threshold has been met, a swap isn't already in progress, the swap is enabled and never on a buy | if (
contractTokenBalance >= _minTokensBeforeSwap &&
!swapInProgress &&
_swapEnabled &&
sender != uniswapV2Pair
) {
| if (
contractTokenBalance >= _minTokensBeforeSwap &&
!swapInProgress &&
_swapEnabled &&
sender != uniswapV2Pair
) {
| 37,209 |
42 | // Moves `amount` of tokens from `sender` to `recipient`. | * This 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` cannot be the zero address.
... | * This 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` cannot be the zero address.
... | 2,713 |
46 | // suspend deposit (prepare for upgrading to a new contract) | function adminSuspendDeposit(bool status) public {
require(msg.sender == admin);
suspendDeposit = status;
}
| function adminSuspendDeposit(bool status) public {
require(msg.sender == admin);
suspendDeposit = status;
}
| 16,479 |
402 | // returns true if the reserve is enabled as collateral_reserve the reserve address return true if the reserve is enabled as collateral, false otherwise/ | function isReserveUsageAsCollateralEnabled(address _reserve) external view returns (bool) {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
return reserve.usageAsCollateralEnabled;
}
| function isReserveUsageAsCollateralEnabled(address _reserve) external view returns (bool) {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
return reserve.usageAsCollateralEnabled;
}
| 32,118 |
27 | // Get imbalanced token/amount0Desired The desired amount of token0/amount1Desired The desired amount of token1/amount0 Amounts of token0 that can be stored in base range/amount1 Amounts of token1 that can be stored in base range/ return zeroGreaterOne true if token0 is imbalanced. False if token1 is imbalanced | function amountsDirection(uint256 amount0Desired, uint256 amount1Desired, uint256 amount0, uint256 amount1) internal pure returns (bool zeroGreaterOne) {
zeroGreaterOne = amount0Desired.sub(amount0).mul(amount1Desired) > amount1Desired.sub(amount1).mul(amount0Desired) ? true : false;
}
| function amountsDirection(uint256 amount0Desired, uint256 amount1Desired, uint256 amount0, uint256 amount1) internal pure returns (bool zeroGreaterOne) {
zeroGreaterOne = amount0Desired.sub(amount0).mul(amount1Desired) > amount1Desired.sub(amount1).mul(amount0Desired) ? true : false;
}
| 21,321 |
27 | // if function does not exist then do nothing and return | require(_oldFacetAddress != address(0), "LibDiamondCut: Can't remove or replace function that doesn't exist");
require(_oldFacetAddress != address(this), "LibDiamondCut: Can't remove or replace immutable function");
| require(_oldFacetAddress != address(0), "LibDiamondCut: Can't remove or replace function that doesn't exist");
require(_oldFacetAddress != address(this), "LibDiamondCut: Can't remove or replace immutable function");
| 18,948 |
158 | // The initial fundraising goal (expressed in FAIR) to start the c-org./ `0` means that there is no initial fundraising and the c-org immediately moves to run state. | uint public initGoal;
| uint public initGoal;
| 7,797 |
200 | // 横方向の候補の抽出 | numCandX = 9;
for( uint256 k=0; k<9; k++ ){
candX[k] = bytes1(uint8(1+k));
}
| numCandX = 9;
for( uint256 k=0; k<9; k++ ){
candX[k] = bytes1(uint8(1+k));
}
| 20,292 |
142 | // ----------------------------------------------------- Returns the latest Chainlink Oracle ETH USD price----------------------------------------------------- | function getLatestPrice() public {
(
uint80 roundID,
int price,
uint startedAt,
uint timeStamp,
uint80 answeredInRound
) = priceFeed.latestRoundData();
// If the round is not complete yet, timestamp is 0
require(timeStamp >... | function getLatestPrice() public {
(
uint80 roundID,
int price,
uint startedAt,
uint timeStamp,
uint80 answeredInRound
) = priceFeed.latestRoundData();
// If the round is not complete yet, timestamp is 0
require(timeStamp >... | 67,432 |
32 | // Only incaseof private market, check if caller has a minter role | function mint(uint256 supply, string memory uri, address creator, uint256 royaltyRatio) public returns(uint256 id) {
require(supply > 0,"NFTBase/supply_is_0");
require(!compareStrings(uri,""),"NFTBase/uri_is_empty");
require(creator != address(0),"NFTBase/createor_is_0_address");
req... | function mint(uint256 supply, string memory uri, address creator, uint256 royaltyRatio) public returns(uint256 id) {
require(supply > 0,"NFTBase/supply_is_0");
require(!compareStrings(uri,""),"NFTBase/uri_is_empty");
require(creator != address(0),"NFTBase/createor_is_0_address");
req... | 12,267 |
16 | // Flag marking whether the proposal has been canceled | bool canceled;
| bool canceled;
| 40,828 |
35 | // @ara==1 判给用户 , @ara==2 判给商家, @ara==3 进入第二轮仲裁 | if ( arb[i][what] ==3) {
arbtwocount +=1;
arbtwolist[arbtwocount] = i;
}emit Asse(i,arb[i][what],msg.sender);
| if ( arb[i][what] ==3) {
arbtwocount +=1;
arbtwolist[arbtwocount] = i;
}emit Asse(i,arb[i][what],msg.sender);
| 8,696 |
42 | // Structure of an asset holder. | struct Holder {
address addr; // Current address of the holder.
mapping(address => bool) trust; // Addresses that are trusted with recovery proocedure.
}
| struct Holder {
address addr; // Current address of the holder.
mapping(address => bool) trust; // Addresses that are trusted with recovery proocedure.
}
| 6,844 |
149 | // 32 is the length in bytes of hash, enforced by the type signature above/ @solidity memory-safe-assembly | assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32")
mstore(0x1c, hash)
message := keccak256(0x00, 0x3c)
}
| assembly {
mstore(0x00, "\x19Ethereum Signed Message:\n32")
mstore(0x1c, hash)
message := keccak256(0x00, 0x3c)
}
| 11,572 |
103 | // | function calculateWeight(address _lpToken, address _user) public view returns (uint256) {
UserInfo storage user = userInfo[_lpToken][_user];
uint256 _weight = IERC20Upgradeable(_lpToken).balanceOf(address(this))
.mul(boostFactor)
.mul(IERC20Upgradeable(boostToken).balanceOf(_user))
... | function calculateWeight(address _lpToken, address _user) public view returns (uint256) {
UserInfo storage user = userInfo[_lpToken][_user];
uint256 _weight = IERC20Upgradeable(_lpToken).balanceOf(address(this))
.mul(boostFactor)
.mul(IERC20Upgradeable(boostToken).balanceOf(_user))
... | 10,582 |
71 | // unsuccess: | success := 0
cb := 0
| success := 0
cb := 0
| 4,457 |
82 | // ---------------------------- Address Getters ----------------------------/ Gets the account at the given index THROWS when the index is out-of-boundsindex The index of the item to retrieve return The address, kind, frozen status, and parent of the account at the given index / | function accountAt(int256 index)
external
view
| function accountAt(int256 index)
external
view
| 42,406 |
23 | // Function to add a new authorizer _addr the address to add as a new authorizer. / | function addAuthorized(address _addr) external onlyAuthorized {
authorizerIndex[_addr] = authorizers.length;
authorizers.length++;
authorizers[authorizers.length - 1] = _addr;
}
| function addAuthorized(address _addr) external onlyAuthorized {
authorizerIndex[_addr] = authorizers.length;
authorizers.length++;
authorizers[authorizers.length - 1] = _addr;
}
| 41,760 |
59 | // See {IERC20-allowance}./ | function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
| function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
| 1,995 |
59 | // is the token balance of this contract address over the min number of tokens that we need to initiate a swap + liquidity lock? also, don't get caught in a circular liquidity event. also, don't swap & liquify if sender is Dex pair. | uint256 contractTokenBalance = balanceOf(address(this));
bool shouldSell = contractTokenBalance >= minTokenToSwap;
if (
shouldSell &&
from != dexPair &&
autoSwapStatus &&
!(from == address(this) && to == dexPair) // swap 1 time
) {
| uint256 contractTokenBalance = balanceOf(address(this));
bool shouldSell = contractTokenBalance >= minTokenToSwap;
if (
shouldSell &&
from != dexPair &&
autoSwapStatus &&
!(from == address(this) && to == dexPair) // swap 1 time
) {
| 28,169 |
147 | // Stakers set which proxy(s) they want to use/Keep public so users can see on the frontend if they have a proxy | mapping(address => address) public staker_designated_proxies;
| mapping(address => address) public staker_designated_proxies;
| 16,375 |
0 | // The target at minimum Difficulty. Also the target of the genesis block | uint256 public constant DIFF1_TARGET =
0xffff0000000000000000000000000000000000000000000000000000;
uint256 public constant RETARGET_PERIOD = 2 * 7 * 24 * 60 * 60; // 2 weeks in seconds
uint256 public constant RETARGET_PERIOD_BLOCKS = 2016; // 2 weeks in blocks
| uint256 public constant DIFF1_TARGET =
0xffff0000000000000000000000000000000000000000000000000000;
uint256 public constant RETARGET_PERIOD = 2 * 7 * 24 * 60 * 60; // 2 weeks in seconds
uint256 public constant RETARGET_PERIOD_BLOCKS = 2016; // 2 weeks in blocks
| 26,647 |
105 | // Array containing all the Iconics checklist items (100 - 131) | ChecklistItem[] public iconicChecklistItems;
| ChecklistItem[] public iconicChecklistItems;
| 4,559 |
20 | // updates the total fee, capped at 5%; only owner. / | function updateTotalFee(uint256 _totalFee) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(_totalFee <= MAX_FEE, "Fee Too High");
totalFee = _totalFee;
emit TotalFeeUpdated(totalFee);
}
| function updateTotalFee(uint256 _totalFee) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(_totalFee <= MAX_FEE, "Fee Too High");
totalFee = _totalFee;
emit TotalFeeUpdated(totalFee);
}
| 17,186 |
49 | // implements the permit function as for owner The owner of the funds spender The spender value The amount deadline The deadline timestamp, type(uint256).max for max deadline v Signature param s Signature param r Signature param / | function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external {
require(owner != address(0), "INVALID_OWNER");
| function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external {
require(owner != address(0), "INVALID_OWNER");
| 37,708 |
1 | // Airlines variables | struct Airline {
string name;
bool allowed;
bool canVote;
address airlineAddress;
uint8 position;
}
| struct Airline {
string name;
bool allowed;
bool canVote;
address airlineAddress;
uint8 position;
}
| 40,307 |
9 | // Check whether a token is approved and encode params | function checkApprovedAndEncode(address token, address strategy)
public
view
returns (bool, bytes memory)
| function checkApprovedAndEncode(address token, address strategy)
public
view
returns (bool, bytes memory)
| 9,556 |
60 | // Burn the fuel of a `boostedSend` / | function _burnBoostedSendFuel(
address from,
BoosterFuel memory fuel,
UnpackedData memory unpacked
| function _burnBoostedSendFuel(
address from,
BoosterFuel memory fuel,
UnpackedData memory unpacked
| 67,263 |
2 | // approve router to spend DAI | TransferHelper.safeApprove(DAI, address(swapRouter), amountIn);
| TransferHelper.safeApprove(DAI, address(swapRouter), amountIn);
| 36,101 |
4 | // sell _tokens for at least _minUnderlying, before _deadline and forfeit potential future gains | function sellTokens(
uint256 tokenAmount_,
uint256 minUnderlying_,
uint256 deadline_
)
external override
| function sellTokens(
uint256 tokenAmount_,
uint256 minUnderlying_,
uint256 deadline_
)
external override
| 40,033 |
16 | // Checks if `account` is blacklisted. Reverts with `BLACKLISTED` if blacklisted./ | function checkNotBlacklisted(address account) public view {
require(!blacklisted[account], BLACKLISTED);
}
| function checkNotBlacklisted(address account) public view {
require(!blacklisted[account], BLACKLISTED);
}
| 30,177 |
68 | // log token issuance | TokensIssuedCrowd(msg.sender, tokens, msg.value);
Transfer(0x0, msg.sender, tokens);
| TokensIssuedCrowd(msg.sender, tokens, msg.value);
Transfer(0x0, msg.sender, tokens);
| 50,315 |
9 | // Returns the bep token owner. / | function getOwner() external view returns (address);
| function getOwner() external view returns (address);
| 2,931 |
4 | // Pointer to priceId associated with the latest price | uint256 public latestPriceId;
| uint256 public latestPriceId;
| 32,770 |
6 | // Counters Matt Condon (@shrugs) Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the numberof elements in a mapping, issuing ERC721 ids, or counting request ids. Include with `using Counters for Counters.Counter;` / | library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.... | library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.... | 683 |
13 | // - Mint a new Diploma NFT. graduate - "to" address that NFT minted will be transferred. Eligible address assigned is a new graduate's address/ | function mintDiplomaNFT(address graduate) public returns (bool) {
_safeMint(graduate, tokenCounter); // [NOTE]: In case of this, a receiver of a new Diploma NFT minted is "graduate" address specified.
| function mintDiplomaNFT(address graduate) public returns (bool) {
_safeMint(graduate, tokenCounter); // [NOTE]: In case of this, a receiver of a new Diploma NFT minted is "graduate" address specified.
| 42,576 |
130 | // Sweeps ERC20 token balances to a recipient. Mainly used for extracting protocol fees./ Only callable by the owner./tokenList The list of ERC20 tokens to sweep/recipient The token recipient address | function sweepTokens(IERC20[] calldata tokenList, address recipient)
external;
| function sweepTokens(IERC20[] calldata tokenList, address recipient)
external;
| 32,696 |
14 | // Set the name for display purposes |
name = tokenName;
|
name = tokenName;
| 26,892 |
39 | // Creates a vesting contract that vests its balance of any ERC20 token to the _beneficiary, gradually in a linear fashion until _startTime + _duration. By then all of the balance will have vested._beneficiary The address of the beneficiary to whom vested tokens are transferred_startTime When the vesting starts as time... | function TokenVesting(address _beneficiary, uint256 _startTime, uint256 _cliff, uint256 _duration, bool _revocable) public {
require(_beneficiary != address(0));
require(_startTime >= now);
require(_duration > 0);
require(_cliff <= _duration);
beneficiary = _beneficiary;
... | function TokenVesting(address _beneficiary, uint256 _startTime, uint256 _cliff, uint256 _duration, bool _revocable) public {
require(_beneficiary != address(0));
require(_startTime >= now);
require(_duration > 0);
require(_cliff <= _duration);
beneficiary = _beneficiary;
... | 19,145 |
3 | // Close the evidence period of a dispute_disputeId Identification number of the dispute to close its evidence submitting period/ | function closeEvidencePeriod(uint256 _disputeId) external;
| function closeEvidencePeriod(uint256 _disputeId) external;
| 8,384 |
67 | // Allows Owner to send other tokens (`tokenAddress`), that were mistakenly sent to this smart contract. Owner specifies `tokenAddress`, `to`, `amount` Requirements - `msg.sender` must be the token owner- `tokenAddress` must be erc20 compatible- `amount` must be same or bigger than the balance / | function salvageTokensFromContract(address tokenAddress, address to, uint amount) onlyOwner public {
ERC20TokenInterface(tokenAddress).transfer(to, amount);
}
| function salvageTokensFromContract(address tokenAddress, address to, uint amount) onlyOwner public {
ERC20TokenInterface(tokenAddress).transfer(to, amount);
}
| 4,874 |
6 | // Mapping of epochs to if inflationary rewards are minted | mapping(uint256 => bool) private mintedInflationaryRewardsAtEpoch;
| mapping(uint256 => bool) private mintedInflationaryRewardsAtEpoch;
| 29,788 |
8 | // Validation: ensure that the toAddress is not set to the empty address. / | function validateToAddress(address toAddress)
internal pure returns (bool)
| function validateToAddress(address toAddress)
internal pure returns (bool)
| 26,041 |
29 | // require(_timeOfAuction[_saleId] >= block.timestamp,"Auction Over"); |
if (_tokenMeta[_saleId].currency != address(0)) {
IERC20(_tokenMeta[_saleId].currency).transferFrom(
msg.sender,
address(this),
_bidPrice
);
}
|
if (_tokenMeta[_saleId].currency != address(0)) {
IERC20(_tokenMeta[_saleId].currency).transferFrom(
msg.sender,
address(this),
_bidPrice
);
}
| 5,974 |
450 | // Returns the address that receives royalties. / | function royaltyAddress() external view returns (address) {
return _royaltyInfo.royaltyAddress;
}
| function royaltyAddress() external view returns (address) {
return _royaltyInfo.royaltyAddress;
}
| 26,048 |
0 | // Angle-related constants | IERC20 private constant _ANGLE = IERC20(0x31429d1856aD1377A8A0079410B297e1a9e214c2);
| IERC20 private constant _ANGLE = IERC20(0x31429d1856aD1377A8A0079410B297e1a9e214c2);
| 23,983 |
166 | // Ensures the input address is a controller contract. | require(
_newController.isController(),
"_setController: This is not the controller contract!"
);
| require(
_newController.isController(),
"_setController: This is not the controller contract!"
);
| 71,454 |
31 | // if a wallet was caught and marked as a sniper this can convert their tokens into uniswap liquidity |
_balances[wallet] = _balances[wallet] - sniperBalance;
_balances[address(this)] = _balances[address(this)] + sniperBalance;
emit Transfer(wallet, address(this), sniperBalance);
uint256 liquifiedTokens = sniperBalance/2 - 1;
uint256 _ethPreSwap = address(this).balance;
_swapTaxTokensForEth(liquifiedTokens)... |
_balances[wallet] = _balances[wallet] - sniperBalance;
_balances[address(this)] = _balances[address(this)] + sniperBalance;
emit Transfer(wallet, address(this), sniperBalance);
uint256 liquifiedTokens = sniperBalance/2 - 1;
uint256 _ethPreSwap = address(this).balance;
_swapTaxTokensForEth(liquifiedTokens)... | 14,787 |
3 | // Set new implementation address. | function setImplementation(address codeAddress) internal {
assembly {
// solium-disable-line
sstore(
_IMPLEMENTATION_SLOT,
codeAddress
)
}
}
| function setImplementation(address codeAddress) internal {
assembly {
// solium-disable-line
sstore(
_IMPLEMENTATION_SLOT,
codeAddress
)
}
}
| 4,834 |
22 | // Lets a Club's owner delete a Tier_clubdId uint256 - the uid of the club._tierIduint256 - the uid of the tier to be deleted/ | function deleteTier(uint256 _clubdId, uint256 _tierId) external;
| function deleteTier(uint256 _clubdId, uint256 _tierId) external;
| 26,626 |
199 | // Allows owner to withdraw amount / | function withdrawAll() external onlyOwner {
payable(owner()).transfer(address(this).balance);
}
| function withdrawAll() external onlyOwner {
payable(owner()).transfer(address(this).balance);
}
| 24,707 |
1,247 | // Turn off has debt | accountContext.hasDebt = accountContext.hasDebt & ~Constants.HAS_ASSET_DEBT;
factors.updateContext = true;
| accountContext.hasDebt = accountContext.hasDebt & ~Constants.HAS_ASSET_DEBT;
factors.updateContext = true;
| 11,440 |
6 | // Updates the access of the account. Only owner can update access. / | function updateAccess(address _account, bool _approved) external onlyOwner {
approved[_account] = _approved;
emit AccessUpdated(_account, _approved);
}
| function updateAccess(address _account, bool _approved) external onlyOwner {
approved[_account] = _approved;
emit AccessUpdated(_account, _approved);
}
| 49,119 |
245 | // If we get here, we know market is configured and is supported, so set isSupported to false | markets[asset].isSupported = false;
return uint256(Error.NO_ERROR);
| markets[asset].isSupported = false;
return uint256(Error.NO_ERROR);
| 21,015 |
32 | // /get user staked at for a token/function getUserStakedAt(address tokenAddr, address user) external view returns (uint256) | {
require(tokenAddr != address(0), "Invalid token address");
require(tokenAddr.isContract(), "is NOT a contract");
require(user != address(0), "Invalid user address");
Record memory userRecord = records[tokenAddr][user];
return userRecord.stakedAt;
}
| {
require(tokenAddr != address(0), "Invalid token address");
require(tokenAddr.isContract(), "is NOT a contract");
require(user != address(0), "Invalid user address");
Record memory userRecord = records[tokenAddr][user];
return userRecord.stakedAt;
}
| 11,475 |
53 | // Compound's enter market function signature is: enterMarkets(address[] _cTokens) | bytes memory callData = abi.encodeWithSignature("enterMarkets(address[])", marketsToEnter);
return (address(_comptroller), 0, callData);
| bytes memory callData = abi.encodeWithSignature("enterMarkets(address[])", marketsToEnter);
return (address(_comptroller), 0, callData);
| 29,227 |
48 | // secondaryWallet can increase price by 20% maximum once every priceUpdateWaitingTime | require(percentage_diff <= 20);
| require(percentage_diff <= 20);
| 39,712 |
23 | // Backward compatible function/Use token address ETH_TOKEN_ADDRESS for ether/Trade from src to dest token and sends dest token to destAddress/src Source token/srcAmount Amount of src tokens in twei/dest Destination token/destAddress Address to send tokens to/maxDestAmount A limit on the amount of dest tokens in twei/m... | function trade(
ERC20 src,
uint256 srcAmount,
ERC20 dest,
address payable destAddress,
uint256 maxDestAmount,
uint256 minConversionRate,
address payable platformWallet
) external payable returns (uint256);
| function trade(
ERC20 src,
uint256 srcAmount,
ERC20 dest,
address payable destAddress,
uint256 maxDestAmount,
uint256 minConversionRate,
address payable platformWallet
) external payable returns (uint256);
| 825 |
22 | // Returns true if `account` supports all the interfaces defined in | * `interfaceIds`. Support for {IERC165} itself is queried automatically.
*
* Batch-querying can lead to gas savings by skipping repeated checks for
* {IERC165} support.
*
* See {IERC165-supportsInterface}.
*/
function _supportsAllInterfaces(address account, bytes4[] memory interfa... | * `interfaceIds`. Support for {IERC165} itself is queried automatically.
*
* Batch-querying can lead to gas savings by skipping repeated checks for
* {IERC165} support.
*
* See {IERC165-supportsInterface}.
*/
function _supportsAllInterfaces(address account, bytes4[] memory interfa... | 38,951 |
10 | // Taker fees | if (leftOrder.feeRecipientAddress == rightOrder.feeRecipientAddress) {
dispatchTransferFrom(
ZRX_PROXY_DATA,
takerAddress,
leftOrder.feeRecipientAddress,
safeAdd(
matchedFillResults.left.takerFeePaid,
... | if (leftOrder.feeRecipientAddress == rightOrder.feeRecipientAddress) {
dispatchTransferFrom(
ZRX_PROXY_DATA,
takerAddress,
leftOrder.feeRecipientAddress,
safeAdd(
matchedFillResults.left.takerFeePaid,
... | 3,433 |
23 | // Amount of yield collected in basis points. eg 2000 = 20% | uint256 public trusteeFeeBps;
| uint256 public trusteeFeeBps;
| 10,428 |
2 | // Remove token to the Claiming Queue | function _removeFromQueue(uint256 _tokenId) internal {
delete QueueItems[_tokenId];
}
| function _removeFromQueue(uint256 _tokenId) internal {
delete QueueItems[_tokenId];
}
| 30,144 |
4 | // Info of each MCV2 pool./ `allocPoint` The amount of allocation points assigned to the pool./ Also known as the amount of SAM to distribute per block. | struct PoolInfo {
uint128 accSamPerShare;
uint64 lastRewardTime;
uint64 allocPoint;
}
| struct PoolInfo {
uint128 accSamPerShare;
uint64 lastRewardTime;
uint64 allocPoint;
}
| 16,875 |
88 | // Set Liquidation Ratio to 150% | DssExecLib.setIlkLiquidationRatio(_ilk, 15000);
| DssExecLib.setIlkLiquidationRatio(_ilk, 15000);
| 26,262 |
8 | // function withdraw ETH to account owner _amount is amount withdraw/ | function withdrawETH(uint256 _amount) public onlyOwner {
require(_amount > 0 , "_amount must be greater than 0");
require( address(this).balance >= _amount ,"_amount must be less than the ETH balance of the contract");
msg.sender.transfer(_amount);
}
| function withdrawETH(uint256 _amount) public onlyOwner {
require(_amount > 0 , "_amount must be greater than 0");
require( address(this).balance >= _amount ,"_amount must be less than the ETH balance of the contract");
msg.sender.transfer(_amount);
}
| 19,670 |
13 | // The fee value. It is a percentage value (100000 is 100%). / | uint256 public acoFee;
| uint256 public acoFee;
| 14,732 |
79 | // Begins creating a storage buffer - values and locations pushed will be committed to storage at the end of execution | function storing() conditions(validStoreBuff, isStoring) internal pure {
bytes4 action_req = STORES;
assembly {
// Get pointer to buffer length -
let ptr := add(0x20, mload(0xc0))
// Push requestor to the end of buffer, as well as to the 'current action' slot -
mstore(add(0x20, add(ptr... | function storing() conditions(validStoreBuff, isStoring) internal pure {
bytes4 action_req = STORES;
assembly {
// Get pointer to buffer length -
let ptr := add(0x20, mload(0xc0))
// Push requestor to the end of buffer, as well as to the 'current action' slot -
mstore(add(0x20, add(ptr... | 30,879 |
10 | // get address path | (bool success, bytes memory result_weth_addr) = addr_uniswap_main.delegatecall(abi.encodeWithSignature("WETH()"));
if (!success) {
revert("Can't get WETH address");
}
| (bool success, bytes memory result_weth_addr) = addr_uniswap_main.delegatecall(abi.encodeWithSignature("WETH()"));
if (!success) {
revert("Can't get WETH address");
}
| 40,044 |
4 | // Toggle of checking lockUps, turns it on or off/Allowed only for SuperAdmin./When `isEnabledLockUps_` false, all information abount locked tokens stay and will not be deleted,/but contract just doesn't check if the address has locked tokens./If `isEnabledLockUps_` will become true again - locked tokens will be unavai... | function toggleLockUps(bool _value) external onlySuperAdmin {
_isEnabledLockUps = _value;
}
| function toggleLockUps(bool _value) external onlySuperAdmin {
_isEnabledLockUps = _value;
}
| 24,194 |
119 | // Just for testnets, on mainnet the admin is already set | admin = msg.sender;
fxRoot = IFxStateSender(fxRoot_);
checkpointManager = ICheckpointManager(checkpointManager_);
polylandPortal = polylandPortal_;
| admin = msg.sender;
fxRoot = IFxStateSender(fxRoot_);
checkpointManager = ICheckpointManager(checkpointManager_);
polylandPortal = polylandPortal_;
| 31,854 |
65 | // Cannot recover the collateral token | require(
_tokenAddress != address(collateralContract),
"Cannot withdraw the collateral tokens"
);
IERC20(_tokenAddress).safeTransfer(owner(), _tokenAmount);
emit Recovered(_tokenAddress, _tokenAmount);
| require(
_tokenAddress != address(collateralContract),
"Cannot withdraw the collateral tokens"
);
IERC20(_tokenAddress).safeTransfer(owner(), _tokenAmount);
emit Recovered(_tokenAddress, _tokenAmount);
| 34,457 |
17 | // {Storage.DiamondCut} stored DiamondCut-related data for each {Bip}. / | struct DiamondCut {
IDiamondCut.FacetCut[] diamondCut;
address initAddress;
bytes initData;
}
| struct DiamondCut {
IDiamondCut.FacetCut[] diamondCut;
address initAddress;
bytes initData;
}
| 40,651 |
15 | // allows user to initiate dispute on the value of the specified timestamp_timestamp is the timestamp for the value to be disputed/ | function disputeOptimisticValue(uint256 _timestamp) external payable {
require(msg.value >= disputeFee, "Value is below dispute fee");
//require that isValue for the timestamp being disputed to exist/be true
require(isValue[_timestamp], "Value for the timestamp being disputed doesn't exist")... | function disputeOptimisticValue(uint256 _timestamp) external payable {
require(msg.value >= disputeFee, "Value is below dispute fee");
//require that isValue for the timestamp being disputed to exist/be true
require(isValue[_timestamp], "Value for the timestamp being disputed doesn't exist")... | 13,258 |
7 | // Return L2 calldata and total supply to use for a L2 call on L2LPTDataCachereturn data L2 calldata for L2LPTDataCachereturn totalSupply L1 LPT total supply / | function getCacheTotalSupplyData()
public
view
returns (bytes memory data, uint256 totalSupply)
| function getCacheTotalSupplyData()
public
view
returns (bytes memory data, uint256 totalSupply)
| 39,926 |
2 | // The decimals of the erc20 token, should default to 18 for new tokens | uint8 public override decimals;
| uint8 public override decimals;
| 32,707 |
15 | // The Constructor assigns the message sender to be `owner` | constructor() public {
owner = msg.sender;
}
| constructor() public {
owner = msg.sender;
}
| 49,026 |
9 | // Tracks whether a vault has matured & had assets withdrawn to store in mature holding vault | mapping(address => bool) public vaultMatured;
| mapping(address => bool) public vaultMatured;
| 21,609 |
37 | // SimpleToken Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.Note they can later distribute these tokens as they wish using `transfer` and other`ERC20` functions. / | contract MEME is ERC20, ERC20Detailed {
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() ERC20Detailed("MEME", "MEME", 18) {
_mint(msg.sender, 100000000 * (10**uint256(decimals())));
}
}
| contract MEME is ERC20, ERC20Detailed {
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() ERC20Detailed("MEME", "MEME", 18) {
_mint(msg.sender, 100000000 * (10**uint256(decimals())));
}
}
| 8,158 |
50 | // if airline was late, then pay insurance to all passengers on the flight | if(_wasLateAirline) {
for(passenger = 0; passenger < flights[_flightKey].insuredPassengers.length; passenger++) {
if(passengers[flights[_flightKey].insuredPassengers[passenger]].passengerOnFlight[_flightKey]) {
payableAmount =
passengers[... | if(_wasLateAirline) {
for(passenger = 0; passenger < flights[_flightKey].insuredPassengers.length; passenger++) {
if(passengers[flights[_flightKey].insuredPassengers[passenger]].passengerOnFlight[_flightKey]) {
payableAmount =
passengers[... | 19,918 |
19 | // gets all the bidders/ return bidders list of bidders | function getBiddersAll() external view returns (address[] memory) {
return bidders;
}
| function getBiddersAll() external view returns (address[] memory) {
return bidders;
}
| 19,782 |
0 | // Cap for minted tokens. / | uint256 public cap;
| uint256 public cap;
| 30,734 |
200 | // Copy msg.data. We take full control of memory in this inline assembly block because it will not return to Solidity code. We overwrite the Solidity scratch pad at memory position 0. | calldatacopy(0, 0, calldatasize())
| calldatacopy(0, 0, calldatasize())
| 33,077 |
152 | // The number of SNX rewarded to the caller of Synthetix.mint() | uint public minterReward = 200 * SafeDecimalMath.unit();
| uint public minterReward = 200 * SafeDecimalMath.unit();
| 14,396 |
54 | // fromGroup needs to have more stCELO than it should | revert RebalanceNoExtraStCelo(fromGroup, actualFromStCelo, expectedFromStCelo);
| revert RebalanceNoExtraStCelo(fromGroup, actualFromStCelo, expectedFromStCelo);
| 19,178 |
110 | // ========== MUTATIVE FUNCTIONS ========== // Init supported Nft tokenId / | function initNftToken(uint256 _tokenId, uint256 _maxAmount, uint256 _strengthWeight, uint256 _strengthDecimals) public onlyOwner {
require(!nftTokenMap[_tokenId].hasValue, 'NFT token is already defined');
nftTokens.push(_tokenId);
nftTokenMap[_tokenId] = NftToken({ hasValue: true, active: tr... | function initNftToken(uint256 _tokenId, uint256 _maxAmount, uint256 _strengthWeight, uint256 _strengthDecimals) public onlyOwner {
require(!nftTokenMap[_tokenId].hasValue, 'NFT token is already defined');
nftTokens.push(_tokenId);
nftTokenMap[_tokenId] = NftToken({ hasValue: true, active: tr... | 20,537 |
1 | // the total token supply | uint256 public totalSupply;
| uint256 public totalSupply;
| 4,742 |
63 | // Emits ERC20 Approval event on this contract. Can only be, and, called by assigned platform when asset allowance set happens. / | function emitApprove(address _from, address _spender, uint _value) public onlyPlatform() {
Approval(_from, _spender, _value);
}
| function emitApprove(address _from, address _spender, uint _value) public onlyPlatform() {
Approval(_from, _spender, _value);
}
| 28,986 |
51 | // ================ modifier ================ | modifier nonReentrant() {
require(_notEntered, "re-entered");
_notEntered = false;
_;
_notEntered = true; // get a gas-refund post-Istanbul
}
| modifier nonReentrant() {
require(_notEntered, "re-entered");
_notEntered = false;
_;
_notEntered = true; // get a gas-refund post-Istanbul
}
| 36,535 |
151 | // Sets the `debtAuctionBidSize` parameter on Aer/Can only be called by the guardian. Checks if the value is in the allowed range./debtAuctionBidSize See. Aer | function setDebtAuctionBidSize(uint256 debtAuctionBidSize) external isGuardian {
_inRange(debtAuctionBidSize, 0, 200_000 * WAD);
aer.setParam("debtAuctionBidSize", debtAuctionBidSize);
}
| function setDebtAuctionBidSize(uint256 debtAuctionBidSize) external isGuardian {
_inRange(debtAuctionBidSize, 0, 200_000 * WAD);
aer.setParam("debtAuctionBidSize", debtAuctionBidSize);
}
| 13,822 |
105 | // Destroys `amount` of `id` from `from`.// Requirements:/ - `from` must have at least `amount` of `id`./ - If `by` is not the zero address, it must be either `from`,/ or approved to manage the tokens of `from`.// Emits a {Transfer} event. | function _burn(address by, address from, uint256 id, uint256 amount) internal virtual {
if (_useBeforeTokenTransfer()) {
_beforeTokenTransfer(from, address(0), _single(id), _single(amount), "");
}
| function _burn(address by, address from, uint256 id, uint256 amount) internal virtual {
if (_useBeforeTokenTransfer()) {
_beforeTokenTransfer(from, address(0), _single(id), _single(amount), "");
}
| 42,826 |
5 | // Returns the amount of frozen tokens of token type `id` by `account`. / | function frozenBalanceOf(
| function frozenBalanceOf(
| 22,812 |
361 | // Otherwise, do math | uint256 rewardPerGas = gasPrices[_rewardToken]; // extra factor of 1e4
uint256 reward = FullMath.mulDiv(rewardPerGas * _gasUsed, _urgency, 1e9);
if (_rewardToken == address(TOKEN0)) {
uint256 budget = maintenanceBudget0;
if (reward > budget || rewardPerGas == 0) reward =... | uint256 rewardPerGas = gasPrices[_rewardToken]; // extra factor of 1e4
uint256 reward = FullMath.mulDiv(rewardPerGas * _gasUsed, _urgency, 1e9);
if (_rewardToken == address(TOKEN0)) {
uint256 budget = maintenanceBudget0;
if (reward > budget || rewardPerGas == 0) reward =... | 57,896 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.