From 26e74299ac1cbbf58e373282497d50e0274d1a2b Mon Sep 17 00:00:00 2001 From: JP Angelle <jp@k-f.co> Date: Thu, 31 Aug 2023 14:48:32 -0500 Subject: [PATCH] remove price feed on finance --- .../src/pages/Loan/ExternalFinanceForm.tsx | 22 +++------------- centrifuge-js/src/modules/pools.ts | 25 +++++-------------- 2 files changed, 9 insertions(+), 38 deletions(-) diff --git a/centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx b/centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx index 03a7cea6e0..5925ff4d89 100644 --- a/centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx +++ b/centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx @@ -1,4 +1,4 @@ -import { CurrencyBalance, ExternalPricingInfo, findBalance, Loan as LoanType } from '@centrifuge/centrifuge-js' +import { CurrencyBalance, findBalance, Loan as LoanType } from '@centrifuge/centrifuge-js' import { useBalances, useCentrifugeTransaction } from '@centrifuge/centrifuge-react' import { Box, Button, Card, CurrencyInput, IconInfo, InlineFeedback, Shelf, Stack, Text } from '@centrifuge/fabric' import BN from 'bn.js' @@ -63,14 +63,7 @@ export function ExternalFinanceForm({ loan }: { loan: LoanType }) { const price = CurrencyBalance.fromFloat(values.price, pool.currency.decimals) const faceValue = CurrencyBalance.fromFloat(values.faceValue, 18) - doFinanceTransaction([ - loan.poolId, - loan.id, - faceValue, - price, - (loan.pricing as ExternalPricingInfo).Isin, - account.actingAddress, - ]) + doFinanceTransaction([loan.poolId, loan.id, faceValue, price, account.actingAddress]) actions.setSubmitting(false) }, validateOnMount: true, @@ -88,16 +81,7 @@ export function ExternalFinanceForm({ loan }: { loan: LoanType }) { pool.currency.decimals ) - doRepayTransaction([ - loan.poolId, - loan.id, - quantity, - new BN(0), - new BN(0), - price, - (loan.pricing as ExternalPricingInfo).Isin, - account.actingAddress, - ]) + doRepayTransaction([loan.poolId, loan.id, quantity, new BN(0), new BN(0), price, account.actingAddress]) actions.setSubmitting(false) }, validateOnMount: true, diff --git a/centrifuge-js/src/modules/pools.ts b/centrifuge-js/src/modules/pools.ts index 61cc2a934c..87d3f699d1 100644 --- a/centrifuge-js/src/modules/pools.ts +++ b/centrifuge-js/src/modules/pools.ts @@ -1341,10 +1341,10 @@ export function getPoolsModule(inst: Centrifuge) { } function financeExternalLoan( - args: [poolId: string, loanId: string, quantity: BN, price: BN, isin: string, aoProxy: string], + args: [poolId: string, loanId: string, quantity: BN, price: BN, aoProxy: string], options?: TransactionOptions ) { - const [poolId, loanId, quantity, price, isin, aoProxy] = args + const [poolId, loanId, quantity, price, aoProxy] = args const $api = inst.getApi() return $api.pipe( switchMap((api) => { @@ -1355,9 +1355,7 @@ export function getPoolsModule(inst: Centrifuge) { external: { quantity: quantity.toString(), settlementPrice: price.toString() }, }) ) - const oracleFeedSubmittable = api.tx.priceOracle.feedValues([[{ Isin: isin }, price]]) - const batchSubmittable = api.tx.utility.batchAll([oracleFeedSubmittable, borrowSubmittable]) - return inst.wrapSignAndSend(api, batchSubmittable, options) + return inst.wrapSignAndSend(api, borrowSubmittable, options) }) ) } @@ -1393,19 +1391,10 @@ export function getPoolsModule(inst: Centrifuge) { } function repayExternalLoanPartially( - args: [ - poolId: string, - loanId: string, - quantity: BN, - interest: BN, - unscheduled: BN, - price: BN, - isin: string, - aoProxy: string - ], + args: [poolId: string, loanId: string, quantity: BN, interest: BN, unscheduled: BN, price: BN, aoProxy: string], options?: TransactionOptions ) { - const [poolId, loanId, quantity, interest, unscheduled, price, isin, aoProxy] = args + const [poolId, loanId, quantity, interest, unscheduled, price, aoProxy] = args const $api = inst.getApi() return $api.pipe( @@ -1419,9 +1408,7 @@ export function getPoolsModule(inst: Centrifuge) { unscheduled: unscheduled.toString(), }) ) - const oracleFeedSubmittable = api.tx.priceOracle.feedValues([[{ Isin: isin }, price]]) - const batchSubmittable = api.tx.utility.batchAll([oracleFeedSubmittable, repaySubmittable]) - return inst.wrapSignAndSend(api, batchSubmittable, options) + return inst.wrapSignAndSend(api, repaySubmittable, options) }) ) }