diff --git a/codex/contracts/market.nim b/codex/contracts/market.nim index 4e228670e..c874d5db9 100644 --- a/codex/contracts/market.nim +++ b/codex/contracts/market.nim @@ -46,7 +46,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(1) + discard await token.increaseAllowance(market.contract.address(), amount).confirm(0) method getZkeyHash*(market: OnChainMarket): Future[?string] {.async.} = let config = await market.contract.config() @@ -92,7 +92,7 @@ method requestStorage(market: OnChainMarket, request: StorageRequest){.async.} = convertEthersError: debug "Requesting storage" await market.approveFunds(request.price()) - await market.contract.requestStorage(request) + discard await market.contract.requestStorage(request).confirm(0) method getRequest(market: OnChainMarket, id: RequestId): Future[?StorageRequest] {.async.} = @@ -159,16 +159,16 @@ method fillSlot(market: OnChainMarket, collateral: UInt256) {.async.} = convertEthersError: await market.approveFunds(collateral) - await market.contract.fillSlot(requestId, slotIndex, proof) + discard await market.contract.fillSlot(requestId, slotIndex, proof).confirm(0) method freeSlot*(market: OnChainMarket, slotId: SlotId) {.async.} = convertEthersError: - await market.contract.freeSlot(slotId) + discard await market.contract.freeSlot(slotId).confirm(0) method withdrawFunds(market: OnChainMarket, requestId: RequestId) {.async.} = convertEthersError: - await market.contract.withdrawFunds(requestId) + discard await market.contract.withdrawFunds(requestId).confirm(0) method isProofRequired*(market: OnChainMarket, id: SlotId): Future[bool] {.async.} = @@ -201,13 +201,13 @@ method submitProof*(market: OnChainMarket, id: SlotId, proof: Groth16Proof) {.async.} = convertEthersError: - await market.contract.submitProof(id, proof) + discard await market.contract.submitProof(id, proof).confirm(0) method markProofAsMissing*(market: OnChainMarket, id: SlotId, period: Period) {.async.} = convertEthersError: - await market.contract.markProofAsMissing(id, period) + discard await market.contract.markProofAsMissing(id, period).confirm(0) method canProofBeMarkedAsMissing*( market: OnChainMarket, @@ -218,7 +218,7 @@ method canProofBeMarkedAsMissing*( let contractWithoutSigner = market.contract.connect(provider) let overrides = CallOverrides(blockTag: some BlockTag.pending) try: - await contractWithoutSigner.markProofAsMissing(id, period, overrides) + discard await contractWithoutSigner.markProofAsMissing(id, period, overrides) return true except EthersError as e: trace "Proof cannot be marked as missing", msg = e.msg diff --git a/codex/contracts/marketplace.nim b/codex/contracts/marketplace.nim index 2326ed3f1..301f8c25c 100644 --- a/codex/contracts/marketplace.nim +++ b/codex/contracts/marketplace.nim @@ -42,10 +42,10 @@ proc slashMisses*(marketplace: Marketplace): UInt256 {.contract, view.} proc slashPercentage*(marketplace: Marketplace): UInt256 {.contract, view.} proc minCollateralThreshold*(marketplace: Marketplace): UInt256 {.contract, view.} -proc requestStorage*(marketplace: Marketplace, request: StorageRequest) {.contract.} -proc fillSlot*(marketplace: Marketplace, requestId: RequestId, slotIndex: UInt256, proof: Groth16Proof) {.contract.} -proc withdrawFunds*(marketplace: Marketplace, requestId: RequestId) {.contract.} -proc freeSlot*(marketplace: Marketplace, id: SlotId) {.contract.} +proc requestStorage*(marketplace: Marketplace, request: StorageRequest): ?TransactionResponse {.contract.} +proc fillSlot*(marketplace: Marketplace, requestId: RequestId, slotIndex: UInt256, proof: Groth16Proof): ?TransactionResponse {.contract.} +proc withdrawFunds*(marketplace: Marketplace, requestId: RequestId): ?TransactionResponse {.contract.} +proc freeSlot*(marketplace: Marketplace, id: SlotId): ?TransactionResponse {.contract.} proc getRequest*(marketplace: Marketplace, id: RequestId): StorageRequest {.contract, view.} proc getHost*(marketplace: Marketplace, id: SlotId): Address {.contract, view.} proc getActiveSlot*(marketplace: Marketplace, id: SlotId): Slot {.contract, view.} @@ -66,5 +66,5 @@ proc willProofBeRequired*(marketplace: Marketplace, id: SlotId): bool {.contract proc getChallenge*(marketplace: Marketplace, id: SlotId): array[32, byte] {.contract, view.} proc getPointer*(marketplace: Marketplace, id: SlotId): uint8 {.contract, view.} -proc submitProof*(marketplace: Marketplace, id: SlotId, proof: Groth16Proof) {.contract.} -proc markProofAsMissing*(marketplace: Marketplace, id: SlotId, period: UInt256) {.contract.} +proc submitProof*(marketplace: Marketplace, id: SlotId, proof: Groth16Proof): ?TransactionResponse {.contract.} +proc markProofAsMissing*(marketplace: Marketplace, id: SlotId, period: UInt256): ?TransactionResponse {.contract.} diff --git a/tests/contracts/testContracts.nim b/tests/contracts/testContracts.nim index 019de7aa8..4432160db 100644 --- a/tests/contracts/testContracts.nim +++ b/tests/contracts/testContracts.nim @@ -39,10 +39,10 @@ ethersuite "Marketplace contracts": switchAccount(client) discard await token.approve(marketplace.address, request.price) - await marketplace.requestStorage(request) + discard await marketplace.requestStorage(request) switchAccount(host) discard await token.approve(marketplace.address, request.ask.collateral) - await marketplace.fillSlot(request.id, 0.u256, proof) + discard await marketplace.fillSlot(request.id, 0.u256, proof) slotId = request.slotId(0.u256) proc waitUntilProofRequired(slotId: SlotId) {.async.} = @@ -57,12 +57,12 @@ ethersuite "Marketplace contracts": proc startContract() {.async.} = for slotIndex in 1..