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 |
|---|---|---|---|---|
16 | // During the deployment of the contract pass the ERC-20 contract address used for rewards. | constructor(address _rewardsToken) public {
rewardsToken = IERC20(_rewardsToken);
}
| constructor(address _rewardsToken) public {
rewardsToken = IERC20(_rewardsToken);
}
| 77,595 |
113 | // Make sure tokens are currently locked before proceeding to unlock them | require(tokensLocked == true);
tokensLocked = false;
| require(tokensLocked == true);
tokensLocked = false;
| 42,320 |
11 | // send fee tokens to fee collector | IERC20(_token).safeTransfer(feeCollector, liquidityFee);
uint256 amountLocked = _amount.sub(liquidityFee);
TokenLock memory token_lock;
token_lock.lockDate = block.timestamp;
token_lock.amount = amountLocked;
token_lock.initialAmount = amountLocked;
token_lock.un... | IERC20(_token).safeTransfer(feeCollector, liquidityFee);
uint256 amountLocked = _amount.sub(liquidityFee);
TokenLock memory token_lock;
token_lock.lockDate = block.timestamp;
token_lock.amount = amountLocked;
token_lock.initialAmount = amountLocked;
token_lock.un... | 39,690 |
65 | // Redeems yield bearing tokens from this TempusPool/msg.sender will receive the YBT/NOTE 1 Before maturity, principalAmount must equal to yieldAmount./NOTE 2 This function can only be called by TempusController/from Address to redeem its Tempus Shares/principalAmount Amount of Tempus Principal Shares (TPS) to redeem f... | function redeem(
address from,
uint256 principalAmount,
uint256 yieldAmount,
address recipient
)
external
returns (
uint256 redeemableYieldTokens,
uint256 fee,
| function redeem(
address from,
uint256 principalAmount,
uint256 yieldAmount,
address recipient
)
external
returns (
uint256 redeemableYieldTokens,
uint256 fee,
| 53,411 |
20 | // Initializes the contract with immutable variables / | constructor(address _share) {
if (_share == address(0)) revert BadAddress();
share = IVaultShare(_share);
}
| constructor(address _share) {
if (_share == address(0)) revert BadAddress();
share = IVaultShare(_share);
}
| 15,323 |
89 | // Set next loan allocation from vault in USD | allocationState.loanAllocation =
(uint256(_allocationState.loanAllocationPCT) * lockedBalance) /
TOTAL_PCT;
| allocationState.loanAllocation =
(uint256(_allocationState.loanAllocationPCT) * lockedBalance) /
TOTAL_PCT;
| 8,339 |
0 | // ratio for token transfers. 1000 -> 1:1 transfer | uint256 public constant TOKEN_RATIO = 1000;
uint256 private nonce;
string private constant ACTIVE_TOKEN_NAME = "IOU-";
string private constant PASSIVE_TOKEN_NAME = "R-";
| uint256 public constant TOKEN_RATIO = 1000;
uint256 private nonce;
string private constant ACTIVE_TOKEN_NAME = "IOU-";
string private constant PASSIVE_TOKEN_NAME = "R-";
| 27,222 |
114 | // Redeem invested underlying tokens from defi protocol and exchange into DAI _amount tokens to be redeemedreturn amount of token swapped to dai, amount of reward token swapped to dai, total dai / | function redeemUnderlyingToDAI(uint256 _amount, address _recipient)
| function redeemUnderlyingToDAI(uint256 _amount, address _recipient)
| 38,711 |
24 | // Forward authorized contract calls to protocol contracts Fallback function can be called by the beneficiary only if function call is allowed / solhint-disable-next-line no-complex-fallback | fallback() external payable {
// Only beneficiary can forward calls
require(msg.sender == beneficiary, "Unauthorized caller");
require(msg.value == 0, "ETH transfers not supported");
// Function call validation
address _target = manager.getAuthFunctionCallTarget(msg.sig);
... | fallback() external payable {
// Only beneficiary can forward calls
require(msg.sender == beneficiary, "Unauthorized caller");
require(msg.value == 0, "ETH transfers not supported");
// Function call validation
address _target = manager.getAuthFunctionCallTarget(msg.sig);
... | 21,308 |
296 | // lib/yamV3/contracts/tests/vesting_pool/VestingPool.sol/ pragma solidity 0.5.15; // import "../../lib/SafeERC20.sol"; / | /* import {YAMDelegate3} from "../../token/YAMDelegate3.sol"; */
contract VestingPool {
using SafeMath_2 for uint256;
using SafeMath_2 for uint128;
struct Stream {
address recipient;
uint128 startTime;
uint128 length;
uint256 totalAmount;
uint256 amountPaidOut;
... | /* import {YAMDelegate3} from "../../token/YAMDelegate3.sol"; */
contract VestingPool {
using SafeMath_2 for uint256;
using SafeMath_2 for uint128;
struct Stream {
address recipient;
uint128 startTime;
uint128 length;
uint256 totalAmount;
uint256 amountPaidOut;
... | 36,803 |
28 | // Deletes the provided root from the collection ofwithdrawal authorization merkle tree roots, invalidating thewithdrawals contained in the tree assocated with this root. root The root hash to delete. / | function deleteWithdrawalRoot(bytes32 root) private {
uint256 nonce = _withdrawalRootToNonce[root];
require(
nonce > 0,
"Root hash not set"
);
delete _withdrawalRootToNonce[root];
emit WithdrawalRootHashRemoval(root, nonce);
}
| function deleteWithdrawalRoot(bytes32 root) private {
uint256 nonce = _withdrawalRootToNonce[root];
require(
nonce > 0,
"Root hash not set"
);
delete _withdrawalRootToNonce[root];
emit WithdrawalRootHashRemoval(root, nonce);
}
| 26,532 |
1 | // Subtract a number from another number, checking for underflowsa first number b second numberreturna - b / | function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
| function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
| 40,744 |
6 | // Track amount of seed money put into jackpot. | uint256 public seedAmount;
| uint256 public seedAmount;
| 11,574 |
290 | // Allow Original Crypterior Holders to mint an another one if goal is reached. / | function increaseMaxMintPerOriginalCrypterior() public {
require(totalSupply() > WHEN_INCREASE_MAX_MINTS_PER_ORIGINAL_CRYPTERIOR, "Goal has to be reached");
MAX_MINTS_PER_ORIGINAL_CRYPTERIOR = 2;
}
| function increaseMaxMintPerOriginalCrypterior() public {
require(totalSupply() > WHEN_INCREASE_MAX_MINTS_PER_ORIGINAL_CRYPTERIOR, "Goal has to be reached");
MAX_MINTS_PER_ORIGINAL_CRYPTERIOR = 2;
}
| 52,005 |
97 | // event of when a swap has been cancelled | event SwapCancelled(uint256 indexed id);
| event SwapCancelled(uint256 indexed id);
| 15,465 |
240 | // StakeRewarder This contract distributes rewards to depositors of supported tokens.It's based on Sushi's MasterChef v1, but notably only serves what's alreadyavailable: no new tokens can be created. It's just a restaurant, not a farm. / | contract StakeRewarder is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct UserInfo {
uint256 amount; // Quantity of tokens the user has staked.
uint256 rewardDebt; // Reward debt. See explanation below.
// We do some fancy math here. Basically, any p... | contract StakeRewarder is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct UserInfo {
uint256 amount; // Quantity of tokens the user has staked.
uint256 rewardDebt; // Reward debt. See explanation below.
// We do some fancy math here. Basically, any p... | 31,477 |
1,430 | // Load the corresponding market into memory | nToken.cashGroup.loadMarket(market, i + 1, true, blockTime);
PortfolioAsset memory liquidityToken = nToken.portfolioState.storedAssets[i];
uint256 maturity = liquidityToken.maturity;
| nToken.cashGroup.loadMarket(market, i + 1, true, blockTime);
PortfolioAsset memory liquidityToken = nToken.portfolioState.storedAssets[i];
uint256 maturity = liquidityToken.maturity;
| 4,280 |
0 | // ISideToken sideTokenBtc;sideEthereumBTC | address internal constant NULL_ADDRESS = address(0);
uint256 public fee;
mapping(address => uint256) public balance;
| address internal constant NULL_ADDRESS = address(0);
uint256 public fee;
mapping(address => uint256) public balance;
| 11,779 |
103 | // Pool Delegate Utility Functions // / | function poolSanityChecks(
IMapleGlobals globals,
address liquidityAsset,
address stakeAsset,
uint256 stakingFee,
uint256 delegateFee
| function poolSanityChecks(
IMapleGlobals globals,
address liquidityAsset,
address stakeAsset,
uint256 stakingFee,
uint256 delegateFee
| 59,702 |
6 | // Empty internal constructor, to prevent people from mistakenly deployingan instance of this contract, which should be used via inheritance. | constructor () internal { }
| constructor () internal { }
| 8,951 |
121 | // Returns number of valid coins staked by `account` / | function activeStakeOf(address account) public view returns (uint256) {
return _stakeOf(account, _nextCheckpoint());
}
| function activeStakeOf(address account) public view returns (uint256) {
return _stakeOf(account, _nextCheckpoint());
}
| 34,692 |
1 | // Store accounts that have made a transaction | mapping(address => bool) public senders;
| mapping(address => bool) public senders;
| 2,844 |
5 | // Chainlink Setup: | bytes32 internal keyHash;
uint256 public fee;
uint256 internal randomResult;
uint256 internal randomNumber;
address public linkToken;
uint256 public vrfcooldown;
CountersUpgradeable.Counter public vrfReqd;
| bytes32 internal keyHash;
uint256 public fee;
uint256 internal randomResult;
uint256 internal randomNumber;
address public linkToken;
uint256 public vrfcooldown;
CountersUpgradeable.Counter public vrfReqd;
| 7,092 |
683 | // Address of the position's heldToken. Cached for convenience and lower-cost withdrawals | address public heldToken;
| address public heldToken;
| 67,421 |
0 | // ERC20 A standard interface for tokens. / | contract ERC20 {
/// @dev Returns the total token supply
function totalSupply() public view returns (uint256 supply);
/// @dev Returns the account balance of the account with address _owner
function balanceOf(address _owner) public view returns (uint256 balance);
/// @dev Transfers _value number ... | contract ERC20 {
/// @dev Returns the total token supply
function totalSupply() public view returns (uint256 supply);
/// @dev Returns the account balance of the account with address _owner
function balanceOf(address _owner) public view returns (uint256 balance);
/// @dev Transfers _value number ... | 52,012 |
147 | // Get the total denormalized weight of the pool. / | function getTotalDenormalizedWeight()
external
view
override
_viewlock_
returns (uint256)
| function getTotalDenormalizedWeight()
external
view
override
_viewlock_
returns (uint256)
| 12,416 |
9 | // Events / | event Stake(uint256 amount, uint256 campaignId, uint256 poolId);
event SwitchPool(uint256 campaignId, uint256 fromPoolId, uint256 toPoolId);
event Unstake(uint256 campaignId, uint256 poolId);
event Claim(uint256 campaignId, address userAddress, uint256 amount);
| event Stake(uint256 amount, uint256 campaignId, uint256 poolId);
event SwitchPool(uint256 campaignId, uint256 fromPoolId, uint256 toPoolId);
event Unstake(uint256 campaignId, uint256 poolId);
event Claim(uint256 campaignId, address userAddress, uint256 amount);
| 4,724 |
516 | // Make sure the FPI oracle price hasn't moved away too much from the target peg price | require(price_diff_abs <= peg_band_twamm, "Peg band [TWAMM]");
| require(price_diff_abs <= peg_band_twamm, "Peg band [TWAMM]");
| 47,960 |
1 | // NoDeliveryCrowdsale Enjinstarter Extension of Crowdsale contract where purchased tokens are not delivered. / | abstract contract NoDeliveryCrowdsale is Crowdsale {
/**
* @dev Overrides delivery by not delivering tokens upon purchase.
*/
function _deliverTokens(address, uint256) internal pure override {
return;
}
}
| abstract contract NoDeliveryCrowdsale is Crowdsale {
/**
* @dev Overrides delivery by not delivering tokens upon purchase.
*/
function _deliverTokens(address, uint256) internal pure override {
return;
}
}
| 31,642 |
61 | // increment buyer | tokenSaleInfo.counter++;
| tokenSaleInfo.counter++;
| 73,770 |
21 | // Sanity check: constants are reasonable. | require(_processGas >= 850_000, "!process gas");
require(_reserveGas >= 15_000, "!reserve gas");
PROCESS_GAS = _processGas;
RESERVE_GAS = _reserveGas;
require(_merkle != address(0), "!zero merkle");
MERKLE = MerkleTreeManager(_merkle);
delayBlocks = _delayBlocks;
| require(_processGas >= 850_000, "!process gas");
require(_reserveGas >= 15_000, "!reserve gas");
PROCESS_GAS = _processGas;
RESERVE_GAS = _reserveGas;
require(_merkle != address(0), "!zero merkle");
MERKLE = MerkleTreeManager(_merkle);
delayBlocks = _delayBlocks;
| 11,464 |
12 | // list of tokens | address[] public tokens;
mapping(address => tokenData) public tokenInfo;
mapping(address => bool) public keepers;
distributionSplit public tokenDistribution;
| address[] public tokens;
mapping(address => tokenData) public tokenInfo;
mapping(address => bool) public keepers;
distributionSplit public tokenDistribution;
| 48,547 |
106 | // Shortcut to check if a farm is active / | function _checkActive(Farm storage farm) internal {
farm.active = !(farm.paused || farm.farmEndedAtBlock > 0);
}
| function _checkActive(Farm storage farm) internal {
farm.active = !(farm.paused || farm.farmEndedAtBlock > 0);
}
| 49,721 |
11 | // Compute the look up table for the simultaneous multiplication (P, 3P,..,Q,3Q,..)./_iP the look up table were values will be stored/_points the points P and Q to be multiplied/_aa constant of the curve/_beta constant of the curve (endomorphism)/_pp the modulus | function _lookupSimMul(
uint256[3][4][4] memory _iP,
uint256[4] memory _points,
uint256 _aa,
uint256 _beta,
uint256 _pp)
private pure
| function _lookupSimMul(
uint256[3][4][4] memory _iP,
uint256[4] memory _points,
uint256 _aa,
uint256 _beta,
uint256 _pp)
private pure
| 50,062 |
140 | // CURVE | int128 fromIndex = int128(curveIndex[fromAddress]);
int128 toIndex = int128(curveIndex[toAddress]);
if (fromIndex > 0 && toIndex > 0) {
reserveA = curve.balances(uint256(getCurveIndex(fromAddress)));
reserveB = curve.balances(uint256(getCurveIndex(toAd... | int128 fromIndex = int128(curveIndex[fromAddress]);
int128 toIndex = int128(curveIndex[toAddress]);
if (fromIndex > 0 && toIndex > 0) {
reserveA = curve.balances(uint256(getCurveIndex(fromAddress)));
reserveB = curve.balances(uint256(getCurveIndex(toAd... | 36,802 |
28 | // {ERC721} token, including:This contract uses {AccessControl} to lock permissioned functions using the/ Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` to theaccount that deploys the contract. Token URIs will be autogenerated based on `baseURI` and their token IDs.See {ERC721-tokenURI}. / | constructor(string memory name, string memory symbol, string memory baseTokenURI, uint32 maxTokenSupply, address _proxyRegistryAddress)
ERC721(name, symbol) {
proxyRegistryAddress = _proxyRegistryAddress;
_initializeEIP712(name);
_baseTokenURI = baseTokenURI;
_maxSupply = maxTo... | constructor(string memory name, string memory symbol, string memory baseTokenURI, uint32 maxTokenSupply, address _proxyRegistryAddress)
ERC721(name, symbol) {
proxyRegistryAddress = _proxyRegistryAddress;
_initializeEIP712(name);
_baseTokenURI = baseTokenURI;
_maxSupply = maxTo... | 40,239 |
170 | // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. | result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
| result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
| 8,215 |
18 | // Gets the maximum input for a valid swap pair _mAsset mAsset address (e.g. mUSD) _input Asset to input only bAssets accepted _output Either a bAsset or the mAssetreturn validreturn validity reasonreturn max input units (in native decimals)return how much output this input would produce (in native decimals, after any ... | function getMaxSwap(
| function getMaxSwap(
| 29,865 |
34 | // Utility function to switch sides/ _side Side /return Opposite Side | function switchTeam(Sides _side) internal pure returns (Sides) {
if (_side == Sides.Black) {
return Sides.White;
} else {
return Sides.Black;
}
}
| function switchTeam(Sides _side) internal pure returns (Sides) {
if (_side == Sides.Black) {
return Sides.White;
} else {
return Sides.Black;
}
}
| 10,949 |
68 | // Solidity does not require us to clean the trailing bytes. We do it anyway | result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)
| result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)
| 5,769 |
54 | // if we are selling token to token | else {
amounts = router.swapExactTokensForTokens(_srcAmount, 1, path, msg.sender, block.timestamp + 1);
}
| else {
amounts = router.swapExactTokensForTokens(_srcAmount, 1, path, msg.sender, block.timestamp + 1);
}
| 38,373 |
1 | // Query the TokenId(ERAC) list for the specified account./ | function getTokenIds(address owner) external view returns (uint256[] memory);
| function getTokenIds(address owner) external view returns (uint256[] memory);
| 55,395 |
32 | // Don't allow for funding if the amount of Ether sent is less than 1 szabo. | reffUp(_reff);
if (msg.value > 0.000001 ether) {
investSum = add(investSum,msg.value);
buy(bondType/*,edgePigmentR(),edgePigmentG(),edgePigmentB()*/);
lastGateway = msg.sender;
} else {
| reffUp(_reff);
if (msg.value > 0.000001 ether) {
investSum = add(investSum,msg.value);
buy(bondType/*,edgePigmentR(),edgePigmentG(),edgePigmentB()*/);
lastGateway = msg.sender;
} else {
| 14,446 |
6 | // ======== STATE VARIABLS ======== // ======== EVENTS ======== // ======== POLICY FUNCTIONS ======== // / | function pushBond(address _principalToken, address _customTreasury, address _customBond, address _initialOwner, uint[] calldata _tierCeilings, uint[] calldata _fees) external returns(address _treasury, address _bond) {
require(olympusProFactory == msg.sender, "Not Olympus Pro Factory");
indexOfBond... | function pushBond(address _principalToken, address _customTreasury, address _customBond, address _initialOwner, uint[] calldata _tierCeilings, uint[] calldata _fees) external returns(address _treasury, address _bond) {
require(olympusProFactory == msg.sender, "Not Olympus Pro Factory");
indexOfBond... | 11,977 |
26 | // Has the farm started earning yet? | if ( block.number <= farm.lastRewardBlock) {
return;
}
| if ( block.number <= farm.lastRewardBlock) {
return;
}
| 34,905 |
8 | // Swap old and new receivers' vesting schedule, using address(0) as a scratch space. This is done to not overwrite an active vesting schedule. | vestingScheduleOf[address(0)] = vestingScheduleOf[oldReceiver_];
vestingScheduleOf[oldReceiver_] = vestingScheduleOf[newReceiver_];
vestingScheduleOf[newReceiver_] = vestingScheduleOf[address(0)];
delete vestingScheduleOf[address(0)];
emit ReceiverChanged(oldReceiver_, newRecei... | vestingScheduleOf[address(0)] = vestingScheduleOf[oldReceiver_];
vestingScheduleOf[oldReceiver_] = vestingScheduleOf[newReceiver_];
vestingScheduleOf[newReceiver_] = vestingScheduleOf[address(0)];
delete vestingScheduleOf[address(0)];
emit ReceiverChanged(oldReceiver_, newRecei... | 57,994 |
82 | // Given an addr input, injects return/sub values if specified/_param The original input value/_mapType Indicated the type of the input in paramMapping/_subData Array of subscription data we can replace the input value with/_returnValues Array of subscription data we can replace the input value with | function _parseParamAddr(
address _param,
uint8 _mapType,
bytes[] memory _subData,
bytes32[] memory _returnValues
| function _parseParamAddr(
address _param,
uint8 _mapType,
bytes[] memory _subData,
bytes32[] memory _returnValues
| 2,656 |
92 | // Update totals | weiRaised = weiRaised.plus(weiAmount);
tokensSold = tokensSold.plus(tokenAmount);
| weiRaised = weiRaised.plus(weiAmount);
tokensSold = tokensSold.plus(tokenAmount);
| 66 |
12 | // Note: the cost of playing is set by the contract creator, but it may be left to the player to decide. | function RockPaperScissors(uint _gameCreationCost)
public
| function RockPaperScissors(uint _gameCreationCost)
public
| 13,339 |
153 | // Set address to receive fees./ This may be called only by `governance`/_rewards Rewards receiver in Everscale network | function setRewards(
EverscaleAddress memory _rewards
| function setRewards(
EverscaleAddress memory _rewards
| 42,018 |
84 | // _releaseTime["C"] = _lockStart.add(231104000000); | _issueByPartition("C",msg.sender,msg.sender,87358000 * 10 ** uint256(_decimals),"");
| _issueByPartition("C",msg.sender,msg.sender,87358000 * 10 ** uint256(_decimals),"");
| 3,232 |
30 | // Get size of "_to" address, if 0 it's a wallet | uint32 size;
assembly {
size := extcodesize(_to)
}
| uint32 size;
assembly {
size := extcodesize(_to)
}
| 4,917 |
425 | // URI | string internal hiddenURI;
string internal _baseTokenURI;
string public _baseExtension = ".json";
| string internal hiddenURI;
string internal _baseTokenURI;
string public _baseExtension = ".json";
| 38,789 |
137 | // ERC721 Delete asset | _destroy(mortgageId);
| _destroy(mortgageId);
| 50,093 |
42 | // Update the swap fee to be applied on swaps newSwapFee new swap fee to be applied on future transactions / | function setSwapFee(uint256 newSwapFee) external payable onlyOwner {
swapStorage.setSwapFee(newSwapFee);
}
| function setSwapFee(uint256 newSwapFee) external payable onlyOwner {
swapStorage.setSwapFee(newSwapFee);
}
| 6,489 |
113 | // Returns total USD holdings in strategy.return amount is lpBalance x lpPrice + cvx x cvxPrice + _config.crvcrvPrice.return Returns total USD holdings in strategy / | function totalHoldings() public view virtual returns (uint256) {
uint256 crvLpHoldings = (cvxRewards.balanceOf(address(this)) * getCurvePoolPrice()) /
CURVE_PRICE_DENOMINATOR;
uint256 crvEarned = cvxRewards.earned(address(this));
uint256 cvxTotalCliffs = _config.cvx.totalCliffs... | function totalHoldings() public view virtual returns (uint256) {
uint256 crvLpHoldings = (cvxRewards.balanceOf(address(this)) * getCurvePoolPrice()) /
CURVE_PRICE_DENOMINATOR;
uint256 crvEarned = cvxRewards.earned(address(this));
uint256 cvxTotalCliffs = _config.cvx.totalCliffs... | 9,887 |
42 | // calcOutGivenIn aO = tokenAmountOutbO = tokenBalanceOut bI = tokenBalanceIn//bI \(wI / wO) \ aI = tokenAmountInaO = bO|1 - | --------------------------| ^|wI = tokenWeightIn \\ ( bI + ( aI( 1 - sF )) // wO = tokenWeightOutsF = swapFee/ | ) public pure returns (uint256 tokenAmountOut) {
uint256 weightRatio;
if (tokenWeightIn == tokenWeightOut) {
weightRatio = 1 * BONE;
} else if (tokenWeightIn >> 1 == tokenWeightOut) {
weightRatio = 2 * BONE;
} else {
weightRatio = tokenWeightIn.bdi... | ) public pure returns (uint256 tokenAmountOut) {
uint256 weightRatio;
if (tokenWeightIn == tokenWeightOut) {
weightRatio = 1 * BONE;
} else if (tokenWeightIn >> 1 == tokenWeightOut) {
weightRatio = 2 * BONE;
} else {
weightRatio = tokenWeightIn.bdi... | 1,576 |
226 | // check if the base fee gas price is higher than we allow. if it is, block harvests. | if (!isBaseFeeAcceptable()) return false;
| if (!isBaseFeeAcceptable()) return false;
| 21,643 |
20 | // See {ERC20-_burn}.votes will be updated after burn() whoever the delegator is. / | function burn(uint256 rawAmount) external returns (bool) {
uint128 amount = safe128(rawAmount, "_burn: amount exceeds 128 bits");
require(_burn(msg.sender, amount), "burn: fail to burn");
return true;
}
| function burn(uint256 rawAmount) external returns (bool) {
uint128 amount = safe128(rawAmount, "_burn: amount exceeds 128 bits");
require(_burn(msg.sender, amount), "burn: fail to burn");
return true;
}
| 34,763 |
7 | // Emitted when a submission for a bounty is rejected/bountyID The ID of the bounty for which the submission is rejected/submitter The address of the submitter/stake The stake of the rejected submission/payload The payload of the rejected submission/queueIndex The queue index of the submission/queueLength The queue len... | event RejectSubmission (
uint256 indexed bountyID,
address indexed submitter,
uint256 stake,
bytes32 payload,
uint32 queueIndex,
uint32 queueLength
);
| event RejectSubmission (
uint256 indexed bountyID,
address indexed submitter,
uint256 stake,
bytes32 payload,
uint32 queueIndex,
uint32 queueLength
);
| 27,987 |
157 | // control | uint256 public period = 0;
uint256 public periodFinish = 0;
uint256 public startTime = 0;
| uint256 public period = 0;
uint256 public periodFinish = 0;
uint256 public startTime = 0;
| 72,749 |
1,351 | // See {ERC20-_mint}. Requirements: - the caller must have the `MINTER_ROLE`. / | function mint(address to, uint256 amount) external virtual {
require(
hasRole(MINTER_ROLE, _msgSender()),
"ERC20SupplyControlled/MinterRole"
);
_mint(to, amount);
}
| function mint(address to, uint256 amount) external virtual {
require(
hasRole(MINTER_ROLE, _msgSender()),
"ERC20SupplyControlled/MinterRole"
);
_mint(to, amount);
}
| 3,686 |
28 | // Contract address on Optimism | opWorldIDAddress,
message,
opGasLimitSendRootOptimism
);
| opWorldIDAddress,
message,
opGasLimitSendRootOptimism
);
| 26,813 |
61 | // Getter for the address of the payee number `index`. / | function payee(uint256 index) public view returns (address) {
return _payees[index];
}
| function payee(uint256 index) public view returns (address) {
return _payees[index];
}
| 24,368 |
86 | // Calculates the current borrow interest rate per blockcash The total amount of cash the market hasborrows The total amount of borrows the market has outstandingreserves The total amnount of reserves the market has return The borrow rate per block (as a percentage, and scaled by 1e18)/ | function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);
| function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);
| 12,697 |
174 | // I needed a time calaculator somewhere, so I added it in here. _months: The number of months to be converted into unix time. return uint256: The time stamp of the months in unix time./ | function getMonthsFutureTimestamp(
uint256 _months
)
public
view
returns(uint256)
| function getMonthsFutureTimestamp(
uint256 _months
)
public
view
returns(uint256)
| 2,152 |
128 | // Optional metadata extension for ERC-721 non-fungible token standard. / | interface ERC721Metadata {
/**
* @dev Returns a descriptive name for a collection of NFTs in this contract.
*/
function name()
external
view
returns (string _name);
/**
* @dev Returns a abbreviated name for a collection of NFTs in this contract.
*/
function symbol()
external
vi... | interface ERC721Metadata {
/**
* @dev Returns a descriptive name for a collection of NFTs in this contract.
*/
function name()
external
view
returns (string _name);
/**
* @dev Returns a abbreviated name for a collection of NFTs in this contract.
*/
function symbol()
external
vi... | 22,052 |
9 | // Initial exchange rate used when minting the first PTokens (used when totalSupply = 0) / | uint256 internal initialExchangeRateMantissa;
| uint256 internal initialExchangeRateMantissa;
| 48,636 |
3 | // Owner of account approves the transfer of an amount to another account | mapping(address => mapping (address => uint256)) allowed;
| mapping(address => mapping (address => uint256)) allowed;
| 9,290 |
24 | // The tradeable status of asset Leave (together with assetPrice) for auto buy and sell functionality (with Ether). | bool public isTradable;
| bool public isTradable;
| 21,182 |
273 | // Gas price for oraclize callback transaction | uint256 public oracleGasPrice = 7000000000;
| uint256 public oracleGasPrice = 7000000000;
| 1,645 |
23 | // _transfer tokens | try
ERC20(paymentToken).transferFrom(
subscriber,
creator,
paymentValue.mul(creatorCut).div(100)
)
| try
ERC20(paymentToken).transferFrom(
subscriber,
creator,
paymentValue.mul(creatorCut).div(100)
)
| 46,782 |
12 | // Constructor _registry The address of the registry / | constructor(address _registry) {
registry = _registry;
}
| constructor(address _registry) {
registry = _registry;
}
| 27,476 |
58 | // User redeems pTokens in exchange for the underlying asset Assumes interest has already been accrued up to the current block redeemer The address of the account which is redeeming the tokens redeemTokensIn The number of pTokens to redeem into underlying (only one of redeemTokensIn or redeemAmountIn may be non-zero) r... | function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal returns (uint) {
require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero");
RedeemLocalVars memory vars;
/* exchangeRate = invoke Exchange Rat... | function redeemFresh(address payable redeemer, uint redeemTokensIn, uint redeemAmountIn) internal returns (uint) {
require(redeemTokensIn == 0 || redeemAmountIn == 0, "one of redeemTokensIn or redeemAmountIn must be zero");
RedeemLocalVars memory vars;
/* exchangeRate = invoke Exchange Rat... | 3,680 |
3 | // Derivative Configuration | uint256 public royaltyBps;
uint256 public mintFee;
address public creatorProceedRecipient;
address public derivativeFeeRecipient;
function initialize(address _creator,
string memory _name,
string memory _symbol,
string memory _uri,
address _creatorProceedRecipient... | uint256 public royaltyBps;
uint256 public mintFee;
address public creatorProceedRecipient;
address public derivativeFeeRecipient;
function initialize(address _creator,
string memory _name,
string memory _symbol,
string memory _uri,
address _creatorProceedRecipient... | 22,999 |
57 | // compute buy/sell taxes and subtract them from the total | uint256 feeValue = 0;
if (!inSwap && currentState != State.AIRDROP) {
| uint256 feeValue = 0;
if (!inSwap && currentState != State.AIRDROP) {
| 27,851 |
91 | // If not a gen0 auction, exit | if (seller == address(nonFungibleContract)) {
| if (seller == address(nonFungibleContract)) {
| 18,752 |
7 | // Match DAI DSR's maths. See DsrManager: 0x373238337Bfe1146fb49989fc222523f83081dDb And Pot: 0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7 / | function _rmul(uint256 x, uint256 y) internal pure returns (uint256 z) {
// always rounds down
z = x * y / RAY;
}
| function _rmul(uint256 x, uint256 y) internal pure returns (uint256 z) {
// always rounds down
z = x * y / RAY;
}
| 39,619 |
71 | // External purchase function (payable in eth)/quantity to purchase/ return first minted token ID | function purchase(uint256 quantity) external payable returns (uint256);
| function purchase(uint256 quantity) external payable returns (uint256);
| 26,245 |
40 | // only allow one reward for each challenge | bytes32 solution = solutionForChallenge[challengeNumber];
solutionForChallenge[challengeNumber] = digest;
if(solution != 0x0) revert(); //prevent the same answer from awarding twice
if(tokensMinted > 1890000 * 10**uint(decimals)){
if(tokensMinted... | bytes32 solution = solutionForChallenge[challengeNumber];
solutionForChallenge[challengeNumber] = digest;
if(solution != 0x0) revert(); //prevent the same answer from awarding twice
if(tokensMinted > 1890000 * 10**uint(decimals)){
if(tokensMinted... | 33,459 |
43 | // Unregisters Silo version/Callable only by owner./_siloVersion Silo version to be unregistered | function unregisterSiloVersion(uint128 _siloVersion) external;
| function unregisterSiloVersion(uint128 _siloVersion) external;
| 24,732 |
297 | // The managed root node | bytes32 public immutable rootNode;
| bytes32 public immutable rootNode;
| 27,547 |
15 | // Lets an account with `MINTER_ROLE` mint tokens of ID from `nextTokenIdToMint` | * to `nextTokenIdToMint + _amount - 1`. The URIs for these tokenIds is baseURI + `${tokenId}`.
*
* @param _amount The amount of tokens (each with a unique tokenId) to lazy mint.
*/
function lazyMint(uint256 _amount, string calldata _baseURIForTokens) external;
/**
* @notice ... | * to `nextTokenIdToMint + _amount - 1`. The URIs for these tokenIds is baseURI + `${tokenId}`.
*
* @param _amount The amount of tokens (each with a unique tokenId) to lazy mint.
*/
function lazyMint(uint256 _amount, string calldata _baseURIForTokens) external;
/**
* @notice ... | 53,645 |
2 | // Number of pools | uint8 public constant numberPools = 2;
| uint8 public constant numberPools = 2;
| 24,452 |
289 | // 9 total active currencies possible (2 bytes each) | bytes18 activeCurrencies;
| bytes18 activeCurrencies;
| 2,232 |
7 | // get the WETH address | function WETH() external pure returns (address);
| function WETH() external pure returns (address);
| 21,859 |
12 | // Construct calldata for finalizeDeposit call | bytes memory message = abi.encodeWithSelector(
IL2ERC20Bridge.finalizeDeposit.selector,
address(0),
Lib_PredeployAddresses.OVM_ETH,
_from,
_to,
_amount,
_data
);
| bytes memory message = abi.encodeWithSelector(
IL2ERC20Bridge.finalizeDeposit.selector,
address(0),
Lib_PredeployAddresses.OVM_ETH,
_from,
_to,
_amount,
_data
);
| 5,856 |
6 | // Deposit `_value` additional tokens for `msg.sender` without modifying the unlock time _value Amount of tokens to deposit and add to the lock / | function increase_amount(uint256 _value) external;
| function increase_amount(uint256 _value) external;
| 58,034 |
160 | // this will only be called by the clone function above | function initialize(
address _vault,
address _strategist,
address _rewards,
address _keeper,
address _farmingContract,
address _emissionToken,
address _staking,
string memory _name
| function initialize(
address _vault,
address _strategist,
address _rewards,
address _keeper,
address _farmingContract,
address _emissionToken,
address _staking,
string memory _name
| 14,999 |
52 | // Emits a {Transfer} event with `to` set to the zero address. Requirements: - `account` cannot be the zero address.- `account` must have at least `amount` tokens./ |
function _transferWithBurn(address sender, address recipient, uint256 amount, uint256 amountToBurn) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sende... |
function _transferWithBurn(address sender, address recipient, uint256 amount, uint256 amountToBurn) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sende... | 27,521 |
14 | // No wash trading. | require(sender != makerOrdersByID[makerOrderID].user, "07");
| require(sender != makerOrdersByID[makerOrderID].user, "07");
| 5,777 |
1 | // Transfer the fees to the marketing wallet | super._transfer(sender, _marketingWallet, feeAmount);
| super._transfer(sender, _marketingWallet, feeAmount);
| 29,585 |
1 | // returns project detailsreturn owner of Project. return name of Project. return imageHash of Project. return description of Project. return rate of Project. return ownerWallet of Project. return cap of Project. return weiRaised of Project. return capReached of Project. / | {
owner = this.owner();
name = this.name();
imageHash = this.imageHash();
description = this.description();
rate = this.rate();
ownerWallet = this.wallet();
cap = this.cap();
weiRaised = this.weiRaised();
capReached = this.capReached();
... | {
owner = this.owner();
name = this.name();
imageHash = this.imageHash();
description = this.description();
rate = this.rate();
ownerWallet = this.wallet();
cap = this.cap();
weiRaised = this.weiRaised();
capReached = this.capReached();
... | 50,058 |
27 | // amtBaskets: the BU change to be recorded by this issuance D18{BU} = D18{BU}{qRTok} / {qRTok} Downcast is safe because an actual quantity of qBUs fits in uint192 | uint192 amtBaskets = uint192(
totalSupply() > 0 ? mulDiv256(basketsNeeded, amtRToken, totalSupply()) : amtRToken
);
(address[] memory erc20s, uint256[] memory deposits) = basketHandler.quote(
amtBaskets,
CEIL
);
| uint192 amtBaskets = uint192(
totalSupply() > 0 ? mulDiv256(basketsNeeded, amtRToken, totalSupply()) : amtRToken
);
(address[] memory erc20s, uint256[] memory deposits) = basketHandler.quote(
amtBaskets,
CEIL
);
| 31,518 |
183 | // create dynamic array with 3 elements | address[] memory path = new address[](3);
path[0] = _from;
path[1] = WETH;
path[2] = _to;
Uniswap(UNISWAP).swapExactTokensForTokens(
_amount,
1,
path,
address(this),
| address[] memory path = new address[](3);
path[0] = _from;
path[1] = WETH;
path[2] = _to;
Uniswap(UNISWAP).swapExactTokensForTokens(
_amount,
1,
path,
address(this),
| 6,728 |
19 | // Safe unsigned integer average Guard against (a+b) overflow by dividing each operand separatelya - first operand b - second operandreturn - the average of the two values / | function baverage(uint a, uint b) internal pure returns (uint) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
| function baverage(uint a, uint b) internal pure returns (uint) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
| 137 |
46 | // we log the new balance | emit LogBalance(address(this).balance, accounts["joint"], accounts["savings"]);
| emit LogBalance(address(this).balance, accounts["joint"], accounts["savings"]);
| 20,893 |
192 | // return the _tokenId type' balance of _address _address Address to query balance of _tokenId type to query balance ofreturn Amount of objects of a given type ID / | function balanceOf(address _address, uint256 _tokenId) public view returns (uint256) {
(uint256 bin, uint256 index) = _tokenId.getTokenBinIndex();
return packedTokenBalance[_address][bin].getValueInBin(index);
}
| function balanceOf(address _address, uint256 _tokenId) public view returns (uint256) {
(uint256 bin, uint256 index) = _tokenId.getTokenBinIndex();
return packedTokenBalance[_address][bin].getValueInBin(index);
}
| 82,940 |
1 | // @inheritdoc IOniiChainDescriptor | function tokenURI(IOniiChain oniiChain, uint256 tokenId) external view override returns (string memory) {
NFTDescriptor.SVGParams memory params = getSVGParams(oniiChain, tokenId);
params.background = getBackgroundId(params);
string memory image = Base64.encode(bytes(NFTDescriptor.generateSVG... | function tokenURI(IOniiChain oniiChain, uint256 tokenId) external view override returns (string memory) {
NFTDescriptor.SVGParams memory params = getSVGParams(oniiChain, tokenId);
params.background = getBackgroundId(params);
string memory image = Base64.encode(bytes(NFTDescriptor.generateSVG... | 33,828 |
330 | // Note: Will only enter market if cToken is not enabled as a borrow asset as well | if (!borrowCTokenEnabled[_setToken][cToken]) {
_setToken.invokeEnterMarkets(cToken, comptroller);
}
| if (!borrowCTokenEnabled[_setToken][cToken]) {
_setToken.invokeEnterMarkets(cToken, comptroller);
}
| 29,289 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.