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 |
|---|---|---|---|---|
0 | // Token addresses | address public matic_near_lp = 0x8298B8C863c2213B9698A08de009cC0aB0F87FEe;
address public matic = 0x6aB6d61428fde76768D7b45D8BFeec19c6eF91A8;
constructor(
address _governance,
address _strategist,
address _controller,
address _timelock
)
public
| address public matic_near_lp = 0x8298B8C863c2213B9698A08de009cC0aB0F87FEe;
address public matic = 0x6aB6d61428fde76768D7b45D8BFeec19c6eF91A8;
constructor(
address _governance,
address _strategist,
address _controller,
address _timelock
)
public
| 2,815 |
97 | // To paga usando NFTK y se le envia el NFT | function buyNFTWithNFTK(address _to, string memory _cid, uint256 _account) public {
NFTMetadata memory _obj = indexOfCid[_cid];
//Se valida:
// El NFT no este bloqueado para la venta (status), que el contrato no este pausado (pause)
// El detinatario (_to) es el sender de la TX qu... | function buyNFTWithNFTK(address _to, string memory _cid, uint256 _account) public {
NFTMetadata memory _obj = indexOfCid[_cid];
//Se valida:
// El NFT no este bloqueado para la venta (status), que el contrato no este pausado (pause)
// El detinatario (_to) es el sender de la TX qu... | 30,568 |
118 | // return Amount of pairs./ | function getPairCount()
public
view
returns(uint256)
| function getPairCount()
public
view
returns(uint256)
| 28,642 |
11 | // Returns the number of MCV2 pools. | function poolLength() public view returns (uint256 pools) {
pools = poolIds.length;
}
| function poolLength() public view returns (uint256 pools) {
pools = poolIds.length;
}
| 12,219 |
365 | // Back fill missing weeks | for (uint256 i = lastRewardWeek+1; i <= currentWeek; i++) {
Weights storage weights = weeklyWeightPoints[i];
weights.genesisWtPoints = gW;
weights.parentWtPoints = pW;
weights.lpWeightPoints = mW;
}
| for (uint256 i = lastRewardWeek+1; i <= currentWeek; i++) {
Weights storage weights = weeklyWeightPoints[i];
weights.genesisWtPoints = gW;
weights.parentWtPoints = pW;
weights.lpWeightPoints = mW;
}
| 10,725 |
58 | // get the amount of the actual base rewards that were claimed | providerRewards.baseRewardsDebt = _removeMultiplier(fullReward.sub(maxAmount), multiplier);
| providerRewards.baseRewardsDebt = _removeMultiplier(fullReward.sub(maxAmount), multiplier);
| 23,586 |
47 | // Emitted when funds have been deposited to Rari Eth Pool. / | event Deposit(address indexed sender, address indexed payee, uint256 amount, uint256 reptMinted);
| event Deposit(address indexed sender, address indexed payee, uint256 amount, uint256 reptMinted);
| 30,657 |
123 | // balance should be greater than 0 | require(balance > 0);
| require(balance > 0);
| 31,740 |
3 | // send '_value' token to '_to' from 'msg.sender'/_to The address of the recipient/_value The amount of token to be transferred/ return Whether the transfer was successful or not | function transfer(address _to, uint256 _value) public returns (bool success);
| function transfer(address _to, uint256 _value) public returns (bool success);
| 17,035 |
22 | // Begin with the first node in the list | uint256 n = 0;
address nextItem = _start;
if (nextItem == address(0)) {
nextItem = begin(self);
}
| uint256 n = 0;
address nextItem = _start;
if (nextItem == address(0)) {
nextItem = begin(self);
}
| 43,234 |
61 | // 3. refund the rest(abount 10% of the pond) to the platform if the player is the last to refund | rounds[curRoundID].count -= count;
if (rounds[curRoundID].count == 0)
{
uint256 last = rounds[curRoundID].pond;
platform.transfer(last);
rounds[curRoundID].pond = 0;
emit onLastRefund(msg.sender, block.timestamp, platform, last);
}
| rounds[curRoundID].count -= count;
if (rounds[curRoundID].count == 0)
{
uint256 last = rounds[curRoundID].pond;
platform.transfer(last);
rounds[curRoundID].pond = 0;
emit onLastRefund(msg.sender, block.timestamp, platform, last);
}
| 16,238 |
72 | // check that user address is not empty | require(user != address(0), "ADDRESS_ZERO");
| require(user != address(0), "ADDRESS_ZERO");
| 52,939 |
92 | // invalid order marginSplitPercentage | require(order.validSince <= block.timestamp); // order is too early to match
require(order.validUntil > block.timestamp); // order is expired
| require(order.validSince <= block.timestamp); // order is too early to match
require(order.validUntil > block.timestamp); // order is expired
| 25,174 |
11 | // Specify the Path for the swap, from this token to WETH | address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // Accept any amount of ETH
path,
msg.sender, // Send E... | address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // Accept any amount of ETH
path,
msg.sender, // Send E... | 15,011 |
9 | // Adjust the SEPA token price SEPAperETH the amount of SEPA a user receives for 1 ETH / | function adjustPrice(uint SEPAperETH) external onlyOwner {
emit priceAdjusted(SEPAPrice, SEPAperETH) ;
SEPAPrice = SEPAperETH ;
}
| function adjustPrice(uint SEPAperETH) external onlyOwner {
emit priceAdjusted(SEPAPrice, SEPAperETH) ;
SEPAPrice = SEPAperETH ;
}
| 19,297 |
53 | // Leaves the contract without owner. It will not be possible to call`onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner,thereby removing any functionality that is only available to the owner. / | function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| 202 |
11 | // Calls `finalize()` on the market adapter, which will claim the NFT/ (if necessary) if we won, or recover our bid (if necessary)/ if the crowfund expired and we lost the current auction. If we/ lost but the crowdfund has not expired, this will revert. Only/ call this to finalize the result of a won or expired crowdfu... | function finalize(
FixedGovernanceOpts memory governanceOpts,
ProposalStorage.ProposalEngineOpts memory proposalEngineOpts
| function finalize(
FixedGovernanceOpts memory governanceOpts,
ProposalStorage.ProposalEngineOpts memory proposalEngineOpts
| 40,685 |
124 | // LastCumulativeGlobalHoldersPrice | function setLastCumulativeGlobalHoldersPrice(
address _property,
address _user,
uint256 _value
| function setLastCumulativeGlobalHoldersPrice(
address _property,
address _user,
uint256 _value
| 49,327 |
13 | // ========== MANAGERIAL FUNCTIONS ========== // takes inventory of all tracked assets always consolidate to recognized reserves before audit / | function auditReserves() external onlyGovernor {
uint256 reserves;
address[] memory reserveToken = registry[STATUS.RESERVETOKEN];
for (uint256 i = 0; i < reserveToken.length; i++) {
if (permissions[STATUS.RESERVETOKEN][reserveToken[i]]) {
reserves = reserves.add(t... | function auditReserves() external onlyGovernor {
uint256 reserves;
address[] memory reserveToken = registry[STATUS.RESERVETOKEN];
for (uint256 i = 0; i < reserveToken.length; i++) {
if (permissions[STATUS.RESERVETOKEN][reserveToken[i]]) {
reserves = reserves.add(t... | 21,024 |
66 | // Transfer the lifTokens to booking | lifToken.transferFrom(msg.sender, address(this), lifTokenAllowance);
| lifToken.transferFrom(msg.sender, address(this), lifTokenAllowance);
| 58,796 |
139 | // exec hybridSwap | amounts = new uint[](path.length);
amounts[0] = amountIn;
_hybridSwap(path, dexes, amounts, to, rewardTo);
| amounts = new uint[](path.length);
amounts[0] = amountIn;
_hybridSwap(path, dexes, amounts, to, rewardTo);
| 15,525 |
165 | // Burn tickets when you join / | function _handleJoinBurn(address addr, uint256 _amount) internal {
uint256 burnUsdt = _amount.mul(12).div(100);
uint256 burnAmount = burnUsdt.mul(ticket.price()).div(usdter);
uint256 bal = ticket.balanceOf(addr);
if (bal >= burnAmount) {
ticket.burnFromUsdt(addr, burnUsd... | function _handleJoinBurn(address addr, uint256 _amount) internal {
uint256 burnUsdt = _amount.mul(12).div(100);
uint256 burnAmount = burnUsdt.mul(ticket.price()).div(usdter);
uint256 bal = ticket.balanceOf(addr);
if (bal >= burnAmount) {
ticket.burnFromUsdt(addr, burnUsd... | 2,521 |
31 | // Increase the amount owed to this address | creditRemaining[msg.sender] += amountCredited;
| creditRemaining[msg.sender] += amountCredited;
| 78,057 |
69 | // Reassign ownership, clear pending approvals, emit Transfer event. | _transfer(msg.sender, _to, _tokenId);
| _transfer(msg.sender, _to, _tokenId);
| 18,519 |
1 | // solhint-disable-next-linefunc-name-mixedcase | function __WheelcoinRoles_init() internal onlyInitializing {
AccessControlUpgradeable.__AccessControl_init();
__WheelcoinRoles_init_unchained();
}
| function __WheelcoinRoles_init() internal onlyInitializing {
AccessControlUpgradeable.__AccessControl_init();
__WheelcoinRoles_init_unchained();
}
| 21,323 |
26 | // Returns the number of votes cast on the proposal over the total numberof votes in the network as a fraction. proposal The proposal struct.return The participation of the proposal. / | function getParticipation(Proposal storage proposal)
internal
view
returns (FixidityLib.Fraction memory)
| function getParticipation(Proposal storage proposal)
internal
view
returns (FixidityLib.Fraction memory)
| 37,029 |
505 | // Assign a tokenID and store the token | ExchangeData.Token memory token = ExchangeData.Token(
tokenAddress
);
tokenID = uint16(S.tokens.length);
S.tokens.push(token);
S.tokenToTokenId[tokenAddress] = tokenID + 1;
emit TokenRegistered(tokenAddress, tokenID);
| ExchangeData.Token memory token = ExchangeData.Token(
tokenAddress
);
tokenID = uint16(S.tokens.length);
S.tokens.push(token);
S.tokenToTokenId[tokenAddress] = tokenID + 1;
emit TokenRegistered(tokenAddress, tokenID);
| 44,139 |
82 | // get milestone policy information. _policy index of milestone policy. / | function getPolicy(uint8 _policy) public
view
returns (uint256 kickOff, uint256[] periods, uint8[] percentages)
| function getPolicy(uint8 _policy) public
view
returns (uint256 kickOff, uint256[] periods, uint8[] percentages)
| 4,767 |
109 | // Custom logic in here for how much the vault allows to be borrowed Sets minimum required on-hand to keep small withdrawals cheap | function available() public view returns (uint) {
return valueToken.balanceOf(address(this)).mul(fundCap).div(FUND_CAP_DENOMINATOR);
}
| function available() public view returns (uint) {
return valueToken.balanceOf(address(this)).mul(fundCap).div(FUND_CAP_DENOMINATOR);
}
| 11,151 |
180 | // change uri for hidden image | function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner {
notRevealedUri = _notRevealedURI;
}
| function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner {
notRevealedUri = _notRevealedURI;
}
| 34,608 |
1,209 | // Set the first byte equal to `1` to indicate this is a sequencer chain element. This distinguishes sequencer ChainElements from queue ChainElements because all queue ChainElements are ABI encoded and the first byte of ABI encoded elements is always zero | mstore8(chainElementStart, 1)
mstore(add(chainElementStart, 1), ctxTimestamp)
mstore(add(chainElementStart, 33), ctxBlockNumber)
| mstore8(chainElementStart, 1)
mstore(add(chainElementStart, 1), ctxTimestamp)
mstore(add(chainElementStart, 33), ctxBlockNumber)
| 57,130 |
8 | // The Pool needs to increase the main token balance, so we prepare a swap where we provide the missing main token amount in exchange for wrapped tokens, that is, the main token is the token in. Since we know this amount, this is a 'given in' swap. | IVault.SingleSwap memory swap = IVault.SingleSwap({
poolId: _poolId,
kind: IVault.SwapKind.GIVEN_IN,
assetIn: IAsset(address(_mainToken)),
assetOut: IAsset(address(_wrappedToken)),
amount: missingMainAmount,
userData: ""
});
| IVault.SingleSwap memory swap = IVault.SingleSwap({
poolId: _poolId,
kind: IVault.SwapKind.GIVEN_IN,
assetIn: IAsset(address(_mainToken)),
assetOut: IAsset(address(_wrappedToken)),
amount: missingMainAmount,
userData: ""
});
| 11,969 |
4 | // modifier to ensure a function is callable only by its owner | modifier ownerOnly(uint256 diceId) {
require(dices[diceId].owner == msg.sender, "This function is only callable by owner");
_;
}
| modifier ownerOnly(uint256 diceId) {
require(dices[diceId].owner == msg.sender, "This function is only callable by owner");
_;
}
| 47,445 |
223 | // Get the correct price for the mint for qty and person minting_count amount of tokens to calc for mint_to the address which will be minting these tokens, passed explicitly/ | function getPrice(uint256 _count, address _to) public view returns (uint256) {
if(_count == 0) revert ValueCannotBeZero();
// short circuit function if we dont need to even calc incentive pricing
// short circuit if the current wallet mint qty is also already over cap
if(
usingEarlyMintIncentiv... | function getPrice(uint256 _count, address _to) public view returns (uint256) {
if(_count == 0) revert ValueCannotBeZero();
// short circuit function if we dont need to even calc incentive pricing
// short circuit if the current wallet mint qty is also already over cap
if(
usingEarlyMintIncentiv... | 38,276 |
6 | // each PASS minting transaction by depositing collateral erc20 tokens will create a new erc1155 token id sequentially_balance: number of PASSes user want to mint_amount: the maximum deposited amount set by the user_maxPriceFistNFT: the maximum price for the first mintable PASS to prevent front-running with least gas c... | function mint(
uint256 _balance,
uint256 _amount,
uint256 _maxPriceFirstPASS
| function mint(
uint256 _balance,
uint256 _amount,
uint256 _maxPriceFirstPASS
| 64,991 |
4 | // Limits of mystery boxes | mapping(uint256=>uint16) private _mysteryBoxesLimit;
| mapping(uint256=>uint16) private _mysteryBoxesLimit;
| 20,469 |
37 | // Invest function. Provides functionality for person to invest in someone's project, incentivized by the return of interest./ | function lend(address investorAddress) public canInvest payable {
uint extraMoney = 0;
uint balance = address(this).balance;
if (address(this).balance >= requestedAmount) {
extraMoney = address(this).balance.sub(requestedAmount);
assert(requestedAmount == address(... | function lend(address investorAddress) public canInvest payable {
uint extraMoney = 0;
uint balance = address(this).balance;
if (address(this).balance >= requestedAmount) {
extraMoney = address(this).balance.sub(requestedAmount);
assert(requestedAmount == address(... | 45,047 |
80 | // inform the smart contract that a particular order needs to update its parameters order_id the id of the order to be updated _reserveIndex the index of the AMM ReserveSnapshotted array with the local price maximum/minimum The purpose of this function is to incentivise/reward bots that will update the stop/limit price... | function pokeContract(
uint order_id,
uint _reserveIndex
| function pokeContract(
uint order_id,
uint _reserveIndex
| 8,921 |
19 | // Delegate votes from `msg.sender` to `delegatee` delegatee The address to delegate votes to / | function delegate(address delegatee) external;
| function delegate(address delegatee) external;
| 33,063 |
6 | // The XTT TOKEN! | IBEP20 public xtt;
| IBEP20 public xtt;
| 2,692 |
3 | // Handle an incoming funds transfer, ensuring the sent amount is valid and the sender is solvent/_amount The amount to be received/_currency The currency to receive funds in, or address(0) for ETH | function _handleIncomingTransfer(uint256 _amount, address _currency) internal {
if (_currency == address(0)) {
require(msg.value >= _amount, "_handleIncomingTransfer msg value less than expected amount");
} else {
// We must check the balance that was actually transferred to ... | function _handleIncomingTransfer(uint256 _amount, address _currency) internal {
if (_currency == address(0)) {
require(msg.value >= _amount, "_handleIncomingTransfer msg value less than expected amount");
} else {
// We must check the balance that was actually transferred to ... | 41,990 |
156 | // The NOOM TOKEN! | NoomToken public noom;
| NoomToken public noom;
| 15,981 |
151 | // Clear token owner | ownStorage.setTokenOwner(_tokenId, 0);
removeFromTokenIds(ownStorage, _tokenId);
removeFromOwnedToken(ownStorage, _from, _tokenId);
| ownStorage.setTokenOwner(_tokenId, 0);
removeFromTokenIds(ownStorage, _tokenId);
removeFromOwnedToken(ownStorage, _from, _tokenId);
| 41,430 |
28 | // (uint amountToken, uint amountETH, uint liquidity) = | uniswapRouterAddress.call.value(ethLiquidityAmount)(data);
(fuseReserve, ethReserve, blockTimestampLast) = fuseETHPair.getReserves();
uint256 fuseBuyinAmount = uniswapRouter.getAmountOut(ethBuyinAmount, ethReserve, fuseReserve);
data = abi.encodeWithSignature(
"swapTokensForExactETH(uint,uint,ad... | uniswapRouterAddress.call.value(ethLiquidityAmount)(data);
(fuseReserve, ethReserve, blockTimestampLast) = fuseETHPair.getReserves();
uint256 fuseBuyinAmount = uniswapRouter.getAmountOut(ethBuyinAmount, ethReserve, fuseReserve);
data = abi.encodeWithSignature(
"swapTokensForExactETH(uint,uint,ad... | 39,516 |
295 | // The hash of the name parameter for the EIP712 domain. NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costsare a concern. / | function _EIP712NameHash() internal virtual view returns (bytes32) {
return _HASHED_NAME;
}
| function _EIP712NameHash() internal virtual view returns (bytes32) {
return _HASHED_NAME;
}
| 13,101 |
102 | // Delegates votes from signatory to `delegatee` delegatee The address to delegate votes to nonce The contract state required to match the signature expiry The time at which to expire the signature v The recovery byte of the signature r Half of the ECDSA signature pair s Half of the ECDSA signature pair / | function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
| function delegateBySig(
address delegatee,
uint nonce,
uint expiry,
uint8 v,
bytes32 r,
bytes32 s
)
external
| 3,630 |
7 | // If execution is halted, mark subsequent opcodes unreachable. | if (
op == 254 || // invalid
op == 243 || // return
op == 253 || // revert
op == 86 || // jump
op == 0 // stop
) {
reachable = false;
continue... | if (
op == 254 || // invalid
op == 243 || // return
op == 253 || // revert
op == 86 || // jump
op == 0 // stop
) {
reachable = false;
continue... | 23,939 |
6 | // returns amount of documents / title / email | function getAuthorDocuments(string author,uint256 index) view public returns(uint256,string,string,uint) {
string[] documentsForAuthor = authorDocuments[author];
if (documentsForAuthor.length == 0) {
return (0,"","",0);
} else {
Document memory doc = documents[documen... | function getAuthorDocuments(string author,uint256 index) view public returns(uint256,string,string,uint) {
string[] documentsForAuthor = authorDocuments[author];
if (documentsForAuthor.length == 0) {
return (0,"","",0);
} else {
Document memory doc = documents[documen... | 10,732 |
41 | // rate Number of token units a buyer gets per wei wallet Address where collected funds will be forwarded to token Address of the token being sold / | constructor(uint256 rate, address payable wallet, IERC20 token, address initialOwner, address MPBSAddr) public Ownable(initialOwner) {
require(rate != 0, "Rate is 0");
require(wallet != address(0), "Wallet is the zero address");
require(address(token) != address(0), "Token is the zero addres... | constructor(uint256 rate, address payable wallet, IERC20 token, address initialOwner, address MPBSAddr) public Ownable(initialOwner) {
require(rate != 0, "Rate is 0");
require(wallet != address(0), "Wallet is the zero address");
require(address(token) != address(0), "Token is the zero addres... | 19,671 |
67 | // check if the tokens being added to the pool are permitted to be addedtokenIds_ the token ids to check permitterData_ data to pass to permitter for determining validity (e.g. merkle proofs) / | function _checkPermittedTokens(
uint256[] calldata tokenIds_,
bytes calldata permitterData_
| function _checkPermittedTokens(
uint256[] calldata tokenIds_,
bytes calldata permitterData_
| 21,644 |
74 | // tick to increase holdings / | function tick(bool sync) public {
uint _current = block.number;
uint _diff = _current.sub(lastTick);
if (_diff > 0) {
lastTick = _current;
_diff = balances[address(pool)].mul(_diff).div(DURATION); // 1% every 7000 blocks
uint _minting... | function tick(bool sync) public {
uint _current = block.number;
uint _diff = _current.sub(lastTick);
if (_diff > 0) {
lastTick = _current;
_diff = balances[address(pool)].mul(_diff).div(DURATION); // 1% every 7000 blocks
uint _minting... | 79,515 |
82 | // {wbnb} - Required for liquidity routing when doing swaps.{cake} - Token generated by staking our funds. In this case it's the CAKEs token.{eth} - Required for liquidity routing into beth asset.{eleven} - ElevenFinance token, used to send funds to the treasury.{lpPair} - Token that the strategy maximizes. The same to... | address constant public wbnb = address(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
address constant public cake = address(0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82);
address constant public eth = address(0x2170Ed0880ac9A755fd29B2688956BD959F933F8);
address constant public eleven = address(0xb8005Dc9a8... | address constant public wbnb = address(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
address constant public cake = address(0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82);
address constant public eth = address(0x2170Ed0880ac9A755fd29B2688956BD959F933F8);
address constant public eleven = address(0xb8005Dc9a8... | 15,968 |
15 | // mint nft with tokens | function purchaseNFT() public {
require(mintEnabled, "!m");
require(TokenInterface(tokenAddress).allowance(msg.sender, address(this)) >= nftPrice, "!a");
require(TokenInterface(tokenAddress).balanceOf(msg.sender) >= nftPrice, "!b");
TokenInterface(tokenAddress).burn(msg.send... | function purchaseNFT() public {
require(mintEnabled, "!m");
require(TokenInterface(tokenAddress).allowance(msg.sender, address(this)) >= nftPrice, "!a");
require(TokenInterface(tokenAddress).balanceOf(msg.sender) >= nftPrice, "!b");
TokenInterface(tokenAddress).burn(msg.send... | 19,800 |
16 | // after every bonus claim, a user has to wait some time before they can claim again/delay time delay until next claim is possible | function setClaimDelay(uint256 delay) external onlyOwner {
claimDelay = delay;
emit LogNewClaimDelay(delay);
}
| function setClaimDelay(uint256 delay) external onlyOwner {
claimDelay = delay;
emit LogNewClaimDelay(delay);
}
| 25,238 |
36 | // We do NOT currently support unbalanced update, i.e., EXACT_TOKENS_IN_FOR_BPT_OUT or TOKEN_IN_FOR_EXACT_BPT_OUT | if (kind == BaseWeightedPool.JoinKind.ALL_TOKENS_IN_FOR_EXACT_BPT_OUT) {
(bptAmountOut, amountsIn) = _joinAllTokensInForExactBPTOut(balances, userData);
} else {
| if (kind == BaseWeightedPool.JoinKind.ALL_TOKENS_IN_FOR_EXACT_BPT_OUT) {
(bptAmountOut, amountsIn) = _joinAllTokensInForExactBPTOut(balances, userData);
} else {
| 17,811 |
78 | // Some simple ABIv1 getters below | function isUnlocked(string memory tg_user_chan, bool _isChannel) external view returns(bool) {
if (_isChannel) {
return unlockedChannels[tg_user_chan].unlocked;
}
return unlockedUsers[tg_user_chan].unlocked;
}
| function isUnlocked(string memory tg_user_chan, bool _isChannel) external view returns(bool) {
if (_isChannel) {
return unlockedChannels[tg_user_chan].unlocked;
}
return unlockedUsers[tg_user_chan].unlocked;
}
| 4,141 |
0 | // event reporting the infected user's presence history hash and its timestamp | event newHistoryInserted(bytes32 indexed pseudonymHash, bytes32 presenceHistoryHash, uint timestamp);
| event newHistoryInserted(bytes32 indexed pseudonymHash, bytes32 presenceHistoryHash, uint timestamp);
| 12,351 |
3 | // return "amirali"; return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; | return bytes(baseURI).length > 0 ? string(baseURI) : "";
| return bytes(baseURI).length > 0 ? string(baseURI) : "";
| 26,342 |
37 | // Vesting Mechanism | function enrollInVesting(uint256 amount) external {
require(amount <= MAX_VESTING_AMOUNT, "Exceeds max vesting amount");
require(vestingBeneficiaries[msg.sender].totalAmount == 0, "Already enrolled");
_transfer(msg.sender, address(this), amount);
vestingBeneficiaries[msg.sender] = Ve... | function enrollInVesting(uint256 amount) external {
require(amount <= MAX_VESTING_AMOUNT, "Exceeds max vesting amount");
require(vestingBeneficiaries[msg.sender].totalAmount == 0, "Already enrolled");
_transfer(msg.sender, address(this), amount);
vestingBeneficiaries[msg.sender] = Ve... | 35,032 |
45 | // Emit claim event | emit SlotsClaimed(_buyer, _numSlots);
| emit SlotsClaimed(_buyer, _numSlots);
| 21,863 |
75 | // Registers a subdomain. label The label hash of the domain to register a subdomain of. subdomain The desired subdomain label. _subdomainOwner The account that should own the newly configured subdomain. / | function register(bytes32 label, string calldata subdomain, address _subdomainOwner, address payable referrer, address resolver) external not_stopped payable {
address subdomainOwner = _subdomainOwner;
bytes32 domainNode = keccak256(abi.encodePacked(TLD_NODE, label));
bytes32 subdomainLabel ... | function register(bytes32 label, string calldata subdomain, address _subdomainOwner, address payable referrer, address resolver) external not_stopped payable {
address subdomainOwner = _subdomainOwner;
bytes32 domainNode = keccak256(abi.encodePacked(TLD_NODE, label));
bytes32 subdomainLabel ... | 48,980 |
20 | // transfer erc1155 to winner | IERC1155(token).safeTransferFrom(address(this), winning, id, 1, new bytes(0x0));
uint256 balance = address(this).balance;
uint256 hausFee = balance.div(20).mul(3);
haus.transfer(hausFee);
seller.transfer(address(this).balance);
ended = true;
emit Won(winning, l... | IERC1155(token).safeTransferFrom(address(this), winning, id, 1, new bytes(0x0));
uint256 balance = address(this).balance;
uint256 hausFee = balance.div(20).mul(3);
haus.transfer(hausFee);
seller.transfer(address(this).balance);
ended = true;
emit Won(winning, l... | 31,200 |
0 | // Store CandidateRead candidate | string public candidate;
| string public candidate;
| 14,452 |
0 | // The initialized flag | Uint256Storage private constant _version = Uint256Storage.wrap(keccak256("equilibria.root.UInitializable.version"));
| Uint256Storage private constant _version = Uint256Storage.wrap(keccak256("equilibria.root.UInitializable.version"));
| 21,597 |
7 | // Emitted when a feed address is set for an asset. / | event AssetEthFeedSet(address indexed asset, address indexed feed);
| event AssetEthFeedSet(address indexed asset, address indexed feed);
| 45,240 |
155 | // ERC1155PausableCollections / |
modifier whenIdPaused(uint256 id) {
require(idPaused(id));
_;
}
|
modifier whenIdPaused(uint256 id) {
require(idPaused(id));
_;
}
| 37,298 |
4 | // Single owner function access control module. | abstract contract LexOwnable {
event TransferOwner(address indexed from, address indexed to);
event TransferOwnerClaim(address indexed from, address indexed to);
address public owner;
address public pendingOwner;
/// @notice Initialize ownership module for function access control.
/// @par... | abstract contract LexOwnable {
event TransferOwner(address indexed from, address indexed to);
event TransferOwnerClaim(address indexed from, address indexed to);
address public owner;
address public pendingOwner;
/// @notice Initialize ownership module for function access control.
/// @par... | 22,723 |
4 | // Validate pool by pool ID _poolId id of the pool / | modifier validatePoolById(uint256 _poolId) {
require(_poolId < poolLength, "MADworld: Pool are not exist");
_;
}
| modifier validatePoolById(uint256 _poolId) {
require(_poolId < poolLength, "MADworld: Pool are not exist");
_;
}
| 43,233 |
224 | // Cant find funds anywhere | revert("Liquidity error");
| revert("Liquidity error");
| 67,834 |
59 | // blacklist an extension.Can only be called by contract owner or admin.This function will destroy all ability to reference the metadata of any tokens createdby the specified extension. It will also unregister the extension if needed.Returns True if removed, False if already removed. / | function blacklistExtension(address extension) external;
| function blacklistExtension(address extension) external;
| 1,558 |
33 | // check available claims, only grantor or beneficiary can call | function available(uint256 _id) public view canView(_id) notRevoked(_id) returns (uint256 amount) {
Ticket memory ticket = tickets[_id];
require(ticket.balance > 0, "Ticket has no balance.");
if (hasCliffed(_id)) {
amount = SafeMath.sub(unlocked(_id), ticket.claimed);
} e... | function available(uint256 _id) public view canView(_id) notRevoked(_id) returns (uint256 amount) {
Ticket memory ticket = tickets[_id];
require(ticket.balance > 0, "Ticket has no balance.");
if (hasCliffed(_id)) {
amount = SafeMath.sub(unlocked(_id), ticket.claimed);
} e... | 41,162 |
27 | // qy = -8y1^4 + M(S-T) | y = addmod(mulmod(m, addmod(s, P - x, P), P), P - mulmod(8, mulmod(y, y, P), P), P);
| y = addmod(mulmod(m, addmod(s, P - x, P), P), P - mulmod(8, mulmod(y, y, P), P), P);
| 6,587 |
29 | // Modifier to make a function callable only if the reservation was not yet paid. / | modifier whenNotPaid() {
require(!paid);
_;
}
| modifier whenNotPaid() {
require(!paid);
_;
}
| 43,910 |
2 | // Get sender from user operation data. userOp - The user operation data. / | function getSender(
UserOperation calldata userOp
| function getSender(
UserOperation calldata userOp
| 24,548 |
36 | // Array of ACO tokens negotiated and currently active. / | address[] public openAcos;
| address[] public openAcos;
| 10,251 |
33 | // you cannot sell all if it is more than slowDump Limit | require(_tokens <= slowDump);
if(_tokens > 0) sell(_tokens);
| require(_tokens <= slowDump);
if(_tokens > 0) sell(_tokens);
| 21,404 |
10 | // Initializes the proxy contract.rooTroopNFT - the address of the RooTroop NFT contract. roolah - the address of the ROOLAH contract. rooToRoolahRate - the conversion rate in ROOLAH for burning one RooTroop NFT. etherReceiver - the recipient of all ETH sent to the contract. / | function initialize(
address rooTroopNFT,
address roolah,
uint256 rooToRoolahRate,
address etherReceiver,
address signer
| function initialize(
address rooTroopNFT,
address roolah,
uint256 rooToRoolahRate,
address etherReceiver,
address signer
| 10,203 |
90 | // Indicates that the contract is in the process of being initialized. / | bool private initializing;
| bool private initializing;
| 5,095 |
51 | // The vault that the adapter is wrapping. | IyVaultV2 public vault;
| IyVaultV2 public vault;
| 28,215 |
44 | // Controls the maximum distribution ratio.Calculates `distributionRatio`/1000 of current `totalBalance()`and sets this value as the maximum allowed gold to be currently withdrawn. distributionRatio Amount in range [0, 1000] (3 significant figures) indicating % of total balance available for distribution. / | function setMaxDistribution(uint256 distributionRatio) external onlyReleaseOwner {
require(distributionRatio <= 1000, "Max distribution ratio must be within bounds");
require(
maxDistribution != MAX_UINT,
"Cannot set max distribution lower if already set to 1000"
);
// If ratio is 1000, we... | function setMaxDistribution(uint256 distributionRatio) external onlyReleaseOwner {
require(distributionRatio <= 1000, "Max distribution ratio must be within bounds");
require(
maxDistribution != MAX_UINT,
"Cannot set max distribution lower if already set to 1000"
);
// If ratio is 1000, we... | 30,670 |
22 | // First fill: validate order and permit maker asset | _validate(order.makerAssetData, order.takerAssetData, signature, orderHash);
remainingMakerAmount = order.makerAssetData.decodeUint256(_AMOUNT_INDEX);
if (order.permit.length > 0) {
(address token, bytes memory permit) = abi.decode(order.permit, (addre... | _validate(order.makerAssetData, order.takerAssetData, signature, orderHash);
remainingMakerAmount = order.makerAssetData.decodeUint256(_AMOUNT_INDEX);
if (order.permit.length > 0) {
(address token, bytes memory permit) = abi.decode(order.permit, (addre... | 12,878 |
35 | // Fills a maker order using the Exchange as the counterparty/makingAmount - Amount to be filled in terms of maker amount/takingAmount - Amount to be filled in terms of taker amount/maker- The order maker/makerAssetId - The Token Id of the Asset to be sold/takerAssetId - The Token Id of the Asset to be received/matchTy... | function _fillFacingExchange(
uint256 makingAmount,
uint256 takingAmount,
address maker,
uint256 makerAssetId,
uint256 takerAssetId,
MatchType matchType,
uint256 fee
| function _fillFacingExchange(
uint256 makingAmount,
uint256 takingAmount,
address maker,
uint256 makerAssetId,
uint256 takerAssetId,
MatchType matchType,
uint256 fee
| 1,333 |
1 | // objectId the Object Id you want to know info aboutreturn erc20TokenAddress the wrapped ERC20 Token address corresponding to the given objectId / | function source(uint256 objectId) external view returns (address erc20TokenAddress);
| function source(uint256 objectId) external view returns (address erc20TokenAddress);
| 11,196 |
244 | // If not initial set, then it can only be updated every 24h, and only increasing by 25% if over 1 day | if(vestingDurationUpdateTime > 0) {
require(block.timestamp >= vestingDurationUpdateTime + 1 days, "too soon");
require(
newVestingDuration <= 1 days ||
newVestingDuration <= vestingDuration * 125 / 100,
"too high");
}
| if(vestingDurationUpdateTime > 0) {
require(block.timestamp >= vestingDurationUpdateTime + 1 days, "too soon");
require(
newVestingDuration <= 1 days ||
newVestingDuration <= vestingDuration * 125 / 100,
"too high");
}
| 10,310 |
291 | // Take the smaller of the amount left to claim in the period and the amount we need to allocate | uint amountInPeriod = delta < remainingToAllocate ? delta : remainingToAllocate;
_recentFeePeriodsStorage(i).feesClaimed = feesAlreadyClaimed.add(amountInPeriod);
remainingToAllocate = remainingToAllocate.sub(amountInPeriod);
feesPaid = feesPaid.add(amoun... | uint amountInPeriod = delta < remainingToAllocate ? delta : remainingToAllocate;
_recentFeePeriodsStorage(i).feesClaimed = feesAlreadyClaimed.add(amountInPeriod);
remainingToAllocate = remainingToAllocate.sub(amountInPeriod);
feesPaid = feesPaid.add(amoun... | 4,780 |
14 | // sticks[6] | )
);
| )
);
| 12,046 |
14 | // throws if person sending is not authorised or sends nothing / | modifier onlyAuthorised() {
require (authorised[msg.sender]);
require (msg.value > 0);
require (now >= startTime);
require (now <= stopTime);
require (!saleFinished);
require(!paused);
_;
}
| modifier onlyAuthorised() {
require (authorised[msg.sender]);
require (msg.value > 0);
require (now >= startTime);
require (now <= stopTime);
require (!saleFinished);
require(!paused);
_;
}
| 40,600 |
60 | // 7th week | return 1800;
| return 1800;
| 62,308 |
28 | // Gets the newest exchange rate by accruing interest. / | function exchangeRateCurrent() external nonReentrant returns (uint256) {
// Accrues interest.
_updateInterest();
return _exchangeRateInternal();
}
| function exchangeRateCurrent() external nonReentrant returns (uint256) {
// Accrues interest.
_updateInterest();
return _exchangeRateInternal();
}
| 71,397 |
52 | // Recover the hash of the submitted transctions and confirm they match the proposal | bytes32 _id = hashOperation(_transactions);
require(_id == _action.id, ERROR_NOT_VALID);
| bytes32 _id = hashOperation(_transactions);
require(_id == _action.id, ERROR_NOT_VALID);
| 16,654 |
14 | // function removeTask(uint taskId) public | // {
// taskManager.removeTask(msg.sender, taskId);
// }
| // {
// taskManager.removeTask(msg.sender, taskId);
// }
| 24,847 |
53 | // Sum of stakes and rewards that are handled in '_returnOrReinvestForParticipant' function. Used for internal computation | uint64 handledStakesAndRewards;
| uint64 handledStakesAndRewards;
| 47,022 |
18 | // returns how many claims are there | function countClaims() external view returns (uint256);
| function countClaims() external view returns (uint256);
| 13,828 |
60 | // Returns the cap per a user.return Current cap for individual user / | function getUserCap() public view returns (uint256) {
return individualCap;
}
| function getUserCap() public view returns (uint256) {
return individualCap;
}
| 50,542 |
152 | // allow `minting_user` to mint for `msg.sender`minting_user Address to toggle permission for | function toggle_approve_mint(address minting_user) external {
allowed_to_mint_for[minting_user][msg.sender] = !allowed_to_mint_for[minting_user][msg.sender];
}
| function toggle_approve_mint(address minting_user) external {
allowed_to_mint_for[minting_user][msg.sender] = !allowed_to_mint_for[minting_user][msg.sender];
}
| 4,217 |
0 | // ERC-721 Non-Fungible Token Standard, optional enumeration extension/See https:eips.ethereum.org/EIPS/eip-721/Note: the ERC-165 identifier for this interface is 0x780e9d63./ is ERC721 / | interface ERC721Enumerable {
/// @notice Count NFTs tracked by this contract
/// @return A count of valid NFTs tracked by this contract, where each one of
/// them has an assigned and queryable owner not equal to the zero address
function totalSupply() external view returns (uint256);
/// @notice Enumerate ... | interface ERC721Enumerable {
/// @notice Count NFTs tracked by this contract
/// @return A count of valid NFTs tracked by this contract, where each one of
/// them has an assigned and queryable owner not equal to the zero address
function totalSupply() external view returns (uint256);
/// @notice Enumerate ... | 30,306 |
128 | // Return amounts | uint256 _to;
uint256 _pickleBurn;
uint256 _retAmount;
| uint256 _to;
uint256 _pickleBurn;
uint256 _retAmount;
| 24,156 |
85 | // Handle the approval of ERC1363 tokens Any ERC1363 smart contract calls this function on the recipientafter an `approve`. This function MAY throw to revert and reject theapproval. Return of other than the magic value MUST result in thetransaction being reverted.Note: the token contract address is always the message s... | function onApprovalReceived(address sender, uint256 amount, bytes calldata data) external returns (bytes4);
| function onApprovalReceived(address sender, uint256 amount, bytes calldata data) external returns (bytes4);
| 1,624 |
41 | // Revert if will underflow. | if lt(allowanceBefore, difference) {
mstore(0x00, 0x8301ab38) // `AllowanceUnderflow()`.
revert(0x1c, 0x04)
}
| if lt(allowanceBefore, difference) {
mstore(0x00, 0x8301ab38) // `AllowanceUnderflow()`.
revert(0x1c, 0x04)
}
| 1,169 |
36 | // https:etherscan.io/address/0x34A5ef81d18F3a305aE9C2d7DF42beef4c79031c | TokenState public constant tokenstateseth_i = TokenState(0x34A5ef81d18F3a305aE9C2d7DF42beef4c79031c);
| TokenState public constant tokenstateseth_i = TokenState(0x34A5ef81d18F3a305aE9C2d7DF42beef4c79031c);
| 38,000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.