diff --git a/contracts/contracts/interfaces/IVault.sol b/contracts/contracts/interfaces/IVault.sol
index c517cf82b0..a201488fed 100644
--- a/contracts/contracts/interfaces/IVault.sol
+++ b/contracts/contracts/interfaces/IVault.sol
@@ -117,6 +117,8 @@ interface IVault {
) external;
// VaultCore.sol
+
+ /// @notice Deprecated: use `mint(uint256 _amount)` instead.
function mint(
address _asset,
uint256 _amount,
@@ -137,17 +139,6 @@ interface IVault {
function checkBalance(address _asset) external view returns (uint256);
- /// @notice Deprecated: use calculateRedeemOutput
- function calculateRedeemOutputs(uint256 _amount)
- external
- view
- returns (uint256[] memory);
-
- function calculateRedeemOutput(uint256 _amount)
- external
- view
- returns (uint256);
-
function getAssetCount() external view returns (uint256);
function getAllAssets() external view returns (address[] memory);
@@ -156,13 +147,20 @@ interface IVault {
function getAllStrategies() external view returns (address[] memory);
- /// @notice Deprecated.
+ function strategies(address _addr)
+ external
+ view
+ returns (VaultStorage.Strategy memory);
+
+ /// @notice Deprecated: use `asset()` instead.
function isSupportedAsset(address _asset) external view returns (bool);
function dripper() external view returns (address);
function asset() external view returns (address);
+ function oToken() external view returns (address);
+
function initialize(address) external;
function addWithdrawalQueueLiquidity() external;
@@ -216,6 +214,7 @@ interface IVault {
function previewYield() external view returns (uint256 yield);
+ /// @notice Deprecated: user `asset()` instead.
function weth() external view returns (address);
// slither-disable-end constable-states
diff --git a/contracts/contracts/strategies/algebra/OETHSupernovaAMOStrategy.sol b/contracts/contracts/strategies/algebra/OETHSupernovaAMOStrategy.sol
index 1717eb1f7e..a9d2de0b61 100644
--- a/contracts/contracts/strategies/algebra/OETHSupernovaAMOStrategy.sol
+++ b/contracts/contracts/strategies/algebra/OETHSupernovaAMOStrategy.sol
@@ -12,14 +12,9 @@ contract OETHSupernovaAMOStrategy is StableSwapAMMStrategy {
/**
* @param _baseConfig The `platformAddress` is the address of the Supernova OETH/WETH pool.
* The `vaultAddress` is the address of the OETH Vault.
- * @param _oeth Address of the OETH token.
- * @param _weth Address of the WETH token.
* @param _gauge Address of the Supernova gauge for the pool.
*/
- constructor(
- BaseStrategyConfig memory _baseConfig,
- address _oeth,
- address _weth,
- address _gauge
- ) StableSwapAMMStrategy(_baseConfig, _oeth, _weth, _gauge) {}
+ constructor(BaseStrategyConfig memory _baseConfig, address _gauge)
+ StableSwapAMMStrategy(_baseConfig, _gauge)
+ {}
}
diff --git a/contracts/contracts/strategies/algebra/README.md b/contracts/contracts/strategies/algebra/README.md
new file mode 100644
index 0000000000..2d0dc5066c
--- /dev/null
+++ b/contracts/contracts/strategies/algebra/README.md
@@ -0,0 +1,19 @@
+# Diagrams
+
+## OETH Supernova AMO Strategy
+
+### Hierarchy
+
+
+
+### Interactions
+
+
+
+### Squashed
+
+
+
+### Storage
+
+
diff --git a/contracts/contracts/strategies/algebra/StableSwapAMMStrategy.sol b/contracts/contracts/strategies/algebra/StableSwapAMMStrategy.sol
index 99e039b5e7..eb54d529c7 100644
--- a/contracts/contracts/strategies/algebra/StableSwapAMMStrategy.sol
+++ b/contracts/contracts/strategies/algebra/StableSwapAMMStrategy.sol
@@ -154,20 +154,19 @@ contract StableSwapAMMStrategy is InitializableAbstractStrategy {
/**
* @param _baseConfig The `platformAddress` is the address of the Algebra pool.
* The `vaultAddress` is the address of the Origin Sonic Vault.
- * @param _oToken Address of the OToken.
- * @param _asset Address of the asset token.
* @param _gauge Address of the Algebra gauge for the pool.
*/
- constructor(
- BaseStrategyConfig memory _baseConfig,
- address _oToken,
- address _asset,
- address _gauge
- ) InitializableAbstractStrategy(_baseConfig) {
+ constructor(BaseStrategyConfig memory _baseConfig, address _gauge)
+ InitializableAbstractStrategy(_baseConfig)
+ {
+ // Read the oToken address from the Vault
+ address oTokenMem = IVault(_baseConfig.vaultAddress).oToken();
+ address assetMem = IVault(_baseConfig.vaultAddress).asset();
+
// Checked both tokens are to 18 decimals
require(
- IBasicToken(_asset).decimals() == 18 &&
- IBasicToken(_oToken).decimals() == 18,
+ IBasicToken(assetMem).decimals() == 18 &&
+ IBasicToken(oTokenMem).decimals() == 18,
"Incorrect token decimals"
);
// Check the Algebra pool is a Stable AMM (sAMM)
@@ -180,21 +179,22 @@ contract StableSwapAMMStrategy is InitializableAbstractStrategy {
IGauge(_gauge).TOKEN() == _baseConfig.platformAddress,
"Incorrect gauge"
);
- oTokenPoolIndex = IPair(_baseConfig.platformAddress).token0() == _oToken
+ oTokenPoolIndex = IPair(_baseConfig.platformAddress).token0() ==
+ oTokenMem
? 0
: 1;
// Check the pool tokens are correct
require(
IPair(_baseConfig.platformAddress).token0() ==
- (oTokenPoolIndex == 0 ? _oToken : _asset) &&
+ (oTokenPoolIndex == 0 ? oTokenMem : assetMem) &&
IPair(_baseConfig.platformAddress).token1() ==
- (oTokenPoolIndex == 0 ? _asset : _oToken),
+ (oTokenPoolIndex == 0 ? assetMem : oTokenMem),
"Incorrect pool tokens"
);
// Set the immutable variables
- oToken = _oToken;
- asset = _asset;
+ oToken = oTokenMem;
+ asset = assetMem;
pool = _baseConfig.platformAddress;
gauge = _gauge;
diff --git a/contracts/contracts/strategies/sonic/SonicSwapXAMOStrategy.sol b/contracts/contracts/strategies/sonic/SonicSwapXAMOStrategy.sol
index f786fa20a2..5fd18c8dfe 100644
--- a/contracts/contracts/strategies/sonic/SonicSwapXAMOStrategy.sol
+++ b/contracts/contracts/strategies/sonic/SonicSwapXAMOStrategy.sol
@@ -12,14 +12,9 @@ contract SonicSwapXAMOStrategy is StableSwapAMMStrategy {
/**
* @param _baseConfig The `platformAddress` is the address of the SwapX pool.
* The `vaultAddress` is the address of the Origin Sonic Vault.
- * @param _os Address of the OS token.
- * @param _ws Address of the Wrapped S (wS) token.
* @param _gauge Address of the SwapX gauge for the pool.
*/
- constructor(
- BaseStrategyConfig memory _baseConfig,
- address _os,
- address _ws,
- address _gauge
- ) StableSwapAMMStrategy(_baseConfig, _os, _ws, _gauge) {}
+ constructor(BaseStrategyConfig memory _baseConfig, address _gauge)
+ StableSwapAMMStrategy(_baseConfig, _gauge)
+ {}
}
diff --git a/contracts/deploy/deployActions.js b/contracts/deploy/deployActions.js
index 9f449833d9..f5c4265598 100644
--- a/contracts/deploy/deployActions.js
+++ b/contracts/deploy/deployActions.js
@@ -813,7 +813,6 @@ const getPlumeContracts = async () => {
};
const deploySonicSwapXAMOStrategyImplementation = async () => {
- const cOSonicProxy = await ethers.getContract("OSonicProxy");
const cOSonicVaultProxy = await ethers.getContract("OSonicVaultProxy");
// Deploy Sonic SwapX AMO Strategy implementation
@@ -821,8 +820,6 @@ const deploySonicSwapXAMOStrategyImplementation = async () => {
"SonicSwapXAMOStrategy",
[
[addresses.sonic.SwapXWSOS.pool, cOSonicVaultProxy.address],
- cOSonicProxy.address,
- addresses.sonic.wS,
addresses.sonic.SwapXWSOS.gauge,
]
);
@@ -869,11 +866,7 @@ const deploySonicSwapXAMOStrategyImplementationAndInitialize = async () => {
const deployOETHSupernovaAMOStrategyPoolAndGauge = async () => {
// Account authorized to call createPair on the factory contract
const pairBootstrapper = "0x7F8f2B6D0b0AaE8e95221Ce90B5C26B128C1Cb66";
- const topkenHandlerWhitelister = "0xD09A1388F0CcE25DA97E8bBAbf5D083E25a5Fbc6";
const sPairBootstrapper = await impersonateAndFund(pairBootstrapper);
- const sTokenHandlerWhitelister = await impersonateAndFund(
- topkenHandlerWhitelister
- );
const oeth = await ethers.getContract("OETHProxy");
@@ -881,10 +874,6 @@ const deployOETHSupernovaAMOStrategyPoolAndGauge = async () => {
"function createPair(address tokenA, address tokenB, bool stable) external returns (address pair)",
"event PairCreated(address token0, address token1, bool stable, address pair, uint);",
];
- const tokenHandlerABI = [
- "function whitelistToken(address _token) external",
- "function whitelistConnector(address _token) external",
- ];
const pairCreatedTopic =
"0xc4805696c66d7cf352fc1d6bb633ad5ee82f6cb577c453024b6e0eb8306c6fc9";
@@ -897,10 +886,6 @@ const deployOETHSupernovaAMOStrategyPoolAndGauge = async () => {
gaugeManagerAbi,
addresses.mainnet.supernovaGaugeManager
);
- const tokenHandler = await ethers.getContractAt(
- tokenHandlerABI,
- await gaugeManager.tokenHandler()
- );
const factory = await ethers.getContractAt(
factoryABI,
@@ -908,7 +893,7 @@ const deployOETHSupernovaAMOStrategyPoolAndGauge = async () => {
);
let poolAddress;
- log("Creating new OETH/WETH pair...");
+ console.log("Creating new OETH/WETH pair...");
const tx = await factory
.connect(sPairBootstrapper)
.createPair(oeth.address, addresses.mainnet.WETH, true);
@@ -923,14 +908,9 @@ const deployOETHSupernovaAMOStrategyPoolAndGauge = async () => {
);
console.log("Pair address:", pairAddress);
- console.log("Whitelisting OETH token");
- await tokenHandler
- .connect(sTokenHandlerWhitelister)
- .whitelistToken(oeth.address);
-
poolAddress = pairAddress;
- log("Creating gauge for OETH/WETH...");
+ console.log("Creating gauge for OETH/WETH...");
const gaugeCreatedTopic = ethers.utils.id(
"GaugeCreated(address,address,address,address,address)"
);
@@ -959,19 +939,13 @@ const deployOETHSupernovaAMOStrategyImplementation = async (
const cOETHSupernovaAMOStrategyProxy = await ethers.getContract(
"OETHSupernovaAMOProxy"
);
- const cOETHProxy = await ethers.getContract("OETHProxy");
const cOETHVaultProxy = await ethers.getContract("OETHVaultProxy");
// Deploy OETH Supernova AMO Strategy implementation that will serve
// OETH Supernova AMO
const dSupernovaAMOStrategy = await deployWithConfirmation(
"OETHSupernovaAMOStrategy",
- [
- [poolAddress, cOETHVaultProxy.address],
- cOETHProxy.address,
- addresses.mainnet.WETH,
- gaugeAddress,
- ]
+ [[poolAddress, cOETHVaultProxy.address], gaugeAddress]
);
const cOETHSupernovaAMOStrategy = await ethers.getContractAt(
diff --git a/contracts/docs/OETHSupernovaAMOStrategyHierarchy.svg b/contracts/docs/OETHSupernovaAMOStrategyHierarchy.svg
new file mode 100644
index 0000000000..6141e001eb
--- /dev/null
+++ b/contracts/docs/OETHSupernovaAMOStrategyHierarchy.svg
@@ -0,0 +1,75 @@
+
+
+
+
+
diff --git a/contracts/docs/OETHSupernovaAMOStrategyInteractions.svg b/contracts/docs/OETHSupernovaAMOStrategyInteractions.svg
new file mode 100644
index 0000000000..e52f46975c
--- /dev/null
+++ b/contracts/docs/OETHSupernovaAMOStrategyInteractions.svg
@@ -0,0 +1,211 @@
+
+
+
+
+
diff --git a/contracts/docs/OETHSupernovaAMOStrategySquashed.svg b/contracts/docs/OETHSupernovaAMOStrategySquashed.svg
new file mode 100644
index 0000000000..dbbfff8a29
--- /dev/null
+++ b/contracts/docs/OETHSupernovaAMOStrategySquashed.svg
@@ -0,0 +1,124 @@
+
+
+
+
+
diff --git a/contracts/docs/OETHSupernovaAMOStrategyStorage.svg b/contracts/docs/OETHSupernovaAMOStrategyStorage.svg
new file mode 100644
index 0000000000..605400b729
--- /dev/null
+++ b/contracts/docs/OETHSupernovaAMOStrategyStorage.svg
@@ -0,0 +1,129 @@
+
+
+
+
+
diff --git a/contracts/docs/generate.sh b/contracts/docs/generate.sh
index 924a67b2db..0aa95283f0 100644
--- a/contracts/docs/generate.sh
+++ b/contracts/docs/generate.sh
@@ -65,6 +65,12 @@ sol2uml .. -v -hv -hf -he -hs -hl -hi -i prettier-plugin-solidity -b BaseCurveAM
sol2uml .. -s -d 0 -b BaseCurveAMOStrategy -i prettier-plugin-solidity -o BaseCurveAMOStrategySquashed.svg
sol2uml storage .. -c BaseCurveAMOStrategy -i prettier-plugin-solidity -o BaseCurveAMOStrategyStorage.svg --hideExpand ______gap,_reserved,__gap
+# contracts/strategies/algebra
+sol2uml .. -v -hv -hf -he -hs -hl -hi -i prettier-plugin-solidity -b OETHSupernovaAMOStrategy -o OETHSupernovaAMOStrategyHierarchy.svg
+sol2uml .. -v -hv -hf -he -hs -hn -d 2 -i prettier-plugin-solidity -b OETHSupernovaAMOStrategy -o OETHSupernovaAMOStrategyInteractions.svg
+sol2uml .. -s -d 0 -b OETHSupernovaAMOStrategy -i prettier-plugin-solidity -o OETHSupernovaAMOStrategySquashed.svg
+sol2uml storage .. -c OETHSupernovaAMOStrategy -i prettier-plugin-solidity -o OETHSupernovaAMOStrategyStorage.svg --hideExpand ______gap,_reserved
+
# contracts/strategies/sonic
sol2uml .. -v -hv -hf -he -hs -hl -hi -b SonicStakingStrategy -o SonicStakingStrategyHierarchy.svg
sol2uml .. -s -d 0 -b SonicStakingStrategy -o SonicStakingStrategySquashed.svg
diff --git a/contracts/test/behaviour/algebraAmoStrategy.js b/contracts/test/behaviour/algebraAmoStrategy.js
index e36e0a7a78..ab2198e519 100644
--- a/contracts/test/behaviour/algebraAmoStrategy.js
+++ b/contracts/test/behaviour/algebraAmoStrategy.js
@@ -1243,7 +1243,7 @@ const shouldBehaveLikeAlgebraAmoStrategy = (contextFunction) => {
"Strategy's check balance"
).to.withinRange(
dataBefore.stratBalance,
- dataBefore.stratBalance.add(1)
+ dataBefore.stratBalance.add(2)
);
});
@@ -1265,7 +1265,7 @@ const shouldBehaveLikeAlgebraAmoStrategy = (contextFunction) => {
"Strategy's check balance"
).to.withinRange(
dataBefore.stratBalance,
- dataBefore.stratBalance.add(1)
+ dataBefore.stratBalance.add(2)
);
// Swap OToken into the pool and asset token out.
@@ -1283,7 +1283,7 @@ const shouldBehaveLikeAlgebraAmoStrategy = (contextFunction) => {
"Strategy's check balance"
).to.withinRange(
dataBefore.stratBalance,
- dataBefore.stratBalance.add(1)
+ dataBefore.stratBalance.add(2)
);
});
});
diff --git a/contracts/test/strategies/sonic/swapx-amo.sonic.fork-test.js b/contracts/test/strategies/sonic/swapx-amo.sonic.fork-test.js
index 21f387cb94..a0a4d4e0c6 100644
--- a/contracts/test/strategies/sonic/swapx-amo.sonic.fork-test.js
+++ b/contracts/test/strategies/sonic/swapx-amo.sonic.fork-test.js
@@ -32,7 +32,7 @@ describe("Sonic Fork Test: SwapX AMO Strategy", function () {
smallPoolShare: {
bootstrapAssetSwapIn: "10000000",
bigLiquidityAsset: "1000000",
- oTokenBuffer: "2000000",
+ oTokenBuffer: "1800000",
stressSwapOToken: "1005000",
stressSwapAsset: "2000000",
stressSwapAssetAlt: "1006000",