-
Notifications
You must be signed in to change notification settings - Fork 36
test: Vault spoke unit tests #1049
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
base: feat/vault-spoke
Are you sure you want to change the base?
Changes from 14 commits
d90dec4
c68e67b
b37c4b3
8b144f0
33ea07d
a3cd654
10a15ac
4f34f40
2a0b5de
1e2450d
0ded842
1fd7c56
fe8af6f
1c2b38f
090b396
0c71ed4
d8e2d24
72937b3
13f4be2
8832daa
3e4e65b
a1a79c3
8ab9b3e
5f1a0c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,155 @@ | ||||||
| // SPDX-License-Identifier: UNLICENSED | ||||||
| // Copyright (c) 2025 Aave Labs | ||||||
| pragma solidity ^0.8.0; | ||||||
|
|
||||||
| import 'tests/unit/Spoke/SpokeBase.t.sol'; | ||||||
| import 'src/Spoke/Instances/VaultSpokeInstance.sol'; | ||||||
| import 'src/Spoke/Interfaces/IVaultSpoke.sol'; | ||||||
|
|
||||||
| contract VaultSpokeBaseTest is SpokeBase { | ||||||
| IVaultSpoke public vault; | ||||||
| address public proxyAdminOwner = makeAddr('proxyAdminOwner'); | ||||||
|
|
||||||
| function setUp() public override { | ||||||
| super.setUp(); | ||||||
| address deployer = makeAddr('deployer'); | ||||||
| address vaultImpl = address(new VaultSpokeInstance(address(hub1), daiAssetId)); | ||||||
| vault = IVaultSpoke( | ||||||
| _proxify( | ||||||
| deployer, | ||||||
| vaultImpl, | ||||||
| proxyAdminOwner, | ||||||
| abi.encodeCall(VaultSpoke.initialize, ('hub1-DAI')) | ||||||
| ) | ||||||
| ); | ||||||
| // Add VaultSpoke to Hub | ||||||
| IHub.SpokeConfig memory config = IHub.SpokeConfig({ | ||||||
| addCap: Constants.MAX_ALLOWED_SPOKE_CAP, | ||||||
| drawCap: Constants.MAX_ALLOWED_SPOKE_CAP, | ||||||
| riskPremiumThreshold: Constants.MAX_ALLOWED_COLLATERAL_RISK, | ||||||
| active: true, | ||||||
| paused: false | ||||||
| }); | ||||||
| vm.prank(ADMIN); | ||||||
| hub1.addSpoke(daiAssetId, address(vault), config); | ||||||
| } | ||||||
|
|
||||||
| function _depositFromUser(address user, uint256 amount) internal { | ||||||
|
||||||
| deal(address(tokenList.dai), user, amount); | ||||||
|
|
||||||
| vm.startPrank(user); | ||||||
| tokenList.dai.approve(address(vault), amount); | ||||||
| vault.deposit(amount, user); | ||||||
| vm.stopPrank(); | ||||||
| } | ||||||
|
|
||||||
| function _depositData( | ||||||
| IVaultSpoke vault_, | ||||||
|
||||||
| IVaultSpoke vault_, | |
| IVaultSpoke vault, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this causes compiler warning due to shadowed declaration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they must be zero, usually. any reason for not setting zero here now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done