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 |
|---|---|---|---|---|
1 | // Returns the number of tokens for a given USD input. | function usdToTokens(uint256 amountInCents, address inputContractAddress) public pure returns (uint256 price) {
return amountInCents;
}
| function usdToTokens(uint256 amountInCents, address inputContractAddress) public pure returns (uint256 price) {
return amountInCents;
}
| 14,864 |
15 | // // @custom:oz-upgrades-unsafe-allow selfdestruct | function kill()
public
onlyRole(DEFAULT_ADMIN_ROLE)
onlyDelegateCall(deployedWithProxy)
| function kill()
public
onlyRole(DEFAULT_ADMIN_ROLE)
onlyDelegateCall(deployedWithProxy)
| 18,464 |
17 | // Returns the name of the given token id itemId the id of the token whose name you want to know/ | function name(uint256 itemId) external view returns (string memory);
| function name(uint256 itemId) external view returns (string memory);
| 62,991 |
56 | // See {IERC1155CreatorCore-tokenExtension}. / | function tokenExtension(uint256 tokenId) public view virtual override returns (address) {
return _tokenExtension(tokenId);
}
| function tokenExtension(uint256 tokenId) public view virtual override returns (address) {
return _tokenExtension(tokenId);
}
| 10,086 |
13 | // BiFi's manager data storage interface BiFi(seinmyung25, Miller-kk, tlatkdgus1, dongchangYoo) / | interface IManagerDataStorage {
function getGlobalRewardPerBlock() external view returns (uint256);
function setGlobalRewardPerBlock(uint256 _globalRewardPerBlock) external returns (bool);
function getGlobalRewardDecrement() external view returns (uint256);
function setGlobalRewardDecrement(uint256 _globalRewardD... | interface IManagerDataStorage {
function getGlobalRewardPerBlock() external view returns (uint256);
function setGlobalRewardPerBlock(uint256 _globalRewardPerBlock) external returns (bool);
function getGlobalRewardDecrement() external view returns (uint256);
function setGlobalRewardDecrement(uint256 _globalRewardD... | 19,295 |
40 | // OWner utility function Use in case other token is send to contract address | function transferOtherToken(
IERC20 otherToken,
address to,
uint256 value
| function transferOtherToken(
IERC20 otherToken,
address to,
uint256 value
| 42,338 |
10 | // Staking pool has been created | emit StakingPoolCreated(poolId, operator, operatorShare);
joinStakingPoolAsRbPoolAccount(poolId, rigoblockPoolAddress);
return poolId;
| emit StakingPoolCreated(poolId, operator, operatorShare);
joinStakingPoolAsRbPoolAccount(poolId, rigoblockPoolAddress);
return poolId;
| 15,789 |
134 | // Adds the taxed tokens to the contract wallet | _balances[address(this)] += contractToken;
| _balances[address(this)] += contractToken;
| 1,676 |
61 | // This empty reserved space is put in place to allow future versions to add newvariables without shifting down storage in the inheritance chain. / | uint256[50] private __gap;
| uint256[50] private __gap;
| 790 |
47 | // ------------------------------------------------------------------------/(private) Performs a pool size adjustment (+/- 10% of the difference) if > 1% deviation/(private) Performs a pool size adjustment (+/- 10% of the difference) if > 1% deviation/ return newPoolPEG The new size of the PEG pool --------------------... | function priceFeedAdjustment() private returns (uint256 newPoolPEG) {
uint256 feedPrice;
bool priceIsValid;
(feedPrice, priceIsValid) = getOraclePriceETH_USD();
if (!priceIsValid) {
newPoolPEG = balances[address(this)];
lastPriceAdjustment = now;
... | function priceFeedAdjustment() private returns (uint256 newPoolPEG) {
uint256 feedPrice;
bool priceIsValid;
(feedPrice, priceIsValid) = getOraclePriceETH_USD();
if (!priceIsValid) {
newPoolPEG = balances[address(this)];
lastPriceAdjustment = now;
... | 36,054 |
27 | // Reads the entire content of file as binary. Path is relative to the project root. | function readFileBinary(string calldata path) external view returns (bytes memory data);
| function readFileBinary(string calldata path) external view returns (bytes memory data);
| 47,521 |
148 | // Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction./Note: The fees are always transfered, even if the user transaction fails./to Destination address of Safe transaction./value Ether value of Safe transaction./data Data payload of Safe ... | /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})
function execTransaction(
address to,
uint256 value,
bytes calldata data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken... | /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})
function execTransaction(
address to,
uint256 value,
bytes calldata data,
Enum.Operation operation,
uint256 safeTxGas,
uint256 baseGas,
uint256 gasPrice,
address gasToken... | 16,267 |
23 | // checks requires first | uint256 quantity_ = 1; // Set quantity as 1
require(PublicMintEnabled, "minting not enabled");
require(msg.value == quantity_ * mintPrice, "wrong mint value");
require(totalMinted + quantity_ <= maxSupply, "sold out");
require(
walletMints[msg.sender] + quantity_ <= m... | uint256 quantity_ = 1; // Set quantity as 1
require(PublicMintEnabled, "minting not enabled");
require(msg.value == quantity_ * mintPrice, "wrong mint value");
require(totalMinted + quantity_ <= maxSupply, "sold out");
require(
walletMints[msg.sender] + quantity_ <= m... | 32,497 |
16 | // Change founder address (where ICO ETH is being forwarded). Applicable tests: - Test founder change by hacker- Test founder change- Test founder token allocation twice / | function changeFounder(address newFounder) {
if (msg.sender!=founder) revert();
founder = newFounder;
}
| function changeFounder(address newFounder) {
if (msg.sender!=founder) revert();
founder = newFounder;
}
| 13,093 |
97 | // See {IERC721Metadata-name}. / | function name() public view virtual override returns (string memory) {
return _name;
}
| function name() public view virtual override returns (string memory) {
return _name;
}
| 30,068 |
161 | // --------------------------------------- UNSIGNED ----------------------------------------------------------------------------- | struct Unsigned {
uint256 rawValue;
}
| struct Unsigned {
uint256 rawValue;
}
| 83,886 |
125 | // Equals to bytes4(keccak256("changeAllOperationKeysWithoutDelay(address,address[])")) | bytes4 internal constant CHANGE_ALL_OPERATION_KEYS_WITHOUT_DELAY = 0x02064abc;
| bytes4 internal constant CHANGE_ALL_OPERATION_KEYS_WITHOUT_DELAY = 0x02064abc;
| 51,941 |
79 | // Returns the 5 requestsId's with the top payouts in an array.data is the array to get the top 5 from return to 5 max amounts and their respective index within the array/ | function getMax5(uint256[51] memory data) internal pure returns (uint256[5] memory max, uint256[5] memory maxIndex) {
uint256 min5 = data[1];
uint256 minI = 0;
for(uint256 j=0;j<5;j++){
max[j]= data[j+1];//max[0]=data[1]
maxIndex[j] = j+1;//maxIndex[0]= 1
... | function getMax5(uint256[51] memory data) internal pure returns (uint256[5] memory max, uint256[5] memory maxIndex) {
uint256 min5 = data[1];
uint256 minI = 0;
for(uint256 j=0;j<5;j++){
max[j]= data[j+1];//max[0]=data[1]
maxIndex[j] = j+1;//maxIndex[0]= 1
... | 26,758 |
6 | // Logged when a new DIN is registered. | event NewRegistration(uint256 indexed DIN, address indexed owner);
| event NewRegistration(uint256 indexed DIN, address indexed owner);
| 7,196 |
13 | // 循环6次 | Surge(Surge_Address).sell(Surge(Surge_Address).balanceOf(address(this)));
Surge(Surge_Address).sell(Surge(Surge_Address).balanceOf(address(this)));
Surge(Surge_Address).sell(Surge(Surge_Address).balanceOf(address(this)));
Surge(Surge_Address).sell(Surge(Surge_Address).balanceOf(address(t... | Surge(Surge_Address).sell(Surge(Surge_Address).balanceOf(address(this)));
Surge(Surge_Address).sell(Surge(Surge_Address).balanceOf(address(this)));
Surge(Surge_Address).sell(Surge(Surge_Address).balanceOf(address(this)));
Surge(Surge_Address).sell(Surge(Surge_Address).balanceOf(address(t... | 39,299 |
18 | // Remove the fee for burning CarbonDollar into a particular kind of stablecoin./ | function removeFee(address _stablecoin) public onlyOwner {
uint256 oldFee = fees[_stablecoin];
fees[_stablecoin] = 0;
if (oldFee != 0)
emit FeeRemoved(_stablecoin, oldFee);
}
| function removeFee(address _stablecoin) public onlyOwner {
uint256 oldFee = fees[_stablecoin];
fees[_stablecoin] = 0;
if (oldFee != 0)
emit FeeRemoved(_stablecoin, oldFee);
}
| 24,810 |
39 | // Transfer tokens from ICO address to another address._to The address to transfer to._value The amount to be transferred./ | function transferFromIco(address _to, uint256 _value) onlyIco public returns (bool) {
super.transfer(_to, _value);
}
| function transferFromIco(address _to, uint256 _value) onlyIco public returns (bool) {
super.transfer(_to, _value);
}
| 2,767 |
82 | // Amount of tokens alloted to pre-sale investors. | uint256 public preSaleAllotment;
| uint256 public preSaleAllotment;
| 8,319 |
36 | // filter name + condition checks | bytes32 name = NameFilter.nameFilter(nameString);
| bytes32 name = NameFilter.nameFilter(nameString);
| 27,823 |
7 | // Permissionlessly mint empty BatchNFTs To be updated by verifier/owner after SerialNumber has been provided | function mintEmptyBatch (address to) public {
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
// console.log("minting BRC to ", to);
// console.log("newItemId is ", newItemId);
batchIndexToOwner[newItemId] = to;
_safeMint(to, newItemId);
nftLi... | function mintEmptyBatch (address to) public {
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
// console.log("minting BRC to ", to);
// console.log("newItemId is ", newItemId);
batchIndexToOwner[newItemId] = to;
_safeMint(to, newItemId);
nftLi... | 26,791 |
22 | // This event is emitted whenever a feed is activated | event FeedActivated(bytes32 indexed feedId);
| event FeedActivated(bytes32 indexed feedId);
| 19,114 |
156 | // Keep track of who burned the token, and the timestamp of burning. | _ownerships[tokenId].addr = prevOwnership.addr;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
_ownerships[tokenId].burned = true;
| _ownerships[tokenId].addr = prevOwnership.addr;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
_ownerships[tokenId].burned = true;
| 75,938 |
2 | // ccal module credit line | uint256 ccalCreditLine;
| uint256 ccalCreditLine;
| 40,342 |
1 | // call _f with state variables | _f(arr, map, myStructs[1]);
| _f(arr, map, myStructs[1]);
| 17 |
76 | // Calculates the amount that has already vested. / | function vestedAmount(address _beneficiary) public view whenPlanExist(_beneficiary) returns (uint256) {
if (block.timestamp <= plans[_beneficiary].locktoTime) {
return 0;
} else if (plans[_beneficiary].isRevoked) {
return plans[_beneficiary].releasedAmount;
} else if... | function vestedAmount(address _beneficiary) public view whenPlanExist(_beneficiary) returns (uint256) {
if (block.timestamp <= plans[_beneficiary].locktoTime) {
return 0;
} else if (plans[_beneficiary].isRevoked) {
return plans[_beneficiary].releasedAmount;
} else if... | 53,077 |
275 | // This struct represents the data to fully specify a relay. If any portion of this data differs, the relay is considered to be completely distinct. Only one relay for a particular depositId, chainId pair should be considered valid and repaid. This data is hashed and inserted into the slow relay merkle root so that an ... | struct RelayData {
// The address that made the deposit on the origin chain.
address depositor;
// The recipient address on the destination chain.
address recipient;
// The corresponding token address on the destination chain.
address destinationToken;
// The ... | struct RelayData {
// The address that made the deposit on the origin chain.
address depositor;
// The recipient address on the destination chain.
address recipient;
// The corresponding token address on the destination chain.
address destinationToken;
// The ... | 66,950 |
4 | // Update royalty info for collection if owner Only to be called if there is no setter address collection address of the NFT contract setter address that sets the receiver receiver receiver for the royalty fee fee fee (500 = 5%, 1,000 = 10%) / | function updateRoyaltyInfoForCollectionIfOwner(
address collection,
address setter,
address receiver,
uint256 fee
| function updateRoyaltyInfoForCollectionIfOwner(
address collection,
address setter,
address receiver,
uint256 fee
| 816 |
7 | // We don't need to check that tokens and assetManagers have the same length, since the Vault already performs that check. | vault.registerTokens(poolId, tokens, assetManagers);
return poolId;
| vault.registerTokens(poolId, tokens, assetManagers);
return poolId;
| 18,963 |
77 | // ecrecover returns zero on error | require(signature_address != 0x0);
return signature_address;
| require(signature_address != 0x0);
return signature_address;
| 36,755 |
182 | // pick maker's price (whoever placed order sooner considered as maker) | uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;
uint publishedRate;
(publishedRate, ) = rates.rates(augmintToken.peggedSymbol());
uint fillRate = publishedRate.mul(price).roundedDiv(1000000);
uint sellWei = sell.amount.mul(1 ether).roundedDiv(fillRate);
... | uint32 price = buyTokenId > sellTokenId ? sell.price : buy.price;
uint publishedRate;
(publishedRate, ) = rates.rates(augmintToken.peggedSymbol());
uint fillRate = publishedRate.mul(price).roundedDiv(1000000);
uint sellWei = sell.amount.mul(1 ether).roundedDiv(fillRate);
... | 7,264 |
59 | // Update developer fee address. | function dev(address _devaddr) public {
// Can be done only by developer
require(msg.sender == devaddr, "dev: wut?");
devaddr = _devaddr;
}
| function dev(address _devaddr) public {
// Can be done only by developer
require(msg.sender == devaddr, "dev: wut?");
devaddr = _devaddr;
}
| 27,781 |
40 | // int data-sets | uint256 public liquidityFeeBuy = 5;
uint256 public liquidityFeeSell = 5;
uint256 public maxTxSize;
uint256 public maxWalletSize;
uint256 public addLiquidityThreshold;
| uint256 public liquidityFeeBuy = 5;
uint256 public liquidityFeeSell = 5;
uint256 public maxTxSize;
uint256 public maxWalletSize;
uint256 public addLiquidityThreshold;
| 12,070 |
50 | // if no reserve or a new pair is created | if (amountToSwap <= 0) amountToSwap = _amount / 2;
token1Bought = _token2Token(
_toContractAddress,
_ToSushipoolToken1,
amountToSwap
);
token0Bought = _amount.sub(amountToSwap);
| if (amountToSwap <= 0) amountToSwap = _amount / 2;
token1Bought = _token2Token(
_toContractAddress,
_ToSushipoolToken1,
amountToSwap
);
token0Bought = _amount.sub(amountToSwap);
| 37,765 |
20 | // Calculates total value for provided address/ More: https:dev.gearbox.fi/developers/credit/economytotal-value//creditAccount Token creditAccount address | function calcTotalValue(address creditAccount)
external
view
returns (uint256 total);
| function calcTotalValue(address creditAccount)
external
view
returns (uint256 total);
| 35,983 |
577 | // Selector of `log(string,address,uint256,address)`. | mstore(0x00, 0x63fb8bc5)
mstore(0x20, 0x80)
mstore(0x40, p1)
mstore(0x60, p2)
mstore(0x80, p3)
writeString(0xa0, p0)
| mstore(0x00, 0x63fb8bc5)
mstore(0x20, 0x80)
mstore(0x40, p1)
mstore(0x60, p2)
mstore(0x80, p3)
writeString(0xa0, p0)
| 30,721 |
17 | // Token 信息 |
string public constant name = "Truedeal Token";
string public constant symbol = "TDT";
uint8 public decimals = 18;
mapping (address => uint256) accounts; // User Accounts
mapping (address => mapping (address => uint256)) allowed; // User's allowances table
|
string public constant name = "Truedeal Token";
string public constant symbol = "TDT";
uint8 public decimals = 18;
mapping (address => uint256) accounts; // User Accounts
mapping (address => mapping (address => uint256)) allowed; // User's allowances table
| 37,629 |
4 | // When it was planted | uint256 plantTime;
| uint256 plantTime;
| 28,556 |
8 | // Assign what ERC20 pathToSwaps[0] the FNFT will hold | fnftConfig.asset = pathToSwaps[pathToSwaps.length - 1];
| fnftConfig.asset = pathToSwaps[pathToSwaps.length - 1];
| 83,875 |
148 | // onERC721Received: for each token minted | for(uint256 i = 0; i < n; i++) {
| for(uint256 i = 0; i < n; i++) {
| 38,707 |
13 | // Atomically increases the allowance granted to `_spender` by the caller by `_addedValue`. This is an alternative to `approve` that can be used as a mitigation forproblems described in:Emits an `Approval` event indicating the updated allowance. Requirements: - `_spender` cannot be the the zero address.- the contract m... | function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
_approve(msg.sender, _spender, allowances[msg.sender][_spender].add(_addedValue));
return true;
}
| function increaseAllowance(address _spender, uint256 _addedValue) public returns (bool) {
_approve(msg.sender, _spender, allowances[msg.sender][_spender].add(_addedValue));
return true;
}
| 13,778 |
50 | // require(liquidationThreshold > _borrowLTV, "Liquidation threshold must be greater than Borrow LTV"); |
tokenInfo[_token].borrowLTV = _borrowLTV;
emit TokenUpdated(_token);
|
tokenInfo[_token].borrowLTV = _borrowLTV;
emit TokenUpdated(_token);
| 55,413 |
6 | // Function is only accessible by owner (from Ownable contract) | function toggleIsMintEnabled() external onlyOwner {
// Toggle mint enabled state
isMintEnabled = !isMintEnabled;
}
| function toggleIsMintEnabled() external onlyOwner {
// Toggle mint enabled state
isMintEnabled = !isMintEnabled;
}
| 30,171 |
0 | // IUniswapV2Router02 immutable Router2; | address public owner;
| address public owner;
| 9,259 |
101 | // Address of smart contract to delegate execution of delegatable methods to,or zero to not delegate delegatable methods execution. / | address internal delegate;
| address internal delegate;
| 75,703 |
5,846 | // 2924 | entry "hepatectomised" : ENG_ADJECTIVE
| entry "hepatectomised" : ENG_ADJECTIVE
| 19,536 |
35 | // Check that there is at least one attestor for the policy | if (
attestors.length < 1 &&
policyScalar.ruleId != universeRule &&
policyScalar.ruleId != emptyRule)
{
revert Unacceptable({
reason: "every policy needs at least one attestor"
});
| if (
attestors.length < 1 &&
policyScalar.ruleId != universeRule &&
policyScalar.ruleId != emptyRule)
{
revert Unacceptable({
reason: "every policy needs at least one attestor"
});
| 29,322 |
11 | // Updates the address to which platform fees are paid out/_platform - the new platform wallet address | function setPlatform(address _platform)
external
onlyOwner
notToZeroAddress(_platform)
| function setPlatform(address _platform)
external
onlyOwner
notToZeroAddress(_platform)
| 44,536 |
48 | // Doesn&39;t allow to send funds on contract!/ | function () payable public {
require(false);
}
| function () payable public {
require(false);
}
| 10,087 |
23 | // The block number the index was last updated at | uint32 block;
| uint32 block;
| 3,832 |
1 | // This emits when ownership of any NFT changes by any mechanism./This event emits when NFTs are created (`from` == 0) and destroyed/(`to` == 0). Exception: during contract creation, any number of NFTs/may be created and assigned without emitting Transfer. At the time of/any transfer, the approved address for that NFT ... | event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
| event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
| 20,993 |
34 | // Vesting logic The following cases are checked for _beneficiary's actions: | function vest(bool _vestingDecision) external isWhitelisted returns(bool) {
bool existingDecision = contributions[msg.sender].hasVested;
require(existingDecision != _vestingDecision);
require(block.timestamp >= publicTGEStartBlockTimeStamp);
require(contributions[msg.sender].weiContributed > 0);
/... | function vest(bool _vestingDecision) external isWhitelisted returns(bool) {
bool existingDecision = contributions[msg.sender].hasVested;
require(existingDecision != _vestingDecision);
require(block.timestamp >= publicTGEStartBlockTimeStamp);
require(contributions[msg.sender].weiContributed > 0);
/... | 46,533 |
43 | // Get the current votes balance for a user account. account The address to get votes balance. This is a wrapper to simplify arguments. The actual computation isperformed on WeightedStaking parent contract.return The number of current votes for a user account./ | function getCurrentVotes(address account) external view returns (uint96) {
return getPriorVotes(account, block.number - 1, block.timestamp);
}
| function getCurrentVotes(address account) external view returns (uint96) {
return getPriorVotes(account, block.number - 1, block.timestamp);
}
| 39,349 |
309 | // Unit&39;s levels. 0 ~ 3: Heroes. 4 ~ 7: Mobs. | uint32[8] unitLevels;
| uint32[8] unitLevels;
| 41,875 |
18 | // Returns true if the caller is the current owner. / | function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
| function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
| 2,699 |
6 | // Called to pause, triggers stopped state. / | function _pause() internal whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
| function _pause() internal whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
| 23,074 |
654 | // This function's selector is used when ABI encoding the order/and hash into a byte array before calling `isValidSignature`./This function serves no other purpose. | function OrderWithHash(
LibOrder.Order calldata order,
bytes32 orderHash
)
external
pure;
| function OrderWithHash(
LibOrder.Order calldata order,
bytes32 orderHash
)
external
pure;
| 14,571 |
139 | // maintenance and referral come out of the buyin | uint256 _dividends = SafeMath.sub(_undividedDividends, SafeMath.add(_referralBonus, _maintenance));
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
u... | uint256 _dividends = SafeMath.sub(_undividedDividends, SafeMath.add(_referralBonus, _maintenance));
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
u... | 24,588 |
12 | // Schemaless storage / | contract Storage is Ownable {
mapping(bytes32 => uint) UIntStorage;
function getUIntValue(bytes32 record)
public
view
returns (uint) {
return UIntStorage[record];
}
function setUIntValue(bytes32 record, uint value)
public
onlyOwner
{
UIn... | contract Storage is Ownable {
mapping(bytes32 => uint) UIntStorage;
function getUIntValue(bytes32 record)
public
view
returns (uint) {
return UIntStorage[record];
}
function setUIntValue(bytes32 record, uint value)
public
onlyOwner
{
UIn... | 14,248 |
17 | // Gets referrer balance of the specified address._hunter The address of the referrer return An uint256 representing the referral earnings./ | function checkReferral(address _hunter) public view returns (uint256) {
return referrer[_hunter];
}
| function checkReferral(address _hunter) public view returns (uint256) {
return referrer[_hunter];
}
| 23,241 |
2 | // Test if two arrays are equal Arrays must be of equal length, otherwise will return false a First array b Second arrayreturn Whether or not all bytes in the arrays are equal / | function arrayEq(bytes memory a, bytes memory b)
internal
pure
returns (bool)
| function arrayEq(bytes memory a, bytes memory b)
internal
pure
returns (bool)
| 40,723 |
189 | // lets the admin set a new referral registry | function updateReferralRegistry(address newReferralRegistry) external onlyOwner {
referralRegistry = IReferralRegistry(newReferralRegistry);
emit ReferralRegistryUpdated(newReferralRegistry);
}
| function updateReferralRegistry(address newReferralRegistry) external onlyOwner {
referralRegistry = IReferralRegistry(newReferralRegistry);
emit ReferralRegistryUpdated(newReferralRegistry);
}
| 58,746 |
26 | // Returns the vesting schedule id at the given index.return the vesting id / | function getVestingIdAtIndex(
uint256 index
| function getVestingIdAtIndex(
uint256 index
| 28,535 |
9 | // Set base activation fee | function setBaseActivationFee(
uint256 _baseActivationFee
| function setBaseActivationFee(
uint256 _baseActivationFee
| 13,894 |
12 | // public as we will allow specs to create the same mapping key by calling it | function stringToBytes32(string src) public pure returns (bytes32 result) {
// for this example we'll enforce that the location string can't be longer than 32 chars, obv in a prod env you'd just shorten the string here...
require(bytes(src).length <= 32, "Error: Location must be 32 characters or less");
/... | function stringToBytes32(string src) public pure returns (bytes32 result) {
// for this example we'll enforce that the location string can't be longer than 32 chars, obv in a prod env you'd just shorten the string here...
require(bytes(src).length <= 32, "Error: Location must be 32 characters or less");
/... | 6,359 |
154 | // want = address(0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e) | address constant public weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
address constant public dai = address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
address public cdp_manager = address(0x5ef30b9986345249bc32d8928B7ee64DE9435E39);
address public vat = address(0x35D1b3F3D7966A1DFe207aa... | address constant public weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
address constant public dai = address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
address public cdp_manager = address(0x5ef30b9986345249bc32d8928B7ee64DE9435E39);
address public vat = address(0x35D1b3F3D7966A1DFe207aa... | 25,640 |
142 | // it and save gas. / | function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
| function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal {
require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
_tokenURIs[tokenId] = _tokenURI;
}
| 41,817 |
55 | // Add member Only accepts calls from the admin | * Emit {LogAddMember} event
* @param account Member address
*/
function addMember(address account) public override onlyAdmin {
members[account].isMember = true;
emit LogAddMember(account);
}
| * Emit {LogAddMember} event
* @param account Member address
*/
function addMember(address account) public override onlyAdmin {
members[account].isMember = true;
emit LogAddMember(account);
}
| 21,692 |
89 | // Returns the number of decimals the token uses. | uint8 immutable public decimals; // TODO: use `constant` (18) for mainnet
| uint8 immutable public decimals; // TODO: use `constant` (18) for mainnet
| 58,891 |
94 | // Contract should have USDC balance of 70% of given amount | uint256 value = toUSDC(assetAdd, amount);
value = value.mul(loanPercentage).div(100);
require(
IERC20(USDC).balanceOf(address(this)) >= value,
"Insufficient USDC balance"
);
| uint256 value = toUSDC(assetAdd, amount);
value = value.mul(loanPercentage).div(100);
require(
IERC20(USDC).balanceOf(address(this)) >= value,
"Insufficient USDC balance"
);
| 21,366 |
79 | // Require that the caller must be the operator (the bank). | modifier onlyOperator() {
require(msg.sender == operator, "not operator");
_;
}
| modifier onlyOperator() {
require(msg.sender == operator, "not operator");
_;
}
| 20,027 |
4 | // see https:www.ethereum.org/token | interface tokenRecipient {
function receiveApproval( address from, uint256 value, bytes data ) public;
}
| interface tokenRecipient {
function receiveApproval( address from, uint256 value, bytes data ) public;
}
| 80,434 |
13 | // If no more purposes, delete key | if (purposes.length == 0) {
delete _keyHolderData.keys[_key];
}
| if (purposes.length == 0) {
delete _keyHolderData.keys[_key];
}
| 22,700 |
27 | // proxy owner if used through proxy, address(0) otherwise | require(
!address(this).call(abi.encodeWithSelector(UPGRADEABILITY_OWNER)) || // covers usage without calling through storage proxy
msg.sender == IUpgradeabilityOwnerStorage(this).upgradeabilityOwner() || // covers usage through regular proxy calls
msg.sender == addre... | require(
!address(this).call(abi.encodeWithSelector(UPGRADEABILITY_OWNER)) || // covers usage without calling through storage proxy
msg.sender == IUpgradeabilityOwnerStorage(this).upgradeabilityOwner() || // covers usage through regular proxy calls
msg.sender == addre... | 42,458 |
58 | // ============================================================================== interface============================================================================== |
interface UserDataManagerInterface {
function getPlayerID(address _addr) external returns (uint256);
function getPlayerName(uint256 _pID) external view returns (bytes32);
function getPlayerLaff(uint256 _pID) external view returns (uint256);
function getPlayerAddr(uint256 _pID) external view returns (ad... |
interface UserDataManagerInterface {
function getPlayerID(address _addr) external returns (uint256);
function getPlayerName(uint256 _pID) external view returns (bytes32);
function getPlayerLaff(uint256 _pID) external view returns (uint256);
function getPlayerAddr(uint256 _pID) external view returns (ad... | 46,311 |
7 | // Slice the sighash. | _returnData := add(_returnData, 0x04)
| _returnData := add(_returnData, 0x04)
| 40,381 |
20 | // in test environment, a template will be approved automatically after submission/this should be commentted out in PROD environment | approveForTest(_category, _name);
| approveForTest(_category, _name);
| 37,756 |
51 | // 确保玩家存在 | require(_pID != 0, "Please join the game first!");
| require(_pID != 0, "Please join the game first!");
| 7,878 |
18 | // CHECKS | require(
currentExecutor != _newExecutor,
"GelatoProviders.providerAssignsExecutor: already assigned."
);
if (_newExecutor != address(0)) {
require(
isExecutorMinStaked(_newExecutor),
"GelatoProviders.providerAssignsExecutor: is... | require(
currentExecutor != _newExecutor,
"GelatoProviders.providerAssignsExecutor: already assigned."
);
if (_newExecutor != address(0)) {
require(
isExecutorMinStaked(_newExecutor),
"GelatoProviders.providerAssignsExecutor: is... | 42,511 |
193 | // Recover the address of the signature from the hashed digest;/Ensure it equals the requester's address | require(
ecrecover(fxTxHash, sigV, sigR, sigS) == requester,
"Error: Address derived from transaction signature does not match the requester address");
| require(
ecrecover(fxTxHash, sigV, sigR, sigS) == requester,
"Error: Address derived from transaction signature does not match the requester address");
| 26,832 |
129 | // Fallback Manager - A contract that manages fallback calls made to this contract/Richard Meissner - <richard@gnosis.pm> | contract SignerManager is Ownable {
event ChangedSigner(address signer);
// keccak256("owner.signer.address")
bytes32 internal constant SIGNER_STORAGE_SLOT = 0x975ab5f8337fe05074119ae2318a39673b00662f832900cb67ec977634a27381;
/// @dev Set a signer that checks transactions before execution
/// @par... | contract SignerManager is Ownable {
event ChangedSigner(address signer);
// keccak256("owner.signer.address")
bytes32 internal constant SIGNER_STORAGE_SLOT = 0x975ab5f8337fe05074119ae2318a39673b00662f832900cb67ec977634a27381;
/// @dev Set a signer that checks transactions before execution
/// @par... | 33,708 |
21 | // Returns true if the merkle distributor has been funded, otherwise false. | function isFunded() external view returns (bool);
| function isFunded() external view returns (bool);
| 52,410 |
207 | // uint256 lastSupplyChangeTime / If the totalSupply will change then we store the new total supply, the integral total supply and the current block time. We know that this int256 conversion will not overflow because totalSupply is stored as a uint96 and checked in the next line. | int256 newTotalSupply = int256(totalSupply).add(netChange);
require(newTotalSupply >= 0 && uint256(newTotalSupply) < type(uint96).max); // dev: nToken supply overflow
mapping(address => nTokenTotalSupplyStorage) storage store = LibStorage.getNTokenTotalSupplyStorage();
n... | int256 newTotalSupply = int256(totalSupply).add(netChange);
require(newTotalSupply >= 0 && uint256(newTotalSupply) < type(uint96).max); // dev: nToken supply overflow
mapping(address => nTokenTotalSupplyStorage) storage store = LibStorage.getNTokenTotalSupplyStorage();
n... | 64,930 |
51 | // return Returns true if 7 days have passed since the end of the auction / | function finalizeTimeExpired() public view returns (bool) {
return uint256(marketInfo.endTime) + 7 days < block.timestamp;
}
| function finalizeTimeExpired() public view returns (bool) {
return uint256(marketInfo.endTime) + 7 days < block.timestamp;
}
| 33,394 |
52 | // Overrides the ERC20Basic transferFrom() function to only allow token transfers after enableTransfer() is called. / | function transferFrom(address _from, address _to, uint256 _value) public onlyWhenTransferEnabled returns (bool) {
return super.transferFrom(_from, _to, _value);
}
| function transferFrom(address _from, address _to, uint256 _value) public onlyWhenTransferEnabled returns (bool) {
return super.transferFrom(_from, _to, _value);
}
| 1,348 |
72 | // OBR Token | contract OBR is ERC20("OBR", "OBR", 18, 2, 50000), Ownable{
function setBurnrate(uint8 burnrate_) public onlyOwner {
_setupBurnrate(burnrate_);
}
function addWhitelistedAddress(address _address) public onlyOwner {
_whitelistedAddresses[_address] = true;
}
function removeWhi... | contract OBR is ERC20("OBR", "OBR", 18, 2, 50000), Ownable{
function setBurnrate(uint8 burnrate_) public onlyOwner {
_setupBurnrate(burnrate_);
}
function addWhitelistedAddress(address _address) public onlyOwner {
_whitelistedAddresses[_address] = true;
}
function removeWhi... | 21,985 |
221 | // Update state variables | _totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
_callTokensReceived(operator, address(0), account, amount, userData, operatorData, true);
emit Minted(operator, account, amount, userData, operatorData);
emit Transfer(address(0), acco... | _totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
_callTokensReceived(operator, address(0), account, amount, userData, operatorData, true);
emit Minted(operator, account, amount, userData, operatorData);
emit Transfer(address(0), acco... | 10,127 |
160 | // unregister a scheme _scheme the address of the schemereturn bool which represents a success / | function unregisterScheme( address _scheme, address _avatar)
external
onlyRegisteringSchemes
onlySubjectToConstraint("unregisterScheme")
isAvatarValid(_avatar)
returns(bool)
| function unregisterScheme( address _scheme, address _avatar)
external
onlyRegisteringSchemes
onlySubjectToConstraint("unregisterScheme")
isAvatarValid(_avatar)
returns(bool)
| 77,144 |
142 | // avoids stack too deep errors | uint256 tempOnXInitBlock = _onxInitBlock;
uint256 tempBulkBlockSize = _bulkBlockSize;
uint256 tempCommonDifference = _commonDifference;
if (currentPreviousBulkLastBlock > lastRewardBulkLastBlock) {
uint256 tempCurrentPreviousBulkLastBlock = currentPrevious... | uint256 tempOnXInitBlock = _onxInitBlock;
uint256 tempBulkBlockSize = _bulkBlockSize;
uint256 tempCommonDifference = _commonDifference;
if (currentPreviousBulkLastBlock > lastRewardBulkLastBlock) {
uint256 tempCurrentPreviousBulkLastBlock = currentPrevious... | 25,479 |
34 | // Since tokens have been granted, increase the total amount of vesting. | totalVesting = totalVesting.add(_value);
emit NewGrant(msg.sender, _to, _value);
| totalVesting = totalVesting.add(_value);
emit NewGrant(msg.sender, _to, _value);
| 29,418 |
25 | // Init next Game / | GAME_NUM++;
games[GAME_NUM].datetime = now;
emit NewGame(GAME_NUM);
POOL_COUNTER = 0;
| GAME_NUM++;
games[GAME_NUM].datetime = now;
emit NewGame(GAME_NUM);
POOL_COUNTER = 0;
| 48,448 |
3 | // Deploys and returns the address of a clone that mimics the behaviour of `master`. This function uses the create2 opcode and a `salt` to deterministically deploythe clone. Using the same `master` and `salt` multiple time will revert, sincethe clones cannot be deployed twice at the same address. / | function cloneDeterministic(address master, bytes32 salt) internal returns (address instance) {
// solhint-disable-next-line no-inline-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore... | function cloneDeterministic(address master, bytes32 salt) internal returns (address instance) {
// solhint-disable-next-line no-inline-assembly
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore... | 19,370 |
101 | // Deposits tokens in proportion to the Unipilot's current ticks, mints them/ `Unipilot`s NFT./token0 The first of the two tokens of the pool, sorted by address/token1 The second of the two tokens of the pool, sorted by address/amount0Desired Max amount of token0 to deposit/amount1Desired Max amount of token1 to deposi... | function deposit(
address token0,
address token1,
uint256 amount0Desired,
uint256 amount1Desired,
uint256 shares,
uint256 tokenId,
bool isTokenMinted,
bytes memory data
) external payable;
| function deposit(
address token0,
address token1,
uint256 amount0Desired,
uint256 amount1Desired,
uint256 shares,
uint256 tokenId,
bool isTokenMinted,
bytes memory data
) external payable;
| 53,882 |
15 | // Load the rune into the MSBs of b | assembly { word:= mload(mload(add(self, 32))) }
| assembly { word:= mload(mload(add(self, 32))) }
| 19,437 |
5 | // emitted when a non-sequential nonce is occupied in storage through an authorized call to/ `useNonSequentialNonces()`, which can be used to cancel a previously signed request | event NonSequentialNonceOccupied(bytes32 indexed occupiedNonSequentialNonce);
| event NonSequentialNonceOccupied(bytes32 indexed occupiedNonSequentialNonce);
| 5,295 |
115 | // xref:ROOT:erc1155.adocbatch-operations[Batched] version of {_mint}. Emits a {TransferBatch} event. Requirements: - `ids` and `amounts` must have the same length.- If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return theacceptance magic value. / | function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"... | function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"... | 8,494 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.