Skip to content

Commit

Permalink
Merge pull request #649 from liquity/fix-oracle-mainnet-tests
Browse files Browse the repository at this point in the history
test: fix mainnet oracle tests
  • Loading branch information
bingen authored Dec 12, 2024
2 parents be954ae + 2a870c9 commit 7b11776
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion contracts/src/test/OracleMainnet.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract OraclesMainnet is TestAccounts {
WSTETHTokenMock mockWstethToken;

TestDeployer.LiquityContracts[] contractsArray;
ICollateralRegistry collateralRegistry;
CollateralRegistryTester collateralRegistry;
IBoldToken boldToken;

struct StoredOracle {
Expand Down Expand Up @@ -127,6 +127,11 @@ contract OraclesMainnet is TestAccounts {
// console2.log(ethOracle.decimals(), "ETHUSD decimals");
// console2.log(rethOracle.decimals(), "RETHETH decimals");
// console2.log(stethOracle.decimals(), "STETHETH decimals");

// Artificially decay the base rate so we start with a low redemption rate.
// Normally, we would just wait for it to decay "naturally" (with `vm.warp`), but we can't do that here,
// as it would result in all the oracles going stale.
collateralRegistry.setBaseRate(0);
}

function _getLatestAnswerFromOracle(AggregatorV3Interface _oracle) internal view returns (uint256) {
Expand Down
5 changes: 3 additions & 2 deletions contracts/src/test/TestContracts/Deployment.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import "../../SortedTroves.sol";
import "../../StabilityPool.sol";
import "./BorrowerOperationsTester.t.sol";
import "./TroveManagerTester.t.sol";
import "./CollateralRegistryTester.sol";
import "../../TroveNFT.sol";
import "../../NFTMetadata/MetadataNFT.sol";
import "../../CollateralRegistry.sol";
Expand Down Expand Up @@ -148,7 +149,7 @@ contract TestDeployer is MetadataDeployment {
struct DeploymentResultMainnet {
LiquityContracts[] contractsArray;
ExternalAddresses externalAddresses;
ICollateralRegistry collateralRegistry;
CollateralRegistryTester collateralRegistry;
IBoldToken boldToken;
HintHelpers hintHelpers;
MultiTroveGetter multiTroveGetter;
Expand Down Expand Up @@ -574,7 +575,7 @@ contract TestDeployer is MetadataDeployment {
vars.troveManagers[2] = ITroveManager(troveManagerAddress);

// Deploy registry and register the TMs
result.collateralRegistry = new CollateralRegistry(result.boldToken, vars.collaterals, vars.troveManagers);
result.collateralRegistry = new CollateralRegistryTester(result.boldToken, vars.collaterals, vars.troveManagers);

result.hintHelpers = new HintHelpers(result.collateralRegistry);
result.multiTroveGetter = new MultiTroveGetter(result.collateralRegistry);
Expand Down

0 comments on commit 7b11776

Please sign in to comment.