Skip to content

Instantly share code, notes, and snippets.

@alexytiger
Created July 10, 2019 00:09
Show Gist options
  • Save alexytiger/27623a240a8f21795e0d10ee5462cf02 to your computer and use it in GitHub Desktop.
Save alexytiger/27623a240a8f21795e0d10ee5462cf02 to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { Contract } from 'ethers';
import { Provider } from '../../../core/services/tokens';
import { P2pBazaarAnchorModule } from '../../p2p-bazaar.anchor.module';
import { environment } from 'src/environments/environment'
const FLEA_MARKET_CONTRACT_ADDRESS = environment.fleaMarketContractAddress;
const abi = [
'event logNewPurchaseContract(address contractAddress)',
'function createPurchaseContract(bytes32 key, string title, string ipfsHash) payable returns(bool createResult)',
'function getContractCount() view returns(uint contractCount)',
'function getContractKeyAtIndex(uint index) public view returns(bytes32 key)',
'function getContractByKey(bytes32 key) view returns(address contractAddress)'
];
@Injectable({ providedIn: P2pBazaarAnchorModule })
export class FleaMarketContractToken extends Contract {
constructor(provider: Provider) {
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