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 |
|---|---|---|---|---|
54 | // Get the liquidation price of the asset (discount for liquidator) | Decimal.D256 memory liquidationPrice = state.calculateLiquidationPrice(
position.collateralAsset
);
| Decimal.D256 memory liquidationPrice = state.calculateLiquidationPrice(
position.collateralAsset
);
| 36,614 |
18 | // chainlink ETH/DAI on Kovan | priceFeed = AggregatorV3Interface(0x22B58f1EbEDfCA50feF632bD73368b2FdA96D541);
| priceFeed = AggregatorV3Interface(0x22B58f1EbEDfCA50feF632bD73368b2FdA96D541);
| 47,254 |
88 | // add the liquidity | uniswapV2Router.addLiquidityETH{value: ethAmount}(
| uniswapV2Router.addLiquidityETH{value: ethAmount}(
| 1,262 |
164 | // ======================== BIP-3 | uint256 fundReserve = seigniorage.mul(fundAllocationRate).div(100);
if (fundReserve > 0) {
IERC20(cash).safeApprove(fund, fundReserve);
ISimpleERCFund(fund).deposit(
cash,
fundReserve,
'Treasury: Seigniorage Allocation'
... | uint256 fundReserve = seigniorage.mul(fundAllocationRate).div(100);
if (fundReserve > 0) {
IERC20(cash).safeApprove(fund, fundReserve);
ISimpleERCFund(fund).deposit(
cash,
fundReserve,
'Treasury: Seigniorage Allocation'
... | 69,134 |
106 | // The FOBO TOKEN! | FoboToken public fobo;
| FoboToken public fobo;
| 23,267 |
76 | // Deposits funds from `msg.sender` to the Rari DAI Pool in exchange for RFT minted to `to`.You may only deposit currencies accepted by the fund (see `isCurrencyAccepted(string currencyCode)`).Please note that you must approve RariFundManager to transfer at least `amount`. to The address that will receieve the minted R... | function depositTo(address to, string memory currencyCode, uint256 amount) public fundEnabled {
// Input validation
address erc20Contract = _erc20Contracts[currencyCode];
require(erc20Contract != address(0), "Invalid currency code.");
require(isCurrencyAccepted(currencyCode), "This c... | function depositTo(address to, string memory currencyCode, uint256 amount) public fundEnabled {
// Input validation
address erc20Contract = _erc20Contracts[currencyCode];
require(erc20Contract != address(0), "Invalid currency code.");
require(isCurrencyAccepted(currencyCode), "This c... | 13,359 |
33 | // Transfer profit to owner address. | bool sent = weth.transfer(owner, weth_balance);
require(sent, "Token transfer failed");
return weth_balance;
| bool sent = weth.transfer(owner, weth_balance);
require(sent, "Token transfer failed");
return weth_balance;
| 6,505 |
599 | // The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`)./If calling a fill function, this address will represent the taker./If calling a cancel function, this address will represent the maker./ return Signer of 0x transaction if entry point is `executeTransac... | function _getCurrentContextAddress()
internal
view
returns (address);
| function _getCurrentContextAddress()
internal
view
returns (address);
| 2,541 |
202 | // Function to mint tokens. | * NOTE: restricting access to owner only. See {ERC20Mintable-mint}.
*
* @param account The address that will receive the minted tokens
* @param amount The amount of tokens to mint
*/
function _mint(address account, uint256 amount) internal override onlyMinter {
super._mint(account, ... | * NOTE: restricting access to owner only. See {ERC20Mintable-mint}.
*
* @param account The address that will receive the minted tokens
* @param amount The amount of tokens to mint
*/
function _mint(address account, uint256 amount) internal override onlyMinter {
super._mint(account, ... | 5,130 |
34 | // staker has delegated to representative, withdraw will affect representative's delegated stakes | decreaseDelegatedStake(stakerPerEpochData[curEpoch][representative], reduceAmount);
| decreaseDelegatedStake(stakerPerEpochData[curEpoch][representative], reduceAmount);
| 31,298 |
86 | // Emit state changes | emit Claim(
msg.sender,
stakedToken,
tokenAddress,
amount,
block.timestamp
);
| emit Claim(
msg.sender,
stakedToken,
tokenAddress,
amount,
block.timestamp
);
| 840 |
90 | // rusd balance of contract/ return rusd amount held | function rusdBalance() public view override returns (uint256) {
return rusd().balanceOf(address(this));
}
| function rusdBalance() public view override returns (uint256) {
return rusd().balanceOf(address(this));
}
| 31,782 |
6 | // the ongoing operations. | mapping(bytes32 => PendingState) pendings;
bytes32[] pendingsIndex;
| mapping(bytes32 => PendingState) pendings;
bytes32[] pendingsIndex;
| 20,501 |
152 | // Internal function, Helps in updating the Creation Stop Time _seasonSeason UINT Code _value0 - Not allowed, 1 - Allowed / | function _updateGenerationSeasonFlag(uint256 _season, uint8 _value) internal {
generationSeasonController[_season] = _value;
}
| function _updateGenerationSeasonFlag(uint256 _season, uint8 _value) internal {
generationSeasonController[_season] = _value;
}
| 30,968 |
9 | // BlackListRole / | contract BlackListRole is BlacklistAdminRole {
using Roles for Roles.Role;
/// @notice Emitted when blacklist admin add account into blacklist
event BlacklistedAdded(address indexed account);
/// @notice Emitted when blacklist admin remove account into blacklist
event BlacklistedRemoved(address ind... | contract BlackListRole is BlacklistAdminRole {
using Roles for Roles.Role;
/// @notice Emitted when blacklist admin add account into blacklist
event BlacklistedAdded(address indexed account);
/// @notice Emitted when blacklist admin remove account into blacklist
event BlacklistedRemoved(address ind... | 40,953 |
275 | // a garbage staker address due to wrong signature will revert due to lack of approval and funds. | require(staker != address(0), "staker address cannot be 0");
require(stakesNonce[staker] == _nonce);
stakesNonce[staker] = stakesNonce[staker].add(1);
return _stake(_proposalId, _vote, _amount, staker);
| require(staker != address(0), "staker address cannot be 0");
require(stakesNonce[staker] == _nonce);
stakesNonce[staker] = stakesNonce[staker].add(1);
return _stake(_proposalId, _vote, _amount, staker);
| 11,023 |
32 | // Get the redemption intent hash | bytes32 intentHash = GatewayLib.hashRedemptionIntent(
_amount,
_beneficiary,
msg.sender,
_nonce,
_gasPrice,
_gasLimit,
valueToken
);
| bytes32 intentHash = GatewayLib.hashRedemptionIntent(
_amount,
_beneficiary,
msg.sender,
_nonce,
_gasPrice,
_gasLimit,
valueToken
);
| 42,957 |
109 | // return 9e38 / 1e18 = 9e18 | return z.div(scale);
| return z.div(scale);
| 25,942 |
45 | // Admin Events // Event emitted when pendingAdmin is changed / | event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);
| event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);
| 25,129 |
27 | // Completes a pending unlocking with two signatures. Given a request message hash as two signatures of it from two distinct signers in the signer set, this function completes the unlocking of the pending request by executing the callback. _requestMsgHashThe request message hash of a pending request. _recoveryByte1The ... | function completeUnlock(
bytes32 _requestMsgHash,
uint8 _recoveryByte1, bytes32 _ecdsaR1, bytes32 _ecdsaS1,
uint8 _recoveryByte2, bytes32 _ecdsaR2, bytes32 _ecdsaS2
)
public
returns (bool success)
| function completeUnlock(
bytes32 _requestMsgHash,
uint8 _recoveryByte1, bytes32 _ecdsaR1, bytes32 _ecdsaS1,
uint8 _recoveryByte2, bytes32 _ecdsaR2, bytes32 _ecdsaS2
)
public
returns (bool success)
| 16,110 |
57 | // Swap ETH to SDVD using uniswap Param: uint amountOutMin, address[] calldata path, address to, uint deadline | uint256[] memory amounts = uniswapRouter.swapExactETHForTokens{value : amountETH}(
| uint256[] memory amounts = uniswapRouter.swapExactETHForTokens{value : amountETH}(
| 12,477 |
2 | // Begin: Trove // Deposit native ETH and borrow LUSD Opens a Trove by depositing ETH and borrowing LUSD depositAmount The amount of ETH to deposit maxFeePercentage The maximum borrow fee that this transaction should permitborrowAmount The amount of LUSD to borrow upperHint Address of the Trove near the upper bound of ... | function open(
uint depositAmount,
uint maxFeePercentage,
uint borrowAmount,
address upperHint,
address lowerHint,
uint[] memory getIds,
uint[] memory setIds
) external payable returns (string memory _eventName, bytes memory _eventParam) {
| function open(
uint depositAmount,
uint maxFeePercentage,
uint borrowAmount,
address upperHint,
address lowerHint,
uint[] memory getIds,
uint[] memory setIds
) external payable returns (string memory _eventName, bytes memory _eventParam) {
| 29,912 |
10 | // Initialize any state variables that would normally be set in the contructor. Initialization functionality MUST be implemented in inherited upgradeable contract if the child contract requiresvariable initialization on creation. This is because the contructor of the child contract will not executeand set any state whe... | function initialize() initializeOnceOnly public {
// initialize contract state variables here
}
| function initialize() initializeOnceOnly public {
// initialize contract state variables here
}
| 51,391 |
48 | // approve + send STBL & return locked BMI to the claimer | claimingRegistry.acceptClaim(claimIndex);
bmiToken.transfer(claimer, _votings[claimIndex].lockedBMIAmount);
| claimingRegistry.acceptClaim(claimIndex);
bmiToken.transfer(claimer, _votings[claimIndex].lockedBMIAmount);
| 36,905 |
22 | // Returns true if the registry looks ready / | function isReady()
| function isReady()
| 11,100 |
6 | // Whitelist sale start timestamp. | uint256 public whitelistStartTimestamp;
| uint256 public whitelistStartTimestamp;
| 53,875 |
386 | // Copied from compound/Unitroller/ ComptrollerCore storage for the comptroller will be at this address, andcTokens should reference this contract rather than a deployed implementation if/ | contract Unitroller is UnitrollerAdminStorage, ComptrollerErrorReporter {
/**
* @notice Emitted when pendingComptrollerImplementation is changed
*/
event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation);
/**
* @notice Emitted when pendingComptr... | contract Unitroller is UnitrollerAdminStorage, ComptrollerErrorReporter {
/**
* @notice Emitted when pendingComptrollerImplementation is changed
*/
event NewPendingImplementation(address oldPendingImplementation, address newPendingImplementation);
/**
* @notice Emitted when pendingComptr... | 6,276 |
59 | // PAXUSD-A collateral deploy Set ilk bytes32 variable | bytes32 ilkPAXUSDA = "PAXUSD-A";
| bytes32 ilkPAXUSDA = "PAXUSD-A";
| 43,123 |
28 | // remove an account's access to this role / | function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));
role.bearer[account] = false;
}
| function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));
role.bearer[account] = false;
}
| 25,580 |
22 | // Function to access decimals of token . | function decimals() public view returns (uint8 _decimals) {
return decimals_;
}
| function decimals() public view returns (uint8 _decimals) {
return decimals_;
}
| 8,814 |
1 | // Make our own address available to us as a constant | address public CONTRACT_ADDRESS;
| address public CONTRACT_ADDRESS;
| 52,074 |
17 | // adjustedAmount = totalToClaim - bonus | adjustedAmount = totalToClaim.sub(bonus);
| adjustedAmount = totalToClaim.sub(bonus);
| 73,420 |
1 | // blockHeight = ; | return block.number;
| return block.number;
| 11,626 |
47 | // See {ERC20-balanceOf}. / | function balanceOf(address account) external view virtual override returns (uint256) {
return _balances[account];
}
| function balanceOf(address account) external view virtual override returns (uint256) {
return _balances[account];
}
| 8,208 |
31 | // For a given account, for a given operator, store whether that operator isallowed to transfer and modify assets on behalf of them. / | mapping(address => mapping(address => bool)) internal _operators;
| mapping(address => mapping(address => bool)) internal _operators;
| 33,179 |
35 | // ================================================EVENTS ================================================ |
event _BlockPurchased(
uint indexed blockId,
address author,
string file_hash,
uint chunk_id,
uint256 xdai_value,
string attachments,
string tags);
|
event _BlockPurchased(
uint indexed blockId,
address author,
string file_hash,
uint chunk_id,
uint256 xdai_value,
string attachments,
string tags);
| 20,376 |
28 | // 1. vars | uint256 rewardTransferAmount = 0;
| uint256 rewardTransferAmount = 0;
| 49,473 |
28 | // Make sure we're past the challenge period | require(channels[id].closeTime + channels[id].challenge <= now);
| require(channels[id].closeTime + channels[id].challenge <= now);
| 7,637 |
21 | // take fee before transfer out | uint256 amountMinusFee = (balanceAfter.sub(balanceBefore))
.mul(protocolFee)
.div(PROTOCOL_FEE_DECIMALS);
IERC20(tokenOut).transfer(msg.sender, amountMinusFee);
| uint256 amountMinusFee = (balanceAfter.sub(balanceBefore))
.mul(protocolFee)
.div(PROTOCOL_FEE_DECIMALS);
IERC20(tokenOut).transfer(msg.sender, amountMinusFee);
| 30,258 |
0 | // Allocates container space for the DynamicBuffer/capacity_ The intended max amount of bytes in the buffer/ return buffer The memory location of the buffer/Allocates `capacity_ + 0x60` bytes of space/The buffer array starts at the first container data position,/(i.e. `buffer = container + 0x20`) | function allocate(uint256 capacity_)
internal
pure
returns (bytes memory buffer)
| function allocate(uint256 capacity_)
internal
pure
returns (bytes memory buffer)
| 875 |
8 | // Allows the StandardBridge on this network to mint tokens._to Address to mint tokens to. _amount Amount of tokens to mint. / | function mint(address _to, uint256 _amount)
external
virtual
override(IKromaMintableERC20)
onlyBridge
| function mint(address _to, uint256 _amount)
external
virtual
override(IKromaMintableERC20)
onlyBridge
| 43,879 |
8 | // Getter function for the debt token price granularity return debt token price granularity/ | function getDebtTokenPriceGranularity() public view returns (uint256) {
return _debtTokenPriceGranularity;
}
| function getDebtTokenPriceGranularity() public view returns (uint256) {
return _debtTokenPriceGranularity;
}
| 52,829 |
36 | // / | contract ERC20 {
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
/**
* @dev The amount of tokens in existence.
*/
uint256 public totalSupply;
/**
* @dev The amount of tokens owned by `accoun... | contract ERC20 {
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
/**
* @dev The amount of tokens in existence.
*/
uint256 public totalSupply;
/**
* @dev The amount of tokens owned by `accoun... | 18,687 |
8 | // Similar to EIP20 transfer, except it handles a False result from `transferFrom` and reverts in that case. This will revert due to insufficient balance or insufficient allowance. This function returns the actual amount received, which may be less than `amount` if there is a fee attached to the transfer.Note: This wra... | function doTransferIn(address from, uint amount) internal returns (uint) {
EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);
uint balanceBefore = EIP20Interface(underlying).balanceOf(address(this));
token.transferFrom(from, address(this), amount);
bool success... | function doTransferIn(address from, uint amount) internal returns (uint) {
EIP20NonStandardInterface token = EIP20NonStandardInterface(underlying);
uint balanceBefore = EIP20Interface(underlying).balanceOf(address(this));
token.transferFrom(from, address(this), amount);
bool success... | 42,033 |
32 | // Calculate sqrt (x) rounding down.Revert if x < 0.x signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number / | function sqrt (int128 x) internal pure returns (int128) {
unchecked {
require (x >= 0);
return int128 (sqrtu (uint256 (int256 (x)) << 64));
}
}
| function sqrt (int128 x) internal pure returns (int128) {
unchecked {
require (x >= 0);
return int128 (sqrtu (uint256 (int256 (x)) << 64));
}
}
| 27,674 |
10 | // Declare lenDiff + recoveredSigner scope to manage stack pressure. | {
| {
| 22,652 |
31 | // totalFees | uint256 private totalBuyFee = liquidityFee.add(marketingFee).add(opsFee).add(devFee).add(stakingFee);
uint256 private totalSellFee = sellFeeLiquidity.add(sellFeeMarketing).add(sellFeeOps).add(sellFeeDev).add(sellFeeStaking);
uint256 private feeDenominator = 100;
address private autoLiquidityReceiver ... | uint256 private totalBuyFee = liquidityFee.add(marketingFee).add(opsFee).add(devFee).add(stakingFee);
uint256 private totalSellFee = sellFeeLiquidity.add(sellFeeMarketing).add(sellFeeOps).add(sellFeeDev).add(sellFeeStaking);
uint256 private feeDenominator = 100;
address private autoLiquidityReceiver ... | 56,735 |
225 | // Fallbacks / | receive() external payable {
// Only accept ETH via fallback from the WETH contract
require(msg.sender == _rewardsToken);
}
| receive() external payable {
// Only accept ETH via fallback from the WETH contract
require(msg.sender == _rewardsToken);
}
| 38,480 |
19 | // anyone can call this function | function unlock(address from, address to, address token, uint32 unlockTime) public override afterUnlockTime(unlockTime) {
bytes32 key = _getLockedSendKey(from, to, token, unlockTime);
uint amount = lockSendInfos[key];
require(amount != 0, "LockSend: UNLOCK_AMOUNT_SHOULD_BE_NONZERO");
... | function unlock(address from, address to, address token, uint32 unlockTime) public override afterUnlockTime(unlockTime) {
bytes32 key = _getLockedSendKey(from, to, token, unlockTime);
uint amount = lockSendInfos[key];
require(amount != 0, "LockSend: UNLOCK_AMOUNT_SHOULD_BE_NONZERO");
... | 12,747 |
65 | // loop through arrays, committing each individual vote values | for (uint i = 0; i < _pollIDs.length; i++) {
commitVote(_pollIDs[i], _secretHashes[i], _numsTokens[i], _prevPollIDs[i]);
}
| for (uint i = 0; i < _pollIDs.length; i++) {
commitVote(_pollIDs[i], _secretHashes[i], _numsTokens[i], _prevPollIDs[i]);
}
| 49,011 |
158 | // Unpack the data | uint256 ts = _buyTs[sender][arrayIndex];
uint256 amt = _buyAmt[sender][arrayIndex];
if (ts + 30 days < block.timestamp ) {
| uint256 ts = _buyTs[sender][arrayIndex];
uint256 amt = _buyAmt[sender][arrayIndex];
if (ts + 30 days < block.timestamp ) {
| 18,409 |
30 | // Replace used id by last | remainingIds[_index] = getValue(lastSupply);
| remainingIds[_index] = getValue(lastSupply);
| 39,303 |
17 | // Returns the address that signed a hashed message (`hash`) with`signature`. This address can then be used for verification purposes. The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:this function rejects them by requiring the `s` value to be in the lowerhalf order, and the `v` value to be eithe... | * be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
// Divide the signature in r, s and v variables
bytes32 r;
bytes32 s;
uint8 v;
// Check the signature length... | * be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
// Divide the signature in r, s and v variables
bytes32 r;
bytes32 s;
uint8 v;
// Check the signature length... | 1,120 |
17 | // Constructor function. This is only called on contract creation. | function MarketPlace(address admin_, address feeAccount_, uint feeTake_, uint freeUntilDate_, address predecessor_) public {
admin = admin_;
feeAccount = feeAccount_;
feeTake = feeTake_;
freeUntilDate = freeUntilDate_;
depositingTokenFlag = false;
predecessor = predecessor_;
if (predecess... | function MarketPlace(address admin_, address feeAccount_, uint feeTake_, uint freeUntilDate_, address predecessor_) public {
admin = admin_;
feeAccount = feeAccount_;
feeTake = feeTake_;
freeUntilDate = freeUntilDate_;
depositingTokenFlag = false;
predecessor = predecessor_;
if (predecess... | 45,613 |
40 | // Peterson's Law ProtectionClaim tokens / | function claimTokens(address _token) public onlyOwner {
//function claimTokens(address _token) public { //for test's
//require(permissions[4].approveOwner == true && permissions[4].approveOwnerTwo == true);
if (_token == 0x0) {
owner.transfer(this.balance);
retu... | function claimTokens(address _token) public onlyOwner {
//function claimTokens(address _token) public { //for test's
//require(permissions[4].approveOwner == true && permissions[4].approveOwnerTwo == true);
if (_token == 0x0) {
owner.transfer(this.balance);
retu... | 15,632 |
6 | // emit a Transfer event with Create semantic to help with discovery. | emit TransferSingle(msg.sender, address(0x0), address(0x0), _type, 0);
if (bytes(_uri).length > 0)
emit URI(_uri, _type);
| emit TransferSingle(msg.sender, address(0x0), address(0x0), _type, 0);
if (bytes(_uri).length > 0)
emit URI(_uri, _type);
| 6,365 |
142 | // s_signers contains the signing address of each oracle | address[] internal s_signers;
| address[] internal s_signers;
| 2,748 |
1 | // Fills the input order. Reverts if exact takerAssetFillAmount not filled./order LibOrder.Order struct containing order specifications./takerAssetFillAmount Desired amount of takerAsset to sell./signature Proof that order has been created by maker. | function fillOrKillOrder(
LibOrder.Order memory order,
uint256 takerAssetFillAmount,
bytes memory signature
)
public
returns (LibFillResults.FillResults memory fillResults);
| function fillOrKillOrder(
LibOrder.Order memory order,
uint256 takerAssetFillAmount,
bytes memory signature
)
public
returns (LibFillResults.FillResults memory fillResults);
| 3,981 |
88 | // Transfer the token with the given ID to a given address.Save the previous owner before the transfer, in case there is a sell-on fee. This can only be called by the auction contract specified at deployment / | function auctionTransfer(uint256 tokenId, address recipient) external;
| function auctionTransfer(uint256 tokenId, address recipient) external;
| 70,251 |
4 | // tokens are minted at a rate of 1 ETH : 1000 tokens | uint16 internal constant TOKEN_SCALE = 1000;
uint256 private constant ETH1_1000 = 1_000_000_000_000_000; // 0.001 eth
uint256 private constant ETH1_10 = 100_000_000_000_000_000; // 0.1 eth
uint256 public minPurchaseValue;
address public topPartyWallet;
address public fracVaultFactoryAddress;
... | uint16 internal constant TOKEN_SCALE = 1000;
uint256 private constant ETH1_1000 = 1_000_000_000_000_000; // 0.001 eth
uint256 private constant ETH1_10 = 100_000_000_000_000_000; // 0.1 eth
uint256 public minPurchaseValue;
address public topPartyWallet;
address public fracVaultFactoryAddress;
... | 9,543 |
8 | // PostDeliveryCrowdsale Crowdsale that locks tokens from withdrawal until it ends. / | contract PostDeliveryCrowdsale is TimedCrowdsale {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => uint256) private _locker_balances;
__unstable__TokenVault private _vault;
__unstable__TokenVault private _locker_valut;
Clover42Locker pri... | contract PostDeliveryCrowdsale is TimedCrowdsale {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => uint256) private _locker_balances;
__unstable__TokenVault private _vault;
__unstable__TokenVault private _locker_valut;
Clover42Locker pri... | 36,444 |
9 | // set the flag | ended = true;
| ended = true;
| 23,187 |
1,354 | // Called by the DSProxy contract which owns the Compound position/Adds the users Compound poistion in the list of subscriptions so it can be monitored/_minRatio Minimum ratio below which repay is triggered/_maxRatio Maximum ratio after which boost is triggered/_optimalBoost Ratio amount which boost should target/_opti... | function subscribe(uint128 _minRatio, uint128 _maxRatio, uint128 _optimalBoost, uint128 _optimalRepay, bool _boostEnabled) external {
// if boost is not enabled, set max ratio to max uint
uint128 localMaxRatio = _boostEnabled ? _maxRatio : uint128(-1);
require(checkParams(_minRatio, localMa... | function subscribe(uint128 _minRatio, uint128 _maxRatio, uint128 _optimalBoost, uint128 _optimalRepay, bool _boostEnabled) external {
// if boost is not enabled, set max ratio to max uint
uint128 localMaxRatio = _boostEnabled ? _maxRatio : uint128(-1);
require(checkParams(_minRatio, localMa... | 13,324 |
0 | // mint token zero to group wallet | _mint(GROUP_ADDRESS, 0);
_mint(address(0x5CE191eF43a87450faEa24C3487433E2bb0fEE1b), 1);
_mint(address(0x581420a87f00b4B552a3A261e21878Ea5c27e97f), 2);
| _mint(GROUP_ADDRESS, 0);
_mint(address(0x5CE191eF43a87450faEa24C3487433E2bb0fEE1b), 1);
_mint(address(0x581420a87f00b4B552a3A261e21878Ea5c27e97f), 2);
| 14,447 |
101 | // last cumulative price update time | uint32 internal block_timestamp_last;
| uint32 internal block_timestamp_last;
| 35,198 |
24 | // set interface main contract | EngineerContract = CryptoEngineerInterface(0x69fd0e5d0a93bf8bac02c154d343a8e3709adabf);
MiningwarContract = CryptoMiningWarInterface(0xf84c61bb982041c030b8580d1634f00fffb89059);
| EngineerContract = CryptoEngineerInterface(0x69fd0e5d0a93bf8bac02c154d343a8e3709adabf);
MiningwarContract = CryptoMiningWarInterface(0xf84c61bb982041c030b8580d1634f00fffb89059);
| 69,703 |
336 | // LastWithdrawalPrice | function setLastWithdrawalPrice(
address _property,
address _user,
uint256 _value
| function setLastWithdrawalPrice(
address _property,
address _user,
uint256 _value
| 29,187 |
94 | // Two step operation since msg.sender has no permission to move tokens other than through address(this) | require(token.transferFrom(msg.sender, address(this), transferableAmount));
require(token.transfer(_recipient, transferableAmount));
emit AmountClaimed(msg.sender, _recipient, transferableAmount);
| require(token.transferFrom(msg.sender, address(this), transferableAmount));
require(token.transfer(_recipient, transferableAmount));
emit AmountClaimed(msg.sender, _recipient, transferableAmount);
| 56,553 |
73 | // Insert a new resource. _cid bytes16: Resource index(ClaimID). _udfsstring : The UDFS Hash value of the resource. _authoraddress: Declare the address of the resource. _pricing uint256: Pricing of resources. _deposit uint256: Declare a deposit required for a resource. _typeuint8: Type of resource.return bool : The suc... | function insertClaim(bytes16 _cid, string _udfs, address _author, uint256 _pricing, uint256 _deposit, uint8 _type)
public
returns(bool)
| function insertClaim(bytes16 _cid, string _udfs, address _author, uint256 _pricing, uint256 _deposit, uint8 _type)
public
returns(bool)
| 38,920 |
42 | // Generate pseudorandom number | function getRndmNmbr(uint256 _upper) private view returns (uint256) {
uint256 rndm = uint256(keccak256(abi.encodePacked(availableTkns.length, blockhash(block.number - 1), block.coinbase, block.difficulty, msg.sender)));
return rndm % _upper;
}
| function getRndmNmbr(uint256 _upper) private view returns (uint256) {
uint256 rndm = uint256(keccak256(abi.encodePacked(availableTkns.length, blockhash(block.number - 1), block.coinbase, block.difficulty, msg.sender)));
return rndm % _upper;
}
| 25,994 |
10 | // if liquidity has pulled in contract then calculate share accordingly | if (_pulled == 1) {
uint256 liquidityShare = FullMath.mulDiv(
liquidity,
1e18,
totalSupply
);
(amount0, amount1) = pool.burnUserLiquidity(
ticksData.baseTickLower,
ticksData.baseTickUpper,
| if (_pulled == 1) {
uint256 liquidityShare = FullMath.mulDiv(
liquidity,
1e18,
totalSupply
);
(amount0, amount1) = pool.burnUserLiquidity(
ticksData.baseTickLower,
ticksData.baseTickUpper,
| 26,588 |
83 | // if currency to convert to is ether | if(payout_currency=="ether"){
bytes16 amountInViaUSD = ABDKMathQuad.mul(amount, viarate);
bytes16 inEth = ABDKMathQuad.div(amountInViaUSD, ethusd);
return inEth;
}
| if(payout_currency=="ether"){
bytes16 amountInViaUSD = ABDKMathQuad.mul(amount, viarate);
bytes16 inEth = ABDKMathQuad.div(amountInViaUSD, ethusd);
return inEth;
}
| 51,445 |
0 | // minimal uniswap we need: | interface IUniswap {
function tokenAddress() external view returns (address);
function tokenToEthSwapOutput(uint256 eth_bought, uint256 max_tokens, uint256 deadline) external returns (uint256 out);
function tokenToEthTransferOutput(uint256 eth_bought, uint256 max_tokens, uint256 deadline, address payable ... | interface IUniswap {
function tokenAddress() external view returns (address);
function tokenToEthSwapOutput(uint256 eth_bought, uint256 max_tokens, uint256 deadline) external returns (uint256 out);
function tokenToEthTransferOutput(uint256 eth_bought, uint256 max_tokens, uint256 deadline, address payable ... | 35,803 |
12 | // If `account` had not been already granted `role`, emits a {RoleGranted}event. Requirements: - the caller must have ``role``'s admin role. / | function grantRole(
bytes32 role,
address account
) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
| function grantRole(
bytes32 role,
address account
) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
| 27,126 |
25 | // address pancakeAddress = 0x10ED43C718714eb63d5aA57B78B54704E256024E; |
string constant _name = "GRAMPEPE"; //Set the name of your token.
string constant _symbol = "GRAMP"; //Set the symbol of your token.
bool public restrictWhales = true; //If true, limits wallet to _walletMax set above.
mapping(address => uint256) _balances;
mapping(address => mapping(address => ui... |
string constant _name = "GRAMPEPE"; //Set the name of your token.
string constant _symbol = "GRAMP"; //Set the symbol of your token.
bool public restrictWhales = true; //If true, limits wallet to _walletMax set above.
mapping(address => uint256) _balances;
mapping(address => mapping(address => ui... | 24,911 |
59 | // Renounces Ownership | }
| }
| 19,876 |
98 | // returns proposal info with additional information for frontend/ id id of proposal/return proposal struct/return creatorAmountStaked amount of staked tokens by proposal creator/return quorum/return majority | function getProposalInfo(uint256 id)
external
view
returns (
Voting memory,
uint256 creatorAmountStaked,
uint256,
uint256
)
| function getProposalInfo(uint256 id)
external
view
returns (
Voting memory,
uint256 creatorAmountStaked,
uint256,
uint256
)
| 73,705 |
7 | // requires UPGRADE ADMIN role in v2-3, company in v1 | function changeTokenController(address newController)
public;
function newTokenController()
public
constant
returns (address);
function oldTokenController()
public
| function changeTokenController(address newController)
public;
function newTokenController()
public
constant
returns (address);
function oldTokenController()
public
| 25,029 |
158 | // When a deposit is initiated on L1, the L1 Bridge transfers the funds to itself for future withdrawals. safeTransferFrom also checks if the contract has code, so this will fail if _from is an EOA or address(0). | IERC20(_l1Token).safeTransferFrom(_from, address(this), _amount);
| IERC20(_l1Token).safeTransferFrom(_from, address(this), _amount);
| 75,741 |
57 | // Returns the available supple (total supply minus tokens held by owner) / | function availableSupply() public view returns (uint256) {
return _totalSupply.sub(balances[owner]).sub(balances[address(0)]);
}
| function availableSupply() public view returns (uint256) {
return _totalSupply.sub(balances[owner]).sub(balances[address(0)]);
}
| 22,972 |
31 | // Set a new coordinator address | function setCoordinator(address _coordinator)
public
onlyOwner
| function setCoordinator(address _coordinator)
public
onlyOwner
| 74,423 |
0 | // On mainnet, we override the restakeNFT method so that TellerNFTV1 is also restakesloanID ID of loan for which to restake linked NFT / | function _restakeNFTForRepayment(uint256 loanID) internal override {
NFTLib.restakeLinked(loanID, LibLoans.loan(loanID).borrower);
super._restakeNFTForRepayment(loanID);
}
| function _restakeNFTForRepayment(uint256 loanID) internal override {
NFTLib.restakeLinked(loanID, LibLoans.loan(loanID).borrower);
super._restakeNFTForRepayment(loanID);
}
| 9,308 |
23 | // fromG converts a gOHM balance to sOHM terms. sOHM is a 9 decimal token. balance given is in 9 decimal format. | function fromG(uint256 amount) external view override returns (uint256) {
return gOHM.balanceFrom(amount);
}
| function fromG(uint256 amount) external view override returns (uint256) {
return gOHM.balanceFrom(amount);
}
| 24,364 |
5 | // Creator of the bounty | address creator;
| address creator;
| 27,842 |
141 | // destroys `amount` tokens from the caller (public) | function burn(uint amount) public {
_burn(_msgSender(), amount);
_moveDelegates(_delegates[_msgSender()], address(0), amount);
}
| function burn(uint amount) public {
_burn(_msgSender(), amount);
_moveDelegates(_delegates[_msgSender()], address(0), amount);
}
| 19,753 |
119 | // buy -> the quote is the offered token by the maker | return mustSkipFee[makerOrder.wantToken_][makerOrder.offerToken_]
? 0
: toTakerAmount.mul(feeEdoPerQuote[makerOrder.offerToken_]).div(10**feeEdoPerQuoteDecimals[makerOrder.offerToken_]);
| return mustSkipFee[makerOrder.wantToken_][makerOrder.offerToken_]
? 0
: toTakerAmount.mul(feeEdoPerQuote[makerOrder.offerToken_]).div(10**feeEdoPerQuoteDecimals[makerOrder.offerToken_]);
| 22,701 |
30 | // Use virtual total supply and zero swap fees for joins. | (uint256 amp, ) = _getAmplificationParameter();
amountOut = StableMath._calcTokenOutGivenExactBptIn(amp, balances, tokenIndex, bptIn, virtualSupply, 0);
| (uint256 amp, ) = _getAmplificationParameter();
amountOut = StableMath._calcTokenOutGivenExactBptIn(amp, balances, tokenIndex, bptIn, virtualSupply, 0);
| 74,112 |
7 | // Returns the timestamp of the person in the front of the queue / | function getFirstTime() constant returns(uint256) {
require(spotsFilled>0);
return submissionList[queueList[0]].time;
}
| function getFirstTime() constant returns(uint256) {
require(spotsFilled>0);
return submissionList[queueList[0]].time;
}
| 29,876 |
68 | // Parse an address from the view at `_index`. Requires that the view have >= 20 bytes following that index. | function indexAddress(bytes29 memView, uint256 _index) internal pure returns (address) {
return address(uint160(indexInt(memView, _index, 20)));
}
| function indexAddress(bytes29 memView, uint256 _index) internal pure returns (address) {
return address(uint160(indexInt(memView, _index, 20)));
}
| 42,461 |
32 | // Price of token in Wei / | uint256 public price;
| uint256 public price;
| 37,725 |
96 | // Emits a {Burn} event / | function _burn(address account, uint256 amount) internal virtual override {
require(amount >= burnMin, "BurnableTokenWithBounds: below min burn bound");
require(amount <= burnMax, "BurnableTokenWithBounds: exceeds max burn bound");
super._burn(account, amount);
emit Burn(account, am... | function _burn(address account, uint256 amount) internal virtual override {
require(amount >= burnMin, "BurnableTokenWithBounds: below min burn bound");
require(amount <= burnMax, "BurnableTokenWithBounds: exceeds max burn bound");
super._burn(account, amount);
emit Burn(account, am... | 31,921 |
35 | // Sender borrows assets from the protocol to their own address _borrowAmount: The amount of the underlying asset to borrowreturn SUCCESS / | function borrowInternal(uint _borrowAmount) internal nonReentrant returns (uint) {
uint err = accrueInterest();
require(err == uint(Error.SUCCESS), "BORROW_ACCRUE_INTEREST_FAILED");
return borrowFresh(msg.sender, _borrowAmount);
}
| function borrowInternal(uint _borrowAmount) internal nonReentrant returns (uint) {
uint err = accrueInterest();
require(err == uint(Error.SUCCESS), "BORROW_ACCRUE_INTEREST_FAILED");
return borrowFresh(msg.sender, _borrowAmount);
}
| 20,962 |
15 | // The EIP-712 typehash for the ballot struct used by the contract | bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)");
| bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)");
| 42,700 |
61 | // Returns ether according to rate / | function getEthAmount(uint256 _tokenAmount) public view returns (uint256) {
return _getEthAmount(_tokenAmount);
}
| function getEthAmount(uint256 _tokenAmount) public view returns (uint256) {
return _getEthAmount(_tokenAmount);
}
| 21,981 |
22 | // Take the newer price | uint64 tokenPrice = cachePrice.timestamp >= oracleUpdatedAt ? cachePrice.price :
(decimals == 8 ? uint64(price) : uint64(price * 1e8 / (10 ** decimals)));
return (tokenPrice, updatedAt);
| uint64 tokenPrice = cachePrice.timestamp >= oracleUpdatedAt ? cachePrice.price :
(decimals == 8 ? uint64(price) : uint64(price * 1e8 / (10 ** decimals)));
return (tokenPrice, updatedAt);
| 19,541 |
20 | // _minimumAnte is the new the minimum bet | function setMinimumAnte(uint256 _minimumAnte)
public
override
onlyRole(GAME_MANAGER_ROLE)
| function setMinimumAnte(uint256 _minimumAnte)
public
override
onlyRole(GAME_MANAGER_ROLE)
| 13,340 |
48 | // charge exit fee on the pool token side pAiAfterExitFee = pAi(1-exitFee) | uint poolAmountInAfterExitFee = bmul(poolAmountIn, bsub(BONE, EXIT_FEE));
uint newPoolSupply = bsub(poolSupply, poolAmountInAfterExitFee);
uint poolRatio = bdiv(newPoolSupply, poolSupply);
| uint poolAmountInAfterExitFee = bmul(poolAmountIn, bsub(BONE, EXIT_FEE));
uint newPoolSupply = bsub(poolSupply, poolAmountInAfterExitFee);
uint poolRatio = bdiv(newPoolSupply, poolSupply);
| 8,496 |
5 | // Increase shares and set the poll | _poll.shareOf[_voter] += _count;
_poll.pollOf[_voter] = _variant;
_poll.valueOf[_variant] += _count;
| _poll.shareOf[_voter] += _count;
_poll.pollOf[_voter] = _variant;
_poll.valueOf[_variant] += _count;
| 6,445 |
0 | // ========== EVENTS ========== // ========== STATE VARIABLES ========== // ========== Constructor ========== / | constructor(IExodusAuthority _authority) {
authority = _authority;
emit AuthorityUpdated(_authority);
}
| constructor(IExodusAuthority _authority) {
authority = _authority;
emit AuthorityUpdated(_authority);
}
| 10,142 |
2 | // 3. nested mapping (eg. ERC 20 tokens) | mapping (address => mapping(address => bool)) approved;
| mapping (address => mapping(address => bool)) approved;
| 31,108 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.