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 |
|---|---|---|---|---|
214 | // Makes an arbitrary call with the VaultProxy contract as the sender/_contract The contract to call/_selector The selector to call/_encodedArgs The encoded arguments for the call/ return returnData_ The data returned by the call | function vaultCallOnContract(
address _contract,
bytes4 _selector,
bytes calldata _encodedArgs
| function vaultCallOnContract(
address _contract,
bytes4 _selector,
bytes calldata _encodedArgs
| 38,715 |
38 | // ========== Internal Functions ========== // Open a new position. return The new position and the ID of the opened position / | function openPosition(
uint256 collateralAmount,
uint256 borrowAmount
)
internal
returns (MozartTypes.Position memory, uint256)
| function openPosition(
uint256 collateralAmount,
uint256 borrowAmount
)
internal
returns (MozartTypes.Position memory, uint256)
| 49,871 |
65 | // Returns an `Bytes32Slot` with member `value` located at `slot`. / | function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly {
r.slot := slot
}
}
| function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly {
r.slot := slot
}
}
| 11,943 |
24 | // multiply a UQ112x112 by a uint, returning a UQ144x112reverts on overflow | // function mul(uq112x112 memory self, uint256 y) internal pure returns (uq144x112 memory) {
// uint256 z = 0;
// require(y == 0 || (z = self._x * y) / y == self._x, 'FixedPoint::mul: overflow');
// return uq144x112(z);
// }
| // function mul(uq112x112 memory self, uint256 y) internal pure returns (uq144x112 memory) {
// uint256 z = 0;
// require(y == 0 || (z = self._x * y) / y == self._x, 'FixedPoint::mul: overflow');
// return uq144x112(z);
// }
| 48,622 |
89 | // private view methods/Get actual token price. return price One token price in wei. / | function calcTokenPriceInWei()
private
view
returns(uint256 price)
| function calcTokenPriceInWei()
private
view
returns(uint256 price)
| 41,288 |
4 | // Returns `randomProvider` address. / | function getRandomProvider() external view returns(address) {
return _randomProvider;
}
| function getRandomProvider() external view returns(address) {
return _randomProvider;
}
| 19,169 |
198 | // Deposit LP tokens to YFGFinancing for YFGEN 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.accYFGPerShare).div(1e12).sub(user.rewardDe... | 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.accYFGPerShare).div(1e12).sub(user.rewardDe... | 42,148 |
17 | // This Token is Claimed We need to get you a new one. |
id = uint256(
nextTokenInOrder(
_claimData[i].tokenId,
_claimData[i].startRange,
_claimData[i].endRange
)
); // Get the replacement token
|
id = uint256(
nextTokenInOrder(
_claimData[i].tokenId,
_claimData[i].startRange,
_claimData[i].endRange
)
); // Get the replacement token
| 12,074 |
15 | // Raini rewards | _generalRewardVars.rainiRewardPerTokenStored = uint64(rainiRewardPerToken());
_generalRewardVars.lastUpdateTime = uint32(lastTimeRewardApplicable());
if (_owner != address(0)) {
uint32 duration = uint32(block.timestamp) - _accountRewardVars.lastUpdated;
uint128 reward = calculateReward(_owner, ... | _generalRewardVars.rainiRewardPerTokenStored = uint64(rainiRewardPerToken());
_generalRewardVars.lastUpdateTime = uint32(lastTimeRewardApplicable());
if (_owner != address(0)) {
uint32 duration = uint32(block.timestamp) - _accountRewardVars.lastUpdated;
uint128 reward = calculateReward(_owner, ... | 11,725 |
111 | // Prevents receiving Ether or calls to unsuported methods / | fallback () external {
revert("NiftyswapExchange:UNSUPPORTED_METHOD");
}
| fallback () external {
revert("NiftyswapExchange:UNSUPPORTED_METHOD");
}
| 23,964 |
37 | // 领取剩余 nest | nestDao.collectNestReward();
| nestDao.collectNestReward();
| 157 |
12 | // Check if we will need to add an extra node | if (nextLevelLength % 2 == 1 && nextLevelLength != 1) {
nodes[nextLevelLength] = defaultHashes[currentLevel];
nextLevelLength += 1;
}
| if (nextLevelLength % 2 == 1 && nextLevelLength != 1) {
nodes[nextLevelLength] = defaultHashes[currentLevel];
nextLevelLength += 1;
}
| 6,793 |
2 | // イベント:レジストリ登録 | event Registered(
address indexed contractAddress,
string contractType,
address contractOwner
);
| event Registered(
address indexed contractAddress,
string contractType,
address contractOwner
);
| 52,327 |
7 | // Destination address of gram transfer. | address dest;
| address dest;
| 41,679 |
29 | // MetaSwap - A StableSwap implementation in solidity. This contract is responsible for custody of closely pegged assets (eg. group of stablecoins)and automatic market making system. Users become an LP (Liquidity Provider) by depositing their tokensin desired ratios for an exchange of the pool token that represents the... | contract MetaSwap is Swap {
using MetaSwapUtils for SwapUtils.Swap;
MetaSwapUtils.MetaSwap public metaSwapStorage;
uint256 constant MAX_UINT256 = 2**256 - 1;
/*** EVENTS ***/
// events replicated from SwapUtils to make the ABI easier for dumb
// clients
event TokenSwapUnderlying(
... | contract MetaSwap is Swap {
using MetaSwapUtils for SwapUtils.Swap;
MetaSwapUtils.MetaSwap public metaSwapStorage;
uint256 constant MAX_UINT256 = 2**256 - 1;
/*** EVENTS ***/
// events replicated from SwapUtils to make the ABI easier for dumb
// clients
event TokenSwapUnderlying(
... | 25,983 |
1 | // | // modifier checkPublicAllow() {
// require(publicAllowed || msg.sender == operator, "!operator nor !publicAllowed");
// _;
// }
| // modifier checkPublicAllow() {
// require(publicAllowed || msg.sender == operator, "!operator nor !publicAllowed");
// _;
// }
| 6,683 |
23 | // Credit each router that provided liquidity their due 'share' of the asset. | uint256 routerAmount = _amount / pathLen;
for (uint256 i; i < pathLen - 1; ) {
s.routerBalances[routers[i]][_asset] += routerAmount;
unchecked {
++i;
}
| uint256 routerAmount = _amount / pathLen;
for (uint256 i; i < pathLen - 1; ) {
s.routerBalances[routers[i]][_asset] += routerAmount;
unchecked {
++i;
}
| 10,369 |
78 | // IMaintainersRegistry contract. Nikola MadjarevicDate created: 3.5.21.Github: madjarevicn / | interface IMaintainersRegistry {
function isMaintainer(address _address) external view returns (bool);
}
| interface IMaintainersRegistry {
function isMaintainer(address _address) external view returns (bool);
}
| 53,944 |
90 | // 回收本金 | function withdraw(uint256 amount,
address user)
public
onlyWithdrawnAdmin
| function withdraw(uint256 amount,
address user)
public
onlyWithdrawnAdmin
| 4,356 |
65 | // check if the dnsName Reservation is allowed/ | function isDNSNameReservationAllowed(bytes32 _dnsName) internal view returns (bool _isValid) {
return !isAValidDNSName(_dnsName);
}
| function isDNSNameReservationAllowed(bytes32 _dnsName) internal view returns (bool _isValid) {
return !isAValidDNSName(_dnsName);
}
| 53,570 |
57 | // Index | function index_set_leverage(address _index, uint256 _target) external {
require(msg.sender == parameter_admin, "Access denied");
IIndexTemplate(_index).setLeverage(_target);
}
| function index_set_leverage(address _index, uint256 _target) external {
require(msg.sender == parameter_admin, "Access denied");
IIndexTemplate(_index).setLeverage(_target);
}
| 38,432 |
33 | // Kovan addresses, not used on mainnet | address public constant COMPOUND_DAI_ADDRESS = 0x25a01a05C188DaCBCf1D61Af55D4a5B4021F7eeD;
address public constant STUPID_EXCHANGE = 0x863E41FE88288ebf3fcd91d8Dbb679fb83fdfE17;
| address public constant COMPOUND_DAI_ADDRESS = 0x25a01a05C188DaCBCf1D61Af55D4a5B4021F7eeD;
address public constant STUPID_EXCHANGE = 0x863E41FE88288ebf3fcd91d8Dbb679fb83fdfE17;
| 32,902 |
2 | // Time after which the CRYPTO NUGGETSare randomized and revealed 7 days from instantly after initial launch). | uint256 public constant REVEAL_TIMESTAMP = SALE_START_TIMESTAMP;
| uint256 public constant REVEAL_TIMESTAMP = SALE_START_TIMESTAMP;
| 6,220 |
177 | // ``` As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) aresupported. / | library EnumerableMap {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Map type with
// bytes32 keys and values.
// The Map implementation uses private functions, and user-facing
// implementations (such as Uint256ToAd... | library EnumerableMap {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Map type with
// bytes32 keys and values.
// The Map implementation uses private functions, and user-facing
// implementations (such as Uint256ToAd... | 481 |
351 | // Recreate the digest the user signed | bytes32 delegationDigest;
if (_signatureType == 2) {
delegationDigest = keccak256(
abi.encodePacked(
DELEGATION_HASH_EIP712, keccak256(
abi.encodePacked(
address(this),
_proposalId,
... | bytes32 delegationDigest;
if (_signatureType == 2) {
delegationDigest = keccak256(
abi.encodePacked(
DELEGATION_HASH_EIP712, keccak256(
abi.encodePacked(
address(this),
_proposalId,
... | 7,744 |
47 | // Reclaim all BUSD at the contract address.This sends the BUSD tokens that this contract add holding to the owner.Note: this is not affected by freeze constraints. / | function reclaimBUSD() external onlyOwner {
uint256 _balance = balances[this];
balances[this] = 0;
balances[owner] = balances[owner].add(_balance);
emit Transfer(this, owner, _balance);
}
| function reclaimBUSD() external onlyOwner {
uint256 _balance = balances[this];
balances[this] = 0;
balances[owner] = balances[owner].add(_balance);
emit Transfer(this, owner, _balance);
}
| 26,143 |
79 | // `pendingOnchainOpsPubdata` only contains ops of the current chain no need to check chain id |
if (opType == Operations.OpType.Withdraw) {
Operations.Withdraw memory op = Operations.readWithdrawPubdata(pubData);
|
if (opType == Operations.OpType.Withdraw) {
Operations.Withdraw memory op = Operations.readWithdrawPubdata(pubData);
| 28,632 |
12 | // Divides two numbers and returns the remainder (unsigned integer modulo), reverts when dividing by zero._dividend Number._divisor Number. return Remainder./ | function mod(
uint256 _dividend,
uint256 _divisor
)
internal
pure
returns (uint256 remainder)
| function mod(
uint256 _dividend,
uint256 _divisor
)
internal
pure
returns (uint256 remainder)
| 22,155 |
3 | // 取 _ms[i+1] 的后 4 位,在末尾补 _ms[i+2] 的前 2 位作为 base64 字符 2 的索引 | uint c2 = (uint(uint8(_ms[i+1])) & 15) << 2 | uint(uint8(_ms[i+2])) >> 6;
| uint c2 = (uint(uint8(_ms[i+1])) & 15) << 2 | uint(uint8(_ms[i+2])) >> 6;
| 23,901 |
4 | // The attribute structure: every attribute is composed of:- Attribute hash- Endorsements / | struct Attribute {
bytes32 hash;
mapping(bytes32 => Endorsement) endorsements;
}
| struct Attribute {
bytes32 hash;
mapping(bytes32 => Endorsement) endorsements;
}
| 38,143 |
62 | // Drives Cat's Token ICO / | contract CatICO {
using SafeMath for uint256;
/// Starts at 21 Sep 2017 05:00:00 UTC
// uint256 public start = 1505970000;
uint256 public start = 1503970000;
/// Ends at 21 Nov 2017 05:00:00 UTC
uint256 public end = 1511240400;
/// Keeps supplied ether
address public wallet;
/// ... | contract CatICO {
using SafeMath for uint256;
/// Starts at 21 Sep 2017 05:00:00 UTC
// uint256 public start = 1505970000;
uint256 public start = 1503970000;
/// Ends at 21 Nov 2017 05:00:00 UTC
uint256 public end = 1511240400;
/// Keeps supplied ether
address public wallet;
/// ... | 49,275 |
117 | // ============ Core Methods ============ |
function getPartial(
uint256 target,
uint256 numerator,
uint256 denominator
)
private
pure
returns (uint256)
|
function getPartial(
uint256 target,
uint256 numerator,
uint256 denominator
)
private
pure
returns (uint256)
| 1,243 |
19 | // adds Shiba inu rewards system to nfts |
mapping(uint256 => uint256) ClaimedAmountOfNFT;
uint256 public claimPerNFT;
uint256 public totalClaimGlobal;
IERC20 shiba = IERC20(0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE);
|
mapping(uint256 => uint256) ClaimedAmountOfNFT;
uint256 public claimPerNFT;
uint256 public totalClaimGlobal;
IERC20 shiba = IERC20(0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE);
| 66,638 |
185 | // This function reverts if the caller does not have the admin role.//_toBlacklist the account to mint tokens to. | function setBlacklist(address _toBlacklist) external onlySentinel {
blacklist[_toBlacklist] = true;
}
| function setBlacklist(address _toBlacklist) external onlySentinel {
blacklist[_toBlacklist] = true;
}
| 23,905 |
11 | // Here we do some "dumb" work in order to burn gas, although we should probably replace this with something like minting gas token later on. | uint256 i;
while(startingGas - gasleft() < gasToConsume) {
i++;
}
| uint256 i;
while(startingGas - gasleft() < gasToConsume) {
i++;
}
| 27,897 |
7 | // Add 1 wei for markets 0-1 and 2 wei for markets 2-3 | return
tokenAmount.add(marketIdFromTokenAddress(tokenAddress) < 2 ? 1 : 2);
| return
tokenAmount.add(marketIdFromTokenAddress(tokenAddress) < 2 ? 1 : 2);
| 6,579 |
21 | // Internal function that mints a specified number of ERC721 tokens to a specific address.contains NO SAFETY CHECKS and thus should be wrapped in a function that does. to_ address: The address to mint the tokens to. numMint uint16: The number of tokens to be minted. / | function _safeMintTokens(address to_, uint16 numMint) internal {
for (uint16 i = 0; i < numMint; ++i) {
_tokenIdCounter.increment();
_safeMint(to_, _tokenIdCounter.current());
}
}
| function _safeMintTokens(address to_, uint16 numMint) internal {
for (uint16 i = 0; i < numMint; ++i) {
_tokenIdCounter.increment();
_safeMint(to_, _tokenIdCounter.current());
}
}
| 20,170 |
260 | // moves any unmasked earnings to gen vault.updates earnings mask / | function updateGenVault(uint256 _pID, uint256 _rIDlast)
private
| function updateGenVault(uint256 _pID, uint256 _rIDlast)
private
| 32,311 |
75 | // Destroy minted tokens and refund ether spent by investor. Used in AML (Anti Money Laundering) workflow. Will be called only by humans because there is no way to withdraw crowdfunded ether from Beneficiary account from context of this account. Important note: all tokens minted to team, foundation etc. will NOT be bur... | function burnTokensAndRefund(address _address)
external
payable
addrNotNull(_address)
onlyOwner()
| function burnTokensAndRefund(address _address)
external
payable
addrNotNull(_address)
onlyOwner()
| 14,086 |
14 | // Access Controls contract for the Frosty Platform Blochainerr / | contract FrostyAccessControls is AccessControl {
/// @notice Role definitions
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant SMART_CONTRACT_ROLE = keccak256("SMART_CONTRACT_ROLE");
/// @notice Events for adding and removing various roles
event AdminRoleGrant... | contract FrostyAccessControls is AccessControl {
/// @notice Role definitions
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant SMART_CONTRACT_ROLE = keccak256("SMART_CONTRACT_ROLE");
/// @notice Events for adding and removing various roles
event AdminRoleGrant... | 44,900 |
113 | // Remove the offer from storage and refund the offerer. | address offerer = offer.offerer;
uint128 amount = offer.amount;
| address offerer = offer.offerer;
uint128 amount = offer.amount;
| 30,935 |
0 | // Required interface of an ERC721 compliant contract. / | contract IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanc... | contract IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanc... | 2,159 |
7 | // Charge ETH fee for contract creation | require(
msg.value >= settings.getPresaleCreateFee() + settings.getLockFee(),
"Balance is insufficent"
);
require(_presale_info.token_rate > 0, "token rate is invalid");
require(
_presale_info.raise_min < _presale_info.raise_max,
"raise mi... | require(
msg.value >= settings.getPresaleCreateFee() + settings.getLockFee(),
"Balance is insufficent"
);
require(_presale_info.token_rate > 0, "token rate is invalid");
require(
_presale_info.raise_min < _presale_info.raise_max,
"raise mi... | 14,742 |
48 | // Stakeless Gauge Checkpointer Implements IStakelessGaugeCheckpointer; refer to it for API documentation. / | contract StakelessGaugeCheckpointer is IStakelessGaugeCheckpointer, ReentrancyGuard, SingletonAuthentication {
using EnumerableSet for EnumerableSet.AddressSet;
bytes32 private immutable _arbitrum = keccak256(abi.encodePacked("Arbitrum"));
mapping(string => EnumerableSet.AddressSet) private _gauges;
I... | contract StakelessGaugeCheckpointer is IStakelessGaugeCheckpointer, ReentrancyGuard, SingletonAuthentication {
using EnumerableSet for EnumerableSet.AddressSet;
bytes32 private immutable _arbitrum = keccak256(abi.encodePacked("Arbitrum"));
mapping(string => EnumerableSet.AddressSet) private _gauges;
I... | 34,487 |
70 | // To prevent flash loan sandwich attacks to 'steal' the profit, only the owner can harvest the COMP Swap all COMP to WETH | _swapAll(compToken, weth, address(this));
| _swapAll(compToken, weth, address(this));
| 80,806 |
14 | // `msg.sender` approves `_addr` to spend `_value` tokens _spender The address of the account able to transfer the tokens _value The amount of wei to be approved for transferreturn Whether the approval was successful or not / | function approve(address _spender, uint256 _value) returns (bool);
| function approve(address _spender, uint256 _value) returns (bool);
| 32,977 |
2 | // remove Address from whitelist/adr Address to remove | function removeAddress(address adr) external onlyOwner {
emit AddressRemoved(adr);
delete whitelist[adr];
for(uint i = 0; i < allAddresses.length; i++){
if(allAddresses[i] == adr) {
allAddresses[i] = allAddresses[allAddresses.length - 1];
allAddres... | function removeAddress(address adr) external onlyOwner {
emit AddressRemoved(adr);
delete whitelist[adr];
for(uint i = 0; i < allAddresses.length; i++){
if(allAddresses[i] == adr) {
allAddresses[i] = allAddresses[allAddresses.length - 1];
allAddres... | 25,278 |
6 | // compound, y, busd, pax and susd pools | function remove_liquidity_one_coin(
uint256 _token_amount,
int128 i,
uint256 min_uamount,
bool donate_dust
) external;
function calc_withdraw_one_coin(uint256 _token_amount, int128 i)
external
view
| function remove_liquidity_one_coin(
uint256 _token_amount,
int128 i,
uint256 min_uamount,
bool donate_dust
) external;
function calc_withdraw_one_coin(uint256 _token_amount, int128 i)
external
view
| 39,020 |
11 | // in the case of private notification, it is assumed that fields like title, action, bodyand imageHash have already been encrypted by the sender who is compulsarily admin of channel in that case. | function notifyOneInChannel(
address _recipient,
uint256 _channel,
string memory _title,
string memory _action,
string memory _body,
string memory _imageHash,
bool _privateNotification
| function notifyOneInChannel(
address _recipient,
uint256 _channel,
string memory _title,
string memory _action,
string memory _body,
string memory _imageHash,
bool _privateNotification
| 24,014 |
2 | // The transaction fee (in basis points) as a portion of the sale price | uint256 public feePortion;
| uint256 public feePortion;
| 13,805 |
91 | // Returns array with owner addresses, which confirmed transaction./transactionId Transaction ID./ return _confirmations Returns array of owner addresses?. | function getConfirmations(uint transactionId)
public
view
returns (address[] memory _confirmations)
| function getConfirmations(uint transactionId)
public
view
returns (address[] memory _confirmations)
| 13,000 |
146 | // Updates default base URI to `_defaultBaseURI`. Thecontract-level defaultBaseURI is only used when initializing newprojects. Token URIs are determined by their project's `projectBaseURI`. _defaultBaseURI New default base URI. / | function updateDefaultBaseURI(string memory _defaultBaseURI)
external
onlyAdminACL(this.updateDefaultBaseURI.selector)
onlyNonEmptyString(_defaultBaseURI)
| function updateDefaultBaseURI(string memory _defaultBaseURI)
external
onlyAdminACL(this.updateDefaultBaseURI.selector)
onlyNonEmptyString(_defaultBaseURI)
| 4,225 |
24 | // Cast the received randomness to a uint128 | uint128 randomnessCast = uint128(randomness % MAX_UINT128);
| uint128 randomnessCast = uint128(randomness % MAX_UINT128);
| 1,975 |
46 | // Up won | if (resolvedTo[_epoch] == 1) {
if (totalSharesUp[_epoch] == 0) {
return 0;
} else {
| if (resolvedTo[_epoch] == 1) {
if (totalSharesUp[_epoch] == 0) {
return 0;
} else {
| 1,140 |
1 | // ignore slippage | IUniswapV2Router01(router).addLiquidityETH{value : msg.value}(myToken, tokenAmount, 0, 0, msg.sender, block.timestamp);
| IUniswapV2Router01(router).addLiquidityETH{value : msg.value}(myToken, tokenAmount, 0, 0, msg.sender, block.timestamp);
| 9,535 |
33 | // Create an empty array to store the result Should be the same length as the staked tokens set | uint256[] memory tokenIds = new uint256[](stakedTokensLength);
| uint256[] memory tokenIds = new uint256[](stakedTokensLength);
| 35,277 |
95 | // GOVERNANCE FUNCTION: Edit an existing asset pair's oracle._assetOne Address of first asset in pair _assetTwo Address of second asset in pair _oracle Address of asset pair's new oracle / | function editPair(address _assetOne, address _assetTwo, IOracle _oracle) external onlyOwner {
require(
address(oracles[_assetOne][_assetTwo]) != address(0),
"PriceOracle.editPair: Pair doesn't exist."
);
oracles[_assetOne][_assetTwo] = _oracle;
emit PairEdite... | function editPair(address _assetOne, address _assetTwo, IOracle _oracle) external onlyOwner {
require(
address(oracles[_assetOne][_assetTwo]) != address(0),
"PriceOracle.editPair: Pair doesn't exist."
);
oracles[_assetOne][_assetTwo] = _oracle;
emit PairEdite... | 7,440 |
304 | // push into mapping of NFTs by base owner (owner[0]) | nftMap[owner[0]].push(nft);
| nftMap[owner[0]].push(nft);
| 15,677 |
204 | // Mapping for wallet addresses that have previously minted | mapping(address => uint256) private _whitelistMinters;
string internal baseTokenURI;
string internal baseTokenURI_extension;
uint public constant maxTokens = 500;
uint public total = 0;
uint mintCost = 0.05 ether;
bool whitelistActive;
| mapping(address => uint256) private _whitelistMinters;
string internal baseTokenURI;
string internal baseTokenURI_extension;
uint public constant maxTokens = 500;
uint public total = 0;
uint mintCost = 0.05 ether;
bool whitelistActive;
| 22,051 |
89 | // Start payment not complete? Then end payment surely not complete. | if(!isStartPaymentComplete()) return;
for (uint i = 1; i <= backerIndex; i++)
{
| if(!isStartPaymentComplete()) return;
for (uint i = 1; i <= backerIndex; i++)
{
| 30,335 |
108 | // Fund the Loan. | ILiquidityLocker(liquidityLocker).fundLoan(loan, debtLocker, amt);
emit LoanFunded(loan, debtLocker, amt);
| ILiquidityLocker(liquidityLocker).fundLoan(loan, debtLocker, amt);
emit LoanFunded(loan, debtLocker, amt);
| 25,111 |
133 | // 0.4 booster | uint32 private constant FEE_TO_BOOSTER = 4 * 1e5;
| uint32 private constant FEE_TO_BOOSTER = 4 * 1e5;
| 35,280 |
21 | // Deposit LP tokens. | function deposit(uint256 _pid, uint256 _amount) public {
address _sender = msg.sender;
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 _pending = user.amount.mul(pool.accTomb... | function deposit(uint256 _pid, uint256 _amount) public {
address _sender = msg.sender;
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][_sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 _pending = user.amount.mul(pool.accTomb... | 10,738 |
8 | // Revert if the owner of the item is not the message sender. itemId itemId of the item. / | modifier isOwner(bytes32 itemId) {
require (itemState[itemId].owner == msg.sender, "Sender is not owner of item.");
_;
}
| modifier isOwner(bytes32 itemId) {
require (itemState[itemId].owner == msg.sender, "Sender is not owner of item.");
_;
}
| 2,170 |
84 | // get fee Collector wallet address / | function getFeeCollector() public view returns (address) {
return _feeCollector;
}
| function getFeeCollector() public view returns (address) {
return _feeCollector;
}
| 42,526 |
17 | // Computes the reward balance in ETH of the operator of a pool./poolId Unique id of pool./ return reward Balance in ETH. | function computeRewardBalanceOfOperator(bytes32 poolId)
external
view
returns (uint256 reward);
| function computeRewardBalanceOfOperator(bytes32 poolId)
external
view
returns (uint256 reward);
| 25,088 |
34 | // 32 is the length in bytes of hash, enforced by the type signature above | return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
| return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
| 36,557 |
70 | // Sets `amount` as the allowance of `spender` over the `owner` s tokens. This internal function is equivalent to `approve`, and can be used toe.g. set automatic allowances for certain subsystems, etc. | * Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero... | * Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero... | 21,283 |
12 | // Modifier to make a function callable only when the contract is not paused. / | modifier whenNotPaused() {
require(!paused);
_;
}
| modifier whenNotPaused() {
require(!paused);
_;
}
| 4,430 |
14 | // This function can be enabled or disabled by calling function SetV2toV1Status(_TrueOrFalse); | function MigrateV2toV1tokens() external {
uint256 amountV2 = GetV2BalanceOf(msg.sender);
require(enableV2toV1 && migrationEnabled && amountV2 > minimumV2Balance, "MigrationContract: Migration from V2 to V1 is disabled or your tokenV2 balance is insufficient");
IERC20(tokenV2).... | function MigrateV2toV1tokens() external {
uint256 amountV2 = GetV2BalanceOf(msg.sender);
require(enableV2toV1 && migrationEnabled && amountV2 > minimumV2Balance, "MigrationContract: Migration from V2 to V1 is disabled or your tokenV2 balance is insufficient");
IERC20(tokenV2).... | 33,724 |
32 | // start timestamp must be in future | require(block.timestamp < _startTime, 'start timestamp too early');
| require(block.timestamp < _startTime, 'start timestamp too early');
| 15,541 |
14 | // register proposers and cancellers | for (uint256 i = 0; i < proposers.length; ++i) {
_grantRole(PROPOSER_ROLE, proposers[i]);
_grantRole(CANCELLER_ROLE, proposers[i]);
}
| for (uint256 i = 0; i < proposers.length; ++i) {
_grantRole(PROPOSER_ROLE, proposers[i]);
_grantRole(CANCELLER_ROLE, proposers[i]);
}
| 1,500 |
280 | // {IERC20-approve}, and its usage is discouraged. Whenever possible, use {safeIncreaseAllowance} and{safeDecreaseAllowance} instead. / | function safeApprove(IERC20 token, address spender, uint256 value) internal {
| function safeApprove(IERC20 token, address spender, uint256 value) internal {
| 3,127 |
97 | // get AAVE additional apr for a specific aToken market | function getStkAaveApr(address _aToken, address _token) external view returns (uint256) {
IAaveIncentivesController _ctrl = IAaveIncentivesController(AToken(_aToken).getIncentivesController());
(,uint256 aavePerSec,) = _ctrl.getAssetData(_aToken);
uint256 aTokenNAV = IERC20Detailed(_aToken).totalSupply();... | function getStkAaveApr(address _aToken, address _token) external view returns (uint256) {
IAaveIncentivesController _ctrl = IAaveIncentivesController(AToken(_aToken).getIncentivesController());
(,uint256 aavePerSec,) = _ctrl.getAssetData(_aToken);
uint256 aTokenNAV = IERC20Detailed(_aToken).totalSupply();... | 15,004 |
181 | // Internal function to set the base URI for all token IDs. It is | * automatically added as a prefix to the value returned in {tokenURI},
* or to the token ID if {tokenURI} is empty.
*/
function _setBaseURI(string memory baseURI_) internal {
_baseURI = baseURI_;
}
| * automatically added as a prefix to the value returned in {tokenURI},
* or to the token ID if {tokenURI} is empty.
*/
function _setBaseURI(string memory baseURI_) internal {
_baseURI = baseURI_;
}
| 60,619 |
33 | // the function as defined in the breeding contract - as defined in CK bible | function mixGenes(uint256 _genes1, uint256 _genes2, uint256 _targetBlock) public returns (uint256) {
require(block.number > _targetBlock);
// Try to grab the hash of the "target block". This should be available the vast
// majority of the time (it will only fail if no-one calls giveBirth() ... | function mixGenes(uint256 _genes1, uint256 _genes2, uint256 _targetBlock) public returns (uint256) {
require(block.number > _targetBlock);
// Try to grab the hash of the "target block". This should be available the vast
// majority of the time (it will only fail if no-one calls giveBirth() ... | 46,635 |
173 | // Allow refund to investors. Available to the owner of the contract. | function enableRefunds() onlyOwner public {
require(state == State.Active);
state = State.Refunding;
RefundsEnabled();
}
| function enableRefunds() onlyOwner public {
require(state == State.Active);
state = State.Refunding;
RefundsEnabled();
}
| 27,824 |
16 | // TODO: Check price | IUniswapV2Router02(_sushiswap).swapExactTokensForTokens(
sushiBalance,
uint256(0),
paths,
address(this),
block.timestamp + 1800
);
| IUniswapV2Router02(_sushiswap).swapExactTokensForTokens(
sushiBalance,
uint256(0),
paths,
address(this),
block.timestamp + 1800
);
| 23,119 |
14 | // Adds a token as approved. _token The address of the token to be approved.return A boolean indicating whether the operation was successful or not. / | function approveToken(address _token) external onlyAdmin returns (bool) {
require(!approvedTokens[address(this)][_token], "Token is already approved");
approvedTokens[address(this)][_token] = true;
emit TokenApproved(_token);
return true;
}
| function approveToken(address _token) external onlyAdmin returns (bool) {
require(!approvedTokens[address(this)][_token], "Token is already approved");
approvedTokens[address(this)][_token] = true;
emit TokenApproved(_token);
return true;
}
| 17,368 |
31 | // Get a project info _projectId Project Id to fetchreturn Project / | function getProject(
uint256 _projectId
)
public
view
returns (Project memory)
| function getProject(
uint256 _projectId
)
public
view
returns (Project memory)
| 13,652 |
7 | // 35% of entryFee_ (i.e. 7% dividends) is given to referrer | uint8 constant internal refferalFee_ = 35;
uint256 constant internal tokenPriceInitial_ = 0.00180000 ether;
uint256 constant internal tokenPriceIncremental_ = 0.000000001 ether;
uint256 constant internal magnitude = 2 ** 64;
| uint8 constant internal refferalFee_ = 35;
uint256 constant internal tokenPriceInitial_ = 0.00180000 ether;
uint256 constant internal tokenPriceIncremental_ = 0.000000001 ether;
uint256 constant internal magnitude = 2 ** 64;
| 48,127 |
29 | // Cast a vote._choiceIndex the vote choice index./ | function castVote(uint256 _choiceIndex) internal onlyIfActive onlyIfUserVoteAbsent onlyIfValidChoiceIndex(_choiceIndex) onlyIfAuthorizedUser
| function castVote(uint256 _choiceIndex) internal onlyIfActive onlyIfUserVoteAbsent onlyIfValidChoiceIndex(_choiceIndex) onlyIfAuthorizedUser
| 22,089 |
43 | // If an address is holding X percent of the supply, then it can claim up to X percent of the reward pool | uint256 reward = bnbPool * balance / holdersAmount;
if (reward > _maxClaimAllowed) {
reward = _maxClaimAllowed;
}
| uint256 reward = bnbPool * balance / holdersAmount;
if (reward > _maxClaimAllowed) {
reward = _maxClaimAllowed;
}
| 4,996 |
54 | // Pull `tokenB` from msg.sender to add to Uniswap V2 Pair. Warning: calls into msg.sender using `safeTransferFrom`. Msg.sender is not trusted. | IERC20(tokenB).safeTransferFrom(
msg.sender,
address(this),
amountBDesired
);
| IERC20(tokenB).safeTransferFrom(
msg.sender,
address(this),
amountBDesired
);
| 34,062 |
7 | // bump the current data to the list of old adrs before adding new data | uint id = stateCount ++;
state a = stateList[id];
a.ipfsAddr = currentAddr;
a.date = dateUpdated;
| uint id = stateCount ++;
state a = stateList[id];
a.ipfsAddr = currentAddr;
a.date = dateUpdated;
| 10,506 |
4 | // A unique identifier of the AS. | bytes32 schema;
| bytes32 schema;
| 33,512 |
200 | // Changes the reward points for the provided tokens. Reward points are a weighting system that enables certaintokens to accrue DMG faster than others, allowing the protocol to prioritize certain deposits. At the start ofseason 1, mETH had points of 100 (equalling 1) and the stablecoins had 200, doubling their weight a... | function setRewardPointsByTokens(
| function setRewardPointsByTokens(
| 40,370 |
12 | // ----------------------------------------------------- | function claim() whenNotPaused public {
uint256 rewardClass = checkFind(msg.sender);
require(!balances.checkClaimed(msg.sender));
require(rewardClass != 9000);
balances.setClaimed(msg.sender);
balances.addBalance(msg.sender, rewardClass, msg.sender);
emit Mine(msg.... | function claim() whenNotPaused public {
uint256 rewardClass = checkFind(msg.sender);
require(!balances.checkClaimed(msg.sender));
require(rewardClass != 9000);
balances.setClaimed(msg.sender);
balances.addBalance(msg.sender, rewardClass, msg.sender);
emit Mine(msg.... | 45,914 |
52 | // 重置时间 | releaseTime += month30;
success = true;
| releaseTime += month30;
success = true;
| 12,519 |
11 | // public actions | function giftCode(address to) onlyOwner public returns (uint256)
| function giftCode(address to) onlyOwner public returns (uint256)
| 56,897 |
127 | // Public functions / | function transfer(address to, uint value) public returns (bool);
function transferFrom(address from, address to, uint value) public returns (bool);
function approve(address spender, uint value) public returns (bool);
function balanceOf(address owner) public view returns (uint);
function allowance(ad... | function transfer(address to, uint value) public returns (bool);
function transferFrom(address from, address to, uint value) public returns (bool);
function approve(address spender, uint value) public returns (bool);
function balanceOf(address owner) public view returns (uint);
function allowance(ad... | 24,324 |
9 | // In order to fetch and display all ARI | mapping(uint256 => bytes32[]) public houseArikeyMap;
| mapping(uint256 => bytes32[]) public houseArikeyMap;
| 13,443 |
113 | // add token to set | assert(_bonusTokenSet.add(bonusToken));
| assert(_bonusTokenSet.add(bonusToken));
| 72,013 |
100 | // Ensure that the escape hatch account is the caller. | if (msg.sender != escapeHatch) {
revert(_revertReason(7));
}
| if (msg.sender != escapeHatch) {
revert(_revertReason(7));
}
| 32,032 |
8 | // Transfer prize to the winner | payable(winner).transfer(address(this).balance);
uint256 amountToBurn = depositors[winner].totalDeposited;
burnedPRIZE = amountToBurn; // Update the burnedPRIZE variable
prizeToken.transfer(0x000000000000000000000000000000000000dEaD, amountToBurn);
emit WinnerSet(winne... | payable(winner).transfer(address(this).balance);
uint256 amountToBurn = depositors[winner].totalDeposited;
burnedPRIZE = amountToBurn; // Update the burnedPRIZE variable
prizeToken.transfer(0x000000000000000000000000000000000000dEaD, amountToBurn);
emit WinnerSet(winne... | 29,782 |
28 | // Single use contract for testing No hiding or revealing | contract HigherLower is Admin {
// Current bets
mapping (uint256 => mapping (address => uint)) public bets;
mapping (uint256 => uint) public betTotals;
address public currentWinner;
uint public currentGame;
// Timestamps for when to deal with bets
uint public betLength = 60;
uint public... | contract HigherLower is Admin {
// Current bets
mapping (uint256 => mapping (address => uint)) public bets;
mapping (uint256 => uint) public betTotals;
address public currentWinner;
uint public currentGame;
// Timestamps for when to deal with bets
uint public betLength = 60;
uint public... | 34,617 |
51 | // Modifies `self` to contain everything from the first occurrence of `needle` to the end of the slice. `self` is set to the empty slice if `needle` is not found. self The slice to search and modify. needle The text to search for.return `self`. / | function find(slice memory self, slice memory needle) internal pure returns (slice memory) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
self._len -= ptr - self._ptr;
self._ptr = ptr;
return self;
}
| function find(slice memory self, slice memory needle) internal pure returns (slice memory) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
self._len -= ptr - self._ptr;
self._ptr = ptr;
return self;
}
| 289 |
60 | // 1.判断是否首次投资,若是首次则只能投1~2级,否则可以任意投资级别 | if(user.investDataIndex == 0) {
require(money < paramsMapping[3003],"invalid first invest range");
} else {
| if(user.investDataIndex == 0) {
require(money < paramsMapping[3003],"invalid first invest range");
} else {
| 12,723 |
0 | // STRUCTURE DEFINATIONS/ | struct StoremanGroupConfig {
uint deposit;
uint[2] chain;
uint[2] curve;
bytes gpk1;
bytes gpk2;
uint startTime;
uint endTime;
uint8 status;
bool isDebtClean;
}
| struct StoremanGroupConfig {
uint deposit;
uint[2] chain;
uint[2] curve;
bytes gpk1;
bytes gpk2;
uint startTime;
uint endTime;
uint8 status;
bool isDebtClean;
}
| 50,151 |
262 | // These functions deal with verification of Merkle Tree proofs. The tree and the proofs can be generated using ourYou will find a quickstart guide in the readme. WARNING: You should avoid using leaf values that are 64 bytes long prior tohashing, or use a hash function other than keccak256 for hashing leaves.This is be... | library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are ... | library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are ... | 7,045 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.