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
381
// TODO: emit event
emit ExecuteSwap(msg.sender, _tokenFrom, _tokenTo, _amount, amountReceived);
emit ExecuteSwap(msg.sender, _tokenFrom, _tokenTo, _amount, amountReceived);
14,580
147
// Where fees are pooled in pUSD
address public constant FEE_ADDRESS = 0xc8d3A942a82290612DD8167Bd9ce2d3054BAf8B7;
address public constant FEE_ADDRESS = 0xc8d3A942a82290612DD8167Bd9ce2d3054BAf8B7;
13,064
364
// Sets the prize strategy of the prize pool.Only callable by the owner./_prizeStrategy The new prize strategy.Must implement TokenListenerInterface
function setPrizeStrategy(TokenListenerInterface _prizeStrategy) external;
function setPrizeStrategy(TokenListenerInterface _prizeStrategy) external;
7,105
8
// to eliminate problem of `same random numbers` lets addsome offset on each number generation
uint8 startOffset = uint8((generationNumber++) % 10); if (randomBlockStart[lotteryId] == 0) {
uint8 startOffset = uint8((generationNumber++) % 10); if (randomBlockStart[lotteryId] == 0) {
8,122
78
// 1 : 2
v1.postAndUpvote(); lottery.downvote(1); v2.upvote(1); v3.upvote(1);
v1.postAndUpvote(); lottery.downvote(1); v2.upvote(1); v3.upvote(1);
31,399
274
// If additional reward to existing period, calc sum
else { uint256 remaining = periodFinish - currentTime; uint256 leftoverReward = remaining * rewardRate; rewardRate = (_reward + leftoverReward) / DURATION; uint256 leftoverPlatformReward = remaining * platformRewardRate; platformRewardRate = (newPlat...
else { uint256 remaining = periodFinish - currentTime; uint256 leftoverReward = remaining * rewardRate; rewardRate = (_reward + leftoverReward) / DURATION; uint256 leftoverPlatformReward = remaining * platformRewardRate; platformRewardRate = (newPlat...
46,734
37
// Called by the factory contract, and pays out to a _party _party being paid _swap address/
function pay(TokenStorage storage self,address _party, address _swap) public{ require(msg.sender == self.factory_contract); uint party_balance_index = self.swap_balances_index[_swap][_party]; require(party_balance_index > 0); uint party_swap_balance = self.swap_balances[_swap][party_...
function pay(TokenStorage storage self,address _party, address _swap) public{ require(msg.sender == self.factory_contract); uint party_balance_index = self.swap_balances_index[_swap][_party]; require(party_balance_index > 0); uint party_swap_balance = self.swap_balances[_swap][party_...
14,136
179
// onlyOwner
function setBlocksPerYear(uint256 _blocksPerYear) external onlyOwner { blocksPerYear = _blocksPerYear; }
function setBlocksPerYear(uint256 _blocksPerYear) external onlyOwner { blocksPerYear = _blocksPerYear; }
11,099
4
// ---------------------- /Owner ----------------------
32,419
88
// Using `etherAmountFromReserves`, trade for Dai using UniswapV2,and use that Dai to mint Dharma Dai.Only the owner or the trade reserve role can call this function. etherAmountFromReserves the amount of Ether to take from reservesand add to the provided amount. quotedDaiAmount uint256 The amount of Dai requested in t...
function tradeEtherForDaiUsingReservesAndMintDDaiV2( uint256 etherAmountFromReserves, uint256 quotedDaiAmount, uint256 deadline ) external onlyOwnerOr(Role.RESERVE_TRADER) returns ( uint256 totalDaiBought, uint256 totalDDaiMinted
function tradeEtherForDaiUsingReservesAndMintDDaiV2( uint256 etherAmountFromReserves, uint256 quotedDaiAmount, uint256 deadline ) external onlyOwnerOr(Role.RESERVE_TRADER) returns ( uint256 totalDaiBought, uint256 totalDDaiMinted
19,377
75
// We must normalize the inputs to 18 point
_normalizeSortedArray(currentBalances); _normalizeSortedArray(maxAmountsIn);
_normalizeSortedArray(currentBalances); _normalizeSortedArray(maxAmountsIn);
60,228
29
// Generic purchase function for GNXNative General purchase function where GNXTokens are sold in exchangefor GNXNative. Requires stating a minimum expected return to prevent price spoofing.This function is akin to tokenSwawp. This is the base function for switching from GNXTokens to GNXNative.minNative Minimum expected...
function buyNative(uint256 minNative, uint256 tokensSold) public override(IGNXPool) returns (uint256) { require(token.balanceOf(msg.sender) >= tokensSold, "GNX: not enough GNXTokens"); uint256 _tokenReserve = tokenReserve(); uint256 _nativeReserve = nativeReserve(); uint256...
function buyNative(uint256 minNative, uint256 tokensSold) public override(IGNXPool) returns (uint256) { require(token.balanceOf(msg.sender) >= tokensSold, "GNX: not enough GNXTokens"); uint256 _tokenReserve = tokenReserve(); uint256 _nativeReserve = nativeReserve(); uint256...
7,482
35
// Returns the number of NFTs owned by `_owner`. NFTs assigned to the zero address areconsidered invalid, and this function throws for queries about the zero address. _owner Address for whom to query the balance.return Balance of _owner. /
function balanceOf(address _owner) external view returns (uint256) { require(_owner != address(0)); return _getOwnerNFTCount(_owner); }
function balanceOf(address _owner) external view returns (uint256) { require(_owner != address(0)); return _getOwnerNFTCount(_owner); }
50,598
0
// Members /
address predictionFactoryImplRelay; constructor(address _predictionFactoryImplRelay) public Ownable(msg.sender)
address predictionFactoryImplRelay; constructor(address _predictionFactoryImplRelay) public Ownable(msg.sender)
27,025
36
// allows a minter to 'unburn' an amount back to a user amount of Zarp to empty from burnBalance account - address to send the amount to sigs - optional list of signatures if mintNumSigsRequired>0 /
function unBurn(uint256 amount, address account, bytes calldata sigs) public { bytes32 m = keccak256(abi.encodePacked(amount,account)); require(burnBalances[account]>=amount); require(_validate(sigs,m,true,false)); burnBalances[account] = burnBalances[account].sub(amount); ba...
function unBurn(uint256 amount, address account, bytes calldata sigs) public { bytes32 m = keccak256(abi.encodePacked(amount,account)); require(burnBalances[account]>=amount); require(_validate(sigs,m,true,false)); burnBalances[account] = burnBalances[account].sub(amount); ba...
42,156
5
// Event triggered when tokens are transferred.
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
45,006
4
// Adds two numbers, throws on overflow./
function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; }
function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; }
4,196
123
// Automatic swap and liquify enabled
bool private swapAndLiquifyEnabled = false;
bool private swapAndLiquifyEnabled = false;
24,243
194
// request exchange RC20 token with WRC20 on wanchain/ uniqueIDfast cross chain random number/ smgID ID of storeman/ tokenPairID token pair ID of cross chain token/ value exchange value/ userAccount address of user, used to receive original token/coin/ r signature/ s signature
function smgRelease(bytes32 uniqueID, bytes32 smgID, uint tokenPairID, uint value, address tokenAccount, address userAccount, bytes r, bytes32 s) external notHalted
function smgRelease(bytes32 uniqueID, bytes32 smgID, uint tokenPairID, uint value, address tokenAccount, address userAccount, bytes r, bytes32 s) external notHalted
36,192
25
// return The market associated with this Share Token ID /
function getMarket(uint256 _tokenId) external pure returns(address) { (address _market, uint256 _outcome) = TokenId.unpackTokenId(_tokenId); return _market; }
function getMarket(uint256 _tokenId) external pure returns(address) { (address _market, uint256 _outcome) = TokenId.unpackTokenId(_tokenId); return _market; }
16,295
10
// Define minting rules
bool public _mintActive = true; uint256 private _price = 0.05 ether;
bool public _mintActive = true; uint256 private _price = 0.05 ether;
15,452
86
// returns anonymous voting duration
function anonymousVotingDuration(uint256 index) external view returns (uint256);
function anonymousVotingDuration(uint256 index) external view returns (uint256);
45,219
179
// Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. Tokens start existing when they are minted (_mint), /
function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < currentIndex; }
function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < currentIndex; }
10,563
34
// escrow management functions share ETH from contract account balance
function _shareETH(address[] memory users, uint256[] memory shares) internal accurateUserSharesRatio(users, shares) hasEnoughBalance(shares, address(this).balance)
function _shareETH(address[] memory users, uint256[] memory shares) internal accurateUserSharesRatio(users, shares) hasEnoughBalance(shares, address(this).balance)
46,711
16
// DEPRECATEDA mapping from NFT ID to the address that owns it. /
mapping(bytes => address) public locIdToOwner;
mapping(bytes => address) public locIdToOwner;
8,040
37
// constructor(string memory name, string memory symbol, uint8 decimals, uint256 totalSupply, address payable feeReceiver, address tokenOwnerAddress) public payable {
constructor() public { _name = "COVID 19"; _symbol = "COV19"; _decimals = 18;
constructor() public { _name = "COVID 19"; _symbol = "COV19"; _decimals = 18;
18,269
244
// Converts a boolean to a bytes32 value. _in Input boolean value.return Boolean as a bytes32. /
function fromBool( bool _in ) internal pure returns ( bytes32 )
function fromBool( bool _in ) internal pure returns ( bytes32 )
63,367
1
// Half percentage factor (50.00%)
uint256 internal constant HALF_PERCENTAGE_FACTOR = 0.5e4;
uint256 internal constant HALF_PERCENTAGE_FACTOR = 0.5e4;
10,660
228
// esimate sell order by amount of tokens/ETH. returns eth/tokens amount after the deal, total fee in ETH and average token price
function estimateSellOrder(uint256 amount, bool fromToken) public view returns(uint256, uint256, uint256) { uint256 minAmount; uint256 maxAmount; (minAmount, maxAmount) = fromToken ? getTokenDealRange() : getEthDealRange(); //require(amount >= minAmount && amount <= maxAmount); uint...
function estimateSellOrder(uint256 amount, bool fromToken) public view returns(uint256, uint256, uint256) { uint256 minAmount; uint256 maxAmount; (minAmount, maxAmount) = fromToken ? getTokenDealRange() : getEthDealRange(); //require(amount >= minAmount && amount <= maxAmount); uint...
41,166
1
// It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`./
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
29,865
544
// Can only escape to a point one size higher than ourselves,except in the special case where the escaping point hasn'tbeen linked yet -- in that case we may escape to points ofthe same size, to support lightweight invitation chains.The use case for lightweight invitations is that a planetowner should be able to invite...
Azimuth.Size pointSize = azimuth.getPointSize(_point); Azimuth.Size sponsorSize = azimuth.getPointSize(_sponsor); return ( // normal hierarchical escape structure
Azimuth.Size pointSize = azimuth.getPointSize(_point); Azimuth.Size sponsorSize = azimuth.getPointSize(_sponsor); return ( // normal hierarchical escape structure
15,055
45
// Method to register a Voter to a Jar /
function registerVoter() public payable { address voterAddress = msg.sender; uint voterDeposit = msg.value; // Check that Voter is not already registerd to Jar if (voterStore[voterAddress].exists == true) { revert(); } // Check that Deposit is above minimum required to Vote in Jar ...
function registerVoter() public payable { address voterAddress = msg.sender; uint voterDeposit = msg.value; // Check that Voter is not already registerd to Jar if (voterStore[voterAddress].exists == true) { revert(); } // Check that Deposit is above minimum required to Vote in Jar ...
16,992
192
// constructor_ownerAddress of the fund manager_name Name of the fund, required for DetailedERC20 compliance_successFee Percentage of profit that the fund manager receives_platformAddressAddress of platform to send fees to_exchangePortalAddressAddress of initial exchange portal_poolPortalAddressAddress of initial pool ...
constructor( address _owner, string memory _name, uint256 _successFee, address _platformAddress, address _exchangePortalAddress, address _poolPortalAddress, address _defiPortal, address _permittedAddresses, bool _isRequireTradeVerification
constructor( address _owner, string memory _name, uint256 _successFee, address _platformAddress, address _exchangePortalAddress, address _poolPortalAddress, address _defiPortal, address _permittedAddresses, bool _isRequireTradeVerification
3,893
48
// Failure event /
event Failure(uint error, uint info, uint detail);
event Failure(uint error, uint info, uint detail);
4,772
40
// Clear approvals from the previous owner
_approve(address(0), tokenId); emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId);
_approve(address(0), tokenId); emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId);
39,880
59
// Get the balance of an asset held in Vault and all strategies. _asset Address of assetreturn uint256 Balance of asset in decimals of asset /
function checkBalance(address _asset) external view returns (uint256) { return _checkBalance(_asset); }
function checkBalance(address _asset) external view returns (uint256) { return _checkBalance(_asset); }
25,020
245
// Returns whether the given account is entered in the given asset account The address of the account to check cToken The cToken to checkreturn True if the account is in the asset, otherwise false. /
function checkMembership(address account, CToken cToken) external view returns (bool) { return markets[address(cToken)].accountMembership[account]; }
function checkMembership(address account, CToken cToken) external view returns (bool) { return markets[address(cToken)].accountMembership[account]; }
23,635
55
// subtract dev fees
uint256 onePc = _grossRevenue/100; uint256 netRevenue = onePc*(100-devFeePercent); uint256 devFee = onePc*(devFeePercent); uint256 districtRevenue = (netRevenue/100)*localRevenuePercent; uint256 federalRevenue = (netRevenue/100)*(100-localRevenuePercent);
uint256 onePc = _grossRevenue/100; uint256 netRevenue = onePc*(100-devFeePercent); uint256 devFee = onePc*(devFeePercent); uint256 districtRevenue = (netRevenue/100)*localRevenuePercent; uint256 federalRevenue = (netRevenue/100)*(100-localRevenuePercent);
61,274
334
// Import issuer data from synthetixState.issuerData on FeePeriodClose() blockOnly callable by the contract owner, and only for 6 weeks after deployment. accounts Array of issuing addresses ratios Array of debt ratios periodToInsert The Fee Period to insert the historical records into feePeriodCloseIndex An accounts de...
function importIssuerData( address[] calldata accounts, uint[] calldata ratios, uint periodToInsert, uint feePeriodCloseIndex
function importIssuerData( address[] calldata accounts, uint[] calldata ratios, uint periodToInsert, uint feePeriodCloseIndex
3,674
2
// LEGACY USE ONLY: Administrator for this contract /
address payable internal __admin;
address payable internal __admin;
18,331
592
// Gets the amount of owedTokens currently needed to close the position completely, includinginterest fees. positionIdUnique ID of the positionreturn The number of owedTokens /
function getPositionOwedAmount( bytes32 positionId ) external view returns (uint256)
function getPositionOwedAmount( bytes32 positionId ) external view returns (uint256)
67,384
73
// Get the node at the beginning of a double linked list.self The list being used. return A address identifying the node at the beginning of the double linked list./
function begin(List storage self) internal view returns (address) { return self.list[NULL].next; }
function begin(List storage self) internal view returns (address) { return self.list[NULL].next; }
53,162
47
// Claim rewards from pool
function _claim(uint256 pid) internal { PoolInfo storage pool = poolInfo[pid]; UserInfo storage user = userInfo[pid][msg.sender]; uint256 pending = user.amount.mul(pool.accCarvePerShare).div(1e12).sub(user.rewardDebt); if (pending > 0) { uint256 fee = pending.mul(rewardPo...
function _claim(uint256 pid) internal { PoolInfo storage pool = poolInfo[pid]; UserInfo storage user = userInfo[pid][msg.sender]; uint256 pending = user.amount.mul(pool.accCarvePerShare).div(1e12).sub(user.rewardDebt); if (pending > 0) { uint256 fee = pending.mul(rewardPo...
15,572
23
// All chain index, for example [1, 2, 3, 4] => 1 << 0 | 1 << 1 | 1 << 2 | 1 << 3 = 15
uint256 internal constant ALL_CHAINS = 15;
uint256 internal constant ALL_CHAINS = 15;
46,276
10
// Function to delete a specific waste disposal report (only for authorized users).
// function deleteReport(uint256 reportId) public { // // Add access control here to ensure only authorized users can delete reports // delete reports[reportId]; // }
// function deleteReport(uint256 reportId) public { // // Add access control here to ensure only authorized users can delete reports // delete reports[reportId]; // }
24,322
159
// Updates the admin role for the address. _account Address to update admin role. _allowed Whether the address is granted the admin role. /
function setAdmin(address _account, bool _allowed) external { require(msg.sender == governance, "not governance"); require(_account != address(0x0), "account not set"); admins[_account] = _allowed; }
function setAdmin(address _account, bool _allowed) external { require(msg.sender == governance, "not governance"); require(_account != address(0x0), "account not set"); admins[_account] = _allowed; }
54,061
6
// Thrown when getFinalizedEpoch function is called before any epoch has been finalized./ return HN:Epochs/not-finalized
string public constant NOT_FINALIZED = "HN:Epochs/not-finalized";
string public constant NOT_FINALIZED = "HN:Epochs/not-finalized";
21,274
44
// Exepected amount of collateral
FixedPoint.Unsigned redeemableCollateral;
FixedPoint.Unsigned redeemableCollateral;
7,845
317
// add to pending reward
collectedAmount += compoundAmount;
collectedAmount += compoundAmount;
61,141
13
// structure contains full state related to long term orders
struct LongTermOrders { ///@notice minimum block interval between order expiries uint256 orderBlockInterval; ///@notice last virtual orders were executed immediately before this block uint256 lastVirtualOrderBlock; ///@notice token pair being traded in embedded amm ad...
struct LongTermOrders { ///@notice minimum block interval between order expiries uint256 orderBlockInterval; ///@notice last virtual orders were executed immediately before this block uint256 lastVirtualOrderBlock; ///@notice token pair being traded in embedded amm ad...
24,953
47
// Check cooldown
require(_isCooldownReady(skinAId, skinBId));
require(_isCooldownReady(skinAId, skinBId));
56,170
28
// Get number of transactions there are for the seller
uint256 _sellersTransactionLength = sellersTransactions[msg.sender].length; require( _sellersTransactionLength > 0, "You have no sales" ); uint128 rewards = 0;
uint256 _sellersTransactionLength = sellersTransactions[msg.sender].length; require( _sellersTransactionLength > 0, "You have no sales" ); uint128 rewards = 0;
2,152
6
// Calculate the tx hash
bytes32 txHash = hashTx(ctx.DOMAIN_SEPARATOR, accountUpdate);
bytes32 txHash = hashTx(ctx.DOMAIN_SEPARATOR, accountUpdate);
27,598
283
// return the block at which the funds will be available
return unlockTimestamp;
return unlockTimestamp;
54,826
173
// support granularity if ERC777
address implementer = _erc1820.getInterfaceImplementer(tokenToUse, TOKENS_ERC777_HASH); if (implementer != address(0)) { granularity = IERC777(implementer).granularity();
address implementer = _erc1820.getInterfaceImplementer(tokenToUse, TOKENS_ERC777_HASH); if (implementer != address(0)) { granularity = IERC777(implementer).granularity();
9,177
13
// boolean to check if the deal has been executed
bool isExecuted;
bool isExecuted;
5,468
1
// EnumerableSet.UintSet claimedKzgIds; EnumerableSet.UintSet gfIdsFromKzg;
address public signer; uint256 public MINT_PRICE; uint256 public MAX_MINT_PER_WL; mapping(address => uint256) public wlMintCount;
address public signer; uint256 public MINT_PRICE; uint256 public MAX_MINT_PER_WL; mapping(address => uint256) public wlMintCount;
29,944
90
// ========== VIEWS ========== // Returns the ERC20 allowance of one party to spend on behalf of another. owner The party authorising spending of their funds. spender The party spending tokenOwner's funds. /
function allowance(address owner, address spender) public view returns (uint)
function allowance(address owner, address spender) public view returns (uint)
26,306
22
// for claiming CRV tokens which accumalates on staking 3CRV.
function claimCRV() public onlyAuthorized(){ minter.mint(address(gauge)); emit crvClaimed(); }
function claimCRV() public onlyAuthorized(){ minter.mint(address(gauge)); emit crvClaimed(); }
40,508
90
// Sending Ether to this contract will cause an exception, because the fallback function does not have the `payable` modifier.
function() external { } }
function() external { } }
26,482
27
// Provide owner context /
abstract contract Ownable { constructor() { _owner = msg.sender; } address payable _owner; function isOwner(address sender) public view returns (bool) { return sender == _owner; } function ownly() internal view { require(isOwner(msg.sender)); } modifier owned()...
abstract contract Ownable { constructor() { _owner = msg.sender; } address payable _owner; function isOwner(address sender) public view returns (bool) { return sender == _owner; } function ownly() internal view { require(isOwner(msg.sender)); } modifier owned()...
23,682
8
// address owner;
address immutable SaitoL2; IInbox public arbitrum; mapping(address => uint256) public poolBalance; address[] public poolUsers; uint256 public poolUsersQty; uint256 public poolTotal; bool public isPoolOpen; uint256 public MIN_USERS; uint256 public MIN_TOTAL;
address immutable SaitoL2; IInbox public arbitrum; mapping(address => uint256) public poolBalance; address[] public poolUsers; uint256 public poolUsersQty; uint256 public poolTotal; bool public isPoolOpen; uint256 public MIN_USERS; uint256 public MIN_TOTAL;
61,801
211
// Check for best price
Uniswap exchange; if ( sushi.amountOutFor(path, balance) > uni.amountOutFor(path, balance) ) { exchange = sushi; } else {
Uniswap exchange; if ( sushi.amountOutFor(path, balance) > uni.amountOutFor(path, balance) ) { exchange = sushi; } else {
54,533
326
// some users might have too many tokens to do that in one transaction
if (userBalance > (maxTokensAtOnce - migrated)) { end = (maxTokensAtOnce - migrated); }
if (userBalance > (maxTokensAtOnce - migrated)) { end = (maxTokensAtOnce - migrated); }
67,511
76
// Now that the balances are updated, call onERC1155BatchReceived if the destination is a contract
if (_to.isContract()) { require(IERC1155TokenReceiver(_to).onERC1155BatchReceived(msg.sender, _from, _ids, _values, _data) == ERC1155_BATCH_RECEIVED); }
if (_to.isContract()) { require(IERC1155TokenReceiver(_to).onERC1155BatchReceived(msg.sender, _from, _ids, _values, _data) == ERC1155_BATCH_RECEIVED); }
34,545
0
// The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore, it is recommended to avoid using short time durations (less than a minute). Typical vesting schem...
using SafeMath for uint256; using SafeERC20 for IERC20; event TokensReleased(address token, uint256 amount); event TokenVestingRevoked(address token);
using SafeMath for uint256; using SafeERC20 for IERC20; event TokensReleased(address token, uint256 amount); event TokenVestingRevoked(address token);
15,020
17
// Starts at 0 votes
suggestions.push(Suggestion(suggestionId, 0, true, msg.sender, expires, votesUsedTime, text)); emit SuggestionCreated(suggestionId, text);
suggestions.push(Suggestion(suggestionId, 0, true, msg.sender, expires, votesUsedTime, text)); emit SuggestionCreated(suggestionId, text);
18,353
96
// Mutative Functions
function claimFees() external returns (bool); function claimOnBehalf(address claimingForAddress) external returns (bool); function closeCurrentFeePeriod() external;
function claimFees() external returns (bool); function claimOnBehalf(address claimingForAddress) external returns (bool); function closeCurrentFeePeriod() external;
4,669
0
// Sets token royalties/recipient recipient of the royalties/value percentage (using 2 decimals - 10000 = 100, 0 = 0)
function _setTokenRoyalty(address recipient, uint256 value) internal { require(value <= 10000, "ERC2981Royalties: Too high"); _royalties = RoyaltyInfo(recipient, uint24(value)); }
function _setTokenRoyalty(address recipient, uint256 value) internal { require(value <= 10000, "ERC2981Royalties: Too high"); _royalties = RoyaltyInfo(recipient, uint24(value)); }
84
88
// Adds a bid to fee history. Doesn't perform any checks if the bid is valid! returnReturns how the bid was split. Same value as _splitBid function./
function _registerBid(uint32 _canvasId, uint _amount) internal stateBidding(_canvasId) returns ( uint commission, uint paintersRewards
function _registerBid(uint32 _canvasId, uint _amount) internal stateBidding(_canvasId) returns ( uint commission, uint paintersRewards
36,413
39
// Execute a multi-signature revoke transaction from this wallet using 2 signers: one from msg.sender and the other from ecrecover.hash the certificate's hash that will be revoked on the blockchain signature second signer's signature /
function revoke( bytes32 hash, bytes memory signature
function revoke( bytes32 hash, bytes memory signature
20,845
12
// Get the current token count/ return the created token count
function tokenCount() public view returns (uint256) { return _tokenCount.current(); }
function tokenCount() public view returns (uint256) { return _tokenCount.current(); }
18,317
201
// Get the root owner of a child token Returns the owner at the top of the tree of composablesUse Cases handled:- Case 1: Token owner is this contract and token.- Case 2: Token owner is other external top-down composable- Case 3: Token owner is other contract- Case 4: Token owner is user _childContract The contract add...
function rootOwnerOfChild(address _childContract, uint256 _childTokenId) public view virtual override returns (bytes32 rootOwner)
function rootOwnerOfChild(address _childContract, uint256 _childTokenId) public view virtual override returns (bytes32 rootOwner)
60,576
45
// migrates liquidity to uniswap v3 /
function migrate(address _lpToken, uint256 _index, uint256 _lockID, uint256 _amount) external nonReentrant
function migrate(address _lpToken, uint256 _index, uint256 _lockID, uint256 _amount) external nonReentrant
39,294
3
// Require payment for non-free mints
require(msg.value >= mintRate * quantity, "Insufficient payment");
require(msg.value >= mintRate * quantity, "Insufficient payment");
38,252
27
// Indicates that the contract is in the process of being initialized. /
bool private initializing;
bool private initializing;
22,072
33
// sy=((qy-py)/(qx-px))(px-sx)-py
(sy, dy) = projectiveSub(px, z1, sx, dx); // px-sx (sy, dy) = projectiveMul(sy, dy, lx, lz); // ((qy-py)/(qx-px))(px-sx) (sy, dy) = projectiveSub(sy, dy, py, z1); // ((qy-py)/(qx-px))(px-sx)-py if (dx != dy) { // Cross-multiply to put everything over a common denominator sx = mulmod(sx,...
(sy, dy) = projectiveSub(px, z1, sx, dx); // px-sx (sy, dy) = projectiveMul(sy, dy, lx, lz); // ((qy-py)/(qx-px))(px-sx) (sy, dy) = projectiveSub(sy, dy, py, z1); // ((qy-py)/(qx-px))(px-sx)-py if (dx != dy) { // Cross-multiply to put everything over a common denominator sx = mulmod(sx,...
20,930
280
// expmodsAndPoints[19:96] (.points) points used during the denominators calculation.
uint256[96] memory expmodsAndPoints;
uint256[96] memory expmodsAndPoints;
3,258
28
// Modified from 0x LibBytes//
library LibBytes { using LibBytes for bytes; /// @dev Gets the memory address for the contents of a byte array. /// @param input Byte array to lookup. /// @return memoryAddress Memory address of the contents of the byte array. function contentAddress(bytes memory input) internal pure r...
library LibBytes { using LibBytes for bytes; /// @dev Gets the memory address for the contents of a byte array. /// @param input Byte array to lookup. /// @return memoryAddress Memory address of the contents of the byte array. function contentAddress(bytes memory input) internal pure r...
30,472
38
// One opnd.
VAR, // v1 NOT, // !v1
VAR, // v1 NOT, // !v1
28,835
84
// Registers new fiat currency in ANT contract._currency Crypto fiat currency address. _price Crypto fiat currency price in ETH.return A boolean that indicates if the operation was successful./
function registerCurrency(address _currency, uint _price) public _onlyOwner returns (bool) { for (uint i = 0; i < currencies.length; i++) { if (currencies[i] == _currency) { return false; } } currencies.push(_currency); prices[_currency] = _pr...
function registerCurrency(address _currency, uint _price) public _onlyOwner returns (bool) { for (uint i = 0; i < currencies.length; i++) { if (currencies[i] == _currency) { return false; } } currencies.push(_currency); prices[_currency] = _pr...
48,559
21
// clamingTokensCount = totalLocked elabsedClaimingCount / ClaimingCount
uint256 clamingTokensCount = claimingLocked .mul(elabsedClaimingCount) .div(ClaimingCount); if(clamingTokensCount > claimingLocked){ clamingTokensCount = claimingLocked; }
uint256 clamingTokensCount = claimingLocked .mul(elabsedClaimingCount) .div(ClaimingCount); if(clamingTokensCount > claimingLocked){ clamingTokensCount = claimingLocked; }
18,681
87
// migate token function for Nami Team
function migrateToken(address _from, address _to) public onlyEscrow
function migrateToken(address _from, address _to) public onlyEscrow
25,529
107
// //Stake SUSHI `amount` into crSUSHI and BENTO for benefit of `to` by batching calls to `crSushiToken` and `bento`.
function sushiToCreamToBento(address to, uint256 amount) external returns (uint256 amountOut, uint256 shareOut) { sushiToken.safeTransferFrom(msg.sender, address(this), amount); // deposit `msg.sender` SUSHI `amount` into this contract ICompoundBridge(crSushiToken).mint(amount); // stake deposited S...
function sushiToCreamToBento(address to, uint256 amount) external returns (uint256 amountOut, uint256 shareOut) { sushiToken.safeTransferFrom(msg.sender, address(this), amount); // deposit `msg.sender` SUSHI `amount` into this contract ICompoundBridge(crSushiToken).mint(amount); // stake deposited S...
5,885
22
// Withdraw
msg.sender.transfer(this.balance);
msg.sender.transfer(this.balance);
2,278
73
// update last round;
if (pIDPlayer[_pID].lrnd != _rID) updateVault(_pID); pIDPlayer[_pID].lrnd = _rID; uint256 _inv1 = pIDPlayer[_pID].inviter1; uint256 _inv2 = pIDPlayer[_pID].inviter2;
if (pIDPlayer[_pID].lrnd != _rID) updateVault(_pID); pIDPlayer[_pID].lrnd = _rID; uint256 _inv1 = pIDPlayer[_pID].inviter1; uint256 _inv2 = pIDPlayer[_pID].inviter2;
21,226
4
// resolves ipfshash to truebit file
function load(string ipfshash) public view returns (bytes32 hash, uint sz) { hash = filesystem.getRoot(string_to_file[ipfshash]); sz = filesystem.getByteSize(string_to_file[ipfshash]); }
function load(string ipfshash) public view returns (bytes32 hash, uint sz) { hash = filesystem.getRoot(string_to_file[ipfshash]); sz = filesystem.getByteSize(string_to_file[ipfshash]); }
24,320
129
// Governance - Internal, Set Pool VIP Amount
function _setPoolVipAmount(uint256 _pid, uint256 _vipAmount) internal { require(poolInfo[_pid].vipAmount != _vipAmount, "SetVipAmount: No amount change"); poolInfo[_pid].vipAmount = _vipAmount; emit PoolVipAmountUpdated(msg.sender, _pid, _vipAmount); }
function _setPoolVipAmount(uint256 _pid, uint256 _vipAmount) internal { require(poolInfo[_pid].vipAmount != _vipAmount, "SetVipAmount: No amount change"); poolInfo[_pid].vipAmount = _vipAmount; emit PoolVipAmountUpdated(msg.sender, _pid, _vipAmount); }
44,923
3
// Connext contracts.
IConnext public immutable connext = IConnext(0x2334937846Ab2A3FCE747b32587e1A1A2f6EEC5a);
IConnext public immutable connext = IConnext(0x2334937846Ab2A3FCE747b32587e1A1A2f6EEC5a);
788
256
// Transfers `tokenId` from `from` to `to`. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must be owned by `from`.- If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) ...
* by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) ...
18,413
114
// excludes JOE Router, pair, contract and burn address from sell limits on time
_excludedFromSellLock.add(address(_JOERouter)); _excludedFromSellLock.add(_JOEPairAddress); _excludedFromSellLock.add(address(this));
_excludedFromSellLock.add(address(_JOERouter)); _excludedFromSellLock.add(_JOEPairAddress); _excludedFromSellLock.add(address(this));
1,658
41
// remove liquidity
require(msg.sender == manager, "Only managerAddr can removeLiquidity."); IUniswapV2Pair pair = IUniswapV2Pair(uniPairAddr); TransferHelper.safeTransfer(uniPairAddr, uniPairAddr, liquidity) ; pair.burn( address(this) ) ;
require(msg.sender == manager, "Only managerAddr can removeLiquidity."); IUniswapV2Pair pair = IUniswapV2Pair(uniPairAddr); TransferHelper.safeTransfer(uniPairAddr, uniPairAddr, liquidity) ; pair.burn( address(this) ) ;
29,867
77
// details for the given aggregator round _roundId target aggregator round (NOT OCR round). Must fit in uint32return roundId _roundIdreturn answer median of report from given _roundIdreturn startedAt timestamp of block in which report from given _roundId was transmittedreturn updatedAt timestamp of block in which repor...
function getRoundData(uint80 _roundId) public override view virtual returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
function getRoundData(uint80 _roundId) public override view virtual returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
22,781
305
// Initialize the new money market underlying_ The address of the underlying asset bController_ The address of the BController interestRateModel_ The address of the interest rate model initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18 name_ ERC-20 name of this token symbol_ ERC-20 symbol of this to...
function initialize(address underlying_, BControllerInterface bController_, InterestRateModel interestRateModel_, uint initialExchangeRateMantissa_, string memory name_, string memory symbol_,
function initialize(address underlying_, BControllerInterface bController_, InterestRateModel interestRateModel_, uint initialExchangeRateMantissa_, string memory name_, string memory symbol_,
70,998
48
// Computes the vested amount of tokens for the given vesting schedule identifier. return the vested amount/
function computeReleasableAmount(bytes32 vestingScheduleId) public onlyIfVestingScheduleNotRevoked(vestingScheduleId) view
function computeReleasableAmount(bytes32 vestingScheduleId) public onlyIfVestingScheduleNotRevoked(vestingScheduleId) view
27,153
54
// The PallyCoin/Manoj Patidar
contract PallyCoin is PausableToken { using SafeMath for uint256; string public constant name = 'PallyCoin'; string public constant symbol = 'PLL'; uint8 public constant decimals = 18; uint256 public totalSupply = 100e24; // 100M tokens with 18 decimals bool public remainingTokenBurnt = false; ...
contract PallyCoin is PausableToken { using SafeMath for uint256; string public constant name = 'PallyCoin'; string public constant symbol = 'PLL'; uint8 public constant decimals = 18; uint256 public totalSupply = 100e24; // 100M tokens with 18 decimals bool public remainingTokenBurnt = false; ...
15,508
105
// allow list of supported tokens to updated, removal/
function removeWinnableToken (string memory symbol_) public onlyOwner returns (bool){ delete(tokens[symbol_]); return true; }
function removeWinnableToken (string memory symbol_) public onlyOwner returns (bool){ delete(tokens[symbol_]); return true; }
33,011
23
// Lets user know if their vote has been counted
function haveYouVoted() public view returns (bool) { return voters[msg.sender]; }
function haveYouVoted() public view returns (bool) { return voters[msg.sender]; }
17,289
12
// Iterate over all addresses in the ToBePaid array
for (uint256 i = 0; i < ToBePaid.length; i++) {
for (uint256 i = 0; i < ToBePaid.length; i++) {
26,070
19
// Returns a SignedMath.Int version of the margin in balance. /
function getMargin( PPTypes.Balance memory balance ) internal pure returns (SignedMath.Int memory)
function getMargin( PPTypes.Balance memory balance ) internal pure returns (SignedMath.Int memory)
31,552