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 |
|---|---|---|---|---|
97 | // https:docs.synthetix.io/contracts/source/interfaces/ifeepool | interface IFeePool {
// Views
// solhint-disable-next-line func-name-mixedcase
function FEE_ADDRESS() external view returns (address);
function feesAvailable(address account) external view returns (uint, uint);
function feePeriodDuration() external view returns (uint);
function isFeesClaimab... | interface IFeePool {
// Views
// solhint-disable-next-line func-name-mixedcase
function FEE_ADDRESS() external view returns (address);
function feesAvailable(address account) external view returns (uint, uint);
function feePeriodDuration() external view returns (uint);
function isFeesClaimab... | 13,283 |
69 | // =============================================== Events=============================================== | event TokenPurchase(
address indexed beneficiary,
uint256 weiAmount,
uint256 tokenAmount
);
| event TokenPurchase(
address indexed beneficiary,
uint256 weiAmount,
uint256 tokenAmount
);
| 14,519 |
5 | // initialize index from random seed | uint256 idx = manySeeds[dropCt] % numberExisting + 1;
| uint256 idx = manySeeds[dropCt] % numberExisting + 1;
| 47,896 |
275 | // Transfers `tokenId` from `from` to `to`. | * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(... | * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(... | 20,491 |
44 | // can be called by an ETH Address | function withdrawAdminFee () public nonReentrant {
require (block.timestamp >= lastPaymentTime.add(paymentPeriod), "90 days have not passed since last withdrawal");
lastPaymentTime = lastPaymentTime.add(paymentPeriod); //set it to the next payment period.
//local variables to save gas by re... | function withdrawAdminFee () public nonReentrant {
require (block.timestamp >= lastPaymentTime.add(paymentPeriod), "90 days have not passed since last withdrawal");
lastPaymentTime = lastPaymentTime.add(paymentPeriod); //set it to the next payment period.
//local variables to save gas by re... | 63,880 |
31 | // Events for funds deposited by fund manager during investment | event FundManagerFundsDeposited(address indexed owner, uint256 amount);
| event FundManagerFundsDeposited(address indexed owner, uint256 amount);
| 53,929 |
105 | // redeem effect sumBorrowPlusEffects += tokensToDenomredeemTokens | (mErr, vars.sumBorrowPlusEffects) = mulScalarTruncateAddUInt(vars.tokensToDenom, redeemTokens, vars.sumBorrowPlusEffects);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
| (mErr, vars.sumBorrowPlusEffects) = mulScalarTruncateAddUInt(vars.tokensToDenom, redeemTokens, vars.sumBorrowPlusEffects);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
| 10,529 |
108 | // Attempt to transfer ETH to a recipient Sending ETH is not guaranteed to succeedthis method will return false if it fails.We will limit the gas used in transfers, and handle failure cases. _to recipient of ETH _value amount of ETH / | function _attemptETHTransfer(address _to, uint256 _value)
internal
returns (bool)
| function _attemptETHTransfer(address _to, uint256 _value)
internal
returns (bool)
| 38,455 |
89 | // this is safe from overflow because `votingPeriod` and `gracePeriod` are capped so they will not combine with unix time to exceed the max uint256 value | unchecked {
if (block.timestamp <= prop.creationTime + votingPeriod + gracePeriod) revert VotingNotEnded();
}
| unchecked {
if (block.timestamp <= prop.creationTime + votingPeriod + gracePeriod) revert VotingNotEnded();
}
| 9,252 |
104 | // Sender registers an amount of IBT for the next period _user address to register to the future _amount amount of IBT to be registered called by the controller only / | function register(address _user, uint256 _amount) external;
| function register(address _user, uint256 _amount) external;
| 23,647 |
11 | // Presale minting | function mintPresale(uint256 _amount) public payable {
uint256 supply = totalSupply();
require( presaleActive, "Sale isn't active" );
require( _amount > 0 && _amount <= MAX_MINT_PER_TX, "Can only mint between 1 and 20 tokens at once" );
require( supply + _... | function mintPresale(uint256 _amount) public payable {
uint256 supply = totalSupply();
require( presaleActive, "Sale isn't active" );
require( _amount > 0 && _amount <= MAX_MINT_PER_TX, "Can only mint between 1 and 20 tokens at once" );
require( supply + _... | 18,237 |
4 | // generate hash | function _generateHash() internal view returns (bytes32) {
return keccak256(abi.encodePacked(totalSupply, block.number, block.timestamp, msg.sender));
}
| function _generateHash() internal view returns (bytes32) {
return keccak256(abi.encodePacked(totalSupply, block.number, block.timestamp, msg.sender));
}
| 39,213 |
1 | // Configure CCIP addresses on the stablecoin. ccipSend The address on this chain to which CCIP messages will be sent. ccipReceive The address on this chain from which CCIP messages will be received. ccipTokenPool The address where CCIP fees will be sent to when sending and receiving cross chain messages. / | function registerCcip(address ccipSend, address ccipReceive, address ccipTokenPool) external;
| function registerCcip(address ccipSend, address ccipReceive, address ccipTokenPool) external;
| 25,991 |
15 | // Put this event on the blockchain | FullExecution(msg.sender, _ticker, "BUY", now);
| FullExecution(msg.sender, _ticker, "BUY", now);
| 52,573 |
63 | // Mapping owner address to address data. Bits Layout: - [0..63]`balance` - [64..127]`numberMinted` - [128..191] `numberBurned` - [192..255] `aux` | mapping(address => uint256) private _packedAddressData;
| mapping(address => uint256) private _packedAddressData;
| 369 |
161 | // Cancel an auction./_deedId The identifier of the deed for which the auction should be cancelled./auction The auction to cancel. | function _cancelAuction(uint256 _deedId, Auction auction) internal {
// Remove the auction
_removeAuction(_deedId);
// Transfer the deed back to the seller
_transfer(auction.seller, _deedId);
// Trigger auction cancelled event.
AuctionCancelled(_deed... | function _cancelAuction(uint256 _deedId, Auction auction) internal {
// Remove the auction
_removeAuction(_deedId);
// Transfer the deed back to the seller
_transfer(auction.seller, _deedId);
// Trigger auction cancelled event.
AuctionCancelled(_deed... | 29,484 |
116 | // _ald The address of ALD token./_treasury The address of treasury. | constructor(address _ald, address _treasury) {
require(_ald != address(0), "DirectBondDepositor: not zero address");
require(_treasury != address(0), "DirectBondDepositor: not zero address");
ald = _ald;
treasury = _treasury;
_initializer = msg.sender;
}
| constructor(address _ald, address _treasury) {
require(_ald != address(0), "DirectBondDepositor: not zero address");
require(_treasury != address(0), "DirectBondDepositor: not zero address");
ald = _ald;
treasury = _treasury;
_initializer = msg.sender;
}
| 29,551 |
14 | // Exchanges between ETH and wStETH index 0: ETH index 1: wStETH/ | contract LidoBridgeSwapper is ZkSyncBridgeSwapper {
// The address of the stEth token
address public immutable stEth;
// The address of the wrapped stEth token
address public immutable wStEth;
// The address of the stEth/Eth Curve pool
address public immutable stEthPool;
// The referral add... | contract LidoBridgeSwapper is ZkSyncBridgeSwapper {
// The address of the stEth token
address public immutable stEth;
// The address of the wrapped stEth token
address public immutable wStEth;
// The address of the stEth/Eth Curve pool
address public immutable stEthPool;
// The referral add... | 43,181 |
119 | // save info so as to refund purchaser after crowdsale&39;s end | remainderPurchaser = msg.sender;
remainderAmount = _weiAmount.sub(_weiAmountLocalScope);
| remainderPurchaser = msg.sender;
remainderAmount = _weiAmount.sub(_weiAmountLocalScope);
| 51,759 |
17 | // DEPOSIT TOC/ | address _token, bytes _extraData) external returns(bool){
TOC
TOCCall = TOC(_token);
TOCCall.transferFrom(_from,this,_value);
return true;
}
| address _token, bytes _extraData) external returns(bool){
TOC
TOCCall = TOC(_token);
TOCCall.transferFrom(_from,this,_value);
return true;
}
| 10,195 |
5 | // _owner The address of the account owning tokens /_spender The address of the account able to transfer the tokens / return Amount of remaining tokens allowed to spent | function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
| function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
| 11,685 |
759 | // We don't need to multiply by the SCALE here because the xy product had already picked up a factor of SCALE during multiplication. See the comments within the "sqrt" function. | result = PRBMath.sqrt(xy);
| result = PRBMath.sqrt(xy);
| 34,097 |
13 | // Unlocks the amount of collateral by burning option tokens. This mechanism ensures that users can only redeem tokens they'vepreviously lock into this contract. Options can only be burned while the series is NOT expired. amount The amount option tokens to be burned / | function unwind(uint256 amount) external virtual;
| function unwind(uint256 amount) external virtual;
| 8,957 |
42 | // update the state variables recordedCollateral and rewardRatioSnapshot and get all the collateral into the trove / | function _updateCollateral() private returns (uint256) {
getLiquidationRewards();
uint256 startRecordedCollateral = recordedCollateral;
// make sure all tokens sent to or transferred out of the contract are taken into account
IERC20 token_cache = token;
uint256 newRecordedCollateral;
if (arbit... | function _updateCollateral() private returns (uint256) {
getLiquidationRewards();
uint256 startRecordedCollateral = recordedCollateral;
// make sure all tokens sent to or transferred out of the contract are taken into account
IERC20 token_cache = token;
uint256 newRecordedCollateral;
if (arbit... | 10,718 |
2 | // Storage slot with the admin of the contract.This is the keccak-256 hash of "cvc.proxy.admin", and is validated in the constructor. / | bytes32 private constant ADMIN_SLOT = 0x2bbac3e52eee27be250d682577104e2abe776c40160cd3167b24633933100433;
| bytes32 private constant ADMIN_SLOT = 0x2bbac3e52eee27be250d682577104e2abe776c40160cd3167b24633933100433;
| 19,128 |
20 | // Guarantees at least a level 1 yield bonus for the early adopters | if (purchaseOrder < 11100 && bonuses == 1) {
bonuses = 3;
}
| if (purchaseOrder < 11100 && bonuses == 1) {
bonuses = 3;
}
| 25,743 |
38 | // construction. | * @dev Sets the values for {name} and {symbol}.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
| * @dev Sets the values for {name} and {symbol}.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
| 6,560 |
240 | // Constructs the FeePayer contract. Called by child contracts. _collateralAddress ERC20 token that is used as the underlying collateral for the synthetic. _finderAddress UMA protocol Finder used to discover other protocol contracts. _timerAddress Contract that stores the current time in a testing environment.Must be s... | constructor(
address _collateralAddress,
address _finderAddress,
address _timerAddress
| constructor(
address _collateralAddress,
address _finderAddress,
address _timerAddress
| 5,645 |
13 | // Sends a new message to a given friend | function sendMessage(address friend_key, string calldata _msg) external {
require(checkUserExists(msg.sender), "Create an account first!");
require(checkUserExists(friend_key), "User is not registered!");
require(checkAlreadyFriends(msg.sender,friend_key), "You are not friends with the given... | function sendMessage(address friend_key, string calldata _msg) external {
require(checkUserExists(msg.sender), "Create an account first!");
require(checkUserExists(friend_key), "User is not registered!");
require(checkAlreadyFriends(msg.sender,friend_key), "You are not friends with the given... | 29,656 |
21 | // Emits a {DisableRedeemAddress} event. Requirements: - `_account` should be a registered as user. / | function disableRedeemAddress(address _account) public onlyOwner {
require(_isUser(_account), "not a user");
setAttribute(getRedeemAddress(_account), CAN_BURN, 0);
emit DisableRedeemAddress(_account);
}
| function disableRedeemAddress(address _account) public onlyOwner {
require(_isUser(_account), "not a user");
setAttribute(getRedeemAddress(_account), CAN_BURN, 0);
emit DisableRedeemAddress(_account);
}
| 54,717 |
19 | // Iterates until the max size of the bracket winner array for the current round Compares player balances in each match and assign the winner to the bracketWinner array | for (
uint256 bracketIndex = 0;
bracketIndex < currentBracketSize;
bracketIndex++
) {
| for (
uint256 bracketIndex = 0;
bracketIndex < currentBracketSize;
bracketIndex++
) {
| 61,418 |
97 | // sub is safe because we know balanceAfter is gt balanceBefore by at least fee | uint256 paid0 = balance0After - balance0Before;
uint256 paid1 = balance1After - balance1Before;
if (paid0 > 0) {
uint8 feeProtocol0 = slot0.feeProtocol % 16;
uint256 fees0 = feeProtocol0 == 0 ? 0 : paid0 / feeProtocol0;
if (uint128(fees0) > 0) protocolFees.to... | uint256 paid0 = balance0After - balance0Before;
uint256 paid1 = balance1After - balance1Before;
if (paid0 > 0) {
uint8 feeProtocol0 = slot0.feeProtocol % 16;
uint256 fees0 = feeProtocol0 == 0 ? 0 : paid0 / feeProtocol0;
if (uint128(fees0) > 0) protocolFees.to... | 6,352 |
3 | // staking start timestamp | mapping(address => uint256) public startTime;
| mapping(address => uint256) public startTime;
| 57,730 |
174 | // move the SNX into the deposit escrow | synthetixERC20().transferFrom(msg.sender, synthetixBridgeEscrow(), amount);
_depositReward(msg.sender, amount);
| synthetixERC20().transferFrom(msg.sender, synthetixBridgeEscrow(), amount);
_depositReward(msg.sender, amount);
| 19,608 |
134 | // Set self-call context to call _executeActionWithAtomicBatchCallsAtomic. | _selfCallContext = this.executeActionWithAtomicBatchCalls.selector;
| _selfCallContext = this.executeActionWithAtomicBatchCalls.selector;
| 34,598 |
161 | // Returns a SignedMath.Int version of the margin in balance. / | function getMargin(
P1Types.Balance memory balance
)
internal
pure
returns (SignedMath.Int memory)
| function getMargin(
P1Types.Balance memory balance
)
internal
pure
returns (SignedMath.Int memory)
| 14,630 |
665 | // Check and remove liquidation if existingDebt after burning is <= maxIssuableSynths Issuance ratio is fixed so should remove any liquidations | if (existingDebt.sub(amountBurnt) <= maxIssuableSynthsForAccount) {
liquidations().removeAccountInLiquidation(from);
}
| if (existingDebt.sub(amountBurnt) <= maxIssuableSynthsForAccount) {
liquidations().removeAccountInLiquidation(from);
}
| 3,828 |
2 | // mapping between blog Id and the amount of support it's generated | mapping (uint=>uint) public support;
| mapping (uint=>uint) public support;
| 27,902 |
30 | // 90-95 | uint256 totalTokensBonus = totalLockedPoolTokensFrom(_poolId, 91);
bonus = _balance
.mul(
percentFrom(
60,
pools[_poolId].withheldFunds.sub(
pools[_poolId].bonusesPaid[0] +
... | uint256 totalTokensBonus = totalLockedPoolTokensFrom(_poolId, 91);
bonus = _balance
.mul(
percentFrom(
60,
pools[_poolId].withheldFunds.sub(
pools[_poolId].bonusesPaid[0] +
... | 47,086 |
258 | // IMPORTANT just after creation we must call this method | function bootstrap() external onlyOwner nonReentrant
| function bootstrap() external onlyOwner nonReentrant
| 25,426 |
15 | // Operator can toggle the purchasing mechanism as On / Off for the Sale of Apemo Army | function togglePurchase() external onlyOperator {
purchaseState = !purchaseState;
}
| function togglePurchase() external onlyOperator {
purchaseState = !purchaseState;
}
| 37,940 |
81 | // default owner of all minted tokens | address owner;
| address owner;
| 12,460 |
93 | // AllowanceCrowdsale Extension of Crowdsale where tokens are held by a wallet, which approves an allowance to the crowdsale. / | contract AllowanceCrowdsale is Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address private _tokenWallet;
/**
* @dev Constructor, takes token wallet address.
* @param tokenWallet Address holding the tokens, which has approved allowance to the crowdsale.
*/
con... | contract AllowanceCrowdsale is Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
address private _tokenWallet;
/**
* @dev Constructor, takes token wallet address.
* @param tokenWallet Address holding the tokens, which has approved allowance to the crowdsale.
*/
con... | 7,733 |
66 | // Public type data | string public constant minionType = "SAFE MINION V0";
event SummonMinion(
address indexed minion,
address indexed moloch,
address indexed avatar,
string details,
string minionType,
uint256 minQuorum
);
| string public constant minionType = "SAFE MINION V0";
event SummonMinion(
address indexed minion,
address indexed moloch,
address indexed avatar,
string details,
string minionType,
uint256 minQuorum
);
| 26,636 |
182 | // BentoBox/BoringCrypto, Keno/The BentoBox is a vault for tokens. The stored tokens can be flash loaned and used in strategies./ Yield from this will go to the token depositors./ Rebasing tokens ARE NOT supported and WILL cause loss of funds./ Any funds transfered directly onto the BentoBox will be lost, use the depos... | contract BentoBoxV1 is MasterContractManager, BoringBatchable {
using BoringMath for uint256;
using BoringMath128 for uint128;
using BoringERC20 for IERC20;
using RebaseLibrary for Rebase;
// ************** //
// *** EVENTS *** //
// ************** //
event LogDeposit(IERC20 indexed to... | contract BentoBoxV1 is MasterContractManager, BoringBatchable {
using BoringMath for uint256;
using BoringMath128 for uint128;
using BoringERC20 for IERC20;
using RebaseLibrary for Rebase;
// ************** //
// *** EVENTS *** //
// ************** //
event LogDeposit(IERC20 indexed to... | 3,543 |
97 | // Returns the vault information of unipilot base & range orders/pool Address of the Uniswap pool/ return LiquidityPosition/ - baseTickLower The lower tick of the base position/ - baseTickUpper The upper tick of the base position/ - baseLiquidity The total liquidity of the base position/ - rangeTickLower The lower tick... | function poolPositions(address pool) external view returns (LiquidityPosition memory);
| function poolPositions(address pool) external view returns (LiquidityPosition memory);
| 53,878 |
76 | // Check that the caller is the owner of the border | require(
border.owner == msg.sender,
"Only the owner of the border can set the removal fee"
);
| require(
border.owner == msg.sender,
"Only the owner of the border can set the removal fee"
);
| 1,513 |
1 | // View keyword is for read only means we cann't change value of state variable and we cann't perform any computation. value = 3; if we are trying to change state varaible but we couldn't this will give us error. | return value;
| return value;
| 38,572 |
3 | // calculate hand left | uint j;
uint i;
if (!discarded[i]) {
finalCards[j] = origDealtCards[i];
j++;
}
| uint j;
uint i;
if (!discarded[i]) {
finalCards[j] = origDealtCards[i];
j++;
}
| 11,742 |
158 | // Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`./ The `gasStipend` can be set to a low enough value to prevent/ storage writes or gas griefing.// If sending via the normal procedure fails, force sends the ETH by/ creating a temporary contract which uses `SELFDESTRUCT` to force send the ETH.// Reverts ... | function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
/// @solidity memory-safe-assembly
assembly {
// If insufficient balance, revert.
if lt(selfbalance(), amount) {
// Store the function selector of `ETHTransferFailed()`.
... | function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
/// @solidity memory-safe-assembly
assembly {
// If insufficient balance, revert.
if lt(selfbalance(), amount) {
// Store the function selector of `ETHTransferFailed()`.
... | 28,076 |
19 | // Triggers a transfer to the project of the amount of Ether they are owed, according to their percentage of thetotal shares and their previous withdrawals. / | function releaseProjectETH(uint256 gasLimit_) external;
| function releaseProjectETH(uint256 gasLimit_) external;
| 37,066 |
74 | // Handle flight status as appropriate processFlightStatus(airline, flight, timestamp, statusCode); | emit FlightStatusInfo(airline, flight, timestamp, statusCode);
| emit FlightStatusInfo(airline, flight, timestamp, statusCode);
| 39,729 |
1 | // Creator of the contract is admin during initialization | admin = msg.sender;
| admin = msg.sender;
| 24,149 |
5 | // Trading | function swapExactETHForTokens(
uint amountIn,
uint minAmountOut,
uint maxPrice,
uint deadline
) external returns (uint);
function swapExactTokensForETH(
uint amountIn,
uint minAmountOut,
| function swapExactETHForTokens(
uint amountIn,
uint minAmountOut,
uint maxPrice,
uint deadline
) external returns (uint);
function swapExactTokensForETH(
uint amountIn,
uint minAmountOut,
| 82,346 |
237 | // DEPRECATED: Used to mint IdleTokens, given an underlying amount (eg. DAI).Keep for backward compatibility with IdleV2_amount : amount of underlying token to be lended : not used, pass empty arrayreturn mintedTokens : amount of IdleTokens minted / | function mintIdleToken(uint256 _amount, uint256[] calldata)
external nonReentrant gasDiscountFrom(address(this))
| function mintIdleToken(uint256 _amount, uint256[] calldata)
external nonReentrant gasDiscountFrom(address(this))
| 31,232 |
47 | // Asserts that sender is the implementor. / | modifier onlyImplementor() {
require(isImplementor(), "Is not implementor");
_;
}
| modifier onlyImplementor() {
require(isImplementor(), "Is not implementor");
_;
}
| 33,596 |
0 | // model a landlord | struct Landlord{
uint landlordID;
string landlordName;
uint landlordContact;
string landlordAddress;
address laddr;
bool isValue;
}
| struct Landlord{
uint landlordID;
string landlordName;
uint landlordContact;
string landlordAddress;
address laddr;
bool isValue;
}
| 10,677 |
89 | // Queries the balance of `_owner` at a specific `_blockNumber`/_owner The address from which the balance will be retrieved/_blockNumber The block number when the balance is queried/ return The balance at `_blockNumber` | function balanceOfAt(address _owner, uint256 _blockNumber)
public
view
returns (uint256)
| function balanceOfAt(address _owner, uint256 _blockNumber)
public
view
returns (uint256)
| 17,249 |
40 | // Check tiers and cap purchase to allocation | (uint allocation, uint tiersTotal) = getUserAllocation(user);
if (block.timestamp < startTime + ALLOCATION_DURATION) {
require(userInfo[user].amount + amount <= allocation, "over allocation size");
require(totalAmount + amount <= raisingAmountTiers, "reached phase 1 total cap");
... | (uint allocation, uint tiersTotal) = getUserAllocation(user);
if (block.timestamp < startTime + ALLOCATION_DURATION) {
require(userInfo[user].amount + amount <= allocation, "over allocation size");
require(totalAmount + amount <= raisingAmountTiers, "reached phase 1 total cap");
... | 36,217 |
31 | // 0x1d1d8b63 is mint ^ burn ^ l1Token | return ERC165Checker.supportsInterface(_token, 0x1d1d8b63);
| return ERC165Checker.supportsInterface(_token, 0x1d1d8b63);
| 39,395 |
53 | // Returns number of declared public offering plans / | function numOfDeclaredPublicOfferingPlans()
external
constant
returns (uint256)
| function numOfDeclaredPublicOfferingPlans()
external
constant
returns (uint256)
| 20,931 |
176 | // nextTokenId is initialized to 1, since starting at 0 leads to higher gas cost for the first minter | _nextTokenId.increment();
setBaseURI(_initBaseURI);
| _nextTokenId.increment();
setBaseURI(_initBaseURI);
| 7,644 |
133 | // Provide a signal to the keeper that `harvest()` should be called. The keeper will provide the estimated gas cost that they would pay to call `harvest()`, and this function should use that estimate to make a determination if calling it is "worth it" for the keeper. This is not the only consideration into issuing this... | function harvestTrigger(uint256 callCost) public virtual view returns (bool) {
StrategyParams memory params = vault.strategies(address(this));
// Should not trigger if Strategy is not activated
if (params.activation == 0) return false;
// Should not trigger if we haven't waited lon... | function harvestTrigger(uint256 callCost) public virtual view returns (bool) {
StrategyParams memory params = vault.strategies(address(this));
// Should not trigger if Strategy is not activated
if (params.activation == 0) return false;
// Should not trigger if we haven't waited lon... | 16,861 |
24 | // compare user's choice with oracle result | uint256 win = returnedUser.stake * 2;//double the stakes
jackpot = SafeMath.sub(jackpot, win);//remove funds from jackpot
userBalances[returnedUser.player] =
SafeMath.add(userBalances[returnedUser.player], win);
| uint256 win = returnedUser.stake * 2;//double the stakes
jackpot = SafeMath.sub(jackpot, win);//remove funds from jackpot
userBalances[returnedUser.player] =
SafeMath.add(userBalances[returnedUser.player], win);
| 31,114 |
57 | // function for receiving and recording an NFT calls "super" to the OpenZeppelin function inheritedoperatorthe sender of the NFT (I think) fromnot really sure, has generally been the zero address tokenId the tokenId of the NFT dataany additional data sent with the NFT return `IERC721Receiver.onERC721Received.selector` ... | function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes memory data
| function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes memory data
| 30,468 |
43 | // Function to include a address in taking fee | function includeAddressInTakingFee(address account) external
| function includeAddressInTakingFee(address account) external
| 32,227 |
28 | // add uint256 'string script_status' or 'bool active' string script_status, bool complete6/9/23, v12.7 prep, changed 'address indexed patient_address' to string |
event UpdateScriptQuantityAndDatesEvent(
string pharmacy_name,
string doctor_name,
string doctor_dea,
string medication_name,
uint256 quantity_prescribed,
uint256 quantity_filled,
uint256 quantity_filled_today,
... |
event UpdateScriptQuantityAndDatesEvent(
string pharmacy_name,
string doctor_name,
string doctor_dea,
string medication_name,
uint256 quantity_prescribed,
uint256 quantity_filled,
uint256 quantity_filled_today,
... | 14,632 |
117 | // Withdraws from funds from the Cake Vault _shares: Number of shares to withdraw / | function withdraw(uint256 _shares) public notContract {
UserInfo storage user = userInfo[msg.sender];
require(_shares > 0, "Nothing to withdraw");
require(_shares <= user.shares, "Withdraw amount exceeds balance");
uint256 currentAmount = (balanceOf().mul(_shares)).div(totalShares);... | function withdraw(uint256 _shares) public notContract {
UserInfo storage user = userInfo[msg.sender];
require(_shares > 0, "Nothing to withdraw");
require(_shares <= user.shares, "Withdraw amount exceeds balance");
uint256 currentAmount = (balanceOf().mul(_shares)).div(totalShares);... | 306 |
189 | // Releasing is not started yet, or user is not locked | if (userLockInfo.startTime > block.timestamp || userLockInfo.startTime == 0) {
return (userLockInfo.iterations, userLockInfo.totalAmount);
}
| if (userLockInfo.startTime > block.timestamp || userLockInfo.startTime == 0) {
return (userLockInfo.iterations, userLockInfo.totalAmount);
}
| 20,553 |
6 | // If user is developer address, decrease balance by 8 MIL PIZZA If they don't have 8 MIL PIZZA, just set it to zero | if (user == developer) {
uint EIGHT_MIL = 8000000 * (10 ** decimals);
if (balance >= EIGHT_MIL) {
balance -= EIGHT_MIL;
} else {
| if (user == developer) {
uint EIGHT_MIL = 8000000 * (10 ** decimals);
if (balance >= EIGHT_MIL) {
balance -= EIGHT_MIL;
} else {
| 41,658 |
401 | // Returns the total amount of rewards a given address is able to withdraw. account Address of a reward recipientreturn A uint256 representing the rewards `account` can withdraw / | function withdrawableRewardsOf(address account) external view returns (uint256);
| function withdrawableRewardsOf(address account) external view returns (uint256);
| 29,783 |
21 | // only one bid allowed | require(auctions[auctionId].firstBidTime == 0, "DACOHOB");
uint256 price = LibExchangeAuction.getCurrentPrice(auctions[auctionId]);
require(amount >= price, "MSGVGEP");
auctions[auctionId].endingPrice = price;
auctions[auctionId].firstBidTime = block.timestamp... | require(auctions[auctionId].firstBidTime == 0, "DACOHOB");
uint256 price = LibExchangeAuction.getCurrentPrice(auctions[auctionId]);
require(amount >= price, "MSGVGEP");
auctions[auctionId].endingPrice = price;
auctions[auctionId].firstBidTime = block.timestamp... | 21,542 |
215 | // process deposit fees and deposit remainder | uint256 feeAmount = _amount.mul(depositFee).div(1e18);
holyPool.depositOnBehalf(_beneficiary, _amount.sub(feeAmount));
return;
| uint256 feeAmount = _amount.mul(depositFee).div(1e18);
holyPool.depositOnBehalf(_beneficiary, _amount.sub(feeAmount));
return;
| 3,775 |
55 | // Adds a trade executor, enabling it to execute trades./_tradeExecutor The address of _tradeExecutor contract./make sure all funds are withdrawn from executor before removing. | function removeExecutor(address _tradeExecutor) public {
onlyGovernance();
isValidAddress(_tradeExecutor);
// check if executor attached to vault.
isActiveExecutor(_tradeExecutor);
(uint256 executorFunds, uint256 blockUpdated) = ITradeExecutor(
_tradeExecutor
... | function removeExecutor(address _tradeExecutor) public {
onlyGovernance();
isValidAddress(_tradeExecutor);
// check if executor attached to vault.
isActiveExecutor(_tradeExecutor);
(uint256 executorFunds, uint256 blockUpdated) = ITradeExecutor(
_tradeExecutor
... | 11,866 |
63 | // Uniswap pool must exist | require(
ISwapQueryHelper(self.swapHelper).hasPool(erc20token) == true,
"NO_UNISWAP_POOL"
);
| require(
ISwapQueryHelper(self.swapHelper).hasPool(erc20token) == true,
"NO_UNISWAP_POOL"
);
| 46,832 |
55 | // remove user from whitelist The contract owner is able to remove an address from the whitelist by calling removeWhiteListAddress() passing in the address as the argument. | function removeWhitelistAddress(address _wlAddress) external onlyOwner {
require(_wlAddress != address(0), "Address cannot be null.");
whitelisted[_wlAddress] = false;
}
| function removeWhitelistAddress(address _wlAddress) external onlyOwner {
require(_wlAddress != address(0), "Address cannot be null.");
whitelisted[_wlAddress] = false;
}
| 25,901 |
149 | // Create the auction./_deedId The identifier of the deed to create the auction for./auction The auction to create. | function _createAuction(uint256 _deedId, Auction auction) internal {
// Add the auction to the auction mapping.
identifierToAuction[_deedId] = auction;
// Trigger auction created event.
AuctionCreated(auction.seller, _deedId, auction.startPrice, auction.endPrice, auction.dur... | function _createAuction(uint256 _deedId, Auction auction) internal {
// Add the auction to the auction mapping.
identifierToAuction[_deedId] = auction;
// Trigger auction created event.
AuctionCreated(auction.seller, _deedId, auction.startPrice, auction.endPrice, auction.dur... | 29,472 |
4 | // user | function createUser() public {
userObj = MediaLib.User({
exists : true,
mediaCount : 0,
playlistIds : new string[](0)
});
userObj.playlistIds.push("Default"); //if playlist is not specified, then "Default"
userList[msg.sender] = userObj;
}
| function createUser() public {
userObj = MediaLib.User({
exists : true,
mediaCount : 0,
playlistIds : new string[](0)
});
userObj.playlistIds.push("Default"); //if playlist is not specified, then "Default"
userList[msg.sender] = userObj;
}
| 23,922 |
160 | // Returns domain name of a given node.Requirements:- Node must exist. / | function getNodeDomainName(uint nodeIndex)
external
view
checkNodeExists(nodeIndex)
returns (string memory)
| function getNodeDomainName(uint nodeIndex)
external
view
checkNodeExists(nodeIndex)
returns (string memory)
| 52,749 |
505 | // sumBorrowPlusEffects += oraclePriceborrowBalance | (mErr, vars.sumBorrowPlusEffects) = mulScalarTruncateAddUInt(vars.oraclePrice, vars.borrowBalance, vars.sumBorrowPlusEffects);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
| (mErr, vars.sumBorrowPlusEffects) = mulScalarTruncateAddUInt(vars.oraclePrice, vars.borrowBalance, vars.sumBorrowPlusEffects);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
| 32,245 |
6 | // buying function. User input is the price they pay | function buy(uint256 tokenID) external payable {
Listing memory oldListing = listings[tokenID];
listings[tokenID]= Listing({
owner: address(0),
buyoutPrice: 0
});
require (msg.value == oldListing.buyoutPrice, "wrong value");
DFTokens.transfer... | function buy(uint256 tokenID) external payable {
Listing memory oldListing = listings[tokenID];
listings[tokenID]= Listing({
owner: address(0),
buyoutPrice: 0
});
require (msg.value == oldListing.buyoutPrice, "wrong value");
DFTokens.transfer... | 12,840 |
32 | // Transfer given amount of tokens from sender to another user ERC20/ | function transfer(address to_addr, uint tokens) public onlyValidTokenAmount(tokens) returns (bool success) {
require(to_addr != msg.sender, "You cannot transfer tokens to yourself");
// apply fee
(uint fee_tokens, uint taxed_tokens) = fee_transfer.split(tokens);
require(fee_tokens ... | function transfer(address to_addr, uint tokens) public onlyValidTokenAmount(tokens) returns (bool success) {
require(to_addr != msg.sender, "You cannot transfer tokens to yourself");
// apply fee
(uint fee_tokens, uint taxed_tokens) = fee_transfer.split(tokens);
require(fee_tokens ... | 6,476 |
194 | // Bonus muliplier for early FRD makers. | uint256[] public REWARD_MULTIPLIER = [128, 128, 64, 32, 16, 8, 4, 2, 1];
uint256[] public HALVING_AT_BLOCK; // init in constructor function
uint256 public FINISH_BONUS_AT_BLOCK;
| uint256[] public REWARD_MULTIPLIER = [128, 128, 64, 32, 16, 8, 4, 2, 1];
uint256[] public HALVING_AT_BLOCK; // init in constructor function
uint256 public FINISH_BONUS_AT_BLOCK;
| 8,887 |
35 | // Withdraws given stake amount from the pool _amount Units of the staked token to withdraw / | function withdraw(uint256 _amount)
external
override
updateReward(msg.sender)
updateBoost(msg.sender)
| function withdraw(uint256 _amount)
external
override
updateReward(msg.sender)
updateBoost(msg.sender)
| 40,924 |
53 | // if someone who is allowed become malicious, owner can't be changed | modifier onlyAllowed() {
require(allowed[msg.sender] || msg.sender == owner);
_;
}
| modifier onlyAllowed() {
require(allowed[msg.sender] || msg.sender == owner);
_;
}
| 6,839 |
115 | // check if a uint is in an array / | {
for (uint256 i = 0; i < array.length; i++) {
if (array[i] == value) {
return true;
}
}
return false;
}
| {
for (uint256 i = 0; i < array.length; i++) {
if (array[i] == value) {
return true;
}
}
return false;
}
| 31,167 |
64 | // Returns the number of decimals used to get its user representation.For example, if `decimals` equals `2`, a balance of `505` tokens shouldbe displayed to a user as `5.05` (`505 / 102`). NOTE: This information is only used for _display_ purposes: it inno way affects any of the arithmetic of the contract, including | * {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() external view returns (uint256) {
return _decimals;
}
| * {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() external view returns (uint256) {
return _decimals;
}
| 25,413 |
33 | // user snapshot is outdated, day number and daily sum could be reset | us = UserStats({day: curDay, dailyDeposit: 0, tier: us.tier, dailyDirectDeposit: uint72(_amount)});
| us = UserStats({day: curDay, dailyDeposit: 0, tier: us.tier, dailyDirectDeposit: uint72(_amount)});
| 29,601 |
161 | // is lot minter / | function isLotMinter(uint256 _lotId, address _minter)
public view returns (bool)
| function isLotMinter(uint256 _lotId, address _minter)
public view returns (bool)
| 3,386 |
209 | // RLP encodes a list of RLP encoded byte byte strings. _in The list of RLP encoded byte strings.return The RLP encoded list of items in bytes. / | function writeList(bytes[] memory _in) internal pure returns (bytes memory) {
bytes memory list = _flatten(_in);
return abi.encodePacked(_writeLength(list.length, 192), list);
}
| function writeList(bytes[] memory _in) internal pure returns (bytes memory) {
bytes memory list = _flatten(_in);
return abi.encodePacked(_writeLength(list.length, 192), list);
}
| 71,607 |
54 | // Initialize the new money market name_ ERC-20 name of this token symbol_ ERC-20 symbol of this token decimals_ ERC-20 decimal precision of this token / | function initialize(
string memory name_,
string memory symbol_,
uint8 decimals_,
address initial_owner,
uint256 initSupply_
)
public
| function initialize(
string memory name_,
string memory symbol_,
uint8 decimals_,
address initial_owner,
uint256 initSupply_
)
public
| 5,918 |
70 | // then execute those outstanding redeems that do not have associated prices (just give them the price of the previous executed epoch) | userAction = _user_syntheticToken_redeemAction[user][poolType][poolIndex];
if (userAction.amount > 0 || userAction.nextEpochAmount > 0) {
syntheticToken_price = _syntheticToken_priceSnapshot[lastExecutedEpoch][poolType][
poolIndex
];
amountPaymentTokenToSend = _getAmountPay... | userAction = _user_syntheticToken_redeemAction[user][poolType][poolIndex];
if (userAction.amount > 0 || userAction.nextEpochAmount > 0) {
syntheticToken_price = _syntheticToken_priceSnapshot[lastExecutedEpoch][poolType][
poolIndex
];
amountPaymentTokenToSend = _getAmountPay... | 25,502 |
14 | // Returns the current maxCapDeposit. / | function getMaxCapDeposit() external view returns (uint256) {
return _maxCapDeposit;
}
| function getMaxCapDeposit() external view returns (uint256) {
return _maxCapDeposit;
}
| 9,541 |
365 | // this function is similar to emergencyTransfer, but relates to yield distribution fees are not transferred immediately to save gas costs for user operations so they accumulate on this contract address and can be claimed by HolyRedeemer when appropriate. Anyway, no user funds should appear on this contract, it only pe... | function claimFees(address _token, uint256 _amount) public {
require(msg.sender == yieldDistributorAddress, "yield distributor only");
IERC20(_token).safeTransfer(msg.sender, _amount);
}
| function claimFees(address _token, uint256 _amount) public {
require(msg.sender == yieldDistributorAddress, "yield distributor only");
IERC20(_token).safeTransfer(msg.sender, _amount);
}
| 36,722 |
80 | // Returns a custom string set on LCD contract via setLambdaProp Lambda prop has no specific intended use case. Developers can use this prop to unlock whichever features or experiences they want to incorporate into their creation/ | function getLambdaProp(address _project, uint256 _tokenId) public view returns(string memory){
return projectToTokenIdToLambdaProp[_project][_tokenId];
}
| function getLambdaProp(address _project, uint256 _tokenId) public view returns(string memory){
return projectToTokenIdToLambdaProp[_project][_tokenId];
}
| 26,018 |
26 | // remove amount only for limited leaves in tree [first_leaf, leaf] amount value to remove / | function removeLimit(uint128 amount, uint48 leaf) internal {
if (treeNode[1].amount >= amount) {
// get last-updated top node
(uint48 updatedNode, uint48 begin, uint48 end) = getUpdatedNode(
1,
treeNode[1].updateId,
LIQUIDITYNODES,
... | function removeLimit(uint128 amount, uint48 leaf) internal {
if (treeNode[1].amount >= amount) {
// get last-updated top node
(uint48 updatedNode, uint48 begin, uint48 end) = getUpdatedNode(
1,
treeNode[1].updateId,
LIQUIDITYNODES,
... | 15,629 |
162 | // newController will point to the new controller after the present controller is upgraded | address public newController;
| address public newController;
| 10,605 |
241 | // If this has been called twice in the same block, shortcircuit to reduce gas | if(timeDelta == 0) {
return (rewardPerTokenStored, lastApplicableTime);
}
| if(timeDelta == 0) {
return (rewardPerTokenStored, lastApplicableTime);
}
| 29,326 |
5 | // The AF TOKEN! | IERC20 public tokenAF;
| IERC20 public tokenAF;
| 48,747 |
13 | // Tranfer tokens from sender to this contract | mimatic.transferFrom(msg.sender, address(this), amount);
| mimatic.transferFrom(msg.sender, address(this), amount);
| 38,882 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.