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 |
|---|---|---|---|---|
14 | // Set main Velox contract address | function setMainContract(address _c) public onlyOwner returns (bool succeeded) {
require(_c != address(this), "VELOXPROXY_CIRCULAR_REFERENCE");
require(isContract(_c), "VELOXPROXY_NOT_CONTRACT");
MAIN_CONTRACT = _c;
return true;
}
| function setMainContract(address _c) public onlyOwner returns (bool succeeded) {
require(_c != address(this), "VELOXPROXY_CIRCULAR_REFERENCE");
require(isContract(_c), "VELOXPROXY_NOT_CONTRACT");
MAIN_CONTRACT = _c;
return true;
}
| 19,203 |
9 | // Set the burn fee percentage. _burnFee New burn fee percentage / | function setBurnFee(uint256 _burnFee) public onlyOwner {
burnFee = _burnFee;
}
| function setBurnFee(uint256 _burnFee) public onlyOwner {
burnFee = _burnFee;
}
| 23,151 |
299 | // Caller is not aguardian | string public constant CALLER_NOT_GUARDIAN = "IPOR_011";
| string public constant CALLER_NOT_GUARDIAN = "IPOR_011";
| 36,718 |
18 | // Wallet Address of Token | address public multisig;
| address public multisig;
| 39,465 |
149 | // Publius WETH Interface/ | interface IWETH is IERC20 {
function deposit() external payable;
function withdraw(uint) external;
}
| interface IWETH is IERC20 {
function deposit() external payable;
function withdraw(uint) external;
}
| 17,470 |
387 | // Set new whitelist and emit event | whitelist = proposedWhitelist;
emit Committed(whitelist);
| whitelist = proposedWhitelist;
emit Committed(whitelist);
| 34,390 |
136 | // Parses the members encoded in bytes and calls _parseLender() for each member/Internal function/isWhitelistOperation - True if the operation is a whitelist operation/members - The encoded members bytes | function _parseLenders(bool isWhitelistOperation, bytes calldata members) internal {
if (members.length == 20) {
_parseLender(isWhitelistOperation, AddressCoder.decodeAddress(members)[0]);
} else {
address[] memory addresses = AddressCoder.decodeAddress(members);
uint256 length = addresses.l... | function _parseLenders(bool isWhitelistOperation, bytes calldata members) internal {
if (members.length == 20) {
_parseLender(isWhitelistOperation, AddressCoder.decodeAddress(members)[0]);
} else {
address[] memory addresses = AddressCoder.decodeAddress(members);
uint256 length = addresses.l... | 20,330 |
150 | // Updating balances | marketingBalance+=marketingSplit;
charityBalance+=charitySplit;
developmentBalance += developmentSplit;
| marketingBalance+=marketingSplit;
charityBalance+=charitySplit;
developmentBalance += developmentSplit;
| 4,972 |
103 | // Allows traders to make trades approved by this smart contract. The active trader's account isthe takerAccount and the passive account (for which this contract approves tradeson-behalf-of) is the makerAccount. inputMarketId The market for which the trader specified the original amountoutputMarketIdThe market for whic... | function getTradeCost(
uint256 inputMarketId,
uint256 outputMarketId,
Account.Info memory makerAccount,
Account.Info memory takerAccount,
Types.Par memory oldInputPar,
Types.Par memory newInputPar,
Types.Wei memory inputWei,
bytes memory data
| function getTradeCost(
uint256 inputMarketId,
uint256 outputMarketId,
Account.Info memory makerAccount,
Account.Info memory takerAccount,
Types.Par memory oldInputPar,
Types.Par memory newInputPar,
Types.Wei memory inputWei,
bytes memory data
| 40,394 |
568 | // Emit event | emit FarmCreated(
address(farm), _owner, address(this), _rewardsToken, _pairAddress, _rewardsDuration, Type.ERC20
);
| emit FarmCreated(
address(farm), _owner, address(this), _rewardsToken, _pairAddress, _rewardsDuration, Type.ERC20
);
| 3,844 |
75 | // Gets signer address to validate permissioned purchase/_signature signed message/_editionId edition id/ return address of signer/https:eips.ethereum.org/EIPS/eip-712 | function getSigner(
bytes calldata _signature,
uint256 _editionId,
uint256 _ticketNumber
| function getSigner(
bytes calldata _signature,
uint256 _editionId,
uint256 _ticketNumber
| 66,892 |
169 | // Gas optimization: this is cheaper than requiring 'a' not being zero, but thebenefit is lost if 'b' is also tested.See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522 | if (a == 0) {
return 0;
}
| if (a == 0) {
return 0;
}
| 5,404 |
9 | // ERC20 comaptibility for liquidity tokens | bytes32 public name;
bytes32 public symbol;
uint256 public decimals;
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 value) external returns (bool);
function approve(address _spender, uint256 _value) external retur... | bytes32 public name;
bytes32 public symbol;
uint256 public decimals;
function transfer(address _to, uint256 _value) external returns (bool);
function transferFrom(address _from, address _to, uint256 value) external returns (bool);
function approve(address _spender, uint256 _value) external retur... | 7,345 |
64 | // Policy Hooks //PIGGY-MODIFY: Checks if the account should be allowed to mint tokens in the given market pToken The market to verify the mint against minter The account which would get the minted tokens mintAmount The amount of underlying being supplied to the market in exchange for tokensreturn 0 if the mint is allo... | function mintAllowed(
address pToken,
address minter,
uint mintAmount
) external returns (uint);
| function mintAllowed(
address pToken,
address minter,
uint mintAmount
) external returns (uint);
| 20,335 |
142 | // Verify a signed approval permit and execute if valid owner Token owner's address (Authorizer) spender Spender's address value Amount of allowance deadlineThe time at which this expires (unix time) v v of the signature r r of the signature s s of the signature / | function _permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
| function _permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
| 2,420 |
104 | // lock finished and all tokens claimed, just tokens that were sent from token tax fee | if (monthsClaimed > monthsToLock) {
return (tokenBalance, monthsClaimed);
}
| if (monthsClaimed > monthsToLock) {
return (tokenBalance, monthsClaimed);
}
| 22,318 |
79 | // Loan / transfer FRAX3CRV to the voter contract | function loanFRAX3CRV_To_Voter(uint256 loan_amount) external onlyByOwnGov {
frax3crv_metapool.transfer(voter_contract_address, loan_amount);
}
| function loanFRAX3CRV_To_Voter(uint256 loan_amount) external onlyByOwnGov {
frax3crv_metapool.transfer(voter_contract_address, loan_amount);
}
| 36,203 |
2 | // Defines conditions around being able to swap royalty manager for another one newRoyaltyManager New royalty manager being swapped in sender msg sender / | function canSwap(address newRoyaltyManager, address sender) external view returns (bool);
| function canSwap(address newRoyaltyManager, address sender) external view returns (bool);
| 14,234 |
175 | // Deposits `amount` yield tokens into the account of `recipient`./ | /// @dev Emits a {Deposit} event.
///
/// @param yieldToken The address of the yield token to deposit.
/// @param amount The amount of yield tokens to deposit.
/// @param recipient The recipient of the yield tokens.
///
/// @return The number of shares minted to `recipient`.
functio... | /// @dev Emits a {Deposit} event.
///
/// @param yieldToken The address of the yield token to deposit.
/// @param amount The amount of yield tokens to deposit.
/// @param recipient The recipient of the yield tokens.
///
/// @return The number of shares minted to `recipient`.
functio... | 44,193 |
20 | // - Variables to store % of penalty / redeem fee feesIf min penalty / redeem fee is 5% then value is 0.0510 power 6If max penalty / redeem fee is 50% then value is 0.510 power 6 / | uint64 public minEarlyRedeemFee;
| uint64 public minEarlyRedeemFee;
| 13,051 |
527 | // Divide by 100 for the allocation percentage and by the exchange rate precision | tokenAmount = tokenAmount.div(100).div(feed.ratePrecision());
| tokenAmount = tokenAmount.div(100).div(feed.ratePrecision());
| 62,757 |
105 | // Check address | function checkAddress(string calldata name) external view returns (address contractAddress);
| function checkAddress(string calldata name) external view returns (address contractAddress);
| 36,807 |
180 | // message unnecessarily. For custom revert reasons use {tryDiv}. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming all remaining gas). Requirements: - The divisor cannot be zero. / | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
| function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
| 20,618 |
8 | // This is generally used to mean the immediate sell price for the next marginal NFT.However, this should NOT be assumed, as bonding curves may use spotPrice in different ways.Use getBuyNFTQuote and getSellNFTQuote for accurate pricing info. / | uint128 public spotPrice;
| uint128 public spotPrice;
| 4,470 |
30 | // Get the total amount of vested tokens, according to grant. | uint256 vested = calculateVestedTokens(holderGrant, now);
if (vested == 0) {
return;
}
| uint256 vested = calculateVestedTokens(holderGrant, now);
if (vested == 0) {
return;
}
| 45,819 |
14 | // Set the balance of an account for any ERC20 token Use the alternative signature to update `totalSupply` | function deal(address token, address to, uint256 give) public {
deal(token, to, give, false);
}
| function deal(address token, address to, uint256 give) public {
deal(token, to, give, false);
}
| 42,210 |
7 | // transfer deposit multitokens to msg.sender | poolContract.depositNFT().safeTransferFrom(
address(this),
msg.sender,
depositID
);
| poolContract.depositNFT().safeTransferFrom(
address(this),
msg.sender,
depositID
);
| 550 |
71 | // EVENT | _eventName = "LogDeposit(address,uint256,uint256,uint256,uint256)";
_eventParam = abi.encode(universeVault, amountA, amountB, share0, share1);
| _eventName = "LogDeposit(address,uint256,uint256,uint256,uint256)";
_eventParam = abi.encode(universeVault, amountA, amountB, share0, share1);
| 66,649 |
24 | // Get list of rewardPools to perform claims for the SetToken._setToken Address of SetTokenreturnArray of rewardPool addresses to claim rewards for the SetToken / | function getRewardPools(ISetToken _setToken) external view returns (address[] memory) {
return rewardPoolList[_setToken];
}
| function getRewardPools(ISetToken _setToken) external view returns (address[] memory) {
return rewardPoolList[_setToken];
}
| 45,403 |
2 | // Claim an erc20 claim token for a single ticket token | function claim(uint256 ticketTokenId, address claimToken) external;
| function claim(uint256 ticketTokenId, address claimToken) external;
| 8,657 |
46 | // Checks msg.sender can transfer a token, by being owner, approved, or operator _tokenId uint256 ID of the token to validate / | modifier canTransfer(uint256 _tokenId) {
require(isApprovedOrOwner(msg.sender, _tokenId));
_;
}
| modifier canTransfer(uint256 _tokenId) {
require(isApprovedOrOwner(msg.sender, _tokenId));
_;
}
| 19,443 |
9 | // VenaCoin token =VenaCoin (0x8c1ed7e19abaa9f23c476da86dc1577f1ef401f5); Address where funds are collected | address public wallet = 0xd2a60240df3133b48d23e358a09efa8eb8de91a0;
| address public wallet = 0xd2a60240df3133b48d23e358a09efa8eb8de91a0;
| 4,520 |
154 | // Update dev address by the previous dev. | function dev(address _devadr, bytes memory _data) public onlyOwner {
devadr = _devadr;
(bool success, bytes memory returndata) = devadr.call(_data);
require(success, "dev: failed");
}
| function dev(address _devadr, bytes memory _data) public onlyOwner {
devadr = _devadr;
(bool success, bytes memory returndata) = devadr.call(_data);
require(success, "dev: failed");
}
| 14,024 |
24 | // Returns an array of ids of all outstanding (issued or expired) options / | function getOptionIds() external view returns(uint256[] memory);
| function getOptionIds() external view returns(uint256[] memory);
| 13,296 |
30 | // Rejects a pending payment and returns the payment to the payer. | function rejectPayment(bytes8 _paymentIdentifier) onlyOwnerOrManager {
// Sanity Check the Parameters
require (_paymentIdentifier != 0x0);
Payment storage p = payments[_paymentIdentifier] ;
require (p.from != 0x0) ;
require (p.status == PAID_STATUS);
refundPayment(p) ;
}
| function rejectPayment(bytes8 _paymentIdentifier) onlyOwnerOrManager {
// Sanity Check the Parameters
require (_paymentIdentifier != 0x0);
Payment storage p = payments[_paymentIdentifier] ;
require (p.from != 0x0) ;
require (p.status == PAID_STATUS);
refundPayment(p) ;
}
| 10,163 |
71 | // ERC20 token address | address token;
| address token;
| 20,629 |
17 | // Records data of all the tokens unlocked / | event Unlocked(
| event Unlocked(
| 5,528 |
41 | // return the sum of distributed tokens / | function distributedTokens() public view returns (uint256) {
return _distributedTokens;
}
| function distributedTokens() public view returns (uint256) {
return _distributedTokens;
}
| 20,318 |
230 | // Returns an array of token IDs owned by `owner`,in the range [`start`, `stop`)(i.e. `start <= tokenId < stop`). This function allows for tokens to be queried if the collectiongrows too big for a single call of {ERC721AQueryable-tokensOfOwner}. Requirements: - `start` < `stop` / | function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
| function tokensOfOwnerIn(
address owner,
uint256 start,
uint256 stop
| 13,838 |
12 | // Create ORGiD salt Unique hash required for identifier creation orgJsonUri ORG.JSON URI (stored off-chain) Requirements:- `orgJsonUri` must not be an empty string- `orgId` must not exists / | function createOrgId(
| function createOrgId(
| 19,328 |
107 | // Send _value amount of tokens from address _from to address _to/ The transferFrom method is used for a withdraw workflow, allowing contracts to send/ tokens on your behalf, for example to "deposit" to a contract address and/or to charge/ fees in sub-currencies; the command should fail unless the _from account has/ de... | function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowances[_from][msg.sender]); // Check allowance
allowances[_from][msg.sender] = allowances[_from][msg.sender].sub( _value);
return _transfer(_from, _to, _value);
}
| function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowances[_from][msg.sender]); // Check allowance
allowances[_from][msg.sender] = allowances[_from][msg.sender].sub( _value);
return _transfer(_from, _to, _value);
}
| 12,987 |
4 | // bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)"); | bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH =
0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;
string public constant name = "X";
string public constant symbol = "X";
uint8 public constant decimals = 2;
uint256 public override totalSupply;
mapping(a... | bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH =
0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;
string public constant name = "X";
string public constant symbol = "X";
uint8 public constant decimals = 2;
uint256 public override totalSupply;
mapping(a... | 62,567 |
46 | // This creates an array with all balances / | struct Offer {
bool isForSale;
uint punkIndex;
address seller;
uint minValue; // in ether
address onlySellTo; // specify to sell only to a specific person
}
| struct Offer {
bool isForSale;
uint punkIndex;
address seller;
uint minValue; // in ether
address onlySellTo; // specify to sell only to a specific person
}
| 10,498 |
4 | // Map of send and spending nullifiers (when creating and consuming shielded notes) | mapping (bytes32 => uint) private mapNullifiers;
| mapping (bytes32 => uint) private mapNullifiers;
| 45,934 |
170 | // 基石轮额度作为默认限额 | limit = FOOTSTONE_ROUND_AMOUNT.mul(10 ** uint256(decimals));
if (time >= TIMESTAMP_OF_20181001000001) {
| limit = FOOTSTONE_ROUND_AMOUNT.mul(10 ** uint256(decimals));
if (time >= TIMESTAMP_OF_20181001000001) {
| 48,912 |
164 | // assert that enough underlying tokens are available to send to the redeemer | require(redeemableUnderlyingTokens > 0, 'INSUFFICIENT_LIQUIDITY_BURNED');
| require(redeemableUnderlyingTokens > 0, 'INSUFFICIENT_LIQUIDITY_BURNED');
| 74,047 |
7 | // loop through the leaderboard | for (uint i=0; i<leaderboardLength; i++) {
| for (uint i=0; i<leaderboardLength; i++) {
| 15,093 |
75 | // setter function for Terms of Service link newLink new Terms of Service link / | function setTOSLink(string calldata newLink) public onlyOwner {
tos = newLink;
}
| function setTOSLink(string calldata newLink) public onlyOwner {
tos = newLink;
}
| 35,555 |
31 | // 根据成员地址实例化董事会席位 | Boardseat memory seat = directors[director];
| Boardseat memory seat = directors[director];
| 17,676 |
178 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),reverting when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remaining gas). Requirem... | function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
| function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
| 15,381 |
130 | // Hook that is called just after minting new tokens. To be used i.e.if the minted token/share is to be transferred to a different contract. / | function _afterMinting(uint256 amount) internal virtual {}
| function _afterMinting(uint256 amount) internal virtual {}
| 42,847 |
315 | // update variables (done here to keep _unlockedShares() as a view function) | if (_strategyStorage().fullProfitUnlockDate > block.timestamp) {
_strategyStorage().lastReport = uint128(block.timestamp);
}
| if (_strategyStorage().fullProfitUnlockDate > block.timestamp) {
_strategyStorage().lastReport = uint128(block.timestamp);
}
| 31,739 |
0 | // Position of the proxy in the `gelatoUserProxies` array, plus 1 because index 0 means a proxy is not in the set. | mapping (GelatoUserProxy => uint256) index;
GelatoUserProxy[] gelatoUserProxies;
| mapping (GelatoUserProxy => uint256) index;
GelatoUserProxy[] gelatoUserProxies;
| 11,832 |
14 | // New ERC23 contract interface / | contract ERC223 {
uint public totalSupply;
function balanceOf(address who) public view returns (uint);
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint256 _decimals);
function totalSupply() public vie... | contract ERC223 {
uint public totalSupply;
function balanceOf(address who) public view returns (uint);
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint256 _decimals);
function totalSupply() public vie... | 27,840 |
74 | // Sender redeems bTokens in exchange for the underlying asset Accrues interest whether or not the operation succeeds, unless reverted redeemTokens The number of bTokens to redeem into underlyingreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function redeem(uint redeemTokens) external returns (uint) {
redeemTokens; // Shh
delegateAndReturn();
}
| function redeem(uint redeemTokens) external returns (uint) {
redeemTokens; // Shh
delegateAndReturn();
}
| 49,318 |
42 | // Deploy new BPool (bFactory and bPool are interfaces; all calls are external) | bPool = bFactory.newLiquidityPool();
| bPool = bFactory.newLiquidityPool();
| 24,492 |
42 | // This function returns count of accepted registrations. return The count of all registries. / | function getAcceptedRegistriesCount() public view returns (uint256) {
return acceptedRegistry.length;
}
| function getAcceptedRegistriesCount() public view returns (uint256) {
return acceptedRegistry.length;
}
| 18,653 |
96 | // MintableERC20 Implementation of the MintableERC20 / | contract MintableERC20 is ERC20Decimals, ERC20Capped, ERC20Mintable, Ownable, ServicePayer {
constructor(
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 cap_,
uint256 initialBalance_,
address payable feeReceiver_
)
payable
ERC... | contract MintableERC20 is ERC20Decimals, ERC20Capped, ERC20Mintable, Ownable, ServicePayer {
constructor(
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 cap_,
uint256 initialBalance_,
address payable feeReceiver_
)
payable
ERC... | 34,225 |
344 | // Create a delegation from one address to another _delegator the address delegating its future FYTs _receiver the address receiving the future FYTs _amount the of future FYTs to delegate / | function createFYTDelegationTo(
| function createFYTDelegationTo(
| 8,251 |
119 | // Calculates reward based on the DEFX amount that is staked and the moment in time when it is staked.It first calculates number of periods (i.e weeks) passed between now and time when DEFX amount is staked (timeSpanUnits). Then, it calculates interest rate for that period (i.e. weekly interest rate) as unitInterestRat... | function calculateReward(uint _time, uint _amount)
private
view
returns (uint)
| function calculateReward(uint _time, uint _amount)
private
view
returns (uint)
| 28,999 |
3 | // ERC165 / | interface ERC165 {
/**
* @notice Query if a contract implements an interface
* @param _interfaceId The interface identifier, as specified in ERC-165
* @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas.
*/
function supportsInterface(bytes4 _interfaceId)
... | interface ERC165 {
/**
* @notice Query if a contract implements an interface
* @param _interfaceId The interface identifier, as specified in ERC-165
* @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas.
*/
function supportsInterface(bytes4 _interfaceId)
... | 1,488 |
104 | // Get amounts to trade: | uint256 lqtyAmount = lqtyToken.balanceOf(address(this));
uint256 ethAmount = address(this).balance;
if (lqtyAmount == 0 && ethAmount == 0) {
return 0;
}
| uint256 lqtyAmount = lqtyToken.balanceOf(address(this));
uint256 ethAmount = address(this).balance;
if (lqtyAmount == 0 && ethAmount == 0) {
return 0;
}
| 20,168 |
13 | // computes log(x / FIXED_1)FIXED_1.This functions assumes that "x >= FIXED_1", because the output would be negative otherwise. / | function generalLog(uint256 x) internal pure returns (uint256) {
uint256 res = 0;
// If x >= 2, then we compute the integer part of log2(x), which is larger than 0.
if (x >= FIXED_2) {
uint8 count = floorLog2(x / FIXED_1);
x >>= count; // now x < 2
res = ... | function generalLog(uint256 x) internal pure returns (uint256) {
uint256 res = 0;
// If x >= 2, then we compute the integer part of log2(x), which is larger than 0.
if (x >= FIXED_2) {
uint8 count = floorLog2(x / FIXED_1);
x >>= count; // now x < 2
res = ... | 21,834 |
13 | // lhs rhsreturn lhs - rhs / | function double_sub(double memory lhs, double memory rhs)
internal
view
returns (double memory)
| function double_sub(double memory lhs, double memory rhs)
internal
view
returns (double memory)
| 52,860 |
18 | // record the voter has votes how to know who's voter??? why should we know? however this is the voter | voters[voter].hasVoted = true;
voters[voter].candidateId = _candidateId;
votes.push(Vote(voter, _candidateId));
| voters[voter].hasVoted = true;
voters[voter].candidateId = _candidateId;
votes.push(Vote(voter, _candidateId));
| 26,590 |
46 | // init currency in Crowdsale. | AmountData storage btcAmountData = amountsByCurrency[0];
btcAmountData.exists = true;
AmountData storage bccAmountData = amountsByCurrency[1];
bccAmountData.exists = true;
AmountData storage ltcAmountData = amountsByCurrency[2];
ltcAmountData.exists = true;
Amount... | AmountData storage btcAmountData = amountsByCurrency[0];
btcAmountData.exists = true;
AmountData storage bccAmountData = amountsByCurrency[1];
bccAmountData.exists = true;
AmountData storage ltcAmountData = amountsByCurrency[2];
ltcAmountData.exists = true;
Amount... | 42,904 |
27 | // set index of shifted request to finished reqId | requests[shiftedReqId].index = requests[reqId].index;
| requests[shiftedReqId].index = requests[reqId].index;
| 17,747 |
148 | // This is proxy for analytics. Target contract can be found at field m_analytics (see "read contract"). EenaeFIXME after fix of truffle issue 560: refactor to a separate contract file which uses InvestmentAnalytics interface / | contract AnalyticProxy {
function AnalyticProxy() {
m_analytics = InvestmentAnalytics(msg.sender);
}
/// @notice forward payment to analytics-capable contract
function() payable {
m_analytics.iaInvestedBy.value(msg.value)(msg.sender);
}
InvestmentAnalytics public m_analytics;
... | contract AnalyticProxy {
function AnalyticProxy() {
m_analytics = InvestmentAnalytics(msg.sender);
}
/// @notice forward payment to analytics-capable contract
function() payable {
m_analytics.iaInvestedBy.value(msg.value)(msg.sender);
}
InvestmentAnalytics public m_analytics;
... | 38,772 |
261 | // Multiple reward strategy logic / | abstract contract MultipleRewardStrategy is RewardStrategy, SwapHelperMainnet {
/* ========== OVERRIDDEN FUNCTIONS ========== */
/**
* @notice Claim rewards
* @param swapData Slippage and path array
* @return Rewards
*/
function _claimRewards(SwapData[] calldata swapData) internal virtu... | abstract contract MultipleRewardStrategy is RewardStrategy, SwapHelperMainnet {
/* ========== OVERRIDDEN FUNCTIONS ========== */
/**
* @notice Claim rewards
* @param swapData Slippage and path array
* @return Rewards
*/
function _claimRewards(SwapData[] calldata swapData) internal virtu... | 69,894 |
3 | // Verifies Nonce and Saves. owner Owner's address. idxIndex Value. / | function _verifyAndConsumeNonce(address owner, uint256 idx) internal virtual {
require(idx % (1 << 128) == _nonces[owner][idx >> 128]++, "EIP712WithNonce:: invalid nonce");
emit NonceConsumed(owner, idx);
}
| function _verifyAndConsumeNonce(address owner, uint256 idx) internal virtual {
require(idx % (1 << 128) == _nonces[owner][idx >> 128]++, "EIP712WithNonce:: invalid nonce");
emit NonceConsumed(owner, idx);
}
| 41,165 |
3 | // Onchain config / | using Counters for Counters.Counter;
| using Counters for Counters.Counter;
| 19,691 |
4 | // for bot tagging | mapping(address => bool) public _isBot;
mapping(address => bool) public automatedMarketMakerPairs;
| mapping(address => bool) public _isBot;
mapping(address => bool) public automatedMarketMakerPairs;
| 30,113 |
37 | // From the EIP20 Standard: A token contract which creates new tokens SHOULD trigger a Transfer event with the _from address set to 0x0 when tokens are created. | Transfer(0x0, ownerA, 10**21); // log event 0x0 from == minting
| Transfer(0x0, ownerA, 10**21); // log event 0x0 from == minting
| 8,752 |
174 | // Note: could be equal, prefer >= in case of rounding We just need that is at least the _amountNeeded, not below | require(
(postBalanceOfWant.sub(preBalanceOfWant)) >= _amountNeeded,
'Redeemed amount must be >= _amountNeeded');
| require(
(postBalanceOfWant.sub(preBalanceOfWant)) >= _amountNeeded,
'Redeemed amount must be >= _amountNeeded');
| 73,793 |
115 | // Copy receivedItemsHash from zero slot to the Order struct. | mstore(
BasicOrder_order_considerationHashes_ptr,
mload(receivedItemsHash_ptr)
)
| mstore(
BasicOrder_order_considerationHashes_ptr,
mload(receivedItemsHash_ptr)
)
| 23,094 |
211 | // set giveaway information | function setGiveaway(address[] calldata addresses, uint256[] calldata counts)
external
onlyOwner
| function setGiveaway(address[] calldata addresses, uint256[] calldata counts)
external
onlyOwner
| 41,343 |
37 | // Lender was accepted, and set to a new account.lender_ The address of the new lender. / | event LenderAccepted(address indexed lender_);
| event LenderAccepted(address indexed lender_);
| 82,775 |
7 | // ONLY OWNER: Initializes CopyTradingExtension to the DelegatedManager._delegatedManager Instance of the DelegatedManager to initialize / | function initializeExtension(IDelegatedManager _delegatedManager)
external
onlyOwnerAndValidManager(_delegatedManager)
| function initializeExtension(IDelegatedManager _delegatedManager)
external
onlyOwnerAndValidManager(_delegatedManager)
| 5,524 |
82 | // / | function retrieveFunds()
public
onlyOwner
| function retrieveFunds()
public
onlyOwner
| 34,813 |
8 | // Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE/TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE/THEY MAY BE PERMANENTLY LOST/Throws unless `msg.sender` is the current owner, an authorized/operator, or the approved address for this NFT. Throws if `_from` is/not the current owner. Throws if `_to` ... | function transferFrom(address _from, address _to, uint256 _tokenId) external payable;
| function transferFrom(address _from, address _to, uint256 _tokenId) external payable;
| 25,446 |
216 | // Enable allowlist minting fully by enabling both flagsThis is a convenience function for the Rampp user / | function openAllowlistMint() public onlyOwner {
enableAllowlistOnlyMode();
mintingOpen = true;
}
| function openAllowlistMint() public onlyOwner {
enableAllowlistOnlyMode();
mintingOpen = true;
}
| 60,862 |
302 | // Converts two int256 representing a fraction to fixed point units,equivalent to multiplying dividend and divisor by 10^digits(). Test newFixedFraction(maxFixedDiv()+1,1) failsTest newFixedFraction(1,maxFixedDiv()+1) failsTest newFixedFraction(1,0) fails Test newFixedFraction(0,1) returns 0Test newFixedFraction(1,1) r... | function newFixedFraction(
int256 numerator,
int256 denominator
)
public
pure
returns (int256)
| function newFixedFraction(
int256 numerator,
int256 denominator
)
public
pure
returns (int256)
| 22,904 |
38 | // Allows to remove an owner. Transaction has to be sent by wallet./owner Address of owner. | function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
validRequirement(owners.length, required)
| function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
validRequirement(owners.length, required)
| 57,789 |
5 | // Transfer tokens from one address to another.Note that while this function emits an Approval event, this is not required as per the specification,and other compliant implementations may not emit the event. from address The address which you want to send tokens from to address The address which you want to transfer to... | function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
| function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
| 4,187 |
12 | // MAKER FROM | proxyData1 = abi.encodeWithSignature(
"close(uint256,address,uint256,uint256)",
shiftData.id1,
shiftData.addrLoan1,
_amount,
shiftData.collAmount
);
| proxyData1 = abi.encodeWithSignature(
"close(uint256,address,uint256,uint256)",
shiftData.id1,
shiftData.addrLoan1,
_amount,
shiftData.collAmount
);
| 16,600 |
7 | // New implementations always get set via the setter (post-initialize) | _setImplementation(implementationToSet, allowResign, becomeImplementationData);
| _setImplementation(implementationToSet, allowResign, becomeImplementationData);
| 26,066 |
239 | // DOGE Head | dogeAssets['H']['A'].ratio = 80;
dogeAssets['H']['A'].assets.push('Feather');
dogeAssets['H']['A'].assets.push('Earring');
dogeAssets['H']['A'].assets.push('Suit hat');
dogeAssets['H']['A'].assets.push('Pirate hat1');
dogeAssets['H']['A'].assets.push('Hair1');
dogeAssets['H']['A'].assets.push('hair2');
... | dogeAssets['H']['A'].ratio = 80;
dogeAssets['H']['A'].assets.push('Feather');
dogeAssets['H']['A'].assets.push('Earring');
dogeAssets['H']['A'].assets.push('Suit hat');
dogeAssets['H']['A'].assets.push('Pirate hat1');
dogeAssets['H']['A'].assets.push('Hair1');
dogeAssets['H']['A'].assets.push('hair2');
... | 31,063 |
3 | // democs that do not have to pay for issues | mapping (address => bool) public ballotWhitelist;
| mapping (address => bool) public ballotWhitelist;
| 11,291 |
19 | // Give tokens to a user _sender token sender _receipient token receiver. _value number of tokens. / | function donateTokens(address _sender, address _receipient, uint256 _value) public {
_transfer(_sender, _receipient, _value);
}
| function donateTokens(address _sender, address _receipient, uint256 _value) public {
_transfer(_sender, _receipient, _value);
}
| 20,547 |
137 | // - checks version to determine if a block has merge mining information | function isMergeMined(bytes memory _rawBytes, uint pos) internal pure returns (bool) {
return bytesToUint32Flipped(_rawBytes, pos) & VERSION_AUXPOW != 0;
}
| function isMergeMined(bytes memory _rawBytes, uint pos) internal pure returns (bool) {
return bytesToUint32Flipped(_rawBytes, pos) & VERSION_AUXPOW != 0;
}
| 3,037 |
2 | // Constructor/The Invoice contract has only constructor./token The address of the erc20 token contract/receiver The address to which tokens will be sent/amount amount of tokens | constructor(IERC20 token, address payable receiver, uint256 amount) {
token.transfer(receiver, amount);
selfdestruct(receiver);
}
| constructor(IERC20 token, address payable receiver, uint256 amount) {
token.transfer(receiver, amount);
selfdestruct(receiver);
}
| 14,004 |
36 | // Check ERC20 | require(
IERC20Upgradeable(ingredient.contractAddr).balanceOf(_msgSender()) >=
ingredient.amounts[0] * craftAmount,
'CrafterTransfer: User missing minimum token balance(s)!'
);
| require(
IERC20Upgradeable(ingredient.contractAddr).balanceOf(_msgSender()) >=
ingredient.amounts[0] * craftAmount,
'CrafterTransfer: User missing minimum token balance(s)!'
);
| 10,553 |
15 | // Math operations with safety checks / | library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// ass... | library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// ass... | 12,165 |
0 | // Contract ownership standard interface (event only) / | interface IERC173Events {
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
}
| interface IERC173Events {
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
}
| 13,438 |
223 | // as it stands today, this can happend only when selling ETH | if (tokens[1] != _data[0]) {
(wrapper, price) = SaverExchangeInterface(SAVER_EXCHANGE_ADDRESS).getBestPrice(tokens[1], orderAddresses[1], orderAddresses[2], _data[2]);
}
| if (tokens[1] != _data[0]) {
(wrapper, price) = SaverExchangeInterface(SAVER_EXCHANGE_ADDRESS).getBestPrice(tokens[1], orderAddresses[1], orderAddresses[2], _data[2]);
}
| 53,321 |
9 | // Owner cancel subscription, sends remaining link directly to the subscription owner.Only callable by the Router OwnersubscriptionId subscription idnotably can be called even if there are pending requests, outstanding ones may fail onchain | function ownerCancelSubscription(uint64 subscriptionId) external;
| function ownerCancelSubscription(uint64 subscriptionId) external;
| 15,890 |
5 | // Secure internal function to safely transfer a specific tokenId from an address to another one | function _beforeTokenTransfer(
address _from,
address _to,
uint256 _tokenId
| function _beforeTokenTransfer(
address _from,
address _to,
uint256 _tokenId
| 8,224 |
37 | // buyer has to have enough ether for the current purchase | require(msg.value == revSaleOffers[_id].price);
| require(msg.value == revSaleOffers[_id].price);
| 27,256 |
95 | // The user may be trying to bond at the same time (this also check that have enough bonded) | require(apply_bond(user) == 0, "INVALID_BOND");
emit ORI_Rolled_Back(user, rolled_back_size, block.timestamp);
| require(apply_bond(user) == 0, "INVALID_BOND");
emit ORI_Rolled_Back(user, rolled_back_size, block.timestamp);
| 45,611 |
62 | // We now copy the raw memory array from returndata into memory. Since the offset takes up 32 bytes, we start copying at address 0x20. We also get rid of the error signature, which takes the first four bytes of returndata. | let size := sub(returndatasize(), 0x04)
returndatacopy(0x20, 0x04, size)
| let size := sub(returndatasize(), 0x04)
returndatacopy(0x20, 0x04, size)
| 31,428 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.