Skip to content
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
16 changes: 11 additions & 5 deletions contracts/deploy/deployActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const {
getOracleAddresses,
isMainnet,
isHolesky,
isHoleskyOrFork,
isSonicOrFork,
isTest,
} = require("../test/helpers.js");
const { deployWithConfirmation, withConfirmation } = require("../utils/deploy");
Expand Down Expand Up @@ -1019,23 +1021,27 @@ const deployOracles = async () => {
let args = [];
if (isMainnet) {
oracleContract = "OracleRouter";
} else if (isHolesky) {
} else if (isHoleskyOrFork) {
oracleContract = "OETHFixedOracle";
contractName = "OETHOracleRouter";
args = [addresses.zero];
} else if (isSonicOrFork) {
oracleContract = "OETHFixedOracle";
contractName = "OSonicOracleRouter";
args = [addresses.zero];
}

await deployWithConfirmation(contractName, args, oracleContract);
const oracleRouter = await ethers.getContract("OracleRouter");
log("Deployed OracleRouter");

if (isHolesky) {
if (isHoleskyOrFork || isSonicOrFork) {
// no need to configure any feeds since they are hardcoded to a fixed feed
// TODO: further deployments will require more intelligent separation of different
// chains / environment oracle deployments
return;
}

const oracleRouter = await ethers.getContract("OracleRouter");
log("Deployed OracleRouter");

const assetAddresses = await getAssetAddresses(deployments);
await deployWithConfirmation("AuraWETHPriceFeed", [
assetAddresses.auraWeightedOraclePool,
Expand Down
32 changes: 32 additions & 0 deletions contracts/deploy/sonic/002_oracle_router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const { deployOnSonic } = require("../../utils/deploy-l2.js");
const { deployOracles } = require("../deployActions");

module.exports = deployOnSonic(
{
deployName: "002_oracle_router",
forceSkip: false,
},
Comment on lines +5 to +8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question to learn a bit more, is there a reason not to set reduceQueueTime to true here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the timelock is already configured to have 60s delay time on sonic chain. No need to reduce it

async ({ ethers }) => {
const cOSonicVaultProxy = await ethers.getContract("OSonicVaultProxy");
const cOSonicVault = await ethers.getContractAt(
"IVault",
cOSonicVaultProxy.address
);

await deployOracles();
const oracleRouter = await ethers.getContract("OSonicOracleRouter");
console.log(`Deployed Oracle Router at: ${oracleRouter.address}`);

return {
name: "Configure Oracle Router as Price provider",
actions: [
// 1. Approve Sonic Staking Strategy on the Vault
{
contract: cOSonicVault,
signature: "setPriceProvider(address)",
args: [oracleRouter.address],
},
],
};
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const addresses = require("../../utils/addresses.js");

module.exports = deployOnSonic(
{
deployName: "002_sonic_staking_strategy",
deployName: "003_sonic_staking_strategy",
forceSkip: false,
},
async ({ ethers }) => {
Expand Down
Binary file modified contracts/docs/plantuml/sonicContracts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions contracts/docs/plantuml/sonicContracts.puml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ object "OSonicHarvester" as harv <<Origin>><<Proxy>> #$phase2 {
rewards: ?
}

' Oracle
object "OSonicOracleRouter" as router <<Origin>> #DeepSkyBlue {
}

wos <. zap
zap ..> os
zap ..> vault
Expand All @@ -72,6 +76,7 @@ vault <.> drip
vault <...> stakeStrat
stakeStrat ..> sfc
vault <...> amoStrat
vault .> router

vault <.. harv
drip <.. harv
Expand Down
19 changes: 17 additions & 2 deletions contracts/test/behaviour/sfcStakingStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ const MIN_WITHDRAWAL_EPOCH_ADVANCE = 4;
const shouldBehaveLikeASFCStakingStrategy = (context) => {
describe("Initial setup", function () {
it("Should verify the initial state", async () => {
const { sonicStakingStrategy, addresses, oSonicVault, testValidatorIds } =
await context();
const {
sonicStakingStrategy,
addresses,
oSonicVault,
testValidatorIds,
wS,
} = await context();
expect(await sonicStakingStrategy.wrappedSonic()).to.equal(
addresses.wS,
"Incorrect wrapped sonic address set"
Expand Down Expand Up @@ -69,6 +74,16 @@ const shouldBehaveLikeASFCStakingStrategy = (context) => {
expect(
(await sonicStakingStrategy.getRewardTokenAddresses()).length
).to.equal(0, "Incorrectly configured Reward Token Addresses");

expect(await oSonicVault.priceProvider()).to.not.equal(
AddressZero,
"Price provider address not set"
);

expect(await oSonicVault.priceUnitMint(wS.address)).to.equal(
oethUnits("1"),
"not expected PriceUnitMint"
);
});
});

Expand Down
Loading