Skip to content

Commit

Permalink
Merge pull request #225 from roycoprotocol/uday
Browse files Browse the repository at this point in the history
feat(sdk): added sonic support
  • Loading branch information
githubotoro authored Jan 17, 2025
2 parents e740f45 + 62392b4 commit 6b9ca88
Show file tree
Hide file tree
Showing 20 changed files with 3,520 additions and 4 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 = {};
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 6b9ca88

Please sign in to comment.