-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asset finance repay redesign #2282
Conversation
PR deployed in Google Cloud |
PR deployed in Google Cloud |
…apps into asset-finance-repay-redesign
…finance-repay-redesign
* Fix max quantity and principal * Update repay boxes * Update external repay form * Update finance forms * Error handling * Transaction summary * Add principal amount * Update principal * Use ids from dropdown * Fix asset list report values * Onchain reserve name * Update type * Fix another type * Change gap
let feeTx = api.tx.poolFees.chargeFee(fee.id, feeAmount.toString()) | ||
return cent.remark | ||
.remark([[{ Loan: [poolId, loanId] }], feeTx], { batch: true }) | ||
.pipe(switchMap((tx) => [wrapProxyCallsForAccount(api, tx, borrower, 'Borrow')])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can just be a map
(without returning as an array, I guess)
totalRepay, | ||
principalAmount, | ||
} | ||
}, [loan, balance, repayForm.values]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint warning about the memo. also useMemo is probably overkill here
} else if (destination === 'other') { | ||
if (!repayForm.values.category) throw new Error('No category selected') | ||
const decreaseDebtTx = api.tx.loans.decreaseDebt(pool.id, loan.id, { internal: principal }) | ||
const categoryHex = Buffer.from(repayForm.values.category).toString('hex') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Buffer is only incidentally available now because we have it polyfilled because of a dependency. Still would rather not rely on it
maxInterest, | ||
totalRepay, | ||
} | ||
}, [loan, balance, repayForm.values]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
positiveNumber(), | ||
max(balance.toNumber(), 'Amount exceeds balance'), | ||
max(debt.toNumber(), 'Amount exceeds outstanding') | ||
nonNegativeNumberNotRequired(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the original positiveNumber
etc. functions were wrong then, if they made the value implicitly required. if the value is required it should be combine(positiveNumber(), required())
to signal it better. Maybe not essential to fix now, but should probably change that sometime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think so too, I didn't want to break every other form on this PR and we're handling errors in the form a bit differently. Will keep in mind for a future refactor
…y, fix lint warnings
Description
This PR redesigns finance/repay flow by integratung transfer debt into finance and repay forms.
#2269
Form variations
Internal non cash assets
Finance
Repay
External oracle assets
Purchase (Finance)
Sell (Repay)
Cash assets
Deposit (Finance)
Withdraw (Repay)
Approvals
Screenshots
Impact