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 |
|---|---|---|---|---|
26 | // payable(receiver).transfer(value); | }else{
| }else{
| 24,074 |
12 | // Matter Labs/The library provides the API to interact with the priority queue container/Order of processing operations from queue - FIFO (Fist in - first out) | library PriorityQueue {
using PriorityQueue for Queue;
/// @notice Container that stores priority operations
/// @param data The inner mapping that saves priority operation by its index
/// @param head The pointer to the first unprocessed priority operation, equal to the tail if the queue is empty
... | library PriorityQueue {
using PriorityQueue for Queue;
/// @notice Container that stores priority operations
/// @param data The inner mapping that saves priority operation by its index
/// @param head The pointer to the first unprocessed priority operation, equal to the tail if the queue is empty
... | 11,668 |
130 | // ydy = fyDaiReserves - fyDaiAmount; | uint256 ydy = uint256 (fyDaiReserves) - uint256 (fyDaiAmount);
require (ydy < 0x100000000000000000000000000000000, "YieldMath: Too much fyDai out");
uint256 sum =
pow (daiReserves, uint128 (a), 0x10000000000000000) +
pow (fyDaiReserves, uint128 (a), 0x10000000000000000) -
pow (uint128 (yd... | uint256 ydy = uint256 (fyDaiReserves) - uint256 (fyDaiAmount);
require (ydy < 0x100000000000000000000000000000000, "YieldMath: Too much fyDai out");
uint256 sum =
pow (daiReserves, uint128 (a), 0x10000000000000000) +
pow (fyDaiReserves, uint128 (a), 0x10000000000000000) -
pow (uint128 (yd... | 56,345 |
17 | // Automatically unlock if there is a pending lock | if (erc721Locks[itemHash].royalty > 0) {
unlockERC721(token, identifier);
}
| if (erc721Locks[itemHash].royalty > 0) {
unlockERC721(token, identifier);
}
| 8,866 |
6 | // Set a maximum value that a variable can hold. This is done to ensure that the token supply remains within a certain limit. | uint256 private constant MAX_TOKEN_SUPPLY = ~uint256(0);
| uint256 private constant MAX_TOKEN_SUPPLY = ~uint256(0);
| 31,463 |
34 | // An event emitted when a proposal has been canceled | event ProposalCanceled(uint id);
| event ProposalCanceled(uint id);
| 6,818 |
170 | // Ensure the value in the AMM is not over the limit.Revert if so. / | function enforceDepositLimit() internal view {
// If deposit limits are enabled, track and limit
if (enforceDepositLimits) {
// Do not allow open markets over the TVL
require(
getTotalPoolValue(false) <= globalDepositLimit,
"Pool over deposit l... | function enforceDepositLimit() internal view {
// If deposit limits are enabled, track and limit
if (enforceDepositLimits) {
// Do not allow open markets over the TVL
require(
getTotalPoolValue(false) <= globalDepositLimit,
"Pool over deposit l... | 7,046 |
27 | // Third Place Playoff Saturday 14th July, 2018 | worldCupGameID["L61-L62"] = 63; // L61 vs L62
gameLocked[63] = 1531576800;
| worldCupGameID["L61-L62"] = 63; // L61 vs L62
gameLocked[63] = 1531576800;
| 50,400 |
67 | // The cap determines the amount of addresses processed when a user runs the faucet | function updateProcessingCap(uint cap) onlyOwner public {
require(cap >= 5 && cap <= 15, "Capacity set outside of policy range");
maxProcessingCap = cap;
}
| function updateProcessingCap(uint cap) onlyOwner public {
require(cap >= 5 && cap <= 15, "Capacity set outside of policy range");
maxProcessingCap = cap;
}
| 24,536 |
121 | // 可投资的剩余份数 | function remainInvestAmount(uint256 id) external view returns (uint256) {
IBondData b = bondData(id);
uint256 crowdDec = ERC20Detailed(b.crowdToken()).decimals();
return
b.totalBondIssuance().div(10**crowdDec).div(b.par()).sub(
b.actualBondIssuance()
... | function remainInvestAmount(uint256 id) external view returns (uint256) {
IBondData b = bondData(id);
uint256 crowdDec = ERC20Detailed(b.crowdToken()).decimals();
return
b.totalBondIssuance().div(10**crowdDec).div(b.par()).sub(
b.actualBondIssuance()
... | 54,207 |
17 | // update our tracker with estimates (yea. not perfect, but cheaper on gas) | _tracker = (_tracker.mul(81)) / 100;
| _tracker = (_tracker.mul(81)) / 100;
| 41,082 |
272 | // Failure without authorization | IERC20(underlyToken).safeTransferFrom(
msg.sender,
supplyBooster,
_extraErc20Amount
);
| IERC20(underlyToken).safeTransferFrom(
msg.sender,
supplyBooster,
_extraErc20Amount
);
| 72,631 |
107 | // Dev address. | address public devaddr;
address private devadr;
| address public devaddr;
address private devadr;
| 11,455 |
26 | // same as above. Replace this line with the following if you want to protect against wrapping uints. | require(_to != address(0));
assert(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0);
balances[_to] = safeAdd(balances[_to], _value);
balances[_from] = safeSub(balances[_from], _value);
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value);
emit Transfer(_f... | require(_to != address(0));
assert(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0);
balances[_to] = safeAdd(balances[_to], _value);
balances[_from] = safeSub(balances[_from], _value);
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value);
emit Transfer(_f... | 73,833 |
30 | // Queries all redelegations from a source to to a destination validator/ for a given delegator in a specified pagination manner./delegatorAddress The address of the delegator./srcValidatorAddress Defines the validator address to redelegate from./dstValidatorAddress Defines the validator address to redelegate to./pageR... | function redelegations(
address delegatorAddress,
string memory srcValidatorAddress,
string memory dstValidatorAddress,
PageRequest calldata pageRequest
) external view returns (RedelegationResponse calldata response);
| function redelegations(
address delegatorAddress,
string memory srcValidatorAddress,
string memory dstValidatorAddress,
PageRequest calldata pageRequest
) external view returns (RedelegationResponse calldata response);
| 32,043 |
72 | // set up our tx event data and determine if player is new or not | F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
| F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_);
| 20,555 |
116 | // if the current time is still within the time limit do nothing | if (block.timestamp <= tokenList[_tokenIndex].limitTimestamp) {
return;
}
| if (block.timestamp <= tokenList[_tokenIndex].limitTimestamp) {
return;
}
| 15,581 |
19 | // DebtPledge storage dp = proposal.pledges[supporter]; |
if (supporter == borrower) {
if (dbt.lAmount == 0) {
pLocked = 0;
pUnlocked = pPledge;
} else {
|
if (supporter == borrower) {
if (dbt.lAmount == 0) {
pLocked = 0;
pUnlocked = pPledge;
} else {
| 52,787 |
82 | // New bounty | if (!bounties[bountyGuid]) {
bounties[bountyGuid] = true;
numBounties = numBounties.add(1);
emit BountyRecorded(bountyGuid, blockNumber);
}
| if (!bounties[bountyGuid]) {
bounties[bountyGuid] = true;
numBounties = numBounties.add(1);
emit BountyRecorded(bountyGuid, blockNumber);
}
| 40,671 |
104 | // Added to support recovering tokens from other systems to be distributed to holders | function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner {
// Cannot recover the staking token
require(
tokenAddress != address(stakingToken),
"Cannot withdraw the staking token"
);
IERC20(tokenAddress).safeTransfer(owner, tokenAmoun... | function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner {
// Cannot recover the staking token
require(
tokenAddress != address(stakingToken),
"Cannot withdraw the staking token"
);
IERC20(tokenAddress).safeTransfer(owner, tokenAmoun... | 45,194 |
48 | // Sets 'amount' as the allowance of 'spender' over the 'owner' s tokens. This internal function is equivalent to 'approve', and can be used toe.g. set automatic allowances for certain subsystems, etc. | * Emits an {Approval} event.
*
* Requirements:
*
* - 'owner' cannot be the zero address.
* - 'spender' cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
... | * Emits an {Approval} event.
*
* Requirements:
*
* - 'owner' cannot be the zero address.
* - 'spender' cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
... | 15,308 |
9 | // return length of arrays | function get_length_list() constant returns (uint user, uint inv) {
// users list length
user = users_list.length;
// investors list length
inv = investors_list.length;
}
| function get_length_list() constant returns (uint user, uint inv) {
// users list length
user = users_list.length;
// investors list length
inv = investors_list.length;
}
| 32,298 |
388 | // error found | revert(string(abi.encodePacked("Liquidation failed: ", returnMessage)));
| revert(string(abi.encodePacked("Liquidation failed: ", returnMessage)));
| 81,101 |
223 | // Burns `share` shares of `yieldToken` from the account owned by `owner`.//ownerThe address of the owner./yieldToken The address of the yield token./shares The amount of shares to burn. | function _burnShares(address owner, address yieldToken, uint256 shares) internal {
Account storage account = _accounts[owner];
account.balances[yieldToken] -= shares;
_yieldTokens[yieldToken].totalShares -= shares;
if (account.balances[yieldToken] == 0) {
account.deposi... | function _burnShares(address owner, address yieldToken, uint256 shares) internal {
Account storage account = _accounts[owner];
account.balances[yieldToken] -= shares;
_yieldTokens[yieldToken].totalShares -= shares;
if (account.balances[yieldToken] == 0) {
account.deposi... | 44,843 |
8 | // internal functions |
function _initializeController(
address controller_
)
internal
|
function _initializeController(
address controller_
)
internal
| 17,626 |
1 | // Mints the specified amount of tokens.This contract should have minting permissions assigned to it in the token contract. _to address of the tokens receiver. _amount amount of tokens to mint. / | function mint(address _to, uint256 _amount) external override {
require(_amount <= limit, "FaucetMinter: too much");
IMintableERC20(token).mint(_to, _amount);
emit Mint(msg.sender, _to, _amount);
}
| function mint(address _to, uint256 _amount) external override {
require(_amount <= limit, "FaucetMinter: too much");
IMintableERC20(token).mint(_to, _amount);
emit Mint(msg.sender, _to, _amount);
}
| 5,065 |
148 | // tmp is pushed onto stack and points to betBase slot in storage | let tmp := betBase_slot
| let tmp := betBase_slot
| 54,041 |
7 | // Shift the "amount" bits into the correct spot in the word, for instance New claim mask could be: 00000000110111010000000 | uint256 newClaimMask = uint256(amount) << (claimedWord*8);
| uint256 newClaimMask = uint256(amount) << (claimedWord*8);
| 9,326 |
202 | // check if protocol has excess solarite in the reserve | uint256 excess = solarite.balanceOf(reservesContract);
uint256 tokens_to_max_slippage = uniswapMaxSlippage(token0Reserves, token1Reserves, offPegPerc);
UniVars memory uniVars = UniVars({
solaritesToUni: tokens_to_max_slippage, // how many solarites uniswap needs
amountFrom... | uint256 excess = solarite.balanceOf(reservesContract);
uint256 tokens_to_max_slippage = uniswapMaxSlippage(token0Reserves, token1Reserves, offPegPerc);
UniVars memory uniVars = UniVars({
solaritesToUni: tokens_to_max_slippage, // how many solarites uniswap needs
amountFrom... | 59,902 |
9 | // @inheritdoc IPayments | function unwrapWETH9(uint256 amountMinimum, address recipient) public payable override {
uint256 balanceWETH9 = IWETHMinimum(weth9).balanceOf(address(this));
// AP_IWETH9: insufficient WETH9
require(balanceWETH9 >= amountMinimum, "AP_IWETH9");
if (balanceWETH9 > 0) {
IWE... | function unwrapWETH9(uint256 amountMinimum, address recipient) public payable override {
uint256 balanceWETH9 = IWETHMinimum(weth9).balanceOf(address(this));
// AP_IWETH9: insufficient WETH9
require(balanceWETH9 >= amountMinimum, "AP_IWETH9");
if (balanceWETH9 > 0) {
IWE... | 18,545 |
237 | // Community Fund has xx% locked during bonus period and then drips out linearly over 3 years. | if (block.number <= FINISH_BONUS_AT_BLOCK) {
Bao.lock(address(comfundaddr), BaoForCom.mul(85).div(100));
}
| if (block.number <= FINISH_BONUS_AT_BLOCK) {
Bao.lock(address(comfundaddr), BaoForCom.mul(85).div(100));
}
| 21,703 |
35 | // Execute an operation's call. | * Emits a {CallExecuted} event.
*/
function _call(
bytes32 id,
uint256 index,
address target,
uint256 value,
bytes calldata data
) private {
(bool success, ) = target.call{value: value}(data);
require(success, "TimelockController: underlying tran... | * Emits a {CallExecuted} event.
*/
function _call(
bytes32 id,
uint256 index,
address target,
uint256 value,
bytes calldata data
) private {
(bool success, ) = target.call{value: value}(data);
require(success, "TimelockController: underlying tran... | 2,346 |
40 | // Assume that this is the EIP-1271 Forwarder (which does not have a `NAME` function) The default signature is the abi.encode of the tuple (order, payload) | signature = abi.encode(order, PayloadStruct({params: params, offchainInput: offchainInput, proof: proof}));
| signature = abi.encode(order, PayloadStruct({params: params, offchainInput: offchainInput, proof: proof}));
| 20,127 |
6 | // for (uint8 i = 2; i <= LAST_LEVEL; i++) { levelPrice[i] = levelPrice[i-1]2; } |
owner = msg.sender;
User memory user = User({
id: 1,
referrer: address(0),
partnersCount: uint(0),
totalETHEarnings:0,
zeroBonusStartMonth:0,
zeroBonusEndMonth:0,
|
owner = msg.sender;
User memory user = User({
id: 1,
referrer: address(0),
partnersCount: uint(0),
totalETHEarnings:0,
zeroBonusStartMonth:0,
zeroBonusEndMonth:0,
| 28,496 |
36 | // balances[GUILD2] = balances[GUILD2].add(reward_amount.div(3)(epochCount3-epouchCount));balances[GUILD3] = balances[GUILD3].add(reward_amount.div(3)(epochCount3-epouchCount)); | emit GuildMint(epochCount);
| emit GuildMint(epochCount);
| 44,834 |
156 | // Retrieves current minimum amount of tokens per one transfer for a particular token contract. _token address of the token contract.return minimum amount on tokens that can be sent through the bridge in one transfer. / | function minPerTx(address _token) public view returns (uint256) {
return uintStorage[keccak256(abi.encodePacked("minPerTx", _token))];
}
| function minPerTx(address _token) public view returns (uint256) {
return uintStorage[keccak256(abi.encodePacked("minPerTx", _token))];
}
| 8,972 |
423 | // Validate token id (must be less than or equal to total tokens amount)/_tokenId Token id/ return bool flag that indicates if token id is less than or equal to total tokens amount | function isValidTokenId(uint16 _tokenId) external view returns (bool) {
return _tokenId <= totalTokens;
}
| function isValidTokenId(uint16 _tokenId) external view returns (bool) {
return _tokenId <= totalTokens;
}
| 83,156 |
68 | // Launch it | contract PreSale is EggPurchase {
constructor() public {
paused = true;
}
function generateUniquePets(uint8 count) external onlyOwner whenNotPaused {
require(storeAddress != address(0));
require(address(geneScience) != address(0));
require(tokensCount <... | contract PreSale is EggPurchase {
constructor() public {
paused = true;
}
function generateUniquePets(uint8 count) external onlyOwner whenNotPaused {
require(storeAddress != address(0));
require(address(geneScience) != address(0));
require(tokensCount <... | 36,735 |
13 | // | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
... | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
... | 1,874 |
50 | // 计价代币地址, 0表示eth | address token0;
| address token0;
| 30,423 |
34 | // Check for duplicates | if (seedExists[random_seed] == false)
{
break;
}
| if (seedExists[random_seed] == false)
{
break;
}
| 32,843 |
10 | // We register chain,bridge in [mpn run register] command. | function registerChain(uint16 chainId_, bytes32 bridgeContract_) public onlyOwner {
_bridgeContracts[chainId_] = bridgeContract_;
}
| function registerChain(uint16 chainId_, bytes32 bridgeContract_) public onlyOwner {
_bridgeContracts[chainId_] = bridgeContract_;
}
| 31,254 |
70 | // if there's a bug with larger strings, this may be the culprit | if (x % 23 == 0) {
uint elemcborlen = elemArray[i].length - x >= 24 ? 23 : elemArray[i].length - x;
elemcborlen += 0x40;
uint lctr = ctr;
while (byte(elemcborlen).length > ctr - lctr) {
... | if (x % 23 == 0) {
uint elemcborlen = elemArray[i].length - x >= 24 ? 23 : elemArray[i].length - x;
elemcborlen += 0x40;
uint lctr = ctr;
while (byte(elemcborlen).length > ctr - lctr) {
... | 36,118 |
22 | // assemble the given address bytecode. If bytecode exists then the _addr is a contract. | function isContract(address _addr) internal view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
| function isContract(address _addr) internal view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
| 50,717 |
22 | // Token symbol | string private _symbol;
| string private _symbol;
| 18,424 |
74 | // Add 20 bytes for the address appended add the end | let success := call(gas(), handler, 0, 0, add(calldatasize(), 20), 0, 0)
returndatacopy(0, 0, returndatasize())
if iszero(success) {
revert(0, returndatasize())
}
| let success := call(gas(), handler, 0, 0, add(calldatasize(), 20), 0, 0)
returndatacopy(0, 0, returndatasize())
if iszero(success) {
revert(0, returndatasize())
}
| 6,334 |
84 | // Only allow the owner to withdraw if the crowdsale target has been reached | require(crowdsaleTargetReached());
owner.transfer(this.balance);
| require(crowdsaleTargetReached());
owner.transfer(this.balance);
| 25,783 |
36 | // calls all the internal functions above, to transfer a token from one user to another | function _clearApprovalAndTransfer(address _from, address _to, uint256 _tokenId) internal
| function _clearApprovalAndTransfer(address _from, address _to, uint256 _tokenId) internal
| 43,648 |
20 | // /// | function setBday(uint256 _day) internal {
if (_day <1 || _day > maxDays) {
revert("Invalid day");
}
| function setBday(uint256 _day) internal {
if (_day <1 || _day > maxDays) {
revert("Invalid day");
}
| 36,397 |
10 | // only for CEX hot wallets and DEX pools | function isSandwicherAllowed(address account) public view returns (bool) {
return sandwicherWhitelist[account];
}
| function isSandwicherAllowed(address account) public view returns (bool) {
return sandwicherWhitelist[account];
}
| 27,538 |
22 | // -----------------------------------/ Getter methods/----------------------------------- | function getLend(uint lendId) public view returns (Lend memory _lend) {
Lend memory lend = lends[msg.sender][lendId];
return lend;
}
| function getLend(uint lendId) public view returns (Lend memory _lend) {
Lend memory lend = lends[msg.sender][lendId];
return lend;
}
| 10,881 |
12 | // Seller receives quote asset minus fees | balance = loadBalanceAndMigrateIfNeeded(
self,
sell.walletAddress,
trade.quoteAssetAddress
);
balance.balanceInPips += trade.netQuoteQuantityInPips;
| balance = loadBalanceAndMigrateIfNeeded(
self,
sell.walletAddress,
trade.quoteAssetAddress
);
balance.balanceInPips += trade.netQuoteQuantityInPips;
| 2,739 |
14 | // Int8 | function getInt8(bytes32 _key) public view returns (int8) {
return int8Storage[_key];
}
| function getInt8(bytes32 _key) public view returns (int8) {
return int8Storage[_key];
}
| 18,498 |
18 | // Return InstaEvent Address./ | // function getEventAddr() internal pure returns (address) {
// return 0x2af7ea6Cb911035f3eb1ED895Cb6692C39ecbA97; // InstaEvent Address
// }
| // function getEventAddr() internal pure returns (address) {
// return 0x2af7ea6Cb911035f3eb1ED895Cb6692C39ecbA97; // InstaEvent Address
// }
| 12,761 |
1 | // mapping (uint8 => mapping (uint256 => bytes32)) internal genreToArtists;mapping (bytes32 => mapping (uint256 => bytes32)) internal artistToAlbums;mapping (bytes32 => mapping (uint256 => bytes32)) internal albumToTitles; |
bytes32[] artist;
uint256[]rmpIdList;
mapping(uint256 => bool) internal rmpId_exists;
mapping(bytes32 => bool) internal artist_exists;
mapping(bytes32 => bool) internal album_exists;
|
bytes32[] artist;
uint256[]rmpIdList;
mapping(uint256 => bool) internal rmpId_exists;
mapping(bytes32 => bool) internal artist_exists;
mapping(bytes32 => bool) internal album_exists;
| 27,412 |
14 | // string memory big = "0x01"; bytes memory bigAsBytes = bytes(big); |
string memory vote1 = "0x01";
string memory vote2 = "0x02";
string memory vote3 = "0x03";
string memory vote4 = "0x04";
string memory vote5 = "0x05";
string memory vote6 = "0x06";
|
string memory vote1 = "0x01";
string memory vote2 = "0x02";
string memory vote3 = "0x03";
string memory vote4 = "0x04";
string memory vote5 = "0x05";
string memory vote6 = "0x06";
| 30,709 |
458 | // event emitted when token URI is updated | event DigitalaxGarmentTokenUriUpdate(
uint256 indexed _tokenId,
string _tokenUri
);
| event DigitalaxGarmentTokenUriUpdate(
uint256 indexed _tokenId,
string _tokenUri
);
| 38,091 |
191 | // Function to distribute the SRT tokens after the initial auction The distributor should have the necessary number of SRT tokens (99) | function distributeSRT(address _distributor)
public
onlyRole(MINTER_ROLE)
| function distributeSRT(address _distributor)
public
onlyRole(MINTER_ROLE)
| 31,812 |
266 | // The caller must own `tokenId` or be an approved operator. tokenId The tokenId owned by the owner or an approved operator / | function burnEPN(uint256 tokenId) external;
| function burnEPN(uint256 tokenId) external;
| 35,626 |
5 | // Initialize ERC721 token address. | INFTContract nftTokenAddress;
/*///////////////////////////////////////////////////////////////
Structures
| INFTContract nftTokenAddress;
/*///////////////////////////////////////////////////////////////
Structures
| 21,391 |
208 | // Initialize the AaveV2 Strategy Proxy/registry_ the registry contract/bank_ the bank associated with the strategy/underlying_ the underlying token that is deposited/derivative_ the aToken address received from Aave/reward_ the address of the reward token stkAAVE/lendingPool_ the AaveV2 lending pool that we lend to/in... | function initializeAaveV2Strategy(
address registry_,
address bank_,
address underlying_,
address derivative_,
address reward_,
address stakedToken_,
address lendingPool_,
address incentivesController_
| function initializeAaveV2Strategy(
address registry_,
address bank_,
address underlying_,
address derivative_,
address reward_,
address stakedToken_,
address lendingPool_,
address incentivesController_
| 74,241 |
5 | // Actually mint the NFT (using the underlying logic) | super.mintTo(_to, _tokenURI);
| super.mintTo(_to, _tokenURI);
| 3,889 |
2 | // Emits when ORG.JSON changes / | event OrgJsonUriChanged(
bytes32 indexed orgId,
string orgJsonUri
);
| event OrgJsonUriChanged(
bytes32 indexed orgId,
string orgJsonUri
);
| 19,319 |
34 | // how many PPDEX needed to stake for a normal NFT | uint public minPPDEX = 466*10**17;
| uint public minPPDEX = 466*10**17;
| 16,217 |
33 | // msg.value is in wei, as is our price above | require(numberToMint > 0, "Must mint at least one token.");
require(numberToMint <= maxMintBatchSize, "Must mint fewer tokens in a single batch. See getMaxMintBatchSize() for the current batch size.");
require(msg.value >= (mintPriceWei*numberToMint), "Must send correct amount of ether to buy to... | require(numberToMint > 0, "Must mint at least one token.");
require(numberToMint <= maxMintBatchSize, "Must mint fewer tokens in a single batch. See getMaxMintBatchSize() for the current batch size.");
require(msg.value >= (mintPriceWei*numberToMint), "Must send correct amount of ether to buy to... | 33,727 |
24 | // Get the list of addresses allowed to send/receive uPremia return The list of addresses allowed to send/receive uPremia | function getWhitelisted() external view returns(address[] memory) {
uint256 length = _whitelisted.length();
address[] memory result = new address[](length);
for (uint256 i=0; i < length; i++) {
result[i] = _whitelisted.at(i);
}
return result;
}
| function getWhitelisted() external view returns(address[] memory) {
uint256 length = _whitelisted.length();
address[] memory result = new address[](length);
for (uint256 i=0; i < length; i++) {
result[i] = _whitelisted.at(i);
}
return result;
}
| 55,813 |
94 | // Send the other half of the tokens to the referral bonus contract | _safeBoogieTransfer(referralAddress, referralBonusAmount);
emit BoogiePoolActive(msg.sender, initialBoogieLiquidity, initialEthLiquidity);
| _safeBoogieTransfer(referralAddress, referralBonusAmount);
emit BoogiePoolActive(msg.sender, initialBoogieLiquidity, initialEthLiquidity);
| 26,883 |
86 | // Validator Simple validator contract / | contract MainchainValidator is Validator, HasAdmin {
uint256 nonce;
constructor(
address[] memory _validators,
uint256 _num,
uint256 _denom
) Validator(_validators, _num, _denom) {
}
function addValidators(address[] calldata _validators) external onlyAdmin {
for (uint256 _i; _i < _validator... | contract MainchainValidator is Validator, HasAdmin {
uint256 nonce;
constructor(
address[] memory _validators,
uint256 _num,
uint256 _denom
) Validator(_validators, _num, _denom) {
}
function addValidators(address[] calldata _validators) external onlyAdmin {
for (uint256 _i; _i < _validator... | 19,889 |
22 | // used to withdraw erc20 tokens like DAI | function withdrawERC20(IERC20 token, address to) external onlyOwner {
require(Address.isContract(to) == false, "CryptoMofayas: no contracts");
token.transfer(payable(to), token.balanceOf(address(this)));
}
| function withdrawERC20(IERC20 token, address to) external onlyOwner {
require(Address.isContract(to) == false, "CryptoMofayas: no contracts");
token.transfer(payable(to), token.balanceOf(address(this)));
}
| 45,059 |
176 | // rawReportContext consists of: 11-byte zero padding 16-byte configDigest 4-byte epoch 1-byte round |
bytes16 configDigest = bytes16(r.rawReportContext << 88);
require(
r.hotVars.latestConfigDigest == configDigest,
"configDigest mismatch"
);
uint40 epochAndRound = uint40(uint256(r.rawReportContext));
|
bytes16 configDigest = bytes16(r.rawReportContext << 88);
require(
r.hotVars.latestConfigDigest == configDigest,
"configDigest mismatch"
);
uint40 epochAndRound = uint40(uint256(r.rawReportContext));
| 35,983 |
93 | // swapAndLiquify or rebalance(don't do both at once or it will cost too much gas) | if(!inSwapAndLiquify) {
bool swap = true;
if(now > lastRebalance + rebalanceInterval && rebalanceEnalbed){
uint256 lpBalance = IERC20(uniswapV2Pair).balanceOf(address(this));
if(lpBalance > 100) {
_rebalance(lpBalance);
... | if(!inSwapAndLiquify) {
bool swap = true;
if(now > lastRebalance + rebalanceInterval && rebalanceEnalbed){
uint256 lpBalance = IERC20(uniswapV2Pair).balanceOf(address(this));
if(lpBalance > 100) {
_rebalance(lpBalance);
... | 33,303 |
436 | // Minimum bonus amount per share | uint public minBonusAmount;
| uint public minBonusAmount;
| 31,118 |
314 | // Completes the liquidity pool migration by redeeming all funds from the pool. This method does not actually transfer the redemeed funds to the recipient, it assumes the caller contract will perform that. This method is exposed publicly.return _migrationRecipient The address of the recipient.return _stakesAmount The a... | function completePoolMigration(Self storage _self) public returns (address _migrationRecipient, uint256 _stakesAmount, uint256 _sharesAmount)
| function completePoolMigration(Self storage _self) public returns (address _migrationRecipient, uint256 _stakesAmount, uint256 _sharesAmount)
| 33,852 |
14 | // Transfer tokens from sender to wrapper for swap | IERC20(senderToken).safeTransferFrom(
msg.sender,
address(this),
senderAmount
);
| IERC20(senderToken).safeTransferFrom(
msg.sender,
address(this),
senderAmount
);
| 9,843 |
0 | // Will instantiate safe teller with gnosis master and proxy addresses _memberToken The address of the MemberToken contract _controllerRegistry The address of the ControllerRegistry contract _proxyFactoryAddress The proxy factory address _gnosisMasterAddress The gnosis master address / | constructor(
address _memberToken,
address _controllerRegistry,
address _proxyFactoryAddress,
address _gnosisMasterAddress,
address _podEnsRegistrar,
address _fallbackHandlerAddress
)
SafeTeller(
_proxyFactoryAddress,
| constructor(
address _memberToken,
address _controllerRegistry,
address _proxyFactoryAddress,
address _gnosisMasterAddress,
address _podEnsRegistrar,
address _fallbackHandlerAddress
)
SafeTeller(
_proxyFactoryAddress,
| 37,500 |
10 | // ========== MUTATIVE FUNCTIONS ========== // Allows a user to claim their pending vesting amount of the vested claim | * Emits a {Vested} event indicating the user who claimed their vested tokens
* as well as the amount that was vested.
*
* Requirements:
*
* - the vesting period has started
* - the caller must have a non-zero vested amount
*/
function claim() external override returns (uint25... | * Emits a {Vested} event indicating the user who claimed their vested tokens
* as well as the amount that was vested.
*
* Requirements:
*
* - the vesting period has started
* - the caller must have a non-zero vested amount
*/
function claim() external override returns (uint25... | 39,675 |
53 | // If length is only one, we need to move the secondary slot into the primary slot. | shouldExecuteBatchedOutstandingActions = true;
| shouldExecuteBatchedOutstandingActions = true;
| 21,656 |
8 | // Mint tokens when the release stage is whitelist (2)./qty Number of tokens to mint (max 3) | function whitelistMint(uint256 qty) external payable nonReentrant {
IGraveyard graveyard = IGraveyard(GRAVEYARD_ADDRESS);
address sender = _msgSender();
require(graveyard.releaseStage() == 2, "Whitelist inactive");
require(qty > 0 && graveyard.isWhitelisted(sender, qty), "Invalid whi... | function whitelistMint(uint256 qty) external payable nonReentrant {
IGraveyard graveyard = IGraveyard(GRAVEYARD_ADDRESS);
address sender = _msgSender();
require(graveyard.releaseStage() == 2, "Whitelist inactive");
require(qty > 0 && graveyard.isWhitelisted(sender, qty), "Invalid whi... | 76,804 |
56 | // close the ICO / | function closeSale() public onlyOwner {
saleClosed = true;
if (TOTAL_TOKEN_SUPPLY > token.totalSupply()) {
token.mint(owner, TOTAL_TOKEN_SUPPLY.sub(token.totalSupply()));
}
token.finishMinting();
token.transferOwnership(owner);
}
| function closeSale() public onlyOwner {
saleClosed = true;
if (TOTAL_TOKEN_SUPPLY > token.totalSupply()) {
token.mint(owner, TOTAL_TOKEN_SUPPLY.sub(token.totalSupply()));
}
token.finishMinting();
token.transferOwnership(owner);
}
| 15,550 |
6 | // reference to $GP for burning on mint | IGP public gpToken;
| IGP public gpToken;
| 287 |
1 | // organisation structure | struct Organisation {
string name;
address ethAddress;
string regNumber;
}
| struct Organisation {
string name;
address ethAddress;
string regNumber;
}
| 33,615 |
760 | // Submits a claim for a given cover note.Adds claim to queue incase of emergency pause else directly submits the claim. coverId Cover Id. / | function submitClaim(uint coverId) external {
_submitClaim(coverId, msg.sender);
}
| function submitClaim(uint coverId) external {
_submitClaim(coverId, msg.sender);
}
| 54,851 |
19 | // Contracts that should be able to recover tokens or ethers Ilan Doron This allows to recover any tokens or Ethers received in a contract.This will prevent any accidental loss of tokens. / | contract Withdrawable is PermissionGroups {
event TokenWithdraw(ERC20 token, uint amount, address sendTo);
/**
* @dev Withdraw all ERC20 compatible tokens
* @param token ERC20 The address of the token contract
*/
function withdrawToken(ERC20 token, uint amount, address sendTo) external only... | contract Withdrawable is PermissionGroups {
event TokenWithdraw(ERC20 token, uint amount, address sendTo);
/**
* @dev Withdraw all ERC20 compatible tokens
* @param token ERC20 The address of the token contract
*/
function withdrawToken(ERC20 token, uint amount, address sendTo) external only... | 56,836 |
12 | // now clear funds from rest of accounts | for (uint256 i=0; i < fundedBy.length; i++) {
funds[fundedBy[i]] = 0; //clear the mapping
}
| for (uint256 i=0; i < fundedBy.length; i++) {
funds[fundedBy[i]] = 0; //clear the mapping
}
| 21,183 |
205 | // first return 0x fee to msg.sender as it is the address that actually sent 0x fee | sendContractBalance(ETH_ADDR, tx.origin, min(address(this).balance, msg.value));
| sendContractBalance(ETH_ADDR, tx.origin, min(address(this).balance, msg.value));
| 38,525 |
215 | // Calculates and returns`_tree`'s current root | function root(Tree storage _tree) internal view returns (bytes32) {
return rootWithCtx(_tree, zeroHashes());
}
| function root(Tree storage _tree) internal view returns (bytes32) {
return rootWithCtx(_tree, zeroHashes());
}
| 579 |
61 | // returns number of reserves/ return number of reserves | function getNumReserves() public view returns(uint) {
return reserves.length;
}
| function getNumReserves() public view returns(uint) {
return reserves.length;
}
| 9,061 |
40 | // 查询资源的所有的购买者 _cid bytes16 : 资源索引 claimIDreturn address[] : 地址组成的列表 / | function getConsumerByClaim(bytes16 _cid) view public returns(address[]){
return claim_[_cid].buyers;
}
| function getConsumerByClaim(bytes16 _cid) view public returns(address[]){
return claim_[_cid].buyers;
}
| 43,793 |
135 | // Overrides TimedCrowdsalehasClosed method to end sale permaturely if token cap has been reached.return Whether crowdsale has finished / | function hasClosed() public view returns (bool) {
return tokenCapReached() || super.hasClosed();
}
| function hasClosed() public view returns (bool) {
return tokenCapReached() || super.hasClosed();
}
| 7,682 |
89 | // Sets `_permissions` as the new Permissions module._permissions The address of the new Pemissions module. / | function setPermissions(address _permissions) external;
| function setPermissions(address _permissions) external;
| 8,798 |
39 | // Hook that is called before a batch token transfer. / | function _beforeBatchTokenTransfer(
address operator,
address from,
| function _beforeBatchTokenTransfer(
address operator,
address from,
| 6,226 |
88 | // Take liquidity fee | uint256 liquidityFee = amount.mul(200).div(10**(_feeDecimal + 2));
transferAmount = transferAmount.sub(liquidityFee);
_reflectionBalance[address(this)] = _reflectionBalance[address(this)].add(liquidityFee.mul(rate));
_liquidityFeeTotal = _liquidityFeeTotal... | uint256 liquidityFee = amount.mul(200).div(10**(_feeDecimal + 2));
transferAmount = transferAmount.sub(liquidityFee);
_reflectionBalance[address(this)] = _reflectionBalance[address(this)].add(liquidityFee.mul(rate));
_liquidityFeeTotal = _liquidityFeeTotal... | 30,017 |
6 | // _rate Number of token units a buyer gets per wei _wallet Address where collected funds will be forwarded to _token Address of the token being sold / | function _Crowdsale_init_unchained(
| function _Crowdsale_init_unchained(
| 1,465 |
460 | // Ensure that net the per market deposit figure does not drop below zero, this should not be possible given how we've calculated the exchange rate but extra caution here | int256 residual = perMarketDeposit.add(netAssetCash);
require(residual >= 0); // dev: insufficient cash
return (residual, fCashAmount);
| int256 residual = perMarketDeposit.add(netAssetCash);
require(residual >= 0); // dev: insufficient cash
return (residual, fCashAmount);
| 88,529 |
9 | // mapping for info about growers | mapping (address => FarmInfo) farmsInfo;
| mapping (address => FarmInfo) farmsInfo;
| 15,426 |
14 | // See {IERC721Metadata-name}. / | function name() public view virtual override returns (string memory) {
return _name;
}
| function name() public view virtual override returns (string memory) {
return _name;
}
| 5,772 |
308 | // Override ERC223 transferFrom function in order tosubtract the transaction fee and send it to the fee poolfor SNX holders to claim. / | {
// The fee is deducted from the amount sent.
uint amountReceived = feePool.amountReceivedFromTransfer(value);
uint fee = value.sub(amountReceived);
// Reduce the allowance by the amount we're transferring.
// The safeSub call will handle an insufficient allowance.
... | {
// The fee is deducted from the amount sent.
uint amountReceived = feePool.amountReceivedFromTransfer(value);
uint fee = value.sub(amountReceived);
// Reduce the allowance by the amount we're transferring.
// The safeSub call will handle an insufficient allowance.
... | 25,516 |
67 | // See {ICreatorCore-setRoyaltiesExtension}. / | function setRoyaltiesExtension(
address extension,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) external override adminRequired {
_setRoyaltiesExtension(extension, receivers, basisPoints);
}
| function setRoyaltiesExtension(
address extension,
address payable[] calldata receivers,
uint256[] calldata basisPoints
) external override adminRequired {
_setRoyaltiesExtension(extension, receivers, basisPoints);
}
| 17,173 |
69 | // Allows a participant to reserve tokens by committing ETH as contributions.Function signature: 0x3c7a3aff / | function commit()
public
payable
isInitialized
isNotFrozen
isRunning
| function commit()
public
payable
isInitialized
isNotFrozen
isRunning
| 8,681 |
12 | // if user has already registered previously | if(users[msg.sender].isExist)
buyLevelMatrix1(level);
else if(level == 1) {
uint refId = 0;
address referrer = bytesToAddress(msg.data);
if(users[referrer].isExist) refId = users[referrer].id;
else revert('Incorrect referrer');
| if(users[msg.sender].isExist)
buyLevelMatrix1(level);
else if(level == 1) {
uint refId = 0;
address referrer = bytesToAddress(msg.data);
if(users[referrer].isExist) refId = users[referrer].id;
else revert('Incorrect referrer');
| 42,309 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.