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 |
|---|---|---|---|---|
248 | // only allow vault owner or vault operator to deposit collateral | require((_args.from == msg.sender) || (_args.from == _args.owner), "C20");
require(whitelist.isWhitelistedCollateral(_args.asset), "C21");
(, uint256 typeVault, ) = getVaultWithDetails(_args.owner, _args.vaultId);
if (typeVault == 1) {
nakedPoolBalance[_args.asset] = naked... | require((_args.from == msg.sender) || (_args.from == _args.owner), "C20");
require(whitelist.isWhitelistedCollateral(_args.asset), "C21");
(, uint256 typeVault, ) = getVaultWithDetails(_args.owner, _args.vaultId);
if (typeVault == 1) {
nakedPoolBalance[_args.asset] = naked... | 63,534 |
146 | // ConveyorMulticall/0xOsiris, 0xKitsune, Conveyor Labs/Optimized multicall execution contract. | contract ConveyorMulticall is GenericMulticall, UniswapV3Callback, UniswapV2Callback {
using SafeERC20 for IERC20;
address immutable CONVEYOR_SWAP_AGGREGATOR;
///@param conveyorRouterV1 Address of the ConveyorRouterV1 contract.
constructor(address conveyorRouterV1) {
CONVEYOR_SWAP_AGGREGATOR =... | contract ConveyorMulticall is GenericMulticall, UniswapV3Callback, UniswapV2Callback {
using SafeERC20 for IERC20;
address immutable CONVEYOR_SWAP_AGGREGATOR;
///@param conveyorRouterV1 Address of the ConveyorRouterV1 contract.
constructor(address conveyorRouterV1) {
CONVEYOR_SWAP_AGGREGATOR =... | 7,497 |
15 | // Obtain Art status for Token | function getArtStatus(uint256 _tokenid) public view returns (uint256) {
uint256 temp;
temp = artenabled[_tokenid];
return temp;
}
| function getArtStatus(uint256 _tokenid) public view returns (uint256) {
uint256 temp;
temp = artenabled[_tokenid];
return temp;
}
| 10,685 |
135 | // Returns the amount contributed so far by a specific beneficiary. beneficiary Address of contributorreturn Beneficiary contribution so far / | function getContribution(address beneficiary)
public
view
returns (uint256)
| function getContribution(address beneficiary)
public
view
returns (uint256)
| 24,471 |
71 | // return The result of safely dividing x and y. The return value is a highprecision decimal.y is divided after the product of x and the standard precision unitis evaluated, so the product of x and UNIT must be less than 2256. Asthis is an integer division, the result is always rounded down.This helps save on gas. Roun... | function divideDecimal(uint x, uint y) internal pure returns (uint) {
/* Reintroduce the UNIT factor that will be divided out by y. */
return x.mul(UNIT).div(y);
}
| function divideDecimal(uint x, uint y) internal pure returns (uint) {
/* Reintroduce the UNIT factor that will be divided out by y. */
return x.mul(UNIT).div(y);
}
| 10,011 |
30 | // All actions are allowed by default | LimitedToken memory _tokenIn = LimitedToken(ActionLib.allActions(), tokenIn);
return swapQuoter.getAmountOut(_tokenIn, tokenOut, amountIn);
| LimitedToken memory _tokenIn = LimitedToken(ActionLib.allActions(), tokenIn);
return swapQuoter.getAmountOut(_tokenIn, tokenOut, amountIn);
| 16,590 |
149 | // Sets `amount` as the allowance of `spender` over the `owner`s tokens./ | /// @dev Emits an {Approval} event.
///
/// This is internal function is equivalent to `approve`, and can be used to e.g. set automatic
/// allowances for certain subsystems, etc.
///
/// Requirements:
///
/// - `owner` cannot be the zero address.
/// - `spender` cannot be the zero a... | /// @dev Emits an {Approval} event.
///
/// This is internal function is equivalent to `approve`, and can be used to e.g. set automatic
/// allowances for certain subsystems, etc.
///
/// Requirements:
///
/// - `owner` cannot be the zero address.
/// - `spender` cannot be the zero a... | 71,285 |
284 | // solhint-disable-next-line avoid-low-level-calls | (bool success, ) = payable(msg.sender).call{
gas: 2300,
value: address(this).balance
}("");
| (bool success, ) = payable(msg.sender).call{
gas: 2300,
value: address(this).balance
}("");
| 23,606 |
75 | // freeze account | selfFreeze(true, 24 * 3600);
maxAllowedAmount[_from] = 0;
return isTransfer;
| selfFreeze(true, 24 * 3600);
maxAllowedAmount[_from] = 0;
return isTransfer;
| 25,345 |
14 | // Training partition size | uint16 constant training_data_group_size = 400;
| uint16 constant training_data_group_size = 400;
| 53,437 |
32 | // decode current field number and wiretype | function decKey(Buffer memory buf) internal pure returns (uint256 tag, WireType wiretype) {
uint256 v = decVarint(buf);
tag = v / 8;
wiretype = WireType(v & 7);
}
| function decKey(Buffer memory buf) internal pure returns (uint256 tag, WireType wiretype) {
uint256 v = decVarint(buf);
tag = v / 8;
wiretype = WireType(v & 7);
}
| 11,912 |
127 | // Ensure individual and global consistency when decrementing collateral balances. Returns the change to the position. This function is similar to the _decrementCollateralBalances function except this function checks position GCR between the decrements. This ensures that collateral removal will not leave the position u... | function _decrementCollateralBalancesCheckGCR(
PositionData storage positionData,
FixedPoint.Unsigned memory collateralAmount
| function _decrementCollateralBalancesCheckGCR(
PositionData storage positionData,
FixedPoint.Unsigned memory collateralAmount
| 30,058 |
83 | // If no xFat exists, mint it 1:1 to the amount put in | if (totalShares == 0 || totalFat == 0) {
_mint(msg.sender, _amount);
}
| if (totalShares == 0 || totalFat == 0) {
_mint(msg.sender, _amount);
}
| 20,918 |
58 | // Get the message to be signed in case of delegated transfer/approvals methodHash The method hash for which delegate action in to be performed token The unique token for each delegated function networkFee The fee that will be paid to relayer for gas fee he spends to The recipient or spender amount The amount to be app... | function getProofApproval(bytes4 methodHash, bytes32 token, uint256 networkFee, address broadcaster, address to, uint256 amount)
public
view
returns (bytes32)
| function getProofApproval(bytes4 methodHash, bytes32 token, uint256 networkFee, address broadcaster, address to, uint256 amount)
public
view
returns (bytes32)
| 35,213 |
172 | // No previous checkpoint data - add current balance against checkpoint | if (_checkpoints.length == 0) {
_checkpoints.push(
Checkpoint({
checkpointId: currentCheckpointId,
value: _newValue
})
| if (_checkpoints.length == 0) {
_checkpoints.push(
Checkpoint({
checkpointId: currentCheckpointId,
value: _newValue
})
| 48,356 |
60 | // Template contract to use for new minion proxies | address payable public immutable safeMinionSingleton;
| address payable public immutable safeMinionSingleton;
| 16,660 |
15 | // Uniswap v3 pool interface | interface IUniV3_POOL {
function slot0()
external
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint8 feeProtocol,
... | interface IUniV3_POOL {
function slot0()
external
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint8 feeProtocol,
... | 25,675 |
4 | // Layer 0 info // Tx Info /uint16 _chainID, | uint256 _nonce,
| uint256 _nonce,
| 26,262 |
71 | // Set the leftover amount to the initial amount. | leftoverAmount = _amount;
| leftoverAmount = _amount;
| 9,454 |
24 | // Assign the created voter object to the array of voters | voters[_email] = Voter(votrSize, Library.bytes32ToStr(_email), false);
| voters[_email] = Voter(votrSize, Library.bytes32ToStr(_email), false);
| 1,642 |
2 | // Throw if called by any account other than the owner. / | modifier onlyOwner() {
require(_owner == msg.sender, "caller is not the owner");
_;
}
| modifier onlyOwner() {
require(_owner == msg.sender, "caller is not the owner");
_;
}
| 9,672 |
3 | // Event emitted when bank owner give credit for user. | event newApproveCredit(uint64 indexed id);
| event newApproveCredit(uint64 indexed id);
| 19,320 |
17 | // Return current balance of token0 (tender) in the poolreturn token0Balance current balance of the pooled tendertoken / | function getToken0Balance() external view returns (uint256 token0Balance);
| function getToken0Balance() external view returns (uint256 token0Balance);
| 29,052 |
119 | // Getter function for requestId based on timestamp_timestamp to check requestId return uint of requestId/ | function getRequestIdByTimestamp(TellorStorage.TellorStorageStruct storage self, uint256 _timestamp) internal view returns (uint256) {
return self.requestIdByTimestamp[_timestamp];
}
| function getRequestIdByTimestamp(TellorStorage.TellorStorageStruct storage self, uint256 _timestamp) internal view returns (uint256) {
return self.requestIdByTimestamp[_timestamp];
}
| 31,850 |
52 | // update dividends tracker | int256 _updatedPayouts = (int256) (tokenLedger[contractAddress].dividend * _collates + (_taxedToken * magnitude));
balanceLedger[_customerAddress][contractAddress].payOut -= _updatedPayouts;
| int256 _updatedPayouts = (int256) (tokenLedger[contractAddress].dividend * _collates + (_taxedToken * magnitude));
balanceLedger[_customerAddress][contractAddress].payOut -= _updatedPayouts;
| 11,873 |
10 | // calculates the next token ID based on value of _currentTokenIdreturn uint256 for the next token ID / | function _getNextTokenId(uint256 collection) private returns (uint256) {
Series storage coll = collections[collection];
uint pointer = coll.current++;
require(pointer < coll.supply, "No tokens available");
uint256 reply = coll.start + pointer;
return reply;
}
| function _getNextTokenId(uint256 collection) private returns (uint256) {
Series storage coll = collections[collection];
uint pointer = coll.current++;
require(pointer < coll.supply, "No tokens available");
uint256 reply = coll.start + pointer;
return reply;
}
| 4,087 |
36 | // Checks the amount of tokens left in the allowance.return Amount of tokens left in the allowance / | function remainingTokens() public view returns (uint256) {
return token.allowance(tokenWallet, this);
}
| function remainingTokens() public view returns (uint256) {
return token.allowance(tokenWallet, this);
}
| 40,535 |
14 | // Differentiate between sending to address(0) and creating a contract | if (_isCreation && _to != address(0)) {
revert NonZeroCreationTarget();
}
| if (_isCreation && _to != address(0)) {
revert NonZeroCreationTarget();
}
| 45,762 |
57 | // Allow contributions to this crowdfunding. | function invest() public payable stopInEmergency {
require(getState() == State.Funding);
require(msg.value > 0);
uint weiAmount = msg.value;
address investor = msg.sender;
if(investedAmountOf[investor] == 0) {
// A new investor
investorCount++;
... | function invest() public payable stopInEmergency {
require(getState() == State.Funding);
require(msg.value > 0);
uint weiAmount = msg.value;
address investor = msg.sender;
if(investedAmountOf[investor] == 0) {
// A new investor
investorCount++;
... | 50,340 |
19 | // find parent user whose level is toLevel for limited loop i | uint i = 0;
address parent = me;
bool found = false;
while(i++ < maxLoopTimes) {
parent = userTree[parent];
| uint i = 0;
address parent = me;
bool found = false;
while(i++ < maxLoopTimes) {
parent = userTree[parent];
| 12,348 |
11 | // SmartAccount -> TypeID | mapping(address => uint256) SmartAccountType;
mapping(uint256 => address) accountIDtoAddress;
event AddNewAccountType(uint256 accountTypeID, address acountProxyAddress);
event UpdateAccountType(uint256 accountTypeID, address acountProxyAddress);
event CreateAccount(address EOA, address account, ui... | mapping(address => uint256) SmartAccountType;
mapping(uint256 => address) accountIDtoAddress;
event AddNewAccountType(uint256 accountTypeID, address acountProxyAddress);
event UpdateAccountType(uint256 accountTypeID, address acountProxyAddress);
event CreateAccount(address EOA, address account, ui... | 7,177 |
6 | // The ERC721 Receiver interface | interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
| interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
| 43,574 |
4 | // cast address to payable | address payable addr = payable(address(recipient));
selfdestruct(addr);
| address payable addr = payable(address(recipient));
selfdestruct(addr);
| 8,904 |
12 | // Library for Math operations | library Math {
function safeToAdd(uint a, uint b)
public
pure
returns (bool)
{
return a + b >= a;
}
function safeToSub(uint a, uint b)
public
pure
returns (bool)
{
return a >= b;
}
function safeToMul(uint a, uint b)
p... | library Math {
function safeToAdd(uint a, uint b)
public
pure
returns (bool)
{
return a + b >= a;
}
function safeToSub(uint a, uint b)
public
pure
returns (bool)
{
return a >= b;
}
function safeToMul(uint a, uint b)
p... | 2,614 |
9 | // Decimals & precision | uint256 constant MILLION = 10 ** 6;
uint256 constant RAY = 10 ** 27;
uint256 constant RAD = 10 ** 45;
| uint256 constant MILLION = 10 ** 6;
uint256 constant RAY = 10 ** 27;
uint256 constant RAD = 10 ** 45;
| 11,718 |
106 | // cap debt to liquidate | uint256 amountToLiquidate = liquidationAmount < _debtToCover ? liquidationAmount : _debtToCover;
| uint256 amountToLiquidate = liquidationAmount < _debtToCover ? liquidationAmount : _debtToCover;
| 20,752 |
509 | // retrieve the size of the code at address `addr` | size := extcodesize(addr)
| size := extcodesize(addr)
| 11,462 |
5 | // This contract is vulnerable to having its funds stolen. Written for ECEN 4133 at the University of Colorado Boulder: https:ecen4133.org/ (Adapted from ECEN 5033 w19) Happy hacking, and play nice! :) | contract Vuln {
mapping(address => uint256) public balances;
function deposit() public payable {
// Increment their balance with whatever they pay
balances[msg.sender] += msg.value;
}
function withdraw() public {
// Refund their balance
msg.sender.call.value(balances[ms... | contract Vuln {
mapping(address => uint256) public balances;
function deposit() public payable {
// Increment their balance with whatever they pay
balances[msg.sender] += msg.value;
}
function withdraw() public {
// Refund their balance
msg.sender.call.value(balances[ms... | 22,095 |
242 | // Decodes the first pool in path/path The bytes encoded swap path/ return tokenA The first token of the given pool/ return tokenB The second token of the given pool/ return fee The fee level of the pool | function decodeFirstPool(bytes memory path)
internal
pure
returns (
address tokenA,
address tokenB,
uint24 fee
)
| function decodeFirstPool(bytes memory path)
internal
pure
returns (
address tokenA,
address tokenB,
uint24 fee
)
| 27,030 |
257 | // Get the referrer address that referred the user | function getReferrer(address _user) public view override returns (address) {
return referrers[_user];
}
| function getReferrer(address _user) public view override returns (address) {
return referrers[_user];
}
| 33,449 |
356 | // Used to mark the smart contract as upgraded when an upgrade happens._v2Address Upgraded version of the core contract. / | function setNewAddress(address _v2Address) external onlyCEO whenPaused {
// We'll announce if the upgrade is needed.
newContractAddress = _v2Address;
emit ContractUpgrade(_v2Address);
}
| function setNewAddress(address _v2Address) external onlyCEO whenPaused {
// We'll announce if the upgrade is needed.
newContractAddress = _v2Address;
emit ContractUpgrade(_v2Address);
}
| 17,459 |
33 | // Returns the number of decimals used for token display.return The number of decimals. / | function decimals() public view virtual override returns (uint8) {
return _decimals;
}
| function decimals() public view virtual override returns (uint8) {
return _decimals;
}
| 24,169 |
206 | // redeem lending profit from anXSushi to xSushi | _redeemUnderlying(lendingProfit());
| _redeemUnderlying(lendingProfit());
| 3,548 |
0 | // SPDX-License-Identifier: Unlicensed | contract timelock {
} | contract timelock {
} | 31,044 |
194 | // Returns a token ID owned by `owner` at a given `index` of its token list. | * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to en... | * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to en... | 368 |
19 | // new "memory end" including padding | mstore(0x40, add(o_code, and(add(add(size, 0x20), 0x1f), not(0x1f))))
| mstore(0x40, add(o_code, and(add(add(size, 0x20), 0x1f), not(0x1f))))
| 7,946 |
4 | // others | bool public isSalePaused = false;
| bool public isSalePaused = false;
| 41,214 |
595 | // Calculates derivative hash and gets margin/_derivative Derivative/ return margins uint256[2] left and right margin/ return derivativeHash bytes32 Hash of the derivative | function _calculateDerivativeAndGetMargin(Derivative memory _derivative) private returns (uint256[2] memory margins, bytes32 derivativeHash) {
// Calculate derivative related data for validation
derivativeHash = getDerivativeHash(_derivative);
// Get cached total margin required according t... | function _calculateDerivativeAndGetMargin(Derivative memory _derivative) private returns (uint256[2] memory margins, bytes32 derivativeHash) {
// Calculate derivative related data for validation
derivativeHash = getDerivativeHash(_derivative);
// Get cached total margin required according t... | 34,560 |
356 | // Gets the current votes balance for `account` / | function getVotes(address account) public view virtual override returns (uint256) {
uint256 pos = _checkpoints[account].length;
return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;
}
| function getVotes(address account) public view virtual override returns (uint256) {
uint256 pos = _checkpoints[account].length;
return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;
}
| 32,201 |
15 | // minter The address for which the minting allowance has been changed./newAllowance The new minting allowance for the address (does not include fees). | event MintingAllowanceChanged(address indexed minter, uint256 newAllowance);
| event MintingAllowanceChanged(address indexed minter, uint256 newAllowance);
| 19,510 |
4 | // Gets all the function selectors supported by a specific facet./_facet The facet address./ return facetFunctionSelectors_ | function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_);
| function facetFunctionSelectors(address _facet) external view returns (bytes4[] memory facetFunctionSelectors_);
| 12,382 |
5 | // written when we get funded | bytes8 utxoSizeBytes; // LE uint. the size of the deposit UTXO in satoshis
uint256 fundedAt; // timestamp when funding proof was received
bytes utxoOutpoint; // the 36-byte outpoint of the custodied UTXO
| bytes8 utxoSizeBytes; // LE uint. the size of the deposit UTXO in satoshis
uint256 fundedAt; // timestamp when funding proof was received
bytes utxoOutpoint; // the 36-byte outpoint of the custodied UTXO
| 48,865 |
47 | // Stake tokens for TRU rewards.Also claims any existing rewards. amount Amount of tokens to stake / | function stake(uint256 amount) external override update {
if (claimableReward[msg.sender] > 0) {
_claim();
}
staked[msg.sender] = staked[msg.sender].add(amount);
totalStaked = totalStaked.add(amount);
require(stakingToken.transferFrom(msg.sender, address(this), am... | function stake(uint256 amount) external override update {
if (claimableReward[msg.sender] > 0) {
_claim();
}
staked[msg.sender] = staked[msg.sender].add(amount);
totalStaked = totalStaked.add(amount);
require(stakingToken.transferFrom(msg.sender, address(this), am... | 37,895 |
2 | // Store the booking submissions | mapping(uint256 => Booking) public bookings;
| mapping(uint256 => Booking) public bookings;
| 21,977 |
23 | // start of stake time | uint256 public stakeStartTime = block.timestamp - 1;
| uint256 public stakeStartTime = block.timestamp - 1;
| 40,088 |
97 | // Withdraws the ether distributed to the sender./It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0. | function withdrawDividend(address _rewardToken) external virtual override {
_withdrawDividendOfUser(payable(msg.sender), _rewardToken);
}
| function withdrawDividend(address _rewardToken) external virtual override {
_withdrawDividendOfUser(payable(msg.sender), _rewardToken);
}
| 1,899 |
23 | // raised when the address is already unblacklisted | error AddrAlreadyUnblacklisted(address addr);
| error AddrAlreadyUnblacklisted(address addr);
| 5,667 |
196 | // Set an asset to escrow locked status (6/50/56). / | function setEscrow(bytes32 _idxHash, uint8 _newAssetStatus) external;
| function setEscrow(bytes32 _idxHash, uint8 _newAssetStatus) external;
| 5,443 |
77 | // Delegate votes from `msg.sender` to `delegatee`delegatee The address to delegate votes to/ | function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
| function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
| 1,039 |
0 | // bitmap The `uint256` representation of bits./index The index number to check whether 1 or 0 is set./ return Returns `true` if the bit is set at `index` on `bitmap`. | function hasBit(uint256 bitmap, uint8 index) pure returns (bool) {
uint256 bitValue = bitmap & (1 << index);
return bitValue > 0;
}
| function hasBit(uint256 bitmap, uint8 index) pure returns (bool) {
uint256 bitValue = bitmap & (1 << index);
return bitValue > 0;
}
| 8,309 |
1 | // mapping(address => ) |
event CategoryCreated(uint id, string name, string hash);
event PostCreated(uint id, string title, string hash);
event PostUpdated(uint id, string title, string hash, bool published);
event InitReviewCreated(uint id, string postHash, string revHash);
event FundingRequested(address user, ReqType req... |
event CategoryCreated(uint id, string name, string hash);
event PostCreated(uint id, string title, string hash);
event PostUpdated(uint id, string title, string hash, bool published);
event InitReviewCreated(uint id, string postHash, string revHash);
event FundingRequested(address user, ReqType req... | 22,347 |
10 | // Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender when not paused._spender The address which will spend the funds._value The amount of tokens to be spent./ | function approve(address _spender, uint256 _value) public returns (bool) {
return super.approve(_spender, _value);
}
| function approve(address _spender, uint256 _value) public returns (bool) {
return super.approve(_spender, _value);
}
| 46,070 |
101 | // Hypersign identity token interface | IERC20 private hidToken;
| IERC20 private hidToken;
| 3,759 |
100 | // The address of Aladdin Treasury. | address public immutable treasury;
| address public immutable treasury;
| 35,627 |
176 | // Calculate WETH profit | if(_normalizedGain.add(interestGain) == 0){
return 0;
}
| if(_normalizedGain.add(interestGain) == 0){
return 0;
}
| 46,281 |
2 | // Return token to InstaPool. Payback borrowed flashloan. token Token Address. amt Token Amount. getId Get token amount at this ID from `InstaMemory` Contract. setId Set token amount at this ID in `InstaMemory` Contract./ | function flashPayback(
address token,
uint amt,
uint getId,
uint setId
| function flashPayback(
address token,
uint amt,
uint getId,
uint setId
| 5,926 |
2 | // basic operations | b++;
b += a;
| b++;
b += a;
| 2,193 |
6 | // Total liquidity pool holds | uint256 private _liquidity;
bool private _mutex;
| uint256 private _liquidity;
bool private _mutex;
| 59,670 |
48 | // --------distribute current xdai balance | last_epoch_rewards_amount = last_epoch_remaining_rewards + current_xdai_balance.mul(90).div(100.0); //put the holders balance in the epoch rewards
moderation_xdai_balance += current_xdai_balance.mul(5).div(100.0);
uint256 surplus_mod = 0;
if(moderation_xdai_balance > MODERATION_POOL_CAP)... | last_epoch_rewards_amount = last_epoch_remaining_rewards + current_xdai_balance.mul(90).div(100.0); //put the holders balance in the epoch rewards
moderation_xdai_balance += current_xdai_balance.mul(5).div(100.0);
uint256 surplus_mod = 0;
if(moderation_xdai_balance > MODERATION_POOL_CAP)... | 10,085 |
558 | // Claim reward/sender address. Address who have stake the token./recipient address. Address who receive the reward./ return totalNetReward Total net SDVD reward./ return totalTaxReward Total taxed SDVD reward./ return totalReward Total SDVD reward. | function _claimReward(address sender, address recipient) internal virtual returns(uint256 totalNetReward, uint256 totalTaxReward, uint256 totalReward) {
_checkHalving();
_updateReward(sender);
_updateBonusReward(sender);
_notifyController();
uint256 reward = accountInfos[sen... | function _claimReward(address sender, address recipient) internal virtual returns(uint256 totalNetReward, uint256 totalTaxReward, uint256 totalReward) {
_checkHalving();
_updateReward(sender);
_updateBonusReward(sender);
_notifyController();
uint256 reward = accountInfos[sen... | 80,899 |
245 | // if stake is big enough and can take into account the whole fee: | if(stakes[msg.sender][_stakeidxa].amount > _feeRemaining) {
stakes[msg.sender][_stakeidxa].amount = stakes[msg.sender][_stakeidxa].amount.sub(_feeRemaining);
stakesAmount[msg.sender] = stakesAmount[msg.sender].sub(_feeRemaining);
_feeRemaining = 0;
break;
}
| if(stakes[msg.sender][_stakeidxa].amount > _feeRemaining) {
stakes[msg.sender][_stakeidxa].amount = stakes[msg.sender][_stakeidxa].amount.sub(_feeRemaining);
stakesAmount[msg.sender] = stakesAmount[msg.sender].sub(_feeRemaining);
_feeRemaining = 0;
break;
}
| 33,602 |
33 | // off-chain hash | string public tokenDetails;
| string public tokenDetails;
| 47,972 |
23 | // Bankroll | address internal bankrollAddress;
| address internal bankrollAddress;
| 36,323 |
36 | // Increase the amount of tokens that an owner allowed to a spender.approve should be called when allowed_[_spender] == 0. To incrementallowed value is better to use this function to avoid 2 calls (and wait untilthe first transaction is mined)Emits an Approval event. spender The address which will spend the funds. valu... | function increase_allowance(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowance[msg.sender][spender] = _allowance[msg.sender][spender].add(value);
emit Approval(msg.sender, spender, _allowance[msg.sender][spender]);
return true;
}
| function increase_allowance(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowance[msg.sender][spender] = _allowance[msg.sender][spender].add(value);
emit Approval(msg.sender, spender, _allowance[msg.sender][spender]);
return true;
}
| 6,180 |
8 | // _beforeTokenTransfer / | function _beforeTokenTransfer(
address, /* from */
address to,
uint256 /* amount */
| function _beforeTokenTransfer(
address, /* from */
address to,
uint256 /* amount */
| 21,359 |
5 | // Ether market price in USD | uint public constant USD_PER_ETH = 800; // approx 7 day average High Low as at 29th OCT 2017
| uint public constant USD_PER_ETH = 800; // approx 7 day average High Low as at 29th OCT 2017
| 910 |
77 | // Success finish of PreSale | function finishPreSale() public onlyOwner {
require(weiRaised >= softCap);
require(weiRaised >= hardCap || now > endTime);
if (now < endTime) {
endTime = now;
}
forwardFunds(this.balance);
token.transferOwnership(owner);
}
| function finishPreSale() public onlyOwner {
require(weiRaised >= softCap);
require(weiRaised >= hardCap || now > endTime);
if (now < endTime) {
endTime = now;
}
forwardFunds(this.balance);
token.transferOwnership(owner);
}
| 17,618 |
34 | // Function to guarantee that the contract will not receive ether. / | receive() external payable virtual {
revert();
}
| receive() external payable virtual {
revert();
}
| 35,674 |
97 | // Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp/To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing/ the beginning of the period and another for the end of the period. E.g., to get the last hour t... | function observe(uint32[] calldata secondsAgos)
external
view
returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
| function observe(uint32[] calldata secondsAgos)
external
view
returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
| 1,195 |
3 | // @inheritdoc IERC20MetadataUpgradeable / | function name() external view returns (string memory) {
return string.concat("Locked ", underlyingToken.name());
}
| function name() external view returns (string memory) {
return string.concat("Locked ", underlyingToken.name());
}
| 21,558 |
0 | // function returning tuples | function ReturnTuples() public pure returns(uint, uint, bool) {
return (3,6, false);
}
| function ReturnTuples() public pure returns(uint, uint, bool) {
return (3,6, false);
}
| 41,125 |
76 | // Withdraw Metapool LP from Curve DAO back to this contract | function withdrawFromGauge(uint256 _metapool_lp_out) external onlyByOwnGov {
gauge_frax3crv.withdraw(_metapool_lp_out);
}
| function withdrawFromGauge(uint256 _metapool_lp_out) external onlyByOwnGov {
gauge_frax3crv.withdraw(_metapool_lp_out);
}
| 36,200 |
106 | // return 0 if exp(x) is tiny, using MIN_POWER = int(mp.floor(mp.log(mpf(1) / ONE, 2)ONE)) | if (x < -1180591620717411303424)
return (0, 1);
| if (x < -1180591620717411303424)
return (0, 1);
| 49,056 |
17 | // The start time of the auction. | uint256 startTime;
| uint256 startTime;
| 10,430 |
1 | // 1200% patronage | mapping(uint256 => uint256) public patronageNumerator;
| mapping(uint256 => uint256) public patronageNumerator;
| 53,632 |
33 | // Returns the seconds since last accrualcurrentTimestamp in seconds lastAccrualTimestamp in secondsreturn secondsSinceLastAccrualreturn accrualTimestamp in seconds / | function getSecondsSinceLastAccrual(
uint256 currentTimestamp,
uint256 lastAccrualTimestamp
)
public
pure
returns (uint256 secondsSinceLastAccrual, uint256 accrualTimestamp)
| function getSecondsSinceLastAccrual(
uint256 currentTimestamp,
uint256 lastAccrualTimestamp
)
public
pure
returns (uint256 secondsSinceLastAccrual, uint256 accrualTimestamp)
| 34,439 |
27 | // Do common multisig verification for both eth sends and erc20token transferstoAddress the destination address to send an outgoing transaction operationHash see Data Formats signature see Data Formats expireTime the number of seconds since 1970 for which this transaction is valid orderId the unique order id obtainable... | function verifyMultiSig(
address toAddress,
bytes32 operationHash,
bytes signature,
uint expireTime,
uint orderId
| function verifyMultiSig(
address toAddress,
bytes32 operationHash,
bytes signature,
uint expireTime,
uint orderId
| 12,225 |
115 | // Returns an URI for a given token IDThrows if the token ID does not exist. May return an empty string. tokenId uint256 ID of the token to query / | function tokenURI(uint256 tokenId) public view returns (string) {
require(_exists(tokenId));
return _tokenURIs[tokenId];
}
| function tokenURI(uint256 tokenId) public view returns (string) {
require(_exists(tokenId));
return _tokenURIs[tokenId];
}
| 71,554 |
0 | // Kyber Network interface | interface KyberNetworkProxyInterface {
function getExpectedRate(
address src,
address dest,
uint256 srcQty
)
external
view
returns (uint256 expectedRate, uint256 slippageRate);
function trade(
address src,
uint srcAmount,
address dest,
address des... | interface KyberNetworkProxyInterface {
function getExpectedRate(
address src,
address dest,
uint256 srcQty
)
external
view
returns (uint256 expectedRate, uint256 slippageRate);
function trade(
address src,
uint srcAmount,
address dest,
address des... | 41,240 |
1 | // Computes the result of swapping some amount in, or amount out, given the parameters of the swap/The fee, plus the amount in, will never exceed the amount remaining if the swap's `amountSpecified` is positive/sqrtRatioCurrentX96 The current sqrt price of the pool/sqrtRatioTargetX96 The price that cannot be exceeded, ... | function computeSwapStep(
uint160 sqrtRatioCurrentX96,
uint160 sqrtRatioTargetX96,
uint128 liquidity,
int256 amountRemaining,
uint24 feePips
)
external
pure
returns (
| function computeSwapStep(
uint160 sqrtRatioCurrentX96,
uint160 sqrtRatioTargetX96,
uint128 liquidity,
int256 amountRemaining,
uint24 feePips
)
external
pure
returns (
| 3,940 |
64 | // Available only if presale is running. | require(currentPhase == Phase.Running);
| require(currentPhase == Phase.Running);
| 64,650 |
55 | // Sender will be owner only if no have bidded on auction. | require(
IMintableToken(_mintableToken).ownerOf(tokenID) == msg.sender,
"You must be owner and Token should not have any bid"
);
_;
| require(
IMintableToken(_mintableToken).ownerOf(tokenID) == msg.sender,
"You must be owner and Token should not have any bid"
);
_;
| 14,575 |
60 | // launch buy fees | uint256 _buyMarketingFee = 0;
uint256 _buyLiquidityFee = 0;
uint256 _buyDevelopmentFee = 0;
uint256 _buyOperationsFee = 0;
| uint256 _buyMarketingFee = 0;
uint256 _buyLiquidityFee = 0;
uint256 _buyDevelopmentFee = 0;
uint256 _buyOperationsFee = 0;
| 26,863 |
285 | // DEPRECATED FOR V2 Mapping to store the scheduled withdrawals (address => withdrawAmount) | mapping(address => uint256) private scheduledWithdrawals;
| mapping(address => uint256) private scheduledWithdrawals;
| 54,433 |
11 | // A mapping from CarIDs to the price of the token. | mapping (uint256 => uint256) private carIndexToPrice;
| mapping (uint256 => uint256) private carIndexToPrice;
| 46,422 |
54 | // 提现,由管理员调用该方法对指定地址进行提现ballotAddress 用户地址 / | function withdrawTokenToAddress(address ballotAddress) public onlyOwner returns(bool res){
return _withdrawToken(ballotAddress);
}
| function withdrawTokenToAddress(address ballotAddress) public onlyOwner returns(bool res){
return _withdrawToken(ballotAddress);
}
| 35,928 |
122 | // Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. Tokens start existing when they are minted (`_mint`),and stop existing when they are burned (`_burn`). / | function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
| function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
| 280 |
4 | // Some string type variables to identify the token. | string public name = "My Hardhat Token";
string public symbol = "MHT";
| string public name = "My Hardhat Token";
string public symbol = "MHT";
| 5,448 |
23 | // Performs a single exact output swap return value = amountIn returned by swap + 1ExFee, is omitted to decrease gas usage | function exactOutputInternal(
uint256 amountOut,
address recipient,
uint160 sqrtPriceLimitX96,
SwapCallbackData memory data
| function exactOutputInternal(
uint256 amountOut,
address recipient,
uint160 sqrtPriceLimitX96,
SwapCallbackData memory data
| 13,500 |
5 | // Swap half earned to token0 | _safeSwap(
earnedAmt.div(2),
earnedToToken0Path,
address(this)
);
| _safeSwap(
earnedAmt.div(2),
earnedToToken0Path,
address(this)
);
| 34,905 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.