Last active
January 18, 2020 04:46
-
-
Save alexytiger/4e252994d056f1c035b8f94e51356d5b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import { Injectable } from '@angular/core'; | |
import { Contract } from 'ethers'; | |
import { EthersWeb3Provider } from '../../../core/services/ethers-web3-provider'; | |
import { MarketPlaceAnchorModule } from '../../market-place-anchor.module'; | |
import { environment } from 'src/environments/environment'; | |
const FLEA_MARKET_CONTRACT_ADDRESS = environment.fleaMarketContractAddress; | |
const abi = [ | |
'event LogCreatePurchaseContract(address sender, address contractAddress)', | |
'event LogRemovePurchaseContract(address sender, bytes32 key)', | |
'function createPurchaseContract(bytes32 key, string description, string ipfsImageHash, uint256 commissionRate) payable returns(bool createResult)', | |
'function getContractCount() view returns(uint contractCount)', | |
'function getContractKeyAtIndex(uint index) view returns(bytes32 key)', | |
'function getContractByKey(bytes32 key) view returns(address contractAddress)', | |
'function contractName() view returns(string contractName)', | |
'function removeContractByKey(bytes32 key) returns(bool result)' | |
]; | |
@Injectable({ providedIn: MarketPlaceAnchorModule }) | |
export class FleaMarketContractToken extends Contract { | |
constructor(provider: EthersWeb3Provider) { | |
super(FLEA_MARKET_CONTRACT_ADDRESS, abi, provider.getSigner()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment