Skip to content

Commit

Permalink
Shifting experimental libraries to testing state out of genesis
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Dec 20, 2024
1 parent 09d8d02 commit 0a4038c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
4 changes: 2 additions & 2 deletions convex-core/src/main/cvx/convex/asset/multi-token.cvx
Original file line number Diff line number Diff line change
Expand Up @@ -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
))
Expand Down Expand Up @@ -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}
Expand Down
10 changes: 5 additions & 5 deletions convex-core/src/main/java/convex/core/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

/**
Expand All @@ -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.
Expand Down
31 changes: 22 additions & 9 deletions convex-core/src/main/java/convex/core/init/Init.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package convex.core.init;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import convex.core.Coin;
Expand Down Expand Up @@ -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<AccountKey> 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)"));
Expand Down Expand Up @@ -521,4 +533,5 @@ private static AVector<AccountStatus> addCoreLibrary(AVector<AccountStatus> acct
}



}
2 changes: 1 addition & 1 deletion convex-core/src/test/java/convex/core/init/InitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0a4038c

Please sign in to comment.