-
Notifications
You must be signed in to change notification settings - Fork 55
Add Arc support #1106
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
Open
j0ntz
wants to merge
2
commits into
master
Choose a base branch
from
jon/arc-chain
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add Arc support #1106
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| import { EdgeCurrencyInfo, EdgeTokenMap } from 'edge-core-js/types' | ||
|
|
||
| import { makeOuterPlugin } from '../../common/innerPlugin' | ||
| import { createEvmTokenId, makeMetaTokens } from '../../common/tokenHelpers' | ||
| import type { EthereumTools } from '../EthereumTools' | ||
| import { | ||
| asEthereumInfoPayload, | ||
| EthereumFees, | ||
| EthereumInfoPayload, | ||
| EthereumNetworkInfo | ||
| } from '../ethereumTypes' | ||
| import { | ||
| evmCustomFeeTemplate, | ||
| evmCustomTokenTemplate, | ||
| evmMemoOptions, | ||
| makeEvmDefaultSettings | ||
| } from './ethereumCommonInfo' | ||
|
|
||
| // Addresses from Arc's published contract list, each confirmed against the | ||
| // contract's own name, symbol and decimals. USDC at 0x3600…0000 is not listed: | ||
| // it is the native balance seen through an ERC-20 interface, so as a token it | ||
| // would show the same money twice. | ||
| export const builtinTokens: EdgeTokenMap = { | ||
| bef5f6d51cb62b58e6a8f77868681825c6fe21c1: { | ||
| currencyCode: 'EURC', | ||
| displayName: 'EURC', | ||
| denominations: [{ name: 'EURC', multiplier: '1000000' }], | ||
| networkLocation: { | ||
| contractAddress: '0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1' | ||
| } | ||
| }, | ||
| '171a4217b86a807a64eb94757db6849fb4bdbaa0': { | ||
| currencyCode: 'cirBTC', | ||
| displayName: 'Circle Wrapped Bitcoin', | ||
| denominations: [{ name: 'cirBTC', multiplier: '100000000' }], | ||
| networkLocation: { | ||
| contractAddress: '0x171A4217b86A807A64eB94757Db6849fb4bDbAA0' | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Fees are in USDC wei (18 decimals). The base fee holds near 20 gwei, about | ||
| // $0.0004 for a plain transfer, and most blocks tip a few gwei. | ||
| const networkFees: EthereumFees = { | ||
| default: { | ||
| baseFee: undefined, | ||
| baseFeeMultiplier: { | ||
| lowFee: '1', | ||
| standardFeeLow: '1.25', | ||
| standardFeeHigh: '1.5', | ||
| highFee: '1.75' | ||
| }, | ||
| gasLimit: { | ||
| regularTransaction: '21000', | ||
| tokenTransaction: '300000', | ||
| minGasLimit: '21000' | ||
| }, | ||
| gasPrice: { | ||
| lowFee: '20000000001', | ||
| standardFeeLow: '22000000001', | ||
| standardFeeHigh: '30000000001', | ||
| standardFeeLowAmount: '100000000000000000', | ||
| standardFeeHighAmount: '10000000000000000000', | ||
| highFee: '40000000001', | ||
| minGasPrice: '20000000000' | ||
| }, | ||
| minPriorityFee: '1000000000' | ||
| } | ||
| } | ||
|
|
||
| const networkInfo: EthereumNetworkInfo = { | ||
| // Blocks arrive about every 0.5s, so this is the usual ~2 minute overlap | ||
| addressQueryLookbackBlocks: 240, | ||
| networkAdapterConfigs: [ | ||
| { | ||
| // History source. Both this adapter and `evmscan` below add the native | ||
| // ERC-20 interface's transfers, which neither reports as native value. | ||
| type: 'alchemy', | ||
| servers: ['https://arc-mainnet.g.alchemy.com/v2/{{alchemyApiKey}}'] | ||
| }, | ||
| { | ||
| type: 'rpc', | ||
| servers: [ | ||
| 'https://rpc.mainnet.arc.io', | ||
| 'https://rpc.drpc.mainnet.arc.io', | ||
| 'https://rpc.quicknode.mainnet.arc.io', | ||
| 'https://arc-mainnet.g.alchemy.com/v2/{{alchemyApiKey}}' | ||
| ] | ||
| }, | ||
| { | ||
| // History fallback, and the only source in a build without an Alchemy | ||
| // key. Etherscan V2 serves chain 5042. | ||
| type: 'evmscan', | ||
| servers: ['https://api.etherscan.io'] | ||
| } | ||
|
j0ntz marked this conversation as resolved.
|
||
| ], | ||
| nativeErc20Interface: { | ||
| contractAddress: '0x3600000000000000000000000000000000000000', | ||
| multiplier: '1000000' | ||
| }, | ||
| uriNetworks: ['arc'], | ||
| ercTokenStandard: 'ERC20', | ||
| chainParams: { | ||
| chainId: 5042, | ||
| name: 'Arc' | ||
| }, | ||
| supportsEIP1559: true, | ||
| hdPathCoinType: 60, | ||
| pluginMnemonicKeyName: 'arcMnemonic', | ||
| pluginRegularKeyName: 'arcKey', | ||
| evmGasStationUrl: null, | ||
| networkFees | ||
| } | ||
|
|
||
| export const currencyInfo: EdgeCurrencyInfo = { | ||
| canReplaceByFee: true, | ||
| currencyCode: 'USDC', | ||
| evmChainId: 5042, | ||
| customFeeTemplate: evmCustomFeeTemplate, | ||
| customTokenTemplate: evmCustomTokenTemplate, | ||
| chainDisplayName: 'Arc', | ||
| assetDisplayName: 'USD Coin', | ||
| memoOptions: evmMemoOptions, | ||
| pluginId: 'arc', | ||
| walletType: 'wallet:arc', | ||
|
|
||
| // Explorers: | ||
| addressExplorer: 'https://arc.etherscan.io/address/%s', | ||
| transactionExplorer: 'https://arc.etherscan.io/tx/%s', | ||
|
|
||
| denominations: [ | ||
| { | ||
| name: 'USDC', | ||
| multiplier: '1000000000000000000', | ||
| symbol: 'USDC' | ||
| } | ||
| ], | ||
|
|
||
| usesChangeServer: true, | ||
|
|
||
| // Deprecated: | ||
| defaultSettings: makeEvmDefaultSettings(networkInfo), | ||
| displayName: 'Arc', | ||
| metaTokens: makeMetaTokens(builtinTokens) | ||
| } | ||
|
|
||
| export const arc = makeOuterPlugin< | ||
| EthereumNetworkInfo, | ||
| EthereumTools, | ||
| EthereumInfoPayload | ||
| >({ | ||
| builtinTokens, | ||
| currencyInfo, | ||
| asInfoPayload: asEthereumInfoPayload, | ||
| createTokenId: createEvmTokenId, | ||
| networkInfo, | ||
|
|
||
| async getInnerPlugin() { | ||
| return await import('../EthereumTools') | ||
| } | ||
| }) | ||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.