Skip to content

Commit

Permalink
feat(statics): add polygon amoy testnet
Browse files Browse the repository at this point in the history
WIN-2819
TICKET: WIN-2819

This PR is adding polygon amoy testnet
  • Loading branch information
gianchandania committed Apr 18, 2024
1 parent 5d13956 commit 6d4338b
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 26 deletions.
12 changes: 8 additions & 4 deletions modules/sdk-coin-polygon/src/lib/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ import EthereumCommon from '@ethereumjs/common';
/**
* A Common object defining the chain and the hardfork for Polygon Testnet
*/
export const testnetCommon = EthereumCommon.forCustomChain(
'goerli',

export const testnetCommon = EthereumCommon.custom(
{
name: 'mumbai',
name: 'polygon amoy testnet',
networkId: (coins.get('tpolygon').network as EthereumNetwork).chainId,
chainId: (coins.get('tpolygon').network as EthereumNetwork).chainId,
},
'london'
{
baseChain: 'sepolia',
hardfork: 'london',
eips: [1559],
}
);

/**
Expand Down
12 changes: 6 additions & 6 deletions modules/sdk-coin-polygon/test/resources.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions modules/sdk-coin-polygon/test/unit/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ describe('Polygon', function () {
gasPrice: 20000000000,
gasLimit: 500000,
replayProtectionOptions: {
chain: 80001,
chain: 80002,
hardfork: 'london',
},
};
Expand Down Expand Up @@ -737,7 +737,7 @@ describe('Polygon', function () {
walletContractAddress: walletContractAddress,
recoveryDestination: TestBitGo.V2.TEST_ERC20_TOKEN_RECIPIENT as string,
eip1559: { maxFeePerGas: 20000000000, maxPriorityFeePerGas: 10000000000 },
replayProtectionOptions: { chain: 80001, hardfork: 'london' },
replayProtectionOptions: { chain: 80002, hardfork: 'london' },
gasLimit: 500000,
})) as OfflineVaultTxInfo;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Eth address initialization', () => {
txBuilder.sign({ key: testData.KEYPAIR_PRV.getKeys().prv });
const tx = await txBuilder.build();
const txJson = tx.toJson();
should.equal(txJson.deployedAddress, '0x96bbdd57fe67f5d5d86c06ba5f205c8793f2e162');
should.equal(txJson.deployedAddress, '0xde4133877caa961ff30caf3373c5a2f9e9cd31b2');
should.equal(txJson.to, testData.FORWARDER_FACTORY_ADDRESS);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Polygon wallet initialization', function () {
txJson.gasLimit.should.equal('6800000');
txJson.gasPrice.should.equal('10000000000');
should.equal(txJson.nonce, 1);
should.equal(txJson.chainId, '0x13881');
should.equal(txJson.chainId, '0x13882');
should.equal(tx.toBroadcastFormat(), testData.TX_BROADCAST);
});

Expand All @@ -45,7 +45,7 @@ describe('Polygon wallet initialization', function () {
newTxBuilder.from(testData.TX_BROADCAST);
const newTx = await newTxBuilder.build();
should.equal(newTx.toBroadcastFormat(), testData.TX_BROADCAST);
should.equal(newTx.id, '0x400357e2d5fdbcd16ee09cb484b7e20d87ebea9b0d92935f1ed0566b6e8d44c6');
should.equal(newTx.id, '0x9c955e671f05f8e4e909757675f535bdbcdb95cc66fbb4e897146dec20383303');
const txJson = newTx.toJson();
should.exist(txJson.v);
should.exist(txJson.r);
Expand All @@ -67,7 +67,7 @@ describe('Polygon wallet initialization', function () {
txJson.gasLimit.should.equal('6800000');
txJson.gasPrice.should.equal('10000000000');
should.equal(txJson.nonce, 0);
should.equal(txJson.chainId, '0x13881');
should.equal(txJson.chainId, '0x13882');
});

it('an unsigned init transaction from serialized with 0-prefixed address', async () => {
Expand Down Expand Up @@ -104,7 +104,7 @@ describe('Polygon wallet initialization', function () {
txBuilder.owner('0x78caeb4527170e52f54d936e4eef6f83250e01bb');
txBuilder.owner('0xb1938215967408fff7c59c77ae5e5283b55c8e26');
const tx = await txBuilder.build();
should.equal(tx.toJson().v, '0x027125');
should.equal(tx.toJson().v, '0x027127');
});

it('wallet deployment transaction for recovery', async () => {
Expand Down
2 changes: 1 addition & 1 deletion modules/statics/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,7 @@ export function polygonErc20(
}

/**
* Factory function for Mumbai testnet polygonErc20 token instances.
* Factory function for Amoy testnet polygonErc20 token instances.
*
* @param id uuid v4
* @param name unique identifier of the token
Expand Down
2 changes: 1 addition & 1 deletion modules/statics/src/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class CoinMap {
5: 'gteth',
17000: 'hteth',
10001: 'ethw',
80001: 'tpolygon',
80002: 'tpolygon',
137: 'polygon',
56: 'bsc',
97: 'tbsc',
Expand Down
14 changes: 7 additions & 7 deletions modules/statics/src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -913,13 +913,13 @@ class Polygon extends Mainnet implements EthereumNetwork {
class PolygonTestnet extends Testnet implements EthereumNetwork {
name = 'PolygonTestnet';
family = CoinFamily.POLYGON;
explorerUrl = 'https://mumbai.polygonscan.com/tx/';
accountExplorerUrl = 'https://mumbai.polygonscan.com/address/';
chainId = 80001;
forwarderFactoryAddress = '0x7d10cfdcb763375fb5f0a0e9101f490f0bf1b43a';
forwarderImplementationAddress = '0xaa2216d72d7c149dfe4c3dd2154cd00994216506';
walletFactoryAddress = '0xe37c07faec87be075ce4002b5fedbde00a4fe9d5';
walletImplementationAddress = '0x11f8d70a4ee9d0962bb1160d776d4a996cfdff40';
explorerUrl = 'https://amoy.polygonscan.com/tx/';
accountExplorerUrl = 'https://amoy.polygonscan.com/address/';
chainId = 80002;
forwarderFactoryAddress = '0x23223fd7cfc5f34b20f38ebb9a489e1ff3c084d1';
forwarderImplementationAddress = '0xd4c24325b5ef514fbb1ecc76a9bb4dcb57a8341e';
walletFactoryAddress = '0xe9c16033e01bf9f94bf9f99fc0fefcfb8b124992';
walletImplementationAddress = '0xf8360c213e4f44cce03e48cb9281254de2a7a566';
batcherContractAddress = '0xcdf01a31ea2a1d62951aac3a5743c4416f9da3fb';
nativeCoinOperationHashPrefix = 'POLYGON';
tokenOperationHashPrefix = 'POLYGON-ERC20';
Expand Down

0 comments on commit 6d4338b

Please sign in to comment.