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 |
|---|---|---|---|---|
247 | // EIP-2981 bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a => 0x2a55205a = 0x2a55205a / | bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a;
| bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a;
| 1,939 |
100 | // Ensure that the Lock has not sold all of its keys. | modifier notSoldOut() {
require(maxNumberOfKeys > numberOfKeysSold, "Maximum number of keys already sold");
_;
}
| modifier notSoldOut() {
require(maxNumberOfKeys > numberOfKeysSold, "Maximum number of keys already sold");
_;
}
| 30,017 |
187 | // Chainlink randomness value | uint256 public chainlinkRandomness;
| uint256 public chainlinkRandomness;
| 27,498 |
83 | // Checks if a given address currently has transferApproval for a particular Asset./_tokenId asset UniqueId | function approvedFor(uint256 _tokenId) public view onlyGrantedContracts returns (address) {
return assetIndexToApproved[_tokenId];
}
| function approvedFor(uint256 _tokenId) public view onlyGrantedContracts returns (address) {
return assetIndexToApproved[_tokenId];
}
| 10,930 |
22 | // sets the merkle root for the whitelist | function setMerkleRoot(bytes32 _root) external onlyOwner {
root = _root;
}
| function setMerkleRoot(bytes32 _root) external onlyOwner {
root = _root;
}
| 22,358 |
83 | // LibBytes library to handle operations on bytes | using LibBytes for bytes;
| using LibBytes for bytes;
| 21,281 |
0 | // Extra predicates | (Token._name == "Sample Token");
(Token._symbol == "STK");
| (Token._name == "Sample Token");
(Token._symbol == "STK");
| 1,114 |
128 | // Let the network know the user has voted on the dispute and their casted vote | emit Voted(_disputeId, _supportsDispute, msg.sender, voteWeight);
| emit Voted(_disputeId, _supportsDispute, msg.sender, voteWeight);
| 11,613 |
12 | // The maximum amount of bets can be made for each game | uint public maxAmountOfBets = 7;
| uint public maxAmountOfBets = 7;
| 11,919 |
221 | // static price is the current exact price in collateral per token according to the initial state of the batch [expressed in PPM for precision sake] | uint256 staticPricePPM = _staticPricePPM(batch.supply, batch.balance, batch.reserveRatio);
| uint256 staticPricePPM = _staticPricePPM(batch.supply, batch.balance, batch.reserveRatio);
| 20,735 |
173 | // Checks that the Kydy is able to synthesize./ | function _isReadyToSynthesize(Kydy _kyd) internal view returns (bool) {
// Double-checking if there is any pending creation event.
return (_kyd.synthesizingWithId == 0) && (_kyd.rechargeEndBlock <= uint64(block.number));
}
| function _isReadyToSynthesize(Kydy _kyd) internal view returns (bool) {
// Double-checking if there is any pending creation event.
return (_kyd.synthesizingWithId == 0) && (_kyd.rechargeEndBlock <= uint64(block.number));
}
| 71,299 |
4 | // Reverts a function if a colormap does not exist./_hash Hash of the colormap's definition. | modifier colormapExists(bytes8 _hash) {
SegmentData memory segmentData = segments[_hash];
| modifier colormapExists(bytes8 _hash) {
SegmentData memory segmentData = segments[_hash];
| 44,996 |
175 | // Change the creator address for given token_to Address of the new creator_idToken IDs to change creator of/ | function _setCreator(address _to, uint256 _id) internal creatorOnly(_id)
| function _setCreator(address _to, uint256 _id) internal creatorOnly(_id)
| 12,425 |
26 | // | * @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
| * @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
| 15,903 |
269 | // Cache the end of the memory to calculate the length later. | let end := str
| let end := str
| 11,285 |
168 | // 8 bytes 基金经理 + 24 bytes 简要描述 | function descriptor() external view returns (bytes32);
| function descriptor() external view returns (bytes32);
| 37,945 |
5 | // Aprove allows a user to withdraw from the owners account multiple times up untill the max available balanceif the function is called again it overwrites the current allowance with the amount being withdrawn | function Approve(address recipient,uint256 amount) constant returns (bool success);
| function Approve(address recipient,uint256 amount) constant returns (bool success);
| 21,902 |
215 | // A function that rescue any ERC20 token/_token token address/_amount amount to rescue/_recipient address to send token rescued | function rescueERC20(
address _token,
uint256 _amount,
address _recipient
| function rescueERC20(
address _token,
uint256 _amount,
address _recipient
| 59,242 |
62 | // Keep track of spent Parsec credits amount | uint256 public spentParsecCredits;
| uint256 public spentParsecCredits;
| 13,112 |
3 | // ----------- Burner only state changing api ----------- |
function burnFrom(address account, uint256 amount) external;
|
function burnFrom(address account, uint256 amount) external;
| 22,987 |
546 | // Calculate denominator for row 4102: x - g^4102z. | let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0xbc0)))
mstore(add(productsPtr, 0x920), partialProduct)
mstore(add(valuesPtr, 0x920), denominator)
partialProduct := mulmod(partialProduct, denominator, PRIME)
| let denominator := add(shiftedEvalPoint, mload(add(expmodsAndPoints, 0xbc0)))
mstore(add(productsPtr, 0x920), partialProduct)
mstore(add(valuesPtr, 0x920), denominator)
partialProduct := mulmod(partialProduct, denominator, PRIME)
| 77,093 |
14 | // The final fee must be < available collateral or the fee will be larger than 100%. | require(collateralPool.isGreaterThan(amount), "Final fee is more than PfC");
_adjustCumulativeFeeMultiplier(amount, collateralPool);
| require(collateralPool.isGreaterThan(amount), "Final fee is more than PfC");
_adjustCumulativeFeeMultiplier(amount, collateralPool);
| 37,865 |
341 | // Commits the current open draw, if any, and opens the next draw using the passed hash.Really this function is only called twice:the first after Pool contract creation and the second immediately after.Can only be called by an admin.May fire the Committed event, and always fires the Open event. nextSecretHash The secre... | function openNextDraw(bytes32 nextSecretHash) public onlyAdmin {
if (currentCommittedDrawId() > 0) {
require(currentCommittedDrawHasBeenRewarded(), "Pool/not-reward");
}
if (currentOpenDrawId() != 0) {
emitCommitted();
}
open(nextSecretHash);
}
| function openNextDraw(bytes32 nextSecretHash) public onlyAdmin {
if (currentCommittedDrawId() > 0) {
require(currentCommittedDrawHasBeenRewarded(), "Pool/not-reward");
}
if (currentOpenDrawId() != 0) {
emitCommitted();
}
open(nextSecretHash);
}
| 55,256 |
200 | // calculate max ( short amount - long amount , 0) / | FPI.FixedPointInt memory secondPart = FPI.max(_shortAmount.sub(_longAmount), ZERO);
| FPI.FixedPointInt memory secondPart = FPI.max(_shortAmount.sub(_longAmount), ZERO);
| 22,643 |
2 | // Per clone variables Clone init settings | IERC20 public collateral;
IOracle public oracle;
bytes public oracleData;
| IERC20 public collateral;
IOracle public oracle;
bytes public oracleData;
| 26,529 |
2 | // Redeem related | mapping (address => uint256) public redeemFXSBalances;
mapping (address => mapping(uint256 => uint256)) public redeemCollateralBalances; // Address -> collateral index -> balance
uint256[] public unclaimedPoolCollateral; // collateral index -> balance
uint256 private unclaimedPoolFXS;
mapping (addre... | mapping (address => uint256) public redeemFXSBalances;
mapping (address => mapping(uint256 => uint256)) public redeemCollateralBalances; // Address -> collateral index -> balance
uint256[] public unclaimedPoolCollateral; // collateral index -> balance
uint256 private unclaimedPoolFXS;
mapping (addre... | 33,665 |
119 | // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes This check is not completely accurate, since it is possible that more signatures than the threshold are send. Here we only check that the pointer is not pointing inside the part that is being processed | require(uint256(s) >= requiredSignatures.mul(65), "GS021");
| require(uint256(s) >= requiredSignatures.mul(65), "GS021");
| 16,707 |
224 | // Only emitted for claims that generate a new tokenId // Constructor function / | constructor(
bool[1] memory bools, address[3] memory addresses, uint256[3] memory uints, string[2] memory strings
| constructor(
bool[1] memory bools, address[3] memory addresses, uint256[3] memory uints, string[2] memory strings
| 41,811 |
32 | // Claim your share of the balance. / | function claim(address token) public {
executeClaim(token, msg.sender, calculateMaximumPayment(token, msg.sender));
}
| function claim(address token) public {
executeClaim(token, msg.sender, calculateMaximumPayment(token, msg.sender));
}
| 9,917 |
23 | // MCV2 start to earn CAKE reward from current block in MCV1 pool | lastBurnedTimestamp = block.timestamp;
emit Init();
| lastBurnedTimestamp = block.timestamp;
emit Init();
| 27,787 |
128 | // caller needs to do the actual token transfer | function _executeDelayedTransfer(bytes32 id) internal returns (delayedTransfer memory) {
delayedTransfer memory transfer = delayedTransfers[id];
require(transfer.timestamp > 0, "delayed transfer not exist");
require(block.timestamp > transfer.timestamp + delayPeriod, "delayed transfer still ... | function _executeDelayedTransfer(bytes32 id) internal returns (delayedTransfer memory) {
delayedTransfer memory transfer = delayedTransfers[id];
require(transfer.timestamp > 0, "delayed transfer not exist");
require(block.timestamp > transfer.timestamp + delayPeriod, "delayed transfer still ... | 55,930 |
12 | // Disallow token withdrawals if there are no tokens to withdraw. | require(contract_token_balance != 0);
| require(contract_token_balance != 0);
| 37,895 |
15 | // Used to get the balance of an account accross all the vaults for a token.will be used to get the wrapper balance using totalVaultBalance(address(this)).account The address of the account. return balance of token for the account accross all the vaults. / | function totalVaultBalance(address account)
public
view
returns (uint256 balance)
| function totalVaultBalance(address account)
public
view
returns (uint256 balance)
| 30,251 |
54 | // Atomically decreases the allowance granted to `spender` by the caller. | ... | ... | 5,163 |
11 | // Returns the list of keys being tracked by the changelog/May fail if keys is too large, if so, call count() and iterate with get() | function list() public view returns (bytes32[] memory) {
return keys;
}
| function list() public view returns (bytes32[] memory) {
return keys;
}
| 37,959 |
11 | // The contracts in this list should correspond to MCD core contracts, verifyagainst the current release list at: https:changelog.makerdao.com/releases/mainnet/1.0.8/contracts.json | address constant MCD_JUG = 0x19c0976f590D67707E62397C87829d896Dc0f1F1;
address constant MCD_POT = 0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7;
address constant MCD_SPOT = 0x65C79fcB50Ca1594B025960e539eD7A9a6D434A3;
address constant GITCOIN_OLD = 0xA4188B523EccECFbAC49855eB52eA0b55c4d56dd;
address co... | address constant MCD_JUG = 0x19c0976f590D67707E62397C87829d896Dc0f1F1;
address constant MCD_POT = 0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7;
address constant MCD_SPOT = 0x65C79fcB50Ca1594B025960e539eD7A9a6D434A3;
address constant GITCOIN_OLD = 0xA4188B523EccECFbAC49855eB52eA0b55c4d56dd;
address co... | 16,571 |
15 | // Convert signed 64.64 fixed point number into signed 64-bit integer numberrounding down.x signed 64.64-bit fixed point numberreturn signed 64-bit integer number / | function toInt (int128 x) internal pure returns (int64) {
return int64 (x >> 64);
}
| function toInt (int128 x) internal pure returns (int64) {
return int64 (x >> 64);
}
| 1,319 |
98 | // Multiplies two precise units, and then truncates by the given scale. For example,when calculating 90% of 10e18, (10e189e17) / 1e18 = (9e36) / 1e18 = 9e18 x Left hand input to multiplication y Right hand input to multiplication scale Scale unitreturn Result after multiplying the two inputs and then dividing by the sh... | function mulTruncateScale(
uint256 x,
uint256 y,
uint256 scale
| function mulTruncateScale(
uint256 x,
uint256 y,
uint256 scale
| 7,300 |
184 | // shampoo tokens created per block. | uint256 public shampooPerBlock;
| uint256 public shampooPerBlock;
| 17,128 |
98 | // PSM swap parameters | address tokenToSwapWithPsm;
address tokenJoinForSwapWithPsm;
address psm;
uint256 psmSellGemAmount;
uint256 expectedDebtTokenFromPsmSellGemOperation;
address lendingPool;
| address tokenToSwapWithPsm;
address tokenJoinForSwapWithPsm;
address psm;
uint256 psmSellGemAmount;
uint256 expectedDebtTokenFromPsmSellGemOperation;
address lendingPool;
| 70,080 |
6,170 | // 3087 | entry "unwittily" : ENG_ADVERB
| entry "unwittily" : ENG_ADVERB
| 23,923 |
4 | // Returns a slice containing the entire string. self The string to make a slice from.return A newly allocated slice containing the entire string. / | function toSlice(string memory self) internal pure returns (slice memory) {
uint ptr;
assembly {
ptr := add(self, 0x20)
}
return slice(bytes(self).length, ptr);
}
| function toSlice(string memory self) internal pure returns (slice memory) {
uint ptr;
assembly {
ptr := add(self, 0x20)
}
return slice(bytes(self).length, ptr);
}
| 10,092 |
19 | // store compressed note coordinate gamma in `s + 0x80` | mstore(
add(s, 0xa0),
or(
calldataload(add(noteIndex, 0x40)),
mul(
and(calldataload(add(noteIndex, 0x60)), 0x01),
0x80000000000000000000000000000000000000000000... | mstore(
add(s, 0xa0),
or(
calldataload(add(noteIndex, 0x40)),
mul(
and(calldataload(add(noteIndex, 0x60)), 0x01),
0x80000000000000000000000000000000000000000000... | 48,677 |
9 | // Set the time after which the user will be able to use the faucet time new faucet time limit in seconds (timestamp) / | function setFaucetTimeLimit(uint256 time) external onlyRole(OPERATOR_ROLE) {
faucetTimeLimit = time;
}
| function setFaucetTimeLimit(uint256 time) external onlyRole(OPERATOR_ROLE) {
faucetTimeLimit = time;
}
| 41,494 |
23 | // Allow to reimburse if funding of the round was unsuccessful. | if (!round.hasPaid[_answer]) {
reward = round.contributions[_beneficiary][_answer];
} else if (question.ruling == 0 || !round.hasPaid[question.ruling]) {
| if (!round.hasPaid[_answer]) {
reward = round.contributions[_beneficiary][_answer];
} else if (question.ruling == 0 || !round.hasPaid[question.ruling]) {
| 37,909 |
124 | // Spends a certain amount of tokens to acquire other tokens. Sends takerMarket tokens to thespecified exchangeWrapper and expects makerMarket tokens in return. The amount field appliesto the takerMarket. / | struct SellArgs {
Types.AssetAmount amount;
Account.Info account;
uint256 takerMarket;
uint256 makerMarket;
address exchangeWrapper;
bytes orderData;
}
| struct SellArgs {
Types.AssetAmount amount;
Account.Info account;
uint256 takerMarket;
uint256 makerMarket;
address exchangeWrapper;
bytes orderData;
}
| 23,781 |
22 | // If true, no changes can be made | function unchangeable() public view returns (bool){
return _unchangeable;
}
| function unchangeable() public view returns (bool){
return _unchangeable;
}
| 16,385 |
158 | // Transfers of securities may fail for a number of reasons. So this function will used to understand thecause of failure by getting the byte value. Which will be the ESC that follows the EIP 1066. ESC can be mappedwith a reson string to understand the failure cause, table of Ethereum status code will always reside off... | function canTransferFrom(address _from, address _to, uint256 _value, bytes calldata _data) external view returns (byte statusCode, bytes32 reasonCode);
| function canTransferFrom(address _from, address _to, uint256 _value, bytes calldata _data) external view returns (byte statusCode, bytes32 reasonCode);
| 33,321 |
10 | // Set token price once before start of crowdsale / | function setTokenPrice(uint256 _tokenPriceNum, uint256 _tokenPriceDenom) public onlyOwner {
require(tokenPriceNum == 0 && tokenPriceDenom == 0);
require(_tokenPriceNum > 0 && _tokenPriceDenom > 0);
tokenPriceNum = _tokenPriceNum;
tokenPriceDenom = _tokenPriceDenom;
}
| function setTokenPrice(uint256 _tokenPriceNum, uint256 _tokenPriceDenom) public onlyOwner {
require(tokenPriceNum == 0 && tokenPriceDenom == 0);
require(_tokenPriceNum > 0 && _tokenPriceDenom > 0);
tokenPriceNum = _tokenPriceNum;
tokenPriceDenom = _tokenPriceDenom;
}
| 47,532 |
46 | // From ERC721 registry assetId to Order (to avoid asset collision) | mapping (address => mapping(uint256 => Order)) public orderByAssetId;
| mapping (address => mapping(uint256 => Order)) public orderByAssetId;
| 14,092 |
13 | // Set the NFT capacity of each escrow vault_capacity the new NFT capacity / | function setNFTCapacity(uint256 _capacity) public onlyOwner {
nftCapacity = _capacity;
}
| function setNFTCapacity(uint256 _capacity) public onlyOwner {
nftCapacity = _capacity;
}
| 7,850 |
131 | // Returns whether refundees can withdraw their deposits (be refunded). The overridden function receives a'payee' argument, but we ignore it here since the condition is global, not per-payee. / | function withdrawalAllowed(address) override public view returns (bool) {
return _state == State.Refunding;
}
| function withdrawalAllowed(address) override public view returns (bool) {
return _state == State.Refunding;
}
| 7,894 |
12 | // Holders with more than the maximum RYOSHI balance will all have the same voting power: | if (balance > maxRyoshiBalance) balance = maxRyoshiBalance;
| if (balance > maxRyoshiBalance) balance = maxRyoshiBalance;
| 75,176 |
361 | // Sets the reference to the sale auction./_address - Address of sale contract. | function setBattleProviderAddress(address _address) external onlyAdmin {
PVPInterface candidateContract = PVPInterface(_address);
// NOTE: verify that a contract is what we expect - https://github.com/Lunyr/crowdsale-contracts/blob/cfadd15986c30521d8ba7d5b6f57b4fefcc7ac38/contracts/LunyrToken.sol#L... | function setBattleProviderAddress(address _address) external onlyAdmin {
PVPInterface candidateContract = PVPInterface(_address);
// NOTE: verify that a contract is what we expect - https://github.com/Lunyr/crowdsale-contracts/blob/cfadd15986c30521d8ba7d5b6f57b4fefcc7ac38/contracts/LunyrToken.sol#L... | 24,139 |
42 | // Function can be called by an DEUS holder to have the protocol buy back DEUS with excess collateral value from a desired collateral pool This can also happen if the collateral ratio > 1 | function buyBackDEUS(
uint256 DEUS_amount,
uint256[] memory collateral_price,
uint256 deus_current_price,
uint256 expireBlock,
bytes[] calldata sigs
| function buyBackDEUS(
uint256 DEUS_amount,
uint256[] memory collateral_price,
uint256 deus_current_price,
uint256 expireBlock,
bytes[] calldata sigs
| 51,196 |
258 | // Math: small chance of underflow due to possible rounding in sqrt | tokenAmount = tokenAmount.sub(supply);
return fundraisedAmount.add(tokenAmount);
| tokenAmount = tokenAmount.sub(supply);
return fundraisedAmount.add(tokenAmount);
| 7,870 |
74 | // Keep a reference to the token ID being iterated on. | uint256 _tokenId;
for (uint256 _i; _i < _count; ) {
| uint256 _tokenId;
for (uint256 _i; _i < _count; ) {
| 33,550 |
11 | // Emits an {ERC1155TokenAdded} event.Requirements:- Schain should not be killed.- Only owner of the schain able to run function. / | function addERC1155TokenByOwner(
string calldata schainName,
address erc1155OnMainnet
)
external
override
onlySchainOwner(schainName)
whenNotKilled(keccak256(abi.encodePacked(schainName)))
{
_addERC1155ForSchain(schainName, erc1155OnMainnet);
| function addERC1155TokenByOwner(
string calldata schainName,
address erc1155OnMainnet
)
external
override
onlySchainOwner(schainName)
whenNotKilled(keccak256(abi.encodePacked(schainName)))
{
_addERC1155ForSchain(schainName, erc1155OnMainnet);
| 72,395 |
10 | // Delete the slot where the moved value was stored | set._values.pop();
| set._values.pop();
| 41,389 |
162 | // Convert back to required pull amount | if (address(oracle) != address(0)) {
paidToken = _toToken(paid, tokens, equivalent);
require(paidToken <= amount, "Paid can't exceed requested");
} else {
| if (address(oracle) != address(0)) {
paidToken = _toToken(paid, tokens, equivalent);
require(paidToken <= amount, "Paid can't exceed requested");
} else {
| 44,101 |
12 | // set immutables in constructor/also set the implementation contract to initialized = true | constructor(address _optionToken, address _oracle) initializer {
optionToken = IPhysicalOptionToken(_optionToken);
oracle = IOracle(_oracle);
}
| constructor(address _optionToken, address _oracle) initializer {
optionToken = IPhysicalOptionToken(_optionToken);
oracle = IOracle(_oracle);
}
| 31,383 |
21 | // Wrap ETH output and transfer to recipient. | if (isToTokenWeth) {
state.weth.deposit.value(boughtAmount)();
state.weth.transfer(to, boughtAmount);
}
| if (isToTokenWeth) {
state.weth.deposit.value(boughtAmount)();
state.weth.transfer(to, boughtAmount);
}
| 24,020 |
20 | // set the new Vault NFT smart contract address newVault the new Vault address / | function setVaultAddress(
address newVault
| function setVaultAddress(
address newVault
| 21,973 |
0 | // Hash of the state of the chain as of this node | bytes32 public override stateHash;
| bytes32 public override stateHash;
| 21,119 |
56 | // Cast the streamed amount to uint128. This is safe due to the check above. | return uint128(streamedAmount.intoUint256());
| return uint128(streamedAmount.intoUint256());
| 31,203 |
2 | // Add the address to the restricted list / | function addRestrictedList(address _evilUser) public onlyOwner {
isRestrictedList[_evilUser] = true;
emit AddedRestrictedList(_evilUser);
}
| function addRestrictedList(address _evilUser) public onlyOwner {
isRestrictedList[_evilUser] = true;
emit AddedRestrictedList(_evilUser);
}
| 38,015 |
111 | // Adds or removes addresses from the whitelist._investor is the address to whitelist_fromTime is the moment when the sale lockup period ends and the investor can freely sell his tokens_toTime is the moment when the purchase lockup period ends and the investor can freely purchase tokens from others_expiryTime is the mo... | function modifyWhitelist(
address _investor,
uint256 _fromTime,
uint256 _toTime,
uint256 _expiryTime,
bool _canBuyFromSTO
)
public
withPerm(WHITELIST)
| function modifyWhitelist(
address _investor,
uint256 _fromTime,
uint256 _toTime,
uint256 _expiryTime,
bool _canBuyFromSTO
)
public
withPerm(WHITELIST)
| 43,449 |
0 | // Mints 15001 BAG to contract creator for initial Uniswap oracle deployment. Will be burned after oracle deployment | _mint(msg.sender, 10000 * 10**18);
| _mint(msg.sender, 10000 * 10**18);
| 34,708 |
251 | // Transfer WETH from the buyer to this contract. | _transferERC20TokensFrom(WETH, msg.sender, address(this), (erc20FillAmount - depositAmount));
| _transferERC20TokensFrom(WETH, msg.sender, address(this), (erc20FillAmount - depositAmount));
| 62,360 |
37 | // add to promoter list | promoter_list.push(promoter_address);
| promoter_list.push(promoter_address);
| 13,441 |
296 | // return amount to user | baseToken.uniTransfer(msg.sender, amountOut);
emit Withdraw(msg.sender, sharesIn, amountOut, totalSupply(), isSettled);
| baseToken.uniTransfer(msg.sender, amountOut);
emit Withdraw(msg.sender, sharesIn, amountOut, totalSupply(), isSettled);
| 29,894 |
169 | // PFToken with Governance. | contract PFToken is ERC20("FireToken", "Fir"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
event MintEvent(address indexed sender,uint256 indexed _amount);
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);... | contract PFToken is ERC20("FireToken", "Fir"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
event MintEvent(address indexed sender,uint256 indexed _amount);
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);... | 14,904 |
25 | // Check, whether a block with a given block hash has been reportedbefore._blockHash The hash of the block that should be checked. return `true` if the block has been reported before. / | function isBlockReported(
bytes32 _blockHash
)
external
view
returns (bool reported_)
| function isBlockReported(
bytes32 _blockHash
)
external
view
returns (bool reported_)
| 31,898 |
484 | // utility functions for uint256 operations / | library UintUtils {
bytes16 private constant HEX_SYMBOLS = '0123456789abcdef';
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return '0';
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
dig... | library UintUtils {
bytes16 private constant HEX_SYMBOLS = '0123456789abcdef';
function toString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return '0';
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
dig... | 79,998 |
0 | // / | interface IERC20 {
function totalSupply() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function transfer(address recipient, uint amount) external returns(bool);
function allowance(address owner, address spender) external view returns(uint);
// function... | interface IERC20 {
function totalSupply() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function transfer(address recipient, uint amount) external returns(bool);
function allowance(address owner, address spender) external view returns(uint);
// function... | 82,477 |
74 | // given an array of ids, returns whether or not this composition is unique assumes the layers are all base layers (flattened)_layers uint256[] an array of token IDs_imageHash uint256 image hash for the composition return bool whether or not the composition is unique/ | function _isUnique(uint256[] _layers, uint256 _imageHash) private view returns (bool) {
return compositions[keccak256(_layers)] == false && imageHashes[_imageHash] == 0;
}
| function _isUnique(uint256[] _layers, uint256 _imageHash) private view returns (bool) {
return compositions[keccak256(_layers)] == false && imageHashes[_imageHash] == 0;
}
| 74,785 |
85 | // Internal function to mint a new tokenReverts if the given token ID already exists_to address the beneficiary that will own the minted token_tokenId uint256 ID of the token to be minted by the msg.sender/ | function _mint(address _to, uint256 _tokenId) internal {
super._mint(_to, _tokenId);
allTokensIndex[_tokenId] = allTokens.length;
allTokens.push(_tokenId);
}
| function _mint(address _to, uint256 _tokenId) internal {
super._mint(_to, _tokenId);
allTokensIndex[_tokenId] = allTokens.length;
allTokens.push(_tokenId);
}
| 38,168 |
24 | // Withdraws system fee. | function withdrawSystemETH(address _beneficiary)
external
onlyAdmin
| function withdrawSystemETH(address _beneficiary)
external
onlyAdmin
| 43,857 |
14 | // --- Internals --- | function _transferFrom(
address caller,
address src,
address dst,
uint256 wad
| function _transferFrom(
address caller,
address src,
address dst,
uint256 wad
| 42,577 |
14 | // Durations and timestamps are expressed in UNIX time, the same units as block.timestamp. | uint256 private _start;
uint256 private _duration;
mapping (address => uint256) private _released;
| uint256 private _start;
uint256 private _duration;
mapping (address => uint256) private _released;
| 9,736 |
407 | // the tick range of the position | int24 tickLower;
int24 tickUpper;
| int24 tickLower;
int24 tickUpper;
| 50,371 |
0 | // Returns the current block number.Using a function rather than `block.number` allows us to easily mock the block number intests./ | function getBlockNumber() internal view returns (uint256) {
return block.number;
}
| function getBlockNumber() internal view returns (uint256) {
return block.number;
}
| 2,930 |
1,073 | // Returns portfolio value for the bitmapped currency | function _getBitmapPortfolioValue(
address account,
uint256 blockTime,
AccountContext memory accountContext,
FreeCollateralFactors memory factors
| function _getBitmapPortfolioValue(
address account,
uint256 blockTime,
AccountContext memory accountContext,
FreeCollateralFactors memory factors
| 65,317 |
50 | // Campaign Funding Function ✅ | function fundCampaign(
Campaign storage _campaign,
uint256 _funding
| function fundCampaign(
Campaign storage _campaign,
uint256 _funding
| 16,113 |
0 | // Order here is important for gas optimisations. Must be fitting into uint265 slots. | bytes32 node; // ENS node
| bytes32 node; // ENS node
| 48,502 |
184 | // Return structure | return (pool.total, pool.remaining, pool.tokenAddress);
| return (pool.total, pool.remaining, pool.tokenAddress);
| 25,677 |
46 | // The challenge will expire in a year, at which point the handle can be claimed if the challenge hasn't been answered. | uint256 _challengeExpiry = block.timestamp + SECONDS_IN_YEAR;
challengeExpiryOf[_handle] = _challengeExpiry;
emit ChallengeHandle(_handle, _challengeExpiry, msg.sender);
| uint256 _challengeExpiry = block.timestamp + SECONDS_IN_YEAR;
challengeExpiryOf[_handle] = _challengeExpiry;
emit ChallengeHandle(_handle, _challengeExpiry, msg.sender);
| 24,766 |
53 | // Dutch auction mints of 200 tokens | tokenId = getTokenIdInRange(
randomNumber,
211,
incrementor,
lowerBound,
upperBound
);
| tokenId = getTokenIdInRange(
randomNumber,
211,
incrementor,
lowerBound,
upperBound
);
| 491 |
48 | // initiate bridge transaction on the source chain | function transferIn(
string calldata _tokenTicker,
uint256 _noOfTokens,
uint8 _toChainId,
uint256 _gasPrice
| function transferIn(
string calldata _tokenTicker,
uint256 _noOfTokens,
uint8 _toChainId,
uint256 _gasPrice
| 10,281 |
149 | // return NextUint32(buff, offset); | (value, offset) = NextUint32(buff, offset);
require(value > 0xFFFF && value <= 0xFFFFFFFF, "NextVarUint, value outside range");
return (value, offset);
| (value, offset) = NextUint32(buff, offset);
require(value > 0xFFFF && value <= 0xFFFFFFFF, "NextVarUint, value outside range");
return (value, offset);
| 33,693 |
13 | // Function `concludeFinal` immediately concludes the channelidentified by `params` if the provided state is valid and final.The caller must provide signatures from all participants.Since any fully-signed final state supersedes any ongoing dispute,concludeFinal may skip any registered dispute.The function emits events ... | function concludeFinal(
Channel.Params memory params,
Channel.State memory state,
bytes[] memory sigs)
public
| function concludeFinal(
Channel.Params memory params,
Channel.State memory state,
bytes[] memory sigs)
public
| 55,244 |
48 | // verify that link wasn't used before | require(usedTransitAddresses[_transitAddress] == false);
| require(usedTransitAddresses[_transitAddress] == false);
| 15,210 |
93 | // Get the equivalent Dai amount of the transfer. | uint256 daiEquivalent = (dDaiAmount.mul(exchangeRate)) / 1e18;
| uint256 daiEquivalent = (dDaiAmount.mul(exchangeRate)) / 1e18;
| 6,770 |
86 | // Rounds to best delta value prevDelta is the delta of the previous strike price currDelta is delta of the current strike price targetDelta is the delta we are targeting isPut is whether its a put / | function _getBestDelta(
uint256 prevDelta,
uint256 currDelta,
uint256 targetDelta,
bool isPut
| function _getBestDelta(
uint256 prevDelta,
uint256 currDelta,
uint256 targetDelta,
bool isPut
| 21,513 |
399 | // returns `be((e(1-n)-b-c)m+en) > (e(1-n)-b-c)x(e-b-c)(1-m)` / | function affordableDeficit(
uint256 b, // <= 2**128-1
uint256 e, // <= 2**128-1
uint256 f, // == e*(1-n)-b-c <= e <= 2**128-1
uint256 g, // == e-b-c <= e <= 2**128-1
uint256 m, // <= M == 1000000
uint256 n, // <= M == 1000000
uint256 x /// < e*c/(b+c) <= e <=... | function affordableDeficit(
uint256 b, // <= 2**128-1
uint256 e, // <= 2**128-1
uint256 f, // == e*(1-n)-b-c <= e <= 2**128-1
uint256 g, // == e-b-c <= e <= 2**128-1
uint256 m, // <= M == 1000000
uint256 n, // <= M == 1000000
uint256 x /// < e*c/(b+c) <= e <=... | 75,617 |
28 | // This function makes it easy to get the total number of reputation/ return The total number of reputation | function totalSupply() public view returns (uint256) {
return totalSupplyAt(block.number);
}
| function totalSupply() public view returns (uint256) {
return totalSupplyAt(block.number);
}
| 9,829 |
3 | // Returns the token name./ | function name() external view returns (string memory) {
return _name;
}
| function name() external view returns (string memory) {
return _name;
}
| 1,258 |
7 | // Tokens to distribute to each pool. Indexed by avaxPairs then partyPairs. | uint256[] public distribution;
uint256 public unallocatedParty = 0;
constructor(
address wavax_,
address party_,
address stableToken_,
address treasuryVester_
| uint256[] public distribution;
uint256 public unallocatedParty = 0;
constructor(
address wavax_,
address party_,
address stableToken_,
address treasuryVester_
| 10,477 |
9 | // Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted}event. Requirements: - the caller must have ``role``'s admin role. / | function grantRole(bytes32 role, address account) external;
| function grantRole(bytes32 role, address account) external;
| 2,524 |
32 | // Minted token information | uint16 public tokenCount;
mapping(uint256 => uint256) internal _mintNumbers;
mapping(address => uint16) internal _addressMintCount;
| uint16 public tokenCount;
mapping(uint256 => uint256) internal _mintNumbers;
mapping(address => uint16) internal _addressMintCount;
| 23,905 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.