diff --git a/README.md b/README.md index f0739be..50654ca 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,17 @@ Implementations of MakerDAO surplus auctions, triggered on `vow.flap`. ### Splitter -Exposes a `kick` operation to be triggered periodically. Its logic withdraws `NST` from the `vow` and splits it in two parts. The first part (`burn`) is sent to the underlying `flapper` contract to be processed by the burn engine. The second part (`WAD - burn`) is distributed as reward to a `farm` contract. The `kick` cadence is determined by the `hop` value. +Exposes a `kick` operation to be triggered periodically. Its logic withdraws `USDS` from the `vow` and splits it in two parts. The first part (`burn`) is sent to the underlying `flapper` contract to be processed by the burn engine. The second part (`WAD - burn`) is distributed as reward to a `farm` contract. The `kick` cadence is determined by the `hop` value. Configurable Parameters: -* `burn` - The percentage of the `vow.bump` to be moved to the underlying `flapper`. For example, a value of 0.70 \* `WAD` corresponds to funneling 70% of the `NST` to the burn engine. +* `burn` - The percentage of the `vow.bump` to be moved to the underlying `flapper`. For example, a value of 0.70 \* `WAD` corresponds to funneling 70% of the `USDS` to the burn engine. * `hop` - Minimum seconds interval between kicks. * `flapper` - The underlying burner strategy (e.g. the address of `FlapperUniV2SwapOnly`). * `farm` - The staking rewards contract receiving the rewards. ### FlapperUniV2 -Exposes an `exec` operation to be triggered periodically by the `Splitter` (at a cadence determined by `Splitter.hop()`). Its logic withdraws `NST` from the `Splitter` and buys `gem` tokens on Uniswap v2. The acquired tokens, along with a proportional amount of `NST` (saved from the initial withdraw) are deposited back into the liquidity pool. Finally, the minted LP tokens are sent to a predefined `receiver` address. +Exposes an `exec` operation to be triggered periodically by the `Splitter` (at a cadence determined by `Splitter.hop()`). Its logic withdraws `USDS` from the `Splitter` and buys `gem` tokens on Uniswap v2. The acquired tokens, along with a proportional amount of `USDS` (saved from the initial withdraw) are deposited back into the liquidity pool. Finally, the minted LP tokens are sent to a predefined `receiver` address. Configurable Parameters: * `pip` - A reference price oracle, used for bounding the exchange rate of the swap. @@ -26,7 +26,7 @@ Configurable Parameters: ### FlapperUniV2SwapOnly -Exposes an `exec` operation to be triggered periodically by the `Splitter` (at a cadence determined by `Splitter.hop()`). Its logic withdraws `NST` from the `Splitter` and buys `gem` tokens on Uniswap v2. The acquired tokens are sent to a predefined `receiver` address. +Exposes an `exec` operation to be triggered periodically by the `Splitter` (at a cadence determined by `Splitter.hop()`). Its logic withdraws `USDS` from the `Splitter` and buys `gem` tokens on Uniswap v2. The acquired tokens are sent to a predefined `receiver` address. Configurable Parameters: * `pip` - A reference price oracle, used for bounding the exchange rate of the swap. @@ -42,4 +42,4 @@ Allows for scaling down an oracle price by a certain value. This can be useful w ### General Note: -* Availability and accounting of the withdrawn `NST` is the responsibility of the `vow`. At the time of a `kick`, the `vow` is expected to hold at least the drawn amount (`vow.bump`) over the configured flapping threshold (`vow.hump`). +* Availability and accounting of the withdrawn `USDS` is the responsibility of the `vow`. At the time of a `kick`, the `vow` is expected to hold at least the drawn amount (`vow.bump`) over the configured flapping threshold (`vow.hump`). diff --git a/deploy/FlapperDeploy.sol b/deploy/FlapperDeploy.sol index 597ed35..28db674 100644 --- a/deploy/FlapperDeploy.sol +++ b/deploy/FlapperDeploy.sol @@ -32,15 +32,15 @@ library FlapperDeploy { address deployer, address owner, address spotter, - address nst, + address usds, address gem, address pair, address receiver, bool swapOnly ) internal returns (address flapper) { flapper = - swapOnly ? address(new FlapperUniV2SwapOnly(spotter, nst, gem, pair, receiver)) - : address(new FlapperUniV2(spotter, nst, gem, pair, receiver)) + swapOnly ? address(new FlapperUniV2SwapOnly(spotter, usds, gem, pair, receiver)) + : address(new FlapperUniV2(spotter, usds, gem, pair, receiver)) ; ScriptTools.switchOwner(flapper, deployer, owner); @@ -57,9 +57,9 @@ library FlapperDeploy { function deploySplitter( address deployer, address owner, - address nstJoin + address usdsJoin ) internal returns (SplitterInstance memory splitterInstance) { - address splitter = address(new Splitter(nstJoin)); + address splitter = address(new Splitter(usdsJoin)); address mom = address(new SplitterMom(splitter)); ScriptTools.switchOwner(splitter, deployer, owner); diff --git a/deploy/FlapperInit.sol b/deploy/FlapperInit.sol index c603449..4d7475e 100644 --- a/deploy/FlapperInit.sol +++ b/deploy/FlapperInit.sol @@ -22,7 +22,7 @@ import { SplitterInstance } from "./SplitterInstance.sol"; interface FlapperUniV2Like { function pip() external view returns (address); function spotter() external view returns (address); - function nst() external view returns (address); + function usds() external view returns (address); function gem() external view returns (address); function receiver() external view returns (address); function pair() external view returns (address); @@ -50,14 +50,14 @@ interface PairLike { function token1() external view returns (address); } -interface NstJoinLike { +interface UsdsJoinLike { function dai() external view returns (address); // TODO: Replace when new join is ready by the new getter } interface SplitterLike { function live() external view returns (uint256); function vat() external view returns (address); - function nstJoin() external view returns (address); + function usdsJoin() external view returns (address); function hop() external view returns (uint256); function rely(address) external; function file(bytes32, uint256) external; @@ -74,7 +74,7 @@ struct FlapperUniV2Config { uint256 want; address pip; address pair; - address nst; + address usds; address splitter; bytes32 prevChainlogKey; bytes32 chainlogKey; @@ -82,7 +82,7 @@ struct FlapperUniV2Config { struct FarmConfig { address splitter; - address nstJoin; + address usdsJoin; uint256 hop; bytes32 prevChainlogKey; bytes32 chainlogKey; @@ -93,7 +93,7 @@ struct SplitterConfig { uint256 bump; uint256 hop; uint256 burn; - address nstJoin; + address usdsJoin; bytes32 splitterChainlogKey; bytes32 prevMomChainlogKey; bytes32 momChainlogKey; @@ -112,15 +112,15 @@ library FlapperInit { // Sanity checks require(flapper.spotter() == address(dss.spotter), "Flapper spotter mismatch"); - require(flapper.nst() == cfg.nst, "Flapper nst mismatch"); + require(flapper.usds() == cfg.usds, "Flapper usds mismatch"); require(flapper.pair() == cfg.pair, "Flapper pair mismatch"); require(flapper.receiver() == dss.chainlog.getAddress("MCD_PAUSE_PROXY"), "Flapper receiver mismatch"); PairLike pair = PairLike(flapper.pair()); - (address pairNst, address pairGem) = pair.token0() == cfg.nst ? (pair.token0(), pair.token1()) - : (pair.token1(), pair.token0()); - require(pairNst == cfg.nst, "Nst mismatch"); - require(pairGem == flapper.gem(), "Gem mismatch"); + (address pairUsds, address pairGem) = pair.token0() == cfg.usds ? (pair.token0(), pair.token1()) + : (pair.token1(), pair.token0()); + require(pairUsds == cfg.usds, "Usds mismatch"); + require(pairGem == flapper.gem(), "Gem mismatch"); require(cfg.want >= WAD * 90 / 100, "want too low"); @@ -158,7 +158,7 @@ library FlapperInit { FarmLike farm = FarmLike(farm_); SplitterLike splitter = SplitterLike(cfg.splitter); - require(farm.rewardsToken() == NstJoinLike(cfg.nstJoin).dai(), "Farm rewards not nst"); + require(farm.rewardsToken() == UsdsJoinLike(cfg.usdsJoin).dai(), "Farm rewards not usds"); // Staking token is checked in the Lockstake script // The following two checks enforce the initSplitter function has to be called first @@ -185,7 +185,7 @@ library FlapperInit { // Sanity checks require(splitter.live() == 1, "Splitter not live"); require(splitter.vat() == address(dss.vat), "Splitter vat mismatch"); - require(splitter.nstJoin() == cfg.nstJoin, "Splitter nstJoin mismatch"); + require(splitter.usdsJoin() == cfg.usdsJoin, "Splitter usdsJoin mismatch"); require(mom.splitter() == splitterInstance.splitter, "Mom splitter mismatch"); require(cfg.hump > 0, "hump too low"); diff --git a/src/FlapperUniV2.sol b/src/FlapperUniV2.sol index a625a3e..79094f4 100644 --- a/src/FlapperUniV2.sol +++ b/src/FlapperUniV2.sol @@ -49,12 +49,12 @@ contract FlapperUniV2 { // For example: 0.98 * WAD allows 2% worse price than the reference. SpotterLike public immutable spotter; - address public immutable nst; + address public immutable usds; address public immutable gem; address public immutable receiver; PairLike public immutable pair; - bool public immutable nstFirst; + bool public immutable usdsFirst; event Rely(address indexed usr); event Deny(address indexed usr); @@ -64,20 +64,20 @@ contract FlapperUniV2 { constructor( address _spotter, - address _nst, + address _usds, address _gem, address _pair, address _receiver ) { spotter = SpotterLike(_spotter); - nst = _nst; - gem = _gem; + usds = _usds; + gem = _gem; require(GemLike(gem).decimals() == 18, "FlapperUniV2/gem-decimals-not-18"); - pair = PairLike(_pair); - nstFirst = pair.token0() == nst; - receiver = _receiver; + pair = PairLike(_pair); + usdsFirst = pair.token0() == usds; + receiver = _receiver; wards[msg.sender] = 1; emit Rely(msg.sender); @@ -109,27 +109,27 @@ contract FlapperUniV2 { emit File(what, data); } - function _getReserves() internal returns (uint256 reserveNst, uint256 reserveGem) { + function _getReserves() internal returns (uint256 reserveUsds, uint256 reserveGem) { (uint256 _reserveA, uint256 _reserveB,) = pair.getReserves(); - (reserveNst, reserveGem) = nstFirst ? (_reserveA, _reserveB) : (_reserveB, _reserveA); + (reserveUsds, reserveGem) = usdsFirst ? (_reserveA, _reserveB) : (_reserveB, _reserveA); - uint256 _nstBalance = GemLike(nst).balanceOf(address(pair)); - uint256 _gemBalance = GemLike(gem).balanceOf(address(pair)); - if (_nstBalance > reserveNst || _gemBalance > reserveGem) { + uint256 _usdsBalance = GemLike(usds).balanceOf(address(pair)); + uint256 _gemBalance = GemLike(gem).balanceOf(address(pair)); + if (_usdsBalance > reserveUsds || _gemBalance > reserveGem) { pair.sync(); - (reserveNst, reserveGem) = (_nstBalance, _gemBalance); + (reserveUsds, reserveGem) = (_usdsBalance, _gemBalance); } } // The Uniswap invariant needs to hold through the swap. // Additionally, The deposited funds need to be in the same ratio as the reserves after the swap. // - // (1) reserveNst * reserveGem = (reserveNst + sell * 997 / 1000) * (reserveGem - bought) - // (2) (lot - sell) / bought = (reserveNst + sell) / (reserveGem - bought) + // (1) reserveUsds * reserveGem = (reserveUsds + sell * 997 / 1000) * (reserveGem - bought) + // (2) (lot - sell) / bought = (reserveUsds + sell) / (reserveGem - bought) // // The solution for the these equations for variables `sell` and `bought` is used below. - function _getNstToSell(uint256 lot, uint256 reserveNst) internal pure returns (uint256 sell) { - sell = (Babylonian.sqrt(reserveNst * (lot * 3_988_000 + reserveNst * 3_988_009)) - reserveNst * 1997) / 1994; + function _getUsdsToSell(uint256 lot, uint256 reserveUsds) internal pure returns (uint256 sell) { + sell = (Babylonian.sqrt(reserveUsds * (lot * 3_988_000 + reserveUsds * 3_988_009)) - reserveUsds * 1997) / 1994; } // Based on: https://github.com/Uniswap/v2-periphery/blob/0335e8f7e1bd1e8d8329fd300aea2ef2f36dd19f/contracts/libraries/UniswapV2Library.sol#L43 @@ -140,22 +140,22 @@ contract FlapperUniV2 { function exec(uint256 lot) external auth { // Check Amounts - (uint256 _reserveNst, uint256 _reserveGem) = _getReserves(); + (uint256 _reserveUsds, uint256 _reserveGem) = _getReserves(); - uint256 _sell = _getNstToSell(lot, _reserveNst); + uint256 _sell = _getUsdsToSell(lot, _reserveUsds); - uint256 _buy = _getAmountOut(_sell, _reserveNst, _reserveGem); + uint256 _buy = _getAmountOut(_sell, _reserveUsds, _reserveGem); require(_buy >= _sell * want / (uint256(pip.read()) * RAY / spotter.par()), "FlapperUniV2/insufficient-buy-amount"); // // Swap - GemLike(nst).transfer(address(pair), _sell); - (uint256 _amt0Out, uint256 _amt1Out) = nstFirst ? (uint256(0), _buy) : (_buy, uint256(0)); + GemLike(usds).transfer(address(pair), _sell); + (uint256 _amt0Out, uint256 _amt1Out) = usdsFirst ? (uint256(0), _buy) : (_buy, uint256(0)); pair.swap(_amt0Out, _amt1Out, address(this), new bytes(0)); // // Deposit - GemLike(nst).transfer(address(pair), lot - _sell); + GemLike(usds).transfer(address(pair), lot - _sell); GemLike(gem).transfer(address(pair), _buy); uint256 _liquidity = pair.mint(receiver); // diff --git a/src/FlapperUniV2SwapOnly.sol b/src/FlapperUniV2SwapOnly.sol index 0e577cc..773fbdc 100644 --- a/src/FlapperUniV2SwapOnly.sol +++ b/src/FlapperUniV2SwapOnly.sol @@ -44,12 +44,12 @@ contract FlapperUniV2SwapOnly { // For example: 0.98 * WAD allows 2% worse price than the reference. SpotterLike public immutable spotter; - address public immutable nst; + address public immutable usds; address public immutable gem; address public immutable receiver; PairLike public immutable pair; - bool public immutable nstFirst; + bool public immutable usdsFirst; event Rely(address indexed usr); event Deny(address indexed usr); @@ -59,20 +59,20 @@ contract FlapperUniV2SwapOnly { constructor( address _spotter, - address _nst, + address _usds, address _gem, address _pair, address _receiver ) { spotter = SpotterLike(_spotter); - nst = _nst; - gem = _gem; + usds = _usds; + gem = _gem; require(GemLike(gem).decimals() == 18, "FlapperUniV2SwapOnly/gem-decimals-not-18"); - pair = PairLike(_pair); - nstFirst = pair.token0() == nst; - receiver = _receiver; + pair = PairLike(_pair); + usdsFirst = pair.token0() == usds; + receiver = _receiver; wards[msg.sender] = 1; emit Rely(msg.sender); @@ -104,9 +104,9 @@ contract FlapperUniV2SwapOnly { emit File(what, data); } - function _getReserves() internal view returns (uint256 reserveNst, uint256 reserveGem) { + function _getReserves() internal view returns (uint256 reserveUsds, uint256 reserveGem) { (uint256 _reserveA, uint256 _reserveB,) = pair.getReserves(); - (reserveNst, reserveGem) = nstFirst ? (_reserveA, _reserveB) : (_reserveB, _reserveA); + (reserveUsds, reserveGem) = usdsFirst ? (_reserveA, _reserveB) : (_reserveB, _reserveA); } // Based on: https://github.com/Uniswap/v2-periphery/blob/0335e8f7e1bd1e8d8329fd300aea2ef2f36dd19f/contracts/libraries/UniswapV2Library.sol#L43 @@ -117,15 +117,15 @@ contract FlapperUniV2SwapOnly { function exec(uint256 lot) external auth { // Check Amount to buy - (uint256 _reserveNst, uint256 _reserveGem) = _getReserves(); + (uint256 _reserveUsds, uint256 _reserveGem) = _getReserves(); - uint256 _buy = _getAmountOut(lot, _reserveNst, _reserveGem); + uint256 _buy = _getAmountOut(lot, _reserveUsds, _reserveGem); require(_buy >= lot * want / (uint256(pip.read()) * RAY / spotter.par()), "FlapperUniV2SwapOnly/insufficient-buy-amount"); // // Swap - GemLike(nst).transfer(address(pair), lot); - (uint256 _amt0Out, uint256 _amt1Out) = nstFirst ? (uint256(0), _buy) : (_buy, uint256(0)); + GemLike(usds).transfer(address(pair), lot); + (uint256 _amt0Out, uint256 _amt1Out) = usdsFirst ? (uint256(0), _buy) : (_buy, uint256(0)); pair.swap(_amt0Out, _amt1Out, receiver, new bytes(0)); // diff --git a/src/OracleWrapper.sol b/src/OracleWrapper.sol index 51a9f43..b6b56e4 100644 --- a/src/OracleWrapper.sol +++ b/src/OracleWrapper.sol @@ -31,7 +31,7 @@ contract OracleWrapper { address _flapper, uint256 _divisor ) { - pip = PipLike(_pip); + pip = PipLike(_pip); flapper = _flapper; divisor = _divisor; } diff --git a/src/Splitter.sol b/src/Splitter.sol index 7faa9c0..4137d3e 100644 --- a/src/Splitter.sol +++ b/src/Splitter.sol @@ -21,7 +21,7 @@ interface VatLike { function hope(address) external; } -interface NstJoinLike { +interface UsdsJoinLike { function vat() external view returns (address); function exit(address, uint256) external; } @@ -44,8 +44,8 @@ contract Splitter { uint256 public hop; // [Seconds] Time between kicks uint256 public zzz; // [Timestamp] Last kick - VatLike public immutable vat; - NstJoinLike public immutable nstJoin; + VatLike public immutable vat; + UsdsJoinLike public immutable usdsJoin; event Rely(address indexed usr); event Deny(address indexed usr); @@ -55,14 +55,14 @@ contract Splitter { event Cage(uint256 rad); constructor( - address _nstJoin + address _usdsJoin ) { - nstJoin = NstJoinLike(_nstJoin); - vat = VatLike(nstJoin.vat()); + usdsJoin = UsdsJoinLike(_usdsJoin); + vat = VatLike(usdsJoin.vat()); - vat.hope(_nstJoin); + vat.hope(_usdsJoin); - hop = 1 hours; // Initial value for safety + hop = 1 hours; // Initial value for safety wards[msg.sender] = 1; emit Rely(msg.sender); @@ -105,13 +105,13 @@ contract Splitter { uint256 lot = tot * burn / RAD; if (lot > 0) { - NstJoinLike(nstJoin).exit(address(flapper), lot); + UsdsJoinLike(usdsJoin).exit(address(flapper), lot); flapper.exec(lot); } uint256 pay = (tot / RAY - lot); if (pay > 0) { - NstJoinLike(nstJoin).exit(address(farm), pay); + UsdsJoinLike(usdsJoin).exit(address(farm), pay); farm.notifyRewardAmount(pay); } diff --git a/test/FlapperUniV2.t.sol b/test/FlapperUniV2.t.sol index 3c5f4b5..276f73b 100644 --- a/test/FlapperUniV2.t.sol +++ b/test/FlapperUniV2.t.sol @@ -130,10 +130,10 @@ contract FlapperUniV2Test is DssTest { vm.stopPrank(); (flapper, medianizer) = setUpFlapper(MKR, UNIV2_DAI_MKR_PAIR, 727 * WAD, "MCD_FLAP") ; - assertEq(flapper.nstFirst(), true); + assertEq(flapper.usdsFirst(), true); (linkFlapper, linkMedianizer) = setUpFlapper(LINK, UNIV2_LINK_DAI_PAIR, 654 * WAD / 100, bytes32(0)); - assertEq(linkFlapper.nstFirst(), false); + assertEq(linkFlapper.usdsFirst(), false); changeFlapper(address(flapper)); // Use MKR flapper by default @@ -162,7 +162,7 @@ contract FlapperUniV2Test is DssTest { deployer: address(this), owner: PAUSE_PROXY, spotter: SPOT, - nst: DAI, + usds: DAI, gem: gem, pair: pair, receiver: PAUSE_PROXY, @@ -175,7 +175,7 @@ contract FlapperUniV2Test is DssTest { want: WAD * 97 / 100, pip: address(_medianizer), pair: pair, - nst: DAI, + usds: DAI, splitter: address(splitter), prevChainlogKey: prevChainlogKey, chainlogKey: "MCD_FLAP_LP" @@ -355,7 +355,7 @@ contract FlapperUniV2Test is DssTest { // A shortened version of the sell and deposit flapper that sells `lot`. // Based on: https://github.com/makerdao/dss-flappers/blob/da7b6b70e7cfe3631f8af695bbe0c79db90e2a20/src/FlapperUniV2.sol - function sellLotAndDeposit(PairLike pair, address gem, bool nstFirst, address receiver, uint256 lot) internal { + function sellLotAndDeposit(PairLike pair, address gem, bool usdsFirst, address receiver, uint256 lot) internal { // Get Amounts (uint256 _reserveDai, uint256 _reserveGem) = UniswapV2Library.getReserves(UNIV2_FACTORY, DAI, gem); uint256 _wlot = lot / RAY; @@ -364,7 +364,7 @@ contract FlapperUniV2Test is DssTest { // Swap GemLike(DAI).transfer(address(pair), _wlot); - (uint256 _amt0Out, uint256 _amt1Out) = nstFirst ? (uint256(0), _buy) : (_buy, uint256(0)); + (uint256 _amt0Out, uint256 _amt1Out) = usdsFirst ? (uint256(0), _buy) : (_buy, uint256(0)); pair.swap(_amt0Out, _amt1Out, address(this), new bytes(0)); // Deposit diff --git a/test/FlapperUniV2SwapOnly.t.sol b/test/FlapperUniV2SwapOnly.t.sol index f1a756b..e277163 100644 --- a/test/FlapperUniV2SwapOnly.t.sol +++ b/test/FlapperUniV2SwapOnly.t.sol @@ -128,10 +128,10 @@ contract FlapperUniV2SwapOnlyTest is DssTest { vm.stopPrank(); (flapper, medianizer) = setUpFlapper(MKR, UNIV2_DAI_MKR_PAIR, 727 * WAD) ; - assertEq(flapper.nstFirst(), true); + assertEq(flapper.usdsFirst(), true); (linkFlapper, linkMedianizer) = setUpFlapper(LINK, UNIV2_LINK_DAI_PAIR, 654 * WAD / 100); - assertEq(linkFlapper.nstFirst(), false); + assertEq(linkFlapper.usdsFirst(), false); changeFlapper(address(flapper)); // Use MKR flapper by default @@ -160,7 +160,7 @@ contract FlapperUniV2SwapOnlyTest is DssTest { deployer: address(this), owner: PAUSE_PROXY, spotter: SPOT, - nst: DAI, + usds: DAI, gem: gem, pair: pair, receiver: PAUSE_PROXY, @@ -173,7 +173,7 @@ contract FlapperUniV2SwapOnlyTest is DssTest { want: WAD * 97 / 100, pip: address(_medianizer), pair: pair, - nst: DAI, + usds: DAI, splitter: address(splitter), prevChainlogKey: bytes32(0), chainlogKey: "MCD_FLAP_BURN" diff --git a/test/Splitter.t.sol b/test/Splitter.t.sol index 96e667f..f910019 100644 --- a/test/Splitter.t.sol +++ b/test/Splitter.t.sol @@ -118,7 +118,7 @@ contract SplitterTest is DssTest { SplitterInstance memory splitterInstance = FlapperDeploy.deploySplitter({ deployer: address(this), owner: PAUSE_PROXY, - nstJoin: DAI_JOIN + usdsJoin: DAI_JOIN }); splitter = Splitter(splitterInstance.splitter); @@ -126,7 +126,7 @@ contract SplitterTest is DssTest { deployer: address(this), owner: PAUSE_PROXY, spotter: SPOT, - nst: DAI, + usds: DAI, gem: MKR, pair: UNIV2_DAI_MKR_PAIR, receiver: PAUSE_PROXY, @@ -141,7 +141,7 @@ contract SplitterTest is DssTest { bump: 5707 * RAD, hop: 30 minutes, burn: 70 * WAD / 100, - nstJoin: DAI_JOIN, + usdsJoin: DAI_JOIN, splitterChainlogKey: "MCD_FLAP_SPLIT", prevMomChainlogKey: "FLAPPER_MOM", momChainlogKey: "SPLITTER_MOM" @@ -150,17 +150,17 @@ contract SplitterTest is DssTest { want: WAD * 97 / 100, pip: address(medianizer), pair: UNIV2_DAI_MKR_PAIR, - nst: DAI, + usds: DAI, splitter: address(splitter), prevChainlogKey: bytes32(0), chainlogKey: "MCD_FLAP_BURN" }); FarmConfig memory farmCfg = FarmConfig({ splitter: address(splitter), - nstJoin: DAI_JOIN, + usdsJoin: DAI_JOIN, hop: 30 minutes, prevChainlogKey: bytes32(0), - chainlogKey: "MCD_FARM_NST" + chainlogKey: "MCD_FARM_USDS" }); DssInstance memory dss = MCD.loadFromChainlog(LOG); @@ -172,7 +172,7 @@ contract SplitterTest is DssTest { assertEq(dss.chainlog.getAddress("MCD_FLAP_SPLIT"), splitterInstance.splitter); assertEq(dss.chainlog.getAddress("MCD_FLAP_BURN"), address(flapper)); - assertEq(dss.chainlog.getAddress("MCD_FARM_NST"), address(farm)); + assertEq(dss.chainlog.getAddress("MCD_FARM_USDS"), address(farm)); // Add initial liquidity if needed (uint256 reserveDai, ) = UniswapV2Library.getReserves(UNIV2_FACTORY, DAI, MKR); @@ -300,7 +300,7 @@ contract SplitterTest is DssTest { assertEq(s.hop(), 1 hours); assertEq(s.zzz(), 0); - assertEq(address(s.nstJoin()), DAI_JOIN); + assertEq(address(s.usdsJoin()), DAI_JOIN); assertEq(address(s.vat()), address(vat)); assertEq(address(s.farm()), address(0)); assertEq(s.wards(address(this)), 1); diff --git a/test/SplitterMom.t.sol b/test/SplitterMom.t.sol index 49f7cd7..d95f3e8 100644 --- a/test/SplitterMom.t.sol +++ b/test/SplitterMom.t.sol @@ -72,7 +72,7 @@ contract SplitterMomTest is DssTest { SplitterInstance memory splitterInstance = FlapperDeploy.deploySplitter({ deployer: address(this), owner: PAUSE_PROXY, - nstJoin: DAI_JOIN + usdsJoin: DAI_JOIN }); splitter = Splitter(splitterInstance.splitter); mom = SplitterMom(splitterInstance.mom); @@ -81,7 +81,7 @@ contract SplitterMomTest is DssTest { deployer: address(this), owner: PAUSE_PROXY, spotter: SPOT, - nst: DAI, + usds: DAI, gem: MKR, pair: UNIV2_DAI_MKR_PAIR, receiver: PAUSE_PROXY, @@ -94,7 +94,7 @@ contract SplitterMomTest is DssTest { bump: 0, hop: 5 minutes, burn: WAD, - nstJoin: DAI_JOIN, + usdsJoin: DAI_JOIN, splitterChainlogKey: "MCD_FLAP_SPLIT", prevMomChainlogKey: "FLAPPER_MOM", momChainlogKey: "SPLITTER_MOM" @@ -103,17 +103,17 @@ contract SplitterMomTest is DssTest { want: 1e18, pip: address(0), pair: UNIV2_DAI_MKR_PAIR, - nst: DAI, + usds: DAI, splitter: address(splitter), prevChainlogKey: "MCD_FLAP", chainlogKey: "MCD_FLAP_LP" }); FarmConfig memory farmCfg = FarmConfig({ splitter: address(splitter), - nstJoin: DAI_JOIN, + usdsJoin: DAI_JOIN, hop: 5 minutes, prevChainlogKey: bytes32(0), - chainlogKey: "MCD_FARM_NST" + chainlogKey: "MCD_FARM_USDS" }); DssInstance memory dss = MCD.loadFromChainlog(LOG); diff --git a/test/mocks/SplitterMock.sol b/test/mocks/SplitterMock.sol index da4238b..1438b54 100644 --- a/test/mocks/SplitterMock.sol +++ b/test/mocks/SplitterMock.sol @@ -7,7 +7,7 @@ interface VatLike { function hope(address) external; } -interface NstJoinLike { +interface UsdsJoinLike { function vat() external view returns (address); function exit(address, uint256) external; } @@ -19,16 +19,16 @@ interface FlapLike { contract SplitterMock { FlapLike public flapper; - VatLike public immutable vat; - NstJoinLike public immutable nstJoin; + VatLike public immutable vat; + UsdsJoinLike public immutable usdsJoin; constructor( - address _nstJoin + address _usdsJoin ) { - nstJoin = NstJoinLike(_nstJoin); - vat = VatLike(nstJoin.vat()); + usdsJoin = UsdsJoinLike(_usdsJoin); + vat = VatLike(usdsJoin.vat()); - vat.hope(_nstJoin); + vat.hope(_usdsJoin); } uint256 internal constant RAY = 10 ** 27; @@ -41,7 +41,7 @@ contract SplitterMock { function kick(uint256 tot, uint256) external returns (uint256) { vat.move(msg.sender, address(this), tot); uint256 lot = tot / RAY; - NstJoinLike(nstJoin).exit(address(flapper), lot); + UsdsJoinLike(usdsJoin).exit(address(flapper), lot); flapper.exec(lot); return 0; }