Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,41 @@ describe('Eth Transaction builder flush tokens (ETH-specific)', function () {
txJson.data.should.startWith(flushForwarderTokensMethodIdV4);
});

it('a SUSHI token flush from v4 forwarder with EIP-1559 fees', async () => {
// SUSHI mainnet contract: 0x6b3595068778dd592e39a122f4f5a5cf09c90fe2
// For v4 forwarder, contractAddress must equal forwarderAddress
const sushiContractAddress = '0x6b3595068778dd592e39a122f4f5a5cf09c90fe2';
const v4ForwarderAddress = '0x53b8e91bb3b8f618b5f01004ef108f134f219573';

const tx = await buildTransaction({
fee: {
fee: '30',
eip1559: {
maxPriorityFeePerGas: '2000000000',
maxFeePerGas: '30000000000',
},
gasLimit: '100000',
},
counter: 1,
forwarderAddress: v4ForwarderAddress,
tokenAddress: sushiContractAddress,
contractAddress: v4ForwarderAddress,
forwarderVersion: 4,
});

tx.type.should.equal(TransactionType.FlushTokens);
const txJson = tx.toJson();
txJson.gasLimit.should.equal('100000');
txJson._type.should.equals(ETHTransactionType.EIP1559);
txJson.maxFeePerGas!.should.equal('30000000000');
txJson.maxPriorityFeePerGas!.should.equal('2000000000');
txJson.to!.should.equal(v4ForwarderAddress);
should.equal(txJson.nonce, 1);
txJson.data.should.startWith(flushForwarderTokensMethodIdV4);
// Verify SUSHI contract address is encoded in calldata
txJson.data.should.containEql(sushiContractAddress.slice(2).toLowerCase());
});

it('decode wallet flush forwarder transaction with forwarder Version 4', async () => {
const tx = await buildTransaction({
fee: {
Expand Down
6 changes: 5 additions & 1 deletion modules/statics/src/coinFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,11 @@ export const POLYX_TOKEN_FEATURES = [
CoinFeature.TOKEN_STANDARD_USES_ALTERNATIVE_ADDRESS_IDENTIFIER,
];

export const ETH_FEATURES_WITH_FRANKFURT = [...ETH_FEATURES, CoinFeature.CUSTODY_BITGO_FRANKFURT];
export const ETH_FEATURES_WITH_FRANKFURT = [
...ETH_FEATURES,
CoinFeature.CUSTODY_BITGO_FRANKFURT,
CoinFeature.EIP1559,
];
export const ETH_FEATURES_WITH_GERMANY = [...ETH_FEATURES, CoinFeature.CUSTODY_BITGO_GERMANY];
export const ETH_FEATURES_WITH_FRANKFURT_GERMANY = [...ETH_FEATURES_WITH_FRANKFURT, CoinFeature.CUSTODY_BITGO_GERMANY];
export const SOL_TOKEN_FEATURES_WITH_FRANKFURT = [
Expand Down
1 change: 1 addition & 0 deletions modules/statics/test/unit/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,7 @@ describe('Eip1559 coins', () => {
'toas',
'coredao',
'tcoredao',
'sushi',
];
it('should have EIP1559 feature', () => {
eip1559Coins.forEach((coinName) => {
Expand Down
Loading