Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
469 changes: 469 additions & 0 deletions broadcast/DeployDEX_v2.s.sol/2892/run-1757758113.json

Large diffs are not rendered by default.

278 changes: 139 additions & 139 deletions broadcast/DeployDEX_v2.s.sol/2892/run-latest.json

Large diffs are not rendered by default.

164 changes: 164 additions & 0 deletions broadcast/DeployDEX_v2.s.sol/91342/run-1757757881.json

Large diffs are not rendered by default.

164 changes: 164 additions & 0 deletions broadcast/DeployDEX_v2.s.sol/91342/run-latest.json

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions frontend/src/components/FarmingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ export default function FarmingPage() {
const { data: totalStakedData } = useReadContract({
address: CONTRACTS.FARMING,
abi: FARMING_ABI,
functionName: 'totalStaked',
functionName: 'totalSupply',
});

const { data: rewardRateData } = useReadContract({
address: CONTRACTS.FARMING,
abi: FARMING_ABI,
functionName: 'rewardRate',
// use the helper that returns a human-scaled reward rate
functionName: 'getRewardRate',
});

const { data: periodFinishData } = useReadContract({
Expand All @@ -68,16 +69,18 @@ export default function FarmingPage() {
const { data: pausedData } = useReadContract({
address: CONTRACTS.FARMING,
abi: FARMING_ABI,
functionName: 'paused',
functionName: 'isPaused',
});

// Update state when data changes
useEffect(() => {
if (lpBalanceData) setLpBalance(formatEther(lpBalanceData));
if (stakedData) setStakedBalance(formatEther(stakedData));
if (earnedData) setEarnedRewards(formatEther(earnedData));
if (totalStakedData) setTotalStaked(formatEther(totalStakedData));
if (rewardRateData) setRewardRate(formatEther(rewardRateData));
if (totalStakedData) setTotalStaked(formatEther(totalStakedData));
// getRewardRate() returns the token/sec value already scaled to token units
// but it's still a BigInt in wei-style units; formatEther will convert to decimal
if (rewardRateData) setRewardRate(formatEther(rewardRateData));
if (periodFinishData) setPeriodFinish(Number(periodFinishData));
if (pausedData !== undefined) setIsPaused(pausedData);
}, [lpBalanceData, stakedData, earnedData, totalStakedData, rewardRateData, periodFinishData, pausedData]);
Expand Down
107 changes: 87 additions & 20 deletions frontend/src/lib/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
export const CONTRACTS = {
// Token addresses
USDC: "0xcC11f370fe6126b36D634FC1D2CCbC1F72599199" as const,
KANARI: "0x022F8de9adF2B8Aea32C715F79b5f05A611625EC" as const,
KANARI: "0xcefB699Cf39C5462CaD926920f869a252FDE09EC" as const,

// DEX Infrastructure
DEX_FACTORY: "0xad255Cc5437AcA030b1f8D41054CC2bfeaBfb3a9" as const,
KANARI_NATIVE_POOL: "0x71D5414715a3957dFDeaDB2a7368c5768C0683D3" as const,
FARMING: "0x1871A6c114B62A8Ea0855b1a29B7Df4341ED9a0d" as const,
DEX_FACTORY: "0xb24361e65059537C684014FC9aa903d60B3290dc" as const,
KANARI_NATIVE_POOL: "0xeD415A516A0F83e27314Ddc8fb12bB3fd572D260" as const,
FARMING: "0xEA4054041b1c65308a0D2F2d88DEa0f107A0c85A" as const,

} as const;

// Pool configurations for different trading pairs
export const POOLS = {
'KANARI-NATIVE': {
address: CONTRACTS.KANARI_NATIVE_POOL,
tokenA: 'KANARI' as TokenKey,
tokenB: 'NATIVE' as TokenKey,
name: 'KANARI/sBTC',
tokenA: 'NATIVE' as TokenKey,
tokenB: 'KANARI' as TokenKey,
name: 'sBTC/KANARI',
description: 'KANARI paired with native sBTC (Dev fee: 0.1%)',
hasFeeCollection: true,
devFee: '0.1%',
Expand Down Expand Up @@ -524,7 +524,6 @@ export const SWAP_ABI = [

// Farming Contract ABI (NEW)
export const FARMING_ABI = [
// View functions
{
"type": "function",
"name": "lpToken",
Expand All @@ -541,30 +540,37 @@ export const FARMING_ABI = [
},
{
"type": "function",
"name": "totalStaked",
"name": "rewardRate",
"inputs": [],
"outputs": [{ "type": "uint256", "name": "" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "rewardRate",
"name": "periodFinish",
"inputs": [],
"outputs": [{ "type": "uint256", "name": "" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "periodFinish",
"name": "lastUpdateTime",
"inputs": [],
"outputs": [{ "type": "uint256", "name": "" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "paused",
"name": "rewardPerTokenStored",
"inputs": [],
"outputs": [{ "type": "bool", "name": "" }],
"outputs": [{ "type": "uint256", "name": "" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "totalSupply",
"inputs": [],
"outputs": [{ "type": "uint256", "name": "" }],
"stateMutability": "view"
},
{
Expand All @@ -576,19 +582,25 @@ export const FARMING_ABI = [
},
{
"type": "function",
"name": "earned",
"inputs": [{ "type": "address", "name": "account" }],
"name": "lastTimeRewardApplicable",
"inputs": [],
"outputs": [{ "type": "uint256", "name": "" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "getRewardForDuration",
"name": "rewardPerToken",
"inputs": [],
"outputs": [{ "type": "uint256", "name": "" }],
"stateMutability": "view"
},
// State-changing functions
{
"type": "function",
"name": "earned",
"inputs": [{ "type": "address", "name": "account" }],
"outputs": [{ "type": "uint256", "name": "" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "stake",
Expand Down Expand Up @@ -624,17 +636,54 @@ export const FARMING_ABI = [
"outputs": [],
"stateMutability": "nonpayable"
},
// Owner functions
{
"type": "function",
"name": "fundRewards",
"inputs": [
{ "type": "uint256", "name": "amount" },
{ "type": "uint256", "name": "rewardAmount" },
{ "type": "uint256", "name": "duration" }
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "recoverERC20",
"inputs": [
{ "type": "address", "name": "token" },
{ "type": "uint256", "name": "amount" }
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "getPeriodFinish",
"inputs": [],
"outputs": [{ "type": "uint256", "name": "" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "getRewardRate",
"inputs": [],
"outputs": [{ "type": "uint256", "name": "" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "getRewardForDuration",
"inputs": [],
"outputs": [{ "type": "uint256", "name": "" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "isPaused",
"inputs": [],
"outputs": [{ "type": "bool", "name": "" }],
"stateMutability": "view"
},
{
"type": "function",
"name": "pause",
Expand Down Expand Up @@ -678,11 +727,29 @@ export const FARMING_ABI = [
"type": "event",
"name": "RewardAdded",
"inputs": [
{ "type": "uint256", "name": "reward", "indexed": false }
{ "type": "uint256", "name": "reward", "indexed": false },
{ "type": "uint256", "name": "duration", "indexed": false }
]
},
{
"type": "event",
"name": "TokenRecovered",
"inputs": [
{ "type": "address", "name": "token", "indexed": true },
{ "type": "uint256", "name": "amount", "indexed": false }
]
},
{
"type": "event",
"name": "EmergencyWithdraw",
"inputs": [
{ "type": "address", "name": "user", "indexed": true },
{ "type": "uint256", "name": "amount", "indexed": false }
]
}
] as const;


// DEX Factory ABI for creating new trading pairs
export const DEX_FACTORY_ABI = [
{
Expand Down
Loading
Loading