Skip to content

Commit

Permalink
Merge pull request #4868 from BitGo/COIN-1651-add-script-for-matic-po…
Browse files Browse the repository at this point in the history
…l-migration

chore(root): add script for matic to pol migration
  • Loading branch information
gianchandania committed Sep 2, 2024
2 parents 11863f9 + 663243a commit b293ed9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions examples/ts/eth/getContractDataForPolMigration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Get contract data required for Matic to Pol migration
*
* Copyright 2024, BitGo, Inc. All Rights Reserved.
*/
import * as ethAbi from 'ethereumjs-abi';

// Get data for calling approve method in MaticToken contract
function getApproveCallData() {
// Amount here needs to be replaced with the amount of tokens to be migrated
const data = ethAbi.methodID('approve', [ 'address', 'uint256' ]).toString('hex') + ethAbi.rawEncode([ 'address', 'uint256' ], [ '0x29e7DF7b6A1B2b07b731457f499E1696c60E2C4e', '1000000000000000000' ]).toString('hex')
console.log('Data for calling approve method in MaticToken contract', `0x${data}`);
}

getApproveCallData();

// Get data for calling migrate method in PolygonMigration contract
function getMigrateCallData() {
// Amount here needs to be replaced with the amount of tokens to be migrated
const data = ethAbi.methodID('migrate', [ 'uint256' ]).toString('hex') + ethAbi.rawEncode([ 'uint256' ], [ '1000000000000000000' ]).toString('hex')
console.log('Data for calling migrate method in PolygonMigration contract', `0x${data}`);
}

getMigrateCallData();

0 comments on commit b293ed9

Please sign in to comment.