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
12 changes: 6 additions & 6 deletions contracts/contracts/poolBooster/AbstractPoolBoosterFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ contract AbstractPoolBoosterFactory is Governable {
IPoolBoostCentralRegistry.PoolBoosterType boosterType;
}

// @notice address of Origin Sonic
address public immutable oSonic;
// @notice address of Origin Token
address public immutable oToken;
// @notice Central registry contract
IPoolBoostCentralRegistry public immutable centralRegistry;

Expand All @@ -26,22 +26,22 @@ contract AbstractPoolBoosterFactory is Governable {
// @notice mapping of AMM pool to pool booster
mapping(address => PoolBoosterEntry) public poolBoosterFromPool;

// @param address _oSonic address of the OSonic token
// @param address _oToken address of the OToken token
// @param address _governor address governor
// @param address _centralRegistry address of the central registry
constructor(
address _oSonic,
address _oToken,
address _governor,
address _centralRegistry
) {
require(_oSonic != address(0), "Invalid oSonic address");
require(_oToken != address(0), "Invalid oToken address");
require(_governor != address(0), "Invalid governor address");
require(
_centralRegistry != address(0),
"Invalid central registry address"
);

oSonic = _oSonic;
oToken = _oToken;
centralRegistry = IPoolBoostCentralRegistry(_centralRegistry);
_setGovernor(_governor);
}
Expand Down
10 changes: 5 additions & 5 deletions contracts/contracts/poolBooster/PoolBoosterFactoryMerkl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ contract PoolBoosterFactoryMerkl is AbstractPoolBoosterFactory {
event MerklDistributorUpdated(address newDistributor);

/**
* @param _oSonic address of the OSonic token
* @param _oToken address of the OToken token
* @param _governor address governor
* @param _centralRegistry address of the central registry
* @param _merklDistributor address of the Merkl distributor
*/
constructor(
address _oSonic,
address _oToken,
address _governor,
address _centralRegistry,
address _merklDistributor
) AbstractPoolBoosterFactory(_oSonic, _governor, _centralRegistry) {
) AbstractPoolBoosterFactory(_oToken, _governor, _centralRegistry) {
_setMerklDistributor(_merklDistributor);
}

Expand Down Expand Up @@ -64,7 +64,7 @@ contract PoolBoosterFactoryMerkl is AbstractPoolBoosterFactory {
abi.encodePacked(
type(PoolBoosterMerkl).creationCode,
abi.encode(
oSonic,
oToken,
merklDistributor,
_campaignDuration,
_campaignType,
Expand Down Expand Up @@ -111,7 +111,7 @@ contract PoolBoosterFactoryMerkl is AbstractPoolBoosterFactory {
abi.encodePacked(
type(PoolBoosterMerkl).creationCode,
abi.encode(
oSonic,
oToken,
merklDistributor,
_campaignDuration,
_campaignType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ contract PoolBoosterFactoryMetropolis is AbstractPoolBoosterFactory {
address public immutable rewardFactory;
address public immutable voter;

// @param address _oSonic address of the OSonic token
// @param address _oToken address of the OToken token
// @param address _governor address governor
// @param address _centralRegistry address of the central registry
// @param address _rewardFactory address of the Metropolis reward factory
// @param address _voter address of the Metropolis voter
constructor(
address _oSonic,
address _oToken,
address _governor,
address _centralRegistry,
address _rewardFactory,
address _voter
) AbstractPoolBoosterFactory(_oSonic, _governor, _centralRegistry) {
) AbstractPoolBoosterFactory(_oToken, _governor, _centralRegistry) {
rewardFactory = _rewardFactory;
voter = _voter;
}
Expand All @@ -49,7 +49,7 @@ contract PoolBoosterFactoryMetropolis is AbstractPoolBoosterFactory {
address poolBoosterAddress = _deployContract(
abi.encodePacked(
type(PoolBoosterMetropolis).creationCode,
abi.encode(oSonic, rewardFactory, _ammPoolAddress, voter)
abi.encode(oToken, rewardFactory, _ammPoolAddress, voter)
),
_salt
);
Expand Down Expand Up @@ -83,7 +83,7 @@ contract PoolBoosterFactoryMetropolis is AbstractPoolBoosterFactory {
_computeAddress(
abi.encodePacked(
type(PoolBoosterMetropolis).creationCode,
abi.encode(oSonic, rewardFactory, _ammPoolAddress, voter)
abi.encode(oToken, rewardFactory, _ammPoolAddress, voter)
),
_salt
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import { AbstractPoolBoosterFactory, IPoolBoostCentralRegistry } from "./Abstrac
contract PoolBoosterFactorySwapxDouble is AbstractPoolBoosterFactory {
uint256 public constant version = 1;

// @param address _oSonic address of the OSonic token
// @param address _oToken address of the OToken token
// @param address _governor address governor
// @param address _centralRegistry address of the central registry
constructor(
address _oSonic,
address _oToken,
address _governor,
address _centralRegistry
) AbstractPoolBoosterFactory(_oSonic, _governor, _centralRegistry) {}
) AbstractPoolBoosterFactory(_oToken, _governor, _centralRegistry) {}

/**
* @dev Create a Pool Booster for SwapX Ichi vault based pool where 2 Bribe contracts need to be
Expand Down Expand Up @@ -49,7 +49,7 @@ contract PoolBoosterFactorySwapxDouble is AbstractPoolBoosterFactory {
address poolBoosterAddress = _deployContract(
abi.encodePacked(
type(PoolBoosterSwapxDouble).creationCode,
abi.encode(_bribeAddressOS, _bribeAddressOther, oSonic, _split)
abi.encode(_bribeAddressOS, _bribeAddressOther, oToken, _split)
),
_salt
);
Expand Down Expand Up @@ -92,7 +92,7 @@ contract PoolBoosterFactorySwapxDouble is AbstractPoolBoosterFactory {
abi.encode(
_bribeAddressOS,
_bribeAddressOther,
oSonic,
oToken,
_split
)
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import { AbstractPoolBoosterFactory, IPoolBoostCentralRegistry } from "./Abstrac
contract PoolBoosterFactorySwapxSingle is AbstractPoolBoosterFactory {
uint256 public constant version = 1;

// @param address _oSonic address of the OSonic token
// @param address _oToken address of the OToken token
// @param address _governor address governor
// @param address _centralRegistry address of the central registry
constructor(
address _oSonic,
address _oToken,
address _governor,
address _centralRegistry
) AbstractPoolBoosterFactory(_oSonic, _governor, _centralRegistry) {}
) AbstractPoolBoosterFactory(_oToken, _governor, _centralRegistry) {}

/**
* @dev Create a Pool Booster for SwapX classic volatile or classic stable pools where
Expand All @@ -45,7 +45,7 @@ contract PoolBoosterFactorySwapxSingle is AbstractPoolBoosterFactory {
address poolBoosterAddress = _deployContract(
abi.encodePacked(
type(PoolBoosterSwapxSingle).creationCode,
abi.encode(_bribeAddress, oSonic)
abi.encode(_bribeAddress, oToken)
),
_salt
);
Expand Down Expand Up @@ -81,7 +81,7 @@ contract PoolBoosterFactorySwapxSingle is AbstractPoolBoosterFactory {
_computeAddress(
abi.encodePacked(
type(PoolBoosterSwapxSingle).creationCode,
abi.encode(_bribeAddress, oSonic)
abi.encode(_bribeAddress, oToken)
),
_salt
);
Expand Down
95 changes: 95 additions & 0 deletions contracts/deploy/mainnet/152_pool_booster_setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
const addresses = require("../../utils/addresses");
const { deploymentWithGovernanceProposal } = require("../../utils/deploy");

module.exports = deploymentWithGovernanceProposal(
{
deployName: "152_pool_booster_setup",
forceDeploy: false,
reduceQueueTime: true,
deployerIsProposer: false,
proposalId: "",
},
async ({ deployWithConfirmation, withConfirmation }) => {
const { deployerAddr } = await getNamedAccounts();
const sDeployer = await ethers.provider.getSigner(deployerAddr);

const oethProxy = await ethers.getContract("OETHProxy");
const oeth = await ethers.getContractAt("OETH", oethProxy.address);

// ---------------------------------------------------------------------------------------------------------
// ---
// --- Deploy PoolBoostCentralRegistry
// ---
// ---------------------------------------------------------------------------------------------------------

await deployWithConfirmation("PoolBoostCentralRegistryProxy");
const cPoolBoostCentralRegistryProxy = await ethers.getContract(
"PoolBoostCentralRegistryProxy"
);

console.log(
`Pool boost central registry proxy deployed: ${cPoolBoostCentralRegistryProxy.address}`
);

const dPoolBoostCentralRegistry = await deployWithConfirmation(
"PoolBoostCentralRegistry",
[]
);
console.log(
`Deployed Pool Boost Central Registry to ${dPoolBoostCentralRegistry.address}`
);

const cPoolBoostCentralRegistry = await ethers.getContractAt(
"PoolBoostCentralRegistry",
cPoolBoostCentralRegistryProxy.address
);

// prettier-ignore
await withConfirmation(
cPoolBoostCentralRegistryProxy
.connect(sDeployer)["initialize(address,address,bytes)"](
dPoolBoostCentralRegistry.address,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we should start the strategist as governor and change it later, when we are ready

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is only to approve and remove factories. Is there any benefit to going initially with the strategist?

addresses.mainnet.Timelock,
"0x"
)
);
console.log(
"Initialized PoolBoostCentralRegistry proxy and implementation"
);

// ---------------------------------------------------------------------------------------------------------
// ---
// --- Deploy PoolBoosterFactoryMerkl
// ---
// ---------------------------------------------------------------------------------------------------------
const dPoolBoosterFactoryMerkl = await deployWithConfirmation(
"PoolBoosterFactoryMerkl",
[
oeth.address,
// so we can create a Merkl pool booster fast via a multichain strategist and kick off yield forwarding
addresses.multichainStrategist,
cPoolBoostCentralRegistryProxy.address,
addresses.mainnet.CampaignCreator,
]
);
const cPoolBoosterMerklFactory = await ethers.getContract(
"PoolBoosterFactoryMerkl"
);

console.log(
`Pool Booster Merkl Factory deployed to ${cPoolBoosterMerklFactory.address}`
);

return {
name: "Upgrade PoolBoosterCentralRegistry and deploy PoolBoosterFactoryMerkl",
actions: [
{
// set the factory as an approved one
contract: cPoolBoostCentralRegistry,
signature: "approveFactory(address)",
args: [dPoolBoosterFactoryMerkl.address],
},
],
};
}
);
24 changes: 23 additions & 1 deletion contracts/test/_fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const morphoLensAbi = require("./abi/morphoLens.json");
const crvMinterAbi = require("./abi/crvMinter.json");
const susdsAbi = require("./abi/sUSDS.json");
const metamorphoAbi = require("./abi/metamorpho.json");
const merklDistributorAbi = require("./abi/merklDistributor.json");

// const curveFactoryAbi = require("./abi/curveFactory.json")
const ousdMetapoolAbi = require("./abi/ousdMetapool.json");
Expand Down Expand Up @@ -779,7 +780,10 @@ const defaultFixture = deployments.createFixture(async () => {
mock1InchSwapRouter,
convexEthMetaStrategy,
vaultValueChecker,
oethVaultValueChecker;
oethVaultValueChecker,
poolBoosterCentralRegistry,
poolBoosterMerklFactory,
merklDistributor;

if (isFork) {
usdt = await ethers.getContractAt(usdtAbi, addresses.mainnet.USDT);
Expand Down Expand Up @@ -908,6 +912,21 @@ const defaultFixture = deployments.createFixture(async () => {

vaultValueChecker = await ethers.getContract("VaultValueChecker");
oethVaultValueChecker = await ethers.getContract("OETHVaultValueChecker");

poolBoosterCentralRegistry = await ethers.getContractAt(
"PoolBoostCentralRegistry",
(
await ethers.getContract("PoolBoostCentralRegistryProxy")
).address
);
poolBoosterMerklFactory = await ethers.getContract(
"PoolBoosterFactoryMerkl"
);

merklDistributor = await ethers.getContractAt(
merklDistributorAbi,
addresses.mainnet.CampaignCreator
);
} else {
usdt = await ethers.getContract("MockUSDT");
usds = await ethers.getContract("MockUSDS");
Expand Down Expand Up @@ -1152,6 +1171,9 @@ const defaultFixture = deployments.createFixture(async () => {

morphoToken,
legacyMorphoToken,
poolBoosterCentralRegistry,
poolBoosterMerklFactory,
merklDistributor,
};
});

Expand Down
49 changes: 49 additions & 0 deletions contracts/test/poolBooster/poolBooster.mainnet.fork-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const { createFixtureLoader, defaultFixture } = require("../_fixture");
const { expect } = require("chai");
const { oethUnits } = require("../helpers");
const addresses = require("../../utils/addresses");

const sonicFixture = createFixtureLoader(defaultFixture);

describe("ForkTest: Merkl Pool Booster", function () {
//const INCENTIVISE_BORROWING_TYPE = 45;
//const DEFAULT_DURATION = 86400 * 7; // a week
//const MOPRHO_CAMPAIGN_DATA = "0xb8fef900b383db2dbbf4458c7f46acf5b140f26d603a6d1829963f241b82510e00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";

let fixture, poolBoosterMerklFactory, merklDistributor, oeth;
beforeEach(async () => {
fixture = await sonicFixture();
oeth = fixture.oeth;
poolBoosterMerklFactory = fixture.poolBoosterMerklFactory;
merklDistributor = fixture.merklDistributor;
});

it("Should have correct deployment params", async () => {
expect(await poolBoosterMerklFactory.merklDistributor()).to.equal(
addresses.mainnet.CampaignCreator
);

// Uncomment once the pool booster is deployed
// const poolBooster = await poolBoosterMerklFactory.poolBoosters(0)
// expect(await poolBooster.campaignType()).to.equal(
// INCENTIVISE_BORROWING_TYPE
// );

// expect(await poolBooster.duration()).to.equal(
// DEFAULT_DURATION
// );

// expect(await poolBooster.campaignData()).to.equal(
// MOPRHO_CAMPAIGN_DATA
// );

// expect(await poolBooster.rewardToken()).to.equal(oeth.address);
// expect(await poolBooster.merklDistributor()).to.equal(merklDistributor.address);
});

it("Should have OETH token supported by Merkl Distributor", async () => {
expect(await merklDistributor.rewardTokenMinAmounts(oeth.address)).to.equal(
oethUnits("0.00001")
);
});
});
Loading
Loading