diff --git a/convex-core/src/main/cvx/convex/asset/multi-token.cvx b/convex-core/src/main/cvx/convex/asset/multi-token.cvx index b19fdbf51..d838237b3 100644 --- a/convex-core/src/main/cvx/convex/asset/multi-token.cvx +++ b/convex-core/src/main/cvx/convex/asset/multi-token.cvx @@ -160,7 +160,7 @@ (assoc rec 1 (assoc os receiver quantity)))] (set-holding *caller* (assoc hs id nrec))) (do ;; create a new record with given offer - (or (get tokens id) (fail "token does not exist")) + (or (get tokens id) (fail :STATE "token does not exist")) (set-holding *caller* {id [0 {receiver quantity}]}))) quantity ;; return value is quantity offered )) @@ -203,7 +203,7 @@ [a b] (let [a (cond a (int a) 0) b (cond b (int b) 0)] - (if (>= a b) (- a b) 0))) + (cond (>= a b) (- a b) 0))) (defn quantity-subset? ^{:callable true} diff --git a/convex-core/src/main/java/convex/core/Constants.java b/convex-core/src/main/java/convex/core/Constants.java index 730f4e08c..8aba13405 100644 --- a/convex-core/src/main/java/convex/core/Constants.java +++ b/convex-core/src/main/java/convex/core/Constants.java @@ -19,7 +19,7 @@ public class Constants { /** * Initial timestamp for new States */ - public static final long INITIAL_TIMESTAMP = Instant.parse("2024-12-16T23:00:00.0000Z").toEpochMilli(); + public static final long INITIAL_TIMESTAMP = Instant.parse("2024-12-20T02:21:42.0200Z").toEpochMilli(); // public static final long INITIAL_TIMESTAMP = Instant.parse("2024-12-06T05:08:13.0864Z").toEpochMilli(); /** @@ -38,15 +38,15 @@ public class Constants { public static final long INITIAL_MEMORY_PRICE = 1000000L; /** - * Memory Pool of growth increment 1mb + * Memory Pool of growth increment 40kb / hour i.e. approx. 1mb per day */ - public static final long MEMORY_POOL_GROWTH = 1000000L; + public static final long MEMORY_POOL_GROWTH = 40000L; /** - * Memory Pool of growth interval (once per day). This means regular price drops + * Memory Pool of growth interval (once per hour). This means regular price drops * in memory pool */ - public static final long MEMORY_POOL_GROWTH_INTERVAL = 1000L * 24 * 3600; + public static final long MEMORY_POOL_GROWTH_INTERVAL = 1000L * 3600; /** * Max juice allowable during execution of a single transaction. diff --git a/convex-core/src/main/java/convex/core/init/Init.java b/convex-core/src/main/java/convex/core/init/Init.java index 63a2bf806..4ef43cfc9 100644 --- a/convex-core/src/main/java/convex/core/init/Init.java +++ b/convex-core/src/main/java/convex/core/init/Init.java @@ -1,6 +1,7 @@ package convex.core.init; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import convex.core.Coin; @@ -334,32 +335,43 @@ private static State addTestingCurrencies(State s) { private static State addStandardLibraries(State s) { s = doActorDeploy(s, "/convex/asset/fungible.cvx"); - s = doActorDeploy(s, "/convex/lab/trusted-oracle/actor.cvx"); - s = doActorDeploy(s, "/convex/lab/oracle.cvx"); s = doActorDeploy(s, "/convex/asset/asset.cvx"); s = doActorDeploy(s, "/convex/torus/exchange.cvx"); s = doActorDeploy(s, "/convex/asset/nft/simple.cvx"); s = doActorDeploy(s, "/convex/asset/nft/basic.cvx"); - s = doActorDeploy(s, "/convex/asset/nft/tokens.cvx"); s = doActorDeploy(s, "/convex/asset/box/actor.cvx"); s = doActorDeploy(s, "/convex/asset/box.cvx"); s = doActorDeploy(s, "/convex/asset/multi-token.cvx"); - s = doActorDeploy(s, "/convex/asset/share.cvx"); - s = doActorDeploy(s, "/convex/asset/market/trade.cvx"); s = doActorDeploy(s, "/convex/asset/wrap/convex.cvx"); - s = doActorDeploy(s, "/convex/lab/play.cvx"); - s = doActorDeploy(s, "/convex/lab/did.cvx"); - s = doActorDeploy(s, "/convex/lab/curation-market.cvx"); s = doActorDeploy(s, "/convex/trust/ownership-monitor.cvx"); s = doActorDeploy(s, "/convex/trust/delegate.cvx"); s = doActorDeploy(s, "/convex/trust/whitelist.cvx"); s = doActorDeploy(s, "/convex/trust/monitors.cvx"); s = doActorDeploy(s, "/convex/trust/governance.cvx"); - s = doActorDeploy(s, "/convex/asset/spatial.cvx"); // s = doActorDeploy(s, "convex/user.cvx"); return s; } + /** + * Add extra libraries for testing purposes, not part of official genesis + * @param peerKeys + * @return + */ + public static State createTestState(ArrayList peerKeys) { + State s=createState(peerKeys); + s = doActorDeploy(s, "/convex/asset/nft/tokens.cvx"); + s = doActorDeploy(s, "/convex/lab/play.cvx"); + s = doActorDeploy(s, "/convex/lab/did.cvx"); + s = doActorDeploy(s, "/convex/lab/curation-market.cvx"); + s = doActorDeploy(s, "/convex/lab/trusted-oracle/actor.cvx"); + s = doActorDeploy(s, "/convex/lab/oracle.cvx"); + s = doActorDeploy(s, "/convex/asset/share.cvx"); + s = doActorDeploy(s, "/convex/asset/market/trade.cvx"); + s = doActorDeploy(s, "/convex/asset/spatial.cvx"); + + return s; + } + private static State addCNSBaseTree(State s) { Context ctx=Context.create(s, GOVERNANCE_ADDRESS); ctx=ctx.eval(Reader.read("(*registry*/create 'convex)")); @@ -521,4 +533,5 @@ private static AVector addCoreLibrary(AVector acct } + } diff --git a/convex-core/src/test/java/convex/core/init/InitTest.java b/convex-core/src/test/java/convex/core/init/InitTest.java index 2f1100b2a..3f1a9db6f 100644 --- a/convex-core/src/test/java/convex/core/init/InitTest.java +++ b/convex-core/src/test/java/convex/core/init/InitTest.java @@ -60,7 +60,7 @@ public class InitTest extends ACVMTest { public static State createState() { try { - return Init.createState(PEER_KEYS); + return Init.createTestState(PEER_KEYS); } catch (Throwable e) { e.printStackTrace(); throw e;