Skip to content
Open
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
64 changes: 63 additions & 1 deletion src/components/Header/ExternalLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,68 @@ export default function ExternalLinks({isSubMenuOpen, setIsSubMenuOpen, mobile}:
}
}

const addImolaTokenToMM = async () => {
const {ethereum} = window
if (ethereum && ethereum.request) {
let networkSwitched = false

const chainId = '0x780c' // Imola chain ID
const networkAdded = await ethereum.request({
method: 'wallet_addEthereumChain',
params: [
{
chainId,
chainName: 'Move-EVM', // Imola network name
nativeCurrency: {
name: 'MOVE',
symbol: 'MOVE',
decimals: 18,
},
rpcUrls: ['https://mevm.devnet.imola.movementlabs.xyz'], // Imola RPC endpoint
blockExplorerUrls: ['https://explorer.testnet.imola.movementlabs.xyz'], // Imola block explorer URL
},
],
})

if (!networkAdded) {
try {
await ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{chainId: '0x780c'}], // Imola chain ID
})
networkSwitched = true
} catch (error) {
if ((error as any).code === 4902) {
console.error('User rejected network switch.')
} else {
console.error(error)
}
}

if (networkSwitched) {
try {
await ethereum.request({
method: 'wallet_watchAsset',
params: {
// params is expecting an array, even though the correct type is an object.
// @ts-ignore
type: 'ERC20',
options: {
address: '0xCde46284D32148c4D470fA33BA788710b3d21E89', // Imola OVL address
symbol: 'OVL',
decimals: 18,
image: 'https://raw.githubusercontent.com/overlay-market/overlay-interface/staging/public/overlay-logo-white.png',
},
},
})
} catch (error) {
console.error(error)
}
}
}
}
}

