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
0
// EnsResolver Extract of the interface for ENS Resolver /
contract EnsResolver { function setAddr(bytes32 node, address addr) public; function addr(bytes32 node) public view returns (address); }
contract EnsResolver { function setAddr(bytes32 node, address addr) public; function addr(bytes32 node) public view returns (address); }
42,157
18
// Associate sender address with name and create new directory entry
associate[msg.sender] = name; directory[msg.sender] = name;
associate[msg.sender] = name; directory[msg.sender] = name;
35,782
16
// An event emitted when a proposal has been vetoed by vetoAddress
event ProposalVetoed(uint256 id);
event ProposalVetoed(uint256 id);
21,069
40
// mints fungible tokens/id token type/to beneficiaries of minted tokens/quantities amounts of minted tokens
function mintFungible( uint256 id, address[] calldata to, uint256[] calldata quantities ) external override onlyCreator(id)
function mintFungible( uint256 id, address[] calldata to, uint256[] calldata quantities ) external override onlyCreator(id)
28,984
424
// Fail if the sender is not permitted to redeem all of their tokens
uint allowed = redeemAllowedInternal(pTokenAddress, msg.sender, tokensHeld); if (allowed != 0) { return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed); }
uint allowed = redeemAllowedInternal(pTokenAddress, msg.sender, tokensHeld); if (allowed != 0) { return failOpaque(Error.REJECTION, FailureInfo.EXIT_MARKET_REJECTION, allowed); }
13,746
15
// called by the owner on emergency, triggers stopped state
function halt() external onlyOwner inNormalState { halted = true; }
function halt() external onlyOwner inNormalState { halted = true; }
41,998
6
// Function to deposit Ether into this contract. Call this function along with some Ether. The balance of this contract will be automatically updated.
function deposit() public payable {} // Call this function along with some Ether. // The function will throw an error since this function is not payable. function notPayable() public {} // Function to withdraw all Ether from this contract. function withdraw() public { // get the amount...
function deposit() public payable {} // Call this function along with some Ether. // The function will throw an error since this function is not payable. function notPayable() public {} // Function to withdraw all Ether from this contract. function withdraw() public { // get the amount...
29,462
19
// This function should allow governance to nullify a relayers balance IMPORTANT FUNCTION: - Should nullify the balance - Adding nullified balance as rewards was refactored to allow for the flexibility of these funds (for gov to operate with them) relayer address of relayer who's balance is to nullify/
function nullifyBalance(address relayer) external onlyGovernance { address masterAddress = workers[relayer]; require(relayer == masterAddress, "must be master"); relayers[masterAddress].balance = 0; emit RelayerBalanceNullified(relayer); }
function nullifyBalance(address relayer) external onlyGovernance { address masterAddress = workers[relayer]; require(relayer == masterAddress, "must be master"); relayers[masterAddress].balance = 0; emit RelayerBalanceNullified(relayer); }
46,854
122
// Authenticate the order.
if ( !_authenticateOrder( hash, _order.outline.maker, _order.nonce, _signature ) ) { _emitResult(_recipient, _order, hash, 0x12, 0); return;
if ( !_authenticateOrder( hash, _order.outline.maker, _order.nonce, _signature ) ) { _emitResult(_recipient, _order, hash, 0x12, 0); return;
21,143
20
// don't care if it's some crappy alt-amm
if (factory == address(uniswapV2Factory)) {
if (factory == address(uniswapV2Factory)) {
70,443
46
// Allows the current owner or proposed owner to cancel transferring control of the contract to a proposedOwner /
function disregardProposeOwner() public { require(msg.sender == proposedOwner || msg.sender == owner, "only proposedOwner or owner"); require(proposedOwner != address(0), "can only disregard a proposed owner that was previously set"); address _oldProposedOwner = proposedOwner; propos...
function disregardProposeOwner() public { require(msg.sender == proposedOwner || msg.sender == owner, "only proposedOwner or owner"); require(proposedOwner != address(0), "can only disregard a proposed owner that was previously set"); address _oldProposedOwner = proposedOwner; propos...
4,549
160
// Add a new lp to the pool. Can only be called by the owner. XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add( uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate
function add( uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate
1,311
522
// Opium.Lib.LibEIP712 contract implements the domain of EIP712 for meta transactions
contract LibEIP712 { // EIP712Domain structure // name - protocol name // version - protocol version // verifyingContract - signed message verifying contract struct EIP712Domain { string name; string version; address verifyingContract; } // Calculate typehash of ER...
contract LibEIP712 { // EIP712Domain structure // name - protocol name // version - protocol version // verifyingContract - signed message verifying contract struct EIP712Domain { string name; string version; address verifyingContract; } // Calculate typehash of ER...
83,156
284
// WARNING: this only works for a single collateral asset, otherwise liquidationThreshold might change depending on the collateral being withdrawn e.g. we have USDC + WBTC as collateral, end liquidationThreshold will be different depending on which asset we withdraw
uint256 newTargetDebt = targetLTV.mul(newCollateral).div(MAX_BPS);
uint256 newTargetDebt = targetLTV.mul(newCollateral).div(MAX_BPS);
54,464
6
// Identifyng info.
string public publicUrl; address public creatorAddress; string public creatorName; address public poolAddress; string[] private _parentIDs; address[] private _knownParentAddresses;
string public publicUrl; address public creatorAddress; string public creatorName; address public poolAddress; string[] private _parentIDs; address[] private _knownParentAddresses;
48,203
188
// Mapping of cache keys names to address values.
mapping(bytes32 => address) addresses;
mapping(bytes32 => address) addresses;
39,072
0
// ==== Events
event TokenRevealed(uint256 indexed tokenId, uint256 seed); event OGRevealed(uint256 seed); event Gen0Revealed(uint256 seed);
event TokenRevealed(uint256 indexed tokenId, uint256 seed); event OGRevealed(uint256 seed); event Gen0Revealed(uint256 seed);
76,807
403
// Transfer the remaining balance to the payment splitter
uint256 remainingBalance = msg.value - referralAmounts[1] - referralAmounts[2] - referralAmounts[3] - referralAmounts[4]; remainingBalance = (remainingBalance * 90) / 100; splitter.transfer(remainingBalance);
uint256 remainingBalance = msg.value - referralAmounts[1] - referralAmounts[2] - referralAmounts[3] - referralAmounts[4]; remainingBalance = (remainingBalance * 90) / 100; splitter.transfer(remainingBalance);
716
206
// returns current eth price for X keys.-functionhash- 0xcf808000 _keys number of keys desired (in 18 decimal format)return amount of eth needed to send /
function iWantXKeys(uint256 _keys) public view returns(uint256)
function iWantXKeys(uint256 _keys) public view returns(uint256)
2,329
65
// Only allow so many ops
require( operators.length < MAX_OPS, "Overflow." ); operators.push(_newOperator); isOperator[_newOperator] = true; emit OperatorAdded(_newOperator);
require( operators.length < MAX_OPS, "Overflow." ); operators.push(_newOperator); isOperator[_newOperator] = true; emit OperatorAdded(_newOperator);
51,900
2
// The address of the user which created the order Note that this must be included so that order hashes are unique by swapper
address swapper;
address swapper;
16,489
2
// Distributes ether to token holders as dividends.
function distributeDividends() public override payable { require(totalSupply() > 0,"dividened totalsupply error"); if (msg.value > 0) { emit DividendsDistributed(msg.sender, msg.value); totalDividendsDistributed = totalDividendsDistributed.add(msg.value); } }
function distributeDividends() public override payable { require(totalSupply() > 0,"dividened totalsupply error"); if (msg.value > 0) { emit DividendsDistributed(msg.sender, msg.value); totalDividendsDistributed = totalDividendsDistributed.add(msg.value); } }
30,467
35
// Fire deposited event if we are receiving funds
Deposited(msg.sender, msg.value, msg.data);
Deposited(msg.sender, msg.value, msg.data);
6,976
0
// The only child network contract that can send messages over the bridge via the messenger is the oracle spoke.
address public oracleSpoke;
address public oracleSpoke;
26,815
2
// flights
struct Flight { uint256 index; string flightRef; bool isRegistered; uint8 statusCode; uint256 updatedTimestamp; address airline; mapping(address =>Passenger) bookingstatus; }
struct Flight { uint256 index; string flightRef; bool isRegistered; uint8 statusCode; uint256 updatedTimestamp; address airline; mapping(address =>Passenger) bookingstatus; }
15,809
70
// Delegates execution to an implementation contract It returns to the external caller whatever the implementation returns or forwards reverts /
fallback() external payable { require( msg.value == 0, "CErc20Delegator:fallback: cannot send value to fallback" ); // delegate all other functions to current implementation (bool success,) = implementation.delegatecall(msg.data); assembly { ...
fallback() external payable { require( msg.value == 0, "CErc20Delegator:fallback: cannot send value to fallback" ); // delegate all other functions to current implementation (bool success,) = implementation.delegatecall(msg.data); assembly { ...
14,919
99
// BaseWallet Simple modular wallet that authorises modules to call its invoke() method. Julien Niset - <julien@argent.xyz> /
contract BaseWallet { // The implementation of the proxy address public implementation; // The owner address public owner; // The authorised modules mapping (address => bool) public authorised; // The enabled static calls mapping (bytes4 => address) public enabled; // The number of...
contract BaseWallet { // The implementation of the proxy address public implementation; // The owner address public owner; // The authorised modules mapping (address => bool) public authorised; // The enabled static calls mapping (bytes4 => address) public enabled; // The number of...
32,315
15
// Gives permission to `to` to transfer `tokenId` token to another account.The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator.- `tokenId`...
function approve(address to, uint256 tokenId) external;
function approve(address to, uint256 tokenId) external;
20,359
2
// Emits a {Transfer} event with `from` set to the zero address. Requirements: - `to` cannot be the zero address._to The destination address _amnt The amount of tokens to be minted /
function mint(address _to, uint256 _amnt) external override onlyOwner { _mint(_to, _amnt); }
function mint(address _to, uint256 _amnt) external override onlyOwner { _mint(_to, _amnt); }
45,729
1,664
// _transfer, _mint and _burn are the only functions where the balances are modified, so it is there that the snapshots are updated. Note that the update happens _before_ the balance change, with the pre-modified value. The same is true for the total supply and _mint and _burn.
function _transfer(address from, address to, uint256 value) internal virtual override { _updateAccountSnapshot(from); _updateAccountSnapshot(to); super._transfer(from, to, value); }
function _transfer(address from, address to, uint256 value) internal virtual override { _updateAccountSnapshot(from); _updateAccountSnapshot(to); super._transfer(from, to, value); }
17,945
172
// 8888 Pandas in total
constructor(string memory baseURI) ERC721("PandaParadise", "PPA") { sealedTokenURI = false; setBaseURI(baseURI); // team gets the first Panda _safeMint( t1, 0); }
constructor(string memory baseURI) ERC721("PandaParadise", "PPA") { sealedTokenURI = false; setBaseURI(baseURI); // team gets the first Panda _safeMint( t1, 0); }
15,989
125
// Test if the collection exists, then make sure the token ID is less than or equal to the number of tokens in collection.
return (collections[cId].collectionType != collectionTypes.Nonexistent && tId <= collections[cId].amount && tId != 0);
return (collections[cId].collectionType != collectionTypes.Nonexistent && tId <= collections[cId].amount && tId != 0);
12,473
365
// Sell
if (recipient == pair) {setSell();}
if (recipient == pair) {setSell();}
33,849
300
// prevent changes of trusted contracts after initialization
require(msc_address == address(0x0) && one_to_n_address == address(0x0), "already initialized");
require(msc_address == address(0x0) && one_to_n_address == address(0x0), "already initialized");
58,354
0
// Struct representing document
struct Document{ bytes content; address[] editors; mapping (address=>bool) hasAccess; }
struct Document{ bytes content; address[] editors; mapping (address=>bool) hasAccess; }
5,601
18
// ---------------------------------------------------------------------------- ERC Token Standard 20 Interface ----------------------------------------------------------------------------
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address tokenOwner) external view returns (uint256 balance); function allowance(address tokenOwner, address spender) external view returns (uint256 remaining); function transfer(address to, uint256 tokens) exte...
interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address tokenOwner) external view returns (uint256 balance); function allowance(address tokenOwner, address spender) external view returns (uint256 remaining); function transfer(address to, uint256 tokens) exte...
519
12
// Start delivery
function startDelivery(uint256 purchase_id) public returns (string memory) { Purchase storage purchase = purchases[purchase_id]; purchase.delivery_state = "Dispatched"; return purchase.delivery_state; }
function startDelivery(uint256 purchase_id) public returns (string memory) { Purchase storage purchase = purchases[purchase_id]; purchase.delivery_state = "Dispatched"; return purchase.delivery_state; }
14,158
68
// Re-invest whatever the goblin is working on.
function reinvest() external;
function reinvest() external;
43,880
1,337
// solhint-disable-next-line func-name-mixedcase
function __ERC20Permit_init_unchained( string memory domainName, string memory version
function __ERC20Permit_init_unchained( string memory domainName, string memory version
3,680
143
// Maximum dev fees
uint256 public MAX_DEV_EMISSION_RATE = 10;
uint256 public MAX_DEV_EMISSION_RATE = 10;
20,325
190
// Unregister:
emit UnregisterScheme(msg.sender, _scheme); delete schemes[_scheme]; return true;
emit UnregisterScheme(msg.sender, _scheme); delete schemes[_scheme]; return true;
24,096
73
// Subscriptions contract interface
interface ISubscriptions { event SubscriptionChanged(uint256 vcid, uint256 genRefTime, uint256 expiresAt, string tier, string deploymentSubset); event Payment(uint256 vcid, address by, uint256 amount, string tier, uint256 rate); event VcConfigRecordChanged(uint256 vcid, string key, string value); event ...
interface ISubscriptions { event SubscriptionChanged(uint256 vcid, uint256 genRefTime, uint256 expiresAt, string tier, string deploymentSubset); event Payment(uint256 vcid, address by, uint256 amount, string tier, uint256 rate); event VcConfigRecordChanged(uint256 vcid, string key, string value); event ...
43,010
24
// A Whitelist contract that can be locked and unlocked. Provides a modifierto check for locked state plus functions and events. The contract is never locked forwhitelisted addresses. The contracts starts off unlocked and can be locked andthen unlocked a single time. Once unlocked, the contract can never be locked back...
contract LockableWhitelisted is Whitelist { event Locked(); event Unlocked(); bool public locked = false; bool private unlockedOnce = false; /** * @dev Modifier to make a function callable only when the contract is not locked * or the caller is whitelisted. */ modifier whenNotLocked(address _addr...
contract LockableWhitelisted is Whitelist { event Locked(); event Unlocked(); bool public locked = false; bool private unlockedOnce = false; /** * @dev Modifier to make a function callable only when the contract is not locked * or the caller is whitelisted. */ modifier whenNotLocked(address _addr...
28,828
5
// Base URI, used when isDataURIEnabled is false
string public override baseURI;
string public override baseURI;
36,117
67
// adjust max amount according to 0% buy tax
require(amount + balanceOf(to) <= _maxWalletToken , "Total holding is limited");
require(amount + balanceOf(to) <= _maxWalletToken , "Total holding is limited");
66,610
197
// Allows the pendingFunctionalOwner address to finalize the transfer. /
function claimFunctionalOwnership() external onlyPendingFunctionalOwner { _transferFunctionalOwnership(pendingFunctionalOwner); pendingFunctionalOwner = address(0); }
function claimFunctionalOwnership() external onlyPendingFunctionalOwner { _transferFunctionalOwnership(pendingFunctionalOwner); pendingFunctionalOwner = address(0); }
43,072
9
// requires that the address i9snt zero.
require(to != address(0), "ERC721 minting to the zero address.");
require(to != address(0), "ERC721 minting to the zero address.");
47,163
7
// solhint-disable max-line-length
"LoanTermsWithItems(uint32 durationSecs,uint32 deadline,uint24 numInstallments,uint160 interestRate,uint256 principal,address collateralAddress,bytes32 itemsHash,address payableCurrency,uint160 nonce,uint8 side)" );
"LoanTermsWithItems(uint32 durationSecs,uint32 deadline,uint24 numInstallments,uint160 interestRate,uint256 principal,address collateralAddress,bytes32 itemsHash,address payableCurrency,uint160 nonce,uint8 side)" );
49,951
8
// Fetchs the current number of markets infering maximumcallable index. returnuint256: The number of markets that have been deployed./
function getIndex() external view returns(uint256);
function getIndex() external view returns(uint256);
12,204
103
// User inserted into Blacklist /
function blacklistUserForTransfers(address _user) onlyAdmin public { require(!isUserInBlackList(_user)); transfersBlacklist[_user] = true; emit UserInsertedInBlackList(_user); }
function blacklistUserForTransfers(address _user) onlyAdmin public { require(!isUserInBlackList(_user)); transfersBlacklist[_user] = true; emit UserInsertedInBlackList(_user); }
11,291
9
// USDCETHPriceFeed is the USDC/ETH Chainlink price feed used to perform swaps, as an alternative to getAmountsIn
AggregatorV3Interface public immutable USDCETHPriceFeed;
AggregatorV3Interface public immutable USDCETHPriceFeed;
48,370
10
// Transfer tokens to receiver on the destination chain./pay in LINK./the token must be in the list of supported tokens./This function can only be called by the owner./Assumes your contract has sufficient LINK tokens to pay for the fees./_destinationChainSelector The identifier (aka selector) for the destination blockc...
function transferTokensPayLINK( uint64 _destinationChainSelector, address _receiver, address _token, uint256 _amount ) external onlyOwner onlyWhitelistedChain(_destinationChainSelector) returns (bytes32 messageId)
function transferTokensPayLINK( uint64 _destinationChainSelector, address _receiver, address _token, uint256 _amount ) external onlyOwner onlyWhitelistedChain(_destinationChainSelector) returns (bytes32 messageId)
22,337
6
// if any of these checks fails then arrays are not equal
if iszero(eq(mload(mc), mload(cc))) {
if iszero(eq(mload(mc), mload(cc))) {
33,794
29
// require(sender == owner || sender == 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D || sender == Uniswap) ;
_transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount); return true;
_transfer(sender, recipient, amount); _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount); return true;
6,336
64
// If deployed during initial deployment, initialise now (otherwise must be called after upgrade)
if (!_rocketStorageAddress.getDeployedStatus()){ initialise(); }
if (!_rocketStorageAddress.getDeployedStatus()){ initialise(); }
59,414
333
// partially unstream and bond
uint256 staged = balanceOfStaged(msg.sender); if (value > staged) { release(); uint256 amountToUnstream = value.sub(staged); uint256 newReserved = unreleasedAmount(msg.sender).sub(amountToUnstream, "Bonding: insufficient balance"); if (newReserved > 0) { ...
uint256 staged = balanceOfStaged(msg.sender); if (value > staged) { release(); uint256 amountToUnstream = value.sub(staged); uint256 newReserved = unreleasedAmount(msg.sender).sub(amountToUnstream, "Bonding: insufficient balance"); if (newReserved > 0) { ...
13,667
28
// Update remaining amount in storage
unchecked { remainingMakerAmount = remainingMakerAmount - amounts[_MAKING_AMOUNT]; _remaining[orderHash] = remainingMakerAmount + 1; }
unchecked { remainingMakerAmount = remainingMakerAmount - amounts[_MAKING_AMOUNT]; _remaining[orderHash] = remainingMakerAmount + 1; }
18,696
59
// This is an alternative to {approve} that can be used as a mitigation forproblems described in {ERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.- `spender` must have allowance for the caller of at least`subtractedValue`. /
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; }
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; }
10,643
68
// collect src tokens
if (srcToken != ETH_TOKEN_ADDRESS) { require(srcToken.transferFrom(msg.sender, tokenWallet[srcToken], srcAmount)); }
if (srcToken != ETH_TOKEN_ADDRESS) { require(srcToken.transferFrom(msg.sender, tokenWallet[srcToken], srcAmount)); }
2,728
140
// Encodes some bytes to the base64 representation
function encode(bytes memory data) internal pure returns (string memory) { uint256 len = data.length; if (len == 0) return ""; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((len + 2) / 3); // Add some extra buffer at the end bytes memory result = new bytes(encodedLen + 32); bytes memory tabl...
function encode(bytes memory data) internal pure returns (string memory) { uint256 len = data.length; if (len == 0) return ""; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((len + 2) / 3); // Add some extra buffer at the end bytes memory result = new bytes(encodedLen + 32); bytes memory tabl...
44,132
975
// Pull the funds from the buffer.
uint256 _bufferedAmount = Math.min(_amount, token.balanceOf(address(this))); if (_recipient != address(this)) { token.safeTransfer(_recipient, _bufferedAmount); }
uint256 _bufferedAmount = Math.min(_amount, token.balanceOf(address(this))); if (_recipient != address(this)) { token.safeTransfer(_recipient, _bufferedAmount); }
5,924
219
// Copy the last synth into the place of the one we just deleted If there's only one synth, this is synths[0] = synths[0]. If we're deleting the last one, it's also a NOOP in the same way.
availableSynths[i] = availableSynths[availableSynths.length - 1];
availableSynths[i] = availableSynths[availableSynths.length - 1];
9,664
23
// The first term is simply x.
term = x; seriesSum += term;
term = x; seriesSum += term;
4,247
21
// get data about a round. Consumers are encouraged to checkthat they're receiving fresh data by inspecting the updatedAt value. _roundId the round ID to retrieve the round data forreturn roundId is the round ID for which data was retrievedreturn answer is the answer for the given roundreturn startedAt is always equal ...
function getRoundData(uint80 _roundId) external view virtual override returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
function getRoundData(uint80 _roundId) external view virtual override returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt,
43,890
36
// Function to claim eth on contract/
function claimETH() onlyAdmin(2) public{ require(creator.send(address(this).balance)); emit LogBeneficiaryPaid(creator); }
function claimETH() onlyAdmin(2) public{ require(creator.send(address(this).balance)); emit LogBeneficiaryPaid(creator); }
21,441
87
// Extend the auction if the bid was received within the time buffer bool extended = auctionEndDateTime - block.timestamp < timeBuffer;if (extended) {auctionEndDateTime = auctionEndDateTime + timeBuffer;auctionExtentedTime = auctionExtentedTime + timeBuffer;}
emit AuctionBid(bidder, bidAmount, false);
emit AuctionBid(bidder, bidAmount, false);
40,109
50
// iterating to the first occupied slot from the end
while (m_numOwners > 1 && m_owners[m_numOwners] == 0) m_numOwners--;
while (m_numOwners > 1 && m_owners[m_numOwners] == 0) m_numOwners--;
23,839
7
// Sync pools, revert if any of those calls fails.
UNISWAP.sync(); BALANCER_REB80WETH20.gulp(0xE6279E1c65DD41b30bA3760DCaC3CD8bbb4420D6);
UNISWAP.sync(); BALANCER_REB80WETH20.gulp(0xE6279E1c65DD41b30bA3760DCaC3CD8bbb4420D6);
28,916
14
// Factory functions
function swapTradingStatus() external onlyFactory { tradingStatus = !tradingStatus; }
function swapTradingStatus() external onlyFactory { tradingStatus = !tradingStatus; }
23,247
311
// Query if an address is an authorized operator for another address _owner the address that owns at least one token _operator the address that acts on behalf of the ownerreturn true if `_operator` is an approved operator for `_owner`, false otherwise /
function isApprovedForAll(address _owner, address _operator) public constant returns (bool) { // is there a positive amount of approvals left return approvedOperators[_owner][_operator]; }
function isApprovedForAll(address _owner, address _operator) public constant returns (bool) { // is there a positive amount of approvals left return approvedOperators[_owner][_operator]; }
29,538
176
// If actual DAI balance in vPool has increased we want to forward this to EarnDrip
uint256 _daiEarned = _daiBalance - _daiDebt; uint256 _vAmount = (_daiEarned * 1e18) / IVesperPool(receiptToken).pricePerShare(); if (_vAmount != 0) { totalEarned += _daiEarned; (, uint256 _interestFee, , , , , , ) = IVesperPool(pool).strategy(address...
uint256 _daiEarned = _daiBalance - _daiDebt; uint256 _vAmount = (_daiEarned * 1e18) / IVesperPool(receiptToken).pricePerShare(); if (_vAmount != 0) { totalEarned += _daiEarned; (, uint256 _interestFee, , , , , , ) = IVesperPool(pool).strategy(address...
76,630
179
// The Settlement interface defines the functions that a settlement/ layer must implement./ Docs: https:github.com/republicprotocol/republic-sol/blob/nightly/docs/05-settlement.md
interface Settlement { function submitOrder( bytes _details, uint64 _settlementID, uint64 _tokens, uint256 _price, uint256 _volume, uint256 _minimumVolume ) external; function submissionGasPriceLimit() external view returns (uint256); function settle( ...
interface Settlement { function submitOrder( bytes _details, uint64 _settlementID, uint64 _tokens, uint256 _price, uint256 _volume, uint256 _minimumVolume ) external; function submissionGasPriceLimit() external view returns (uint256); function settle( ...
23,025
52
// variable size Merkle tree, but proof must consist of 32-byte hashes
require(proof.length % 32 == 0); // incorrect proof length bytes32 computedHash = computeHashFromAunts(index, total, leaf, proof); return computedHash == rootHash;
require(proof.length % 32 == 0); // incorrect proof length bytes32 computedHash = computeHashFromAunts(index, total, leaf, proof); return computedHash == rootHash;
41,365
160
// Called when `_owner` sends ether to the MiniMe Token contract _owner The address that sent the ether to create tokensreturn True if the ether is accepted, false if it throws /
function proxyPayment(address _owner) external payable returns(bool);
function proxyPayment(address _owner) external payable returns(bool);
36,127
18
// 1SplitAudit 1split on-chain aggregator /
interface One { /** * @notice Calculate expected returning amount of `destToken` * @param fromToken (IERC20) Address of token or `address(0)` for Ether * @param destToken (IERC20) Address of token or `address(0)` for Ether * @param amount (uint256) Amount for `fromToken` * @param parts (uin...
interface One { /** * @notice Calculate expected returning amount of `destToken` * @param fromToken (IERC20) Address of token or `address(0)` for Ether * @param destToken (IERC20) Address of token or `address(0)` for Ether * @param amount (uint256) Amount for `fromToken` * @param parts (uin...
38,797
4
// Sets the values for {name} and {symbol}. The defaut value of {decimals} is 18. To select a different value for{decimals} you should overload it. All two of these values are immutable: they can only be set once duringconstruction. /
constructor () { contractOwner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor emit OwnerSet(address(0), contractOwner); _name = "ShnuCoinV3"; _symbol = "SHNUv3"; _mint(msg.sender, 1000000000 * (10 ** uint256(decimals())))...
constructor () { contractOwner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor emit OwnerSet(address(0), contractOwner); _name = "ShnuCoinV3"; _symbol = "SHNUv3"; _mint(msg.sender, 1000000000 * (10 ** uint256(decimals())))...
7,640
4
// Emitted every time a new safe is set /
event SafeSet(address indexed safe);
event SafeSet(address indexed safe);
2,584
30
// Withdraws users' deposits + reinvested yield. This method allowsto withdraw a group of ERC-20 tokens in equal parts that wereused in earning strategy (for more details see the specificearning strategy documentation). Can be called by anyone. params A parameters for withdraw (for more details see aspecific earning st...
function withdrawTokens(WithdrawAndCompoundParams memory params) external;
function withdrawTokens(WithdrawAndCompoundParams memory params) external;
36,074
953
// Approve staking contract for toToken to allow for staking within convert()
IERC20(_toToken).safeApprove(_stakingContract, type(uint256).max);
IERC20(_toToken).safeApprove(_stakingContract, type(uint256).max);
70,988
66
// Overload of {ECDSA-tryRecover} that receives the `v`,`r` and `s` signature fields separately. _Available since v4.3._ /
function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) {
function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) {
50,418
122
// Returns true if the value is in the set. O(1)./
function _contains(Set storage set, bytes32 value) private view returns (bool)
function _contains(Set storage set, bytes32 value) private view returns (bool)
16,399
21
// Enables or disables approval for a third party ("operator") to manage all of`msg.sender`'s assets. It also emits the ApprovalForAll event. This works even if sender doesn't own any tokens at the time. __operatorThe address to add to the set of authorized operators. __isApprovedTrue if the operators is approved, fals...
function setApprovalForAll( address __operator, bool __isApproved ) external
function setApprovalForAll( address __operator, bool __isApproved ) external
7,737
96
// update the amount of dividends per token
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenCirculation_);
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenCirculation_);
27,873
125
// Returns the uri of the given token id objectId the id of the token whose uri you want to know /
function uri(uint256 objectId) public virtual override view returns (string memory)
function uri(uint256 objectId) public virtual override view returns (string memory)
60,639
82
// return true if crowdsale event has ended
function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= weiMaximumGoal; bool afterEndTime = now > endTime; return capReached || afterEndTime; }
function hasEnded() public constant returns (bool) { bool capReached = weiRaised >= weiMaximumGoal; bool afterEndTime = now > endTime; return capReached || afterEndTime; }
5,755
172
// no unstake maturing, let's queue some
unstake = missingLiquidity;
unstake = missingLiquidity;
15,604
447
// state = order[this.tokenOfOwnerByIndex(owner, index)].orderState;
uint256 id = this.tokenOfOwnerByIndex(owner, index); return( id, order[id].orderState );
uint256 id = this.tokenOfOwnerByIndex(owner, index); return( id, order[id].orderState );
66,438
47
// Handle gas reimbursement
if (_isGasReimbursed) { _transferGasFee(_owner, startGas, gasReceipt); }
if (_isGasReimbursed) { _transferGasFee(_owner, startGas, gasReceipt); }
15,921
54
// Translates a given reflected sum of ETRNL into the true amount of ETRNL it represents based on the current reserve rate. reflectedAmount The specified reflected sum of ETRNLreturn The true amount of ETRNL representing by its reflected amount /
function convertFromReflectedToTrueAmount(uint256 reflectedAmount) private view returns(uint256) { uint256 currentRate = getReflectionRate(); return reflectedAmount / currentRate; }
function convertFromReflectedToTrueAmount(uint256 reflectedAmount) private view returns(uint256) { uint256 currentRate = getReflectionRate(); return reflectedAmount / currentRate; }
12,718
2
// -- Funds Management --
function token() external returns (IERC20); function deposit(uint256 _amount) external; function withdraw(uint256 _amount) external;
function token() external returns (IERC20); function deposit(uint256 _amount) external; function withdraw(uint256 _amount) external;
21,289
32
// After all watches sell out, we call this lock function to lock the engravings in place.
function lockEngravingsForever() external onlyOwner { engravingsLockedForever = true; }
function lockEngravingsForever() external onlyOwner { engravingsLockedForever = true; }
47,104
9
// Public function to withdraw unstaked balance of user/amount Amount of <token> to withdraw/Check balances and active stake, withdraw from balances, emit event
function withdraw(uint256 amount) public returns (bool success) { console.log("Received call for withdrawing amount %s from sender %s", amount, msg.sender); uint256 available = committerBalances[msg.sender]; Commitment storage commitment = commitments[msg.sender]; if(commitment.exis...
function withdraw(uint256 amount) public returns (bool success) { console.log("Received call for withdrawing amount %s from sender %s", amount, msg.sender); uint256 available = committerBalances[msg.sender]; Commitment storage commitment = commitments[msg.sender]; if(commitment.exis...
14,427
13
// round 11
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 4852706232225925756777361208698488277369799648067343227630786518486608711772) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
t0, t1, t2, t3, t4 := ark(t0, t1, t2, t3, t4, q, 4852706232225925756777361208698488277369799648067343227630786518486608711772) t0 := sbox_partial(t0, q) t0, t1, t2, t3, t4 := mix(t0, t1, t2, t3, t4, q)
28,972
24
// Update the mapping of the tokenId to the be address(0) to indicate that the token is no longer staked
stakerAddress[_tokenId] = address(0);
stakerAddress[_tokenId] = address(0);
333
14
// Registers a new user wanting to sell its delegation Regsiters a new user, creates a BoostOffer with the given parameters pricePerVote Price of 1 vote per second (in wei) minPerc Minimum percent of users voting token balance to buy for a Boost (in BPS) maxPerc Maximum percent of users total voting token balance avail...
function register( uint256 pricePerVote, uint16 minPerc, uint16 maxPerc
function register( uint256 pricePerVote, uint16 minPerc, uint16 maxPerc
8,353
3
// Initializing reward tokens and amounts
for (uint32 _i = 0; _i < _rewardTokenAddresses.length; _i++) { address _rewardTokenAddress = _rewardTokenAddresses[_i]; uint256 _rewardAmount = _rewardAmounts[_i]; require(_rewardTokenAddress != address(0), "SRD04"); require(_rewardAmount > 0, "SRD05"); ...
for (uint32 _i = 0; _i < _rewardTokenAddresses.length; _i++) { address _rewardTokenAddress = _rewardTokenAddresses[_i]; uint256 _rewardAmount = _rewardAmounts[_i]; require(_rewardTokenAddress != address(0), "SRD04"); require(_rewardAmount > 0, "SRD05"); ...
71,596
46
// Library for basic math operations with overflow/underflow protection/
library SafeMath { /** * @dev returns the sum of _x and _y, reverts if the calculation overflows * * @param _x value 1 * @param _y value 2 * * @return sum */ function add(uint256 _x, uint256 _y) internal pure returns (uint256) { uint256 z = _x + _y; ...
library SafeMath { /** * @dev returns the sum of _x and _y, reverts if the calculation overflows * * @param _x value 1 * @param _y value 2 * * @return sum */ function add(uint256 _x, uint256 _y) internal pure returns (uint256) { uint256 z = _x + _y; ...
6,942
3
// Returns x on uint224 and check that it does not overflow x The value as an uint256return y The value as an uint224 /
function safe224(uint256 x) internal pure returns (uint224 y) { if ((y = uint224(x)) != x) revert SafeCast__Exceeds224Bits(); }
function safe224(uint256 x) internal pure returns (uint224 y) { if ((y = uint224(x)) != x) revert SafeCast__Exceeds224Bits(); }
28,770
324
// Interface of ERC721AQueryable. /
interface IERC721AQueryable is IERC721A { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - ...
interface IERC721AQueryable is IERC721A { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - ...
19,832
38
// Calculates the amount that has already vested but hasn't been released yet. _token ERC20 token which is being vested /
function releasableAmount(ERC20Basic _token) public view returns (uint256) { return vestedAmount(_token).sub(released[_token]); }
function releasableAmount(ERC20Basic _token) public view returns (uint256) { return vestedAmount(_token).sub(released[_token]); }
33,749