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 |
|---|---|---|---|---|
55 | // ============================================================================== _ __ _ | __ . _.(_(_)| (/_|(_)(_||(_.=====================_|======================================================= | function registerNameCore(uint256 _pID, address _addr, uint256 _affID, bytes32 _name, bool _isNewPlayer, bool _all)
private
| function registerNameCore(uint256 _pID, address _addr, uint256 _affID, bytes32 _name, bool _isNewPlayer, bool _all)
private
| 10,317 |
209 | // update lockedNumberblock.number.sub(user.lockBlock).mul(withdrawAmount).div(availablePending).add(user.lockBlock); | if(invited) {
| if(invited) {
| 76,708 |
134 | // Allow all tokens to transfer to contract | bool public allowedToContract = false; ///////////////////////////////////////////////////////////////////////////////////////////////////// new 2
| bool public allowedToContract = false; ///////////////////////////////////////////////////////////////////////////////////////////////////// new 2
| 44,228 |
195 | // We want to get back 3CRV | if (_want > 0) {
| if (_want > 0) {
| 16,638 |
45 | // convert token to weth | _toWETH(token0);
_toWETH(token1);
uint256 wethAmount = IERC20(weth).balanceOf(address(this)).sub(beforeWeth);
if(token0 == titan || token1 == titan) {
ITitanSwapV1Pair pair = ITitanSwapV1Pair(factory.getPair(titan,weth));
(uint reserve0, uint reserve1,) = pair.getReserves();
address _token0 = pair.token0();
(uint reserveIn, uint reserveOut) = _token0 == titan ? (reserve0, reserve1) : (reserve1, reserve0);
uint titanAmount = IERC20(titan).balanceOf(address(this)).sub(beforeTitan);
uint256 titanWethAmount = reserveOut.mul(titanAmount).div(reserveIn);
| _toWETH(token0);
_toWETH(token1);
uint256 wethAmount = IERC20(weth).balanceOf(address(this)).sub(beforeWeth);
if(token0 == titan || token1 == titan) {
ITitanSwapV1Pair pair = ITitanSwapV1Pair(factory.getPair(titan,weth));
(uint reserve0, uint reserve1,) = pair.getReserves();
address _token0 = pair.token0();
(uint reserveIn, uint reserveOut) = _token0 == titan ? (reserve0, reserve1) : (reserve1, reserve0);
uint titanAmount = IERC20(titan).balanceOf(address(this)).sub(beforeTitan);
uint256 titanWethAmount = reserveOut.mul(titanAmount).div(reserveIn);
| 46,678 |
0 | // document ipfs hash and document hash and timestamp | struct File {
string ipfsHash;
bytes32 docHash;
uint documentTimeStamp;
}
| struct File {
string ipfsHash;
bytes32 docHash;
uint documentTimeStamp;
}
| 16,856 |
54 | // Number of real (i.e. non-virtual) tokens in circulation. / | uint256 internal tokensCount;
| uint256 internal tokensCount;
| 50,041 |
0 | // Returns the number of decimals used / | function decimals()
public
view
virtual
override(ERC20, BaseControlledMintableBurnableERC20)
returns (uint8)
{
return BaseControlledMintableBurnableERC20.decimals();
}
| function decimals()
public
view
virtual
override(ERC20, BaseControlledMintableBurnableERC20)
returns (uint8)
{
return BaseControlledMintableBurnableERC20.decimals();
}
| 19,281 |
12 | // Owner of account approves the transfer of an amount to another account | mapping(address => mapping (address => uint256)) allowed;
| mapping(address => mapping (address => uint256)) allowed;
| 21,238 |
69 | // Check status evaluation | require(_evaluation.status == EvaluationStatus.EVALUATED, "ASSET_NOT_EVALUATED"); // evaluation status must be Evaluated
return true;
| require(_evaluation.status == EvaluationStatus.EVALUATED, "ASSET_NOT_EVALUATED"); // evaluation status must be Evaluated
return true;
| 40,343 |
4 | // Subtracts two uint256 numbers, reverts on overflow (i.e. if subtrahend is greater than minuend)./ | function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b <= _a, 'Sub operation underflowed!');
uint256 c = _a - _b;
return c;
}
| function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b <= _a, 'Sub operation underflowed!');
uint256 c = _a - _b;
return c;
}
| 1,111 |
169 | // Add `_staker` to the array of pool's delegators | _addPoolDelegator(_poolStakingAddress, _staker);
| _addPoolDelegator(_poolStakingAddress, _staker);
| 25,667 |
258 | // if the user delegated his voting power to another user, then he doesn't have any voting power left | if (stake.delegatedTo != address(0)) {
ownVotingPower = 0;
} else {
| if (stake.delegatedTo != address(0)) {
ownVotingPower = 0;
} else {
| 71,678 |
132 | // View the amount of dividend in wei that an address has earned in total./accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)/ = (magnifiedDividendPerSharebalanceOf(_owner) + magnifiedDividendCorrections[_owner]) / magnitude/_owner The address of a token holder./ return The amount of dividend in wei that `_owner` has earned in total. | function accumulativeDividendOf(address _owner)
public
view
override
returns (uint256)
| function accumulativeDividendOf(address _owner)
public
view
override
returns (uint256)
| 11,313 |
104 | // Matches a taker order with maker orders in the opposite Orderbook beforeit is entered in its own orderbook.Also handles matching auction orders. IF BUY order, it will try to match with an order in the SELL OrderBook and vice versaA taker order that is entered can match with multiple maker orders that are waiting in the orderbook.This function may run out of gas not because of the single taker order but because of the number ofmaker orders that are matching with it. This variable is ESSENTIAL for tradepairs in AUCTION_MODE== MATCHINGbecause we are guaranteed to run into such situations where | function matchOrder(bytes32 _takerOrderId, uint256 _maxNbrOfFills) private returns (uint256) {
Order storage takerOrder = orderMap[_takerOrderId];
Side side = takerOrder.side;
TradePair storage tradePair = tradePairMap[takerOrder.tradePairId];
// Get the opposite Book. if buying need to match with SellBook and vice versa
bytes32 bookId = side == Side.BUY ? tradePair.sellBookId : tradePair.buyBookId;
(uint256 price, bytes32 makerOrderId) = orderBooks.getTopOfTheBook(bookId);
Order storage makerOrder;
uint256 quantity;
uint256 takerRemainingQuantity = UtilsLibrary.getRemainingQuantity(
takerOrder.quantity,
takerOrder.quantityFilled
);
// Don't need price > 0 check as orderBooks.getHead(bookId,price) != ""
// which is makerOrderId != "" takes care of it
while (
takerRemainingQuantity > 0 &&
makerOrderId != "" &&
(side == Side.BUY ? takerOrder.price >= price : takerOrder.price <= price) &&
_maxNbrOfFills > 0
) {
makerOrder = orderMap[makerOrderId];
quantity = orderBooks.matchTrade(
bookId,
price,
takerRemainingQuantity,
UtilsLibrary.getRemainingQuantity(makerOrder.quantity, makerOrder.quantityFilled)
);
if (tradePair.auctionMode == AuctionMode.MATCHING) {
// In the typical flow, takerOrder amounts are all available and not locked
// In auction, taker order amounts are locked like a maker order and
// has to be made available before addExecution
portfolio.adjustAvailable(
IPortfolio.Tx.INCREASEAVAIL,
takerOrder.traderaddress,
tradePair.baseSymbol,
quantity
);
// In Auction, all executions should be at auctionPrice
price = tradePair.auctionPrice;
}
addExecution(makerOrder.id, takerOrder.id, price, quantity); // this makes a state change to Order Map
if (tradePair.auctionMode == AuctionMode.MATCHING && makerOrder.price > tradePair.auctionPrice) {
// Increase the available by the difference between the makerOrder & the auction Price
portfolio.adjustAvailable(
IPortfolio.Tx.INCREASEAVAIL,
makerOrder.traderaddress,
tradePair.quoteSymbol,
getQuoteAmount(makerOrder.tradePairId, makerOrder.price - tradePair.auctionPrice, quantity)
);
}
removeClosedOrder(makerOrder.id);
(price, makerOrderId) = orderBooks.getTopOfTheBook(bookId);
takerRemainingQuantity = UtilsLibrary.getRemainingQuantity(takerOrder.quantity, takerOrder.quantityFilled);
_maxNbrOfFills--;
}
if (tradePair.auctionMode == AuctionMode.MATCHING) {
emitStatusUpdate(takerOrder.id); // EMIT taker order's status update
if (takerRemainingQuantity == 0) {
// Remove the taker auction order from the sell orderbook
orderBooks.removeFirstOrder(tradePair.sellBookId, takerOrder.price);
removeClosedOrder(takerOrder.id);
}
} else if (takerRemainingQuantity > 0 && (_maxNbrOfFills == 0 || takerOrder.type1 == Type1.MARKET)) {
// This is not applicable to Auction Matching Mode
// if an order gets the max number of fills in a single block, it gets CANCELED for the
// remaining amount to protect the above loop from running out of gas.
// OR IF the Market Order fills all the way to the worst price and still has remaining,
// it gets CANCELED for the remaining amount.
takerOrder.status = Status.CANCELED;
}
return takerRemainingQuantity;
}
| function matchOrder(bytes32 _takerOrderId, uint256 _maxNbrOfFills) private returns (uint256) {
Order storage takerOrder = orderMap[_takerOrderId];
Side side = takerOrder.side;
TradePair storage tradePair = tradePairMap[takerOrder.tradePairId];
// Get the opposite Book. if buying need to match with SellBook and vice versa
bytes32 bookId = side == Side.BUY ? tradePair.sellBookId : tradePair.buyBookId;
(uint256 price, bytes32 makerOrderId) = orderBooks.getTopOfTheBook(bookId);
Order storage makerOrder;
uint256 quantity;
uint256 takerRemainingQuantity = UtilsLibrary.getRemainingQuantity(
takerOrder.quantity,
takerOrder.quantityFilled
);
// Don't need price > 0 check as orderBooks.getHead(bookId,price) != ""
// which is makerOrderId != "" takes care of it
while (
takerRemainingQuantity > 0 &&
makerOrderId != "" &&
(side == Side.BUY ? takerOrder.price >= price : takerOrder.price <= price) &&
_maxNbrOfFills > 0
) {
makerOrder = orderMap[makerOrderId];
quantity = orderBooks.matchTrade(
bookId,
price,
takerRemainingQuantity,
UtilsLibrary.getRemainingQuantity(makerOrder.quantity, makerOrder.quantityFilled)
);
if (tradePair.auctionMode == AuctionMode.MATCHING) {
// In the typical flow, takerOrder amounts are all available and not locked
// In auction, taker order amounts are locked like a maker order and
// has to be made available before addExecution
portfolio.adjustAvailable(
IPortfolio.Tx.INCREASEAVAIL,
takerOrder.traderaddress,
tradePair.baseSymbol,
quantity
);
// In Auction, all executions should be at auctionPrice
price = tradePair.auctionPrice;
}
addExecution(makerOrder.id, takerOrder.id, price, quantity); // this makes a state change to Order Map
if (tradePair.auctionMode == AuctionMode.MATCHING && makerOrder.price > tradePair.auctionPrice) {
// Increase the available by the difference between the makerOrder & the auction Price
portfolio.adjustAvailable(
IPortfolio.Tx.INCREASEAVAIL,
makerOrder.traderaddress,
tradePair.quoteSymbol,
getQuoteAmount(makerOrder.tradePairId, makerOrder.price - tradePair.auctionPrice, quantity)
);
}
removeClosedOrder(makerOrder.id);
(price, makerOrderId) = orderBooks.getTopOfTheBook(bookId);
takerRemainingQuantity = UtilsLibrary.getRemainingQuantity(takerOrder.quantity, takerOrder.quantityFilled);
_maxNbrOfFills--;
}
if (tradePair.auctionMode == AuctionMode.MATCHING) {
emitStatusUpdate(takerOrder.id); // EMIT taker order's status update
if (takerRemainingQuantity == 0) {
// Remove the taker auction order from the sell orderbook
orderBooks.removeFirstOrder(tradePair.sellBookId, takerOrder.price);
removeClosedOrder(takerOrder.id);
}
} else if (takerRemainingQuantity > 0 && (_maxNbrOfFills == 0 || takerOrder.type1 == Type1.MARKET)) {
// This is not applicable to Auction Matching Mode
// if an order gets the max number of fills in a single block, it gets CANCELED for the
// remaining amount to protect the above loop from running out of gas.
// OR IF the Market Order fills all the way to the worst price and still has remaining,
// it gets CANCELED for the remaining amount.
takerOrder.status = Status.CANCELED;
}
return takerRemainingQuantity;
}
| 34,548 |
353 | // Increase the total stake for a delegate and updates its 'lastActiveStakeUpdateRound' _delegate The delegate to increase the stake for _amount The amount to increase the stake for '_delegate' by / | function increaseTotalStake(address _delegate, uint256 _amount, address _newPosPrev, address _newPosNext) internal {
if (isRegisteredTranscoder(_delegate)) {
uint256 currStake = transcoderTotalStake(_delegate);
uint256 newStake = currStake.add(_amount);
uint256 currRound = roundsManager().currentRound();
uint256 nextRound = currRound.add(1);
// If the transcoder is already in the active set update its stake and return
if (transcoderPoolV2.contains(_delegate)) {
transcoderPoolV2.updateKey(_delegate, newStake, _newPosPrev, _newPosNext);
nextRoundTotalActiveStake = nextRoundTotalActiveStake.add(_amount);
Transcoder storage t = transcoders[_delegate];
// currStake (the transcoder's delegatedAmount field) will reflect the transcoder's stake from lastActiveStakeUpdateRound
// because it is updated every time lastActiveStakeUpdateRound is updated
// The current active total stake is set to currStake to ensure that the value can be used in updateTranscoderWithRewards()
// and updateTranscoderWithFees() when lastActiveStakeUpdateRound > currentRound
if (t.lastActiveStakeUpdateRound < currRound) {
t.earningsPoolPerRound[currRound].setStake(currStake);
}
t.earningsPoolPerRound[nextRound].setStake(newStake);
t.lastActiveStakeUpdateRound = nextRound;
} else {
// Check if the transcoder is eligible to join the active set in the update round
tryToJoinActiveSet(_delegate, newStake, nextRound, _newPosPrev, _newPosNext);
}
}
// Increase delegate's delegated amount
delegators[_delegate].delegatedAmount = delegators[_delegate].delegatedAmount.add(_amount);
}
| function increaseTotalStake(address _delegate, uint256 _amount, address _newPosPrev, address _newPosNext) internal {
if (isRegisteredTranscoder(_delegate)) {
uint256 currStake = transcoderTotalStake(_delegate);
uint256 newStake = currStake.add(_amount);
uint256 currRound = roundsManager().currentRound();
uint256 nextRound = currRound.add(1);
// If the transcoder is already in the active set update its stake and return
if (transcoderPoolV2.contains(_delegate)) {
transcoderPoolV2.updateKey(_delegate, newStake, _newPosPrev, _newPosNext);
nextRoundTotalActiveStake = nextRoundTotalActiveStake.add(_amount);
Transcoder storage t = transcoders[_delegate];
// currStake (the transcoder's delegatedAmount field) will reflect the transcoder's stake from lastActiveStakeUpdateRound
// because it is updated every time lastActiveStakeUpdateRound is updated
// The current active total stake is set to currStake to ensure that the value can be used in updateTranscoderWithRewards()
// and updateTranscoderWithFees() when lastActiveStakeUpdateRound > currentRound
if (t.lastActiveStakeUpdateRound < currRound) {
t.earningsPoolPerRound[currRound].setStake(currStake);
}
t.earningsPoolPerRound[nextRound].setStake(newStake);
t.lastActiveStakeUpdateRound = nextRound;
} else {
// Check if the transcoder is eligible to join the active set in the update round
tryToJoinActiveSet(_delegate, newStake, nextRound, _newPosPrev, _newPosNext);
}
}
// Increase delegate's delegated amount
delegators[_delegate].delegatedAmount = delegators[_delegate].delegatedAmount.add(_amount);
}
| 35,693 |
62 | // Governor (owner contract) pays a community member with ETH or a token inside the treasury ETH can be transfered with supplying 0x0 for "token" | function pay(
IERC20 token,
address payable who,
uint256 howManyTokens,
string memory note
) public onlyOwner {
| function pay(
IERC20 token,
address payable who,
uint256 howManyTokens,
string memory note
) public onlyOwner {
| 54,835 |
5 | // Auditor contract constructor _operator is an operator if this auditor _token is an associated issuer token _holder is an issurance holder address / | function Auditor(address _operator,
address _token,
| function Auditor(address _operator,
address _token,
| 5,035 |
167 | // How many NFTs can be purchasable (via the minting site or directly from this smart contract) | uint256 public maxNumberPurchasable = 2030;
uint256 public maxMintAmountPerSession = 10;
uint256 public nftPerAddressLimit = 30;
| uint256 public maxNumberPurchasable = 2030;
uint256 public maxMintAmountPerSession = 10;
uint256 public nftPerAddressLimit = 30;
| 72,957 |
22 | // Total Token Allocations | uint256 public totalAllocation = 10 * (10 ** 9) * (10 ** 18);
uint256 public investorTimeLock = 183 days; // six months
uint256 public othersTimeLock = 3 * 365 days;
| uint256 public totalAllocation = 10 * (10 ** 9) * (10 ** 18);
uint256 public investorTimeLock = 183 days; // six months
uint256 public othersTimeLock = 3 * 365 days;
| 47,568 |
259 | // DVD price in wei according to the bonding curve formula./ return Current DVD price in wei. | function dvdPrice() external view returns (uint256) {
// price = supply * multiplier
return dvdTotalSupply().roundedDiv(DIVIDER);
}
| function dvdPrice() external view returns (uint256) {
// price = supply * multiplier
return dvdTotalSupply().roundedDiv(DIVIDER);
}
| 49,215 |
15 | // and then BURN token will send to wallet | event Burn(uint256 _amoumt);
| event Burn(uint256 _amoumt);
| 20,376 |
37 | // returns the current phase's ID. / | function phaseId()
external
view
returns (uint16)
| function phaseId()
external
view
returns (uint16)
| 25,247 |
3 | // todo reward pool! | address public _rewardPool = 0x5B8c8Ea185A009B807Fc598c0820e6429AD7d6F8;
| address public _rewardPool = 0x5B8c8Ea185A009B807Fc598c0820e6429AD7d6F8;
| 16,856 |
55 | // Without this check, the value passed to "exp2" would be greater than 128e18. | require(x < 88722839111672999628);
| require(x < 88722839111672999628);
| 8,420 |
84 | // Change minimum lock period. Call by only Governance. / | function changedMinimumLockPeriod(uint256 minLockPeriod_)
external
onlyGovernance
| function changedMinimumLockPeriod(uint256 minLockPeriod_)
external
onlyGovernance
| 9,926 |
280 | // require(isSaleActive, "Sale is not active");require(numberOfTokens <= maxPerTx, "No more than 20 tokens per transaction");require(totalSupply().add(numberOfTokens) <= maxToken, "Purchase would exceed max supply of PandaHead");require(pricePerToken.mul(numberOfTokens) == msg.value, "Ether value is not correct"); |
payable(owner()).transfer(msg.value);
for (uint256 i = 0; i < numberOfTokens; i++) {
uint256 mintIndex = totalSupply();
if (totalSupply() < maxToken) {
_safeMint(msg.sender, mintIndex);
}
|
payable(owner()).transfer(msg.value);
for (uint256 i = 0; i < numberOfTokens; i++) {
uint256 mintIndex = totalSupply();
if (totalSupply() < maxToken) {
_safeMint(msg.sender, mintIndex);
}
| 24,779 |
34 | // _getTknAddr(); _getIcoAddr(); _getExchgAddr();address tkn_addr; address ico_addr; address exchg_addr;_________________________________________________________/ Internal transfer, only can be called by this contract / | function _transfer(address _from, address _to, uint _value) internal {
require (_to != 0x0);
require(!frozenAccount[_from]);
require(!frozenAccount[_to]);
uint valtmp = _value;
uint _valueA = valtmp;
valtmp = 0;
require (balanceOf[_from] >= _valueA);
require (balanceOf[_to] + _valueA > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
| function _transfer(address _from, address _to, uint _value) internal {
require (_to != 0x0);
require(!frozenAccount[_from]);
require(!frozenAccount[_to]);
uint valtmp = _value;
uint _valueA = valtmp;
valtmp = 0;
require (balanceOf[_from] >= _valueA);
require (balanceOf[_to] + _valueA > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
| 46,138 |
49 | // To provided recipient | recipient,
| recipient,
| 43,977 |
23 | // Switch to Settled state if appropriate time threshold is passed and/ set underlyingStarts value and set underlyingEnds value,/ calculate primaryConversion and complementConversion params/Reverts if underlyingEnds are not available/ Vault cannot settle when it paused | function settle(uint256[] calldata _underlyingEndRoundHints)
public
whenNotPaused()
| function settle(uint256[] calldata _underlyingEndRoundHints)
public
whenNotPaused()
| 53,743 |
20 | // Swaps Tokens for Eth / | function cryptoDevTokenToEth(uint _tokensSold, uint _minEth) public {
uint256 tokenReserve = getReserve();
uint256 ethBought = getAmountOfTokens(
_tokensSold,
tokenReserve,
address(this).balance
);
require(ethBought >= _minEth, "insufficient output amount");
ERC20(cryptoDevTokenAddress).transferFrom(
msg.sender,
address(this),
_tokensSold
);
payable(msg.sender).transfer(ethBought);
}
| function cryptoDevTokenToEth(uint _tokensSold, uint _minEth) public {
uint256 tokenReserve = getReserve();
uint256 ethBought = getAmountOfTokens(
_tokensSold,
tokenReserve,
address(this).balance
);
require(ethBought >= _minEth, "insufficient output amount");
ERC20(cryptoDevTokenAddress).transferFrom(
msg.sender,
address(this),
_tokensSold
);
payable(msg.sender).transfer(ethBought);
}
| 6,642 |
11 | // NOT using safeTransferFrom intentionally | SHIBOSHI.transferFrom(address(this), msg.sender, s.ids[i]);
| SHIBOSHI.transferFrom(address(this), msg.sender, s.ids[i]);
| 29,687 |
108 | // index Index of transaction. Transaction ordering may have changed since adding. enabled True for enabled, false for disabled. / |
function setTransactionEnabled(uint index, bool enabled)
external
onlyOwner
|
function setTransactionEnabled(uint index, bool enabled)
external
onlyOwner
| 11,389 |
25 | // Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1. | * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.
*
* This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either
* by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting
* power can be queried through the public accessors {getVotes} and {getPastVotes}.
*
* By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it
* requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.
* Enabling self-delegation can easily be done by overriding the {delegates} function. Keep in mind however that this
* will significantly increase the base gas cost of transfers.
*
* _Available since v4.2._
*/
abstract contract ERC20Votes is ERC20Permit {
struct Checkpoint {
uint32 fromBlock;
uint224 votes;
}
bytes32 private constant _DELEGATION_TYPEHASH =
keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
mapping(address => address) private _delegates;
mapping(address => Checkpoint[]) private _checkpoints;
Checkpoint[] private _totalSupplyCheckpoints;
/**
* @dev Emitted when an account changes their delegate.
*/
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/**
* @dev Emitted when a token transfer or delegate change results in changes to an account's voting power.
*/
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
/**
* @dev Get the `pos`-th checkpoint for `account`.
*/
function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {
return _checkpoints[account][pos];
}
/**
* @dev Get number of checkpoints for `account`.
*/
function numCheckpoints(address account) public view virtual returns (uint32) {
return SafeCast.toUint32(_checkpoints[account].length);
}
/**
* @dev Get the address `account` is currently delegating to.
*/
function delegates(address account) public view virtual returns (address) {
return _delegates[account];
}
/**
* @dev Gets the current votes balance for `account`
*/
function getVotes(address account) public view returns (uint256) {
uint256 pos = _checkpoints[account].length;
return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;
}
/**
* @dev Retrieve the number of votes for `account` at the end of `blockNumber`.
*
* Requirements:
*
* - `blockNumber` must have been already mined
*/
function getPastVotes(address account, uint256 blockNumber) public view returns (uint256) {
require(blockNumber < block.number, "ERC20Votes: block not yet mined");
return _checkpointsLookup(_checkpoints[account], blockNumber);
}
/**
* @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.
* It is but NOT the sum of all the delegated votes!
*
* Requirements:
*
* - `blockNumber` must have been already mined
*/
function getPastTotalSupply(uint256 blockNumber) public view returns (uint256) {
require(blockNumber < block.number, "ERC20Votes: block not yet mined");
return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);
}
/**
* @dev Lookup a value in a list of (sorted) checkpoints.
*/
function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {
// We run a binary search to look for the earliest checkpoint taken after `blockNumber`.
//
// During the loop, the index of the wanted checkpoint remains in the range [low-1, high).
// With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.
// - If the middle checkpoint is after `blockNumber`, we look in [low, mid)
// - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high)
// Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not
// out of bounds (in which case we're looking too far in the past and the result is 0).
// Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is
// past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out
// the same.
uint256 high = ckpts.length;
uint256 low = 0;
while (low < high) {
uint256 mid = Math.average(low, high);
if (ckpts[mid].fromBlock > blockNumber) {
high = mid;
} else {
low = mid + 1;
}
}
return high == 0 ? 0 : ckpts[high - 1].votes;
}
/**
* @dev Delegate votes from the sender to `delegatee`.
*/
function delegate(address delegatee) public virtual {
_delegate(_msgSender(), delegatee);
}
/**
* @dev Delegates votes from signer to `delegatee`
*/
function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
require(block.timestamp <= expiry, "ERC20Votes: signature expired");
address signer = ECDSA.recover(
_hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),
v,
r,
s
);
require(nonce == _useNonce(signer), "ERC20Votes: invalid nonce");
_delegate(signer, delegatee);
}
/**
* @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).
*/
function _maxSupply() internal view virtual returns (uint224) {
return type(uint224).max;
}
/**
* @dev Snapshots the totalSupply after it has been increased.
*/
function _mint(address account, uint256 amount) internal virtual override {
super._mint(account, amount);
require(totalSupply() <= _maxSupply(), "ERC20Votes: total supply risks overflowing votes");
_writeCheckpoint(_totalSupplyCheckpoints, _add, amount);
}
/**
* @dev Snapshots the totalSupply after it has been decreased.
*/
function _burn(address account, uint256 amount) internal virtual override {
super._burn(account, amount);
_writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);
}
/**
* @dev Move voting power when tokens are transferred.
*
* Emits a {DelegateVotesChanged} event.
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
super._afterTokenTransfer(from, to, amount);
_moveVotingPower(delegates(from), delegates(to), amount);
}
/**
* @dev Change delegation for `delegator` to `delegatee`.
*
* Emits events {DelegateChanged} and {DelegateVotesChanged}.
*/
function _delegate(address delegator, address delegatee) internal virtual {
address currentDelegate = delegates(delegator);
uint256 delegatorBalance = balanceOf(delegator);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveVotingPower(currentDelegate, delegatee, delegatorBalance);
}
function _moveVotingPower(
address src,
address dst,
uint256 amount
) private {
if (src != dst && amount > 0) {
if (src != address(0)) {
(uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);
emit DelegateVotesChanged(src, oldWeight, newWeight);
}
if (dst != address(0)) {
(uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);
emit DelegateVotesChanged(dst, oldWeight, newWeight);
}
}
}
function _writeCheckpoint(
Checkpoint[] storage ckpts,
function(uint256, uint256) view returns (uint256) op,
uint256 delta
) private returns (uint256 oldWeight, uint256 newWeight) {
uint256 pos = ckpts.length;
oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;
newWeight = op(oldWeight, delta);
if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {
ckpts[pos - 1].votes = SafeCast.toUint224(newWeight);
} else {
ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(block.number), votes: SafeCast.toUint224(newWeight)}));
}
}
function _add(uint256 a, uint256 b) private pure returns (uint256) {
return a + b;
}
function _subtract(uint256 a, uint256 b) private pure returns (uint256) {
return a - b;
}
}
| * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.
*
* This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either
* by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting
* power can be queried through the public accessors {getVotes} and {getPastVotes}.
*
* By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it
* requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.
* Enabling self-delegation can easily be done by overriding the {delegates} function. Keep in mind however that this
* will significantly increase the base gas cost of transfers.
*
* _Available since v4.2._
*/
abstract contract ERC20Votes is ERC20Permit {
struct Checkpoint {
uint32 fromBlock;
uint224 votes;
}
bytes32 private constant _DELEGATION_TYPEHASH =
keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
mapping(address => address) private _delegates;
mapping(address => Checkpoint[]) private _checkpoints;
Checkpoint[] private _totalSupplyCheckpoints;
/**
* @dev Emitted when an account changes their delegate.
*/
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/**
* @dev Emitted when a token transfer or delegate change results in changes to an account's voting power.
*/
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
/**
* @dev Get the `pos`-th checkpoint for `account`.
*/
function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {
return _checkpoints[account][pos];
}
/**
* @dev Get number of checkpoints for `account`.
*/
function numCheckpoints(address account) public view virtual returns (uint32) {
return SafeCast.toUint32(_checkpoints[account].length);
}
/**
* @dev Get the address `account` is currently delegating to.
*/
function delegates(address account) public view virtual returns (address) {
return _delegates[account];
}
/**
* @dev Gets the current votes balance for `account`
*/
function getVotes(address account) public view returns (uint256) {
uint256 pos = _checkpoints[account].length;
return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;
}
/**
* @dev Retrieve the number of votes for `account` at the end of `blockNumber`.
*
* Requirements:
*
* - `blockNumber` must have been already mined
*/
function getPastVotes(address account, uint256 blockNumber) public view returns (uint256) {
require(blockNumber < block.number, "ERC20Votes: block not yet mined");
return _checkpointsLookup(_checkpoints[account], blockNumber);
}
/**
* @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.
* It is but NOT the sum of all the delegated votes!
*
* Requirements:
*
* - `blockNumber` must have been already mined
*/
function getPastTotalSupply(uint256 blockNumber) public view returns (uint256) {
require(blockNumber < block.number, "ERC20Votes: block not yet mined");
return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);
}
/**
* @dev Lookup a value in a list of (sorted) checkpoints.
*/
function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {
// We run a binary search to look for the earliest checkpoint taken after `blockNumber`.
//
// During the loop, the index of the wanted checkpoint remains in the range [low-1, high).
// With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.
// - If the middle checkpoint is after `blockNumber`, we look in [low, mid)
// - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high)
// Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not
// out of bounds (in which case we're looking too far in the past and the result is 0).
// Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is
// past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out
// the same.
uint256 high = ckpts.length;
uint256 low = 0;
while (low < high) {
uint256 mid = Math.average(low, high);
if (ckpts[mid].fromBlock > blockNumber) {
high = mid;
} else {
low = mid + 1;
}
}
return high == 0 ? 0 : ckpts[high - 1].votes;
}
/**
* @dev Delegate votes from the sender to `delegatee`.
*/
function delegate(address delegatee) public virtual {
_delegate(_msgSender(), delegatee);
}
/**
* @dev Delegates votes from signer to `delegatee`
*/
function delegateBySig(
address delegatee,
uint256 nonce,
uint256 expiry,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
require(block.timestamp <= expiry, "ERC20Votes: signature expired");
address signer = ECDSA.recover(
_hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),
v,
r,
s
);
require(nonce == _useNonce(signer), "ERC20Votes: invalid nonce");
_delegate(signer, delegatee);
}
/**
* @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).
*/
function _maxSupply() internal view virtual returns (uint224) {
return type(uint224).max;
}
/**
* @dev Snapshots the totalSupply after it has been increased.
*/
function _mint(address account, uint256 amount) internal virtual override {
super._mint(account, amount);
require(totalSupply() <= _maxSupply(), "ERC20Votes: total supply risks overflowing votes");
_writeCheckpoint(_totalSupplyCheckpoints, _add, amount);
}
/**
* @dev Snapshots the totalSupply after it has been decreased.
*/
function _burn(address account, uint256 amount) internal virtual override {
super._burn(account, amount);
_writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);
}
/**
* @dev Move voting power when tokens are transferred.
*
* Emits a {DelegateVotesChanged} event.
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
super._afterTokenTransfer(from, to, amount);
_moveVotingPower(delegates(from), delegates(to), amount);
}
/**
* @dev Change delegation for `delegator` to `delegatee`.
*
* Emits events {DelegateChanged} and {DelegateVotesChanged}.
*/
function _delegate(address delegator, address delegatee) internal virtual {
address currentDelegate = delegates(delegator);
uint256 delegatorBalance = balanceOf(delegator);
_delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveVotingPower(currentDelegate, delegatee, delegatorBalance);
}
function _moveVotingPower(
address src,
address dst,
uint256 amount
) private {
if (src != dst && amount > 0) {
if (src != address(0)) {
(uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);
emit DelegateVotesChanged(src, oldWeight, newWeight);
}
if (dst != address(0)) {
(uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);
emit DelegateVotesChanged(dst, oldWeight, newWeight);
}
}
}
function _writeCheckpoint(
Checkpoint[] storage ckpts,
function(uint256, uint256) view returns (uint256) op,
uint256 delta
) private returns (uint256 oldWeight, uint256 newWeight) {
uint256 pos = ckpts.length;
oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;
newWeight = op(oldWeight, delta);
if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {
ckpts[pos - 1].votes = SafeCast.toUint224(newWeight);
} else {
ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(block.number), votes: SafeCast.toUint224(newWeight)}));
}
}
function _add(uint256 a, uint256 b) private pure returns (uint256) {
return a + b;
}
function _subtract(uint256 a, uint256 b) private pure returns (uint256) {
return a - b;
}
}
| 25,189 |
2 | // In the future, we might want to add some new fields to the struct. The `txData` struct is to be passed to account and any changes to its structure would mean a breaking change to these accounts. To prevent this, we should keep some fields as "reserved". It is also recommended that their length is fixed, since it would allow easier proof integration (in case we will need some special circuit for preprocessing transactions). | uint256[4] reserved;
bytes data;
bytes signature;
uint256[] factoryDeps;
bytes paymasterInput;
| uint256[4] reserved;
bytes data;
bytes signature;
uint256[] factoryDeps;
bytes paymasterInput;
| 20,764 |
0 | // Divide the signature in r, s and v variables | bytes32 r;
bytes32 s;
uint8 v;
bytes memory signature = sig.signature;
| bytes32 r;
bytes32 s;
uint8 v;
bytes memory signature = sig.signature;
| 39,434 |
249 | // subsidized deposit of assets to pool | function executeDepositOnBehalf(address _beneficiary, address _token, address _pool, uint256 _amount, uint256 _expectedMinimumReceived, bytes memory _convertData, uint256 _bonus) public {
require(hasRole(TRUSTED_EXECUTION_ROLE, msg.sender), "trusted executor only");
ISmartTreasury(smartTreasury).spendBonus(_beneficiary, priceCorrection(_bonus));
// perform deposit, assuming this contract has allowance
// TODO: check deposit on behalf with raw Eth! it's not supported but that it reverts;
// TODO: check if swap would be executed properly;
depositToPoolOnBehalf(_beneficiary, _pool, _token, _amount, _expectedMinimumReceived, _convertData);
}
| function executeDepositOnBehalf(address _beneficiary, address _token, address _pool, uint256 _amount, uint256 _expectedMinimumReceived, bytes memory _convertData, uint256 _bonus) public {
require(hasRole(TRUSTED_EXECUTION_ROLE, msg.sender), "trusted executor only");
ISmartTreasury(smartTreasury).spendBonus(_beneficiary, priceCorrection(_bonus));
// perform deposit, assuming this contract has allowance
// TODO: check deposit on behalf with raw Eth! it's not supported but that it reverts;
// TODO: check if swap would be executed properly;
depositToPoolOnBehalf(_beneficiary, _pool, _token, _amount, _expectedMinimumReceived, _convertData);
}
| 3,796 |
12 | // Block timestamp that interest was last accrued at / | uint256 public accrualBlockTimestamp;
| uint256 public accrualBlockTimestamp;
| 48,514 |
0 | // Periphery Payments/Functions to ease deposits and withdrawals of ETH | interface IPeripheryPayments {
/// @notice Unwraps the contract's WETH9 balance and sends it to recipient as ETH.
/// @dev The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.
/// @param amountMinimum The minimum amount of WETH9 to unwrap
/// @param recipient The address receiving ETH
function unwrapWETH9(uint256 amountMinimum, address recipient) external payable;
/// @notice Refunds any ETH balance held by this contract to the `msg.sender`
/// @dev Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps
/// that use ether for the input amount
function refundETH() external payable;
/// @notice Transfers the full amount of a token held by this contract to recipient
/// @dev The amountMinimum parameter prevents malicious contracts from stealing the token from users
/// @param token The contract address of the token which will be transferred to `recipient`
/// @param amountMinimum The minimum amount of token required for a transfer
/// @param recipient The destination address of the token
function sweepToken(
address token,
uint256 amountMinimum,
address recipient
) external payable;
}
| interface IPeripheryPayments {
/// @notice Unwraps the contract's WETH9 balance and sends it to recipient as ETH.
/// @dev The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.
/// @param amountMinimum The minimum amount of WETH9 to unwrap
/// @param recipient The address receiving ETH
function unwrapWETH9(uint256 amountMinimum, address recipient) external payable;
/// @notice Refunds any ETH balance held by this contract to the `msg.sender`
/// @dev Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps
/// that use ether for the input amount
function refundETH() external payable;
/// @notice Transfers the full amount of a token held by this contract to recipient
/// @dev The amountMinimum parameter prevents malicious contracts from stealing the token from users
/// @param token The contract address of the token which will be transferred to `recipient`
/// @param amountMinimum The minimum amount of token required for a transfer
/// @param recipient The destination address of the token
function sweepToken(
address token,
uint256 amountMinimum,
address recipient
) external payable;
}
| 7,208 |
79 | // The pool limit (0 if none) | uint256 public poolLimitPerUser;
| uint256 public poolLimitPerUser;
| 18,369 |
42 | // Sets the collection max per wallet _maxPerWallet The max per wallet / | function setMaxPerWallet(uint256 _maxPerWallet) external onlyOwner {
maxPerWallet = _maxPerWallet;
}
| function setMaxPerWallet(uint256 _maxPerWallet) external onlyOwner {
maxPerWallet = _maxPerWallet;
}
| 11,873 |
3 | // Permissionless method that reads price from oracle contracts and checks if barrier is triggered cegaStateAddress is the address of the CegaState contract that stores the oracle addresses / | function checkBarriers(FCNVaultMetadata storage self, address cegaStateAddress) public {
if (self.isKnockedIn == true) {
return;
}
require(self.vaultStatus == VaultStatus.Traded, "500:WS");
for (uint256 i = 0; i < self.optionBarriersCount; i++) {
OptionBarrier storage optionBarrier = self.optionBarriers[i];
address oracle = getOracleAddress(optionBarrier, cegaStateAddress);
(, int256 answer, , , ) = Oracle(oracle).latestRoundData();
// Knock In: Check if current price is less than barrier
if (optionBarrier.barrierType == OptionBarrierType.KnockIn) {
if (uint256(answer) <= optionBarrier.barrierAbsoluteValue) {
self.isKnockedIn = true;
}
}
}
}
| function checkBarriers(FCNVaultMetadata storage self, address cegaStateAddress) public {
if (self.isKnockedIn == true) {
return;
}
require(self.vaultStatus == VaultStatus.Traded, "500:WS");
for (uint256 i = 0; i < self.optionBarriersCount; i++) {
OptionBarrier storage optionBarrier = self.optionBarriers[i];
address oracle = getOracleAddress(optionBarrier, cegaStateAddress);
(, int256 answer, , , ) = Oracle(oracle).latestRoundData();
// Knock In: Check if current price is less than barrier
if (optionBarrier.barrierType == OptionBarrierType.KnockIn) {
if (uint256(answer) <= optionBarrier.barrierAbsoluteValue) {
self.isKnockedIn = true;
}
}
}
}
| 39,646 |
143 | // Mint KUSD to treasury account to keep on-chain KUSD consist with off-chain trading system amount The amount of KUSD to mint to treasury / | function treasuryMint(uint amount) external onlyTreasury {
kUSD.mint(vault, amount);
emit TreasuryMint(amount);
}
| function treasuryMint(uint amount) external onlyTreasury {
kUSD.mint(vault, amount);
emit TreasuryMint(amount);
}
| 34,130 |
80 | // a function only the treasury can use so they can send both the allunvested deal tokens as well as all the vested underlying deal tokens in asingle transaction. we can use this when we are ready to distri / | function treasuryTransfer(address recipient) external returns (bool) {
require(
msg.sender == aelinRewardsAddress,
"only Rewards address can access"
);
(
uint256 underlyingClaimable,
uint256 claimableDealTokens
) = claimableTokens(msg.sender);
transfer(recipient, balanceOf(msg.sender) - claimableDealTokens);
return
IERC20(underlyingDealToken).transfer(
recipient,
underlyingClaimable
);
}
| function treasuryTransfer(address recipient) external returns (bool) {
require(
msg.sender == aelinRewardsAddress,
"only Rewards address can access"
);
(
uint256 underlyingClaimable,
uint256 claimableDealTokens
) = claimableTokens(msg.sender);
transfer(recipient, balanceOf(msg.sender) - claimableDealTokens);
return
IERC20(underlyingDealToken).transfer(
recipient,
underlyingClaimable
);
}
| 62,296 |
68 | // exclude owner and this contract from fee | _isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
| _isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
| 37,866 |
28 | // in the extreme case of zero staked tokens for this expiry even now, => nothing to do from this epoch onwards | if (_totalStake == 0) break;
| if (_totalStake == 0) break;
| 36,886 |
14 | // Internal snipes /+clear+/ `internalSnipes` works by looping over targets. Each successive offer is executed under a [reentrancy lock](internalSnipes/liftReentrancy), then its posthook is called. Going upward, each offer's `maker` contract is called again with its remaining gas and given the chance to update its offers on the book. / | ) internal returns (uint successCount, uint snipesGot, uint snipesGave) { unchecked {
for (uint i = 0; i < targets.length; i++) {
/* Reset these amounts since every snipe is treated individually. Only the total penalty is sent at the end of all snipes. */
mor.totalGot = 0;
mor.totalGave = 0;
/* Initialize single order struct. */
sor.offerId = targets[i][0];
sor.offer = offers[sor.outbound_tkn][sor.inbound_tkn][sor.offerId];
sor.offerDetail = offerDetails[sor.outbound_tkn][sor.inbound_tkn][
sor.offerId
];
/* If we removed the `isLive` conditional, a single expired or nonexistent offer in `targets` would revert the entire transaction (by the division by `offer.gives` below since `offer.gives` would be 0). We also check that `gasreq` is not worse than specified. A taker who does not care about `gasreq` can specify any amount larger than $2^{24}-1$. A mismatched price will be detected by `execute`. */
if (
!isLive(sor.offer) ||
sor.offerDetail.gasreq() > targets[i][3]
) {
/* We move on to the next offer in the array. */
continue;
} else {
require(
uint96(targets[i][1]) == targets[i][1],
"mgv/snipes/takerWants/96bits"
);
require(
uint96(targets[i][2]) == targets[i][2],
"mgv/snipes/takerGives/96bits"
);
sor.wants = targets[i][1];
sor.gives = targets[i][2];
/* We start be enabling the reentrancy lock for this (`outbound_tkn`,`inbound_tkn`) pair. */
sor.local = sor.local.lock(true);
locals[sor.outbound_tkn][sor.inbound_tkn] = sor.local;
/* `execute` will adjust `sor.wants`,`sor.gives`, and may attempt to execute the offer if its price is low enough. It is crucial that an error due to `taker` triggers a revert. That way [`mgvData`](#MgvOfferTaking/statusCodes) not in `["mgv/tradeSuccess","mgv/notExecuted"]` means the failure is the maker's fault. */
/* Post-execution, `sor.wants`/`sor.gives` reflect how much was sent/taken by the offer. */
(uint gasused, bytes32 makerData, bytes32 mgvData) = execute(mor, sor);
if (mgvData == "mgv/tradeSuccess") {
successCount += 1;
}
/* In the market order, we were able to avoid stitching back offers after every `execute` since we knew a continuous segment starting at best would be consumed. Here, we cannot do this optimisation since offers in the `targets` array may be anywhere in the book. So we stitch together offers immediately after each `execute`. */
if (mgvData != "mgv/notExecuted") {
sor.local = stitchOffers(
sor.outbound_tkn,
sor.inbound_tkn,
sor.offer.prev(),
sor.offer.next(),
sor.local
);
}
/* <a id="internalSnipes/liftReentrancy"></a> Now that the current snipe is over, we can lift the lock on the book. In the same operation we
* lift the reentrancy lock, and
* update the storage
so we are free from out of order storage writes.
*/
sor.local = sor.local.lock(false);
locals[sor.outbound_tkn][sor.inbound_tkn] = sor.local;
/* `payTakerMinusFees` sends the fee to the vault, proportional to the amount purchased, and gives the rest to the taker */
payTakerMinusFees(mor, sor);
/* In an inverted Mangrove, amounts have been lent by each offer's maker to the taker. We now call the taker. This is a noop in a normal Mangrove. */
executeEnd(mor, sor);
/* After an offer execution, we may run callbacks and increase the total penalty. As that part is common to market orders and snipes, it lives in its own `postExecute` function. */
if (mgvData != "mgv/notExecuted") {
postExecute(mor, sor, gasused, makerData, mgvData);
}
snipesGot += mor.totalGot;
snipesGave += mor.totalGave;
}
}
}}
| ) internal returns (uint successCount, uint snipesGot, uint snipesGave) { unchecked {
for (uint i = 0; i < targets.length; i++) {
/* Reset these amounts since every snipe is treated individually. Only the total penalty is sent at the end of all snipes. */
mor.totalGot = 0;
mor.totalGave = 0;
/* Initialize single order struct. */
sor.offerId = targets[i][0];
sor.offer = offers[sor.outbound_tkn][sor.inbound_tkn][sor.offerId];
sor.offerDetail = offerDetails[sor.outbound_tkn][sor.inbound_tkn][
sor.offerId
];
/* If we removed the `isLive` conditional, a single expired or nonexistent offer in `targets` would revert the entire transaction (by the division by `offer.gives` below since `offer.gives` would be 0). We also check that `gasreq` is not worse than specified. A taker who does not care about `gasreq` can specify any amount larger than $2^{24}-1$. A mismatched price will be detected by `execute`. */
if (
!isLive(sor.offer) ||
sor.offerDetail.gasreq() > targets[i][3]
) {
/* We move on to the next offer in the array. */
continue;
} else {
require(
uint96(targets[i][1]) == targets[i][1],
"mgv/snipes/takerWants/96bits"
);
require(
uint96(targets[i][2]) == targets[i][2],
"mgv/snipes/takerGives/96bits"
);
sor.wants = targets[i][1];
sor.gives = targets[i][2];
/* We start be enabling the reentrancy lock for this (`outbound_tkn`,`inbound_tkn`) pair. */
sor.local = sor.local.lock(true);
locals[sor.outbound_tkn][sor.inbound_tkn] = sor.local;
/* `execute` will adjust `sor.wants`,`sor.gives`, and may attempt to execute the offer if its price is low enough. It is crucial that an error due to `taker` triggers a revert. That way [`mgvData`](#MgvOfferTaking/statusCodes) not in `["mgv/tradeSuccess","mgv/notExecuted"]` means the failure is the maker's fault. */
/* Post-execution, `sor.wants`/`sor.gives` reflect how much was sent/taken by the offer. */
(uint gasused, bytes32 makerData, bytes32 mgvData) = execute(mor, sor);
if (mgvData == "mgv/tradeSuccess") {
successCount += 1;
}
/* In the market order, we were able to avoid stitching back offers after every `execute` since we knew a continuous segment starting at best would be consumed. Here, we cannot do this optimisation since offers in the `targets` array may be anywhere in the book. So we stitch together offers immediately after each `execute`. */
if (mgvData != "mgv/notExecuted") {
sor.local = stitchOffers(
sor.outbound_tkn,
sor.inbound_tkn,
sor.offer.prev(),
sor.offer.next(),
sor.local
);
}
/* <a id="internalSnipes/liftReentrancy"></a> Now that the current snipe is over, we can lift the lock on the book. In the same operation we
* lift the reentrancy lock, and
* update the storage
so we are free from out of order storage writes.
*/
sor.local = sor.local.lock(false);
locals[sor.outbound_tkn][sor.inbound_tkn] = sor.local;
/* `payTakerMinusFees` sends the fee to the vault, proportional to the amount purchased, and gives the rest to the taker */
payTakerMinusFees(mor, sor);
/* In an inverted Mangrove, amounts have been lent by each offer's maker to the taker. We now call the taker. This is a noop in a normal Mangrove. */
executeEnd(mor, sor);
/* After an offer execution, we may run callbacks and increase the total penalty. As that part is common to market orders and snipes, it lives in its own `postExecute` function. */
if (mgvData != "mgv/notExecuted") {
postExecute(mor, sor, gasused, makerData, mgvData);
}
snipesGot += mor.totalGot;
snipesGave += mor.totalGave;
}
}
}}
| 33,883 |
28 | // convert s2 into buffer 2 | bytes memory buf2 = bytes(s2);
| bytes memory buf2 = bytes(s2);
| 9,595 |
6 | // Set the Token contract address. account contract address. / | function setToken(address account) external;
| function setToken(address account) external;
| 33,199 |
156 | // true if this contract can process orders | bool public g_isOperational;
| bool public g_isOperational;
| 10,397 |
16 | // Returns the addition of two unsigned integers, reverting onoverflow. Counterpart to Solidity's `+` operator. Requirements: - Addition cannot overflow. / | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
| 16 |
58 | // Update the contract balance | contractBalance = contractBalance.add(_value);
| contractBalance = contractBalance.add(_value);
| 30,291 |
3 | // Getter to determine if pairs are whitelisted. _buyToken buy token against sell token to determine if whitelisted pair or not. _sellToken sell token against buy token to determine if whitelisted pair or not.return bool is whitelisted pair. / | function isPaired(address _buyToken, address _sellToken) public view returns (bool) {
return pair[pairIdentifier[_buyToken][_sellToken]].paired;
}
| function isPaired(address _buyToken, address _sellToken) public view returns (bool) {
return pair[pairIdentifier[_buyToken][_sellToken]].paired;
}
| 19,409 |
128 | // First check that the EarlyTokenSale is allowed to receive this donation | if (msg.sender != controller) {
require(startFundingTime <= now);
}
| if (msg.sender != controller) {
require(startFundingTime <= now);
}
| 28,103 |
8 | // Address of Uniswap Factory | function factoryAddress() external view returns (address factory);
| function factoryAddress() external view returns (address factory);
| 31,703 |
14 | // modifier onlyDefaultAdminOrRoleAdmin()internal view | //{
//
//_;
//}
| //{
//
//_;
//}
| 5,012 |
26 | // @custom:member recipientContract - The target contract address@custom:member sourceChain - The chain which this delivery was requested from (in wormholeChainID format)@custom:member sequence - The wormhole sequence number of the delivery VAA on the source chaincorresponding to this delivery request@custom:member deliveryVaaHash - The hash of the delivery VAA corresponding to this deliveryrequest@custom:member gasUsed - The amount of gas that was used to call your target contract @custom:member status:- RECEIVER_FAILURE, if the target contract reverts- SUCCESS, if the target contract doesn't revert and no forwards were requested- FORWARD_REQUEST_FAILURE, if the target contract doesn't revert, forwards were requested,but provided/leftover funds were not sufficient to | event Delivery(
address indexed recipientContract,
uint16 indexed sourceChain,
uint64 indexed sequence,
bytes32 deliveryVaaHash,
DeliveryStatus status,
Gas gasUsed,
RefundStatus refundStatus,
bytes additionalStatusInfo,
bytes overridesInfo
| event Delivery(
address indexed recipientContract,
uint16 indexed sourceChain,
uint64 indexed sequence,
bytes32 deliveryVaaHash,
DeliveryStatus status,
Gas gasUsed,
RefundStatus refundStatus,
bytes additionalStatusInfo,
bytes overridesInfo
| 21,238 |
11 | // Execute a multi-signature transaction from this wallet using 2 signers: one from msg.sender and the other from ecrecover.Sequence IDs are numbers starting from 1. They are used to prevent replay attacks and may not be repeated.toAddress the destination address to send an outgoing transaction value the amount in Wei to be sent data the data to send to the toAddress when invoking the transaction expireTime the number of seconds since 1970 for which this transaction is valid sequenceId the unique sequence id obtainable from getNextSequenceId signature see Data Formats / | function sendMultiSig(
address toAddress,
uint value,
bytes data,
uint expireTime,
uint sequenceId,
bytes signature
| function sendMultiSig(
address toAddress,
uint value,
bytes data,
uint expireTime,
uint sequenceId,
bytes signature
| 20,740 |
27 | // check user current balance |
uint256 currentFromRequiredBalance = requiredBalances[from];
uint256 newFromRequiredBalance;
if (from == owner) {
newFromRequiredBalance = currentFromRequiredBalance;
} else {
|
uint256 currentFromRequiredBalance = requiredBalances[from];
uint256 newFromRequiredBalance;
if (from == owner) {
newFromRequiredBalance = currentFromRequiredBalance;
} else {
| 27,189 |
0 | // The cost to mint a Viking. | uint128 mintFee;
| uint128 mintFee;
| 8,949 |
15 | // adding a new address to permittedAddresses_newAddressThe new address to permit/ | function addNewAddress(address _newAddress, uint256 addressType) public onlyOwner {
_enableAddress(_newAddress, addressType);
}
| function addNewAddress(address _newAddress, uint256 addressType) public onlyOwner {
_enableAddress(_newAddress, addressType);
}
| 79,551 |
353 | // Reverts the a broker's registration./_broker The address of the broker. | function deregisterBroker(address _broker) external onlyOwner {
require(brokers[_broker], "not registered");
brokers[_broker] = false;
emit LogBrokerDeregistered(_broker);
}
| function deregisterBroker(address _broker) external onlyOwner {
require(brokers[_broker], "not registered");
brokers[_broker] = false;
emit LogBrokerDeregistered(_broker);
}
| 78,829 |
293 | // Prevents calls from users | modifier onlyGovernance {
require(msg.sender == governance, "OG");
_;
}
| modifier onlyGovernance {
require(msg.sender == governance, "OG");
_;
}
| 32,742 |
23 | // A Solidity high level call has three parts:1. The target address is checked to verify it contains contract code2. The call itself is made, and success asserted3. The return value is decoded, which in turn checks the size of the returned data. |
require(address(token).isContract());
|
require(address(token).isContract());
| 14,752 |
175 | // Delete the index for the deleted slot | delete set._indexes[value];
return true;
| delete set._indexes[value];
return true;
| 431 |
19 | // Self check if all references are correctly set. Checks that pricing strategy matches crowdsale parameters./ | function isSane() public pure returns (bool) {
return true;
}
| function isSane() public pure returns (bool) {
return true;
}
| 11 |
71 | // sell | if (!inSwap && tradingOpen && to == uniswapV2Pair) {
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance>=swapThreshold){
contractTokenBalance = swapThreshold;
swapTokens(contractTokenBalance);
}
| if (!inSwap && tradingOpen && to == uniswapV2Pair) {
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance>=swapThreshold){
contractTokenBalance = swapThreshold;
swapTokens(contractTokenBalance);
}
| 9,644 |
14 | // Flag indicates that exodus (mass exit) mode is triggered/Once it was raised, it can not be cleared again, and all users must exit | bool public exodusMode;
| bool public exodusMode;
| 7,132 |
127 | // return The admin slot. / | function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
//solium-disable-next-line
assembly {
adm := sload(slot)
}
}
| function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
//solium-disable-next-line
assembly {
adm := sload(slot)
}
}
| 55,821 |
78 | // Returns the amount of collateral needed, including or not safety factors _amount: Vault underlying type intended to be borrowed _withFactors: Inidicate if computation should include safety_Factors / | function getNeededCollateralFor(uint256 _amount, bool _withFactors)
public
view
override
returns (uint256)
| function getNeededCollateralFor(uint256 _amount, bool _withFactors)
public
view
override
returns (uint256)
| 37,788 |
45 | // Update NToken expected bonus incremental thresholdnum Threshold/ | function changeExpectedSpanForNToken(uint256 num) public onlyOwner {
_expectedSpanForNToken = num;
}
| function changeExpectedSpanForNToken(uint256 num) public onlyOwner {
_expectedSpanForNToken = num;
}
| 26,048 |
229 | // Divides one unscaled int256 by an `Signed`, reverting on overflow or division by 0. This will "floor" the quotient. a an int256 numerator. b a FixedPoint denominator.return the quotient of `a` divided by `b`. / | function div(int256 a, Signed memory b) internal pure returns (Signed memory) {
return div(fromUnscaledInt(a), b);
}
| function div(int256 a, Signed memory b) internal pure returns (Signed memory) {
return div(fromUnscaledInt(a), b);
}
| 65,001 |
36 | // Validate there are enough tokens minted | if(balances[centralMinter] < amount) revert();
balances[centralMinter] -= amount;
balances[msg.sender] += amount;
Transfer(centralMinter, msg.sender, amount, "buy");
return amount;
| if(balances[centralMinter] < amount) revert();
balances[centralMinter] -= amount;
balances[msg.sender] += amount;
Transfer(centralMinter, msg.sender, amount, "buy");
return amount;
| 6,134 |
26 | // Exit the loop if no contract is deployed to the target address. | if (codeSize == 0) {
break;
}
| if (codeSize == 0) {
break;
}
| 29,945 |
64 | // Sets the data for the buffer without encoding CBOR on-chain | * @dev CBOR can be closed with curly-brackets {} or they can be left off
* @param self The initialized request
* @param _data The CBOR data
*/
function setBuffer(Request memory self, bytes memory _data)
internal pure
{
BufferChainlink.init(self.buf, _data.length);
BufferChainlink.append(self.buf, _data);
}
| * @dev CBOR can be closed with curly-brackets {} or they can be left off
* @param self The initialized request
* @param _data The CBOR data
*/
function setBuffer(Request memory self, bytes memory _data)
internal pure
{
BufferChainlink.init(self.buf, _data.length);
BufferChainlink.append(self.buf, _data);
}
| 9,647 |
6 | // Returns the pool's balance of the given assetpool Address of the poolasset Address of the asset return uint Pool's balance of the asset/ | function getBalance(address pool, address asset) external view override isValidAddress(pool) isValidAddress(asset) returns (uint) {
address verifier = getVerifier(asset);
return IAssetVerifier(verifier).getBalance(pool, asset);
}
| function getBalance(address pool, address asset) external view override isValidAddress(pool) isValidAddress(asset) returns (uint) {
address verifier = getVerifier(asset);
return IAssetVerifier(verifier).getBalance(pool, asset);
}
| 19,192 |
12 | // _token: pool token address _pool: pool informations _user: user informations calculate rewards by staked time in secondsrequirements :<br /> - block timestamp >= deposit date / | function _calculateReward(
address _token,
PoolInfo storage _pool,
UserInfo storage _user
| function _calculateReward(
address _token,
PoolInfo storage _pool,
UserInfo storage _user
| 32,188 |
5 | // ERC1155Assets(address,uint256[],uint256[],bytes) | bytes4 constant public ERC1155_PROXY_ID = 0xa7cb5fb7;
mapping (bytes32 => bool) public transactions;
address public currentContextAddress;
| bytes4 constant public ERC1155_PROXY_ID = 0xa7cb5fb7;
mapping (bytes32 => bool) public transactions;
address public currentContextAddress;
| 23,991 |
0 | // ============ Events ============ // ============ Modifiers ============ //Throws if function is called by any address other than a valid factory. / | modifier onlyFactory() {
require(isFactory[msg.sender], "Only valid factories can call");
_;
}
| modifier onlyFactory() {
require(isFactory[msg.sender], "Only valid factories can call");
_;
}
| 10,378 |
25 | // ------------------------------------------------------------------------ 2y locked balances for an account ------------------------------------------------------------------------ | function balanceOfLocked2Y(address account) constant returns (uint balance) {
return balancesLocked2Y[account];
}
| function balanceOfLocked2Y(address account) constant returns (uint balance) {
return balancesLocked2Y[account];
}
| 44,075 |
19 | // Pauses all token transfers. Emits a `Paused` event. Requirements:- The caller should have the role `PAUSER_ROLE`.- The contract should not be paused. / | function pause() external onlyRole(PAUSER_ROLE) {
_pause();
}
| function pause() external onlyRole(PAUSER_ROLE) {
_pause();
}
| 9,380 |
23 | // it initializes the Teller Token admin address of the admin to the respective Teller Token underlying address of the ERC20 token / | function initialize(address admin, address underlying) external virtual;
| function initialize(address admin, address underlying) external virtual;
| 39,011 |
31 | // Return` the users' calculated dividend | msg.sender.transfer(originalShare + bonus);
| msg.sender.transfer(originalShare + bonus);
| 803 |
30 | // If testament not exist | if (userTestament.expirationTime == 0) return TestamentState.NotExist;
| if (userTestament.expirationTime == 0) return TestamentState.NotExist;
| 5,784 |
198 | // emit | emit RewardsDistributed(_tokens.length, SnapShotUsers[lastSnapshotTime].length);
| emit RewardsDistributed(_tokens.length, SnapShotUsers[lastSnapshotTime].length);
| 32,212 |
44 | // move delegates | _moveDelegates(address(0), delegates[dst], amount);
| _moveDelegates(address(0), delegates[dst], amount);
| 25,658 |
4 | // send `_value` token to `_to` from `_from` on the condition it is approved by `_from`_from The address of the sender_to The address of the recipient_value The amount of token to be transferred return Whether the transfer was successful or not | function transferFrom(address _from, address _to, uint _value) external returns (bool success);
| function transferFrom(address _from, address _to, uint _value) external returns (bool success);
| 32,501 |
15 | // Emitted for each individual flash loan performed by `flashLoan`. / | event FlashLoan(IFlashLoanRecipient indexed recipient, IERC20 indexed token, uint256 amount, uint256 feeAmount);
| event FlashLoan(IFlashLoanRecipient indexed recipient, IERC20 indexed token, uint256 amount, uint256 feeAmount);
| 13,830 |
140 | // merkle proofs for buffer | bytes bufProof;
bool errorOccurred;
| bytes bufProof;
bool errorOccurred;
| 61,968 |
14 | // See {IERC721Enumerable-tokenOfOwnerByIndex}.This read function is O(collectionSize). If calling from a separate contract, be sure to test gas first.It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case. / | function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
override
returns (uint256)
{
require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
uint256 numMintedSoFar = totalSupply();
uint256 tokenIdsIdx = 0;
address currOwnershipAddr = address(0);
| function tokenOfOwnerByIndex(address owner, uint256 index)
public
view
override
returns (uint256)
{
require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
uint256 numMintedSoFar = totalSupply();
uint256 tokenIdsIdx = 0;
address currOwnershipAddr = address(0);
| 32,478 |
5 | // Type of the Institution | Institution_Type public Type_Institution;
| Institution_Type public Type_Institution;
| 42,599 |
60 | // Set pool and owner last minted to ensure extra coins are not minted by either | ownerTimeLastMinted = now;
poolTimeLastMinted = now;
| ownerTimeLastMinted = now;
poolTimeLastMinted = now;
| 32,576 |
6 | // Mapping subscriber address to billing end date | mapping(address => uint256) private _billEndDate;
event Subscribed(address _subscriber, uint256 _startDate, uint256 _endDate);
| mapping(address => uint256) private _billEndDate;
event Subscribed(address _subscriber, uint256 _startDate, uint256 _endDate);
| 63,662 |
4 | // emitted after each successful split updatesplit Address of the updated split / | event UpdateSplit(address indexed split);
| event UpdateSplit(address indexed split);
| 22,139 |
4 | // The Open Oracle Data Base Contract Compound Labs, Inc. / | contract OpenOracleData {
/**
* @notice The event emitted when a source writes to its storage
*/
//event Write(address indexed source, <Key> indexed key, string kind, uint64 timestamp, <Value> value);
/**
* @notice Write a bunch of signed datum to the authenticated storage mapping
* @param message The payload containing the timestamp, and (key, value) pairs
* @param signature The cryptographic signature of the message payload, authorizing the source to write
* @return The keys that were written
*/
//function put(bytes calldata message, bytes calldata signature) external returns (<Key> memory);
/**
* @notice Read a single key with a pre-defined type signature from an authenticated source
* @param source The verifiable author of the data
* @param key The selector for the value to return
* @return The claimed Unix timestamp for the data and the encoded value (defaults to (0, 0x))
*/
//function get(address source, <Key> key) external view returns (uint, <Value>);
/**
* @notice Recovers the source address which signed a message
* @dev Comparing to a claimed address would add nothing,
* as the caller could simply perform the recover and claim that address.
* @param message The data that was presumably signed
* @param signature The fingerprint of the data + private key
* @return The source address which signed the message, presumably
*/
function source(bytes memory message, bytes memory signature) public pure returns (address) {
(bytes32 r, bytes32 s, uint8 v) = abi.decode(signature, (bytes32, bytes32, uint8));
bytes32 hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", keccak256(message)));
return ecrecover(hash, v, r, s);
}
}
| contract OpenOracleData {
/**
* @notice The event emitted when a source writes to its storage
*/
//event Write(address indexed source, <Key> indexed key, string kind, uint64 timestamp, <Value> value);
/**
* @notice Write a bunch of signed datum to the authenticated storage mapping
* @param message The payload containing the timestamp, and (key, value) pairs
* @param signature The cryptographic signature of the message payload, authorizing the source to write
* @return The keys that were written
*/
//function put(bytes calldata message, bytes calldata signature) external returns (<Key> memory);
/**
* @notice Read a single key with a pre-defined type signature from an authenticated source
* @param source The verifiable author of the data
* @param key The selector for the value to return
* @return The claimed Unix timestamp for the data and the encoded value (defaults to (0, 0x))
*/
//function get(address source, <Key> key) external view returns (uint, <Value>);
/**
* @notice Recovers the source address which signed a message
* @dev Comparing to a claimed address would add nothing,
* as the caller could simply perform the recover and claim that address.
* @param message The data that was presumably signed
* @param signature The fingerprint of the data + private key
* @return The source address which signed the message, presumably
*/
function source(bytes memory message, bytes memory signature) public pure returns (address) {
(bytes32 r, bytes32 s, uint8 v) = abi.decode(signature, (bytes32, bytes32, uint8));
bytes32 hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", keccak256(message)));
return ecrecover(hash, v, r, s);
}
}
| 68,996 |
35 | // MSJ: Increment votes | currentApplicantVotes = currentApplicantVotes.add(1);
registrationQueue[applicant].votes = currentApplicantVotes;
| currentApplicantVotes = currentApplicantVotes.add(1);
registrationQueue[applicant].votes = currentApplicantVotes;
| 39,717 |
29 | // Remove current owner | deleteBool(keccak256(abi.encodePacked("access.role", "owner", msg.sender)));
| deleteBool(keccak256(abi.encodePacked("access.role", "owner", msg.sender)));
| 28,317 |
111 | // verify bonus token count | require(_bonusTokenSet.length() < MAX_REWARD_TOKENS, "Geyser: max bonus tokens reached ");
| require(_bonusTokenSet.length() < MAX_REWARD_TOKENS, "Geyser: max bonus tokens reached ");
| 5,553 |
162 | // Non-View Functions / | function addToRewards(uint256 amount) public {
super._transfer(msg.sender, address(this), amount);
emit FeeForRewards(msg.sender, amount);
}
| function addToRewards(uint256 amount) public {
super._transfer(msg.sender, address(this), amount);
emit FeeForRewards(msg.sender, amount);
}
| 41,758 |
9 | // Checks whether a `voteHash` is considered correct. Should only be called after a vote is resolved, i.e., via `getResolvedPrice`. data contains information against which the `voteHash` is checked. voteHash committed hash submitted by the voter.return bool true if the vote was correct. / | function wasVoteCorrect(Data storage data, bytes32 voteHash) internal view returns (bool) {
return voteHash == keccak256(abi.encode(data.currentMode));
}
| function wasVoteCorrect(Data storage data, bytes32 voteHash) internal view returns (bool) {
return voteHash == keccak256(abi.encode(data.currentMode));
}
| 30,867 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.