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 |
|---|---|---|---|---|
100 | // Get the referrer address that referred the user. / | function getReferrer(address user) external view returns (address);
| function getReferrer(address user) external view returns (address);
| 23,817 |
301 | // Rolls the vault's funds into a new short position. / | function rollToNextOption() external onlyManager nonReentrant {
require(
block.timestamp >= nextOptionReadyAt,
"Cannot roll before delay"
);
address newOption = nextOption;
require(newOption != address(0), "No found option");
currentOption = newOptio... | function rollToNextOption() external onlyManager nonReentrant {
require(
block.timestamp >= nextOptionReadyAt,
"Cannot roll before delay"
);
address newOption = nextOption;
require(newOption != address(0), "No found option");
currentOption = newOptio... | 21,485 |
9 | // Stores the total count of assets managed by this registry / | uint256 internal _count;
| uint256 internal _count;
| 29,328 |
123 | // Withdraw LP tokens from farm. | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.acctkfPerShare... | function withdraw(uint256 _pid, uint256 _amount) public {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.amount >= _amount, "withdraw: not good");
updatePool(_pid);
uint256 pending = user.amount.mul(pool.acctkfPerShare... | 57,308 |
25 | // Sets the distributorSurfReward. Must be between 0 and 100 | function setDistributorSurfReward(uint256 _distributorSurfReward) external onlyOwner {
require(_distributorSurfReward >= 0 && _distributorSurfReward <= 100e18, "Out of range");
distributorSurfReward = _distributorSurfReward;
}
| function setDistributorSurfReward(uint256 _distributorSurfReward) external onlyOwner {
require(_distributorSurfReward >= 0 && _distributorSurfReward <= 100e18, "Out of range");
distributorSurfReward = _distributorSurfReward;
}
| 32,659 |
104 | // If not burned. | if (packed & _BITMASK_BURNED == 0) {
| if (packed & _BITMASK_BURNED == 0) {
| 41,810 |
17 | // See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is notrequired by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowanceis the maximum `uint256`. Requirements: - `from` and `to` cannot be the zero address.- `from` mu... | function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
| function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
| 14,989 |
219 | // Checks that _msgSender is the quest Manager / | modifier onlyQuestManager() {
require(_msgSender() == address(questManager), "Not verified");
_;
}
| modifier onlyQuestManager() {
require(_msgSender() == address(questManager), "Not verified");
_;
}
| 23,777 |
5 | // The registry ID of the exchange contract with permission to mint and burn this token. Unique per StableToken instance. solhint-disable-next-line state-visibility | bytes32 exchangeRegistryId;
| bytes32 exchangeRegistryId;
| 25,827 |
5 | // If the user doesn't have variable debt, no need to try to burn variable debt tokens | if (vars.userVariableDebt > 0) {
IVariableDebtToken(debtReserve.variableDebtTokenAddress).burn(
user,
vars.userVariableDebt,
debtReserve.variableBorrowIndex
);
}
| if (vars.userVariableDebt > 0) {
IVariableDebtToken(debtReserve.variableDebtTokenAddress).burn(
user,
vars.userVariableDebt,
debtReserve.variableBorrowIndex
);
}
| 53,240 |
82 | // See {transferCreativeLicense}. / | function _transferCreativeLicense(
address from,
address to,
uint256 tokenId
) internal virtual {
address creativeOwner = ERC1190.creativeOwnerOf(tokenId);
require(
creativeOwner == from,
"ERC1190: Cannot transfer the ownership license if it is not... | function _transferCreativeLicense(
address from,
address to,
uint256 tokenId
) internal virtual {
address creativeOwner = ERC1190.creativeOwnerOf(tokenId);
require(
creativeOwner == from,
"ERC1190: Cannot transfer the ownership license if it is not... | 37,353 |
59 | // Gets the API struct variables that are not mappings _requestId to look upreturn string of api to queryreturn string of symbol of api to queryreturn bytes32 hash of stringreturn bytes32 of the granularity(decimal places) requestedreturn uint of index in requestQ arrayreturn uint of current payout/tip for this request... | function getRequestVars(uint256 _requestId)
| function getRequestVars(uint256 _requestId)
| 41,347 |
173 | // return current block number | return block.number;
| return block.number;
| 11,207 |
366 | // Before token transfer hook to enforce that no token can be moved to another address until the pode sale has ended / | function _beforeTokenTransfer(address from, address, uint256) internal override {
if (from != address(0) && _getNow() <= podeLockTimestamp) {
revert("DigitalaxPodeNFT._beforeTokenTransfer: Transfers are currently locked at this time");
}
}
| function _beforeTokenTransfer(address from, address, uint256) internal override {
if (from != address(0) && _getNow() <= podeLockTimestamp) {
revert("DigitalaxPodeNFT._beforeTokenTransfer: Transfers are currently locked at this time");
}
}
| 40,837 |
139 | // CsaToken with Governance. | contract CsaToken is ERC20("CsaToken", "CSA"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
}
| contract CsaToken is ERC20("CsaToken", "CSA"), Ownable {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
}
}
| 81,965 |
15 | // Mapping from inscription Id to a hash of the nftAddress and tokenId | mapping (uint256 => bytes32) private _locationHashes;
| mapping (uint256 => bytes32) private _locationHashes;
| 235 |
24 | // 1. Harvest gains from positions | _tendGainsFromPositions();
uint256 stakedCvxCrv = cvxCrvRewardsPool.balanceOf(address(this));
if (stakedCvxCrv > 0) {
cvxCrvRewardsPool.withdraw(stakedCvxCrv, true);
}
| _tendGainsFromPositions();
uint256 stakedCvxCrv = cvxCrvRewardsPool.balanceOf(address(this));
if (stakedCvxCrv > 0) {
cvxCrvRewardsPool.withdraw(stakedCvxCrv, true);
}
| 17,612 |
65 | // oneWrite. / | contract oneWrite {
// Adds modifies that allow one function to be called only once
//Copyright (c) 2017 GenkiFS
bool written = false;
function oneWrite() {
/** @dev Constuctor, make sure written=false initally
*/
written = false;
}
modifier LockIfUnwritten() {
if (written){
_;
}
}
... | contract oneWrite {
// Adds modifies that allow one function to be called only once
//Copyright (c) 2017 GenkiFS
bool written = false;
function oneWrite() {
/** @dev Constuctor, make sure written=false initally
*/
written = false;
}
modifier LockIfUnwritten() {
if (written){
_;
}
}
... | 35,185 |
125 | // the Metadata extension. Built to optimize for lower gas during batch mints. Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..). Assumes that an owner cannot have more than 264 - 1 (max value of uint64) of supply. Assumes that the maximum token id cannot exceed 2256 - 1 (max value of uint256). ... | contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Compiler will pack this into a single 256bit word.
struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of owne... | contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Compiler will pack this into a single 256bit word.
struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of owne... | 3,401 |
156 | // contract dependencies | IExchangeWrapper public exchange;
IERC20 public perpToken;
IMinter public minter;
IInflationMonitor public inflationMonitor;
address private beneficiary;
| IExchangeWrapper public exchange;
IERC20 public perpToken;
IMinter public minter;
IInflationMonitor public inflationMonitor;
address private beneficiary;
| 7,166 |
12 | // Checks if a transfer can occur between the from/to addresses Both addresses must be whitelisted, unfrozen, and pass all compliance rule checks THROWS when the transfer should failinitiator The address initiating the transferfrom The address of the senderto The address of the receivertokens The number of tokens being... | function canTransfer(address initiator, address from, address to, uint256 tokens)
external
| function canTransfer(address initiator, address from, address to, uint256 tokens)
external
| 20,960 |
28 | // Configurable Configurable varriables of the contract / | contract Configurable {
uint256 public constant cap = 420000000000000000000000 *10**1;
uint256 public constant basePrice = 1000000000000000000000*10**1; // tokens per 1 ether
uint256 public tokensSold = 0;
uint256 public constant tokenReserve = 80000000000000000000000*10**1;
uint256 public rema... | contract Configurable {
uint256 public constant cap = 420000000000000000000000 *10**1;
uint256 public constant basePrice = 1000000000000000000000*10**1; // tokens per 1 ether
uint256 public tokensSold = 0;
uint256 public constant tokenReserve = 80000000000000000000000*10**1;
uint256 public rema... | 10,086 |
12 | // Listing identifier is keccak256 of Seller's partial transaction outpoint | bytes32 _listingID = keccak256(_partialTx.slice(7, 36));
| bytes32 _listingID = keccak256(_partialTx.slice(7, 36));
| 30,214 |
87 | // `maxBatchSize` refers to how much a minter can mint at a time.`collectionSize_` refers to how many tokens are in the collection. / | constructor(
string memory name_,
string memory symbol_,
uint256 maxBatchSize_,
uint256 collectionSize_
| constructor(
string memory name_,
string memory symbol_,
uint256 maxBatchSize_,
uint256 collectionSize_
| 12,052 |
37 | // mint using other mint functions | mintOnChainMfer(dna);
| mintOnChainMfer(dna);
| 37,723 |
140 | // Conic tokens created per second. | uint256 public conicPerSecond;
| uint256 public conicPerSecond;
| 33,842 |
4 | // v must be in the closed interval [0, 99] otherwise it outputs junk | y := numbx1(numbx1(x, div(v, 10)), mod(v, 10))
| y := numbx1(numbx1(x, div(v, 10)), mod(v, 10))
| 20,258 |
119 | // Our Token Contract | IERC20 public contractToken;
IERC20 public __usdtToken;
AggregatorV3Interface internal priceFeed;
using SafeMath for uint256;
using SafeCast for uint256;
using SafeERC20 for IERC20;
| IERC20 public contractToken;
IERC20 public __usdtToken;
AggregatorV3Interface internal priceFeed;
using SafeMath for uint256;
using SafeCast for uint256;
using SafeERC20 for IERC20;
| 27,704 |
13 | // Init StRSR | {
string memory stRSRSymbol = string(abi.encodePacked(StringLib.toLower(symbol), "RSR"));
string memory stRSRName = string(abi.encodePacked(stRSRSymbol, " Token"));
main.stRSR().init(
main,
stRSRName,
stRSRSymbol,
... | {
string memory stRSRSymbol = string(abi.encodePacked(StringLib.toLower(symbol), "RSR"));
string memory stRSRName = string(abi.encodePacked(stRSRSymbol, " Token"));
main.stRSR().init(
main,
stRSRName,
stRSRSymbol,
... | 38,579 |
27 | // Set up the member: status, name, `member since` & `inactive since`. | members_[_memberId] = Member(true, _memberName, "", uint64(now), 0);
| members_[_memberId] = Member(true, _memberName, "", uint64(now), 0);
| 83,427 |
196 | // Update the free memory pointer to allocate. | mstore(0x40, m)
| mstore(0x40, m)
| 44,314 |
15 | // usage: bytes32 h = Wallet(w).from(oneOwner).transact(to, value, data); Wallet(w).from(anotherOwner).confirm(h); | contract Wallet is multisig, multiowned, daylimit {
uint public version = 2;
// TYPES
// Transaction structure to remember details of transaction lest it need be saved for a later call.
struct Transaction {
address to;
uint value;
bytes data;
}
// METHODS
// cons... | contract Wallet is multisig, multiowned, daylimit {
uint public version = 2;
// TYPES
// Transaction structure to remember details of transaction lest it need be saved for a later call.
struct Transaction {
address to;
uint value;
bytes data;
}
// METHODS
// cons... | 35,918 |
4 | // Returns the index of the Pool's main token in the Pool tokens array (as returned by IVault.getPoolTokens). / | function getMainIndex() external view returns (uint256);
| function getMainIndex() external view returns (uint256);
| 22,022 |
22 | // Conversion rate from IX15 to ETH | struct Price { uint256 numerator; uint256 denominator; }
Price public currentPrice;
// The amount of time that the secondary wallet must wait between price updates
uint256 public priceUpdateInterval = 1 hours;
mapping (uint256 => Price) public priceHistory;
uint256 public currentPriceHistoryI... | struct Price { uint256 numerator; uint256 denominator; }
Price public currentPrice;
// The amount of time that the secondary wallet must wait between price updates
uint256 public priceUpdateInterval = 1 hours;
mapping (uint256 => Price) public priceHistory;
uint256 public currentPriceHistoryI... | 37,996 |
190 | // now add to yearn | yvToken.deposit();
lastInvest = block.timestamp;
| yvToken.deposit();
lastInvest = block.timestamp;
| 46,213 |
99 | // transfer token last, to follow CEI pattern | stakeToken.safeTransferFrom(msg.sender, address(this), amount);
| stakeToken.safeTransferFrom(msg.sender, address(this), amount);
| 12,798 |
14 | // Add accounts to the minter role. Restricted to admins.accounts The members to add as a member./ | function addMinters(address[] memory accounts)
public
virtual
onlyOwner
| function addMinters(address[] memory accounts)
public
virtual
onlyOwner
| 38,988 |
1 | // even if not all parameters are currently used in this implementation they help future proofing it | function onReward(
uint256 _pid,
address _user,
address _to,
uint256 _pending,
uint256 _stakedAmount,
uint256 _lpSupply
) external;
| function onReward(
uint256 _pid,
address _user,
address _to,
uint256 _pending,
uint256 _stakedAmount,
uint256 _lpSupply
) external;
| 31,986 |
13 | // Will burn sender account rendering it unusable | function burn() public {
require(BurntLedger[msg.sender] == false);
BurntLedger[msg.sender] = true;
}
| function burn() public {
require(BurntLedger[msg.sender] == false);
BurntLedger[msg.sender] = true;
}
| 3,483 |
310 | // Checks if sorbetto is initialized | bool public finalized;
| bool public finalized;
| 10,685 |
44 | // CAPITAL (CALL) Token Token representing CALL. / | contract CALLToken is MintableToken {
string public name = "CAPITAL";
string public symbol = "CALL";
uint8 public decimals = 18;
}
| contract CALLToken is MintableToken {
string public name = "CAPITAL";
string public symbol = "CALL";
uint8 public decimals = 18;
}
| 50,552 |
75 | // Generates `_amount` tokens that are assigned to `_owner`/_owner The address that will be assigned the new tokens/_amount The quantity of tokens generated/ return True if the tokens are generated correctly | function generateTokens(address _owner, uint256 _amount
| function generateTokens(address _owner, uint256 _amount
| 24,482 |
140 | // BeeBToken with Governance. | contract BeeBToken is BEP20('PancakeSwap Token', 'Cake') {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
... | contract BeeBToken is BEP20('PancakeSwap Token', 'Cake') {
/// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef).
function mint(address _to, uint256 _amount) public onlyOwner {
_mint(_to, _amount);
_moveDelegates(address(0), _delegates[_to], _amount);
}
... | 23,290 |
125 | // _loans[nftID].accuredInterestWei = outstanding(nftID) - _loans[nftID].borrowedWei; | _loans[nftID].returnedWei = _loans[nftID].borrowedWei;
| _loans[nftID].returnedWei = _loans[nftID].borrowedWei;
| 57,740 |
138 | // CozyTimeAuction / | contract CozyTimeAuction is AuctionBase {
// solhint-disable-next-line
constructor (address _pepeContract, address _affiliateContract) AuctionBase(_pepeContract, _affiliateContract) public {
}
| contract CozyTimeAuction is AuctionBase {
// solhint-disable-next-line
constructor (address _pepeContract, address _affiliateContract) AuctionBase(_pepeContract, _affiliateContract) public {
}
| 58,038 |
5 | // get delegation weight | (, , uint256 deactivatedEpoch, , uint256 amount, ,) = sfc.delegations(from, toStakerID);
if (deactivatedEpoch != 0) {
return 0;
}
| (, , uint256 deactivatedEpoch, , uint256 amount, ,) = sfc.delegations(from, toStakerID);
if (deactivatedEpoch != 0) {
return 0;
}
| 4,139 |
0 | // Usings // Enums // Status of the message state machine. / | enum MessageStatus {
Undeclared,
Declared,
Progressed,
DeclaredRevocation,
Revoked
}
| enum MessageStatus {
Undeclared,
Declared,
Progressed,
DeclaredRevocation,
Revoked
}
| 34,967 |
4 | // Returns the DAO's membership token URI / | function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
| function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
| 43,749 |
107 | // Same as a standards-compliant ERC20.approve() that never reverts (returns false).Note that this makes an external call to the token./ | function safeApprove(ERC20 _token, address _spender, uint256 _amount) internal returns (bool) {
bytes memory approveCallData = abi.encodeWithSelector(
_token.approve.selector,
_spender,
_amount
);
return invokeAndCheckSuccess(_token, approveCallData);
... | function safeApprove(ERC20 _token, address _spender, uint256 _amount) internal returns (bool) {
bytes memory approveCallData = abi.encodeWithSelector(
_token.approve.selector,
_spender,
_amount
);
return invokeAndCheckSuccess(_token, approveCallData);
... | 5,515 |
72 | // Get token price | (uint256 systemCoinPrice, bool validSysCoinPrice) = systemCoinOrcl.getResultWithValidity();
require(both(systemCoinPrice > 0, validSysCoinPrice), "DebtAuctionInitialParameterSetter/invalid-price");
| (uint256 systemCoinPrice, bool validSysCoinPrice) = systemCoinOrcl.getResultWithValidity();
require(both(systemCoinPrice > 0, validSysCoinPrice), "DebtAuctionInitialParameterSetter/invalid-price");
| 7,384 |
225 | // Converts masset amount into credits based on exchange ratem = creditsexchangeRate / | function _creditToUnderlying(uint256 _credits)
internal
view
returns (uint256 underlyingAmount)
| function _creditToUnderlying(uint256 _credits)
internal
view
returns (uint256 underlyingAmount)
| 5,401 |
66 | // get isLocked attribute of the smart contract/ | function getIsLocked() public view returns (bool) {
return isLocked;
}
| function getIsLocked() public view returns (bool) {
return isLocked;
}
| 10,830 |
380 | // Liquidity Protection Store interface / | interface ILiquidityProtectionStore is IOwned {
function withdrawTokens(
IReserveToken token,
address recipient,
uint256 amount
) external;
function protectedLiquidity(uint256 id)
external
view
returns (
address,
IDSToken,
... | interface ILiquidityProtectionStore is IOwned {
function withdrawTokens(
IReserveToken token,
address recipient,
uint256 amount
) external;
function protectedLiquidity(uint256 id)
external
view
returns (
address,
IDSToken,
... | 23,692 |
60 | // Get the current balance of the tokens / | function balanceToMaintain() external view returns(uint256) {
uint256 currentBalance = IERC20(stakeToken).balanceOf(address(this));
uint256 totalUnClaimed = totalUnClaimedTokens();
if(totalUnClaimed > currentBalance) {
return totalUnClaimed.sub(currentBalance);
} else {
... | function balanceToMaintain() external view returns(uint256) {
uint256 currentBalance = IERC20(stakeToken).balanceOf(address(this));
uint256 totalUnClaimed = totalUnClaimedTokens();
if(totalUnClaimed > currentBalance) {
return totalUnClaimed.sub(currentBalance);
} else {
... | 27,210 |
20 | // Gets the current votes balance for `account` account The address to get votes balancereturn The number of current votes for `account` / | function getCurrentVotes(address account)
external
view
returns (uint256)
| function getCurrentVotes(address account)
external
view
returns (uint256)
| 1,031 |
68 | // save in returned value the amount of weth receive to use off-chain | _balances[i] = _res[_res.length - 1];
| _balances[i] = _res[_res.length - 1];
| 67,315 |
26 | // scope to avoid stack too deep errors | (uint256 reserve0, uint256 reserve1, ) = pair.getReserves();
(uint256 reserveInput, uint256 reserveOutput) =
input == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
amountInput = IERC20(input).balanceOf(address(pair)).sub(reserveInput);
... | (uint256 reserve0, uint256 reserve1, ) = pair.getReserves();
(uint256 reserveInput, uint256 reserveOutput) =
input == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
amountInput = IERC20(input).balanceOf(address(pair)).sub(reserveInput);
... | 25,240 |
15 | // Operations are ordered from most likely usage to least likely usage. | for {} 1 {
| for {} 1 {
| 20,556 |
2 | // Check if adddress bought before | if (addressSale[msg.sender] != 0) revert AddressAlreadyBought();
| if (addressSale[msg.sender] != 0) revert AddressAlreadyBought();
| 30,023 |
2 | // Params that could be changed by Strategy or Protocol Governance./tokenLimitPerAddress Max LP token limit per address/tokenLimit Max LP token for the vault | struct StrategyParams {
uint256 tokenLimitPerAddress;
uint256 tokenLimit;
}
| struct StrategyParams {
uint256 tokenLimitPerAddress;
uint256 tokenLimit;
}
| 42,022 |
1 | // Request a reassignment of the grantee address./ Can only be called by the grantee./_newGrantee The requested new grantee. | function requestGranteeReassignment(address _newGrantee)
public
onlyGrantee
noRequestedReassignment
| function requestGranteeReassignment(address _newGrantee)
public
onlyGrantee
noRequestedReassignment
| 17,900 |
6 | // Refund user | if(_sourceAddress == address(ETH)){
msg.sender.transfer(_amount);
} else if(_needToRefund) {
| if(_sourceAddress == address(ETH)){
msg.sender.transfer(_amount);
} else if(_needToRefund) {
| 23,241 |
17 | // Lets a contract admin set the recipient for all primary sales. | function setSaleRecipientForToken(uint256 _tokenId, address _saleRecipient) external onlyRole(DEFAULT_ADMIN_ROLE) {
saleRecipient[_tokenId] = _saleRecipient;
}
| function setSaleRecipientForToken(uint256 _tokenId, address _saleRecipient) external onlyRole(DEFAULT_ADMIN_ROLE) {
saleRecipient[_tokenId] = _saleRecipient;
}
| 6,259 |
305 | // Stores the details of an order.//_prefix The miscellaneous details of the order required for/calculating the order id./_settlementID The settlement identifier./_tokens The encoding of the token pair (buy token is encoded as/the first 32 bytes and sell token is encoded as the last 32/bytes)./_price The price of the o... | function submitOrder(
bytes _prefix,
uint64 _settlementID,
uint64 _tokens,
uint256 _price,
uint256 _volume,
uint256 _minimumVolume
| function submitOrder(
bytes _prefix,
uint64 _settlementID,
uint64 _tokens,
uint256 _price,
uint256 _volume,
uint256 _minimumVolume
| 32,871 |
25 | // Adjusted tokens | uint256 adjustedTokens = (((((_tokens * PRECISION) / fromAppliedTokenCirculation) * info.totalSupply)) / PRECISION);
info.users[_from].balance -= adjustedTokens;
_transferred = adjustedTokens;
info.users[_to].balance += _transferred;
| uint256 adjustedTokens = (((((_tokens * PRECISION) / fromAppliedTokenCirculation) * info.totalSupply)) / PRECISION);
info.users[_from].balance -= adjustedTokens;
_transferred = adjustedTokens;
info.users[_to].balance += _transferred;
| 38,595 |
125 | // Community Multisig | rewardDistribution[0xF49440C1F012d041802b25A73e5B0B9166a75c02] = true;
for(uint256 i = 0; i < _rewardDistributions.length; i++) {
rewardDistribution[_rewardDistributions[i]] = true;
}
| rewardDistribution[0xF49440C1F012d041802b25A73e5B0B9166a75c02] = true;
for(uint256 i = 0; i < _rewardDistributions.length; i++) {
rewardDistribution[_rewardDistributions[i]] = true;
}
| 24,939 |
241 | // Three different options for minting Creatures (basic, premium, and gold). / | uint256 NUM_OPTIONS = 3;
uint256 SINGLE_CREATURE_OPTION = 0;
uint256 MULTIPLE_CREATURE_OPTION = 1;
uint256 NUM_CREATURES_IN_MULTIPLE_CREATURE_OPTION = 4;
| uint256 NUM_OPTIONS = 3;
uint256 SINGLE_CREATURE_OPTION = 0;
uint256 MULTIPLE_CREATURE_OPTION = 1;
uint256 NUM_CREATURES_IN_MULTIPLE_CREATURE_OPTION = 4;
| 37,620 |
9 | // Indicates if surplus funds have been redistributed for each sustainer address | mapping(address => bool) redistributed;
| mapping(address => bool) redistributed;
| 22,819 |
85 | // Mapping from NFT ID to its index in the seller tokens list. / | mapping(uint256 => uint256) public tokenToSellerIndex;
| mapping(uint256 => uint256) public tokenToSellerIndex;
| 22,175 |
839 | // Accrue ALK to the market by updating the borrow index market The market whose borrow index to update isVerified Verified / Public protocol / | function updateAlkBorrowIndex(address market, bool isVerified) public {
MarketState storage borrowState = alkBorrowState[isVerified][market];
uint256 marketSpeed = alkSpeeds[isVerified][market];
uint256 blockNumber = getBlockNumber();
uint256 deltaBlocks = sub_(blockNumber, uint256(b... | function updateAlkBorrowIndex(address market, bool isVerified) public {
MarketState storage borrowState = alkBorrowState[isVerified][market];
uint256 marketSpeed = alkSpeeds[isVerified][market];
uint256 blockNumber = getBlockNumber();
uint256 deltaBlocks = sub_(blockNumber, uint256(b... | 17,641 |
3 | // Declares the contract as willing to be an implementer of`interfaceHash` for `account`. | * See {IERC1820Registry-setInterfaceImplementer} and
* {IERC1820Registry-interfaceHash}.
*/
function _registerInterfaceForAddress(bytes32 interfaceHash, address account) internal virtual {
_supportedInterfaces[interfaceHash][account] = true;
}
| * See {IERC1820Registry-setInterfaceImplementer} and
* {IERC1820Registry-interfaceHash}.
*/
function _registerInterfaceForAddress(bytes32 interfaceHash, address account) internal virtual {
_supportedInterfaces[interfaceHash][account] = true;
}
| 30,867 |
909 | // emit in deposit or burn | event Sent(address sender, address srcNft, uint256 id, uint64 dstChid, address receiver, address dstNft);
| event Sent(address sender, address srcNft, uint256 id, uint64 dstChid, address receiver, address dstNft);
| 5,421 |
85 | // Convert x to the 192.64-bit fixed-point format. | uint256 x192x64 = (x << 64) / SCALE;
| uint256 x192x64 = (x << 64) / SCALE;
| 32,416 |
0 | // Withdraws token from Franklin to root chain in case of exodus mode. User must provide proof that he owns funds/_accountId Id of the account in the tree/_proof Proof/_tokenId Verified token id/_amount Amount for owner (must be total amount, not part of it) | function exit(uint32 _accountId, uint16 _tokenId, uint128 _amount, uint256[] calldata _proof) external nonReentrant {
bytes22 packedBalanceKey = packAddressAndTokenId(msg.sender, _tokenId);
require(exodusMode, "fet11"); // must be in exodus mode
require(!exited[_accountId][_tokenId], "fet12"... | function exit(uint32 _accountId, uint16 _tokenId, uint128 _amount, uint256[] calldata _proof) external nonReentrant {
bytes22 packedBalanceKey = packAddressAndTokenId(msg.sender, _tokenId);
require(exodusMode, "fet11"); // must be in exodus mode
require(!exited[_accountId][_tokenId], "fet12"... | 21,060 |
4 | // Used to notify listeners that a child's asset has been unequipped from one of its parent assets. tokenId ID of the token that had an asset unequipped assetId ID of the asset associated with the token we are unequipping out of slotPartId ID of the slot we are unequipping from childId ID of the token being unequipped ... | event ChildAssetUnequipped(
| event ChildAssetUnequipped(
| 13,072 |
11 | // versions: - ArbitrumValidator 0.1.0: initial release- ArbitrumValidator 0.2.0: critical Arbitrum network update- xDomain `msg.sender` backwards incompatible change (now an alias address)- new `withdrawFundsFromL2` fn that withdraws from L2 xDomain alias address- approximation of `maxSubmissionCost` using a L1 gas pr... | function typeAndVersion() external pure virtual override returns (string memory) {
return "ArbitrumValidator 1.0.0";
}
| function typeAndVersion() external pure virtual override returns (string memory) {
return "ArbitrumValidator 1.0.0";
}
| 42,872 |
149 | // Steal part of the tokens and the arbitration fee of a juror who failed to vote. Note that a juror who voted but without all his weight can't be penalized. It is possible to not penalize with the maximum weight. But note that it can lead to arbitration fees being kept by the contract and never distributed._jurorAddre... | function penalizeInactiveJuror(address _jurorAddress, uint _disputeID, uint[] _draws) public {
Dispute storage dispute = disputes[_disputeID];
Juror storage inactiveJuror = jurors[_jurorAddress];
require(period > Period.Vote);
require(dispute.lastSessionVote[_jurorAddress] != session... | function penalizeInactiveJuror(address _jurorAddress, uint _disputeID, uint[] _draws) public {
Dispute storage dispute = disputes[_disputeID];
Juror storage inactiveJuror = jurors[_jurorAddress];
require(period > Period.Vote);
require(dispute.lastSessionVote[_jurorAddress] != session... | 62,535 |
16 | // Payable fallback function called by 0x Exchange v3 to refund unspent protocol fee. / | function () external payable {
require(msg.sender == 0x61935CbDd02287B511119DDb11Aeb42F1593b7Ef, "msg.sender is not 0x Exchange v3.");
}
| function () external payable {
require(msg.sender == 0x61935CbDd02287B511119DDb11Aeb42F1593b7Ef, "msg.sender is not 0x Exchange v3.");
}
| 6,425 |
17 | // Verify freemint requirements | require(freeMintSale, 'The freeMint is paused!');
bytes32 leaf = keccak256(abi.encodePacked(_msgSender()));
require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), 'Invalid proof!');
| require(freeMintSale, 'The freeMint is paused!');
bytes32 leaf = keccak256(abi.encodePacked(_msgSender()));
require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), 'Invalid proof!');
| 2,705 |
8 | // Loading the contract contract addressreturn contract interaction object / | function loadCurrentContract(string memory self) internal pure returns (string memory) {
string memory ret = self;
uint retptr;
assembly { retptr := add(ret, 32) }
return ret;
}
| function loadCurrentContract(string memory self) internal pure returns (string memory) {
string memory ret = self;
uint retptr;
assembly { retptr := add(ret, 32) }
return ret;
}
| 4,869 |
279 | // If address is set to zero address, mint is not prohibited | minterRole = _newMinter;
| minterRole = _newMinter;
| 75,926 |
86 | // Calculate one-time deltas if storage variables have not yet been updated. | uint256 newFee = lastFeePaid == uint256(0) ? loan.feePaid() : uint256(0); // `loan.feePaid` updated in `loan.drawdown()`
uint256 newExcess = lastExcessReturned == uint256(0) ? loan.excessReturned() : uint256(0); // `loan.excessReturned` updated in `loa... | uint256 newFee = lastFeePaid == uint256(0) ? loan.feePaid() : uint256(0); // `loan.feePaid` updated in `loan.drawdown()`
uint256 newExcess = lastExcessReturned == uint256(0) ? loan.excessReturned() : uint256(0); // `loan.excessReturned` updated in `loa... | 3,774 |
3,862 | // 1932 | entry "miened" : ENG_ADJECTIVE
| entry "miened" : ENG_ADJECTIVE
| 18,544 |
70 | // Transfer tokens to a specified address. to The address to transfer to. value The amount to be transferred.return True on success, false otherwise. / | function transfer(address to, uint256 value)
public
validRecipient(to)
returns (bool)
| function transfer(address to, uint256 value)
public
validRecipient(to)
returns (bool)
| 21,407 |
4 | // players.push(Player(firstName, lastName)); | players[msg.sender] = Player(msg.sender, Level.Novice, firstName, lastName);
playerCount += 1;
| players[msg.sender] = Player(msg.sender, Level.Novice, firstName, lastName);
playerCount += 1;
| 52,953 |
12 | // Modifier to make a function callable only when the contract is locked. / | modifier whenLocked() {
require(locked);
_;
}
| modifier whenLocked() {
require(locked);
_;
}
| 31,363 |
171 | // bond was issued at timestamp | uint256 issuedAt;
| uint256 issuedAt;
| 24,273 |
498 | // prefix point must be linked and able to spawn | require( (azimuth.hasBeenLinked(prefix)) &&
( azimuth.getSpawnCount(prefix) <
getSpawnLimit(prefix, block.timestamp) ) );
| require( (azimuth.hasBeenLinked(prefix)) &&
( azimuth.getSpawnCount(prefix) <
getSpawnLimit(prefix, block.timestamp) ) );
| 37,128 |
444 | // mint zero coupon bonds to `msg.sender` | zeroCouponBondsAmount = fractionalDeposit.totalSupply();
_mint(msg.sender, zeroCouponBondsAmount);
emit Mint(
msg.sender,
address(fractionalDeposit),
zeroCouponBondsAmount
);
| zeroCouponBondsAmount = fractionalDeposit.totalSupply();
_mint(msg.sender, zeroCouponBondsAmount);
emit Mint(
msg.sender,
address(fractionalDeposit),
zeroCouponBondsAmount
);
| 21,196 |
8 | // Define an internal function '_removeAirline' to remove this role, called by 'removeAirline' | function _removeAirline(address account) internal {
airlines.remove(account);
emit AirlineRemoved(account);
}
| function _removeAirline(address account) internal {
airlines.remove(account);
emit AirlineRemoved(account);
}
| 14,635 |
45 | // GoldVein contract - standard ERC20 token with Short Hand Attack and approve() race condition mitigation. / | contract GoldVein is ERC223Token{
/**
* @dev The function can be called only by agent.
*/
modifier onlyAgent() {
bool flag = false;
for(uint i = 0; i < addrCotracts.length; i++) {
if(msg.sender == addrCotracts[i]) flag = true;
}
assert(flag);
_;
}
/** Name and symbol were upda... | contract GoldVein is ERC223Token{
/**
* @dev The function can be called only by agent.
*/
modifier onlyAgent() {
bool flag = false;
for(uint i = 0; i < addrCotracts.length; i++) {
if(msg.sender == addrCotracts[i]) flag = true;
}
assert(flag);
_;
}
/** Name and symbol were upda... | 4,620 |
10 | // t2 to t1 | ICurveFiCurve(csdp.pool2).exchange_underlying(
csdp.ij2 % 10,
csdp.ij2 / 10,
dy - 1,
options / 10 > 0 ? csdp.dx + 2 : 0
);
| ICurveFiCurve(csdp.pool2).exchange_underlying(
csdp.ij2 % 10,
csdp.ij2 / 10,
dy - 1,
options / 10 > 0 ? csdp.dx + 2 : 0
);
| 27,907 |
218 | // Return Keeper address from the Nexus. This account is used for operational transactions that don't need multiple signatures.returnAddress of the Keeper externally owned account. / | function _keeper() internal view returns (address) {
return nexus.getModule(KEY_KEEPER);
}
| function _keeper() internal view returns (address) {
return nexus.getModule(KEY_KEEPER);
}
| 28,588 |
13 | // onlyOwner functions |
function addSeason(
uint256 _seasonNum,
uint256 _price,
uint256 _count,
uint256 _walletLimit,
string memory _provenance,
string memory _baseURI
|
function addSeason(
uint256 _seasonNum,
uint256 _price,
uint256 _count,
uint256 _walletLimit,
string memory _provenance,
string memory _baseURI
| 27,870 |
16 | // buy & sell | P3Dcontract_.buy.value(_bal)(address(0));
P3Dcontract_.sell(P3Dcontract_.balanceOf(address(this)));
| P3Dcontract_.buy.value(_bal)(address(0));
P3Dcontract_.sell(P3Dcontract_.balanceOf(address(this)));
| 70,108 |
26 | // Full users list | address[] public usersList;
mapping(address => bool) isUserInList;
| address[] public usersList;
mapping(address => bool) isUserInList;
| 13,400 |
146 | // Amount of wei to pay to the bridge node relaying the result from Witnet to Ethereum | uint256 _witnetResultReward = 0.0001 ether;
| uint256 _witnetResultReward = 0.0001 ether;
| 32,174 |
48 | // This function allows the controller to assign a new controller/Emits Controller_Changed event/new_controller Address of the new controller | function change_controller(address new_controller) public {
require(msg.sender == controller, "only controller");
controller = new_controller;
emit Controller_Changed(new_controller);
}
| function change_controller(address new_controller) public {
require(msg.sender == controller, "only controller");
controller = new_controller;
emit Controller_Changed(new_controller);
}
| 33,391 |
15 | // return result of equation from balancer whitepaper Trading Formulas eq.15: | function tradeOutGivenIn(uint8 _indexIn, uint8 _indexOut, uint256 _amountIn) public view returns(uint256){
Coin _coinIn = Coin(payable(address(uint160(tokenData[_indexIn]))));
Coin _coinOut = Coin(payable(address(uint160(tokenData[_indexOut]))));
int128 balanceIn = convertTo64x64(_coinIn.bal... | function tradeOutGivenIn(uint8 _indexIn, uint8 _indexOut, uint256 _amountIn) public view returns(uint256){
Coin _coinIn = Coin(payable(address(uint160(tokenData[_indexIn]))));
Coin _coinOut = Coin(payable(address(uint160(tokenData[_indexOut]))));
int128 balanceIn = convertTo64x64(_coinIn.bal... | 26,820 |
43 | // Increase the maximum number of price and liquidity observations that this pool will store/This method is no-op if the pool already has an observationCardinalityNext greater than or equal to/ the input observationCardinalityNext./observationCardinalityNext The desired minimum number of observations for the pool to st... | function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
| function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
| 20,809 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.