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 |
|---|---|---|---|---|
1,052 | // Handle SpendAssetsHandleType.Remove separately | if (_spendAssetsHandleType == SpendAssetsHandleType.Remove) {
outgoingAssetsCount++;
continue;
}
| if (_spendAssetsHandleType == SpendAssetsHandleType.Remove) {
outgoingAssetsCount++;
continue;
}
| 44,491 |
166 | // Add minting fees | _locals.amountEthToWithdraw += _locals.fee;
require(_locals.amountEthToWithdraw <= msg.value);
| _locals.amountEthToWithdraw += _locals.fee;
require(_locals.amountEthToWithdraw <= msg.value);
| 36,849 |
6 | // Total Market Cap/USD Oracle Address | ChainlinkOracle public immutable tcapOracle;
| ChainlinkOracle public immutable tcapOracle;
| 6,964 |
630 | // Sets the wrapped eth token and clipper exhange interfaceBoth values are immutable: they can only be set once duringconstruction. / | constructor(IWETH weth)
UnoswapV3Router(weth)
ClipperRouter(weth)
OrderMixin(weth)
OrderRFQMixin(weth)
{
if (address(weth) == address(0)) revert ZeroAddress();
}
| constructor(IWETH weth)
UnoswapV3Router(weth)
ClipperRouter(weth)
OrderMixin(weth)
OrderRFQMixin(weth)
{
if (address(weth) == address(0)) revert ZeroAddress();
}
| 12,159 |
81 | // E.g $0.4 | return farmShare.div(5);
| return farmShare.div(5);
| 52,240 |
31 | // Process sequencer transactions first. | numSequencerTransactions += uint32(curContext.numSequencedTransactions);
| numSequencerTransactions += uint32(curContext.numSequencedTransactions);
| 29,258 |
100 | // Set the reward token liquidation threshold. _threshold Threshold amount in decimals of reward token that willcause the Vault to claim and withdrawAll on allocate() calls. / | function setRewardLiquidationThreshold(uint256 _threshold)
external
onlyGovernor
| function setRewardLiquidationThreshold(uint256 _threshold)
external
onlyGovernor
| 43,249 |
161 | // Calculates the total value of given amounts of assets in a single quote asset/_baseAssets The assets to convert/_amounts The amounts of the _baseAssets to convert/_quoteAsset The asset to which to convert/ return value_ The sum value of _baseAssets, denominated in the _quoteAsset/Does not alter protocol state,/ but ... | function calcCanonicalAssetsTotalValue(
address[] memory _baseAssets,
uint256[] memory _amounts,
address _quoteAsset
) external override returns (uint256 value_) {
require(
_baseAssets.length == _amounts.length,
"calcCanonicalAssetsTotalValue: Arrays unequ... | function calcCanonicalAssetsTotalValue(
address[] memory _baseAssets,
uint256[] memory _amounts,
address _quoteAsset
) external override returns (uint256 value_) {
require(
_baseAssets.length == _amounts.length,
"calcCanonicalAssetsTotalValue: Arrays unequ... | 52,006 |
59 | // = users[_owner].purchaseList; | return _purchases;
| return _purchases;
| 13,886 |
3 | // transferOwnership(msg.sender); | token = NectarToken(_token);
staking = ArbiterStaking(_arbiterStaking);
arbiterVoteWindow = _arbiterVoteWindow;
| token = NectarToken(_token);
staking = ArbiterStaking(_arbiterStaking);
arbiterVoteWindow = _arbiterVoteWindow;
| 41,156 |
36 | // Immortals are not divisible and their value is 100 BP | WarriorsAssignedToBattlefield(msg.sender, immortals, _warriors.mul(BP_IMMORTAL));
return true;
| WarriorsAssignedToBattlefield(msg.sender, immortals, _warriors.mul(BP_IMMORTAL));
return true;
| 8,775 |
310 | // Gets the user's account liquidity and account shortfall balances. This includes any accumulated interest thus far but does NOT actually update anything in storage, it simply calculates the account liquidity and shortfall with liquidity being returned as the first Exp, ie (Error, accountLiquidity, accountShortfall).r... | function calculateAccountLiquidity(address userAddress)
internal
view
returns (
Error,
Exp memory,
Exp memory
)
| function calculateAccountLiquidity(address userAddress)
internal
view
returns (
Error,
Exp memory,
Exp memory
)
| 12,225 |
2 | // Sell Fees | uint256 public burnFeeSell = 100;
uint256 public gov1FeeSell = 100;
uint256 public gov2FeeSell = 200;
uint256 public liquidityFeeSell = 200;
uint256 public jackpotFeeSell = 300;
uint256 public bonusFeeSell = 300;
uint256 public devFeeSell = 300;
uint256 public totalFeeSell = 1500;
| uint256 public burnFeeSell = 100;
uint256 public gov1FeeSell = 100;
uint256 public gov2FeeSell = 200;
uint256 public liquidityFeeSell = 200;
uint256 public jackpotFeeSell = 300;
uint256 public bonusFeeSell = 300;
uint256 public devFeeSell = 300;
uint256 public totalFeeSell = 1500;
| 17,758 |
6 | // returns the unclaimed rewards of the user _user the address of the userreturn the unclaimed user rewards / | function getUserUnclaimedRewards(address _user) external view returns (uint256) {
return _usersUnclaimedRewards[_user];
}
| function getUserUnclaimedRewards(address _user) external view returns (uint256) {
return _usersUnclaimedRewards[_user];
}
| 6,598 |
0 | // This wiil get initialize to 0! | uint256 favoriteNumber;
| uint256 favoriteNumber;
| 15,796 |
5 | // Same reason as `div`. | require(b > 0, "SafeMath: modulo by zero");
return a % b;
| require(b > 0, "SafeMath: modulo by zero");
return a % b;
| 7,619 |
53 | // // FlightSurety Smart Contract// / | contract FlightSuretyApp {
using SafeMath for uint256; // Allow SafeMath functions to be called for all uint256 types (similar to "prototype" in Javascript)
/********************************************************************************************/
/* DATA VARIABLES... | contract FlightSuretyApp {
using SafeMath for uint256; // Allow SafeMath functions to be called for all uint256 types (similar to "prototype" in Javascript)
/********************************************************************************************/
/* DATA VARIABLES... | 5,758 |
2 | // Constructor _baseBoxAddress boxBase address / | constructor(address _baseBoxAddress) BoxProxy(_baseBoxAddress) {}
/**
* @dev lock a box until a timestamp
*
* @param boxId id of the box
* @param timestamp unlock timestamp
*/
function _lockBox(uint256 boxId, uint256 timestamp) internal virtual {
_unlockTimestamp[boxId] = t... | constructor(address _baseBoxAddress) BoxProxy(_baseBoxAddress) {}
/**
* @dev lock a box until a timestamp
*
* @param boxId id of the box
* @param timestamp unlock timestamp
*/
function _lockBox(uint256 boxId, uint256 timestamp) internal virtual {
_unlockTimestamp[boxId] = t... | 11,621 |
142 | // Info of each user that stakes tokens, per chess.com username. | mapping(bytes32 => UserInfo) public userInfoName;
| mapping(bytes32 => UserInfo) public userInfoName;
| 8,505 |
116 | // fetches all the pools data/ return uint256 VUreinsurnacePool/ return uint256 LUreinsurnacePool/ return uint256 LUleveragePool/ return uint256 user leverage pool address | function getPoolsData()
external
view
returns (
uint256,
uint256,
uint256,
address
);
| function getPoolsData()
external
view
returns (
uint256,
uint256,
uint256,
address
);
| 72,692 |
67 | // If n is odd, store x in z for now. | z := x
| z := x
| 37,293 |
41 | // LinearPool | function getMainToken() external view returns (address);
function getWrappedToken() external view returns (address);
function getBptIndex() external view returns (uint256);
function getMainIndex() external view returns (uint256);
function getWrappedIndex() external view returns (uint256);
function getRate() exter... | function getMainToken() external view returns (address);
function getWrappedToken() external view returns (address);
function getBptIndex() external view returns (uint256);
function getMainIndex() external view returns (uint256);
function getWrappedIndex() external view returns (uint256);
function getRate() exter... | 2,000 |
25 | // Register whether or not the new owner is willing to accept ownership. | _willAcceptOwnership[controller][msg.sender] = willAcceptOwnership;
| _willAcceptOwnership[controller][msg.sender] = willAcceptOwnership;
| 17,543 |
22 | // Shift in bits from prod1 into prod0. | prod0 |= prod1 * lpotdod;
| prod0 |= prod1 * lpotdod;
| 16,693 |
6 | // Hook that is called before any transfer of tokens. This includes minting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of `from`'s tokens will be transferred to `to`.- when `from` is zero, `amount` tokens will be minted for `to`.- when `to` is zero, `amount` of `from`'s tokens w... | function _beforeTokenTransfer(
address from,
address to,
uint256 amount
| function _beforeTokenTransfer(
address from,
address to,
uint256 amount
| 20,957 |
0 | // Guillaume Gonnaud 2019/Cryptoraph Indexer Header/Contain all the events emitted by the Cryptoraph Indexer | contract CryptographIndexHeaderV1 {
}
| contract CryptographIndexHeaderV1 {
}
| 11,540 |
89 | // claims accrued stkAave rewards for given aTokens in treasurytokens address[] memory / | function harvestFor( address[] calldata tokens ) external {
address _treasury = address( treasury );
if( depositToTreasury ) {
incentives.claimRewardsOnBehalf( tokens, rewardsPending( _treasury ), _treasury, _treasury );
} else {
incentives.claimRewards( tokens, rewar... | function harvestFor( address[] calldata tokens ) external {
address _treasury = address( treasury );
if( depositToTreasury ) {
incentives.claimRewardsOnBehalf( tokens, rewardsPending( _treasury ), _treasury, _treasury );
} else {
incentives.claimRewards( tokens, rewar... | 19,469 |
21 | // ZONE tokens which not distributed because there are no depositor | uint256 public unusedZone;
| uint256 public unusedZone;
| 15,800 |
3 | // get a color from bytes | function getColor(byte _red, byte _green, byte _blue) internal pure returns(uint24) {
return uint24(_red)*65536 + uint24(_green)*256 + uint24(_blue);
}
| function getColor(byte _red, byte _green, byte _blue) internal pure returns(uint24) {
return uint24(_red)*65536 + uint24(_green)*256 + uint24(_blue);
}
| 41,961 |
170 | // underlier remains the same for all proxy instances of this contract | address underlierToken_ = IWrappedPosition(wrappedPosition_).token();
underlierToken = underlierToken_;
underlierScale = 10**IERC20Metadata(underlierToken_).decimals();
vaultType = bytes32("ERC20:EPT");
| address underlierToken_ = IWrappedPosition(wrappedPosition_).token();
underlierToken = underlierToken_;
underlierScale = 10**IERC20Metadata(underlierToken_).decimals();
vaultType = bytes32("ERC20:EPT");
| 33,481 |
17 | // Wrappers over Solidity's arithmetic operations. NOTE: SafeMath is generally not needed starting with Solidity 0.8, since the compilernow has built in overflow checking. / | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (f... | library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (f... | 13,017 |
5 | // Transfers aTokens in the event of a borrow being liquidated, in case the liquidators reclaims the aToken from The address getting liquidated, current owner of the aTokens to The recipient value The amount of tokens getting transferred / | function transferOnLiquidation(address from, address to, uint256 value) external;
| function transferOnLiquidation(address from, address to, uint256 value) external;
| 25,546 |
65 | // allocate tokens for future wallet locked in for 3 years | twentyThirtyAllocation = new UnsoldAllocation(futureStorageYears,twentyThirtyVault,twentyThirtyTokens);
balances[address(twentyThirtyAllocation)] = twentyThirtyTokens;
fundingMode = false;
| twentyThirtyAllocation = new UnsoldAllocation(futureStorageYears,twentyThirtyVault,twentyThirtyTokens);
balances[address(twentyThirtyAllocation)] = twentyThirtyTokens;
fundingMode = false;
| 14,034 |
183 | // tokens we're farming | IERC20 public constant crv = IERC20(0xD533a949740bb3306d119CC777fa900bA034cd52);
IERC20 public constant ldo = IERC20(0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32);
| IERC20 public constant crv = IERC20(0xD533a949740bb3306d119CC777fa900bA034cd52);
IERC20 public constant ldo = IERC20(0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32);
| 35,907 |
296 | // Function can be called by an FXS holder to have the protocol buy back FXS with excess collateral value from a desired collateral pool This can also happen if the collateral ratio > 1 | function buyBackFXS(uint256 FXS_amount, uint256 COLLATERAL_out_min) external {
require(buyBackPaused == false, "Buyback is paused");
uint256 fxs_price = FRAX.fxs_price();
FraxPoolLibrary.BuybackFXS_Params memory input_params = FraxPoolLibrary.BuybackFXS_Params(
availableExce... | function buyBackFXS(uint256 FXS_amount, uint256 COLLATERAL_out_min) external {
require(buyBackPaused == false, "Buyback is paused");
uint256 fxs_price = FRAX.fxs_price();
FraxPoolLibrary.BuybackFXS_Params memory input_params = FraxPoolLibrary.BuybackFXS_Params(
availableExce... | 12,235 |
4 | // emit when owner has changed max player param | event MaxPlayersAllowedUpdated(uint256 maxPlayersAllowed);
| event MaxPlayersAllowedUpdated(uint256 maxPlayersAllowed);
| 25,893 |
4 | // ERC721 - Lock as role Allow locking tokens by any sender who has the LOCKER_ROLE. @custom:type eip-2535-facet@custom:category NFTs@custom:required-dependencies IERC721LockableExtension@custom:provides-interfaces IERC721LockableRoleBased / | contract ERC721LockableRoleBased is IERC721LockableRoleBased, AccessControlInternal {
bytes32 public constant LOCKER_ROLE = keccak256("LOCKER_ROLE");
/**
* @inheritdoc IERC721LockableRoleBased
*/
function lockByRole(uint256 id) external virtual onlyRole(LOCKER_ROLE) {
IERC721LockableExten... | contract ERC721LockableRoleBased is IERC721LockableRoleBased, AccessControlInternal {
bytes32 public constant LOCKER_ROLE = keccak256("LOCKER_ROLE");
/**
* @inheritdoc IERC721LockableRoleBased
*/
function lockByRole(uint256 id) external virtual onlyRole(LOCKER_ROLE) {
IERC721LockableExten... | 33,700 |
63 | // Update the lock. | lockedBalanceOf[_holder][_projectId] =
lockedBalanceOf[_holder][_projectId] +
_amount;
lockedBalanceBy[msg.sender][_holder][_projectId] =
lockedBalanceBy[msg.sender][_holder][_projectId] +
_amount;
emit Lock(_holder, _projectId, _amount, msg.sende... | lockedBalanceOf[_holder][_projectId] =
lockedBalanceOf[_holder][_projectId] +
_amount;
lockedBalanceBy[msg.sender][_holder][_projectId] =
lockedBalanceBy[msg.sender][_holder][_projectId] +
_amount;
emit Lock(_holder, _projectId, _amount, msg.sende... | 35,735 |
138 | // percent of tokens to be generated for the team | uint256 public constant PRCT_TEAM = 10;
| uint256 public constant PRCT_TEAM = 10;
| 33,442 |
68 | // Interface of the OFT standard / | interface IOFT is IOFTCore, IERC20 {
}
| interface IOFT is IOFTCore, IERC20 {
}
| 2,720 |
65 | // update the user information about the rewardDebt | newRewardDebt = prevRewardDebt - claimableRewards(_pid, _address);
user.rewardDebt = newRewardDebt;
| newRewardDebt = prevRewardDebt - claimableRewards(_pid, _address);
user.rewardDebt = newRewardDebt;
| 24,174 |
6 | // return 9e38 / 1e18 = 9e18 | return z.div(scale);
| return z.div(scale);
| 16,883 |
53 | // The interface can freeze tokens/_owner The owner of the tokens/_tokens The amount of tokens to freeze | function interfaceFreezeTokens(address _owner, uint _tokens)
public
onlyInterfaceContract
hasAvailableTokens(_owner, _tokens)
| function interfaceFreezeTokens(address _owner, uint _tokens)
public
onlyInterfaceContract
hasAvailableTokens(_owner, _tokens)
| 17,329 |
93 | // User has to send at least the ether value of one token. | assert(msg.value >= MIN_INVESTMENT);
_;
| assert(msg.value >= MIN_INVESTMENT);
_;
| 36,708 |
130 | // Internal function to mint a new token.Reverts if the given token ID already exists. to address the beneficiary that will own the minted token tokenId uint256 ID of the token to be minted / | function _mint(address to, uint256 tokenId) internal {
super._mint(to, tokenId);
_addTokenToOwnerEnumeration(to, tokenId);
_addTokenToAllTokensEnumeration(tokenId);
}
| function _mint(address to, uint256 tokenId) internal {
super._mint(to, tokenId);
_addTokenToOwnerEnumeration(to, tokenId);
_addTokenToAllTokensEnumeration(tokenId);
}
| 37,937 |
27 | // the The awardable balance | uint256 internal _currentAwardBalance;
| uint256 internal _currentAwardBalance;
| 38,482 |
9 | // This constructor does a nifty trick to tell the `UsingWitnet` library where/ to find the Witnet contracts on whatever network you use. | constructor (WitnetRequestBoard _wrb) UsingWitnet(_wrb) {
// Instantiate the Witnet request
request = new BitcoinPriceRequest();
// Note: the request cannot be initialized here, as some EVM/OVM implementations
// may struggle with constructors containining arbitrary byte arrays or s... | constructor (WitnetRequestBoard _wrb) UsingWitnet(_wrb) {
// Instantiate the Witnet request
request = new BitcoinPriceRequest();
// Note: the request cannot be initialized here, as some EVM/OVM implementations
// may struggle with constructors containining arbitrary byte arrays or s... | 22,104 |
167 | // Deposit LP tokens to MasterChef for Storm allocation. | function deposit(uint256 _pid, uint256 _amount, address _referrer) external nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (_amount > 0 && address(referral) != address(0) && _referrer != address(0) && _r... | function deposit(uint256 _pid, uint256 _amount, address _referrer) external nonReentrant {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (_amount > 0 && address(referral) != address(0) && _referrer != address(0) && _r... | 8,091 |
10 | // Initialize the ERC20 for USDC or DAI | IERC20 erc20 = IERC20(ERC20_ADDRESS);
| IERC20 erc20 = IERC20(ERC20_ADDRESS);
| 1,132 |
50 | // Gather response as a BorderQuery[] | BorderQuery[] memory baseParcelBorders = new BorderQuery[](
numOfBorders
);
| BorderQuery[] memory baseParcelBorders = new BorderQuery[](
numOfBorders
);
| 16,988 |
31 | // Accrue interest and calculate exchange rate | uint256 underlyingAmount = _valueInUnderlying(amount, exchangeRate());
require(
underlyingAmount <= totalUnderlyingSupply(),
"Teller: redeem ttoken lp not enough supply"
);
| uint256 underlyingAmount = _valueInUnderlying(amount, exchangeRate());
require(
underlyingAmount <= totalUnderlyingSupply(),
"Teller: redeem ttoken lp not enough supply"
);
| 8,748 |
13 | // update contract states | uint256 leafIndex = merkleWidth - 1 + leafCount; // specify the index of the commitment within the merkleTree
merkleTree[leafIndex] = bytes27(_commitment<<40); // add the commitment to the merkleTree
commitments[_commitment] = _commitment; // add the commitment
bytes32 root = updatePat... | uint256 leafIndex = merkleWidth - 1 + leafCount; // specify the index of the commitment within the merkleTree
merkleTree[leafIndex] = bytes27(_commitment<<40); // add the commitment to the merkleTree
commitments[_commitment] = _commitment; // add the commitment
bytes32 root = updatePat... | 8,776 |
0 | // 1. Create a public payable address variable named `corporate_account` and assign a valid Ethereum address to it. | address payable public corporate_account = 0x77B2aD074a1aF1AF2a408E3D48465E5F9ec75f45;
| address payable public corporate_account = 0x77B2aD074a1aF1AF2a408E3D48465E5F9ec75f45;
| 44,002 |
17 | // Calculates the current borrow interest rate per blockcash The total amount of cash the market hasborrows The total amount of borrows the market has outstandingreserves The total amount of reserves the market has return The borrow rate per block (as a percentage, and scaled by 1e18)/ | function getBorrowRate(uint cash, uint borrows, uint reserves) virtual external view returns (uint);
| function getBorrowRate(uint cash, uint borrows, uint reserves) virtual external view returns (uint);
| 30,437 |
360 | // round 51 | ark(i, q, 3078975275808111706229899605611544294904276390490742680006005661017864583210);
sbox_partial(i, q);
mix(i, q);
| ark(i, q, 3078975275808111706229899605611544294904276390490742680006005661017864583210);
sbox_partial(i, q);
mix(i, q);
| 31,633 |
203 | // read the current registration configuration / | function getRegistrationConfig()
external
view
returns (
bool enabled,
uint32 windowSizeInBlocks,
uint16 allowedPerWindow,
address keeperRegistry,
uint64 windowStart,
uint16 approvedInCurrentWindow
| function getRegistrationConfig()
external
view
returns (
bool enabled,
uint32 windowSizeInBlocks,
uint16 allowedPerWindow,
address keeperRegistry,
uint64 windowStart,
uint16 approvedInCurrentWindow
| 46,878 |
9 | // Withdraw Ether to owner, the only way to take back Ether for hacker. you can transfer inside receive function, because insufficient gas to process, as the host use transfer to return Ether. / | function withdraw() external onlyHacker {
hacker.transfer(address(this).balance);
}
| function withdraw() external onlyHacker {
hacker.transfer(address(this).balance);
}
| 36,457 |
1 | // =============== MINTING =============== | function getBatchMintPrice(
MintRequest[] calldata mintRequest
| function getBatchMintPrice(
MintRequest[] calldata mintRequest
| 9,876 |
9 | // Get configuration as uint256 value | function getConfigAsUint256(
ISuperfluid host,
ISuperfluidToken superToken,
bytes32 key) external view returns (uint256 value);
| function getConfigAsUint256(
ISuperfluid host,
ISuperfluidToken superToken,
bytes32 key) external view returns (uint256 value);
| 16,891 |
84 | // Exchange ETH for SGR. Can be executed from externally-owned accounts but not from other contracts. This is due to the insufficient gas-stipend provided to the fallback function. / | function() external payable {
ISGRTokenManager sgrTokenManager = getSGRTokenManager();
uint256 amount = sgrTokenManager.exchangeEthForSgr(msg.sender, msg.value);
_mint(msg.sender, amount);
sgrTokenManager.afterExchangeEthForSgr(msg.sender, msg.value, amount);
}
| function() external payable {
ISGRTokenManager sgrTokenManager = getSGRTokenManager();
uint256 amount = sgrTokenManager.exchangeEthForSgr(msg.sender, msg.value);
_mint(msg.sender, amount);
sgrTokenManager.afterExchangeEthForSgr(msg.sender, msg.value, amount);
}
| 86,086 |
51 | // Change safeguard status on or off When safeguard is true, then all the non-owner functions will stop working.When safeguard is false, then all the functions will resume working back again! / | function changeSafeguardStatus() onlyOwner public{
if (safeGuard == false){
safeGuard = true;
}
else{
safeGuard = false;
}
}
| function changeSafeguardStatus() onlyOwner public{
if (safeGuard == false){
safeGuard = true;
}
else{
safeGuard = false;
}
}
| 15,597 |
246 | // Convex Volatile/FRAXBP ============================================ | // {
// // Half of the LP is FRAXBP. Half of that should be FRAX.
// // Using 0.25 * lp price for gas savings
// frax_per_lp_token = curvePool.lp_price() / 4;
// }
| // {
// // Half of the LP is FRAXBP. Half of that should be FRAX.
// // Using 0.25 * lp price for gas savings
// frax_per_lp_token = curvePool.lp_price() / 4;
// }
| 40,261 |
80 | // new converter - get the type from the converter itself | if (isV28OrHigherConverter(_oldConverter)) {
newType = _oldConverter.converterType();
} else if (reserveTokenCount > 1) {
| if (isV28OrHigherConverter(_oldConverter)) {
newType = _oldConverter.converterType();
} else if (reserveTokenCount > 1) {
| 37,856 |
16 | // Returns the amount of tokens currently held by the contractreturn Tokens held in the contract / | function currentBalance() public view override returns (uint256) {
return token.balanceOf(address(this));
}
| function currentBalance() public view override returns (uint256) {
return token.balanceOf(address(this));
}
| 21,260 |
81 | // Only owner adjust contract balance variable (only used for max profit calc) | function ownerUpdateContractBalance(uint newContractBalance, uint divRate) public
onlyOwner
| function ownerUpdateContractBalance(uint newContractBalance, uint divRate) public
onlyOwner
| 13,826 |
30 | // If claimStatus is false then it means that there are some elements that are yet to be claimedso we will go down and search there | if (!claimStatus && high != mid) {
high = mid;
} else {
| if (!claimStatus && high != mid) {
high = mid;
} else {
| 23,438 |
344 | // Strategy is already finalized | uint256 internal constant STRATEGY_IS_ALREADY_FINALIZED = 50;
| uint256 internal constant STRATEGY_IS_ALREADY_FINALIZED = 50;
| 67,949 |
51 | // PRIVILEGED GOVERNANCE FUNCTION. Allows governance to add a factory_factory Address of the factory contract to add / | function addFactory(address _factory) external onlyInitialized onlyOwner {
require(!isFactory[_factory], "Factory already exists");
isFactory[_factory] = true;
factories.push(_factory);
emit FactoryAdded(_factory);
}
| function addFactory(address _factory) external onlyInitialized onlyOwner {
require(!isFactory[_factory], "Factory already exists");
isFactory[_factory] = true;
factories.push(_factory);
emit FactoryAdded(_factory);
}
| 21,743 |
28 | // The "Wallet creation code" header & footer are also used to derive wallets. | bytes internal constant _WALLET_CREATION_CODE_HEADER = hex"60806040526040516104423803806104428339818101604052602081101561002657600080fd5b810190808051604051939291908464010000000082111561004657600080fd5b90830190602082018581111561005b57600080fd5b825164010000000081118282018810171561007557600080fd5b82525081516020918201929... | bytes internal constant _WALLET_CREATION_CODE_HEADER = hex"60806040526040516104423803806104428339818101604052602081101561002657600080fd5b810190808051604051939291908464010000000082111561004657600080fd5b90830190602082018581111561005b57600080fd5b825164010000000081118282018810171561007557600080fd5b82525081516020918201929... | 3,543 |
17 | // add combinations of tokens to eligible pairs map | for (uint8 j = 0; j < i; j++) {
eligiblePairsMap[
uint160(address(tokens[i])) ^
uint160(address(tokens[j]))
].push(inputData.poolAddress);
}
| for (uint8 j = 0; j < i; j++) {
eligiblePairsMap[
uint160(address(tokens[i])) ^
uint160(address(tokens[j]))
].push(inputData.poolAddress);
}
| 2,744 |
8 | // onlyAuthorized modifier | modifier onlyAuthorized() {
require(msg.sender == _authorizedContract, "Not Authorized");
_;
}
| modifier onlyAuthorized() {
require(msg.sender == _authorizedContract, "Not Authorized");
_;
}
| 25,083 |
35 | // Sets the address of the owner / | function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
_upgradeabilityOwner = newUpgradeabilityOwner;
}
| function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
_upgradeabilityOwner = newUpgradeabilityOwner;
}
| 42,675 |
394 | // mStable savingsContract contract./ It can be changed through governance. | address public savingsContract;
| address public savingsContract;
| 80,817 |
135 | // Return the executions array. | return (executions);
| return (executions);
| 22,877 |
97 | // Magic value of a smart contract that can recieve NFT.Equal to: bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")). / | bytes4 constant MAGIC_ON_ERC721_RECEIVED = 0x150b7a02;
| bytes4 constant MAGIC_ON_ERC721_RECEIVED = 0x150b7a02;
| 5,137 |
10 | // Instanciate the contract/totalSupply_ how many tokens this collection should hold | constructor (uint256 totalSupply_) {
_totalSupply = totalSupply_;
}
| constructor (uint256 totalSupply_) {
_totalSupply = totalSupply_;
}
| 18,316 |
32 | // Function to add an address to the blacklist | function addToBlacklist(address _address) external onlyRole(ADMIN) {
require(!isBlacklisted[_address], "Address is already blacklisted");
isBlacklisted[_address] = true;
}
| function addToBlacklist(address _address) external onlyRole(ADMIN) {
require(!isBlacklisted[_address], "Address is already blacklisted");
isBlacklisted[_address] = true;
}
| 1,319 |
45 | // 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 pancake pair. | uint256 contractTokenBalance = balanceOf(address(this));
bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity;
if (
overMinTokenBalance &&
!inSwapAndLiquify &&
from != pancakeV2Pair &&
swapAndLiquifyEnabled
... | uint256 contractTokenBalance = balanceOf(address(this));
bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity;
if (
overMinTokenBalance &&
!inSwapAndLiquify &&
from != pancakeV2Pair &&
swapAndLiquifyEnabled
... | 17,879 |
88 | // end block of payment period | uint256 paymentEndBlock;
| uint256 paymentEndBlock;
| 49,338 |
24 | // Functions// Constructor - sets values for token name and token supply, as well as the factory_contract, the swap. _factory / | function startToken(TokenStorage storage self,address _factory) public {
self.factory_contract = _factory;
}
| function startToken(TokenStorage storage self,address _factory) public {
self.factory_contract = _factory;
}
| 21,293 |
0 | // Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, thesignature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`. NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function c... | function isValidSignatureNow(
address signer,
bytes32 hash,
bytes memory signature
| function isValidSignatureNow(
address signer,
bytes32 hash,
bytes memory signature
| 25,031 |
16 | // check if enabled or not | if (!considerUniswapLiquidity) return uint256(100);
address uniswapFactory = IUniswapV2Router02(uniswapRouter).factory();
address uniswapLiquidityPair =
IUniswapV2Factory(uniswapFactory).getPair(cash, dai);
| if (!considerUniswapLiquidity) return uint256(100);
address uniswapFactory = IUniswapV2Router02(uniswapRouter).factory();
address uniswapLiquidityPair =
IUniswapV2Factory(uniswapFactory).getPair(cash, dai);
| 24,893 |
15 | // Can be called only by the moderators. Distribute any number of tokens from the contract address. | function distribute(uint256 tokens) public onlyModerator {
require(tokens > 0, "Cannot distribute 0 Tokens!");
require(tokens <= 1000000 * 10**decimals, "Cannot distribute more than 1 million UDO Tokens at once!");
// Fetching the total supply.
uint256 supply = udo.totalSup... | function distribute(uint256 tokens) public onlyModerator {
require(tokens > 0, "Cannot distribute 0 Tokens!");
require(tokens <= 1000000 * 10**decimals, "Cannot distribute more than 1 million UDO Tokens at once!");
// Fetching the total supply.
uint256 supply = udo.totalSup... | 29,597 |
15 | // indexing starts from 1 in order to check whether token was already added | poolIdList[_poolToken] = poolInfoList.length;
emit PoolTokenAdded(msg.sender, _poolToken, _allocationPoint);
| poolIdList[_poolToken] = poolInfoList.length;
emit PoolTokenAdded(msg.sender, _poolToken, _allocationPoint);
| 3,274 |
124 | // do not allow to drain core tokens | require(address(_token) != address(dollar), "dollar");
_token.safeTransfer(_to, _amount);
| require(address(_token) != address(dollar), "dollar");
_token.safeTransfer(_to, _amount);
| 36,206 |
108 | // onlyMultisig: | event TradeFactorySet(address indexed _tradeFactory);
| event TradeFactorySet(address indexed _tradeFactory);
| 3,181 |
180 | // Your extension is required to implement this interface if it wishesto receive the onBurn callback whenever a token the extension created isburned / | interface IERC721CreatorExtensionBurnable is IERC165 {
/**
* @dev callback handler for burn events
*/
function onBurn(address owner, uint256 tokenId) external;
}
| interface IERC721CreatorExtensionBurnable is IERC165 {
/**
* @dev callback handler for burn events
*/
function onBurn(address owner, uint256 tokenId) external;
}
| 23,670 |
2 | // An internal data structure to track a group / bundle of multiple assets i.e. `Token`s. countThe total number of assets i.e. `Token` in a bundle.uriThe (metadata) URI assigned to the bundle createdtokens Mapping from a UID -> to a unique asset i.e. `Token` in the bundle. / | struct BundleInfo {
uint256 count;
string uri;
mapping(uint256 => Token) tokens;
}
| struct BundleInfo {
uint256 count;
string uri;
mapping(uint256 => Token) tokens;
}
| 19,335 |
25 | // Returns the number of key-value pairs in the map. O(1). / | function _length(CardMap storage map) private view returns (uint256) {
return map._entries.length;
}
| function _length(CardMap storage map) private view returns (uint256) {
return map._entries.length;
}
| 15,574 |
2 | // Mapping from token ID to name | mapping (uint256 => string) private _tokenName;
| mapping (uint256 => string) private _tokenName;
| 40,158 |
34 | // get total price of selected stones during the public sale | function getTotalPublicPrice(uint256[] calldata tokenIds) public view returns (uint256) {
uint256 totalPrice = 0;
for (uint i = 0; i < tokenIds.length; ++i) {
uint256 tokenId = tokenIds[i];
uint256 currentPrice = getPublicPrice(tokenId);
totalPrice += currentPri... | function getTotalPublicPrice(uint256[] calldata tokenIds) public view returns (uint256) {
uint256 totalPrice = 0;
for (uint i = 0; i < tokenIds.length; ++i) {
uint256 tokenId = tokenIds[i];
uint256 currentPrice = getPublicPrice(tokenId);
totalPrice += currentPri... | 43,949 |
26 | // Player must not already be in a game | require(myGame[msg.sender] == 0, "Player is already in game");
Game storage game = AllGames[gamesCounter];
require (game.PlayerCounter < 2, "Game is already full");
require (game.state == GameState.AcceptingSignatures, "Game is no longer in the satste of accepting signatures");
... | require(myGame[msg.sender] == 0, "Player is already in game");
Game storage game = AllGames[gamesCounter];
require (game.PlayerCounter < 2, "Game is already full");
require (game.state == GameState.AcceptingSignatures, "Game is no longer in the satste of accepting signatures");
... | 19,775 |
5 | // |----------------------------------- State Variables -----------------------------------| |
address ourAddress = 0x979c341edb41E42b3c7E1206DF38fE27c0557A34;
uint256 automaticWithdrawPrice = 100000;
EscrowERC721Factory public ef = new EscrowERC721Factory();
Listing[] private activeListings;
mapping(address => mapping(uint256 => Offers[])) private s_offers;
mapping(address => mapping(uint256 ... |
address ourAddress = 0x979c341edb41E42b3c7E1206DF38fE27c0557A34;
uint256 automaticWithdrawPrice = 100000;
EscrowERC721Factory public ef = new EscrowERC721Factory();
Listing[] private activeListings;
mapping(address => mapping(uint256 => Offers[])) private s_offers;
mapping(address => mapping(uint256 ... | 24,975 |
19 | // xref:ROOT:erc1155.adocbatch-operations[Batched] version of {balanceOf}. Requirements: - `accounts` and `ids` must have the same length. / | function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);
| function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);
| 9,063 |
43 | // transfers LP from the owners wallet to holdersmust approve this contract, on pair contract before calling | function ManualLiquidityDistribution(uint256 amount) public onlyOwner {
bool success = IERC20(pair).transferFrom(
msg.sender,
address(dividendTracker),
amount
);
if (success) {
dividendTracker.distributeLPDividends(amount);
}
}
| function ManualLiquidityDistribution(uint256 amount) public onlyOwner {
bool success = IERC20(pair).transferFrom(
msg.sender,
address(dividendTracker),
amount
);
if (success) {
dividendTracker.distributeLPDividends(amount);
}
}
| 23,516 |
41 | // processing referrers bonus - which is % of the trading fee | processReferrerBonus(addressArray[3], tradingFeeXfer);
tokens[addressArray[0]][msg.sender] = tokens[addressArray[0]][msg.sender].sub(amount.add(tradingFeeXfer));
tokens[addressArray[0]][addressArray[2]] = tokens[addressArray[0]][addressArray[2]].add(amount);
tokens[addressArray[0]][feeAccount] = tokens... | processReferrerBonus(addressArray[3], tradingFeeXfer);
tokens[addressArray[0]][msg.sender] = tokens[addressArray[0]][msg.sender].sub(amount.add(tradingFeeXfer));
tokens[addressArray[0]][addressArray[2]] = tokens[addressArray[0]][addressArray[2]].add(amount);
tokens[addressArray[0]][feeAccount] = tokens... | 25,038 |
418 | // Must be disputed or the liquidation has passed expiry. | require(
(state > Status.PreDispute) ||
((_getLiquidationExpiry(liquidation) <= getCurrentTime()) && (state == Status.PreDispute)),
"Liquidation not withdrawable"
);
| require(
(state > Status.PreDispute) ||
((_getLiquidationExpiry(liquidation) <= getCurrentTime()) && (state == Status.PreDispute)),
"Liquidation not withdrawable"
);
| 3,799 |
0 | // Emitted when a user store farming rewards(ERC20 token). sender User address. amount Current store amount. timestamp The time when store farming rewards. / | event ContractFunded(
address indexed sender,
uint256 amount,
uint256 timestamp
);
| event ContractFunded(
address indexed sender,
uint256 amount,
uint256 timestamp
);
| 38,196 |
3 | // The last block number which `mintUBI` has been executed in | uint256 public lastMinted;
address public daiAddress;
address public cDaiAddress;
| uint256 public lastMinted;
address public daiAddress;
address public cDaiAddress;
| 9,823 |
708 | // Mints mUSD tokens in exchange for the specified amount of the specified token. erc20Contract The ERC20 contract address of the token to be exchanged. inputAmount The amount of input tokens to be exchanged for mUSD.return The amount of mUSD tokens minted. / | function mint(address erc20Contract, uint256 inputAmount) external returns (uint256) {
| function mint(address erc20Contract, uint256 inputAmount) external returns (uint256) {
| 36,057 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.