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

chore: release v1.616.0 #7139

Merged
merged 4 commits into from
Jun 17, 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
1 change: 1 addition & 0 deletions .env.base
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ REACT_APP_FEATURE_READ_ONLY_ASSETS=true
# swapper feature flags - other .env files will override these
REACT_APP_FEATURE_COWSWAP=true
REACT_APP_FEATURE_COWSWAP_GNOSIS=true
REACT_APP_FEATURE_COWSWAP_ARBITRUM=false
REACT_APP_FEATURE_LIFI_SWAP=true
REACT_APP_FEATURE_ONE_INCH=false
REACT_APP_FEATURE_THOR_SWAP=true
Expand Down
1 change: 1 addition & 0 deletions .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
REACT_APP_FEATURE_RFOX=true
REACT_APP_FEATURE_RFOX_REWARDS_TAB=true
REACT_APP_FEATURE_ARBITRUM_BRIDGE=true
REACT_APP_FEATURE_COWSWAP_ARBITRUM=true

# logging
REACT_APP_REDUX_WINDOW=false
Expand Down
1 change: 1 addition & 0 deletions .env.develop
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ REACT_APP_FEATURE_CHATWOOT=true
REACT_APP_FEATURE_RFOX=true
REACT_APP_FEATURE_RFOX_REWARDS_TAB=true
REACT_APP_FEATURE_ARBITRUM_BRIDGE=true
REACT_APP_FEATURE_COWSWAP_ARBITRUM=true

# mixpanel
REACT_APP_MIXPANEL_TOKEN=1c1369f6ea23a6404bac41b42817cc4b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@ import type { Trade, Transfer } from '../../../../types'
import { Dex, TradeType, TransferType, TxStatus } from '../../../../types'
import type { ParsedTx } from '../../../parser'
import { V1Api } from '../../index'
import { TransactionParser, ZRX_ARBITRUM_PROXY_CONTRACT } from '../index'
import {
RFOX_PROXY_CONTRACT_ADDRESS,
TransactionParser,
ZRX_ARBITRUM_PROXY_CONTRACT,
} from '../index'
import erc20Approve from './mockData/erc20Approve'
import erc721 from './mockData/erc721'
import erc1155 from './mockData/erc1155'
import ethSelfSend from './mockData/ethSelfSend'
import ethStandard from './mockData/ethStandard'
import { usdcToken } from './mockData/tokens'
import rfoxSetRuneAddress from './mockData/rfoxSetRuneAddress'
import rfoxStake from './mockData/rfoxStake'
import rfoxUnstake from './mockData/rfoxUnstake'
import rfoxWithdraw from './mockData/rfoxWithdraw'
import { foxToken, usdcToken } from './mockData/tokens'
import tokenSelfSend from './mockData/tokenSelfSend'
import tokenStandard from './mockData/tokenStandard'
import zrxTradeEthToUsdc from './mockData/zrxTradeEthToUsdc'
Expand Down Expand Up @@ -878,4 +886,150 @@ describe('parseTx', () => {
expect(actual).toEqual(expected)
})
})

