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
1,759 changes: 504 additions & 1,255 deletions packages/frontend/src/constants/abis/ArcherSwapRouter.json

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions packages/frontend/src/constants/abis/argent-wallet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "_transactions",
"type": "tuple[]"
}
],
"name": "wc_multiCall",
"outputs": [
{
"internalType": "bytes[]",
"name": "",
"type": "bytes[]"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "_msgHash",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "_signature",
"type": "bytes"
}
],
"name": "isValidSignature",
"outputs": [
{
"internalType": "bytes4",
"name": "",
"type": "bytes4"
}
],
"stateMutability": "view",
"type": "function"
}
]
11 changes: 9 additions & 2 deletions packages/frontend/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { AbstractConnector } from '@web3-react/abstract-connector'
import { fortmatic, injected, portis, walletconnect, walletlink } from '../connectors'

export const ARCHER_ROUTER_ADDRESS: { [chainId in ChainId]?: string } = {
[ChainId.MAINNET]: '0x87535b160E251167FB7abE239d2467d1127219E4',
[ChainId.MAINNET]: '0x9917C083FF9FbD29Df1367FBF7F2388A9a202431',
[ChainId.RINKEBY]: '0x21323080D91dD77c420be7775Bf5C33d21Dcc8Fc'
}

export const ARCHER_RELAY_URI: { [chainId in ChainId]?: string } = {
[ChainId.MAINNET]: 'https://api.archerdao.io/v1/transaction'
[ChainId.MAINNET]: 'https://api.edennetwork.io/v1/transaction'
}

export const UNISWAP_ROUTER_ADDRESS = '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D'
Expand Down Expand Up @@ -254,3 +254,10 @@ export const BLOCKED_ADDRESSES: string[] = [
'0xA7e5d5A720f06526557c513402f2e6B5fA20b008',
'0x8576aCC5C05D6Ce88f4e49bf65BdF0C62F91353C'
]


export const EIP_1559_ACTIVATION_BLOCK: { [chainId in ChainId]?: number } = {
[ChainId.ROPSTEN]: 10499401,
[ChainId.GÖRLI]: 5062605,
[ChainId.RINKEBY]: 8897988,
}
6 changes: 5 additions & 1 deletion packages/frontend/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ import { injected } from '../connectors'
import { NetworkContextName } from '../constants'

export function useActiveWeb3React(): Web3ReactContextInterface<Web3Provider> & { chainId?: ChainId } {
// replace with address to impersonate
const impersonate = false
const context = useWeb3ReactCore<Web3Provider>()
const contextNetwork = useWeb3ReactCore<Web3Provider>(NetworkContextName)
return context.active ? context : contextNetwork
return context.active
? { ...context, account: impersonate || context.account }
: { ...contextNetwork, account: impersonate || contextNetwork.account }
}

export function useEagerConnect() {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/hooks/useArcherMinerTips.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';

const ARCHER_GAS_URL = "https://api.archerdao.io/v1/gas";
const ARCHER_GAS_URL = "https://api.edennetwork.io/v1/gas";
type T = Record<string, string>;

export default function useFetchArcherMinerTips(): { status: string, data: T } {
Expand Down
12 changes: 12 additions & 0 deletions packages/frontend/src/hooks/useArgentWalletContract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import ARGENT_WALLET_ABI from '../constants/abis/argent-wallet.json'

import { Contract } from '@ethersproject/contracts'
import { useActiveWeb3React } from './index'
import { useContract } from './useContract'
import useIsArgentWallet from './useIsArgentWallet'

export function useArgentWalletContract(): Contract | null {
const { account } = useActiveWeb3React()
const isArgentWallet = useIsArgentWallet()
return useContract(isArgentWallet ? account ?? undefined : undefined, ARGENT_WALLET_ABI, true)
}
4 changes: 2 additions & 2 deletions packages/frontend/src/hooks/useContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { getContract } from '../utils'
import { useActiveWeb3React } from './index'

// returns null on errors
function useContract(address: string | undefined, ABI: any, withSignerIfPossible = true): Contract | null {
export function useContract(address: string | undefined, ABI: any, withSignerIfPossible = true): Contract | null {
const { library, account } = useActiveWeb3React()

return useMemo(() => {
Expand Down Expand Up @@ -127,4 +127,4 @@ export function useSocksController(): Contract | null {
UNISOCKS_ABI,
false
)
}
}
27 changes: 27 additions & 0 deletions packages/frontend/src/hooks/useERC20Permit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
enum PermitType {
AMOUNT = 1,
ALLOWED = 2,
}

interface BaseSignatureData {
v: number
r: string
s: string
deadline: number
nonce: number
owner: string
spender: string
chainId: number
tokenAddress: string
permitType: PermitType
}

export interface StandardSignatureData extends BaseSignatureData {
amount: string
}

export interface AllowedSignatureData extends BaseSignatureData {
allowed: true
}

export type SignatureData = StandardSignatureData | AllowedSignatureData
Loading