Skip to content

Commit

Permalink
Merge pull request #82 from usmfum/fix/public-not-private
Browse files Browse the repository at this point in the history
Made some stuff that had no clear reason not to be public, public!
  • Loading branch information
jacob-eliosoff authored Jan 18, 2021
2 parents 08a72fa + e02f89e commit 35ddce9
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions contracts/USMTemplate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ abstract contract USMTemplate is IUSM, Oracle, ERC20Permit, Delegable {
* @return usmOut The amount of USM to receive in exchange
*/
function usmFromMint(uint ethUsmPrice, uint ethIn, uint ethQty0, uint usmQty0, uint debtRatio0)
internal view returns (uint usmOut)
public view returns (uint usmOut)
{
uint usmPrice0 = usmPrice(Side.Buy, ethUsmPrice, debtRatio0);
uint ethQty1 = ethQty0.add(ethIn);
Expand Down Expand Up @@ -432,7 +432,7 @@ abstract contract USMTemplate is IUSM, Oracle, ERC20Permit, Delegable {
* @return ethOut The amount of ETH to receive in exchange
*/
function ethFromBurn(uint ethUsmPrice, uint usmIn, uint ethQty0, uint usmQty0, uint debtRatio0)
internal view returns (uint ethOut)
public view returns (uint ethOut)
{
// Burn USM at a sliding-down USM price (ie, a sliding-up ETH price):
uint usmPrice0 = usmPrice(Side.Sell, ethUsmPrice, debtRatio0);
Expand All @@ -451,7 +451,7 @@ abstract contract USMTemplate is IUSM, Oracle, ERC20Permit, Delegable {
* @return fumOut The amount of FUM to receive in exchange
*/
function fumFromFund(uint ethUsmPrice, uint ethIn, uint ethQty0, uint usmQty0, uint fumQty0, uint adjustment)
internal view returns (uint fumOut)
public view returns (uint fumOut)
{
// Create FUM at a sliding-up FUM price:
uint fumPrice0 = fumPrice(Side.Buy, ethUsmPrice, ethQty0, usmQty0, fumQty0, adjustment);
Expand All @@ -471,7 +471,7 @@ abstract contract USMTemplate is IUSM, Oracle, ERC20Permit, Delegable {
* @return ethOut The amount of ETH to receive in exchange
*/
function ethFromDefund(uint ethUsmPrice, uint fumIn, uint ethQty0, uint usmQty0)
internal view returns (uint ethOut)
public view returns (uint ethOut)
{
// Burn FUM at a sliding-down FUM price:
uint fumQty0 = fum.totalSupply();
Expand Down
16 changes: 8 additions & 8 deletions contracts/WadMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ library WadMath {

enum Round {Down, Up}

uint private constant WAD = 10 ** 18;
uint private constant WAD_MINUS_1 = WAD - 1;
uint private constant WAD_SQUARED = WAD * WAD;
uint private constant WAD_SQUARED_MINUS_1 = WAD_SQUARED - 1;
uint private constant WAD_OVER_10 = WAD / 10;
uint private constant WAD_OVER_20 = WAD / 20;
uint private constant HALF_TO_THE_ONE_TENTH = 933032991536807416;
uint private constant TWO_WAD = 2 * WAD;
uint public constant WAD = 10 ** 18;
uint public constant WAD_MINUS_1 = WAD - 1;
uint public constant WAD_SQUARED = WAD * WAD;
uint public constant WAD_SQUARED_MINUS_1 = WAD_SQUARED - 1;
uint public constant WAD_OVER_10 = WAD / 10;
uint public constant WAD_OVER_20 = WAD / 20;
uint public constant HALF_TO_THE_ONE_TENTH = 933032991536807416;
uint public constant TWO_WAD = 2 * WAD;

function wadMul(uint x, uint y, Round upOrDown) internal pure returns (uint) {
return upOrDown == Round.Down ? wadMulDown(x, y) : wadMulUp(x, y);
Expand Down
2 changes: 1 addition & 1 deletion contracts/mocks/MockChainlinkOracleUSM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "../USM.sol";
* @notice Like USM (so, also inheriting MedianOracle), but allows latestPrice() to be set for testing purposes
*/
contract MockChainlinkOracleUSM is USM, SettableOracle {
uint private constant NUM_UNISWAP_PAIRS = 3;
uint public constant NUM_UNISWAP_PAIRS = 3;

uint public savedPrice;

Expand Down
2 changes: 1 addition & 1 deletion contracts/oracles/ChainlinkOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ contract ChainlinkOracle is Oracle {

uint private constant SCALE_FACTOR = 10 ** 10; // Since Chainlink has 8 dec places, and latestPrice() needs 18

AggregatorV3Interface private aggregator;
AggregatorV3Interface public aggregator;

constructor(AggregatorV3Interface aggregator_) public
{
Expand Down
2 changes: 1 addition & 1 deletion contracts/oracles/CompoundOpenOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract CompoundOpenOracle is Oracle {

uint private constant SCALE_FACTOR = 10 ** 12; // Since Compound has 6 dec places, and latestPrice() needs 18

UniswapAnchoredView private anchoredView;
UniswapAnchoredView public anchoredView;

constructor(UniswapAnchoredView anchoredView_) public
{
Expand Down
2 changes: 1 addition & 1 deletion contracts/oracles/MedianOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ contract MedianOracle is ChainlinkOracle, CompoundOpenOracle, OurUniswapV2TWAPOr
* @return median value
*/
function median(uint a, uint b, uint c)
private pure returns (uint)
public pure returns (uint)
{
bool ab = a > b;
bool bc = b > c;
Expand Down
8 changes: 4 additions & 4 deletions contracts/oracles/OurUniswapV2TWAPOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ contract OurUniswapV2TWAPOracle is Oracle {
* We store two CumulativePrices, A and B, without specifying which is more recent. This is so that we only need to do one
* SSTORE each time we save a new one: we can inspect them later to figure out which is newer - see orderedStoredPrices().
*/
CumulativePrice private storedPriceA;
CumulativePrice private storedPriceB;
CumulativePrice public storedPriceA;
CumulativePrice public storedPriceB;

/**
* Example pairs to pass in:
Expand Down Expand Up @@ -145,7 +145,7 @@ contract OurUniswapV2TWAPOracle is Oracle {
* 10,001,370.1 (stored as 10,001,370.1 * 10**18).
*/
function cumulativePrice()
private view returns (uint timestamp, uint priceSeconds)
public view returns (uint timestamp, uint priceSeconds)
{
(, , timestamp) = uniswapPair.getReserves();

Expand All @@ -165,7 +165,7 @@ contract OurUniswapV2TWAPOracle is Oracle {
* @return price WAD-scaled.
*/
function calculateTWAP(uint newTimestamp, uint newPriceSeconds, uint oldTimestamp, uint oldPriceSeconds)
private pure returns (uint price)
public pure returns (uint price)
{
price = (newPriceSeconds.sub(oldPriceSeconds)).div(newTimestamp.sub(oldTimestamp));
}
Expand Down

0 comments on commit 35ddce9

Please sign in to comment.