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 |
|---|---|---|---|---|
71 | // {ERC721Enumerable}.Token name | string private _name;
| string private _name;
| 55,728 |
473 | // add y^09 / 09 - y^10 / 10 | res += (z * (0x08ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8b - y)) / 0x600000000000000000000000000000000;
z = (z * w) / FIXED_1;
| res += (z * (0x08ba2e8ba2e8ba2e8ba2e8ba2e8ba2e8b - y)) / 0x600000000000000000000000000000000;
z = (z * w) / FIXED_1;
| 33,264 |
33 | // get tokens to be distributed between two timestamps scaled by SCALE | function getDistribution(uint256 _from, uint256 _to) public view returns (uint256) {
uint256 from = Math.max(startTime, _from);
uint256 to = Math.min(_to, contractDisabledAt == 0 ? endTime : contractDisabledAt);
if (from > to) return uint256(0);
from = from.sub(startTime);
to = to.sub(startTime);
/* check readme at github.com/1Hive/honeyswap-farm for a breakdown of
the maths */
// d(t1, t2) = (t2 - t1) * (2 * ds - (-m) * (t2 + t1)) / 2
return
to.sub(from).mul(startDistribution.mul(2).sub(distributionSlope.mul(from.add(to)))) / 2;
}
| function getDistribution(uint256 _from, uint256 _to) public view returns (uint256) {
uint256 from = Math.max(startTime, _from);
uint256 to = Math.min(_to, contractDisabledAt == 0 ? endTime : contractDisabledAt);
if (from > to) return uint256(0);
from = from.sub(startTime);
to = to.sub(startTime);
/* check readme at github.com/1Hive/honeyswap-farm for a breakdown of
the maths */
// d(t1, t2) = (t2 - t1) * (2 * ds - (-m) * (t2 + t1)) / 2
return
to.sub(from).mul(startDistribution.mul(2).sub(distributionSlope.mul(from.add(to)))) / 2;
}
| 2,396 |
0 | // setBaseURI(baseURI); | admin = msg.sender;
| admin = msg.sender;
| 26,096 |
56 | // Initializes the contract in unpaused state. Assigns the Pauser roleto the deployer. / | constructor() internal {
_paused = false;
}
| constructor() internal {
_paused = false;
}
| 66,179 |
13 | // 79Possible 9.1 « système bancaire »« National »80Possible 9.2 « système bancaire »« International »81Possible 9.3 « système bancaire »« Holdings-filiales-groupes »82Possible 9.4 « système bancaire »« Système de paiement sphère (i = pro) »83Possible 9.5 « système bancaire »« Système de paiement sphère (ii = v) »84Possible 9.6 « système bancaire »« Système de paiement sphère (iii = neutre) »85Possible 9.7 « système bancaire »« Système d'encaissement sphère (i = pro) »86Possible 9.8 « système bancaire »« Système d'encaissement sphère (ii = v) »87Possible 9.9 « système bancaire »« Système d'encaissement sphère (iii = neutre) »88Possible 9.10 « système | 11,640 | ||
35 | // View function to determine a meta-transaction message hash, and todetermine if it is still valid (i.e. it has not yet been used and is notexpired). The returned message hash will need to be prefixed using EIP-1910x45 and hashed again in order to generate a final digest for the requiredsignature - in other words, the same procedure utilized by `eth_Sign`. functionSelector bytes4 The function selector for the givenmeta-transaction. There is only one function selector available for V1:`0x2d657fa5` (the selector for `modifyAllowanceViaMetaTransaction`). arguments bytes The abi-encoded function arguments (aside from the`expiration`, `salt`, and `signatures` arguments) that should be suppliedto the given function. | function getMetaTransactionMessageHash(
bytes4 functionSelector,
bytes calldata arguments,
uint256 expiration,
bytes32 salt
| function getMetaTransactionMessageHash(
bytes4 functionSelector,
bytes calldata arguments,
uint256 expiration,
bytes32 salt
| 16,756 |
3 | // Token id to Properties | mapping(uint8 => Inventory) public inventoryProperties;
| mapping(uint8 => Inventory) public inventoryProperties;
| 21,058 |
4 | // To simulate the answer submission. | function addAnswerToHistory(
bytes32 _answer_or_commitment_id,
address _answerer,
uint256 _bond,
bool _is_commitment
| function addAnswerToHistory(
bytes32 _answer_or_commitment_id,
address _answerer,
uint256 _bond,
bool _is_commitment
| 20,946 |
15 | // Can be overridden to add finalization logic. The overriding functionshould call super.finalization() to ensure the chain of finalization isexecuted entirely. / | function finalization() internal {
// if we own the token, pass ownership to our owner when finalized
if(address(token) != address(0) && token.owner() == address(this) && owner != address(0)) {
token.transferOwnership(owner);
}
super.finalization();
}
| function finalization() internal {
// if we own the token, pass ownership to our owner when finalized
if(address(token) != address(0) && token.owner() == address(this) && owner != address(0)) {
token.transferOwnership(owner);
}
super.finalization();
}
| 19,105 |
1 | // Events // Variables // Initializers // | * @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
function __ERC20Module_init(
string memory name_,
string memory symbol_,
uint8 decimals_
) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
__ERC20_init(name_, symbol_);
/* own function */
__ERC20Module_init_unchained(decimals_);
}
| * @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
function __ERC20Module_init(
string memory name_,
string memory symbol_,
uint8 decimals_
) internal onlyInitializing {
/* OpenZeppelin */
__Context_init_unchained();
__ERC20_init(name_, symbol_);
/* own function */
__ERC20Module_init_unchained(decimals_);
}
| 31,406 |
15 | // Custom thing / | function customThing(
uint256 nftID,
uint256 id,
string memory what
| function customThing(
uint256 nftID,
uint256 id,
string memory what
| 34,068 |
72 | // Calculates the amount of each component will be returned on redemption net of fees as well as how much debt needs to be paid down to.redeem. Values DO NOT take into account any updates from pre action manager or module hooks._setToken Instance of the SetToken to issue _quantity Amount of Sets to be redeemed return address[]Array of component addresses making up the Setreturn uint256[]Array of equity notional amounts of each component, respectively, represented as uint256return uint256[]Array of debt notional amounts of each component, respectively, represented as uint256 / | function getRequiredComponentRedemptionUnits(
ISetToken _setToken,
uint256 _quantity
)
external
view
virtual
returns (address[] memory, uint256[] memory, uint256[] memory)
| function getRequiredComponentRedemptionUnits(
ISetToken _setToken,
uint256 _quantity
)
external
view
virtual
returns (address[] memory, uint256[] memory, uint256[] memory)
| 46,528 |
10 | // Allows the company to tokenize shares. If these shares are newly created, setTotalShares must becalled first in order to adjust the total number of shares. / | function mint(address shareholder, uint256 _amount) public onlyOwner() {
require(totalValidSupply().add(_amount) <= totalShares, "There can't be fewer shares than valid tokens");
_mint(shareholder, _amount);
}
| function mint(address shareholder, uint256 _amount) public onlyOwner() {
require(totalValidSupply().add(_amount) <= totalShares, "There can't be fewer shares than valid tokens");
_mint(shareholder, _amount);
}
| 32,331 |
21 | // ============ Registry ============ creator -> token address list | mapping(address => address[]) public _USER_STD_REGISTRY_;
mapping(address => address[]) public _USER_CUSTOM_REGISTRY_;
mapping(address => address[]) public _USER_CUSTOM_MINTABLE_REGISTRY_;
| mapping(address => address[]) public _USER_STD_REGISTRY_;
mapping(address => address[]) public _USER_CUSTOM_REGISTRY_;
mapping(address => address[]) public _USER_CUSTOM_MINTABLE_REGISTRY_;
| 19,495 |
140 | // Increment the supply per original nft (max: 1) | totalSupply[seed]++;
assert(totalSupply[seed] == 1);
seedAtIndex[originalsMinted] = seed;
| totalSupply[seed]++;
assert(totalSupply[seed] == 1);
seedAtIndex[originalsMinted] = seed;
| 20,357 |
309 | // 8yyS_squared | (pt2yx, pt2yy) = _FQ2Sub(pt2yx, pt2yy, pt2xx, pt2xy);
| (pt2yx, pt2yy) = _FQ2Sub(pt2yx, pt2yy, pt2xx, pt2xy);
| 15,271 |
20 | // - Integrate bancor pools with lending protocols (Compound) to hedge risk for stakers/ | ) public returns (bool) {
// [In progress]: Integrate with lending pool of compound (cToken)
// Step #1: Initial Setup
bytes32 BNT_TOKEN = "BNT Token";
bytes32 CTOKEN = "compound DAI";
contractRegistry.registerAddress(BNT_TOKEN, BNTtokenAddr); // BNT Token
contractRegistry.registerAddress(CTOKEN, cDAItokenAddr); // cToken (cDAI)
address registryedToken1;
address registryedToken2;
registryedToken1 = contractRegistry.addressOf(BNT_TOKEN);
registryedToken2 = contractRegistry.addressOf(CTOKEN);
// Step #2: Smart Relay Token Deployment(Using smartToken of "cDAIBNT")
smartToken.issue(msg.sender, amountOfSmartToken);
smartToken.transfer(receiverAddr, amountOfSmartToken);
// Step #3: Converter Deployment
uint index = 0;
uint32 reserveRatio = 10; // The case of this, I specify 10% as percentage of ratio. (After I need to divide by 100)
uint32 _conversionFee = 1000; // Fee: 1,000 (0.1%)
bancorConverter.addConnector(iErc20, reserveRatio, true);
bancorConverter.setConversionFee(_conversionFee);
// Step #4: Funding & Initial Supply
uint256 fundedAmount = 100;
bancorConverter.fund(fundedAmount);
// Step #5: Activation
// Step #6: Multisig Ownership
address _converterAddress; // @notice - This variable is for receiving return value of createConverter() below
// uint32 _maxConversionFee = 1;
bancorConverter.transferOwnership(msg.sender); // @dev - Reference from Managed.sol
bancorConverter.transferManagement(msg.sender); // @dev - Reference from Managed.sol
_converterAddress = address(bancorConverter);
// Step #7: Converters Registry Listing
bancorConverterRegistry.addConverter(IBancorConverter(_converterAddress));
}
| ) public returns (bool) {
// [In progress]: Integrate with lending pool of compound (cToken)
// Step #1: Initial Setup
bytes32 BNT_TOKEN = "BNT Token";
bytes32 CTOKEN = "compound DAI";
contractRegistry.registerAddress(BNT_TOKEN, BNTtokenAddr); // BNT Token
contractRegistry.registerAddress(CTOKEN, cDAItokenAddr); // cToken (cDAI)
address registryedToken1;
address registryedToken2;
registryedToken1 = contractRegistry.addressOf(BNT_TOKEN);
registryedToken2 = contractRegistry.addressOf(CTOKEN);
// Step #2: Smart Relay Token Deployment(Using smartToken of "cDAIBNT")
smartToken.issue(msg.sender, amountOfSmartToken);
smartToken.transfer(receiverAddr, amountOfSmartToken);
// Step #3: Converter Deployment
uint index = 0;
uint32 reserveRatio = 10; // The case of this, I specify 10% as percentage of ratio. (After I need to divide by 100)
uint32 _conversionFee = 1000; // Fee: 1,000 (0.1%)
bancorConverter.addConnector(iErc20, reserveRatio, true);
bancorConverter.setConversionFee(_conversionFee);
// Step #4: Funding & Initial Supply
uint256 fundedAmount = 100;
bancorConverter.fund(fundedAmount);
// Step #5: Activation
// Step #6: Multisig Ownership
address _converterAddress; // @notice - This variable is for receiving return value of createConverter() below
// uint32 _maxConversionFee = 1;
bancorConverter.transferOwnership(msg.sender); // @dev - Reference from Managed.sol
bancorConverter.transferManagement(msg.sender); // @dev - Reference from Managed.sol
_converterAddress = address(bancorConverter);
// Step #7: Converters Registry Listing
bancorConverterRegistry.addConverter(IBancorConverter(_converterAddress));
}
| 12,340 |
12 | // _initialSupply {uint} initial supply of token_tokenName {string} name of token_decimalUnits {uint} how many decimal units token will have_tokenSymbol {string} ticker for the token_version {string} version of the token_tokenPriceETH {uint} price of token for exchange functionality | function deployMultiToken () public returns (address) {
MultiToken token;
token = new MultiToken();
TokenDeployed(token, 0);
return token;
}
| function deployMultiToken () public returns (address) {
MultiToken token;
token = new MultiToken();
TokenDeployed(token, 0);
return token;
}
| 9,629 |
24 | // Returning Residue in token0, if any. | if (token0Bought.sub(amountA) > 0) {
IERC20(_ToUnipoolToken0).safeTransfer(
msg.sender,
token0Bought.sub(amountA)
);
}
| if (token0Bought.sub(amountA) > 0) {
IERC20(_ToUnipoolToken0).safeTransfer(
msg.sender,
token0Bought.sub(amountA)
);
}
| 59,882 |
8 | // Coa allocation share address // ERC20 constants // returns // Suns per Satoshi = 10,0001e8 / 1e8 = 1e4 // Time of contract launch (Nov 28, T00:00:00Z Auction Day 1 Starts Nov 29th, 00:00:00 UTC) // Start of claim phase // Number of words to hold 1 bit for each transform lobby day // Stake timing parameters // Stake shares Longer Pays Better bonus constants used by _stakeStartBonusSuns() // Stake shares Bigger Pays Better bonus constants used by _stakeStartBonusSuns() // Share rate is scaled to increase precision // Share rate max (after scaling) // weekly staking bonus / / hack | struct GlobalsCache {
uint256 indexed entryIndex,
uint256 indexed xfAmount,
address indexed referrerAddr
);
address indexed updaterAddr,
uint256 timestamp,
uint256 beginDay,
uint256 endDay
);
uint40 indexed stakeId,
address indexed stakerAddr,
uint256 stakedSuns,
uint256 stakeShares,
uint256 stakedDays
);
uint40 indexed stakeId,
address indexed stakerAddr,
address indexed senderAddr,
uint256 stakedSuns,
uint256 stakeShares,
uint256 payout,
uint256 penalty
);
uint40 indexed stakeId,
uint40 prevUnlocked,
address indexed stakerAddr,
uint256 lockedDay,
uint256 servedDays,
uint256 stakedSuns,
uint256 stakeShares,
uint256 dividends,
uint256 payout,
uint256 penalty,
uint256 stakeReturn
);
uint40 indexed stakeId,
uint256 timestamp,
uint256 newShareRate
);
uint8 adminpct,
uint256 dayDiv,
uint8 unipct,
uint256 unieth
);
uint256 _lockedSunsTotal;
uint256 _nextStakeSharesTotal;
uint256 _shareRate;
uint256 _stakePenaltyTotal;
uint256 _dailyDataCount;
uint256 _stakeSharesTotal;
uint40 _latestStakeId;
uint256 _currentDay;
}
| struct GlobalsCache {
uint256 indexed entryIndex,
uint256 indexed xfAmount,
address indexed referrerAddr
);
address indexed updaterAddr,
uint256 timestamp,
uint256 beginDay,
uint256 endDay
);
uint40 indexed stakeId,
address indexed stakerAddr,
uint256 stakedSuns,
uint256 stakeShares,
uint256 stakedDays
);
uint40 indexed stakeId,
address indexed stakerAddr,
address indexed senderAddr,
uint256 stakedSuns,
uint256 stakeShares,
uint256 payout,
uint256 penalty
);
uint40 indexed stakeId,
uint40 prevUnlocked,
address indexed stakerAddr,
uint256 lockedDay,
uint256 servedDays,
uint256 stakedSuns,
uint256 stakeShares,
uint256 dividends,
uint256 payout,
uint256 penalty,
uint256 stakeReturn
);
uint40 indexed stakeId,
uint256 timestamp,
uint256 newShareRate
);
uint8 adminpct,
uint256 dayDiv,
uint8 unipct,
uint256 unieth
);
uint256 _lockedSunsTotal;
uint256 _nextStakeSharesTotal;
uint256 _shareRate;
uint256 _stakePenaltyTotal;
uint256 _dailyDataCount;
uint256 _stakeSharesTotal;
uint40 _latestStakeId;
uint256 _currentDay;
}
| 5,485 |
56 | // Calculates the base value in relationship to `elastic` and `total`. | function toBase(
Rebase memory total,
uint256 elastic,
bool roundUp
| function toBase(
Rebase memory total,
uint256 elastic,
bool roundUp
| 29,985 |
23 | // Tax txn by transfering fees to Farandole and royalties to the rightsowner if applicable/grossSaleValue - the price at which the asset will be sold/tokenId - used to fetch the rightsowner and royalties amount/ return netSaleAmount - the value that will go to the seller after deducting fees and royalties | function _taxTxn(address sender, IERC721 token, uint tokenId, uint grossSaleValue, ERC20 currency) internal virtual returns (uint) {
uint paidFees = _payFees(sender, grossSaleValue, currency);
(uint paidRoyalties, address receiver) = _payRoyalties(sender, token, tokenId, grossSaleValue, currency);
emit RoyaltiesAndFeesPaid(token, tokenId, paidRoyalties, receiver, paidFees, farandoleWallet);
return grossSaleValue - (paidRoyalties + paidFees);
}
| function _taxTxn(address sender, IERC721 token, uint tokenId, uint grossSaleValue, ERC20 currency) internal virtual returns (uint) {
uint paidFees = _payFees(sender, grossSaleValue, currency);
(uint paidRoyalties, address receiver) = _payRoyalties(sender, token, tokenId, grossSaleValue, currency);
emit RoyaltiesAndFeesPaid(token, tokenId, paidRoyalties, receiver, paidFees, farandoleWallet);
return grossSaleValue - (paidRoyalties + paidFees);
}
| 14,884 |
66 | // Releases vested tokens back to Hut34 wallet | function releaseVested()
public
returns (bool)
| function releaseVested()
public
returns (bool)
| 49,774 |
40 | // emit Transfer event to "to" address | emit Transfer(msg.sender,to,tokens);
return true;
| emit Transfer(msg.sender,to,tokens);
return true;
| 27,769 |
22 | // --------------------- FXS --------------------- | function noteFxsMint(uint256 chain_id, uint256 fxs_amount) external validChain(chain_id) onlyByOwnGov {
fxs_minted[chain_id] += fxs_amount;
}
| function noteFxsMint(uint256 chain_id, uint256 fxs_amount) external validChain(chain_id) onlyByOwnGov {
fxs_minted[chain_id] += fxs_amount;
}
| 43,802 |
8 | // do a trade/sourceToken Source token/sourceAmount Amount of source token/destToken Destination token/destAddress Destination address to send tokens to/validate If true, additional validations are applicable/ return true iff trade is succesful | function doTrade( ERC20 sourceToken,
uint sourceAmount,
ERC20 destToken,
address destAddress,
| function doTrade( ERC20 sourceToken,
uint sourceAmount,
ERC20 destToken,
address destAddress,
| 34,037 |
42 | // We need to make sure the Factory address cannot be changed without wallet owner's/explicit authorization. | modifier onlyFromFactoryOrModule
| modifier onlyFromFactoryOrModule
| 47,093 |
344 | // Funded date is the date of first funding. We can only add initial liquidity once. If this date is set, we cannot proceed | if (fundedDate == 0) {
fundedDate = uint32(block.timestamp);
} else {
| if (fundedDate == 0) {
fundedDate = uint32(block.timestamp);
} else {
| 7,567 |
40 | // The main wallet UTXO's value doesn't include all pending redemptions. To determine if the requested redemption can be performed by the wallet we need to subtract the total value of all pending redemptions from that wallet's main UTXO value. Given that the treasury fee is not redeemed from the wallet, we are subtracting it. | wallet.pendingRedemptionsValue += amount - treasuryFee;
require(
mainUtxo.txOutputValue >= wallet.pendingRedemptionsValue,
"Insufficient wallet funds"
);
self.pendingRedemptions[redemptionKey] = RedemptionRequest(
redeemer,
amount,
treasuryFee,
| wallet.pendingRedemptionsValue += amount - treasuryFee;
require(
mainUtxo.txOutputValue >= wallet.pendingRedemptionsValue,
"Insufficient wallet funds"
);
self.pendingRedemptions[redemptionKey] = RedemptionRequest(
redeemer,
amount,
treasuryFee,
| 10,944 |
32 | // prefer claimed in bit 0. | if (_splits[_i].preferClaimed) _packedSplitParts1 = 1;
| if (_splits[_i].preferClaimed) _packedSplitParts1 = 1;
| 4,542 |
1 | // ACE Equity Token Official Symbol | string public symbol;
| string public symbol;
| 10,426 |
544 | // Per cash group settings | bytes32 data =
(bytes32(uint256(cashGroup.maxMarketIndex)) |
(bytes32(uint256(cashGroup.rateOracleTimeWindow5Min)) << RATE_ORACLE_TIME_WINDOW) |
(bytes32(uint256(cashGroup.totalFeeBPS)) << TOTAL_FEE) |
(bytes32(uint256(cashGroup.reserveFeeShare)) << RESERVE_FEE_SHARE) |
(bytes32(uint256(cashGroup.debtBuffer5BPS)) << DEBT_BUFFER) |
(bytes32(uint256(cashGroup.fCashHaircut5BPS)) << FCASH_HAIRCUT) |
(bytes32(uint256(cashGroup.settlementPenaltyRate5BPS)) << SETTLEMENT_PENALTY) |
(bytes32(uint256(cashGroup.liquidationfCashHaircut5BPS)) <<
LIQUIDATION_FCASH_HAIRCUT) |
| bytes32 data =
(bytes32(uint256(cashGroup.maxMarketIndex)) |
(bytes32(uint256(cashGroup.rateOracleTimeWindow5Min)) << RATE_ORACLE_TIME_WINDOW) |
(bytes32(uint256(cashGroup.totalFeeBPS)) << TOTAL_FEE) |
(bytes32(uint256(cashGroup.reserveFeeShare)) << RESERVE_FEE_SHARE) |
(bytes32(uint256(cashGroup.debtBuffer5BPS)) << DEBT_BUFFER) |
(bytes32(uint256(cashGroup.fCashHaircut5BPS)) << FCASH_HAIRCUT) |
(bytes32(uint256(cashGroup.settlementPenaltyRate5BPS)) << SETTLEMENT_PENALTY) |
(bytes32(uint256(cashGroup.liquidationfCashHaircut5BPS)) <<
LIQUIDATION_FCASH_HAIRCUT) |
| 16,055 |
177 | // Sauce | traitTypes[1].push(Trait("BBQ","Sauce","714c4b",0));
traitTypes[1].push(Trait("Gold","Sauce","FECD51",0));
traitTypes[1].push(Trait("Hot","Sauce","cd7542",0));
traitTypes[1].push(Trait("Pesto","Sauce","7aa579",0));
traitTypes[1].push(Trait("Tomato","Sauce","c94f49",0));
traitTypes[1].push(Trait("White","Sauce","acacac",0));
| traitTypes[1].push(Trait("BBQ","Sauce","714c4b",0));
traitTypes[1].push(Trait("Gold","Sauce","FECD51",0));
traitTypes[1].push(Trait("Hot","Sauce","cd7542",0));
traitTypes[1].push(Trait("Pesto","Sauce","7aa579",0));
traitTypes[1].push(Trait("Tomato","Sauce","c94f49",0));
traitTypes[1].push(Trait("White","Sauce","acacac",0));
| 49,088 |
13 | // tokenURI() base path./Without trailing slash | string internal _baseTokenURI;
constructor(
address newOwner,
address signerEarlyAccess,
address signerPublic,
string memory baseTokenURI,
MintConfig memory config,
address[] memory payees,
uint256[] memory shares,
| string internal _baseTokenURI;
constructor(
address newOwner,
address signerEarlyAccess,
address signerPublic,
string memory baseTokenURI,
MintConfig memory config,
address[] memory payees,
uint256[] memory shares,
| 20,387 |
51 | // ------------------------------------------------------------------------ Get the total ETH deposited by `depositer` ------------------------------------------------------------------------ | function depositsOf(address depositer) public constant returns (uint balance) {
return ethDeposits[depositer];
}
| function depositsOf(address depositer) public constant returns (uint balance) {
return ethDeposits[depositer];
}
| 18,958 |
393 | // validatorId => slashing log | mapping (uint => SlashingLog) private _slashesOfValidator;
| mapping (uint => SlashingLog) private _slashesOfValidator;
| 52,798 |
27 | // multiplies normal precision a with extra precision b (with 38 decimals)/ Rounds down in signed direction/ returns normal precision of the product | function mulDownXpToNp(int256 a, int256 b) internal pure returns (int256) {
int256 b1 = b / 1e19;
int256 prod1 = a * b1;
if (!(a == 0 || prod1 / a == b1)) _require(false, Errors.MUL_OVERFLOW);
int256 b2 = b % 1e19;
int256 prod2 = a * b2;
if (!(a == 0 || prod2 / a == b2)) _require(false, Errors.MUL_OVERFLOW);
return prod1 >= 0 && prod2 >= 0 ? (prod1 + prod2 / 1e19) / 1e19 : (prod1 + prod2 / 1e19 + 1) / 1e19 - 1;
}
| function mulDownXpToNp(int256 a, int256 b) internal pure returns (int256) {
int256 b1 = b / 1e19;
int256 prod1 = a * b1;
if (!(a == 0 || prod1 / a == b1)) _require(false, Errors.MUL_OVERFLOW);
int256 b2 = b % 1e19;
int256 prod2 = a * b2;
if (!(a == 0 || prod2 / a == b2)) _require(false, Errors.MUL_OVERFLOW);
return prod1 >= 0 && prod2 >= 0 ? (prod1 + prod2 / 1e19) / 1e19 : (prod1 + prod2 / 1e19 + 1) / 1e19 - 1;
}
| 17,864 |
29 | // Safe AYIELD transfer function, just in case if rounding error causes pool to not have enough AYIELD. | function safeAyieldTransfer(address _to, uint256 _amount) internal {
uint256 ayieldBal = ayield.balanceOf(address(this));
bool transferSuccess = false;
if (_amount > ayieldBal) {
transferSuccess = ayield.transfer(_to, ayieldBal);
} else {
transferSuccess = ayield.transfer(_to, _amount);
}
require(transferSuccess, "safeAyieldTransfer: transfer failed");
}
| function safeAyieldTransfer(address _to, uint256 _amount) internal {
uint256 ayieldBal = ayield.balanceOf(address(this));
bool transferSuccess = false;
if (_amount > ayieldBal) {
transferSuccess = ayield.transfer(_to, ayieldBal);
} else {
transferSuccess = ayield.transfer(_to, _amount);
}
require(transferSuccess, "safeAyieldTransfer: transfer failed");
}
| 35,011 |
0 | // IIdentifiable IIdentifiable interfaceSébastien Krafft - <sebastien.krafft@mtpelerin.com>/ | interface IIdentifiable {
function identity(address shareholder) external view returns (bytes memory);
function setMyIdentity(bytes calldata _identity) external;
}
| interface IIdentifiable {
function identity(address shareholder) external view returns (bytes memory);
function setMyIdentity(bytes calldata _identity) external;
}
| 5,953 |
18 | // Internal conversion function (from assets to shares) with support for rounding direction. Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. That corresponds to a case where any assetwould represent an infinite amout of shares. / | function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256 shares) {
uint256 supply = totalSupply();
return
(assets == 0 || supply == 0)
? assets.mulDiv(10**decimals(), 10**_asset.decimals(), rounding)
: assets.mulDiv(supply, totalAssets(), rounding);
}
| function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256 shares) {
uint256 supply = totalSupply();
return
(assets == 0 || supply == 0)
? assets.mulDiv(10**decimals(), 10**_asset.decimals(), rounding)
: assets.mulDiv(supply, totalAssets(), rounding);
}
| 36,701 |
4 | // _userId The SppedRun.com `userId` being queried./_gameId The id of the game./_levelId The id of the level of the game./_mark The time ckeched. / return `true` if there is verified evidence in the repo that the user has a mark equal or better than `mark`./It returns `false` if no evidence found (but it might be that such evidence is yet at SpeedRun.com) | function passed_mark(string calldata _userId, string calldata _gameId, string calldata _levelId, uint _mark) override external view returns (bool){
Run[] memory user_runs = runs[_userId][_gameId][_levelId];
for (uint256 i = 0; i < user_runs.length; ++i) {
if (user_runs[i].primaryTime <= _mark)
return true;
}
return false;
}
| function passed_mark(string calldata _userId, string calldata _gameId, string calldata _levelId, uint _mark) override external view returns (bool){
Run[] memory user_runs = runs[_userId][_gameId][_levelId];
for (uint256 i = 0; i < user_runs.length; ++i) {
if (user_runs[i].primaryTime <= _mark)
return true;
}
return false;
}
| 18,106 |
109 | // TRUE NAME - 29.76 MKR - 0x612f7924c367575a0edf21333d96b15f1b345a5d | MKR.transfer(TRUENAME_WALLET, 29.76 ether); // NOTE: 'ether' is a keyword helper, only MKR is transferred here
| MKR.transfer(TRUENAME_WALLET, 29.76 ether); // NOTE: 'ether' is a keyword helper, only MKR is transferred here
| 28,202 |
128 | // _month uint256 the month (from 0 to 5) for which the Reward Unlock Rate is returnedreturn uint256 the Reward Unlock Rate for KittieFightToken for the _monthreturn uint256 the Reward Unlock Rate for SuperDaoToken for the _month / | function getRewardUnlockRateByMonth(uint256 _month) external view returns (uint256, uint256) {
uint256 _KTYunlockRate = KTYunlockRates[_month];
uint256 _SDAOunlockRate = SDAOunlockRates[_month];
return (_KTYunlockRate, _SDAOunlockRate);
}
| function getRewardUnlockRateByMonth(uint256 _month) external view returns (uint256, uint256) {
uint256 _KTYunlockRate = KTYunlockRates[_month];
uint256 _SDAOunlockRate = SDAOunlockRates[_month];
return (_KTYunlockRate, _SDAOunlockRate);
}
| 79,571 |
1 | // Track the enumerated allowed SeaDrop addresses. | address[] internal _enumeratedAllowedSeaDrop;
| address[] internal _enumeratedAllowedSeaDrop;
| 2,384 |
127 | // Read oracle prices for borrowed and collateral markets //Get the exchange rate and calculate the number of collateral tokens to seize: seizeAmount = actualRepayAmountliquidationIncentivepriceBorrowed / priceCollateral seizeTokens = seizeAmount / exchangeRate= actualRepayAmount(liquidationIncentivepriceBorrowed) / (priceCollateralexchangeRate) / | uint256 exchangeRateMantissa = JToken(jTokenCollateral).exchangeRateStored(); // Note: reverts on error
Exp memory numerator = mul_(
| uint256 exchangeRateMantissa = JToken(jTokenCollateral).exchangeRateStored(); // Note: reverts on error
Exp memory numerator = mul_(
| 8,618 |
22 | // deadlines 1: 08/21/2017 @ 11:59pm (UTC) +30%deadlines 2: 08/28/2017 @ 11:59pm (UTC) +20%deadlines 3: 09/05/2017 @ 11:59pm (UTC) +10%deadlines 4: 09/12/2017 @ 11:59pm (UTC) +5%deadlines 5: 09/21/2017 @ 11:59pm (UTC) +0% | uint[5] public deadlines = [1503359999, 1503964799, 1504655999, 1505260799, 1506038399];
uint[5] public prices = [130, 120, 110, 105, 100];
uint256 public constant ETH_RECEIVED_CAP = 115 * (10**3) * 10**decimals; // 115 000 ETH
uint256 public constant ETH_RECEIVED_MIN = 0;//1 * 10**decimals; // 0 ETH
uint256 public constant TOKEN_MIN = 1 * 10**decimals; // 1 VIBEX
uint256 public constant MIN_ETH_TRANS = 25 * 10**decimals; // 25 ETH
| uint[5] public deadlines = [1503359999, 1503964799, 1504655999, 1505260799, 1506038399];
uint[5] public prices = [130, 120, 110, 105, 100];
uint256 public constant ETH_RECEIVED_CAP = 115 * (10**3) * 10**decimals; // 115 000 ETH
uint256 public constant ETH_RECEIVED_MIN = 0;//1 * 10**decimals; // 0 ETH
uint256 public constant TOKEN_MIN = 1 * 10**decimals; // 1 VIBEX
uint256 public constant MIN_ETH_TRANS = 25 * 10**decimals; // 25 ETH
| 44,236 |
48 | // NICE! | autoLiquidityReceiver = msg.sender;
marketingFeeReceiver = msg.sender;
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
| autoLiquidityReceiver = msg.sender;
marketingFeeReceiver = msg.sender;
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
| 3,748 |
68 | // withdraw fundsThis will set the withdrawal wallet _wallet The address to transmit to./ | function setWallet(address _wallet) onlyOwner public returns(bool) {
// set wallet
wallet = _wallet;
WalletChange(_wallet , now);
return true;
}
| function setWallet(address _wallet) onlyOwner public returns(bool) {
// set wallet
wallet = _wallet;
WalletChange(_wallet , now);
return true;
}
| 34,250 |
528 | // Sets the last complete commission index _stakerAddress smart contract address. _index current index. / | function setLastCompletedStakeCommissionIndex(
address _stakerAddress,
uint _index
)
public
onlyInternal
| function setLastCompletedStakeCommissionIndex(
address _stakerAddress,
uint _index
)
public
onlyInternal
| 33,534 |
81 | // //Get user (ticketsBoughtticketPrice) - user fees / | function getUserDoTxInBalance(uint256 _warIndex, address userAddress) public view returns(uint256){
return wars[_warIndex].users[userAddress].ticketsBought.mul(wars[_warIndex].ticketPrice);
}
| function getUserDoTxInBalance(uint256 _warIndex, address userAddress) public view returns(uint256){
return wars[_warIndex].users[userAddress].ticketsBought.mul(wars[_warIndex].ticketPrice);
}
| 6,133 |
9 | // The offering token | IERC20 public immutable offeringToken;
| IERC20 public immutable offeringToken;
| 34,878 |
82 | // take some fee here first | finalAmountGotten = result[result.length-1];
finalAmountGotten = finalAmountGotten.sub(_deductSppFee(finalAmountGotten, tokenGet));
_creditTokens( finalAmountGotten, _subscriptionData.customerAddress, tokenGet);
require(setcurrentTokenStats(_sppId, finalAmountGotten, _subscriptionData.value),"setcurrentTokenStats failed");
require(setLastPaidAt(_sppId),"setLastPaidAt failed");
| finalAmountGotten = result[result.length-1];
finalAmountGotten = finalAmountGotten.sub(_deductSppFee(finalAmountGotten, tokenGet));
_creditTokens( finalAmountGotten, _subscriptionData.customerAddress, tokenGet);
require(setcurrentTokenStats(_sppId, finalAmountGotten, _subscriptionData.value),"setcurrentTokenStats failed");
require(setLastPaidAt(_sppId),"setLastPaidAt failed");
| 20,867 |
27 | // Reduce allowance user ~ sub ~ from ~ SafeMath | allowanceMoney[_who] = allowanceMoney[_who].sub(_amount);
| allowanceMoney[_who] = allowanceMoney[_who].sub(_amount);
| 16,649 |
22 | // IInstantDistributionAgreementV1.getIndex implementation | function getIndex(
ISuperfluidToken token,
address publisher,
uint32 indexId
)
external view override
returns (
bool exist,
uint128 indexValue,
uint128 totalUnitsApproved,
| function getIndex(
ISuperfluidToken token,
address publisher,
uint32 indexId
)
external view override
returns (
bool exist,
uint128 indexValue,
uint128 totalUnitsApproved,
| 7,923 |
13 | // Event for Payee & subPayees Separated from the Created Event to allow a 4th indexed parameter (subpayees) | event NewSubPayee(bytes32 indexed requestId, address indexed payee);
event UpdateExpectedAmount(bytes32 indexed requestId, uint8 payeeIndex, int256 deltaAmount);
event UpdateBalance(bytes32 indexed requestId, uint8 payeeIndex, int256 deltaAmount);
| event NewSubPayee(bytes32 indexed requestId, address indexed payee);
event UpdateExpectedAmount(bytes32 indexed requestId, uint8 payeeIndex, int256 deltaAmount);
event UpdateBalance(bytes32 indexed requestId, uint8 payeeIndex, int256 deltaAmount);
| 34,304 |
11 | // Returns the ip of a list of guardians/an unregistered guardian returns 0 ip address/guardianAddrs is a list of guardians' addresses to query/ips is a list of the guardians' node ipv4 addresses as a 32b numbers | function getGuardianIps(address[] calldata guardianAddrs) external view returns (bytes4[] memory ips);
| function getGuardianIps(address[] calldata guardianAddrs) external view returns (bytes4[] memory ips);
| 37,839 |
38 | // Get current group names// return group names | function getGroups() public view returns (bytes32[] _groups) {
uint _groupsCount = groupsCount;
_groups = new bytes32[](_groupsCount);
for (uint _groupIdx = 0; _groupIdx < _groupsCount; ++_groupIdx) {
_groups[_groupIdx] = index2groupName[_groupIdx + 1];
}
}
| function getGroups() public view returns (bytes32[] _groups) {
uint _groupsCount = groupsCount;
_groups = new bytes32[](_groupsCount);
for (uint _groupIdx = 0; _groupIdx < _groupsCount; ++_groupIdx) {
_groups[_groupIdx] = index2groupName[_groupIdx + 1];
}
}
| 20,427 |
14 | // Check the vehicle signed the toll | address vehicleOwnerAddress = getVehicleOwner(_plate);
address tollSignerAddress = ecrecover(_tollHash, _v, _r, _s);
require (vehicleOwnerAddress == tollSignerAddress, "Signature doesn't match vehicle owner");
| address vehicleOwnerAddress = getVehicleOwner(_plate);
address tollSignerAddress = ecrecover(_tollHash, _v, _r, _s);
require (vehicleOwnerAddress == tollSignerAddress, "Signature doesn't match vehicle owner");
| 721 |
6 | // Mapping from owner to operator approvals | mapping(address => mapping(address => bool)) operatorApprovals;
address owner;
bool initialized;
address payable wormhole;
uint16 chainId;
| mapping(address => mapping(address => bool)) operatorApprovals;
address owner;
bool initialized;
address payable wormhole;
uint16 chainId;
| 15,251 |
2 | // Receive function to receive plain transfers. | receive() external payable {
heritageCounter++;
}
| receive() external payable {
heritageCounter++;
}
| 19,284 |
35 | // for all non-winners, add a bonus for next rounds | uint8 bonus = timeBonusMapping[participant];
if (bonus < maxRoundBonus) {
timeBonusMapping[participant] += 1;
}
| uint8 bonus = timeBonusMapping[participant];
if (bonus < maxRoundBonus) {
timeBonusMapping[participant] += 1;
}
| 17,148 |
8 | // transfer ownership of the data contracts | azimuth.transferOwnership(_new);
polls.transferOwnership(_new);
| azimuth.transferOwnership(_new);
polls.transferOwnership(_new);
| 3,033 |
332 | // withdraw funds from contract | function withdraw() public payable onlyOwner nonReentrant {
uint256 balance = address(this).balance;
payable(_msgSenderERC721A()).transfer(balance);
}
| function withdraw() public payable onlyOwner nonReentrant {
uint256 balance = address(this).balance;
payable(_msgSenderERC721A()).transfer(balance);
}
| 40,953 |
31 | // Process rewards distributions to holders | function process() external authorized {
try distributor.process(distributorGas) {} catch {}
}
| function process() external authorized {
try distributor.process(distributorGas) {} catch {}
}
| 34,548 |
24 | // if admin or owner of item | require(msg.sender == admin || idToMarketItem[itemId].owner == msg.sender,"You are not the owner of this item");
idToMarketItem[itemId].status = Status.Canceled;
| require(msg.sender == admin || idToMarketItem[itemId].owner == msg.sender,"You are not the owner of this item");
idToMarketItem[itemId].status = Status.Canceled;
| 28,076 |
7 | // The maximum multiplier used to calculate the amount of gas paid to the Keeper for the gas used to perform a job/ For example: if the quoted gas used is 1000, then the maximum amount to be paid will be 1000MAX / BOOST_BASE/ return _multiplier The MAX multiplier | function MAX() external view returns (uint256 _multiplier);
| function MAX() external view returns (uint256 _multiplier);
| 48,727 |
2 | // Changes the owner of this contract. _newOwner address of the new owner. / | function transferOwnership(address _newOwner) external onlyOwner {
owner = _newOwner;
}
| function transferOwnership(address _newOwner) external onlyOwner {
owner = _newOwner;
}
| 288 |
3 | // Paper contract deployed address | address paperContractAddress;
| address paperContractAddress;
| 17,220 |
14 | // Transfer NFT Condition KeykoImplementation of condition allowing to transfer an NFT between the original owner and a receiver/ | contract TransferNFTCondition is Condition, ITransferNFT, ReentrancyGuardUpgradeable, AccessControlUpgradeable {
bytes32 private constant CONDITION_TYPE = keccak256('TransferNFTCondition');
bytes32 private constant MARKET_ROLE = keccak256('MARKETPLACE_ROLE');
NFTUpgradeable private erc1155;
/**
* @notice initialize init the contract with the following parameters
* @dev this function is called only once during the contract
* initialization.
* @param _owner contract's owner account address
* @param _conditionStoreManagerAddress condition store manager address
* @param _ercAddress Nevermined ERC-1155 address
* @param _nftContractAddress Market address
*/
function initialize(
address _owner,
address _conditionStoreManagerAddress,
address _ercAddress,
address _nftContractAddress
)
external
initializer()
{
require(
_owner != address(0) &&
_conditionStoreManagerAddress != address(0) &&
_ercAddress != address(0),
'Invalid address'
);
OwnableUpgradeable.__Ownable_init();
transferOwnership(_owner);
conditionStoreManager = ConditionStoreManager(
_conditionStoreManagerAddress
);
erc1155 = NFTUpgradeable(
_ercAddress
);
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
if (_nftContractAddress != address(0))
grantRole(MARKET_ROLE, _nftContractAddress);
}
function grantMarketRole(address _nftContractAddress)
public
onlyOwner
{
grantRole(MARKET_ROLE, _nftContractAddress);
}
function revokeMarketRole(address _nftContractAddress)
public
onlyOwner
{
revokeRole(MARKET_ROLE, _nftContractAddress);
}
/**
* @notice hashValues generates the hash of condition inputs
* with the following parameters
* @param _did refers to the DID in which secret store will issue the decryption keys
* @param _nftReceiver is the address of the granted user or the DID provider
* @param _nftAmount amount of NFTs to transfer
* @param _lockCondition lock condition identifier
* @return bytes32 hash of all these values
*/
function hashValues(
bytes32 _did,
address _nftHolder,
address _nftReceiver,
uint256 _nftAmount,
bytes32 _lockCondition
)
public
view
returns (bytes32)
{
return hashValues(_did, _nftHolder, _nftReceiver, _nftAmount, _lockCondition, address(erc1155));
}
/**
* @notice hashValues generates the hash of condition inputs
* with the following parameters
* @param _did refers to the DID in which secret store will issue the decryption keys
* @param _nftReceiver is the address of the granted user or the DID provider
* @param _nftAmount amount of NFTs to transfer
* @param _lockCondition lock condition identifier
* @param _nftContractAddress NFT contract to use
* @return bytes32 hash of all these values
*/
function hashValues(
bytes32 _did,
address _nftHolder,
address _nftReceiver,
uint256 _nftAmount,
bytes32 _lockCondition,
address _nftContractAddress
)
public
pure
override
returns (bytes32)
{
return keccak256(abi.encode(_did, _nftHolder, _nftReceiver, _nftAmount, _lockCondition, _nftContractAddress));
}
function fulfill(
bytes32 _agreementId,
bytes32 _did,
address _nftReceiver,
uint256 _nftAmount,
bytes32 _lockPaymentCondition
)
public
returns (ConditionStoreLibrary.ConditionState)
{
return fulfill(_agreementId, _did, _nftReceiver, _nftAmount, _lockPaymentCondition, address(erc1155));
}
/**
* @notice fulfill the transfer NFT condition
* @dev Fulfill method transfer a certain amount of NFTs
* to the _nftReceiver address.
* When true then fulfill the condition
* @param _agreementId agreement identifier
* @param _did refers to the DID in which secret store will issue the decryption keys
* @param _nftReceiver is the address of the account to receive the NFT
* @param _nftAmount amount of NFTs to transfer
* @param _lockPaymentCondition lock payment condition identifier
* @param _nftContractAddress NFT contract to use
* @return condition state (Fulfilled/Aborted)
*/
function fulfill(
bytes32 _agreementId,
bytes32 _did,
address _nftReceiver,
uint256 _nftAmount,
bytes32 _lockPaymentCondition,
address _nftContractAddress
)
public
override
nonReentrant
returns (ConditionStoreLibrary.ConditionState)
{
bytes32 _id = generateId(
_agreementId,
hashValues(_did, msg.sender, _nftReceiver, _nftAmount, _lockPaymentCondition, _nftContractAddress)
);
address lockConditionTypeRef;
ConditionStoreLibrary.ConditionState lockConditionState;
(lockConditionTypeRef,lockConditionState,,,,,,) = conditionStoreManager
.getCondition(_lockPaymentCondition);
require(
lockConditionState == ConditionStoreLibrary.ConditionState.Fulfilled,
'LockCondition needs to be Fulfilled'
);
IERC1155Upgradeable token = IERC1155Upgradeable(_nftContractAddress);
if (_nftAmount > 0)
token.safeTransferFrom(msg.sender, _nftReceiver, uint256(_did), _nftAmount, '');
ConditionStoreLibrary.ConditionState state = super.fulfill(
_id,
ConditionStoreLibrary.ConditionState.Fulfilled
);
emit Fulfilled(
_agreementId,
_did,
_nftReceiver,
_nftAmount,
_id,
_nftContractAddress
);
return state;
}
/**
* @notice fulfill the transfer NFT condition
* @dev Fulfill method transfer a certain amount of NFTs
* to the _nftReceiver address in the DIDRegistry contract.
* When true then fulfill the condition
* @param _agreementId agreement identifier
* @param _did refers to the DID in which secret store will issue the decryption keys
* @param _nftReceiver is the address of the account to receive the NFT
* @param _nftAmount amount of NFTs to transfer
* @param _lockPaymentCondition lock payment condition identifier
* @param _nftHolder is the address of the account to receive the NFT
* @return condition state (Fulfilled/Aborted)
*/
function fulfillForDelegate(
bytes32 _agreementId,
bytes32 _did,
address _nftHolder,
address _nftReceiver,
uint256 _nftAmount,
bytes32 _lockPaymentCondition
)
public
returns (ConditionStoreLibrary.ConditionState)
{
require(hasRole(MARKET_ROLE, msg.sender) || erc1155.isApprovedForAll(_nftHolder, msg.sender), 'Invalid access role');
bytes32 _id = generateId(
_agreementId,
hashValues(_did, _nftHolder, _nftReceiver, _nftAmount, _lockPaymentCondition)
);
address lockConditionTypeRef;
ConditionStoreLibrary.ConditionState lockConditionState;
(lockConditionTypeRef,lockConditionState,,,,,,) = conditionStoreManager
.getCondition(_lockPaymentCondition);
require(
lockConditionState == ConditionStoreLibrary.ConditionState.Fulfilled,
'LockCondition needs to be Fulfilled'
);
require(
erc1155.balanceOf(_nftHolder, uint256(_did)) >= _nftAmount,
'Not enough balance'
);
erc1155.safeTransferFrom(_nftHolder, _nftReceiver, uint256(_did), _nftAmount, '');
ConditionStoreLibrary.ConditionState state = super.fulfill(
_id,
ConditionStoreLibrary.ConditionState.Fulfilled
);
emit Fulfilled(
_agreementId,
_did,
_nftReceiver,
_nftAmount,
_id,
address(erc1155)
);
return state;
}
/*
* @notice fulfill the transfer NFT condition
* @dev only DID owner or DID provider can call this
* method. Fulfill method transfer a certain amount of NFTs
* to the _receiver address.
* When true then fulfill the condition
* @param _agreementId agreement identifier
* @param _did refers to the DID in which secret store will issue the decryption keys
* @param _nftReceiver is the address of the account to receive the NFT
* @param _nftAmount amount of NFTs to transfer
* @param _nftLockCondition lock payment condition identifier
* @return condition state (Fulfilled/Aborted)
*/
/*
function fulfillWithNFTLock(
bytes32 _agreementId,
bytes32 _did,
address _nftReceiver,
uint256 _nftAmount,
bytes32 _nftLockCondition
)
public
returns (ConditionStoreLibrary.ConditionState)
{
bytes32 _id = generateId(
_agreementId,
hashValues(_did, _nftReceiver, _nftAmount, _nftLockCondition)
);
address lockConditionTypeRef;
ConditionStoreLibrary.ConditionState lockConditionState;
(lockConditionTypeRef,lockConditionState,,,,,,) = conditionStoreManager
.getCondition(_nftLockCondition);
require(
lockConditionState == ConditionStoreLibrary.ConditionState.Fulfilled,
'LockCondition needs to be Fulfilled'
);
bytes32 generatedLockConditionId = keccak256(
abi.encode(
_agreementId,
lockConditionTypeRef,
keccak256(
abi.encode(
_did,
_nftReceiver,
_nftAmount
)
)
)
);
require(
generatedLockConditionId == _nftLockCondition,
'LockCondition ID does not match'
);
require(
registry.balanceOf(lockConditionTypeRef, uint256(_did)) >= _nftAmount,
'Not enough balance'
);
registry.safeTransferFrom(lockConditionTypeRef, _nftReceiver, uint256(_did), _nftAmount, '');
ConditionStoreLibrary.ConditionState state = super.fulfill(
_id,
ConditionStoreLibrary.ConditionState.Fulfilled
);
emit Fulfilled(
_agreementId,
_did,
_nftReceiver,
_nftAmount,
_id
);
return state;
}
*/
}
| contract TransferNFTCondition is Condition, ITransferNFT, ReentrancyGuardUpgradeable, AccessControlUpgradeable {
bytes32 private constant CONDITION_TYPE = keccak256('TransferNFTCondition');
bytes32 private constant MARKET_ROLE = keccak256('MARKETPLACE_ROLE');
NFTUpgradeable private erc1155;
/**
* @notice initialize init the contract with the following parameters
* @dev this function is called only once during the contract
* initialization.
* @param _owner contract's owner account address
* @param _conditionStoreManagerAddress condition store manager address
* @param _ercAddress Nevermined ERC-1155 address
* @param _nftContractAddress Market address
*/
function initialize(
address _owner,
address _conditionStoreManagerAddress,
address _ercAddress,
address _nftContractAddress
)
external
initializer()
{
require(
_owner != address(0) &&
_conditionStoreManagerAddress != address(0) &&
_ercAddress != address(0),
'Invalid address'
);
OwnableUpgradeable.__Ownable_init();
transferOwnership(_owner);
conditionStoreManager = ConditionStoreManager(
_conditionStoreManagerAddress
);
erc1155 = NFTUpgradeable(
_ercAddress
);
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
if (_nftContractAddress != address(0))
grantRole(MARKET_ROLE, _nftContractAddress);
}
function grantMarketRole(address _nftContractAddress)
public
onlyOwner
{
grantRole(MARKET_ROLE, _nftContractAddress);
}
function revokeMarketRole(address _nftContractAddress)
public
onlyOwner
{
revokeRole(MARKET_ROLE, _nftContractAddress);
}
/**
* @notice hashValues generates the hash of condition inputs
* with the following parameters
* @param _did refers to the DID in which secret store will issue the decryption keys
* @param _nftReceiver is the address of the granted user or the DID provider
* @param _nftAmount amount of NFTs to transfer
* @param _lockCondition lock condition identifier
* @return bytes32 hash of all these values
*/
function hashValues(
bytes32 _did,
address _nftHolder,
address _nftReceiver,
uint256 _nftAmount,
bytes32 _lockCondition
)
public
view
returns (bytes32)
{
return hashValues(_did, _nftHolder, _nftReceiver, _nftAmount, _lockCondition, address(erc1155));
}
/**
* @notice hashValues generates the hash of condition inputs
* with the following parameters
* @param _did refers to the DID in which secret store will issue the decryption keys
* @param _nftReceiver is the address of the granted user or the DID provider
* @param _nftAmount amount of NFTs to transfer
* @param _lockCondition lock condition identifier
* @param _nftContractAddress NFT contract to use
* @return bytes32 hash of all these values
*/
function hashValues(
bytes32 _did,
address _nftHolder,
address _nftReceiver,
uint256 _nftAmount,
bytes32 _lockCondition,
address _nftContractAddress
)
public
pure
override
returns (bytes32)
{
return keccak256(abi.encode(_did, _nftHolder, _nftReceiver, _nftAmount, _lockCondition, _nftContractAddress));
}
function fulfill(
bytes32 _agreementId,
bytes32 _did,
address _nftReceiver,
uint256 _nftAmount,
bytes32 _lockPaymentCondition
)
public
returns (ConditionStoreLibrary.ConditionState)
{
return fulfill(_agreementId, _did, _nftReceiver, _nftAmount, _lockPaymentCondition, address(erc1155));
}
/**
* @notice fulfill the transfer NFT condition
* @dev Fulfill method transfer a certain amount of NFTs
* to the _nftReceiver address.
* When true then fulfill the condition
* @param _agreementId agreement identifier
* @param _did refers to the DID in which secret store will issue the decryption keys
* @param _nftReceiver is the address of the account to receive the NFT
* @param _nftAmount amount of NFTs to transfer
* @param _lockPaymentCondition lock payment condition identifier
* @param _nftContractAddress NFT contract to use
* @return condition state (Fulfilled/Aborted)
*/
function fulfill(
bytes32 _agreementId,
bytes32 _did,
address _nftReceiver,
uint256 _nftAmount,
bytes32 _lockPaymentCondition,
address _nftContractAddress
)
public
override
nonReentrant
returns (ConditionStoreLibrary.ConditionState)
{
bytes32 _id = generateId(
_agreementId,
hashValues(_did, msg.sender, _nftReceiver, _nftAmount, _lockPaymentCondition, _nftContractAddress)
);
address lockConditionTypeRef;
ConditionStoreLibrary.ConditionState lockConditionState;
(lockConditionTypeRef,lockConditionState,,,,,,) = conditionStoreManager
.getCondition(_lockPaymentCondition);
require(
lockConditionState == ConditionStoreLibrary.ConditionState.Fulfilled,
'LockCondition needs to be Fulfilled'
);
IERC1155Upgradeable token = IERC1155Upgradeable(_nftContractAddress);
if (_nftAmount > 0)
token.safeTransferFrom(msg.sender, _nftReceiver, uint256(_did), _nftAmount, '');
ConditionStoreLibrary.ConditionState state = super.fulfill(
_id,
ConditionStoreLibrary.ConditionState.Fulfilled
);
emit Fulfilled(
_agreementId,
_did,
_nftReceiver,
_nftAmount,
_id,
_nftContractAddress
);
return state;
}
/**
* @notice fulfill the transfer NFT condition
* @dev Fulfill method transfer a certain amount of NFTs
* to the _nftReceiver address in the DIDRegistry contract.
* When true then fulfill the condition
* @param _agreementId agreement identifier
* @param _did refers to the DID in which secret store will issue the decryption keys
* @param _nftReceiver is the address of the account to receive the NFT
* @param _nftAmount amount of NFTs to transfer
* @param _lockPaymentCondition lock payment condition identifier
* @param _nftHolder is the address of the account to receive the NFT
* @return condition state (Fulfilled/Aborted)
*/
function fulfillForDelegate(
bytes32 _agreementId,
bytes32 _did,
address _nftHolder,
address _nftReceiver,
uint256 _nftAmount,
bytes32 _lockPaymentCondition
)
public
returns (ConditionStoreLibrary.ConditionState)
{
require(hasRole(MARKET_ROLE, msg.sender) || erc1155.isApprovedForAll(_nftHolder, msg.sender), 'Invalid access role');
bytes32 _id = generateId(
_agreementId,
hashValues(_did, _nftHolder, _nftReceiver, _nftAmount, _lockPaymentCondition)
);
address lockConditionTypeRef;
ConditionStoreLibrary.ConditionState lockConditionState;
(lockConditionTypeRef,lockConditionState,,,,,,) = conditionStoreManager
.getCondition(_lockPaymentCondition);
require(
lockConditionState == ConditionStoreLibrary.ConditionState.Fulfilled,
'LockCondition needs to be Fulfilled'
);
require(
erc1155.balanceOf(_nftHolder, uint256(_did)) >= _nftAmount,
'Not enough balance'
);
erc1155.safeTransferFrom(_nftHolder, _nftReceiver, uint256(_did), _nftAmount, '');
ConditionStoreLibrary.ConditionState state = super.fulfill(
_id,
ConditionStoreLibrary.ConditionState.Fulfilled
);
emit Fulfilled(
_agreementId,
_did,
_nftReceiver,
_nftAmount,
_id,
address(erc1155)
);
return state;
}
/*
* @notice fulfill the transfer NFT condition
* @dev only DID owner or DID provider can call this
* method. Fulfill method transfer a certain amount of NFTs
* to the _receiver address.
* When true then fulfill the condition
* @param _agreementId agreement identifier
* @param _did refers to the DID in which secret store will issue the decryption keys
* @param _nftReceiver is the address of the account to receive the NFT
* @param _nftAmount amount of NFTs to transfer
* @param _nftLockCondition lock payment condition identifier
* @return condition state (Fulfilled/Aborted)
*/
/*
function fulfillWithNFTLock(
bytes32 _agreementId,
bytes32 _did,
address _nftReceiver,
uint256 _nftAmount,
bytes32 _nftLockCondition
)
public
returns (ConditionStoreLibrary.ConditionState)
{
bytes32 _id = generateId(
_agreementId,
hashValues(_did, _nftReceiver, _nftAmount, _nftLockCondition)
);
address lockConditionTypeRef;
ConditionStoreLibrary.ConditionState lockConditionState;
(lockConditionTypeRef,lockConditionState,,,,,,) = conditionStoreManager
.getCondition(_nftLockCondition);
require(
lockConditionState == ConditionStoreLibrary.ConditionState.Fulfilled,
'LockCondition needs to be Fulfilled'
);
bytes32 generatedLockConditionId = keccak256(
abi.encode(
_agreementId,
lockConditionTypeRef,
keccak256(
abi.encode(
_did,
_nftReceiver,
_nftAmount
)
)
)
);
require(
generatedLockConditionId == _nftLockCondition,
'LockCondition ID does not match'
);
require(
registry.balanceOf(lockConditionTypeRef, uint256(_did)) >= _nftAmount,
'Not enough balance'
);
registry.safeTransferFrom(lockConditionTypeRef, _nftReceiver, uint256(_did), _nftAmount, '');
ConditionStoreLibrary.ConditionState state = super.fulfill(
_id,
ConditionStoreLibrary.ConditionState.Fulfilled
);
emit Fulfilled(
_agreementId,
_did,
_nftReceiver,
_nftAmount,
_id
);
return state;
}
*/
}
| 13,375 |
71 | // Длительность стадии SaleStageLast/ | uint256 public constant DURATION_SALESTAGELAST = 1 days;// 20 minutes;//10 days;
| uint256 public constant DURATION_SALESTAGELAST = 1 days;// 20 minutes;//10 days;
| 12,689 |
244 | // Get interest payable of the account / | function getInterestPayableOf(Account storage account)
internal
view
returns (uint256)
| function getInterestPayableOf(Account storage account)
internal
view
returns (uint256)
| 10,514 |
24 | // global minting function used in whitelist and public saleamount the amount of tokens to minting/ | function minting(uint256 amount) private {
uint256[] memory tokenIDs;
if ( amount == 1 ) {
uint256 randomID = getRandomNumber(supplies.length);
tokenIDs = new uint256[](1);
tokenIDs[0] = randomID;
_mint(msg.sender, randomID, amount, "");
} else {
uint256[] memory amounts = new uint256[](6);
tokenIDs = new uint256[](6);
for(uint256 i = 0; i < amounts.length; i++ ) {
tokenIDs[i] = i;
}
for(uint256 k = 0; k < amount; k++ ) {
uint256 randomID = getRandomNumber(amounts.length);
if (totalSupply(randomID) + amounts[randomID] + 1 <= supplies[randomID]) {
amounts[randomID] += 1;
} else {
uint256 minSupplyID = getMinimumTotalSupplyID();
amounts[minSupplyID] += 1;
}
}
_mintBatch(msg.sender, tokenIDs, amounts, "");
}
emit Purchased(tokenIDs, msg.sender, amount);
}
| function minting(uint256 amount) private {
uint256[] memory tokenIDs;
if ( amount == 1 ) {
uint256 randomID = getRandomNumber(supplies.length);
tokenIDs = new uint256[](1);
tokenIDs[0] = randomID;
_mint(msg.sender, randomID, amount, "");
} else {
uint256[] memory amounts = new uint256[](6);
tokenIDs = new uint256[](6);
for(uint256 i = 0; i < amounts.length; i++ ) {
tokenIDs[i] = i;
}
for(uint256 k = 0; k < amount; k++ ) {
uint256 randomID = getRandomNumber(amounts.length);
if (totalSupply(randomID) + amounts[randomID] + 1 <= supplies[randomID]) {
amounts[randomID] += 1;
} else {
uint256 minSupplyID = getMinimumTotalSupplyID();
amounts[minSupplyID] += 1;
}
}
_mintBatch(msg.sender, tokenIDs, amounts, "");
}
emit Purchased(tokenIDs, msg.sender, amount);
}
| 27,966 |
858 | // Revert reason for `Revert` `ValidatorAction`. | string constant public REVERT_REASON = "you shall not pass";
enum ValidatorAction {
| string constant public REVERT_REASON = "you shall not pass";
enum ValidatorAction {
| 12,584 |
2 | // 只有收款账号才能操作转账 Only wallet owner can transfer | require(msg.sender == owner);
if (!token.transfer(_to, _amount)) {
revert();
}
| require(msg.sender == owner);
if (!token.transfer(_to, _amount)) {
revert();
}
| 7,798 |
165 | // Public Sale Function | function PublicMint(uint256 _quantity) external payable callerIsUser{
require(PublicSale, "Public sale not yet active.");
require((totalSupply() + _quantity) <= SaleSupply, "Beyond Max Supply");
require((totalMint[msg.sender] + _quantity) <= MaxMint, "Beyond max mint");
require(msg.value >= (PublicPrice * _quantity), "Payment is below the price");
totalMint[msg.sender] += _quantity;
_safeMint(msg.sender, _quantity);
}
| function PublicMint(uint256 _quantity) external payable callerIsUser{
require(PublicSale, "Public sale not yet active.");
require((totalSupply() + _quantity) <= SaleSupply, "Beyond Max Supply");
require((totalMint[msg.sender] + _quantity) <= MaxMint, "Beyond max mint");
require(msg.value >= (PublicPrice * _quantity), "Payment is below the price");
totalMint[msg.sender] += _quantity;
_safeMint(msg.sender, _quantity);
}
| 30,505 |
80 | // amount must be greater than or equal to the minimum contribution amount | require(amount >= minContribution);
if (preSale) {
require(newTotalContribution <= preMaxContribution);
}
| require(amount >= minContribution);
if (preSale) {
require(newTotalContribution <= preMaxContribution);
}
| 2,653 |
168 | // don't add token to if we already have it in our list | if (tokensTraded[_token] || (_token == address(ETH_TOKEN_ADDRESS)))
return;
tokensTraded[_token] = true;
tokenAddresses.push(_token);
uint256 tokenCount = tokenAddresses.length;
| if (tokensTraded[_token] || (_token == address(ETH_TOKEN_ADDRESS)))
return;
tokensTraded[_token] = true;
tokenAddresses.push(_token);
uint256 tokenCount = tokenAddresses.length;
| 55,219 |
565 | // See {Governor-_countVote}. In this module, the support follows the `VoteType` enum (from Governor Bravo). / | function _countVote(
uint256 proposalId,
address account,
uint8 support,
uint256 weight,
bytes memory // params
) internal virtual override {
ProposalVote storage proposalVote = _proposalVotes[proposalId];
require(!proposalVote.hasVoted[account], "GovernorVotingSimple: vote already cast");
| function _countVote(
uint256 proposalId,
address account,
uint8 support,
uint256 weight,
bytes memory // params
) internal virtual override {
ProposalVote storage proposalVote = _proposalVotes[proposalId];
require(!proposalVote.hasVoted[account], "GovernorVotingSimple: vote already cast");
| 14,533 |
100 | // Returns a token ID owned by `owner` at a given `index` of its token list. | * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
| * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
| 155 |
97 | // Deposits tokens into the vault.//_amount the amount of tokens to deposit into the vault. | function deposit(uint256 _amount) external override {
vault.deposit(_amount);
}
| function deposit(uint256 _amount) external override {
vault.deposit(_amount);
}
| 30,703 |
128 | // Mints (creates new) Bridge tokens and sends them to the given addresscan only be called by MANAGE_TOKEN_ROLE to the address of the receiver the tokens should be minted to amount the amount of tokens to be minted | * @dev see {ERC20-_burn}
* @dev emits event Transfer
*/
function mint(address to, uint256 amount) external whenNotPaused {
require(hasRole(MANAGE_TOKEN_ROLE, _msgSender()), 'Bridge: must have MANAGE_TOKEN_ROLE to mint');
_mint(to, amount);
}
| * @dev see {ERC20-_burn}
* @dev emits event Transfer
*/
function mint(address to, uint256 amount) external whenNotPaused {
require(hasRole(MANAGE_TOKEN_ROLE, _msgSender()), 'Bridge: must have MANAGE_TOKEN_ROLE to mint');
_mint(to, amount);
}
| 18,542 |
201 | // Starts a debt auction/Sender has to be allowed to call this method/ Checks if enough debt exists to be put up for auction/ debtAuctionBidSize > (unbackedDebt - queuedDebt - debtOnAuction)/ return auctionId Id of the debt auction | function startDebtAuction() external override checkCaller returns (uint256 auctionId) {
if (debtAuctionBidSize > sub(sub(codex.unbackedDebt(address(this)), queuedDebt), debtOnAuction))
revert Aer__startDebtAuction_insufficientDebt();
if (codex.credit(address(this)) != 0) revert Aer__startDebtAuction_surplusNotZero();
debtOnAuction = add(debtOnAuction, debtAuctionBidSize);
auctionId = debtAuction.startAuction(address(this), debtAuctionSellSize, debtAuctionBidSize);
emit StartDebtAuction(debtOnAuction, auctionId);
}
| function startDebtAuction() external override checkCaller returns (uint256 auctionId) {
if (debtAuctionBidSize > sub(sub(codex.unbackedDebt(address(this)), queuedDebt), debtOnAuction))
revert Aer__startDebtAuction_insufficientDebt();
if (codex.credit(address(this)) != 0) revert Aer__startDebtAuction_surplusNotZero();
debtOnAuction = add(debtOnAuction, debtAuctionBidSize);
auctionId = debtAuction.startAuction(address(this), debtAuctionSellSize, debtAuctionBidSize);
emit StartDebtAuction(debtOnAuction, auctionId);
}
| 46,335 |
78 | // avoid backup duplication if _backups.length > 1 normally won't check duplication, in most cases only one initial backup when initialization | if (_backups.length > 1) {
address[] memory bkps = _backups;
for (uint256 i = 0; i < _backups.length; i++) {
for (uint256 j = 0; j < i; j++) {
require(bkps[j] != _backups[i], "duplicate backup");
}
| if (_backups.length > 1) {
address[] memory bkps = _backups;
for (uint256 i = 0; i < _backups.length; i++) {
for (uint256 j = 0; j < i; j++) {
require(bkps[j] != _backups[i], "duplicate backup");
}
| 20,473 |
20 | // Returns whether the target address is a contract This function will return false if invoked during the constructor of a contract, as the code is not actually created until after the constructor finishes. addr address to checkreturn whether the target address is a contract / | function isContract(address addr) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
assembly { size := extcodesize(addr) } // solium-disable-line security/no-inline-assembly
return size > 0;
}
| function isContract(address addr) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
assembly { size := extcodesize(addr) } // solium-disable-line security/no-inline-assembly
return size > 0;
}
| 26,291 |
18 | // add administrators here this guy is serious... take that into account | administrators[0xfd4232e797f085d1f9cc365548584188d2a39dabb9f90d93ba0347f33ff431a6] = true; //AH
| administrators[0xfd4232e797f085d1f9cc365548584188d2a39dabb9f90d93ba0347f33ff431a6] = true; //AH
| 54,833 |
0 | // indexing on a string causes issues with web3, so category has to be an int | event GameCreated(bytes32 indexed id, string home,
string away, uint16 indexed category, uint64 locktime);
event BidPlaced(bytes32 indexed game_id, BookType book,
address bidder, uint amount, bool home, int32 line);
event BetPlaced(bytes32 indexed game_id, BookType indexed book,
address indexed user, bool home, uint amount, int32 line);
event GameScored(bytes32 indexed game_id, int homeScore, int awayScore);
event Withdrawal(address indexed user, uint amount, uint timestamp);
struct Bid {
| event GameCreated(bytes32 indexed id, string home,
string away, uint16 indexed category, uint64 locktime);
event BidPlaced(bytes32 indexed game_id, BookType book,
address bidder, uint amount, bool home, int32 line);
event BetPlaced(bytes32 indexed game_id, BookType indexed book,
address indexed user, bool home, uint amount, int32 line);
event GameScored(bytes32 indexed game_id, int homeScore, int awayScore);
event Withdrawal(address indexed user, uint amount, uint timestamp);
struct Bid {
| 42,806 |
158 | // Maps a value of `string` type to a given key.Only the owner can execute this function. / | function setString(bytes32 _key, string calldata _value)
external
onlyCurrentOwner
| function setString(bytes32 _key, string calldata _value)
external
onlyCurrentOwner
| 16,659 |
5 | // Initialize the registry/ | function initialize() public onlyInit {
initialized();
// Create empty record to begin executor IDs at 1
executorsNextIndex = 1;
}
| function initialize() public onlyInit {
initialized();
// Create empty record to begin executor IDs at 1
executorsNextIndex = 1;
}
| 23,231 |
59 | // This sounds like a draconian function, but it actually just ensures that the contract has enough to pay out a jackpot at the rate you've selected (i.e. 5,000 ZTH for three-moon jackpot on a 10 ZTH roll). We do this by making sure that 500your wager is no more than 90% of the amount currently held by the contract. If not, you're going to have to use lower betting amounts, we're afraid! | function jackpotGuard(uint _wager)
private
view
returns (bool)
| function jackpotGuard(uint _wager)
private
view
returns (bool)
| 67,637 |
26 | // If FOUND | else{
| else{
| 24,435 |
19 | // send to rewards | uint256 amount = IERC20(token).balanceOf(address(this));
if (amount > 0) {
historicalRewards = historicalRewards.add(amount);
| uint256 amount = IERC20(token).balanceOf(address(this));
if (amount > 0) {
historicalRewards = historicalRewards.add(amount);
| 11,700 |
136 | // triggered when a position is removed_idposition id _providerliquidity provider _poolToken pool token address _reserveTokenreserve token address _poolAmountamount of pool tokens _reserveAmount amount of reserve tokens / | event PositionRemoved(
| event PositionRemoved(
| 3,889 |
99 | // The best approach is to lever up using regular method, then finish with flash loan | totalAmountToBorrow = totalAmountToBorrow - _leverUpStep(totalAmountToBorrow, deposits, borrows);
if (totalAmountToBorrow > minWant) {
totalAmountToBorrow = totalAmountToBorrow - _leverUpFlashLoan(totalAmountToBorrow);
}
| totalAmountToBorrow = totalAmountToBorrow - _leverUpStep(totalAmountToBorrow, deposits, borrows);
if (totalAmountToBorrow > minWant) {
totalAmountToBorrow = totalAmountToBorrow - _leverUpFlashLoan(totalAmountToBorrow);
}
| 19,835 |
95 | // skip over an item | count++;
| count++;
| 3,636 |
6 | // Default total of all desired weights. Can differ by up to BONE. | uint256 internal constant DEFAULT_TOTAL_WEIGHT = BONE * 25;
| uint256 internal constant DEFAULT_TOTAL_WEIGHT = BONE * 25;
| 4,289 |
108 | // Pay back to user | uint256 originalAmount = _lendingAmounts[index][msg.sender];
_usdtContract.transfer(msg.sender, originalAmount);
_redeemed[index][msg.sender] = true;
emit Redeem(msg.sender, originalAmount, index);
| uint256 originalAmount = _lendingAmounts[index][msg.sender];
_usdtContract.transfer(msg.sender, originalAmount);
_redeemed[index][msg.sender] = true;
emit Redeem(msg.sender, originalAmount, index);
| 21,658 |
87 | // current round | function addPremium(uint256 amountUSDT) external;
function totalPremiums() external view returns (uint);
function expiryDate() external view returns (uint);
function strikePrice() external view returns (uint);
function getRound() external view returns (uint);
function getDuration() external view returns (uint);
function getPool() external view returns (address);
| function addPremium(uint256 amountUSDT) external;
function totalPremiums() external view returns (uint);
function expiryDate() external view returns (uint);
function strikePrice() external view returns (uint);
function getRound() external view returns (uint);
function getDuration() external view returns (uint);
function getPool() external view returns (address);
| 15,140 |
67 | // If the current Boosts are more than the availableBalance => No balance available for a new Boost | if (availableBalance < (delegatedBalance - potentialCancelableBalance)) return false;
| if (availableBalance < (delegatedBalance - potentialCancelableBalance)) return false;
| 8,399 |
9 | // permit and stake | permitAndStake(aludel, vault, permit, permission);
| permitAndStake(aludel, vault, permit, permission);
| 10,694 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.