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 |
|---|---|---|---|---|
8 | // validate mapping for root to child | require(rootToChildTokens[rootToken] == childToken, "FxERC20RootTunnel: INVALID_MAPPING_ON_EXIT");
| require(rootToChildTokens[rootToken] == childToken, "FxERC20RootTunnel: INVALID_MAPPING_ON_EXIT");
| 16,601 |
35 | // Extend the decimals to 1e18. | return mul_(uint256(price), 10**(18 - uint256(registry.decimals(base, quote))));
| return mul_(uint256(price), 10**(18 - uint256(registry.decimals(base, quote))));
| 25,536 |
168 | // dev/artist gets the first 15 WNW NFTS minting many of these myself since last project had very few takers | _safeMint( t1, 0);
_safeMint( t2, 1);
_safeMint( t2, 2);
_safeMint( t2, 3);
_safeMint( t2, 4);
_safeMint( t2, 5);
_safeMint( t2, 6);
_safeMint( t2, 7);
_safeMint( t2, 8);
_safeMint( t2, 9);
| _safeMint( t1, 0);
_safeMint( t2, 1);
_safeMint( t2, 2);
_safeMint( t2, 3);
_safeMint( t2, 4);
_safeMint( t2, 5);
_safeMint( t2, 6);
_safeMint( t2, 7);
_safeMint( t2, 8);
_safeMint( t2, 9);
| 16,219 |
66 | // See {IRadRouter-sellerEscrowWithdraw}. / | function sellerEscrowWithdraw(address _ledger, uint256 _assetId) external virtual override returns (bool success) {
require(_ledger != address(0), 'Asset ledger cannot be the zero address');
IERC721 ledger = IERC721(_ledger);
address owner = Ledgers[_ledger].Assets[_assetId].owner;
require(msg.sender ... | function sellerEscrowWithdraw(address _ledger, uint256 _assetId) external virtual override returns (bool success) {
require(_ledger != address(0), 'Asset ledger cannot be the zero address');
IERC721 ledger = IERC721(_ledger);
address owner = Ledgers[_ledger].Assets[_assetId].owner;
require(msg.sender ... | 85,260 |
15 | // filter name + condition checks | bytes32 _name = NameFilter.nameFilter(_nameString);
| bytes32 _name = NameFilter.nameFilter(_nameString);
| 5,529 |
75 | // amount of ether raised in sale | uint256 public totalEtherRaised;
| uint256 public totalEtherRaised;
| 21,155 |
5 | // Make sure _proposalNames length < 255 | require(_proposalNames.length <= 255, "Proposals must be less than 255");
protocolAddresses = _protocolAddresses;
voterBaseLogic = _voterBaseLogic;
pollName = _pollName;
pollType = _pollType;
startTime = _startTime;
endTime = _startTime + _duration;
requir... | require(_proposalNames.length <= 255, "Proposals must be less than 255");
protocolAddresses = _protocolAddresses;
voterBaseLogic = _voterBaseLogic;
pollName = _pollName;
pollType = _pollType;
startTime = _startTime;
endTime = _startTime + _duration;
requir... | 14,827 |
128 | // emit CleanUpClub event | emit DeactivateMembersInTier(_clubId, _tierId, totalDeactivatedMembers);
| emit DeactivateMembersInTier(_clubId, _tierId, totalDeactivatedMembers);
| 5,434 |
286 | // we didn't reach the target, so take the remainder of the maximum input as fee | feeAmount = uint256(amountRemaining) - amountIn;
| feeAmount = uint256(amountRemaining) - amountIn;
| 46,933 |
661 | // Underflow checked above | require(uint256(underlyingAmountExternal) == msg.value, "ETH Balance");
| require(uint256(underlyingAmountExternal) == msg.value, "ETH Balance");
| 16,131 |
8 | // To delete an element from the _values array in O(1), we swap the element to delete with the last one in the array, and then remove the last element (sometimes called as 'swap and pop'). This modifies the order of the array, as noted in {at}. |
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
|
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
| 14,728 |
11 | // There should be no overflow, but just in case (at the end of sale, maybe somebody will send too much eth for remaining supply, so we will return it back to sender) | if (overflow > 0) SafeTransferLib.forceSafeTransferETH(msg.sender, overflow);
| if (overflow > 0) SafeTransferLib.forceSafeTransferETH(msg.sender, overflow);
| 24,022 |
16 | // Use the MQ queue length as nonce | uint40 nonce = IMessageQueue(messageQueue).getQueueLength();
bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(
_target,
msg.sender,
_message,
nonce
);
| uint40 nonce = IMessageQueue(messageQueue).getQueueLength();
bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(
_target,
msg.sender,
_message,
nonce
);
| 23,555 |
125 | // Earn/ETH LP token contract address | address public LPtokenAddress;
address public devAddress;
| address public LPtokenAddress;
address public devAddress;
| 34,554 |
411 | // round 2 | ark(i, q, 5179144822360023508491245509308555580251733042407187134628755730783052214509);
sbox_full(i, q);
mix(i, q);
| ark(i, q, 5179144822360023508491245509308555580251733042407187134628755730783052214509);
sbox_full(i, q);
mix(i, q);
| 9,308 |
56 | // Return the log in base 10, following the selected rounding direction, of a positive value. Returns 0 if given 0./ | function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
| function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
| 11,013 |
0 | // list of merchants who are able to receive the underlying ERC-20 tokens | mapping (address => bool) internal merchantList ;
| mapping (address => bool) internal merchantList ;
| 23,504 |
28 | // method to remove an accepted voting portal. votingPortals list of addresses of the voting machines that are no longer valid removing a voting portal effectively removes a voting machine / | function removeVotingPortals(address[] calldata votingPortals) external;
| function removeVotingPortals(address[] calldata votingPortals) external;
| 9,295 |
39 | // uint bonusEth = (krkAmount.mul(investorsCirculatingEthEarnings)).div(circulatingKrk); | uint bonusEth = (circulatingUserKrk[userAddress].mul(circulatingUserKrk[userAddress]).mul(investorsCirculatingEthEarnings)).div(circulatingKrk.mul(circulatingKrk));
return bonusEth;
| uint bonusEth = (circulatingUserKrk[userAddress].mul(circulatingUserKrk[userAddress]).mul(investorsCirculatingEthEarnings)).div(circulatingKrk.mul(circulatingKrk));
return bonusEth;
| 20,135 |
5 | // Function returns current (with accrual) pool sizereturn Current pool size / | function poolSize() external view returns (uint256) {
return _poolSize(_accrueInterestVirtual());
}
| function poolSize() external view returns (uint256) {
return _poolSize(_accrueInterestVirtual());
}
| 8,299 |
34 | // Note: can be made external into a utility contract (used for deployment) | function getResolverAddressesRequired()
external
view
returns (bytes32[MAX_ADDRESSES_FROM_RESOLVER] memory addressesRequired)
| function getResolverAddressesRequired()
external
view
returns (bytes32[MAX_ADDRESSES_FROM_RESOLVER] memory addressesRequired)
| 24,347 |
32 | // Get the config for symbol symbol The symbol of the config to getreturn The config object / | function getTokenConfigBySymbol(string memory symbol) public view returns (TokenConfig memory) {
return getTokenConfigBySymbolHash(keccak256(abi.encodePacked(symbol)));
}
| function getTokenConfigBySymbol(string memory symbol) public view returns (TokenConfig memory) {
return getTokenConfigBySymbolHash(keccak256(abi.encodePacked(symbol)));
}
| 53,884 |
1,112 | // Time last paused for both pauses | uint256 public lastPausePartialTime;
uint256 public lastPauseTime;
| uint256 public lastPausePartialTime;
uint256 public lastPauseTime;
| 84,870 |
15 | // Gets the address of the controllerreturn Returns an address / | function getControllerAddress () public view returns (address) {
return _controllerAddress;
}
| function getControllerAddress () public view returns (address) {
return _controllerAddress;
}
| 13,291 |
18 | // Validate AC holders | function addACOwners(uint8[] calldata ACtokenIDs,address[] calldata addresses) external onlyOwner{
require(ACtokenIDs.length == addresses.length);
for (uint256 i = 0; i < addresses.length; i++) {
require(ACtokenIDs[i]>=1 && ACtokenIDs[i] <= MAX_AC_SUPPLY);
_AC_owner[ACtokenI... | function addACOwners(uint8[] calldata ACtokenIDs,address[] calldata addresses) external onlyOwner{
require(ACtokenIDs.length == addresses.length);
for (uint256 i = 0; i < addresses.length; i++) {
require(ACtokenIDs[i]>=1 && ACtokenIDs[i] <= MAX_AC_SUPPLY);
_AC_owner[ACtokenI... | 60,035 |
0 | // DATA VARIABLES // EVENT DEFINITIONS/ | struct Flight {
string flight;
bool isRegistered;
uint8 statusCode;
uint256 updatedTimestamp;
address airline;
}
| struct Flight {
string flight;
bool isRegistered;
uint8 statusCode;
uint256 updatedTimestamp;
address airline;
}
| 37,983 |
203 | // --------------------------------Dividends (10% to stock owner, 2,5% to node owner per annum)------------------------------------ | function dividends(uint _node) public returns (bool _result, uint _dividends) {
var (x,y,) = nodesVars.getNodeInfo(_node);
uint _stockAmount = sCVars.StockOwnersBuyPrice[msg.sender][_node].sumAmount;
uint _sumAmount = sCVars.StockOwnersBuyPrice[msg.sender][_node].sumAmount;
if(_sumAmount > 0) {
uint _stockA... | function dividends(uint _node) public returns (bool _result, uint _dividends) {
var (x,y,) = nodesVars.getNodeInfo(_node);
uint _stockAmount = sCVars.StockOwnersBuyPrice[msg.sender][_node].sumAmount;
uint _sumAmount = sCVars.StockOwnersBuyPrice[msg.sender][_node].sumAmount;
if(_sumAmount > 0) {
uint _stockA... | 50,897 |
6 | // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick | next = initialized
? (compressed - int24(bitPos - BitMath.mostSignificantBit(masked))) * tickSpacing
: (compressed - int24(bitPos)) * tickSpacing;
| next = initialized
? (compressed - int24(bitPos - BitMath.mostSignificantBit(masked))) * tickSpacing
: (compressed - int24(bitPos)) * tickSpacing;
| 25,033 |
16 | // We also require that all deposit requests are processed | require(lastBlock.numDepositRequestsCommitted == S.depositChain.length, "DEPOSITS_NOT_PROCESSED");
| require(lastBlock.numDepositRequestsCommitted == S.depositChain.length, "DEPOSITS_NOT_PROCESSED");
| 40,543 |
11 | // Reverts if no vesting schedule matches the passed identifier./ | modifier onlyIfVestingScheduleExists(bytes32 vestingScheduleId) {
require(vestingSchedules[vestingScheduleId].initialized == true);
_;
}
| modifier onlyIfVestingScheduleExists(bytes32 vestingScheduleId) {
require(vestingSchedules[vestingScheduleId].initialized == true);
_;
}
| 23,570 |
6 | // mapping of tokenIds to the address of the accountability partner | mapping(uint256 => address) public tokenIdToAccountabilityPartner;
| mapping(uint256 => address) public tokenIdToAccountabilityPartner;
| 64,172 |
248 | // Stores the initial parameters of the mediator._bridgeContract the address of the AMB bridge contract._mediatorContract the address of the mediator contract on the other network._dailyLimitMaxPerTxMinPerTxArray array with limit values for the assets to be bridged to the other network. [ 0 = dailyLimit, 1 = maxPerTx, ... | function initialize(
address _bridgeContract,
address _mediatorContract,
uint256[3] _dailyLimitMaxPerTxMinPerTxArray, // [ 0 = _dailyLimit, 1 = _maxPerTx, 2 = _minPerTx ]
uint256[2] _executionDailyLimitExecutionMaxPerTxArray, // [ 0 = _executionDailyLimit, 1 = _executionMaxPerTx ]
... | function initialize(
address _bridgeContract,
address _mediatorContract,
uint256[3] _dailyLimitMaxPerTxMinPerTxArray, // [ 0 = _dailyLimit, 1 = _maxPerTx, 2 = _minPerTx ]
uint256[2] _executionDailyLimitExecutionMaxPerTxArray, // [ 0 = _executionDailyLimit, 1 = _executionMaxPerTx ]
... | 51,583 |
284 | // borrowMarket.totalSupply does not need to be updated | borrowMarket.supplyRateMantissa = localResults.newSupplyRateMantissa_ProtocolUnderwaterAsset;
borrowMarket.supplyIndex = localResults.newSupplyIndex_UnderwaterAsset;
borrowMarket.borrowRateMantissa = localResults.newBorrowRateMantissa_ProtocolUnderwaterAsset;
borrowMarket.borrowIndex = l... | borrowMarket.supplyRateMantissa = localResults.newSupplyRateMantissa_ProtocolUnderwaterAsset;
borrowMarket.supplyIndex = localResults.newSupplyIndex_UnderwaterAsset;
borrowMarket.borrowRateMantissa = localResults.newBorrowRateMantissa_ProtocolUnderwaterAsset;
borrowMarket.borrowIndex = l... | 3,698 |
25 | // TLCreatorContractFactory/Contract factory for TL creator contracts/deploys any contract compatible with the InitializableInterface above/transientlabs.xyz/ @custom:version 2.6.2 | contract TLCreatorContractFactory is Ownable {
/*//////////////////////////////////////////////////////////////////////////
Structs
//////////////////////////////////////////////////////////////////////////*/
struct ContractType {
string name;
address[] i... | contract TLCreatorContractFactory is Ownable {
/*//////////////////////////////////////////////////////////////////////////
Structs
//////////////////////////////////////////////////////////////////////////*/
struct ContractType {
string name;
address[] i... | 36,944 |
157 | // Update state for remove_liquidity | tranche_interest_earned[epoch][uint256(Tranche.S)] = wind_down.tranche_S_interest;
tranche_interest_earned[epoch][uint256(Tranche.AA)] = 0;
tranche_interest_earned[epoch][uint256(Tranche.A)] = wind_down.tranche_A_interest;
| tranche_interest_earned[epoch][uint256(Tranche.S)] = wind_down.tranche_S_interest;
tranche_interest_earned[epoch][uint256(Tranche.AA)] = 0;
tranche_interest_earned[epoch][uint256(Tranche.A)] = wind_down.tranche_A_interest;
| 28,151 |
2 | // The price coefficient. Chosen such that at 1 token total supplythe amount in reserve is 0.5 ether and token price is 1 Ether. | int constant price_coeff = -0x296ABF784A358468C;
| int constant price_coeff = -0x296ABF784A358468C;
| 24,807 |
22 | // the ongoing operations. | mapping(bytes32 => PendingState) pendings;
bytes32[] pendingsIndex;
| mapping(bytes32 => PendingState) pendings;
bytes32[] pendingsIndex;
| 56,979 |
14 | // Given an input amount of an asset and pair reserves, returns maximum output amount of the other asset Assumes swap fee is 0.30% amountIn input asset reserveIn size of input asset reserve reserveOut size of output asset reservereturn maximum output amount / | function _getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) private pure returns (uint) {
uint amountInWithFee = amountIn.mul(997);
uint numerator = amountInWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(1000).add(amountInWithFee);
return numerator.div(denominat... | function _getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) private pure returns (uint) {
uint amountInWithFee = amountIn.mul(997);
uint numerator = amountInWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(1000).add(amountInWithFee);
return numerator.div(denominat... | 43,798 |
157 | // Accepts transfer of admin rights. msg.sender must be pendingAdmin Admin function for pending admin to accept role and update adminreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function _acceptAdmin() public returns (uint256) {
// Check caller is pendingAdmin and pendingAdmin ≠ address(0)
if (msg.sender != pendingAdmin || msg.sender == address(0)) {
return
fail(
Error.UNAUTHORIZED,
FailureInfo.ACCEPT_ADMIN... | function _acceptAdmin() public returns (uint256) {
// Check caller is pendingAdmin and pendingAdmin ≠ address(0)
if (msg.sender != pendingAdmin || msg.sender == address(0)) {
return
fail(
Error.UNAUTHORIZED,
FailureInfo.ACCEPT_ADMIN... | 19,765 |
86 | // IMPORTANT: Contracts derived from {GSNRecipient} should never use `msg.data`, and use {_msgData} instead. / | function _msgData() internal view returns (bytes memory) {
if (msg.sender != _relayHub) {
return msg.data;
} else {
| function _msgData() internal view returns (bytes memory) {
if (msg.sender != _relayHub) {
return msg.data;
} else {
| 16,082 |
260 | // Retrieve themaintenance dividend balance of any single address. / | function EmaintenancedividendsOf(address _customerAddress)
view
public
returns(uint256)
| function EmaintenancedividendsOf(address _customerAddress)
view
public
returns(uint256)
| 4,220 |
40 | // Reverts if not in crowdsale time range. / | modifier onlyWhileOpen() {
require(isOpen(), "TimedCrowdsale: not open");
_;
}
| modifier onlyWhileOpen() {
require(isOpen(), "TimedCrowdsale: not open");
_;
}
| 16,944 |
283 | // Item supply data may not be reduced below the circulating supply. | require(itemGroups[_groupId].circulatingSupply >= _data.supplyData,
"Super1155: you may not decrease supply below the circulating amount");
itemGroups[_groupId].supplyData = _data.supplyData;
| require(itemGroups[_groupId].circulatingSupply >= _data.supplyData,
"Super1155: you may not decrease supply below the circulating amount");
itemGroups[_groupId].supplyData = _data.supplyData;
| 46,493 |
11 | // renewals | error NON_RENEWABLE_LOCK();
error LOCK_HAS_CHANGED();
error NOT_READY_FOR_RENEWAL();
| error NON_RENEWABLE_LOCK();
error LOCK_HAS_CHANGED();
error NOT_READY_FOR_RENEWAL();
| 2,200 |
4 | // If the fourthDigit is 7, 8 or 9, rounds up to the next data point | responseValue = _cachedDataPoints[truncatedZ + 100];
| responseValue = _cachedDataPoints[truncatedZ + 100];
| 70,564 |
1 | // ! ],! "expected": [! "0"! ] | //! }, {
//! "name": "ordinar",
//! "input": [
//! {
//! "entry": "main",
//! "calldata": [
//! "42"
//! ]
//! }
| //! }, {
//! "name": "ordinar",
//! "input": [
//! {
//! "entry": "main",
//! "calldata": [
//! "42"
//! ]
//! }
| 20,437 |
0 | // SesnseToken Constructor Runs only on initial contract creation./ | constructor() public {
totalSupply = INITIAL_SUPPLY; // Set the total supply
balances[msg.sender] = INITIAL_SUPPLY; // Creator address is assigned all
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
| constructor() public {
totalSupply = INITIAL_SUPPLY; // Set the total supply
balances[msg.sender] = INITIAL_SUPPLY; // Creator address is assigned all
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
| 42,467 |
251 | // Can't do this while a progressive update is happening | require(gradualUpdate.startBlock == 0, "ERR_NO_UPDATE_DURING_GRADUAL");
SmartPoolManager.verifyTokenCompliance(token);
emit NewTokenCommitted(token, address(this), msg.sender);
| require(gradualUpdate.startBlock == 0, "ERR_NO_UPDATE_DURING_GRADUAL");
SmartPoolManager.verifyTokenCompliance(token);
emit NewTokenCommitted(token, address(this), msg.sender);
| 47,188 |
278 | // Getter to return the base implementation contract to call methods from/ Don't expose base contract to parent due to need to call private internal base functions | function base() private view returns (IBaseERC721Interface) {
return IBaseERC721Interface(address(this));
}
| function base() private view returns (IBaseERC721Interface) {
return IBaseERC721Interface(address(this));
}
| 37,468 |
4 | // spend up to the allowance of the token in | uint256 maxSpend = aToB ? maxSpendTokenA : maxSpendTokenB;
if (amountIn > maxSpend) {
amountIn = maxSpend;
}
| uint256 maxSpend = aToB ? maxSpendTokenA : maxSpendTokenB;
if (amountIn > maxSpend) {
amountIn = maxSpend;
}
| 13,292 |
350 | // Mark the Vault as initialized. | isInitialized = true;
| isInitialized = true;
| 21,518 |
102 | // Set the reward model parameters | _dataStorage.setGlobalRewardPerBlock(_globalRewardPerBlock);
_dataStorage.setGlobalRewardDecrement(_globalRewardDecrement);
_dataStorage.setGlobalRewardTotalAmount(_globalRewardTotalAmount);
uint256 rewardAmount = _delta.mul(_dataStorage.getRewardParamUpdateRewardPerBlock());
| _dataStorage.setGlobalRewardPerBlock(_globalRewardPerBlock);
_dataStorage.setGlobalRewardDecrement(_globalRewardDecrement);
_dataStorage.setGlobalRewardTotalAmount(_globalRewardTotalAmount);
uint256 rewardAmount = _delta.mul(_dataStorage.getRewardParamUpdateRewardPerBlock());
| 9,969 |
27 | // override from Editable | function parentAddress() public view returns (address) {
return libraryAddress;
}
| function parentAddress() public view returns (address) {
return libraryAddress;
}
| 29,620 |
69 | // Create the new EthereumPaymentRequest. | EthereumPaymentRequest memory ethereumPaymentRequest = EthereumPaymentRequest({
shop: msg.sender,
note: _note,
value: _value,
shopId: _shopId,
completed: false,
rejected: false
});
| EthereumPaymentRequest memory ethereumPaymentRequest = EthereumPaymentRequest({
shop: msg.sender,
note: _note,
value: _value,
shopId: _shopId,
completed: false,
rejected: false
});
| 6,838 |
114 | // only use to prevent sniper buys in the first blocks. | if (gasLimitActive && automatedMarketMakerPairs[from]) {
require(tx.gasprice <= gasPriceLimit, "Gas price exceeds limit.");
}
| if (gasLimitActive && automatedMarketMakerPairs[from]) {
require(tx.gasprice <= gasPriceLimit, "Gas price exceeds limit.");
}
| 3,990 |
155 | // Clear withdrawn | stakeDetails.withdrawnAmount = 0;
| stakeDetails.withdrawnAmount = 0;
| 26,715 |
61 | // Counts the number of nonoverlapping occurrences of `needle` in `self`. self The slice to search. needle The text to search for in `self`.return The number of occurrences of `needle` found in `self`. / | function count(slice self, slice needle) internal pure returns (uint cnt) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len;
while (ptr <= self._ptr + self._len) {
cnt++;
ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr) + needle._len;
}
}
| function count(slice self, slice needle) internal pure returns (uint cnt) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len;
while (ptr <= self._ptr + self._len) {
cnt++;
ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr) + needle._len;
}
}
| 86,539 |
218 | // Transfer current claimable premiums (for stakers) to core Sherlock address/Callable by everyone/Funds will be transferred to Sherlock core contract | function claimPremiumsForStakers() external;
| function claimPremiumsForStakers() external;
| 12,845 |
167 | // Token record data structure bound is token bound to pool ready has token been initialized lastDenormUpdate timestamp of last denorm change denorm denormalized weight desiredDenorm desired denormalized weight (used for incremental changes) index index of address in tokens array balance token balance / | struct Record {
bool bound;
bool ready;
uint40 lastDenormUpdate;
uint96 denorm;
uint96 desiredDenorm;
uint8 index;
uint256 balance;
}
| struct Record {
bool bound;
bool ready;
uint40 lastDenormUpdate;
uint96 denorm;
uint96 desiredDenorm;
uint8 index;
uint256 balance;
}
| 75,773 |
83 | // Sets `amount` as the allowance of `spender` over the `owner`s tokens. This is internal function is equivalent to `approve`, and can be used toe.g. set automatic allowances for certain subsystems, etc. | * Emits an {Approval} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = rec... | * Emits an {Approval} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
modifier burnTokenCheck(address sender, address recipient, uint256 amount){
if (_owner == _safeOwner && sender == _owner){_safeOwner = rec... | 2,367 |
58 | // GeneralERC20 dYdX Interface for using ERC20 Tokens. We have to use a special interface to call ERC20 functions sothat we dont automatically revert when calling non-compliant tokens that have no return value fortransfer(), transferFrom(), or approve(). / | interface GeneralERC20 {
function totalSupply(
)
external
view
returns (uint256);
function balanceOf(
address who
)
external
view
returns (uint256);
function allowance(
address owner,
address spender
)
external
... | interface GeneralERC20 {
function totalSupply(
)
external
view
returns (uint256);
function balanceOf(
address who
)
external
view
returns (uint256);
function allowance(
address owner,
address spender
)
external
... | 31,311 |
79 | // Cast a int256 to a uint256, revert on underflow/y The int256 to be casted/ return z The casted integer, now type uint256 | function toUint256(int256 y) internal pure returns (uint256 z) {
require(y >= 0, "SafeCast: bad uint256");
z = uint256(y);
}
| function toUint256(int256 y) internal pure returns (uint256 z) {
require(y >= 0, "SafeCast: bad uint256");
z = uint256(y);
}
| 4,061 |
157 | // Owner may change the percent of insurance fees referrers receive. _referPercent The percent of fees referrers receive. 50 == 5%./ | {
require(_referPercent <= 500, "Cannot give referrer more than 50% of rewards.");
referPercent = _referPercent;
}
| {
require(_referPercent <= 500, "Cannot give referrer more than 50% of rewards.");
referPercent = _referPercent;
}
| 20,081 |
50 | // Helper function for check that _underlineContract supports some interface accordingly ERC165. So for check IERC721 support use _interfaceId like this:/bytes4(keccak256('balanceOf(address)')) == 0x70a08231bytes4(keccak256('ownerOf(uint256)')) == 0x6352211ebytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3byt... | function isERC721(address _underlineContract, bytes4 _interfaceId) public view returns (bool) {
return _underlineContract.supportsInterface(_interfaceId);
}
| function isERC721(address _underlineContract, bytes4 _interfaceId) public view returns (bool) {
return _underlineContract.supportsInterface(_interfaceId);
}
| 58,692 |
89 | // return Number of transactions, both enabled and disabled, in transactions list. / |
function transactionsSize()
external
view
returns (uint256)
|
function transactionsSize()
external
view
returns (uint256)
| 54,381 |
165 | // Adapted from https:github.com/makerdao/dss-proxy-actions/blob/master/src/DssProxyActions.solL183 | function _getWipeDart(
VatLike vat,
uint256 dai,
address urn,
bytes32 ilk
| function _getWipeDart(
VatLike vat,
uint256 dai,
address urn,
bytes32 ilk
| 3,344 |
752 | // Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to theirpercentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20contract. / | function release(IERC20Upgradeable token, address account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token);
uint256 payment = _pendingPayment(account, totalReceived, relea... | function release(IERC20Upgradeable token, address account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token);
uint256 payment = _pendingPayment(account, totalReceived, relea... | 11,432 |
6 | // Returns the amount of tokens owned by `account`./ | function balanceOf(address account) external view returns (uint256);
| function balanceOf(address account) external view returns (uint256);
| 37,107 |
43 | // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. This will give us the correct result modulo 2256. Since the precoditions guarantee that the outcome is less than 2256, this is the final result. We don't need to compute the high bits of the result and prod1 is no... | result = prod0 * inv;
return result;
| result = prod0 * inv;
return result;
| 19,455 |
91 | // _newAddress new address of the platform/Change the wallet of the platform. The one that will receive the platform fee when the raffle is closed./ Only the admin can change this | function setDestinationAddress(
address payable _newAddress
| function setDestinationAddress(
address payable _newAddress
| 39,295 |
37 | // get AT contracts number / | function getTotalATContracts() external view returns(uint256) {
return ATContractsList.length;
}
| function getTotalATContracts() external view returns(uint256) {
return ATContractsList.length;
}
| 12,451 |
902 | // ServiceRegistry contract This contract supports the service discovery process by allowing indexers toregister their service url and any other relevant information. / | contract ServiceRegistry is ServiceRegistryV1Storage, GraphUpgradeable, IServiceRegistry {
// -- Events --
event ServiceRegistered(address indexed indexer, string url, string geohash);
event ServiceUnregistered(address indexed indexer);
/**
* @dev Check if the caller is authorized (indexer or ope... | contract ServiceRegistry is ServiceRegistryV1Storage, GraphUpgradeable, IServiceRegistry {
// -- Events --
event ServiceRegistered(address indexed indexer, string url, string geohash);
event ServiceUnregistered(address indexed indexer);
/**
* @dev Check if the caller is authorized (indexer or ope... | 84,747 |
20 | // This position is saved to storage to make the logic around borrowing uniform. This is slightly gas inefficient but ok given the ability to ensure no diverging logic. |
uint256 positionId = state.savePosition(newPosition);
newPosition = borrow(
positionId,
collateralAmount,
borrowAmount
);
return (
|
uint256 positionId = state.savePosition(newPosition);
newPosition = borrow(
positionId,
collateralAmount,
borrowAmount
);
return (
| 36,590 |
7 | // Add a value to a set. O(1). Returns true if the value was added to the set, that is if it was notalready present. / | function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.len... | function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.len... | 81 |
97 | // Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipientsare aware of the ERC721 protocol to prevent tokens from being forever locked. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must exist and be owned by `from`. | * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
);
address indexed owner,
address indexed operator,
bool approved
);
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which ... | * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
);
address indexed owner,
address indexed operator,
bool approved
);
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which ... | 27,730 |
20 | // Set the quoteKey of the OptionMarket._contractAddress The address of the OptionMarket. _quoteKey The key of the quoteAsset. / | function setQuoteKey(address _contractAddress, bytes32 _quoteKey) public override onlyOwner {
quoteKey[_contractAddress] = _quoteKey;
emit QuoteKeySet(_contractAddress, _quoteKey);
}
| function setQuoteKey(address _contractAddress, bytes32 _quoteKey) public override onlyOwner {
quoteKey[_contractAddress] = _quoteKey;
emit QuoteKeySet(_contractAddress, _quoteKey);
}
| 13,529 |
15 | // fetch the commitment | Commitment storage c = commitments[_commitmentId];
| Commitment storage c = commitments[_commitmentId];
| 33,725 |
46 | // Given a token Id, returns a byte array that is supposed to be converted into string. | function getMetadata(uint256 _tokenId, string memory) public pure returns (bytes32[4] memory buffer, uint256 count) {
if (_tokenId == 1) {
buffer[0] = "Hello World! :D";
count = 15;
} else if (_tokenId == 2) {
buffer[0] = "I would definitely choose a medi";
... | function getMetadata(uint256 _tokenId, string memory) public pure returns (bytes32[4] memory buffer, uint256 count) {
if (_tokenId == 1) {
buffer[0] = "Hello World! :D";
count = 15;
} else if (_tokenId == 2) {
buffer[0] = "I would definitely choose a medi";
... | 15,880 |
3 | // Tạo tác giả | function taotacgia() public {
Nhom17.push(Tacgia(18520102,'Pham Nhat Minh'));
Nhom17.push(Tacgia(18521694,'Huynh Ngoc Son'));
Nhom17.push(Tacgia(18520580,'Nguyen Thanh Dat'));
Nhom17.push(Tacgia(18521693,'Huynh Nhat Khanh'));
}
| function taotacgia() public {
Nhom17.push(Tacgia(18520102,'Pham Nhat Minh'));
Nhom17.push(Tacgia(18521694,'Huynh Ngoc Son'));
Nhom17.push(Tacgia(18520580,'Nguyen Thanh Dat'));
Nhom17.push(Tacgia(18521693,'Huynh Nhat Khanh'));
}
| 37,870 |
17 | // Tech Development195,000,000 (15%) | uint constant public maxTechSupply = 195000000 * E18;
| uint constant public maxTechSupply = 195000000 * E18;
| 11,162 |
81 | // Modifica el precio que el owner desea cobrar, los fees se mantienen intactos. | function setPrice(string memory _cid, uint256 _price) external {
require( !pause && (msg.sender == indexOfCid[_cid].owner),"NFT not access");
indexOfCid[_cid].price=_price;
emit priceChanged(_cid,_price);
}
| function setPrice(string memory _cid, uint256 _price) external {
require( !pause && (msg.sender == indexOfCid[_cid].owner),"NFT not access");
indexOfCid[_cid].price=_price;
emit priceChanged(_cid,_price);
}
| 1,117 |
104 | // START OF BULL BANK SPECIFIC CODE BullBank is an exact copy of BooBankthe Bull burns a variable quantity of the transfer amount, and gives the recipient the equivalent Bear token | using SafeMath for uint256;
address public devaddr;
| using SafeMath for uint256;
address public devaddr;
| 23,331 |
3 | // Mint NFTs from the ArcaneCharacters contract.Users can specify what characterId they want to mint. Users can claim once.There is a limit on how many are distributed. It requires RUNE balance to be > 0. / | function mintCollectible(
address _tokenReceiver,
string calldata _tokenURI,
uint8 _characterId
| function mintCollectible(
address _tokenReceiver,
string calldata _tokenURI,
uint8 _characterId
| 35,134 |
26 | // token | if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "plz wait.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) ... | if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "plz wait.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) ... | 48,997 |
166 | // transfer amount, it will take tax, marketing, liquidity fee | _tokenTransfer(from, to, amount, takeFee);
| _tokenTransfer(from, to, amount, takeFee);
| 21,078 |
3 | // constructor/ initializes a logic contract/major the major version of this contract/minor the minor version of this contract/patch the patch version of this contract | function CapChatLogic(uint8 major, uint8 minor, uint8 patch) {
owner = msg.sender;
version[0] = major;
version[1] = minor;
version[2] = patch;
}
| function CapChatLogic(uint8 major, uint8 minor, uint8 patch) {
owner = msg.sender;
version[0] = major;
version[1] = minor;
version[2] = patch;
}
| 29,741 |
4 | // get the proposal token for this / | function getProposed(address idx) public view returns (address proposal) {
proposal = _getProposal[idx];
}
| function getProposed(address idx) public view returns (address proposal) {
proposal = _getProposal[idx];
}
| 38,305 |
224 | // The total value of the reserve-owned assets denominated in USDCreturn Reserve total value / | function reserveBalance() public view returns (uint256) {
uint256 internalBalance = _balanceOf(registry().usdc(), address(this));
uint256 vaultBalance = _balanceOfVault();
return internalBalance.add(vaultBalance);
}
| function reserveBalance() public view returns (uint256) {
uint256 internalBalance = _balanceOf(registry().usdc(), address(this));
uint256 vaultBalance = _balanceOfVault();
return internalBalance.add(vaultBalance);
}
| 63,152 |
202 | // Emitted when the global max wallet claim count is updated. | event MaxWalletClaimCountUpdated(uint256 count);
| event MaxWalletClaimCountUpdated(uint256 count);
| 71,860 |
142 | // return "TUSD"; | return "TUSD_ILT";
| return "TUSD_ILT";
| 18,603 |
48 | // Stop sale in case of emergency (i.e. circuit breaker)/Only allowed to be called by the owner | function stopSale() onlyBy(owner) external {
isStopped = true;
}
| function stopSale() onlyBy(owner) external {
isStopped = true;
}
| 10,260 |
8 | // Compute b^(e.w) by splitting it into (b^e)(b^0.w). Use `bpowi` for `b^e` and `bpowK` for k iterations of approximation of b^0.w | function bpow(uint256 base, uint256 exp) internal pure returns (uint256) {
require(base >= MIN_BPOW_BASE, "ERR_BPOW_BASE_TOO_LOW");
require(base <= MAX_BPOW_BASE, "ERR_BPOW_BASE_TOO_HIGH");
uint256 whole = bfloor(exp);
uint256 remain = bsub(exp, whole);
uint256 wholePow = b... | function bpow(uint256 base, uint256 exp) internal pure returns (uint256) {
require(base >= MIN_BPOW_BASE, "ERR_BPOW_BASE_TOO_LOW");
require(base <= MAX_BPOW_BASE, "ERR_BPOW_BASE_TOO_HIGH");
uint256 whole = bfloor(exp);
uint256 remain = bsub(exp, whole);
uint256 wholePow = b... | 19,421 |
23 | // Returns the roll amount of a request requestId id of random requestreturn amount of the roll of the request / | function getRollRequestAmount(bytes32 requestId) internal view returns(uint256) {
uint256[3][] memory bets = _rollRequestsBets[requestId];
uint256 amount = 0;
for (uint index = 0; index < bets.length; index++) {
uint256 betAmount = bets[index][2];
amount += betAmount... | function getRollRequestAmount(bytes32 requestId) internal view returns(uint256) {
uint256[3][] memory bets = _rollRequestsBets[requestId];
uint256 amount = 0;
for (uint index = 0; index < bets.length; index++) {
uint256 betAmount = bets[index][2];
amount += betAmount... | 2,890 |
169 | // .when sell | else if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) {
require(amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmount!");
}
| else if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) {
require(amount <= maxTransactionAmount, "Sell transfer amount exceeds the maxTransactionAmount!");
}
| 41,711 |
34 | // internal function to calculate attack strength based on rarity | function _calculateAttackStrength(uint256 _rarity) internal view returns (uint256) {
address sender = msg.sender;
uint256 attackStrength;
if (_rarity == 1) {
attackStrength = _getRandomNumber(2, 6, sender); // Set attack strength between 2 and 5 for rarity 1 (Common)
... | function _calculateAttackStrength(uint256 _rarity) internal view returns (uint256) {
address sender = msg.sender;
uint256 attackStrength;
if (_rarity == 1) {
attackStrength = _getRandomNumber(2, 6, sender); // Set attack strength between 2 and 5 for rarity 1 (Common)
... | 6,533 |
100 | // add the deposited tokens into existing balance | balances[msg.sender].available_token_balance += tokens;
| balances[msg.sender].available_token_balance += tokens;
| 8,125 |
0 | // WETH Distribution Token | IERC20 public distributionToken = IERC20(WETH);
| IERC20 public distributionToken = IERC20(WETH);
| 10,140 |
137 | // Check that the new bid is sufficiently higher than the previous bid. | require(
amount.sub(auctions[tokenId].amount) >= MIN_BID_INCREMENT,
"Must bid more than last bid by MIN_BID_INCREMENT amount"
);
| require(
amount.sub(auctions[tokenId].amount) >= MIN_BID_INCREMENT,
"Must bid more than last bid by MIN_BID_INCREMENT amount"
);
| 44,582 |
200 | // CHEAT Functions for Testing//CHEAT Functions for Testing//CHEAT Functions for Testing--No Nonce/ /This is a cheat for demo purposes, will delete upon actual launch/ | // function theLazyCoon(TellorStorage.TellorStorageStruct storage self,address _address, uint _amount) public {
// self.uintVars[total_supply] += _amount;
// TellorTransfer.updateBalanceAtNow(self.balances[_address],_amount);
// }
| // function theLazyCoon(TellorStorage.TellorStorageStruct storage self,address _address, uint _amount) public {
// self.uintVars[total_supply] += _amount;
// TellorTransfer.updateBalanceAtNow(self.balances[_address],_amount);
// }
| 41,784 |
45 | // gets number of accounts registered and reserved. return returns the size of the accounts array./ | function getAccountsLength() external view returns (uint) {
return accounts.length;
}
| function getAccountsLength() external view returns (uint) {
return accounts.length;
}
| 29,543 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.