From 690741b1cc1d86ae9d4b6cb8a4fc8cea4d369b08 Mon Sep 17 00:00:00 2001 From: sunbreak1211 Date: Tue, 27 Aug 2024 16:58:08 -0300 Subject: [PATCH] Renaming --- README.md | 14 ++-- certora/AllocatorVault.conf | 16 ++-- certora/AllocatorVault.spec | 76 +++++++++---------- deploy/AllocatorDeploy.sol | 4 +- deploy/AllocatorInit.sol | 6 +- src/AllocatorVault.sol | 34 ++++----- test/AllocatorVault.t.sol | 42 +++++----- test/funnels/automation/VaultMinter.t.sol | 32 ++++---- test/integration/Deployment.t.sol | 14 ++-- .../{NstJoinMock.sol => UsdsJoinMock.sol} | 14 ++-- test/mocks/{NstMock.sol => UsdsMock.sol} | 12 +-- 11 files changed, 132 insertions(+), 132 deletions(-) rename test/mocks/{NstJoinMock.sol => UsdsJoinMock.sol} (68%) rename test/mocks/{NstMock.sol => UsdsMock.sol} (84%) diff --git a/README.md b/README.md index 1e2599a9..82032bfa 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The system is comprised of several layers: - Core Allocation System (*green above*): - Smart contracts that can be considered a part of the Maker Core Protocol, and are immutable and present in all Allocators. - - Their main role is to mint NST (New Stable Token) and hold it (possibly with other tokens) in the `AllocatorBuffer`. + - Their main role is to mint USDS (New Stable Token) and hold it (possibly with other tokens) in the `AllocatorBuffer`. - Deployment Funnels (*blue above*): - Contracts that pull funds from the `AllocatorBuffer`. - The funds can be swapped and/or deployed into AMM pools or specific conduits. @@ -33,7 +33,7 @@ The allocation system includes several actor types: - Pause Proxy: - Performs actions through spells with governance delay. - - In charge of setting up the core components and the NST minting instant access modules (DC-IAMs). + - In charge of setting up the core components and the USDS minting instant access modules (DC-IAMs). - Ward of the singleton contracts (e.g RWA conduits, Coinbase Custody, `AllocatorRoles`). - AllocatorDAO Proxy: - Performs actions through a sub-spell with governance delay. @@ -46,7 +46,7 @@ The allocation system includes several actor types: - An optional actor which is whitelisted through the `AllocatorRoles` contract to perform specified actions on the `AllocatorVault`, funnels and conduits. - Will typically be a facilitator multisig or an automation contract controlled by one (e.g `StableSwapper`, `StableDepositorUniV3`). - Keeper: - - An optional actor which can be set up to trigger the automation contracts in case repetitive actions are needed (such as swapping NST to USDC every time interval). + - An optional actor which can be set up to trigger the automation contracts in case repetitive actions are needed (such as swapping USDS to USDC every time interval). ![Untitled (1)](https://github.com/makerdao/dss-allocator/assets/130549691/c677928b-32f4-4000-b6ed-e3798caa9c5c) @@ -61,15 +61,15 @@ Each AllocatorDAO has a unique `ilk` (collateral type) with one VAT vault set up Single contract per `ilk`, which operators can use to: -- Mint (`draw`) NST from the vault to the AllocatorBuffer. -- Repay (`wipe`) NST from the AllocatorBuffer. +- Mint (`draw`) USDS from the vault to the AllocatorBuffer. +- Repay (`wipe`) USDS from the AllocatorBuffer. ### AllocatorBuffer A simple contract for the AllocatorDAO to hold funds in. - Supports approving contracts to `transferFrom` it. -- Note that although the `AllocatorVault` pushes and pulls NST to/from the `AllocatorBuffer`, it can manage other tokens as well. +- Note that although the `AllocatorVault` pushes and pulls USDS to/from the `AllocatorBuffer`, it can manage other tokens as well. ### AllocatorRoles @@ -112,7 +112,7 @@ An automation contract sample, which can be used by the AllocatorDAOs to `draw` ### StableSwapper -An automation contract, which can be used by the AllocatorDAOs to set up recurring swaps of stable tokens (e.g NST to USDC). +An automation contract, which can be used by the AllocatorDAOs to set up recurring swaps of stable tokens (e.g USDS to USDC). - In order to use it, the AllocatorDAO should list it as an operator of its `Swapper` primitive in the `AllocatorRoles` contract. - The `Swapper` primitive will rate-limit the automation contract. diff --git a/certora/AllocatorVault.conf b/certora/AllocatorVault.conf index 98118487..9a5356c7 100644 --- a/certora/AllocatorVault.conf +++ b/certora/AllocatorVault.conf @@ -4,18 +4,18 @@ "src/AllocatorRoles.sol", "test/mocks/VatMock.sol", "test/mocks/JugMock.sol", - "test/mocks/NstJoinMock.sol", - "test/mocks/NstMock.sol" + "test/mocks/UsdsJoinMock.sol", + "test/mocks/UsdsMock.sol" ], "link": [ "AllocatorVault:roles=AllocatorRoles", "AllocatorVault:vat=VatMock", "AllocatorVault:jug=JugMock", - "AllocatorVault:nstJoin=NstJoinMock", - "AllocatorVault:nst=NstMock", + "AllocatorVault:usdsJoin=UsdsJoinMock", + "AllocatorVault:usds=UsdsMock", "JugMock:vat=VatMock", - "NstJoinMock:vat=VatMock", - "NstJoinMock:nst=NstMock" + "UsdsJoinMock:vat=VatMock", + "UsdsJoinMock:usds=UsdsMock" ], "rule_sanity": "basic", "solc": "solc-0.8.16", @@ -24,8 +24,8 @@ "AllocatorRoles": "200", "VatMock": "0", "JugMock": "0", - "NstJoinMock": "0", - "NstMock": "0" + "UsdsJoinMock": "0", + "UsdsMock": "0" }, "verify": "AllocatorVault:certora/AllocatorVault.spec", "parametric_contracts": [ diff --git a/certora/AllocatorVault.spec b/certora/AllocatorVault.spec index 20105b54..cb2baad8 100644 --- a/certora/AllocatorVault.spec +++ b/certora/AllocatorVault.spec @@ -3,8 +3,8 @@ using AllocatorRoles as roles; using VatMock as vat; using JugMock as jug; -using NstJoinMock as nstJoin; -using NstMock as nst; +using UsdsJoinMock as usdsJoin; +using UsdsMock as usds; methods { function ilk() external returns (bytes32) envfree; @@ -19,9 +19,9 @@ methods { function vat.rate() external returns (uint256) envfree; function jug.duty() external returns (uint256) envfree; function jug.rho() external returns (uint256) envfree; - function nst.allowance(address, address) external returns (uint256) envfree; - function nst.balanceOf(address) external returns (uint256) envfree; - function nst.totalSupply() external returns (uint256) envfree; + function usds.allowance(address, address) external returns (uint256) envfree; + function usds.balanceOf(address) external returns (uint256) envfree; + function usds.totalSupply() external returns (uint256) envfree; } definition WAD() returns mathint = 10^18; @@ -145,9 +145,9 @@ rule file_revert(bytes32 what, address data) { rule draw(uint256 wad) { env e; - mathint nstTotalSupplyBefore = nst.totalSupply(); - mathint nstBalanceOfBufferBefore = nst.balanceOf(buffer()); - require nstBalanceOfBufferBefore <= nstTotalSupplyBefore; + mathint usdsTotalSupplyBefore = usds.totalSupply(); + mathint usdsBalanceOfBufferBefore = usds.balanceOf(buffer()); + require usdsBalanceOfBufferBefore <= usdsTotalSupplyBefore; mathint vatInkVaultBefore; mathint vatArtVaultBefore; vatInkVaultBefore, vatArtVaultBefore = vat.urns(ilk(), currentContract); mathint rate = vat.rate() + (jug.duty() - RAY()) * (e.block.timestamp - jug.rho()); @@ -156,15 +156,15 @@ rule draw(uint256 wad) { draw(e, wad); - mathint nstTotalSupplyAfter = nst.totalSupply(); - mathint nstBalanceOfBufferAfter = nst.balanceOf(buffer()); + mathint usdsTotalSupplyAfter = usds.totalSupply(); + mathint usdsBalanceOfBufferAfter = usds.balanceOf(buffer()); mathint vatInkVaultAfter; mathint vatArtVaultAfter; vatInkVaultAfter, vatArtVaultAfter = vat.urns(ilk(), currentContract); assert vatInkVaultAfter == vatInkVaultBefore, "draw did not keep vat.urns(ilk,vault).ink unchanged"; assert vatArtVaultAfter == vatArtVaultBefore + dart, "draw did not increase vat.urns(ilk,vault).art by dart"; - assert nstBalanceOfBufferAfter == nstBalanceOfBufferBefore + wad, "draw did not increase nst.balanceOf(buffer) by wad"; - assert nstTotalSupplyAfter == nstTotalSupplyBefore + wad, "draw did not increase nst.totalSupply() by wad"; + assert usdsBalanceOfBufferAfter == usdsBalanceOfBufferBefore + wad, "draw did not increase usds.balanceOf(buffer) by wad"; + assert usdsTotalSupplyAfter == usdsTotalSupplyBefore + wad, "draw did not increase usds.totalSupply() by wad"; } // Verify revert rules on draw @@ -173,9 +173,9 @@ rule draw_revert(uint256 wad) { bool canCall = roles.canCall(ilk(), e.msg.sender, currentContract, to_bytes4(0x3b304147)); mathint wardsSender = wards(e.msg.sender); - mathint nstTotalSupply = nst.totalSupply(); - mathint nstBalanceOfBuffer = nst.balanceOf(buffer()); - require nstBalanceOfBuffer <= nstTotalSupply; + mathint usdsTotalSupply = usds.totalSupply(); + mathint usdsBalanceOfBuffer = usds.balanceOf(buffer()); + require usdsBalanceOfBuffer <= usdsTotalSupply; mathint vatInkVault; mathint vatArtVault; vatInkVault, vatArtVault = vat.urns(ilk(), currentContract); mathint duty = jug.duty(); @@ -186,8 +186,8 @@ rule draw_revert(uint256 wad) { require rate > 0 && rate <= max_int256(); mathint dart = divUp(wad * RAY(), rate); mathint vatDaiVault = vat.dai(currentContract); - mathint vatCanVaultNstJoin = vat.can(currentContract, nstJoin); - mathint vatDaiNstJoin = vat.dai(nstJoin); + mathint vatCanVaultUsdsJoin = vat.can(currentContract, usdsJoin); + mathint vatDaiUsdsJoin = vat.dai(usdsJoin); draw@withrevert(e, wad); @@ -198,9 +198,9 @@ rule draw_revert(uint256 wad) { bool revert5 = vatArtVault + dart > max_uint256; bool revert6 = rate * dart > max_int256(); bool revert7 = vatDaiVault + rate * dart > max_uint256; - bool revert8 = vatCanVaultNstJoin != 1; - bool revert9 = vatDaiNstJoin + wad * RAY() > max_uint256; - bool revert10 = nstTotalSupply + wad > max_uint256; + bool revert8 = vatCanVaultUsdsJoin != 1; + bool revert9 = vatDaiUsdsJoin + wad * RAY() > max_uint256; + bool revert10 = usdsTotalSupply + wad > max_uint256; assert lastReverted <=> revert1 || revert2 || revert3 || revert4 || revert5 || revert6 || @@ -212,9 +212,9 @@ rule draw_revert(uint256 wad) { rule wipe(uint256 wad) { env e; - mathint nstTotalSupplyBefore = nst.totalSupply(); - mathint nstBalanceOfBufferBefore = nst.balanceOf(buffer()); - require nstBalanceOfBufferBefore <= nstTotalSupplyBefore; + mathint usdsTotalSupplyBefore = usds.totalSupply(); + mathint usdsBalanceOfBufferBefore = usds.balanceOf(buffer()); + require usdsBalanceOfBufferBefore <= usdsTotalSupplyBefore; mathint vatInkVaultBefore; mathint vatArtVaultBefore; vatInkVaultBefore, vatArtVaultBefore = vat.urns(ilk(), currentContract); mathint rate = vat.rate() + (jug.duty() - RAY()) * (e.block.timestamp - jug.rho()); @@ -223,15 +223,15 @@ rule wipe(uint256 wad) { wipe(e, wad); - mathint nstTotalSupplyAfter = nst.totalSupply(); - mathint nstBalanceOfBufferAfter = nst.balanceOf(buffer()); + mathint usdsTotalSupplyAfter = usds.totalSupply(); + mathint usdsBalanceOfBufferAfter = usds.balanceOf(buffer()); mathint vatInkVaultAfter; mathint vatArtVaultAfter; vatInkVaultAfter, vatArtVaultAfter = vat.urns(ilk(), currentContract); assert vatInkVaultAfter == vatInkVaultBefore, "wipe did not keep vat.urns(ilk,vault).ink unchanged"; assert vatArtVaultAfter == vatArtVaultBefore - dart, "wipe did not decrease vat.urns(ilk,vault).art by dart"; - assert nstBalanceOfBufferAfter == nstBalanceOfBufferBefore - wad, "wipe did not decrease nst.balanceOf(buffer) by wad"; - assert nstTotalSupplyAfter == nstTotalSupplyBefore - wad, "wipe did not decrease nst.totalSupply() by wad"; + assert usdsBalanceOfBufferAfter == usdsBalanceOfBufferBefore - wad, "wipe did not decrease usds.balanceOf(buffer) by wad"; + assert usdsTotalSupplyAfter == usdsTotalSupplyBefore - wad, "wipe did not decrease usds.totalSupply() by wad"; } // Verify revert rules on wipe @@ -240,14 +240,14 @@ rule wipe_revert(uint256 wad) { bool canCall = roles.canCall(ilk(), e.msg.sender, currentContract, to_bytes4(0xb38a1620)); mathint wardsSender = wards(e.msg.sender); - mathint nstTotalSupply = nst.totalSupply(); + mathint usdsTotalSupply = usds.totalSupply(); address buffer = buffer(); require buffer != currentContract; - mathint nstBalanceOfBuffer = nst.balanceOf(buffer); - mathint nstBalanceOfVault = nst.balanceOf(currentContract); - require nstBalanceOfBuffer + nstBalanceOfVault <= nstTotalSupply; - mathint nstAllowanceBufferVault = nst.allowance(buffer, currentContract); - mathint nstAllowanceVaultNstJoin = nst.allowance(currentContract, nstJoin); + mathint usdsBalanceOfBuffer = usds.balanceOf(buffer); + mathint usdsBalanceOfVault = usds.balanceOf(currentContract); + require usdsBalanceOfBuffer + usdsBalanceOfVault <= usdsTotalSupply; + mathint usdsAllowanceBufferVault = usds.allowance(buffer, currentContract); + mathint usdsAllowanceVaultUsdsJoin = usds.allowance(currentContract, usdsJoin); mathint vatInkVault; mathint vatArtVault; vatInkVault, vatArtVault = vat.urns(ilk(), currentContract); mathint duty = jug.duty(); @@ -258,18 +258,18 @@ rule wipe_revert(uint256 wad) { require rate > 0 && rate <= max_int256(); mathint dart = wad * RAY() / rate; mathint vatDaiVault = vat.dai(currentContract); - mathint vatDaiNstJoin = vat.dai(nstJoin); + mathint vatDaiUsdsJoin = vat.dai(usdsJoin); wipe@withrevert(e, wad); bool revert1 = e.msg.value > 0; bool revert2 = !canCall && wardsSender != 1; - bool revert3 = nstBalanceOfBuffer < to_mathint(wad); - bool revert4 = nstAllowanceBufferVault < to_mathint(wad); + bool revert3 = usdsBalanceOfBuffer < to_mathint(wad); + bool revert4 = usdsAllowanceBufferVault < to_mathint(wad); bool revert5 = wad * RAY() > max_uint256; - bool revert6 = nstAllowanceVaultNstJoin < to_mathint(wad); + bool revert6 = usdsAllowanceVaultUsdsJoin < to_mathint(wad); bool revert7 = vatArtVault < dart; - bool revert8 = vatDaiNstJoin < wad * RAY(); + bool revert8 = vatDaiUsdsJoin < wad * RAY(); bool revert9 = vatDaiVault + wad * RAY() > max_uint256; bool revert10 = rate * dart > max_int256(); diff --git a/deploy/AllocatorDeploy.sol b/deploy/AllocatorDeploy.sol index b372cb66..bf0a2917 100644 --- a/deploy/AllocatorDeploy.sol +++ b/deploy/AllocatorDeploy.sol @@ -52,13 +52,13 @@ library AllocatorDeploy { address owner, address roles, bytes32 ilk, - address nstJoin + address usdsJoin ) internal returns (AllocatorIlkInstance memory ilkInstance) { address _buffer = address(new AllocatorBuffer()); ScriptTools.switchOwner(_buffer, deployer, owner); ilkInstance.buffer = _buffer; - address _vault = address(new AllocatorVault(roles, _buffer, ilk, nstJoin)); + address _vault = address(new AllocatorVault(roles, _buffer, ilk, usdsJoin)); ScriptTools.switchOwner(_vault, deployer, owner); ilkInstance.vault = _vault; diff --git a/deploy/AllocatorInit.sol b/deploy/AllocatorInit.sol index 47f6bfb1..e5986bf3 100644 --- a/deploy/AllocatorInit.sol +++ b/deploy/AllocatorInit.sol @@ -47,7 +47,7 @@ interface VaultLike { function roles() external view returns (address); function buffer() external view returns (address); function vat() external view returns (address); - function nst() external view returns (address); + function usds() external view returns (address); function file(bytes32, address) external; } @@ -107,7 +107,7 @@ library AllocatorInit { require(VaultLike(ilkInstance.vault).roles() == sharedInstance.roles, "AllocatorInit/vault-roles-mismatch"); require(VaultLike(ilkInstance.vault).buffer() == ilkInstance.buffer, "AllocatorInit/vault-buffer-mismatch"); require(VaultLike(ilkInstance.vault).vat() == address(dss.vat), "AllocatorInit/vault-vat-mismatch"); - // Once nstJoin is in the chainlog and adapted to dss-test should also check against it + // Once usdsJoin is in the chainlog and adapted to dss-test should also check against it // Onboard the ilk dss.vat.init(ilk); @@ -134,7 +134,7 @@ library AllocatorInit { VaultLike(ilkInstance.vault).file("jug", address(dss.jug)); // Allow vault to pull funds from the buffer - BufferLike(ilkInstance.buffer).approve(VaultLike(ilkInstance.vault).nst(), ilkInstance.vault, type(uint256).max); + BufferLike(ilkInstance.buffer).approve(VaultLike(ilkInstance.vault).usds(), ilkInstance.vault, type(uint256).max); // Set the allocator proxy as the ilk admin instead of the Pause Proxy RolesLike(sharedInstance.roles).setIlkAdmin(ilk, cfg.allocatorProxy); diff --git a/src/AllocatorVault.sol b/src/AllocatorVault.sol index 4d46ffdb..163c6d0e 100644 --- a/src/AllocatorVault.sol +++ b/src/AllocatorVault.sol @@ -35,8 +35,8 @@ interface GemLike { function transferFrom(address, address, uint256) external; } -interface NstJoinLike { - function nst() external view returns (GemLike); +interface UsdsJoinLike { + function usds() external view returns (GemLike); function vat() external view returns (VatLike); function exit(address, uint256) external; function join(address, uint256) external; @@ -55,12 +55,12 @@ contract AllocatorVault { // --- immutables --- - RolesLike immutable public roles; - address immutable public buffer; - VatLike immutable public vat; - bytes32 immutable public ilk; - NstJoinLike immutable public nstJoin; - GemLike immutable public nst; + RolesLike immutable public roles; + address immutable public buffer; + VatLike immutable public vat; + bytes32 immutable public ilk; + UsdsJoinLike immutable public usdsJoin; + GemLike immutable public usds; // --- events --- @@ -80,18 +80,18 @@ contract AllocatorVault { // --- constructor --- - constructor(address roles_, address buffer_, bytes32 ilk_, address nstJoin_) { + constructor(address roles_, address buffer_, bytes32 ilk_, address usdsJoin_) { roles = RolesLike(roles_); buffer = buffer_; ilk = ilk_; - nstJoin = NstJoinLike(nstJoin_); + usdsJoin = UsdsJoinLike(usdsJoin_); - vat = nstJoin.vat(); - nst = nstJoin.nst(); + vat = usdsJoin.vat(); + usds = usdsJoin.usds(); - vat.hope(nstJoin_); - nst.approve(nstJoin_, type(uint256).max); + vat.hope(usdsJoin_); + usds.approve(usdsJoin_, type(uint256).max); wards[msg.sender] = 1; emit Rely(msg.sender); @@ -132,13 +132,13 @@ contract AllocatorVault { uint256 dart = _divup(wad * RAY, rate); require(dart <= uint256(type(int256).max), "AllocatorVault/overflow"); vat.frob(ilk, address(this), address(0), address(this), 0, int256(dart)); - nstJoin.exit(buffer, wad); + usdsJoin.exit(buffer, wad); emit Draw(msg.sender, wad); } function wipe(uint256 wad) external auth { - nst.transferFrom(buffer, address(this), wad); - nstJoin.join(address(this), wad); + usds.transferFrom(buffer, address(this), wad); + usdsJoin.join(address(this), wad); uint256 rate = jug.drip(ilk); uint256 dart = wad * RAY / rate; require(dart <= uint256(type(int256).max), "AllocatorVault/overflow"); diff --git a/test/AllocatorVault.t.sol b/test/AllocatorVault.t.sol index 4f4cde38..c693f5b6 100644 --- a/test/AllocatorVault.t.sol +++ b/test/AllocatorVault.t.sol @@ -9,15 +9,15 @@ import { RolesMock } from "test/mocks/RolesMock.sol"; import { VatMock } from "test/mocks/VatMock.sol"; import { JugMock } from "test/mocks/JugMock.sol"; import { GemMock } from "test/mocks/GemMock.sol"; -import { NstJoinMock } from "test/mocks/NstJoinMock.sol"; +import { UsdsJoinMock } from "test/mocks/UsdsJoinMock.sol"; contract AllocatorVaultTest is DssTest { using stdStorage for StdStorage; VatMock public vat; JugMock public jug; - GemMock public nst; - NstJoinMock public nstJoin; + GemMock public usds; + UsdsJoinMock public usdsJoin; AllocatorBuffer public buffer; RolesMock public roles; AllocatorVault public vault; @@ -35,32 +35,32 @@ contract AllocatorVaultTest is DssTest { } function setUp() public { - ilk = "TEST-ILK"; - vat = new VatMock(); - jug = new JugMock(vat); - nst = new GemMock(0); - nstJoin = new NstJoinMock(vat, nst); - buffer = new AllocatorBuffer(); - roles = new RolesMock(); - vault = new AllocatorVault(address(roles), address(buffer), ilk, address(nstJoin)); - buffer.approve(address(nst), address(vault), type(uint256).max); + ilk = "TEST-ILK"; + vat = new VatMock(); + jug = new JugMock(vat); + usds = new GemMock(0); + usdsJoin = new UsdsJoinMock(vat, usds); + buffer = new AllocatorBuffer(); + roles = new RolesMock(); + vault = new AllocatorVault(address(roles), address(buffer), ilk, address(usdsJoin)); + buffer.approve(address(usds), address(vault), type(uint256).max); vat.slip(ilk, address(vault), int256(1_000_000 * WAD)); vat.grab(ilk, address(vault), address(vault), address(0), int256(1_000_000 * WAD), 0); - // Add some existing DAI assigned to nstJoin to avoid a particular error - stdstore.target(address(vat)).sig("dai(address)").with_key(address(nstJoin)).depth(0).checked_write(100_000 * RAD); + // Add some existing DAI assigned to usdsJoin to avoid a particular error + stdstore.target(address(vat)).sig("dai(address)").with_key(address(usdsJoin)).depth(0).checked_write(100_000 * RAD); } function testConstructor() public { vm.expectEmit(true, true, true, true); emit Rely(address(this)); - address join = address(new NstJoinMock(vat, nst)); + address join = address(new UsdsJoinMock(vat, usds)); AllocatorVault v = new AllocatorVault(address(0xBEEF), address(0xCCC), "SubDAO 1", join); assertEq(address(v.roles()), address(0xBEEF)); assertEq(v.buffer(), address(0xCCC)); assertEq(v.ilk(), "SubDAO 1"); - assertEq(address(v.nstJoin()), join); + assertEq(address(v.usdsJoin()), join); assertEq(v.wards(address(this)), 1); } @@ -100,7 +100,7 @@ contract AllocatorVaultTest is DssTest { (, art) = vat.urns(ilk, address(vault)); assertEq(art, 50 * 10**18); assertEq(vat.rate(), 10**27); - assertEq(nst.balanceOf(address(buffer)), 50 * 10**18); + assertEq(usds.balanceOf(address(buffer)), 50 * 10**18); vm.warp(block.timestamp + 1); vm.expectEmit(true, true, true, true); emit Draw(address(this), 50 * 10**18); @@ -109,19 +109,19 @@ contract AllocatorVaultTest is DssTest { uint256 expectedArt = 50 * 10**18 + _divup(50 * 10**18 * 1000, 1001); assertEq(art, expectedArt); assertEq(vat.rate(), 1001 * 10**27 / 1000); - assertEq(nst.balanceOf(address(buffer)), 100 * 10**18); + assertEq(usds.balanceOf(address(buffer)), 100 * 10**18); assertGt(art * vat.rate(), 100.05 * 10**45); assertLt(art * vat.rate(), 100.06 * 10**45); vm.expectRevert("Gem/insufficient-balance"); vault.wipe(100.06 * 10**18); - deal(address(nst), address(buffer), 100.06 * 10**18, true); - assertEq(nst.balanceOf(address(buffer)), 100.06 * 10**18); + deal(address(usds), address(buffer), 100.06 * 10**18, true); + assertEq(usds.balanceOf(address(buffer)), 100.06 * 10**18); vm.expectRevert(); vault.wipe(100.06 * 10**18); // It will try to wipe more art than existing, then reverts vm.expectEmit(true, true, true, true); emit Wipe(address(this), 100.05 * 10**18); vault.wipe(100.05 * 10**18); - assertEq(nst.balanceOf(address(buffer)), 0.01 * 10**18); + assertEq(usds.balanceOf(address(buffer)), 0.01 * 10**18); (, art) = vat.urns(ilk, address(vault)); assertEq(art, 1); // Dust which is impossible to wipe } diff --git a/test/funnels/automation/VaultMinter.t.sol b/test/funnels/automation/VaultMinter.t.sol index d74a15b5..a4d78a3c 100644 --- a/test/funnels/automation/VaultMinter.t.sol +++ b/test/funnels/automation/VaultMinter.t.sol @@ -10,7 +10,7 @@ import { AllocatorBuffer } from "src/AllocatorBuffer.sol"; import { VatMock } from "test/mocks/VatMock.sol"; import { JugMock } from "test/mocks/JugMock.sol"; import { GemMock } from "test/mocks/GemMock.sol"; -import { NstJoinMock } from "test/mocks/NstJoinMock.sol"; +import { UsdsJoinMock } from "test/mocks/UsdsJoinMock.sol"; contract VaultMinterTest is DssTest { using stdStorage for StdStorage; @@ -23,8 +23,8 @@ contract VaultMinterTest is DssTest { VatMock public vat; JugMock public jug; - GemMock public nst; - NstJoinMock public nstJoin; + GemMock public usds; + UsdsJoinMock public usdsJoin; AllocatorBuffer public buffer; AllocatorRoles public roles; AllocatorVault public vault; @@ -36,15 +36,15 @@ contract VaultMinterTest is DssTest { uint8 constant MINTER_ROLE = uint8(1); function setUp() public { - vat = new VatMock(); - jug = new JugMock(vat); - nst = new GemMock(0); - nstJoin = new NstJoinMock(vat, nst); - buffer = new AllocatorBuffer(); - roles = new AllocatorRoles(); - vault = new AllocatorVault(address(roles), address(buffer), ILK, address(nstJoin)); + vat = new VatMock(); + jug = new JugMock(vat); + usds = new GemMock(0); + usdsJoin = new UsdsJoinMock(vat, usds); + buffer = new AllocatorBuffer(); + roles = new AllocatorRoles(); + vault = new AllocatorVault(address(roles), address(buffer), ILK, address(usdsJoin)); vault.file("jug", address(jug)); - buffer.approve(address(nst), address(vault), type(uint256).max); + buffer.approve(address(usds), address(vault), type(uint256).max); vat.slip(ILK, address(vault), int256(1_000_000 * WAD)); vat.grab(ILK, address(vault), address(vault), address(0), int256(1_000_000 * WAD), 0); @@ -135,7 +135,7 @@ contract VaultMinterTest is DssTest { function testDrawWipeByKeeper() public { minter.setConfig(int64(10), uint32(1 hours), uint128(1_000 * WAD)); - assertEq(nst.balanceOf(address(buffer)), 0); + assertEq(usds.balanceOf(address(buffer)), 0); (int64 num, uint32 hop, uint32 zzz, uint128 lot) = minter.config(); assertEq(num, 10); assertEq(hop, 1 hours); @@ -146,7 +146,7 @@ contract VaultMinterTest is DssTest { emit Draw(uint128(1_000 * WAD)); vm.prank(KEEPER); minter.draw(); - assertEq(nst.balanceOf(address(buffer)), 1_000 * WAD); + assertEq(usds.balanceOf(address(buffer)), 1_000 * WAD); (num, hop, zzz, lot) = minter.config(); assertEq(num, 9); assertEq(hop, 1 hours); @@ -160,7 +160,7 @@ contract VaultMinterTest is DssTest { vm.warp(block.timestamp + 1); vm.prank(KEEPER); minter.draw(); - assertEq(nst.balanceOf(address(buffer)), 2_000 * WAD); + assertEq(usds.balanceOf(address(buffer)), 2_000 * WAD); (num, hop, zzz, lot) = minter.config(); assertEq(num, 8); assertEq(hop, 1 hours); @@ -179,7 +179,7 @@ contract VaultMinterTest is DssTest { emit Wipe(uint128(100 * WAD)); vm.prank(KEEPER); minter.wipe(); - assertEq(nst.balanceOf(address(buffer)), 1_900 * WAD); + assertEq(usds.balanceOf(address(buffer)), 1_900 * WAD); (num, hop, zzz, lot) = minter.config(); assertEq(num, -9); assertEq(hop, 1 hours); @@ -193,7 +193,7 @@ contract VaultMinterTest is DssTest { vm.warp(block.timestamp + 1); vm.prank(KEEPER); minter.wipe(); - assertEq(nst.balanceOf(address(buffer)), 1_800 * WAD); + assertEq(usds.balanceOf(address(buffer)), 1_800 * WAD); (num, hop, zzz, lot) = minter.config(); assertEq(num, -8); assertEq(hop, 1 hours); diff --git a/test/integration/Deployment.t.sol b/test/integration/Deployment.t.sol index 3011bab9..5cb80411 100644 --- a/test/integration/Deployment.t.sol +++ b/test/integration/Deployment.t.sol @@ -28,7 +28,7 @@ import { AllocatorFunnelInit, AllocatorIlkFunnelConfig } from "deploy/funnels/Al import { SwapperCalleeUniV3 } from "src/funnels/callees/SwapperCalleeUniV3.sol"; import { GemMock } from "test/mocks/GemMock.sol"; -import { NstJoinMock } from "test/mocks/NstJoinMock.sol"; +import { UsdsJoinMock } from "test/mocks/UsdsJoinMock.sol"; import { VatMock } from "test/mocks/VatMock.sol"; import { AllocatorConduitMock } from "test/mocks/AllocatorConduitMock.sol"; @@ -105,8 +105,8 @@ contract DeploymentTest is DssTest { uint8 constant automationRole = uint8(2); // contracts to be deployed - address nst; - address nstJoin; + address usds; + address usdsJoin; address uniV3Callee; address conduit1; address conduit2; @@ -130,8 +130,8 @@ contract DeploymentTest is DssTest { ILK_REGISTRY = ChainlogLike(LOG).getAddress("ILK_REGISTRY"); USDC = ChainlogLike(LOG).getAddress("USDC"); - nst = address(new GemMock(0)); - nstJoin = address(new NstJoinMock(VatMock(address(dss.vat)), GemMock(nst))); + usds = address(new GemMock(0)); + usdsJoin = address(new UsdsJoinMock(VatMock(address(dss.vat)), GemMock(usds))); uniV3Callee = address(new SwapperCalleeUniV3(UNIV3_ROUTER)); usdcDaiPath = abi.encodePacked(USDC, uint24(100), address(dss.dai)); @@ -143,7 +143,7 @@ contract DeploymentTest is DssTest { owner : PAUSE_PROXY, roles : sharedInst.roles, ilk : ILK, - nstJoin : nstJoin + usdsJoin : usdsJoin }); ilkFunnelInst = AllocatorFunnelDeploy.deployIlkFunnel({ deployer : address(this), @@ -279,7 +279,7 @@ contract DeploymentTest is DssTest { assertEq(AllocatorRegistry(sharedInst.registry).buffers(ILK), ilkInst.buffer); assertEq(address(AllocatorVault(ilkInst.vault).jug()), address(dss.jug)); - assertEq(GemLike(nst).allowance(ilkInst.buffer, ilkInst.vault), type(uint256).max); + assertEq(GemLike(usds).allowance(ilkInst.buffer, ilkInst.vault), type(uint256).max); assertEq(GemLike(address(dss.dai)).allowance(ilkInst.buffer, ilkFunnelInst.swapper), type(uint256).max); assertEq(GemLike(address(dss.dai)).allowance(ilkInst.buffer, ilkFunnelInst.depositorUniV3), type(uint256).max); assertEq(GemLike(USDC).allowance(ilkInst.buffer, ilkFunnelInst.depositorUniV3), type(uint256).max); diff --git a/test/mocks/NstJoinMock.sol b/test/mocks/UsdsJoinMock.sol similarity index 68% rename from test/mocks/NstJoinMock.sol rename to test/mocks/UsdsJoinMock.sol index 20913ffc..5350848a 100644 --- a/test/mocks/NstJoinMock.sol +++ b/test/mocks/UsdsJoinMock.sol @@ -5,22 +5,22 @@ pragma solidity ^0.8.16; import { VatMock } from "test/mocks/VatMock.sol"; import { GemMock } from "test/mocks/GemMock.sol"; -contract NstJoinMock { +contract UsdsJoinMock { VatMock public vat; - GemMock public nst; + GemMock public usds; - constructor(VatMock vat_, GemMock nst_) { - vat = vat_; - nst = nst_; + constructor(VatMock vat_, GemMock usds_) { + vat = vat_; + usds = usds_; } function join(address usr, uint256 wad) external { vat.move(address(this), usr, wad * 10**27); - nst.burn(msg.sender, wad); + usds.burn(msg.sender, wad); } function exit(address usr, uint256 wad) external { vat.move(msg.sender, address(this), wad * 10**27); - nst.mint(usr, wad); + usds.mint(usr, wad); } } diff --git a/test/mocks/NstMock.sol b/test/mocks/UsdsMock.sol similarity index 84% rename from test/mocks/NstMock.sol rename to test/mocks/UsdsMock.sol index 555736f1..6b033e0e 100644 --- a/test/mocks/NstMock.sol +++ b/test/mocks/UsdsMock.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.16; -contract NstMock { +contract UsdsMock { mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; @@ -19,7 +19,7 @@ contract NstMock { function transfer(address to, uint256 value) external returns (bool) { uint256 balance = balanceOf[msg.sender]; - require(balance >= value, "Nst/insufficient-balance"); + require(balance >= value, "Usds/insufficient-balance"); unchecked { balanceOf[msg.sender] = balance - value; @@ -30,12 +30,12 @@ contract NstMock { function transferFrom(address from, address to, uint256 value) external returns (bool) { uint256 balance = balanceOf[from]; - require(balance >= value, "Nst/insufficient-balance"); + require(balance >= value, "Usds/insufficient-balance"); if (from != msg.sender) { uint256 allowed = allowance[from][msg.sender]; if (allowed != type(uint256).max) { - require(allowed >= value, "Nst/insufficient-allowance"); + require(allowed >= value, "Usds/insufficient-allowance"); unchecked { allowance[from][msg.sender] = allowed - value; @@ -59,12 +59,12 @@ contract NstMock { function burn(address from, uint256 value) external { uint256 balance = balanceOf[from]; - require(balance >= value, "Nst/insufficient-balance"); + require(balance >= value, "Usds/insufficient-balance"); if (from != msg.sender) { uint256 allowed = allowance[from][msg.sender]; if (allowed != type(uint256).max) { - require(allowed >= value, "Nst/insufficient-allowance"); + require(allowed >= value, "Usds/insufficient-allowance"); unchecked { allowance[from][msg.sender] = allowed - value;