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 |
|---|---|---|---|---|
212 | // ignore first byte | path[1] = pathBytes.toAddress(ACTION_SIZE);
for (uint256 i = 1; i < pathLength; i++) {
path[i + 1] = pathBytes.toAddress(i * ADDR_SIZE + ACTION_SIZE);
}
| path[1] = pathBytes.toAddress(ACTION_SIZE);
for (uint256 i = 1; i < pathLength; i++) {
path[i + 1] = pathBytes.toAddress(i * ADDR_SIZE + ACTION_SIZE);
}
| 65,155 |
6 | // This function sets the withdraw delay for withdrawals over the per-asset set thresholds/delay Amount of time to delay a withdrawal/nonce Vega-assigned single-use number that provides replay attack protection/signatures Vega-supplied signature bundle of a validator-signed order | function set_withdraw_delay(uint256 delay, uint256 nonce, bytes calldata signatures) public virtual;
| function set_withdraw_delay(uint256 delay, uint256 nonce, bytes calldata signatures) public virtual;
| 3,770 |
302 | // Deposits ETH into the contract and mint vault shares. Reverts if the underlying is not WETH. / | function depositETH() external payable nonReentrant {
require(asset == WETH, "asset is not WETH");
require(msg.value > 0, "No value passed");
IWETH(WETH).deposit{value: msg.value}();
_deposit(msg.value);
}
| function depositETH() external payable nonReentrant {
require(asset == WETH, "asset is not WETH");
require(msg.value > 0, "No value passed");
IWETH(WETH).deposit{value: msg.value}();
_deposit(msg.value);
}
| 40,140 |
63 | // Mint the relevant NFTs to claimer. | transferClaimedTokens(_receiver, activeConditionId, _quantity);
emit TokensClaimed(activeConditionId, _msgSender(), _receiver, tokenIdToClaim, _quantity);
| transferClaimedTokens(_receiver, activeConditionId, _quantity);
emit TokensClaimed(activeConditionId, _msgSender(), _receiver, tokenIdToClaim, _quantity);
| 60,832 |
87 | // Limit gas to prevent reentrancy. | return ERC20(token).allowance.gas(EXTERNAL_QUERY_GAS_LIMIT)(
owner,
granter
);
| return ERC20(token).allowance.gas(EXTERNAL_QUERY_GAS_LIMIT)(
owner,
granter
);
| 10,544 |
290 | // truncate interval if underwriter has excess short position size |
if (interval.contractSize > contractSize)
interval.contractSize = contractSize;
|
if (interval.contractSize > contractSize)
interval.contractSize = contractSize;
| 88,086 |
1 | // Internals | EnumerableBytes32Set.Bytes32Set internal logicTargetsSet; // implementations set
EnumerableBytes32Set.Bytes32Set internal activeLoansSet; // active loans set
EnumerableBytes32Set.Bytes32Set internal auxDataKeySet; // aux data k... | EnumerableBytes32Set.Bytes32Set internal logicTargetsSet; // implementations set
EnumerableBytes32Set.Bytes32Set internal activeLoansSet; // active loans set
EnumerableBytes32Set.Bytes32Set internal auxDataKeySet; // aux data k... | 15,077 |
40 | // input ptr | let dataPtr := data
let endPtr := add(dataPtr, mload(data))
| let dataPtr := data
let endPtr := add(dataPtr, mload(data))
| 15,391 |
124 | // castDocumentVote(): as _galaxy, cast a _vote on the _proposal_vote is true when in favor of the proposal, false otherwise | function castDocumentVote(uint8 _galaxy, bytes32 _proposal, bool _vote)
external
activePointVoter(_galaxy)
| function castDocumentVote(uint8 _galaxy, bytes32 _proposal, bool _vote)
external
activePointVoter(_galaxy)
| 43,053 |
4 | // Maximum amount of NFT for airdrop | uint256 public constant MAX_AIRDROP_MINT = 188;
| uint256 public constant MAX_AIRDROP_MINT = 188;
| 20,639 |
83 | // Overload of {ECDSA-recover} that receives the `r` and `vs` short-signature fields separately._Available since v4.2._ / | function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
bytes32 s;
uint8 v;
assembly {
s := and(
vs,
| function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
bytes32 s;
uint8 v;
assembly {
s := and(
vs,
| 10,110 |
58 | // Update collecting wallet address _address The address to send collected funds / | function setWallet(address _address) onlyOwner public {
wallet = _address;
WalletSet(_address);
}
| function setWallet(address _address) onlyOwner public {
wallet = _address;
WalletSet(_address);
}
| 45,574 |
36 | // Takes into account the contracts' {startingIndex} which - alone - determines the allocation of Loopy Donuts - ensuring a fair and completely random distribution./ | function getTokenURI(uint256 tokenId, StorageType origin) public view returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
if (startingIndex == 0) {
return mysteryDonutURI;
}
| function getTokenURI(uint256 tokenId, StorageType origin) public view returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
if (startingIndex == 0) {
return mysteryDonutURI;
}
| 46,357 |
237 | // Storage seed for a function selector's implementation address | function appSelectors(bytes4 _selector) internal pure returns (bytes32)
| function appSelectors(bytes4 _selector) internal pure returns (bytes32)
| 30,932 |
305 | // verify that the position is not removed on the same block in which it was added | require(pos.timestamp < time(), "ERR_TOO_EARLY");
if (portion == PPM_RESOLUTION) {
notifyEventSubscribersOnRemovingLiquidity(
id,
pos.provider,
pos.poolToken,
pos.reserveToken,
pos.poolAmount,
po... | require(pos.timestamp < time(), "ERR_TOO_EARLY");
if (portion == PPM_RESOLUTION) {
notifyEventSubscribersOnRemovingLiquidity(
id,
pos.provider,
pos.poolToken,
pos.reserveToken,
pos.poolAmount,
po... | 38,754 |
9 | // _maximumGasPrice highest gas price for which transmitter will be compensated _reasonableGasPrice transmitter will receive reward for gas prices under this value _microLinkPerEth reimbursement per ETH of gas cost, in 1e-6LINK units _linkGweiPerObservation reward to oracle for contributing an observation to a successf... | constructor(
uint32 _maximumGasPrice,
uint32 _reasonableGasPrice,
uint32 _microLinkPerEth,
uint32 _linkGweiPerObservation,
uint32 _linkGweiPerTransmission,
LinkTokenInterface _link,
int192 _minAnswer,
| constructor(
uint32 _maximumGasPrice,
uint32 _reasonableGasPrice,
uint32 _microLinkPerEth,
uint32 _linkGweiPerObservation,
uint32 _linkGweiPerTransmission,
LinkTokenInterface _link,
int192 _minAnswer,
| 53,157 |
9 | // In reality, the correct amount is the amount + 1% | require(this.balance >= SafeMath.div(SafeMath.mul(min_amount, 100), 99));
_;
| require(this.balance >= SafeMath.div(SafeMath.mul(min_amount, 100), 99));
_;
| 32,796 |
69 | // If there are previous unlocks, check for claims that would leave them untouchable | if (_first > 0) {
require(
lastClaim >= userRewards[_account][_first - 1].finish,
"Invalid _first arg: Must claim earlier entries"
);
}
| if (_first > 0) {
require(
lastClaim >= userRewards[_account][_first - 1].finish,
"Invalid _first arg: Must claim earlier entries"
);
}
| 40,945 |
27 | // replace with maximum allowed value | function approveStake () public {
(bool success, ) = ieth.call(abi.encodeWithSignature("approve(address,uint256)",stakePool,100000 ether ));
require(success, "Stake IETH approve failed!");
}
| function approveStake () public {
(bool success, ) = ieth.call(abi.encodeWithSignature("approve(address,uint256)",stakePool,100000 ether ));
require(success, "Stake IETH approve failed!");
}
| 555 |
4 | // Router token swapping functionality/Functions for swapping tokens via Native | interface INativeRouter is ISwapCallback {
struct WidgetFee {
address signer;
address feeRecipient;
uint256 feeRate;
}
struct ExactInputSingleParams {
bytes orders;
address recipient;
uint256 amountIn;
uint256 amountOutMinimum;
WidgetFee widge... | interface INativeRouter is ISwapCallback {
struct WidgetFee {
address signer;
address feeRecipient;
uint256 feeRate;
}
struct ExactInputSingleParams {
bytes orders;
address recipient;
uint256 amountIn;
uint256 amountOutMinimum;
WidgetFee widge... | 39,717 |
76 | // The precision used in the balance calculations in contract | uint8 public constant decimals = 18;
| uint8 public constant decimals = 18;
| 78,633 |
5 | // 18 decimal constants | int256 constant x0 = 128000000000000000000; // 2ˆ7
int256 constant a0 = 38877084059945950922200000000000000000000000000000000000; // eˆ(x0) (no decimals)
int256 constant x1 = 64000000000000000000; // 2ˆ6
int256 constant a1 = 6235149080811616882910000000; // eˆ(x1) (no decimals)
| int256 constant x0 = 128000000000000000000; // 2ˆ7
int256 constant a0 = 38877084059945950922200000000000000000000000000000000000; // eˆ(x0) (no decimals)
int256 constant x1 = 64000000000000000000; // 2ˆ6
int256 constant a1 = 6235149080811616882910000000; // eˆ(x1) (no decimals)
| 7,207 |
146 | // charcoal.burn(msg.sender, _amount); | emit Withdraw(msg.sender, 0, _amount);
| emit Withdraw(msg.sender, 0, _amount);
| 60,324 |
41 | // Get a specific record for the given name | function getRecord(string calldata name, RecordType recordType)
public
view
returns (string memory)
{
if (recordType == RecordType.TLD) {
return records[name].tld;
} else if (recordType == RecordType.CATEGORY) {
| function getRecord(string calldata name, RecordType recordType)
public
view
returns (string memory)
{
if (recordType == RecordType.TLD) {
return records[name].tld;
} else if (recordType == RecordType.CATEGORY) {
| 16,541 |
194 | // Set new baseURI | function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseTokenURI = _newBaseURI;
}
| function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseTokenURI = _newBaseURI;
}
| 32,628 |
211 | // Calculate and mint the amount of xTokens the base tokens are worth. The ratio will change overtime, as xTokens are burned/minted and base tokens deposited + gained from fees / withdrawn. | else {
uint256 what = (_amount * totalShares) / totalBaseToken;
_timelockMint(account, what, timelockLength);
return what;
}
| else {
uint256 what = (_amount * totalShares) / totalBaseToken;
_timelockMint(account, what, timelockLength);
return what;
}
| 81,673 |
97 | // Token name | string private _name;
| string private _name;
| 5,357 |
22 | // Generic owned destroyable contract / | contract Object is Owned {
/**
* Common result code. Means everything is fine.
*/
uint constant OK = 1;
uint constant OWNED_ACCESS_DENIED_ONLY_CONTRACT_OWNER = 8;
function withdrawnTokens(address[] tokens, address _to) onlyContractOwner returns(uint) {
for(uint i=0;i<tokens.length;i++)... | contract Object is Owned {
/**
* Common result code. Means everything is fine.
*/
uint constant OK = 1;
uint constant OWNED_ACCESS_DENIED_ONLY_CONTRACT_OWNER = 8;
function withdrawnTokens(address[] tokens, address _to) onlyContractOwner returns(uint) {
for(uint i=0;i<tokens.length;i++)... | 16,952 |
23 | // Redeem tokens if the sender is the beneficiary / | function getReward() external override nonReentrant returns (uint256) {
(uint256 amount, uint256 totalTokens) = _earned(msg.sender);
if (amount == 0) {
// Do nothing if there are no tokens to redeem
return 0;
}
totalTokensReceived = totalTokens;
// Tr... | function getReward() external override nonReentrant returns (uint256) {
(uint256 amount, uint256 totalTokens) = _earned(msg.sender);
if (amount == 0) {
// Do nothing if there are no tokens to redeem
return 0;
}
totalTokensReceived = totalTokens;
// Tr... | 20,091 |
17 | // update the mapping of the tokenId to the staker's address | stakerAddress[_tokenId] = msg.sender;
| stakerAddress[_tokenId] = msg.sender;
| 12,602 |
42 | // - penalty applies | _balances[penaltyAccount] = _balances[penaltyAccount]
.sub(signedRewardAmount);
| _balances[penaltyAccount] = _balances[penaltyAccount]
.sub(signedRewardAmount);
| 24,487 |
89 | // Construct managed ERC20 token _name The full token name _symbol The token symbol (aberration) _decimals The token precision _locked Whether the token should be locked initially / | function ManagedToken(string _name, string _symbol, uint8 _decimals, bool _locked)
| function ManagedToken(string _name, string _symbol, uint8 _decimals, bool _locked)
| 7,972 |
494 | // Decreases a Pool's 'cash' (and therefore its 'total'). Called when Pool tokens are sent from the Vault(except for Asset Manager withdrawals). Updates the last total balance change block, even if `amount` is zero. / | function decreaseCash(bytes32 balance, uint256 amount) internal view returns (bytes32) {
uint256 newCash = cash(balance).sub(amount);
uint256 currentManaged = managed(balance);
uint256 newLastChangeBlock = block.number;
return toBalance(newCash, currentManaged, newLastChangeBlock);
... | function decreaseCash(bytes32 balance, uint256 amount) internal view returns (bytes32) {
uint256 newCash = cash(balance).sub(amount);
uint256 currentManaged = managed(balance);
uint256 newLastChangeBlock = block.number;
return toBalance(newCash, currentManaged, newLastChangeBlock);
... | 32,392 |
17 | // Allows the msg.sender to get all the event managers address/s of all events/ /TODO: WIP/ return The address of all Event Manager/s of all events | function getAllOrganizers() view returns () {}
| function getAllOrganizers() view returns () {}
| 39,129 |
637 | // Possible ways this could break addressed 1) Accessing before event is over and resetting eth contributed -- added require 2) No uniswap pair - impossible at this moment because of the LPGenerationCompleted bool 3) LP per unit is 0 - impossible checked at generation function | function claimLPTokens() public {
require(LPGenerationCompleted, "Event not over yet");
require(ethContributed[msg.sender] > 0, "Nothing to claim, move along");
IUniswapV2Pair pair = IUniswapV2Pair(tokenUniswapPair);
uint256 amountLPToTransfer = ethContributed[msg.sender]
... | function claimLPTokens() public {
require(LPGenerationCompleted, "Event not over yet");
require(ethContributed[msg.sender] > 0, "Nothing to claim, move along");
IUniswapV2Pair pair = IUniswapV2Pair(tokenUniswapPair);
uint256 amountLPToTransfer = ethContributed[msg.sender]
... | 34,828 |
18 | // Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any) / | function buy(address _referredBy)
public
payable
returns(uint256)
| function buy(address _referredBy)
public
payable
returns(uint256)
| 9,702 |
55 | // maximum amount of tokens for sale | uint256 public tokensForSale; // 36 Million Tokens for SALE
| uint256 public tokensForSale; // 36 Million Tokens for SALE
| 64,563 |
0 | // A library that parses the packed funding cycle metadata into a friendlier format. | using JBFundingCycleMetadataResolver for JBFundingCycle;
| using JBFundingCycleMetadataResolver for JBFundingCycle;
| 36,094 |
88 | // This is an alternative to {approve} that can be used as a mitigation forproblems described in {BEP20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - `spender` cannot be the zero address.- `spender` must have allowance for the caller of at least`subtractedValue`. / | function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(subtractedValue, 'BEP20: decreased allowance below zero')
);
return true;
}
| function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(subtractedValue, 'BEP20: decreased allowance below zero')
);
return true;
}
| 9,325 |
7 | // Deprecated / | function requestFriendWithGift(address receiver, uint256 gift) external {
require(blockList[receiver][msg.sender] != true, "You are blocked");
require(
friendRequests[receiver][msg.sender] != true,
"Can not request friend twice"
);
require(
friendRelations[receiver][msg.sender] != tr... | function requestFriendWithGift(address receiver, uint256 gift) external {
require(blockList[receiver][msg.sender] != true, "You are blocked");
require(
friendRequests[receiver][msg.sender] != true,
"Can not request friend twice"
);
require(
friendRelations[receiver][msg.sender] != tr... | 5,556 |
25 | // Snapshot with offset (in case runs out of gas) | function snapshotWithOffset(
address rewardAsset,
uint256 start,
uint256 end
| function snapshotWithOffset(
address rewardAsset,
uint256 start,
uint256 end
| 21,974 |
250 | // This is where we actually mint tokens: | tokenSupply = tokenSupply.add(tokensBought);
divTokenSupply = divTokenSupply.add(dividendTokensBought);
| tokenSupply = tokenSupply.add(tokensBought);
divTokenSupply = divTokenSupply.add(dividendTokensBought);
| 32,448 |
1 | // Error for if does not exist. | error DoesNotExist();
| error DoesNotExist();
| 24,554 |
3 | // Floor price at which a SAFE is allowed to generate debt | uint256 safetyPrice; // [ray]
| uint256 safetyPrice; // [ray]
| 53,472 |
49 | // address of the interest rate strategy | address interestRateStrategyAddress;
| address interestRateStrategyAddress;
| 28,956 |
11 | // Create rToken linked with cToken at `cToken_` / | constructor(IAllocationStrategy allocationStrategy) public {
ias = allocationStrategy;
token = IERC20(ias.underlying());
}
| constructor(IAllocationStrategy allocationStrategy) public {
ias = allocationStrategy;
token = IERC20(ias.underlying());
}
| 6,559 |
184 | // gas optimization, arrayLength implicitly prevents overflows | unchecked {
i++;
}
| unchecked {
i++;
}
| 32,590 |
8 | // withdraw balance to owner | function withdraw() external onlyOwner {
owner.transfer(address(this).balance);
}
| function withdraw() external onlyOwner {
owner.transfer(address(this).balance);
}
| 6,368 |
24 | // @inheritdocIERC2981Royalties | function royaltyInfo(uint256, uint256 value)
external
view
override
returns (address receiver, uint256 royaltyAmount)
| function royaltyInfo(uint256, uint256 value)
external
view
override
returns (address receiver, uint256 royaltyAmount)
| 2,555 |
324 | // Revokes `role` from `account`. Internal function without access restriction. | * May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
| * May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
| 7,553 |
144 | // scope to avoid stack too deep errors | (
uint256 reserveIn,
uint256 reserveOut,
uint256 vReserveIn,
uint256 vReserveOut,
uint256 feeInPrecision
) = DMMLibrary.getTradeInfo(poolsPath[i], input, output);
uint256 a... | (
uint256 reserveIn,
uint256 reserveOut,
uint256 vReserveIn,
uint256 vReserveOut,
uint256 feeInPrecision
) = DMMLibrary.getTradeInfo(poolsPath[i], input, output);
uint256 a... | 4,035 |
56 | // taxFee | uint256 private _taxFee;
string private _name = 'doge moon';
string private _symbol = 'DM';
uint8 private _decimals = 18;
address private _deadAddress = _msgSender();
uint256 private _minFee;
| uint256 private _taxFee;
string private _name = 'doge moon';
string private _symbol = 'DM';
uint8 private _decimals = 18;
address private _deadAddress = _msgSender();
uint256 private _minFee;
| 4,657 |
18 | // mint function for masterchef; | function mint(address to, uint256 amount) public onlyMasterChefAndBridge {
_mint(to, amount);
}
| function mint(address to, uint256 amount) public onlyMasterChefAndBridge {
_mint(to, amount);
}
| 67,662 |
0 | // Interfaces / | interface IUnitroller {
function getAllMarkets() external view returns (address[] memory);
}
| interface IUnitroller {
function getAllMarkets() external view returns (address[] memory);
}
| 50,756 |
39 | // BaseACL: ACL check method should not return anything. | string constant ACL_FUNC_RETURNS_NON_EMPTY = "E39";
| string constant ACL_FUNC_RETURNS_NON_EMPTY = "E39";
| 38,013 |
13 | // Withdraw principal from the uncalled tranche. / | function withdraw(Waterfall storage w, uint256 principalAmount) internal {
return w.getTranche(w.uncalledCapitalTrancheIndex()).withdraw(principalAmount);
}
| function withdraw(Waterfall storage w, uint256 principalAmount) internal {
return w.getTranche(w.uncalledCapitalTrancheIndex()).withdraw(principalAmount);
}
| 39,911 |
127 | // Safe Nifity transfer function, just in case if rounding error causes pool to not have enough nifity. | function safeNifityTransfer(address _to, uint256 _amount) internal {
uint256 nifityBal = nifity.balanceOf(address(this));
if (_amount > nifityBal) {
nifity.transfer(_to, nifityBal);
} else {
nifity.transfer(_to, _amount);
}
}
| function safeNifityTransfer(address _to, uint256 _amount) internal {
uint256 nifityBal = nifity.balanceOf(address(this));
if (_amount > nifityBal) {
nifity.transfer(_to, nifityBal);
} else {
nifity.transfer(_to, _amount);
}
}
| 19,403 |
10 | // generates a base64 encoded metadata response without referencing off-chain content tokenId the ID of the token to generate the metadata forreturn a base64 encoded JSON dictionary of the token's metadata and SVG / | function tokenURI(uint256 tokenId) public view override returns (string memory) {
IWoolf.SheepWolf memory s = woolf.getTokenTraits(tokenId);
string memory metadata = string(abi.encodePacked(
'{"name": "',
s.isSheep ? 'Sheep #' : 'Wolf #',
tokenId.toString(),
'", "description": "Thousa... | function tokenURI(uint256 tokenId) public view override returns (string memory) {
IWoolf.SheepWolf memory s = woolf.getTokenTraits(tokenId);
string memory metadata = string(abi.encodePacked(
'{"name": "',
s.isSheep ? 'Sheep #' : 'Wolf #',
tokenId.toString(),
'", "description": "Thousa... | 10,796 |
69 | // return the amount of borrow rUSTP that corresponds to `_sharesAmount` borrow shares. / | function getBorrowrUSTPAmountByShares(uint256 _sharesAmount) public view returns (uint256) {
return
totalBorrowShares == 0 ? 0 : _sharesAmount.mul(totalBorrowrUSTP).div(totalBorrowShares);
}
| function getBorrowrUSTPAmountByShares(uint256 _sharesAmount) public view returns (uint256) {
return
totalBorrowShares == 0 ? 0 : _sharesAmount.mul(totalBorrowrUSTP).div(totalBorrowShares);
}
| 33,205 |
101 | // Has the edition sold out | function isEditionSoldOut(uint256 _editionId) external view returns (bool);
| function isEditionSoldOut(uint256 _editionId) external view returns (bool);
| 10,732 |
2 | // Checking if the caller is the owner only after calling the authority saves gas in most cases, but be aware that this makes protected functions uncallable even to the owner if the authority is out of order. | return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;
| return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;
| 21,114 |
151 | // Returns the address of the current migrationOwner. / | function migrationOwner() public view returns (address) {
return _migrationOwner;
}
| function migrationOwner() public view returns (address) {
return _migrationOwner;
}
| 36,717 |
189 | // Throws if called by any sender that isn't a registered staking pool/ | modifier onlyRegisteredStakingPool(address _stakingPoolAddress) {
require(getBool(keccak256(abi.encodePacked("stakingpool.exists", _stakingPoolAddress))), "Invalid staking pool");
_;
}
| modifier onlyRegisteredStakingPool(address _stakingPoolAddress) {
require(getBool(keccak256(abi.encodePacked("stakingpool.exists", _stakingPoolAddress))), "Invalid staking pool");
_;
}
| 49,223 |
81 | // Get storage pointer to the accounts array of loans | PynthLoanStruct[] storage pynthLoans = accountsPynthLoans[pynthLoan.account];
for (uint256 i = 0; i < pynthLoans.length; i++) {
if (pynthLoans[i].loanID == pynthLoan.loanID) {
| PynthLoanStruct[] storage pynthLoans = accountsPynthLoans[pynthLoan.account];
for (uint256 i = 0; i < pynthLoans.length; i++) {
if (pynthLoans[i].loanID == pynthLoan.loanID) {
| 36,275 |
312 | // Update buffer length if we extended it | if eq(off, buflen) {
mstore(bufptr, add(buflen, 1))
}
| if eq(off, buflen) {
mstore(bufptr, add(buflen, 1))
}
| 14,785 |
101 | // Check signature and mint tokens _amount - subj _lastBlockNumber - subj _currentBlockNumber - subj _msgForSign - hash for sign with Ethereum style prefix!!! _signature- signature/ | function harvest(
uint256 _amount,
uint256 _lastBlockNumber,
uint256 _currentBlockNumber,
bytes32 _msgForSign,
bytes memory _signature)
public
| function harvest(
uint256 _amount,
uint256 _lastBlockNumber,
uint256 _currentBlockNumber,
bytes32 _msgForSign,
bytes memory _signature)
public
| 40,108 |
140 | // Initialize AppProxyPinned (makes it an un-upgradeable Aragon app)_kernel Reference to organization kernel for the app_appId Identifier for app_initializePayload Payload for call to be made after setup to initialize/ | function AppProxyPinned(IKernel _kernel, bytes32 _appId, bytes _initializePayload)
AppProxyBase(_kernel, _appId, _initializePayload) public
| function AppProxyPinned(IKernel _kernel, bytes32 _appId, bytes _initializePayload)
AppProxyBase(_kernel, _appId, _initializePayload) public
| 13,065 |
126 | // Create a resolution to remove the operator. Performs removal if threshold is 1 or zero. | function createResolutionRemoveOperator(address operator)
public
onlyOwners()
| function createResolutionRemoveOperator(address operator)
public
onlyOwners()
| 53,413 |
8 | // Contract Details / | function TokenERC20() public {
totalSupply = 20000000000000000000000000;
balanceOf[msg.sender] = totalSupply;
name = "Missimx.com Dollar";
symbol = "MSX";
}
| function TokenERC20() public {
totalSupply = 20000000000000000000000000;
balanceOf[msg.sender] = totalSupply;
name = "Missimx.com Dollar";
symbol = "MSX";
}
| 53,626 |
14 | // Returns the scaling factor for one of the Pool's tokens. Reverts if `token` is not a token registered by thePool. / | function _scalingFactor(IERC20 token) internal view virtual override returns (uint256) {
// prettier-ignore
if (token == _token0) { return _scalingFactor0; }
else if (token == _token1) { return _scalingFactor1; }
else if (token == _token2) { return _scalingFactor2; }
else if ... | function _scalingFactor(IERC20 token) internal view virtual override returns (uint256) {
// prettier-ignore
if (token == _token0) { return _scalingFactor0; }
else if (token == _token1) { return _scalingFactor1; }
else if (token == _token2) { return _scalingFactor2; }
else if ... | 32,769 |
17 | // 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[... | 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[... | 43,844 |
27 | // PRIVILEGED MODULE FUNCTION. Remove a old minter. / | function removeMinter(address minter) external onlyOwner {
require(minters[minter], "Minter does not exist");
delete minters[minter];
emit EventMinterRemoved(minter);
}
| function removeMinter(address minter) external onlyOwner {
require(minters[minter], "Minter does not exist");
delete minters[minter];
emit EventMinterRemoved(minter);
}
| 43,568 |
364 | // Changes a node's status to Left. / | function _setNodeLeft(uint nodeIndex) private {
nodesIPCheck[nodes[nodeIndex].ip] = false;
nodesNameCheck[keccak256(abi.encodePacked(nodes[nodeIndex].name))] = false;
delete nodesNameToIndex[keccak256(abi.encodePacked(nodes[nodeIndex].name))];
if (nodes[nodeIndex].status == NodeStatu... | function _setNodeLeft(uint nodeIndex) private {
nodesIPCheck[nodes[nodeIndex].ip] = false;
nodesNameCheck[keccak256(abi.encodePacked(nodes[nodeIndex].name))] = false;
delete nodesNameToIndex[keccak256(abi.encodePacked(nodes[nodeIndex].name))];
if (nodes[nodeIndex].status == NodeStatu... | 29,063 |
9 | // make sure we don't go over the hard limit of sizeof(byte) for the number of members | require(_members.length < 0xff);
require(_res_majority_percentage > 0 && _res_majority_percentage <= 100);
self.GOLD_ACCOUNT = "ac.gold";
self.NOT_A_MEMBER = 0xff;
self.registry = NameRegistry(_registry);
self.project_status = Status.Confirmed;
self.project_name = _name;
self.project_initiator = msg.s... | require(_members.length < 0xff);
require(_res_majority_percentage > 0 && _res_majority_percentage <= 100);
self.GOLD_ACCOUNT = "ac.gold";
self.NOT_A_MEMBER = 0xff;
self.registry = NameRegistry(_registry);
self.project_status = Status.Confirmed;
self.project_name = _name;
self.project_initiator = msg.s... | 27,547 |
23 | // Croupier account. | address public croupier;
| address public croupier;
| 16,207 |
29 | // Withdraw staked tokens and collect reward tokens _amount: amount to withdraw (in rewardToken) / | function withdraw(uint256 _amount) external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
require(user.amount >= _amount, "Amount to withdraw too high");
require(user.depositTime + lockTime < block.timestamp, "Can not withdraw in lock period");
_updatePool();
... | function withdraw(uint256 _amount) external nonReentrant {
UserInfo storage user = userInfo[msg.sender];
require(user.amount >= _amount, "Amount to withdraw too high");
require(user.depositTime + lockTime < block.timestamp, "Can not withdraw in lock period");
_updatePool();
... | 18,291 |
3 | // Get LoanTerms struct hash/_terms Loan Terms/ return hash struct hash | function getLoanTermsHash(
LoanTerms calldata _terms
| function getLoanTermsHash(
LoanTerms calldata _terms
| 41,037 |
211 | // set new leaders | if (round_[_rID].plyr != _pID)
round_[_rID].plyr = _pID;
if (round_[_rID].team != _team)
round_[_rID].team = _team;
| if (round_[_rID].plyr != _pID)
round_[_rID].plyr = _pID;
if (round_[_rID].team != _team)
round_[_rID].team = _team;
| 32,285 |
26 | // can't remove immutable functions -- functions defined directly in the diamond | require(
oldFacetAddressAndSelectorPosition.facetAddress != address(this),
"LibDiamondCut: Can't remove immutable function."
);
| require(
oldFacetAddressAndSelectorPosition.facetAddress != address(this),
"LibDiamondCut: Can't remove immutable function."
);
| 25,785 |
34 | // start of vesting period as a timestamp | uint256 public start;
| uint256 public start;
| 18,761 |
134 | // Gets the token name.return string representing the token name / | function name() external view returns (string memory) {
return _name;
}
| function name() external view returns (string memory) {
return _name;
}
| 11,492 |
14 | // Kills a Loan, and reward the Killer a part of the fees of the LoanSend the reward fees to the Killer, then return the loaned tokens and the fees to the PalPool, and destroy the contract_killer Address of the Loan Killer_killerRatio Percentage of the fees to reward to the killer (scale 1e18)/ | function killLoan(address _killer, uint _killerRatio) external motherPoolOnly {
IERC20 _underlying = IERC20(underlying);
//Send the killer reward to the killer
//Then return the borrowed amount and the fees to the pool
uint _killerAmount = feesAmount.mul(_killerRatio).div(ui... | function killLoan(address _killer, uint _killerRatio) external motherPoolOnly {
IERC20 _underlying = IERC20(underlying);
//Send the killer reward to the killer
//Then return the borrowed amount and the fees to the pool
uint _killerAmount = feesAmount.mul(_killerRatio).div(ui... | 55,711 |
20 | // Read and consume the next 16 bytes from the buffer as an `uint128`._buffer An instance of `BufferLib.Buffer`. return The `uint128` value of the next 16 bytes in the buffer counting from the cursor position./ | function readUint128(Buffer memory _buffer) internal pure notOutOfBounds(_buffer.cursor + 15, _buffer.data.length) returns (uint128) {
bytes memory bytesValue = _buffer.data;
uint32 offset = _buffer.cursor;
uint128 value;
assembly {
value := mload(add(add(bytesValue, 16), offset))
}
_buf... | function readUint128(Buffer memory _buffer) internal pure notOutOfBounds(_buffer.cursor + 15, _buffer.data.length) returns (uint128) {
bytes memory bytesValue = _buffer.data;
uint32 offset = _buffer.cursor;
uint128 value;
assembly {
value := mload(add(add(bytesValue, 16), offset))
}
_buf... | 29,009 |
3 | // Wallet 3 (2%): | address public owner3 = 0xf08e0469565d481d4193de46D5f98b7c6463FC3d;
| address public owner3 = 0xf08e0469565d481d4193de46D5f98b7c6463FC3d;
| 84,600 |
100 | // Amount of RUBC to be locked in gas pool on opening troves | uint constant public RUBC_GAS_COMPENSATION = 20_000e18;
| uint constant public RUBC_GAS_COMPENSATION = 20_000e18;
| 21,415 |
179 | // Value Liquidity (VALUE) with Governance Alpha | contract ValueLiquidityToken is ERC20 {
using SafeERC20 for IERC20;
using SafeMath for uint256;
IERC20 public yfv;
address public governance;
uint256 public cap;
uint256 public yfvLockedBalance;
mapping(address => bool) public minters;
event Deposit(address indexed dst, uint amount);
... | contract ValueLiquidityToken is ERC20 {
using SafeERC20 for IERC20;
using SafeMath for uint256;
IERC20 public yfv;
address public governance;
uint256 public cap;
uint256 public yfvLockedBalance;
mapping(address => bool) public minters;
event Deposit(address indexed dst, uint amount);
... | 15,431 |
241 | // increment the bid count | bidCount[catId] += 1;
| bidCount[catId] += 1;
| 11,025 |
6 | // Network fees have three tier, but it is sufficient to have minimun and maximun amount of tier 2Tier 1: deposit amount < minimun amount of tier 2Tier 2: minimun amount of tier 2 <= deposit amount <= maximun amount of tier 2Tier 3: amount > maximun amount of tier 2 / | uint256[] memory oldNetworkFeeTier2 = networkFeeTier2;
networkFeeTier2 = _networkFeeTier2;
emit SetNetworkFeeTier2(oldNetworkFeeTier2, _networkFeeTier2);
| uint256[] memory oldNetworkFeeTier2 = networkFeeTier2;
networkFeeTier2 = _networkFeeTier2;
emit SetNetworkFeeTier2(oldNetworkFeeTier2, _networkFeeTier2);
| 17,775 |
25 | // Withdraws staked creature NFTs/tokenIds The tokenIds of the NFTs which will be withdrawn | function withdrawCreatures(uint256[] memory tokenIds) external nonReentrant updateReward(msg.sender) {
require(tokenIds.length > 0, "SwampStaking: No tokenIds provided");
uint256 amount;
for (uint256 i; i < tokenIds.length;) {
// Check if the user who withdraws is the owner
require(stakedCrea... | function withdrawCreatures(uint256[] memory tokenIds) external nonReentrant updateReward(msg.sender) {
require(tokenIds.length > 0, "SwampStaking: No tokenIds provided");
uint256 amount;
for (uint256 i; i < tokenIds.length;) {
// Check if the user who withdraws is the owner
require(stakedCrea... | 5,377 |
19 | // i < tokenBalanceOwner because tokenBalanceOwner is 1-indexed | for (uint256 i = 0; i < tokenBalanceOwner; i++) {
| for (uint256 i = 0; i < tokenBalanceOwner; i++) {
| 11,645 |
157 | // Add the user liqudation fee with the arc liquidation fee / | function totalLiquidationSpread()
public
view
returns (Decimal.D256 memory)
| function totalLiquidationSpread()
public
view
returns (Decimal.D256 memory)
| 32,811 |
7 | // Constructor ------------------------------------------------------------------------ | constructor()
ERC721GasOptimization("BlackandBlueCosmos", "BBC",0)
EIP712("BlackandBlueCosmos", "1.0.0")
| constructor()
ERC721GasOptimization("BlackandBlueCosmos", "BBC",0)
EIP712("BlackandBlueCosmos", "1.0.0")
| 29,625 |
186 | // This cannot happen - just in case | last_point.slope = 0;
| last_point.slope = 0;
| 48,112 |
53 | // eslint-ignore | ICash Dollars;
mapping(address=>Account) private _shareBalances;
mapping (address => mapping (address => uint256)) private _allowedShares;
bool reEntrancyMintMutex;
address public _euroMinter;
mapping (address => uint256) private _euroDividendPoints;
mapping (address => bool) public _debas... | ICash Dollars;
mapping(address=>Account) private _shareBalances;
mapping (address => mapping (address => uint256)) private _allowedShares;
bool reEntrancyMintMutex;
address public _euroMinter;
mapping (address => uint256) private _euroDividendPoints;
mapping (address => bool) public _debas... | 14,415 |
442 | // Sends a message associated with a transfer to a contract on another chain. _receiver The address of the destination app contract. _token The address of the token to be sent. _amount The amount of tokens to be sent. _dstChainId The destination chain ID. _nonce A number input to guarantee uniqueness of transferId. Can... | * Only applicable to the {MsgDataTypes.BridgeSendType.Liquidity}.
* @param _message Arbitrary message bytes to be decoded by the destination app contract.
* If message is empty, only the token transfer will be sent
* @param _bridgeSendType One of the {BridgeSendType} enum.
* @para... | * Only applicable to the {MsgDataTypes.BridgeSendType.Liquidity}.
* @param _message Arbitrary message bytes to be decoded by the destination app contract.
* If message is empty, only the token transfer will be sent
* @param _bridgeSendType One of the {BridgeSendType} enum.
* @para... | 5,325 |
12 | // This function should be called only by account with MANAGE_GROUPS permissions_groupName name of the group in storage_a address which will be removed from the group with name _groupNamethis function remove address _a from group name with name _groupName in storage/ | function removeGroupMember(string _groupName, address _a) public isCanDoOrByOwner(MANAGE_GROUPS) {
emit DaoBaseRemoveGroupMember(_groupName, _a);
daoStorage.removeGroupMember(stringHash(_groupName), _a);
}
| function removeGroupMember(string _groupName, address _a) public isCanDoOrByOwner(MANAGE_GROUPS) {
emit DaoBaseRemoveGroupMember(_groupName, _a);
daoStorage.removeGroupMember(stringHash(_groupName), _a);
}
| 10,288 |
24 | // contracts/interfaces/ILoanFactory.sol/ pragma solidity 0.6.11; / | interface ILoanFactory {
function CL_FACTORY() external view returns (uint8);
function FL_FACTORY() external view returns (uint8);
function INTEREST_CALC_TYPE() external view returns (uint8);
function LATEFEE_CALC_TYPE() external view returns (uint8);
function PREMIUM_CALC_TYPE() external view ... | interface ILoanFactory {
function CL_FACTORY() external view returns (uint8);
function FL_FACTORY() external view returns (uint8);
function INTEREST_CALC_TYPE() external view returns (uint8);
function LATEFEE_CALC_TYPE() external view returns (uint8);
function PREMIUM_CALC_TYPE() external view ... | 6,359 |
34 | // To exclude division by zero There is a check for a non zero eend.allWhiteCollateral above Cell 26 | eend.whiteCoefficient = wdiv(eend.allBlackCollateral, eend.allWhiteCollateral);
emit WhiteCefficient(eend.whiteCoefficient);
| eend.whiteCoefficient = wdiv(eend.allBlackCollateral, eend.allWhiteCollateral);
emit WhiteCefficient(eend.whiteCoefficient);
| 26,205 |
105 | // This amount must be determined before arNxm burn. | uint256 wNxmAmount = wNxmValue(_arAmount);
| uint256 wNxmAmount = wNxmValue(_arAmount);
| 20,034 |
1 | // Mint statuses. | enum Status {
Paused,
Whitelist,
Mintpass,
Public
}
| enum Status {
Paused,
Whitelist,
Mintpass,
Public
}
| 40,738 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.