describe('rfox', () => {
it('should be able to stake', async () => {
const { tx } = rfoxStake
const address = '0x5daF465a9cCf64DEB146eEaE9E7Bd40d6761c986'

const expected: ParsedTx = {
txid: tx.txid,
blockHeight: tx.blockHeight,
blockTime: tx.timestamp,
blockHash: tx.blockHash,
address,
chainId: arbitrumChainId,
confirmations: tx.confirmations,
fee: {
assetId: arbitrumAssetId,
value: '3013123887600',
},
data: {
method: 'stake',
parser: 'rfox',
assetId: 'eip155:42161/erc20:0xf929de51d91c77e42f5090069e0ad7a09e513c73',
runeAddress: 'thor125dwsa39yeylqc7pn59l079dur502nsleyrgup',
},
status: TxStatus.Confirmed,
transfers: [
{
assetId: 'eip155:42161/erc20:0xf929de51d91c77e42f5090069e0ad7a09e513c73',
components: [{ value: '1000000000000000000' }],
from: address,
to: RFOX_PROXY_CONTRACT_ADDRESS,
token: foxToken,
totalValue: '1000000000000000000',
type: TransferType.Send,
},
],
}

const actual = await txParser.parse(tx, address)

expect(actual).toEqual(expected)
})

it('should be able to unstake', async () => {
const { tx } = rfoxUnstake
const address = '0x5daF465a9cCf64DEB146eEaE9E7Bd40d6761c986'

const expected: ParsedTx = {
txid: tx.txid,
blockHeight: tx.blockHeight,
blockTime: tx.timestamp,
blockHash: tx.blockHash,
address,
chainId: arbitrumChainId,
confirmations: tx.confirmations,
fee: {
assetId: arbitrumAssetId,
value: '44360779710690',
},
data: {
method: 'unstakeRequest',
parser: 'rfox',
assetId: 'eip155:42161/erc20:0xf929de51d91c77e42f5090069e0ad7a09e513c73',
value: '3273624096679687500',
},
status: TxStatus.Confirmed,
transfers: [],
}

const actual = await txParser.parse(tx, address)

expect(actual).toEqual(expected)
})

it('should be able to withdraw claim', async () => {
const { tx } = rfoxWithdraw
const address = '0x5daF465a9cCf64DEB146eEaE9E7Bd40d6761c986'

const expected: ParsedTx = {
txid: tx.txid,
blockHeight: tx.blockHeight,
blockTime: tx.timestamp,
blockHash: tx.blockHash,
address,
chainId: arbitrumChainId,
confirmations: tx.confirmations,
fee: {
assetId: arbitrumAssetId,
value: '41698790000000',
},
data: {
method: 'withdraw',
parser: 'rfox',
assetId: 'eip155:42161/erc20:0xf929de51d91c77e42f5090069e0ad7a09e513c73',
claimIndex: 0,
},
status: TxStatus.Confirmed,
transfers: [
{
assetId: 'eip155:42161/erc20:0xf929de51d91c77e42f5090069e0ad7a09e513c73',
components: [{ value: '4364832128906250000' }],
from: RFOX_PROXY_CONTRACT_ADDRESS,
to: address,
token: foxToken,
totalValue: '4364832128906250000',
type: TransferType.Receive,
},
],
}

const actual = await txParser.parse(tx, address)

expect(actual).toEqual(expected)
})

it('should be able to set RUNE address', async () => {
const { tx } = rfoxSetRuneAddress
const address = '0x5daF465a9cCf64DEB146eEaE9E7Bd40d6761c986'

const expected: ParsedTx = {
txid: tx.txid,
blockHeight: tx.blockHeight,
blockTime: tx.timestamp,
blockHash: tx.blockHash,
address,
chainId: arbitrumChainId,
confirmations: tx.confirmations,
fee: {
assetId: arbitrumAssetId,
value: '39355169490000',
},
data: {
method: 'setRuneAddress',
parser: 'rfox',
assetId: 'eip155:42161/erc20:0xf929de51d91c77e42f5090069e0ad7a09e513c73',
runeAddress: 'thor1clpczglrkrvdq9xtcsmj9a8ayrjeet2llcqufl',
},
status: TxStatus.Confirmed,
transfers: [],
}

const actual = await txParser.parse(tx, address)

expect(actual).toEqual(expected)
})
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Tx } from '../../../..'

const tx: Tx = {
txid: '0x0145c782916e9e8683caac3b24c6c93a22b738cd2e019d7c43cd3d60c82e6b9b',
blockHash: '0x76787a0a3d5b6a43a308b828b58edb841d13b6671f366ad1308fb7bdaaf5cc6a',
blockHeight: 221516124,
timestamp: 1718305602,
status: 1,
from: '0x5daF465a9cCf64DEB146eEaE9E7Bd40d6761c986',
to: '0xd612B64A134f3D4830542B7463CE8ca8a29D7268',
confirmations: 303953,
value: '0',
fee: '39355169490000',
gasLimit: '145286',
gasUsed: '126711',
gasPrice: '310590000',
inputData:
'0xf6d0b2ed0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002b74686f7231636c70637a676c726b7276647139787463736d6a3961386179726a656574326c6c637175666c000000000000000000000000000000000000000000',
internalTxs: [],
}

export default { tx }
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type { Tx } from '../../../..'

const tx: Tx = {
txid: '0x38532538617c6db07af876e0fbe070526e549d0d48cd5c73b67fad0bc5551fd2',
blockHash: '0x54a56f8a3162328adfc8c7c796aa6bce78d2c21dcca9fd2d18cf1938014c243b',
blockHeight: 221776349,
timestamp: 1718370601,
status: 1,
from: '0x5daF465a9cCf64DEB146eEaE9E7Bd40d6761c986',
to: '0xd612B64A134f3D4830542B7463CE8ca8a29D7268',
confirmations: 41943,
value: '0',
fee: '3013123887600',
gasLimit: '236001',
gasUsed: '205844',
gasPrice: '14637900',
inputData:
'0xe7e4e1f70000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002b74686f723132356477736133397965796c716337706e35396c3037396475723530326e736c657972677570000000000000000000000000000000000000000000',
tokenTransfers: [
{
contract: '0xf929de51D91C77E42f5090069E0AD7A09e513c73',
decimals: 18,
name: 'FOX',
symbol: 'FOX',
type: 'ERC20',
from: '0x5daF465a9cCf64DEB146eEaE9E7Bd40d6761c986',
to: '0xd612B64A134f3D4830542B7463CE8ca8a29D7268',
value: '1000000000000000000',
},
],
internalTxs: [],
}

export default { tx }
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Tx } from '../../../..'

