From 8dd110765f63010ad97a4063e5d653824f91c7d6 Mon Sep 17 00:00:00 2001 From: Eric Mastro Date: Tue, 13 Sep 2022 16:33:04 +1000 Subject: [PATCH] [marketplace] Catch slot empty, return default values --- codex/contracts/proofs.nim | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/codex/contracts/proofs.nim b/codex/contracts/proofs.nim index 81ee8b68..2b40fb51 100644 --- a/codex/contracts/proofs.nim +++ b/codex/contracts/proofs.nim @@ -24,15 +24,24 @@ method periodicity*(proofs: OnChainProofs): Future[Periodicity] {.async.} = method isProofRequired*(proofs: OnChainProofs, id: SlotId): Future[bool] {.async.} = - return await proofs.storage.isProofRequired(id) + try: + return await proofs.storage.isProofRequired(id) + except ValueError: + return false method willProofBeRequired*(proofs: OnChainProofs, id: SlotId): Future[bool] {.async.} = - return await proofs.storage.willProofBeRequired(id) + try: + return await proofs.storage.willProofBeRequired(id) + except ValueError: + return false method getProofEnd*(proofs: OnChainProofs, id: SlotId): Future[UInt256] {.async.} = - return await proofs.storage.proofEnd(id) + try: + return await proofs.storage.proofEnd(id) + except ValueError: + return 0.u256 method submitProof*(proofs: OnChainProofs, id: SlotId,