Skip to content

Commit

Permalink
feat: usdz + incentives
Browse files Browse the repository at this point in the history
  • Loading branch information
rhlsthrm committed Oct 3, 2024
1 parent 7f10670 commit c52c013
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 14 deletions.
15 changes: 15 additions & 0 deletions packages/chains/src/base/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const OGN = "0x7002458B1DF59EccB57387bC79fFc7C29E22e6f7";
export const EURC = "0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42";
export const USDplus = "0xB79DD08EA68A908A97220C76d19A6aA9cBDE4376";
export const wUSDplus = "0xd95ca61CE9aAF2143E81Ef5462C0c2325172E028";
export const USDz = "0x04D5ddf5f3a8939889F11E97f8c4BB48317F1938";

export const assets: SupportedAsset[] = [
{
Expand Down Expand Up @@ -302,6 +303,20 @@ export const assets: SupportedAsset[] = [
initialCf: "0.85",
initialSupplyCap: parseUnits(String(40_000_000), 6).toString(),
initialBorrowCap: "1"
},
{
symbol: assetSymbols.USDz,
underlying: USDz,
name: "USDz",
decimals: 18,
oracle: OracleTypes.ChainlinkPriceOracleV2,
oracleSpecificParams: {
aggregator: "0xe25969e2Fa633a0C027fAB8F30Fc9C6A90D60B48",
feedBaseCurrency: ChainlinkFeedBaseCurrency.USD
},
initialCf: "0.80",
initialSupplyCap: parseEther(String(13_000_000)).toString(),
initialBorrowCap: parseEther(String(10_000_000)).toString()
}
// DO NOT ADD TO MARKET UNLESS PROPER ORACLE IS DEPLOYED
// {
Expand Down
5 changes: 3 additions & 2 deletions packages/contracts/chainDeploy/helpers/oracles/chainlink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const deployChainlinkOracle = async ({
chainlinkAssets,
namePostfix
}: ChainlinkDeployFnParams): Promise<{ cpo: any; chainLinkv2: any }> => {
const { deployer } = await getNamedAccounts();
const { deployer, multisig } = await getNamedAccounts();
const publicClient = await viem.getPublicClient();
let tx: Hex;

Expand All @@ -42,7 +42,8 @@ export const deployChainlinkOracle = async ({
args: [deployConfig.stableToken, deployConfig.nativeTokenUsdChainlinkFeed]
}
},
proxyContract: "OpenZeppelinTransparentProxy"
proxyContract: "OpenZeppelinTransparentProxy",
owner: multisig ?? deployer
},
waitConfirmations: 1,
skipIfAlreadyDeployed: true
Expand Down
7 changes: 4 additions & 3 deletions packages/contracts/chainDeploy/helpers/oracles/erc4626.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const deployErc4626PriceOracle = async ({
deployments,
erc4626Assets
}: Erc4626OracleFnParams): Promise<void> => {
const { deployer } = await getNamedAccounts();
const { deployer, multisig } = await getNamedAccounts();
const publicClient = await viem.getPublicClient();

const mpo = await viem.getContractAt(
Expand All @@ -28,9 +28,10 @@ export const deployErc4626PriceOracle = async ({
args: []
}
},
owner: deployer,
owner: multisig,
proxyContract: "OpenZeppelinTransparentProxy"
}
},
skipIfAlreadyDeployed: true
});
if (e4626o.transactionHash) await publicClient.waitForTransactionReceipt({ hash: e4626o.transactionHash as Address });
console.log("ERC4626Oracle: ", e4626o.address);
Expand Down
1 change: 1 addition & 0 deletions packages/contracts/chainDeploy/helpers/oracles/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export async function addUnderlyingsToMpo(
}

