Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error contract name #125

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/pools/D3MAaveV3USDSNoSupplyCapTypePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ contract D3MAaveV3USDSNoSupplyCapTypePool is ID3MPool {

// Fetch the reserve data from Aave
PoolLike.ReserveData memory data = pool.getReserveData(address(usds));
require(data.aTokenAddress != address(0), "D3MAaveV3NoSupplyCapTypePool/invalid-ausds");
require(data.stableDebtTokenAddress != address(0), "D3MAaveV3NoSupplyCapTypePool/invalid-stableDebt");
require(data.variableDebtTokenAddress != address(0), "D3MAaveV3NoSupplyCapTypePool/invalid-variableDebt");
require(data.aTokenAddress != address(0), "D3MAaveV3USDSNoSupplyCapTypePool/invalid-ausds");
require(data.stableDebtTokenAddress != address(0), "D3MAaveV3USDSNoSupplyCapTypePool/invalid-stableDebt");
require(data.variableDebtTokenAddress != address(0), "D3MAaveV3USDSNoSupplyCapTypePool/invalid-variableDebt");

ausds = ATokenLike(data.aTokenAddress);
stableDebt = ATokenLike(data.stableDebtTokenAddress);
Expand All @@ -157,12 +157,12 @@ contract D3MAaveV3USDSNoSupplyCapTypePool is ID3MPool {
}

modifier auth {
require(wards[msg.sender] == 1, "D3MAaveV3NoSupplyCapTypePool/not-authorized");
require(wards[msg.sender] == 1, "D3MAaveV3USDSNoSupplyCapTypePool/not-authorized");
_;
}

modifier onlyHub {
require(msg.sender == hub, "D3MAaveV3NoSupplyCapTypePool/only-hub");
require(msg.sender == hub, "D3MAaveV3USDSNoSupplyCapTypePool/only-hub");
_;
}

Expand All @@ -186,13 +186,13 @@ contract D3MAaveV3USDSNoSupplyCapTypePool is ID3MPool {
}

function file(bytes32 what, address data) external auth {
require(vat.live() == 1, "D3MAaveV3NoSupplyCapTypePool/no-file-during-shutdown");
require(vat.live() == 1, "D3MAaveV3USDSNoSupplyCapTypePool/no-file-during-shutdown");
if (what == "hub") {
vat.nope(hub);
hub = data;
vat.hope(data);
} else if (what == "king") king = data;
else revert("D3MAaveV3NoSupplyCapTypePool/file-unrecognized-param");
else revert("D3MAaveV3USDSNoSupplyCapTypePool/file-unrecognized-param");
emit File(what, data);
}

Expand All @@ -209,7 +209,7 @@ contract D3MAaveV3USDSNoSupplyCapTypePool is ID3MPool {
// Verify the correct amount of ausds shows up
uint256 interestIndex = pool.getReserveNormalizedIncome(address(usds));
uint256 scaledAmount = _rdiv(wad, interestIndex);
require(ausds.scaledBalanceOf(address(this)) >= (scaledPrev + scaledAmount), "D3MAaveV3NoSupplyCapTypePool/incorrect-ausds-balance-received");
require(ausds.scaledBalanceOf(address(this)) >= (scaledPrev + scaledAmount), "D3MAaveV3USDSNoSupplyCapTypePool/incorrect-ausds-balance-received");
}

// Withdraws USDS from Aave in exchange for ausds
Expand All @@ -219,7 +219,7 @@ contract D3MAaveV3USDSNoSupplyCapTypePool is ID3MPool {

pool.withdraw(address(usds), wad, address(this));

require(usds.balanceOf(address(this)) == prevUsds + wad, "D3MAaveV3NoSupplyCapTypePool/incorrect-usds-balance-received");
require(usds.balanceOf(address(this)) == prevUsds + wad, "D3MAaveV3USDSNoSupplyCapTypePool/incorrect-usds-balance-received");

usdsJoin.join(address(this), wad);
daiJoin.exit(msg.sender, wad);
Expand All @@ -229,12 +229,12 @@ contract D3MAaveV3USDSNoSupplyCapTypePool is ID3MPool {
uint256 exited_ = exited;
exited = exited_ + wad;
uint256 amt = wad * assetBalance() / (D3mHubLike(hub).end().Art(ilk) - exited_);
require(ausds.transfer(dst, amt), "D3MAaveV3NoSupplyCapTypePool/transfer-failed");
require(ausds.transfer(dst, amt), "D3MAaveV3USDSNoSupplyCapTypePool/transfer-failed");
}

function quit(address dst) external override auth {
require(vat.live() == 1, "D3MAaveV3NoSupplyCapTypePool/no-quit-during-shutdown");
require(ausds.transfer(dst, ausds.balanceOf(address(this))), "D3MAaveV3NoSupplyCapTypePool/transfer-failed");
require(vat.live() == 1, "D3MAaveV3USDSNoSupplyCapTypePool/no-quit-during-shutdown");
require(ausds.transfer(dst, ausds.balanceOf(address(this))), "D3MAaveV3USDSNoSupplyCapTypePool/transfer-failed");
}

function preDebtChange() external override {}
Expand All @@ -260,7 +260,7 @@ contract D3MAaveV3USDSNoSupplyCapTypePool is ID3MPool {

// --- Collect any rewards ---
function collect(address gift) external returns (uint256 amt) {
require(king != address(0), "D3MAaveV3NoSupplyCapTypePool/king-not-set");
require(king != address(0), "D3MAaveV3USDSNoSupplyCapTypePool/king-not-set");

address[] memory assets = new address[](1);
assets[0] = address(ausds);
Expand Down
8 changes: 4 additions & 4 deletions src/tests/pools/D3MAaveV3USDSNoSupplyCapTypePool.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ contract D3MAaveV3USDSNoSupplyCapTypePoolTest is D3MPoolBaseTest {
D3MAaveV3USDSNoSupplyCapTypePool pool;

function setUp() public {
baseInit("D3MAaveV3NoSupplyCapTypePool");
baseInit("D3MAaveV3USDSNoSupplyCapTypePool");

usds = new TokenMock(18);
ausds = new AToken(18);
Expand Down Expand Up @@ -237,12 +237,12 @@ contract D3MAaveV3USDSNoSupplyCapTypePoolTest is D3MPoolBaseTest {

function test_cannot_file_king_no_auth() public {
pool.deny(address(this));
assertRevert(address(pool), abi.encodeWithSignature("file(bytes32,address)", bytes32("king"), address(123)), "D3MAaveV3NoSupplyCapTypePool/not-authorized");
assertRevert(address(pool), abi.encodeWithSignature("file(bytes32,address)", bytes32("king"), address(123)), "D3MAaveV3USDSNoSupplyCapTypePool/not-authorized");
}

function test_cannot_file_king_vat_caged() public {
vat.cage();
assertRevert(address(pool), abi.encodeWithSignature("file(bytes32,address)", bytes32("king"), address(123)), "D3MAaveV3NoSupplyCapTypePool/no-file-during-shutdown");
assertRevert(address(pool), abi.encodeWithSignature("file(bytes32,address)", bytes32("king"), address(123)), "D3MAaveV3USDSNoSupplyCapTypePool/no-file-during-shutdown");
}

function test_deposit_calls_lending_pool_deposit() public {
Expand Down Expand Up @@ -297,7 +297,7 @@ contract D3MAaveV3USDSNoSupplyCapTypePoolTest is D3MPoolBaseTest {

function test_collect_no_king() public {
assertEq(pool.king(), address(0));
assertRevert(address(pool), abi.encodeWithSignature("collect(address)", address(0)), "D3MAaveV3NoSupplyCapTypePool/king-not-set");
assertRevert(address(pool), abi.encodeWithSignature("collect(address)", address(0)), "D3MAaveV3USDSNoSupplyCapTypePool/king-not-set");
}

function test_redeemable_returns_ausds() public {
Expand Down
Loading