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

test: fix mainnet oracle tests #649

Merged
merged 1 commit into from
Dec 12, 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
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
Loading