From 76be728f6150f30a70fbd37068f9205c1ec43cce Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Wed, 30 Mar 2022 17:07:03 +0200 Subject: [PATCH] [sales] Availability.new -> Availability.init --- dagger/sales.nim | 2 +- tests/dagger/examples.nim | 2 +- tests/dagger/testsales.nim | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dagger/sales.nim b/dagger/sales.nim index 9b046176..d614ea67 100644 --- a/dagger/sales.nim +++ b/dagger/sales.nim @@ -22,7 +22,7 @@ type func new*(_: type Sales, market: Market): Sales = Sales(market: market) -proc new*(_: type Availability, +proc init*(_: type Availability, size: uint64, duration: uint64, minPrice: UInt256): Availability = diff --git a/tests/dagger/examples.nim b/tests/dagger/examples.nim index a5da27a6..ee09fbde 100644 --- a/tests/dagger/examples.nim +++ b/tests/dagger/examples.nim @@ -54,4 +54,4 @@ proc example*(_: type Cid): Cid = Block.example.cid proc example*(_: type Availability): Availability = - Availability.new(uint16.example, uint16.example, uint64.example.u256) + Availability.init(uint16.example, uint16.example, uint64.example.u256) diff --git a/tests/dagger/testsales.nim b/tests/dagger/testsales.nim index 57c955f1..5aa9d329 100644 --- a/tests/dagger/testsales.nim +++ b/tests/dagger/testsales.nim @@ -32,12 +32,12 @@ suite "Sales": check sales.available.len == 0 test "generates unique ids for storage availability": - let availability1 = Availability.new(size=1, duration=2, minPrice=3.u256) - let availability2 = Availability.new(size=1, duration=2, minPrice=3.u256) + let availability1 = Availability.init(size=1, duration=2, minPrice=3.u256) + let availability2 = Availability.init(size=1, duration=2, minPrice=3.u256) check availability1.id != availability2.id test "offers available storage when matching request comes in": - let availability = Availability.new(size=100, duration=60, minPrice=42.u256) + let availability = Availability.init(size=100, duration=60, minPrice=42.u256) sales.add(availability) sales.start() let request = StorageRequest(duration:60.u256, size:100.u256, maxPrice:42.u256) @@ -47,7 +47,7 @@ suite "Sales": sales.stop() test "ignores request when no matching storage is available": - let availability = Availability.new(size=99, duration=60, minPrice=42.u256) + let availability = Availability.init(size=99, duration=60, minPrice=42.u256) sales.add(availability) sales.start() let request = StorageRequest(duration:60.u256, size:100.u256, maxPrice:42.u256) @@ -56,7 +56,7 @@ suite "Sales": sales.stop() test "makes storage unavailable when offer is submitted": - let availability = Availability.new(size=100, duration=60, minPrice=42.u256) + let availability = Availability.init(size=100, duration=60, minPrice=42.u256) sales.add(availability) sales.start() let request = StorageRequest(duration:60.u256, size:100.u256, maxPrice:42.u256)