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 |
|---|---|---|---|---|
7 | // revert if something gone wrong | revert(0, 0)
| revert(0, 0)
| 20,806 |
98 | // Live cycle block init | testMode = _testMode;
token = new Token(this);
maxInvestments = _maxInvestments;
minInvestments = _minInvestments;
preIcoStartTime = _startTimePreIco;
preIcoFinishTime = _endTimePreIco;
icoStartTime = 0;
icoFinishTime = 0;
icoInstalled = false;
... | testMode = _testMode;
token = new Token(this);
maxInvestments = _maxInvestments;
minInvestments = _minInvestments;
preIcoStartTime = _startTimePreIco;
preIcoFinishTime = _endTimePreIco;
icoStartTime = 0;
icoFinishTime = 0;
icoInstalled = false;
... | 2,811 |
116 | // Burn the nft | _burn(msg.sender, _merchId, 1);
emit BurnedOne(msg.sender, _merchId);
| _burn(msg.sender, _merchId, 1);
emit BurnedOne(msg.sender, _merchId);
| 14,513 |
197 | // Calculates unclaimed rewards from the liquidation stream _mAsset mAsset key _previousCollection Time of previous collectionreturn Units of mAsset that have been unlocked for distribution / | function _unclaimedRewards(address _mAsset, uint256 _previousCollection)
internal
view
returns (uint256)
| function _unclaimedRewards(address _mAsset, uint256 _previousCollection)
internal
view
returns (uint256)
| 38,537 |
225 | // Set trade taker nominal relative fee and discount tiers and values at given block number tier/fromBlockNumber Block number from which the update applies/nominal Nominal relative fee/nominal Discount tier levels/nominal Discount values | function setTradeTakerFee(uint256 fromBlockNumber, int256 nominal, int256[] memory discountTiers, int256[] memory discountValues)
public
onlyOperator
onlyDelayedBlockNumber(fromBlockNumber)
| function setTradeTakerFee(uint256 fromBlockNumber, int256 nominal, int256[] memory discountTiers, int256[] memory discountValues)
public
onlyOperator
onlyDelayedBlockNumber(fromBlockNumber)
| 35,612 |
238 | // Query the second referred user. | function getReferreds2(address addr, uint256 startPos)
external
view
returns (uint256 length, address[5] memory data)
| function getReferreds2(address addr, uint256 startPos)
external
view
returns (uint256 length, address[5] memory data)
| 3,887 |
51 | // Gets the token address from the Join contract/_joinAddr Address of the Join contract | function getCollateralAddr(address _joinAddr) internal view returns (address) {
return address(Join(_joinAddr).gem());
}
| function getCollateralAddr(address _joinAddr) internal view returns (address) {
return address(Join(_joinAddr).gem());
}
| 16,480 |
211 | // only owner adjust contract balance variable (only used for max profit calc) / | {
contractBalance = newContractBalanceInWei;
}
| {
contractBalance = newContractBalanceInWei;
}
| 9,452 |
23 | // Gets the token bucket with its values for the block it was requested at./ return The token bucket. | function currentOnRampRateLimiterState(address onRamp) external view returns (RateLimiter.TokenBucket memory) {
return s_onRampRateLimits[onRamp]._currentTokenBucketState();
}
| function currentOnRampRateLimiterState(address onRamp) external view returns (RateLimiter.TokenBucket memory) {
return s_onRampRateLimits[onRamp]._currentTokenBucketState();
}
| 12,259 |
3 | // block.timestamp + | _accessPeriods[lockTokenId] = period == 1 ? 1 : period * 1 minutes;
_mint(renter, lockTokenId);
_assetTokens[lockTokenId] = carTokenId;
return lockTokenId;
| _accessPeriods[lockTokenId] = period == 1 ? 1 : period * 1 minutes;
_mint(renter, lockTokenId);
_assetTokens[lockTokenId] = carTokenId;
return lockTokenId;
| 30,516 |
38 | // Add a bonus to a block. That bonus will be awarded to the next buyer. Note, we are not emitting an event to avoid cheating. | function addBonusToBlock(
uint x,
uint y,
uint bonus
| function addBonusToBlock(
uint x,
uint y,
uint bonus
| 15,512 |
272 | // Opt into allowing anyone to claim on the sender's behalf.Note that this does not affect who receives the funds. The user specified in the Merkle tree receives those rewards regardless of who issues the claim.Note that addresses with the CLAIM_OPERATOR_ROLE ignore this allowlist when triggering claims. allowWhether o... | function setAlwaysAllowClaimsFor(
bool allow
)
external
nonReentrant
| function setAlwaysAllowClaimsFor(
bool allow
)
external
nonReentrant
| 77,498 |
17 | // Restrict caller only owner/ | modifier onlyOwner() {
require(msg.sender == owner, "caller is not owner");
_;
}
| modifier onlyOwner() {
require(msg.sender == owner, "caller is not owner");
_;
}
| 547 |
307 | // Shift the three period start times back one place | penultimateFeePeriodStartTime = lastFeePeriodStartTime;
lastFeePeriodStartTime = feePeriodStartTime;
feePeriodStartTime = now;
emit FeePeriodRollover(now);
| penultimateFeePeriodStartTime = lastFeePeriodStartTime;
lastFeePeriodStartTime = feePeriodStartTime;
feePeriodStartTime = now;
emit FeePeriodRollover(now);
| 754 |
406 | // Select Transaction Root from Proof | function selectTransactionRoot(proofIndex) -> transactionRoot {
| function selectTransactionRoot(proofIndex) -> transactionRoot {
| 21,664 |
1 | // Admin mints an NFT ticket _to Mint to _to address _userId User ID of the NFT ticket Owner _eventId Event ID that the ticket belongs to _ticketTypeId ID of the ticket type / | function safeMint(
| function safeMint(
| 33,869 |
23 | // Flag to show if the Jackpot has completed | bool public jackpotCompleted = false;
| bool public jackpotCompleted = false;
| 10,332 |
5 | // Loads a storage slot from an address | function load(address account, bytes32 slot) external returns (bytes32);
| function load(address account, bytes32 slot) external returns (bytes32);
| 22,644 |
109 | // Emits a {TransferSingle} event. Requirements: - `to` cannot be the zero address.- `from` must have a balance of tokens of type `id` of at least `amount`.- If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return theacceptance magic value. / | function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
| function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
| 2,008 |
39 | // Returns true if the slice is empty (has a length of 0). self The slice to operate on.return True if the slice is empty, False otherwise. / | function empty(slice self) internal pure returns (bool) {
return self._len == 0;
}
| function empty(slice self) internal pure returns (bool) {
return self._len == 0;
}
| 29,759 |
15 | // See {IOracles-isOracle}. / | function isOracle(address _account) external override view returns (bool) {
return hasRole(ORACLE_ROLE, _account);
}
| function isOracle(address _account) external override view returns (bool) {
return hasRole(ORACLE_ROLE, _account);
}
| 51,007 |
54 | // increase the short oToken balance in a vault when a new oToken is minted _vault vault to add or increase the short position in _shortOtoken address of the _shortOtoken being minted from the user's vault _amount number of _shortOtoken being minted from the user's vault _index index of _shortOtoken in the user's vault... | function addShort(
Vault storage _vault,
address _shortOtoken,
uint256 _amount,
uint256 _index
| function addShort(
Vault storage _vault,
address _shortOtoken,
uint256 _amount,
uint256 _index
| 530 |
162 | // type 8 - change the staking maxs for each period | if(proposal[id].proposaltype == 8) {
Mine mine = Mine(addressIndex.getMine());
mine.changeStakingMax(proposal[id].uints);
} else
| if(proposal[id].proposaltype == 8) {
Mine mine = Mine(addressIndex.getMine());
mine.changeStakingMax(proposal[id].uints);
} else
| 40,986 |
14 | // and {_fallback} should delegate. / | function _implementation() internal view virtual returns (address);
| function _implementation() internal view virtual returns (address);
| 576 |
7 | // Point oldTrueUSD delegation to NewTrueUSD | tokenController.transferChild(address(oldTrueUSD), address(this));
oldTrueUSD.claimOwnership();
oldTrueUSD.delegateToNewContract(address(newTrueUSD));
| tokenController.transferChild(address(oldTrueUSD), address(this));
oldTrueUSD.claimOwnership();
oldTrueUSD.delegateToNewContract(address(newTrueUSD));
| 593 |
276 | // If specified collateral asset is COMP, then skip trade and set post trade collateral quantity | postTradeCollateralQuantity = gulpInfo.preTradeReceiveTokenBalance;
| postTradeCollateralQuantity = gulpInfo.preTradeReceiveTokenBalance;
| 29,546 |
116 | // Joins DAI amount into the vat | daiJoin_join(daiJoin, urn, wad);
| daiJoin_join(daiJoin, urn, wad);
| 53,609 |
68 | // Emit success event | emit UpdateRedemptionRate(
ray(marketPrice),
redemptionPrice,
validated
);
| emit UpdateRedemptionRate(
ray(marketPrice),
redemptionPrice,
validated
);
| 34,680 |
88 | // Dividend tracker | if(!isDividendExempt[sender]) {
try dividendDistributor.setShare(sender, _balances[sender]) {} catch {}
| if(!isDividendExempt[sender]) {
try dividendDistributor.setShare(sender, _balances[sender]) {} catch {}
| 7,861 |
270 | // Deploy liquidity with a registered `IZap` The order of token amounts should match `IZap.sortedSymbols` name The name of the `IZap` amounts The token amounts to deploy / | function deployStrategy(string calldata name, uint256[] calldata amounts)
external;
| function deployStrategy(string calldata name, uint256[] calldata amounts)
external;
| 69,147 |
195 | // Set pauseGuardian account account Account address / | function setGuardian(address account) public onlyAdmin {
pauseGuardian = account;
}
| function setGuardian(address account) public onlyAdmin {
pauseGuardian = account;
}
| 78,800 |
924 | // Ensure that the sponsor will meet the min position size after the reduction. | FixedPoint.Unsigned memory newTokenCount = positionData.tokensOutstanding.sub(tokensToRemove);
require(newTokenCount.isGreaterThanOrEqual(minSponsorTokens), "Below minimum sponsor position");
positionData.tokensOutstanding = newTokenCount;
| FixedPoint.Unsigned memory newTokenCount = positionData.tokensOutstanding.sub(tokensToRemove);
require(newTokenCount.isGreaterThanOrEqual(minSponsorTokens), "Below minimum sponsor position");
positionData.tokensOutstanding = newTokenCount;
| 17,655 |
775 | // Gets type of oraclize query for a given Oraclize Query ID. myid Oraclize Query ID identifying the query for which the result is being received.return _typeof It could be of type "quote","quotation","cover","claim" etc. / | function getApiIdTypeOf(bytes32 myid) external view returns (bytes4) {
return allAPIid[myid].typeOf;
}
| function getApiIdTypeOf(bytes32 myid) external view returns (bytes4) {
return allAPIid[myid].typeOf;
}
| 35,004 |
43 | // if fee is on, mint liquidity equivalent to 1/3th of the growth in sqrt(k) | function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = ISafeSwapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.s... | function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = ISafeSwapV2Factory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.s... | 33,218 |
52 | // ========== ERC20 Overrides ==========/overriden ERC20 transfer to tax on transfers to and from the uniswap pair, xperp is swapped to ETH and prepared for snapshot distribution | function _transfer(address from, address to, uint256 amount) internal override {
bool isTradingTransfer =
(from == uniswapV2Pair || to == uniswapV2Pair) &&
msg.sender != address(uniswapV2Router) &&
from != address(this) && to != address(this) &&
from != owner(... | function _transfer(address from, address to, uint256 amount) internal override {
bool isTradingTransfer =
(from == uniswapV2Pair || to == uniswapV2Pair) &&
msg.sender != address(uniswapV2Router) &&
from != address(this) && to != address(this) &&
from != owner(... | 44,657 |
99 | // withdraw reserve | require(
LENDING_POOL.withdraw(reserve, amount, address(this)) == amount,
'UNEXPECTED_AMOUNT_WITHDRAWN'
);
| require(
LENDING_POOL.withdraw(reserve, amount, address(this)) == amount,
'UNEXPECTED_AMOUNT_WITHDRAWN'
);
| 42,746 |
15 | // Store detokenization request data | _detokenizationRequests[requestId] = DetokenizationRequest(
user,
amount,
RequestStatus.Pending,
batchTokenIds
);
| _detokenizationRequests[requestId] = DetokenizationRequest(
user,
amount,
RequestStatus.Pending,
batchTokenIds
);
| 22,967 |
3 | // Revert with an error when attempting to execute transfers using a caller that does not have an open channel. / | error ChannelClosed(address channel);
| error ChannelClosed(address channel);
| 14,086 |
248 | // See {IToken-setSymbol}./ | function setSymbol(string calldata _symbol) external override onlyOwner {
tokenSymbol = _symbol;
emit UpdatedTokenInformation(tokenName, tokenSymbol, tokenDecimals, TOKEN_VERSION, tokenOnchainID);
}
| function setSymbol(string calldata _symbol) external override onlyOwner {
tokenSymbol = _symbol;
emit UpdatedTokenInformation(tokenName, tokenSymbol, tokenDecimals, TOKEN_VERSION, tokenOnchainID);
}
| 15,246 |
1 | // Signature verification helper: Provide a single mechanism to verify both private-key (EOA) ECDSA signature andERC1271 contract sigantures. Using this instead of ECDSA.recover in your contract will make them compatible withsmart contract wallets such as Argent and Gnosis. Note: unlike ECDSA signatures, contract signa... | library SignatureChecker {
function isValidSignatureNow(
address signer,
bytes32 hash,
bytes memory signature
) internal view returns (bool) {
(address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);
if (error == ECDSA.RecoverError.NoError && rec... | library SignatureChecker {
function isValidSignatureNow(
address signer,
bytes32 hash,
bytes memory signature
) internal view returns (bool) {
(address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);
if (error == ECDSA.RecoverError.NoError && rec... | 23,110 |
30 | // Distribute the funds (handles royalties, staking, multisig, and seller) | getMarketController().setConsignmentPendingPayout(consignment.id, 0);
disburseFunds(_consignmentId, consignment.pendingPayout);
| getMarketController().setConsignmentPendingPayout(consignment.id, 0);
disburseFunds(_consignmentId, consignment.pendingPayout);
| 18,159 |
20 | // Gets the balance of the specified address._owner The address to query the the balance of. return balance An uint representing the amount owned by the passed address./ | function balanceOf(address _owner) public override virtual view returns (uint balance) {
return balances[_owner];
}
| function balanceOf(address _owner) public override virtual view returns (uint balance) {
return balances[_owner];
}
| 24,216 |
218 | // Calculate loan life span in seconds as (Now - Loan creation time) | loanLifeSpanResult = loanClosed
? synthLoan.timeClosed.sub(synthLoan.timeCreated)
: now.sub(synthLoan.timeCreated);
| loanLifeSpanResult = loanClosed
? synthLoan.timeClosed.sub(synthLoan.timeCreated)
: now.sub(synthLoan.timeCreated);
| 20,417 |
75 | // Mint tokens for PreSale | token.mint(address(this), hardCap);
return true;
| token.mint(address(this), hardCap);
return true;
| 41,032 |
109 | // Dividend tracker | if(!isDividendExempt[from]) {
try distributor.setShare(from, balanceOf(from)) {} catch {}
| if(!isDividendExempt[from]) {
try distributor.setShare(from, balanceOf(from)) {} catch {}
| 10,027 |
40 | // internal method for registering an interface / | function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff);
_supportedInterfaces[interfaceId] = true;
}
| function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff);
_supportedInterfaces[interfaceId] = true;
}
| 26,051 |
75 | // errorBuffer << 255 != 0 | revert MustSpecifyERC1155ConsiderationItemForSeaDropMint();
| revert MustSpecifyERC1155ConsiderationItemForSeaDropMint();
| 15,019 |
73 | // dispath | _dispatch(msg.sender, msg.value);
| _dispatch(msg.sender, msg.value);
| 48,312 |
87 | // ERC20 Token Standard, optional extension: DetailedNote: the ERC-165 identifier for this interface is 0xa219a025. / | interface IERC20Detailed {
/**
* Returns the name of the token. E.g. "My Token".
* @return The name of the token.
*/
function name() external view returns (string memory);
/**
* Returns the symbol of the token. E.g. "HIX".
* @return The symbol of the token.
*/
function sym... | interface IERC20Detailed {
/**
* Returns the name of the token. E.g. "My Token".
* @return The name of the token.
*/
function name() external view returns (string memory);
/**
* Returns the symbol of the token. E.g. "HIX".
* @return The symbol of the token.
*/
function sym... | 54,549 |
13 | // Retrieve listing details | Listing storage listing = listings[_id];
require(listing.price > 0, "Invalid listing");
require(listing.seller != address(0), "Listing does not exist");
require(msg.value >= listing.price, "Insufficient funds");
| Listing storage listing = listings[_id];
require(listing.price > 0, "Invalid listing");
require(listing.seller != address(0), "Listing does not exist");
require(msg.value >= listing.price, "Insufficient funds");
| 26,187 |
96 | // The number of sell tax checkpoints in the registry. | uint256 private _sellTaxPoints;
| uint256 private _sellTaxPoints;
| 42,282 |
226 | // Metastonez has three initial batches: - The first one, "Genesis", contains a small set of Metastonez - The second one, "Origins", contains a larger set of Metastonez - The third one contains a set of 1/1s that will be auctioned off using a separate mechanism. This batch will be minted by the auction contract. It is ... | Batch[] public batches;
| Batch[] public batches;
| 34,006 |
84 | // Compiler will pack this into a single 256bit word. | struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
| struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
| 25,902 |
317 | // Fees & Rewards in fee period [0] are not yet available for withdrawal | for (uint256 i = 1; i < FEE_PERIOD_LENGTH; i++) {
totalFees = totalFees.add(userFees[i][0]);
totalRewards = totalRewards.add(userFees[i][1]);
}
| for (uint256 i = 1; i < FEE_PERIOD_LENGTH; i++) {
totalFees = totalFees.add(userFees[i][0]);
totalRewards = totalRewards.add(userFees[i][1]);
}
| 9,814 |
19 | // Returns the addition of two unsigned integers, reverting on overflow. Counterpart to Solidity's `+` operator. Requirements:- Addition cannot overflow. / | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SAFEMATH:ADD_OVERFLOW");
return c;
}
| function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SAFEMATH:ADD_OVERFLOW");
return c;
}
| 34,674 |
3 | // Sell token0 at higher tick | uint160 sqrtLimitPriceX96 = uint160(
Utils.sqrt(outputAmount.mulDiv(1 << 192, inputAmount))
);
tickUpper = Utils.matchTickSpacingDown(
TickMath.getTickAtSqrtRatio(sqrtLimitPriceX96),
tickSpacing
);
tickLower = Ut... | uint160 sqrtLimitPriceX96 = uint160(
Utils.sqrt(outputAmount.mulDiv(1 << 192, inputAmount))
);
tickUpper = Utils.matchTickSpacingDown(
TickMath.getTickAtSqrtRatio(sqrtLimitPriceX96),
tickSpacing
);
tickLower = Ut... | 8,834 |
5 | // Moves `amount` tokens from the caller's account to `to`. Returns a boolean value indicating whether the operation succeeded. Emits a {Transfer} event. / | function transfer(address to, uint256 amount) external returns (bool);
| function transfer(address to, uint256 amount) external returns (bool);
| 24,214 |
109 | // No new options can be createdRedemption token holders can't do anythingCollateral tokens holders can re-claim their collateral / | EXPIRED,
| EXPIRED,
| 7,087 |
680 | // update holdlers account info, this info will be used for processingsenderthe sendin account addressrecipient the receiving account address/ | function updateHoldlersInfo(address sender, address recipient) private {
//v2 we will use firstDepositTime, if the first time, lets set the initial deposit
if(holdlersInfo[recipient].initialDepositTimestamp == 0){
holdlersInfo[recipient].initialDepositTimestamp = block.timestamp;
... | function updateHoldlersInfo(address sender, address recipient) private {
//v2 we will use firstDepositTime, if the first time, lets set the initial deposit
if(holdlersInfo[recipient].initialDepositTimestamp == 0){
holdlersInfo[recipient].initialDepositTimestamp = block.timestamp;
... | 9,228 |
6 | // Info of each user that stakestokens. | mapping(uint256 => mapping(address => UserInfo)) public userInfo;
bool genesisLPClaimed;
| mapping(uint256 => mapping(address => UserInfo)) public userInfo;
bool genesisLPClaimed;
| 10,610 |
139 | // Returns the name of the protocol the Ante Test is testing/This overrides the auto-generated getter for protocolName as a public var/ return The name of the protocol in string format | function protocolName() external view returns (string memory);
| function protocolName() external view returns (string memory);
| 42,703 |
2 | // Minimum balance before a withdrawal can be triggered. | uint256 public immutable MIN_WITHDRAWAL_AMOUNT;
| uint256 public immutable MIN_WITHDRAWAL_AMOUNT;
| 11,095 |
36 | // Unregisted node: { nodeAddr : 0 } { nodeAddr : HEAD_I } -> registered node but not in any group | mapping(address => uint) public nodeToGroupId;
| mapping(address => uint) public nodeToGroupId;
| 41,904 |
15 | // Ensure no outbox entry already exists w/ batch number | require(!outboxEntryExists(batchNum), "ENTRY_ALREADY_EXISTS");
| require(!outboxEntryExists(batchNum), "ENTRY_ALREADY_EXISTS");
| 22,053 |
24 | // Initialize this contract. Acts as a constructor_arianeeWhitelistAddress Adress of the whitelist contract./ | constructor(
address _arianeeWhitelistAddress
)
public
| constructor(
address _arianeeWhitelistAddress
)
public
| 43,461 |
62 | // Don't use validate arrays because empty arrays are valid | require(_newComponents.length == _newComponentsTargetUnits.length, "Array length mismatch");
require(_currentComponents.length == _oldComponentsTargetUnits.length, "Old Components targets missing");
aggregateComponents = _currentComponents.extend(_newComponents);
aggregateTargetUnits = ... | require(_newComponents.length == _newComponentsTargetUnits.length, "Array length mismatch");
require(_currentComponents.length == _oldComponentsTargetUnits.length, "Old Components targets missing");
aggregateComponents = _currentComponents.extend(_newComponents);
aggregateTargetUnits = ... | 36,022 |
3 | // Allocates 'numBytes' bytes of memory and returns a pointer to the starting address. Additionally, all allocated bytes are equal to 0. | function allocate(uint numBytes) internal pure returns (uint addr) {
// Take the current value of the free memory pointer, and update.
assembly {
addr := mload(0x40)
mstore(0x40, add(addr, numBytes))
}
uint words = (numBytes + 31) / 32;
for (uint i = 0... | function allocate(uint numBytes) internal pure returns (uint addr) {
// Take the current value of the free memory pointer, and update.
assembly {
addr := mload(0x40)
mstore(0x40, add(addr, numBytes))
}
uint words = (numBytes + 31) / 32;
for (uint i = 0... | 46,851 |
1 | // The address empowered to call permissioned functions. | address private _manager;
| address private _manager;
| 27,275 |
12 | // Return the allocation for each token / | function allocation(address tokenAddress) public view returns (uint256) {
for (uint256 i = 0; i < _tokens.length; i++) {
if(_tokens[i].tokenAddress == tokenAddress) return _tokens[i].allocation;
}
return 0;
}
| function allocation(address tokenAddress) public view returns (uint256) {
for (uint256 i = 0; i < _tokens.length; i++) {
if(_tokens[i].tokenAddress == tokenAddress) return _tokens[i].allocation;
}
return 0;
}
| 13,857 |
65 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),reverting with custom message when dividing by zero. CAUTION: This function is deprecated because it requires allocating memory for the error | * message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
... | * message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
... | 31,072 |
8 | // read new stateRoot | bytes32 stateRoot;
output.stateRoot = stateRoot;
newOffset = offset + 33 + 32;
| bytes32 stateRoot;
output.stateRoot = stateRoot;
newOffset = offset + 33 + 32;
| 11,100 |
9 | // Allows to withdraw any rewards or reimbursable fees after the dispute gets resolved. For all rounds at once. This function has O(m) time complexity where m is number of rounds. It is safe to assume m is always less than 10 as appeal cost growth order is O(2^m). Thus, we can assume this loop will run less than 10 tim... | function withdrawFeesAndRewardsForAllRounds(
uint256 _localDisputeID,
address payable _contributor,
uint256 _ruling
| function withdrawFeesAndRewardsForAllRounds(
uint256 _localDisputeID,
address payable _contributor,
uint256 _ruling
| 52,701 |
3 | // @send make transactions receiver receiver's address amount amount to send / | function send(address receiver, uint amount) public {
if (amount > balances[msg.sender]) {
revert InsufficientBalance({
requested: amount,
available: balances[msg.sender]
});
}
balances[msg.sender] -= amount;
balances[receiver] ... | function send(address receiver, uint amount) public {
if (amount > balances[msg.sender]) {
revert InsufficientBalance({
requested: amount,
available: balances[msg.sender]
});
}
balances[msg.sender] -= amount;
balances[receiver] ... | 45,418 |
151 | // The number of onchain deposit requests that have been processed up to and including this block. | uint32 numDepositRequestsCommitted;
| uint32 numDepositRequestsCommitted;
| 28,576 |
19 | // Number of skins an account owns | mapping (address => uint256) public numSkinOfAccounts;
| mapping (address => uint256) public numSkinOfAccounts;
| 9,978 |
280 | // Withdraw staking.Releases staking, withdraw rewards, and transfer the staked and withdraw rewards amount to the sender. / | function withdraw(address _property, uint256 _amount) external {
/**
* Validates the sender is staking to the target Property.
*/
require(
hasValue(_property, msg.sender, _amount),
"insufficient tokens staked"
);
/**
* Withdraws the staking reward
*/
RewardPrices memory prices = _withdrawI... | function withdraw(address _property, uint256 _amount) external {
/**
* Validates the sender is staking to the target Property.
*/
require(
hasValue(_property, msg.sender, _amount),
"insufficient tokens staked"
);
/**
* Withdraws the staking reward
*/
RewardPrices memory prices = _withdrawI... | 30,127 |
269 | // Transfer ETT Token to User | sendTokenToUser(EntranceTicketToken, msg.sender, amount);
isTakeSucceed = true;
| sendTokenToUser(EntranceTicketToken, msg.sender, amount);
isTakeSucceed = true;
| 7,455 |
2 | // Collection ID `_collectionId` size updated | event CollectionSizeUpdated(uint256 indexed _collectionId, uint256 _size);
| event CollectionSizeUpdated(uint256 indexed _collectionId, uint256 _size);
| 26,877 |
42 | // Now that the balance is updated and the event was emitted, call onERC1155Received if the destination is a contract. | if (_to.isContract()) {
_doSafeTransferAcceptanceCheck(msg.sender, _from, _to, _id, _value, _data);
}
| if (_to.isContract()) {
_doSafeTransferAcceptanceCheck(msg.sender, _from, _to, _id, _value, _data);
}
| 21,455 |
156 | // If the pool is full and the transcoder has less stake than the least stake transcoder in the pool then the transcoder is unable to join the active set for the next round | if (_totalStake <= lastStake) {
return;
}
| if (_totalStake <= lastStake) {
return;
}
| 33,945 |
280 | // Constraint expression for rc16/minimum: column21_row1 - rc_min. | let val := addmod(/*column21_row1*/ mload(0x3580), sub(PRIME, /*rc_min*/ mload(0x200)), PRIME)
| let val := addmod(/*column21_row1*/ mload(0x3580), sub(PRIME, /*rc_min*/ mload(0x200)), PRIME)
| 21,600 |
87 | // xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Emits a {TransferBatch} event. Requirements: - `ids` and `amounts` must have the same length.- If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return theacceptance magic value. / | function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(
ids.length == amounts.length,
"ERC1155: ids and... | function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(
ids.length == amounts.length,
"ERC1155: ids and... | 16,181 |
11 | // this does calculates where to start copying bytes into bytes is the location where the bytes array is byte+offset is the location where copying should start from | let copyDestination := add(_bytes, offset)
let endNewBytes := add(copyDestination, _length)
| let copyDestination := add(_bytes, offset)
let endNewBytes := add(copyDestination, _length)
| 20,257 |
14 | // allows a spender address to spend a specific amount of value | function approve(address _spender, uint _value) external override returns (bool success) {
__allowances[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| function approve(address _spender, uint _value) external override returns (bool success) {
__allowances[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 11,744 |
1 | // This is the current stage. | stages public CURENT_STAGE = stages.STAGE_INIT;
int[] public interest_rates = [-20,-10,0,10,20];
string public token_name = "PineappleToken"; //Generated
string public token_symbol = "PINE"; //Generated
uint256 public token_borrow = 1000; //User key in ... | stages public CURENT_STAGE = stages.STAGE_INIT;
int[] public interest_rates = [-20,-10,0,10,20];
string public token_name = "PineappleToken"; //Generated
string public token_symbol = "PINE"; //Generated
uint256 public token_borrow = 1000; //User key in ... | 5,345 |
21 | // Function to check the amount of tokens that an owner has allowed to a spender. owner_ The address which owns the funds. spender The address which will spend the funds.return The number of tokens still available for the spender. / | function allowance(address owner_, address spender) public view returns (uint256) {
return _allowedFragments[owner_][spender];
}
| function allowance(address owner_, address spender) public view returns (uint256) {
return _allowedFragments[owner_][spender];
}
| 52,504 |
165 | // return The amount of DOWS mintable for the inflationary supply/ | function mintableSupply() external view returns (uint) {
uint totalAmount;
if (!isMintable()) {
return totalAmount;
}
uint remainingWeeksToMint = weeksSinceLastIssuance();
uint currentWeek = weekCounter;
// Calculate total mintable supply from exponent... | function mintableSupply() external view returns (uint) {
uint totalAmount;
if (!isMintable()) {
return totalAmount;
}
uint remainingWeeksToMint = weeksSinceLastIssuance();
uint currentWeek = weekCounter;
// Calculate total mintable supply from exponent... | 12,214 |
202 | // Holding pool share token solhint-disable no-empty-blocks | abstract contract PoolShareToken is ERC20Permit, Pausable, ReentrancyGuard, Governed {
using SafeERC20 for IERC20;
IERC20 public immutable token;
IAddressList public immutable feeWhitelist;
uint256 public constant MAX_BPS = 10_000;
address public feeCollector; // fee collector address
uint256 pu... | abstract contract PoolShareToken is ERC20Permit, Pausable, ReentrancyGuard, Governed {
using SafeERC20 for IERC20;
IERC20 public immutable token;
IAddressList public immutable feeWhitelist;
uint256 public constant MAX_BPS = 10_000;
address public feeCollector; // fee collector address
uint256 pu... | 58,319 |
6 | // function sendEth(address payable rcv_addr) publicpayable | {
address payable aa=rcv_addr;
uint256 xs=msg.value;
aa.transfer(xs);
}*/
| {
address payable aa=rcv_addr;
uint256 xs=msg.value;
aa.transfer(xs);
}*/
| 24,992 |
35 | // Burn token and mint owners nft to the msg sender onlyTokenOwner, whenNotPaused _tokenId - tokenId / | function burn(uint256 _tokenId)
public
onlyTokenOwner(_tokenId)
whenNotPaused
| function burn(uint256 _tokenId)
public
onlyTokenOwner(_tokenId)
whenNotPaused
| 66,903 |
11 | // Allows execution by the event manager only | modifier onlyEventManager {
require(msg.sender == eventManager);
_;
}
| modifier onlyEventManager {
require(msg.sender == eventManager);
_;
}
| 13,176 |
3 | // Check that the tokenId is valid | require(_tokenId >= 3 && _tokenId <= 5, "Invalid tokenId");
uint256 nftPrice = buyPrices[_tokenId];
| require(_tokenId >= 3 && _tokenId <= 5, "Invalid tokenId");
uint256 nftPrice = buyPrices[_tokenId];
| 28,947 |
124 | // set control variable adjustment_addition bool_increment uint_target uint_buffer uint / | function setAdjustment(
bool _addition,
uint256 _increment,
uint256 _target,
uint256 _buffer
| function setAdjustment(
bool _addition,
uint256 _increment,
uint256 _target,
uint256 _buffer
| 15,989 |
110 | // allows Tellor to read data from the addressVars mapping_data is the keccak256("variable_name") of the variable that is being accessed. These are examples of how the variables are saved within other functions: addressVars[keccak256("_owner")] addressVars[keccak256("tellorContract")] return address requested/ | function getAddressVars(TellorStorage.TellorStorageStruct storage self, bytes32 _data) internal view returns (address) {
return self.addressVars[_data];
}
| function getAddressVars(TellorStorage.TellorStorageStruct storage self, bytes32 _data) internal view returns (address) {
return self.addressVars[_data];
}
| 41,713 |
8 | // General | _admins[msg.sender] = true;
owner = payable(address(this));
| _admins[msg.sender] = true;
owner = payable(address(this));
| 31,425 |
12 | // Helper function that should be used for any reduction of account funds.It has error checking to prevent underflowing the account balance which would be REALLY bad. / | if (value > self.accountBalances[accountAddress]) {
| if (value > self.accountBalances[accountAddress]) {
| 50,512 |
12 | // authorized caller contract/ | function authorizeCaller(address contactAddress)
external
requireContractOwner
| function authorizeCaller(address contactAddress)
external
requireContractOwner
| 48,603 |
22 | // Create a new property with the provided parameters | properties[propertyId] = Property(
name,
rewardAmount,
rewardTokenContract,
rewardCicleDays,
rewardCicles,
maxSupply,
buybackDays,
buybackUsdPriceReference,
0, 0, _mintActive
| properties[propertyId] = Property(
name,
rewardAmount,
rewardTokenContract,
rewardCicleDays,
rewardCicles,
maxSupply,
buybackDays,
buybackUsdPriceReference,
0, 0, _mintActive
| 3,725 |
8 | // Starting block number of the distribution. / | uint256 public distributionStartBlock;
| uint256 public distributionStartBlock;
| 46,034 |
44 | // false if the ico is not started, false if the ico is started and running, true if the ico is completed | function ended() public view returns(bool);
| function ended() public view returns(bool);
| 7,119 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.