diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index c5e0eee..ddcbb20 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -29,7 +29,7 @@ jobs: dist_path: out script_install: pnpm install script_build: pnpm run build - project_name: kton-stake + project_name: kton-stake-v2 enable_cache: true enable_notify_comment: true enable_notify_slack: true diff --git a/.github/workflows/deploy-prd.yml b/.github/workflows/deploy-prd.yml index 67f2810..ed9f89d 100644 --- a/.github/workflows/deploy-prd.yml +++ b/.github/workflows/deploy-prd.yml @@ -31,7 +31,7 @@ jobs: dist_path: out script_install: pnpm install script_build: pnpm run build - project_name: kton-stake + project_name: kton-stake-v2 prod_mode: true enable_cache: true enable_notify_slack: true diff --git a/.github/workflows/deploy-stg.yml b/.github/workflows/deploy-stg.yml index aff7904..2cddfd1 100644 --- a/.github/workflows/deploy-stg.yml +++ b/.github/workflows/deploy-stg.yml @@ -30,8 +30,8 @@ jobs: dist_path: out script_install: pnpm install script_build: pnpm run build - project_name: kton-stake - alias_domain: "kton-stake-stg" + project_name: kton-stake-v2 + alias_domain: "kton-stake-v2-stg" enable_cache: true enable_notify_slack: true slack_channel: public-darwinia-websites-apps diff --git a/public/images/chains/koi.png b/public/images/chains/koi.png new file mode 100644 index 0000000..78afa23 Binary files /dev/null and b/public/images/chains/koi.png differ diff --git a/src/config/abi/KTONStakingRewards.ts b/src/config/abi/KTONStakingRewards.ts index 79de9b5..a90741d 100644 --- a/src/config/abi/KTONStakingRewards.ts +++ b/src/config/abi/KTONStakingRewards.ts @@ -217,5 +217,23 @@ export const abi = [ payable: false, constant: false, stateMutability: 'nonpayable' + }, + { + name: 'lockAndStake', + type: 'function', + inputs: [{ name: 'amount', type: 'uint256', internalType: 'uint256' }], + outputs: [], + payable: false, + constant: false, + stateMutability: 'nonpayable' + }, + { + name: 'unlockAndWithdraw', + type: 'function', + inputs: [{ name: 'amount', type: 'uint256', internalType: 'uint256' }], + outputs: [], + payable: false, + constant: false, + stateMutability: 'nonpayable' } ] as const; diff --git a/src/config/chains/crab.ts b/src/config/chains/crab.ts index 021ec0b..c6015e1 100644 --- a/src/config/chains/crab.ts +++ b/src/config/chains/crab.ts @@ -45,5 +45,5 @@ export const crab: ChainConfig = { decimals: 18, logoPath: '/images/token/ckton.svg' }, - stakingContractAddress: '0x000000000419683a1a03abc21fc9da25fd2b4dd7' + stakingContractAddress: '0xB633Ad1142941CA2Eb9C350579cF88BbE266660D' } as const satisfies ChainConfig; diff --git a/src/config/chains/index.ts b/src/config/chains/index.ts index 39954bd..3b9d068 100644 --- a/src/config/chains/index.ts +++ b/src/config/chains/index.ts @@ -1,2 +1,3 @@ export * from './crab'; export * from './darwinia'; +export * from './koi'; diff --git a/src/config/chains/koi.ts b/src/config/chains/koi.ts new file mode 100644 index 0000000..3c0c51f --- /dev/null +++ b/src/config/chains/koi.ts @@ -0,0 +1,40 @@ +import { ChainConfig, ChainId } from "@/types/chains"; + +export const koi: ChainConfig = { + id: ChainId.KOI, + name: 'Koi', + nativeCurrency: { name: 'KRING', symbol: 'KRING', decimals: 18 }, + rpcUrls: { + default: { + http: ['https://koi-rpc.darwinia.network'], + webSocket: ['wss://koi-rpc.darwinia.network'] + }, + public: { + http: ['https://koi-rpc.darwinia.network'], + webSocket: ['wss://koi-rpc.darwinia.network'] + } + }, + blockExplorers: { + default: { + name: 'Koi scan', + url: 'https://koi-scan.darwinia.network/' + } + }, + iconUrl: '/images/chains/koi.png', + + /** + * Token info + */ + nativeToken: { + symbol: 'KRING', + decimals: 18, + logoPath: '/images/token/ring.svg' + }, + ktonToken: { + address: '0x0000000000000000000000000000000000000402', + symbol: 'PKTON', + decimals: 18, + logoPath: '/images/token/pkton.svg' + }, + stakingContractAddress: '0xB633Ad1142941CA2Eb9C350579cF88BbE266660D' +} as const satisfies ChainConfig; \ No newline at end of file diff --git a/src/hooks/useStake.ts b/src/hooks/useStake.ts index 23f65c6..1c9443d 100644 --- a/src/hooks/useStake.ts +++ b/src/hooks/useStake.ts @@ -37,7 +37,7 @@ export function useStake({ ownerAddress, onSuccess, onError }: UseStakeProps) { abi, address: activeChain?.stakingContractAddress, account: ownerAddress!, - functionName: 'stake', + functionName: 'lockAndStake', args: [parseEther(amount)] })?.catch((data) => { updateOperationStatus('stake', 0); diff --git a/src/hooks/useUnStake.ts b/src/hooks/useUnStake.ts index 5ab2822..f6ddab6 100644 --- a/src/hooks/useUnStake.ts +++ b/src/hooks/useUnStake.ts @@ -36,7 +36,7 @@ export function useUnStake({ ownerAddress, onError, onSuccess }: UseUnStakeProps abi, address: activeChain?.stakingContractAddress, account: ownerAddress!, - functionName: 'withdraw', + functionName: 'unlockAndWithdraw', args: [parseEther(amount)] })?.catch((data) => { updateOperationStatus('unstake', 0); diff --git a/src/types/chains.ts b/src/types/chains.ts index 1a75dbd..3c30307 100644 --- a/src/types/chains.ts +++ b/src/types/chains.ts @@ -4,7 +4,8 @@ import type { Chain } from '@rainbow-me/rainbowkit'; */ export enum ChainId { CRAB = 44, - DARWINIA = 46 + DARWINIA = 46, + KOI = 701 } interface NativeToken { diff --git a/src/utils/chain.ts b/src/utils/chain.ts index 0dea8d7..47296ce 100644 --- a/src/utils/chain.ts +++ b/src/utils/chain.ts @@ -1,11 +1,12 @@ -import { darwinia, crab } from '@/config/chains'; +import { darwinia, crab, koi} from '@/config/chains'; import { ChainConfig, ChainId } from '@/types/chains'; // Map object to return a specific chain configuration // Using Record to ensure type safety const chainConfigMap: Record = { [ChainId.DARWINIA]: darwinia, - [ChainId.CRAB]: crab + [ChainId.CRAB]: crab, + [ChainId.KOI]: koi }; // Helper function to filter testnets in production