Skip to content

Commit

Permalink
feat(sdk): added sonic support
Browse files Browse the repository at this point in the history
  • Loading branch information
githubotoro committed Jan 17, 2025
1 parent bec6dd1 commit 62392b4
Show file tree
Hide file tree
Showing 22 changed files with 3,524 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/constants/generate-market-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import prettier from "prettier";

const projectRoot = process.cwd();

const CHAIN_IDS = [1, 11155111, 8453, 42161, 21000000, 98865];
const CHAIN_IDS = [1, 11155111, 8453, 42161, 21000000, 98865, 146];

const generateMarketMap = async () => {
// Generate maps for each chain ID
Expand Down
2 changes: 1 addition & 1 deletion scripts/constants/generate-token-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import prettier from "prettier";

const projectRoot = process.cwd();

const CHAIN_IDS = [1, 11155111, 8453, 42161, 21000000, 98865];
const CHAIN_IDS = [1, 11155111, 8453, 42161, 21000000, 98865, 146];

const generateTokenMap = async () => {
// Generate maps for each chain ID
Expand Down
9 changes: 9 additions & 0 deletions sdk/constants/chain-map/chain-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
base,
corn,
plume,
sonic,
} from "viem/chains";
import { type Chain } from "viem/chains";

Expand Down Expand Up @@ -53,13 +54,21 @@ export const Plume = {
symbol: "PLUME",
};

export const Sonic = {
...sonic,
name: "Sonic",
image: "https://icons.llamao.fi/icons/chains/rsz_sonic.jpg",
symbol: "SONIC",
};

export const SupportedChainMap: Record<number, SupportedChain> = {
[ethereumSepolia.id]: EthereumSepolia,
[ethereumMainnet.id]: EthereumMainnet,
[arbitrumOne.id]: ArbitrumOne,
[base.id]: Base,
[corn.id]: Corn,
[plume.id]: Plume,
[sonic.id]: Sonic,
};

export const SupportedChainlist = Object.values(SupportedChainMap);
1 change: 1 addition & 0 deletions sdk/constants/market-map/146/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const MarketMap146 = {};
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export default defineMarket({
name: `Deposit USDC into SuperUSDC for 10 weeks`,
description: `Deposit USDC into Superform&#x27;s SuperUSDC on Base for 3 months. SuperUSDC optimizes across blue-chip lending yield on Base to earn the best returns.`,
is_verified: false,
});
});
3 changes: 3 additions & 0 deletions sdk/constants/market-map/8453/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import market_8453_0_0x01343749855527b9525f0a2c5e12daff5f3da81bfd8af3514334fdfb5a9ae931 from "./definitions/8453_0_0x01343749855527b9525f0a2c5e12daff5f3da81bfd8af3514334fdfb5a9ae931";
import market_8453_0_0x1b467d65fde4ec8988e8df1706d0f9e028db8d41e14d10fbbd7b194e5744ac59 from "./definitions/8453_0_0x1b467d65fde4ec8988e8df1706d0f9e028db8d41e14d10fbbd7b194e5744ac59";
import market_8453_0_0x1ca4129e09bfea50d71f1aaf8ef52be058b58301939a84406c51286454147591 from "./definitions/8453_0_0x1ca4129e09bfea50d71f1aaf8ef52be058b58301939a84406c51286454147591";
import market_8453_0_0x2be8bc14f1bca4285983c31503d487bf512df01a3d5469c5d7f35c0a7f2f6b75 from "./definitions/8453_0_0x2be8bc14f1bca4285983c31503d487bf512df01a3d5469c5d7f35c0a7f2f6b75";
import market_8453_0_0x63cb3b36c1b893932321463867a6dbfac387611b28eee083d8d256e35e00f348 from "./definitions/8453_0_0x63cb3b36c1b893932321463867a6dbfac387611b28eee083d8d256e35e00f348";
import market_8453_0_0xd9cefc89a473c60f4c2328fc6af2cc0dbe59f250299133ab3c53c5afc0fdb11a from "./definitions/8453_0_0xd9cefc89a473c60f4c2328fc6af2cc0dbe59f250299133ab3c53c5afc0fdb11a";
import market_8453_1_0x114f63d0cc180e2e886a1eaa84eb4458632504cb from "./definitions/8453_1_0x114f63d0cc180e2e886a1eaa84eb4458632504cb";
Expand All @@ -22,6 +23,8 @@ export const MarketMap8453 = {
market_8453_0_0x1b467d65fde4ec8988e8df1706d0f9e028db8d41e14d10fbbd7b194e5744ac59,
[market_8453_0_0x1ca4129e09bfea50d71f1aaf8ef52be058b58301939a84406c51286454147591.id]:
market_8453_0_0x1ca4129e09bfea50d71f1aaf8ef52be058b58301939a84406c51286454147591,
[market_8453_0_0x2be8bc14f1bca4285983c31503d487bf512df01a3d5469c5d7f35c0a7f2f6b75.id]:
market_8453_0_0x2be8bc14f1bca4285983c31503d487bf512df01a3d5469c5d7f35c0a7f2f6b75,
[market_8453_0_0x63cb3b36c1b893932321463867a6dbfac387611b28eee083d8d256e35e00f348.id]:
market_8453_0_0x63cb3b36c1b893932321463867a6dbfac387611b28eee083d8d256e35e00f348,
[market_8453_0_0xd9cefc89a473c60f4c2328fc6af2cc0dbe59f250299133ab3c53c5afc0fdb11a.id]:
Expand Down
3 changes: 3 additions & 0 deletions sdk/constants/market-map/market-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { MarketMap42161 } from "./42161";
import { MarketMap8453 } from "./8453";
import { MarketMap21000000 } from "./21000000";
import { MarketMap98865 } from "./98865";
import { MarketMap146 } from "./146";

import type { SupportedMarket } from "./utils";

Expand All @@ -14,6 +15,7 @@ export {
MarketMap8453,
MarketMap21000000,
MarketMap98865,
MarketMap146,
};

export const SupportedMarketMap = {
Expand All @@ -23,6 +25,7 @@ export const SupportedMarketMap = {
...MarketMap8453,
...MarketMap21000000,
...MarketMap98865,
...MarketMap146,
} as Record<string, SupportedMarket>;

export const MarketList = Object.values(SupportedMarketMap);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineToken } from "@/sdk/constants";

export default defineToken({
id: "146-0x29219dd400f2bf60e5a23d13be72b486d4038894",
chain_id: 146,
contract_address: "0x29219dd400f2bf60e5a23d13be72b486d4038894",
name: "Sonic Bridged USDC.e (Sonic)",
symbol: "USDC.e",
image:
"https://coin-images.coingecko.com/coins/images/53064/large/logo.png?1735179479",
decimals: 6,
source: "coingecko",
search_id: "sonic-bridged-usdc-e-sonic",
type: "token",
});
6 changes: 6 additions & 0 deletions sdk/constants/token-map/146/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import token_146_0x29219dd400f2bf60e5a23d13be72b486d4038894 from "./definitions/146-0x29219dd400f2bf60e5a23d13be72b486d4038894";

export const TokenMap146 = {
[token_146_0x29219dd400f2bf60e5a23d13be72b486d4038894.id]:
token_146_0x29219dd400f2bf60e5a23d13be72b486d4038894,
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineToken({
chain_id: 21000000,
contract_address: "0xdf0b24095e15044538866576754f3c964e902ee6",
name: "Bridged USDC (Corn)",
symbol: "USDC.E",
symbol: "USDC.e",
image:
"https://coin-images.coingecko.com/coins/images/30691/large/usdc.png?1696529560",
decimals: 6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineToken({
chain_id: 42161,
contract_address: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
name: "Arbitrum Bridged USDC (Arbitrum)",
symbol: "USDC.E",
symbol: "USDC.e",
image:
"https://coin-images.coingecko.com/coins/images/30691/large/usdc.png?1696529560",
decimals: 6,
Expand Down
3 changes: 3 additions & 0 deletions sdk/constants/token-map/token-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TokenMap11155111 } from "./11155111";
import { TokenMap8453 } from "./8453";
import { TokenMap21000000 } from "./21000000";
import { TokenMap98865 } from "./98865";
import { TokenMap146 } from "./146";

import { NULL_ADDRESS } from "../market-utils";
import type { SupportedToken } from "./utils";
Expand All @@ -15,6 +16,7 @@ export {
TokenMap8453,
TokenMap98865,
TokenMap21000000,
TokenMap146,
};

export const SupportedTokenMap = {
Expand All @@ -24,6 +26,7 @@ export const SupportedTokenMap = {
...TokenMap8453,
...TokenMap21000000,
...TokenMap98865,
...TokenMap146,
} as Record<string, SupportedToken>;

export const SupportedTokenList = Object.values(SupportedTokenMap);
Expand Down
183 changes: 183 additions & 0 deletions sdk/contracts/146/contract-abis/PointsFactory.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
{
"abi": [
{
"type": "constructor",
"inputs": [
{ "name": "_owner", "type": "address", "internalType": "address" }
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "acceptOwnership",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "addRecipeMarketHub",
"inputs": [
{
"name": "_recipeMarketHub",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "createPointsProgram",
"inputs": [
{ "name": "_name", "type": "string", "internalType": "string" },
{ "name": "_symbol", "type": "string", "internalType": "string" },
{ "name": "_decimals", "type": "uint256", "internalType": "uint256" },
{ "name": "_owner", "type": "address", "internalType": "address" }
],
"outputs": [
{
"name": "points",
"type": "address",
"internalType": "contract Points"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "isPointsProgram",
"inputs": [{ "name": "", "type": "address", "internalType": "address" }],
"outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "isRecipeMarketHub",
"inputs": [{ "name": "", "type": "address", "internalType": "address" }],
"outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "owner",
"inputs": [],
"outputs": [{ "name": "", "type": "address", "internalType": "address" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "pendingOwner",
"inputs": [],
"outputs": [{ "name": "", "type": "address", "internalType": "address" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "renounceOwnership",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "transferOwnership",
"inputs": [
{ "name": "newOwner", "type": "address", "internalType": "address" }
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "event",
"name": "NewPointsProgram",
"inputs": [
{
"name": "points",
"type": "address",
"indexed": true,
"internalType": "contract Points"
},
{
"name": "name",
"type": "string",
"indexed": true,
"internalType": "string"
},
{
"name": "symbol",
"type": "string",
"indexed": true,
"internalType": "string"
}
],
"anonymous": false
},
{
"type": "event",
"name": "OwnershipTransferStarted",
"inputs": [
{
"name": "previousOwner",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "newOwner",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"type": "event",
"name": "OwnershipTransferred",
"inputs": [
{
"name": "previousOwner",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "newOwner",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"type": "event",
"name": "RecipeMarketHubAdded",
"inputs": [
{
"name": "recipeMarketHub",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"type": "error",
"name": "OwnableInvalidOwner",
"inputs": [
{ "name": "owner", "type": "address", "internalType": "address" }
]
},
{
"type": "error",
"name": "OwnableUnauthorizedAccount",
"inputs": [
{ "name": "account", "type": "address", "internalType": "address" }
]
}
]
}
Loading

0 comments on commit 62392b4

Please sign in to comment.