Skip to content

Instantly share code, notes, and snippets.

View anurag-arjun's full-sized avatar

Anurag anurag-arjun

View GitHub Profile
[
{
"constant": true,
"inputs": [],
"name": "childChainContract",
"outputs": [
{
"name": "",
"type": "address"
}
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
@anurag-arjun
anurag-arjun / deposit.js
Created January 10, 2019 11:37
Depositing Funds from Kovan to Matic
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,
@anurag-arjun
anurag-arjun / deposit.js
Created January 10, 2019 11:43
Token address
const token = '0x670568761764f53E6C10cd63b71024c31551c9EC' // test token address
const amount = '10000000000000000' // amount in wei (0.01 TEST)
const from = '0xdcd53258BA8A69C6a505300BE75447A772bFd3d6' // from address
matic.wallet = '0x' + config.PRIVATE_KEY // prefix with `0x`
@anurag-arjun
anurag-arjun / deposit.js
Created January 10, 2019 12:42
Approve tokens to the Matic mainchain contract
// 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.")
},
})
@anurag-arjun
anurag-arjun / deposit.js
Created January 10, 2019 13:07
Move tokens to Matic
// Deposit tokens
matic.
depositTokens(token, from, amount, {
from,
onTransactionHash: () => {
// action on Transaction success
console.log("Tokens deposited from Kovan/Ethereum to Matic.")
},
})
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>'
}