chg: use artifacts and address for pos from meta package
MODIFY
src/common/ContractsBase.ts
src/common/ContractsBase.ts
@@ -4,10 +4,6 @@ import Web3Client from './Web3Client'
import { address } from '../types/Common'
-import posChildERC20Artifact from 'matic-pos-portal/artifacts/ChildERC20.json'
-import posChildERC721Artifact from 'matic-pos-portal/artifacts/ChildERC721.json'
-import posChildERC1155Artifact from 'matic-pos-portal/artifacts/ChildERC1155.json'
-
export default class ContractsBase {
static MATIC_CHILD_TOKEN: address = '0x0000000000000000000000000000000000001010'
@@ -47,16 +43,16 @@ export default class ContractsBase {
public getPOSERC20TokenContract(token: address, parent: boolean = false) {
const web3 = parent ? this.web3Client.parentWeb3 : this.web3Client.web3
- return new web3.eth.Contract(posChildERC20Artifact.abi, token)
+ return new web3.eth.Contract(this.network.abi('ChildERC20', 'pos'), token)
}
public getPOSERC721TokenContract(token: address, parent: boolean = false) {
const web3 = parent ? this.web3Client.parentWeb3 : this.web3Client.web3
- return new web3.eth.Contract(posChildERC721Artifact.abi, token)
+ return new web3.eth.Contract(this.network.abi('ChildERC721', 'pos'), token)
}
public getPOSERC1155TokenContract(token: address, parent: boolean = false) {
const web3 = parent ? this.web3Client.parentWeb3 : this.web3Client.web3
- return new web3.eth.Contract(posChildERC1155Artifact.abi, token)
+ return new web3.eth.Contract(this.network.abi('ChildERC1155', 'pos'), token)
}
}

MODIFY
src/root/POSRootChainManager.ts
src/root/POSRootChainManager.ts
@@ -2,8 +2,6 @@ import BN from 'bn.js'
import Contract from 'web3/eth/contract'
import Web3 from 'web3'
-import RootChainManagerArtifact from 'matic-pos-portal/artifacts/RootChainManager.json'
-
import ContractsBase from '../common/ContractsBase'
import { address, SendOptions, MaticClientInitializationOptions } from '../types/Common'
import Web3Client from '../common/Web3Client'
@@ -30,13 +28,13 @@ export default class POSRootChainManager extends ContractsBase {
constructor(options: MaticClientInitializationOptions, rootChain: RootChain, web3Client: Web3Client) {
super(web3Client, options.network)
this.posRootChainManager = new this.web3Client.parentWeb3.eth.Contract(
- RootChainManagerArtifact.abi,
- options.posRootChainManager
+ options.network.abi('RootChainManager', 'pos'),
+ options.posRootChainManager || options.network.Main.POSContracts.RootChainManagerProxy
)
this.exitManager = new ExitManager(rootChain, options, web3Client)
- this.erc20Predicate = options.posERC20Predicate
- this.erc721Predicate = options.posERC721Predicate
- this.erc1155Predicate = options.posERC1155Predicate
+ this.erc20Predicate = options.posERC20Predicate || options.network.Main.POSContracts.ERC20PredicateProxy
+ this.erc721Predicate = options.posERC721Predicate || options.network.Main.POSContracts.ERC721PredicateProxy
+ this.erc1155Predicate = options.posERC1155Predicate || options.network.Main.POSContracts.ERC1155PredicateProxy
}
async depositEtherForUser(amount: BN | string, user: address, options: SendOptions = {}) {

chg: use artifacts and address for pos from meta package