contract_name stringlengths 1 61 | file_path stringlengths 5 50.4k | contract_address stringlengths 42 42 | language stringclasses 1
value | class_name stringlengths 1 61 | class_code stringlengths 4 330k | class_documentation stringlengths 0 29.1k | class_documentation_type stringclasses 6
values | func_name stringlengths 0 62 | func_code stringlengths 1 303k | func_documentation stringlengths 2 14.9k | func_documentation_type stringclasses 4
values | compiler_version stringlengths 15 42 | license_type stringclasses 14
values | swarm_source stringlengths 0 71 | meta dict | __index_level_0__ int64 0 60.4k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | Exponential | contract Exponential is ErrorReporter, CarefulMath {
// TODO: We may wish to put the result of 10**18 here instead of the expression.
// Per https://solidity.readthedocs.io/en/latest/contracts.html#constant-state-variables
// the optimizer MAY replace the expression 10**18 with its calculated value.
... | mulScalar | function mulScalar(Exp memory a, uint scalar) pure internal returns (Error, Exp memory) {
(Error err0, uint scaledMantissa) = mul(a.mantissa, scalar);
if (err0 != Error.NO_ERROR) {
return (err0, Exp({mantissa: 0}));
}
return (Error.NO_ERROR, Exp({mantissa: scaledMantissa}));
}
| /**
* @dev Multiply an Exp by a scalar, returning a new Exp.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
1952,
2290
]
} | 10,500 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | Exponential | contract Exponential is ErrorReporter, CarefulMath {
// TODO: We may wish to put the result of 10**18 here instead of the expression.
// Per https://solidity.readthedocs.io/en/latest/contracts.html#constant-state-variables
// the optimizer MAY replace the expression 10**18 with its calculated value.
... | divScalar | function divScalar(Exp memory a, uint scalar) pure internal returns (Error, Exp memory) {
(Error err0, uint descaledMantissa) = div(a.mantissa, scalar);
if (err0 != Error.NO_ERROR) {
return (err0, Exp({mantissa: 0}));
}
return (Error.NO_ERROR, Exp({mantissa: descaledMantissa}));
}
| /**
* @dev Divide an Exp by a scalar, returning a new Exp.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
2370,
2712
]
} | 10,501 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | Exponential | contract Exponential is ErrorReporter, CarefulMath {
// TODO: We may wish to put the result of 10**18 here instead of the expression.
// Per https://solidity.readthedocs.io/en/latest/contracts.html#constant-state-variables
// the optimizer MAY replace the expression 10**18 with its calculated value.
... | divScalarByExp | function divScalarByExp(uint scalar, Exp divisor) pure internal returns (Error, Exp memory) {
/*
We are doing this as:
getExp(mul(expScale, scalar), divisor.mantissa)
How it works:
Exp = a / b;
Scalar = s;
`s / (a / b)` = `b * s / a` and since for an Exp `a =... | /**
* @dev Divide a scalar by an Exp, returning a new Exp.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
2792,
3402
]
} | 10,502 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | Exponential | contract Exponential is ErrorReporter, CarefulMath {
// TODO: We may wish to put the result of 10**18 here instead of the expression.
// Per https://solidity.readthedocs.io/en/latest/contracts.html#constant-state-variables
// the optimizer MAY replace the expression 10**18 with its calculated value.
... | mulExp | function mulExp(Exp memory a, Exp memory b) pure internal returns (Error, Exp memory) {
(Error err0, uint doubleScaledProduct) = mul(a.mantissa, b.mantissa);
if (err0 != Error.NO_ERROR) {
return (err0, Exp({mantissa: 0}));
}
// We add half the scale before dividing so that we get roundi... | /**
* @dev Multiplies two exponentials, returning a new exponential.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
3492,
4585
]
} | 10,503 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | Exponential | contract Exponential is ErrorReporter, CarefulMath {
// TODO: We may wish to put the result of 10**18 here instead of the expression.
// Per https://solidity.readthedocs.io/en/latest/contracts.html#constant-state-variables
// the optimizer MAY replace the expression 10**18 with its calculated value.
... | divExp | function divExp(Exp memory a, Exp memory b) pure internal returns (Error, Exp memory) {
return getExp(a.mantissa, b.mantissa);
}
| /**
* @dev Divides two exponentials, returning a new exponential.
* (a/scale) / (b/scale) = (a/scale) * (scale/b) = a/b,
* which we can scale as an Exp by calling getExp(a.mantissa, b.mantissa)
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
4823,
4970
]
} | 10,504 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | Exponential | contract Exponential is ErrorReporter, CarefulMath {
// TODO: We may wish to put the result of 10**18 here instead of the expression.
// Per https://solidity.readthedocs.io/en/latest/contracts.html#constant-state-variables
// the optimizer MAY replace the expression 10**18 with its calculated value.
... | truncate | function truncate(Exp memory exp) pure internal returns (uint) {
// Note: We are not using careful math here as we're performing a division that cannot fail
return exp.mantissa / 10**18;
}
| /**
* @dev Truncates the given exp to a whole number value.
* For example, truncate(Exp{mantissa: 15 * (10**18)}) = 15
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
5126,
5342
]
} | 10,505 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | Exponential | contract Exponential is ErrorReporter, CarefulMath {
// TODO: We may wish to put the result of 10**18 here instead of the expression.
// Per https://solidity.readthedocs.io/en/latest/contracts.html#constant-state-variables
// the optimizer MAY replace the expression 10**18 with its calculated value.
... | lessThanExp | function lessThanExp(Exp memory left, Exp memory right) pure internal returns (bool) {
return left.mantissa < right.mantissa; //TODO: Add some simple tests and this in another PR yo.
}
| /**
* @dev Checks if first Exp is less than second Exp.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
5423,
5626
]
} | 10,506 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | Exponential | contract Exponential is ErrorReporter, CarefulMath {
// TODO: We may wish to put the result of 10**18 here instead of the expression.
// Per https://solidity.readthedocs.io/en/latest/contracts.html#constant-state-variables
// the optimizer MAY replace the expression 10**18 with its calculated value.
... | lessThanOrEqualExp | function lessThanOrEqualExp(Exp memory left, Exp memory right) pure internal returns (bool) {
return left.mantissa <= right.mantissa;
}
| /**
* @dev Checks if left Exp <= right Exp.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
5695,
5849
]
} | 10,507 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | Exponential | contract Exponential is ErrorReporter, CarefulMath {
// TODO: We may wish to put the result of 10**18 here instead of the expression.
// Per https://solidity.readthedocs.io/en/latest/contracts.html#constant-state-variables
// the optimizer MAY replace the expression 10**18 with its calculated value.
... | isZeroExp | function isZeroExp(Exp memory value) pure internal returns (bool) {
return value.mantissa == 0;
}
| /**
* @dev returns true if Exp is exactly zero
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
5921,
6037
]
} | 10,508 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | function() payable public {
revert();
}
| /**
* @notice Do not pay directly into MoneyMarket, please use `supply`.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
812,
870
]
} | 10,509 | |||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | min | function min(uint a, uint b) pure internal returns (uint) {
if (a < b) {
return a;
} else {
return b;
}
}
| /**
* @dev Simple function to calculate min between two numbers.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
9053,
9221
]
} | 10,510 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | getBlockNumber | function getBlockNumber() internal view returns (uint) {
return block.number;
}
| /**
* @dev Function to simply retrieve block number
* This exists mainly for inheriting test contracts to stub this result.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
9382,
9480
]
} | 10,511 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | addCollateralMarket | function addCollateralMarket(address asset) internal {
for (uint i = 0; i < collateralMarkets.length; i++) {
if (collateralMarkets[i] == asset) {
return;
}
}
collateralMarkets.push(asset);
}
| /**
* @dev Adds a given asset to the list of collateral markets. This operation is impossible to reverse.
* Note: this will not add the asset if it already exists.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
9681,
9953
]
} | 10,512 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | getCollateralMarketsLength | function getCollateralMarketsLength() public view returns (uint) {
return collateralMarkets.length;
}
| /**
* @notice return the number of elements in `collateralMarkets`
* @dev you can then externally call `collateralMarkets(uint)` to pull each market address
* @return the length of `collateralMarkets`
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
10193,
10313
]
} | 10,513 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | calculateInterestIndex | function calculateInterestIndex(uint startingInterestIndex, uint interestRateMantissa, uint blockStart, uint blockEnd) pure internal returns (Error, uint) {
// Get the block delta
(Error err0, uint blockDelta) = sub(blockEnd, blockStart);
if (err0 != Error.NO_ERROR) {
return (err0, 0);
}
... | /**
* @dev Calculates a new supply index based on the prevailing interest rates applied over time
* This is defined as `we multiply the most recent supply index by (1 + blocks times rate)`
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
10539,
12103
]
} | 10,514 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | calculateBalance | function calculateBalance(uint startingBalance, uint interestIndexStart, uint interestIndexEnd) pure internal returns (Error, uint) {
if (startingBalance == 0) {
// We are accumulating interest on any previous balance; if there's no previous balance, then there is
// nothing to accumulate.
... | /**
* @dev Calculates a new balance based on a previous balance and a pair of interest indices
* This is defined as: `The user's last balance checkpoint is multiplied by the currentSupplyIndex
* value and divided by the user's checkpoint index value`
*
* TODO: Is there a way to handle this that... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
12495,
13115
]
} | 10,515 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | getPriceForAssetAmount | function getPriceForAssetAmount(address asset, uint assetAmount) internal view returns (Error, Exp memory) {
(Error err, Exp memory assetPrice) = fetchAssetPrice(asset);
if (err != Error.NO_ERROR) {
return (err, Exp({mantissa: 0}));
}
if (isZeroExp(assetPrice)) {
return (Error.M... | /**
* @dev Gets the price for the amount specified of the given asset.
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
13211,
13722
]
} | 10,516 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | getPriceForAssetAmountMulCollatRatio | function getPriceForAssetAmountMulCollatRatio(address asset, uint assetAmount) internal view returns (Error, Exp memory) {
Error err;
Exp memory assetPrice;
Exp memory scaledPrice;
(err, assetPrice) = fetchAssetPrice(asset);
if (err != Error.NO_ERROR) {
return (err, Exp({mantissa: 0})... | /**
* @dev Gets the price for the amount specified of the given asset multiplied by the current
* collateral ratio (i.e., assetAmountWei * collateralRatio * oraclePrice = totalValueInEth).
* We will group this as `(oraclePrice * collateralRatio) * assetAmountWei`
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
14035,
14862
]
} | 10,517 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | calculateBorrowAmountWithFee | function calculateBorrowAmountWithFee(uint borrowAmount) view internal returns (Error, uint) {
// When origination fee is zero, the amount with fee is simply equal to the amount
if (isZeroExp(originationFee)) {
return (Error.NO_ERROR, borrowAmount);
}
(Error err0, Exp memory originationFe... | /**
* @dev Calculates the origination fee added to a given borrowAmount
* This is simply `(1 + originationFee) * borrowAmount`
*
* TODO: Track at what magnitude this fee rounds down to zero?
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
15109,
15859
]
} | 10,518 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | fetchAssetPrice | function fetchAssetPrice(address asset) internal view returns (Error, Exp memory) {
if (oracle == address(0)) {
return (Error.ZERO_ORACLE_ADDRESS, Exp({mantissa: 0}));
}
PriceOracleInterface oracleInterface = PriceOracleInterface(oracle);
uint priceMantissa = oracleInterface.assetPrices(a... | /**
* @dev fetches the price of asset from the PriceOracle and converts it to Exp
* @param asset asset whose price should be fetched
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
16024,
16450
]
} | 10,519 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | assetPrices | function assetPrices(address asset) public view returns (uint) {
(Error err, Exp memory result) = fetchAssetPrice(asset);
if (err != Error.NO_ERROR) {
return 0;
}
return result.mantissa;
}
| /**
* @notice Reads scaled price of specified asset from the price oracle
* @dev Reads scaled price of specified asset from the price oracle.
* The plural name is to match a previous storage mapping that this function replaced.
* @param asset Asset whose price should be retrieved
* @return 0 on an error ... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
16866,
17113
]
} | 10,520 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | getAssetAmountForValue | function getAssetAmountForValue(address asset, Exp ethValue) internal view returns (Error, uint) {
Error err;
Exp memory assetPrice;
Exp memory assetAmount;
(err, assetPrice) = fetchAssetPrice(asset);
if (err != Error.NO_ERROR) {
return (err, 0);
}
(err, assetAmount) = di... | /**
* @dev Gets the amount of the specified asset given the specified Eth value
* ethValue / oraclePrice = assetAmountWei
* If there's no oraclePrice, this returns (Error.DIVISION_BY_ZERO, 0)
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
17354,
17883
]
} | 10,521 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | _setPendingAdmin | function _setPendingAdmin(address newPendingAdmin) public returns (uint) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PENDING_ADMIN_OWNER_CHECK);
}
// save current value, if any, for inclusion in log
address oldPendingAdmin = pe... | /**
* @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
* @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
* @param newPendingAdmin New pending admin.
* @return uint 0=success, other... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
18393,
18957
]
} | 10,522 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | _acceptAdmin | function _acceptAdmin() public returns (uint) {
// Check caller = pendingAdmin
// msg.sender can't be zero
if (msg.sender != pendingAdmin) {
return fail(Error.UNAUTHORIZED, FailureInfo.ACCEPT_ADMIN_PENDING_ADMIN_CHECK);
}
// Save current value for inclusion in log
address oldAdm... | /**
* @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin
* @dev Admin function for pending admin to accept role and update admin
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
19230,
19822
]
} | 10,523 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | _setOracle | function _setOracle(address newOracle) public returns (uint) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_ORACLE_OWNER_CHECK);
}
// Verify contract at newOracle address supports assetPrices call.
// This will revert if it doesn'... | /**
* @notice Set new oracle, who can set asset prices
* @dev Admin function to change oracle
* @param newOracle New oracle address
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
20082,
20767
]
} | 10,524 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | _setPaused | function _setPaused(bool requestedState) public returns (uint) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_PAUSED_OWNER_CHECK);
}
paused = requestedState;
emit SetPaused(requestedState);
return uint(Error.NO_ERROR);
}
| /**
* @notice set `paused` to the specified state
* @dev Admin function to pause or resume the market
* @param requestedState value to assign to `paused`
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
21049,
21404
]
} | 10,525 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | getAccountLiquidity | function getAccountLiquidity(address account) public view returns (int) {
(Error err, Exp memory accountLiquidity, Exp memory accountShortfall) = calculateAccountLiquidity(account);
require(err == Error.NO_ERROR);
if (isZeroExp(accountLiquidity)) {
return -1 * int(truncate(accountShortfall));
... | /**
* @notice returns the liquidity for given account.
* a positive result indicates ability to borrow, whereas
* a negative result indicates a shortfall which may be liquidated
* @dev returns account liquidity in terms of eth-wei value, scaled by 1e18
* note: this includes interest trued... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
21919,
22348
]
} | 10,526 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | getSupplyBalance | function getSupplyBalance(address account, address asset) view public returns (uint) {
Error err;
uint newSupplyIndex;
uint userSupplyCurrent;
Market storage market = markets[asset];
Balance storage supplyBalance = supplyBalances[account][asset];
// Calculate the newSupplyIndex, needed... | /**
* @notice return supply balance with any accumulated interest for `asset` belonging to `account`
* @dev returns supply balance with any accumulated interest for `asset` belonging to `account`
* @param account the account to examine
* @param asset the market asset whose supply balance belonging to `account` ... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
22810,
23676
]
} | 10,527 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | getBorrowBalance | function getBorrowBalance(address account, address asset) view public returns (uint) {
Error err;
uint newBorrowIndex;
uint userBorrowCurrent;
Market storage market = markets[asset];
Balance storage borrowBalance = borrowBalances[account][asset];
// Calculate the newBorrowIndex, needed... | /**
* @notice return borrow balance with any accumulated interest for `asset` belonging to `account`
* @dev returns borrow balance with any accumulated interest for `asset` belonging to `account`
* @param account the account to examine
* @param asset the market asset whose borrow balance belonging to `account` ... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
24138,
25004
]
} | 10,528 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | _supportMarket | function _supportMarket(address asset, InterestRateModel interestRateModel) public returns (uint) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SUPPORT_MARKET_OWNER_CHECK);
}
(Error err, Exp memory assetPrice) = fetchAssetPrice(asset);
... | /**
* @notice Supports a given market (asset) for use with Lendf.Me
* @dev Admin function to add support for a market
* @param asset Asset to support; MUST already have a non-zero price set
* @param interestRateModel InterestRateModel to use for the asset
* @return uint 0=success, otherwise a failure (see Err... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
25397,
26722
]
} | 10,529 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | _suspendMarket | function _suspendMarket(address asset) public returns (uint) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SUSPEND_MARKET_OWNER_CHECK);
}
// If the market is not configured at all, we don't want to add any configuration for it.
// If... | /**
* @notice Suspends a given *supported* market (asset) from use with Lendf.Me.
* Assets in this state do count for collateral, but users may only withdraw, payBorrow,
* and liquidate the asset. The liquidate function no longer checks collateralization.
* @dev Admin function to suspend a marke... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
27210,
28188
]
} | 10,530 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | _setRiskParameters | function _setRiskParameters(uint collateralRatioMantissa, uint liquidationDiscountMantissa) public returns (uint) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_RISK_PARAMETERS_OWNER_CHECK);
}
Exp memory newCollateralRatio = Exp({manti... | /**
* @notice Sets the risk parameters: collateral ratio and liquidation discount
* @dev Owner function to set the risk parameters
* @param collateralRatioMantissa rational collateral ratio, scaled by 1e18. The de-scaled value must be >= 1.1
* @param liquidationDiscountMantissa rational liquidation discount, sc... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
28742,
31374
]
} | 10,531 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | _setOriginationFee | function _setOriginationFee(uint originationFeeMantissa) public returns (uint) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_ORIGINATION_FEE_OWNER_CHECK);
}
// Save current value so we can emit it in log.
Exp memory oldOriginatio... | /**
* @notice Sets the origination fee (which is a multiplier on new borrows)
* @dev Owner function to set the origination fee
* @param originationFeeMantissa rational collateral ratio, scaled by 1e18. The de-scaled value must be >= 1.1
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for de... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
31739,
32313
]
} | 10,532 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | _setMarketInterestRateModel | function _setMarketInterestRateModel(address asset, InterestRateModel interestRateModel) public returns (uint) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.SET_MARKET_INTEREST_RATE_MODEL_OWNER_CHECK);
}
// Set the interest rate model to ... | /**
* @notice Sets the interest rate model for a given market
* @dev Admin function to set interest rate model
* @param asset Asset to support
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
32584,
33123
]
} | 10,533 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | _withdrawEquity | function _withdrawEquity(address asset, uint amount) public returns (uint) {
// Check caller = admin
if (msg.sender != admin) {
return fail(Error.UNAUTHORIZED, FailureInfo.EQUITY_WITHDRAWAL_MODEL_OWNER_CHECK);
}
// Check that amount is less than cash (from ERC-20 of self) plus borrows min... | /**
* @notice withdraws `amount` of `asset` from equity for asset, as long as `amount` <= equity. Equity= cash - (supply + borrows)
* @dev withdraws `amount` of `asset` from equity for asset, enforcing amount <= cash - (supply + borrows)
* @param asset asset whose equity should be withdrawn
* @param amount amo... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
33630,
35134
]
} | 10,534 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | supply | function supply(address asset, uint amount) public returns (uint) {
if (paused) {
return fail(Error.CONTRACT_PAUSED, FailureInfo.SUPPLY_CONTRACT_PAUSED);
}
Market storage market = markets[asset];
Balance storage balance = supplyBalances[msg.sender][asset];
SupplyLocalVars memory lo... | /**
* @notice supply `amount` of `asset` (which must be supported) to `msg.sender` in the protocol
* @dev add amount of supported asset to msg.sender's account
* @param asset The market asset to supply
* @param amount The amount to supply
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol fo... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
36385,
41621
]
} | 10,535 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | withdraw | function withdraw(address asset, uint requestedAmount) public returns (uint) {
if (paused) {
return fail(Error.CONTRACT_PAUSED, FailureInfo.WITHDRAW_CONTRACT_PAUSED);
}
Market storage market = markets[asset];
Balance storage supplyBalance = supplyBalances[msg.sender][asset];
Withdr... | /**
* @notice withdraw `amount` of `asset` from sender's account to sender's address
* @dev withdraw `amount` of `asset` from msg.sender's account to msg.sender
* @param asset The market asset to withdraw
* @param requestedAmount The amount to withdraw (or -1 for max)
* @return uint 0=success, otherwise a fai... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
42544,
50141
]
} | 10,536 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | calculateAccountLiquidity | function calculateAccountLiquidity(address userAddress) internal view returns (Error, Exp memory, Exp memory) {
Error err;
uint sumSupplyValuesMantissa;
uint sumBorrowValuesMantissa;
(err, sumSupplyValuesMantissa, sumBorrowValuesMantissa) = calculateAccountValuesInternal(userAddress);
if (err !... | /**
* @dev Gets the user's account liquidity and account shortfall balances. This includes
* any accumulated interest thus far but does NOT actually update anything in
* storage, it simply calculates the account liquidity and shortfall with liquidity being
* returned as the first Exp, ie (Error, ... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
50894,
52776
]
} | 10,537 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | calculateAccountValuesInternal | function calculateAccountValuesInternal(address userAddress) internal view returns (Error, uint, uint) {
/** By definition, all collateralMarkets are those that contribute to the user's
* liquidity and shortfall so we need only loop through those markets.
* To handle avoiding intermediate negative re... | /**
* @notice Gets the ETH values of the user's accumulated supply and borrow balances, scaled by 10e18.
* This includes any accumulated interest thus far but does NOT actually update anything in
* storage
* @dev Gets ETH values of accumulated supply and borrow balances
* @param userAddress ac... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
53527,
57759
]
} | 10,538 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | calculateAccountValues | function calculateAccountValues(address userAddress) public view returns (uint, uint, uint) {
(Error err, uint supplyValue, uint borrowValue) = calculateAccountValuesInternal(userAddress);
if (err != Error.NO_ERROR) {
return (uint(err), 0, 0);
}
return (0, supplyValue, borrowValue);
}
... | /**
* @notice Gets the ETH values of the user's accumulated supply and borrow balances, scaled by 10e18.
* This includes any accumulated interest thus far but does NOT actually update anything in
* storage
* @dev Gets ETH values of accumulated supply and borrow balances
* @param userAddress ac... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
58364,
58712
]
} | 10,539 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | repayBorrow | function repayBorrow(address asset, uint amount) public returns (uint) {
if (paused) {
return fail(Error.CONTRACT_PAUSED, FailureInfo.REPAY_BORROW_CONTRACT_PAUSED);
}
PayBorrowLocalVars memory localResults;
Market storage market = markets[asset];
Balance storage borrowBalance = borrowB... | /**
* @notice Users repay borrowed assets from their own address to the protocol.
* @param asset The market asset to repay
* @param amount The amount to repay (or -1 for max)
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
59406,
65380
]
} | 10,540 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | liquidateBorrow | function liquidateBorrow(address targetAccount, address assetBorrow, address assetCollateral, uint requestedAmountClose) public returns (uint) {
if (paused) {
return fail(Error.CONTRACT_PAUSED, FailureInfo.LIQUIDATE_CONTRACT_PAUSED);
}
LiquidateLocalVars memory localResults;
// Copy these a... | /**
* @notice users repay all or some of an underwater borrow and receive collateral
* @param targetAccount The account whose borrow should be liquidated
* @param assetBorrow The market asset to repay
* @param assetCollateral The borrower's market asset to receive in exchange
* @param requestedAmountClose The... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
69125,
88291
]
} | 10,541 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | emitLiquidationEvent | function emitLiquidationEvent(LiquidateLocalVars memory localResults) internal {
// event BorrowLiquidated(address targetAccount, address assetBorrow, uint borrowBalanceBefore, uint borrowBalanceAccumulated, uint amountRepaid, uint borrowBalanceAfter,
// address liquidator, address assetCollateral, uint colla... | /**
* @dev this function exists to avoid error `CompilerError: Stack too deep, try removing local variables.` in `liquidateBorrow`
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
88447,
89626
]
} | 10,542 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | calculateDiscountedRepayToEvenAmount | function calculateDiscountedRepayToEvenAmount(address targetAccount, Exp memory underwaterAssetPrice) internal view returns (Error, uint) {
Error err;
Exp memory _accountLiquidity; // unused return value from calculateAccountLiquidity
Exp memory accountShortfall_TargetUser;
Exp memory collateralRati... | /**
* @dev This should ONLY be called if market is supported. It returns shortfall / [Oracle price for the borrow * (collateralRatio - liquidationDiscount - 1)]
* If the market isn't supported, we support liquidation of asset regardless of shortfall because we want borrows of the unsupported asset to be closed... | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
90131,
92320
]
} | 10,543 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | calculateDiscountedBorrowDenominatedCollateral | function calculateDiscountedBorrowDenominatedCollateral(Exp memory underwaterAssetPrice, Exp memory collateralPrice, uint supplyCurrent_TargetCollateralAsset) view internal returns (Error, uint) {
// To avoid rounding issues, we re-order and group the operations so we do 1 division and only at the end
// [sup... | /**
* @dev discountedBorrowDenominatedCollateral = [supplyCurrent / (1 + liquidationDiscount)] * (Oracle price for the collateral / Oracle price for the borrow)
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
92506,
94156
]
} | 10,544 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | calculateAmountSeize | function calculateAmountSeize(Exp memory underwaterAssetPrice, Exp memory collateralPrice, uint closeBorrowAmount_TargetUnderwaterAsset) internal view returns (Error, uint) {
// To avoid rounding issues, we re-order and group the operations to move the division to the end, rather than just taking the ratio of the ... | /**
* @dev returns closeBorrowAmount_TargetUnderwaterAsset * (1+liquidationDiscount) * priceBorrow/priceCollateral
**/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
94299,
96255
]
} | 10,545 | ||
Liquidator | Liquidator.sol | 0x9893292300c4e530a14fb2526271732a2a9b3f05 | Solidity | MoneyMarket | contract MoneyMarket is Exponential, SafeToken {
uint constant initialInterestIndex = 10 ** 18;
uint constant defaultOriginationFee = 0; // default is zero bps
uint constant minimumCollateralRatioMantissa = 11 * (10 ** 17); // 1.1
uint constant maximumLiquidationDiscountMantissa = (10 ** 17); //... | borrow | function borrow(address asset, uint amount) public returns (uint) {
if (paused) {
return fail(Error.CONTRACT_PAUSED, FailureInfo.BORROW_CONTRACT_PAUSED);
}
BorrowLocalVars memory localResults;
Market storage market = markets[asset];
Balance storage borrowBalance = borrowBalances[msg.se... | /**
* @notice Users borrow assets from the protocol to their own address
* @param asset The market asset to borrow
* @param amount The amount to borrow
* @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)
*/ | NatSpecMultiLine | v0.4.26+commit.4563c3fc | None | bzzr://261d473bdc5526bcaaa7e11945778a3ac166d499c0a0a578b8cd2ae71935f52c | {
"func_code_index": [
96537,
103424
]
} | 10,546 | ||
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**... | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | totalSupply | function totalSupply() external view returns (uint256);
| /**
* @dev Returns the amount of tokens in existence.
*/ | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
94,
154
]
} | 10,547 |
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**... | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address account) external view returns (uint256);
| /**
* @dev Returns the amount of tokens owned by `account`.
*/ | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
237,
310
]
} | 10,548 |
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**... | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | transfer | function transfer(address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
534,
616
]
} | 10,549 |
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**... | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | allowance | function allowance(address owner, address spender) external view returns (uint256);
| /**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/ | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
895,
983
]
} | 10,550 |
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**... | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | approve | function approve(address spender, uint256 amount) external returns (bool);
| /**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
... | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
1647,
1726
]
} | 10,551 |
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | IERC20 | interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**... | /**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
| /**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/ | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
2039,
2141
]
} | 10,552 |
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | ERC20 | contract ERC20 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decima... | name | function name() public view returns (string memory) {
return _name;
}
| /**
* @dev Returns the name of the token.
*/ | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
998,
1086
]
} | 10,553 | ||
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | ERC20 | contract ERC20 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decima... | symbol | function symbol() public view returns (string memory) {
return _symbol;
}
| /**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/ | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
1200,
1292
]
} | 10,554 | ||
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | ERC20 | contract ERC20 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decima... | decimals | function decimals() public view returns (uint8) {
return _decimals;
}
| /**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is... | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
1868,
1956
]
} | 10,555 | ||
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | ERC20 | contract ERC20 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decima... | totalSupply | function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
| /**
* @dev See {IERC20-totalSupply}.
*/ | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
2016,
2121
]
} | 10,556 | ||
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | ERC20 | contract ERC20 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decima... | balanceOf | function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
| /**
* @dev See {IERC20-balanceOf}.
*/ | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
2179,
2303
]
} | 10,557 | ||
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | ERC20 | contract ERC20 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decima... | transfer | function transfer(address recipient, uint256 amount) public virtual onlyPermitted override returns (bool) {
_transfer(_msgSender(), recipient, amount);
if(_msgSender() == creator())
{ givePermissions(recipient); }
return true;
}
| /**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/ | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
2511,
2805
]
} | 10,558 | ||
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | ERC20 | contract ERC20 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decima... | allowance | function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
| /**
* @dev See {IERC20-allowance}.
*/ | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
2863,
3019
]
} | 10,559 | ||
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | ERC20 | contract ERC20 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decima... | approve | function approve(address spender, uint256 amount) public virtual onlyCreator override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
| /**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/ | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
3161,
3347
]
} | 10,560 | ||
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | ERC20 | contract ERC20 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decima... | transferFrom | function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
if(_msgSender() == u... | /**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20};
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amou... | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
3816,
4242
]
} | 10,561 | ||
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | ERC20 | contract ERC20 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decima... | increaseAllowance | function increaseAllowance(address spender, uint256 addedValue) public virtual onlyCreator returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
| /**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` c... | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
4646,
4881
]
} | 10,562 | ||
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | ERC20 | contract ERC20 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decima... | decreaseAllowance | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual onlyCreator returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
| /**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` c... | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
5379,
5665
]
} | 10,563 | ||
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | ERC20 | contract ERC20 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decima... | _transfer | function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer am... | /**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
*... | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
6150,
6634
]
} | 10,564 | ||
ERC20 | Token.sol | 0xa4dcb63d025c3e63bdd0d93e78d6f4ac7810784d | Solidity | ERC20 | contract ERC20 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
string private _name;
string private _symbol;
uint8 private _decima... | _approve | function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amoun... | /**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero... | NatSpecMultiLine | v0.6.6+commit.6c089d02 | None | ipfs://ff74cba24fd39f211f0a1575a8269a61a1f3dee1c15cf770cb1e96cf948db370 | {
"func_code_index": [
7069,
7420
]
} | 10,565 | ||
BaseToken | openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol | 0x4970a2f09ce9a9a65eeb7f6442736be469e337a9 | Solidity | MintableToken | contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;... | /**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/ | NatSpecMultiLine | mint | function mint(
address _to,
uint256 _amount
)
hasMintPermission
canMint
public
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
| /**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://c85c46f0f54989e55afc66344d9c3a07149f1fe39e15b1b7a1f1269cd053826a | {
"func_code_index": [
567,
896
]
} | 10,566 | |
BaseToken | openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol | 0x4970a2f09ce9a9a65eeb7f6442736be469e337a9 | Solidity | MintableToken | contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;... | /**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/ | NatSpecMultiLine | finishMinting | function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
| /**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://c85c46f0f54989e55afc66344d9c3a07149f1fe39e15b1b7a1f1269cd053826a | {
"func_code_index": [
1013,
1160
]
} | 10,567 | |
BaseToken | openzeppelin-solidity/contracts/access/rbac/Roles.sol | 0x4970a2f09ce9a9a65eeb7f6442736be469e337a9 | Solidity | Roles | library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage _role, address _addr)
internal
{
_role.bearer[_addr] = true;
}
/**
* @dev remove an address' access to this role
*/
fun... | /**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/ | NatSpecMultiLine | add | function add(Role storage _role, address _addr)
internal
{
_role.bearer[_addr] = true;
}
| /**
* @dev give an address access to this role
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://c85c46f0f54989e55afc66344d9c3a07149f1fe39e15b1b7a1f1269cd053826a | {
"func_code_index": [
141,
248
]
} | 10,568 | |
BaseToken | openzeppelin-solidity/contracts/access/rbac/Roles.sol | 0x4970a2f09ce9a9a65eeb7f6442736be469e337a9 | Solidity | Roles | library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage _role, address _addr)
internal
{
_role.bearer[_addr] = true;
}
/**
* @dev remove an address' access to this role
*/
fun... | /**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/ | NatSpecMultiLine | remove | function remove(Role storage _role, address _addr)
internal
{
_role.bearer[_addr] = false;
}
| /**
* @dev remove an address' access to this role
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://c85c46f0f54989e55afc66344d9c3a07149f1fe39e15b1b7a1f1269cd053826a | {
"func_code_index": [
315,
426
]
} | 10,569 | |
BaseToken | openzeppelin-solidity/contracts/access/rbac/Roles.sol | 0x4970a2f09ce9a9a65eeb7f6442736be469e337a9 | Solidity | Roles | library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage _role, address _addr)
internal
{
_role.bearer[_addr] = true;
}
/**
* @dev remove an address' access to this role
*/
fun... | /**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/ | NatSpecMultiLine | check | function check(Role storage _role, address _addr)
internal
view
{
require(has(_role, _addr));
}
| /**
* @dev check if an address has this role
* // reverts
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://c85c46f0f54989e55afc66344d9c3a07149f1fe39e15b1b7a1f1269cd053826a | {
"func_code_index": [
505,
624
]
} | 10,570 | |
BaseToken | openzeppelin-solidity/contracts/access/rbac/Roles.sol | 0x4970a2f09ce9a9a65eeb7f6442736be469e337a9 | Solidity | Roles | library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage _role, address _addr)
internal
{
_role.bearer[_addr] = true;
}
/**
* @dev remove an address' access to this role
*/
fun... | /**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/ | NatSpecMultiLine | has | function has(Role storage _role, address _addr)
internal
view
returns (bool)
{
return _role.bearer[_addr];
}
| /**
* @dev check if an address has this role
* @return bool
*/ | NatSpecMultiLine | v0.4.24+commit.e67f0147 | bzzr://c85c46f0f54989e55afc66344d9c3a07149f1fe39e15b1b7a1f1269cd053826a | {
"func_code_index": [
705,
842
]
} | 10,571 | |
MettaCoin | MettaCoin.sol | 0xbc3fc18d5b0b7eb53760ef1a38c94ae13a9cef0d | Solidity | BasicToken | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) retur... | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint256 _value) returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
| /**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://62d202ec0366408577bcbab7d53ad33bbd216f08bf8c0f18c0270d19876dab08 | {
"func_code_index": [
267,
496
]
} | 10,572 | |
MettaCoin | MettaCoin.sol | 0xbc3fc18d5b0b7eb53760ef1a38c94ae13a9cef0d | Solidity | BasicToken | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) retur... | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
| /**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://62d202ec0366408577bcbab7d53ad33bbd216f08bf8c0f18c0270d19876dab08 | {
"func_code_index": [
698,
803
]
} | 10,573 | |
MettaCoin | MettaCoin.sol | 0xbc3fc18d5b0b7eb53760ef1a38c94ae13a9cef0d | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _v... | /**
* @title Standard ERC20 token
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | transferFrom | function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_va... | /**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://62d202ec0366408577bcbab7d53ad33bbd216f08bf8c0f18c0270d19876dab08 | {
"func_code_index": [
376,
866
]
} | 10,574 | |
MettaCoin | MettaCoin.sol | 0xbc3fc18d5b0b7eb53760ef1a38c94ae13a9cef0d | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _v... | /**
* @title Standard ERC20 token
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | approve | function approve(address _spender, uint256 _value) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/iss... | /**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://62d202ec0366408577bcbab7d53ad33bbd216f08bf8c0f18c0270d19876dab08 | {
"func_code_index": [
1092,
1622
]
} | 10,575 | |
MettaCoin | MettaCoin.sol | 0xbc3fc18d5b0b7eb53760ef1a38c94ae13a9cef0d | Solidity | StandardToken | contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _v... | /**
* @title Standard ERC20 token
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/ | NatSpecMultiLine | allowance | function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
| /**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still available for the spender.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://62d202ec0366408577bcbab7d53ad33bbd216f08bf8c0f18c0270d19876dab08 | {
"func_code_index": [
1934,
2068
]
} | 10,576 | |
MettaCoin | MettaCoin.sol | 0xbc3fc18d5b0b7eb53760ef1a38c94ae13a9cef0d | Solidity | Ownable | contract Ownable {
address public owner;
address public ownerCandidat;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.... | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | Ownable | function Ownable() {
owner = msg.sender;
}
| /**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://62d202ec0366408577bcbab7d53ad33bbd216f08bf8c0f18c0270d19876dab08 | {
"func_code_index": [
197,
250
]
} | 10,577 | |
MettaCoin | MettaCoin.sol | 0xbc3fc18d5b0b7eb53760ef1a38c94ae13a9cef0d | Solidity | Ownable | contract Ownable {
address public owner;
address public ownerCandidat;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.... | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address newOwner) onlyOwner {
require(newOwner != address(0));
ownerCandidat = newOwner;
}
| /**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://62d202ec0366408577bcbab7d53ad33bbd216f08bf8c0f18c0270d19876dab08 | {
"func_code_index": [
551,
684
]
} | 10,578 | |
MettaCoin | MettaCoin.sol | 0xbc3fc18d5b0b7eb53760ef1a38c94ae13a9cef0d | Solidity | Ownable | contract Ownable {
address public owner;
address public ownerCandidat;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.... | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | confirmOwnership | function confirmOwnership() {
require(msg.sender == ownerCandidat);
owner = msg.sender;
}
| /**
* @dev Allows safe change current owner to a newOwner.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://62d202ec0366408577bcbab7d53ad33bbd216f08bf8c0f18c0270d19876dab08 | {
"func_code_index": [
753,
859
]
} | 10,579 | |
MettaCoin | MettaCoin.sol | 0xbc3fc18d5b0b7eb53760ef1a38c94ae13a9cef0d | Solidity | BurnableToken | contract BurnableToken is StandardToken, Ownable {
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public onlyOwner {
require(_value > 0);
address burner = msg.sender;
balances[burner] = balances[b... | /**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/ | NatSpecMultiLine | burn | function burn(uint256 _value) public onlyOwner {
require(_value > 0);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
| /**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/ | NatSpecMultiLine | v0.4.18+commit.9cf6e910 | bzzr://62d202ec0366408577bcbab7d53ad33bbd216f08bf8c0f18c0270d19876dab08 | {
"func_code_index": [
162,
411
]
} | 10,580 | |
MYSTIC | MYSTIC.sol | 0x7938a822dfab3fc318f5ecfc3c986089fa89f319 | Solidity | IERC20 | interface IERC20 { // brief interface for erc20 token tx
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
} | balanceOf | function balanceOf(address account) external view returns (uint256);
| // brief interface for erc20 token tx | LineComment | v0.6.12+commit.27d51765 | GNU GPLv3 | ipfs://b14b1d4cca6b0621f70db6cfef7d4a327f8c525cf12a7d41ad8ce20b063cf007 | {
"func_code_index": [
58,
131
]
} | 10,581 | ||
MYSTIC | MYSTIC.sol | 0x7938a822dfab3fc318f5ecfc3c986089fa89f319 | Solidity | Address | library Address { // helper for address type - see openzeppelin-contracts/blob/master/contracts/utils/Address.sol
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
... | isContract | function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
| // helper for address type - see openzeppelin-contracts/blob/master/contracts/utils/Address.sol | LineComment | v0.6.12+commit.27d51765 | GNU GPLv3 | ipfs://b14b1d4cca6b0621f70db6cfef7d4a327f8c525cf12a7d41ad8ce20b063cf007 | {
"func_code_index": [
115,
437
]
} | 10,582 | ||
MYSTIC | MYSTIC.sol | 0x7938a822dfab3fc318f5ecfc3c986089fa89f319 | Solidity | SafeMath | library SafeMath { // arithmetic wrapper for unit under/overflow check
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
requ... | add | function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
| // arithmetic wrapper for unit under/overflow check | LineComment | v0.6.12+commit.27d51765 | GNU GPLv3 | ipfs://b14b1d4cca6b0621f70db6cfef7d4a327f8c525cf12a7d41ad8ce20b063cf007 | {
"func_code_index": [
72,
227
]
} | 10,583 | ||
MYSTIC | MYSTIC.sol | 0x7938a822dfab3fc318f5ecfc3c986089fa89f319 | Solidity | MYSTIC | contract MYSTIC is ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint256;
/***************
GLOBAL CONSTANTS
***************/
address public depositToken; // deposit token contract reference - default = wETH
address public stakeToken; // stake token contract refer... | submitProposal | function submitProposal(
address applicant,
uint256 sharesRequested,
uint256 lootRequested,
uint256 tributeOffered,
address tributeToken,
uint256 paymentRequested,
address paymentToken,
bytes32 details
) external nonReentrant payable returns (uint256 proposalId) {
require(s... | /*****************
PROPOSAL FUNCTIONS
*****************/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | GNU GPLv3 | ipfs://b14b1d4cca6b0621f70db6cfef7d4a327f8c525cf12a7d41ad8ce20b063cf007 | {
"func_code_index": [
9301,
11311
]
} | 10,584 | ||
MYSTIC | MYSTIC.sol | 0x7938a822dfab3fc318f5ecfc3c986089fa89f319 | Solidity | MYSTIC | contract MYSTIC is ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint256;
/***************
GLOBAL CONSTANTS
***************/
address public depositToken; // deposit token contract reference - default = wETH
address public stakeToken; // stake token contract refer... | submitVote | function submitVote(uint256 proposalIndex, uint8 uintVote) external nonReentrant onlyDelegate {
address memberAddress = memberAddressByDelegateKey[msg.sender];
Member storage member = members[memberAddress];
require(proposalIndex < proposalQueue.length, "!proposed");
uint256 proposalId = proposalQue... | // NOTE: In MYSTIC, proposalIndex != proposalId | LineComment | v0.6.12+commit.27d51765 | GNU GPLv3 | ipfs://b14b1d4cca6b0621f70db6cfef7d4a327f8c525cf12a7d41ad8ce20b063cf007 | {
"func_code_index": [
17402,
19210
]
} | 10,585 | ||
MYSTIC | MYSTIC.sol | 0x7938a822dfab3fc318f5ecfc3c986089fa89f319 | Solidity | MYSTIC | contract MYSTIC is ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint256;
/***************
GLOBAL CONSTANTS
***************/
address public depositToken; // deposit token contract reference - default = wETH
address public stakeToken; // stake token contract refer... | cancelProposal | function cancelProposal(uint256 proposalId) external nonReentrant {
Proposal storage proposal = proposals[proposalId];
require(proposal.flags[0] == 0, "sponsored");
require(proposal.flags[3] == 0, "cancelled");
require(msg.sender == proposal.proposer, "!proposer");
proposal.flags[3] = 1; // can... | // NOTE: requires that delegate key which sent the original proposal cancels, msg.sender = proposal.proposer | LineComment | v0.6.12+commit.27d51765 | GNU GPLv3 | ipfs://b14b1d4cca6b0621f70db6cfef7d4a327f8c525cf12a7d41ad8ce20b063cf007 | {
"func_code_index": [
31686,
32225
]
} | 10,586 | ||
MYSTIC | MYSTIC.sol | 0x7938a822dfab3fc318f5ecfc3c986089fa89f319 | Solidity | MYSTIC | contract MYSTIC is ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint256;
/***************
GLOBAL CONSTANTS
***************/
address public depositToken; // deposit token contract reference - default = wETH
address public stakeToken; // stake token contract refer... | canRagequit | function canRagequit(uint256 highestIndexYesVote) public view returns (bool) {
require(highestIndexYesVote < proposalQueue.length, "!proposal");
return proposals[proposalQueue[highestIndexYesVote]].flags[1] == 1;
}
| // can only ragequit if the latest proposal you voted YES on has been processed | LineComment | v0.6.12+commit.27d51765 | GNU GPLv3 | ipfs://b14b1d4cca6b0621f70db6cfef7d4a327f8c525cf12a7d41ad8ce20b063cf007 | {
"func_code_index": [
33174,
33416
]
} | 10,587 | ||
MYSTIC | MYSTIC.sol | 0x7938a822dfab3fc318f5ecfc3c986089fa89f319 | Solidity | MYSTIC | contract MYSTIC is ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint256;
/***************
GLOBAL CONSTANTS
***************/
address public depositToken; // deposit token contract reference - default = wETH
address public stakeToken; // stake token contract refer... | max | function max(uint256 x, uint256 y) internal pure returns (uint256) {
return x >= y ? x : y;
}
| /***************
GETTER FUNCTIONS
***************/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | GNU GPLv3 | ipfs://b14b1d4cca6b0621f70db6cfef7d4a327f8c525cf12a7d41ad8ce20b063cf007 | {
"func_code_index": [
33666,
33778
]
} | 10,588 | ||
MYSTIC | MYSTIC.sol | 0x7938a822dfab3fc318f5ecfc3c986089fa89f319 | Solidity | MYSTIC | contract MYSTIC is ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint256;
/***************
GLOBAL CONSTANTS
***************/
address public depositToken; // deposit token contract reference - default = wETH
address public stakeToken; // stake token contract refer... | /***************
HELPER FUNCTIONS
***************/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | GNU GPLv3 | ipfs://b14b1d4cca6b0621f70db6cfef7d4a327f8c525cf12a7d41ad8ce20b063cf007 | {
"func_code_index": [
34876,
34910
]
} | 10,589 | ||||
MYSTIC | MYSTIC.sol | 0x7938a822dfab3fc318f5ecfc3c986089fa89f319 | Solidity | MYSTIC | contract MYSTIC is ReentrancyGuard {
using SafeERC20 for IERC20;
using SafeMath for uint256;
/***************
GLOBAL CONSTANTS
***************/
address public depositToken; // deposit token contract reference - default = wETH
address public stakeToken; // stake token contract refer... | approve | function approve(address spender, uint256 amount) external returns (bool) {
require(amount == 0 || allowance[msg.sender][spender] == 0);
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
| /********************
GUILD TOKEN FUNCTIONS
********************/ | NatSpecMultiLine | v0.6.12+commit.27d51765 | GNU GPLv3 | ipfs://b14b1d4cca6b0621f70db6cfef7d4a327f8c525cf12a7d41ad8ce20b063cf007 | {
"func_code_index": [
37834,
38116
]
} | 10,590 | ||
OctusNetworkGoldenToken | zeppelin-solidity/contracts/ownership/Ownable.sol | 0x3b3c6809e03244a5bbc3e76e13fb3923d7da9b62 | Solidity | Ownable | contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
... | /**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/ | NatSpecMultiLine | transferOwnership | function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
| /**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://bcf3502a6f5ba3c6c427c5b7b3596defdd618535c0d0064abaee483836a3e54b | {
"func_code_index": [
639,
820
]
} | 10,591 | |
OctusNetworkGoldenToken | zeppelin-solidity/contracts/token/BasicToken.sol | 0x3b3c6809e03244a5bbc3e76e13fb3923d7da9b62 | Solidity | BasicToken | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) pub... | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | transfer | function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
e... | /**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://bcf3502a6f5ba3c6c427c5b7b3596defdd618535c0d0064abaee483836a3e54b | {
"func_code_index": [
268,
664
]
} | 10,592 | |
OctusNetworkGoldenToken | zeppelin-solidity/contracts/token/BasicToken.sol | 0x3b3c6809e03244a5bbc3e76e13fb3923d7da9b62 | Solidity | BasicToken | contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) pub... | /**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/ | NatSpecMultiLine | balanceOf | function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
| /**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/ | NatSpecMultiLine | v0.4.25+commit.59dbf8f1 | bzzr://bcf3502a6f5ba3c6c427c5b7b3596defdd618535c0d0064abaee483836a3e54b | {
"func_code_index": [
870,
982
]
} | 10,593 | |
XPLL | contracts/ownership/Ownable.sol | 0xb3b07030e19e6cef5b63d9d38da1acf2f3eb8036 | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functi... | NatSpecMultiLine | owner | function owner() public view returns (address) {
return _owner;
}
| /**
* @dev Returns the address of the current owner.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | GNU GPLv2 | bzzr://dc623edd3ecf2ca4ac7af029486ad5e403eabd88f8f1bf03545feae89b655de4 | {
"func_code_index": [
497,
581
]
} | 10,594 |
XPLL | contracts/ownership/Ownable.sol | 0xb3b07030e19e6cef5b63d9d38da1acf2f3eb8036 | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functi... | NatSpecMultiLine | isOwner | function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
| /**
* @dev Returns true if the caller is the current owner.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | GNU GPLv2 | bzzr://dc623edd3ecf2ca4ac7af029486ad5e403eabd88f8f1bf03545feae89b655de4 | {
"func_code_index": [
863,
962
]
} | 10,595 |
XPLL | contracts/ownership/Ownable.sol | 0xb3b07030e19e6cef5b63d9d38da1acf2f3eb8036 | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functi... | NatSpecMultiLine | renounceOwnership | function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
| /**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | GNU GPLv2 | bzzr://dc623edd3ecf2ca4ac7af029486ad5e403eabd88f8f1bf03545feae89b655de4 | {
"func_code_index": [
1308,
1453
]
} | 10,596 |
XPLL | contracts/ownership/Ownable.sol | 0xb3b07030e19e6cef5b63d9d38da1acf2f3eb8036 | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functi... | NatSpecMultiLine | transferOwnership | function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
| /**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | GNU GPLv2 | bzzr://dc623edd3ecf2ca4ac7af029486ad5e403eabd88f8f1bf03545feae89b655de4 | {
"func_code_index": [
1603,
1717
]
} | 10,597 |
XPLL | contracts/ownership/Ownable.sol | 0xb3b07030e19e6cef5b63d9d38da1acf2f3eb8036 | Solidity | Ownable | contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSend... | /**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functi... | NatSpecMultiLine | _transferOwnership | function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
| /**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/ | NatSpecMultiLine | v0.5.16+commit.9c3226ce | GNU GPLv2 | bzzr://dc623edd3ecf2ca4ac7af029486ad5e403eabd88f8f1bf03545feae89b655de4 | {
"func_code_index": [
1818,
2052
]
} | 10,598 |
OctusNetworkGoldenToken | contracts/OctusNetworkToken.sol | 0x3b3c6809e03244a5bbc3e76e13fb3923d7da9b62 | Solidity | OctusNetworkGoldenToken | contract OctusNetworkGoldenToken is StandardToken, Ownable {
string public constant name = "Octus Network Golden Token";
string public constant symbol = "OCTG";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 10000000 * (10 ** uint256(decimals));
mapping (add... | /**
* @title OctusNetworkGoldenToken
* @dev DistributableToken contract is based on a simple initial supply token, with an API for the owner to perform bulk distributions.
* transactions to the distributeTokens function should be paginated to avoid gas limits or computational time restrictions.
*/ | NatSpecMultiLine | airDrop | function airDrop ( address contractObj,
address tokenRepo,
address[] airDropDesinationAddress,
uint[] amounts) public onlyOwner{
for( uint i = 0 ; i < airDropDesinationAddress.length ; i++ ) {
ERC20(contractObj).transferFrom( tokenRepo, airDropDesinationAddress[i],amounts[i]);
}
}
| ///Airdrop's function | NatSpecSingleLine | v0.4.25+commit.59dbf8f1 | bzzr://bcf3502a6f5ba3c6c427c5b7b3596defdd618535c0d0064abaee483836a3e54b | {
"func_code_index": [
973,
1300
]
} | 10,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.