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
7
// Adds whitelisted minters
function addMinter(address minter_address) public onlyByOwnGov { require(minter_address != address(0), "Zero address detected"); require(minters[minter_address] == false, "Address already exists"); minters[minter_address] = true; minters_array.push(minter_address); emit Mi...
function addMinter(address minter_address) public onlyByOwnGov { require(minter_address != address(0), "Zero address detected"); require(minters[minter_address] == false, "Address already exists"); minters[minter_address] = true; minters_array.push(minter_address); emit Mi...
5,407
5
// contract will multiply this value by the premium to credit passengers
uint private constant premiumMultiplier = 2;
uint private constant premiumMultiplier = 2;
39,521
38
// Checks
require(newOwner != address(0) || renounce, "Ownable: zero address");
require(newOwner != address(0) || renounce, "Ownable: zero address");
5,786
5
// Withdraw To MemberB
(bool withdrawMemberB, ) = teamMemberB.call{value: memberBAmount}("");
(bool withdrawMemberB, ) = teamMemberB.call{value: memberBAmount}("");
14,506
40
// Estimates amount return amount Token amount duration In secondsreturn returned Amount /
function estimateAmountReturn(uint256 amount, uint256 duration) public pure returns (uint256 returned)
function estimateAmountReturn(uint256 amount, uint256 duration) public pure returns (uint256 returned)
26,616
163
// Enumerable mapping from token ids to their owners
EnumerableMap.UintToAddressMap private _tokenOwners;
EnumerableMap.UintToAddressMap private _tokenOwners;
35,557
261
// Increment count for given Generation/Series
primeCountByGenAndSeries[uint8(_generation)][uint8(_series)]++;
primeCountByGenAndSeries[uint8(_generation)][uint8(_series)]++;
53,351
3
// tx info status/uninitialized,locked,redeemed,revoked
enum TxStatus {None, Locked, Redeemed, Revoked, AssetLocked, DebtLocked} /** * * STRUCTURES * */ /// @notice struct of HTLC user mint lock parameters struct HTLCUserParams { bytes32 xHash; /// hash of HTLC random number bytes32 smgID; ...
enum TxStatus {None, Locked, Redeemed, Revoked, AssetLocked, DebtLocked} /** * * STRUCTURES * */ /// @notice struct of HTLC user mint lock parameters struct HTLCUserParams { bytes32 xHash; /// hash of HTLC random number bytes32 smgID; ...
14,526
11
// Function returns stage of sale at any point in time /
function isSaleStarted() external view returns(bool) { if(block.timestamp >= saleStartTime) { return true; } return false; }
function isSaleStarted() external view returns(bool) { if(block.timestamp >= saleStartTime) { return true; } return false; }
9,143
478
// LendingPoolCore contractAaveHolds the state of the lending pool and all the funds depositedNOTE: The core does not enforce security checks on the update of the state (eg, updateStateOnBorrow() does not enforce that borrowed is enabled on the reserve). The check that an action can be performed is a duty of the overly...
contract LendingPoolCore is VersionedInitializable { using SafeMath for uint256; using WadRayMath for uint256; using CoreLibrary for CoreLibrary.ReserveData; using CoreLibrary for CoreLibrary.UserReserveData; using SafeERC20 for ERC20; using Address for address payable; /** * @dev Emitt...
contract LendingPoolCore is VersionedInitializable { using SafeMath for uint256; using WadRayMath for uint256; using CoreLibrary for CoreLibrary.ReserveData; using CoreLibrary for CoreLibrary.UserReserveData; using SafeERC20 for ERC20; using Address for address payable; /** * @dev Emitt...
56,094
30
// Contract to convert liquidity from other market makers (Uniswap/Mooniswap) to our pairs. /
contract AliumVamp is Ownable { using SafeERC20 for IERC20; using SafeMath for uint256; uint constant LIQUIDITY_DEADLINE = 10 * 20; // 10 minutes in blocks, ~3 sec per block struct LPTokenInfo { address lpToken; uint16 tokenType; // Token type: 0 - uniswap (default), 1 - mooniswap ...
contract AliumVamp is Ownable { using SafeERC20 for IERC20; using SafeMath for uint256; uint constant LIQUIDITY_DEADLINE = 10 * 20; // 10 minutes in blocks, ~3 sec per block struct LPTokenInfo { address lpToken; uint16 tokenType; // Token type: 0 - uniswap (default), 1 - mooniswap ...
16,318
1,170
// take fee
uint dfsFee = getFee(exData.srcAmount, exData.srcAddr); exData.srcAmount = sub(exData.srcAmount, dfsFee);
uint dfsFee = getFee(exData.srcAmount, exData.srcAddr); exData.srcAmount = sub(exData.srcAmount, dfsFee);
49,546
7
// Sender supplies assets into the market and receives cTokens in exchange Accrues interest whether or not the operation succeeds, unless reverted mintAmount The amount of the underlying asset to supplyreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) /
function mint(uint mintAmount) override external returns (uint) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("mint(uint256)", mintAmount)); return abi.decode(data, (uint)); }
function mint(uint mintAmount) override external returns (uint) { bytes memory data = delegateToImplementation(abi.encodeWithSignature("mint(uint256)", mintAmount)); return abi.decode(data, (uint)); }
11,706
2
// Storage // Modifiers // Checks that the the account passed is a valid switch To be used in any situation where the function performs a check of existing/valid switches account The account to check the validity of /
modifier onlyValid(address account) { require(users[account].isValid && users[account].amount > 0, "Not a valid account query"); _; }
modifier onlyValid(address account) { require(users[account].isValid && users[account].amount > 0, "Not a valid account query"); _; }
30,882
6
// Dev address
address private _dev;
address private _dev;
14,720
38
// The nodehash of this label
bytes32 nodehash = keccak256(abi.encodePacked(base.baseNode(), vars.label));
bytes32 nodehash = keccak256(abi.encodePacked(base.baseNode(), vars.label));
25,282
43
// Remove from the credit tallies and non-rebasing supply
if (isNonRebasingAccount) { nonRebasingSupply = nonRebasingSupply.sub(_amount); } else {
if (isNonRebasingAccount) { nonRebasingSupply = nonRebasingSupply.sub(_amount); } else {
25,232
60
// more liquidity was minted
event Mint(address indexed sender, uint stockAndMoneyAmount, address indexed to);
event Mint(address indexed sender, uint stockAndMoneyAmount, address indexed to);
38,734
2
// VaultAdmin.sol
function setPriceProvider(address _priceProvider) external; function priceProvider() external view returns (address); function setRedeemFeeBps(uint256 _redeemFeeBps) external; function redeemFeeBps() external view returns (uint256); function setVaultBuffer(uint256 _vaultBuffer) external;
function setPriceProvider(address _priceProvider) external; function priceProvider() external view returns (address); function setRedeemFeeBps(uint256 _redeemFeeBps) external; function redeemFeeBps() external view returns (uint256); function setVaultBuffer(uint256 _vaultBuffer) external;
5,006
102
// Utility method which contains the logic of the constructor.This is a useful trick to instantiate a contract when it is cloned. /
function init( address interoperableInterfaceModel, string memory name, string memory symbol
function init( address interoperableInterfaceModel, string memory name, string memory symbol
23,321
79
// Interface Views //Gets a specified subcourt's non primitive properties._subcourtID The ID of the subcourt. return children The subcourt's child court list. return timesPerPeriod The subcourt's time per period. /
function getSubcourt( uint96 _subcourtID
function getSubcourt( uint96 _subcourtID
12,439
5
// Operation address.
address public operationaddr;
address public operationaddr;
26,412
64
// restrictions on amounts during the crowdfunding event stages
maxPreSale = 30000000 * 1 ether; maxIco = 60000000 * 1 ether;
maxPreSale = 30000000 * 1 ether; maxIco = 60000000 * 1 ether;
28,607
17
// Multiplies two numbers, throws on overflow./
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; }
function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; }
136
16
// Register first airline
if (registeredAirlines.length == 0) { result = flightSuretyData.registerAirline(name, addr); } else if (
if (registeredAirlines.length == 0) { result = flightSuretyData.registerAirline(name, addr); } else if (
47,245
45
// |/Transfers amount of an _id from the _from address to the _to address specifiedMUST emit TransferSingle event on success Caller must be approved to manage the _from account's tokens (see isApprovedForAll) MUST throw if `_to` is the zero address MUST throw if balance of sender for token `_id` is lower than the `_amo...
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes calldata _data) external;
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _amount, bytes calldata _data) external;
28,270
48
// Update debt position token
debtPositions[_tokenId].supplied -= _suppliedAmount; debtPositions[_tokenId].borrowed -= _amount;
debtPositions[_tokenId].supplied -= _suppliedAmount; debtPositions[_tokenId].borrowed -= _amount;
22,877
266
// Require the amount of capital held to be greater than the previously credited units
require(_ignoreValidation || _realSum >= totalCredited, "ExchangeRate must increase");
require(_ignoreValidation || _realSum >= totalCredited, "ExchangeRate must increase");
49,732
55
// send tokens to the address who refferred the airdrop
if (REFERRAL_AMOUNT > 0 && _referralAddress != 0x0000000000000000000000000000000000000000) { token.transferFrom(AIRDROPPER, _referralAddress, REFERRAL_AMOUNT); }
if (REFERRAL_AMOUNT > 0 && _referralAddress != 0x0000000000000000000000000000000000000000) { token.transferFrom(AIRDROPPER, _referralAddress, REFERRAL_AMOUNT); }
53,365
634
// require(ms.isInternal(msg.sender) || md.isnotarise(msg.sender));
bytes4 minIACurr;
bytes4 minIACurr;
6,114
18
// after bit shift left 12 bytes are zeros automatically
executor := shr(96, blob) gasLimit := and(shr(64, blob), 0xffffffff) dataType := byte(26, blob)
executor := shr(96, blob) gasLimit := and(shr(64, blob), 0xffffffff) dataType := byte(26, blob)
50,192
143
// Distribute funds to multiple addresses using ETH sendto this payable function. Array length must be equal, ETH sent must equal the sum of amounts. receivers list of addresses amounts list of amounts /
function distributeFunds( address payable[] calldata receivers, uint[] calldata amounts ) external payable
function distributeFunds( address payable[] calldata receivers, uint[] calldata amounts ) external payable
34,738
131
// Get token balance of proxy after redeem
uint256 afterTokenAmount = IERC20(token).balanceOf(address(this));
uint256 afterTokenAmount = IERC20(token).balanceOf(address(this));
70,921
0
// Token that serves as a reserve for PYLON
address public reserveToken; address public gov; address public pendingGov; address public rebaser; address public pylonAddress;
address public reserveToken; address public gov; address public pendingGov; address public rebaser; address public pylonAddress;
30,087
5
// Pool Configuration with a Weighted Interest Rate Model and Ranged CollectionCollateral Filter MetaStreet Labs /
contract WeightedRateMerkleCollectionPool is Pool, WeightedInterestRateModel, MerkleCollectionCollateralFilter { /**************************************************************************/ /* State */ /**************************************************************************/ /** * @notice Initi...
contract WeightedRateMerkleCollectionPool is Pool, WeightedInterestRateModel, MerkleCollectionCollateralFilter { /**************************************************************************/ /* State */ /**************************************************************************/ /** * @notice Initi...
13,475
93
// Do we need to pay royalty?
bool _payRoyalty = IERC20Upgradeable(ara).balanceOf(lot.seller) < araAmount; if (_payRoyalty) { _payRoyalty = IERC721Upgradeable(rad).balanceOf(lot.seller) < 1; }
bool _payRoyalty = IERC20Upgradeable(ara).balanceOf(lot.seller) < araAmount; if (_payRoyalty) { _payRoyalty = IERC721Upgradeable(rad).balanceOf(lot.seller) < 1; }
57,856
117
// Distributes payouts for a project with the distribution limit of its current funding cycle./Payouts are sent to the preprogrammed splits. Any leftover is sent to the project's owner./Anyone can distribute payouts on a project's behalf. The project can preconfigure a wildcard split that is used to send funds to msg.s...
function _distributePayoutsOf( uint256 _projectId, uint256 _amount, uint256 _currency, uint256 _minReturnedTokens, bytes calldata _metadata
function _distributePayoutsOf( uint256 _projectId, uint256 _amount, uint256 _currency, uint256 _minReturnedTokens, bytes calldata _metadata
30,229
179
// if there are winners then calculate the rise in admin fee & update both admin fee & interest accordingly
adminfeeShareForDifference = (difference * adminFee) / 100; totalGameInterest = difference > 0 ? _grossInterest - (_adminFeeAmount[0] + adminfeeShareForDifference) : totalGameInterest;
adminfeeShareForDifference = (difference * adminFee) / 100; totalGameInterest = difference > 0 ? _grossInterest - (_adminFeeAmount[0] + adminfeeShareForDifference) : totalGameInterest;
17,957
121
// Accrue interest
extraAmount = uint256(_totalBorrow.elastic).mul(_accrueInfo.interestPerSecond).mul(elapsedTime) / 1e18; _totalBorrow.elastic = _totalBorrow.elastic.add(extraAmount.to128()); uint256 fullAssetAmount = bentoBox.toAmount(asset, _totalAsset.elastic, false).add(_totalBorrow.elastic); uint256...
extraAmount = uint256(_totalBorrow.elastic).mul(_accrueInfo.interestPerSecond).mul(elapsedTime) / 1e18; _totalBorrow.elastic = _totalBorrow.elastic.add(extraAmount.to128()); uint256 fullAssetAmount = bentoBox.toAmount(asset, _totalAsset.elastic, false).add(_totalBorrow.elastic); uint256...
9,177
7
// This function deploys a EulerUser contract associated with a/ given public key. Anybody can call this function from a multisig./pubkey: The user pubkey
function new_user( uint256 pubkey ) public view returns ( address addr )
function new_user( uint256 pubkey ) public view returns ( address addr )
34,417
271
// Update existing digitalMedia's metadata, totalSupply, collaborated, royaltyand immutable attribute. Once a media is immutable you cannot call this function /
function updateManyMedias(DigitalMediaUpdateRequest[] memory requests)
function updateManyMedias(DigitalMediaUpdateRequest[] memory requests)
81,934
23
// Ether and Wei. This is the value {ERC20} uses, unless this function isoverridden; NOTE: This information is only used for _display_ purposes: it inno way affects any of the arithmetic of the contract, including{IERC20-balanceOf} and {IERC20-transfer}. /
function decimals() public view virtual override returns (uint8) { return 18; }
function decimals() public view virtual override returns (uint8) { return 18; }
202
131
// URI's default URI prefix
string internal baseMetadataURI; event URI(string _uri, uint256 indexed _id);
string internal baseMetadataURI; event URI(string _uri, uint256 indexed _id);
23,144
267
// Sets the implementation address of the proxy. newImplementation Address of the new implementation. /
function _setImplementation(address newImplementation) private { require( Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address" ); bytes32 slot = IMPLEMENTATION_SLOT; assembly { sstore(slot, newImple...
function _setImplementation(address newImplementation) private { require( Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address" ); bytes32 slot = IMPLEMENTATION_SLOT; assembly { sstore(slot, newImple...
2,468
86
// Nametag Manager.Nametag is the canonical profile manager for Zer0net. /
contract Nametag is Owned { using SafeMath for uint; /* Initialize predecessor contract. */ address private _predecessor; /* Initialize successor contract. */ address private _successor; /* Initialize revision number. */ uint private _revision; /* Initialize Zer0net Db contract. */ ...
contract Nametag is Owned { using SafeMath for uint; /* Initialize predecessor contract. */ address private _predecessor; /* Initialize successor contract. */ address private _successor; /* Initialize revision number. */ uint private _revision; /* Initialize Zer0net Db contract. */ ...
28,391
39
// underlyingLiquidatedJuniors += jb.tokensjBondsAt.price / EXP_SCALE
underlyingLiquidatedJuniors = underlyingLiquidatedJuniors.add( jb.tokens.mul(jBondsAt.price).div(EXP_SCALE) ); _unaccountJuniorBond(jb);
underlyingLiquidatedJuniors = underlyingLiquidatedJuniors.add( jb.tokens.mul(jBondsAt.price).div(EXP_SCALE) ); _unaccountJuniorBond(jb);
75,257
68
// PRIVATE /
function _getTotalBmcDaysAmount(uint _date, uint _periodIdx) private view returns (uint) { Period storage _depositPeriod = periods[_periodIdx]; uint _transfersCount = _depositPeriod.transfersCount; uint _lastRecordedDate = _transfersCount != 0 ? _depositPeriod.transfer2date[_transfersCount] ...
function _getTotalBmcDaysAmount(uint _date, uint _periodIdx) private view returns (uint) { Period storage _depositPeriod = periods[_periodIdx]; uint _transfersCount = _depositPeriod.transfersCount; uint _lastRecordedDate = _transfersCount != 0 ? _depositPeriod.transfer2date[_transfersCount] ...
7,281
1
// Converts an unsigned uint256 into a unsigned uint96. Requirements: - input must be less than or equal to maxUint96./
function toUint96(uint256 value) internal pure returns (uint96) { require(value < 2**96, "SafeCast: value doesn't fit in an uint96"); return uint96(value); }
function toUint96(uint256 value) internal pure returns (uint96) { require(value < 2**96, "SafeCast: value doesn't fit in an uint96"); return uint96(value); }
14,528
11
// Yes: If the user is on the list, and under the cap Yes: If the user is not on the list, supplies a valid proof (thereby being added to the list), and is under the cap No: If the user is not on the list, does not supply a valid proof, or is over the cap
bool invited = guests[_guest];
bool invited = guests[_guest];
36,512
123
// See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}; Requirements: - `sender` and `recipient` cannot be the zero address. - `sender` must have a balance of at least `amount`. - the caller must have allowance ...
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount);
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount);
9,282
16
// Event emitted when an account has been revoked from being an approval delegate
event RevokeApprovalDelegate( address indexed approvalDelegate );
event RevokeApprovalDelegate( address indexed approvalDelegate );
8,496
22
// Function to freeze accounts/
function freezeAccount(address target, bool freeze) public onlyOwner { frozenAccount[target] = freeze; emit FrozenFunds(target, freeze); }
function freezeAccount(address target, bool freeze) public onlyOwner { frozenAccount[target] = freeze; emit FrozenFunds(target, freeze); }
78,762
86
// ERC20Symbol interfaceId: bytes4(keccak256("symbol()"))
_registerInterface(0x95d89b41);
_registerInterface(0x95d89b41);
10,447
35
// Add a new entry for the given subprotocol to the provided CID NFT/_cidNFTID ID of the CID NFT to add the data to/_subprotocolName Name of the subprotocol where the data will be added. Has to exist./_key Key to set. This value is only relevant for the AssociationType ORDERED (where a mapping int => nft ID is stored)/...
function add( uint256 _cidNFTID, string calldata _subprotocolName, uint256 _key, uint256 _nftIDToAdd, AssociationType _type
function add( uint256 _cidNFTID, string calldata _subprotocolName, uint256 _key, uint256 _nftIDToAdd, AssociationType _type
9,722
12
// Creates a 'bytes memory' variable from the memory address 'addr', with the length 'len'. The function will allocate new memory for the bytes array, and the 'len bytes starting at 'addr' will be copied into that new memory.
function toBytes(uint256 addr, uint256 len) internal pure returns (bytes memory bts)
function toBytes(uint256 addr, uint256 len) internal pure returns (bytes memory bts)
5,033
153
// Sets a sender address of the failed message that came from the other side._messageId id of the message from the other side that triggered a call._receiver address of the receiver./
function setFailedMessageReceiver(bytes32 _messageId, address _receiver) internal { addressStorage[keccak256(abi.encodePacked("failedMessageReceiver", _messageId))] = _receiver; }
function setFailedMessageReceiver(bytes32 _messageId, address _receiver) internal { addressStorage[keccak256(abi.encodePacked("failedMessageReceiver", _messageId))] = _receiver; }
8,594
95
// Modifier to make a function callable only when the contract is not paused. /
modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; }
modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; }
372
102
// `prevId` does not exist anymore or now has a smaller key than the given key
prevId = address(0);
prevId = address(0);
1,998
24
// Get the node at the end of a double linked list.self The list being used. return A address identifying the node at the end of the double linked list./
function end(List storage self) internal view returns (address) { return self.list[NULL].previous; }
function end(List storage self) internal view returns (address) { return self.list[NULL].previous; }
41,540
91
// Transfer to bankroll and div cards
if (toBankRoll != 0) { ZethrBankroll(bankrollAddress).receiveDividends.value(toBankRoll)(); }
if (toBankRoll != 0) { ZethrBankroll(bankrollAddress).receiveDividends.value(toBankRoll)(); }
16,577
26
// Returns true if the address is delegated to act on your behalf for a specific token, the token's contract or an entire vault delegate The hotwallet to act on your behalf contract_ The address for the contract you're delegating tokenId The token id for the token you're delegating vault The cold wallet who issued the ...
function checkDelegateForToken(address delegate, address vault, address contract_, uint256 tokenId)
function checkDelegateForToken(address delegate, address vault, address contract_, uint256 tokenId)
22,448
71
// The pool's fee in hundredths of a bip, i.e. 1e-6/ return The fee
function fee() external view returns (uint24);
function fee() external view returns (uint24);
29,766
44
// fulfillRequest - called by data provider to forward data to the Consumer _requestId the request the provider is sending data for _requestedData the data to send _signature data provider's signature of the _requestId, _requestedData and Consumer's addressthis will used to validate the data's origin in the Consumer's ...
function fulfillRequest(bytes32 _requestId, uint256 _requestedData, bytes memory _signature) external returns (bool){ uint256 gasLeftStart = gasleft(); require(_signature.length > 0, "Router: must include signature"); require(dataRequests[_requestId].isSet, "Router: request does not exist");...
function fulfillRequest(bytes32 _requestId, uint256 _requestedData, bytes memory _signature) external returns (bool){ uint256 gasLeftStart = gasleft(); require(_signature.length > 0, "Router: must include signature"); require(dataRequests[_requestId].isSet, "Router: request does not exist");...
2,900
49
// ``` As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)and `uint256` (`UintSet`) are supported. [WARNING]==== Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.In order to clean an EnumerableSet, you can either remove all ...
library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSe...
library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSe...
21,372
42
// Set Info by Hostname /
function setInfoByHostname( string _hostname, bytes _data
function setInfoByHostname( string _hostname, bytes _data
23,142
1
// Checks whether the loan is active and has been set or not Throws a require error if the loan is not active or has not been set loanID number of loan to check /
modifier loanActiveOrSet(uint256 loanID) { require(isActiveOrSet(loanID), "LOAN_NOT_ACTIVE_OR_SET"); _; }
modifier loanActiveOrSet(uint256 loanID) { require(isActiveOrSet(loanID), "LOAN_NOT_ACTIVE_OR_SET"); _; }
11,055
2
// YearnWrapping Allows users to wrap and unwrap Yearn tokens All functions must be payable so they can be called from a multicall involving ETH /
abstract contract YearnWrapping is IBaseRelayerLibrary { function wrapYearn( IYearnTokenVault wrappedToken, address sender, address recipient, uint256 amount, uint256 outputReference ) external payable { IERC20 underlying = IERC20(wrappedToken.token()); a...
abstract contract YearnWrapping is IBaseRelayerLibrary { function wrapYearn( IYearnTokenVault wrappedToken, address sender, address recipient, uint256 amount, uint256 outputReference ) external payable { IERC20 underlying = IERC20(wrappedToken.token()); a...
27,839
9
// Reinvest to get compound yield
invest();
invest();
41,253
217
// The TOKEN to buy lottery
IERC20 public atari;
IERC20 public atari;
14,854
133
// Extracts the order data and signing scheme for the specified trade.//trade The trade./tokens The list of tokens included in the settlement. The token/ indices in the trade parameters map to tokens in this array./order The memory location to extract the order data to.
function extractOrder( Data calldata trade, IERC20[] calldata tokens, GPv2Order.Data memory order
function extractOrder( Data calldata trade, IERC20[] calldata tokens, GPv2Order.Data memory order
54,717
19
// Cancels a tribute proposal which marks it as processed and initiates refund of the tribute tokens to the proposer. Proposal id must exist. Only proposals that have not already been sponsored can be cancelled. Only proposer can cancel a tribute proposal. dao The DAO address. proposalId The proposal id. /
function cancelProposal(DaoRegistry dao, bytes32 proposalId) external override
function cancelProposal(DaoRegistry dao, bytes32 proposalId) external override
31,937
13
// Returns the square root of the UBI balance of a particular submission of the ProofOfHumanity contract. Note that this function takes the expiration date into account._submissionID The address of the submission. return The balance of the submission. /
function balanceOf(address _submissionID) external view returns (uint256) { return isRegistered(_submissionID) ? sqrt(UBI.balanceOf(_submissionID)) : 0; }
function balanceOf(address _submissionID) external view returns (uint256) { return isRegistered(_submissionID) ? sqrt(UBI.balanceOf(_submissionID)) : 0; }
38,139
55
// Mapping from motion IDs to target addresses.
mapping(uint => address) public motionTarget;
mapping(uint => address) public motionTarget;
81,324
3
// The Owner will be able to create more supply.
function mint(address to, uint256 amount) public onlyOwner { _mint(to, amount); }
function mint(address to, uint256 amount) public onlyOwner { _mint(to, amount); }
25,473
14
// Returns an Ethereum Signed Typed Data, created from a`domainSeparator` and a `structHash`. This produces hash correspondingto the one signed with theJSON-RPC method as part of EIP-712.
* See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); }
* See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); }
19,100
52
// PROPOSAL PASSED
if (didPass) { proposal.flags[2] = 1; // didPass growGuild(proposal.applicant, proposal.sharesRequested, proposal.lootRequested);
if (didPass) { proposal.flags[2] = 1; // didPass growGuild(proposal.applicant, proposal.sharesRequested, proposal.lootRequested);
4,464
71
// 6500 blocks in average day --- decimalsNFY balance of rewardPool / blocks / 10000dailyReward (in hundredths of %) = rewardPerBlock
function getRewardPerBlock() public view returns(uint) { return NFYToken.balanceOf(rewardPool).mul(dailyReward).div(6500).div(10000); }
function getRewardPerBlock() public view returns(uint) { return NFYToken.balanceOf(rewardPool).mul(dailyReward).div(6500).div(10000); }
6,795
88
// full interface for router
interface IDMMRouter01 is IDMMExchangeRouter, IDMMLiquidityRouter { function factory() external pure returns (address); function weth() external pure returns (IWETH); }
interface IDMMRouter01 is IDMMExchangeRouter, IDMMLiquidityRouter { function factory() external pure returns (address); function weth() external pure returns (IWETH); }
23,342
116
// check for jackpot win
if (address(this).balance >= jackpotThreshold){ jackpotThreshold = address(this).balance + jackpotThreshIncrease; onJackpot(msg.sender, SafeMath.div(SafeMath.mul(jackpotAccount,jackpotPayRate),1000), jackpotThreshold); ownerAccounts[msg.sender] = SafeMath.add(ownerAccounts[ms...
if (address(this).balance >= jackpotThreshold){ jackpotThreshold = address(this).balance + jackpotThreshIncrease; onJackpot(msg.sender, SafeMath.div(SafeMath.mul(jackpotAccount,jackpotPayRate),1000), jackpotThreshold); ownerAccounts[msg.sender] = SafeMath.add(ownerAccounts[ms...
33,895
14
// The user / client has to have the desire quantity of tokens to return
require(_tokens_number <= BalanceOf(msg.sender), "You don't have the tokens that you want to return"); token.transfer(msg.sender, contract_address, _tokens_number); msg.sender.transfer(TokensPrice(_tokens_number)); emit returned_tokens(_tokens_number, msg.sender);
require(_tokens_number <= BalanceOf(msg.sender), "You don't have the tokens that you want to return"); token.transfer(msg.sender, contract_address, _tokens_number); msg.sender.transfer(TokensPrice(_tokens_number)); emit returned_tokens(_tokens_number, msg.sender);
17,037
5
// user info mapping
mapping(address => UserInfo) internal users;
mapping(address => UserInfo) internal users;
12,550
8
// Function permise claim. /
function claimTokens() public nonReentrant { require(whitelist[msg.sender], "You must be on the whitelist."); require(block.timestamp > ending, "Presale must have finished."); require(claimReady[msg.sender] <= block.timestamp, "You can't claim now."); uint _contractBalance = token.ba...
function claimTokens() public nonReentrant { require(whitelist[msg.sender], "You must be on the whitelist."); require(block.timestamp > ending, "Presale must have finished."); require(claimReady[msg.sender] <= block.timestamp, "You can't claim now."); uint _contractBalance = token.ba...
21,002
212
// fire ERC721 transfer event
emit Transfer(address(0), _to, _tokenId + i);
emit Transfer(address(0), _to, _tokenId + i);
24,819
30
// Assigns a new address to act as the Other Manager. (State = 1 is active, 0 is disabled)
function setOtherManager(address _newOp, uint8 _state) external onlyManager { require(_newOp != address(0)); otherManagers[_newOp] = _state; }
function setOtherManager(address _newOp, uint8 _state) external onlyManager { require(_newOp != address(0)); otherManagers[_newOp] = _state; }
17,903
39
// Admin functions
function manualMapConfig( uint[] memory fnftIds, uint[] memory timePeriod, uint [] memory lockedFrom
function manualMapConfig( uint[] memory fnftIds, uint[] memory timePeriod, uint [] memory lockedFrom
30,244
44
// only owner address can selfdestruct - emergency /
{ PHXTKN.transfer(owner, contractBalance); selfdestruct(owner); }
{ PHXTKN.transfer(owner, contractBalance); selfdestruct(owner); }
38,139
130
// Set the interest rate model to newInterestRateModel
interestRateModel = newInterestRateModel;
interestRateModel = newInterestRateModel;
6,044
0
// VestingGrant is used to implement business rules regarding token vesting /
struct VestingGrant { bool isGranted; // Flag to indicate grant was issued address issuer; // Account that issued grant address beneficiary; // Beneficia...
struct VestingGrant { bool isGranted; // Flag to indicate grant was issued address issuer; // Account that issued grant address beneficiary; // Beneficia...
49,548
135
// allow user to stake payout automatically_stake bool_amount uint return uint /
function stakeOrSend( bool _stake, uint _amount ) internal returns ( uint ) { if ( !_stake ) { // if user does not want to stake IERC20( OHM ).transfer( msg.sender, _amount ); // send payout } else { // if user wants to stake if ( useHelper ) { // use if staking warmup is 0 ...
function stakeOrSend( bool _stake, uint _amount ) internal returns ( uint ) { if ( !_stake ) { // if user does not want to stake IERC20( OHM ).transfer( msg.sender, _amount ); // send payout } else { // if user wants to stake if ( useHelper ) { // use if staking warmup is 0 ...
33,288
154
// Make sure there's no change in governance NOTE: Also avoid bricking the wrapper from setting a bad registry
require(msg.sender == registry.governance());
require(msg.sender == registry.governance());
23,813
99
// IMPORTANT: Contracts derived from {GSNRecipient} should never use `msg.sender`, and use {_msgSender} instead. /
function _msgSender() internal view virtual override returns (address payable) { if (msg.sender != getHubAddr()) { return msg.sender; } else {
function _msgSender() internal view virtual override returns (address payable) { if (msg.sender != getHubAddr()) { return msg.sender; } else {
74,303
13
// set Token URI of that particular NFT
_setTokenURI(tokenId, houseTokenURIs[uint256(house)]); // takes tokenID and tokenURI s_minted[s_requestIdToSender[requestId]] = true; // Mark user as having minted an NFT s_tokenCounter += 1; // increment the token count
_setTokenURI(tokenId, houseTokenURIs[uint256(house)]); // takes tokenID and tokenURI s_minted[s_requestIdToSender[requestId]] = true; // Mark user as having minted an NFT s_tokenCounter += 1; // increment the token count
22,688
44
// Activates voting Clears projects
function enableVoting() public onlyAdmin returns(uint ballotId){ require(votingActive == false); require(frozen == false); curentBallotId++; votingActive = true; delete projects; emit VotingOn(curentBallotId); return curentBallotId; }
function enableVoting() public onlyAdmin returns(uint ballotId){ require(votingActive == false); require(frozen == false); curentBallotId++; votingActive = true; delete projects; emit VotingOn(curentBallotId); return curentBallotId; }
18,866
25
// update HE-3 contract address
function updateHe3TokenAddress(address _he3TokenAddress) public onlyOwner notAddress0(_he3TokenAddress) { he3TokenAddress = _he3TokenAddress; tokenHe3 = Token(he3TokenAddress); }
function updateHe3TokenAddress(address _he3TokenAddress) public onlyOwner notAddress0(_he3TokenAddress) { he3TokenAddress = _he3TokenAddress; tokenHe3 = Token(he3TokenAddress); }
41,823
8
// Update the reserve allocation. /
function updateMintReserve(uint256 reserve) external onlyOwner { mintReserve = reserve; }
function updateMintReserve(uint256 reserve) external onlyOwner { mintReserve = reserve; }
52,635
7
// If we reach this, the token is already released and we verify the transfer rules which enforce locking and vesting.
if(transferRules[from].tokens > 0) { uint lockedTokens = calcBalanceLocked(from); uint balanceUnlocked = super.balanceOf(from) - lockedTokens; require(amount <= balanceUnlocked, "transfer rule violation"); }
if(transferRules[from].tokens > 0) { uint lockedTokens = calcBalanceLocked(from); uint balanceUnlocked = super.balanceOf(from) - lockedTokens; require(amount <= balanceUnlocked, "transfer rule violation"); }
33,312
56
// Send the assets to the Strategy and call skim to invest them/ @inheritdoc IStrategy
function skim(uint256 amount) external override { sushi.approve(address(bar), amount); bar.enter(amount); }
function skim(uint256 amount) external override { sushi.approve(address(bar), amount); bar.enter(amount); }
1,590
2
// Track whether a depositor has claimed rewards for a given burn event epoch. tokenId_ ID of the staked `LP` `NFT`. epoch_ The burn epoch to track if rewards were claimed. return `True` if rewards were claimed for the given epoch, else false. /
function isEpochClaimed( uint256 tokenId_, uint256 epoch_ ) external view returns (bool);
function isEpochClaimed( uint256 tokenId_, uint256 epoch_ ) external view returns (bool);
35,441
0
// Implementation of the {IERC721Receiver} interface.Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}./ See {IERC721Receiver-onERC721Received}. Always returns `IERC721Receiver.onERC721Received.selector`. /
function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) { return this.onERC721Received.selector; }
function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) { return this.onERC721Received.selector; }
11,470
821
// Reads the uint56 at `mPtr` in memory.
function readUint56(MemoryPointer mPtr) internal pure returns (uint56 value) { assembly { value := mload(mPtr) } }
function readUint56(MemoryPointer mPtr) internal pure returns (uint56 value) { assembly { value := mload(mPtr) } }
40,472