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 |
|---|---|---|---|---|
196 | // event emitted when tokens are minted | event MinterMinted(
address target,
uint256 tokenHash,
uint256 amount
);
| event MinterMinted(
address target,
uint256 tokenHash,
uint256 amount
);
| 76,913 |
106 | // test morning | function claimDecompose(string memory name, uint8 garden) public {
uint8 i = tulipType(name);
require(_tulipToken[i][garden].isDecomposing[msg.sender], "308");//This token is not decomposing
require(i > 0, "310");//Cannot decompose a seed! //redundant
| function claimDecompose(string memory name, uint8 garden) public {
uint8 i = tulipType(name);
require(_tulipToken[i][garden].isDecomposing[msg.sender], "308");//This token is not decomposing
require(i > 0, "310");//Cannot decompose a seed! //redundant
| 22,724 |
55 | // Locker Locker holds tokens and releases them at a certain time. / | contract Locker is Ownable {
using SafeMath for uint;
using SafeERC20 for ERC20Basic;
/**
* It is init state only when adding release info is possible.
* beneficiary only can release tokens when Locker is active.
* After all tokens are released, locker is drawn.
*/
enum State { Init, Ready, Active,... | contract Locker is Ownable {
using SafeMath for uint;
using SafeERC20 for ERC20Basic;
/**
* It is init state only when adding release info is possible.
* beneficiary only can release tokens when Locker is active.
* After all tokens are released, locker is drawn.
*/
enum State { Init, Ready, Active,... | 29,372 |
18 | // Events //Event to emit if a ring is successfully mined./ _amountsList is an array of:/ [_amountS, _amountB, _lrcReward, _lrcFee, splitS, splitB]. | event RingMined(
uint _ringIndex,
bytes32 indexed _ringHash,
address _miner,
address _feeRecipient,
bytes32[] _orderHashList,
uint[6][] _amountsList
);
event OrderCancelled(
bytes32 ind... | event RingMined(
uint _ringIndex,
bytes32 indexed _ringHash,
address _miner,
address _feeRecipient,
bytes32[] _orderHashList,
uint[6][] _amountsList
);
event OrderCancelled(
bytes32 ind... | 37,935 |
33 | // Rebate All Unclaimed Bids & Sends Remaining ETH To Multisig / | function ___InitiateRebateAndProceeds() external onlyAdmin
| function ___InitiateRebateAndProceeds() external onlyAdmin
| 43,493 |
100 | // Set the address that can mint, burn and rebasename_ Name of the token symbol_ Symbol of the token decimals_ Decimal places of the token - purely for display purposes maxExpectedSupply_ Maximum possilbe supply of the token. initialSupply_ Inital supply of the token, sent to the creator of the token / | function initialize(
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 maxExpectedSupply_,
uint256 initialSupply_
| function initialize(
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 maxExpectedSupply_,
uint256 initialSupply_
| 48,807 |
14 | // A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform/ to the ERC20 specification/ return The address of the Uniswap V3 Pool | function pool() external view returns (IUniswapV3Pool);
| function pool() external view returns (IUniswapV3Pool);
| 14,813 |
3 | // Only allow minting one token id at time/Mint contract function that calls the underlying sales function for commands/minter Address for the minter/tokenId tokenId to mint, set to 0 for new tokenId/quantity to mint/minterArguments calldata for the minter contracts | function mint(IMinter1155 minter, uint256 tokenId, uint256 quantity, bytes calldata minterArguments) external payable;
function adminMint(address recipient, uint256 tokenId, uint256 quantity, bytes memory data) external;
function adminMintBatch(address recipient, uint256[] memory tokenIds, uint256[] memor... | function mint(IMinter1155 minter, uint256 tokenId, uint256 quantity, bytes calldata minterArguments) external payable;
function adminMint(address recipient, uint256 tokenId, uint256 quantity, bytes memory data) external;
function adminMintBatch(address recipient, uint256[] memory tokenIds, uint256[] memor... | 20,422 |
83 | // 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;
}
| 12,063 |
34 | // Constructor, takes maximum amount of wei accepted in the crowdsale. _cap Max amount of wei to be contributed / | function CappedCrowdsale(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
| function CappedCrowdsale(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
| 30,192 |
94 | // The strategy's last updated index | uint224 index;
| uint224 index;
| 17,274 |
322 | // sumBorrowPlusEffects += oraclePriceborrowBalance | vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(vars.oraclePrice, vars.borrowBalance, vars.sumBorrowPlusEffects);
| vars.sumBorrowPlusEffects = mul_ScalarTruncateAddUInt(vars.oraclePrice, vars.borrowBalance, vars.sumBorrowPlusEffects);
| 7,517 |
11 | // executeDiamondCut takes one single FacetCut action and executes it if FacetCutAction can't be identified, it reverts | function executeDiamondCut(uint256 selectorCount, IDiamondCut.FacetCut memory cut) internal returns (uint256) {
require(cut.functionSelectors.length > 0, "LibDiamond: No selectors in facet to cut");
if (cut.action == IDiamondCut.FacetCutAction.Add) {
require(cut.facetAddress != address(... | function executeDiamondCut(uint256 selectorCount, IDiamondCut.FacetCut memory cut) internal returns (uint256) {
require(cut.functionSelectors.length > 0, "LibDiamond: No selectors in facet to cut");
if (cut.action == IDiamondCut.FacetCutAction.Add) {
require(cut.facetAddress != address(... | 19,449 |
280 | // we will lose money until we claim comp then we will make moneythis has an unintended side effect of slowly lowering our total debt allowed | _loss = debt - balance;
_debtPayment = Math.min(wantBalance, _debtOutstanding);
| _loss = debt - balance;
_debtPayment = Math.min(wantBalance, _debtOutstanding);
| 9,929 |
111 | // grandfather | uint256 aff_affID = _plyr[affID].laff;
uint256 aff_affReward = amount.mul(_refer2RewardRate).div(_baseRate);
if(aff_affID <= 0){
aff_affID = _pIDxName[_defaulRefer];
}
| uint256 aff_affID = _plyr[affID].laff;
uint256 aff_affReward = amount.mul(_refer2RewardRate).div(_baseRate);
if(aff_affID <= 0){
aff_affID = _pIDxName[_defaulRefer];
}
| 22,310 |
64 | // Lets an authorised module set the lock for a wallet. _wallet The target wallet. _releaseAfter The epoch time at which the lock should automatically release. / | function setLock(BaseWallet _wallet, uint256 _releaseAfter) external onlyModule(_wallet) {
configs[address(_wallet)].lock = _releaseAfter; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
if (_releaseAfter != 0 && msg.sender != configs[address(_wallet)].locker) { //inject NONPUBLIC VAR ACCESSD BY PUBLI... | function setLock(BaseWallet _wallet, uint256 _releaseAfter) external onlyModule(_wallet) {
configs[address(_wallet)].lock = _releaseAfter; //inject NONPUBLIC VAR ACCESSD BY PUBLIC FUNC
if (_releaseAfter != 0 && msg.sender != configs[address(_wallet)].locker) { //inject NONPUBLIC VAR ACCESSD BY PUBLI... | 29,152 |
32 | // Update total payout of offer request | claimData.setRequestIdToPayout(cover.requestId, payout);
| claimData.setRequestIdToPayout(cover.requestId, payout);
| 10,543 |
6 | // Emitted when the Allocator is activated. / | event AllocatorActivated();
| event AllocatorActivated();
| 39,078 |
229 | // Now with the tokens this contract can send them to msg.sender | bool xfer = IERC20(token).transfer(msg.sender, deltaBalance);
require(xfer, "ERR_ERC20_FALSE");
self.pullPoolShareFromLib(msg.sender, poolShares);
self.burnPoolShareFromLib(poolShares);
| bool xfer = IERC20(token).transfer(msg.sender, deltaBalance);
require(xfer, "ERR_ERC20_FALSE");
self.pullPoolShareFromLib(msg.sender, poolShares);
self.burnPoolShareFromLib(poolShares);
| 16,157 |
174 | // EmpireDEX | event Sweep(uint256 sweepAmount);
event Unsweep(uint256 unsweepAmount);
| event Sweep(uint256 sweepAmount);
event Unsweep(uint256 unsweepAmount);
| 44,189 |
28 | // Destroys amount tokens from account, reducing thetotal supply. | * Emits a {Transfer} event with to set to the zero address.
*
* Requirements:
*
* - account cannot be the zero address.
* - account must have at least amount tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20... | * Emits a {Transfer} event with to set to the zero address.
*
* Requirements:
*
* - account cannot be the zero address.
* - account must have at least amount tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20... | 17,628 |
106 | // clear any previously approved ownership exchange | delete PlayerIndexToApproved[_tokenId];
| delete PlayerIndexToApproved[_tokenId];
| 35,170 |
3 | // 定義一個事件「租客繳交押金」 | event DepositPayed(
uint256 timestamp,
address tenantAddress,
uint256 amountThisTime,
uint256 amountAccumulated
);
| event DepositPayed(
uint256 timestamp,
address tenantAddress,
uint256 amountThisTime,
uint256 amountAccumulated
);
| 9,749 |
2 | // Utility library of inline functions on addresses / | library LibAddress {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
*... | library LibAddress {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
*... | 34,555 |
58 | // Buys an IdeaTokenideaToken The IdeaToken to buy amount The amount of IdeaTokens to buy cost The cost in Dai for the purchase of `amount` IdeaTokens recipient The recipient of the bought IdeaTokens/ | function buyInternal(address ideaToken, uint amount, uint cost, address recipient) internal {
IIdeaTokenExchange exchange = _ideaTokenExchange;
require(_dai.approve(address(exchange), cost), "approve");
exchange.buyTokens(ideaToken, amount, amount, cost, recipient);
}
| function buyInternal(address ideaToken, uint amount, uint cost, address recipient) internal {
IIdeaTokenExchange exchange = _ideaTokenExchange;
require(_dai.approve(address(exchange), cost), "approve");
exchange.buyTokens(ideaToken, amount, amount, cost, recipient);
}
| 58,316 |
94 | // Swap BLOT token. account.amount The amount that will be swapped./ | function swapBLOT(address _of, address _to, uint256 amount) public;
function totalBalanceOf(address _of)
public
view
returns (uint256 amount);
function transferFrom(address _token, address _of, address _to, uint256 amount) public;
| function swapBLOT(address _of, address _to, uint256 amount) public;
function totalBalanceOf(address _of)
public
view
returns (uint256 amount);
function transferFrom(address _token, address _of, address _to, uint256 amount) public;
| 13,978 |
267 | // userDelegatedTo returns the address to which a user delegated their voting power; address(0) if not delegated | function userDelegatedTo(address user) public view returns (address) {
LibBarnStorage.Stake memory c = stakeAtTs(user, block.timestamp);
return c.delegatedTo;
}
| function userDelegatedTo(address user) public view returns (address) {
LibBarnStorage.Stake memory c = stakeAtTs(user, block.timestamp);
return c.delegatedTo;
}
| 34,065 |
67 | // Else, this is a normal slow relay being finalizes where the contract sends ERC20 to the recipient OR this is the finalization of an instant relay where we need to reimburse the instant relayer in WETH. | } else
| } else
| 7,999 |
10 | // Mapping address of accounts in whitelist | mapping(address => bool) private _participants;
| mapping(address => bool) private _participants;
| 16,458 |
2 | // Fired in registerNFT()nft NFT contract address registered / | event RegisterNFT(address indexed nft);
| event RegisterNFT(address indexed nft);
| 20,529 |
15 | // signature must be filled in order to use the Wrapper | if (order.signature.v == 0) {
errors[errorCount] = "SIGNATURE_MUST_BE_SENT";
errorCount++;
}
| if (order.signature.v == 0) {
errors[errorCount] = "SIGNATURE_MUST_BE_SENT";
errorCount++;
}
| 34,418 |
6 | // Constrctor function Initializes contract with initial supply tokens to the creator of the contract / | constructor() public {
name = "FloppaCoin";
symbol = "FLOP";
decimals = 18;
_totalSupply = 314159265358979323846264338346;
balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
| constructor() public {
name = "FloppaCoin";
symbol = "FLOP";
decimals = 18;
_totalSupply = 314159265358979323846264338346;
balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
| 40,741 |
269 | // check if `_addr` has permission to user alpaca `_id` to breed with as sire. / | function hasPermissionToBreedAsSire(address _addr, uint256 _id)
external
override
view
returns (bool)
| function hasPermissionToBreedAsSire(address _addr, uint256 _id)
external
override
view
returns (bool)
| 10,947 |
24 | // Errors | error InvalidPrice();
error LatestPriceMismatch();
error PricesAlreadyMatch();
error PriceIdDoesNotExist();
| error InvalidPrice();
error LatestPriceMismatch();
error PricesAlreadyMatch();
error PriceIdDoesNotExist();
| 32,784 |
9 | // Updates the address of the rewards controller Only callable by the owner of the EmissionManager controller the address of the RewardsController contract / | function setRewardsController(address controller) external;
| function setRewardsController(address controller) external;
| 28,882 |
41 | // openBox.request open box according to '_requestId', only lottery role. / | function openBox(address _address) public {
require(hasRole(_msgSender()), "JoysLottery: have no privilege.");
uint256 len = requestCount(_address);
require(len > 0, "JoysLottery: have no box.");
uint256 idx = len - 1;
RequestInfo storage req = reqBox[_address][idx];
... | function openBox(address _address) public {
require(hasRole(_msgSender()), "JoysLottery: have no privilege.");
uint256 len = requestCount(_address);
require(len > 0, "JoysLottery: have no box.");
uint256 idx = len - 1;
RequestInfo storage req = reqBox[_address][idx];
... | 6,519 |
37 | // Addresses of the main providers. | address[] public mainProviders;
| address[] public mainProviders;
| 50,033 |
31 | // PRIVATE GETTERS |
function _getWorth(
uint256 balance,
address account,
uint256 amount,
bool antiBots
)
private
view
returns (
|
function _getWorth(
uint256 balance,
address account,
uint256 amount,
bool antiBots
)
private
view
returns (
| 28,239 |
225 | // Converts stake weight (not to be mixed with the pool weight) to ILV reward value, applying the 10^12 division on weight_weight stake weight rewardPerWeight ILV reward per weightreturn reward value normalized to 10^12 / | function weightToReward(uint256 _weight, uint256 rewardPerWeight) public pure returns (uint256) {
// apply the formula and return
return (_weight * rewardPerWeight) / REWARD_PER_WEIGHT_MULTIPLIER;
}
| function weightToReward(uint256 _weight, uint256 rewardPerWeight) public pure returns (uint256) {
// apply the formula and return
return (_weight * rewardPerWeight) / REWARD_PER_WEIGHT_MULTIPLIER;
}
| 6,964 |
1 | // Encoding of field elements is: X[0]z + X[1] | struct G2Point {
uint[2] X;
uint[2] Y;
}
| struct G2Point {
uint[2] X;
uint[2] Y;
}
| 6,734 |
5 | // Uniswap redemption path | address[] memory path = new address[](2);
path[0] = _swapToken;
path[1] = wethAddress;
| address[] memory path = new address[](2);
path[0] = _swapToken;
path[1] = wethAddress;
| 30,163 |
43 | // Only owner function to apply minter address/The minter address will be applied after the delay period | function applyMinter() external onlyOwner {
require(pendingMinter != address(0) && block.timestamp >= delayMinter, "NIBBLE: Cannot apply minter");
isMinter[pendingMinter] = true;
minters.push(pendingMinter);
pendingMinter = address(0);
delayMinter = 0;
emit MinterApplied(minters[minters.length... | function applyMinter() external onlyOwner {
require(pendingMinter != address(0) && block.timestamp >= delayMinter, "NIBBLE: Cannot apply minter");
isMinter[pendingMinter] = true;
minters.push(pendingMinter);
pendingMinter = address(0);
delayMinter = 0;
emit MinterApplied(minters[minters.length... | 24,166 |
11 | // TODO: this should only be used by the LiquidityMiningV2 contract??/This function finishes the migration process disabling further withdrawals and claims/migration grace period should have started before this function is called. | function finishMigrationGracePeriod() external onlyAuthorized onlyBeforeMigrationGracePeriodFinished {
require(migrationGracePeriodState == MigrationGracePeriodStates.Started, "Migration hasn't started yet");
migrationGracePeriodState = MigrationGracePeriodStates.Finished;
}
| function finishMigrationGracePeriod() external onlyAuthorized onlyBeforeMigrationGracePeriodFinished {
require(migrationGracePeriodState == MigrationGracePeriodStates.Started, "Migration hasn't started yet");
migrationGracePeriodState = MigrationGracePeriodStates.Finished;
}
| 12,312 |
3 | // return eip-1167 code to write it to spawned contract runtime. | assembly {
return(add(0x20, runtimeCode), 45) // eip-1167 runtime code, length
}
| assembly {
return(add(0x20, runtimeCode), 45) // eip-1167 runtime code, length
}
| 1,985 |
25 | // dup free memory pointer | hex"82"
| hex"82"
| 45,245 |
23 | // Calculate sqrt (x) rounding down.Revert if x < 0.x signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number / | function sqrt (int128 x) internal pure returns (int128) {
require (x >= 0);
return int128 (sqrtu (uint256 (x) << 64));
}
| function sqrt (int128 x) internal pure returns (int128) {
require (x >= 0);
return int128 (sqrtu (uint256 (x) << 64));
}
| 15,454 |
3 | // Sets a new Authorizer for the Vault. The caller must be allowed by the current Authorizer to do this. Emits an `AuthorizerChanged` event. / | function setAuthorizer(IAuthorizer newAuthorizer) external;
| function setAuthorizer(IAuthorizer newAuthorizer) external;
| 21,196 |
94 | // Writes {Tokens} | function finalise()
when_allocations_complete
public
{
tokens.finalise();
}
| function finalise()
when_allocations_complete
public
{
tokens.finalise();
}
| 33,085 |
91 | // Limit variables for bot protection | bool public limitsInEffect = true; //boolean used to turn limits on and off
uint256 private gasPriceLimit = 7 * 1 gwei;
mapping(address => uint256) private _holderLastTransferBlock; // for 1 tx per block
mapping(address => uint256) private _holderLastTransferTimestamp; // for sell cooldown timer
ui... | bool public limitsInEffect = true; //boolean used to turn limits on and off
uint256 private gasPriceLimit = 7 * 1 gwei;
mapping(address => uint256) private _holderLastTransferBlock; // for 1 tx per block
mapping(address => uint256) private _holderLastTransferTimestamp; // for sell cooldown timer
ui... | 15,615 |
127 | // Emergency withdraw for tokens left in contract / | function withdrawToken(address tokenAddress, uint256 amount) external onlyOwner {
if ( amount == 0 )
amount = IERC20(tokenAddress).balanceOf(address(this));
IERC20(tokenAddress).transfer(owner(), amount);
}
| function withdrawToken(address tokenAddress, uint256 amount) external onlyOwner {
if ( amount == 0 )
amount = IERC20(tokenAddress).balanceOf(address(this));
IERC20(tokenAddress).transfer(owner(), amount);
}
| 22,291 |
405 | // internal function to save on code size for the onlyActiveReserve modifier/ | function requireReserveActiveInternal(address _reserve) internal view {
require(core.getReserveIsActive(_reserve), "Action requires an active reserve");
}
| function requireReserveActiveInternal(address _reserve) internal view {
require(core.getReserveIsActive(_reserve), "Action requires an active reserve");
}
| 18,687 |
60 | // use token address TOMO_TOKEN_ADDRESS for tomo/makes a trade between src and dest token and send dest token to destAddress/src Src token/srcAmount amount of src tokens/dest Destination token/destAddress Address to send tokens to/maxDestAmount A limit on the amount of dest tokens/minConversionRate The minimal conversi... | function swap(
TRC20 src,
uint srcAmount,
TRC20 dest,
address destAddress,
uint maxDestAmount,
uint minConversionRate,
address walletId
)
public
| function swap(
TRC20 src,
uint srcAmount,
TRC20 dest,
address destAddress,
uint maxDestAmount,
uint minConversionRate,
address walletId
)
public
| 29,836 |
16 | // Verify that the new Balance is in expected state | require(
_balances[rewardClaim.accountKey] == rewardClaim.newBalance,
"Rewards: New Balance is not in Expected State"
);
| require(
_balances[rewardClaim.accountKey] == rewardClaim.newBalance,
"Rewards: New Balance is not in Expected State"
);
| 61,650 |
43 | // Lets a module admin restrict token transfers. | function setRestrictedTransfer(bool _restrictedTransfer) external onlyModuleAdmin {
transfersRestricted = _restrictedTransfer;
emit TransfersRestricted(_restrictedTransfer);
}
| function setRestrictedTransfer(bool _restrictedTransfer) external onlyModuleAdmin {
transfersRestricted = _restrictedTransfer;
emit TransfersRestricted(_restrictedTransfer);
}
| 9,548 |
488 | // The COMP borrow index for each market for each borrower as of the last time they accrued COMP/This storage is depreacted. | mapping(address => mapping(address => uint256)) public compBorrowerIndex;
| mapping(address => mapping(address => uint256)) public compBorrowerIndex;
| 31,973 |
2 | // Checking if both players have joined | bool isPlayerOneIn;
bool isPlayerTwoIn;
| bool isPlayerOneIn;
bool isPlayerTwoIn;
| 29,574 |
283 | // Setting presaleEnded state to true allows for minting beyond the presale token count/ | function setPresaleState() external onlyOwner {
presaleEnded = !presaleEnded;
}
| function setPresaleState() external onlyOwner {
presaleEnded = !presaleEnded;
}
| 57,271 |
22 | // Allows the current owner to change the asset manager to a newManager. newManager The address to change asset management to. / | function changeAssetManager(address payable newManager) external onlyOwner {
require(newManager != address(0), "newManager should not be address(0).");
emit AssetManagerChanged(_assetManager, newManager);
_assetManager = newManager;
}
| function changeAssetManager(address payable newManager) external onlyOwner {
require(newManager != address(0), "newManager should not be address(0).");
emit AssetManagerChanged(_assetManager, newManager);
_assetManager = newManager;
}
| 26,102 |
259 | // Gain czxp for sacrificing card | uint256 sacrificeCzxp = allCardTypes[Cards[_tokenId].cardTypeId].sacrificeCzxp;
awardCzxp(msg.sender,sacrificeCzxp);
| uint256 sacrificeCzxp = allCardTypes[Cards[_tokenId].cardTypeId].sacrificeCzxp;
awardCzxp(msg.sender,sacrificeCzxp);
| 1,763 |
21 | // sets the owner as the deployer (who deployed reputationToken and reputationController together) | owner = msg.sender;
| owner = msg.sender;
| 22,956 |
299 | // Validates seize and reverts on rejection. May emit logs. cTokenCollateral Asset which was used as collateral and will be seized cTokenBorrowed Asset which was borrowed by the borrower liquidator The address repaying the borrow and seizing the collateral borrower The address of the borrower seizeTokens The number of ... | function seizeVerify(
address cTokenCollateral,
address cTokenBorrowed,
address liquidator,
address borrower,
| function seizeVerify(
address cTokenCollateral,
address cTokenBorrowed,
address liquidator,
address borrower,
| 43,387 |
80 | // Gets the token ID at a given index of the tokens list of the requested owner. owner address owning the tokens list to be accessed index uint256 representing the index to be accessed of the requested tokens listreturn uint256 token ID at the given index of the tokens list owned by the requested address / | function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
| function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256) {
require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
| 15,213 |
44 | // Var to track the rewarder pool. | PoolInfo public poolInfo;
| PoolInfo public poolInfo;
| 61,668 |
104 | // Overrides the superclass implementation to handle custom logicsuch as taking fees, burning tokens, and supplying liquidity to PancakeSwap | function _transfer(
address from,
address to,
uint256 amount
| function _transfer(
address from,
address to,
uint256 amount
| 11,089 |
19 | // Create the contract._contractAddressLocator The contract address locator._description The voting description._startBlock The voting start block._endBlock The voting end block./ | constructor(IContractAddressLocator _contractAddressLocator, string _description, uint256 _startBlock, uint256 _endBlock) ContractAddressLocatorHolder(_contractAddressLocator) public
| constructor(IContractAddressLocator _contractAddressLocator, string _description, uint256 _startBlock, uint256 _endBlock) ContractAddressLocatorHolder(_contractAddressLocator) public
| 75,759 |
6 | // cash request info | address payable[] authorizedCashRecipients;
uint256 newCashRecipientId;
uint256 newCashRequestId;
| address payable[] authorizedCashRecipients;
uint256 newCashRecipientId;
uint256 newCashRequestId;
| 34,740 |
79 | // Cancels previously made sell offer. Caller has to be an owner of the canvas. Function will fail if there is no sell offer for the canvas./ | function cancelSellOffer(uint32 _canvasId) external {
cancelSellOfferInternal(_canvasId, true);
}
| function cancelSellOffer(uint32 _canvasId) external {
cancelSellOfferInternal(_canvasId, true);
}
| 4,652 |
34 | // TODO: CHECK IF A TABLE ALREADY EXISTS BEFORE CREATING ONE | contract SQLStorage {
bytes1 comma = 44;
bytes1 recordSeparator = 124;
// architecture
// columnsBundle a column is maximum 32 characters
// metadata
uint numberOfTables;
// table index -> table name
mapping(uint => string) tableNames;
// table name -> count
mapping(string =>... | contract SQLStorage {
bytes1 comma = 44;
bytes1 recordSeparator = 124;
// architecture
// columnsBundle a column is maximum 32 characters
// metadata
uint numberOfTables;
// table index -> table name
mapping(uint => string) tableNames;
// table name -> count
mapping(string =>... | 25,139 |
79 | // Raises an `Signed` to the power of an unscaled uint256, reverting on overflow. E.g., `b=2` squares `a`. This will "floor" the result. a a FixedPoint.Signed. b a uint256 (negative exponents are not allowed).return output is `a` to the power of `b`. / | function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) {
output = fromUnscaledInt(1);
for (uint256 i = 0; i < b; i = i.add(1)) {
output = mul(output, a);
}
}
| function pow(Signed memory a, uint256 b) internal pure returns (Signed memory output) {
output = fromUnscaledInt(1);
for (uint256 i = 0; i < b; i = i.add(1)) {
output = mul(output, a);
}
}
| 19,598 |
1 | // old steward has the buy function with only one parameter | function buy(uint256 _newPrice) external payable;
function price() external view returns (uint256); // mimics fetching the variable
| function buy(uint256 _newPrice) external payable;
function price() external view returns (uint256); // mimics fetching the variable
| 71,922 |
12 | // Recipient should match the sender | uint256 msgIdx = uint256(readBytes32(reqData, 4));
address recipient = address(readBytes32(reqData, 4 + msgIdx + 20));
require(recipient == relayRequest.request.from, "sender does not match recipient");
return (abi.encodePacked(relayRequest.request.from, maxPossibleGas, maxTokensFee), tr... | uint256 msgIdx = uint256(readBytes32(reqData, 4));
address recipient = address(readBytes32(reqData, 4 + msgIdx + 20));
require(recipient == relayRequest.request.from, "sender does not match recipient");
return (abi.encodePacked(relayRequest.request.from, maxPossibleGas, maxTokensFee), tr... | 18,349 |
19 | // (274 bytes) | function pickEye(uint8 seed) private pure returns (uint8) {
if (seed < 80) return 0;
if (seed < 144) return 1;
if (seed < 184) return 2;
if (seed < 224) return 3;
if (seed < 246) return 4;
if (seed < 254) return 5;
return 6;
}
| function pickEye(uint8 seed) private pure returns (uint8) {
if (seed < 80) return 0;
if (seed < 144) return 1;
if (seed < 184) return 2;
if (seed < 224) return 3;
if (seed < 246) return 4;
if (seed < 254) return 5;
return 6;
}
| 8,264 |
61 | // Set an account can perform some operations _newManager Manager addressreturn True if success / | function setManager(address _newManager) public onlyAdmin returns (bool) {
manager = _newManager;
emit NewManager(_newManager);
return true;
}
| function setManager(address _newManager) public onlyAdmin returns (bool) {
manager = _newManager;
emit NewManager(_newManager);
return true;
}
| 41,938 |
37 | // Constant used to specify the highest gas price available in the gelato system/Input 0 as gasPriceCeil and it will be assigned to NO_CEIL/ return MAX_UINT | function NO_CEIL() external pure returns(uint256);
| function NO_CEIL() external pure returns(uint256);
| 11,639 |
1 | // helper contract for EntryPoint, to call userOp.initCode from a "neutral" address,which is explicitly not the entryPoint itself. / | contract SenderCreator {
/**
* call the "initCode" factory to create and return the sender account address
* @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata
* @return sender the returned address of the created account, or zero address on f... | contract SenderCreator {
/**
* call the "initCode" factory to create and return the sender account address
* @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata
* @return sender the returned address of the created account, or zero address on f... | 23,545 |
40 | // Returns the current implementation.return impl Address of the current implementation / | function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
| function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
| 22,740 |
10 | // defining Structure of the Policy | struct Policy
| struct Policy
| 49,244 |
24 | // check if token is in shell. If it is in the shell, return the index. If not, revert | bool isIn;
for (uint8 i = 0; i < 5; i++) {
if (_shells[tokenId].tokenList[i] == addy) {
isIn = true;
} else {
| bool isIn;
for (uint8 i = 0; i < 5; i++) {
if (_shells[tokenId].tokenList[i] == addy) {
isIn = true;
} else {
| 6,091 |
106 | // safeApprove should only be called when setting an initial allowance, or when resetting it to zero. To increase and decrease it, use 'safeIncreaseAllowance' and 'safeDecreaseAllowance' solhint-disable-next-line max-line-length |
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
|
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
| 433 |
492 | // isApprovedForAll(): returns true if _operator is anoperator for _owner | function isApprovedForAll(address _owner, address _operator)
public
view
returns (bool result)
| function isApprovedForAll(address _owner, address _operator)
public
view
returns (bool result)
| 39,283 |
239 | // Interest Module Interface//Paladin | interface InterestInterface {
function getSupplyRate(address palPool, uint cash, uint borrows, uint reserves, uint reserveFactor) external view returns(uint);
function getBorrowRate(address palPool, uint cash, uint borrows, uint reserves) external view returns(uint);
}
| interface InterestInterface {
function getSupplyRate(address palPool, uint cash, uint borrows, uint reserves, uint reserveFactor) external view returns(uint);
function getBorrowRate(address palPool, uint cash, uint borrows, uint reserves) external view returns(uint);
}
| 14,916 |
54 | // get current active loans in the system/start of the index/count number of loans to return/unsafeOnly boolean if true return unsafe loan only (open for liquidation) | function getActiveLoans(
uint256 start,
uint256 count,
bool unsafeOnly
) external view returns (LoanReturnData[] memory loansData);
| function getActiveLoans(
uint256 start,
uint256 count,
bool unsafeOnly
) external view returns (LoanReturnData[] memory loansData);
| 5,453 |
7 | // point | pairWinners[i][2] = prefs[i][2];
| pairWinners[i][2] = prefs[i][2];
| 45,952 |
36 | // Claims rewards from the Balancer's fee distributor contract and transfers the tokens into the rewards contract | function earmarkFees() external;
function isShutdown() external view returns (bool);
function poolInfo(uint256)
external
view
returns (
address,
address,
| function earmarkFees() external;
function isShutdown() external view returns (bool);
function poolInfo(uint256)
external
view
returns (
address,
address,
| 27,331 |
19 | // gas fiddling | switch success case 0 {
revert(0, 0)
}
| switch success case 0 {
revert(0, 0)
}
| 13,238 |
37 | // Public swap ETH->DRVS | function swap_for_drvs(uint256 amountIn) public returns(uint256 amountOut) {
amountOut = swapExactInputSingle(amountIn);
}
| function swap_for_drvs(uint256 amountIn) public returns(uint256 amountOut) {
amountOut = swapExactInputSingle(amountIn);
}
| 36,512 |
39 | // storage and mapping of all balances & allowances | mapping (address => Account) accounts;
| mapping (address => Account) accounts;
| 31,284 |
2 | // read elements | balances[msg.sender];
| balances[msg.sender];
| 49,402 |
2 | // Update the number of feathers claimed for the sender address | whitelist[msg.sender] = whitelist[msg.sender] - numberOfTokens;
for (uint256 i = 0; i < numberOfTokens; i++) {
_safeMint(msg.sender, _nextTokenId.current());
_nextTokenId.increment();
}
| whitelist[msg.sender] = whitelist[msg.sender] - numberOfTokens;
for (uint256 i = 0; i < numberOfTokens; i++) {
_safeMint(msg.sender, _nextTokenId.current());
_nextTokenId.increment();
}
| 32,059 |
5 | // Used to ensure that the function it is applied to cannot be reentered. 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, a... | modifier nonReentrant() {
_nonReentrantIn();
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
| modifier nonReentrant() {
_nonReentrantIn();
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
| 12,889 |
262 | // function to calculate the interest using a compounded interest rate formula _rate the interest rate, in ray _lastUpdateTimestamp the timestamp of the last update of the interestreturn the interest rate compounded during the timeDelta, in ray / | ) internal view returns (uint256) {
//solium-disable-next-line
uint256 timeDifference = block.timestamp.sub(
uint256(_lastUpdateTimestamp)
);
uint256 ratePerSecond = _rate.div(SECONDS_PER_YEAR);
return ratePerSecond.add(WadRayMath.ray()).rayPow(timeDifference);
... | ) internal view returns (uint256) {
//solium-disable-next-line
uint256 timeDifference = block.timestamp.sub(
uint256(_lastUpdateTimestamp)
);
uint256 ratePerSecond = _rate.div(SECONDS_PER_YEAR);
return ratePerSecond.add(WadRayMath.ray()).rayPow(timeDifference);
... | 17,421 |
1 | // PUBLIC VARIABLES |
gamblerarray[] public gamblerlist;
uint public Gamblers_Until_Jackpot=0;
uint public Total_Gamblers=0;
uint public FeeRate=7;
uint public Bankroll = 0;
uint public Jackpot = 0;
uint public Total_Deposits=0;
uint public Total_Payouts=0;
uint public MinDeposit=100 finney;
|
gamblerarray[] public gamblerlist;
uint public Gamblers_Until_Jackpot=0;
uint public Total_Gamblers=0;
uint public FeeRate=7;
uint public Bankroll = 0;
uint public Jackpot = 0;
uint public Total_Deposits=0;
uint public Total_Payouts=0;
uint public MinDeposit=100 finney;
| 9,030 |
8 | // KiCollectable Kick Ass Collectable (KCB), Base on Openzeppelin ERC721 contract. / | contract KiCollectable is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable {
using Counters for Counters.Counter;
// Trade index number counter
Counters.Counter private _tokenIdCounter;
constructor() ERC721("KiCollectable", "KCB") {}
function _baseURI() internal pure override returns (string m... | contract KiCollectable is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable {
using Counters for Counters.Counter;
// Trade index number counter
Counters.Counter private _tokenIdCounter;
constructor() ERC721("KiCollectable", "KCB") {}
function _baseURI() internal pure override returns (string m... | 40,206 |
12 | // bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)"); | bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;
string public constant name = "Flash Token";
string public constant symbol = "FLASH";
uint8 public constant decimals = 18;
uint256 public override totalSupply;
uin... | bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;
string public constant name = "Flash Token";
string public constant symbol = "FLASH";
uint8 public constant decimals = 18;
uint256 public override totalSupply;
uin... | 19,618 |
283 | // Owner can set price oracle address/_priceOracle Router address to add | function setPriceOracle(address _priceOracle) external onlyOwner whenNotPaused {
priceOracle = IPriceOracle(_priceOracle);
// Emit event
emit NewPriceOracle(_priceOracle);
}
| function setPriceOracle(address _priceOracle) external onlyOwner whenNotPaused {
priceOracle = IPriceOracle(_priceOracle);
// Emit event
emit NewPriceOracle(_priceOracle);
}
| 37,159 |
34 | // require(ownerPlanetCount[msg.sender] == 0); Reinstall this line during the game | uint256 randDna = _generateRandomDna(_name);
| uint256 randDna = _generateRandomDna(_name);
| 15,228 |
25 | // Creates a new token type and assigns _initialSupply to an address _maxSupply max supply allowed _initialSupply Optional amount to supply the first owner _uri Optional URI for this token type _data Optional data to pass if receiver is contractreturn _id The newly created token ID / | function create(
uint256 _initialSupply,
uint256 _maxSupply,
string calldata _uri,
bytes calldata _data,
string calldata _ipfs
| function create(
uint256 _initialSupply,
uint256 _maxSupply,
string calldata _uri,
bytes calldata _data,
string calldata _ipfs
| 55,720 |
130 | // Security mechanism which anyone can enable if the total supply of PRPS or DUBI should ever go >= 1 billion | bool private _killSwitchOn;
| bool private _killSwitchOn;
| 57,029 |
281 | // Remove the `_rnid` from the owner | _removeRoomNight(dataSource.roomNightIndexToOwner(_rnid), _rnid);
| _removeRoomNight(dataSource.roomNightIndexToOwner(_rnid), _rnid);
| 14,559 |
76 | // Allows the owner to set the starting time. _start the new _start / | function setStart(uint _start) public onlyOwner {
start = _start;
}
| function setStart(uint _start) public onlyOwner {
start = _start;
}
| 30,274 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.