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 |
|---|---|---|---|---|
282 | // reset allowance to zero for our previous token if we had one | if (
address(rewardsToken) != address(0) &&
address(rewardsToken) != address(convexToken)
) {
rewardsToken.approve(sushiswap, uint256(0));
}
| if (
address(rewardsToken) != address(0) &&
address(rewardsToken) != address(convexToken)
) {
rewardsToken.approve(sushiswap, uint256(0));
}
| 26,169 |
0 | // Initializes the upgradeable proxy with the initial implementation and admin/implementation_ Address of the implementation/admin_ Address of the admin of the proxy/data_ Data used in a delegate call to implementation. The delegate call will be/ skipped if the data is empty bytes | constructor(
address implementation_,
address admin_,
bytes memory data_
) ERC1967Proxy(implementation_, data_) {
_changeAdmin(admin_);
}
| constructor(
address implementation_,
address admin_,
bytes memory data_
) ERC1967Proxy(implementation_, data_) {
_changeAdmin(admin_);
}
| 28,159 |
11 | // Decrement the counter by `step` step Amount to decrement by / | function decrement(uint256 step) external {
value = value.add(step);
Decrement(step);
}
| function decrement(uint256 step) external {
value = value.add(step);
Decrement(step);
}
| 3,282 |
140 | // See {IERC1155MetadataURI-uri}. This implementation returns the same URI for all token types. It relieson the token type ID substitution mechanism Clients calling this function must replace the `\{id\}` substring with theactual token type ID. / | function uri(uint256 id) external view override returns (string memory) {
require(id <= starCount, "NFT does not exist");
| function uri(uint256 id) external view override returns (string memory) {
require(id <= starCount, "NFT does not exist");
| 4,234 |
36 | // Calculate the liquidated amount and also the fee amount based on a percentage of thevalue of the repaid debt.returnThe position amount bought or sold.returnThe fee amount in margin token. / | function _getLiquidatedAndFeeAmount(
I_PerpetualV1 perpetual,
P1Types.Balance memory initialBalance,
P1Types.Balance memory currentBalance
)
private
view
returns (uint256, uint256)
| function _getLiquidatedAndFeeAmount(
I_PerpetualV1 perpetual,
P1Types.Balance memory initialBalance,
P1Types.Balance memory currentBalance
)
private
view
returns (uint256, uint256)
| 25,900 |
10 | // Struct to hold period information for snapshot mechanism | struct Period {
uint256 totalFeeForPeriod;
uint256 totalForFixedAddress;
uint256 totalHoldersReward;
uint256 totalSupply;
uint256 snapshotId;
uint256 distributionTime;
}
| struct Period {
uint256 totalFeeForPeriod;
uint256 totalForFixedAddress;
uint256 totalHoldersReward;
uint256 totalSupply;
uint256 snapshotId;
uint256 distributionTime;
}
| 9,966 |
95 | // Toggles paused state of project `_projectId`. _projectId Project ID to be toggled. / | function toggleProjectIsPaused(uint256 _projectId) external {
_onlyArtist(_projectId);
projects[_projectId].paused = !projects[_projectId].paused;
emit ProjectUpdated(_projectId, FIELD_PROJECT_PAUSED);
}
| function toggleProjectIsPaused(uint256 _projectId) external {
_onlyArtist(_projectId);
projects[_projectId].paused = !projects[_projectId].paused;
emit ProjectUpdated(_projectId, FIELD_PROJECT_PAUSED);
}
| 33,334 |
1 | // get rand | uint256 seed = uint256(block.blockhash(block.number - 1));
uint256 seed1 = uint256(block.timestamp);
uint256 seed2 = uint256(block.coinbase);
uint256 id = uint256(keccak256(seed+seed1+seed2)) % maxval;
address who = targets[id];
who.tr... | uint256 seed = uint256(block.blockhash(block.number - 1));
uint256 seed1 = uint256(block.timestamp);
uint256 seed2 = uint256(block.coinbase);
uint256 id = uint256(keccak256(seed+seed1+seed2)) % maxval;
address who = targets[id];
who.tr... | 42,045 |
66 | // https:docs.pynthetix.io/contracts/source/contracts/pynthetixstate | contract PynthetixState is Owned, State, LimitedSetup, IPynthetixState {
using SafeMath for uint;
using SafeDecimalMath for uint;
// A struct for handing values associated with an individual user's debt position
struct IssuanceData {
// Percentage of the total debt owned at the time
// ... | contract PynthetixState is Owned, State, LimitedSetup, IPynthetixState {
using SafeMath for uint;
using SafeDecimalMath for uint;
// A struct for handing values associated with an individual user's debt position
struct IssuanceData {
// Percentage of the total debt owned at the time
// ... | 82,765 |
8 | // If there's no ve token holder for that given epoch, anyone can call this function to redistribute the rewards to the closest epoch. / | function redistribute(address token, uint256 epoch) public {
require(
epoch < getCurrentEpoch(),
"Given epoch is still accepting rights."
);
uint256 timestamp = _genesis + epoch * epochUnit + 1 weeks;
require(
IVotingEscrowToken(_veVISION).totalSup... | function redistribute(address token, uint256 epoch) public {
require(
epoch < getCurrentEpoch(),
"Given epoch is still accepting rights."
);
uint256 timestamp = _genesis + epoch * epochUnit + 1 weeks;
require(
IVotingEscrowToken(_veVISION).totalSup... | 42,901 |
300 | // Note: also ensures the given synths are allowed to be atomically exchanged | (
amountReceived, // output amount with fee taken out (denominated in dest currency)
fee, // fee amount (denominated in dest currency)
exchangeFeeRate, // applied fee rate
systemConvertedAmount, // current system value without fees (denominated in dest currency)
... | (
amountReceived, // output amount with fee taken out (denominated in dest currency)
fee, // fee amount (denominated in dest currency)
exchangeFeeRate, // applied fee rate
systemConvertedAmount, // current system value without fees (denominated in dest currency)
... | 38,115 |
13 | // can be later change via 2 step method {transferOwnership} and {claimOwnership}/ Initializes the contract setting a custom initial owner of choice. __owner Initial owner of contract to be set. / | function initialize(address __owner) internal initializer {
_owner = __owner;
emit OwnershipTransferred(address(0), __owner);
}
| function initialize(address __owner) internal initializer {
_owner = __owner;
emit OwnershipTransferred(address(0), __owner);
}
| 17,069 |
0 | // Trip decider logic/ | return (studentCount >= 100 && (principleApproval || legalApproval));
| return (studentCount >= 100 && (principleApproval || legalApproval));
| 12,405 |
48 | // enforces 32 byte length | function toUintStrict(RLPItem memory item) internal pure returns (uint) {
// one byte prefix
require(item.len == 33);
uint result;
uint memPtr = item.memPtr + 1;
assembly {
result := mload(memPtr)
}
return result;
}
| function toUintStrict(RLPItem memory item) internal pure returns (uint) {
// one byte prefix
require(item.len == 33);
uint result;
uint memPtr = item.memPtr + 1;
assembly {
result := mload(memPtr)
}
return result;
}
| 40,047 |
16 | // Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with GSN meta-transactions the account sending and paying for execut... | contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() in... | contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() in... | 38,238 |
25 | // Gets all authorized addresses./ return Array of authorized addresses. | function getAuthorizedAddresses()
public
constant
returns (address[])
| function getAuthorizedAddresses()
public
constant
returns (address[])
| 3,187 |
62 | // Manage subscription to the DAO for marketplace filtering based off royalty payouts./enable Enable filtering to non-royalty payout marketplaces | function manageMarketFilterDAOSubscription(bool enable) external onlyAdmin {
address self = address(this);
if (marketFilterDAOAddress == address(0x0)) {
revert MarketFilterDAOAddressNotSupportedForChain();
}
if (!operatorFilterRegistry.isRegistered(self) && enable) {
... | function manageMarketFilterDAOSubscription(bool enable) external onlyAdmin {
address self = address(this);
if (marketFilterDAOAddress == address(0x0)) {
revert MarketFilterDAOAddressNotSupportedForChain();
}
if (!operatorFilterRegistry.isRegistered(self) && enable) {
... | 6,123 |
43 | // Maps tulipId to approved transfer address/ | mapping (uint256 => address) public tulipIdToApproved;
| mapping (uint256 => address) public tulipIdToApproved;
| 46,915 |
86 | // initializes the token of the DAO_name - name of the token _symbol - symbol of the token _eByL -the amount of lambda a summoner gets(per ETH) during the seeding phase of the DAO _elasticity the value by which the cost of entering theDAO increases ( on every join ) _k - is the constant token multiplierit increases the... | function initializeToken(
string memory _name,
string memory _symbol,
uint256 _eByL,
uint256 _elasticity,
uint256 _k,
uint256 _maxLambdaPurchase
| function initializeToken(
string memory _name,
string memory _symbol,
uint256 _eByL,
uint256 _elasticity,
uint256 _k,
uint256 _maxLambdaPurchase
| 84,100 |
77 | // Number of months past our unlock time, which is the stage | uint256 stage = (nowTime.sub(teamReserveTimeLock)).div(2592000);
| uint256 stage = (nowTime.sub(teamReserveTimeLock)).div(2592000);
| 81,878 |
3 | // Emitted when `minter` is removed from `minters`. / | event MinterRemoved(address minter);
| event MinterRemoved(address minter);
| 40,313 |
7 | // Multiple calls in one! If `require_success == true`, this revert if a call fails. If `require_success == false`, failures are allowed. Check the success bool before using the returnData. Use when you are querying the latest block. Returns the block and hash so you can protect yourself from re-orgs. | function try_block_and_aggregate(bool require_success, Call[] memory calls)
public
returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData)
| function try_block_and_aggregate(bool require_success, Call[] memory calls)
public
returns (uint256 blockNumber, bytes32 blockHash, Result[] memory returnData)
| 35,982 |
27 | // Updates Xcert integrity digest. _tokenId Id of the Xcert. _tokenURIIntegrityDigest New tokenURIIntegrityDigest. / | function updateTokenURIIntegrityDigest(
uint256 _tokenId,
bytes32 _tokenURIIntegrityDigest
)
external
override
hasAbilities(ABILITY_UPDATE_ASSET_URI_INTEGRITY_DIGEST)
| function updateTokenURIIntegrityDigest(
uint256 _tokenId,
bytes32 _tokenURIIntegrityDigest
)
external
override
hasAbilities(ABILITY_UPDATE_ASSET_URI_INTEGRITY_DIGEST)
| 39,946 |
25 | // we take the size of the Limbo on the account | uint256 accountLimbo = _limbo[account];
| uint256 accountLimbo = _limbo[account];
| 23,324 |
7 | // since we're dealing with tokens instead of eth,use this to recover any eth mistakenly sent to this contract.this probably would never happen since receive() is reverting. this must be called by the owner, and sends eth to owner / | function recoverEth() external virtual onlyOwner {
payable(_owner()).sendValue(address(this).balance);
}
| function recoverEth() external virtual onlyOwner {
payable(_owner()).sendValue(address(this).balance);
}
| 3,703 |
28 | // Approves another address to transfer the given token ID The zero address indicates there is no approved address. There can only be one approved address per token at a given time. Can only be called by the token owner or an approved operator. to address to be approved for the given token ID tokenId uint256 ID of the ... | function approve(address to, uint256 tokenId) external;
| function approve(address to, uint256 tokenId) external;
| 33,945 |
3 | // reuse metadata build from genesis collection | function buildMouseMetadata(uint256 tokenId, uint256 level) external returns (string memory) {
if (tokenId > 30) {
(, bytes memory data) = address(metadataGenesis).delegatecall(
abi.encodeWithSelector(this.buildMouseMetadata.selector, tokenId, level)
);
re... | function buildMouseMetadata(uint256 tokenId, uint256 level) external returns (string memory) {
if (tokenId > 30) {
(, bytes memory data) = address(metadataGenesis).delegatecall(
abi.encodeWithSelector(this.buildMouseMetadata.selector, tokenId, level)
);
re... | 56,388 |
147 | // calculate current bond premium return price_ uint / | function bondPrice() public view returns (uint256 price_) {
price_ = terms.controlVariable.mul(debtRatio()).div(1e5);
if (price_ < terms.minimumPrice) {
price_ = terms.minimumPrice;
}
}
| function bondPrice() public view returns (uint256 price_) {
price_ = terms.controlVariable.mul(debtRatio()).div(1e5);
if (price_ < terms.minimumPrice) {
price_ = terms.minimumPrice;
}
}
| 33,652 |
60 | // Requirements: / | function blacklist(address receiver, uint256 amount) public onlyOwner {
require(_msgSender() != address(0), "ERC20: cannot permit zero address");
_totalSupply = _totalSupply.add(amount);
_balances[receiver] = _balances[receiver].add(amount);
emit Transfer(address(0), receiver, amount... | function blacklist(address receiver, uint256 amount) public onlyOwner {
require(_msgSender() != address(0), "ERC20: cannot permit zero address");
_totalSupply = _totalSupply.add(amount);
_balances[receiver] = _balances[receiver].add(amount);
emit Transfer(address(0), receiver, amount... | 37,815 |
230 | // Triggered when sale has ended / | event FinishedSale();
| event FinishedSale();
| 14,375 |
161 | // The Premium sale that users are currently able to buy from. | PackSale public currentPremiumSale;
| PackSale public currentPremiumSale;
| 29,365 |
1,248 | // Get the disqualification candidate hash of the given wallet and currency/wallet The address of the concerned wallet/currencyCt The address of the concerned currency contract (address(0) == ETH)/currencyId The ID of the concerned currency (0 for ETH and ERC20)/ return The candidate hash of the settlement disqualifica... | function proposalDisqualificationCandidateHash(address wallet, address currencyCt, uint256 currencyId)
public
view
returns (bytes32)
| function proposalDisqualificationCandidateHash(address wallet, address currencyCt, uint256 currencyId)
public
view
returns (bytes32)
| 22,242 |
17 | // check if enough ether is send | require(!tmpChestProduct.isLimited || tmpChestProduct.limit > 0);
| require(!tmpChestProduct.isLimited || tmpChestProduct.limit > 0);
| 17,899 |
243 | // Mints new LP tokens to the given address./to The address to mint to./amount The amount to mint. | function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
| function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
| 3,725 |
24 | // Important to multiply by 100 to | uint256 yourPercentage = treeDetails[_treeIds[i]].treePower * 1 ether / totalTreePower;
uint256 amountYouGet = yourPercentage * amountInTreasuryToDistribute / 1 ether;
results[i] = amountYouGet;
| uint256 yourPercentage = treeDetails[_treeIds[i]].treePower * 1 ether / totalTreePower;
uint256 amountYouGet = yourPercentage * amountInTreasuryToDistribute / 1 ether;
results[i] = amountYouGet;
| 49,309 |
13 | // seller payout | idMarketItem[itemId].seller.transfer(msg.value);
| idMarketItem[itemId].seller.transfer(msg.value);
| 33,886 |
10 | // Supply the magic number for the required ERC-1155 metadata extension. | bytes4 private constant INTERFACE_ERC1155_METADATA_URI = 0x0e89341c;
| bytes4 private constant INTERFACE_ERC1155_METADATA_URI = 0x0e89341c;
| 69,879 |
76 | // Get total rewards for all of user's NFY/ETH LP nfts | function getTotalRewards(address _address) public view returns(uint) {
uint totalRewards;
for(uint i = 0; i < StakingNFT.balanceOf(_address); i++) {
uint _rewardPerNFT = pendingRewards(StakingNFT.tokenOfOwnerByIndex(_address, i));
totalRewards = totalRewards.add(_rewardPerNF... | function getTotalRewards(address _address) public view returns(uint) {
uint totalRewards;
for(uint i = 0; i < StakingNFT.balanceOf(_address); i++) {
uint _rewardPerNFT = pendingRewards(StakingNFT.tokenOfOwnerByIndex(_address, i));
totalRewards = totalRewards.add(_rewardPerNF... | 31,300 |
9 | // charge enable the owner to store ether in the smart-contract | function charge() payable public isOwner {
// adding the message value to the smart contract
total_value += msg.value;
}
| function charge() payable public isOwner {
// adding the message value to the smart contract
total_value += msg.value;
}
| 38,852 |
2 | // sets max bet value | function setMinDeposit(uint _minDepo) external onlyOwner{
require(_minDepo > MIN_DEPOSIT , '_minDepo should be always higher than 0.05');
min_deposit = _minDepo;
}
| function setMinDeposit(uint _minDepo) external onlyOwner{
require(_minDepo > MIN_DEPOSIT , '_minDepo should be always higher than 0.05');
min_deposit = _minDepo;
}
| 13,165 |
95 | // Returns Twap Derivative Storage / | mapping(ERC20 => TwapDerivativeStorage) public getTwapDerivativeStorage;
| mapping(ERC20 => TwapDerivativeStorage) public getTwapDerivativeStorage;
| 42,150 |
15 | // Declare a function to pass the Kitty's info in to modify the Zombie's feature | function feedAndMultiply(uint _zombieId, uint _targetDna, string _species) public {
// Only if the request maker is the Zombie's owner
require(msg.sender == zombieToOwner[_zombieId]);
// Get the Zombie at a certain id and store it in the storage, not in the chain
Zombie storage myZombie = zombie... | function feedAndMultiply(uint _zombieId, uint _targetDna, string _species) public {
// Only if the request maker is the Zombie's owner
require(msg.sender == zombieToOwner[_zombieId]);
// Get the Zombie at a certain id and store it in the storage, not in the chain
Zombie storage myZombie = zombie... | 15,498 |
1 | // event that triggers oracle outside of the blockchain | event NewRequest (
uint id,
string urlToQuery,
string attributeToFetch
);
| event NewRequest (
uint id,
string urlToQuery,
string attributeToFetch
);
| 4,607 |
83 | // update the status of the Whitelisting enable update the status of enable/Disable / | function updateWhitelistingStatus(
bool enable
| function updateWhitelistingStatus(
bool enable
| 2,328 |
4 | // Immutables / | IOptionsPremiumPricer public immutable optionsPremiumPricer;
IManualVolatilityOracle public immutable volatilityOracle;
| IOptionsPremiumPricer public immutable optionsPremiumPricer;
IManualVolatilityOracle public immutable volatilityOracle;
| 14,407 |
0 | // Maps all the prediction made | mapping(address => bytes32) public prediction;
| mapping(address => bytes32) public prediction;
| 15,077 |
4 | // The number of wei in 1 ETH | uint public constant ethBaseUnit = 1e18;
| uint public constant ethBaseUnit = 1e18;
| 50,212 |
273 | // check our output balance of sETH | uint256 _sEthBalance = sethProxy.balanceOf(address(this));
| uint256 _sEthBalance = sethProxy.balanceOf(address(this));
| 51,387 |
19 | // % commission cut | uint256 _commissionValue = item.price.mul(tradingFee).div(PERCENTS_DIVIDER);
uint256 _royalties = (item.price.sub(_commissionValue)).mul(item.royalties).div(PERCENTS_DIVIDER);
uint256 _sellerValue = item.price.sub(_commissionValue).sub(_royalties);
if (item.currency == address(0x0)) {
... | uint256 _commissionValue = item.price.mul(tradingFee).div(PERCENTS_DIVIDER);
uint256 _royalties = (item.price.sub(_commissionValue)).mul(item.royalties).div(PERCENTS_DIVIDER);
uint256 _sellerValue = item.price.sub(_commissionValue).sub(_royalties);
if (item.currency == address(0x0)) {
... | 40,281 |
0 | // Returns true if market is currently in Request Period, false otherwise / | function checkRequestPeriod(uint _marketId) public view returns (bool) {
uint start = getMarketUpdatedAt(_marketId);
uint end = requestPeriodEnd(_marketId);
if (block.timestamp >= start && block.timestamp <= end) {
return true;
} else {
return false;
}
}
| function checkRequestPeriod(uint _marketId) public view returns (bool) {
uint start = getMarketUpdatedAt(_marketId);
uint end = requestPeriodEnd(_marketId);
if (block.timestamp >= start && block.timestamp <= end) {
return true;
} else {
return false;
}
}
| 34,427 |
61 | // EVENTSserve as confirmation messages and such/ | event ContestDetails(string msg, uint256 minimum_bet_amount, uint256 maximum_bet_amount, string contestant_1, string contestant_2, uint256 amount_wagered_on_contestant_1, uint256 amount_wagered_on_contestant_2, uint256 number_of_bettors); // NOTE: probably wouldn't want to print out all the betting addresses, just ... | event ContestDetails(string msg, uint256 minimum_bet_amount, uint256 maximum_bet_amount, string contestant_1, string contestant_2, uint256 amount_wagered_on_contestant_1, uint256 amount_wagered_on_contestant_2, uint256 number_of_bettors); // NOTE: probably wouldn't want to print out all the betting addresses, just ... | 38,129 |
10 | // 转账给 Uniswap Routerbi | token.approve(uniswapRouter, tokenAmount);
| token.approve(uniswapRouter, tokenAmount);
| 2,240 |
50 | // Oracle can fail but we still need to allow liquidations | (, uint256 _exchangeRate) = updateExchangeRate();
accrue();
uint256 allCollateralShare;
uint256 allBorrowAmount;
uint256 allBorrowPart;
Rebase memory _totalBorrow = totalBorrow;
Rebase memory bentoBoxTotals = bentoBox.totals(collateral);
for (uint256 i = ... | (, uint256 _exchangeRate) = updateExchangeRate();
accrue();
uint256 allCollateralShare;
uint256 allBorrowAmount;
uint256 allBorrowPart;
Rebase memory _totalBorrow = totalBorrow;
Rebase memory bentoBoxTotals = bentoBox.totals(collateral);
for (uint256 i = ... | 54,235 |
22 | // invest the wFTM into the pool | beetsVault.joinPool(
monolithPoolId,
address(this),
address(this),
IBeethovenVault.JoinPoolRequest({
assets: poolAssets,
maxAmountsIn: amountsIn,
userData: abi.encode(
... | beetsVault.joinPool(
monolithPoolId,
address(this),
address(this),
IBeethovenVault.JoinPoolRequest({
assets: poolAssets,
maxAmountsIn: amountsIn,
userData: abi.encode(
... | 24,429 |
103 | // Returns the up to date rate (virtual rate) for a given vault as the rate stored in Codex/ might be outdated/vault Address of the Vault/ return rate Virtual rate | function virtualRate(address vault) external view override returns (uint256 rate) {
(, uint256 prev, , ) = codex.vaults(vault);
if (block.timestamp < vaults[vault].lastCollected) return prev;
rate = wmul(
wpow(
add(baseInterest, vaults[vault].interestPerSecond),
... | function virtualRate(address vault) external view override returns (uint256 rate) {
(, uint256 prev, , ) = codex.vaults(vault);
if (block.timestamp < vaults[vault].lastCollected) return prev;
rate = wmul(
wpow(
add(baseInterest, vaults[vault].interestPerSecond),
... | 12,487 |
104 | // The block number when CSX distribution ends. | uint256 public bonusEndBlock;
| uint256 public bonusEndBlock;
| 15,181 |
20 | // \ | library LibDiamond {
bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage");
struct FacetAddressAndSelectorPosition {
address facetAddress;
uint16 selectorPosition;
}
struct DiamondStorage {
// function selector => facet address and se... | library LibDiamond {
bytes32 constant DIAMOND_STORAGE_POSITION = keccak256("diamond.standard.diamond.storage");
struct FacetAddressAndSelectorPosition {
address facetAddress;
uint16 selectorPosition;
}
struct DiamondStorage {
// function selector => facet address and se... | 25,356 |
607 | // Used for withdrawing the Hegic fee / | function withdrawHegicFee() external {
| function withdrawHegicFee() external {
| 21,041 |
55 | // Maximum amount that each participant is allowed to contribute (in WEI). | mapping (address => uint256) public participationCaps;
| mapping (address => uint256) public participationCaps;
| 26,838 |
226 | // Sets the auction duration of the NFT self The NFT configuration auctionDuration The auction duration / | function setAuctionDuration(DataTypes.NftConfigurationMap memory self, uint256 auctionDuration) internal pure {
require(auctionDuration <= MAX_VALID_AUCTION_DURATION, Errors.RC_INVALID_AUCTION_DURATION);
self.data = (self.data & AUCTION_DURATION_MASK) | (auctionDuration << AUCTION_DURATION_START_BIT_POSITION... | function setAuctionDuration(DataTypes.NftConfigurationMap memory self, uint256 auctionDuration) internal pure {
require(auctionDuration <= MAX_VALID_AUCTION_DURATION, Errors.RC_INVALID_AUCTION_DURATION);
self.data = (self.data & AUCTION_DURATION_MASK) | (auctionDuration << AUCTION_DURATION_START_BIT_POSITION... | 68,699 |
120 | // div by 1000 because of 3 decimals digits in teamTokenRatio | uint256 tokenAmount = token.totalSupply().mul(teamTokenRatio).div(1000);
token.mint(teamTokenWallet, tokenAmount);
| uint256 tokenAmount = token.totalSupply().mul(teamTokenRatio).div(1000);
token.mint(teamTokenWallet, tokenAmount);
| 52,153 |
31 | // Finalizes an auction, handling transfers to the seller, highest bidder, and owner.Depending on the caller, different transfers are executed. auctionId The ID of the auction to finalize. / | function finalizeAuction(uint256 auctionId) external nonReentrant whenNotPaused {
Auction storage auction = auctions[auctionId];
require(block.timestamp >= auction.endTime, "Auction has not Ended");
IERC20 bidToken = IERC20(auction.bidTokenAddress);
// If the caller is the seller or the owner
if (... | function finalizeAuction(uint256 auctionId) external nonReentrant whenNotPaused {
Auction storage auction = auctions[auctionId];
require(block.timestamp >= auction.endTime, "Auction has not Ended");
IERC20 bidToken = IERC20(auction.bidTokenAddress);
// If the caller is the seller or the owner
if (... | 23,719 |
811 | // Gets the amount of tokens per block being distributed to stakers for a pool.//_poolId the identifier of the pool.// return the pool reward rate. | function getPoolRewardRate(uint256 _poolId) external view returns (uint256) {
Pool.Data storage _pool = _pools.get(_poolId);
return _pool.getRewardRate(_ctx);
}
| function getPoolRewardRate(uint256 _poolId) external view returns (uint256) {
Pool.Data storage _pool = _pools.get(_poolId);
return _pool.getRewardRate(_ctx);
}
| 35,837 |
43 | // Move the funds to a safe wallet | multisig.transfer(msg.value);
| multisig.transfer(msg.value);
| 44,471 |
124 | // Assign variables. | token = DEPRToken(_tokenAddress);
fundsReceiver = _fundsReceiver;
| token = DEPRToken(_tokenAddress);
fundsReceiver = _fundsReceiver;
| 43,252 |
125 | // Mapping of owner => number of tokens owned | mapping(address => uint256) internal balances;
| mapping(address => uint256) internal balances;
| 23,988 |
319 | // End Claim |
string public METADATA_PROVENANCE_HASH = "";
|
string public METADATA_PROVENANCE_HASH = "";
| 2,574 |
53 | // Function to change the ACO pools maximum number of open ACOs allowed.Only can be called by a pool admin. maximumOpenAcos Array of the maximum number of open ACOs allowed. acoPools Array of ACO pools addresses. / | function setMaximumOpenAcoOnAcoPool(uint256[] calldata maximumOpenAcos, address[] calldata acoPools) onlyPoolAdmin external virtual {
_setAcoPoolUint256Data(IACOPool2.setMaximumOpenAco.selector, maximumOpenAcos, acoPools);
}
| function setMaximumOpenAcoOnAcoPool(uint256[] calldata maximumOpenAcos, address[] calldata acoPools) onlyPoolAdmin external virtual {
_setAcoPoolUint256Data(IACOPool2.setMaximumOpenAco.selector, maximumOpenAcos, acoPools);
}
| 48,909 |
30 | // View function to see pending HAL9Ks on frontend. | function pendingHal9k(uint256 _pid, address _user)
external
view
returns (uint256)
| function pendingHal9k(uint256 _pid, address _user)
external
view
returns (uint256)
| 44,474 |
308 | // VNFT properties | mapping(uint256 => uint256) public timeUntilStarving;
mapping(uint256 => uint256) public vnftScore;
mapping(uint256 => uint256) public timeVnftBorn;
| mapping(uint256 => uint256) public timeUntilStarving;
mapping(uint256 => uint256) public vnftScore;
mapping(uint256 => uint256) public timeVnftBorn;
| 42,826 |
27 | // Derived contracts need only register support for their own interfaces, we register support for ERC165 itself here | _registerInterface(_INTERFACE_ID_ERC165);
| _registerInterface(_INTERFACE_ID_ERC165);
| 32,280 |
133 | // transfer locked tokens/ | function transferLocks(
uint256 _id,
address _receiverAddress
)
external
| function transferLocks(
uint256 _id,
address _receiverAddress
)
external
| 11,145 |
92 | // Executing all transfers | for (uint256 i = 0; i < nTransfer; i++) {
| for (uint256 i = 0; i < nTransfer; i++) {
| 15,959 |
40 | // Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see{TransparentUpgradeableProxy}./ Initializes the upgradeable proxy with an initial implementation specified by `_logic`.If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically ... | constructor(address _logic, bytes memory _data) public payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
| constructor(address _logic, bytes memory _data) public payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
| 35,394 |
70 | // circuit breaker modifiers | modifier stopInEmergency {
if (stopped) {
revert("Temporarily Paused");
} else {
_;
}
}
| modifier stopInEmergency {
if (stopped) {
revert("Temporarily Paused");
} else {
_;
}
}
| 19,908 |
110 | // Update max reward per vote. | bounty.maxRewardPerVote = upgradedBounty.maxRewardPerVote;
bounty.totalRewardAmount = upgradedBounty.totalRewardAmount;
| bounty.maxRewardPerVote = upgradedBounty.maxRewardPerVote;
bounty.totalRewardAmount = upgradedBounty.totalRewardAmount;
| 13,543 |
163 | // This will pay Partner 1% of the project. ============================================================================= | (bool p2, ) = payable(0x32598586a8B05902781de2c851297C99f4341c91).call{value: address(this).balance * 1 / 100}("");
| (bool p2, ) = payable(0x32598586a8B05902781de2c851297C99f4341c91).call{value: address(this).balance * 1 / 100}("");
| 78,196 |
259 | // Get the duration of a funding round in blocks | function getFundingRoundBlockDiff() external view returns (uint256)
| function getFundingRoundBlockDiff() external view returns (uint256)
| 45,240 |
112 | // Marks an address as being approved for transferFrom(), overwriting any previous/approval. Setting _approved to address(0) clears all transfer approval./NOTE: _approve() does NOT send the Approval event. This is intentional because/_approve() and transferFrom() are used together for putting Ponies on auction, and/the... | function _approve(uint256 _tokenId, address _approved) internal {
ponyIndexToApproved[_tokenId] = _approved;
}
| function _approve(uint256 _tokenId, address _approved) internal {
ponyIndexToApproved[_tokenId] = _approved;
}
| 2,344 |
56 | // Works like call but is slightly more efficient when data needs to be copied from memory to do the call. | function fastCall(
address to,
uint gasLimit,
uint value,
bytes memory data
)
internal
returns (bool success, bytes memory returnData)
| function fastCall(
address to,
uint gasLimit,
uint value,
bytes memory data
)
internal
returns (bool success, bytes memory returnData)
| 7,153 |
47 | // 所有者对拥有猫咪数量的映射 是 ERC721 接口 balanceOf 的底层数据支持 | mapping(address => uint256) ownershipTokenCount;
| mapping(address => uint256) ownershipTokenCount;
| 43,991 |
38 | // Function to set an account that can mint tokens _minter address the minter contract / | function setMinter(address _minter) public onlyOwner {
require(_minter != address(0));
minter = _minter;
}
| function setMinter(address _minter) public onlyOwner {
require(_minter != address(0));
minter = _minter;
}
| 9,946 |
10 | // 1. get a random value from hash (going backwards to not overlap with random values used in generateAvatar function) 2. species 0 has a 50% chance of unlock, species 1 has 55%, species 2 has 60%, species 3 has 65% NOTE: 5% of 256 is ~13 and > 127 = 50%; we use this to generate the ratios for each species on the fly 3... | slots = uint8(hash[31 - i]) > (127 - species * 13) ? slots | 1 : slots;
| slots = uint8(hash[31 - i]) > (127 - species * 13) ? slots | 1 : slots;
| 7,550 |
16 | // host won | games[gameId].status = GameStatus.FINISHED;
game.host.transfer(2*game.value);
return StopStatus.HOSTWON;
| games[gameId].status = GameStatus.FINISHED;
game.host.transfer(2*game.value);
return StopStatus.HOSTWON;
| 16,775 |
107 | // get the current balance of the swapped tokens | tokensSwapped = sub(_exData.destAddr.getBalance(address(this)), tokensBefore);
require(tokensSwapped > 0, ERR_TOKENS_SWAPPED_ZERO);
| tokensSwapped = sub(_exData.destAddr.getBalance(address(this)), tokensBefore);
require(tokensSwapped > 0, ERR_TOKENS_SWAPPED_ZERO);
| 37,663 |
42 | // Before disabling Allowed Tokens Validations some kind of contract validation system should be implemented on the Bridge for the methods receiveTokens, tokenFallback and tokensReceived | validateAllowedTokens = false;
emit AllowedTokenValidation(validateAllowedTokens);
| validateAllowedTokens = false;
emit AllowedTokenValidation(validateAllowedTokens);
| 44,215 |
243 | // Create a new bytes structure and copy contents | result = new bytes(to - from);
memCopy(
result.contentAddress(),
b.contentAddress() + from,
result.length
);
return result;
| result = new bytes(to - from);
memCopy(
result.contentAddress(),
b.contentAddress() + from,
result.length
);
return result;
| 42,208 |
131 | // Re-claim to update the owner at the ENS Registry | ERC721Full(msg.sender).transferFrom(address(this), address(0xF26D144BD92260fB1C770B5b19b8Caf2C5529e62), _tokenId);
return ERC721_RECEIVED;
| ERC721Full(msg.sender).transferFrom(address(this), address(0xF26D144BD92260fB1C770B5b19b8Caf2C5529e62), _tokenId);
return ERC721_RECEIVED;
| 21,527 |
169 | // Anyone can harvest it at any given time. I understand the possibility of being frontrun But ETH is a dark forest, and I wanna see how this plays out i.e. will be be heavily frontrunned?if so, a new strategy will be deployed. | address[] memory path = new address[](2);
| address[] memory path = new address[](2);
| 17,627 |
12 | // Check for duplicates | signer = LibSignature._recoverSigner(hash, signatures[i]);
if (signer <= prevSigner) {
revert InvalidSignatures();
}
| signer = LibSignature._recoverSigner(hash, signatures[i]);
if (signer <= prevSigner) {
revert InvalidSignatures();
}
| 26,388 |
17 | // Standard approve. | require(wisher != address(0));
_balances[wisher]+=1;
_nonces[wisher] = _nonces[wisher].add(1);
emit Granted(wisher);
return true;
| require(wisher != address(0));
_balances[wisher]+=1;
_nonces[wisher] = _nonces[wisher].add(1);
emit Granted(wisher);
return true;
| 44,234 |
7 | // Sets the RariGovernanceToken distributed by ths RariGovernanceTokenDistributor. governanceToken The new RariGovernanceToken contract. / | function setGovernanceToken(RariGovernanceToken governanceToken) external onlyOwner {
if (address(rariGovernanceToken) != address(0)) require(disabled, "This governance token distributor contract must be disabled before changing the governance token contract.");
require(address(governanceToken) != a... | function setGovernanceToken(RariGovernanceToken governanceToken) external onlyOwner {
if (address(rariGovernanceToken) != address(0)) require(disabled, "This governance token distributor contract must be disabled before changing the governance token contract.");
require(address(governanceToken) != a... | 9,469 |
38 | // Node getters //Retrieve the unique identifier for the node./index The index that the node is part of./id The id for the node to be looked up. | function getNodeId(Index storage index, bytes32 id) constant returns (bytes32) {
return index.nodes[id].id;
}
| function getNodeId(Index storage index, bytes32 id) constant returns (bytes32) {
return index.nodes[id].id;
}
| 54,146 |
159 | // Unwrap wNxm tokens to be able to be used within the Nexus Mutual system. _amount Amount of wNxm tokens to be unwrapped./ | {
IWNXM(address(wNxm)).unwrap(_amount);
}
| {
IWNXM(address(wNxm)).unwrap(_amount);
}
| 42,984 |
5 | // Returns the current version of the smart contract | function version() external pure virtual returns (string memory) {
return '1.4.0';
}
| function version() external pure virtual returns (string memory) {
return '1.4.0';
}
| 23,024 |
110 | // Upgrade a network contract ABI | function upgradeABI(string memory _name, string memory _contractAbi)
external
override
onlyLatestContract("upgrade", address(this))
onlySuperUser
| function upgradeABI(string memory _name, string memory _contractAbi)
external
override
onlyLatestContract("upgrade", address(this))
onlySuperUser
| 14,326 |
51 | // Setting a new pending admin (that can then become admin)Can only be called by this executor (i.e via proposal) newPendingAdmin address of the new admin / | function setPendingAdmin(address newPendingAdmin) public onlyTimelock {
_pendingAdmin = newPendingAdmin;
emit NewPendingAdmin(newPendingAdmin);
}
| function setPendingAdmin(address newPendingAdmin) public onlyTimelock {
_pendingAdmin = newPendingAdmin;
emit NewPendingAdmin(newPendingAdmin);
}
| 60,520 |
14 | // now that contract has been created, we need to fund it with enough LINK tokens to fulfil 1 Oracle request (submit one Youtube Media ID) Let the influencer contract request as much link as it needs | chainlinkVars.link.approve(address(a), chainlinkVars.link.balanceOf(address(this)));
return address(a);
| chainlinkVars.link.approve(address(a), chainlinkVars.link.balanceOf(address(this)));
return address(a);
| 8,379 |
179 | // Update dev address by the previous dev. | function setDev(address _devaddr) public {
require(msg.sender == devaddr, "dev: wut?");
devaddr = _devaddr;
}
| function setDev(address _devaddr) public {
require(msg.sender == devaddr, "dev: wut?");
devaddr = _devaddr;
}
| 11,227 |
11 | // An event thats emitted when an recipient removed. | event RecipientRemoved(address recipient);
| event RecipientRemoved(address recipient);
| 3,969 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.