-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into jun/vault-rounding-error
- Loading branch information
Showing
8 changed files
with
103 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"initialDefaultAdmin": "0x01bd9aBD70D74D8eC70D338bD6099ca29DA3F9B4", | ||
"protocol": "0x0000000000417626Ef34D62C4DC189b021603f2F", | ||
"ilkAddress": "0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0" | ||
"ilkAddress": "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
{ | ||
"ilkData": { | ||
"adjustedProfitMargin": "0", | ||
"minimumKinkRate": "4062570058138700000", | ||
"minimumKinkRate": "3030912926100000000", | ||
"reserveFactor": "0", | ||
"adjustedBaseRate": "0", | ||
"minimumBaseRate": "1580630071273960000", | ||
"optimalUtilizationRate": "8500", | ||
"minimumBaseRate": "860244400000000000", | ||
"optimalUtilizationRate": "9000", | ||
"adjustedAboveKinkSlope": "0", | ||
"minimumAboveKinkSlope": "23863999665252300000" | ||
"minimumAboveKinkSlope": "73381553300000000000" | ||
}, | ||
"yieldOracleAddress": "0x437CC840e234C2127f54CD59B0B18aF59c586760" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ | ||
"targetHealth": "1200000000000000000000000000", | ||
"liquidationThreshold": "900000000000000000000000000", | ||
"liquidationThreshold": "960000000000000000000000000", | ||
"maxDiscount": "200000000000000000000000000", | ||
"reserveFactor": "10000000000000000000000000", | ||
"ionPool": "0x00000000007C8105548f9d0eE081987378a6bE93", | ||
"reserveOracle": "0xAAa88236D483f08003493adbbf451373992f2f58", | ||
"salt": "0x01bd9abd70d74d8ec70d338bd6099ca29da3f9b4005cafa1b6cefd1e01e924d6" | ||
"salt": "0x01bd9abd70d74d8ec70d338bd6099ca29da3f9b4002d932cfb5726e503d4baa8" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"ltv": "930000000000000000000000000", | ||
"reserveOracle": "0xAAa88236D483f08003493adbbf451373992f2f58", | ||
"maxTimeFromLastUpdate": "86400" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.21; | ||
|
||
import { ReserveOracle } from "../../src/oracles/reserve/ReserveOracle.sol"; | ||
import { SpotOracle } from "../../src/oracles/spot/SpotOracle.sol"; | ||
import { DeployTestBase } from "./00_DeployTestBase.t.sol"; | ||
import { RedeploySpotOracleScript } from "../deploy/11_RedeploySpotOracle.s.sol"; | ||
|
||
contract RedeploySpotOracleTest is DeployTestBase, RedeploySpotOracleScript { | ||
function checkState(SpotOracle spotOracle) public { | ||
assertGt(address(spotOracle).code.length, 0, "spot oracle code"); | ||
assertEq(spotOracle.LTV(), ltv, "spot oracle ltv"); | ||
assertEq(address(spotOracle.RESERVE_ORACLE()), address(reserveOracle), "spot oracle reserve oracle"); | ||
assertGt(spotOracle.getPrice(), 0, "spot oracle get price"); | ||
assertGt(spotOracle.getSpot(), 0, "spot oracle get spot"); | ||
} | ||
|
||
function test_PreExecution() public { | ||
(SpotOracle spotOracle) = super.run(); | ||
checkState(spotOracle); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.21; | ||
|
||
import { DeployScript } from "../Deploy.s.sol"; | ||
import { RAY } from "../../src/libraries/math/WadRayMath.sol"; | ||
import { SpotOracle } from "./../../src/oracles/spot/SpotOracle.sol"; | ||
import { WeEthWstEthSpotOracle } from "../../src/oracles/spot/lrt/WeEthWstEthSpotOracle.sol"; | ||
import { RsEthWstEthSpotOracle } from "./../../src/oracles/spot/lrt/RsEthWstEthSpotOracle.sol"; | ||
import { RswEthWstEthSpotOracle } from "./../../src/oracles/spot/lrt/RswEthWstEthSpotOracle.sol"; | ||
import { stdJson as StdJson } from "forge-std/StdJson.sol"; | ||
|
||
import { console2 } from "forge-std/console2.sol"; | ||
|
||
// NOTE ALWAYS CHECK WHETHER THE CORRECT CONTRACT IS BEING DEPLOYED | ||
contract RedeploySpotOracleScript is DeployScript { | ||
using StdJson for string; | ||
|
||
string configPath = "./deployment-config/11_RedeploySpotOracle.json"; | ||
string config = vm.readFile(configPath); | ||
|
||
uint256 ltv = config.readUint(".ltv"); | ||
address reserveOracle = config.readAddress(".reserveOracle"); | ||
|
||
function run() public broadcast returns (SpotOracle spotOracle) { | ||
require(ltv > 0.2e27, "ltv must be greater than 20%"); | ||
require(ltv < RAY, "ltv must be less than 100%"); | ||
|
||
// Specific to using Redstone Oracles | ||
uint256 maxTimeFromLastUpdate = config.readUint(".maxTimeFromLastUpdate"); | ||
|
||
if (deployCreate2) { | ||
spotOracle = | ||
new RswEthWstEthSpotOracle{ salt: DEFAULT_SALT }(ltv, address(reserveOracle), maxTimeFromLastUpdate); | ||
} else { | ||
spotOracle = new RswEthWstEthSpotOracle(ltv, address(reserveOracle), maxTimeFromLastUpdate); | ||
} | ||
|
||
console2.log("address(spotOracle): ", address(spotOracle)); | ||
} | ||
} |