Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add core network support to osnap plugin #4575

Merged
merged 5 commits into from
Feb 23, 2024
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
36 changes: 34 additions & 2 deletions src/plugins/oSnap/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,8 @@ export const EXPLORER_API_URLS = {
'246': 'https://explorer.energyweb.org/api',
'137': 'https://api.polygonscan.com/api',
'56': 'https://api.bscscan.com/api',
'42161': 'https://api.arbiscan.io/api'
'42161': 'https://api.arbiscan.io/api',
// '1116': Add 'https://openapi.coredao.org/api' if API key requirement is removed
} as const;

export const GNOSIS_SAFE_TRANSACTION_API_URLS = {
Expand All @@ -1116,7 +1117,20 @@ export const GNOSIS_SAFE_TRANSACTION_API_URLS = {
'246': 'https://safe-transaction-ewc.safe.global/api',
'137': 'https://safe-transaction-polygon.safe.global/api',
'56': 'https://safe-transaction-bsc.safe.global/api',
'42161': 'https://safe-transaction-arbitrum.safe.global/api'
'42161': 'https://safe-transaction-arbitrum.safe.global/api',
// '1116': Add when public tx service is available for Core
} as const;

export const SAFE_APP_URLS = {
'1': 'https://app.safe.global/apps/open',
'5': 'https://app.safe.global/apps/open',
'100': 'https://app.safe.global/apps/open',
'73799': 'https://app.safe.global/apps/open',
'246': 'https://app.safe.global/apps/open',
'137': 'https://app.safe.global/apps/open',
'56': 'https://app.safe.global/apps/open',
'42161': 'https://app.safe.global/apps/open',
'1116': 'https://safe.coredao.org/apps/open'
} as const;

// ABIs
Expand Down Expand Up @@ -1417,6 +1431,15 @@ export const contractData = [
'https://api.thegraph.com/subgraphs/name/umaprotocol/avalanche-optimistic-oracle-v3',
deployBlock: 27816737
},
{
// core
network: '1116',
name: 'OptimisticOracleV3',
address: '0xD84ACa67d683aF7702705141b3C7E57e4e5e7726',
subgraph:
'https://thegraph.coredao.org/subgraphs/name/umaprotocol/core-optimistic-oracle-v3',
deployBlock: 11341063
},
{
// mainnet
network: '1',
Expand Down Expand Up @@ -1480,6 +1503,15 @@ export const contractData = [
deployBlock: 28050250,
subgraph:
'https://api.thegraph.com/subgraphs/name/umaprotocol/avalanche-optimistic-governor'
},
{
// core
network: '1116',
name: 'OptimisticGovernor',
address: '0x596Fd6A5A185c67aBD1c845b39f593fBA9C233aa',
deployBlock: 11341122,
subgraph:
'https://thegraph.coredao.org/subgraphs/name/umaprotocol/core-optimistic-governor'
}
] as const;

Expand Down
10 changes: 10 additions & 0 deletions src/plugins/oSnap/utils/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ const BNB_COIN = {
logoUri:
'https://safe-transaction-assets.safe.global/chains/56/currency_logo.png'
} as const;
const CORE_COIN = {
name: 'Core',
symbol: 'CORE',
address: 'main',
decimals: 18,
logoUri:
'https://cloudflare-ipfs.com/ipfs/bafkreigjv5yb7uhlrryzib7j2f73nnwqan2tmfnwjdu26vkk365fyesoiu'
} as const;

export function getNativeAsset(network: Network) {
switch (parseInt(network)) {
Expand All @@ -55,6 +63,8 @@ export function getNativeAsset(network: Network) {
return EWC_COIN;
case 56:
return BNB_COIN;
case 1116:
return CORE_COIN;
}

return ETHEREUM_COIN;
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/oSnap/utils/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
GNOSIS_SAFE_TRANSACTION_API_URLS,
OPTIMISTIC_GOVERNOR_ABI,
OPTIMISTIC_ORACLE_V3_ABI,
SAFE_APP_URLS,
contractData,
safePrefixes,
solidityZeroHexString
Expand Down Expand Up @@ -248,9 +249,9 @@ export function makeConfigureOsnapUrl(params: {
network,
spaceName,
spaceUrl,
baseUrl = 'https://app.safe.global/apps/open',
appUrl = 'https://osnap.uma.xyz/'
} = params;
const baseUrl = params.baseUrl ?? SAFE_APP_URLS[network] ?? 'https://app.safe.global/apps/open';
const safeAddressPrefix = getSafeNetworkPrefix(network);
const appUrlSearchParams = new URLSearchParams();
appUrlSearchParams.set('spaceName', spaceName);
Expand Down
28 changes: 25 additions & 3 deletions src/plugins/safeSnap/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export const EIP3770_PREFIXES = {
246: 'ewt',
73799: 'vt',
42161: 'arb1',
137: 'matic'
137: 'matic',
1116: 'core'
};

export const EXPLORER_API_URLS = {
Expand All @@ -29,7 +30,8 @@ export const EXPLORER_API_URLS = {
'246': 'https://explorer.energyweb.org/api',
'137': 'https://api.polygonscan.com/api',
'56': 'https://api.bscscan.com/api',
'42161': 'https://api.arbiscan.io/api'
'42161': 'https://api.arbiscan.io/api',
// '1116': Add 'https://openapi.coredao.org/api' if API key requirement is removed
};

export const GNOSIS_SAFE_TRANSACTION_API_URLS = {
Expand All @@ -40,7 +42,8 @@ export const GNOSIS_SAFE_TRANSACTION_API_URLS = {
'246': 'https://safe-transaction-ewc.safe.global/api',
'137': 'https://safe-transaction-polygon.safe.global/api',
'56': 'https://safe-transaction-bsc.safe.global/api',
'42161': 'https://safe-transaction-arbitrum.safe.global/api'
'42161': 'https://safe-transaction-arbitrum.safe.global/api',
// '1116': // Add when public tx service is available for Core
};

// ABIs
Expand Down Expand Up @@ -348,6 +351,7 @@ export const MULTI_SEND_V1_3_0 = {
'288': '0x998739BFdAAdde7C933B942a68053933098f9EDa',
'588': '0x998739BFdAAdde7C933B942a68053933098f9EDa',
'1088': '0x998739BFdAAdde7C933B942a68053933098f9EDa',
'1116': '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761',
'1285': '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761',
'1287': '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761',
'4002': '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761',
Expand Down Expand Up @@ -460,6 +464,15 @@ export const contractData: ContractData[] = [
'https://api.thegraph.com/subgraphs/name/umaprotocol/avalanche-optimistic-oracle-v3',
deployBlock: 27816737
},
{
// core
network: '43114',
name: 'OptimisticOracleV3',
address: '0xD84ACa67d683aF7702705141b3C7E57e4e5e7726',
subgraph:
'https://thegraph.coredao.org/subgraphs/name/umaprotocol/core-optimistic-oracle-v3',
deployBlock: 11341063
},
{
// mainnet
network: '1',
Expand Down Expand Up @@ -523,5 +536,14 @@ export const contractData: ContractData[] = [
deployBlock: 28050250,
subgraph:
'https://api.thegraph.com/subgraphs/name/umaprotocol/avalanche-optimistic-governor'
},
{
// core
network: '1116',
name: 'OptimisticGovernor',
address: '0x596Fd6A5A185c67aBD1c845b39f593fBA9C233aa',
deployBlock: 11341122,
subgraph:
'https://thegraph.coredao.org/subgraphs/name/umaprotocol/core-optimistic-governor'
}
];
12 changes: 11 additions & 1 deletion src/plugins/safeSnap/utils/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ const BNB_COIN: TokenAsset = {
logoUri:
'https://safe-transaction-assets.safe.global/chains/56/currency_logo.png'
};
const CORE_COIN: TokenAsset = {
name: 'Core',
symbol: 'CORE',
address: 'main',
decimals: 18,
logoUri:
'https://cloudflare-ipfs.com/ipfs/bafkreigjv5yb7uhlrryzib7j2f73nnwqan2tmfnwjdu26vkk365fyesoiu'
};

export function getNativeAsset(network: Network) {
switch (parseInt(network)) {
Expand All @@ -53,7 +61,9 @@ export function getNativeAsset(network: Network) {
return EWC_COIN;
case 56:
return BNB_COIN;
}
case 1116:
return CORE_COIN;
}

return ETHEREUM_COIN;
}
Loading