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 |
|---|---|---|---|---|
43 | // is non residue ? | t0 := addmod(mulmod(t0, t0, N), mulmod(t1, t1, N), N)
let freemem := mload(0x40)
mstore(freemem, 0x20)
mstore(add(freemem, 0x20), 0x20)
mstore(add(freemem, 0x40), 0x20)
mstore(add(freemem, 0x60), t0)
| t0 := addmod(mulmod(t0, t0, N), mulmod(t1, t1, N), N)
let freemem := mload(0x40)
mstore(freemem, 0x20)
mstore(add(freemem, 0x20), 0x20)
mstore(add(freemem, 0x40), 0x20)
mstore(add(freemem, 0x60), t0)
| 18,570 |
208 | // make sure they own the name | require(plyrNames_[_pID][_name] == true, "umm... thats not a name you own");
| require(plyrNames_[_pID][_name] == true, "umm... thats not a name you own");
| 35,176 |
131 | // If none of the above conditions are satisfied, then should not rebalance | return ShouldRebalance.NONE;
| return ShouldRebalance.NONE;
| 34,745 |
117 | // This means the controller will withdraw tokens to keep price So they need to redeem PCTokens | deltaWeight = BalancerSafeMath.bsub(currentWeight, newWeight);
| deltaWeight = BalancerSafeMath.bsub(currentWeight, newWeight);
| 33,520 |
161 | // See {ERC20-_mint}. / | function swapFromNeo(address to, string memory from, uint256 amount, uint256 swapId) public virtual {
require(hasRole(MINTER_ROLE, msg.sender), "[NEX] Caller is not a minter");
require(_swapsFromNeo[swapId] == false, "[NEX] Swap for given swap id already performed");
_mint(to, amount);
... | function swapFromNeo(address to, string memory from, uint256 amount, uint256 swapId) public virtual {
require(hasRole(MINTER_ROLE, msg.sender), "[NEX] Caller is not a minter");
require(_swapsFromNeo[swapId] == false, "[NEX] Swap for given swap id already performed");
_mint(to, amount);
... | 31,938 |
144 | // calculate amount of BTRFLY available for claim by depositor_depositor address return pendingPayout_ uint / | function pendingPayoutFor( address _depositor ) external view returns ( uint pendingPayout_ ) {
uint percentVested = percentVestedFor( _depositor );
uint payout = bondInfo[ _depositor ].payout;
if ( percentVested >= 10000 ) {
pendingPayout_ = payout;
} else {
... | function pendingPayoutFor( address _depositor ) external view returns ( uint pendingPayout_ ) {
uint percentVested = percentVestedFor( _depositor );
uint payout = bondInfo[ _depositor ].payout;
if ( percentVested >= 10000 ) {
pendingPayout_ = payout;
} else {
... | 14,167 |
92 | // close the locked position after withdrawing all the reward | if (!_setupsInfo[_setups[farmingPosition.setupIndex].infoIndex].free) {
_setupPositionsCount[farmingPosition.setupIndex] -= 1;
if (_setupPositionsCount[farmingPosition.setupIndex] == 0 && !_setups[farmingPosition.setupIndex].active) {
_giveBack(_rewardRece... | if (!_setupsInfo[_setups[farmingPosition.setupIndex].infoIndex].free) {
_setupPositionsCount[farmingPosition.setupIndex] -= 1;
if (_setupPositionsCount[farmingPosition.setupIndex] == 0 && !_setups[farmingPosition.setupIndex].active) {
_giveBack(_rewardRece... | 40,075 |
59 | // validates a proof-of-work for a given NFT, with a supplied nonce at a given difficulty level | function work(
uint256 id, uint256 nonce, uint8 difficulty
| function work(
uint256 id, uint256 nonce, uint8 difficulty
| 31,311 |
1 | // 提案编号:唯一性ID,可以用时间戳 | uint topicId;
| uint topicId;
| 35,710 |
5 | // make sure that caller owns lender note | address lender = lenderNote.ownerOf(lenderNoteId);
require(lender == msg.sender, "RepaymentController: not owner of lender note");
| address lender = lenderNote.ownerOf(lenderNoteId);
require(lender == msg.sender, "RepaymentController: not owner of lender note");
| 71,478 |
32 | // Function to check if a Sell Order is canceledorderHash The hash of the orderreturn bool: True if order has been cancelled / | function isSellOrderCancelled(bytes32 orderHash) external view returns (bool) {
return sellOrdersCancelled[orderHash];
}
| function isSellOrderCancelled(bytes32 orderHash) external view returns (bool) {
return sellOrdersCancelled[orderHash];
}
| 18,470 |
147 | // if(_isExcluded[_devAddr])_tOwned[_devAddr] = _tOwned[_devAddr].add(rDev.div(currentRate)); |
uint256 nrLiquidity = rLiquidity.sub(rBurn).sub(rDev);
_rOwned[address(this)] = _rOwned[address(this)].add(nrLiquidity);
|
uint256 nrLiquidity = rLiquidity.sub(rBurn).sub(rDev);
_rOwned[address(this)] = _rOwned[address(this)].add(nrLiquidity);
| 22,411 |
18 | // Assigns ownership of a specific Kitty to an address. | function _transfer(address _from, address _to, uint256 _tokenId) internal {
// Since the number of kittens is capped to 2^32 we can't overflow this
ownershipTokenCount[_to]++;
// transfer ownership
kittyIndexToOwner[_tokenId] = _to;
// When creating new kittens _from is 0x0, ... | function _transfer(address _from, address _to, uint256 _tokenId) internal {
// Since the number of kittens is capped to 2^32 we can't overflow this
ownershipTokenCount[_to]++;
// transfer ownership
kittyIndexToOwner[_tokenId] = _to;
// When creating new kittens _from is 0x0, ... | 3,977 |
25 | // Provides a user their quoted share of future rewards. If the contract's not synced with the controller, it'll reference the updated period. _user Reward owner _gauge The gauge being referenced by this function. _token The incentive deposited on this gauge.return _amount The amount currently claimable / | function claimable(address _user, address _gauge, address _token) external view returns (uint _amount) {
_amount = 0;
bool userBlacklisted = isBlacklisted(_user) || isBlacklistedGaugeAddress(_gauge, _user);
// user can't claim if blacklisted
if (userBlacklisted) {
retur... | function claimable(address _user, address _gauge, address _token) external view returns (uint _amount) {
_amount = 0;
bool userBlacklisted = isBlacklisted(_user) || isBlacklistedGaugeAddress(_gauge, _user);
// user can't claim if blacklisted
if (userBlacklisted) {
retur... | 64,401 |
19 | // as funding rates are maxed out at 2.5% of RM, the return must max out at 97.5% of RM so that required margins cover all potential payment scenarios/ | assetReturnsNew[i] = bound(assetReturnsNew[i], cap);
| assetReturnsNew[i] = bound(assetReturnsNew[i], cap);
| 30,128 |
22 | // Loads the gauge list for better performance | address[] memory _gauges = gauges;
| address[] memory _gauges = gauges;
| 75,501 |
128 | // calculate half and full time match result | if(_homeGoals > _awayGoals){
fullMatchResult = 1;
if(_halfHomeGoals > _halfAwayGoals){
halfAndFullResult = 1;
}else if(_halfHomeGoals == _halfAwayGoals){
| if(_homeGoals > _awayGoals){
fullMatchResult = 1;
if(_halfHomeGoals > _halfAwayGoals){
halfAndFullResult = 1;
}else if(_halfHomeGoals == _halfAwayGoals){
| 34,679 |
30 | // Calculates the sum of values already filled and cancelled for a given order./orderHash The Keccak-256 hash of the given order./ return Sum of values already filled and cancelled. | function getUnavailableTakerTokenAmount(bytes32 orderHash)
public
constant
returns (uint)
| function getUnavailableTakerTokenAmount(bytes32 orderHash)
public
constant
returns (uint)
| 33,509 |
40 | // Verify offchain order hasn&39;t expired. | require(now < amountPremium_expiration[1]);
bytes32 optionHash = getOptionHash(assetLocked_assetTraded_firstMaker, amountLocked_amountTraded_maturation);
| require(now < amountPremium_expiration[1]);
bytes32 optionHash = getOptionHash(assetLocked_assetTraded_firstMaker, amountLocked_amountTraded_maturation);
| 11,794 |
199 | // modifier to check if the sender is the partialPauser address / | modifier onlyPartialPauser {
require(msg.sender == partialPauser, "C2");
_;
}
| modifier onlyPartialPauser {
require(msg.sender == partialPauser, "C2");
_;
}
| 6,661 |
73 | // When only tokens received, msg.value must be 0 | require(msg.value == 0, "msg.value must be 0 when receiving tokens");
IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
| require(msg.value == 0, "msg.value must be 0 when receiving tokens");
IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
| 28,239 |
103 | // Settles the balance between the two parties. Note that arguments/ order counts: `participant1_transferred_amount +/ participant1_locked_amount` <= `participant2_transferred_amount +/ participant2_locked_amount`/channel_identifier Identifier for the channel on which this/ operation takes place/participant1 Channel pa... | function settleChannel(
uint256 channel_identifier,
address participant1,
uint256 participant1_transferred_amount,
uint256 participant1_locked_amount,
bytes32 participant1_locksroot,
address participant2,
uint256 participant2_transferred_amount,
uint25... | function settleChannel(
uint256 channel_identifier,
address participant1,
uint256 participant1_transferred_amount,
uint256 participant1_locked_amount,
bytes32 participant1_locksroot,
address participant2,
uint256 participant2_transferred_amount,
uint25... | 26,281 |
130 | // Returns owner of a given Asset(Token)./_tokenId Token ID to get owner./Required for ERC-721 compliance. | function ownerOf(uint256 _tokenId)
external
view
returns (address owner)
| function ownerOf(uint256 _tokenId)
external
view
returns (address owner)
| 6,926 |
10 | // `owner` can step down and assign some other address to this role/_newOwner The address of the new owner. | function changeOwnership(address _newOwner) onlyOwner {
require(_newOwner != 0x0);
address oldOwner = owner;
owner = _newOwner;
newOwnerCandidate = 0x0;
OwnershipTransferred(oldOwner, owner);
}
| function changeOwnership(address _newOwner) onlyOwner {
require(_newOwner != 0x0);
address oldOwner = owner;
owner = _newOwner;
newOwnerCandidate = 0x0;
OwnershipTransferred(oldOwner, owner);
}
| 47,478 |
5 | // require that the caller is an admin | require(ui.fnIsAdmin(msg.sender), "Only admins can do this"); _;
| require(ui.fnIsAdmin(msg.sender), "Only admins can do this"); _;
| 15,439 |
176 | // ForeignAMBErc677ToErc677Foreign side implementation for erc677-to-erc677 mediator intended to work on top of AMB bridge. It is designed to be used as an implementation contract of EternalStorageProxy contract./ | contract ForeignAMBErc677ToErc677 is BasicAMBErc677ToErc677, MediatorBalanceStorage {
using SafeERC20 for ERC677;
/**
* @dev Executes action on the request to withdraw tokens relayed from the other network
* @param _recipient address of tokens receiver
* @param _value amount of bridged tokens
... | contract ForeignAMBErc677ToErc677 is BasicAMBErc677ToErc677, MediatorBalanceStorage {
using SafeERC20 for ERC677;
/**
* @dev Executes action on the request to withdraw tokens relayed from the other network
* @param _recipient address of tokens receiver
* @param _value amount of bridged tokens
... | 42,581 |
15 | // This is the interface that {BeaconProxy} expects of its beacon./ Must return an address that can be used as a delegate call target. {BeaconProxy} will check that this address is a contract. / | function childImplementation() external view returns (address);
function upgradeChildTo(address newImplementation) external;
| function childImplementation() external view returns (address);
function upgradeChildTo(address newImplementation) external;
| 9,552 |
2 | // withdraws an ERC-20 token that accidentally ended up on this contract and cannot be used in any way. Can only be called by the current owner. token - a number of tokens to withdraw from this contract. amount - a number of tokens to withdraw from this contract. receiver - a wallet that will receive withdrawing tokens... | function rescueERC20Token(
address token,
uint256 amount,
address receiver
) external;
| function rescueERC20Token(
address token,
uint256 amount,
address receiver
) external;
| 36,043 |
110 | // transfer(_burnAddress,amount.div(2)); | _tTotal = _tTotal.sub(amount);
| _tTotal = _tTotal.sub(amount);
| 3,726 |
51 | // Initializer function (replaces constructor) | function initialize(address _sqrlAddress, uint256 _lastRewardBalance) public initializer {
OwnableUpgradeSafe.__Ownable_init();
sqrl = IERC20(_sqrlAddress);
sqrlAddress = _sqrlAddress;
lastRewardBalance = _lastRewardBalance;
}
| function initialize(address _sqrlAddress, uint256 _lastRewardBalance) public initializer {
OwnableUpgradeSafe.__Ownable_init();
sqrl = IERC20(_sqrlAddress);
sqrlAddress = _sqrlAddress;
lastRewardBalance = _lastRewardBalance;
}
| 23,866 |
175 | // Return reward multiplier over the given "from" to "to" block. from block to start calculating reward to block to finish calculating rewardreturn the multiplier for the period / | function _getMultiplier(uint256 from, uint256 to) internal view returns (uint256) {
if (to <= endBlock) {
return to - from;
} else if (from >= endBlock) {
return 0;
} else {
return endBlock - from;
}
}
| function _getMultiplier(uint256 from, uint256 to) internal view returns (uint256) {
if (to <= endBlock) {
return to - from;
} else if (from >= endBlock) {
return 0;
} else {
return endBlock - from;
}
}
| 65,483 |
66 | // Returns whether or not a user is blacklisted. _who The address of the account in question.return `true` if the user is blacklisted, `false` otherwise. / | function isBlacklistedUser(address _who) public view returns (bool) {
return (!hasUserPermission(_who, BURN_SIG) && hasUserPermission(_who, BLACKLISTED_SIG));
}
| function isBlacklistedUser(address _who) public view returns (bool) {
return (!hasUserPermission(_who, BURN_SIG) && hasUserPermission(_who, BLACKLISTED_SIG));
}
| 33,314 |
9 | // Transfer fee to relayer. | if (useFeeToken()) {
require(
OVM_FeeToken(Lib_PredeployAddresses.OVM_FEETOKEN).transfer(
Lib_PredeployAddresses.SEQUENCER_FEE_WALLET,
SafeMath.mul(_transaction.gasLimit, _transaction.gasPrice)
),
"Fee was not tr... | if (useFeeToken()) {
require(
OVM_FeeToken(Lib_PredeployAddresses.OVM_FEETOKEN).transfer(
Lib_PredeployAddresses.SEQUENCER_FEE_WALLET,
SafeMath.mul(_transaction.gasLimit, _transaction.gasPrice)
),
"Fee was not tr... | 40,924 |
17 | // Used when multiple can call./ | modifier onlyModules(bytes32 _moduleOne, bytes32 _moduleTwo) {
string memory message = string(abi.encodePacked("only module ", _moduleOne.toString()," or ", _moduleTwo.toString()," can call this function"));
require(msg.sender == getModule(_moduleOne) || msg.sender == getModule(_moduleTwo), message)... | modifier onlyModules(bytes32 _moduleOne, bytes32 _moduleTwo) {
string memory message = string(abi.encodePacked("only module ", _moduleOne.toString()," or ", _moduleTwo.toString()," can call this function"));
require(msg.sender == getModule(_moduleOne) || msg.sender == getModule(_moduleTwo), message)... | 26,703 |
1 | // bytes32 public constant emittedAgainSig = 0xc76416badc8398ce17c93eab7b4f60f263241694cf503e4df24f233a8cc1c50d; keccak256(LogEmittedAgain(uint256,uint256,address)) | bytes32 public immutable emittedAgainSig = LogEmittedAgain.selector;
mapping(uint256 => uint256) public lastTopUpBlocks;
mapping(uint256 => uint256) public intervals;
mapping(uint256 => uint256) public previousPerformBlocks;
mapping(uint256 => uint256) public firstPerformBlocks;
mapping(uint256 => uint256)... | bytes32 public immutable emittedAgainSig = LogEmittedAgain.selector;
mapping(uint256 => uint256) public lastTopUpBlocks;
mapping(uint256 => uint256) public intervals;
mapping(uint256 => uint256) public previousPerformBlocks;
mapping(uint256 => uint256) public firstPerformBlocks;
mapping(uint256 => uint256)... | 19,032 |
149 | // ----------ADMINISTRATOR ONLY FUNCTIONS----------//whitelist Admins admin only / |
function adminWhitelistAdministrator(address _identifier, bool _status)
public
onlyAdministrator(msg.sender)
|
function adminWhitelistAdministrator(address _identifier, bool _status)
public
onlyAdministrator(msg.sender)
| 47,796 |
25 | // Stores excluded recipients who will not be effected by token unlocking. | mapping(address => bool) internal excludedFromTokenUnlock;
| mapping(address => bool) internal excludedFromTokenUnlock;
| 44,229 |
14 | // should we make this just "balanceOf" to make it ERC20 compliant | uint256 _bal =
ERC20Interface(_fellowship.tellor()).balanceOfAt(
msg.sender,
voteBreakdown[_id].startBlock
);
voteBreakdown[_id].TRBCount += _bal;
if (_supports) {
voteBreakdown[_id].payeeTally += _fellowship.payments(msg.sender... | uint256 _bal =
ERC20Interface(_fellowship.tellor()).balanceOfAt(
msg.sender,
voteBreakdown[_id].startBlock
);
voteBreakdown[_id].TRBCount += _bal;
if (_supports) {
voteBreakdown[_id].payeeTally += _fellowship.payments(msg.sender... | 55,596 |
333 | // triggered when a pool token is created / | event PoolTokenCreated(IPoolToken indexed poolToken, Token indexed token);
| event PoolTokenCreated(IPoolToken indexed poolToken, Token indexed token);
| 18,409 |
1 | // Synthetix is mocked with an ERC20 token passed via the constructor. | function synthetixERC20() internal view returns (IERC20) {
return mockSynthetixToken;
}
| function synthetixERC20() internal view returns (IERC20) {
return mockSynthetixToken;
}
| 28,603 |
72 | // return a hound / | function selectHound() private returns(HunterHoundTraits memory hh) {
hh.isHunter = false;
hh.metadataId = totalHoundMinted;
totalHoundMinted = totalHoundMinted + 1;
}
| function selectHound() private returns(HunterHoundTraits memory hh) {
hh.isHunter = false;
hh.metadataId = totalHoundMinted;
totalHoundMinted = totalHoundMinted + 1;
}
| 41,214 |
37 | // Returns an address array of all the addresses in this list/Contains a for loop, so complexity is O(n) wrt the list size/self The Mapping struct that this function is attached to/ return An array of all the addresses | function addressArray(Mapping storage self) internal view returns (address[] memory) {
address[] memory array = new address[](self.count);
uint256 count;
address currentAddress = self.addressMap[SENTINEL];
while (currentAddress != address(0) && currentAddress != SENTINEL) {
array[count] = curren... | function addressArray(Mapping storage self) internal view returns (address[] memory) {
address[] memory array = new address[](self.count);
uint256 count;
address currentAddress = self.addressMap[SENTINEL];
while (currentAddress != address(0) && currentAddress != SENTINEL) {
array[count] = curren... | 21,899 |
10 | // token = IERC20(_token); | token = _token;
| token = _token;
| 16,534 |
30 | // Returns the confirmation status of a transaction./transactionId Transaction ID./ return Confirmation status. | function isConfirmed(uint transactionId)
public
constant
returns (bool)
| function isConfirmed(uint transactionId)
public
constant
returns (bool)
| 14,640 |
14 | // Only Token Creator Functions / Intentionally virtual to allow for extensions on the terms of creating tokens | function _create(
uint256 _numberToCreate
)
internal virtual
| function _create(
uint256 _numberToCreate
)
internal virtual
| 27,257 |
18 | // Current number of votes in opposition to this proposal | uint againstVotes;
| uint againstVotes;
| 6,803 |
49 | // div with the difference of decimals AFTER the current rate computation (for more precision) | if (decimalsAggregator < decimalsInput) {
rate = rate.div(10**(decimalsInput-decimalsAggregator));
}
| if (decimalsAggregator < decimalsInput) {
rate = rate.div(10**(decimalsInput-decimalsAggregator));
}
| 60,285 |
345 | // 1e18 | uint256 constant RAY = 1e27;
uint256 constant WAD = 1e18;
| uint256 constant RAY = 1e27;
uint256 constant WAD = 1e18;
| 28,761 |
135 | // Format and send transfer message to a remote chain._transferId Unique identifier for the transfer. _destination The destination domain. _connextion The connext instance on the destination domain. _canonical The canonical token ID/domain info. _local The local token address. _amount The token amount. _isCanonical Whe... | function _sendMessage(
bytes32 _transferId,
uint32 _destination,
bytes32 _connextion,
TokenId memory _canonical,
address _local,
uint256 _amount,
bool _isCanonical
| function _sendMessage(
bytes32 _transferId,
uint32 _destination,
bytes32 _connextion,
TokenId memory _canonical,
address _local,
uint256 _amount,
bool _isCanonical
| 14,098 |
29 | // Initializing a variable to '<<' value | uint16 leftshift = a << b;
| uint16 leftshift = a << b;
| 29,709 |
207 | // Set the number of exactly the same reports needed to finalize the epoch to `_quorum` / | function setQuorum(uint256 _quorum) external;
| function setQuorum(uint256 _quorum) external;
| 32,478 |
64 | // Lock team tokens - 12M | uint256 teamTokens = 12000000 * 10**uint256(decimals);
totalSupply = totalSupply.add(teamTokens);
| uint256 teamTokens = 12000000 * 10**uint256(decimals);
totalSupply = totalSupply.add(teamTokens);
| 42,319 |
195 | // Get the bonus tokens for a stage _amount the amount of tokensreturn Number of wei-ESCBCoin with bonus for 1 wei | function priceForStage(uint256 _amount)
internal
| function priceForStage(uint256 _amount)
internal
| 44,029 |
23 | // Make sure locations were visited in order | require(hunters[msg.sender][i].block > lastBlock);
lastBlock = hunters[msg.sender][i].block;
| require(hunters[msg.sender][i].block > lastBlock);
lastBlock = hunters[msg.sender][i].block;
| 45,789 |
68 | // Deduct count from possible codes | left -= h.counts[len];
| left -= h.counts[len];
| 9,239 |
124 | // Set blacklisted status for the account. account address to set blacklist flag for _isBlacklisted blacklist flag value Requirements: - `msg.sender` should be owner. / | function setBlacklisted(address account, bool _isBlacklisted) external onlyOwner {
require(uint256(account) >= REDEMPTION_ADDRESS_COUNT, "TrueCurrency: blacklisting of redemption address is not allowed");
isBlacklisted[account] = _isBlacklisted;
emit Blacklisted(account, _isBlacklisted);
... | function setBlacklisted(address account, bool _isBlacklisted) external onlyOwner {
require(uint256(account) >= REDEMPTION_ADDRESS_COUNT, "TrueCurrency: blacklisting of redemption address is not allowed");
isBlacklisted[account] = _isBlacklisted;
emit Blacklisted(account, _isBlacklisted);
... | 25,280 |
0 | // enum application_status {applied, approved, rejected, funded, repayment, cleared} | address payable owner;
constructor(){
owner = msg.sender;
}
| address payable owner;
constructor(){
owner = msg.sender;
}
| 11,048 |
372 | // if in deficit we repay amount and then withdraw | if (deficit) {
cToken.repayBorrow(amount);
| if (deficit) {
cToken.repayBorrow(amount);
| 47,278 |
126 | // user functions | function getUserNumLockedTokens (address _user) external view returns (uint256) {
UserInfo storage user = users[_user];
return user.lockedTokens.length();
}
| function getUserNumLockedTokens (address _user) external view returns (uint256) {
UserInfo storage user = users[_user];
return user.lockedTokens.length();
}
| 25,398 |
53 | // Settles the current auction | function _settleAuction() private {
// Get a copy of the current auction
Auction memory _auction = auction;
// Ensure the auction wasn't already settled
if (auction.settled) revert AUCTION_SETTLED();
// Ensure the auction had started
if (_auction.startTime == 0) rev... | function _settleAuction() private {
// Get a copy of the current auction
Auction memory _auction = auction;
// Ensure the auction wasn't already settled
if (auction.settled) revert AUCTION_SETTLED();
// Ensure the auction had started
if (_auction.startTime == 0) rev... | 14,375 |
1 | // Storage IDs for feature storage buckets./ WARNING: APPEND-ONLY. | enum StorageId {
Proxy,
SimpleFunctionRegistry,
Ownable,
TokenSpender,
TransformERC20,
MetaTransactions,
ReentrancyGuard,
NativeOrders,
OtcOrders,
ERC721Orders,
ERC1155Orders
}
| enum StorageId {
Proxy,
SimpleFunctionRegistry,
Ownable,
TokenSpender,
TransformERC20,
MetaTransactions,
ReentrancyGuard,
NativeOrders,
OtcOrders,
ERC721Orders,
ERC1155Orders
}
| 24,580 |
40 | // Deposit LP tokens to MasterGamer for HON allocation. | function deposit(uint256 _pid, uint256 _amount) external validatePoolByPid(_pid) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = ((user.amount.mul(pool.accHonPerShare)).div(1e12)).sub(user.re... | function deposit(uint256 _pid, uint256 _amount) external validatePoolByPid(_pid) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
updatePool(_pid);
if (user.amount > 0) {
uint256 pending = ((user.amount.mul(pool.accHonPerShare)).div(1e12)).sub(user.re... | 27,405 |
11 | // function permitMinterRole(bytes32 signerHash,bytes memory signature)external | //{
//
//}
| //{
//
//}
| 42,258 |
27 | // safe to store timestamp | uint32 lastMintedTimestamp;
| uint32 lastMintedTimestamp;
| 78,350 |
107 | // Tells the contract that the buyer doesn't deserve dividends for the tokens before they owned them;really i know you think you do but you don't | int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens) - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
| int256 _updatedPayouts = (int256) ((profitPerShare_ * _amountOfTokens) - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
| 9,760 |
75 | // Return target(numerator / denominator), but rounded up. / | function getPartialRoundUp(
uint256 target,
uint256 numerator,
uint256 denominator
)
internal
pure
returns (uint256)
| function getPartialRoundUp(
uint256 target,
uint256 numerator,
uint256 denominator
)
internal
pure
returns (uint256)
| 6,830 |
37 | // Always charge management fee regardless of whether the vault is making a profit from the previous options sale | _managementFeeInAsset = managementFeePercent > 0
? lockedBalanceSansPending.mul(managementFeePercent).div(
100 * Vault.FEE_MULTIPLIER
)
: 0;
return _managementFeeInAsset;
| _managementFeeInAsset = managementFeePercent > 0
? lockedBalanceSansPending.mul(managementFeePercent).div(
100 * Vault.FEE_MULTIPLIER
)
: 0;
return _managementFeeInAsset;
| 26,750 |
141 | // fetches a document's uridocumentIndex uint256 return uint256, string, uint256 / | function getDocument(uint256 documentIndex) external view
| function getDocument(uint256 documentIndex) external view
| 27,508 |
10 | // Canonical Uniswap V3 factory/Deploys Uniswap V3 pools and manages ownership and control over pool protocol fees | contract UniswapV3Factory is IUniswapV3Factory, UniswapV3PoolDeployer, NoDelegateCall {
/// @inheritdoc IUniswapV3Factory
address public override owner;
/// @inheritdoc IUniswapV3Factory
mapping(uint24 => int24) public override feeAmountTickSpacing;
/// @inheritdoc IUniswapV3Factory
mapping(add... | contract UniswapV3Factory is IUniswapV3Factory, UniswapV3PoolDeployer, NoDelegateCall {
/// @inheritdoc IUniswapV3Factory
address public override owner;
/// @inheritdoc IUniswapV3Factory
mapping(uint24 => int24) public override feeAmountTickSpacing;
/// @inheritdoc IUniswapV3Factory
mapping(add... | 24,896 |
14 | // Optionally implemented function to show the number of decimals for the token | function decimals() external view returns (uint8 decimals);
| function decimals() external view returns (uint8 decimals);
| 14,801 |
74 | // When minting tokens | require(
totalSupply().add(amount) <= _cap,
"ERC20Capped: cap exceeded"
);
| require(
totalSupply().add(amount) <= _cap,
"ERC20Capped: cap exceeded"
);
| 7,039 |
63 | // make sure _borrower is liquidatable | (, , uint256 shortfall) = comptroller.getAccountLiquidity(_borrower);
require(shortfall > 0, "!liquidatable");
address[] memory path = _getDolaPath(_flashLoanToken);
uint256 tokensNeeded;
{
| (, , uint256 shortfall) = comptroller.getAccountLiquidity(_borrower);
require(shortfall > 0, "!liquidatable");
address[] memory path = _getDolaPath(_flashLoanToken);
uint256 tokensNeeded;
{
| 61,639 |
5 | // Emitted when a node address is linked to a validator. / | event NodeAddressWasAdded(
| event NodeAddressWasAdded(
| 27,129 |
46 | // This is the main function implementing IPayoutCalculator | function calculatePayout(bytes32 _info, uint _duration) returns (uint) {
uint8 unpaid = unpaidPercentage(_info);
CalculatePayout(_info, _duration, hourlyRate, unpaid);
uint fullTimeOutput = _duration * hourlyRate / 3600;
return (fullTimeOutput * (100 - unpaid)) / 100;
}
| function calculatePayout(bytes32 _info, uint _duration) returns (uint) {
uint8 unpaid = unpaidPercentage(_info);
CalculatePayout(_info, _duration, hourlyRate, unpaid);
uint fullTimeOutput = _duration * hourlyRate / 3600;
return (fullTimeOutput * (100 - unpaid)) / 100;
}
| 32,082 |
34 | // Assign tokens to investor with locking period | function assignToken(address _investor,uint256 _tokens) external {
// Tokens assigned by only Angel Sales And PE Sales wallets
require(msg.sender == walletAddresses[0] || msg.sender == walletAddresses[1]);
// Check investor address and tokens.Not allow 0 value
require(_investor != a... | function assignToken(address _investor,uint256 _tokens) external {
// Tokens assigned by only Angel Sales And PE Sales wallets
require(msg.sender == walletAddresses[0] || msg.sender == walletAddresses[1]);
// Check investor address and tokens.Not allow 0 value
require(_investor != a... | 81,594 |
119 | // returns pool rewards for a specific pool and reserve / | function _poolRewards(IDSToken poolToken, IReserveToken reserveToken) private view returns (PoolRewards memory) {
PoolRewards memory data;
(data.lastUpdateTime, data.rewardPerToken, data.totalClaimedRewards) = _store.poolRewards(
poolToken,
reserveToken
);
re... | function _poolRewards(IDSToken poolToken, IReserveToken reserveToken) private view returns (PoolRewards memory) {
PoolRewards memory data;
(data.lastUpdateTime, data.rewardPerToken, data.totalClaimedRewards) = _store.poolRewards(
poolToken,
reserveToken
);
re... | 48,889 |
190 | // function requestMint(uint256 vaultId, uint256[] memory nftIds) public payable virtual nonReentrant | // {
// onlyOwnerIfPaused(1);
// require(store.allowMintRequests(vaultId), "1");
// for (uint256 i = 0; i < nftIds.length; i = i.add(1)) {
// if (vaultId > 6 && vaultId < 10) {
// KittyCoreAlt kittyCoreAlt =
// KittyCoreAlt(store.nftAddress(vau... | // {
// onlyOwnerIfPaused(1);
// require(store.allowMintRequests(vaultId), "1");
// for (uint256 i = 0; i < nftIds.length; i = i.add(1)) {
// if (vaultId > 6 && vaultId < 10) {
// KittyCoreAlt kittyCoreAlt =
// KittyCoreAlt(store.nftAddress(vau... | 43,300 |
16 | // Change current governor/_newGovernor Address of the new governor | function changeGovernor(address _newGovernor) external {
require(_newGovernor != address(0), "1n");
requireGovernor(msg.sender);
if (networkGovernor != _newGovernor) {
networkGovernor = _newGovernor;
emit NewGovernor(_newGovernor);
}
| function changeGovernor(address _newGovernor) external {
require(_newGovernor != address(0), "1n");
requireGovernor(msg.sender);
if (networkGovernor != _newGovernor) {
networkGovernor = _newGovernor;
emit NewGovernor(_newGovernor);
}
| 28,836 |
1,037 | // Revert with an error when attempting to set a new potential owner that is already set. / | error NewPotentialOwnerAlreadySet(address conduit, address newPotentialOwner);
| error NewPotentialOwnerAlreadySet(address conduit, address newPotentialOwner);
| 23,893 |
29 | // No rewards during unstaking period | if (userInfo.unstaking) {
return (rewardAmount, iftBonusAmount, iftPoolRewardAmount);
}
| if (userInfo.unstaking) {
return (rewardAmount, iftBonusAmount, iftPoolRewardAmount);
}
| 21,899 |
93 | // with rounding of last digit | uint _quotient = ((_numerator / denominator) + 5) / 10;
return _quotient;
| uint _quotient = ((_numerator / denominator) + 5) / 10;
return _quotient;
| 50,753 |
456 | // trade source tokens to BNT (while accepting any return amount) | TradeResult memory targetHop1 = _tradeBNT(
contextId,
tokens.sourceToken,
false,
| TradeResult memory targetHop1 = _tradeBNT(
contextId,
tokens.sourceToken,
false,
| 56,420 |
8 | // Set the base URI baseURI_ (string calldata) base URI / | function setBaseURI(string calldata baseURI_) external onlyOwner {
_setBaseURI(baseURI_);
}
| function setBaseURI(string calldata baseURI_) external onlyOwner {
_setBaseURI(baseURI_);
}
| 39,302 |
2 | // Sequencer-Inbox state accumulator | bytes32[] public override inboxAccs;
| bytes32[] public override inboxAccs;
| 67,222 |
50 | // Returns true if the given player does not need to be unlocked to claim their bonus.This is true when they were the last player to click EtherButton in the previous round.That player deserves freebies for losing. So, they get their bonus unlocked early. / | function getIsBonusUnlockExempt(uint roundId, address player) public view returns (bool) {
return Rounds[roundId].activePlayer == player;
}
| function getIsBonusUnlockExempt(uint roundId, address player) public view returns (bool) {
return Rounds[roundId].activePlayer == player;
}
| 38,649 |
5 | // This function indicates if the policy of the given contract address is violated or not.If the given contract address is not being monitored by the trusted oracle in this policy,then this function will always return false even if the policy is violated. It is the responsibilityof the pool owner to make sure that this... | function isViolated(address _contractAddress) external view returns(bool) {
return policyViolated[_contractAddress];
}
| function isViolated(address _contractAddress) external view returns(bool) {
return policyViolated[_contractAddress];
}
| 40,370 |
37 | // Function to set the lateInterestPremium during a refinance.lateInterestPremium_ The new value for lateInterestPremium. / | function setLateInterestPremium(uint256 lateInterestPremium_) external;
| function setLateInterestPremium(uint256 lateInterestPremium_) external;
| 42,452 |
53 | // set crowdsale token | crowdSaleToken = ERC20Token(_tokenAddress);
| crowdSaleToken = ERC20Token(_tokenAddress);
| 23,384 |
19 | // Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),Reverts with custom message when dividing by zero. Counterpart to Solidity's `%` operator. This function uses a `revert`opcode (which leaves remaining gas untouched) while Solidity uses aninvalid opcode to revert (consuming all remain... | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
| function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
| 7,292 |
23 | // Returns URI for the token. | function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
require(_exists(_tokenId), "RT: invalid token");
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI,_tokenId.toString()))
: "";
}
| function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
require(_exists(_tokenId), "RT: invalid token");
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI,_tokenId.toString()))
: "";
}
| 28,126 |
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);
| 4,367 |
4 | // Brendan Asselstine Provides basic fixed point math calculations. This library calculates integer fractions by scaling values by 1e18 then performing standard integer math. / | library FixedPoint {
using OpenZeppelinSafeMath_V3_3_0 for uint256;
// The scale to use for fixed point numbers. Same as Ether for simplicity.
uint256 internal constant SCALE = 1e18;
/**
* Calculates a Fixed18 mantissa given the numerator and denominator
*
* The mantissa = (nu... | library FixedPoint {
using OpenZeppelinSafeMath_V3_3_0 for uint256;
// The scale to use for fixed point numbers. Same as Ether for simplicity.
uint256 internal constant SCALE = 1e18;
/**
* Calculates a Fixed18 mantissa given the numerator and denominator
*
* The mantissa = (nu... | 47,583 |
7 | // set usdc address | function setUSDCAddress(address _usdcAddress) external onlyOwner {
usdcAddress = _usdcAddress;
}
| function setUSDCAddress(address _usdcAddress) external onlyOwner {
usdcAddress = _usdcAddress;
}
| 17,961 |
91 | // Function to create a new Group for the user _groupName describes the name of the group / | function createGroup(string memory _groupName)
| function createGroup(string memory _groupName)
| 57,610 |
268 | // internal owner | }
| }
| 28,290 |
34 | // x is now in the range (-42, 136)1e18. Convert to (-42, 136)296 for more intermediate precision and a binary basis. This base conversion is a multiplication by 1e18 / 296 = 518 / 278. | x = (x << 78) / 5**18;
| x = (x << 78) / 5**18;
| 21,866 |
374 | // ... defined by owner of dpass token | mapping(address => bool) redeemFeeToken; // tokens allowed to pay redeem fee with
TrustedFeeCalculator public fca; // fee calculator contract
address payable public liq; // contract providing DPT liquidity to pay for fee
address payable ... | mapping(address => bool) redeemFeeToken; // tokens allowed to pay redeem fee with
TrustedFeeCalculator public fca; // fee calculator contract
address payable public liq; // contract providing DPT liquidity to pay for fee
address payable ... | 26,901 |
177 | // Calculate the index of the last item in the array | uint256 userIndex = _stakeholders.length - 1;
| uint256 userIndex = _stakeholders.length - 1;
| 24,369 |
173 | // Price of each Miss | uint256 private _price = 0.04 ether;
| uint256 private _price = 0.04 ether;
| 61,654 |
21 | // Emitted every time `bridge` is called / | event Bridge(
| event Bridge(
| 32,176 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.