-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f17084
commit cae1a51
Showing
6 changed files
with
39 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
NEXT_PUBLIC_TEST_TOKENS_ADMIN= # Test tokens admin address | ||
NEXT_PUBLIC_TEST_TOKENS_ADMIN= # Test tokens admin address | ||
NEXT_PUBLIC_IS_LOCAL= # Defines the environment config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
import axios from 'axios' | ||
const baseURL = 'https://raw.githubusercontent.com/paltalabs/defindex/refs/heads/main/public/' | ||
const suffix = '.contracts.json' | ||
|
||
|
||
const contract_addresses = { | ||
testnet: { | ||
defindex_factory: "CAJJAIJT6E7GMJKFA66RRI7KUNNR22TPNLNUFCNANGCFXJ54RYPVPPJT", | ||
hodl_strategy: "CDTSVTAI4BXYIEZ66F2TLZ337OLW5R5P4ONWMHQY5XTOTBZURZEDZ64N", | ||
fixed_apr_strategy: "CDR6K2L2UN3SZLBOUCJCVNKKKGC4F5DHGQ6QIPVBXU3UTXTTGWWEZ2H3", | ||
blend_strategy: "CCFT4EVTUSYUNO7CYJHC3R2F5ZBTXW7CMJW5Z2PGVYCHWNDG4RS35YZ5" | ||
}, | ||
mainnet: { | ||
defindex_factory: undefined, | ||
hodl_strategy: undefined, | ||
fixed_apr_strategy: undefined, | ||
blend_strategy: undefined | ||
} | ||
} | ||
export const configFile = async (network:string)=>{ | ||
if(network != 'testnet' && network != 'mainnet' && network!= 'standalone') throw new Error(`Invalid network: ${network}. It should be testnet, mainnet or standalone`) | ||
const url = baseURL + network + suffix | ||
/* if(network != 'testnet' && network != 'mainnet' && network!= 'standalone') throw new Error(`Invalid network: ${network}. It should be testnet, mainnet or standalone`) | ||
const url = `https://raw.githubusercontent.com/paltalabs/defindex/refs/heads/main/public/${network}.contracts.json` | ||
const data = await axios.get(url) | ||
if(data.status === 200) return data.data | ||
if(data.status === 404) throw new Error(`Deployment not found for network: ${network}`) | ||
if(data.status === 404) throw new Error(`Deployment not found for network: ${network}`) */ | ||
if(network != 'testnet' && network != 'mainnet' && network != 'standalone') throw new Error(`Invalid network: ${network}.`) | ||
if(network === 'testnet') return contract_addresses.testnet | ||
if(network === 'mainnet') return contract_addresses.mainnet | ||
if(network === 'standalone') return contract_addresses.testnet | ||
return {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import { configFile } from '@/constants/constants'; | ||
import localDeployment from '../../../contracts/.soroban/testnet.contracts.json' | ||
|
||
const isLocal = process.env.NEXT_PUBLIC_IS_LOCAL | ||
|
||
export const getRemoteConfig = async (network: string) => { | ||
if (isLocal === 'false') { | ||
const deployments = await configFile(network) | ||
return deployments | ||
} else if(isLocal === 'true') { | ||
const localDeployment = require(`../../../contracts/.soroban/${network}.contracts.json`) | ||
return localDeployment | ||
} | ||
} | ||
/* else if(isLocal === 'true') { | ||
return localDeployment.ids | ||
} */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters