From abecadcbf70fc216e670cb1b92bfb1b024ba17fe Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Sun, 10 Nov 2024 15:27:56 +0100 Subject: [PATCH] use .confirm(1) instead of confirm(0) confirm(0) doesn't wait at all, confirm(1) waits for the transaction to be mined --- codex/contracts/market.nim | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/codex/contracts/market.nim b/codex/contracts/market.nim index b8d1da68..fdddcb22 100644 --- a/codex/contracts/market.nim +++ b/codex/contracts/market.nim @@ -53,7 +53,7 @@ proc approveFunds(market: OnChainMarket, amount: UInt256) {.async.} = convertEthersError: let tokenAddress = await market.contract.token() let token = Erc20Token.new(tokenAddress, market.signer) - discard await token.increaseAllowance(market.contract.address(), amount).confirm(0) + discard await token.increaseAllowance(market.contract.address(), amount).confirm(1) method getZkeyHash*(market: OnChainMarket): Future[?string] {.async.} = let config = await market.contract.configuration() @@ -99,7 +99,7 @@ method requestStorage(market: OnChainMarket, request: StorageRequest){.async.} = convertEthersError: debug "Requesting storage" await market.approveFunds(request.price()) - discard await market.contract.requestStorage(request).confirm(0) + discard await market.contract.requestStorage(request).confirm(1) method getRequest(market: OnChainMarket, id: RequestId): Future[?StorageRequest] {.async.} = @@ -171,7 +171,7 @@ method fillSlot(market: OnChainMarket, await market.approveFunds(collateral) trace "calling fillSlot on contract" - discard await market.contract.fillSlot(requestId, slotIndex, proof).confirm(0) + discard await market.contract.fillSlot(requestId, slotIndex, proof).confirm(1) trace "fillSlot transaction completed" method freeSlot*(market: OnChainMarket, slotId: SlotId) {.async.} = @@ -191,13 +191,13 @@ method freeSlot*(market: OnChainMarket, slotId: SlotId) {.async.} = # recipient (the contract will use msg.sender for both) freeSlot = market.contract.freeSlot(slotId) - discard await freeSlot.confirm(0) + discard await freeSlot.confirm(1) method withdrawFunds(market: OnChainMarket, requestId: RequestId) {.async.} = convertEthersError: - discard await market.contract.withdrawFunds(requestId).confirm(0) + discard await market.contract.withdrawFunds(requestId).confirm(1) method isProofRequired*(market: OnChainMarket, id: SlotId): Future[bool] {.async.} = @@ -230,13 +230,13 @@ method submitProof*(market: OnChainMarket, id: SlotId, proof: Groth16Proof) {.async.} = convertEthersError: - discard await market.contract.submitProof(id, proof).confirm(0) + discard await market.contract.submitProof(id, proof).confirm(1) method markProofAsMissing*(market: OnChainMarket, id: SlotId, period: Period) {.async.} = convertEthersError: - discard await market.contract.markProofAsMissing(id, period).confirm(0) + discard await market.contract.markProofAsMissing(id, period).confirm(1) method canProofBeMarkedAsMissing*( market: OnChainMarket, @@ -264,7 +264,7 @@ method reserveSlot*( slotIndex, # reserveSlot runs out of gas for unknown reason, but 100k gas covers it TransactionOverrides(gasLimit: some 100000.u256) - ).confirm(0) + ).confirm(1) method canReserveSlot*( market: OnChainMarket,