[market] Require a storage contract with a signer
This commit is contained in:
parent
e78a0fb43e
commit
e52153e2ba
|
@ -1,5 +1,6 @@
|
|||
import pkg/ethers
|
||||
import pkg/upraises
|
||||
import pkg/questionable
|
||||
import ../market
|
||||
import ./storage
|
||||
|
||||
|
@ -15,7 +16,9 @@ type
|
|||
export market
|
||||
|
||||
func new*(_: type OnChainMarket, contract: Storage): OnChainMarket =
|
||||
OnChainMarket(contract: contract, signer: !contract.signer)
|
||||
without signer =? contract.signer:
|
||||
raiseAssert("Storage contract should have a signer")
|
||||
OnChainMarket(contract: contract, signer: signer)
|
||||
|
||||
method subscribeRequests(market: OnChainMarket,
|
||||
callback: OnRequest):
|
||||
|
|
|
@ -16,6 +16,11 @@ ethersuite "On-Chain Market":
|
|||
await token.mint(accounts[0], 1000.u256)
|
||||
market = OnChainMarket.new(storage)
|
||||
|
||||
test "fails to instantiate when contract does not have a signer":
|
||||
let storageWithoutSigner = storage.connect(provider)
|
||||
expect AssertionError:
|
||||
discard OnChainMarket.new(storageWithoutSigner)
|
||||
|
||||
test "supports storage requests":
|
||||
var submitted: seq[StorageRequest]
|
||||
proc onRequest(request: StorageRequest) =
|
||||
|
|
Loading…
Reference in New Issue