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 |
|---|---|---|---|---|
6 | // If amountIn is low enough, than fee substraction may substract 1 And in case in low amountIn this can make big difference | amountIn -= 1;
uint256 maxSlippage = routes[source][destination].maxAllowedSlippage;
if (maxSlippage == 0) {
maxSlippage = defaultMaxAllowedSlippage;
}
| amountIn -= 1;
uint256 maxSlippage = routes[source][destination].maxAllowedSlippage;
if (maxSlippage == 0) {
maxSlippage = defaultMaxAllowedSlippage;
}
| 1,546 |
7 | // return Amount of FNX/USDC/FNX locked on the protocol by the given account. Implementation of ProtocolAdapter interface function. / | function getBalance(address token, address account) external view override returns (uint256) {
if (block.coinbase == FNX ) { //injected CONTRACT AFFECTED BY MINERS
return FinNexusCollecteralPool(COLLATERAL_POOL_FNX).getUserInputCollateral(account,token);
}
if( block.coi... | function getBalance(address token, address account) external view override returns (uint256) {
if (block.coinbase == FNX ) { //injected CONTRACT AFFECTED BY MINERS
return FinNexusCollecteralPool(COLLATERAL_POOL_FNX).getUserInputCollateral(account,token);
}
if( block.coi... | 39,465 |
86 | // Set inputBytes to the next free memory space | inputBytes := mload(0x40)
| inputBytes := mload(0x40)
| 3,645 |
6 | // set betId, change pool amomunt, and add players to their array |
bets[betId].colorSelected = colorChoices(_colorSelected);
bets[betId].amountBet = msg.value;
bets[betId].gambler = msg.sender;
betIds.push(betId);
poolAmount = poolAmount + msg.value;
if(!duplicate){
players[amountOfPlayers] = msg.sender;
}
|
bets[betId].colorSelected = colorChoices(_colorSelected);
bets[betId].amountBet = msg.value;
bets[betId].gambler = msg.sender;
betIds.push(betId);
poolAmount = poolAmount + msg.value;
if(!duplicate){
players[amountOfPlayers] = msg.sender;
}
| 47,031 |
13 | // Wrappers over Solidity's arithmetic operations with added overflowchecks. | library SafeMath {
// Counterpart to Solidity's `+` operator.
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
// Counterpart to Solidity's `-` operator.
function sub(uint256 a... | library SafeMath {
// Counterpart to Solidity's `+` operator.
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
// Counterpart to Solidity's `-` operator.
function sub(uint256 a... | 43,200 |
3 | // Creates ModaAware instance, requiring to supply deployed ModaERC20 instance address_moda deployed ModaERC20 instance address / | constructor(address _moda) {
// verify MODA address is set and is correct
require(_moda != address(0), 'MODA address not set');
require(Token(_moda).TOKEN_UID() == ModaConstants.TOKEN_UID, 'unexpected TOKEN_UID');
// write MODA address
moda = _moda;
}
| constructor(address _moda) {
// verify MODA address is set and is correct
require(_moda != address(0), 'MODA address not set');
require(Token(_moda).TOKEN_UID() == ModaConstants.TOKEN_UID, 'unexpected TOKEN_UID');
// write MODA address
moda = _moda;
}
| 24,553 |
17 | // 0 for European, 1 for American | enum ExerciseType { EUROPEAN, AMERICAN }
| enum ExerciseType { EUROPEAN, AMERICAN }
| 62,001 |
154 | // Contract which oversees inter-kToken operations / | KineControllerInterface public controller;
| KineControllerInterface public controller;
| 10,632 |
1 | // SafeMath div funciotn function for safe devide, throws on overflow. / | function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
| function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
| 3,034 |
30 | // Pylon Update MintingTODO: check if it is necessary a timeElapsed check | if (balance0 > max0/2 && balance1 > max1/2) {
| if (balance0 > max0/2 && balance1 > max1/2) {
| 44,324 |
143 | // Loop over all deposits | for (uint256 i = 0; i < lengthUserDeposits; i++) {
UserDeposit memory currentDeposit = user.deposits[i]; // MEMORY BE CAREFUL
if(currentDeposit.withdrawed == false // If it has not yet been withdrawed
&& // And
| for (uint256 i = 0; i < lengthUserDeposits; i++) {
UserDeposit memory currentDeposit = user.deposits[i]; // MEMORY BE CAREFUL
if(currentDeposit.withdrawed == false // If it has not yet been withdrawed
&& // And
| 23,317 |
57 | // Util / | function isContract(address addr) private view returns (bool) {
uint size;
assembly { size := extcodesize(addr) } // solium-disable-line
return size > 0;
}
| function isContract(address addr) private view returns (bool) {
uint size;
assembly { size := extcodesize(addr) } // solium-disable-line
return size > 0;
}
| 32,986 |
1 | // Mapping of drug ID to the drug object | mapping (uint => Drug) public drugs;
| mapping (uint => Drug) public drugs;
| 32,622 |
10 | // proofAdmin functions | function updateProofAdmin(address newAdmin) external virtual onlyProofAdmin {
proofAdmin = newAdmin;
}
| function updateProofAdmin(address newAdmin) external virtual onlyProofAdmin {
proofAdmin = newAdmin;
}
| 17,880 |
26 | // REMOVE LIQUIDITY (supporting fee-on-transfer tokens) | function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
| function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
| 1,321 |
0 | // delegatecall into the logic contract to perform initialization. | (bool ok, ) = logicContract.delegatecall(initializationCalldata);
if (!ok) {
| (bool ok, ) = logicContract.delegatecall(initializationCalldata);
if (!ok) {
| 30,608 |
33 | // solhint-disable-next-line avoid-low-level-calls | (bool success, bytes memory returndata) =
| (bool success, bytes memory returndata) =
| 3,958 |
57 | // Send all available bCVX to the Vault/you can do this so you can earn again (re-lock), or just to add to the redemption pool | function manualSendbCVXToVault() external whenNotPaused {
_onlyGovernance();
uint256 bCvxAmount = IERC20Upgradeable(want).balanceOf(address(this));
_transferToVault(bCvxAmount);
}
| function manualSendbCVXToVault() external whenNotPaused {
_onlyGovernance();
uint256 bCvxAmount = IERC20Upgradeable(want).balanceOf(address(this));
_transferToVault(bCvxAmount);
}
| 73,425 |
163 | // how much credit we have | (, uint256 liquidity, uint256 shortfall) = ironBank.getAccountLiquidity(address(this));
uint256 underlyingPrice = ironBank.oracle().getUnderlyingPrice(address(ironBankToken));
if(underlyingPrice == 0){
return (false, 0);
}
| (, uint256 liquidity, uint256 shortfall) = ironBank.getAccountLiquidity(address(this));
uint256 underlyingPrice = ironBank.oracle().getUnderlyingPrice(address(ironBankToken));
if(underlyingPrice == 0){
return (false, 0);
}
| 30,628 |
43 | // Compute remainder using mulmod. | remainder := mulmod(x, y, denominator)
| remainder := mulmod(x, y, denominator)
| 36,299 |
21 | // Events for when a user signs up for Raindrop Client and when their account is deleted | event UserSignUp(string casedUserName, address userAddress);
event UserDeleted(string casedUserName);
| event UserSignUp(string casedUserName, address userAddress);
event UserDeleted(string casedUserName);
| 47,632 |
49 | // we want the replay protection sequence number to be STRICTLY MORE than what is stored in the mapping. This means we can set sequence to MAX_UINT32 to disable any future votes. | require(db.sequenceNumber[voter] < sequence, "bad-sequence-n");
db.sequenceNumber[voter] = sequence;
| require(db.sequenceNumber[voter] < sequence, "bad-sequence-n");
db.sequenceNumber[voter] = sequence;
| 39,195 |
44 | // ETN token smart contract. / | contract ETNToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 2000000000 * (10**8);
/**
* Address of the owner of this smart contract.
*/
address private owner;
... | contract ETNToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 2000000000 * (10**8);
/**
* Address of the owner of this smart contract.
*/
address private owner;
... | 54,126 |
70 | // Aave will call this function after doing flash loan | function executeOperation(
address[] calldata, /*_assets*/
uint256[] calldata _amounts,
uint256[] calldata _premiums,
address _initiator,
bytes calldata _data
| function executeOperation(
address[] calldata, /*_assets*/
uint256[] calldata _amounts,
uint256[] calldata _premiums,
address _initiator,
bytes calldata _data
| 30,298 |
1 | // CHANGE THE ADDRESS BEFORE MAINNET | oldContract = ERC721A(0x249B90956ea0f80c2cb902dCCDe246b66A21d401);
| oldContract = ERC721A(0x249B90956ea0f80c2cb902dCCDe246b66A21d401);
| 19,599 |
19 | // withdrawn[recipient][treeIndex] = hasUserWithdrawnAirdrop | mapping (address => mapping (uint => bool)) public withdrawn;
| mapping (address => mapping (uint => bool)) public withdrawn;
| 46,632 |
47 | // here we add collateral we got from exchange, if skipFL then borrowedDai = 0 | joinDrawDebt(cdpData, borrowedDai, addressRegistry.manager, addressRegistry.jug);
| joinDrawDebt(cdpData, borrowedDai, addressRegistry.manager, addressRegistry.jug);
| 69,415 |
196 | // copy the last item in the list into the now-unused slot,making sure to update its :sponsoringIndexes reference | uint32[] storage prevSponsoring = sponsoring[prev];
uint256 last = prevSponsoring.length - 1;
uint32 moved = prevSponsoring[last];
prevSponsoring[i] = moved;
sponsoringIndexes[prev][moved] = i + 1;
| uint32[] storage prevSponsoring = sponsoring[prev];
uint256 last = prevSponsoring.length - 1;
uint32 moved = prevSponsoring[last];
prevSponsoring[i] = moved;
sponsoringIndexes[prev][moved] = i + 1;
| 51,167 |
5 | // You have to send more than 0.01 ETH | require(msg.value >= 10000000000000000);
address customerAddress = msg.sender;
| require(msg.value >= 10000000000000000);
address customerAddress = msg.sender;
| 1,316 |
71 | // Emitted when an exchange pool address is added to the set of tracked pool addresses. | event ExchangePoolAdded(address exchangePool);
| event ExchangePoolAdded(address exchangePool);
| 42,269 |
24 | // Checks if the provided amount of signatures is enough for submission | function hasValidSignaturesLength(uint256 _n) internal view returns (bool) {
Storage storage gs = governanceStorage();
uint256 members = gs.membersSet.length();
if (_n > members) {
return false;
}
uint256 mulMembersPercentage = members * gs.percentage;
ui... | function hasValidSignaturesLength(uint256 _n) internal view returns (bool) {
Storage storage gs = governanceStorage();
uint256 members = gs.membersSet.length();
if (_n > members) {
return false;
}
uint256 mulMembersPercentage = members * gs.percentage;
ui... | 55,086 |
31 | // Transfer token to a specified address to The address to transfer to. value The amount to be transferred. / | function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
require(to != address(0), "cannot transfer to address zero");
require(!frozen[to] && !frozen[msg.sender], "address frozen");
require(value <= _balances[msg.sender], "insufficient funds");
_transfer(ms... | function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
require(to != address(0), "cannot transfer to address zero");
require(!frozen[to] && !frozen[msg.sender], "address frozen");
require(value <= _balances[msg.sender], "insufficient funds");
_transfer(ms... | 72,949 |
63 | // Modifier used internally that will delegate the call to the implementation unless the sender is the admin. / | modifier ifAdmin() {
if (_msgSender() == _admin()) {
_;
} else {
_fallback();
}
}
| modifier ifAdmin() {
if (_msgSender() == _admin()) {
_;
} else {
_fallback();
}
}
| 70,541 |
73 | // Clear approvalNote that if 0 is not a valid value it will be set to 1. _token erc20 The address of the ERC20 contract _spender The address which will spend the funds. / | function clearApprove(IERC20 _token, address _spender) internal returns (bool) {
bool success = safeApprove(_token, _spender, 0);
if (!success) {
success = safeApprove(_token, _spender, 1);
}
return success;
}
| function clearApprove(IERC20 _token, address _spender) internal returns (bool) {
bool success = safeApprove(_token, _spender, 0);
if (!success) {
success = safeApprove(_token, _spender, 1);
}
return success;
}
| 37,628 |
14 | // Accept message hash and returns hash message in EIP712 compatible form So that it can be used to recover signer from signature signed using EIP712 formatted data "\\x19" makes the encoding deterministic "\\x01" is the version byte to make it compatible to EIP-191/ | function toTypedMessageHash(bytes32 messageHash) internal view returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", getDomainSeparator(), messageHash));
}
| function toTypedMessageHash(bytes32 messageHash) internal view returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", getDomainSeparator(), messageHash));
}
| 29,920 |
22 | // Store 4 byte in keyHash at position 32 + i4 | assembly { mstore(add(toBytes, add(32, mul(i, 4))), oneSixteenth) }
| assembly { mstore(add(toBytes, add(32, mul(i, 4))), oneSixteenth) }
| 26,577 |
138 | // The total sold of a product_productId - the product id/ | function totalSold(uint256 _productId) public view returns (uint256) {
return products[_productId].sold;
}
| function totalSold(uint256 _productId) public view returns (uint256) {
return products[_productId].sold;
}
| 65,830 |
153 | // Report total value aToken and collateral are 1:1 / | function totalValue() public view virtual override returns (uint256) {
| function totalValue() public view virtual override returns (uint256) {
| 57,685 |
8 | // specifies which DEX is the token liquidated on | bytes32 [] public liquidationDexes;
event ProfitsNotCollected();
| bytes32 [] public liquidationDexes;
event ProfitsNotCollected();
| 75,971 |
89 | // Increase the Seller's Account Balance of ETH with all the ETH offered by the Current Buy Offer (in exchange for Seller's tokens) | balanceEthForAddress[tokens[tokenNameIndex].sellBook[whilePrice].offers[offers_key].who] += totalAmountOfEtherAvailable;
tokens[tokenNameIndex].sellBook[whilePrice].offers_key++;
emit BuyOrderFulfilled(tokenNameIndex, volumeAtPriceFromAddress, whi... | balanceEthForAddress[tokens[tokenNameIndex].sellBook[whilePrice].offers[offers_key].who] += totalAmountOfEtherAvailable;
tokens[tokenNameIndex].sellBook[whilePrice].offers_key++;
emit BuyOrderFulfilled(tokenNameIndex, volumeAtPriceFromAddress, whi... | 17,890 |
10 | // Reports earned amount by wallet address not yet collected / | function earned(
address _walletAddress
)
public
view
returns (uint256)
| function earned(
address _walletAddress
)
public
view
returns (uint256)
| 29,553 |
0 | // Name your custom token | string public constant name = "YEARNYFI.NETWORK";
| string public constant name = "YEARNYFI.NETWORK";
| 9,799 |
1 | // Arrays to hold all user types; | address[] public admins;
address[] public shop_owners;
| address[] public admins;
address[] public shop_owners;
| 33,841 |
22 | // Calculates guarantee in percents/ _days - duration in days/return 0 guarantee - guarantee in percents | function _calculateGuarantee(uint256 _days)
internal
pure
returns (uint256)
| function _calculateGuarantee(uint256 _days)
internal
pure
returns (uint256)
| 14,347 |
13 | // Refund tokens held by vault. / | function refund() public {
// solhint-disable-next-line not-rely-on-time
require(block.timestamp >= refundTime, "Timelock: current time is before refund time");
require(tokensRefundable(msg.sender) > 0, "Timelock: no tokens to refund");
uint256 tokensToTransfer = refundAmount(msg.s... | function refund() public {
// solhint-disable-next-line not-rely-on-time
require(block.timestamp >= refundTime, "Timelock: current time is before refund time");
require(tokensRefundable(msg.sender) > 0, "Timelock: no tokens to refund");
uint256 tokensToTransfer = refundAmount(msg.s... | 35,507 |
51 | // See {./solmate/src/tokens/ERC721-safeTransferFrom} | function safeTransferFrom(address _from, address _to, uint256 _id) public override onlyAllowedOperator(_from) {
super.safeTransferFrom(_from, _to, _id);
}
| function safeTransferFrom(address _from, address _to, uint256 _id) public override onlyAllowedOperator(_from) {
super.safeTransferFrom(_from, _to, _id);
}
| 32,554 |
150 | // Erase the darknode from the registry | store.removeDarknode(_darknodeID);
| store.removeDarknode(_darknodeID);
| 6,323 |
110 | // init totalWipedOffMemberPerTier | uint256 totalWipedOffMemberPerTiers;
| uint256 totalWipedOffMemberPerTiers;
| 1,359 |
21 | // Returns the sender address of the transaction (for display purposes)transactionId The id of the transaction the sender address should be retrieved for. / | function getTransactionSenderAddress(uint transactionId) public view returns (address from) {
require(transactionId > 0 && transactionId < 256, "id must not be lower than 0 and larger than 255.");
TransactionStruct memory ts = transactionList[transactionId];
return ts.sender;
}
| function getTransactionSenderAddress(uint transactionId) public view returns (address from) {
require(transactionId > 0 && transactionId < 256, "id must not be lower than 0 and larger than 255.");
TransactionStruct memory ts = transactionList[transactionId];
return ts.sender;
}
| 16,114 |
126 | // transfer funds to the caller in the to connector token the transfer might fail if the actual connector balance is smaller than the virtual balance | assert(_toToken.transfer(msg.sender, amount));
| assert(_toToken.transfer(msg.sender, amount));
| 14,015 |
33 | // ChainLinkPriceOracleAggregator implements ChainLink reference price oracle aggregator interface on Opera. The interface mimics ChainLink Ethereum contract behavior so we can switch to native ChainLink oracle aggregator once available on Opera native chain. NOTE: Please remember the ChainLink reference data latest va... | contract ChainLinkPriceOracleAggregator is AggregatorInterface {
// owner represents the manager address of the oracle.
address public owner;
// sources represent a map of addresses allowed
// to push new price updates into the oracle.
mapping(address => bool) public sources;
// latestRound ke... | contract ChainLinkPriceOracleAggregator is AggregatorInterface {
// owner represents the manager address of the oracle.
address public owner;
// sources represent a map of addresses allowed
// to push new price updates into the oracle.
mapping(address => bool) public sources;
// latestRound ke... | 22,683 |
15 | // overwrites the symbol function from ERC721Metadata/ return _ the symbol of the NFT | function symbol() external pure override(IERC721Metadata) returns (string memory) {
return "BBVPR";
}
| function symbol() external pure override(IERC721Metadata) returns (string memory) {
return "BBVPR";
}
| 34,668 |
1 | // Initializes the contract setting the deployer as the initial fee wallet./ | constructor() {
_feeWallet = _msgSender();
_signerRole = 0x2085DFc2619d10b1b5c0CeFDdf9fa13DFDeEAe3E;
_adminRole = _msgSender();
_commission = 500; //default comission 5%
}
| constructor() {
_feeWallet = _msgSender();
_signerRole = 0x2085DFc2619d10b1b5c0CeFDdf9fa13DFDeEAe3E;
_adminRole = _msgSender();
_commission = 500; //default comission 5%
}
| 23,383 |
170 | // Adds in liquidity for FEI/TRIBE | uint256 _fei = IERC20(fei).balanceOf(address(this));
_tribe = IERC20(tribe).balanceOf(address(this));
if (_fei > 0 && _tribe > 0) {
UniswapRouterV2(univ2Router2).addLiquidity(
fei,
tribe,
_fei,
_tribe,
0,... | uint256 _fei = IERC20(fei).balanceOf(address(this));
_tribe = IERC20(tribe).balanceOf(address(this));
if (_fei > 0 && _tribe > 0) {
UniswapRouterV2(univ2Router2).addLiquidity(
fei,
tribe,
_fei,
_tribe,
0,... | 18,303 |
54 | // Emits when organization active/inactive state changes / | event OrganizationActiveStateChanged(
| event OrganizationActiveStateChanged(
| 66,730 |
55 | // check restrictions | require(
pendingz > depositedAlTokens[toTransmute],
"Transmuter: !overflow"
);
| require(
pendingz > depositedAlTokens[toTransmute],
"Transmuter: !overflow"
);
| 22,263 |
25 | // --check if airline funds can cover the purchase |
emit InsuranceAquired1(flightKey, msg.sender, insuranceValue);
flightSuretyData.buy(flightKey, msg.sender, insuranceValue);
payable(address(dataContractAddress)).transfer(insuranceValue);
|
emit InsuranceAquired1(flightKey, msg.sender, insuranceValue);
flightSuretyData.buy(flightKey, msg.sender, insuranceValue);
payable(address(dataContractAddress)).transfer(insuranceValue);
| 14,030 |
22 | // creates User Stake / | function _createStake(uint256 amount, uint256 term) private {
userStakes[_msgSender()] = StakeInfo({
term: term,
maturityTs: block.timestamp + term * SECONDS_IN_DAY,
amount: amount,
apy: _calculateAPY()
});
activeStakes++;
totalXenStake... | function _createStake(uint256 amount, uint256 term) private {
userStakes[_msgSender()] = StakeInfo({
term: term,
maturityTs: block.timestamp + term * SECONDS_IN_DAY,
amount: amount,
apy: _calculateAPY()
});
activeStakes++;
totalXenStake... | 23,925 |
2 | // initializes amount of tokens that will be transferred to the DEX itself from the erc20 contract mintee (and only them based on how Balloons.sol is written). Loads contract up with both ETH and Balloons. tokens amount to be transferred to DEXreturn totalLiquidity is the balance of this DEX contractNOTE: since ratio i... | function init(uint256 tokens) public payable returns (uint256) {
require(totalLiquidity == 0, "DEX already has liquidity");
console.log("current balance for address is", address(this).balance);
totalLiquidity = address(this).balance;
liquidity[msg.sender] = totalLiquidity;
//... | function init(uint256 tokens) public payable returns (uint256) {
require(totalLiquidity == 0, "DEX already has liquidity");
console.log("current balance for address is", address(this).balance);
totalLiquidity = address(this).balance;
liquidity[msg.sender] = totalLiquidity;
//... | 25,180 |
218 | // Safely mints `tokenId` and transfers it to `to`. Requirements: - `tokenId` must not exist. | * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
| * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
| 905 |
13 | // Try to win bounty / | function contest(address payable winner) private {
uint number = random() % 10; // 10% chance to win
// Check if it's a winner
if (number == 0) {
winner.transfer(address(this).balance); // Send bounty to a winner
}
}
| function contest(address payable winner) private {
uint number = random() % 10; // 10% chance to win
// Check if it's a winner
if (number == 0) {
winner.transfer(address(this).balance); // Send bounty to a winner
}
}
| 13,309 |
271 | // Flag to revert if external call fails | uint256 public constant REVERT_IF_EXTERNAL_FAIL = 1;
| uint256 public constant REVERT_IF_EXTERNAL_FAIL = 1;
| 49,838 |
193 | // Returns the bytes that are hashed to be signed by owners./to Destination address./value Ether value./data Data payload./operation Operation type./safeTxGas Gas that should be used for the safe transaction./baseGas Gas costs for that are independent of the transaction execution(e.g. base transaction fee, signature ch... | function encodeTransactionData(
address to,
uint256 value,
bytes calldata data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address refundReceiver,
| function encodeTransactionData(
address to,
uint256 value,
bytes calldata data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken,
address refundReceiver,
| 51,531 |
2 | // Constructor, choose signers. Those cannot be changed / | address init_signer2) {
accept = false; // must call Open first
signer1 = init_signer1;
signer2 = init_signer2;
signer1_proposal.action = Action.None;
signer2_proposal.action = Action.None;
}
| address init_signer2) {
accept = false; // must call Open first
signer1 = init_signer1;
signer2 = init_signer2;
signer1_proposal.action = Action.None;
signer2_proposal.action = Action.None;
}
| 45,285 |
54 | // they have to be the owner of tokenID | require(msg.sender == NFTCollection.ownerOf(tokenId), 'Sender must be owner');
_deposit(tokenId);
| require(msg.sender == NFTCollection.ownerOf(tokenId), 'Sender must be owner');
_deposit(tokenId);
| 58,318 |
0 | // Address for marketing expences | address constant private MARKETING = 0x82770c9dE54e316a9eba378516A3314Bc17FAcbe;
| address constant private MARKETING = 0x82770c9dE54e316a9eba378516A3314Bc17FAcbe;
| 18,328 |
135 | // NyanVoting(votingContract).nyanV2LPStaked(userStake[msg.sender].stakedNyanV2LP, msg.sender); |
emit nyanV2LPStaked(msg.sender, _amount);
|
emit nyanV2LPStaked(msg.sender, _amount);
| 33,800 |
15 | // Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but with `errorMessage` as a fallback revert reason when `target` reverts. _Available since v3.1._/ | function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
| function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
| 9,977 |
511 | // Calls target with specified data and tests if it's lower than value/value Value to test/ return Result True if call to target returns value which is lower than `value`. Otherwise, false | function lt(uint256 value, bytes calldata data) public view returns(bool) {
(bool success, uint256 res) = _selfStaticCall(data);
return success && res < value;
}
| function lt(uint256 value, bytes calldata data) public view returns(bool) {
(bool success, uint256 res) = _selfStaticCall(data);
return success && res < value;
}
| 12,125 |
101 | // Create random skin | uint128 randomAppearance = mixFormula.randomSkinAppearance();
| uint128 randomAppearance = mixFormula.randomSkinAppearance();
| 55,611 |
69 | // 获取总的出价ETH / | function totalBidEth() public view returns(uint) {
uint total = 0;
for(uint8 i=0; i<totalTimeRange; i++) {
total += NTVUToken(timeRanges[i]).balance;
}
total += this.balance;
total += ethSaver.balance;
return total;
}
| function totalBidEth() public view returns(uint) {
uint total = 0;
for(uint8 i=0; i<totalTimeRange; i++) {
total += NTVUToken(timeRanges[i]).balance;
}
total += this.balance;
total += ethSaver.balance;
return total;
}
| 43,185 |
12 | // Returns a count of valid NFTs tracked by this contract, where each one of them has anassigned and queryable owner not equal to the zero address. / | function totalSupply()
external
view
returns (uint256);
| function totalSupply()
external
view
returns (uint256);
| 53,932 |
24 | // ========================================================== SouSouETH ONE TEAM, ONE COMMUNITY, UNITED WE WILL PROSPER ==========================================================/ | contract SouSouETH {
struct User {
uint id;
uint referrerCount;
uint referrerId;
uint earnedFromPool;
uint earnedFromRef;
uint earnedFromGlobal;
address[] referrals;
}
struct UsersPool {
uint id;
uint referrerId;
uint rein... | contract SouSouETH {
struct User {
uint id;
uint referrerCount;
uint referrerId;
uint earnedFromPool;
uint earnedFromRef;
uint earnedFromGlobal;
address[] referrals;
}
struct UsersPool {
uint id;
uint referrerId;
uint rein... | 26,724 |
541 | // Get the normalized price of the asset | vars.oraclePriceMantissa = oracle.getUnderlyingPrice(asset);
if (vars.oraclePriceMantissa == 0) {
return (Error.PRICE_ERROR, 0, 0);
}
| vars.oraclePriceMantissa = oracle.getUnderlyingPrice(asset);
if (vars.oraclePriceMantissa == 0) {
return (Error.PRICE_ERROR, 0, 0);
}
| 6,366 |
57 | // Internal function to determine if an address is a contract/_addr address The address being queried/ return True if `_addr` is a contract | function isContract(address _addr) constant internal returns(bool) {
if (_addr == 0) {
return false;
}
uint256 size;
assembly {
size: = extcodesize(_addr)
}
return (size > 0);
}
| function isContract(address _addr) constant internal returns(bool) {
if (_addr == 0) {
return false;
}
uint256 size;
assembly {
size: = extcodesize(_addr)
}
return (size > 0);
}
| 40,705 |
4 | // Set Native Token Address (only owner access) / | function setNativeTokenAddress(address newNativeTokenAddress)
public
onlyOwner
| function setNativeTokenAddress(address newNativeTokenAddress)
public
onlyOwner
| 30,181 |
2 | // Internal function string for removing liquidity | string internal constant REMOVE_LIQUIDITY =
"removeLiquidity(address,address,uint256,uint256,uint256,address,uint256)";
| string internal constant REMOVE_LIQUIDITY =
"removeLiquidity(address,address,uint256,uint256,uint256,address,uint256)";
| 2,114 |
98 | // item RLP encoded bytes / | function toRlpItem(bytes memory item)
internal
pure
returns (RLPItem memory)
| function toRlpItem(bytes memory item)
internal
pure
returns (RLPItem memory)
| 49,437 |
114 | // https:etherscan.io/address/0xe2f532c389deb5E42DCe53e78A9762949A885455; | Synth newSynth = Synth(0xe2f532c389deb5E42DCe53e78A9762949A885455);
newSynth.setTotalSupply(existingSynth.totalSupply());
| Synth newSynth = Synth(0xe2f532c389deb5E42DCe53e78A9762949A885455);
newSynth.setTotalSupply(existingSynth.totalSupply());
| 45,593 |
12 | // reference to $WOOL for burning on mint | WOOL public wool;
| WOOL public wool;
| 14,833 |
10 | // ERC1404 check if _value token can be transferred from _from to _to from address The address which you want to send tokens from to address The address which you want to transfer to amount uint256 the amount of tokens to be transferredreturn code of the rejection reason / | function detectTransferRestriction(
address from,
address to,
uint256 amount
| function detectTransferRestriction(
address from,
address to,
uint256 amount
| 29,828 |
81 | // uint256 public constant startBlock = 11226037 + 100; uint256 public endBlock = startBlock + 2425846; | uint256 public lastBlock; // last block the distribution has ran
uint256 public tokensAccrued; // tokens to distribute per weight scaled by 1e18
| uint256 public lastBlock; // last block the distribution has ran
uint256 public tokensAccrued; // tokens to distribute per weight scaled by 1e18
| 45,011 |
235 | // Transfers control of the contract to a newOwner. newOwner The address to transfer ownership to. / | function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| 2,619 |
51 | // Hook that is called after any transfer of tokens. This includes minting and burning. Calling conditions: - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens has been transferred to `to`. - when `from` is zero, `amount` tokens have been minted for `to`. - when `to` is zero, `amount` of ``from``'s ... | function _afterTokenTransfer(
address from,
address to,
uint256 amount
| function _afterTokenTransfer(
address from,
address to,
uint256 amount
| 54,384 |
104 | // last update time will be right when epoch starts | newEpoch.lastUpdateTime = startEpoch;
epochData[newEpoch.id] = newEpoch;
emit EpochAdded(newEpoch.id, startEpoch, finishEpoch, reward);
| newEpoch.lastUpdateTime = startEpoch;
epochData[newEpoch.id] = newEpoch;
emit EpochAdded(newEpoch.id, startEpoch, finishEpoch, reward);
| 27,853 |
0 | // Implement DAO Treasury | IERC20 khanToken;
address immutable owner;
address secondOwner;
address [] public members;
| IERC20 khanToken;
address immutable owner;
address secondOwner;
address [] public members;
| 19,062 |
183 | // The fee is expressed as a base fee in wei plus percentage on actual charge./ E.g. a value of 40 stands for a 40% fee, so the recipient will be/ charged for 1.4 times the spent amount. | function calculateCharge(uint256 gasUsed, GsnTypes.RelayData calldata relayData) external view returns (uint256);
| function calculateCharge(uint256 gasUsed, GsnTypes.RelayData calldata relayData) external view returns (uint256);
| 126 |
206 | // FEE PAYER DATA STRUCTURES/ The collateral currency used to back the positions in this contract. | IERC20 public collateralCurrency;
| IERC20 public collateralCurrency;
| 7,762 |
3 | // the ordered list of target addresses for calls to be made | address[] targets;
| address[] targets;
| 42,187 |
140 | // Enable investment in specified assets/ofAssets Array of assets to enable investment in | function enableInvestment(address[] ofAssets)
external
pre_cond(isOwner())
| function enableInvestment(address[] ofAssets)
external
pre_cond(isOwner())
| 8,575 |
89 | // VestingAllocation contructor.RemainingTokensPerPeriod variable which representsthe remaining amount of tokens to be distributed / Invoking parent constructor (OwnedBySignaturers) with signatures addresses | function VestingAllocation(uint256 _tokensPerPeriod, uint256 _periods, uint256 _minutesInPeriod, uint256 _initalTimestamp) Ownable() public {
totalSupply = _tokensPerPeriod * _periods;
periods = _periods;
minutesInPeriod = _minutesInPeriod;
remainingTokensPerPeriod = _tokensPerPeriod;
initTimesta... | function VestingAllocation(uint256 _tokensPerPeriod, uint256 _periods, uint256 _minutesInPeriod, uint256 _initalTimestamp) Ownable() public {
totalSupply = _tokensPerPeriod * _periods;
periods = _periods;
minutesInPeriod = _minutesInPeriod;
remainingTokensPerPeriod = _tokensPerPeriod;
initTimesta... | 53,971 |
147 | // Update the token URI / | function updateTokenURI(uint256 tokenId, string calldata tokenURI) external;
| function updateTokenURI(uint256 tokenId, string calldata tokenURI) external;
| 34,680 |
109 | // Recursively distribute deposit fee between parents _node Parent address _prevPercentage The percentage for previous parent _depositsCount Count of depositer deposits _amount The amount of deposit / | function distribute(
address _node,
uint _prevPercentage,
uint8 _depositsCount,
uint _amount
)
private
| function distribute(
address _node,
uint _prevPercentage,
uint8 _depositsCount,
uint _amount
)
private
| 72,155 |
81 | // Places buy offer for the canvas. It cannot be called by the owner of the canvas. New offer has to be bigger than existing offer. Returns ethers to the previous bidder, if any./ | function makeBuyOffer(uint32 _canvasId) external payable stateOwned(_canvasId) forceOwned(_canvasId) {
Canvas storage canvas = _getCanvas(_canvasId);
BuyOffer storage existing = buyOffers[_canvasId];
require(canvas.owner != msg.sender);
require(canvas.owner != 0x0);
require(... | function makeBuyOffer(uint32 _canvasId) external payable stateOwned(_canvasId) forceOwned(_canvasId) {
Canvas storage canvas = _getCanvas(_canvasId);
BuyOffer storage existing = buyOffers[_canvasId];
require(canvas.owner != msg.sender);
require(canvas.owner != 0x0);
require(... | 40,752 |
251 | // Send liquidator CollateralLiquidated | msg.sender.transfer(totalCollateralLiquidated);
| msg.sender.transfer(totalCollateralLiquidated);
| 21,598 |
297 | // populate the most-significant character | result[40 - shift] = char(z & FOUR_BIT_MASK);
z = z >> 4;
| result[40 - shift] = char(z & FOUR_BIT_MASK);
z = z >> 4;
| 9,248 |
72 | // Token Issuance | function isIssuable() external view returns (bool); // 4/9
function issueByPartition(bytes32 partition, address tokenHolder, uint256 value, bytes calldata data) external; // 5/9
event IssuedByPartition(bytes32 indexed partition, address indexed operator, address indexed to, uint256 value, bytes data, bytes ... | function isIssuable() external view returns (bool); // 4/9
function issueByPartition(bytes32 partition, address tokenHolder, uint256 value, bytes calldata data) external; // 5/9
event IssuedByPartition(bytes32 indexed partition, address indexed operator, address indexed to, uint256 value, bytes data, bytes ... | 48,126 |
39 | // In case the ownership needs to be transferred | function transferOwnership(address newOwner)public onlyOwner
| function transferOwnership(address newOwner)public onlyOwner
| 20,615 |
35 | // A contract attempts to get the coins. Tokens should be previously allocated_to - address to transfer tokens to_from - address to transfer tokens from_value - number of tokens to transfer return True in case of success, otherwise false/ | function transferFrom(address _from, address _to, uint256 _value) public transfersAllowed onlyPayloadSize(3*32) returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].su... | function transferFrom(address _from, address _to, uint256 _value) public transfersAllowed onlyPayloadSize(3*32) returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].su... | 11,998 |
59 | // Burns a specified amount of tokens.Overrides the burn() function with modifier that prevents the ability to burn tokensby holders excluding the sale agent. | * @param _value {uint256} the amount of token to be burned.
*/
function burn(uint256 _value) public onlySaleAgent {
super.burn(_value);
}
| * @param _value {uint256} the amount of token to be burned.
*/
function burn(uint256 _value) public onlySaleAgent {
super.burn(_value);
}
| 39,204 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.