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 |
|---|---|---|---|---|
52 | // num: [4, 6, x], odds: 5 | if ((nums[0] == 4 && nums[1] == 6) || (nums[1] == 4 && nums[2] == 6) || (nums[0] == 4 && nums[2] == 6)) {
win += wager * 6;
}
| if ((nums[0] == 4 && nums[1] == 6) || (nums[1] == 4 && nums[2] == 6) || (nums[0] == 4 && nums[2] == 6)) {
win += wager * 6;
}
| 12,716 |
47 | // sets aaRouter mintRatios address as inputValues | function setMintRatios(uint transactionId)
public
notExecuted(transactionId)
| function setMintRatios(uint transactionId)
public
notExecuted(transactionId)
| 74,104 |
278 | // This stores metadata about a FRight token | struct Metadata {
uint256 version; // version of the FRight
uint256 tokenId; // id of the FRight
uint256 startTime; // timestamp when the FRight was created
uint256 endTime; // timestamp until when the FRight is deemed useful
address baseAssetAddress; // address of original NFT locked in the DAO
... | struct Metadata {
uint256 version; // version of the FRight
uint256 tokenId; // id of the FRight
uint256 startTime; // timestamp when the FRight was created
uint256 endTime; // timestamp until when the FRight is deemed useful
address baseAssetAddress; // address of original NFT locked in the DAO
... | 12,446 |
31 | // Checks if user with specified address is the owner of the specified book or an admin userAddress Address of user bookHash Hash reference of book / | modifier isBookOwnerOrAdmin(address userAddress, bytes32 bookHash){
uint bookId = booksHashes[bookHash];
require(booksArr[bookId - 1].owner == userAddress || admin == userAddress, "user does not own this book and not admin");
_;
}
| modifier isBookOwnerOrAdmin(address userAddress, bytes32 bookHash){
uint bookId = booksHashes[bookHash];
require(booksArr[bookId - 1].owner == userAddress || admin == userAddress, "user does not own this book and not admin");
_;
}
| 24,191 |
116 | // Sets the incentivizer contract / | event NewIncentivizer(address oldIncentivizer, address newIncentivizer);
| event NewIncentivizer(address oldIncentivizer, address newIncentivizer);
| 79,469 |
6 | // emit ProjectCompleted(msg.sender, balance, goal); | payCreator();
| payCreator();
| 53,660 |
1 | // SDVD contract address | address public sdvd;
| address public sdvd;
| 73,849 |
5 | // Gets all facets and their selectors./ return An array of bytes arrays containing each facet/ and each facet's selectors./ The return value is tightly packed./ Here is the structure of the return value:/ returnValue = [/ abi.encodePacked(facet, sel1, sel2, sel3, ...),/ abi.encodePacked(facet, sel1, sel2, sel3, ...),/... | function facets() external view returns (bytes[] memory);
| function facets() external view returns (bytes[] memory);
| 920 |
665 | // Returns portfolio value for the bitmapped currency | function _getBitmapPortfolioValue(
address account,
uint256 blockTime,
AccountContext memory accountContext,
FreeCollateralFactors memory factors
| function _getBitmapPortfolioValue(
address account,
uint256 blockTime,
AccountContext memory accountContext,
FreeCollateralFactors memory factors
| 3,791 |
332 | // Returns the fee charged on a strategy's generated profits. The strategist is paid in LP tokens, while the remainder of the profit stays in the vault. Default performance fee is set to 5% of harvested profits. / | function getPerformanceFee() public view returns (uint256) {
return currentUInts256[_PERFORMANCE_FEE_KEY];
}
| function getPerformanceFee() public view returns (uint256) {
return currentUInts256[_PERFORMANCE_FEE_KEY];
}
| 9,708 |
303 | // Remove a manager from an xAsset fund / | function removeManager(address manager, address fund) external;
| function removeManager(address manager, address fund) external;
| 56,236 |
0 | // IOKLGSpend Logic for spending OKLG on products in the product ecosystem. / | interface IOKLGSpend {
function spendOnProduct(address _payor, uint8 _product) external payable;
}
| interface IOKLGSpend {
function spendOnProduct(address _payor, uint8 _product) external payable;
}
| 41,687 |
20 | // Wrapped ETH (WETH) Interface / | contract WETHInterface {
function() public payable;
function deposit() public payable ;
function withdraw(uint wad) public;
function totalSupply() public view returns (uint);
function approve(address guy, uint wad) public returns (bool);
function transfer(address dst, uint wad) public returns (b... | contract WETHInterface {
function() public payable;
function deposit() public payable ;
function withdraw(uint wad) public;
function totalSupply() public view returns (uint);
function approve(address guy, uint wad) public returns (bool);
function transfer(address dst, uint wad) public returns (b... | 28,336 |
92 | // Emitted when `value` tokens are burnt from one account (`burner`) burner address which burned tokens value amount of tokens burned / | event Burn(address indexed burner, uint256 value);
| event Burn(address indexed burner, uint256 value);
| 39,596 |
165 | // register the supported interface to conform to IERC1363Receiver and IERC1363Spender via ERC165 | _registerInterface(_INTERFACE_ID_ERC1363_RECEIVER);
_registerInterface(_INTERFACE_ID_ERC1363_SPENDER);
| _registerInterface(_INTERFACE_ID_ERC1363_RECEIVER);
_registerInterface(_INTERFACE_ID_ERC1363_SPENDER);
| 37,337 |
72 | // Same as {xref-Address-functionCall-address-bytes-}['functionCall'],but performing a static call. _Available since v3.3._ / | function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
| function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
| 20,668 |
17 | // Contains 512-bit math functions/Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision/Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits | library FullMath {
/// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
/// @param a The multiplicand
/// @param b The multiplier
/// @param denominator The divisor
/// @return result The 256-bit result
/// @dev Credit to Rem... | library FullMath {
/// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
/// @param a The multiplicand
/// @param b The multiplier
/// @param denominator The divisor
/// @return result The 256-bit result
/// @dev Credit to Rem... | 7,183 |
205 | // res += valcoefficients[21]. | res := addmod(res,
mulmod(val, /*coefficients[21]*/ mload(0x7e0), PRIME),
PRIME)
| res := addmod(res,
mulmod(val, /*coefficients[21]*/ mload(0x7e0), PRIME),
PRIME)
| 21,559 |
208 | // Aave's referral code | uint16 internal referral;
| uint16 internal referral;
| 33,920 |
34 | // Tracked individual instance spawned by {BuilderShop} contract. | uint immutable public _id;
| uint immutable public _id;
| 62,128 |
4 | // Creating a Purchases history | mapping(address => uint256[]) purchases;
| mapping(address => uint256[]) purchases;
| 5,197 |
37 | // Checks if a group with the given index is a stale group./ Stale group is an expired group which is no longer performing any/ operations. It is important to understand that an expired group may/ still perform some operations for which it was selected when it was still/ active. We consider a group to be stale when it'... | function isStaleGroup(
Storage storage self,
uint256 groupIndex
| function isStaleGroup(
Storage storage self,
uint256 groupIndex
| 26,603 |
12 | // Gets the nth tick in the buffer.//self The reference to the buffer./nThe nth tick to get. | function get(Tick.Cache storage self, uint256 n) internal view returns (Tick.Info storage) {
return self.values[n];
}
| function get(Tick.Cache storage self, uint256 n) internal view returns (Tick.Info storage) {
return self.values[n];
}
| 41,136 |
149 | // Delete the tail element so we can keep the same number of max market offers: | uint lastIndex = blackMarketOffersSorted.pop(PREV); //Pops and removes last element of the list!
delete blackMarketOffersMap[lastIndex];
| uint lastIndex = blackMarketOffersSorted.pop(PREV); //Pops and removes last element of the list!
delete blackMarketOffersMap[lastIndex];
| 13,546 |
47 | // MODIFIERS / | modifier onlyMinter {
require(msg.sender == minter);
_;
}
| modifier onlyMinter {
require(msg.sender == minter);
_;
}
| 7,560 |
69 | // Limit 2 months stay | require (nPotentialBillableDays <= 60);
self._TotalAmount = nPotentialBillableAmount + self._SecDeposit;
| require (nPotentialBillableDays <= 60);
self._TotalAmount = nPotentialBillableAmount + self._SecDeposit;
| 42,129 |
4 | // Restoration-specific setup. | oldV1 = IERC721(_oldV1Address);
restorer = msg.sender; // this must be deployed by the Restoration contract.
snapshotV1Price = _snapshotV1Price;
snapshotV1Owner = _snapshotV1Owner;
| oldV1 = IERC721(_oldV1Address);
restorer = msg.sender; // this must be deployed by the Restoration contract.
snapshotV1Price = _snapshotV1Price;
snapshotV1Owner = _snapshotV1Owner;
| 3,010 |
59 | // for withdrawing vault fund balance/vault_ Arrakis V2 vault address/amount_ amount of balance to retrieve/to_ receiver of balance/only callable by palm term and managed vault | function withdrawVaultBalance(
address vault_,
uint256 amount_,
address payable to_
)
external
override
whenNotPaused
requireAddressNotZero(vault_)
onlyPALMTerms
| function withdrawVaultBalance(
address vault_,
uint256 amount_,
address payable to_
)
external
override
whenNotPaused
requireAddressNotZero(vault_)
onlyPALMTerms
| 34,471 |
31 | // Throws if called by any account other than the authority. / | modifier onlyAuthority {
require(msg.sender == authority, "AU01");
_;
}
| modifier onlyAuthority {
require(msg.sender == authority, "AU01");
_;
}
| 42,493 |
12 | // transfer back the bet | IERC20(token).transfer(accept.acceptor, accept.bet);
| IERC20(token).transfer(accept.acceptor, accept.bet);
| 1,947 |
128 | // Sets up the provided edition to use the provided _recipient | function useRoyaltiesRecipient(uint256 _editionId, address _deployedHandler) external;
| function useRoyaltiesRecipient(uint256 _editionId, address _deployedHandler) external;
| 32,660 |
1 | // Payment balance definition | struct PaymentBalance {
uint256 id;
uint256 claimableAmount;
Payment payment;
}
| struct PaymentBalance {
uint256 id;
uint256 claimableAmount;
Payment payment;
}
| 36,238 |
208 | // The one that we get from the merkleroot.js | bytes32 public root = 0x98b2ac5cf828415200b9fd4614512e165ee9beb92b6562eb2cf723c47e608e65;
| bytes32 public root = 0x98b2ac5cf828415200b9fd4614512e165ee9beb92b6562eb2cf723c47e608e65;
| 16,742 |
174 | // ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplifiedproxy whose upgrades are fully controlled by the current implementation. / | interface IERC1822ProxiableUpgradeable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* brick... | interface IERC1822ProxiableUpgradeable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* brick... | 16,714 |
17 | // first try to do ERC20 transfer | ERC20._transfer(sender, recipient, amount);
_host.callAgreement(
_ida,
abi.encodeWithSelector(
_ida.updateSubscription.selector,
_cashToken,
INDEX_ID,
sender,
senderUnits - uint128(amount),
| ERC20._transfer(sender, recipient, amount);
_host.callAgreement(
_ida,
abi.encodeWithSelector(
_ida.updateSubscription.selector,
_cashToken,
INDEX_ID,
sender,
senderUnits - uint128(amount),
| 17,369 |
51 | // -----------------------------------------------------------------------/ ERC721 Receiver Logic/ ----------------------------------------------------------------------- |
function onERC721Received(
address,
address,
uint256,
bytes calldata
|
function onERC721Received(
address,
address,
uint256,
bytes calldata
| 37,942 |
0 | // please note that 32 bit unsigned int is used to represent UNIX time which is enough to represent dates until Sun, 07 Feb 2106 06:28:15 GMT storage access is optimized so struct layout is important | struct Employee {
| struct Employee {
| 32,583 |
65 | // constructor takes a uniswap pair as an argument to set its 2 borrowable assets | constructor(IUniswapV2Pair _pair) public {
symbol = string(abi.encodePacked(IUniswapV2Pair(_pair.token0()).symbol(), "-", IUniswapV2Pair(_pair.token1()).symbol()));
pair = address(_pair);
token0 = _pair.token0();
token1 = _pair.token1();
}
| constructor(IUniswapV2Pair _pair) public {
symbol = string(abi.encodePacked(IUniswapV2Pair(_pair.token0()).symbol(), "-", IUniswapV2Pair(_pair.token1()).symbol()));
pair = address(_pair);
token0 = _pair.token0();
token1 = _pair.token1();
}
| 64,638 |
44 | // token contract address => resourceID | mapping (address => bytes32) public _tokenContractAddressToResourceID;
| mapping (address => bytes32) public _tokenContractAddressToResourceID;
| 62,704 |
15 | // make the first user super admin | if(super_admin_created == false) {
users[_userId].utype = UserType.super_admin;
super_admin_created = true;
}
| if(super_admin_created == false) {
users[_userId].utype = UserType.super_admin;
super_admin_created = true;
}
| 403 |
304 | // Raw staked balance without any multipliers / | function balanceData(address _account) external view returns (Balance memory) {
return _balances[_account];
}
| function balanceData(address _account) external view returns (Balance memory) {
return _balances[_account];
}
| 63,160 |
15 | // Sets duration for reservation or registry. / | function updateDuration(DurationTypes _durationTypes, uint256 _newDuration)
external
override
onlyOwner
| function updateDuration(DurationTypes _durationTypes, uint256 _newDuration)
external
override
onlyOwner
| 34,939 |
9 | // uint Round = (uint)((now - start)/roundTimer); | uint roundPropose = 0;
uint flag = 0;
for (uint i = 0;i<numberOfSuggestions[Round];i++)
{
if(arrayOfLines[i].voteCount > arrayOfLines[roundPropose].voteCount)
{
roundPropose = i;
}
| uint roundPropose = 0;
uint flag = 0;
for (uint i = 0;i<numberOfSuggestions[Round];i++)
{
if(arrayOfLines[i].voteCount > arrayOfLines[roundPropose].voteCount)
{
roundPropose = i;
}
| 44,613 |
10 | // require(contractMap[spender], "you can only transform from authorized address"); | _spendAllowance(from, spender, amount);
uint256 fromBalance = balanceOf(from);
require(fromBalance >= amount, "transfer amount exceeds balance");
bool isToContract = contractMap[to];
bool isFromContract = contractMap[from];
if (isToContract) {
uint fee = 0;... | _spendAllowance(from, spender, amount);
uint256 fromBalance = balanceOf(from);
require(fromBalance >= amount, "transfer amount exceeds balance");
bool isToContract = contractMap[to];
bool isFromContract = contractMap[from];
if (isToContract) {
uint fee = 0;... | 31,699 |
0 | // What to bit-shift a storage ID by to get its slot./This gives us a maximum of 2128 inline fields in each bucket. | uint256 private constant STORAGE_SLOT_EXP = 128;
| uint256 private constant STORAGE_SLOT_EXP = 128;
| 31,698 |
58 | // Rarible V1 | function getFeeBps(uint256 tokenId) public view returns (uint256[] memory) {
uint256[] memory bps = new uint256[](1);
if (_getReceiver(tokenId) == address(0)) {
bps[0] = _getDefaultBp();
} else {
bps[0] = _getBp(tokenId);
}
return bps;
}
| function getFeeBps(uint256 tokenId) public view returns (uint256[] memory) {
uint256[] memory bps = new uint256[](1);
if (_getReceiver(tokenId) == address(0)) {
bps[0] = _getDefaultBp();
} else {
bps[0] = _getBp(tokenId);
}
return bps;
}
| 54,962 |
50 | // Setup variables | address _customerAddress = _from;
bytes memory empty;
| address _customerAddress = _from;
bytes memory empty;
| 10,923 |
4 | // function to add token info in a struct/ tokeninfo struct of type TokenStructLib.TokenInfo to store nft/token related info/ stores all the nft related info and can only be called by managers | function addTokenInfo(TokenStructLib.TokenInfo calldata tokeninfo) public onlyManager {
TokenStructLib.TokenInfo storage tokenInfo = TokenMarketInfo[tokeninfo.tokenId];
tokenInfo.tokenId = tokeninfo.tokenId;
tokenInfo.totalSell = tokeninfo.totalSell;
tokenInfo.minPrice = tokeninfo.minPrice;
tokenInfo.thirdPa... | function addTokenInfo(TokenStructLib.TokenInfo calldata tokeninfo) public onlyManager {
TokenStructLib.TokenInfo storage tokenInfo = TokenMarketInfo[tokeninfo.tokenId];
tokenInfo.tokenId = tokeninfo.tokenId;
tokenInfo.totalSell = tokeninfo.totalSell;
tokenInfo.minPrice = tokeninfo.minPrice;
tokenInfo.thirdPa... | 29,149 |
79 | // use this when reporting an opaque error from an upgradeable collaborator contract/ | function failOpaque(Error err, FailureInfo info, uint opaqueError) internal returns (uint) {
emit Failure(uint(err), uint(info), opaqueError);
return uint(err);
}
| function failOpaque(Error err, FailureInfo info, uint opaqueError) internal returns (uint) {
emit Failure(uint(err), uint(info), opaqueError);
return uint(err);
}
| 41,715 |
30 | // Address of a account, that will transfer tokens from pre-ICO | address public tokenImporter = 0x0;
| address public tokenImporter = 0x0;
| 40,080 |
2 | // These parameters are documented in IPaymaster.GasAndDataLimits | uint256 constant public PRE_RELAYED_CALL_GAS_LIMIT = 100000;
uint256 constant public POST_RELAYED_CALL_GAS_LIMIT = 110000;
uint256 constant public PAYMASTER_ACCEPTANCE_BUDGET = PRE_RELAYED_CALL_GAS_LIMIT + FORWARDER_HUB_OVERHEAD;
uint256 constant public CALLDATA_SIZE_LIMIT = 10500;
function getGasA... | uint256 constant public PRE_RELAYED_CALL_GAS_LIMIT = 100000;
uint256 constant public POST_RELAYED_CALL_GAS_LIMIT = 110000;
uint256 constant public PAYMASTER_ACCEPTANCE_BUDGET = PRE_RELAYED_CALL_GAS_LIMIT + FORWARDER_HUB_OVERHEAD;
uint256 constant public CALLDATA_SIZE_LIMIT = 10500;
function getGasA... | 10,175 |
282 | // execute swap directly on Uniswap/Pancake/.../swapData stores the swapData information/amountOut expected amount of tokens out/path Sell path./ return amounts | function swapETHForExactTokens(
SwapData calldata swapData,
uint256 amountOut,
address[] calldata path
)
external
payable
whenNotPaused
isValidFork(swapData.fork)
isValidReferee(swapData.referee)
| function swapETHForExactTokens(
SwapData calldata swapData,
uint256 amountOut,
address[] calldata path
)
external
payable
whenNotPaused
isValidFork(swapData.fork)
isValidReferee(swapData.referee)
| 30,475 |
25 | // Returns the integer division of two unsigned integers, reverting ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's '/ ' operator. Requirements: - The divisor cannot be zero. / | function div(uint256 a, uint256 b) internal pure returns(uint256) {
return a / b;
}
| function div(uint256 a, uint256 b) internal pure returns(uint256) {
return a / b;
}
| 26,333 |
202 | // If qty to mint results in a final token ID less than or equal to the cap then the entire qty is within free mint. | if(endingTokenId <= earlyMintTokenIdCap) {
return EARLY_MINT_PRICE * _count;
}
| if(endingTokenId <= earlyMintTokenIdCap) {
return EARLY_MINT_PRICE * _count;
}
| 6,406 |
7 | // Add and use new implemetation / | function pushImplementationContract(address _newImplementation) public onlyOwner {
uint32 size;
assembly {
size := extcodesize(_newImplementation)
}
require(size > 0, "Not a contract");
implementations.push(_newImplementation);
contractVersion = implement... | function pushImplementationContract(address _newImplementation) public onlyOwner {
uint32 size;
assembly {
size := extcodesize(_newImplementation)
}
require(size > 0, "Not a contract");
implementations.push(_newImplementation);
contractVersion = implement... | 29,625 |
26 | // 檢查夠不夠燒 | require(tokens <= balances[msg.sender]);
| require(tokens <= balances[msg.sender]);
| 50,457 |
20 | // Callback when a random number gets generated requestId id of the request sent to Chainlink randomNumber random number returned by Chainlink / | function fulfillRandomness(bytes32 requestId, uint256 randomNumber)
internal
override
| function fulfillRandomness(bytes32 requestId, uint256 randomNumber)
internal
override
| 51,017 |
494 | // one where we copied it - where sender was before. |
delete holderIndexes[ sender ];
holderIndexes[ holders[ index ] ] = index;
|
delete holderIndexes[ sender ];
holderIndexes[ holders[ index ] ] = index;
| 4,704 |
167 | // it calculates how much 'xWant' this contract holds. | function balanceOfXWant() public view returns (uint256) {
return IERC20(xWant).balanceOf(address(this));
}
| function balanceOfXWant() public view returns (uint256) {
return IERC20(xWant).balanceOf(address(this));
}
| 8,057 |
10 | // update total eligible stake units | _stakeTotal = _stakeTotal.add(_eligibleUnitsToAdd);
| _stakeTotal = _stakeTotal.add(_eligibleUnitsToAdd);
| 11,438 |
64 | // We don't need to divide by the padding since we want the result padded since the ONEK token has 18 decimals | uint256 feeIn = blocksPassed.mul(rewardPerBlock);
if (feeIn > 0) addFeeAndUpdatePrice(feeIn);
| uint256 feeIn = blocksPassed.mul(rewardPerBlock);
if (feeIn > 0) addFeeAndUpdatePrice(feeIn);
| 16,661 |
52 | // take funds out of our token holdings | _balances[wallet] -= numTokens;
| _balances[wallet] -= numTokens;
| 13,870 |
5 | // Send `amount` tokens to `to` from `msg.sender`/to The address of the recipient/amount The amount of tokens to be transferred/ return True if the transfer was successful, reverts in any other case/ Overrides the public function in SnapshotTokenBase | function transfer(address to, uint256 amount)
public
returns (bool success)
| function transfer(address to, uint256 amount)
public
returns (bool success)
| 44,618 |
28 | // store incremented value: | _auctions[bidInput.paymentId].endsAt = endsAt;
| _auctions[bidInput.paymentId].endsAt = endsAt;
| 26,399 |
36 | // Get customer attestation data by KYC provider and customer ethereum address_provider Address of the KYC provider._customer Address of the customer ethereum address/ | function getCustomer(address _provider, address _customer) public view returns (
bytes32,
bytes32,
bool,
uint8,
uint256
);
| function getCustomer(address _provider, address _customer) public view returns (
bytes32,
bytes32,
bool,
uint8,
uint256
);
| 31,658 |
31 | // Transfer token to contract | IERC20(tokenID).transferFrom(msg.sender,address(this),amount0);
uint temp_x=IERC20(tokenID).balanceOf(address(this)).sub(reward_in_pool_multi[tokenID]).mul(3);
| IERC20(tokenID).transferFrom(msg.sender,address(this),amount0);
uint temp_x=IERC20(tokenID).balanceOf(address(this)).sub(reward_in_pool_multi[tokenID]).mul(3);
| 29,127 |
40 | // ``` As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`(`UintSet`) are supported. / | library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such... | library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such... | 40,224 |
208 | // Update lockup | removeDelegatorRequests[_serviceProvider][_delegator] = (
block.number + removeDelegatorLockupDuration
);
emit RemoveDelegatorRequested(
_serviceProvider,
_delegator,
removeDelegatorRequests[_serviceProvider][_delegator]
);
| removeDelegatorRequests[_serviceProvider][_delegator] = (
block.number + removeDelegatorLockupDuration
);
emit RemoveDelegatorRequested(
_serviceProvider,
_delegator,
removeDelegatorRequests[_serviceProvider][_delegator]
);
| 55,860 |
3 | // Initializations | UniRouterV2 = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
amo_minter = IFraxAMOMinter(_amo_minter_address);
max_slippage = 50000; // 5%
burn_fraction = 0; // Give all to veFXS initially
| UniRouterV2 = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
amo_minter = IFraxAMOMinter(_amo_minter_address);
max_slippage = 50000; // 5%
burn_fraction = 0; // Give all to veFXS initially
| 4,958 |
11 | // collects from tokensOwed on position, sends to recipient, up to amountMax/ return amount0 amount sent to the recipient | function _uniCollect(Params memory _uniData)
internal
returns (
uint256 amount0,
uint256 amount1
)
| function _uniCollect(Params memory _uniData)
internal
returns (
uint256 amount0,
uint256 amount1
)
| 20,792 |
14 | // emit GroupCreated event | emit GroupCreated(groupId, _sender, _metadataLocator);
| emit GroupCreated(groupId, _sender, _metadataLocator);
| 31,055 |
35 | // calculate lastIndex as minimum of lastPayout from stake session and current day (payouts.length). | uint256 lastIndex = MathUpgradeable.min(payouts.length, lastPayout);
for (uint256 i = firstPayout; i < lastIndex; i++) {
uint256 payout =
payouts[i].payout.mul(shares).div(payouts[i].sharesTotalSupply);
stakingInterest = stakingInterest.add(payout);
}
| uint256 lastIndex = MathUpgradeable.min(payouts.length, lastPayout);
for (uint256 i = firstPayout; i < lastIndex; i++) {
uint256 payout =
payouts[i].payout.mul(shares).div(payouts[i].sharesTotalSupply);
stakingInterest = stakingInterest.add(payout);
}
| 49,940 |
13 | // The Merkle root of all features / | bytes32 public constant FEATURES_ROOT = hex"f8b43e6d091349677b52df00d4dbec8ac3a71d9a48df3eeece013f20733e8355";
| bytes32 public constant FEATURES_ROOT = hex"f8b43e6d091349677b52df00d4dbec8ac3a71d9a48df3eeece013f20733e8355";
| 17,167 |
4 | // Events/Event for token purchase logging purchaser who paid for the tokens beneficiary who got the tokens bonusBeneficiary who got the bonus tokens value weis paid for purchase amount amount of tokens purchased bonusAmount amount of bonus tokens purchased / | event TokenPurchased(
address indexed purchaser,
address indexed beneficiary,
address indexed bonusBeneficiary,
uint256 value,
uint256 amount,
uint256 bonusAmount
);
event CrowdsakeFinished();
| event TokenPurchased(
address indexed purchaser,
address indexed beneficiary,
address indexed bonusBeneficiary,
uint256 value,
uint256 amount,
uint256 bonusAmount
);
event CrowdsakeFinished();
| 43,460 |
9 | // This contract provides the basic logic for implementing the ERC4337 IAccount interface / | abstract contract Account is BaseAccount {
// magic value indicating successfull EIP1271 signature validation.
bytes4 private constant EIP1271_MAGICVALUE = 0x1626ba7e;
// return value in case of signature validation success, with no time-range.
uint256 private constant SIG_VALIDATION_SUCCEEDED = 0;
... | abstract contract Account is BaseAccount {
// magic value indicating successfull EIP1271 signature validation.
bytes4 private constant EIP1271_MAGICVALUE = 0x1626ba7e;
// return value in case of signature validation success, with no time-range.
uint256 private constant SIG_VALIDATION_SUCCEEDED = 0;
... | 23,765 |
121 | // Returns the current admin. | * CAUTION: This function is deprecated. Use {ERC1967Upgrade-_getAdmin} instead.
*/
function _admin() internal view virtual returns (address) {
return _getAdmin();
}
| * CAUTION: This function is deprecated. Use {ERC1967Upgrade-_getAdmin} instead.
*/
function _admin() internal view virtual returns (address) {
return _getAdmin();
}
| 14,592 |
140 | // Withdraw auction tokens or underlying to user | withdrawComponentsToSender(
combinedTokenArray
);
| withdrawComponentsToSender(
combinedTokenArray
);
| 13,718 |
15 | // Must have an interface with the main Zethr token contract | ZethrInterface Zethr;
| ZethrInterface Zethr;
| 8,195 |
21 | // uint newWeightB = DesynSafeMath.bsub(currentWeightB, deltaWeight); require(newWeightB >= 0, "ERR_INCORRECT_WEIGHT_B"); | bool soldout;
if (deltaWeight == currentWeightA) {
| bool soldout;
if (deltaWeight == currentWeightA) {
| 9,282 |
3 | // A function for purchasing starter-packs with DAI./from Must be the tx sender or meta tx signer./to The address to send catalysts & gems to./catalystQuantities The amounts of each type of catalyst to send./gemQuantities The amounts of each type of gem to send./nonce A per-creator nonce, incremented to avoid reuse of ... | function purchaseWithDai(
address from,
address to,
uint256[4] calldata catalystQuantities,
uint256[5] calldata gemQuantities,
uint256 nonce,
bytes calldata signature
) external payable;
| function purchaseWithDai(
address from,
address to,
uint256[4] calldata catalystQuantities,
uint256[5] calldata gemQuantities,
uint256 nonce,
bytes calldata signature
) external payable;
| 39,358 |
20 | // Retrieves the domain from a TokenID _tokenId The messagereturn The domain / | function domain(bytes29 _tokenId) internal pure typeAssert(_tokenId, Types.TokenId) returns (uint32) {
return uint32(_tokenId.indexUint(0, 4));
}
| function domain(bytes29 _tokenId) internal pure typeAssert(_tokenId, Types.TokenId) returns (uint32) {
return uint32(_tokenId.indexUint(0, 4));
}
| 30,180 |
19 | // Grants `role` to `account`. | * If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(uint8 role, address account)
public
virtual
override
onlyRole(getR... | * If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(uint8 role, address account)
public
virtual
override
onlyRole(getR... | 20,133 |
5 | // APPROVE THIRD PARTY SPENDING/ | function approve(address _spender, uint256 _value) public returns (bool success){
/*update allowance record*/
allowed[msg.sender][_spender] = _value;
/*broadcast approval*/
emit BroadcastApproval(msg.sender, _spender, _value);
return true;
}
| function approve(address _spender, uint256 _value) public returns (bool success){
/*update allowance record*/
allowed[msg.sender][_spender] = _value;
/*broadcast approval*/
emit BroadcastApproval(msg.sender, _spender, _value);
return true;
}
| 9,341 |
4 | // Prevents a contract from calling itself, directly or indirectly.Calling a `nonReentrant` function from another `nonReentrant`function is not supported. It is possible to prevent this from happeningby making the `nonReentrant` function external, and making it call a`private` function that does the actual work. / | modifier nonReentrant() {
| modifier nonReentrant() {
| 29,966 |
117 | // Standard ERC-20 events Event - token transfer | event Transfer( address indexed from, address indexed to, uint value );
| event Transfer( address indexed from, address indexed to, uint value );
| 6,605 |
130 | // Upon adding a new asset to teh system, this needs to be called. | function setupAsset(address underlying, uint coinStandard, uint raised) external onlyAdmin {
assets[underlying].coinStandard = coinStandard;
assets[underlying].raised = raised;
}
| function setupAsset(address underlying, uint coinStandard, uint raised) external onlyAdmin {
assets[underlying].coinStandard = coinStandard;
assets[underlying].raised = raised;
}
| 20,599 |
5 | // Request[] public requests; | uint public approversCount;
| uint public approversCount;
| 19,113 |
56 | // Fallback function. Provides functionality for person to buy tokens./ | function() public payable {
buyTokens(msg.sender,msg.value);
}
| function() public payable {
buyTokens(msg.sender,msg.value);
}
| 15,371 |
9 | // module:core Version of the governor instance (used in building the ERC712 domain separator). Default: "1" / | function version() public view virtual returns (string memory);
| function version() public view virtual returns (string memory);
| 13,671 |
27 | // Auction/A contract to run a linear falling-price auction against a diverse/ basket of assets held in a collateral pool. Auctions are taken using/ a single asset. Over time, a larger and larger portion of the assets/ are on offer, eventually hitting 100% of the backing collateral/ pool. Auctions can be partially fill... | contract Auction is IAuction {
using SafeERC20 for IERC20;
struct AuctionStorage {
IERC20 tokenAccepted;
Auctioneer auctioneer;
// the auction price, denominated in tokenAccepted
uint256 amountOutstanding;
uint256 amountDesired;
uint256 startTime;
uint256... | contract Auction is IAuction {
using SafeERC20 for IERC20;
struct AuctionStorage {
IERC20 tokenAccepted;
Auctioneer auctioneer;
// the auction price, denominated in tokenAccepted
uint256 amountOutstanding;
uint256 amountDesired;
uint256 startTime;
uint256... | 29,512 |
291 | // if block.timestamp > lastTouchedTime, update sumRewardPerLiquidity. Otherwise just return it/if block.timestamp > farm's endTime then update phase to settled/fId farm's id/ return curSumRewardPerLiquidity array of sumRewardPerLiquidity until now | function _updateFarmSumRewardPerLiquidity(
uint256 fId
| function _updateFarmSumRewardPerLiquidity(
uint256 fId
| 4,238 |
967 | // Since we use a circular buffer, the oldest sample is simply the next one. | uint256 bufferLength;
uint256 oldestIndex = latestIndex.next();
{
| uint256 bufferLength;
uint256 oldestIndex = latestIndex.next();
{
| 13,744 |
537 | // Initializes a reserve, activating it, assigning an aToken and debt tokens and aninterest rate strategy- Only callable by the LendingPoolConfigurator contract asset The address of the underlying asset of the reserve aTokenAddress The address of the aToken that will be assigned to the reserve stableDebtAddress The add... | ) external override onlyLendingPoolConfigurator {
require(Address.isContract(asset), Errors.LP_NOT_CONTRACT);
_reserves[asset].init(
aTokenAddress,
stableDebtAddress,
variableDebtAddress,
interestRateStrategyAddress
);
_addReserveToList(asset);
}
| ) external override onlyLendingPoolConfigurator {
require(Address.isContract(asset), Errors.LP_NOT_CONTRACT);
_reserves[asset].init(
aTokenAddress,
stableDebtAddress,
variableDebtAddress,
interestRateStrategyAddress
);
_addReserveToList(asset);
}
| 47,712 |
336 | // Encode custom data for callFunction | data
);
operations[2] = _getDepositAction(dyDxMarketId, amount.add(2));
Account.Info[] memory accountInfos = new Account.Info[](1);
accountInfos[0] = _getAccountInfo();
solo.operate(accountInfos, operations);
emit Leverage(amountDesired, amount, deficit, SO... | data
);
operations[2] = _getDepositAction(dyDxMarketId, amount.add(2));
Account.Info[] memory accountInfos = new Account.Info[](1);
accountInfos[0] = _getAccountInfo();
solo.operate(accountInfos, operations);
emit Leverage(amountDesired, amount, deficit, SO... | 38,201 |
276 | // 1.1. If _finalise, move everything to cooldown | if (_finalise) {
_balances[_account].raw = 0;
_balances[_account].cooldownUnits = SafeCastExtended.toUint88(totalRaw);
oldBalance.cooldownUnits = SafeCastExtended.toUint88(totalRaw);
}
| if (_finalise) {
_balances[_account].raw = 0;
_balances[_account].cooldownUnits = SafeCastExtended.toUint88(totalRaw);
oldBalance.cooldownUnits = SafeCastExtended.toUint88(totalRaw);
}
| 23,816 |
67 | // token freeze | event FundsFrozen(address target, bool frozen);
event AccountFrozenError();
| event FundsFrozen(address target, bool frozen);
event AccountFrozenError();
| 51,125 |
200 | // read 4 characters | dataPtr := add(dataPtr, 4)
let input := mload(dataPtr)
| dataPtr := add(dataPtr, 4)
let input := mload(dataPtr)
| 29,233 |
26 | // Transfer back unused tx value: | if (_usedFunds < msg.value) {
payable(msg.sender).transfer(msg.value - _usedFunds);
}
| if (_usedFunds < msg.value) {
payable(msg.sender).transfer(msg.value - _usedFunds);
}
| 41,949 |
15 | // variablePartAB[0] = challengeVariablePart variablePartAB[1] = refutationVariablePart | Signature memory refutationStateSig
| Signature memory refutationStateSig
| 11,734 |
38 | // Subtract the bought tokens from the pool and the eth from the pool | if (
block.timestamp >= tierOneStartTimestamp &&
block.timestamp < tierOneEndTimestamp
) {
tierOneEthAllocated -= msg.value;
tierOneTokensAllocated -= tokensBoughtThisTx;
| if (
block.timestamp >= tierOneStartTimestamp &&
block.timestamp < tierOneEndTimestamp
) {
tierOneEthAllocated -= msg.value;
tierOneTokensAllocated -= tokensBoughtThisTx;
| 25,758 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.