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 |
|---|---|---|---|---|
7 | // Retrieves the "actual" size of loan offer corresponding to particular lender (after excess has been removed) This value would only differ from return value of getLenderOffer()for the same lender if total amount offered > total amount requested and the lender is near the end of the queue This value should only differ... | function actualLenderOffer(address _address, uint _marketId) public view returns (uint) {
return markets[_marketId].lenderOffers[_address].sub(calculateExcess(_marketId, _address));
}
| function actualLenderOffer(address _address, uint _marketId) public view returns (uint) {
return markets[_marketId].lenderOffers[_address].sub(calculateExcess(_marketId, _address));
}
| 35,447 |
6 | // Converts a JoinPoolRequest into a PoolBalanceChange, with no runtime cost. / | function _toPoolBalanceChange(JoinPoolRequest memory request)
private
pure
returns (PoolBalanceChange memory change)
| function _toPoolBalanceChange(JoinPoolRequest memory request)
private
pure
returns (PoolBalanceChange memory change)
| 12,000 |
4 | // @inheritdoc IERC165 / | function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, AccessControl)
returns (bool)
| function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC721, AccessControl)
returns (bool)
| 8,914 |
30 | // Function to open the factory | function openFactory() external onlyOwner {
factoryOpen = true;
}
| function openFactory() external onlyOwner {
factoryOpen = true;
}
| 8,776 |
220 | // every warriors starts from 1 lv (10 level points per level) // PVP rating, every warrior starts with 100 rating / 0 - idle | uint32 action;
| uint32 action;
| 66,270 |
102 | // Sets `value` as allowance of `spender` account over `owner` account's WETH10 token, given `owner` account's signed approval. | /// Emits {Approval} event.
/// Requirements:
/// - `deadline` must be timestamp in future.
/// - `v`, `r` and `s` must be valid `secp256k1` signature from `owner` account over EIP712-formatted function arguments.
/// - the signature must use `owner` account's current nonce (see {nonces}).
... | /// Emits {Approval} event.
/// Requirements:
/// - `deadline` must be timestamp in future.
/// - `v`, `r` and `s` must be valid `secp256k1` signature from `owner` account over EIP712-formatted function arguments.
/// - the signature must use `owner` account's current nonce (see {nonces}).
... | 6,680 |
37 | // AddressSet | struct AddressSet {
Set _inner;
}
| struct AddressSet {
Set _inner;
}
| 30,221 |
34 | // NOTE: In practice, it was discovered that <50 was the maximum we've see for this variance | return _migrate(account, amount, 0);
| return _migrate(account, amount, 0);
| 29,030 |
10 | // computes square roots using the babylonian method https:en.wikipedia.org/wiki/Methods_of_computing_square_rootsBabylonian_method | library Babylonian {
// credit for this implementation goes to
// https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687
function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
// this block is equivalent to r = uint256(1) << (B... | library Babylonian {
// credit for this implementation goes to
// https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687
function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
// this block is equivalent to r = uint256(1) << (B... | 19,461 |
28 | // todo: check if the external contract is legal whitelist. | whiteListContract = newWhiteList;
emit whiteListChanged(newWhiteList);
| whiteListContract = newWhiteList;
emit whiteListChanged(newWhiteList);
| 6,477 |
48 | // id => (owner => balance) | mapping (uint256 => mapping(address => uint256)) internal balances;
| mapping (uint256 => mapping(address => uint256)) internal balances;
| 27,439 |
48 | // Pick out the remaining bytes. | uint256 mask = 256 ** (32 - (_length % 32)) - 1;
assembly {
mstore(
dest,
or(
and(mload(src), not(mask)),
and(mload(dest), mask)
)
)
}
| uint256 mask = 256 ** (32 - (_length % 32)) - 1;
assembly {
mstore(
dest,
or(
and(mload(src), not(mask)),
and(mload(dest), mask)
)
)
}
| 34,495 |
33 | // Check that the auction's endTime has passed | require(
idToMarketItem[tokenId].endTime <= block.timestamp,
"This auction has not ended yet."
);
| require(
idToMarketItem[tokenId].endTime <= block.timestamp,
"This auction has not ended yet."
);
| 25,881 |
30 | // Collects account's received already split funds./accountId The account ID./erc20 The used ERC-20 token./ return amt The collected amount | function _collect(uint256 accountId, IERC20 erc20) internal returns (uint128 amt) {
SplitsBalance storage balance = _splitsStorage().splitsStates[accountId].balances[erc20];
amt = balance.collectable;
balance.collectable = 0;
emit Collected(accountId, erc20, amt);
}
| function _collect(uint256 accountId, IERC20 erc20) internal returns (uint128 amt) {
SplitsBalance storage balance = _splitsStorage().splitsStates[accountId].balances[erc20];
amt = balance.collectable;
balance.collectable = 0;
emit Collected(accountId, erc20, amt);
}
| 21,464 |
273 | // Tell if a given module is active_id ID of the module to be checked_addr Address of the module to be checked return True if the given module address has the requested ID and is enabled/ | function isActive(bytes32 _id, address _addr) external view returns (bool) {
Module storage module = allModules[_addr];
return module.id == _id && !module.disabled;
}
| function isActive(bytes32 _id, address _addr) external view returns (bool) {
Module storage module = allModules[_addr];
return module.id == _id && !module.disabled;
}
| 12,889 |
321 | // forfeit stake and retrieve KEEPER / | function forfeit() external returns ( uint ) {
Claim memory info = warmupInfo[ msg.sender ];
delete warmupInfo[ msg.sender ];
gonsInWarmup = gonsInWarmup.sub(info.gons);
KEEPER.safeTransfer( msg.sender, info.deposit );
return info.deposit;
}
| function forfeit() external returns ( uint ) {
Claim memory info = warmupInfo[ msg.sender ];
delete warmupInfo[ msg.sender ];
gonsInWarmup = gonsInWarmup.sub(info.gons);
KEEPER.safeTransfer( msg.sender, info.deposit );
return info.deposit;
}
| 32,900 |
7 | // Reserve chosen token amount | profileStorage.setWithdrawalAmount(identity, amount);
emit WithdrawalInitiated(identity, amount, withdrawalTime);
| profileStorage.setWithdrawalAmount(identity, amount);
emit WithdrawalInitiated(identity, amount, withdrawalTime);
| 43,937 |
38 | // Returns the current chain name as a string./ return name of the current chain | function CURRENT_CHAIN() public view returns (string memory) {
return _toString(CURRENT_CHAIN_B32);
}
| function CURRENT_CHAIN() public view returns (string memory) {
return _toString(CURRENT_CHAIN_B32);
}
| 2,010 |
19 | // Returns the clubs (IDs) associated to a given country. / | function getClubsForCountry (string calldata country)
public view returns (uint[] memory)
| function getClubsForCountry (string calldata country)
public view returns (uint[] memory)
| 7,625 |
11 | // See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan intomultiple smaller scans if the collection is large enough to causean out-of-gas error (10K pfp collections should be fine). / | function tokensOfOwner(address owner) external view returns (uint256[] memory) {
unchecked {
uint256 tokenIdsIdx;
address currOwnershipAddr;
uint256 tokenIdsLength = balanceOf(owner);
uint256[] memory tokenIds = new uint256[](tokenIdsLength);
Token... | function tokensOfOwner(address owner) external view returns (uint256[] memory) {
unchecked {
uint256 tokenIdsIdx;
address currOwnershipAddr;
uint256 tokenIdsLength = balanceOf(owner);
uint256[] memory tokenIds = new uint256[](tokenIdsLength);
Token... | 3,801 |
33 | // ERC223 additions to ERC20 / | contract Standard223Token is ERC223, StandardToken {
//function that is called when a user or another contract wants to transfer funds
function transfer(address _to, uint _value, bytes _data) returns (bool success) {
//filtering if the target is a contract with bytecode inside it
if (!super.transfer(_to, _v... | contract Standard223Token is ERC223, StandardToken {
//function that is called when a user or another contract wants to transfer funds
function transfer(address _to, uint _value, bytes _data) returns (bool success) {
//filtering if the target is a contract with bytecode inside it
if (!super.transfer(_to, _v... | 8,314 |
21 | // An array can't have a total length larger than the max uint256 value. | unchecked {
i++;
}
| unchecked {
i++;
}
| 25,238 |
0 | // Constructor. _ens The address of the ENS registry. _rootNode The node that this registrar administers. / | constructor(ENS _ens, bytes32 _rootNode) {
ens = _ens;
rootNode = _rootNode;
}
| constructor(ENS _ens, bytes32 _rootNode) {
ens = _ens;
rootNode = _rootNode;
}
| 78,937 |
16 | // Check if the value is less than 0.00001 ETH (10000000000000 wei) | if (weiValue < 10000000000000) {
return "0";
}
| if (weiValue < 10000000000000) {
return "0";
}
| 4,028 |
47 | // Rate and cap for tier 1 | uint256 public tier_rate_1 = 1800;
uint256 public tier_cap_1 = 48;
| uint256 public tier_rate_1 = 1800;
uint256 public tier_cap_1 = 48;
| 7,802 |
0 | // 0: INACTIVE, 1: PRE_SALE, 2: PUBLIC_SALE | uint256 public SALE_STATE = 0;
bytes32 private merkleRoot;
mapping(address => uint256) whitelistMints;
Counters.Counter private idTracker;
string public baseURI;
| uint256 public SALE_STATE = 0;
bytes32 private merkleRoot;
mapping(address => uint256) whitelistMints;
Counters.Counter private idTracker;
string public baseURI;
| 77,640 |
1,016 | // Rate anchors update as the market gets closer to maturity. Rate anchors are not comparable/ across time or markets but implied rates are. The goal here is to ensure that the implied rate/ before and after the rate anchor update is the same. Therefore, the market will trade at the same implied/ rate that it last trad... | function _getRateAnchor(
int256 totalfCash,
uint256 lastImpliedRate,
int256 totalCashUnderlying,
int256 rateScalar,
uint256 timeToMaturity
| function _getRateAnchor(
int256 totalfCash,
uint256 lastImpliedRate,
int256 totalCashUnderlying,
int256 rateScalar,
uint256 timeToMaturity
| 35,789 |
15 | // See `WeightedJoinsLib.joinAllTokensInForExactBPTOut`. / | function joinAllTokensInForExactBPTOut(
| function joinAllTokensInForExactBPTOut(
| 18,986 |
12 | // metadata for each of those NFTs is `${baseURIForTokens}/${tokenId}`._encryptedBaseURI The encrypted base URI for the batch of NFTs being lazy minted. return batchIdA unique integer identifier for the batch of NFTs lazy minted together. / | function lazyMint(
uint256 _amount,
string calldata _baseURIForTokens,
bytes calldata _encryptedBaseURI
) public virtual override returns (uint256 batchId) {
if (_encryptedBaseURI.length != 0) {
_setEncryptedBaseURI(nextTokenIdToLazyMint + _amount, _encryptedBaseURI);... | function lazyMint(
uint256 _amount,
string calldata _baseURIForTokens,
bytes calldata _encryptedBaseURI
) public virtual override returns (uint256 batchId) {
if (_encryptedBaseURI.length != 0) {
_setEncryptedBaseURI(nextTokenIdToLazyMint + _amount, _encryptedBaseURI);... | 6,797 |
9 | // Snapshot of the value of totalStakes, taken immediately after the latest liquidation | uint public totalStakesSnapshot;
| uint public totalStakesSnapshot;
| 28,491 |
93 | // Requests new Riskcoins be made for a given address. The address cannot be a contract, only a simple wallet (with 0 codesize). Contracts must use the Approve, transferFrom pattern and move coins from wallets_user Allows coins to be created and sent to other people return transaction ID which can be viewed in the pend... | _TransID=NewCoinInternal(_user,cast(msg.value),Action.NewRisk);
| _TransID=NewCoinInternal(_user,cast(msg.value),Action.NewRisk);
| 35,195 |
5 | // Set the current contract administrator. account account of contract administrator. / | function setAdmin(address account) external;
| function setAdmin(address account) external;
| 21,428 |
25 | // Require amount greater than 0 | require(RatePerCoin[address(token)].exists==true,"token doesnt have a rate");
require(_amount > 0, "amount cannot be 0");
if (stakers[msg.sender].balance[address(token)] > 0) {
claimToken(address(token));
}
| require(RatePerCoin[address(token)].exists==true,"token doesnt have a rate");
require(_amount > 0, "amount cannot be 0");
if (stakers[msg.sender].balance[address(token)] > 0) {
claimToken(address(token));
}
| 48,358 |
2 | // exchnageRateStored last time we cumulated | uint256 public prevExchnageRateCurrent;
| uint256 public prevExchnageRateCurrent;
| 32,676 |
15 | // Getter function to retrieve subprotocol data/_name Name of the subprotocol to query/ return subprotocolData stored under _name. owner will be set to address(0) if subprotocol does not exist | function getSubprotocol(string calldata _name) external view returns (SubprotocolData memory) {
return subprotocols[_name];
}
| function getSubprotocol(string calldata _name) external view returns (SubprotocolData memory) {
return subprotocols[_name];
}
| 9,750 |
24 | // remove an address from the operators addr addressreturn true if the address was removed from the operators,false if the address wasn't in the operators in the first place / | function removeAddressFromOperators(address addr) onlyOwner public returns(bool success) {
if (operators[addr]) {
operators[addr] = false;
emit OperatorAddressRemoved(addr);
success = true;
}
}
| function removeAddressFromOperators(address addr) onlyOwner public returns(bool success) {
if (operators[addr]) {
operators[addr] = false;
emit OperatorAddressRemoved(addr);
success = true;
}
}
| 22,966 |
198 | // mint all available claims for FA holders | function holderMintAll() public {
uint256[] memory ownedTokens = walletOfFAOwner(msg.sender);
for(uint256 i; i < ownedTokens.length; i++)
{
uint256 _curToken = ownedTokens[i];
//token exist in Acid Apes? If yes, continue. If no, then call holderMint
... | function holderMintAll() public {
uint256[] memory ownedTokens = walletOfFAOwner(msg.sender);
for(uint256 i; i < ownedTokens.length; i++)
{
uint256 _curToken = ownedTokens[i];
//token exist in Acid Apes? If yes, continue. If no, then call holderMint
... | 65,567 |
140 | // unstake p3crv from pickleMasterChef | uint _ratio = pickleJar.getRatio();
_amount = _amount.mul(1e18).div(_ratio);
(uint _stakedAmount,) = pickleMasterChef.userInfo(poolId, address(this));
if (_amount > _stakedAmount) {
_amount = _stakedAmount;
}
| uint _ratio = pickleJar.getRatio();
_amount = _amount.mul(1e18).div(_ratio);
(uint _stakedAmount,) = pickleMasterChef.userInfo(poolId, address(this));
if (_amount > _stakedAmount) {
_amount = _stakedAmount;
}
| 25,240 |
95 | // Ram Vault distributes fees equally amongst staked pools Have fun reading it. Hopefully it's bug-free. God bless. | contract RAMVault is OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
uint256 boostAmount;
... | contract RAMVault is OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount; // How many tokens the user has provided.
uint256 rewardDebt; // Reward debt. See explanation below.
uint256 boostAmount;
... | 12,920 |
41 | // Performs checkpoint for Arbitrum gauge, forwarding ETH to pay bridge costs. / | function _checkpointArbitrumGauge(address gauge) private {
uint256 checkpointCost = ArbitrumRootGauge(gauge).getTotalBridgeCost();
_authorizerAdaptorEntrypoint.performAction{ value: checkpointCost }(
gauge,
abi.encodeWithSelector(IStakelessGauge.checkpoint.selector)
)... | function _checkpointArbitrumGauge(address gauge) private {
uint256 checkpointCost = ArbitrumRootGauge(gauge).getTotalBridgeCost();
_authorizerAdaptorEntrypoint.performAction{ value: checkpointCost }(
gauge,
abi.encodeWithSelector(IStakelessGauge.checkpoint.selector)
)... | 34,481 |
144 | // Returns the packed ownership data of 'tokenId'. / | function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr)
if (curr < _currentIndex) {
uint256 packed = _packedOwnerships[curr];
... | function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr)
if (curr < _currentIndex) {
uint256 packed = _packedOwnerships[curr];
... | 36,607 |
264 | // adding referrer if any | if(_referrer != address(0) && referrer[msg.sender] == address(0)){
referrer[msg.sender] = _referrer;
}
| if(_referrer != address(0) && referrer[msg.sender] == address(0)){
referrer[msg.sender] = _referrer;
}
| 20,361 |
127 | // Transfer wBTC to strategy so strategy can complete the swap. | wBTC.safeTransfer(strategy, _amount);
uint256 amount = ISwapStrategy(strategy).swapTokens(address(wBTC), address(renBTC), _amount, _slippage);
require(amount > minAmount, "swapped amount less than min amount");
| wBTC.safeTransfer(strategy, _amount);
uint256 amount = ISwapStrategy(strategy).swapTokens(address(wBTC), address(renBTC), _amount, _slippage);
require(amount > minAmount, "swapped amount less than min amount");
| 48,784 |
13 | // tip images | function tipImageOwner(uint _id) public payable {
//validate
require(_id > 0 && _id <= imageCount);
//pickimage with _id
Image memory _image = images[_id];
address payable _author = _image.author;
//we need to pay author
address(_author).transfer(msg.value... | function tipImageOwner(uint _id) public payable {
//validate
require(_id > 0 && _id <= imageCount);
//pickimage with _id
Image memory _image = images[_id];
address payable _author = _image.author;
//we need to pay author
address(_author).transfer(msg.value... | 38,045 |
13 | // Storage position of the owner of the contract | bytes32 private constant proxyOwnerPosition = keccak256("org.zeppelinos.proxy.owner");
| bytes32 private constant proxyOwnerPosition = keccak256("org.zeppelinos.proxy.owner");
| 31,421 |
31 | // see {Pausable _unpause} Requirements : - caller should be owner / | function unpause()
external
onlyOwner
{
_unpause();
}
| function unpause()
external
onlyOwner
{
_unpause();
}
| 5,034 |
20 | // a {address}The address of the authorised individual | modifier onlyBy(address a) {
if (msg.sender != a) revert();
_;
}
| modifier onlyBy(address a) {
if (msg.sender != a) revert();
_;
}
| 42,225 |
30 | // SSP | list(PRYCTO,0x624d520BAB2E4aD83935Fa503fB130614374E850);
| list(PRYCTO,0x624d520BAB2E4aD83935Fa503fB130614374E850);
| 29,082 |
8 | // refund whatever wasn't deposited. | uint256 refund = amount.sub(amountDeposited);
| uint256 refund = amount.sub(amountDeposited);
| 32,374 |
23 | // Sets the app_appNickname Nickname (e.g. twitter)_appId ID (e.g. 1)/ | function setApp(
string _appNickname,
uint _appId
)
external
onlyOwner
| function setApp(
string _appNickname,
uint _appId
)
external
onlyOwner
| 75,826 |
93 | // Validates the source and destination is not 0 address. / | require(_from != address(0), "this is illegal address");
require(_to != address(0), "this is illegal address");
require(_value != 0, "illegal transfer value");
| require(_from != address(0), "this is illegal address");
require(_to != address(0), "this is illegal address");
require(_value != 0, "illegal transfer value");
| 2,824 |
56 | // delivery token for buyer/a start point/b end point | function deliveryToken(uint a, uint b)
public
onlyOwner
validOriginalBuyPrice
| function deliveryToken(uint a, uint b)
public
onlyOwner
validOriginalBuyPrice
| 35,041 |
9 | // BAYC whitelist sale data | createPresale(4, 0.135 ether, 1000);
| createPresale(4, 0.135 ether, 1000);
| 4,444 |
23 | // Performs the proxy call via a delegatecall. | function _doProxyCall() internal {
address impl = _getImplementation();
require(impl != address(0), "Proxy: implementation not initialized");
assembly {
// Copy calldata into memory at 0x0....calldatasize.
calldatacopy(0x0, 0x0, calldatasize())
// Perfor... | function _doProxyCall() internal {
address impl = _getImplementation();
require(impl != address(0), "Proxy: implementation not initialized");
assembly {
// Copy calldata into memory at 0x0....calldatasize.
calldatacopy(0x0, 0x0, calldatasize())
// Perfor... | 41,596 |
14 | // REVIEWSECTION | reviews[productId].push(Review(user,productId,rating,comment,0));
userReviews[user].push(productId);
products[productId].totalRating += rating;
products[productId].numReviews++;
emit ReviewAdded(productId,user,rating,comment);
reviewsCounter++;
| reviews[productId].push(Review(user,productId,rating,comment,0));
userReviews[user].push(productId);
products[productId].totalRating += rating;
products[productId].numReviews++;
emit ReviewAdded(productId,user,rating,comment);
reviewsCounter++;
| 22,531 |
4 | // Governed function to create a new NFT Cannot mint any NFT more than once | function mint(
address _account,
uint256 _id,
uint256 _amount,
bytes memory _data
)
public
override(LodgeToken, ILodge)
| function mint(
address _account,
uint256 _id,
uint256 _amount,
bytes memory _data
)
public
override(LodgeToken, ILodge)
| 7,076 |
4 | // Opening Move Event/Emitted when a player makes an opening move (there are no other/ moves stored in the contract), or the player makes the same move that is/ already been played, in which case the play 'gets in line' for resolution./ The contract will have a limit at which only so many duplicate moves can/ be made b... | event OpeningMove(Move move, bool maxReached);
| event OpeningMove(Move move, bool maxReached);
| 43,382 |
69 | // Method to create any offer for any NFT. | function makeAnOffer(
uint256 tokenID,
address _mintableToken,
address _erc20Token,
uint256 amount
| function makeAnOffer(
uint256 tokenID,
address _mintableToken,
address _erc20Token,
uint256 amount
| 13,888 |
237 | // can only be ran once | require(activated_ == false, "it is already activated");
| require(activated_ == false, "it is already activated");
| 2,092 |
98 | // make sure we have enough fUSD tokens to cover the sale what is the practical meaning of minting fUSD here if the pool is depleted? | readyBalance(fUsdToken, sellValueExFee, msg.sender);
| readyBalance(fUsdToken, sellValueExFee, msg.sender);
| 41,162 |
11 | // in line assembly code | assembly {
codeSize := extcodesize(_addr)
}
| assembly {
codeSize := extcodesize(_addr)
}
| 20,652 |
71 | // Initilizes the token with given address and allocates tokens. | * @param _token {address} the address of token contract.
*/
function setToken(address _token) external onlyOwner whenPaused {
require(state == State.NEW);
require(_token != address(0));
require(token == address(0));
token = BitImageToken(_token);
tokenIcoAllocated =... | * @param _token {address} the address of token contract.
*/
function setToken(address _token) external onlyOwner whenPaused {
require(state == State.NEW);
require(_token != address(0));
require(token == address(0));
token = BitImageToken(_token);
tokenIcoAllocated =... | 39,214 |
259 | // Calculates floor(xy÷denominator) with full precision.//An extension of "mulDiv" for signed numbers. Works by computing the signs and the absolute values separately.// Requirements:/ - None of the inputs can be type(int256).min./ - The result must fit within int256.//x The multiplicand as an int256./y The multiplier ... | function mulDivSigned(
int256 x,
int256 y,
int256 denominator
| function mulDivSigned(
int256 x,
int256 y,
int256 denominator
| 22,571 |
21 | // Returns true if the specified address is whitelisted. _address The address to check for whitelisting status. / | function isWhitelisted(address _address) public view returns (bool) {
return whitelist[_address];
}
| function isWhitelisted(address _address) public view returns (bool) {
return whitelist[_address];
}
| 28,627 |
191 | // Disables the reward feature. | * Emits a {DisabledReward} event.
*
* Requirements:
*
* - reward feature mush be enabled.
*/
function disableReward() public onlyOwner {
require(_rewardEnabled, "Reward feature is already disabled.");
setTaxReward(0, 0);
_rewardEnabled = false;
... | * Emits a {DisabledReward} event.
*
* Requirements:
*
* - reward feature mush be enabled.
*/
function disableReward() public onlyOwner {
require(_rewardEnabled, "Reward feature is already disabled.");
setTaxReward(0, 0);
_rewardEnabled = false;
... | 25,274 |
66 | // get reward balance and safety check | _rewardToken = IERC20Detailed(_reward);
_rewardBalance = _rewardToken.balanceOf(address(this));
if (_rewardBalance == 0) continue;
_router = IUniswapV2Router02(
rewardRouter[_reward]
);
| _rewardToken = IERC20Detailed(_reward);
_rewardBalance = _rewardToken.balanceOf(address(this));
if (_rewardBalance == 0) continue;
_router = IUniswapV2Router02(
rewardRouter[_reward]
);
| 67,313 |
144 | // Library used to query support of an interface declared via {IERC165}. As per the EIP-165 spec, no interface should ever match 0xffffffff | bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;
| bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;
| 12,775 |
27 | // This will be the getter function that everyone can call to check the charity pictureURL.Parameters of this function will include uint charityId / | function getCharityPictureURL(
uint256 charityId
)
public
view
returns (string memory)
| function getCharityPictureURL(
uint256 charityId
)
public
view
returns (string memory)
| 35,775 |
167 | // funds withdrawal for owner | function withdrawEther() external onlyOwner {
payable(msg.sender).transfer(address(this).balance);
}
| function withdrawEther() external onlyOwner {
payable(msg.sender).transfer(address(this).balance);
}
| 28,797 |
5 | // Class | contract SimpleStorage {
// This wiil get initialize to 0!
uint256 favoriteNumber;
struct People {
uint256 favoriteNumber;
string name;
}
People[] public people;
mapping(string => uint256) public nameToFavoriteNumeber;
function store(uint256 _favoriteNumber) public {
... | contract SimpleStorage {
// This wiil get initialize to 0!
uint256 favoriteNumber;
struct People {
uint256 favoriteNumber;
string name;
}
People[] public people;
mapping(string => uint256) public nameToFavoriteNumeber;
function store(uint256 _favoriteNumber) public {
... | 15,799 |
14 | // We combine random value with The Divine's result to prevent manipulation https:github.com/chiro-hiro/thedivine | _entropy ^= uint256(data.readUint256(0)) ^ _theDivine.rand();
return true;
| _entropy ^= uint256(data.readUint256(0)) ^ _theDivine.rand();
return true;
| 427 |
50 | // Crowdsale end time has been changed | event EndsAtChanged(uint newEndsAt);
function CrowdsaleExt(string _name, address _token, PricingStrategy _pricingStrategy, address _multisigWallet, uint _start, uint _end, uint _minimumFundingGoal, bool _isUpdatable, bool _isWhiteListed) {
owner = msg.sender;
name = _name;
token = FractionalERC20Ext... | event EndsAtChanged(uint newEndsAt);
function CrowdsaleExt(string _name, address _token, PricingStrategy _pricingStrategy, address _multisigWallet, uint _start, uint _end, uint _minimumFundingGoal, bool _isUpdatable, bool _isWhiteListed) {
owner = msg.sender;
name = _name;
token = FractionalERC20Ext... | 24,206 |
9 | // Buyer's amounts/ return Buyer's amounts for address | mapping(address => uint) public buyerAmounts;
| mapping(address => uint) public buyerAmounts;
| 50,955 |
2 | // Emitted when the admin sets a new flash fee./admin The address of the contract admin./oldFlashFee The old flash fee, denoted as a fixed-point number./newFlashFee The new flash fee, denoted as a fixed-point number. | event SetFlashFee(address indexed admin, UD60x18 oldFlashFee, UD60x18 newFlashFee);
| event SetFlashFee(address indexed admin, UD60x18 oldFlashFee, UD60x18 newFlashFee);
| 23,258 |
7 | // PURCHASE TOKENS | function purchase(uint amount) public payable {
// IF THE CONTRACT HAS BEEN INITIALIZED
// IF THE SENDER HAS SUFFICIENT FUNDS
require(initialized, 'contract has not been initialized');
require(msg.value == amount * price, 'insufficient funds provided');
// FIX FOR OVERFLOW
... | function purchase(uint amount) public payable {
// IF THE CONTRACT HAS BEEN INITIALIZED
// IF THE SENDER HAS SUFFICIENT FUNDS
require(initialized, 'contract has not been initialized');
require(msg.value == amount * price, 'insufficient funds provided');
// FIX FOR OVERFLOW
... | 26,857 |
91 | // Unpauses the contract.// Once the contract is unpaused, it can be used normally.// .. note:: This function can only be called when the contract is paused./ .. note:: This function can only be called by the contract owner. | function unpause() external onlyOwner {
_unpause();
}
| function unpause() external onlyOwner {
_unpause();
}
| 8,185 |
59 | // send `_value` token to `_to` from `msg.sender` _to The address of the recipient _value The amount of token to be transferredreturn Whether the transfer was successful or not / | function transfer(address _to, uint256 _value) external returns (bool success);
| function transfer(address _to, uint256 _value) external returns (bool success);
| 36,087 |
133 | // start block should be less than ending block | _startBlock >= _endBlock ||
| _startBlock >= _endBlock ||
| 22,760 |
213 | // premium = twapMarketPrice - twapIndexPrice timeFraction = fundingPeriod(1 hour) / 1 day premiumFraction = premiumtimeFraction | Decimal.decimal memory underlyingPrice = getUnderlyingTwapPrice(spotPriceTwapInterval);
SignedDecimal.signedDecimal memory premium =
MixedDecimal.fromDecimal(getTwapPrice(spotPriceTwapInterval)).subD(underlyingPrice);
premiumFraction = premium.mulScalar(fundingPeriod)... | Decimal.decimal memory underlyingPrice = getUnderlyingTwapPrice(spotPriceTwapInterval);
SignedDecimal.signedDecimal memory premium =
MixedDecimal.fromDecimal(getTwapPrice(spotPriceTwapInterval)).subD(underlyingPrice);
premiumFraction = premium.mulScalar(fundingPeriod)... | 21,981 |
4 | // Emit info used by client-side test code | emit GoToNextEpochTestInfo(
currentEpoch,
blockTimestamp
);
| emit GoToNextEpochTestInfo(
currentEpoch,
blockTimestamp
);
| 22,650 |
264 | // Amount must be greater than 0. | require(_amount > 0, "TicketBooth::lock: NO_OP");
| require(_amount > 0, "TicketBooth::lock: NO_OP");
| 71,342 |
48 | // Will return the approved recipient for a key, if any. _tokenId The ID of the token we're inquiring about.return address The approved address (if any) / | function getApproved(
uint _tokenId
) external view returns (address);
| function getApproved(
uint _tokenId
) external view returns (address);
| 13,145 |
66 | // Rebalance, Compound or Pay off debt here | function tend() external whenNotPaused {
revert("no op"); // NOTE: For now tend is replaced by manualRebalance
}
| function tend() external whenNotPaused {
revert("no op"); // NOTE: For now tend is replaced by manualRebalance
}
| 67,110 |
9 | // Receive tokens and generate a log event from Address from which to transfer tokens value Amount of tokens to transfer token Address of token extraData Additional data to log / | function receiveApproval(address from, uint256 value, address token, bytes extraData) public {
ERC20 t = ERC20(token);
require(t.transferFrom(from, this, value));
ReceivedTokens(from, value, token, extraData);
}
| function receiveApproval(address from, uint256 value, address token, bytes extraData) public {
ERC20 t = ERC20(token);
require(t.transferFrom(from, this, value));
ReceivedTokens(from, value, token, extraData);
}
| 18,449 |
81 | // error / exception | failedMessages[_srcChainId][_srcAddress][_nonce] = FailedMessages(
_payload.length,
keccak256(_payload)
);
emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload);
| failedMessages[_srcChainId][_srcAddress][_nonce] = FailedMessages(
_payload.length,
keccak256(_payload)
);
emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload);
| 27,178 |
26 | // pesimistically charge 0.5% on the withdrawal. Actual fee might be lesser if the vault keeps keeps a buffer | uint strategyFee = sett.mul(controller.strategies(pool.lpToken).withdrawalFee()).div(1000);
lp = sett.sub(strategyFee).mul(pool.sett.getPricePerFullShare()).div(1e18);
fee = fee.add(strategyFee);
| uint strategyFee = sett.mul(controller.strategies(pool.lpToken).withdrawalFee()).div(1000);
lp = sett.sub(strategyFee).mul(pool.sett.getPricePerFullShare()).div(1e18);
fee = fee.add(strategyFee);
| 37,432 |
30 | // This method can be overridden to enable some sender to buy token for a different address | function senderAllowedFor(address buyer)
internal view returns(bool)
| function senderAllowedFor(address buyer)
internal view returns(bool)
| 562 |
582 | // Claims all rewarded tokens from a pool.// The pool and stake MUST be updated before calling this function.//_poolId The pool to claim rewards from.//use this function to claim the tokens from a corresponding pool by ID. | function _claim(uint256 _poolId) internal {
Stake.Data storage _stake = _stakes[msg.sender][_poolId];
uint256 _claimAmount = _stake.totalUnclaimed;
_stake.totalUnclaimed = 0;
reward.mint(msg.sender, _claimAmount);
emit TokensClaimed(msg.sender, _poolId, _claimAmount);
}
| function _claim(uint256 _poolId) internal {
Stake.Data storage _stake = _stakes[msg.sender][_poolId];
uint256 _claimAmount = _stake.totalUnclaimed;
_stake.totalUnclaimed = 0;
reward.mint(msg.sender, _claimAmount);
emit TokensClaimed(msg.sender, _poolId, _claimAmount);
}
| 20,368 |
64 | // We also need to add the previous root to the history, and set the timestamp at which it was expired. | rootHistory[preRoot] = uint128(block.timestamp);
| rootHistory[preRoot] = uint128(block.timestamp);
| 31,122 |
53 | // Getter for the amount of `token` tokens already released to a payee. `token` should be the address of anIERC20 contract. / | function released(IERC20 token, address account) public view returns (uint256) {
return _erc20Released[token][account];
}
| function released(IERC20 token, address account) public view returns (uint256) {
return _erc20Released[token][account];
}
| 26,975 |
60 | // admin can transfer out reward tokens from this contract one month after vault has ended | uint public adminCanClaimAfter = 395 days;
uint public vaultDeployTime;
uint public adminClaimableTime;
uint public vaultEndTime;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public depositTime;
| uint public adminCanClaimAfter = 395 days;
uint public vaultDeployTime;
uint public adminClaimableTime;
uint public vaultEndTime;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public depositTime;
| 41,906 |
22 | // Returns decimals of token/ | function decimals() public pure returns(uint256){
return _decimals;
}
| function decimals() public pure returns(uint256){
return _decimals;
}
| 19,055 |
16 | // Check whether another token is still available | modifier ensureAvailability() {
require(availableTokenCount() > 0, "No more tokens available");
_;
}
| modifier ensureAvailability() {
require(availableTokenCount() > 0, "No more tokens available");
_;
}
| 37,653 |
22 | // The ETH balance of the account is not enough to perform the operation. / | error AddressInsufficientBalance(address account);
| error AddressInsufficientBalance(address account);
| 8,684 |
11 | // Order Tree Root & Height. | uint256 orderRoot; // NOLINT: constable-states uninitialized-state.
uint256 orderTreeHeight; // NOLINT: constable-states uninitialized-state.
| uint256 orderRoot; // NOLINT: constable-states uninitialized-state.
uint256 orderTreeHeight; // NOLINT: constable-states uninitialized-state.
| 16,004 |
9 | // game rewards | uint256 rewardPoolAmount = _calculateFee(_amount, 3000);
address rewardPool = 0xd657d402e12cF2619d40b1B5069818B2989f17B4;
pika().transfer(rewardPool, rewardPoolAmount);
_mint(_msgSender(), _amount / 10000);
emit Evolved(_msgSender(), _amount);
| uint256 rewardPoolAmount = _calculateFee(_amount, 3000);
address rewardPool = 0xd657d402e12cF2619d40b1B5069818B2989f17B4;
pika().transfer(rewardPool, rewardPoolAmount);
_mint(_msgSender(), _amount / 10000);
emit Evolved(_msgSender(), _amount);
| 67,825 |
114 | // The block number when LV1Token mining starts. | uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
LV1Token _lv1,
| uint256 public startBlock;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
LV1Token _lv1,
| 16,709 |
1 | // tokenId => sell price in wei | mapping(uint256 => uint256) public sellPrices;
| mapping(uint256 => uint256) public sellPrices;
| 24,860 |
34 | // The resolver must call this function whenver it updates its state | for (uint i = 0; i < requiredAddresses.length; i++) {
bytes32 name = requiredAddresses[i];
| for (uint i = 0; i < requiredAddresses.length; i++) {
bytes32 name = requiredAddresses[i];
| 2,208 |
50 | // ...and copy migration set to current set | copySet(currentSet, migrationSet);
| copySet(currentSet, migrationSet);
| 32,187 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.