Skip to content

Commit 19df21b

Browse files
fix: failing tests
Signed-off-by: Elliot <[email protected]>
1 parent aecfda8 commit 19df21b

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

src/exercises/04/SIP04.sol

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ contract SIP04 is GovernorBravoProposal {
3434
chainIds[0] = 1;
3535

3636
setAddresses(new Addresses(addressesFolderPath, chainIds));
37+
setGovernor(addresses.getAddress("COMPOUND_GOVERNOR_BRAVO"));
3738
}
3839

3940
function name() public pure override returns (string memory) {
40-
return "SIP-03 Upgrade";
41+
return "SIP-04";
4142
}
4243

4344
function description()
@@ -46,7 +47,7 @@ contract SIP04 is GovernorBravoProposal {
4647
override
4748
returns (string memory)
4849
{
49-
return name();
50+
return "Upgrade to V4 Vault Implementation";
5051
}
5152

5253
function run() public override {
@@ -80,7 +81,7 @@ contract SIP04 is GovernorBravoProposal {
8081
// upgrade to new implementation
8182
ProxyAdmin(proxyAdmin).upgradeAndCall(
8283
ITransparentUpgradeableProxy(vaultProxy),
83-
addresses.getAddress("V4_VAULT_IMPLEMENTATION"),
84+
addresses.getAddress("V4_VAULT_IMPL"),
8485
""
8586
);
8687

src/exercises/04/Vault04.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ contract Vault is VaultStoragePausable {
196196
uint8 decimals = IERC20Metadata(token).decimals();
197197
normalizedAmount = amount;
198198
if (decimals < 18) {
199-
normalizedAmount = amount ** (10 * (18 - decimals));
199+
normalizedAmount = amount * (10 ** (18 - decimals));
200200
}
201201
}
202202
}

test/TestVault04.t.sol

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ pragma solidity ^0.8.0;
33
import {SafeERC20} from
44
"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
55
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
6-
import {Test} from "@forge-std/Test.sol";
6+
import {Test, console} from "@forge-std/Test.sol";
77

8-
import {SIP02} from "src/exercises/02/SIP02.sol";
8+
import {SIP03} from "src/exercises/03/SIP03.sol";
9+
import {SIP04} from "src/exercises/04/SIP04.sol";
910
import {Vault} from "src/exercises/04/Vault04.sol";
1011

11-
contract TestVault04 is Test, SIP02 {
12+
contract TestVault04 is Test, SIP04 {
1213
using SafeERC20 for IERC20;
1314

1415
Vault public vault;
@@ -32,14 +33,26 @@ contract TestVault04 is Test, SIP02 {
3233
vm.setEnv("DO_PRINT", "false");
3334
vm.setEnv("DO_VALIDATE", "false");
3435

36+
SIP03 sip03 = new SIP03();
37+
38+
sip03.setupProposal();
39+
sip03.deploy();
40+
3541
/// setup the proposal
3642
setupProposal();
3743

44+
/// copy SIP03 addresses into this contract for integration testing
45+
setAddresses(sip03.addresses());
46+
3847
/// run the proposal
3948
vm.startPrank(addresses.getAddress("DEPLOYER_EOA"));
4049
deploy();
4150
vm.stopPrank();
4251

52+
/// build and run proposal
53+
build();
54+
simulate();
55+
4356
dai = addresses.getAddress("DAI");
4457
usdc = addresses.getAddress("USDC");
4558
usdt = addresses.getAddress("USDT");
@@ -76,7 +89,9 @@ contract TestVault04 is Test, SIP02 {
7689

7790
function testWithdrawAlreadyDepositedUSDC() public {
7891
uint256 usdcDepositAmount = 1_000e6;
92+
7993
_vaultDeposit(usdc, address(this), usdcDepositAmount);
94+
8095
vault.withdraw(usdc, usdcDepositAmount);
8196
}
8297

0 commit comments

Comments
 (0)