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 |
|---|---|---|---|---|
26 | // TEAM | walletsLocking[TEAM].directRelease = true;
walletsLocking[TEAM].lockedTokens = 1303625 * 10 ** (decimals);
walletsLocking[TEAM].cliff = block.timestamp.add(365 days);
| walletsLocking[TEAM].directRelease = true;
walletsLocking[TEAM].lockedTokens = 1303625 * 10 ** (decimals);
walletsLocking[TEAM].cliff = block.timestamp.add(365 days);
| 41,467 |
11 | // Verify the merkle proof. | bytes32 node = keccak256(abi.encodePacked(_msgSender()));
require(
MerkleProof.verify(proof, communityMerkleRoot, node),
"MerkleDistributor: Invalid proof."
);
if (block.timestamp < preMintLimitDate) {
require(
... | bytes32 node = keccak256(abi.encodePacked(_msgSender()));
require(
MerkleProof.verify(proof, communityMerkleRoot, node),
"MerkleDistributor: Invalid proof."
);
if (block.timestamp < preMintLimitDate) {
require(
... | 31,058 |
3 | // Private method is used instead of inlining into modifier because modifiers are copied into each method,/ and the use of immutable means the address bytes are copied in every place the modifier is used. | function checkNotDelegateCall() private view {
require(address(this) == original);
}
| function checkNotDelegateCall() private view {
require(address(this) == original);
}
| 4,281 |
41 | // Get total special pending transaction/ | function getTotalPendingTxs() internal view returns (uint32) {
uint32 count;
TransactionState txState = TransactionState.Pending;
for(uint256 i = 0; i < specialTransactions.length; i++) {
if(specialTransactions[i].state == txState)
count++;
}
retur... | function getTotalPendingTxs() internal view returns (uint32) {
uint32 count;
TransactionState txState = TransactionState.Pending;
for(uint256 i = 0; i < specialTransactions.length; i++) {
if(specialTransactions[i].state == txState)
count++;
}
retur... | 6,993 |
254 | // there is no point to do the ratio math as we can just get the difference between current obtained tokens and initial obtained tokens | if (results.obtainedDai > user.amountDai) {
results.feeableDai = results.obtainedDai.sub(user.amountDai);
}
| if (results.obtainedDai > user.amountDai) {
results.feeableDai = results.obtainedDai.sub(user.amountDai);
}
| 14,495 |
5 | // Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled/A fee amount can never be removed, so this value should be hard coded or cached in the calling context/fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee/ return The tick spacing | function feeAmountTickSpacing(uint24 fee) external view returns (int24);
| function feeAmountTickSpacing(uint24 fee) external view returns (int24);
| 25,061 |
12 | // Set the dao users accunt id/ | function setDAOUserAccountId(address _addr, string memory _accountId) external onlyOwner {
daoUsers[_addr].accountId = _accountId;
}
| function setDAOUserAccountId(address _addr, string memory _accountId) external onlyOwner {
daoUsers[_addr].accountId = _accountId;
}
| 32,899 |
4 | // Accepts new implementation of comptroller. msg.sender must be pendingImplementation Admin function for new implementation to accept it's role as implementationreturn uint 0=success, otherwise a failure (see ErrorReporter.sol for details) / | function _acceptImplementation() external returns (uint256);
| function _acceptImplementation() external returns (uint256);
| 23,541 |
31 | // allows owner to change the locked balance of a recipient manually. _owner is the address of the locked token balance to unlock. _unlockedTokens is the amount of locked tokens to unlock. / | function changeLockedBalanceManually(address _owner, uint256 _unlockedTokens) external onlyOwner {
require(_owner != address(0));
require(_unlockedTokens <= lockedTokenBalance[_owner]);
require(isHoldingLockedTokens[_owner]);
require(!excludedFromTokenUnlock[_owner]);
... | function changeLockedBalanceManually(address _owner, uint256 _unlockedTokens) external onlyOwner {
require(_owner != address(0));
require(_unlockedTokens <= lockedTokenBalance[_owner]);
require(isHoldingLockedTokens[_owner]);
require(!excludedFromTokenUnlock[_owner]);
... | 44,235 |
12 | // containerStatus | function containerStatus(address packageId) public view returns (string memory) {
return packages[packageId].transitStatus;
}
| function containerStatus(address packageId) public view returns (string memory) {
return packages[packageId].transitStatus;
}
| 27,892 |
7 | // Moves `value` AnyswapV3ERC20 token from caller's account to account (`to`),/ after which a call is executed to an ERC677-compliant contract with the `data` parameter./ A transfer to `address(0)` triggers an ERC-20 withdraw matching the sent AnyswapV3ERC20 token in favor of caller./ Emits {Transfer} event./ Returns b... | function transferAndCall(address to, uint value, bytes calldata data) external returns (bool);
| function transferAndCall(address to, uint value, bytes calldata data) external returns (bool);
| 4,700 |
100 | // Withdraw slashed tokens.amount The amount to withdraw / | function withdrawSlashedTokens(uint256 amount) external adminOnly {
require(
amount <= slashedTokenAmount,
'Withdraw amount exceeds slashed token amount'
);
EIP20Interface token = EIP20Interface(stakedTokenAddress);
slashedTokenAmount = slashedTokenAmount.sub(... | function withdrawSlashedTokens(uint256 amount) external adminOnly {
require(
amount <= slashedTokenAmount,
'Withdraw amount exceeds slashed token amount'
);
EIP20Interface token = EIP20Interface(stakedTokenAddress);
slashedTokenAmount = slashedTokenAmount.sub(... | 9,965 |
7 | // Removes expired limit orders _orderIds The array of order IDs to remove. / | function cancelExpiredLimitOrders(uint256[] calldata _orderIds) external;
| function cancelExpiredLimitOrders(uint256[] calldata _orderIds) external;
| 8,169 |
3 | // How many tokens to mint | uint256 amount;
| uint256 amount;
| 4,809 |
67 | // refund non compliant member | // @param _contributor {address} of refunded contributor
function refundNonCompliant(address _contributor) payable external onlyOwner() {
Backer storage backer = backers[_contributor];
require (!backer.claimed); // check if tokens have been allocated already
require (!backer.refund... | // @param _contributor {address} of refunded contributor
function refundNonCompliant(address _contributor) payable external onlyOwner() {
Backer storage backer = backers[_contributor];
require (!backer.claimed); // check if tokens have been allocated already
require (!backer.refund... | 35,644 |
59 | // Enables approvals on behalf (permits via an EIP712 signature) Feature FEATURE_PERMITS must be enabled in order for `permit()` function to succeed / | uint32 public constant FEATURE_PERMITS = 0x0000_0200;
| uint32 public constant FEATURE_PERMITS = 0x0000_0200;
| 50,341 |
32 | // Decode an Item into a byte. This will not work if the/ Item is a list./self The Item./ return The decoded string. | function toByte(Item memory self) internal pure returns (byte) {
require(isData(self), "Rlp.sol:Rlp:toByte:1");
(uint256 rStartPos, uint256 len) = _decode(self);
require(len == 1, "Rlp.sol:Rlp:toByte:3");
byte temp;
assembly {
temp := byte(0, mload(rStartPos))
}
return byte(temp);
}
| function toByte(Item memory self) internal pure returns (byte) {
require(isData(self), "Rlp.sol:Rlp:toByte:1");
(uint256 rStartPos, uint256 len) = _decode(self);
require(len == 1, "Rlp.sol:Rlp:toByte:3");
byte temp;
assembly {
temp := byte(0, mload(rStartPos))
}
return byte(temp);
}
| 37,460 |
24 | // require(block.timestamp>NumberStatus[number].endTime, "invalid time"); | uint buyTeam1count;
uint buyTeam2count;
uint buyTeam3count;
uint allCount;
uint winAmount;
uint lostAmount;
| uint buyTeam1count;
uint buyTeam2count;
uint buyTeam3count;
uint allCount;
uint winAmount;
uint lostAmount;
| 7,244 |
12 | // Check pool if exist | mapping (address => bool) public poolExist;
| mapping (address => bool) public poolExist;
| 48,757 |
391 | // Holds account level context information used to determine settlement and/ free collateral actions. Total storage is 28 bytes | struct AccountContext {
// Used to check when settlement must be triggered on an account
uint40 nextSettleTime;
// For lenders that never incur debt, we use this flag to skip the free collateral check.
bytes1 hasDebt;
// Length of the account's asset array
uint8 assetArrayLength;
// If this ... | struct AccountContext {
// Used to check when settlement must be triggered on an account
uint40 nextSettleTime;
// For lenders that never incur debt, we use this flag to skip the free collateral check.
bytes1 hasDebt;
// Length of the account's asset array
uint8 assetArrayLength;
// If this ... | 10,903 |
82 | // increase counter | collateralCounter++;
| collateralCounter++;
| 49,693 |
30 | // An event emitted when a proposal has been executed | event ProposalExecuted(uint id, uint eta);
| event ProposalExecuted(uint id, uint eta);
| 24,455 |
179 | // Buffer of assets to keep in Vault to handle (most) withdrawals | uint256 public vaultBuffer;
| uint256 public vaultBuffer;
| 5,221 |
2 | // The information related to an offer on a direct listing at a location. The type of the listing at ID `lisingId` determins how the `Offer` is interpreted. If the listing is of type `Loctok`, the `Offer` is interpreted as an offer to a direct listing at a google plus code location. listingIdThe uid of the listing the ... | struct Offer {
uint256 listingId;
address offeror;
uint256 quantityWanted;
address currency;
uint256 pricePerToken;
uint256 expirationTimestamp;
string plusCode;
}
| struct Offer {
uint256 listingId;
address offeror;
uint256 quantityWanted;
address currency;
uint256 pricePerToken;
uint256 expirationTimestamp;
string plusCode;
}
| 22,877 |
40 | // Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.Beware that changing an allowance with this method brings the risk that someone may use both the oldand the new allowance by unfortunate transaction ordering. One possible solution to mitigate thisrace condition is to first re... | function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
require(!frozen[_spender] && !frozen[msg.sender], "address frozen");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
require(!frozen[_spender] && !frozen[msg.sender], "address frozen");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
| 26,979 |
62 | // Return whether a tokenId is for an original tokenId The original NFT token id / | function isSeedId(uint256 tokenId) public pure returns (bool) {
return tokenId & PRINTS_FLAG_BIT != PRINTS_FLAG_BIT;
}
| function isSeedId(uint256 tokenId) public pure returns (bool) {
return tokenId & PRINTS_FLAG_BIT != PRINTS_FLAG_BIT;
}
| 6,220 |
117 | // Fallback function to return money to reward distributer via pool deployer In case of issues or incorrect calls or errors | function refund(uint256 amount, address refundAddress) public onlyOwner {
require(IERC20(rewardsToken).balanceOf(address(this)) >= amount, "StakingRewardsFactory::refund: Not enough tokens");
IERC20(rewardsToken).safeTransfer(refundAddress, amount);
}
| function refund(uint256 amount, address refundAddress) public onlyOwner {
require(IERC20(rewardsToken).balanceOf(address(this)) >= amount, "StakingRewardsFactory::refund: Not enough tokens");
IERC20(rewardsToken).safeTransfer(refundAddress, amount);
}
| 24,347 |
6 | // Registers the contract as an implementer of the interface defined by`interfaceId`. Support of the actual ERC165 interface is automatic andregistering its interface id is not required. See `IERC165.supportsInterface`. Requirements: - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). / | function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
| function _registerInterface(bytes4 interfaceId) internal {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
| 35,177 |
56 | // See {IERC721CreatorCore-tokenExtension}. / | function tokenExtension(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "Nonexistent token");
return _tokenExtension(tokenId);
}
| function tokenExtension(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "Nonexistent token");
return _tokenExtension(tokenId);
}
| 24,647 |
16 | // Return the time limit between interaction with the faucetreturn number of seconds (timestamp) / | function getTimeLimit() public view returns (uint256) {
return faucetTimeLimit;
}
| function getTimeLimit() public view returns (uint256) {
return faucetTimeLimit;
}
| 41,501 |
8 | // User calls here to claim rewards from a token launch. Sends a user their share of rewards. _user Address of the user to claim rewards for. _tokens An array of tokens to claim rewards from. _timePoints An array of timepoints the rewards were launched at. / | ) external {
for (uint256 i = 0; i < _tokens.length; i++) {
require(
!claimed[_user][_tokens[i]][_timePoints[i]],
"Reward already claimed."
);
// Vesting for airdrops is 30 days and 216000 in blocks.
require(
_t... | ) external {
for (uint256 i = 0; i < _tokens.length; i++) {
require(
!claimed[_user][_tokens[i]][_timePoints[i]],
"Reward already claimed."
);
// Vesting for airdrops is 30 days and 216000 in blocks.
require(
_t... | 8,188 |
8 | // Allows `spender` to spend the tokens owned by _msgSender() spender The user allowed to spend _msgSender() tokensreturn `true` / | function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| 18,650 |
102 | // Set reward amount _amount uint256 / | function setRewardsVar(uint256 _amount) public _onlyOwner {
rewardsVar = _amount;
}
| function setRewardsVar(uint256 _amount) public _onlyOwner {
rewardsVar = _amount;
}
| 30,421 |
59 | // Get address of this smart contract. return address of this smart contract / | function thisAddress () internal view returns (address) {
return this;
}
| function thisAddress () internal view returns (address) {
return this;
}
| 45,982 |
152 | // Get where last block the voter staked was._voter Address of the voter./ | function getVoterBlockStaked(address _voter) delegatedOnly public view returns(uint256) {
return userStake[_voter].blockStaked;
}
| function getVoterBlockStaked(address _voter) delegatedOnly public view returns(uint256) {
return userStake[_voter].blockStaked;
}
| 25,599 |
86 | // Funders who took part in the crowdfund could have reserved tokens | uint256 reservedHolos = whitelistContract.reservedTokens(beneficiary, dayIndex);
| uint256 reservedHolos = whitelistContract.reservedTokens(beneficiary, dayIndex);
| 39,753 |
34 | // address where funds are collected address where tokens are deposited and from where we send tokens to buyers | address public walletOwner;
Stakeholder stakeholderObj;
uint256 public coinPercentage = 5;
| address public walletOwner;
Stakeholder stakeholderObj;
uint256 public coinPercentage = 5;
| 39,726 |
7 | // Total number of adventurers staked | uint256 public totalAdventurersStaked = 0;
| uint256 public totalAdventurersStaked = 0;
| 29,111 |
906 | // Treasury (10%, initially) | uint256 public treasuryPercentage = 10;
address public governance;
| uint256 public treasuryPercentage = 10;
address public governance;
| 51,049 |
17 | // Event emitted when the community grant period ends. / | event CommunityGrantEnds();
| event CommunityGrantEnds();
| 28,176 |
461 | // Write the _preBytes data into the tempBytes memory 32 bytes at a time. | mstore(mc, mload(cc))
| mstore(mc, mload(cc))
| 4,202 |
0 | // Quinary tree zeros (0) | constructor() {
zeros[0] = uint256(0);
zeros[1] = uint256(14655542659562014735865511769057053982292279840403315552050801315682099828156);
zeros[2] = uint256(19261153649140605024552417994922546473530072875902678653210025980873274131905);
zeros[3] = uint256(2152650355832506866403319238... | constructor() {
zeros[0] = uint256(0);
zeros[1] = uint256(14655542659562014735865511769057053982292279840403315552050801315682099828156);
zeros[2] = uint256(19261153649140605024552417994922546473530072875902678653210025980873274131905);
zeros[3] = uint256(2152650355832506866403319238... | 23,470 |
1 | // WARN: Always remember to change the 'hash' function if modifying the struct | struct Payload {
uint256 nonce;
uint256 executionTime;
address submitter;
IERC3000Executor executor;
Action[] actions;
bytes32 allowFailuresMap;
bytes proof;
}
| struct Payload {
uint256 nonce;
uint256 executionTime;
address submitter;
IERC3000Executor executor;
Action[] actions;
bytes32 allowFailuresMap;
bytes proof;
}
| 40,643 |
34 | // Pool stuff There are a few notable items in how minting works 1) if ADX is sent to the LoyaltyPool in-between mints, it will calculate the incentive as if this amount has been there the whole time since the last mint 2) Compounding is happening when mint is called, so essentially when entities enter/leave/trigger it... | function toMint() external view returns (uint) {
if (block.timestamp <= lastMintTime) return 0;
uint totalADX = ADXToken.balanceOf(address(this));
return (block.timestamp - lastMintTime)
.mul(totalADX)
.mul(incentivePerTokenPerAnnum)
.div(365 days * 10e17);
}
| function toMint() external view returns (uint) {
if (block.timestamp <= lastMintTime) return 0;
uint totalADX = ADXToken.balanceOf(address(this));
return (block.timestamp - lastMintTime)
.mul(totalADX)
.mul(incentivePerTokenPerAnnum)
.div(365 days * 10e17);
}
| 46,547 |
41 | // Get the address of the staker (if set)/ return staker address of the staker | function getStaker() public view returns (address staker) {
return _data.staker;
}
| function getStaker() public view returns (address staker) {
return _data.staker;
}
| 17,960 |
101 | // Prevent having debt represented by positive values | if (position.borrowedAmount.value == 0) {
position.borrowedAmount.sign = false;
}
| if (position.borrowedAmount.value == 0) {
position.borrowedAmount.sign = false;
}
| 13,318 |
55 | // Get the active data list that is associated with a CID NFT / Subprotocol/_cidNFTID ID of the CID NFT to query/_subprotocolName Name of the subprotocol to query/ return subprotocolNFTIDs The ID of the primary NFT at the queried subprotocl / CID NFT. 0 if it does not exist | function getActiveData(uint256 _cidNFTID, string calldata _subprotocolName)
external
view
returns (uint256[] memory subprotocolNFTIDs)
| function getActiveData(uint256 _cidNFTID, string calldata _subprotocolName)
external
view
returns (uint256[] memory subprotocolNFTIDs)
| 9,735 |
308 | // if no more selectors for facet address then delete the facet address | if (lastSelectorPosition == 0) {
| if (lastSelectorPosition == 0) {
| 46,315 |
188 | // Transfer stablecoins back to the sender | IERC20(underlyingCoin).safeTransfer(_msgSender(), underlyingCoinAmount);
| IERC20(underlyingCoin).safeTransfer(_msgSender(), underlyingCoinAmount);
| 11,706 |
17 | // Returns the downcasted uint144 from uint256, reverting onoverflow (when the input is greater than largest uint144). Counterpart to Solidity's `uint144` operator. Requirements: - input must fit into 144 bits / | function toUint144(uint256 value) internal pure returns (uint144) {
if (value > type(uint144).max) {
revert SafeCastOverflowedUintDowncast(144, value);
}
return uint144(value);
}
| function toUint144(uint256 value) internal pure returns (uint144) {
if (value > type(uint144).max) {
revert SafeCastOverflowedUintDowncast(144, value);
}
return uint144(value);
}
| 37,566 |
365 | // Curve 3Coins base strategy / | abstract contract CurveStrategy3CoinsBase is CurveStrategyBase {
using SafeERC20 for IERC20;
/* ========== CONSTANT VARIABLES ========== */
/// @notice Total number of coins
uint256 internal constant TOTAL_COINS = 3;
/* ========== STATE VARIABLES ========== */
/// @notice Stable swap pool
... | abstract contract CurveStrategy3CoinsBase is CurveStrategyBase {
using SafeERC20 for IERC20;
/* ========== CONSTANT VARIABLES ========== */
/// @notice Total number of coins
uint256 internal constant TOTAL_COINS = 3;
/* ========== STATE VARIABLES ========== */
/// @notice Stable swap pool
... | 34,362 |
87 | // Note that _ownedTokensIndex[tokenId] hasn't been cleared: it still points to the old slot (now occupied bylastTokenId, or just over the end of the array if the token was the last one). | }
| }
| 40,771 |
71 | // Pausable token ERC20 modified with pausable transfers. / | contract ERC20Pausable is ERC20, Pausable {
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
return super.transfer(to, value);
}
function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
return super.transferFrom(f... | contract ERC20Pausable is ERC20, Pausable {
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
return super.transfer(to, value);
}
function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
return super.transferFrom(f... | 27,195 |
1 | // Note: double_t(1, 5) will be 1.05 but double_t(1, 50) will be 1.5example:import "multiprecision.sol";contract Test is Double | * {
* function test() internal
* {
* double memory a = double_t(1, 20); // 1.20
* double memory b = double_t(0, 2); // 0.02
* double memory result = double_add(a, b); // 1.22
*
* a = double_t(2, 0); // 2.00
* b = do... | * {
* function test() internal
* {
* double memory a = double_t(1, 20); // 1.20
* double memory b = double_t(0, 2); // 0.02
* double memory result = double_add(a, b); // 1.22
*
* a = double_t(2, 0); // 2.00
* b = do... | 52,856 |
22 | // set epoch claimed to current - 1 | epochClaimed[msg.sender] = _epochNum() - 1;
require(totalClaimable > 0, "NOTHING_TO_CLAIM");
| epochClaimed[msg.sender] = _epochNum() - 1;
require(totalClaimable > 0, "NOTHING_TO_CLAIM");
| 29,549 |
19 | // Calculate how much other token we need to transfer. | uint otToSend = (_numShares * otherTokenReserve) / totalShareSupply;
| uint otToSend = (_numShares * otherTokenReserve) / totalShareSupply;
| 49,340 |
55 | // Performs a direct listing sale. | function executeSale(
Listing memory _targetListing,
address _payer,
address _receiver,
address _currency,
uint256 _currencyAmountToTransfer,
uint256 _listingTokenAmountToTransfer
| function executeSale(
Listing memory _targetListing,
address _payer,
address _receiver,
address _currency,
uint256 _currencyAmountToTransfer,
uint256 _listingTokenAmountToTransfer
| 5,901 |
4 | // returns 0.01 value in United States Dollar | function USD(uint _id) public view returns (uint256) {
return tokens[_id].usd;
}
| function USD(uint _id) public view returns (uint256) {
return tokens[_id].usd;
}
| 36,308 |
270 | // Mints tokens to an address in batch using an ERC-20 token for payment fee may or may not be required_to address of the future owner of the token_amount number of tokens to mint_erc20TokenContract erc-20 token contract to mint with/ | function mintToMultipleERC20(address _to, uint256 _amount, address _erc20TokenContract) public payable {
if(_amount == 0) revert MintZeroQuantity();
if(_amount > maxBatchSize) revert TransactionCapExceeded();
if(!mintingOpen) revert PublicMintClosed();
if(mintWillExceedCap(_amount)) revert CapExceeded... | function mintToMultipleERC20(address _to, uint256 _amount, address _erc20TokenContract) public payable {
if(_amount == 0) revert MintZeroQuantity();
if(_amount > maxBatchSize) revert TransactionCapExceeded();
if(!mintingOpen) revert PublicMintClosed();
if(mintWillExceedCap(_amount)) revert CapExceeded... | 23,177 |
229 | // Following conditions need to be met if the user is borrowing at a stable rate:1. Reserve must be enabled for stable rate borrowing2. Users cannot borrow from the reserve if their collateral is (mostly) the same currency they are borrowing, to prevent abuses.3. Users will be able to borrow only a portion of the total... |
require(vars.stableRateBorrowingEnabled, Errors.VL_STABLE_BORROWING_NOT_ENABLED);
require(
!userConfig.isUsingAsCollateral(reserve.id) ||
reserve.configuration.getLtv() == 0 ||
amount > IERC20(reserve.aTokenAddress).balanceOf(userAddress),
Errors.VL_COLLATERAL_SAME_AS_B... |
require(vars.stableRateBorrowingEnabled, Errors.VL_STABLE_BORROWING_NOT_ENABLED);
require(
!userConfig.isUsingAsCollateral(reserve.id) ||
reserve.configuration.getLtv() == 0 ||
amount > IERC20(reserve.aTokenAddress).balanceOf(userAddress),
Errors.VL_COLLATERAL_SAME_AS_B... | 24,984 |
6 | // Owned - Add an owner to the contract. | contract Owned {
address public owner = msg.sender;
address public potentialOwner;
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier onlyPotentialOwner {
require(msg.sender == potentialOwner);
_;
}
event NewOwner(address old, address current);
event NewPotentialOwner(address old, addr... | contract Owned {
address public owner = msg.sender;
address public potentialOwner;
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier onlyPotentialOwner {
require(msg.sender == potentialOwner);
_;
}
event NewOwner(address old, address current);
event NewPotentialOwner(address old, addr... | 18,922 |
0 | // keep track of liquidations | function incrementLiquidations(DataTypes.UserConfigurationMap storage self) internal {
uint256 oldLiquidations = self.liquidations;
self.liquidations = 1 + oldLiquidations; //needs safemath
}
| function incrementLiquidations(DataTypes.UserConfigurationMap storage self) internal {
uint256 oldLiquidations = self.liquidations;
self.liquidations = 1 + oldLiquidations; //needs safemath
}
| 21,424 |
9 | // KILL ANIMAL | AnimalsWorld loser = AnimalsWorld(_loserAddress);
loser.deadAnimal(_loserAnimal); // Might not work if it is not called from the animal owner address
return returnedMessage;
| AnimalsWorld loser = AnimalsWorld(_loserAddress);
loser.deadAnimal(_loserAnimal); // Might not work if it is not called from the animal owner address
return returnedMessage;
| 12,884 |
17 | // Decodes debt information encoded in the flash loan params params Additional variadic field to include extra params. Expected parameters:address collateralAsset Address of the reserve to be swappeduint256 collateralAmount Amount of reserve to be swappeduint256 rateMode Rate modes of the debt to be repaiduint256 permi... | function _decodeParams(bytes memory params) internal pure returns (RepayParams memory) {
(
address collateralAsset,
uint256 collateralAmount,
uint256 rateMode,
uint256 permitAmount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s,
bool useEthPath
) =
... | function _decodeParams(bytes memory params) internal pure returns (RepayParams memory) {
(
address collateralAsset,
uint256 collateralAmount,
uint256 rateMode,
uint256 permitAmount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s,
bool useEthPath
) =
... | 517 |
37 | // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length, 0x02 bytes for the prefix, and 0x40 bytes for the digits. The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x40) is 0xa0. | let m := add(start, 0xa0)
| let m := add(start, 0xa0)
| 16,167 |
21 | // pool index => swap amount of token1 | mapping(uint => uint) public amountSwap1P;
| mapping(uint => uint) public amountSwap1P;
| 44,681 |
73 | // Gets the owner of the specified token ID _tokenId uint256 ID of the token to query the owner ofreturn owner address currently marked as the owner of the given token ID / | function ownerOf(uint256 _tokenId) public view returns (address) {
address owner = tokenOwner[_tokenId];
require(owner != address(0));
return owner;
}
| function ownerOf(uint256 _tokenId) public view returns (address) {
address owner = tokenOwner[_tokenId];
require(owner != address(0));
return owner;
}
| 1,399 |
86 | // if the participant previously sent ETH, return it |
if (initialParticipantValue > 0) {
address(_recipient).transfer(initialParticipantValue);
}
|
if (initialParticipantValue > 0) {
address(_recipient).transfer(initialParticipantValue);
}
| 18,252 |
60 | // Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.The call is not executed if the target address is not a contract.from address representing the previous owner of the given token ID to target address that will receive the tokens tokenId uint256 ID of the token to be transferred _data... | function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data)
returns (bytes4 retval) {
| function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data)
returns (bytes4 retval) {
| 7,450 |
241 | // solhint-disable-next-line payable-fallback,no-complex-fallback | fallback() external {
bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
let handler := sload(slot)
if iszero(handler) {
return(0, 0)
}
calldatacopy(0, 0, calldatasize())
... | fallback() external {
bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
let handler := sload(slot)
if iszero(handler) {
return(0, 0)
}
calldatacopy(0, 0, calldatasize())
... | 26,757 |
2 | // Public constructor / | constructor() public payable Controlled() {}
/**
* @notice Allow receives
*/
receive()
external
payable
{
//
}
| constructor() public payable Controlled() {}
/**
* @notice Allow receives
*/
receive()
external
payable
{
//
}
| 4,237 |
2 | // if the service '_service' is not a registered service | if (!isService(_service)) {
_;
}
| if (!isService(_service)) {
_;
}
| 45,380 |
169 | // If v is 1 then it is an approved hash When handling approved hashes the address of the approver is encoded into r | currentOwner = address(uint160(uint256(r)));
| currentOwner = address(uint160(uint256(r)));
| 26,157 |
19 | // Checks if the pool address was created in this smart contract/ | function isPool(address pool) external view returns (bool valid) {
return _pools.contains(pool);
}
| function isPool(address pool) external view returns (bool valid) {
return _pools.contains(pool);
}
| 18,211 |
1 | // Include an address to specify the immutable WitnetRequestBoard entrypoint address./_wrb The WitnetRequestBoard immutable entrypoint address. | constructor(WitnetRequestBoard _wrb)
UsingWitnet(_wrb)
| constructor(WitnetRequestBoard _wrb)
UsingWitnet(_wrb)
| 41,934 |
618 | // amount: promised amount of stars | uint16 amount;
| uint16 amount;
| 2,311 |
239 | // Emits an {SchainCreated} event.Requirements:- Schain type is valid.- There is sufficient deposit to create type of schain. / | function addSchain(address from, uint deposit, bytes calldata data) external allow("SkaleManager") {
| function addSchain(address from, uint deposit, bytes calldata data) external allow("SkaleManager") {
| 57,287 |
459 | // See {IGovernorCompatibilityBravo-proposals}. / | function proposals(uint256 proposalId)
public
view
virtual
override
returns (
uint256 id,
address proposer,
uint256 eta,
uint256 startBlock,
| function proposals(uint256 proposalId)
public
view
virtual
override
returns (
uint256 id,
address proposer,
uint256 eta,
uint256 startBlock,
| 20,269 |
39 | // Init rates contract. addr Address of deployed rates contract. / | function setRatesContract(address addr) onlyOwner public{
require(addr != address(0), "Contract address cannot be null");
rates = ETHUSDRate(addr);
}
| function setRatesContract(address addr) onlyOwner public{
require(addr != address(0), "Contract address cannot be null");
rates = ETHUSDRate(addr);
}
| 3,373 |
44 | // Brainz Token representing Brainz. / | contract StoboxToken is BurnableToken {
string public name;
string public symbol;
uint8 public decimals = 18;
/**
* @dev users sending ether to this contract will be reverted. Any ether sent to the contract will be sent back to the caller
*/
function() external payable {
revert("Cannot send Ether ... | contract StoboxToken is BurnableToken {
string public name;
string public symbol;
uint8 public decimals = 18;
/**
* @dev users sending ether to this contract will be reverted. Any ether sent to the contract will be sent back to the caller
*/
function() external payable {
revert("Cannot send Ether ... | 11,371 |
86 | // 持有者的份额 | uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100;
| uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100;
| 73,496 |
11 | // ERC20Basic Simpler version of ERC20 interface / | contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}/**
| contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}/**
| 39,109 |
136 | // mint shares at current rate | uint256 lockedTokens = totalLocked();
uint256 mintedLockedShares = (lockedTokens > 0)
? totalLockedShares.mul(amount).div(lockedTokens)
: amount.mul(INITIAL_SHARES_PER_TOKEN);
totalLockedShares = totalLockedShares.add(mintedLockedShares);
| uint256 lockedTokens = totalLocked();
uint256 mintedLockedShares = (lockedTokens > 0)
? totalLockedShares.mul(amount).div(lockedTokens)
: amount.mul(INITIAL_SHARES_PER_TOKEN);
totalLockedShares = totalLockedShares.add(mintedLockedShares);
| 34,142 |
25 | // grants controller role to address/pcvController new controller | function grantPCVController(address pcvController)
external
override
onlyGovernor
| function grantPCVController(address pcvController)
external
override
onlyGovernor
| 41,966 |
199 | // contract metadata URI for opensea | string public contractURI;
| string public contractURI;
| 13,121 |
22 | // Function to remove addresses from the excluded list for paying fees (only callable by the contract owner) | function includeInFees(address account) external onlyOwner {
require(account != address(0), "Invalid address");
_excludedFromFees[account] = false;
}
| function includeInFees(address account) external onlyOwner {
require(account != address(0), "Invalid address");
_excludedFromFees[account] = false;
}
| 42,006 |
6 | // Remove account into blacklist, only blacklist admin can do this | function removeBlacklisted(address account) public onlyBlacklistAdmin {
_removeBlacklisted(account);
}
| function removeBlacklisted(address account) public onlyBlacklistAdmin {
_removeBlacklisted(account);
}
| 4,967 |
13 | // if anyone votes no, there will be no consensus in the end | if (!agree) {
tasks[taskId].nonconsensus = true;
votedMap[taskId][msg.sender] = 2; // 2 maps to no
} else {
| if (!agree) {
tasks[taskId].nonconsensus = true;
votedMap[taskId][msg.sender] = 2; // 2 maps to no
} else {
| 47,075 |
95 | // Token Operator should be able to do auto renewal | modifier allowSubmission() {
require(
now >= stakeMap[currentStakeMapIndex].startPeriod &&
now <= stakeMap[currentStakeMapIndex].submissionEndPeriod &&
stakeMap[currentStakeMapIndex].openForExternal == true,
"Staking at this point not allowed"
... | modifier allowSubmission() {
require(
now >= stakeMap[currentStakeMapIndex].startPeriod &&
now <= stakeMap[currentStakeMapIndex].submissionEndPeriod &&
stakeMap[currentStakeMapIndex].openForExternal == true,
"Staking at this point not allowed"
... | 51,470 |
8 | // Cancels an initiated dispute process/Escrow is identified by a message = keccak256(_tradeRecordId, _seller, _buyer)/Seller and buyer shoud sign hash of (message, escrow address, msg.sig, _expireAtBlock, _salt) data/_tradeRecordId identifier of escrow record/_seller who will mainly deposit to escrow/_buyer who will e... | function cancelDispute(
bytes32 _tradeRecordId,
address _seller,
address _buyer,
uint _expireAtBlock,
uint _salt,
bytes _signature
) external returns (uint);
| function cancelDispute(
bytes32 _tradeRecordId,
address _seller,
address _buyer,
uint _expireAtBlock,
uint _salt,
bytes _signature
) external returns (uint);
| 44,381 |
81 | // Can only be triggered by owner or governance | TransferHelper.safeTransfer(tokenAddress, owner, tokenAmount);
emit Recovered(tokenAddress, tokenAmount);
| TransferHelper.safeTransfer(tokenAddress, owner, tokenAmount);
emit Recovered(tokenAddress, tokenAmount);
| 3,521 |
0 | // add a state variable to hold your baseURI | string private _baseTokenURI;
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps,
address _primarySaleRecipient,
string memory _initialBaseURI
)
| string private _baseTokenURI;
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps,
address _primarySaleRecipient,
string memory _initialBaseURI
)
| 18,098 |
35 | // Resize the patientEHRs array to remove empty slots | assembly {
mstore(patientEHRs, count)
}
| assembly {
mstore(patientEHRs, count)
}
| 23,988 |
11 | // _name = "VYFI.Finance";_symbol = "VYFI"; | _name = "VYFI.Finance";
_symbol = "VYFI";
_decimals = 18;
_totalSupply = 10000000000000000000000;
_balances[creator()] = _totalSupply;
emit Transfer(address(0), creator(), _totalSupply);
| _name = "VYFI.Finance";
_symbol = "VYFI";
_decimals = 18;
_totalSupply = 10000000000000000000000;
_balances[creator()] = _totalSupply;
emit Transfer(address(0), creator(), _totalSupply);
| 11,607 |
90 | // Fallback function allowing to perform a delegatecall to the given implementation. This function will return whatever the implementation call returns / | function () payable external {
address impl = implementation;
require(impl != address(0));
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, 0, calldatasize)
let result := delegatecall(gas, impl, ptr, calldatasize, 0, 0)
let size := returndat... | function () payable external {
address impl = implementation;
require(impl != address(0));
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, 0, calldatasize)
let result := delegatecall(gas, impl, ptr, calldatasize, 0, 0)
let size := returndat... | 5,144 |
200 | // // Redistributes the unallocated interest to the saved recipient, allowingthe siphoned assets to be used elsewhere in the system _mAssetmAsset to collect / | function distributeUnallocatedInterest(address _mAsset) external override {
IRevenueRecipient recipient = revenueRecipients[_mAsset];
require(address(recipient) != address(0), "Must have valid recipient");
IERC20 mAsset = IERC20(_mAsset);
uint256 balance = mAsset.balanceOf(address(t... | function distributeUnallocatedInterest(address _mAsset) external override {
IRevenueRecipient recipient = revenueRecipients[_mAsset];
require(address(recipient) != address(0), "Must have valid recipient");
IERC20 mAsset = IERC20(_mAsset);
uint256 balance = mAsset.balanceOf(address(t... | 16,982 |
253 | // Adjust the end block | endBlock += stakingPeriod[currentPhase].periodLengthInBlock;
| endBlock += stakingPeriod[currentPhase].periodLengthInBlock;
| 52,886 |
11 | // if needed remove wrapped | removeToken(_wrapped);
emit UnLend(_wrapped, _amount);
| removeToken(_wrapped);
emit UnLend(_wrapped, _amount);
| 44,017 |
13 | // Disables borrowing on a reserve asset The address of the underlying asset of the reserve / | function disableBorrowingOnReserve(address asset) external onlyPoolAdmin {
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setBorrowingEnabled(false);
pool.setConfiguration(asset, currentConfig.data);
emit BorrowingDisabledOnReserve(asset);
}
| function disableBorrowingOnReserve(address asset) external onlyPoolAdmin {
DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);
currentConfig.setBorrowingEnabled(false);
pool.setConfiguration(asset, currentConfig.data);
emit BorrowingDisabledOnReserve(asset);
}
| 30,534 |
153 | // use market collateral to calculate borrow amount this is done so that supplied can reach _targetSupply 99.99% is borrowed to be safe | uint borrowAmount =
_getBorrowAmount(supplied, borrowed, marketCol).mul(9999) / 10000;
require(borrowAmount > 0, "borrow = 0");
if (supplied.add(borrowAmount) > _targetSupply) {
| uint borrowAmount =
_getBorrowAmount(supplied, borrowed, marketCol).mul(9999) / 10000;
require(borrowAmount > 0, "borrow = 0");
if (supplied.add(borrowAmount) > _targetSupply) {
| 19,490 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.