From 13f6a9fa7de52b92716f2b872f3b136b4bd5b2cf Mon Sep 17 00:00:00 2001 From: KS Date: Mon, 11 Mar 2024 12:34:29 +0300 Subject: [PATCH] fixed typos, added pmm.getContractAddress() method --- README.md | 9 ++++++--- src/Unit/Pmm/index.ts | 8 +++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0d2fa18..9ff3632 100644 --- a/README.md +++ b/README.md @@ -744,7 +744,7 @@ import {simpleFetch} from "simple-typed-fetch"; const secretKey = 'secretKey'; const yourWalletPrivateKey = '0x...'; - const orion = new Orion('testing'); // Leave empty for test environment + const orion = new Orion('testing'); // Leave empty for PROD environment const bsc = orion.getUnit('bsc'); const wallet = new Wallet(yourWalletPrivateKey, bsc.provider); @@ -755,6 +755,9 @@ import {simpleFetch} from "simple-typed-fetch"; // Also you need to allow FRQ contract to spend tokens from your address. // This also can be done only once. await bsc.pmm.setAllowance(assetToAddress.ORN, '1000000000000000000', wallet); + + // Just output the PMM router contract address + console.log('Router contract address: ', await bsc.pmm.getContractAddress()); const rfqOrder = await bsc.aggregator.RFQOrder( assetToAddress.ORN, // Spending asset @@ -774,7 +777,7 @@ import {simpleFetch} from "simple-typed-fetch"; // Send order to blockchain try { - const tx = await bsc.pmm.FillRFQOrder(rfqOrder, wallet); + const tx = await bsc.pmm.fillRFQOrder(rfqOrder, wallet); // If tx.hash is not empty - then transaction was sent to blockchain console.log(tx.hash); @@ -787,7 +790,7 @@ import {simpleFetch} from "simple-typed-fetch"; RFQ order response example description (`rfqOrder` from example above): -```json +``` { quotation: { info: '31545611720730315633520017429', diff --git a/src/Unit/Pmm/index.ts b/src/Unit/Pmm/index.ts index aa35962..cb41136 100644 --- a/src/Unit/Pmm/index.ts +++ b/src/Unit/Pmm/index.ts @@ -16,6 +16,7 @@ export default class Pmm { this.unit = unit; this.provider = unit.provider; this.contractAddress = ''; + // this.contractAddress = '0x89357522c0ed6e557d39dc75290859246077bdfc'; } private isInitialized() : boolean { @@ -29,6 +30,11 @@ export default class Pmm { this.contractAddress = orionPMMRouterContractAddress; } + public async getContractAddress() { + await this.init(); + return this.contractAddress; + } + public async setAllowance(token: string, amount: string, signer: Wallet) { await this.init(); @@ -64,7 +70,7 @@ export default class Pmm { await txResponse.wait(); } - public async FillRFQOrder(order : z.infer, signer: Wallet) { + public async fillRFQOrder(order : z.infer, signer: Wallet) { await this.init(); if(!order.success)