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

Add test showing price lookup works even after removing a vault #403

Merged
merged 4 commits into from
Sep 2, 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
34 changes: 34 additions & 0 deletions deployments/testnet/base-sepolia-demo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"chainId": 84532,
"rpcUrl": "https://sepolia.base.org/",
"config": {
"commitHash": "6e8f1a29dff0d7cf5ff74285cfffadae8a8b303f",
"deployer": "0x423420Ae467df6e90291fd0252c0A8a637C1e03f",
"adapter": {
"name": "Axelar",
"axelarGateway": "0xe432150cce91c13a887f7D836923d5597adD8E31",
"axelarGasService": "0xbE406F0189A0B4cf3A05C286473D23791Dd44Cc6"
},
"admin": "0x423420Ae467df6e90291fd0252c0A8a637C1e03f",
"etherscanUrl": "https://api.etherscan.io/api/"
},
"contracts": {
"root": "0x86aFA8451FB7bDAa6eCE9eD9980a603Ab3705c6f",
"guardian": "0x0E371D2F84Bbf2D7773F7f51Fa434B192550240d",
"restrictionManager": "0x318228Ca44F96fe7d2DA84Ab38cd3E9775d1170a",
"investmentManager": "0x8503b4452Bf6238cC76CdbEE223b46d7196b1c93",
"poolManager": "0xfFFAFb8d12d130414FD423A1dEb35130ac302D10",
"centrifugeRouter": "0x1e67906F3F990F7d1B53bfcAB97346d4B16310E3",
"gateway": "0xeda53c42fCaa2a36473AE95c7EB8CE271D4979CD",
"gasService": "0x314fc3bf9984ca64DBB0d6b5A513F1cAAb812A4c",
"escrow": "0x1C535265A20Cfb5FE20baab086642C245117D6c9",
"routerEscrow": "0x425af5C6A68f535A47Cb811f5eB9dad3F6235432",
"adapter": "0xEC55dB8b44088198a2d72Da798535bffB64fBa5c",
"trancheFactory": "0xcE4D15c9d35995e5F46FE406c3E6aa3Fb97ad978",
"erc7540VaultFactory": "0x934eA3cAF6A798Cdf441408bF8C4D4F4E698cef0",
"transferProxyFactory": "0x2B0c5001F55067191735aCF05d251cDf26BB9ABf"
},
"deploymentBlock": 6403738,
"isTestnet": true,
"isDeterministicallyDeployed": false
}
1 change: 1 addition & 0 deletions test/fork/Fork.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ contract ForkTest is Test {

// Testnet
// _loadDeployment("testnet", "ethereum-sepolia-demo");
_loadDeployment("testnet", "base-sepolia-demo");
}

function testContractSetup() public {
Expand Down
24 changes: 24 additions & 0 deletions test/integration/AssetShareConversion.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,28 @@ contract AssetShareConversionTest is BaseTest {
assertEq(vault.convertToAssets(vault.convertToShares(120000000000000000000)), 120000000000000000000);
assertEq(vault.pricePerShare(), 1.2e18);
}

function testPriceWorksAfterRemovingVault(uint64 poolId, bytes16 trancheId, uint128 assetId) public {
vm.assume(assetId > 0);

uint8 INVESTMENT_CURRENCY_DECIMALS = 6; // 6, like USDC
uint8 TRANCHE_TOKEN_DECIMALS = 18; // Like DAI

ERC20 asset = _newErc20("Asset", "A", INVESTMENT_CURRENCY_DECIMALS);
address vault_ =
deployVault(poolId, TRANCHE_TOKEN_DECIMALS, restrictionManager, "", "", trancheId, assetId, address(asset));
ERC7540Vault vault = ERC7540Vault(vault_);
ITranche tranche = ITranche(address(ERC7540Vault(vault_).share()));

assertEq(vault.priceLastUpdated(), block.timestamp);
assertEq(vault.pricePerShare(), 1e6);
centrifugeChain.updateTranchePrice(poolId, trancheId, assetId, 1.2e18, uint64(block.timestamp));
assertEq(vault.priceLastUpdated(), uint64(block.timestamp));
assertEq(vault.pricePerShare(), 1.2e6);

poolManager.removeVault(poolId, trancheId, address(vault.asset()));

assertEq(vault.priceLastUpdated(), uint64(block.timestamp));
assertEq(vault.pricePerShare(), 1.2e6);
}
}
Loading