This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "childChainContract", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "address" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "name", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "string" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Matic = require('maticjs').default | |
const config = require('./config') | |
const token = '0x670568761764f53E6C10cd63b71024c31551c9EC' // test token address | |
const amount = '10000000000000000' // amount in wei (0.01 TEST) | |
const from = '0xdcd53258BA8A69C6a505300BE75447A772bFd3d6' // from address | |
// Create object of Matic | |
const matic = new Matic({ | |
maticProvider: config.MATIC_PROVIDER, | |
parentProvider: config.PARENT_PROVIDER, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const token = '0x670568761764f53E6C10cd63b71024c31551c9EC' // test token address |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const amount = '10000000000000000' // amount in wei (0.01 TEST) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const from = '0xdcd53258BA8A69C6a505300BE75447A772bFd3d6' // from address |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matic.wallet = '0x' + config.PRIVATE_KEY // prefix with `0x` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Approve token from your account to the Matic contracts | |
matic | |
.approveTokensForDeposit(token, amount, { | |
from, | |
onTransactionHash: () => { | |
// action on Transaction success | |
console.log("Deposit Tokens from Kovan/Ethereum to Matic - Transaction Approved.") | |
}, | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Deposit tokens | |
matic. | |
depositTokens(token, from, amount, { | |
from, | |
onTransactionHash: () => { | |
// action on Transaction success | |
console.log("Tokens deposited from Kovan/Ethereum to Matic.") | |
}, | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
MATIC_PROVIDER: 'https://testnet.matic.network', | |
PARENT_PROVIDER: 'https://kovan.infura.io/matic', | |
ROOTCHAIN_ADDRESS: '0x24e01716a6ac34d5f2c4c082f553d86a557543a7', | |
SYNCER_URL: 'https://eth-syncer.api.matic.network/api/v1', | |
WATCHER_URL: 'https://eth-watcher.api.matic.network/api/v1', | |
MATICWETH_ADDRESS: '0xeD3CAFb4dCf835E7a1D2E3169F8D296f931b4aA7', | |
PRIVATE_KEY: '<insert-your-private-key-here>' | |
} |
OlderNewer