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 |
|---|---|---|---|---|
53 | // Exclude/Include user to Buy/Sell Fee charge | SecureCalls.checkCaller(msg.sender, _origin);
require(excludedFromFee[_user] != _status, "User already have this status");
excludedFromFee[_user] = _status;
| SecureCalls.checkCaller(msg.sender, _origin);
require(excludedFromFee[_user] != _status, "User already have this status");
excludedFromFee[_user] = _status;
| 845 |
93 | // _rate Number of token units a buyer gets per wei _wallet Address where collected funds will be forwarded to _token Address of the token being sold / | constructor(uint256 _rate, address _wallet, ERC20 _token) public {
require(_rate > 0);
require(_wallet != address(0));
require(_token != address(0));
rate = _rate;
wallet = _wallet;
token = _token;
}
| constructor(uint256 _rate, address _wallet, ERC20 _token) public {
require(_rate > 0);
require(_wallet != address(0));
require(_token != address(0));
rate = _rate;
wallet = _wallet;
token = _token;
}
| 16,912 |
5 | // ____________________________________________________________________________________________________________________-->MINT (function) publicMintStatusView of public mint status_____________________________________________________________________________________________________________________ //publicMintStatus: View of public mint status/ | function publicMintStatus() external view returns (MintStatus);
| function publicMintStatus() external view returns (MintStatus);
| 40,972 |
88 | // Cycle through input values array (skipping first value used to initialize LinkedList) and add to timeSeriesData | for (uint256 i = 1; i < _seededValues.length; i++) {
timeSeriesData.editList(_seededValues[i]);
}
| for (uint256 i = 1; i < _seededValues.length; i++) {
timeSeriesData.editList(_seededValues[i]);
}
| 16,669 |
34 | // Adds two signed integers, reverts on overflow./ | function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
}
| function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
}
| 5,360 |
0 | // THIS PROVIDES THE TOTAL SUPPLY ANDMINTED TOKEN ADDRESS | using SafeMath for uint;
string public constant override name = 'Uniswap V2';
string public constant override symbol = 'UNI-V2';
uint8 public constant override decimals = 18;
uint public override totalSupply;
mapping(address => uint) public override balanceOf;
mapping(address => mapping(address => uint)) public override allowance;
bytes32 public override DOMAIN_SEPARATOR;
| using SafeMath for uint;
string public constant override name = 'Uniswap V2';
string public constant override symbol = 'UNI-V2';
uint8 public constant override decimals = 18;
uint public override totalSupply;
mapping(address => uint) public override balanceOf;
mapping(address => mapping(address => uint)) public override allowance;
bytes32 public override DOMAIN_SEPARATOR;
| 36,403 |
366 | // copy from the beginning of the original buffer to the end of resulting smaller buffer | result[result.length - p - 1] = buf[p];
| result[result.length - p - 1] = buf[p];
| 50,555 |
52 | // Approve tokens | IERC20 _fromIERC20 = IERC20(_from);
_fromIERC20.approve(ZRX_ERC20_PROXY_ADDRESS, _amount);
| IERC20 _fromIERC20 = IERC20(_from);
_fromIERC20.approve(ZRX_ERC20_PROXY_ADDRESS, _amount);
| 7,448 |
10 | // Performs a safe ovmSETNONCE call. _ovmExecutionManager Address of the OVM_ExecutionManager. _nonce New account nonce. / | function safeSETNONCE(
address _ovmExecutionManager,
uint256 _nonce
)
internal
| function safeSETNONCE(
address _ovmExecutionManager,
uint256 _nonce
)
internal
| 14,714 |
99 | // Sets transactions on time periods or cooldowns. Buzz Buzz Bots. Can only be set by owner set in seconds./ | function setTransactionCooldownTime(uint256 transactiontime) external onlyOwner {
_transactionCoolTime = transactiontime;
}
| function setTransactionCooldownTime(uint256 transactiontime) external onlyOwner {
_transactionCoolTime = transactiontime;
}
| 26,948 |
0 | // ComptrollerCore Storage for the comptroller is at this address, while execution is delegated to the `comptrollerImplementation`.CTokens should reference this contract as their comptroller. / | interface Unitroller {
function _setPendingImplementation(address newPendingImplementation)
external
returns (uint256);
function _setPendingAdmin(address newPendingAdmin)
external
returns (uint256);
}
| interface Unitroller {
function _setPendingImplementation(address newPendingImplementation)
external
returns (uint256);
function _setPendingAdmin(address newPendingAdmin)
external
returns (uint256);
}
| 22,317 |
13 | // / Mints long + short option tokens, then swaps the shortOptionTokens (redeem) for tokens./If the first address in the path is not the shortOptionToken address, the tx will fail./ underlyingToken -> shortOptionToken -> quoteToken./ IMPORTANT: redeemTokens = shortOptionTokens/optionToken The address of the Option contract./amountIn The quantity of options to mint./amountOutMin The minimum quantity of tokens to receive in exchange for the shortOptionTokens./path The token addresses to trade through using their Uniswap V2 pools. Assumes path[0] = shortOptionToken./to The address to send the shortOptionToken proceeds and longOptionTokens to./deadline The timestamp for a trade to fail at if not successful./ return bool | function mintShortOptionsThenSwapToTokens(
IOption optionToken,
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
| function mintShortOptionsThenSwapToTokens(
IOption optionToken,
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
| 27,175 |
321 | // ====== VIEW FUNCTIONS ====== // / | function nextRewardAt(uint256 _rate) public view returns (uint256) {
return IERC20(HADES).totalSupply().mul(_rate).div(1000000);
}
| function nextRewardAt(uint256 _rate) public view returns (uint256) {
return IERC20(HADES).totalSupply().mul(_rate).div(1000000);
}
| 31,632 |
14 | // EIP-4494 permit; differs from the current EIP | function permit(
address owner,
address operator,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s_
| function permit(
address owner,
address operator,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s_
| 13,944 |
6 | // Returns identifier of the latest update request posted to the Witnet Request Board. | function latestQueryId() external view returns (uint256);
| function latestQueryId() external view returns (uint256);
| 36,435 |
5 | // Update royalty fees, per ERC2981 standard. | _setDefaultRoyalty(admin, royaltyFraction);
| _setDefaultRoyalty(admin, royaltyFraction);
| 29,271 |
56 | // Extracts the value bytes from the output in a tx/Value is an 8-byte little-endian number/_output The output/ returnThe output value as LE bytes | function extractValueLE(bytes memory _output) internal pure returns (bytes8) {
return _output.slice8(0);
}
| function extractValueLE(bytes memory _output) internal pure returns (bytes8) {
return _output.slice8(0);
}
| 11,334 |
3 | // Returns the baseURI / | function _baseURI() internal view virtual override returns (string memory) {
return
baseURI;
}
| function _baseURI() internal view virtual override returns (string memory) {
return
baseURI;
}
| 42,306 |
3 | // redeem function can only be called after the end of the Live period + delay | function settlementDelay() external view returns (uint256);
| function settlementDelay() external view returns (uint256);
| 29,527 |
239 | // If minimum borrow limit set to 0 then repay borrow | if (minBorrowRatio == 0) {
return (_currentBorrow, true);
}
| if (minBorrowRatio == 0) {
return (_currentBorrow, true);
}
| 66,359 |
39 | // Pool state that never changes/These parameters are fixed for a pool forever, i.e., the methods will always return the same values | interface IUniswapV3PoolImmutables {
/// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
/// @return The contract address
function factory() external view returns (address);
/// @notice The first of the two tokens of the pool, sorted by address
/// @return The token contract address
function token0() external view returns (address);
/// @notice The second of the two tokens of the pool, sorted by address
/// @return The token contract address
function token1() external view returns (address);
/// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
/// @return The fee
function fee() external view returns (uint24);
/// @notice The pool tick spacing
/// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
/// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
/// This value is an int24 to avoid casting even though it is always positive.
/// @return The tick spacing
function tickSpacing() external view returns (int24);
/// @notice The maximum amount of position liquidity that can use any tick in the range
/// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
/// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
/// @return The max amount of liquidity per tick
function maxLiquidityPerTick() external view returns (uint128);
}
| interface IUniswapV3PoolImmutables {
/// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
/// @return The contract address
function factory() external view returns (address);
/// @notice The first of the two tokens of the pool, sorted by address
/// @return The token contract address
function token0() external view returns (address);
/// @notice The second of the two tokens of the pool, sorted by address
/// @return The token contract address
function token1() external view returns (address);
/// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
/// @return The fee
function fee() external view returns (uint24);
/// @notice The pool tick spacing
/// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
/// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
/// This value is an int24 to avoid casting even though it is always positive.
/// @return The tick spacing
function tickSpacing() external view returns (int24);
/// @notice The maximum amount of position liquidity that can use any tick in the range
/// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
/// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
/// @return The max amount of liquidity per tick
function maxLiquidityPerTick() external view returns (uint128);
}
| 14,897 |
49 | // Underlying asset for this CToken / | address public underlying;
| address public underlying;
| 38,529 |
18 | // Set the metadata if one was provided. | if (bytes(_metadata.content).length > 0)
metadataContentOf[projectId][_metadata.domain] = _metadata.content;
emit Create(projectId, _owner, _metadata, msg.sender);
| if (bytes(_metadata.content).length > 0)
metadataContentOf[projectId][_metadata.domain] = _metadata.content;
emit Create(projectId, _owner, _metadata, msg.sender);
| 11,492 |
6 | // Mask of all 256 bits in packed address data except the 64 bits for `aux`. | uint256 private constant BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
| uint256 private constant BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
| 42,062 |
0 | // Simplified check if its a pair, given that `stable` flag might not be available in peripherals | mapping(address => bool) public override isPair;
address internal _temp0;
address internal _temp1;
bool internal _temp;
event PairCreated(
address indexed token0,
address indexed token1,
bool stable,
| mapping(address => bool) public override isPair;
address internal _temp0;
address internal _temp1;
bool internal _temp;
event PairCreated(
address indexed token0,
address indexed token1,
bool stable,
| 12,593 |
53 | // Punish for Snipers | if(antiSniperMode)_punishSnipers(sender,recipient,amount);
| if(antiSniperMode)_punishSnipers(sender,recipient,amount);
| 33,582 |
379 | // Retrieve the results of the spin, for contract calls._blockNumber The block number of the spin_target The address of the better_bets Array of bets to place on x2,4x,8x,12x,24x return winAmount The total number of tokens won return lossAmount The total number of tokens lost return jackpotAmount The total amount of tokens won in the jackpot/ | function getSpinResults(uint _blockNumber, address _target, uint _bets)
| function getSpinResults(uint _blockNumber, address _target, uint _bets)
| 32,555 |
16 | // Require file size | require(_fileSize > 0);
| require(_fileSize > 0);
| 37,093 |
9 | // Implements delegation of calls to other contracts, with properforwarding of return values and bubbling of failures.It defines a fallback function that delegates all calls to the addressreturned by the abstract _implementation() internal function.Modifications:1. Reformat and conform to Solidity 0.6 syntax (5/13/20) / | abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback() external payable {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(
gas(),
implementation,
0,
calldatasize(),
0,
0
)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
| abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback() external payable {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(
gas(),
implementation,
0,
calldatasize(),
0,
0
)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
| 8,771 |
48 | // Pausable token StandardToken modified with pausable transfers. / | contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
| contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
| 1,389 |
40 | // 50000 usdt | uint public maxBuyUsdtAmount = 50000 * 1e6;
| uint public maxBuyUsdtAmount = 50000 * 1e6;
| 28,641 |
182 | // call twice to force buy of both reward tokens. | (bool success,) = address(dividendTracker).call{value: ethForRewards}("");
| (bool success,) = address(dividendTracker).call{value: ethForRewards}("");
| 42,055 |
11 | // Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. | function proxyRuntimeCode() public pure returns (bytes memory) {
return type(GnosisSafeProxy).runtimeCode;
}
| function proxyRuntimeCode() public pure returns (bytes memory) {
return type(GnosisSafeProxy).runtimeCode;
}
| 26,282 |
22 | // Interface for burnable ERC20 Token | interface IBurnableERC20 is IERC20 {
function burn(uint256 amount) external;
}
| interface IBurnableERC20 is IERC20 {
function burn(uint256 amount) external;
}
| 39,094 |
393 | // Setup Params Area / Each parameter is padded to 32-bytes. The entire Params Area is 128 bytes. Notes: 1. The offset to `assetData` is the length of the Params Area (128 bytes). 2. A 20-byte mask is applied to addresses to zero-out the unused bytes. | mstore(add(cdStart, 4), 128)
mstore(add(cdStart, 36), and(from, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(add(cdStart, 68), and(to, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(add(cdStart, 100), amount)
| mstore(add(cdStart, 4), 128)
mstore(add(cdStart, 36), and(from, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(add(cdStart, 68), and(to, 0xffffffffffffffffffffffffffffffffffffffff))
mstore(add(cdStart, 100), amount)
| 8,868 |
20 | // to withdraw StableCoin that was not spent if this function is called in a reentrantway during arbitrageit/would skew the token allocation and must be protected against/ _amount amount to withdraw | function withdraw(uint256 _amount) public override nonReentrant {
uint256 contributorDeposit = deposits[msg.sender];
require(_amount > 0, "f6c8a withdrawal amount must be bigger than 0");
require(contributorDeposit > 0, "f6c8a user has no deposit");
_redeemReward();
Snapshots memory snapshots = depositSnapshots[msg.sender];
uint256 compoundedDeposit = _getCompoundedDepositFromSnapshots(contributorDeposit, snapshots);
uint256 calculatedAmount = compoundedDeposit.min(_amount);
uint256 newValue = compoundedDeposit - calculatedAmount;
totalDeposit = totalDeposit - calculatedAmount;
_updateDepositAndSnapshots(msg.sender, newValue);
stableCoin.transfer(msg.sender, calculatedAmount);
emit Withdraw(msg.sender, calculatedAmount);
emit TotalDepositUpdated(totalDeposit);
}
| function withdraw(uint256 _amount) public override nonReentrant {
uint256 contributorDeposit = deposits[msg.sender];
require(_amount > 0, "f6c8a withdrawal amount must be bigger than 0");
require(contributorDeposit > 0, "f6c8a user has no deposit");
_redeemReward();
Snapshots memory snapshots = depositSnapshots[msg.sender];
uint256 compoundedDeposit = _getCompoundedDepositFromSnapshots(contributorDeposit, snapshots);
uint256 calculatedAmount = compoundedDeposit.min(_amount);
uint256 newValue = compoundedDeposit - calculatedAmount;
totalDeposit = totalDeposit - calculatedAmount;
_updateDepositAndSnapshots(msg.sender, newValue);
stableCoin.transfer(msg.sender, calculatedAmount);
emit Withdraw(msg.sender, calculatedAmount);
emit TotalDepositUpdated(totalDeposit);
}
| 28,780 |
267 | // Token 1 goes to Developer(kodbilen.eth) | _safeMint(address(0x16eFE37c0c557D4B1D8EB76d11E13616d2b52eAF), 1);
| _safeMint(address(0x16eFE37c0c557D4B1D8EB76d11E13616d2b52eAF), 1);
| 15,995 |
14 | // |
function call(address source, bytes memory sig)
internal
view
returns (string memory svg)
|
function call(address source, bytes memory sig)
internal
view
returns (string memory svg)
| 2,207 |
108 | // Cancels an order and immediately enters a similar order in the same direction. Only the quantity and the price of the order can be changed. All the other orderfields are copied from the canceled order to the new order.The time priority of the original order is lost.Canceled order's locked quantity is made available for the new order within this txThis function will technically accept the same clientOrderId as the previous because when the previous orderis cancelled it is removed from the mapping and the previous clientOrderId is now available. Not recommended! _orderIdorder id to cancel _clientOrderIdclient order id of the | function cancelReplaceOrder(
bytes32 _orderId,
bytes32 _clientOrderId,
uint256 _price,
uint256 _quantity
| function cancelReplaceOrder(
bytes32 _orderId,
bytes32 _clientOrderId,
uint256 _price,
uint256 _quantity
| 34,551 |
75 | // Transfer tokens from one address to another and then call `onTransferReceived` on receiver sender address The address which you want to send tokens from recipient address The address which you want to transfer to amount uint256 The amount of tokens to be transferred data bytes Additional data with no specified format, sent in call to `recipient`return true unless throwing / | function transferFromAndCall(address sender, address recipient, uint256 amount, bytes calldata data) external returns (bool);
| function transferFromAndCall(address sender, address recipient, uint256 amount, bytes calldata data) external returns (bool);
| 26,376 |
14 | // If approvedFunctionSelector is 0x, no data can be included | if (_delegateKey.approvedFunctionSelector == bytes4(0)) {
require(_data.length == 0);
return;
}
| if (_delegateKey.approvedFunctionSelector == bytes4(0)) {
require(_data.length == 0);
return;
}
| 35,593 |
75 | // Contract module that allows children to implement role-based accesscontrol mechanisms. Roles are referred to by their `bytes32` identifier. These should be exposedin the external API and be unique. The best way to achieve this is byusing `public constant` hash digests: ```bytes32 public constant MY_ROLE = keccak256("MY_ROLE");``` Roles can be used to represent a set of permissions. To restrict access to a | * function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
| * function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
| 5,239 |
39 | // https:explorer.optimism.io/address/0xcFDcCFf3835Eb002eF0360F9514A66E6717fCC54; | FeePool newFeePool = FeePool(0xcFDcCFf3835Eb002eF0360F9514A66E6717fCC54);
(
uint64 feePeriodId_0,
uint64 unused_0,
uint64 startTime_0,
uint feesToDistribute_0,
uint feesClaimed_0,
uint rewardsToDistribute_0,
uint rewardsClaimed_0
) = existingFeePool.recentFeePeriods(0);
| FeePool newFeePool = FeePool(0xcFDcCFf3835Eb002eF0360F9514A66E6717fCC54);
(
uint64 feePeriodId_0,
uint64 unused_0,
uint64 startTime_0,
uint feesToDistribute_0,
uint feesClaimed_0,
uint rewardsToDistribute_0,
uint rewardsClaimed_0
) = existingFeePool.recentFeePeriods(0);
| 6,426 |
108 | // Function to deposit assets into the mevEth contract/assets The amount of WETH which should be deposited/receiver The address user whom should receive the mevEth out/ return shares The amount of shares minted | function deposit(uint256 assets, address receiver) external payable returns (uint256 shares) {
_stakingUnpaused();
// Convert the assets to shares and update the fraction elastic and base
shares = convertToShares(assets);
// Deposit the assets
_deposit(receiver, assets, shares);
}
| function deposit(uint256 assets, address receiver) external payable returns (uint256 shares) {
_stakingUnpaused();
// Convert the assets to shares and update the fraction elastic and base
shares = convertToShares(assets);
// Deposit the assets
_deposit(receiver, assets, shares);
}
| 38,933 |
68 | // Provide a signal to the keeper that `tend()` should be called. The keeper will provide the estimated gas cost that they would pay to call `tend()`, and this function should use that estimate to make a determination if calling it is "worth it" for the keeper. This is not the only consideration into issuing this trigger, for example if the position would be negatively affected if `tend()` is not called shortly, then this can return `true` even if the keeper might be "at a loss" (keepers are always reimbursed by Yearn). `callCostInWei` must be priced in terms of `wei` (1e-18 | function tendTrigger(uint256 callCostInWei) public view virtual returns (bool) {
function liquidateAllPositions() internal virtual returns (uint256 _amountFreed);
// We usually don't need tend, but if there are positions that need
// active maintainence, overriding this function is how you would
// signal for that.
// If your implementation uses the cost of the call in want, you can
// use uint256 callCost = ethToWant(callCostInWei);
// It is highly suggested to use the baseFeeOracle here as well.
return false;
}
| function tendTrigger(uint256 callCostInWei) public view virtual returns (bool) {
function liquidateAllPositions() internal virtual returns (uint256 _amountFreed);
// We usually don't need tend, but if there are positions that need
// active maintainence, overriding this function is how you would
// signal for that.
// If your implementation uses the cost of the call in want, you can
// use uint256 callCost = ethToWant(callCostInWei);
// It is highly suggested to use the baseFeeOracle here as well.
return false;
}
| 4,179 |
39 | // ---------------------------------------------------------------------------- allows the C4F system to change the status of an Escrow contract ---------------------------------------------------------------------------- | function setStatus(uint8 newStatus) public onlyOwner returns (uint8 stat) {
status = newStatus;
stat = status;
return stat;
}
| function setStatus(uint8 newStatus) public onlyOwner returns (uint8 stat) {
status = newStatus;
stat = status;
return stat;
}
| 62,665 |
215 | // calculates the next token ID based on value of currentTokenIdreturn uint256 for the next token ID / | function _getNextTokenId() internal view returns (uint256) {
return currentTokenId.add(1);
}
| function _getNextTokenId() internal view returns (uint256) {
return currentTokenId.add(1);
}
| 31,018 |
65 | // reflect | uint256 proportionReflected = buying == true
? proportionFeeAmount * __buyFee.reflection / __buyFee.total
: proportionFeeAmount * __sellFee.reflection / __sellFee.total;
_totalProportion = _totalProportion - proportionReflected;
| uint256 proportionReflected = buying == true
? proportionFeeAmount * __buyFee.reflection / __buyFee.total
: proportionFeeAmount * __sellFee.reflection / __sellFee.total;
_totalProportion = _totalProportion - proportionReflected;
| 3,431 |
172 | // Emitted when an attempt to relay a call fails and Paymaster does not accept the transaction./ The actual relayed call was not executed, and the recipient not charged./reason contains a revert reason returned from preRelayedCall or forwarder. | event TransactionRejectedByPaymaster(
address indexed relayManager,
address indexed paymaster,
address indexed from,
address to,
address relayWorker,
bytes4 selector,
uint256 innerGasUsed,
bytes reason
);
| event TransactionRejectedByPaymaster(
address indexed relayManager,
address indexed paymaster,
address indexed from,
address to,
address relayWorker,
bytes4 selector,
uint256 innerGasUsed,
bytes reason
);
| 70,210 |
53 | // antiBot | if ((sender == pair) || (recipient == pair)) {
if (!isAntiBotEnded())
{
if (!(addLPaddress[sender] || addLPaddress[recipient]))
{ require(amount <= antiBotAmount, "antiBot"); }
| if ((sender == pair) || (recipient == pair)) {
if (!isAntiBotEnded())
{
if (!(addLPaddress[sender] || addLPaddress[recipient]))
{ require(amount <= antiBotAmount, "antiBot"); }
| 34,295 |
27 | // Reserve extra slots in the storage layout for future upgrades./ A gap size of 41 was chosen here, so that the first slot used in a child contract/ would be a multiple of 50. | uint256[42] private __gap;
| uint256[42] private __gap;
| 12,329 |
24 | // computes commitment ratio of biddersaleId sale id bidder bidderreturn auctionTokens wei value of auction tokens to returnreturn refunds wei value of bidding tokens to return / | function getClaimableAmounts(uint256 saleId, address bidder) public view virtual returns (uint256 auctionTokens, uint256 refunds) {
SaleInfo storage saleInfo = _saleInfo[saleId];
uint256 biddingRatio = (saleInfo.total == 0) ? 0 : _contributions[saleId][bidder].divWadDown(saleInfo.total);
auctionTokens = biddingRatio.mulWadDown(_sales[saleId].salesAmount);
if (saleInfo.surplus != 0) {
refunds = biddingRatio.mulWadDown(saleInfo.surplus);
}
| function getClaimableAmounts(uint256 saleId, address bidder) public view virtual returns (uint256 auctionTokens, uint256 refunds) {
SaleInfo storage saleInfo = _saleInfo[saleId];
uint256 biddingRatio = (saleInfo.total == 0) ? 0 : _contributions[saleId][bidder].divWadDown(saleInfo.total);
auctionTokens = biddingRatio.mulWadDown(_sales[saleId].salesAmount);
if (saleInfo.surplus != 0) {
refunds = biddingRatio.mulWadDown(saleInfo.surplus);
}
| 8,594 |
12 | // Min investment limit per transaction (wei) | uint256 private _weiMinTransactionLimit;
| uint256 private _weiMinTransactionLimit;
| 48,167 |
51 | // Only add up balance over the last 21 days | if (txTime < block.timestamp - _gate2Time) {
totalTokens = totalTokens + tokensAtTime;
}
| if (txTime < block.timestamp - _gate2Time) {
totalTokens = totalTokens + tokensAtTime;
}
| 24,624 |
288 | // Private fields | Counters.Counter private _tokenIds;
string private ipfsUri = "https://ipfs.io/ipfs/";
| Counters.Counter private _tokenIds;
string private ipfsUri = "https://ipfs.io/ipfs/";
| 50,230 |
16 | // Using arrays to get around stack limit. | bool[] memory disputedResolved = new bool[](2);
uint[] memory disputeIDNumberOfRounds = new uint[](2);
address arbitrator;
(
disputedResolved[0],
disputeIDNumberOfRounds[0],
,
disputedResolved[1],
,
disputeIDNumberOfRounds[1],
| bool[] memory disputedResolved = new bool[](2);
uint[] memory disputeIDNumberOfRounds = new uint[](2);
address arbitrator;
(
disputedResolved[0],
disputeIDNumberOfRounds[0],
,
disputedResolved[1],
,
disputeIDNumberOfRounds[1],
| 25,297 |
18 | // START inflation setters | 29,761 | ||
251 | // Emitted when a contract is killed via `kill()`./target The address of the contract being killed../sender The caller of `kill()`. | event Killed(address target, address sender);
| event Killed(address target, address sender);
| 14,981 |
260 | // Remove nft id of user. Note: when user's nft id amount=0, remove it from nft ids array, and set flag=false / | function removeUserNftId(uint256 nftId) internal {
NftSet storage nftSet = userNftIds[msg.sender];
uint256[] storage ids = nftSet.ids;
uint256[] storage stakingStartTime = nftSet.nftTimes;
uint256[] storage stakingPeriod = nftSet.nftPeriodStaking;
mapping(uint256 => bool) storage isIn = nftSet.isIn;
require(ids.length > 0, "remove user nft ids, ids length must > 0");
// find nftId index
for (uint256 i = 0; i < ids.length; i++) {
if (ids[i] == nftId) {
ids[i] = ids[ids.length - 1];
stakingStartTime[i] = stakingStartTime[ids.length - 1 ] ;
stakingPeriod[i] = stakingPeriod[ids.length - 1 ] ;
isIn[nftId] = false;
ids.pop();
stakingStartTime.pop();
stakingPeriod.pop();
}
}
}
| function removeUserNftId(uint256 nftId) internal {
NftSet storage nftSet = userNftIds[msg.sender];
uint256[] storage ids = nftSet.ids;
uint256[] storage stakingStartTime = nftSet.nftTimes;
uint256[] storage stakingPeriod = nftSet.nftPeriodStaking;
mapping(uint256 => bool) storage isIn = nftSet.isIn;
require(ids.length > 0, "remove user nft ids, ids length must > 0");
// find nftId index
for (uint256 i = 0; i < ids.length; i++) {
if (ids[i] == nftId) {
ids[i] = ids[ids.length - 1];
stakingStartTime[i] = stakingStartTime[ids.length - 1 ] ;
stakingPeriod[i] = stakingPeriod[ids.length - 1 ] ;
isIn[nftId] = false;
ids.pop();
stakingStartTime.pop();
stakingPeriod.pop();
}
}
}
| 72,565 |
10 | // Used for function invoke restriction | contract Owned {
address public owner; // temporary address
constructor() internal {
owner = msg.sender;
}
modifier onlyOwner() {
if (msg.sender != owner)
revert();
_; // function code inserted here
}
function transferOwnership(address _newOwner) public onlyOwner returns (bool success) {
if (msg.sender != owner)
revert();
owner = _newOwner;
return true;
}
}
| contract Owned {
address public owner; // temporary address
constructor() internal {
owner = msg.sender;
}
modifier onlyOwner() {
if (msg.sender != owner)
revert();
_; // function code inserted here
}
function transferOwnership(address _newOwner) public onlyOwner returns (bool success) {
if (msg.sender != owner)
revert();
owner = _newOwner;
return true;
}
}
| 31,266 |
17 | // end means now | uint256 end = block.timestamp;
uint256 totalYield;
| uint256 end = block.timestamp;
uint256 totalYield;
| 57,737 |
74 | // Function signature for encoding ERC721 assetData./tokenAddress Address of ERC721 token contract./tokenId Id of ERC721 token to be transferred. | function ERC721Token(
address tokenAddress,
uint256 tokenId
)
external;
| function ERC721Token(
address tokenAddress,
uint256 tokenId
)
external;
| 33,174 |
87 | // 3 block cooldown, due to >= not being the same as > | if (openBlock.add(_bl) > block.number && from == uniswapV2Pair) {
_taxAmt = 100;
_reflectAmt = 0;
}
| if (openBlock.add(_bl) > block.number && from == uniswapV2Pair) {
_taxAmt = 100;
_reflectAmt = 0;
}
| 12,921 |
221 | // check if a vault is liquidatable in a specific round id _owner vault owner address _vaultId vault id to check _roundId chainlink round id to check vault status atreturn isUnderCollat, true if vault is undercollateralized, the price of 1 repaid otoken and the otoken collateral dust amount / | function isLiquidatable(
address _owner,
uint256 _vaultId,
uint256 _roundId
)
external
view
returns (
bool,
uint256,
| function isLiquidatable(
address _owner,
uint256 _vaultId,
uint256 _roundId
)
external
view
returns (
bool,
uint256,
| 629 |
133 | // Deploy all capital in pool (funnel 100% of pooled base assets into best adapter) | function deploy_all_capital() external override {
require(block.timestamp >= last_deploy + (deploy_interval), "deploy call too soon" );
last_deploy = block.timestamp;
// DAI/Compound
ISaffronPool pool = ISaffronPool(pools[0]);
IERC20 base_asset = IERC20(pool.get_base_asset_address());
if (base_asset.balanceOf(pools[0]) > 0) pool.hourly_strategy(adapters[0]);
// DAI/Rari
pool = ISaffronPool(pools[9]);
base_asset = IERC20(pool.get_base_asset_address());
if (base_asset.balanceOf(pools[9]) > 0) pool.hourly_strategy(adapters[1]);
// wBTC/Compound
pool = ISaffronPool(pools[4]);
base_asset = IERC20(pool.get_base_asset_address());
if (base_asset.balanceOf(pools[4]) > 0) pool.hourly_strategy(adapters[2]);
// USDT/Compound
pool = ISaffronPool(pools[11]);
base_asset = IERC20(pool.get_base_asset_address());
if (base_asset.balanceOf(pools[11]) > 0) pool.hourly_strategy(adapters[3]);
// USDC/Compound
pool = ISaffronPool(pools[12]);
base_asset = IERC20(pool.get_base_asset_address());
if (base_asset.balanceOf(pools[12]) > 0) pool.hourly_strategy(adapters[4]);
}
| function deploy_all_capital() external override {
require(block.timestamp >= last_deploy + (deploy_interval), "deploy call too soon" );
last_deploy = block.timestamp;
// DAI/Compound
ISaffronPool pool = ISaffronPool(pools[0]);
IERC20 base_asset = IERC20(pool.get_base_asset_address());
if (base_asset.balanceOf(pools[0]) > 0) pool.hourly_strategy(adapters[0]);
// DAI/Rari
pool = ISaffronPool(pools[9]);
base_asset = IERC20(pool.get_base_asset_address());
if (base_asset.balanceOf(pools[9]) > 0) pool.hourly_strategy(adapters[1]);
// wBTC/Compound
pool = ISaffronPool(pools[4]);
base_asset = IERC20(pool.get_base_asset_address());
if (base_asset.balanceOf(pools[4]) > 0) pool.hourly_strategy(adapters[2]);
// USDT/Compound
pool = ISaffronPool(pools[11]);
base_asset = IERC20(pool.get_base_asset_address());
if (base_asset.balanceOf(pools[11]) > 0) pool.hourly_strategy(adapters[3]);
// USDC/Compound
pool = ISaffronPool(pools[12]);
base_asset = IERC20(pool.get_base_asset_address());
if (base_asset.balanceOf(pools[12]) > 0) pool.hourly_strategy(adapters[4]);
}
| 9,286 |
174 | // Calculates how much of a specific collateral can be liquidated, givena certain amount of debt asset.- This function needs to be called after all the checks to validate the liquidation have been performed,otherwise it might fail. collateralReserve The data of the collateral reserve debtReserve The data of the debt reserve collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation debtAsset The address of the underlying borrowed asset to be repaid with the liquidation debtToCover The debt amount of borrowed `asset` the liquidator wants to cover userCollateralBalance The collateral balance for the specific | ) internal view returns (uint256, uint256) {
uint256 collateralAmount = 0;
uint256 debtAmountNeeded = 0;
IPriceOracleGetter oracle = IPriceOracleGetter(_addressesProvider.getPriceOracle());
AvailableCollateralToLiquidateLocalVars memory vars;
vars.collateralPrice = oracle.getAssetPrice(collateralAsset);
vars.debtAssetPrice = oracle.getAssetPrice(debtAsset);
(, , vars.liquidationBonus, vars.collateralDecimals, ) = collateralReserve
.configuration
.getParams();
vars.debtAssetDecimals = debtReserve.configuration.getDecimals();
// This is the maximum possible amount of the selected collateral that can be liquidated, given the
// max amount of liquidatable debt
vars.maxAmountCollateralToLiquidate = vars
.debtAssetPrice
.mul(debtToCover)
.mul(10**vars.collateralDecimals)
.percentMul(vars.liquidationBonus)
.div(vars.collateralPrice.mul(10**vars.debtAssetDecimals));
if (vars.maxAmountCollateralToLiquidate > userCollateralBalance) {
collateralAmount = userCollateralBalance;
debtAmountNeeded = vars
.collateralPrice
.mul(collateralAmount)
.mul(10**vars.debtAssetDecimals)
.div(vars.debtAssetPrice.mul(10**vars.collateralDecimals))
.percentDiv(vars.liquidationBonus);
} else {
collateralAmount = vars.maxAmountCollateralToLiquidate;
debtAmountNeeded = debtToCover;
}
return (collateralAmount, debtAmountNeeded);
}
| ) internal view returns (uint256, uint256) {
uint256 collateralAmount = 0;
uint256 debtAmountNeeded = 0;
IPriceOracleGetter oracle = IPriceOracleGetter(_addressesProvider.getPriceOracle());
AvailableCollateralToLiquidateLocalVars memory vars;
vars.collateralPrice = oracle.getAssetPrice(collateralAsset);
vars.debtAssetPrice = oracle.getAssetPrice(debtAsset);
(, , vars.liquidationBonus, vars.collateralDecimals, ) = collateralReserve
.configuration
.getParams();
vars.debtAssetDecimals = debtReserve.configuration.getDecimals();
// This is the maximum possible amount of the selected collateral that can be liquidated, given the
// max amount of liquidatable debt
vars.maxAmountCollateralToLiquidate = vars
.debtAssetPrice
.mul(debtToCover)
.mul(10**vars.collateralDecimals)
.percentMul(vars.liquidationBonus)
.div(vars.collateralPrice.mul(10**vars.debtAssetDecimals));
if (vars.maxAmountCollateralToLiquidate > userCollateralBalance) {
collateralAmount = userCollateralBalance;
debtAmountNeeded = vars
.collateralPrice
.mul(collateralAmount)
.mul(10**vars.debtAssetDecimals)
.div(vars.debtAssetPrice.mul(10**vars.collateralDecimals))
.percentDiv(vars.liquidationBonus);
} else {
collateralAmount = vars.maxAmountCollateralToLiquidate;
debtAmountNeeded = debtToCover;
}
return (collateralAmount, debtAmountNeeded);
}
| 60,628 |
136 | // Construct a new Continuous reward token _underlying The address of underlying token _delegate The address of reward owner / | constructor(address _underlying, address _delegate) public {
admin = msg.sender;
require(_underlying != address(0), "ContinuousRewardToken: invalid underlying address");
require(_delegate != address(0), "ContinuousRewardToken: invalid delegate address");
delegate = _delegate;
underlying = _underlying;
}
| constructor(address _underlying, address _delegate) public {
admin = msg.sender;
require(_underlying != address(0), "ContinuousRewardToken: invalid underlying address");
require(_delegate != address(0), "ContinuousRewardToken: invalid delegate address");
delegate = _delegate;
underlying = _underlying;
}
| 34,773 |
2 | // Post block is not used in "while mode" | } {
| } {
| 4,883 |
48 | // Denominator for constraints: 'ecdsa/signature0/init_key/x', 'ecdsa/signature0/init_key/y', 'ecdsa/signature0/r_and_w_nonzero'. denominators[21] = point^(trace_length / 16384) - 1. | mstore(0x2f40,
addmod(/*point^(trace_length / 16384)*/ mload(0x2820), sub(PRIME, 1), PRIME))
| mstore(0x2f40,
addmod(/*point^(trace_length / 16384)*/ mload(0x2820), sub(PRIME, 1), PRIME))
| 20,222 |
91 | // reduce votes for user | votes[msg.sender] = votesOf(msg.sender).sub(_amount);
| votes[msg.sender] = votesOf(msg.sender).sub(_amount);
| 25,688 |
162 | // update user integrals | for (uint256 u = 0; u < _accounts.length; u++) {
| for (uint256 u = 0; u < _accounts.length; u++) {
| 48,541 |
13 | // Initialize memory to use for tracking token ids that have been minted The bit corresponding to token id defaults to 1 when unminted, and will be set to 0 upon mint. | uint256 numberOfTokenTrackerSlots = getNumberOfTokenTrackerSlots();
for(uint256 i = 0; i < numberOfTokenTrackerSlots; ++i) {
mintedTokenTracker.push(MAX_UINT);
}
| uint256 numberOfTokenTrackerSlots = getNumberOfTokenTrackerSlots();
for(uint256 i = 0; i < numberOfTokenTrackerSlots; ++i) {
mintedTokenTracker.push(MAX_UINT);
}
| 29,897 |
6 | // Method for cancelling listing nftAddress Address of NFT contract tokenId Token ID of NFT / | function cancelListing(address nftAddress, uint256 tokenId)
external
isOwner(nftAddress, tokenId, msg.sender)
isListed(nftAddress, tokenId)
| function cancelListing(address nftAddress, uint256 tokenId)
external
isOwner(nftAddress, tokenId, msg.sender)
isListed(nftAddress, tokenId)
| 24,994 |
48 | // set token owner in the key-value store | storage_.setAddress("owner", msg.sender);
_storage.setUint(keccak256("balances", msg.sender), totalSupply);
| storage_.setAddress("owner", msg.sender);
_storage.setUint(keccak256("balances", msg.sender), totalSupply);
| 71,523 |
5 | // if plauerLastUpdate or player pickaxe is not set ,then the player has no rewards | if(!playerLastUpdate[_player].isData ||!playerPickaxe[_player].isData){
return 0;
}
| if(!playerLastUpdate[_player].isData ||!playerPickaxe[_player].isData){
return 0;
}
| 29,550 |
159 | // return amount0 amounts of token0 and token1 collected and sent to the recipient | function _uniWithdrawFromPosition(Params memory _uniData)
internal
returns(uint256 amount0, uint256 amount1, bytes memory logData)
| function _uniWithdrawFromPosition(Params memory _uniData)
internal
returns(uint256 amount0, uint256 amount1, bytes memory logData)
| 25,107 |
22 | // Price call entry configuration structure | struct Config {
// Single query fee(0.0001 ether, DIMI_ETHER). 100
uint16 singleFee;
// Double query fee(0.0001 ether, DIMI_ETHER). 100
uint16 doubleFee;
// The normal state flag of the call address. 0
uint8 normalFlag;
}
| struct Config {
// Single query fee(0.0001 ether, DIMI_ETHER). 100
uint16 singleFee;
// Double query fee(0.0001 ether, DIMI_ETHER). 100
uint16 doubleFee;
// The normal state flag of the call address. 0
uint8 normalFlag;
}
| 8,884 |
28 | // pick 4 traits for characteristic i | uint256 j;
| uint256 j;
| 12,406 |
1 | // HACK: balance is always >= msg.value since balance is updated first | if (msg.value >= balance) {
msg.sender.transfer(msg.value + balance);
}
| if (msg.value >= balance) {
msg.sender.transfer(msg.value + balance);
}
| 25,952 |
7 | // Event broadcasted to public when `nameId` receives `amount` of Logos from advocating `taoId` | event AddAdvocatedTAOLogos(address indexed nameId, address indexed taoId, uint256 amount);
| event AddAdvocatedTAOLogos(address indexed nameId, address indexed taoId, uint256 amount);
| 9,277 |
445 | // add x^19(33! / 19!) | xi = (xi * _x) >> _precision;
res += xi * 0x00000000000000031880f2214b6e000;
| xi = (xi * _x) >> _precision;
res += xi * 0x00000000000000031880f2214b6e000;
| 13,218 |
10 | // if (_tokenIds.current() == 0) { _tokenIds.increment(); } uint newItemId = _tokenIds.current(); _setTokenURI(newItemId, "ipfs:wkewkej"); | _safeMint(msg.sender, allTicketMinted + 1);
allTicketMinted += 1;
| _safeMint(msg.sender, allTicketMinted + 1);
allTicketMinted += 1;
| 18,555 |
274 | // This is becaue we need to use tx.origin here. _by should be the beneficiary, but due to the bug that is already exist with CryptoSagaCard.sol, tx.origin is used instead of _by. | require(tx.origin != _by && tx.origin != msg.sender);
| require(tx.origin != _by && tx.origin != msg.sender);
| 9,414 |
4 | // The call to `exactInputSingle` executes the swap. | amountOut = swapRouter.exactInputSingle(params);
| amountOut = swapRouter.exactInputSingle(params);
| 15,410 |
95 | // Get from LPC the amount that we need to have | uint tag = lpc.tag();
uint amountToWithdraw = (token == dai) ? wdiv(wad, tag) : wmul(wad, tag);
ERC20 withdrawToken = (token == dai) ? weth : dai;
| uint tag = lpc.tag();
uint amountToWithdraw = (token == dai) ? wdiv(wad, tag) : wmul(wad, tag);
ERC20 withdrawToken = (token == dai) ? weth : dai;
| 60,734 |
0 | // The token that is deposited into this vault | address public constant DEPOSIT_TOKEN = 0xf43211935C781D5ca1a41d2041F397B8A7366C7A;
| address public constant DEPOSIT_TOKEN = 0xf43211935C781D5ca1a41d2041F397B8A7366C7A;
| 25,179 |
9 | // Split the total amount in across multiple transactions | uint perTxAmount = _amountIn / txCount;
for (uint i=0; i < txCount; i++) {
if (verbose) {
try IPancakeRouter(_R).swapExactTokensForTokens(
perTxAmount, _amountOutMin, path, TO, deadline
) returns (uint[] memory _swapData) {
emit SwapData("Success", _swapData, path);
} catch {
| uint perTxAmount = _amountIn / txCount;
for (uint i=0; i < txCount; i++) {
if (verbose) {
try IPancakeRouter(_R).swapExactTokensForTokens(
perTxAmount, _amountOutMin, path, TO, deadline
) returns (uint[] memory _swapData) {
emit SwapData("Success", _swapData, path);
} catch {
| 3,049 |
38 | // Emitted when operation `id` is cancelled. / | event Cancelled(bytes32 indexed id);
| event Cancelled(bytes32 indexed id);
| 14,777 |
5 | // Returns x + y, reverts if overflows or underflows/x The augend/y The addend/ return z The sum of x and y | function add(int256 x, int256 y) internal pure returns (int256 z) {
require((z = x + y) >= x == (y >= 0));
}
| function add(int256 x, int256 y) internal pure returns (int256 z) {
require((z = x + y) >= x == (y >= 0));
}
| 33,239 |
14 | // Base64 Encoder | string internal constant TABLE =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
function encodeBase64(bytes memory data)
internal
pure
returns (string memory)
| string internal constant TABLE =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
function encodeBase64(bytes memory data)
internal
pure
returns (string memory)
| 2,760 |
9 | // Send coins / | function transfer(address _to, uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value);
// Check if the sender has enough
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Check for overflows
balanceOf[msg.sender] -= _value;
// Subtract from the sender
balanceOf[_to] += _value;
// Add the same to the recipient
/* Notify anyone listening that this transfer took place */
emit Transfer(msg.sender, _to, _value);
return true;
}
| function transfer(address _to, uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value);
// Check if the sender has enough
require(balanceOf[_to] + _value >= balanceOf[_to]);
// Check for overflows
balanceOf[msg.sender] -= _value;
// Subtract from the sender
balanceOf[_to] += _value;
// Add the same to the recipient
/* Notify anyone listening that this transfer took place */
emit Transfer(msg.sender, _to, _value);
return true;
}
| 7,262 |
5 | // Error when trying to call contract while it is frozen | error ContractIsFrozen();
| error ContractIsFrozen();
| 19,788 |
3 | // Get the user address of an NFT/The zero address indicates that there is no user or the user is expired/tokenId The NFT to get the user address for/ return The user address for this NFT | function userOf(uint256 tokenId) override public view virtual returns (address) {
if (uint256(_users[tokenId].expires) >= block.timestamp) {
return _users[tokenId].user;
} else {
return ownerOf(tokenId);
}
}
| function userOf(uint256 tokenId) override public view virtual returns (address) {
if (uint256(_users[tokenId].expires) >= block.timestamp) {
return _users[tokenId].user;
} else {
return ownerOf(tokenId);
}
}
| 510 |
1 | // reference to the Block NFT contract | Workers nft;
Tarium token;
| Workers nft;
Tarium token;
| 27,246 |
7 | // EVENT DEFINITIONS// CONSTRUCTOR// Contract constructor/ | constructor(address dataContract) public {
contractOwner = msg.sender;
flightSuretyData = FlightSuretyData(dataContract);
}
| constructor(address dataContract) public {
contractOwner = msg.sender;
flightSuretyData = FlightSuretyData(dataContract);
}
| 35,701 |
192 | // Block number when each epoch ends. | uint256[6] public epochEndBlocks;
| uint256[6] public epochEndBlocks;
| 3,250 |
22 | // update stats | totalOnEscrow = totalOnEscrow.add(value);
tokensOnEscrow[tokenHolder] = tokensOnEscrow[tokenHolder].add(value);
registeredIds[externalId] = true;
idsIntExtRelations[escrowId] = externalId;
idsExtIntRelations[externalId] = escrowId;
| totalOnEscrow = totalOnEscrow.add(value);
tokensOnEscrow[tokenHolder] = tokensOnEscrow[tokenHolder].add(value);
registeredIds[externalId] = true;
idsIntExtRelations[escrowId] = externalId;
idsExtIntRelations[externalId] = escrowId;
| 46,676 |
22 | // Fill under max supply | standardEnterRaffle(6, 3);
assertErrorWithMessageParams(
ALICE.clearRaffle,
1,
Errors.RaffleNoClearingNeeded
);
| standardEnterRaffle(6, 3);
assertErrorWithMessageParams(
ALICE.clearRaffle,
1,
Errors.RaffleNoClearingNeeded
);
| 4,597 |
61 | // _owner The owner whose social media tokens we are interested in./This method MUST NEVER be called by smart contract code. First, it's fairly/expensive (it walks the entire poos array looking for poos belonging to owner),/but it also returns a dynamic array, which is only supported for web3 calls, and/not contract-to-contract calls. | function tokensOfOwner(address _owner) public view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 totalPoos = totalSupply();
uint256 resultIndex = 0;
uint256 pooId;
for (pooId = 0; pooId <= totalPoos; pooId++) {
if (pooIndexToOwner[pooId] == _owner) {
result[resultIndex] = pooId;
resultIndex++;
}
}
return result;
}
}
| function tokensOfOwner(address _owner) public view returns(uint256[] ownerTokens) {
uint256 tokenCount = balanceOf(_owner);
if (tokenCount == 0) {
// Return an empty array
return new uint256[](0);
} else {
uint256[] memory result = new uint256[](tokenCount);
uint256 totalPoos = totalSupply();
uint256 resultIndex = 0;
uint256 pooId;
for (pooId = 0; pooId <= totalPoos; pooId++) {
if (pooIndexToOwner[pooId] == _owner) {
result[resultIndex] = pooId;
resultIndex++;
}
}
return result;
}
}
| 38,320 |
107 | // These are winning boards when bits are combined | uint16[8] memory winningBits = [448, 292, 273, 146, 84, 73, 56, 7];
for (uint256 index = 0; index < winningBits.length; index++) {
if (bitsMatch(playerMap, winningBits[index])) {
return true;
}
| uint16[8] memory winningBits = [448, 292, 273, 146, 84, 73, 56, 7];
for (uint256 index = 0; index < winningBits.length; index++) {
if (bitsMatch(playerMap, winningBits[index])) {
return true;
}
| 52,572 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.