const tx: Tx = {
txid: '0x971e268f63572aee723b2ecd1a08aa8cdb873927fba6fc55146516bc26fc319a',
blockHash: '0x086aa823ff9e888ab8d7c3026a45de90f5a0df69fdb78ebd8b35868573387dbc',
blockHeight: 221510033,
timestamp: 1718304084,
status: 1,
from: '0x5daF465a9cCf64DEB146eEaE9E7Bd40d6761c986',
to: '0xd612B64A134f3D4830542B7463CE8ca8a29D7268',
confirmations: 309306,
value: '0',
fee: '44360779710690',
gasLimit: '234173',
gasUsed: '210690',
gasPrice: '210550001',
inputData: '0x2e17de780000000000000000000000000000000000000000000000002d6e3fc582c0754c',
internalTxs: [],
}

export default { tx }
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { Tx } from '../../../..'

const tx: Tx = {
txid: '0x6f800e60876460c749e8a9e6dbccd4d166ffc8243a9a63c0c323327ab9764d81',
blockHash: '0x34e3fdfac2e0780254ab3e1f10135bfd2097402c472862a00305b609d65cf4f5',
blockHeight: 221510152,
timestamp: 1718304113,
status: 1,
from: '0x5daF465a9cCf64DEB146eEaE9E7Bd40d6761c986',
to: '0xd612B64A134f3D4830542B7463CE8ca8a29D7268',
confirmations: 309455,
value: '0',
fee: '41698790000000',
gasLimit: '195355',
gasUsed: '159460',
gasPrice: '261500000',
inputData: '0x2e1a7d4d0000000000000000000000000000000000000000000000000000000000000000',
tokenTransfers: [
{
contract: '0xf929de51D91C77E42f5090069E0AD7A09e513c73',
decimals: 18,
name: 'FOX',
symbol: 'FOX',
type: 'ERC20',
from: '0xd612B64A134f3D4830542B7463CE8ca8a29D7268',
to: '0x5daF465a9cCf64DEB146eEaE9E7Bd40d6761c986',
value: '4364832128906250000',
},
],
internalTxs: [],
}

export default { tx }
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ export const usdcToken: Token = {
name: 'USD Coin',
symbol: 'USDC',
}

export const foxToken: Token = {
contract: '0xf929de51D91C77E42f5090069E0AD7A09e513c73',
decimals: 18,
name: 'FOX',
symbol: 'FOX',
}
8 changes: 8 additions & 0 deletions packages/unchained-client/src/evm/arbitrum/parser/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { foxOnArbitrumOneAssetId } from '@shapeshiftoss/caip'

import type { Tx } from '../../../generated/arbitrum'
import type { BaseTransactionParserArgs } from '../../parser'
import { BaseTransactionParser } from '../../parser'
import * as erc20 from '../../parser/erc20'
import * as nft from '../../parser/nft'
import * as rfox from '../../parser/rfox'
import * as zrx from '../../parser/zrx'

export const ZRX_ARBITRUM_PROXY_CONTRACT = '0xDef1C0ded9bec7F1a1670819833240f027b25EfF'
export const RFOX_PROXY_CONTRACT_ADDRESS = '0xd612B64A134f3D4830542B7463CE8ca8a29D7268'

export class TransactionParser extends BaseTransactionParser<Tx> {
constructor(args: BaseTransactionParserArgs) {
Expand All @@ -19,6 +23,10 @@ export class TransactionParser extends BaseTransactionParser<Tx> {
}),
new erc20.Parser({ chainId: this.chainId, provider: this.provider }),
new zrx.Parser({ proxyContract: ZRX_ARBITRUM_PROXY_CONTRACT }),
new rfox.Parser({
proxyContract: RFOX_PROXY_CONTRACT_ADDRESS,
stakingAssetId: foxOnArbitrumOneAssetId,
}),
])
}
}
Loading
Loading