mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-25 14:11:09 +00:00
fix(liquidity): block submit after token resolution failure
This commit is contained in:
@@ -114,6 +114,8 @@ AmmActionCard {
|
||||
&& !root.quoteStale
|
||||
&& !root.submitting
|
||||
&& !root.poolCreationPending
|
||||
&& !root.resolvingToken
|
||||
&& root.tokenResolutionError.length === 0
|
||||
&& root.walletCanSubmit
|
||||
&& (!root.activePool || root.hasActivePoolDepositInput)
|
||||
|
||||
|
||||
@@ -393,6 +393,37 @@ TestCase {
|
||||
compare(amountBInput.tokenInvalid, true)
|
||||
}
|
||||
|
||||
function test_tokenResolutionBlocksStaleQuoteSubmission() {
|
||||
var form = createForm()
|
||||
form.flowState = flowState({
|
||||
"schema": "new-position.v2",
|
||||
"status": "ok",
|
||||
"canSubmit": true,
|
||||
"tokenAId": tokenLow,
|
||||
"tokenBId": tokenHigh,
|
||||
"poolStatus": "active_pool",
|
||||
"quoteHash": "sha256:stale-quote",
|
||||
"reserveARaw": "3",
|
||||
"reserveBRaw": "2000000",
|
||||
"actualAmountARaw": "3",
|
||||
"actualAmountBRaw": "2000000"
|
||||
})
|
||||
form.amountA = "1"
|
||||
form.amountB = "1"
|
||||
wait(0)
|
||||
|
||||
verify(form.canConfirm)
|
||||
|
||||
form.resolveToken("A", tokenThird)
|
||||
compare(form.resolvingTokenId, tokenThird)
|
||||
verify(!form.canConfirm)
|
||||
|
||||
form.failTokenResolution("token_definition_unreadable")
|
||||
compare(form.selectedTokenAId, tokenLow)
|
||||
verify(form.tokenResolutionError.length > 0)
|
||||
verify(!form.canConfirm)
|
||||
}
|
||||
|
||||
function test_staleMissingPoolQuoteDoesNotReplaceDraft() {
|
||||
var quote = {
|
||||
"status": "ok",
|
||||
|
||||
Reference in New Issue
Block a user