if (underlyings.length) {
console.log("adding underlyings to mpo", underlyings, oracles);
if ((await mpo.read.admin()).toLowerCase() === deployer.toLowerCase()) {
const tx = await mpo.write.add([underlyings, oracles]);
console.log("tx: ", tx);
Expand Down
5 changes: 3 additions & 2 deletions packages/contracts/chainDeploy/mainnets/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const deploy = async ({
getNamedAccounts,
deployments
}: HardhatRuntimeEnvironment): Promise<void> => {
const { deployer } = await getNamedAccounts();
const { deployer, multisig } = await getNamedAccounts();
const publicClient = await viem.getPublicClient();

//// ERC4626 Oracle
Expand Down Expand Up @@ -103,7 +103,8 @@ export const deploy = async ({
methodName: "initialize",
args: [[], []]
}
}
},
owner: multisig ?? deployer
}
});
console.log("CurveV2LpTokenPriceOracleNoRegistry: ", curveV2OracleNoRegistry.address);
Expand Down
3 changes: 2 additions & 1 deletion packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const config: HardhatUserConfig = {
namedAccounts: {
deployer: { default: 0 },
multisig: {
34443: "0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2"
34443: "0x8Fba84867Ba458E7c6E2c024D2DE3d0b5C3ea1C2",
8453: "0x9eC25b8063De13d478Ba8121b964A339A1BB0ebB"
}
},
solidity: {
Expand Down
3 changes: 2 additions & 1 deletion packages/contracts/tasks/chain-specific/base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ export const RSR_MARKET = "0xfc6b82668E10AFF62f208C492fc95ef1fa9C0426";
export const wsuperOETH_MARKET = "0xC462eb5587062e2f2391990b8609D2428d8Cf598";
export const wusdm_MARKET = "0xe30965Acd0Ee1CE2e0Cd0AcBFB3596bD6fC78A51";
export const usdPlus_MARKET = "0x74109171033F662D5b898A7a2FcAB2f1EF80c201";
export const wusdPlus_MARKET = "0xF1bbECD6aCF648540eb79588Df692c6b2F0fbc09";
export const wusdPlus_MARKET = "0xF1bbECD6aCF648540eb79588Df692c6b2F0fbc09";
export const USDz_MARKET = "0xa4442b665d4c6DBC6ea43137B336e3089f05626C";
4 changes: 2 additions & 2 deletions packages/contracts/tasks/chain-specific/base/markets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assetSymbols } from "@ionicprotocol/types";
import { COMPTROLLER } from ".";

task("markets:deploy:base:new", "deploy base market").setAction(async (_, { viem, run }) => {
const assetsToDeploy: string[] = [assetSymbols.wUSDplus];
const assetsToDeploy: string[] = [assetSymbols.USDz];
for (const asset of base.assets.filter((asset) => assetsToDeploy.includes(asset.symbol))) {
if (!asset.underlying || !asset.symbol) {
throw new Error("Invalid asset");
Expand Down Expand Up @@ -34,7 +34,7 @@ task("markets:deploy:base:new", "deploy base market").setAction(async (_, { viem
});

task("base:set-caps:new", "one time setup").setAction(async (_, { viem, run }) => {
const asset = base.assets.find((asset) => asset.symbol === assetSymbols.wUSDplus);
const asset = base.assets.find((asset) => asset.symbol === assetSymbols.USDz);
if (!asset) {
throw new Error("asset not found in base assets");
}
Expand Down
34 changes: 34 additions & 0 deletions packages/contracts/tasks/chain-specific/base/rewards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
ION,
RSR_MARKET,
usdPlus_MARKET,
USDz_MARKET,
weETH_MARKET,
wusdm_MARKET,
wusdPlus_MARKET
Expand Down Expand Up @@ -307,4 +308,37 @@ task("base:add-rewards:epoch2:supply:wusdplus", "add rewards to a market").setAc
deployments
);
}
);

task("base:add-rewards:epoch2:supply:usdz", "add rewards to a market").setAction(
async (_, { viem, deployments, getNamedAccounts }) => {
const { deployer, multisig } = await getNamedAccounts();
const rewardToken = ION;
const rewardTokenName = "ION";
const market = USDz_MARKET;
const rewardAmount = (50_000).toString();

// Sending tokens
const _rewardToken = await viem.getContractAt("EIP20Interface", rewardToken);
let balance = await _rewardToken.read.balanceOf([market]);
console.log("balance: ", balance);
if (balance < parseEther(rewardAmount)) {
const tx = await _rewardToken.write.transfer([market, parseEther(rewardAmount) - balance]);
console.log(`Sent ${rewardAmount} ${rewardTokenName} to ${market} - ${tx}`);
} else {
console.log(`Market already has enough ${rewardTokenName} - ${market}`);
}

await setupRewards(
"supply",
market,
rewardTokenName,
rewardToken,
SUPPLY_DURATION,
deployer as Address,
viem,
deployments,
multisig as Address
);
}
);
6 changes: 4 additions & 2 deletions packages/contracts/tasks/flywheel/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export const setupRewards = async (
epochDuration: number,
deployer: Address,
viem: HardhatRuntimeEnvironment["viem"],
deployments: HardhatRuntimeEnvironment["deployments"]
deployments: HardhatRuntimeEnvironment["deployments"],
multisig?: Address
) => {
const publicClient = await viem.getPublicClient();
const needsMultisig = await upgradeMarketToSupportFlywheel(market, viem, deployer, deployments);
Expand Down Expand Up @@ -50,7 +51,8 @@ export const setupRewards = async (
methodName: "initialize",
args: [rewardToken, zeroAddress, type === "borrow" ? booster!.address : zeroAddress, deployer]
}
}
},
owner: multisig ?? deployer
},
waitConfirmations: 1,
skipIfAlreadyDeployed: true
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export enum assetSymbols {
EURC = "EURC",
USDplus = "USD+",
wUSDplus = "wUSD+",
USDz = "USDz",

// optimism
OP = "OP",
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ export const pools: Record<number, PoolParams> = {
'WETH',
'wsuperOETHb',
'OGN',
'wUSDM',
'USDz',
'wUSD+',
'wUSDM',
'USD+',
'EURC',
'cbBTC',
Expand Down
Binary file added packages/ui/public/img/symbols/32/color/usdz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions packages/ui/utils/multipliers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,21 @@ export const multipliers: Record<
ionAPR: true,
flywheel: true
}
},
USDz: {
borrow: {
ionic: 0,
turtle: false,
rewards: false,
ionAPR: false
},
supply: {
ionic: 0,
turtle: false,
rewards: true,
ionAPR: true,
flywheel: true
}
}
}
},
Expand Down

0 comments on commit c52c013

Please sign in to comment.