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 |
|---|---|---|---|---|
26 | // address owner; address spender; | uint256 value;
uint256 deadline;
uint8 v;
bytes32 r;
bytes32 s;
| uint256 value;
uint256 deadline;
uint8 v;
bytes32 r;
bytes32 s;
| 42,622 |
97 | // No trading is performed on deposit | if(nonContract == true){}
| if(nonContract == true){}
| 19,520 |
2 | // Mainnet DragoRegistry address | address constant private DRAGO_REGISTRY_ADDRESS = address(0xdE6445484a8dcD9bf35fC95eb4E3990Cc358822e);
| address constant private DRAGO_REGISTRY_ADDRESS = address(0xdE6445484a8dcD9bf35fC95eb4E3990Cc358822e);
| 1,825 |
28 | // Aave V2 dependencies | import { FlashLoanReceiverBase } from "https://github.com/fifikobayashi/Robin-Hood-Attack/blob/main/FlashLoanReceiverBase.sol";
import { ILendingPool, ILendingPoolAddressesProvider, IERC20 } from "https://github.com/fifikobayashi/Robin-Hood-Attack/blob/main/Interfaces.sol";
// Balancer dependencies
import "https://git... | import { FlashLoanReceiverBase } from "https://github.com/fifikobayashi/Robin-Hood-Attack/blob/main/FlashLoanReceiverBase.sol";
import { ILendingPool, ILendingPoolAddressesProvider, IERC20 } from "https://github.com/fifikobayashi/Robin-Hood-Attack/blob/main/Interfaces.sol";
// Balancer dependencies
import "https://git... | 19,730 |
45 | // Flag for if the trade is involved in a part buy or not | bool isBeingUsedInPartBuy;
| bool isBeingUsedInPartBuy;
| 50,660 |
30 | // Vault: amount is locked | error VaultAmountLocked();
| error VaultAmountLocked();
| 31,148 |
3 | // Gets the rewards token_rewardPool the rewards pool to check return IERC20 the reward token / | function getTokenAddress(address _rewardPool) external view returns(IERC20);
| function getTokenAddress(address _rewardPool) external view returns(IERC20);
| 22,353 |
563 | // Orders filled quantity This mapping holds orders filled quantity filled[orderHash] => filled | mapping (bytes32 => uint256) public filled;
| mapping (bytes32 => uint256) public filled;
| 47,254 |
6 | // retrieves amount to raise on given auction, depending on which type of collateral auction house is used does not support English auction currently | function getAmountToRaise(address auctionHouse, uint256 id) internal view returns (uint amountToRaise) {
if(CollateralAuctionHouseLike_3(auctionHouse).AUCTION_TYPE() == bytes32("FIXED_DISCOUNT"))
(,,,amountToRaise) = FixedDiscountAuctionHouse(auctionHouse).bids(id);
else
(,am... | function getAmountToRaise(address auctionHouse, uint256 id) internal view returns (uint amountToRaise) {
if(CollateralAuctionHouseLike_3(auctionHouse).AUCTION_TYPE() == bytes32("FIXED_DISCOUNT"))
(,,,amountToRaise) = FixedDiscountAuctionHouse(auctionHouse).bids(id);
else
(,am... | 61,712 |
4 | // _token address The address of the token. _to address The address which you want to transfer to. _value uint256 The amount of tokens to be transferred. _data bytes The data which enables the pass additional params _fee uint256 The amount of tokens paid to msg.sender, by the owner. _timestamp uint256 Timestamp of tran... | function getTransferAndCallPreSignedHash(address _token, address _to, uint256 _value, bytes _data, uint256 _fee, uint256 _timestamp) public pure returns (bytes32);
| function getTransferAndCallPreSignedHash(address _token, address _to, uint256 _value, bytes _data, uint256 _fee, uint256 _timestamp) public pure returns (bytes32);
| 4,317 |
104 | // xINV Core contract Abstract base for xINV Inverse Finance / | contract xInvCore is Exponential, TokenErrorReporter {
/**
* @dev Guard variable for re-entrancy checks
*/
bool internal _notEntered;
/**
* @notice EIP-20 token name for this token
*/
string public name;
/**
* @notice EIP-20 token symbol for this token
*/
string ... | contract xInvCore is Exponential, TokenErrorReporter {
/**
* @dev Guard variable for re-entrancy checks
*/
bool internal _notEntered;
/**
* @notice EIP-20 token name for this token
*/
string public name;
/**
* @notice EIP-20 token symbol for this token
*/
string ... | 51,001 |
217 | // the number of coins is hard-coded in curve contracts / solhint-disable-next-line | function add_liquidity(uint256[3] memory amounts, uint256 min_mint_amount)
external;
| function add_liquidity(uint256[3] memory amounts, uint256 min_mint_amount)
external;
| 12,842 |
95 | // token types: 0 = ERC20, 1 = ERC721, 2 = ERC1948 | function registerToken(address _token, uint256 _type) public ifAdmin {
// make sure token is not 0x0 and that it has not been registered yet
require(_token != address(0), "Tried to register 0x0 address");
require(!tokenColors[_token], "Token already registered");
uint16 color;
if (_type == 0) {
... | function registerToken(address _token, uint256 _type) public ifAdmin {
// make sure token is not 0x0 and that it has not been registered yet
require(_token != address(0), "Tried to register 0x0 address");
require(!tokenColors[_token], "Token already registered");
uint16 color;
if (_type == 0) {
... | 37,005 |
2 | // 1proto contract multi swap handler oneProtoData - Struct with multiple swap data defined in interfaces.sol/ | function oneProtoSwapMulti(OneProtoMultiData memory oneProtoData) internal returns (uint buyAmt) {
TokenInterface _sellAddr = oneProtoData.sellToken;
TokenInterface _buyAddr = oneProtoData.buyToken;
uint _sellAmt = oneProtoData._sellAmt;
uint _slippageAmt = getSlippageAmt(_buyAddr, _... | function oneProtoSwapMulti(OneProtoMultiData memory oneProtoData) internal returns (uint buyAmt) {
TokenInterface _sellAddr = oneProtoData.sellToken;
TokenInterface _buyAddr = oneProtoData.buyToken;
uint _sellAmt = oneProtoData._sellAmt;
uint _slippageAmt = getSlippageAmt(_buyAddr, _... | 22,874 |
21 | // data contract | CardsInterface public cards ;
GameConfigInterface public schema;
RareInterface public rare;
| CardsInterface public cards ;
GameConfigInterface public schema;
RareInterface public rare;
| 46,751 |
17 | // used to start the minting | function setPaused(bool _setPaused) public onlyOwner {
return (_setPaused) ? _pause() : _unpause();
}
| function setPaused(bool _setPaused) public onlyOwner {
return (_setPaused) ? _pause() : _unpause();
}
| 36,069 |
4 | // @inheritdoc ITaskDrafts | function getTasksContract() external view returns (ITasks) {
return tasks;
}
| function getTasksContract() external view returns (ITasks) {
return tasks;
}
| 19,101 |
4 | // Lock user amount.(run only owner)/account account to lock/releaseTime Time to release from lock state./amountamount to lock./ return Boolean | function setLock(address account, uint256 releaseTime, uint256 amount) onlyOwner public {
//require(now < releaseTime, "ERC20 : Current time is greater than release time");
require(block.timestamp < releaseTime, "ERC20 : Current time is greater than release time");
require(amount != 0, "ERC2... | function setLock(address account, uint256 releaseTime, uint256 amount) onlyOwner public {
//require(now < releaseTime, "ERC20 : Current time is greater than release time");
require(block.timestamp < releaseTime, "ERC20 : Current time is greater than release time");
require(amount != 0, "ERC2... | 14,895 |
29 | // Calculates the exchange rate from the underlying to the CToken This function does not accrue interest before calculating the exchange ratereturn (error code, calculated exchange rate scaled by 1e18) / | function exchangeRateStoredInternal() internal view returns (MathError, uint) {
uint _totalSupply = totalSupply;
if (_totalSupply == 0) {
/*
* If there are no tokens minted:
* exchangeRate = initialExchangeRate
*/
return (MathError.NO_E... | function exchangeRateStoredInternal() internal view returns (MathError, uint) {
uint _totalSupply = totalSupply;
if (_totalSupply == 0) {
/*
* If there are no tokens minted:
* exchangeRate = initialExchangeRate
*/
return (MathError.NO_E... | 16,204 |
198 | // Deposit LP tokens to MasterChef for ICECREAM allocation. | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accIcecreamPerShare).div(1e12).sub(user.rew... | function deposit(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = user.amount.mul(pool.accIcecreamPerShare).div(1e12).sub(user.rew... | 41,841 |
6 | // TargetYour main contract should inherit from this class and implement the checkInvariant method. This is a function that should check everything your contract assumes to be true all the time. If this function returns false, it means your contract was broken in some way and is in an inconsistent state. This is what s... | contract Target {
function checkInvariant() returns(bool);
}
| contract Target {
function checkInvariant() returns(bool);
}
| 20,338 |
33 | // ------------------------------------------------------------------------ Private function to calculate 1% percentage ------------------------------------------------------------------------ | function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
| function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
| 35,671 |
50 | // Returns whether `tokenId` exists. | * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return _startTokenId() <= tokenId && tokenId < _currentIndex && ... | * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return _startTokenId() <= tokenId && tokenId < _currentIndex && ... | 152 |
65 | // Check for maliciously formatted p2pkh No need to worry about underflow, b/c of _scriptLen check | if (uint8(_output[_at + 3]) != 0x14 ||
_output.slice2(_at + _len - 2) != hex"88ac") {
return hex"";
}
| if (uint8(_output[_at + 3]) != 0x14 ||
_output.slice2(_at + _len - 2) != hex"88ac") {
return hex"";
}
| 11,343 |
85 | // Before locking more tokens, withdraw any unlocked ones if possible | uint256 tokensToWithdraw = indexerStake.tokensWithdrawable();
if (tokensToWithdraw > 0) {
_withdraw(indexer);
}
| uint256 tokensToWithdraw = indexerStake.tokensWithdrawable();
if (tokensToWithdraw > 0) {
_withdraw(indexer);
}
| 22,848 |
90 | // should never happen. | require(timeElapsed >= windowSize - periodSize * 2, 'SlidingWindowOracle: UNEXPECTED_TIME_ELAPSED');
(uint price0Cumulative, uint price1Cumulative,) = UniswapV2OracleLibrary.currentCumulativePrices(pair);
(address token0,) = UniswapV2Library.sortTokens(tokenIn, tokenOut);
if (token0 ==... | require(timeElapsed >= windowSize - periodSize * 2, 'SlidingWindowOracle: UNEXPECTED_TIME_ELAPSED');
(uint price0Cumulative, uint price1Cumulative,) = UniswapV2OracleLibrary.currentCumulativePrices(pair);
(address token0,) = UniswapV2Library.sortTokens(tokenIn, tokenOut);
if (token0 ==... | 26,536 |
125 | // settlement Static Bonus addr user addressrreturn bool / | function settlement_Static(address addr)
private
returns (bool)
| function settlement_Static(address addr)
private
returns (bool)
| 12,770 |
9 | // KIP-17 Non-Fungible Token Standard, optional enumeration extension / | contract IKIP17Enumerable is IKIP17 {
function totalSupply() public view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256 tokenId);
function tokenByIndex(uint256 index) public view returns (uint256);
}
| contract IKIP17Enumerable is IKIP17 {
function totalSupply() public view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) public view returns (uint256 tokenId);
function tokenByIndex(uint256 index) public view returns (uint256);
}
| 12,414 |
59 | // SPDX-License-Identifier: MIT// Publius Bean Interface/ | abstract contract IBean is IERC20 {
function burn(uint256 amount) public virtual;
function burnFrom(address account, uint256 amount) public virtual;
function mint(address account, uint256 amount) public virtual returns (bool);
}
| abstract contract IBean is IERC20 {
function burn(uint256 amount) public virtual;
function burnFrom(address account, uint256 amount) public virtual;
function mint(address account, uint256 amount) public virtual returns (bool);
}
| 32,663 |
8 | // The nft getter / | function getNft()
external
override
view
returns (address)
| function getNft()
external
override
view
returns (address)
| 34,601 |
7 | // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. |
bytes32 lastvalue = set._values[lastIndex];
|
bytes32 lastvalue = set._values[lastIndex];
| 26,310 |
34 | // _updateReward(account); | _updateAllReward();
if(UPDATED_TIMESTAMP[account] <= 0){
UPDATED_TIMESTAMP[account] = block.timestamp;
}
| _updateAllReward();
if(UPDATED_TIMESTAMP[account] <= 0){
UPDATED_TIMESTAMP[account] = block.timestamp;
}
| 41,917 |
73 | // Ensure we can receive money at any time./ Not used, but we might want to extend the reward fund while event is running. | function() public payable {}
/// Apply for participation in this event.
/// Available only during the Application state.
/// A transaction to this function has to be done by the users themselves,
/// registering their wallet address as a participent.
/// The transaction does not have to include... | function() public payable {}
/// Apply for participation in this event.
/// Available only during the Application state.
/// A transaction to this function has to be done by the users themselves,
/// registering their wallet address as a participent.
/// The transaction does not have to include... | 21,860 |
47 | // Calculates an expected reserve amount after the transaction taking into an account the withdrawAmount _reserveRatioPct % of a reserve ratio, 1 ether == 100% _leftOnPiToken The amount of origin tokens left on the piToken (WrappedPiErc20) contract _stakedBalance The amount of original tokens staked on the staking cont... | function getExpectedReserveAmount(
uint256 _reserveRatioPct,
uint256 _leftOnPiToken,
uint256 _stakedBalance,
uint256 _withdrawAmount
| function getExpectedReserveAmount(
uint256 _reserveRatioPct,
uint256 _leftOnPiToken,
uint256 _stakedBalance,
uint256 _withdrawAmount
| 52,785 |
96 | // burns an amount of the tokens of the message sender account.amount The amount that will be burnt./ | function burnCommissionTokens(uint256 amount) external returns(bool);
| function burnCommissionTokens(uint256 amount) external returns(bool);
| 33,238 |
532 | // Smart contract owner functionPauses and unpauses mintSeadrop function. / | function toggleIsPaused() external onlyOwner {
isPaused = !isPaused;
}
| function toggleIsPaused() external onlyOwner {
isPaused = !isPaused;
}
| 39,193 |
59 | // Withdraws any surplus from the unstake requests manager./The request manager is expected to return the funds by pushing them using | /// {receiveFromUnstakeRequestsManager}.
function reclaimAllocatedETHSurplus() external onlyRole(STAKING_MANAGER_ROLE) {
// Calls the receiveFromUnstakeRequestsManager() where we perform
// the accounting.
unstakeRequestsManager.withdrawAllocatedETHSurplus();
}
| /// {receiveFromUnstakeRequestsManager}.
function reclaimAllocatedETHSurplus() external onlyRole(STAKING_MANAGER_ROLE) {
// Calls the receiveFromUnstakeRequestsManager() where we perform
// the accounting.
unstakeRequestsManager.withdrawAllocatedETHSurplus();
}
| 32,756 |
36 | // new type being redeemed. | redeemedFactor[from][boostIndex] = tokenId;
redeemedFactorIndex[from] += 1;
emit Redeemed(from, tokenId, true);
| redeemedFactor[from][boostIndex] = tokenId;
redeemedFactorIndex[from] += 1;
emit Redeemed(from, tokenId, true);
| 11,615 |
31 | // since we do a lot of calcuations with these uints, it's best to leave them uint256 evm will convert to uint256 anyways when doing calculations | uint startTime;
uint endTime;
AuctionState state;
address highestBidder;
| uint startTime;
uint endTime;
AuctionState state;
address highestBidder;
| 41,725 |
15 | // Function for adopting a DevDoggieRequires the amount of Ether be at least or more of the currentPriceCreates an instance of a devdoggie token and mints it to the purchaser_devDoggieType The devdoggie token as an integer_firstName The first name of the devdoggie token_lastName The last name of the devdoggie token ret... | function adoptDevDoggie (
uint256 _devDoggieType
, string memory _firstName
, string memory _lastName
)
public
payable
nonReentrant
returns (uint256)
| function adoptDevDoggie (
uint256 _devDoggieType
, string memory _firstName
, string memory _lastName
)
public
payable
nonReentrant
returns (uint256)
| 46,996 |
259 | // Example: debtOutstanding 100, profit 50, _amountFreed 140, _loss 10 _profit should be 40, (50 profit - 10 loss) loss should end up in be 0 | _profit = _profit.sub(_loss);
_loss = 0;
| _profit = _profit.sub(_loss);
_loss = 0;
| 4,380 |
46 | // using XNum for uint256; |
uint256 private constant ONE = 10**18;
|
uint256 private constant ONE = 10**18;
| 34,546 |
1 | // TapPoll callback agree True if new tap value is accepted by majority of contributors _tap New tap value / | function onTapPollFinish(bool agree, uint256 _tap) external;
| function onTapPollFinish(bool agree, uint256 _tap) external;
| 14,894 |
8 | // Called by a super admin to extend the whitelisting of a client/airnodeId Airnode ID from `AirnodeParameterStore.sol`/clientAddress Client address/expiration Timestamp at which the whitelisting of the client/ will expire | function setWhitelistExpiration(
bytes32 airnodeId,
address clientAddress,
uint256 expiration
| function setWhitelistExpiration(
bytes32 airnodeId,
address clientAddress,
uint256 expiration
| 37,336 |
67 | // - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event. / | function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
| function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
| 28,776 |
26 | // It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) + callNewAccountGas (25000, in case the destination address does not exist and needs creating) | destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
| destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
| 17,245 |
23 | // Minting // Whitelist mint function Restricted to price, threshold, merkle root, and max WL (3) _amount The amount to mint _proof The generated merkel proof / | function whitelistMint(
uint256 _amount,
bytes32[] calldata _proof
)
external
payable
isCorrectPrice(_amount, price)
withinThreshold(_amount)
isWhitelist(merkleRoot, _proof)
| function whitelistMint(
uint256 _amount,
bytes32[] calldata _proof
)
external
payable
isCorrectPrice(_amount, price)
withinThreshold(_amount)
isWhitelist(merkleRoot, _proof)
| 14,433 |
39 | // function GetPETH() public payable returns(bool) | //{
// require( m_Users[msg.sender].Register==true,"NOT REGISTERRED");
// uint256 token=msg.value;
// token=token*95;
// token=token/100;
// balances[msg.sender]= balances[msg.sender] +token;
// //m_Users[msg.sender].PETH_Quota=m_Users[msg.sender].PETH_Quota.add(msg.value)... | //{
// require( m_Users[msg.sender].Register==true,"NOT REGISTERRED");
// uint256 token=msg.value;
// token=token*95;
// token=token/100;
// balances[msg.sender]= balances[msg.sender] +token;
// //m_Users[msg.sender].PETH_Quota=m_Users[msg.sender].PETH_Quota.add(msg.value)... | 21,349 |
295 | // Mapping of token ID to the number of referrals | mapping(uint256 => uint256) public referralCounts;
| mapping(uint256 => uint256) public referralCounts;
| 683 |
686 | // res += valcoefficients[161]. | res := addmod(res,
mulmod(val, /*coefficients[161]*/ mload(0x1960), PRIME),
PRIME)
| res := addmod(res,
mulmod(val, /*coefficients[161]*/ mload(0x1960), PRIME),
PRIME)
| 51,723 |
63 | // Looks up if there is an extension of a given addressreturn Whether or not the address is an extension extensionAddr The address to look up / | function isExtension(address extensionAddr) public view returns (bool) {
return inverseExtensions[extensionAddr].id != bytes32(0);
}
| function isExtension(address extensionAddr) public view returns (bool) {
return inverseExtensions[extensionAddr].id != bytes32(0);
}
| 15,847 |
5 | // Remember the relevant addresses | daiJoinAddress = daiJoinAddress_;
potAddress = potAddress_;
vatAddress = address(vat);
| daiJoinAddress = daiJoinAddress_;
potAddress = potAddress_;
vatAddress = address(vat);
| 12,450 |
10 | // BlacklistAddRemove allow owner to Blacklist artist.contract owner can call .Requirement: _artist- artist address | * Emits a {Blacklisted} event.
* Emits a {BlacklistedRemoved} event.
*/
function blacklistAddRemove(address _artist) public onlyOwner {
if (isBlacklisted[_artist] == false) {
isBlacklisted[_artist] = true;
emit Blacklisted(msg.sender, _artist);
} else {
... | * Emits a {Blacklisted} event.
* Emits a {BlacklistedRemoved} event.
*/
function blacklistAddRemove(address _artist) public onlyOwner {
if (isBlacklisted[_artist] == false) {
isBlacklisted[_artist] = true;
emit Blacklisted(msg.sender, _artist);
} else {
... | 25,955 |
10 | // transfer token for a specified address_to The address to transfer to._value The amount to be transferred./ | function _transfer(address _to, uint256 _value) internal returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value)... | function _transfer(address _to, uint256 _value) internal returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value)... | 2,093 |
189 | // DO NOT CHANGE OR MOVE | ENSInterface private ens;
bytes32 private ensNode;
LinkTokenInterface private link;
ChainlinkRequestInterface private oracle;
uint256 private requestCount = 1;
mapping(bytes32 => address) private pendingRequests;
| ENSInterface private ens;
bytes32 private ensNode;
LinkTokenInterface private link;
ChainlinkRequestInterface private oracle;
uint256 private requestCount = 1;
mapping(bytes32 => address) private pendingRequests;
| 31,924 |
200 | // Forcibly rebalance so that cash reserve is about 10% of total. / | {
_rebalanceReserve(_tokenInfos[tid]);
}
| {
_rebalanceReserve(_tokenInfos[tid]);
}
| 79,240 |
14 | // Empty internal constructor, to prevent people from mistakenly deploying an instance of this contract, which should be used via inheritance | constructor () internal { }
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
| constructor () internal { }
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
| 2,070 |
1 | // Array to store all the materials in a list and that list saved in a variable | materialObj[] public materialList;
materialObj matStruct;
| materialObj[] public materialList;
materialObj matStruct;
| 23,628 |
385 | // Check rollback was effective | require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
| require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades");
| 1,208 |
56 | // Team wallet used to collect funds | address public teamWallet;
| address public teamWallet;
| 6,380 |
106 | // TokenVesting A token holder contract that can release its token balance gradually like atypical vesting scheme, with a cliff and vesting period. Optionally revocable by the owner. / | contract TokenVesting is Ownable {
// The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is
// therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore,
// it is recommended to avoid using short time ... | contract TokenVesting is Ownable {
// The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is
// therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore,
// it is recommended to avoid using short time ... | 26,523 |
41 | // check to see if bid has enough collateral to meet initial ratio for purchase price | _isInInitialCollateralShortFall(
bidSubmission.amount,
bidSubmission.collateralTokens,
bidSubmission.collateralAmounts
)
) {
revert CollateralAmountTooLow();
}
| _isInInitialCollateralShortFall(
bidSubmission.amount,
bidSubmission.collateralTokens,
bidSubmission.collateralAmounts
)
) {
revert CollateralAmountTooLow();
}
| 10,274 |
530 | // deposit eth and get weth | if (msg.sender == owner) {
TokenInterface(WETH_ADDRESS).deposit.value(address(this).balance)();
}
| if (msg.sender == owner) {
TokenInterface(WETH_ADDRESS).deposit.value(address(this).balance)();
}
| 55,059 |
17 | // Stop the prank - calls with no longer come from address(0) | cheats.stopPrank();
| cheats.stopPrank();
| 21,559 |
37 | // Triggers an approval from owner to spends./owner The address to approve from./spender The address to be approved./amount The number of tokens that are approved (2^256-1 means infinite)./deadline The time at which to expire the signature./v The recovery byte of the signature./r Half of the ECDSA signature pair./s Hal... | function permit(address owner, address spender, uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
unchecked {bytes32 structHash = keccak256(abi.encode(PERMIT_... | function permit(address owner, address spender, uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
unchecked {bytes32 structHash = keccak256(abi.encode(PERMIT_... | 2,296 |
86 | // Internal function to burn a specific token.Reverts if the token does not exist.Deprecated, use _burn(uint256) instead. owner owner of the token to burn tokenId uint256 ID of the token being burned / | function _burn(address owner, uint256 tokenId) internal {
super._burn(owner, tokenId);
_removeTokenFromOwnerEnumeration(owner, tokenId);
// Since tokenId will be deleted, we can clear its slot in _ownedTokensIndex to trigger a gas refund
_ownedTokensIndex[tokenId] = 0;
_rem... | function _burn(address owner, uint256 tokenId) internal {
super._burn(owner, tokenId);
_removeTokenFromOwnerEnumeration(owner, tokenId);
// Since tokenId will be deleted, we can clear its slot in _ownedTokensIndex to trigger a gas refund
_ownedTokensIndex[tokenId] = 0;
_rem... | 26,839 |
59 | // mint token amount for supply |
uint mintAmount = 0;
if (epochs[epochID].tokenPrice > 0) {
mintAmount = rmul(epochSupplyToken, epochs[epochID].supplyFulfillment);
}
|
uint mintAmount = 0;
if (epochs[epochID].tokenPrice > 0) {
mintAmount = rmul(epochSupplyToken, epochs[epochID].supplyFulfillment);
}
| 53,104 |
57 | // Checks if account is a minter account The address to check / | function isMinter(address account) external view returns (bool) {
return minters[account];
}
| function isMinter(address account) external view returns (bool) {
return minters[account];
}
| 3,187 |
40 | // Upgrade contract | contract Upgrade {
// 管理员
address public owner;
// 管理员2; 用于双重签名验证
address public owner2;
// 签名的messageHash
mapping (bytes32 => bool) public signHash;
// bhc合约地址
address public bhc;
// 接受10%手续费的地址
address public feeAddress;
// 参数1: 二次签名的地址
// 参数2: bhc代币合约地址
// 参数4: 接受... | contract Upgrade {
// 管理员
address public owner;
// 管理员2; 用于双重签名验证
address public owner2;
// 签名的messageHash
mapping (bytes32 => bool) public signHash;
// bhc合约地址
address public bhc;
// 接受10%手续费的地址
address public feeAddress;
// 参数1: 二次签名的地址
// 参数2: bhc代币合约地址
// 参数4: 接受... | 34,914 |
223 | // If the stream `balance` does not equal `deposit`, it means there have been withdrawals.We have to subtract the total amount withdrawn from the amount of money that has beenstreamed until now. / | if (stream.deposit > stream.remainingBalance) {
(vars.mathErr, vars.withdrawalAmount) = subUInt(stream.deposit, stream.remainingBalance);
assert(vars.mathErr == MathError.NO_ERROR);
(vars.mathErr, vars.recipientBalance) = subUInt(vars.recipientBalance, vars.withdrawalAmount);... | if (stream.deposit > stream.remainingBalance) {
(vars.mathErr, vars.withdrawalAmount) = subUInt(stream.deposit, stream.remainingBalance);
assert(vars.mathErr == MathError.NO_ERROR);
(vars.mathErr, vars.recipientBalance) = subUInt(vars.recipientBalance, vars.withdrawalAmount);... | 43,555 |
86 | // Function used by the main partner to set the start time of the funding/_proposalID Index of the client proposal/_startTime The unix start date of the funding | function setFundingStartTime(
uint _proposalID,
uint _startTime) external;
| function setFundingStartTime(
uint _proposalID,
uint _startTime) external;
| 932 |
23 | // Return user reward fee rate._l1TokenAddress L1 token address / | function getUserRewardFeeRate(
address _l1TokenAddress
)
public
view
onlyInitialized()
returns (uint256 userRewardFeeRate)
| function getUserRewardFeeRate(
address _l1TokenAddress
)
public
view
onlyInitialized()
returns (uint256 userRewardFeeRate)
| 49,592 |
61 | // Only owner of challenge can respond and complete of the challenge _challengeId The ID of the TAOAdvocateChallenge / | function completeTAOAdvocateChallenge(bytes32 _challengeId)
public
senderIsName
| function completeTAOAdvocateChallenge(bytes32 _challengeId)
public
senderIsName
| 40,956 |
8 | // OwnerChanged: :point is now owned by :owner | event OwnerChanged(uint32 indexed point, address indexed owner);
| event OwnerChanged(uint32 indexed point, address indexed owner);
| 14,234 |
159 | // Set the address and name of the underlying ERC-20 token erc20Addr The address of ERC-20 token name The name of ERC-20 tokenreturn true (TODO: validate results) / | function setErc20(address erc20Addr, string memory name) onlyOwner public returns (bool)
| function setErc20(address erc20Addr, string memory name) onlyOwner public returns (bool)
| 13,997 |
143 | // Function to synchronize balances before new user deposit.Can be overridden in the strategy. / | function beforeDeposit() external virtual {}
}
| function beforeDeposit() external virtual {}
}
| 33,204 |
47 | // Send tokens to other multi addresses in one function_destAddrs address The addresses which you want to send tokens to _values uint256 the amounts of tokens to be sent / | function multiSend(address[] _destAddrs, uint256[] _values) onlyOwner public returns (uint256) {
require(_destAddrs.length == _values.length);
uint256 i = 0;
for (; i < _destAddrs.length; i = i.add(1)) {
if (!erc20tk.transfer(_destAddrs[i], _values[i])) {
break;
... | function multiSend(address[] _destAddrs, uint256[] _values) onlyOwner public returns (uint256) {
require(_destAddrs.length == _values.length);
uint256 i = 0;
for (; i < _destAddrs.length; i = i.add(1)) {
if (!erc20tk.transfer(_destAddrs[i], _values[i])) {
break;
... | 28,421 |
13 | // - Subtraction cannot overflow. | * message unnecessarily. For custom revert reasons use {trySub}.
* Counterpart to Solidity's `-` operator.
* Requirements:
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is ... | * message unnecessarily. For custom revert reasons use {trySub}.
* Counterpart to Solidity's `-` operator.
* Requirements:
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is ... | 13,456 |
136 | // We explicitly do not throw if this call fails, as this opens up the possiblity of griefing attacks --> engineering a failed fee would invalidate an entire rollup block. As griefing could be done by consuming all gas in the `_feeReceiver` fallback only 50K gas is forwarded. We are forwarding a bit more gas than in th... | assembly {
pop(call(50000, _feeReceiver, txFee, 0, 0, 0, 0))
}
| assembly {
pop(call(50000, _feeReceiver, txFee, 0, 0, 0, 0))
}
| 14,700 |
59 | // Claims all unclaimed RGT earned by `msg.sender` in all pools.return The quantity of RGT claimed. / | function claimAllRgt() public enabled returns (uint256) {
// Distribute RGT to holder
distributeRgt(msg.sender);
// Get unclaimed RGT
uint256 unclaimedRgt = _rgtDistributedByHolder[msg.sender].sub(_rgtClaimedByHolder[msg.sender]);
require(unclaimedRgt > 0, "Unclaimed RGT not... | function claimAllRgt() public enabled returns (uint256) {
// Distribute RGT to holder
distributeRgt(msg.sender);
// Get unclaimed RGT
uint256 unclaimedRgt = _rgtDistributedByHolder[msg.sender].sub(_rgtClaimedByHolder[msg.sender]);
require(unclaimedRgt > 0, "Unclaimed RGT not... | 9,513 |
183 | // MasterChef is the master of Vice. He can make Vice and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once VICE is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully it'... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeBEP20 for IBEP20;
address private _pair;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below... | contract MasterChef is Ownable {
using SafeMath for uint256;
using SafeBEP20 for IBEP20;
address private _pair;
// Info of each user.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below... | 76,321 |
564 | // setManagementProxy(): configure the management proxy for _pointThe management proxy may perform "reversible" operations onbehalf of the owner. This includes public key configuration andoperations relating to sponsorship. | function setManagementProxy(uint32 _point, address _manager)
external
activePointManager(_point)
onL1(_point)
| function setManagementProxy(uint32 _point, address _manager)
external
activePointManager(_point)
onL1(_point)
| 39,334 |
29 | // iterate over all account holders and balance transfer proportional bte balance should be 0 aftwards in a perfect world | function distribute_reward(uint256 _totalAttempt, uint256 _balance) internal {
uint256 remaining_balance = _balance;
for (uint8 i = 0; i < total_users; i++) {
address user_address = active_users[i];
if (user_address > 0 && remaining_balance != 0) {
uint256 proportion = ... | function distribute_reward(uint256 _totalAttempt, uint256 _balance) internal {
uint256 remaining_balance = _balance;
for (uint8 i = 0; i < total_users; i++) {
address user_address = active_users[i];
if (user_address > 0 && remaining_balance != 0) {
uint256 proportion = ... | 49,989 |
91 | // View function to see pending Reward on frontend. | function pendingReward(address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[_user];
uint256 accCakePerShare = pool.accCakePerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > p... | function pendingReward(address _user) external view returns (uint256) {
PoolInfo storage pool = poolInfo[0];
UserInfo storage user = userInfo[_user];
uint256 accCakePerShare = pool.accCakePerShare;
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
if (block.number > p... | 37,898 |
77 | // Checks if the seizing of assets should be allowed to occur sTokenCollateral Asset which was used as collateral and will be seized sTokenBorrowed Asset which was borrowed by the borrower liquidator The address repaying the borrow and seizing the collateral borrower The address of the borrower seizeTokens The number o... | function seizeAllowed(
address sTokenCollateral,
address sTokenBorrowed,
address liquidator,
address borrower,
| function seizeAllowed(
address sTokenCollateral,
address sTokenBorrowed,
address liquidator,
address borrower,
| 48,496 |
62 | // environment variables for updateable merkle | bytes32 public merkleRoot;
uint256 public update;
bool public frozen = true;
| bytes32 public merkleRoot;
uint256 public update;
bool public frozen = true;
| 34,726 |
3 | // =====================================/proof of stake | uint256 public stakingRequirement = 10e18;
| uint256 public stakingRequirement = 10e18;
| 43,131 |
30 | // Claim up to 20 photons at once in presale / | function presaleMintPhotons(uint256 quantity)
external
payable
callerIsUser
presaleStarted
returns (uint256[] memory)
| function presaleMintPhotons(uint256 quantity)
external
payable
callerIsUser
presaleStarted
returns (uint256[] memory)
| 19,252 |
95 | // Divider for the buyLimit based on circulating Supply (0.75%) | uint16 public constant BuyLimitDivider=135;
| uint16 public constant BuyLimitDivider=135;
| 41,368 |
39 | // register flight | flights[flightKey] = Flight({
flight: flight,
statusCode: 0,
timestamp: timestamp,
airline: msg.sender
});
| flights[flightKey] = Flight({
flight: flight,
statusCode: 0,
timestamp: timestamp,
airline: msg.sender
});
| 48,192 |
6 | // Collection is closed for trading and new listings | event CollectionClose(address indexed collection);
| event CollectionClose(address indexed collection);
| 15,761 |
35 | // Add 25% if you send > 1000 | tokens = tokens + (tokens / 4);
| tokens = tokens + (tokens / 4);
| 9,963 |
1 | // max token supply | uint256 public immutable maxSupply;
| uint256 public immutable maxSupply;
| 79,648 |
5 | // Make sure we have enough DVT to pay | require(token.balanceOf(address(this)) >= TOKEN_PAYMENT, "Not enough funds to pay");
address payable walletAddress = payable(proxy);
| require(token.balanceOf(address(this)) >= TOKEN_PAYMENT, "Not enough funds to pay");
address payable walletAddress = payable(proxy);
| 4,796 |
14 | // settings for EMACollector | emaValue = 8 * 10**9 wei; // set an initial price average for gas (8 gwei)
emaPeriods = 10; // set periods to use for EMA calculation
| emaValue = 8 * 10**9 wei; // set an initial price average for gas (8 gwei)
emaPeriods = 10; // set periods to use for EMA calculation
| 31,029 |
256 | // PUBLIC |
function mintPublicSale(address to, uint256 count)
external
payable
nonReentrant
|
function mintPublicSale(address to, uint256 count)
external
payable
nonReentrant
| 7,285 |
3 | // 1e9 : div for ray | uint256 miningIndexDiff = (timeDiff * amountPerSecond) /
totalSupply /
1e9;
_miningIndex += miningIndexDiff;
| uint256 miningIndexDiff = (timeDiff * amountPerSecond) /
totalSupply /
1e9;
_miningIndex += miningIndexDiff;
| 14,141 |
233 | // the hash of the next gem to be minted / | function _nextGemHash() internal view returns (uint256) {
return uint256(keccak256(abi.encodePacked("gem", address(this), _nextGemId)));
}
| function _nextGemHash() internal view returns (uint256) {
return uint256(keccak256(abi.encodePacked("gem", address(this), _nextGemId)));
}
| 70,392 |
17 | // Sets the date of the ICO end.ICO_end The date of the ICO end./ | function setEndOfICO(uint ICO_end) public onlyOwner {
endOfICO = ICO_end;
}
| function setEndOfICO(uint ICO_end) public onlyOwner {
endOfICO = ICO_end;
}
| 78,218 |
2 | // Function used to intialize the differnet variables _endTime Unix timestamp at which offering get ended / | function configure(uint256 _endTime) public onlyFactory {
require(_endTime != 0, "endTime should not be 0");
endTime = _endTime;
}
| function configure(uint256 _endTime) public onlyFactory {
require(_endTime != 0, "endTime should not be 0");
endTime = _endTime;
}
| 45,574 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.