return (
<>
{(!mobile || isSubMenuOpen) && (
Expand Down Expand Up @@ -312,7 +374,7 @@ export default function ExternalLinks({isSubMenuOpen, setIsSubMenuOpen, mobile}:

{HIDE_MENU_ITEMS ? null : (
<>
<MenuLink mobile={mobile} onClick={chainId && Number(chainId) === Number(DEFAULT_CHAINID) ? addSepoliaTokenToMM : addTokenToMM}>
<MenuLink mobile={mobile} onClick={chainId && Number(chainId) === Number(DEFAULT_CHAINID) ? addImolaTokenToMM : addTokenToMM}>
<TEXT.SmallBody color={colors(false).dark.tan2}>Add OVL to Wallet</TEXT.SmallBody>
</MenuLink>

Expand Down
7 changes: 7 additions & 0 deletions src/components/Header/WalletMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const NETWORK_ICONS: {[chainId in SupportedChainId | number]: string} = {
[SupportedChainId.MAINNET]: EthereumLogo,
[SupportedChainId.ARBITRUM]: ArbitrumLogo,
[SupportedChainId.ARBITRUM_SEPOLIA]: ArbitrumTestnetLogo,
[SupportedChainId.IMOLA]: EthereumLogo,
}

export const NETWORK_LABELS: {[chainId in SupportedChainId | number]: JSX.Element} = {
Expand All @@ -109,6 +110,12 @@ export const NETWORK_LABELS: {[chainId in SupportedChainId | number]: JSX.Elemen
<TEXT.SmallBody color={colors(false).dark.red}>Testnet</TEXT.SmallBody>
</FlexRow>
),
[SupportedChainId.IMOLA]: (
<FlexRow>
<TEXT.SmallBody>Imola -</TEXT.SmallBody>
<TEXT.SmallBody color={colors(false).dark.red}>Testnet</TEXT.SmallBody>
</FlexRow>
),
}

export default function WalletMenu() {
Expand Down
1 change: 1 addition & 0 deletions src/components/Web3Status/Web3Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export const NETWORK_LABELS: {[chainId in SupportedChainId | number]: string} =
[SupportedChainId.ARBITRUM]: 'Arbitrum One',
[SupportedChainId.ARBITRUM_GÖRLI]: 'Arbitrum Goerli Testnet',
[SupportedChainId.ARBITRUM_SEPOLIA]: 'Arbitrum Sepolia Testnet',
[SupportedChainId.IMOLA]: 'Movement Testnet',
}

const providerEth = new ethers.providers.InfuraProvider('mainnet', process.env.REACT_APP_INFURA_KEY)
Expand Down
2 changes: 2 additions & 0 deletions src/connectors/connectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const SUPPORTED_CHAIN_IDS: SupportedChainId[] = [
SupportedChainId.ARBITRUM,
SupportedChainId.ARBITRUM_GÖRLI,
SupportedChainId.ARBITRUM_SEPOLIA,
SupportedChainId.IMOLA,
]

export const injected = new InjectedConnector({
Expand All @@ -37,6 +38,7 @@ export const NETWORK_URLS: {[key in SupportedChainId]: string} = {
[SupportedChainId.ARBITRUM]: `https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}`,
[SupportedChainId.ARBITRUM_GÖRLI]: `https://arbitrum-goerli.infura.io/v3/${INFURA_KEY}`,
[SupportedChainId.ARBITRUM_SEPOLIA]: `https://arbitrum-sepolia.infura.io/v3/${INFURA_KEY}`,
[SupportedChainId.IMOLA]: `https://mevm.devnet.imola.movementlabs.xyz`,
}

export const network = new NetworkConnector({
Expand Down
3 changes: 3 additions & 0 deletions src/constants/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const V1_PERIPHERY_ADDRESS: AddressMap = {
[SupportedChainId.ARBITRUM]: '0xC3cB99652111e7828f38544E3e94c714D8F9a51a',
[SupportedChainId.ARBITRUM_GÖRLI]: '0x68eb0F1Fbbb35b98526F53c01B18507f95F02119',
[SupportedChainId.ARBITRUM_SEPOLIA]: '0x2878837ea173e8bd40db7cee360b15c1c27deb5a',
[SupportedChainId.IMOLA]: '0x0CA6128B528f503C7c649ba9cc02560a8B9fD55e',
}

export const OVL_TOKEN_ADDRESS: AddressMap = {
Expand All @@ -22,6 +23,7 @@ export const OVL_TOKEN_ADDRESS: AddressMap = {
[ChainId.ARBITRUM]: '0x4305C4Bc521B052F17d389c2Fe9d37caBeB70d54',
[SupportedChainId.ARBITRUM_GÖRLI]: '0x1023b1BC47b9b449eAD9329EE0eFD4fDAcA3D767',
[SupportedChainId.ARBITRUM_SEPOLIA]: '0x3E27fAe625f25291bFda517f74bf41DC40721dA2',
[SupportedChainId.IMOLA]: '0xCde46284D32148c4D470fA33BA788710b3d21E89',
}

//@dev: remove LL Token addresses after bridge testing
Expand Down Expand Up @@ -60,4 +62,5 @@ export const MULTICALL2_ADDRESS: AddressMap = {
[ChainId.HARMONY_TESTNET]: '',
[ChainId.OKEX]: '0xF4d73326C13a4Fc5FD7A064217e12780e9Bd62c3',
[ChainId.OKEX_TESTNET]: '',
[SupportedChainId.IMOLA]: '0x1C513aA41Ac47fAc94635A3B4425641ab38Dfb29',
}
8 changes: 6 additions & 2 deletions src/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ export enum SupportedChainId {
ARBITRUM = 42161,
ARBITRUM_GÖRLI = 421613,
ARBITRUM_SEPOLIA = 421614,
IMOLA = 30732,
}

export const DEFAULT_NET = SupportedChainId[421614]
export const DEFAULT_CHAINID = SupportedChainId.ARBITRUM_SEPOLIA
// export const DEFAULT_NET = SupportedChainId[421614]
// export const DEFAULT_CHAINID = SupportedChainId.ARBITRUM_SEPOLIA

export const DEFAULT_NET = SupportedChainId[SupportedChainId.IMOLA]
export const DEFAULT_CHAINID = SupportedChainId.IMOLA
36 changes: 36 additions & 0 deletions src/constants/markets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,42 @@ export const MarketDetails: {[address: string]: MarketDetailsData} = {
url: 'https://sepolia.arbiscan.io/address/0xef898dbf4f4d75bdfbdd85f781a6c1bf8edaf0ae',
},
},
'0xb021eb4489c230234567ca6789e53403310db090': {
marketName: 'BTC Dominance',
logo: BtcdLogo,
oracleLogo: ORACLE_LOGO[FeedType.OVERLAY],
currency: PRICE_CURRENCY_FROM_QUOTE['PERCENTAGE'],
// indexesConstruction: ['Chainlink', 'Coinmarketcap', 'Cryptocompare', 'More'],
// fullLogo: BtcdFull,
// proposedBy: {name: '@VitalikButermin', url: 'https://twitter.com/VitalikButermin'},
// approved: {
// name: '11.5.24 - OGP 28',
// url: 'https://commonwealth.im/overlay/discussion/14675-mint-the-planckcatdao-nft-for-those-who-have-recently-contributed-to-the-overlay-protocol',
// },
contract: {
name: shortenAddress('0xb021eb4489c230234567ca6789e53403310db090'),
url: 'https://explorer.testnet.imola.movementlabs.xyz/#/account/0x000000000000000000000000b021eb4489c230234567ca6789e53403310db090',
},
sources: [{name: 'Chainlink'}, {name: 'Coinmarketcap'}, {name: 'Cryptocompare'}, {name: 'More...'}],
// additionalInfo: {name: 'docs.overlay.market', url: 'https://docs.overlay.market/'},
descriptionText:
'TL:DR -- The share of BTC out of the entire crypto market. \n\nThe source of data is the API provided by Chainlink, Coinmarketcap, Cryptocompare, and others.\n\nThe market capitalization of Bitcoin is divided by the market capitalization of the entire crypto market. The result is the Bitcoin Dominance value.',
},
'0xeab2fbdc9d43e785eb4065c8447d872735729aac': {
marketName: 'ETH Dominance',
logo: EthDominanceLogo,
oracleLogo: ORACLE_LOGO[FeedType.OVERLAY],
currency: PRICE_CURRENCY_FROM_QUOTE['PERCENTAGE'],
disabled: false,
contract: {
name: shortenAddress('0xeab2fbdc9d43e785eb4065c8447d872735729aac'),
url: 'https://explorer.testnet.imola.movementlabs.xyz/#/account/0x000000000000000000000000eab2fbdc9d43e785eb4065c8447d872735729aac',
},
sources: [{name: 'Chainlink'}, {name: 'Coinmarketcap'}, {name: 'Cryptocompare'}, {name: 'More...'}],
// additionalInfo: {name: 'docs.overlay.market', url: 'https://docs.overlay.market/'},
descriptionText:
'TL:DR -- The share of ETH out of the entire crypto market. \n\nThe source of data is the API provided by Chainlink, Coinmarketcap, Cryptocompare, and others.\n\nThe market capitalization of Ethereum is divided by the market capitalization of the entire crypto market. The result is the Ethereum Dominance value.',
},
'0x4edfb4057f3a448b2704df1a3665db4ae6371b69': {
marketName: 'Quantum Cats',
logo: QuantumCatsLogo,
Expand Down
2 changes: 2 additions & 0 deletions src/constants/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const OVL: {[chainId: number]: Token} = {
[SupportedChainId.ARBITRUM]: new Token(SupportedChainId.ARBITRUM, OVL_TOKEN_ADDRESS[42161], 18, 'OVL', 'Overlay'),
[SupportedChainId.ARBITRUM_GÖRLI]: new Token(SupportedChainId.ARBITRUM_GÖRLI, OVL_TOKEN_ADDRESS[421613], 18, 'OVL', 'Overlay'),
[SupportedChainId.ARBITRUM_SEPOLIA]: new Token(SupportedChainId.ARBITRUM_SEPOLIA, OVL_TOKEN_ADDRESS[421614], 18, 'OVL', 'Overlay'),
[SupportedChainId.IMOLA]: new Token(SupportedChainId.IMOLA, OVL_TOKEN_ADDRESS[SupportedChainId.IMOLA], 18, 'OVL', 'Overlay'),
}

export const NETWORK_LOGO: {[chainId: number]: string} = {
Expand All @@ -23,6 +24,7 @@ export const NETWORK_LOGO: {[chainId: number]: string} = {
[SupportedChainId.GÖRLI]: ETHEREUM_LOGO,
[SupportedChainId.ARBITRUM_GÖRLI]: ARBITRUM_LOGO,
[SupportedChainId.ARBITRUM_SEPOLIA]: ARBITRUM_TESTNET_LOGO,
[SupportedChainId.IMOLA]: ETHEREUM_LOGO,
}

//@dev: remove LL Token addresses after bridge testing
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Markets/Chart/BuildChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ export const BuildChart = ({feedAddress, marketId, longPrice, shortPrice}: Build
datafeedUrl:
chainId === Number(SupportedChainId.ARBITRUM_SEPOLIA)
? 'https://api.overlay.market/sepolia-charts/v1/charts'
: chainId === Number(SupportedChainId.IMOLA)
? 'https://api.overlay.market/imola-charts/v1/charts'
: 'https://api.overlay.market/charts/v1/charts',
libraryPath: '/charting_library/',
chartsStorageUrl: 'https://saveload.tradingview.com',
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Markets/Chart/chartDatafeed.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useMarketData} from '../../../state/markets/hooks'
import {LibrarySymbolInfo} from '../../../charting_library/charting_library'
import {getBinSizeAndUnit, isSepolia} from './helpers'
import {getBinSizeAndUnit, isSepolia, isImola} from './helpers'
import {subscribeOnStream, unsubscribeFromStream} from './streaming'
import {MarketDetails} from '../../../constants/markets'

Expand Down Expand Up @@ -78,6 +78,8 @@ export default {
let res = await fetch(
isSepolia(symbolInfo)
? `https://api.overlay.market/sepolia-charts/v1/charts?${query}`
: isImola(symbolInfo)
? `https://api.overlay.market/imola-charts/v1/charts?${query}`
: `https://api.overlay.market/charts/v1/charts?${query}`,
)
res = await res.json()
Expand Down
7 changes: 7 additions & 0 deletions src/pages/Markets/Chart/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ export function isSepolia(symbolInfo) {
)
}

export function isImola(symbolInfo) {
return (
String(symbolInfo?.marketAddress).toLowerCase() === '0xb021eb4489c230234567ca6789e53403310db090' ||
String(symbolInfo?.marketAddress).toLowerCase() === '0xeab2fbdc9d43e785eb4065c8447d872735729aac'
)
}

export function getBinSizeAndUnit(input: string): {binSize: number, binUnit: 'minute' | 'day' | 'week' | 'month'} | null {
const numValue = Number(input)

Expand Down
4 changes: 3 additions & 1 deletion src/pages/Markets/Chart/streaming.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {getBinSizeAndUnit, isSepolia} from './helpers'
import {getBinSizeAndUnit, isSepolia, isImola} from './helpers'

// Reference: https://www.tradingview.com/charting-library-docs/latest/tutorials/implement_datafeed_tutorial/Streaming-Implementation

Expand All @@ -22,6 +22,8 @@ export function subscribeOnStream(symbolInfo, resolution, onRealtimeCallback, su

const endpoint = isSepolia(symbolInfo)
? `https://api.overlay.market/sepolia-charts/v1/charts/sse?${query}`
: isImola(symbolInfo)
? `https://api.overlay.market/imola-charts/v1/charts/sse?${query}`
: `https://api.overlay.market/charts/v1/charts/sse?${query}`

const eventSource = new EventSource(endpoint)
Expand Down
4 changes: 2 additions & 2 deletions src/pages/SepoliaChecker/SepoliaChecker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ const SepoliaChecker = () => {
<Image src={BlueYellowHearts} alt={'Overlay Logo'} height={'73px'} width={'auto'} />
<TEXT.StandardHeader1 color={colors(true).dark.white}>OVL Testnet Trading Competition is on</TEXT.StandardHeader1>
<TEXT.BoldHeader1 fontSize="26px" fontStyle={'italic'} color={colors(true).dark.white}>
Arbitrum Sepolia
Movement Testnet
</TEXT.BoldHeader1>
<TEXT.BoldStandardBody textAlign={'center'}>
Please make sure you are on Sepolia network to join the Testnet Trading Competition
Please make sure you are on Movement Imola network to join the Testnet Trading Competition
</TEXT.BoldStandardBody>
<TriggerActionButton onClick={() => switchNetworkToArbitrum()} active={true}>
Change
Expand Down
1 change: 1 addition & 0 deletions src/state/data/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const CHAIN_SUBGRAPH_URL: Record<number, string> = {
[SupportedChainId.ARBITRUM]:
'https://gateway-arbitrum.network.thegraph.com/api/9d0198304529988979fdf429caba9ed3/subgraphs/id/7RuVCeRzAHL5apu6SWHyUEVt3Ko2pUv2wMTiHQJaiUW9',
[SupportedChainId.ARBITRUM_GÖRLI]: 'https://api.thegraph.com/subgraphs/name/bigboydiamonds/overlay-v1-subgraph-arb-goerli',
[SupportedChainId.IMOLA]: 'https://subgraph.overlay.market/query/subgraphs/name/overlay/v1-subgraph',
}

export const api = createApi({
Expand Down
3 changes: 2 additions & 1 deletion src/state/multicall/updater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {useAppDispatch, useAppSelector} from '../hooks'
import {updateBlockNumber} from '../application/actions'
import {useMulticall2Contract} from '../../hooks/useContract'
import {errorFetchingMulticallResults, fetchingMulticallResults, updateMulticallResults} from './actions'
import {SupportedChainId} from '../../constants/chains'

/**
* Fetches a chunk of calls, enforcing a minimum block number constraint
Expand Down Expand Up @@ -138,7 +139,7 @@ export default function Updater(): null {
if (outdatedCallKeys.length === 0) return
const calls = outdatedCallKeys.map(key => parseCallKey(key))

const chunkedCalls = chunkArray(calls)
const chunkedCalls = chunkArray(calls, +chainId === SupportedChainId.IMOLA ? 2000000 : undefined)

if (cancellations.current && cancellations.current.blockNumber !== latestBlockNumber) {
cancellations.current.cancellations.forEach(c => c())
Expand Down
14 changes: 14 additions & 0 deletions src/utils/getExplorerLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ export function getExplorerLink(chainId: number, data: string, type: ExplorerDat
}
}

if (chainId === SupportedChainId.IMOLA) {
switch (type) {
case ExplorerDataType.TRANSACTION:
return `https://explorer.testnet.imola.movementlabs.xyz/#/txn/${data}`
case ExplorerDataType.ADDRESS:
case ExplorerDataType.TOKEN:
return `https://explorer.testnet.imola.movementlabs.xyz/`
case ExplorerDataType.BLOCK:
return `https://explorer.testnet.imola.movementlabs.xyz/#/block/${data}`
default:
return `https://explorer.testnet.imola.movementlabs.xyz/`
}
}

const prefix = `https://${ETHERSCAN_PREFIXES[chainId] ?? ''}etherscan.io`

switch (type) {
Expand Down
10 changes: 5 additions & 5 deletions src/utils/switchNetworkToArbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ export async function switchNetworkToArbitrum() {
params: [
{
chainId: ethers.utils.hexValue(DEFAULT_CHAINID),
chainName: 'Arbitrum Sepolia',
rpcUrls: ['https://sepolia-rollup.arbitrum.io/rpc'],
blockExplorerUrls: ['https://sepolia.arbiscan.io/'],
chainName: 'Move-EVM',
rpcUrls: ['https://mevm.devnet.imola.movementlabs.xyz'],
blockExplorerUrls: ['https://explorer.testnet.imola.movementlabs.xyz'],
nativeCurrency: {
decimals: 18,
name: 'ETH-Sepolia',
symbol: 'ETH',
name: 'MOVE',
symbol: 'MOVE',
},
},
],
Expand Down