Skip to content

Commit

Permalink
feat: superseed
Browse files Browse the repository at this point in the history
  • Loading branch information
rhlsthrm committed Dec 18, 2024
1 parent 602ec75 commit 5a0c991
Show file tree
Hide file tree
Showing 20 changed files with 534 additions and 145 deletions.
5 changes: 3 additions & 2 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
"forge:build": "forge build",
"prettier": "prettier --write --plugin=prettier-plugin-solidity 'contracts/**/*.sol' --config .prettierrc",
"lint": "prettier --list-different 'contracts/**/*.sol'",
"export:all": "yarn export:mode && yarn export:base && yarn export:bob && yarn export:optimism && yarn export:fraxtal && yarn export:lisk",
"export:all": "yarn export:mode && yarn export:base && yarn export:bob && yarn export:optimism && yarn export:fraxtal && yarn export:lisk && yarn export:superseed",
"export:mode": "hardhat export --network mode --export ../sdk/deployments/mode.json && node ./scripts/prune.js ../sdk/deployments/mode.json",
"export:base": "hardhat export --network base --export ../sdk/deployments/base.json && node ./scripts/prune.js ../sdk/deployments/base.json",
"export:bob": "hardhat export --network bob --export ../sdk/deployments/bob.json && node ./scripts/prune.js ../sdk/deployments/bob.json",
"export:optimism": "hardhat export --network optimism --export ../sdk/deployments/optimism.json && node ./scripts/prune.js ../sdk/deployments/optimism.json",
"export:fraxtal": "hardhat export --network fraxtal --export ../sdk/deployments/fraxtal.json && node ./scripts/prune.js ../sdk/deployments/fraxtal.json",
"export:lisk": "hardhat export --network lisk --export ../sdk/deployments/lisk.json && node ./scripts/prune.js ../sdk/deployments/lisk.json",
"export:superseed": "hardhat export --network superseed --export ../sdk/deployments/superseed.json && node ./scripts/prune.js ../sdk/deployments/superseed.json",
"prune": "node ./scripts/prune.js ../sdk/deployments/*.json",
"generate": "yarn forge:build && wagmi generate"
},
Expand Down Expand Up @@ -56,4 +57,4 @@
"typescript": "^5.7.2",
"viem": "^2.21.55"
}
}
}
1 change: 1 addition & 0 deletions packages/contracts/tasks/chain-specific/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "./fraxtal";
import "./optimism";
import "./lisk";
import "./virtual-base";
import "./superseed";

export const SUPPLY_DURATION = 29 * (24 * 60 * 60) + 1 * (23 * 60 * 60); // 29 days 23 hours
export const BORROW_DURATION = 30 * (24 * 60 * 60); // 30 days
3 changes: 3 additions & 0 deletions packages/contracts/tasks/chain-specific/superseed/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import "./market";

export const COMPTROLLER_MAIN = "0x6C855402d39AFb6B3EB81844dcFC7Bb0cD742D4e";
45 changes: 45 additions & 0 deletions packages/contracts/tasks/chain-specific/superseed/market.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { task } from "hardhat/config";
import { Address, formatUnits, parseEther, zeroAddress } from "viem";
import { assetSymbols } from "@ionicprotocol/types";

import { prepareAndLogTransaction } from "../../../chainDeploy/helpers/logging";
import { COMPTROLLER_MAIN } from ".";
import { getMarketInfo } from "../../market";
import { superseed } from "@ionicprotocol/chains";

const superseedAssets = superseed.assets;

task("markets:deploy:superseed:new", "deploy new superseed assets").setAction(async (_, { viem, run }) => {
const assetsToDeploy: string[] = [assetSymbols.WETH];
for (const asset of superseedAssets.filter((asset) => assetsToDeploy.includes(asset.symbol))) {
if (!asset.name || !asset.symbol || !asset.underlying) {
throw new Error(`Asset ${asset.symbol} has no name, symbol or underlying`);
}
const name = `Ionic ${asset.name}`;
const symbol = "ion" + asset.symbol;
console.log(`Deploying ctoken ${name} with symbol ${symbol}`);
await run("market:deploy", {
signer: "deployer",
cf: "0",
underlying: asset.underlying,
comptroller: COMPTROLLER_MAIN,
symbol,
name
});
const pool = await viem.getContractAt("IonicComptroller", COMPTROLLER_MAIN);
const cToken = await pool.read.cTokensByUnderlying([asset.underlying]);
console.log(`Deployed ${asset.symbol} at ${cToken}`);

if (cToken !== zeroAddress) {
await run("market:set-supply-cap", {
market: cToken,
maxSupply: asset.initialSupplyCap
});

await run("market:set-borrow-cap", {
market: cToken,
maxBorrow: asset.initialBorrowCap
});
}
}
});
11 changes: 11 additions & 0 deletions packages/contracts/tasks/market/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ task("market:deploy", "deploy market")
const collateralFactorBN = parseEther((config.collateralFactor / 100).toString());

console.log("collateralFactorBN", collateralFactorBN.toString());
console.log("constructor params: ", [
config.underlying,
config.comptroller,
config.feeDistributor,
config.interestRateModel,
config.name,
config.symbol,
reserveFactorBN,
adminFeeBN
]);
const constructorData = encodeAbiParameters(
parseAbiParameters("address,address,address,address,string,string,uint256,uint256"),
[
Expand All @@ -52,6 +62,7 @@ task("market:deploy", "deploy market")
adminFeeBN
]
);
console.log("constructorData", constructorData);

const owner = (await comptroller.read.admin()) as Address;
// Test Transaction
Expand Down
14 changes: 13 additions & 1 deletion packages/contracts/tasks/pool/admin/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ task("pool:create:bob:main").setAction(async ({}, { run, deployments }) => {
});
});

task("pool:create:superseed").setAction(async ({}, { run, deployments }) => {
const mpo = await deployments.get("MasterPriceOracle");
await run("pool:create", {
name: "Superseed Main Market",
creator: "deployer",
priceOracle: mpo.address, // MPO
closeFactor: "50",
liquidationIncentive: "8",
enforceWhitelist: "false"
});
});

task("pool:create", "Create pool if does not exist")
.addParam("name", "Name of the pool to be created", undefined, types.string)
.addParam("creator", "Named account from which to create the pool", "deployer", types.string)
Expand Down Expand Up @@ -110,7 +122,7 @@ task("pool:create", "Create pool if does not exist")
]);
const receipt = await publicClient.waitForTransactionReceipt({ hash: deployTx });
const [event] = await poolDirectory.getEvents.PoolRegistered({ blockHash: receipt.blockHash });
console.log(`Pool registered: ${event}`);
console.log(`Pool registered: ${JSON.stringify(event, null, 2)}`);
if (!event) {
throw "Pool not found";
}
Expand Down
149 changes: 147 additions & 2 deletions packages/sdk/deployments/superseed.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,150 @@
{
"name": "superseed",
"chainId": "5330",
"contracts": {}
}
"contracts": {
"AddressesProvider": {
"address": "0xBbDcA7858ac2417b06636F7BA35e7d9EA39402ea"
},
"AddressesProvider_Implementation": {
"address": "0x7Ea7BB80F3bBEE9b52e6Ed3775bA06C9C80D4154"
},
"AddressesProvider_Proxy": {
"address": "0xBbDcA7858ac2417b06636F7BA35e7d9EA39402ea"
},
"AuthoritiesRegistry": {
"address": "0x49fC77CaC3066BDE8EfFb717E43aA31b112A0ECE"
},
"AuthoritiesRegistry_Implementation": {
"address": "0x522E808b99a89F0587906eB0A913675D35a936f6"
},
"AuthoritiesRegistry_Proxy": {
"address": "0x49fC77CaC3066BDE8EfFb717E43aA31b112A0ECE"
},
"CErc20Delegate": {
"address": "0xE1A3006be645a80F206311d9f18C866c204bA02f"
},
"CErc20PluginDelegate": {
"address": "0x8C58ECb9C0050824177f4e1Cd71C335421d4aeA2"
},
"CErc20RewardsDelegate": {
"address": "0xb3788b3C421348E43beEa88551acC16d2f6a6332"
},
"CTokenFirstExtension": {
"address": "0x8b2B6a9dC8Cd73309Cef8d64920831d4C73F43a7"
},
"Comptroller": {
"address": "0x8ea3fc79D9E463464C5159578d38870b770f6E57"
},
"ComptrollerFirstExtension": {
"address": "0x284bb7298F3d7B99CA105a468c4E696D11150E6E"
},
"ComptrollerPrudentiaCapsExt": {
"address": "0xA7B9F9B18587A3854aE41C80a08291eca149bCB7"
},
"DefaultProxyAdmin": {
"address": "0x04C21Db52CcA974dF3Dc019C92E52e522ce57156"
},
"FeeDistributor": {
"address": "0x9BAD1f7685f33ad855AE81089dFe79040864E2F6"
},
"FeeDistributor_Implementation": {
"address": "0x985a323A1CccA8Cd5fb8935590EE33FbcFE849d0"
},
"FeeDistributor_Proxy": {
"address": "0x9BAD1f7685f33ad855AE81089dFe79040864E2F6"
},
"FixedNativePriceOracle": {
"address": "0x431C87E08e2636733a945D742d25Ba77577ED480"
},
"GlobalPauser": {
"address": "0x02140fd77e463137D41b35aec304178DbdbFA8D9"
},
"IonicFlywheelLensRouter": {
"address": "0x7AABEfD7d8d2576Dc932EbE97bE8Ba90299a4ee4"
},
"IonicLiquidator_Implementation": {
"address": "0xeC7D0330E86485474C13A2152Fa867ddd41Bb12B"
},
"IonicUniV3Liquidator": {
"address": "0x48bf6bd4B3d8b4E75863B5340b977E888BacE19a"
},
"IonicUniV3Liquidator_Implementation": {
"address": "0xb0033576a9E444Dd801d5B69e1b63DBC459A6115"
},
"IonicUniV3Liquidator_Proxy": {
"address": "0x48bf6bd4B3d8b4E75863B5340b977E888BacE19a"
},
"JumpRateModel": {
"address": "0xa6BA5F1164dc66F9C5bDCE33A6d2fC70bE8Da108"
},
"LeveredPositionFactory": {
"address": "0x5d74800e977bFc8E14Eca28C9405BacbD091738E"
},
"LeveredPositionFactoryFirstExtension": {
"address": "0xC3cEc17c135d3C5d6BadC284AFF08f396447DaaC"
},
"LeveredPositionFactorySecondExtension": {
"address": "0x7DFDd5B55Fe37602B355F7a9Ed0fe00e30C163cb"
},
"LeveredPositionsLens": {
"address": "0xcA0aE3039B8825Cd7A968ceda6D99a49458722aF"
},
"LeveredPositionsLens_Implementation": {
"address": "0x948BB10123B349F0c9f358Fe36735C260DF0B4cC"
},
"LeveredPositionsLens_Proxy": {
"address": "0xcA0aE3039B8825Cd7A968ceda6D99a49458722aF"
},
"LiquidatorsRegistry": {
"address": "0x2DDF3DdFE856D1A4E5DBcb324194E2a622AeD83C"
},
"LiquidatorsRegistryExtension": {
"address": "0xA90f1c28F8Bc9C92113e54d0b7d007647Ee216a4"
},
"LiquidatorsRegistrySecondExtension": {
"address": "0xc71B968C6C23e2723Bae32957D815C9bE3ca1b34"
},
"LooplessFlywheelBooster": {
"address": "0x1E2812B4dEcA77B5dD7Af9f2D6ec40102bcffD02"
},
"MasterPriceOracle": {
"address": "0x987F3103c976CAF5087087bbF99A7E389F22311c"
},
"MasterPriceOracle_Implementation": {
"address": "0xBc97F93657186ad3614D05AaB83ee744Fc8CEf48"
},
"MasterPriceOracle_Proxy": {
"address": "0x987F3103c976CAF5087087bbF99A7E389F22311c"
},
"OracleRegistry": {
"address": "0x8Da0b2ca671F32afF847A61F845f1e99a152BDA9"
},
"PoolDirectory": {
"address": "0xe451047f3A6C8Dc595Cf305DC21F32adD5fF42Fd"
},
"PoolDirectory_Implementation": {
"address": "0xAeE8AA2c69CaA9F6D2C6a78198243C348d0C07D2"
},
"PoolDirectory_Proxy": {
"address": "0xe451047f3A6C8Dc595Cf305DC21F32adD5fF42Fd"
},
"PoolLens": {
"address": "0x1D7669b6BDfdb83066dd7C0aDa4B630b25cBc28a"
},
"PoolLensSecondary": {
"address": "0x5f0369AA93f36cA6a8B5ed7aAc47bf9e76086D03"
},
"SimplePriceOracle": {
"address": "0x239C8E4792F4D5A9bDD7769bA84A0E8dB1756c9b"
},
"SimplePriceOracle_Implementation": {
"address": "0xd8d2D1195a548FE2ff69C31c4C90e54b263771c7"
},
"SimplePriceOracle_Proxy": {
"address": "0x239C8E4792F4D5A9bDD7769bA84A0E8dB1756c9b"
},
"UniswapV3LiquidatorFunder": {
"address": "0x1D89E5ba287E67AC0046D2218Be5fE1382cE47b4"
}
}
}
16 changes: 5 additions & 11 deletions packages/sdk/src/IonicSdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,11 @@ export class IonicBase {
IonicLiquidator:
this.chainId === bob.id || this.chainId === lisk.id
? ({} as any)

Check warning on line 130 in packages/sdk/src/IonicSdk/index.ts

View workflow job for this annotation

GitHub Actions / build-lint-and-test-local

Unexpected any. Specify a different type
: this.chainId === mode.id
? getContract({
abi: ionicUniV3LiquidatorAbi,
address: this.chainDeployment.IonicUniV3Liquidator.address as Address,
client: this.walletClient!
})
: getContract({
abi: ionicLiquidatorAbi,
address: this.chainDeployment.IonicLiquidator.address as Address,
client: this.walletClient!
}),
: getContract({
abi: ionicUniV3LiquidatorAbi,
address: this.chainDeployment.IonicUniV3Liquidator.address as Address,
client: this.walletClient!
}),
FeeDistributor: getContract({
abi: feeDistributorAbi,
address: this.chainDeployment.FeeDistributor.address as Address,
Expand Down
5 changes: 3 additions & 2 deletions packages/sdk/src/modules/Pools.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { base, bob, mode, optimism, fraxtal, lisk } from "@ionicprotocol/chains";
import { base, bob, mode, optimism, fraxtal, lisk, superseed } from "@ionicprotocol/chains";
import {
ChainSupportedAssets as ChainSupportedAssetsType,
IonicPoolData,
Expand Down Expand Up @@ -39,7 +39,8 @@ export const ChainSupportedAssets: ChainSupportedAssetsType = {
[SupportedChains.optimism]: optimism.assets,
[SupportedChains.bob]: bob.assets,
[SupportedChains.fraxtal]: fraxtal.assets,
[SupportedChains.lisk]: lisk.assets
[SupportedChains.lisk]: lisk.assets,
[SupportedChains.superseed]: superseed.assets
};

export interface IIonicPools {
Expand Down
10 changes: 9 additions & 1 deletion packages/ui/app/_components/markets/NetworkSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ interface INetworkSelector {
upcomingChains?: string[];
}

const NETWORK_ORDER = ['Mode', 'Base', 'Optimism', 'Fraxtal', 'Lisk', 'BoB'];
const NETWORK_ORDER = [
'Mode',
'Base',
'Optimism',
'Fraxtal',
'Lisk',
'BoB',
'Superseed'
];

function NetworkSelector({
dropdownSelectedChain,
Expand Down
10 changes: 6 additions & 4 deletions packages/ui/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import {
mode,
bob,
fraxtal,
lisk
lisk,
superseed
} from '@reown/appkit/networks';
import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
Expand All @@ -35,7 +36,7 @@ const metadata = {
url: 'https://app.ionic.money'
};

export const networks = [base, mode, optimism, bob, fraxtal, lisk];
export const networks = [base, mode, optimism, bob, fraxtal, lisk, superseed];

export const projectId = '923645e96d6f05f650d266a32ea7295f';

Expand All @@ -59,7 +60,8 @@ createAppKit({
chainImages: {
[mode.id]: 'https://icons.llamao.fi/icons/chains/rsz_mode.jpg',
[bob.id]: 'https://icons.llamao.fi/icons/chains/rsz_bob.jpg',
[fraxtal.id]: 'https://icons.llamao.fi/icons/chains/rsz_fraxtal.jpg'
[fraxtal.id]: 'https://icons.llamao.fi/icons/chains/rsz_fraxtal.jpg',
[superseed.id]: 'https://icons.llamao.fi/icons/chains/rsz_superseed.jpg'
}
});

Expand Down Expand Up @@ -102,7 +104,7 @@ export default function RootLayout({
`}
</Script>
<body className={'scrollbar-hide font-inter '}>
<WagmiProvider config={wagmiAdapter.wagmiConfig}>
<WagmiProvider config={wagmiAdapter.wagmiConfig as any}>
<QueryClientProvider client={queryClient}>
<MultiIonicProvider>
<TooltipProvider>
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type CONFIG = {
isBobEnabled: boolean;
isFraxtalEnabled: boolean;
isLiskEnabled: boolean;
isSuperseedEnabled: boolean;
isTestnetEnabled: boolean;
productDomain: string | undefined;
productUrl: string | undefined;
Expand Down Expand Up @@ -36,6 +37,7 @@ const config: CONFIG = {
isBobEnabled: true,
isLiskEnabled: true,
isFraxtalEnabled: true,
isSuperseedEnabled: true,
isTestnetEnabled: process.env.NEXT_PUBLIC_SHOW_TESTNETS === 'true',
productDomain: process.env.PRODUCT_DOMAIN,
productUrl: process.env.PRODUCT_URL,
Expand Down
Loading

0 comments on commit 5a0c991

Please sign in to comment.