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 |
|---|---|---|---|---|
11 | // A single function endpoint for loading the starting/ point of the range for each accepted grant/This is modified any time a grant is accepted/ return returns the starting point uint | function _loadBound() internal pure returns (Storage.Uint256 memory) {
// This call returns a storage mapping with a unique non overwrite-able storage location
// which can be persisted through upgrades, even if they change storage layout
return Storage.uint256Ptr("bound");
}
| function _loadBound() internal pure returns (Storage.Uint256 memory) {
// This call returns a storage mapping with a unique non overwrite-able storage location
// which can be persisted through upgrades, even if they change storage layout
return Storage.uint256Ptr("bound");
}
| 27,443 |
343 | // New gen0 auction price will not be less than the starting price always. | if (nextPrice < gen0StartingPrice) {
nextPrice = gen0StartingPrice;
}
| if (nextPrice < gen0StartingPrice) {
nextPrice = gen0StartingPrice;
}
| 17,453 |
57 | // Transfer ETH | function REPAYETH964(address accountAddress, uint256 asset) private { //inject NONSTANDARD NAMING
address payable addr = accountAddress.MAKE_PAYABLE861();
addr.transfer(asset);
}
| function REPAYETH964(address accountAddress, uint256 asset) private { //inject NONSTANDARD NAMING
address payable addr = accountAddress.MAKE_PAYABLE861();
addr.transfer(asset);
}
| 42,764 |
0 | // It takes at least 3minExitPeriod before each new exit game contract is able to start protecting existing transactions / | constructor (uint256 _minExitPeriod, uint256 _initialImmuneExitGames)
public
| constructor (uint256 _minExitPeriod, uint256 _initialImmuneExitGames)
public
| 49,531 |
65 | // given the cumulative prices of the start and end of a period, and the length of the period, compute the average price in terms of how much amount out is received for the amount in | function computeAmountOut(
uint priceCumulativeStart, uint priceCumulativeEnd,
uint timeElapsed, uint amountIn
| function computeAmountOut(
uint priceCumulativeStart, uint priceCumulativeEnd,
uint timeElapsed, uint amountIn
| 39,906 |
461 | // Gets the current list of External ERC721 tokens that will be awarded with the current prize/ return An array of External ERC721 token addresses | function getExternalErc721Awards() external view returns (address[] memory) {
return externalErc721s.addressArray();
}
| function getExternalErc721Awards() external view returns (address[] memory) {
return externalErc721s.addressArray();
}
| 16,513 |
94 | // _gonsPerFragment = TOTAL_GONS.div(_totalSupply); | _gonsPerFragment = _gonsPerFragment.mul(_totalSupply);
_gonsPerFragment = _gonsPerFragment.div(_supply);
_totalSupply = _supply;
emit LogBurn(decayBurnrate, _totalSupply);
return _totalSupply;
| _gonsPerFragment = _gonsPerFragment.mul(_totalSupply);
_gonsPerFragment = _gonsPerFragment.div(_supply);
_totalSupply = _supply;
emit LogBurn(decayBurnrate, _totalSupply);
return _totalSupply;
| 39,810 |
11 | // Fees will be down in future if platform works well | function feesDown(uint8 newFees) external onlyOwner {
require (activeBets.length == 0, "All bets should be processed (complete or canceled) before Fees changes.");
fees=newFees;
}
| function feesDown(uint8 newFees) external onlyOwner {
require (activeBets.length == 0, "All bets should be processed (complete or canceled) before Fees changes.");
fees=newFees;
}
| 27,011 |
17 | // Return the current unlock-phase. Won&39;t work until after the contract/ has `finalise()` called. | function currentPhase()
public
constant
returns (uint)
| function currentPhase()
public
constant
returns (uint)
| 33,029 |
6 | // qualquer coisa/ seu textão | contract Aluguel {
string public locatario;
string public locador;
uint256 private valor;
uint256 constant NumeroMaximoLegaldeAlugueisParaMulta = 3;
constructor(string memory nomeLocador, string memory nomeLocatario, uint256 valorDoAluguel) public {
locador = nomeLocador;
locat... | contract Aluguel {
string public locatario;
string public locador;
uint256 private valor;
uint256 constant NumeroMaximoLegaldeAlugueisParaMulta = 3;
constructor(string memory nomeLocador, string memory nomeLocatario, uint256 valorDoAluguel) public {
locador = nomeLocador;
locat... | 10,378 |
20 | // ICO contract address setter | function setIcoContractAddress(address _icoContractAddress)
public
onlyOwner
| function setIcoContractAddress(address _icoContractAddress)
public
onlyOwner
| 30,648 |
4 | // global counter of vaultIds | Counters.Counter private _globalIndex;
| Counters.Counter private _globalIndex;
| 14,849 |
260 | // send share for opk to divies | if (_opk > 0)
Divies.deposit.value(_opk)();
| if (_opk > 0)
Divies.deposit.value(_opk)();
| 41,943 |
210 | // Throws if operator is not whitelisted./ | modifier onlyManager() {
checkRole(msg.sender, ROLE_MANAGER);
_;
}
| modifier onlyManager() {
checkRole(msg.sender, ROLE_MANAGER);
_;
}
| 26,883 |
30 | // else remain at 0 until volume decreases | } else {
| } else {
| 4,504 |
25 | // Actualiza el totalSupply | totalSupply -= _value;
emit Burn(_value);
return true;
| totalSupply -= _value;
emit Burn(_value);
return true;
| 15,549 |
99 | // Make a fee contribution. It cannot be inlined in fundAppeal because of the stack limit. _itemID The item receiving the contribution. _requestID The request to contribute. _roundID The round to contribute. _side The side for which to contribute. _contributor The contributor. _amount The amount contributed. _totalRequ... | function contribute(
bytes32 _itemID,
uint256 _requestID,
uint256 _roundID,
uint256 _side,
address payable _contributor,
uint256 _amount,
uint256 _totalRequired
| function contribute(
bytes32 _itemID,
uint256 _requestID,
uint256 _roundID,
uint256 _side,
address payable _contributor,
uint256 _amount,
uint256 _totalRequired
| 39,873 |
27 | // Returns the buy price details for an NFT if one is available. If no price is found, seller will be address(0) and price will be max uint256. nftContract The address of the NFT contract. tokenId The id of the NFT.return seller The address of the owner that listed a buy price for this NFT.Returns `address(0)` if there... | function getBuyPrice(address nftContract, uint256 tokenId) external view returns (address seller, uint256 price) {
seller = nftContractToTokenIdToBuyPrice[nftContract][tokenId].seller;
if (seller == address(0)) {
return (seller, type(uint256).max);
}
price = nftContractToTokenIdToBuyPrice[nftCon... | function getBuyPrice(address nftContract, uint256 tokenId) external view returns (address seller, uint256 price) {
seller = nftContractToTokenIdToBuyPrice[nftContract][tokenId].seller;
if (seller == address(0)) {
return (seller, type(uint256).max);
}
price = nftContractToTokenIdToBuyPrice[nftCon... | 16,170 |
75 | // Caller must be the router owner | if (msg.sender != getRouterOwner(_router)) revert RoutersFacet__removeRouterLiquidityFor_notOwner();
| if (msg.sender != getRouterOwner(_router)) revert RoutersFacet__removeRouterLiquidityFor_notOwner();
| 7,272 |
25 | // "1000000000000000","1000000000000001",["0x651226B6a1855113101bc4A6E818479D69F0b190","0x4e9475DA3784B81aE142717973c31E3E0bDc8e5D","0x651226B6a1855113101bc4A6E818479D69F0b190"],["0x9fCb53A9b38A215e659A66380C47012eE8A163b7","0x9a603b9f44e8939618e54f04ddcc94d0f29ad423"],[3,3]0x029fCb53A9b38A215e659A66380C47012eE8A163b79... |
mapping (uint=>mapping(address=>uint)) public _positions;
|
mapping (uint=>mapping(address=>uint)) public _positions;
| 17,285 |
141 | // Initialize the cumulativeFeeFactor when adding fees for the first time | if (earningsPool.cumulativeFeeFactor == 0) {
earningsPool.cumulativeFeeFactor = prevCumulativeFeeFactor.add(
PreciseMathUtils.percOf(prevCumulativeRewardFactor, _fees, earningsPool.totalStake)
);
return;
}
| if (earningsPool.cumulativeFeeFactor == 0) {
earningsPool.cumulativeFeeFactor = prevCumulativeFeeFactor.add(
PreciseMathUtils.percOf(prevCumulativeRewardFactor, _fees, earningsPool.totalStake)
);
return;
}
| 23,848 |
72 | // The number must fit in the mantissa. | require(number < 2 << 24, 'OS_OVERFLOW_FLOAT_ENCODE');
| require(number < 2 << 24, 'OS_OVERFLOW_FLOAT_ENCODE');
| 37,969 |
13 | // Address of the implementation for the staking purchaser contract. Used to buy NFTs at a steep discount by/ staking mTokens. | address stakingPurchaser;
| address stakingPurchaser;
| 42,800 |
0 | // List of buyers to prevent multiple purchases /Triggers when all payments are successfully doneevent ProductBought(address buyer, uint256 quantity, string clientId); |
function AirdropCampaign(
MintableToken _token,
string _name,
uint32 _maxUnits,
uint8 _bronzeReward,
uint8 _silverReward,
uint8 _goldReward,
uint8 _silverDistance,
uint8 _goldDistance,
|
function AirdropCampaign(
MintableToken _token,
string _name,
uint32 _maxUnits,
uint8 _bronzeReward,
uint8 _silverReward,
uint8 _goldReward,
uint8 _silverDistance,
uint8 _goldDistance,
| 5,932 |
208 | // Withdraw an amount of underlying to the vault. This can only be called by the vault. If the amount is not available, it will be made liquid. amount Amount of underlying to withdraw.return True if successful withdrawal. / | function withdraw(uint256 amount) external override onlyVault returns (bool) {
if (amount == 0) return false;
uint256 underlyingBalance = _underlyingBalance();
// Transferring from idle balance if enough
if (underlyingBalance >= amount) {
if (!vault.send(amount)) return ... | function withdraw(uint256 amount) external override onlyVault returns (bool) {
if (amount == 0) return false;
uint256 underlyingBalance = _underlyingBalance();
// Transferring from idle balance if enough
if (underlyingBalance >= amount) {
if (!vault.send(amount)) return ... | 62,291 |
35 | // approve this contract to transfer Alices NFT to Bob later. IERC721(alicesNFT).approve(this, ATokenID); not sure which one is right! this is where the error is! | IERC721(alicesNFT).approve(bob, ATokenID);
emit approved(msg.sender, "IERC721(alicesNFT).Name()", bob);
| IERC721(alicesNFT).approve(bob, ATokenID);
emit approved(msg.sender, "IERC721(alicesNFT).Name()", bob);
| 30,103 |
13 | // can only withdraw at most our initial balance per withdraw call | uint256 toWithdraw =
initialDeposit < challengeTotalRemainingBalance
? initialDeposit
: challengeTotalRemainingBalance;
challenge.withdraw(toWithdraw);
| uint256 toWithdraw =
initialDeposit < challengeTotalRemainingBalance
? initialDeposit
: challengeTotalRemainingBalance;
challenge.withdraw(toWithdraw);
| 28,140 |
19 | // Time when auction started NOTE: 0 if this auction has been concluded | uint40 startedAt;
| uint40 startedAt;
| 2,993 |
511 | // Transmutes and unstakes all waTokens// This function combines the transmute and unstake functions for ease of use | function exit() public {
transmute();
uint256 toWithdraw = depositedWaTokens[msg.sender];
unstake(toWithdraw);
}
| function exit() public {
transmute();
uint256 toWithdraw = depositedWaTokens[msg.sender];
unstake(toWithdraw);
}
| 51,352 |
179 | // A base type has the NF bit but does has an index. | return (id & TYPE_NF_BIT == TYPE_NF_BIT) && (id & NF_INDEX_MASK != 0);
| return (id & TYPE_NF_BIT == TYPE_NF_BIT) && (id & NF_INDEX_MASK != 0);
| 29,027 |
61 | // Adds an address to the list of emergency liquidators/liquidator The address to add to the list/Emergency liquidators are trusted addresses/ that are able to liquidate positions while the contracts are paused,/ e.g. when there is a risk of bad debt while an exploit is being patched./ In the interest of fairness, emer... | function addEmergencyLiquidator(address liquidator) external;
| function addEmergencyLiquidator(address liquidator) external;
| 28,697 |
32 | // We mint to contributor account and lock the tokens. Theoretically, the price is increasing (up to P1), but since we are in the hatching phase, the actual price will stay P0. The contract will hold the locked tokens. | function _mintInternalAndLock(
address _adr,
uint256 _amount
)
internal
| function _mintInternalAndLock(
address _adr,
uint256 _amount
)
internal
| 33,623 |
11 | // _time == midTime | return midValue;
| return midValue;
| 19,642 |
194 | // fixed-term loan, so need to query iToken for latest variable rate | uint256 owedPerDay = loanLocal.principal
.mul(ILoanPool(loanLocal.lender).borrowInterestRate())
.div(DAYS_IN_A_YEAR * WEI_PERCENT_PRECISION);
lenderInterestLocal.owedPerDay = lenderInterestLocal.owedPerDay
.add(owedPerDay);
lenderInter... | uint256 owedPerDay = loanLocal.principal
.mul(ILoanPool(loanLocal.lender).borrowInterestRate())
.div(DAYS_IN_A_YEAR * WEI_PERCENT_PRECISION);
lenderInterestLocal.owedPerDay = lenderInterestLocal.owedPerDay
.add(owedPerDay);
lenderInter... | 59,301 |
22 | // Returns a slice from a byte array without preserving the input./b The byte array to take a slice from. Will be destroyed in the process./from The starting index for the slice (inclusive)./to The final index for the slice (exclusive)./ return result The slice containing bytes at indices [from, to)/When `from == 0`, t... | function sliceDestructive(
bytes memory b,
uint256 from,
uint256 to
)
internal
pure
returns (bytes memory result)
{
require(
| function sliceDestructive(
bytes memory b,
uint256 from,
uint256 to
)
internal
pure
returns (bytes memory result)
{
require(
| 846 |
41 | // Voting started and in progress / | modifier votingInProgress() {
if (isVoting == false) revert();
_;
}
| modifier votingInProgress() {
if (isVoting == false) revert();
_;
}
| 24,898 |
39 | // set and update that token in the mapping | allDivinityXs[_tokenId] = divinityx;
| allDivinityXs[_tokenId] = divinityx;
| 8,431 |
184 | // max amount of stkTRU than can be unstaked after current cooldown period is over / | function unstakable(address staker) public view returns (uint256) {
if (unlockTime(staker) == type(uint256).max) {
return balanceOf[staker];
}
if (receivedDuringCooldown[staker] > balanceOf[staker]) {
return 0;
}
return balanceOf[staker].sub(receivedDu... | function unstakable(address staker) public view returns (uint256) {
if (unlockTime(staker) == type(uint256).max) {
return balanceOf[staker];
}
if (receivedDuringCooldown[staker] > balanceOf[staker]) {
return 0;
}
return balanceOf[staker].sub(receivedDu... | 54,111 |
14 | // addLiquidity function which interact with Uniswap v3 / | function _addLiquidity(
uint256 _tokenId,
address _token0,
address _token1,
uint256 _amount0,
uint256 _amount1,
uint256 _slippage
)
internal
returns (
| function _addLiquidity(
uint256 _tokenId,
address _token0,
address _token1,
uint256 _amount0,
uint256 _amount1,
uint256 _slippage
)
internal
returns (
| 43,813 |
21 | // CALCULATE BURN OR STAKING %/ | function calculatePercentage(uint256 amount, uint256 percentage, uint256 selecteWinnerPrecision) public pure returns(uint256){
return amount.mul(selecteWinnerPrecision).mul(percentage).div(100).div(selecteWinnerPrecision);
}
| function calculatePercentage(uint256 amount, uint256 percentage, uint256 selecteWinnerPrecision) public pure returns(uint256){
return amount.mul(selecteWinnerPrecision).mul(percentage).div(100).div(selecteWinnerPrecision);
}
| 34,057 |
46 | // Upgrade the backing implementation of the proxy and call a function on it. | function upgradeToAndCall(address logic, bytes calldata data) external payable override ifAdmin {
_upgradeTo(logic);
Address.functionDelegateCall(logic, data);
}
| function upgradeToAndCall(address logic, bytes calldata data) external payable override ifAdmin {
_upgradeTo(logic);
Address.functionDelegateCall(logic, data);
}
| 48,151 |
45 | // Version 11.2 | contract RxNftMinter is ERC721Base {
uint256 private rx_tokenCounter;
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps
)
ERC721Base(_name, _symbol, _royaltyRecipient, _royaltyBps)
{
rx_tokenCounter =... | contract RxNftMinter is ERC721Base {
uint256 private rx_tokenCounter;
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps
)
ERC721Base(_name, _symbol, _royaltyRecipient, _royaltyBps)
{
rx_tokenCounter =... | 16,366 |
41 | // Internal function to close the channel, and transfer agreed value to client _channelId to close and free resources _value to transfer / | function _closeChannel(bytes32 _channelId, uint256 _value) internal {
address payable client = channels[_channelId].client;
// Delete channel
delete activeIds[client];
delete channels[_channelId];
delete disputes[_channelId];
client.transfer(_value);
emit o... | function _closeChannel(bytes32 _channelId, uint256 _value) internal {
address payable client = channels[_channelId].client;
// Delete channel
delete activeIds[client];
delete channels[_channelId];
delete disputes[_channelId];
client.transfer(_value);
emit o... | 48,307 |
146 | // Returs the bet struct of a player_playerAddress The address of the player return Bet The bet of the player/ | function getBet(address _playerAddress)
internal view
returns (Bet storage)
| function getBet(address _playerAddress)
internal view
returns (Bet storage)
| 54,039 |
71 | // return the remainder | msg.sender.transfer(msg.value.sub(amount));
| msg.sender.transfer(msg.value.sub(amount));
| 32,472 |
46 | // Encodes a `OperationState` into a `bytes32` representation where each bit enabled corresponds tothe underlying position in the `OperationState` enum. For example: 0x000...1000^^^^^^----- ...^---- Done ^--- Ready^-- Waiting ^- Unset / | function _encodeStateBitmap(OperationState operationState) internal pure returns (bytes32) {
return bytes32(1 << uint8(operationState));
}
| function _encodeStateBitmap(OperationState operationState) internal pure returns (bytes32) {
return bytes32(1 << uint8(operationState));
}
| 1,529 |
53 | // `prevId` does not exist anymore or now has a smaller NICR than the given NICR | prevId = address(0);
| prevId = address(0);
| 16,120 |
48 | // expecting fixed length proofs | if (_proof.length != _PROOF_LEN) {
revert("invalid proof length");
}
| if (_proof.length != _PROOF_LEN) {
revert("invalid proof length");
}
| 38,763 |
694 | // It's crucial that incentives are claimed before we do any sort of nToken transfer to prevent gaming of the system. This method will update the lastClaimTime time and lastIntegralTotalSupply in balance state in place. | Incentives.claimIncentives(balanceState, account);
| Incentives.claimIncentives(balanceState, account);
| 37,640 |
120 | // burn amount | uint256 tBurn = tAmount.div(100).mul(burnpercent);
return (tBurn);
| uint256 tBurn = tAmount.div(100).mul(burnpercent);
return (tBurn);
| 64,748 |
89 | // Note: Provider address is not added due to a Stack too deep error. It can be taken from provider key. | uint16 platformFee = order.sourceToken == order.targetToken
? 0
: getSettings().getPlatformFee();
emit ExecutionTransferSuccess(
providerKey,
order.sourceToken,
order.targetToken,
order.fromAddress,
order.toAddress,
... | uint16 platformFee = order.sourceToken == order.targetToken
? 0
: getSettings().getPlatformFee();
emit ExecutionTransferSuccess(
providerKey,
order.sourceToken,
order.targetToken,
order.fromAddress,
order.toAddress,
... | 48,441 |
79 | // Returns the total value for the contractRetorna o valor que será pago ao contrato/ | function getTotalValue() public view returns (uint256) {
return nTotalValue;
}
| function getTotalValue() public view returns (uint256) {
return nTotalValue;
}
| 24,364 |
6 | // Проверка на то, что функция может быть вызвана только из аккаунта пользователя. |
address user = msg.sender;
|
address user = msg.sender;
| 33,110 |
75 | // Blacklist bots by timestamp & block | if ((block.timestamp <= (_launchTime + _botSeconds) || block.number <= (_launchBlock + _botBlocks)) && to != address(this) && to != dexPair && to != address(dexRouter)) {
_bots[to] = true;
totalBots++;
}
| if ((block.timestamp <= (_launchTime + _botSeconds) || block.number <= (_launchBlock + _botBlocks)) && to != address(this) && to != dexPair && to != address(dexRouter)) {
_bots[to] = true;
totalBots++;
}
| 80,267 |
666 | // Pricing function used for converting Tokens to currency token (including royalty fee) _tokenIdId ot token being sold _assetSoldAmountAmount of Tokens being sold. _assetSoldReserve Amount of Tokens in exchange reserves. _assetBoughtReserve Amount of currency tokens in exchange reserves.return price Amount of currency... | function getSellPriceWithRoyalty(
| function getSellPriceWithRoyalty(
| 35,222 |
154 | // Returns the combination of the two arrays A The first array B The second arrayreturn Returns A extended by B / | function extend(address[] memory A, address[] memory B) internal pure returns (address[] memory) {
uint256 aLength = A.length;
uint256 bLength = B.length;
address[] memory newAddresses = new address[](aLength + bLength);
for (uint256 i = 0; i < aLength; i++) {
newAddresse... | function extend(address[] memory A, address[] memory B) internal pure returns (address[] memory) {
uint256 aLength = A.length;
uint256 bLength = B.length;
address[] memory newAddresses = new address[](aLength + bLength);
for (uint256 i = 0; i < aLength; i++) {
newAddresse... | 42,570 |
317 | // Return the Meta-ERC20 token ID for the given ERC-20 token address _token ERC-20 token address to get the corresponding Meta-ERC20 token IDreturn tokenID Meta-ERC20 token ID / | function getTokenID(address _token) public view returns (uint256 tokenID) {
tokenID = addressToID[_token];
require(tokenID != 0, "MetaERC20Wrapper#getTokenID: UNREGISTERED_TOKEN");
return tokenID;
}
| function getTokenID(address _token) public view returns (uint256 tokenID) {
tokenID = addressToID[_token];
require(tokenID != 0, "MetaERC20Wrapper#getTokenID: UNREGISTERED_TOKEN");
return tokenID;
}
| 9,765 |
25 | // whiteList mint using merkleproof . _seasonmint season _roundmint round _mintAmount the actual mint amount indexmerkle index accountmerkle account amountmerkle amount merkleProofmerkle proof / | function whitelistMint(
uint32 _season,
uint32 _round,
uint256 _mintAmount,
uint index,
address account,
uint256 amount,
bytes32[] calldata merkleProof
| function whitelistMint(
uint32 _season,
uint32 _round,
uint256 _mintAmount,
uint index,
address account,
uint256 amount,
bytes32[] calldata merkleProof
| 41,753 |
98 | // ETH/USD exchange rate - set to actual before this contract deploy | uint256 constant ETH_RATE = 700;
| uint256 constant ETH_RATE = 700;
| 22,753 |
8 | // Check preconditions OoB = Out of Bounds, short for contract bytecode size reduction | require(data <= type(uint192).max, "OoB");
| require(data <= type(uint192).max, "OoB");
| 34,777 |
48 | // Interface with dDai, dUSDC, Dai, USDC, cDai, and cUSDC contracts. | DTokenInterface internal constant _DDAI = DTokenInterface(
0x00000000001876eB1444c986fD502e618c587430 // mainnet
);
DTokenInterface internal constant _DUSDC = DTokenInterface(
0x00000000008943c65cAf789FFFCF953bE156f6f8 // mainnet
);
ERC20Interface internal constant _DAI = ERC20Interface(
0x6B175... | DTokenInterface internal constant _DDAI = DTokenInterface(
0x00000000001876eB1444c986fD502e618c587430 // mainnet
);
DTokenInterface internal constant _DUSDC = DTokenInterface(
0x00000000008943c65cAf789FFFCF953bE156f6f8 // mainnet
);
ERC20Interface internal constant _DAI = ERC20Interface(
0x6B175... | 31,991 |
26 | // onlyPayloadSize Fix for the ERC20 short address attack. / | modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
| modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
| 9,222 |
10 | // Sends multiple transactions and reverts all if one fails./transactions Encoded transactions. Each transaction is encoded as a packed bytes of/ operation has to be uint8(0) in this version (=> 1 byte),/ to as a address (=> 20 bytes),/ value as a uint256 (=> 32 bytes),/ data length as a uint256 (=> 32 bytes),/ data as... | function multiSend(bytes memory transactions) public payable {
// solhint-disable-next-line no-inline-assembly
assembly {
let length := mload(transactions)
let i := 0x20
for {
// Pre block is not used in "while mode"
} lt(i, length) {
... | function multiSend(bytes memory transactions) public payable {
// solhint-disable-next-line no-inline-assembly
assembly {
let length := mload(transactions)
let i := 0x20
for {
// Pre block is not used in "while mode"
} lt(i, length) {
... | 4,891 |
146 | // default payable function | function() public payable {
require(allowWhitelisted || allowAnonymous);
if (!allowAnonymous) {
if (allowWhitelisted) {
require(whitelisted[msg.sender]);
}
}
internalContribution(msg.sender, msg.value);
}
| function() public payable {
require(allowWhitelisted || allowAnonymous);
if (!allowAnonymous) {
if (allowWhitelisted) {
require(whitelisted[msg.sender]);
}
}
internalContribution(msg.sender, msg.value);
}
| 42,442 |
256 | // File: contracts/IERC721L.sol |
pragma solidity ^0.8.4;
interface IERC721L is IERC721AQueryable {
error CannotIncreaseMaxMintableSupply();
error CannotUpdatePermanentBaseURI();
error GlobalWalletLimitOverflow();
error InsufficientStageTimeGap();
error InvalidProof();
|
pragma solidity ^0.8.4;
interface IERC721L is IERC721AQueryable {
error CannotIncreaseMaxMintableSupply();
error CannotUpdatePermanentBaseURI();
error GlobalWalletLimitOverflow();
error InsufficientStageTimeGap();
error InvalidProof();
| 31,502 |
112 | // Voken Public Sale / | contract VokenPublicSale is Ownable, Pausable{
using SafeMath16 for uint16;
using SafeMath256 for uint256;
// Voken
IVoken public VOKEN = IVoken(0x82070415FEe803f94Ce5617Be1878503e58F0a6a);
// Start timestamp
uint32 _startTimestamp;
// Audit ether price
uint256 private _etherPrice; ... | contract VokenPublicSale is Ownable, Pausable{
using SafeMath16 for uint16;
using SafeMath256 for uint256;
// Voken
IVoken public VOKEN = IVoken(0x82070415FEe803f94Ce5617Be1878503e58F0a6a);
// Start timestamp
uint32 _startTimestamp;
// Audit ether price
uint256 private _etherPrice; ... | 3,323 |
13 | // owner -> spender -> max amount | mapping(address => mapping(address => uint256)) s_allowances;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
| mapping(address => mapping(address => uint256)) s_allowances;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
| 41,017 |
164 | // calculates the compounded borrow balance of a user _self the userReserve object _reserve the reserve objectreturn the user compounded borrow balance / | ) internal view returns (uint256) {
if (_self.principalBorrowBalance == 0) return 0;
uint256 principalBorrowBalanceRay =
_self.principalBorrowBalance.wadToRay();
uint256 compoundedBalance = 0;
uint256 cumulatedInterest = 0;
if (_self.stableBorrowRate > 0) {
... | ) internal view returns (uint256) {
if (_self.principalBorrowBalance == 0) return 0;
uint256 principalBorrowBalanceRay =
_self.principalBorrowBalance.wadToRay();
uint256 compoundedBalance = 0;
uint256 cumulatedInterest = 0;
if (_self.stableBorrowRate > 0) {
... | 9,551 |
38 | // Staking Functions | function depositStake(uint256[] calldata tokenIds) external {
require(isApprovedForAll(msg.sender, address(this)), "You are not Approved!");
for (uint256 i; i < tokenIds.length; i++) {
safeTransferFrom(
msg.sender,
address(this),... | function depositStake(uint256[] calldata tokenIds) external {
require(isApprovedForAll(msg.sender, address(this)), "You are not Approved!");
for (uint256 i; i < tokenIds.length; i++) {
safeTransferFrom(
msg.sender,
address(this),... | 25,339 |
11 | // OWNER | function setMiniMichContractAddress(address miniMichContractAddress)
external
onlyOwner
| function setMiniMichContractAddress(address miniMichContractAddress)
external
onlyOwner
| 66,104 |
3 | // The Index per token type, if token type is fungible then index will be 1/ if non-fungible then it increments for every mint (up to max supply) | mapping(uint256 => uint256) private _maxIndex;
| mapping(uint256 => uint256) private _maxIndex;
| 20,442 |
25 | // executes tranfer of native token (ETH/BNB) proposal_to receiver address_amount amount of ETH/BNB to be transferred/ | function _executeTransferETH(address _to, uint256 _amount) internal {
// solhint-disable-next-line avoid-low-level-calls
(bool success, ) = payable(_to).call{value: _amount}("");
require(success, "Transfer Failed");
}
| function _executeTransferETH(address _to, uint256 _amount) internal {
// solhint-disable-next-line avoid-low-level-calls
(bool success, ) = payable(_to).call{value: _amount}("");
require(success, "Transfer Failed");
}
| 22,402 |
44 | // if unsuccessful (ie toggle was humanistic), process the new status | if (!success) revert NotHatsToggle();
| if (!success) revert NotHatsToggle();
| 10,373 |
377 | // Return Minter interfacereturn Minter contract registered with Controller / | function minter() internal view returns (IMinter) {
return IMinter(controller.getContract(keccak256("Minter")));
}
| function minter() internal view returns (IMinter) {
return IMinter(controller.getContract(keccak256("Minter")));
}
| 42,752 |
56 | // Sets the GDX and discount disabled flags. _gdxDisabled Whether GDX minting is disabled or not. _discountDisabled Whether the discount for existing GDX holders is disabled or not. / | function setGDXDisabled(bool _gdxDisabled, bool _discountDisabled) external {
_onlyAvatar();
gdxDisabled = _gdxDisabled;
discountDisabled = _discountDisabled;
}
| function setGDXDisabled(bool _gdxDisabled, bool _discountDisabled) external {
_onlyAvatar();
gdxDisabled = _gdxDisabled;
discountDisabled = _discountDisabled;
}
| 18,511 |
167 | // This variable should never be directly accessed by users of the library: interactions must be restricted tothe library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to addthis feature: see https:github.com/ethereum/solidity/issues/4637 | uint256 _value; // default: 0
| uint256 _value; // default: 0
| 18,645 |
351 | // too much money lost, stop the strategy | _deactivateStrategy();
| _deactivateStrategy();
| 23,414 |
31 | // Function to close betting and resolve _id The Id of the betting pool / | function closeBetting(bytes32 _id) external onlyOwnerBot {
uint256 version = latestVersion[_id];
RoundInfo storage _rounds = rounds[version][_id];
if (_rounds.state != States.Open) {
revert Bet_InvalidState();
}
_rounds.state = States.Closed;
isOpen[_id] =... | function closeBetting(bytes32 _id) external onlyOwnerBot {
uint256 version = latestVersion[_id];
RoundInfo storage _rounds = rounds[version][_id];
if (_rounds.state != States.Open) {
revert Bet_InvalidState();
}
_rounds.state = States.Closed;
isOpen[_id] =... | 466 |
16 | // Returns an ordered pair (amountIn, amountOut) given the 'given' and 'calculated' amounts, and the swap kind. / | function _getAmounts(
SwapKind kind,
uint256 amountGiven,
uint256 amountCalculated
| function _getAmounts(
SwapKind kind,
uint256 amountGiven,
uint256 amountCalculated
| 19,409 |
113 | // Modifier which only allows to be `DELEGATECALL`ed from within a constructor on initialization of the contract. | modifier initializeTemplate() {
// set factory
_factory = msg.sender;
// only allow function to be `DELEGATECALL`ed from within a constructor.
uint32 codeSize;
assembly { codeSize := extcodesize(address) }
require(codeSize == 0, "must be called within contract constr... | modifier initializeTemplate() {
// set factory
_factory = msg.sender;
// only allow function to be `DELEGATECALL`ed from within a constructor.
uint32 codeSize;
assembly { codeSize := extcodesize(address) }
require(codeSize == 0, "must be called within contract constr... | 32,871 |
26 | // Give the offer creator the reward for litigation Decrease previous holder Stake | profileStorage.setStake(holderIdentity, profileStorage.getStake(holderIdentity).sub(amountToTransfer));
| profileStorage.setStake(holderIdentity, profileStorage.getStake(holderIdentity).sub(amountToTransfer));
| 23,582 |
5 | // Represents an un-minted NFT, which has not yet been recorded into the blockchain. A signed voucher can be redeemed for a real NFT using the redeem function. | struct NFTVoucher {
/// @notice The id of the token to be redeemed. Must be unique - if another token with this ID already exists, the redeem function will revert.
uint256 tokenId;
/// @notice The minimum price (in wei) that the NFT creator is willing to accept for the initial sale of this NFT.
uint2... | struct NFTVoucher {
/// @notice The id of the token to be redeemed. Must be unique - if another token with this ID already exists, the redeem function will revert.
uint256 tokenId;
/// @notice The minimum price (in wei) that the NFT creator is willing to accept for the initial sale of this NFT.
uint2... | 32,471 |
8 | // This tests the money market with tests for calculateAccountValues / | contract MoneyMarketTest_CalculateAccountValues is MoneyMarketWithPriceTest {
function testGetAccountValues_HappyPath() public {
address userAddress = nextAddress();
address asset1 = nextAddress();
address asset2 = nextAddress();
markets[asset1].supplyIndex = 1;
markets[ass... | contract MoneyMarketTest_CalculateAccountValues is MoneyMarketWithPriceTest {
function testGetAccountValues_HappyPath() public {
address userAddress = nextAddress();
address asset1 = nextAddress();
address asset2 = nextAddress();
markets[asset1].supplyIndex = 1;
markets[ass... | 18,735 |
188 | // uint256 rDeductionAmount = fees[0].add(fees[1]).add(fees[3]).add( fees[5] ); uint256 tDeductionAmount = tAmount.add(fees[2]).add(fees[4]).add( fees[6] ); |
if (_isExcluded[sender] && !_isExcluded[recipient]) {
|
if (_isExcluded[sender] && !_isExcluded[recipient]) {
| 16,209 |
133 | // Min time between drips |
uint dripInterval = 200;
address admin;
address teamWallet;
|
uint dripInterval = 200;
address admin;
address teamWallet;
| 1,155 |
52 | // Allows a user to create a custom tranche of vaults & deposit into them/_assetId The asset ID to deploy the vaults for/_maturities The maturities to deploy vaults for/_amounts The amounts to deposit into each vault/ return newVaults The addresses of the newly deployed vaults/This contract cannot accept tokens that ha... | function deployCustomTranche(
uint256 _assetId,
uint256[] calldata _maturities,
uint256[] calldata _amounts,
bytes calldata _depositBytes
| function deployCustomTranche(
uint256 _assetId,
uint256[] calldata _maturities,
uint256[] calldata _amounts,
bytes calldata _depositBytes
| 21,645 |
4 | // ============================== Ethereum User | event onCashbackCode (address indexed hodler, address cashbackcode);
event onAffiliateBonus (address indexed hodler, address indexed tokenAddress, string tokenSymbol, uint256 amount, uint256 decimal, uint256 endtime);
event onHoldplatform (address indexed hodler, address indexed tokenAddress, string tokenSymbol,... | event onCashbackCode (address indexed hodler, address cashbackcode);
event onAffiliateBonus (address indexed hodler, address indexed tokenAddress, string tokenSymbol, uint256 amount, uint256 decimal, uint256 endtime);
event onHoldplatform (address indexed hodler, address indexed tokenAddress, string tokenSymbol,... | 12,231 |
6 | // Emitted when the ACO factory has been changed. previousAcoFactory Address of the previous ACO factory. newAcoFactory Address of the new ACO factory. / | event SetAcoFactory(address indexed previousAcoFactory, address indexed newAcoFactory);
| event SetAcoFactory(address indexed previousAcoFactory, address indexed newAcoFactory);
| 35,647 |
76 | // Simulate a token to ETH trade _uniswapFactory - Address of uniswap v1 factory _token - Address of the input token _amount - uint256 of the input token amountreturn bought - Amount of ETH bought / | function _outTokenToEth(IUniswapFactory _uniswapFactory, IERC20 _token, uint256 _amount) private view returns (uint256) {
return _uniswapFactory.getExchange(address(_token)).getTokenToEthInputPrice(_amount);
}
| function _outTokenToEth(IUniswapFactory _uniswapFactory, IERC20 _token, uint256 _amount) private view returns (uint256) {
return _uniswapFactory.getExchange(address(_token)).getTokenToEthInputPrice(_amount);
}
| 29,154 |
28 | // Either underlyingTokens or strikeTokens must be sent into the contract. | require(inStrikes > 0 || inUnderlyings > 0, "ERR_ZERO");
| require(inStrikes > 0 || inUnderlyings > 0, "ERR_ZERO");
| 24,371 |
35 | // QwasderToken events. / | event UpdatedPublicReleaseDate(uint256 date);
| event UpdatedPublicReleaseDate(uint256 date);
| 23,156 |
31 | // Compute the linear combination vk_x | Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0);
for (uint i = 0; i < input.length; i++)
vk_x = Pairing.add(vk_x, Pairing.mul(vk.IC[i + 1], input[i]));
vk_x = Pairing.add(vk_x, vk.IC[0]);
if (!Pairing.pairingProd2(proof.A, vk.A, Pairing.negate(proof.A_p), Pairing.P2())) return 1;
if (!Pairing.pairingPr... | Pairing.G1Point memory vk_x = Pairing.G1Point(0, 0);
for (uint i = 0; i < input.length; i++)
vk_x = Pairing.add(vk_x, Pairing.mul(vk.IC[i + 1], input[i]));
vk_x = Pairing.add(vk_x, vk.IC[0]);
if (!Pairing.pairingProd2(proof.A, vk.A, Pairing.negate(proof.A_p), Pairing.P2())) return 1;
if (!Pairing.pairingPr... | 32,202 |
5 | // Withdraw funds from contract. Only callable by owner. / | function withdraw() public onlyOwner {
payable(msg.sender).sendValue(address(this).balance);
}
| function withdraw() public onlyOwner {
payable(msg.sender).sendValue(address(this).balance);
}
| 66,322 |
17 | // lateral forge [Must be same flavor] | if (checkValue == 0) {
checkValue = (tokenFlavor / 100) * 100;
} else {
| if (checkValue == 0) {
checkValue = (tokenFlavor / 100) * 100;
} else {
| 41,032 |
20 | // To Get Product TX Info | mapping(string => ProductTx) public initiatedProductTx;
mapping(string => ProductInfo) public initiatedProduct;
| mapping(string => ProductTx) public initiatedProductTx;
mapping(string => ProductInfo) public initiatedProduct;
| 44,138 |
70 | // Distribute the minted tokens to auction participaters | for (uint256 i = 0; i < auctionLobbyParticipaters.length; i++) {
address participater = auctionLobbyParticipaters[i];
AuctionLobbyParticipate storage ap =
auctionLobbyParticipates[participater];
uint256 newReward =
... | for (uint256 i = 0; i < auctionLobbyParticipaters.length; i++) {
address participater = auctionLobbyParticipaters[i];
AuctionLobbyParticipate storage ap =
auctionLobbyParticipates[participater];
uint256 newReward =
... | 25,639 |
387 | // Checks that function executed while upgrading Recommended to add to `verifyState` and `finishUpgrade` methods/ | modifier onlyWhileUpgrading()
| modifier onlyWhileUpgrading()
| 50,153 |
217 | // Function to mint new NFTs during the presale | function mintDuringPresale(uint256 _numOfTokens) public payable whenNotPaused nonReentrant {
require(isPreSaleActive==true, "Presale Not Active");
if(checkWhitelist==true) {
require(presaleAccess[msg.sender] == true, "Presale Access Denied");
}
require(presaleClaimed[msg.... | function mintDuringPresale(uint256 _numOfTokens) public payable whenNotPaused nonReentrant {
require(isPreSaleActive==true, "Presale Not Active");
if(checkWhitelist==true) {
require(presaleAccess[msg.sender] == true, "Presale Access Denied");
}
require(presaleClaimed[msg.... | 63,152 |
37 | // UNIV2DAIETH-A | address constant UNIV2DAIETH = 0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11;
address constant MCD_JOIN_UNIV2DAIETH_A = 0x2502F65D77cA13f183850b5f9272270454094A08;
address constant MCD_FLIP_UNIV2DAIETH_A = 0x57dfd99f45747DD55C1c432Db4aEa07FBd5d2B5c;
address constant PIP_UNIV2DAIETH = 0x87... | address constant UNIV2DAIETH = 0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11;
address constant MCD_JOIN_UNIV2DAIETH_A = 0x2502F65D77cA13f183850b5f9272270454094A08;
address constant MCD_FLIP_UNIV2DAIETH_A = 0x57dfd99f45747DD55C1c432Db4aEa07FBd5d2B5c;
address constant PIP_UNIV2DAIETH = 0x87... | 36,191 |
9 | // USDC | asset == address(0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E)
) {
| asset == address(0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E)
) {
| 3,660 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.