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 |
|---|---|---|---|---|
114 | // Updates the fee amount and it's split ratio between the relayer and feeSplitRecipient | function updateFee(uint256 _feeNumerator, uint256 _feeSplitNumerator) public onlyOwner {
feeNumerator = _feeNumerator;
feeSplitNumerator = _feeSplitNumerator;
}
| function updateFee(uint256 _feeNumerator, uint256 _feeSplitNumerator) public onlyOwner {
feeNumerator = _feeNumerator;
feeSplitNumerator = _feeSplitNumerator;
}
| 36,313 |
129 | // Modifier to only allow the execution of certain functions restricted to the creator | modifier onlyCreatorLevel() {
require(
creator == msg.sender
);
_;
}
| modifier onlyCreatorLevel() {
require(
creator == msg.sender
);
_;
}
| 39,330 |
23 | // overrides safeTransferFrom to prevent transfer if token is staked / | function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
| function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
| 16,019 |
198 | // microLinkPerEth is 1e-6LINK/ETH units, gasCostEthWei is 1e-18ETH units (ETH-wei), product is 1e-24LINK-wei units, dividing by 1e6 gives 1e-18LINK units, i.e. LINK-wei units Safe from over/underflow, since all components are non-negative, gasCostEthWei will always fit into uint128 and microLinkPerEth is a uint32 (128... | uint256 gasCostLinkWei = (gasCostEthWei * billing.microLinkPerEth)/ 1e6;
| uint256 gasCostLinkWei = (gasCostEthWei * billing.microLinkPerEth)/ 1e6;
| 26,003 |
225 | // See {setApprovalForAll}. / | function isApprovedForAll(address account, address operator) public view returns (bool) {
return everRiseToken.isApprovedForAll(account, operator);
}
| function isApprovedForAll(address account, address operator) public view returns (bool) {
return everRiseToken.isApprovedForAll(account, operator);
}
| 26,755 |
8 | // Do not collect after birthday time | if (block.timestamp >= birthday) throw;
| if (block.timestamp >= birthday) throw;
| 11,027 |
18 | // Gets a metaverse registry at a given index/_metaverseId The target metaverse/_index The target index | function registryAt(uint256 _metaverseId, uint256 _index)
external
view
returns (address)
| function registryAt(uint256 _metaverseId, uint256 _index)
external
view
returns (address)
| 74,514 |
9 | // Multiplier used to offset small percentage values to fit within a uint256/ e.g. 5% is internally represented as (0.05mul). The final result/ after calculations is divided by mul again to retrieve a real value | uint256 internal constant MUL = 1e10;
| uint256 internal constant MUL = 1e10;
| 28,594 |
126 | // Chooses the best strategy and re-invests. If the strategy did not change, it just calls doHardWork on the current strategy. Call this through controller to claim hard rewards./ | function doHardWork() whenStrategyDefined onlyControllerOrGovernance external {
// ensure that new funds are invested too
invest();
strategy.doHardWork();
}
| function doHardWork() whenStrategyDefined onlyControllerOrGovernance external {
// ensure that new funds are invested too
invest();
strategy.doHardWork();
}
| 45,462 |
14 | // A contract attempts to get the coins / | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead
if (_value <= 0) throw;
if (balanceOf[_from] < _value) throw; // Check if ... | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
if (_to == 0x0) throw; // Prevent transfer to 0x0 address. Use burn() instead
if (_value <= 0) throw;
if (balanceOf[_from] < _value) throw; // Check if ... | 15,297 |
32 | // The address that will receive the commission for each transaction to or from the owner | address public tokenCommissionReceiver = 0xEa8867Ce34CC66318D4A055f43Cac6a88966C43f;
string public name = "ATON";
string public symbol = "ATL";
| address public tokenCommissionReceiver = 0xEa8867Ce34CC66318D4A055f43Cac6a88966C43f;
string public name = "ATON";
string public symbol = "ATL";
| 21,573 |
29 | // Allows the owner to change the broker. _broker The broker address / | function changeBroker(address _broker) public onlyOwner {
emit BrokerChanged(broker, _broker);
broker = _broker;
}
| function changeBroker(address _broker) public onlyOwner {
emit BrokerChanged(broker, _broker);
broker = _broker;
}
| 56,205 |
400 | // Calculate denominator for row 204: x - g^204z. | let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0x880)))
mstore(add(productsPtr, 0x5e0), partialProduct)
mstore(add(valuesPtr, 0x5e0), denominator)
partialProduct := mulmod(partialProduct, denominator, PRIME)
| let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0x880)))
mstore(add(productsPtr, 0x5e0), partialProduct)
mstore(add(valuesPtr, 0x5e0), denominator)
partialProduct := mulmod(partialProduct, denominator, PRIME)
| 47,263 |
3 | // Sets or upgrades the RariGovernanceTokenDistributor of the RariFundToken. Caller must have the {MinterRole}. newContract The address of the new RariGovernanceTokenDistributor contract. force Boolean indicating if we should not revert on validation error. / | function setGovernanceTokenDistributor(address payable newContract, bool force) external onlyMinter {
if (!force && address(rariGovernanceTokenDistributor) != address(0)) {
require(rariGovernanceTokenDistributor.disabled(), "The old governance token distributor contract has not been disa... | function setGovernanceTokenDistributor(address payable newContract, bool force) external onlyMinter {
if (!force && address(rariGovernanceTokenDistributor) != address(0)) {
require(rariGovernanceTokenDistributor.disabled(), "The old governance token distributor contract has not been disa... | 6,502 |
15 | // Withdraws all from IDLE/ | function withdrawAll() internal {
uint256 balance = IERC20(idleUnderlying).balanceOf(address(this));
// this automatically claims the crops
IIdleTokenV3_1(idleUnderlying).redeemIdleToken(balance);
liquidateRewards();
}
| function withdrawAll() internal {
uint256 balance = IERC20(idleUnderlying).balanceOf(address(this));
// this automatically claims the crops
IIdleTokenV3_1(idleUnderlying).redeemIdleToken(balance);
liquidateRewards();
}
| 44,907 |
13 | // A record of states for signing / validating signatures | mapping (address => uint) public nonces;
| mapping (address => uint) public nonces;
| 6,502 |
141 | // Grants `role` to `account`. Internal function without access restriction. / | function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
| function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
| 2,669 |
38 | // _______ __________ _____ _ __ _______ |__ __| |__ ||_| | ___|| | / /| | |__ __| | || __ _|| |_| | | | | |/ / __| || | | || |\ \ |_| | |__ | |\ \|__| | || | |_||_| \_\|_| |_| |____|| | \_\|_||_| / | contract TRACK {
/// @notice EIP-20 token name for this token
string public constant name = "TRACK-IT Token";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "TRACK";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @... | contract TRACK {
/// @notice EIP-20 token name for this token
string public constant name = "TRACK-IT Token";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "TRACK";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @... | 40,670 |
40 | // Recall that 20 digit fixed point division requires multiplying by ONE_20, and multiplication requires division by ONE_20. | int256 z = ((a - ONE_20) * ONE_20) / (a + ONE_20);
int256 z_squared = (z * z) / ONE_20;
| int256 z = ((a - ONE_20) * ONE_20) / (a + ONE_20);
int256 z_squared = (z * z) / ONE_20;
| 12,763 |
82 | // / | function max(uint256 x, uint256 y) internal pure returns (uint256) {
return x >= y ? x : y;
}
| function max(uint256 x, uint256 y) internal pure returns (uint256) {
return x >= y ? x : y;
}
| 11,145 |
18 | // Configure the max amount of passes that can be redeemed in a txn for a specific pass index id of tokenuri to point the token to/ | function setIndividualTokenURI(uint256 id, string memory uri) external override onlyRole(DEFAULT_ADMIN_ROLE){
require(_exists(id), "ERC721Metadata: Token does not exist");
tokenData[id].tokenURI = uri;
tokenData[id].exists = true;
}
| function setIndividualTokenURI(uint256 id, string memory uri) external override onlyRole(DEFAULT_ADMIN_ROLE){
require(_exists(id), "ERC721Metadata: Token does not exist");
tokenData[id].tokenURI = uri;
tokenData[id].exists = true;
}
| 19,470 |
42 | // Element Finance/Yearn Vault v1 Asset Proxy | contract YVaultAssetProxy is WrappedPosition, Authorizable {
// The addresses of the current yearn vault
IYearnVault public vault;
// 18 decimal fractional form of the multiplier which is applied after
// a vault upgrade. 0 when no upgrade has happened
uint88 public conversionRate;
// Bool packe... | contract YVaultAssetProxy is WrappedPosition, Authorizable {
// The addresses of the current yearn vault
IYearnVault public vault;
// 18 decimal fractional form of the multiplier which is applied after
// a vault upgrade. 0 when no upgrade has happened
uint88 public conversionRate;
// Bool packe... | 27,897 |
177 | // make owner to the owner of that contract | dbot.transferOwnership(dbot.owner());
| dbot.transferOwnership(dbot.owner());
| 16,041 |
116 | // Base contract of nest | contract NestBase {
// Address of nest token contract
address constant NEST_TOKEN_ADDRESS = 0x04abEdA201850aC0124161F037Efd70c74ddC74C;
// Genesis block number of nest
// NEST token contract is created at block height 6913517. However, because the mining algorithm of nest1.0
// is different from t... | contract NestBase {
// Address of nest token contract
address constant NEST_TOKEN_ADDRESS = 0x04abEdA201850aC0124161F037Efd70c74ddC74C;
// Genesis block number of nest
// NEST token contract is created at block height 6913517. However, because the mining algorithm of nest1.0
// is different from t... | 19,833 |
262 | // 9. Assign the return variable. | withdraw = amount;
| withdraw = amount;
| 9,432 |
189 | // Current order tries to deal against the AMM pool. Returns whether current order fully deals. | function _tryDealInPool(Context memory ctx, bool isBuy, RatPrice memory price) private pure returns (bool) {
uint currTokenCanTrade = _intopoolAmountTillPrice(isBuy, ctx.reserveMoney, ctx.reserveStock, price);
require(currTokenCanTrade < uint(1<<112), "GraSwap: CURR_TOKEN_TOO_LARGE");
// all... | function _tryDealInPool(Context memory ctx, bool isBuy, RatPrice memory price) private pure returns (bool) {
uint currTokenCanTrade = _intopoolAmountTillPrice(isBuy, ctx.reserveMoney, ctx.reserveStock, price);
require(currTokenCanTrade < uint(1<<112), "GraSwap: CURR_TOKEN_TOO_LARGE");
// all... | 38,868 |
21 | // Unanimously agree to cancel a dispute/signatures Signatures by all signing keys of the currently latest disputed/ state; an indication of agreement of this state and valid to cancel a dispute/Note this function is only callable when the state channel is in a DISPUTE state | function cancelDispute(bytes signatures)
public
onlyWhenChannelDispute
| function cancelDispute(bytes signatures)
public
onlyWhenChannelDispute
| 4,126 |
84 | // return the current dividend accrual rate, in USD per secondreturn dividend in USD per second / | function getCurrentValue() external view returns (uint256);
| function getCurrentValue() external view returns (uint256);
| 24,354 |
17 | // Team allocation percentages (KEY, BBT) + (Pot , Referrals, Community) Referrals / Community rewards are mathematically designed to come from the winner's share of the pot. | fees_[0] = BBTdatasets.TeamFee(45,20); //15% to pot, 10% to aff, 10% to air drop pot
fees_[1] = BBTdatasets.TeamFee(15,20); //45% to pot, 10% to aff, 10% to air drop pot
| fees_[0] = BBTdatasets.TeamFee(45,20); //15% to pot, 10% to aff, 10% to air drop pot
fees_[1] = BBTdatasets.TeamFee(15,20); //45% to pot, 10% to aff, 10% to air drop pot
| 19,907 |
34 | // the actual amounts collected are returned | (amount0, amount1) = pool.collect(
recipient,
position.tickLower,
position.tickUpper,
amount0Collect,
amount1Collect
);
| (amount0, amount1) = pool.collect(
recipient,
position.tickLower,
position.tickUpper,
amount0Collect,
amount1Collect
);
| 70,039 |
58 | // Insert the last asset into the position previously occupied by the asset to be removed | _assetsOf[from][assetIndex] = lastAssetId;
| _assetsOf[from][assetIndex] = lastAssetId;
| 3,218 |
175 | // Current additionally assignable reward (RNB) of the user (depositor), meaning what wasn't added to UserInfo, but will be upon the next addToTheUsersAssignedReward() call (read only, does not save/alter state) | function calculateUsersAssignableReward() public view returns(uint256) {
// ---
// --- similar to addToTheUsersAssignedReward(), but without the writes, plus few other modifications
// ---
uint256 currentStakingDayNumber = getCurrentStakingDayNumber();
uint256 currentStakin... | function calculateUsersAssignableReward() public view returns(uint256) {
// ---
// --- similar to addToTheUsersAssignedReward(), but without the writes, plus few other modifications
// ---
uint256 currentStakingDayNumber = getCurrentStakingDayNumber();
uint256 currentStakin... | 29,411 |
3 | // Emitted when contract has been deployed. destination Destination address reserve Strategy address strategy Reserve address/ | event Deployed(
address indexed destination,
IReserve indexed reserve,
IStrategy indexed strategy
);
| event Deployed(
address indexed destination,
IReserve indexed reserve,
IStrategy indexed strategy
);
| 24,888 |
7 | // Whitelisted contracts, set by an auth | mapping (address => uint256) public bud;
| mapping (address => uint256) public bud;
| 31,945 |
25 | // poster (receiver) is subject to backup withholding, so keep a running balance, transfer to contract address | payable(address(this)).transfer(msg.value);
balances[poster] += msg.value;
| payable(address(this)).transfer(msg.value);
balances[poster] += msg.value;
| 30,507 |
13 | // Payout creator earnings (funds from minting locked on dstChain).collectionAddress The address of the ERC721 collection. dstChainName Name of the remote chain. redirectFee Fee required to cover transaction fee on the redirectChain, if involved. OmnichainRouter-specific. Involved during cross-chain multi-protocol rout... | function getEarned(address collectionAddress, string memory dstChainName, uint256 gas, uint256 redirectFee) external payable nonReentrant {
IOmniERC721 collection = IOmniERC721(collectionAddress);
uint256 price = collection.mintPrice();
uint256 amount = mints[collectionAddress][dstChainName]... | function getEarned(address collectionAddress, string memory dstChainName, uint256 gas, uint256 redirectFee) external payable nonReentrant {
IOmniERC721 collection = IOmniERC721(collectionAddress);
uint256 price = collection.mintPrice();
uint256 amount = mints[collectionAddress][dstChainName]... | 10,500 |
62 | // Process member burn of `shares` and/or `loot` to claim 'fair share' of `guildTokens`./to Account that receives 'fair share'./lootToBurn Baal pure economic weight to burn./sharesToBurn Baal voting weight to burn. | function ragequit(
address to,
uint96 lootToBurn,
uint96 sharesToBurn
| function ragequit(
address to,
uint96 lootToBurn,
uint96 sharesToBurn
| 4,849 |
83 | // Executes the strategy. Does not use the config argument. vaultTokenIn_ the address of the YEarnV2 vault token to exit tokenInAmount_ amount of tokenOut config_ configreturn executeUniLikeFrom always USDC / | function getExecuteDataByAmountIn(
address vaultTokenIn_,
uint256 tokenInAmount_,
bytes memory config_
)
external
view
override
returns (
address executeUniLikeFrom,
| function getExecuteDataByAmountIn(
address vaultTokenIn_,
uint256 tokenInAmount_,
bytes memory config_
)
external
view
override
returns (
address executeUniLikeFrom,
| 33,639 |
7 | // Register `asset`/ If either the erc20 address or the asset was already registered, fail/ return true if the erc20 address was not already registered./ @custom:governance | function register(IAsset asset) external returns (bool);
| function register(IAsset asset) external returns (bool);
| 31,222 |
32 | // renderfunction |
function tokenURI(
uint256 tokenId
)
public
view
virtual
override(IERC721AUpgradeable, ERC721AUpgradeable)
returns (string memory)
|
function tokenURI(
uint256 tokenId
)
public
view
virtual
override(IERC721AUpgradeable, ERC721AUpgradeable)
returns (string memory)
| 25,656 |
65 | // the cliff period has not ended, no tokens to draw down | return 0;
| return 0;
| 2,913 |
31 | // mapping from a pixelId to the price of that pixel | mapping (uint => uint ) private pixelToPrice;
| mapping (uint => uint ) private pixelToPrice;
| 11,793 |
455 | // - Pay submitter with challenger deposits | function doPaySubmitter(bytes32 superblockHash, SuperblockClaim storage claim) internal {
address challenger;
uint bondedDeposit;
for (uint idx=0; idx < claim.challengers.length; ++idx) {
challenger = claim.challengers[idx];
bondedDeposit = claim.bondedDeposits[challe... | function doPaySubmitter(bytes32 superblockHash, SuperblockClaim storage claim) internal {
address challenger;
uint bondedDeposit;
for (uint idx=0; idx < claim.challengers.length; ++idx) {
challenger = claim.challengers[idx];
bondedDeposit = claim.bondedDeposits[challe... | 3,134 |
3 | // The hash of 'ALGEBRA_BASE_PLUGIN_FACTORY_ADMINISTRATOR' used as role/allows to change settings of BasePluginV1Factory | function ALGEBRA_BASE_PLUGIN_FACTORY_ADMINISTRATOR() external pure returns (bytes32);
| function ALGEBRA_BASE_PLUGIN_FACTORY_ADMINISTRATOR() external pure returns (bytes32);
| 27,102 |
140 | // Allows for depositing the underlying asset in exchange for shares assigned to the holder. This facilitates depositing for someone else (using DepositHelper)/ | function depositFor(uint256 amount, address holder) public defense {
_deposit(amount, msg.sender, holder);
}
| function depositFor(uint256 amount, address holder) public defense {
_deposit(amount, msg.sender, holder);
}
| 26,400 |
219 | // Withdraw tokens in unbalanced proportion amount_ amount of internal token to burn outAmountPCTs_ array of token amount percentages to withdrawreturn outAmounts_ array of tokens amounts that were withdrawn/ | function widthdrawUnbalanced (
uint256 amount_,
uint256[N_TOKENS] calldata outAmountPCTs_
)
external
nonReentrant
returns (uint256[N_TOKENS] memory outAmounts_)
| function widthdrawUnbalanced (
uint256 amount_,
uint256[N_TOKENS] calldata outAmountPCTs_
)
external
nonReentrant
returns (uint256[N_TOKENS] memory outAmounts_)
| 31,373 |
464 | // Mark the Vault as initialized. | isInitialized = true;
| isInitialized = true;
| 30,567 |
27 | // Update the time of the last staking action for the staker | staker.timeOfLastUpdate = block.timestamp;
| staker.timeOfLastUpdate = block.timestamp;
| 26,777 |
155 | // The User Contract enables the entering of a deployed swap along with the wrapping of Ether.Thiscontract was specifically made for drct.decentralizedderivatives.org to simplify user metamask calls/ | contract UserContract{
using SafeMath for uint256;
/*Variables*/
TokenToTokenSwap_Interface internal swap;
Wrapped_Ether internal baseToken;
Factory internal factory;
address public factory_address;
address internal owner;
/*Functions*/
constructor() public {
owner = msg.... | contract UserContract{
using SafeMath for uint256;
/*Variables*/
TokenToTokenSwap_Interface internal swap;
Wrapped_Ether internal baseToken;
Factory internal factory;
address public factory_address;
address internal owner;
/*Functions*/
constructor() public {
owner = msg.... | 72,704 |
90 | // vote expire (1 day) | if(block.number.sub(session.blockNo) > NUMBER_OF_BLOCK_FOR_SESSION_EXPIRE) return true;
return false;
| if(block.number.sub(session.blockNo) > NUMBER_OF_BLOCK_FOR_SESSION_EXPIRE) return true;
return false;
| 24,336 |
65 | // Convert back into 18 decimals (1e18) | debtBalance = highPrecisionBalance.preciseDecimalToDecimal();
| debtBalance = highPrecisionBalance.preciseDecimalToDecimal();
| 28,450 |
92 | // fallback to desired wrapper if 0x failed | if (!success) {
swapedTokens = saverSwap(exData, ActionType.SELL);
wrapper = exData.wrapper;
}
| if (!success) {
swapedTokens = saverSwap(exData, ActionType.SELL);
wrapper = exData.wrapper;
}
| 13,425 |
0 | // / | struct Contract{
bytes32 IdTransaction;
bytes32 amount;
bytes32 currency;
bool IsRecovered;
bool IsInDefault;
bool sellerGotPaid;
}
| struct Contract{
bytes32 IdTransaction;
bytes32 amount;
bytes32 currency;
bool IsRecovered;
bool IsInDefault;
bool sellerGotPaid;
}
| 25,809 |
17 | // Ensure that the caller owns the key | modifier onlyKeyOwner(
uint _tokenId
| modifier onlyKeyOwner(
uint _tokenId
| 47,088 |
12 | // -- 해당 후보자가 해당 투표장에 등록된 후보자가 맞는지 검출. 연달아 사용해서 해당 후보자가 해당 투표장에 존재하면 true를 리턴 | function getCandidateId(uint index) constant returns(uint, uint) {
return (candidateList[index].placeID, candidateList[index].candidateID);
}
| function getCandidateId(uint index) constant returns(uint, uint) {
return (candidateList[index].placeID, candidateList[index].candidateID);
}
| 44,924 |
134 | // How many SNX do they have, excluding escrow? Note: We're excluding escrow here because we're interested in their transferable amount and escrowed SNX are not transferable. | uint balance = tokenState.balanceOf(account);
| uint balance = tokenState.balanceOf(account);
| 8,650 |
246 | // Transition `loanState` to `Liquidated` | loanState = State.Liquidated;
emit Liquidation(
amountLiquidated, // Amount of Collateral Asset swapped.
amountRecovered, // Amount of Liquidity Asset recovered from swap.
liquidationExcess, // Amount of Liquidity Asset returned to borrower.
defaultSuf... | loanState = State.Liquidated;
emit Liquidation(
amountLiquidated, // Amount of Collateral Asset swapped.
amountRecovered, // Amount of Liquidity Asset recovered from swap.
liquidationExcess, // Amount of Liquidity Asset returned to borrower.
defaultSuf... | 14,757 |
16 | // return The token being used / | function buck() public view returns(Buck) {
return _buck;
}
| function buck() public view returns(Buck) {
return _buck;
}
| 10,521 |
23 | // Transfer all the funds to the crowdsale address. | sale.transfer(contract_eth_value);
| sale.transfer(contract_eth_value);
| 14,660 |
7 | // SaturatingMath/Sometimes we neither want math operations to error nor wrap around/ on an overflow or underflow. In the case of transferring assets an error/ may cause assets to be locked in an irretrievable state within the erroring/ contract, e.g. due to a tiny rounding/calculation error. We also can't have/ assets... | library SaturatingMath {
/// Saturating addition.
/// @param a_ First term.
/// @param b_ Second term.
/// @return Minimum of a_ + b_ and max uint256.
function saturatingAdd(uint256 a_, uint256 b_)
internal
pure
returns (uint256)
{
unchecked {
uint256 ... | library SaturatingMath {
/// Saturating addition.
/// @param a_ First term.
/// @param b_ Second term.
/// @return Minimum of a_ + b_ and max uint256.
function saturatingAdd(uint256 a_, uint256 b_)
internal
pure
returns (uint256)
{
unchecked {
uint256 ... | 21,030 |
22 | // a helper function which be used to prove a users tickets were included in the lottery | function checkMerkleProof (
address user,
uint256 first,
uint256 last,
bytes32 merkleRoot,
| function checkMerkleProof (
address user,
uint256 first,
uint256 last,
bytes32 merkleRoot,
| 32,910 |
148 | // debug function for testrpc | return this.balance;
| return this.balance;
| 34,863 |
5 | // how much should service get | uint256 serviceAmount = balance - clientAmount;
| uint256 serviceAmount = balance - clientAmount;
| 41,998 |
52 | // This updates the interest rate model for the risky tokeninterestRateModel The interest rate model for the risky token Requirements: - Only the Int Governance can update this value.- Interest rate model and token cannot be the address zero / | function setRiskyTokenInterestRateModel(address interestRateModel)
external
onlyOwner
| function setRiskyTokenInterestRateModel(address interestRateModel)
external
onlyOwner
| 1,588 |
3 | // mapping from alphaIndex to its score | string[4] _alphas = [
"8",
"7",
"6",
"5"
];
IWoolf public woolf;
| string[4] _alphas = [
"8",
"7",
"6",
"5"
];
IWoolf public woolf;
| 18,488 |
17 | // swap ETH -> LUSD | if (_ethAmount > 0) {
xrouter.functionCallWithValue(_ethSwapData, _ethAmount);
}
| if (_ethAmount > 0) {
xrouter.functionCallWithValue(_ethSwapData, _ethAmount);
}
| 13,731 |
1 | // Whether to allow this token into the bridge. | bool enabled;
| bool enabled;
| 25,245 |
49 | // Submit index-matching arrays that form Phase 0 DepositData objects./ Will create a deposit transaction per index of the arrays submitted./pubkeys - An array of BLS12-381 public keys./withdrawal_credentials - An array of public keys for withdrawals./signatures - An array of BLS12-381 signatures./deposit_data_roots - ... | function batchDeposit(
bytes[] calldata pubkeys,
bytes[] calldata withdrawal_credentials,
bytes[] calldata signatures,
bytes32[] calldata deposit_data_roots,
uint256 service_charge
| function batchDeposit(
bytes[] calldata pubkeys,
bytes[] calldata withdrawal_credentials,
bytes[] calldata signatures,
bytes32[] calldata deposit_data_roots,
uint256 service_charge
| 4,597 |
135 | // A helper contract that provides a way to restrict callers of restricted functions/ to a single address. This allows for a trusted call chain,/ as described in :ref:`contracts' architecture <contracts-architecture>`. | contract RestrictedCalls is Ownable {
/// Maps caller chain IDs to tuples [caller, messenger].
///
/// For same-chain calls, the messenger address is 0x0.
mapping(uint256 => address[2]) public callers;
function _addCaller(
uint256 callerChainId,
address caller,
address messe... | contract RestrictedCalls is Ownable {
/// Maps caller chain IDs to tuples [caller, messenger].
///
/// For same-chain calls, the messenger address is 0x0.
mapping(uint256 => address[2]) public callers;
function _addCaller(
uint256 callerChainId,
address caller,
address messe... | 11,302 |
2 | // ============================== ERC20 | event onTransfer(
address indexed from,
address indexed to,
uint tokens
);
event receivedTokens(
address indexed _from,
uint _value
);
| event onTransfer(
address indexed from,
address indexed to,
uint tokens
);
event receivedTokens(
address indexed _from,
uint _value
);
| 14,182 |
6 | // Modifier checks if the request already is in emergencyState._paymentRef Reference of the payment related.It requires the requestMapping[_paymentRef].emergencyState to be false./ | modifier IsNotInEmergencyState(bytes memory _paymentRef) {
require(!requestMapping[_paymentRef].emergencyState, "In emergencyState");
_;
}
| modifier IsNotInEmergencyState(bytes memory _paymentRef) {
require(!requestMapping[_paymentRef].emergencyState, "In emergencyState");
_;
}
| 22,681 |
167 | // ensure account have escrow migration pending | require(totalEscrowedAccountBalance[addressToMigrate] > 0, "Address escrow balance is 0");
require(totalBalancePendingMigration[addressToMigrate] > 0, "No escrow migration pending");
| require(totalEscrowedAccountBalance[addressToMigrate] > 0, "Address escrow balance is 0");
require(totalBalancePendingMigration[addressToMigrate] > 0, "No escrow migration pending");
| 24,205 |
6 | // start with index 1 | activityOwners[numberOfActivity] = msg.sender;
emit ActivityCreated(_name, msg.sender, _limit, _date);
| activityOwners[numberOfActivity] = msg.sender;
emit ActivityCreated(_name, msg.sender, _limit, _date);
| 39,377 |
1 | // transfer / | function transferInternal(STransferData memory _transferData)
override internal returns (bool)
| function transferInternal(STransferData memory _transferData)
override internal returns (bool)
| 14,368 |
30 | // Return 1Split swap function sig / | function getOneSplitSig() internal pure returns (bytes4) {
return 0xf88309d7;
}
| function getOneSplitSig() internal pure returns (bytes4) {
return 0xf88309d7;
}
| 53,770 |
84 | // log event | emit Transfer(0x0, _account, _tokens);
emit TokensMinted(_mint_type, _account, _tokens, _term);
| emit Transfer(0x0, _account, _tokens);
emit TokensMinted(_mint_type, _account, _tokens, _term);
| 43,002 |
2 | // _reserve underlying token address | function getReserveData(address _reserve)
external virtual
view
returns (
uint256 totalLiquidity, // reserve total liquidity
uint256 availableLiquidity, // reserve available liquidity for borrowing
uint256 totalBorrowsStable, ... | function getReserveData(address _reserve)
external virtual
view
returns (
uint256 totalLiquidity, // reserve total liquidity
uint256 availableLiquidity, // reserve available liquidity for borrowing
uint256 totalBorrowsStable, ... | 19,799 |
10 | // Update storedTotalAssets on withdraw/redeem | function beforeWithdraw(uint256 amount, uint256 shares) internal virtual override {
super.beforeWithdraw(amount, shares);
storedTotalAssets -= amount;
}
| function beforeWithdraw(uint256 amount, uint256 shares) internal virtual override {
super.beforeWithdraw(amount, shares);
storedTotalAssets -= amount;
}
| 36,851 |
52 | // Edit the canvas by buying new pixels and changing price and color of ones already/ owned. The given buyer address must either be the sender or the sender must have been/ approved-for-all by the buyer address. Bought pixels will be transferred to the given/ buyer address. This function works for both existant and non... | function edit(
address buyerAddress,
PixelBuyArgs[] memory buyArgss,
SetColorArgs[] memory setColorArgss,
SetPriceArgs[] memory setPriceArgss
| function edit(
address buyerAddress,
PixelBuyArgs[] memory buyArgss,
SetColorArgs[] memory setColorArgss,
SetPriceArgs[] memory setPriceArgss
| 22,143 |
69 | // end the whole Sale after the current round | function endSale() onlyAdmin public {
saleActive = false;
endNum = roundNum.add(1);
emit EndingSale(msg.sender, roundNum, now);
}
| function endSale() onlyAdmin public {
saleActive = false;
endNum = roundNum.add(1);
emit EndingSale(msg.sender, roundNum, now);
}
| 9,844 |
76 | // Sets {decimals} to a value other than the default one of 18. WARNING: This function should only be called from the constructor. Mostapplications that interact with token contracts will not expect{decimals} to ever change, and may work incorrectly if it does. / | function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
| function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
| 1,618 |
41 | // get current C-Level, without accounting for pending adjustments l storage layout struct isCall whether query is for call or put poolreturn cLevel64x64 64x64 fixed point representation of C-Level / | function getRawCLevel64x64(Layout storage l, bool isCall)
internal
view
returns (int128 cLevel64x64)
| function getRawCLevel64x64(Layout storage l, bool isCall)
internal
view
returns (int128 cLevel64x64)
| 13,103 |
12 | // transfer token for a specified address _to The address to transfer to. _value The amount to be transferred. / | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _... | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _... | 37,591 |
78 | // Tells whether an operator is approved by a given keyManager _owner owner address which you want to query the approval of _operator operator address which you want to query the approval ofreturn bool whether the given operator is approved by the given owner / | function isApprovedForAll(
address _owner,
address _operator
| function isApprovedForAll(
address _owner,
address _operator
| 2,284 |
19 | // This abstract contract provides a fallback function that delegates all calls to another contract using the EVMinstruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to | * be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned ... | * be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned ... | 222 |
89 | // transfer amount minus burn amount | return super.transfer(recipient, amount.sub(burnAmount));
| return super.transfer(recipient, amount.sub(burnAmount));
| 21,310 |
54 | // for views | function getKeys() public view returns(uint) {
return goldKeyRepo[msg.sender];
}
| function getKeys() public view returns(uint) {
return goldKeyRepo[msg.sender];
}
| 33,806 |
15 | // Remove sender from current position. | accountsLL[oldPrev] = accountsLL[msg.sender];
| accountsLL[oldPrev] = accountsLL[msg.sender];
| 21,288 |
290 | // Cancels the salary and transfers the tokens back on a pro rata basis. Throws if the id does not point to a valid salary. Throws if the caller is not the company or the employee. Throws if there is a token transfer failure. salaryId The id of the salary to cancel.return bool true=success, false otherwise. / | function cancelSalary(uint256 salaryId)
external
salaryExists(salaryId)
onlyCompanyOrEmployee(salaryId)
returns (bool success)
| function cancelSalary(uint256 salaryId)
external
salaryExists(salaryId)
onlyCompanyOrEmployee(salaryId)
returns (bool success)
| 43,603 |
26 | // Updates vote delegation stakeID - ID of the stake to delegate votes uber to - address to delegate to / | function delegate(uint256 stakeID, address to)
public
stakeExist(msg.sender, stakeID)
| function delegate(uint256 stakeID, address to)
public
stakeExist(msg.sender, stakeID)
| 42,014 |
1 | // Length of time where the withdrawal window is active | uint256 private constant withdrawalWindowLength = 1 days;
| uint256 private constant withdrawalWindowLength = 1 days;
| 35,001 |
13 | // uint256 _deviceHostIndex, | uint256 _rewardProportion
) public recordChainlinkFulfillment(_requestId)
| uint256 _rewardProportion
) public recordChainlinkFulfillment(_requestId)
| 51,142 |
26 | // Allows the pendingOwner address to finalize the transfer. / | function claimOwnership() onlyPendingOwner public {
OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
| function claimOwnership() onlyPendingOwner public {
OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
| 1,681 |
210 | // Set the insurance mine rate per block. (e.g. 1.189e18 ~ 5% liquidity mine (50mm tokens)) | dsInsuranceFund.mineRatePerBlock = _mineRatePerBlock;
| dsInsuranceFund.mineRatePerBlock = _mineRatePerBlock;
| 34,836 |
12 | // Signature type used by the Order: EOA, POLY_PROXY or POLY_GNOSIS_SAFE | SignatureType signatureType;
| SignatureType signatureType;
| 1,393 |
50 | // Percentage of global debt that should be covered by the buffer | uint256 public coveredDebt; // [thousand]
| uint256 public coveredDebt; // [thousand]
| 52,207 |
157 | // Then fill up the junior tranche with all the interest remaining, upto the principal share price | uint256 expectedInterestSharePrice = slice.juniorTranche.interestSharePrice.add(
usdcToSharePrice(interestRemaining, slice.juniorTranche.principalDeposited)
);
uint256 expectedPrincipalSharePrice = calculateExpectedSharePrice(
slice.juniorTranche,
sliceInfo.principalAccrued,
slice
... | uint256 expectedInterestSharePrice = slice.juniorTranche.interestSharePrice.add(
usdcToSharePrice(interestRemaining, slice.juniorTranche.principalDeposited)
);
uint256 expectedPrincipalSharePrice = calculateExpectedSharePrice(
slice.juniorTranche,
sliceInfo.principalAccrued,
slice
... | 26,882 |
120 | // calculate trading fee | function _getTradingFee(
uint256 feeTokenAmount)
internal
view
returns (uint256)
| function _getTradingFee(
uint256 feeTokenAmount)
internal
view
returns (uint256)
| 51,474 |
97 | // stddev calculates the standard deviation for an array of integers precision is the same as sqrt above meaning for higher precision the decimal place must be moved prior to passing the params numbers uint[] array of numbers to be used in calculation / | function stddev(uint[] memory numbers) public pure returns (uint256 sd) {
uint sum = 0;
for(uint i = 0; i < numbers.length; i++) {
sum += numbers[i];
}
uint256 mean = sum / numbers.length; // Integral value; float not supported in Solidity
sum = 0;
... | function stddev(uint[] memory numbers) public pure returns (uint256 sd) {
uint sum = 0;
for(uint i = 0; i < numbers.length; i++) {
sum += numbers[i];
}
uint256 mean = sum / numbers.length; // Integral value; float not supported in Solidity
sum = 0;
... | 16,799 |
8 | // Define an internal function '_removeRetailer' to remove this role, called by 'removeRetailer' | function _removeManufacturer(address account) internal {
revokeRole(MANUFACTURER_ROLE, account);
}
| function _removeManufacturer(address account) internal {
revokeRole(MANUFACTURER_ROLE, account);
}
| 19,472 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.