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 |
|---|---|---|---|---|
138 | // pragma solidity >=0.8.10; / | /* import {IUniswapV2Router02} from "./IUniswapV2Router02.sol"; */
/* import {IUniswapV2Factory} from "./IUniswapV2Factory.sol"; */
/* import {IUniswapV2Pair} from "./IUniswapV2Pair.sol"; */
/* import {IERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; */
/* import {ERC20} from "lib/openzeppeli... | /* import {IUniswapV2Router02} from "./IUniswapV2Router02.sol"; */
/* import {IUniswapV2Factory} from "./IUniswapV2Factory.sol"; */
/* import {IUniswapV2Pair} from "./IUniswapV2Pair.sol"; */
/* import {IERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; */
/* import {ERC20} from "lib/openzeppeli... | 2,102 |
27 | // Called only by future Bridge contract to withdraw the Realms _tokenIds Ids of Realms / | function bridgeWithdraw(address _player, uint256[] memory _tokenIds)
public
onlyBridge
| function bridgeWithdraw(address _player, uint256[] memory _tokenIds)
public
onlyBridge
| 29,552 |
143 | // there are two types of retractions. | if (status == StatusChoices.NO_PLEDGE_INFO) {
pledgeSum = classifySquareUp(_maker);
} else {
| if (status == StatusChoices.NO_PLEDGE_INFO) {
pledgeSum = classifySquareUp(_maker);
} else {
| 19,917 |
53 | // create pair | lpPair = IDexFactory(dexRouter.factory()).createPair(
address(this),
dexRouter.WETH()
);
_excludeFromMaxTransaction(address(lpPair), true);
_setAutomatedMarketMakerPair(address(lpPair), true);
uint256 totalSupply = 100 * 1e... | lpPair = IDexFactory(dexRouter.factory()).createPair(
address(this),
dexRouter.WETH()
);
_excludeFromMaxTransaction(address(lpPair), true);
_setAutomatedMarketMakerPair(address(lpPair), true);
uint256 totalSupply = 100 * 1e... | 11,770 |
36 | // ------------------------------------------------------------------------ This will give how much of the pending reward is claimable by user according to the current date ------------------------------------------------------------------------ | function claimableReward(address user, uint256 _pendingReward) public view returns(uint256) {
uint256 totalDays = (block.timestamp.sub(stakers[user].stakeDate)).div(1 days);
if(totalDays < 5){
return onePercent(_pendingReward).mul(40); //40% of the pending reward
} else if(totalD... | function claimableReward(address user, uint256 _pendingReward) public view returns(uint256) {
uint256 totalDays = (block.timestamp.sub(stakers[user].stakeDate)).div(1 days);
if(totalDays < 5){
return onePercent(_pendingReward).mul(40); //40% of the pending reward
} else if(totalD... | 16,063 |
333 | // see if we have a character other than a number | if (_hasNonNumber == false && (_temp[i] < 0x30 || _temp[i] > 0x39))
_hasNonNumber = true;
| if (_hasNonNumber == false && (_temp[i] < 0x30 || _temp[i] > 0x39))
_hasNonNumber = true;
| 38,283 |
38 | // Count all NFTs assigned to an owner/NFTs assigned to the zero address are considered invalid, and this/function throws for queries about the zero address./_owner An address for whom to query the balance/ return The number of NFTs owned by `_owner`, possibly zero | function balanceOf(address _owner)
external
view
returns (uint256);
| function balanceOf(address _owner)
external
view
returns (uint256);
| 23,955 |
180 | // _proxyRegistryAddress - 0xa5409ec958c83c3f309868babaca7c86dcb077c1 | constructor(address _proxyRegistryAddress) public ERC1155Tradable("Lympo NFT", "LYMPO", _proxyRegistryAddress) {
_setBaseMetadataURI("https://api.lympo.io/pools/assets/");
}
| constructor(address _proxyRegistryAddress) public ERC1155Tradable("Lympo NFT", "LYMPO", _proxyRegistryAddress) {
_setBaseMetadataURI("https://api.lympo.io/pools/assets/");
}
| 58,837 |
2 | // If, at a certain point, we decide to disable or redirect donations. Otherwise, owner no other purpose. "isOwner isAMistake!" | function changeOwner(address newOwner) public returns (address oldOwner) {
require(msg.sender == owner, "msg.sender must be owner");
oldOwner = owner;
owner = newOwner;
emit OwnerChanged(oldOwner, newOwner);
return oldOwner;
}
| function changeOwner(address newOwner) public returns (address oldOwner) {
require(msg.sender == owner, "msg.sender must be owner");
oldOwner = owner;
owner = newOwner;
emit OwnerChanged(oldOwner, newOwner);
return oldOwner;
}
| 28,581 |
1 | // The identifier of the role which allows accounts to mint tokens. | bytes32 public constant MINTER_ROLE = keccak256("MINTER");
event Paused(address minter, bool state);
constructor(string memory name, string memory symbol) ERC20(name, symbol) {
_setupRole(ADMIN_ROLE, msg.sender);
_setupRole(MINTER_ROLE, msg.sender);
_setRoleAdmin(MINTER_ROLE, ADMIN_ROLE);
_setR... | bytes32 public constant MINTER_ROLE = keccak256("MINTER");
event Paused(address minter, bool state);
constructor(string memory name, string memory symbol) ERC20(name, symbol) {
_setupRole(ADMIN_ROLE, msg.sender);
_setupRole(MINTER_ROLE, msg.sender);
_setRoleAdmin(MINTER_ROLE, ADMIN_ROLE);
_setR... | 42,287 |
12 | // in "decimals==18,6,6,8,18" | function getFreeFundsOriginal(Position memory _position, bool _getAll) public view returns(uint256[5] memory){
if( _getAll == true ){
// return all FreeFunds in cashbox
return[
IERC20(_position.token0).balanceOf(address(this)),
IERC20(_position.token1... | function getFreeFundsOriginal(Position memory _position, bool _getAll) public view returns(uint256[5] memory){
if( _getAll == true ){
// return all FreeFunds in cashbox
return[
IERC20(_position.token0).balanceOf(address(this)),
IERC20(_position.token1... | 2,813 |
33 | // Number of Tokens opposed to the proposal | uint nay;
| uint nay;
| 22,118 |
0 | // ERC20 token to mock ITEP, send all balance to the deployer / | constructor() public {
_balances[msg.sender] = supply;
_totalSupply = supply;
}
| constructor() public {
_balances[msg.sender] = supply;
_totalSupply = supply;
}
| 3,072 |
59 | // Emit Event | emit EmergencyWithdraw(lpWithdrawn);
| emit EmergencyWithdraw(lpWithdrawn);
| 4,195 |
41 | // simple transfer, lock recipient collateral Note: the market must have 'unlocked' funds | ITreasury(treasury).lock(recipient, amount);
ITreasury(treasury).release(sender, sender, amount);
| ITreasury(treasury).lock(recipient, amount);
ITreasury(treasury).release(sender, sender, amount);
| 52,007 |
19 | // Transfer supplying token(e.g. DAI, USDT) to Controller | uint256 supplyTokenBalance = IERC20(supplyToken).balanceOf(address(this));
IERC20(supplyToken).safeTransfer(msg.sender, supplyTokenBalance);
emit UnCommitted(_uncommitAmount);
| uint256 supplyTokenBalance = IERC20(supplyToken).balanceOf(address(this));
IERC20(supplyToken).safeTransfer(msg.sender, supplyTokenBalance);
emit UnCommitted(_uncommitAmount);
| 51,115 |
84 | // Returns the annual staking reward rate/ return annualStakingRewardsRatePercentMille is the annual rate in percent-mille | function getAnnualStakingRewardsRatePercentMille() external view returns (uint32);
| function getAnnualStakingRewardsRatePercentMille() external view returns (uint32);
| 13,403 |
2 | // L1StandardERC20 L1StandardERC20 is the Oasys Standard ERC20 contract. / | contract L1StandardERC20 is ERC20PresetMinterPauser {
/***************
* Constructor *
***************/
/**
* @param _name Name of the ERC20.
* @param _symbol Symbol of the ERC20.
*/
constructor(string memory _name, string memory _symbol)
ERC20PresetMinterPauser(_name, _sym... | contract L1StandardERC20 is ERC20PresetMinterPauser {
/***************
* Constructor *
***************/
/**
* @param _name Name of the ERC20.
* @param _symbol Symbol of the ERC20.
*/
constructor(string memory _name, string memory _symbol)
ERC20PresetMinterPauser(_name, _sym... | 36,463 |
17 | // owner > spender > allowance mapping. | mapping(address => mapping(address => uint256)) public override allowance;
| mapping(address => mapping(address => uint256)) public override allowance;
| 32,827 |
30 | // Burn the repaid LUSD from the user's balance and the gas compensation from the Gas Pool | _repayLUSD(activePoolCached, lusdTokenCached, msg.sender, debt.sub(LUSD_GAS_COMPENSATION));
_repayLUSD(activePoolCached, lusdTokenCached, gasPoolAddress, LUSD_GAS_COMPENSATION);
| _repayLUSD(activePoolCached, lusdTokenCached, msg.sender, debt.sub(LUSD_GAS_COMPENSATION));
_repayLUSD(activePoolCached, lusdTokenCached, gasPoolAddress, LUSD_GAS_COMPENSATION);
| 8,540 |
26 | // Then deposit any remaining Dai. | _depositOnCompound(AssetType.DAI, remainingDai);
| _depositOnCompound(AssetType.DAI, remainingDai);
| 26,654 |
8 | // 解锁记录 | mapping(uint => RecordInfo) public unlockRecord;
| mapping(uint => RecordInfo) public unlockRecord;
| 29,724 |
180 | // max mint amount per wallet | uint256 public maxMintAmountPerAd = 3;
| uint256 public maxMintAmountPerAd = 3;
| 6,485 |
16 | // RESTRICTED FUNCTIONS |
function notifyRewardAmount(uint256 reward)
external
onlyOwner
updateReward(address(0))
|
function notifyRewardAmount(uint256 reward)
external
onlyOwner
updateReward(address(0))
| 7,393 |
6 | // I added some fanciness here, Google it and try to figure out what it is!Let me know what you learn in general-chill-chat / | emit NewInsult(msg.sender, _insultee,block.timestamp, _insultType, _message);
| emit NewInsult(msg.sender, _insultee,block.timestamp, _insultType, _message);
| 48,331 |
37 | // When stopped, values are set to zero and should remain such; thus, disallow updating in that case. | require(stopped_ == 0, "UNIV2LPOracle/is-stopped");
| require(stopped_ == 0, "UNIV2LPOracle/is-stopped");
| 17,870 |
358 | // TokenID -> Primary Ether Sale Price in Wei | mapping(uint256 => uint256) public primarySalePrice;
| mapping(uint256 => uint256) public primarySalePrice;
| 4,872 |
16 | // Type of collateral that users submit to mint the derivative/Should be resolved through CollateralTokenRegistry contract/ return collateral token symbol | function collateralTokenSymbol() external view returns (bytes32);
| function collateralTokenSymbol() external view returns (bytes32);
| 16,113 |
13 | // when a deal is canceled it's added to thislist | function addCanceledDeal(address newCanceledDealAddress) public {
HomiumDeal deal = HomiumDeal(msg.sender);
require(deal.cancelled(), 'STORE.addCanceledDeal: deal is not cancelled to be added to addressesOfCanceledDeals');
addressesOfCanceledDeals[newCanceledDealAddress] = true;
}
| function addCanceledDeal(address newCanceledDealAddress) public {
HomiumDeal deal = HomiumDeal(msg.sender);
require(deal.cancelled(), 'STORE.addCanceledDeal: deal is not cancelled to be added to addressesOfCanceledDeals');
addressesOfCanceledDeals[newCanceledDealAddress] = true;
}
| 33,669 |
1 | // 初始化总量 | totalSupply = initialSupply * 10 ** uint256(decimals); //以太币是10^18,后面18个0,所以默认decimals是18
| totalSupply = initialSupply * 10 ** uint256(decimals); //以太币是10^18,后面18个0,所以默认decimals是18
| 36,862 |
179 | // Required for ERC-721 compliance./Transfer a Asset owned by another address, for which the calling address/has previously been granted transfer approval by the owner./_from The address that owns the Asset to be transfered./_to The address that should take ownership of the Asset. Can be any address,/including the call... | function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
external
whenNotPaused
| function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
external
whenNotPaused
| 1,798 |
5 | // See {ERC2981-_setDefaultRoyalty}. / | function setDefaultRoyalty(address receiver, uint96 feeNumerator)
external
onlyRole(SUPPORT_ROLE)
{
_setDefaultRoyalty(receiver, feeNumerator);
}
| function setDefaultRoyalty(address receiver, uint96 feeNumerator)
external
onlyRole(SUPPORT_ROLE)
{
_setDefaultRoyalty(receiver, feeNumerator);
}
| 1,878 |
26 | // Allow Jolan to modify ADDRESS_JOLAN/ This function is dedicated to the represented shareholder according to require(). | function setJolan(address JOLAN)
| function setJolan(address JOLAN)
| 32,563 |
73 | // add a minter role to an address _minter address / | function addMinter(address _minter) public onlyOwner {
addRole(_minter, ROLE_MINTER);
}
| function addMinter(address _minter) public onlyOwner {
addRole(_minter, ROLE_MINTER);
}
| 30,999 |
13 | // constructor to set owner, crowdsale open, and cold wallet to store funds. | constructor(address) public {
// set constants
OWNER = msg.sender;
CROWDSALEOPEN = true;
// set cold wallet
// COLDWALLET = beneficiary;
}
| constructor(address) public {
// set constants
OWNER = msg.sender;
CROWDSALEOPEN = true;
// set cold wallet
// COLDWALLET = beneficiary;
}
| 25,404 |
11 | // Sends prizes to the winners, fee to CryptoCookies and returns gas cost to sender. / | function sendPrizesToWinners(uint[] memory winnerIndices) private refundGas {
creator.transfer(1 ether);
delete lastWinners;
for (uint i=0; i<winnerIndices.length; i++) {
address payable recipient = participantList[winnerIndices[i]];
if (i < 6) {
uint amount = 1 ether - (... | function sendPrizesToWinners(uint[] memory winnerIndices) private refundGas {
creator.transfer(1 ether);
delete lastWinners;
for (uint i=0; i<winnerIndices.length; i++) {
address payable recipient = participantList[winnerIndices[i]];
if (i < 6) {
uint amount = 1 ether - (... | 475 |
91 | // Returns true for any standardized interfaces implemented by this contract._interfaceID bytes4 the interface to check for return true for any standardized interfaces implemented by this contract./ | function supportsInterface(bytes4 _interfaceID) external pure returns (bool)
| function supportsInterface(bytes4 _interfaceID) external pure returns (bool)
| 49,486 |
47 | // Tally the next batch of state leaves. _intermediateStateRoot The intermediate state root, which isgenerated from the current batch of state leaves_newResultsCommitment A hash of the tallied results so far(cumulative) _proof The zk-SNARK proof / | function proveVoteTallyBatch(
uint256 _intermediateStateRoot,
uint256 _newResultsCommitment,
uint256 _newSpentVoiceCreditsCommitment,
uint256 _newPerVOSpentVoiceCreditsCommitment,
uint256[8] memory _proof
)
| function proveVoteTallyBatch(
uint256 _intermediateStateRoot,
uint256 _newResultsCommitment,
uint256 _newSpentVoiceCreditsCommitment,
uint256 _newPerVOSpentVoiceCreditsCommitment,
uint256[8] memory _proof
)
| 46,831 |
8 | // Create a new agreementpurchase The address of the agreement_price The price of the goods_seller The sellermaxTemp Maximum temperature (-999 = not set)minTemp Minimum temperature (-999 = not set)acceleration Maximum acceleration (-999 = not set)humidity Maximum humidity (-999 = not set)pressure Maximum pressure (-999... | function newPurchase
(
address purchase,
uint _price,
string _description,
address _seller,
int maxTemp,
int minTemp,
int acceleration,
int humidity,
| function newPurchase
(
address purchase,
uint _price,
string _description,
address _seller,
int maxTemp,
int minTemp,
int acceleration,
int humidity,
| 45,981 |
161 | // alpaca user transfered to AlpacaFarm to manage the LP assets | uint256 alpacaID;
| uint256 alpacaID;
| 24,001 |
84 | // Sort the list using the recursive method | _quickSort(offersList, int(0), int(offersList.length - 1));
| _quickSort(offersList, int(0), int(offersList.length - 1));
| 4,661 |
123 | // Token index, can store upto 255 | uint8 index;
| uint8 index;
| 28,242 |
12 | // the current treasury balance, scaled | uint128 accruedToTreasury;
| uint128 accruedToTreasury;
| 11,460 |
30 | // Destroys `amount` tokens from `account`, reducing thetotal supply. Emits a `Transfer` event with `to` set to the zero address. Requirements - `account` cannot be the zero address.- `account` must have at least `amount` tokens. / | function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
| function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
| 916 |
479 | // NahmiiTypesLib Data types of general nahmii character / | library NahmiiTypesLib {
//
// Enums
// -----------------------------------------------------------------------------------------------------------------
enum ChallengePhase {Dispute, Closed}
//
// Structures
// -------------------------------------------------------------------------------... | library NahmiiTypesLib {
//
// Enums
// -----------------------------------------------------------------------------------------------------------------
enum ChallengePhase {Dispute, Closed}
//
// Structures
// -------------------------------------------------------------------------------... | 59,048 |
6 | // eventsevent TokenBurned(address account_from, address address_to, uint unit_token); | event event_exitTransaction(
address account_from,
address address_to,
uint256 unit_token,
bytes32 _secretCode,
uint256 _timelock,
uint256 _assetStatus
); //asset status 'true','false' or 'burn'
event HTLCERC20Withdraw(bytes32 indexed contractId);
event HT... | event event_exitTransaction(
address account_from,
address address_to,
uint256 unit_token,
bytes32 _secretCode,
uint256 _timelock,
uint256 _assetStatus
); //asset status 'true','false' or 'burn'
event HTLCERC20Withdraw(bytes32 indexed contractId);
event HT... | 22,274 |
12 | // address bigbeef = 0xbeefa0b80F7aC1f1a5B5a81C37289532c5D85e88; | address pancakeTest = 0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3;
address lpLocker = 0x98c1F42c7Fb70768d3163253872d8eB655379deD;
address tipsyCoin = _tipsyCoin;
| address pancakeTest = 0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3;
address lpLocker = 0x98c1F42c7Fb70768d3163253872d8eB655379deD;
address tipsyCoin = _tipsyCoin;
| 19,973 |
40 | // Mapping of account addresses to account reward detail | mapping(address => AccountRewardDetail) public accountRewardDetails;
| mapping(address => AccountRewardDetail) public accountRewardDetails;
| 4,662 |
365 | // New entry cannot be lower than 90% of the previous average | uint256 average = gasPrices[_token];
uint256 minimum = average - average / D;
if (_gasPrice < minimum) _gasPrice = minimum;
_gasPrice /= 14;
gasPrices[_token] = average + _gasPrice - array[idx];
array[idx] = _gasPrice;
gasPriceIdxs[_to... | uint256 average = gasPrices[_token];
uint256 minimum = average - average / D;
if (_gasPrice < minimum) _gasPrice = minimum;
_gasPrice /= 14;
gasPrices[_token] = average + _gasPrice - array[idx];
array[idx] = _gasPrice;
gasPriceIdxs[_to... | 57,899 |
11 | // amount of $EGGS due for each alpha point staked | uint256 public eggsPerAlpha = 0;
| uint256 public eggsPerAlpha = 0;
| 81,344 |
44 | // --- Auth --- Mapping of addresses that are allowed to manually recompute the debt floor (without being rewarded for it) | mapping (address => uint256) public manualSetters;
| mapping (address => uint256) public manualSetters;
| 15,466 |
37 | // Throws if contract is paused. / | modifier isPaused() {
require(paused == true);
_;
}
| modifier isPaused() {
require(paused == true);
_;
}
| 29,694 |
211 | // Exclude reward address | mapping(address => bool) public excludeReward;
| mapping(address => bool) public excludeReward;
| 14,199 |
19 | // Send a static number of tokens to each user in an array (e.g. each user receives 100 tokens) | function airdrop(address[] _recipients) public onlyAirdropAgent {
for (uint256 i = 0; i < _recipients.length; i++) {
require(!tokensReceived[_recipients[i]]); // Probably a race condition between two transactions. Bail to avoid double allocations and to save the gas.
require(token.tr... | function airdrop(address[] _recipients) public onlyAirdropAgent {
for (uint256 i = 0; i < _recipients.length; i++) {
require(!tokensReceived[_recipients[i]]); // Probably a race condition between two transactions. Bail to avoid double allocations and to save the gas.
require(token.tr... | 40,413 |
240 | // Validates that passed in quantity is a multiple of the natural unit of the Set._core Address of Core _setAddress of the Set / | function requireValidSet(
ICore _core,
address _set
)
internal
view
| function requireValidSet(
ICore _core,
address _set
)
internal
view
| 33,709 |
212 | // if it's the address's 3rd airdrop so _addressAirDropNumber = 3 | ECDSA.toEthSignedMessageHash(keccak256(abi.encodePacked(_wallet, "airdrop", _addressAirDropNumber.toString()))),
_signature
) == owner();
| ECDSA.toEthSignedMessageHash(keccak256(abi.encodePacked(_wallet, "airdrop", _addressAirDropNumber.toString()))),
_signature
) == owner();
| 40,826 |
5 | // Info holder for token creation | TokenLib.TokenStorage tokenInfo;
uint256 endWithdrawalTime; // time when manual withdrawals are no longer allowed
| TokenLib.TokenStorage tokenInfo;
uint256 endWithdrawalTime; // time when manual withdrawals are no longer allowed
| 1,104 |
302 | // Recompute and return the sender's average balance information. / | {
return _recomputeAccountLastAverageBalance(messageSender);
}
| {
return _recomputeAccountLastAverageBalance(messageSender);
}
| 35,888 |
32 | // General Description:Determine a value of precision.Calculate an integer approximation of (_baseN / _baseD) ^ (_expN / _expD)2 ^ precision.Return the result along with the precision used. Detailed Description:Instead of calculating "base ^ exp", we calculate "e ^ (log(base)exp)".The value of "log(base)" is represente... | function power(
uint256 _baseN,
uint256 _baseD,
uint32 _expN,
uint32 _expD
| function power(
uint256 _baseN,
uint256 _baseD,
uint32 _expN,
uint32 _expD
| 22,308 |
6 | // For approving people on task creation (they are not required to make an application) | struct PreapprovedApplication {
address applicant;
Reward[] reward;
}
| struct PreapprovedApplication {
address applicant;
Reward[] reward;
}
| 26,585 |
137 | // When the loan was created | uint256 timeCreated;
| uint256 timeCreated;
| 14,115 |
12 | // thisCanBeExpandedToMultipleRoles | address roleAddr = USER_ADDR;
if (IOrganization(calleeOrg).isInternalAccountAdmin(innerCaller)) {
roleAddr = ADMIN_ADDR;
} else if (caller == callee) {
| address roleAddr = USER_ADDR;
if (IOrganization(calleeOrg).isInternalAccountAdmin(innerCaller)) {
roleAddr = ADMIN_ADDR;
} else if (caller == callee) {
| 40,058 |
115 | // 0xb93152b59e65a6De8D3464061BcC1d68f6749F98ropsten | );
IUniswapV2Router02 private UniswapV2Router02 = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D //mainnet
| );
IUniswapV2Router02 private UniswapV2Router02 = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D //mainnet
| 52,972 |
45 | // INTERNAL //the first 10k colonist mints go to the minterthe remaining 80% have a 10% chance to be given to a random staked pirate seed a random value to select a recipient fromreturn the address of the recipient (either the minter or the pirate thief's owner) / | function selectRecipient(uint256 seed) internal view returns (address) {
if (((seed >> 245) % 10) != 0) return msg.sender; // top 10 bits
address thief = orbital.randomPirateOwner(seed >> 144); // 144 bits reserved for trait selection
if (thief == address(0x0)) return msg.sender;
ret... | function selectRecipient(uint256 seed) internal view returns (address) {
if (((seed >> 245) % 10) != 0) return msg.sender; // top 10 bits
address thief = orbital.randomPirateOwner(seed >> 144); // 144 bits reserved for trait selection
if (thief == address(0x0)) return msg.sender;
ret... | 34,106 |
117 | // This function handles token purchases for round 3. / | function _buyTokenR3() private {
require(_hasEnded[1] && !_hasEnded[2],
"The second round one must not be active while the third round must be active");
require(block.timestamp >= _startTimeR3,
"The time delay between the first round and the second round must be surpassed");
uint... | function _buyTokenR3() private {
require(_hasEnded[1] && !_hasEnded[2],
"The second round one must not be active while the third round must be active");
require(block.timestamp >= _startTimeR3,
"The time delay between the first round and the second round must be surpassed");
uint... | 5,211 |
64 | // 获取已经开通的欧式期权代币数量/ return 已经开通的欧式期权代币数量 | function getOptionCount() external view returns (uint);
| function getOptionCount() external view returns (uint);
| 66,123 |
12 | // PaymentSplitter This contract allows to split Ether payments among a group of accounts. The sender does not need to be awarethat the Ether will be split in this way, since it is handled transparently by the contract. The split can be in equal parts or in any other arbitrary proportion. The way this is specified is b... | * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
* function.
*/
contract PaymentSplitter is Context {
event PayeeAdded(address account, uint256 shares);
event PaymentReleased(address to, uint256 amount);
event PaymentReceived(address f... | * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
* function.
*/
contract PaymentSplitter is Context {
event PayeeAdded(address account, uint256 shares);
event PaymentReleased(address to, uint256 amount);
event PaymentReceived(address f... | 230 |
7 | // Internal Params of the contract. | function internalParams() external view returns (InternalParams memory);
| function internalParams() external view returns (InternalParams memory);
| 17,359 |
5 | // Add Shop ID to Owner's Shops list | ownedShops[owner].push(shopId);
| ownedShops[owner].push(shopId);
| 14,313 |
15 | // function checks if the public key is different from 0 | bytes32 nopubkey = bytes32(0x0000000000000000000000000000000000000000000000000000000000000000);
if (publicKeyX != nopubkey || publicKeyY != nopubkey) {
return true;
}
| bytes32 nopubkey = bytes32(0x0000000000000000000000000000000000000000000000000000000000000000);
if (publicKeyX != nopubkey || publicKeyY != nopubkey) {
return true;
}
| 52,176 |
32 | // SafeERC20 Wrappers around ERC20 operations that throw on failure.To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,which allows you to call the safe operations as `token.safeTransfer(...)`, etc. / | library SafeERC20 {
using SafeMath for uint256;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
require(token.transfer(to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
require(token.transferFrom(from, t... | library SafeERC20 {
using SafeMath for uint256;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
require(token.transfer(to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
require(token.transferFrom(from, t... | 3,355 |
69 | // Cache trustedCreditor. | trustedCreditor_ = trustedCreditor;
| trustedCreditor_ = trustedCreditor;
| 15,091 |
29 | // ------------------------------------------------------------------------ Token owner can approve for `spender` to transferFrom(...) `tokens` from the token owner's account https:github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md recommends that there are no checks for the approval double-spend attack... | function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
| function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
| 4,433 |
26 | // 15% buy tax 20% sell tax |
uint256 private buyliqFee = 0; //3
uint256 private buyprevLiqFee = 0;
uint256 private buymktFee = 0;//3
uint256 private buyPrevmktFee = 0;
uint256 private buyprizePool = 0;//1
uint256 private buyprevPrizePool = 0;
uint256 GoldenDaycooldown = 0;
|
uint256 private buyliqFee = 0; //3
uint256 private buyprevLiqFee = 0;
uint256 private buymktFee = 0;//3
uint256 private buyPrevmktFee = 0;
uint256 private buyprizePool = 0;//1
uint256 private buyprevPrizePool = 0;
uint256 GoldenDaycooldown = 0;
| 68,382 |
233 | // get the locked balances from the store | (uint256[] memory amounts, uint256[] memory expirationTimes) =
store.lockedBalanceRange(msg.sender, _startIndex, _endIndex);
uint256 totalAmount = 0;
uint256 length = amounts.length;
assert(length == expirationTimes.length);
| (uint256[] memory amounts, uint256[] memory expirationTimes) =
store.lockedBalanceRange(msg.sender, _startIndex, _endIndex);
uint256 totalAmount = 0;
uint256 length = amounts.length;
assert(length == expirationTimes.length);
| 43,244 |
4 | // L1 gateway must have a router | require(_router != address(0), "BAD_ROUTER");
| require(_router != address(0), "BAD_ROUTER");
| 34,280 |
2 | // Number of decimals in base asset answer/ return Returns number of decimals in base asset answer | function REWARD_TOKEN() external view returns (IERC20MetadataUpgradeable);
| function REWARD_TOKEN() external view returns (IERC20MetadataUpgradeable);
| 17,427 |
255 | // will revert if it fails 1. Deposit ETH in Compound as collateral | cEth.mint{value: wethBalance}();
| cEth.mint{value: wethBalance}();
| 6,639 |
4 | // _origin: NFT合约地址sender:购买人cost: 一共花费的币tokenIDs:购买的所有tokenID / | event BuyNFTCard(address _origin, address sender, uint256 cost, uint256 []tokenIDs);
| event BuyNFTCard(address _origin, address sender, uint256 cost, uint256 []tokenIDs);
| 5,098 |
504 | // Modifier to allow function calls only from the Governor or the Keeper EOA. / | modifier onlyKeeperOrGovernor() {
_keeperOrGovernor();
_;
}
| modifier onlyKeeperOrGovernor() {
_keeperOrGovernor();
_;
}
| 63,224 |
400 | // Approve savings contract to spend mUSD on this contract | _approveMax(musd, savingsContract);
| _approveMax(musd, savingsContract);
| 42,738 |
0 | // Define roles / | bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");
| bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");
| 16,174 |
379 | // 3 | _structHash = keccak256(
abi.encode(
_blockhash,
lastTimestamp,
gasremaining,
_externalRandomNumber
)
);
_randomNumber = uint256(_structHash);
| _structHash = keccak256(
abi.encode(
_blockhash,
lastTimestamp,
gasremaining,
_externalRandomNumber
)
);
_randomNumber = uint256(_structHash);
| 37,898 |
3 | // A varaible that maps IPFS hash to an uploader's address | mapping(string => address) public hashAddress;
| mapping(string => address) public hashAddress;
| 37,082 |
79 | // Look for revert reason and bubble it up if present | if (returndata.length > 0) {
| if (returndata.length > 0) {
| 12,089 |
156 | // Get the address of reward token return The address of reward token/ | function getRewardErc20() public view returns (address)
| function getRewardErc20() public view returns (address)
| 36,580 |
4 | // Creates an SKU and associates the specified ERC20 F1DTCrateKey token contract with it. Reverts if called by any other than the contract owner. Reverts if `totalSupply` is zero. Reverts if `sku` already exists. Reverts if the update results in too many SKUs. Reverts if the `totalSupply` is SUPPLY_UNLIMITED. Reverts i... | function createCrateKeySku(
bytes32 sku,
uint256 totalSupply,
uint256 maxQuantityPerPurchase,
IF1DTCrateKeyFull crateKey
| function createCrateKeySku(
bytes32 sku,
uint256 totalSupply,
uint256 maxQuantityPerPurchase,
IF1DTCrateKeyFull crateKey
| 56,017 |
328 | // After strategy DHW process update strategy pending values set pending next as pending and reset pending next strat Strategy address / | function _updatePending(address strat) private {
Strategy storage strategy = strategies[strat];
Pending memory pendingUserNext = strategy.pendingUserNext;
strategy.pendingUser = pendingUserNext;
if (
pendingUserNext.deposit != Max128Bit.ZERO ||
pend... | function _updatePending(address strat) private {
Strategy storage strategy = strategies[strat];
Pending memory pendingUserNext = strategy.pendingUserNext;
strategy.pendingUser = pendingUserNext;
if (
pendingUserNext.deposit != Max128Bit.ZERO ||
pend... | 34,794 |
115 | // either debt has decreased, or debt ceilings are not exceeded | if (deltaNormalDebt > 0 && (wmul(v.totalNormalDebt, v.rate) > v.debtCeiling || globalDebt > globalDebtCeiling))
revert Codex__modifyCollateralAndDebt_ceilingExceeded();
| if (deltaNormalDebt > 0 && (wmul(v.totalNormalDebt, v.rate) > v.debtCeiling || globalDebt > globalDebtCeiling))
revert Codex__modifyCollateralAndDebt_ceilingExceeded();
| 22,501 |
17 | // 10: no partial fills, only offerer or zone can execute | ERC20_TO_ERC721_FULL_RESTRICTED,
| ERC20_TO_ERC721_FULL_RESTRICTED,
| 32,998 |
18 | // View Function - Returns Staking Maximum amount/ return maxSpendAmount - Staking maximum amount | function getMaxSpendAmount() public view returns (uint256) {
uint256 _totalSupply = dione.totalSupply();
return _totalSupply.mul(MAX_SPEND_AMOUNT).div(10**4);
}
| function getMaxSpendAmount() public view returns (uint256) {
uint256 _totalSupply = dione.totalSupply();
return _totalSupply.mul(MAX_SPEND_AMOUNT).div(10**4);
}
| 14,181 |
40 | // Checks if addMember() would add a the member to the committee (qualified to join)/addr is the candidate committee member address/weight is the candidate committee member weight/ return wouldAddMember bool indicates whether the member will be added | function checkAddMember(address addr, uint256 weight) external view returns (bool wouldAddMember);
| function checkAddMember(address addr, uint256 weight) external view returns (bool wouldAddMember);
| 62,393 |
9 | // Bids token | IERC20 public Bids;
| IERC20 public Bids;
| 39,855 |
34 | // Add the numTokens which were just created to the total supply. We're a crypto central bank! | totalSupply = add(totalSupply, numTokens);
| totalSupply = add(totalSupply, numTokens);
| 49,071 |
43 | // Modifier to make a function callable only when the contract is paused./ | modifier whenPaused() {
require(paused, "Not paused now");
_;
}
| modifier whenPaused() {
require(paused, "Not paused now");
_;
}
| 12,322 |
54 | // Checks if the auction has ended.return bool True if current time is greater than auction end time. / | function auctionEnded() public view returns (bool) {
return block.timestamp > marketInfo.endTime;
}
| function auctionEnded() public view returns (bool) {
return block.timestamp > marketInfo.endTime;
}
| 60,416 |
3 | // communities an ambassador is responsible for | mapping(uint256 => EnumerableSet.AddressSet) internal ambassadorCommunities;
| mapping(uint256 => EnumerableSet.AddressSet) internal ambassadorCommunities;
| 29,271 |
203 | // get all ERC20 addresses and balance | for (uint8 i = 2; i < tokenAddresses.length; i++) {
fromAddresses[index] = tokenAddresses[i];
amounts[index] = IERC20(tokenAddresses[i]).balanceOf(address(this));
index++;
}
| for (uint8 i = 2; i < tokenAddresses.length; i++) {
fromAddresses[index] = tokenAddresses[i];
amounts[index] = IERC20(tokenAddresses[i]).balanceOf(address(this));
index++;
}
| 7,265 |
64 | // Assignes a new NFT to an address. Use and override this function with caution. Wrong usage can have serious consequences. _to Address to wich we want to add the NFT. _tokenId Which NFT we want to add. / | function _addNFToken(
address _to,
uint256 _tokenId
)
internal
override
virtual
| function _addNFToken(
address _to,
uint256 _tokenId
)
internal
override
virtual
| 7,262 |
50 | // if `_from` is equal to sender, require own burns feature to be enabled otherwise require burns on behalf feature to be enabled | require(_from == msg.sender && isFeatureEnabled(FEATURE_OWN_BURNS)
|| _from != msg.sender && isFeatureEnabled(FEATURE_BURNS_ON_BEHALF),
_from == msg.sender? "burns are disabled": "burns on behalf are disabled");
| require(_from == msg.sender && isFeatureEnabled(FEATURE_OWN_BURNS)
|| _from != msg.sender && isFeatureEnabled(FEATURE_BURNS_ON_BEHALF),
_from == msg.sender? "burns are disabled": "burns on behalf are disabled");
| 37,021 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.