Skip to content

Commit

Permalink
replaced vessel to mops and upgraded to dfx 0.14.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fermartz committed Jul 10, 2023
1 parent 84ea950 commit 952125f
Show file tree
Hide file tree
Showing 38 changed files with 4,026 additions and 3,190 deletions.
13 changes: 0 additions & 13 deletions Makefile

This file was deleted.

17 changes: 17 additions & 0 deletions dfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": 1,
"dfx": "0.14.1",
"defaults": {
"build": {
"packtool": "mops sources",
"args": ""
}
},
"networks": {
"local": {
"bind": "127.0.0.1:8000",
"type": "ephemeral"
}
}

}
46 changes: 23 additions & 23 deletions examples/multiCanister/simpleMultiCanister/dfx.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"version": 1,
"canisters": {
"index": {
"type": "motoko",
"main": "src/index/Index.mo"
"version": 1,
"canisters": {
"index": {
"type": "motoko",
"main": "src/index/index.mo"
},
"user": {
"type": "motoko",
"main": "src/user/user.mo"
}
},
"user": {
"type": "motoko",
"main": "src/user/User.mo"
}
},
"defaults": {
"build": {
"packtool": "mops sources",
"args": ""
}
},
"dfx": "0.14.1",
"networks": {
"local": {
"bind": "127.0.0.1:8000",
"type": "ephemeral"
"defaults": {
"build": {
"packtool": "mops sources",
"args": ""
}
},
"dfx": "0.14.1",
"networks": {
"local": {
"bind": "127.0.0.1:8000",
"type": "ephemeral"
}
}
}
}
}
13 changes: 0 additions & 13 deletions examples/singleCanister/simpleDB/README.md

This file was deleted.

42 changes: 21 additions & 21 deletions examples/singleCanister/simpleDB/dfx.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"canisters": {
"simpleDB": {
"main": "src/main.mo",
"type": "motoko"
}
},
"defaults": {
"build": {
"args": "",
"packtool": "mops sources"
}
},
"dfx": "0.14.1",
"networks": {
"local": {
"bind": "127.0.0.1:8000",
"type": "ephemeral"
}
},
"version": 1
}
"canisters": {
"simpleDB": {
"main": "src/main.mo",
"type": "motoko"
}
},
"defaults": {
"build": {
"args": "",
"packtool": "mops sources"
}
},
"dfx": "0.14.1",
"networks": {
"local": {
"bind": "127.0.0.1:8000",
"type": "ephemeral"
}
},
"version": 1
}
3 changes: 0 additions & 3 deletions examples/singleCanister/simpleDB/src/main.mo
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,5 @@ actor {
}
};

public query func testCandy(input: CandyTypes.CandyShared): async CandyTypes.CandyShared {
input
};

}
13 changes: 0 additions & 13 deletions examples/singleCanister/transactionsApp/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions examples/singleCanister/transactionsApp/dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"defaults": {
"build": {
"args": "",
"packtool": "vessel sources"
"packtool": "mops sources"
}
},
"dfx": "0.9.3",
"dfx": "0.14.1",
"networks": {
"local": {
"bind": "127.0.0.1:8000",
Expand Down
12 changes: 12 additions & 0 deletions examples/singleCanister/transactionsApp/mops.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[dependencies]
base = "0.9.0"
stable-hash-map = "https://github.com/canscale/StableHashMap#v0.2.1"
stable-rbtree = "https://github.com/canscale/StableRBTree#v0.3.0"
stablebuffer = "https://github.com/skilesare/StableBuffer#v0.2.0"
map = "https://github.com/ZhenyaUsenko/motoko-hash-map#v7.0.0"
candy = "https://github.com/icdevs/candy_library#0.2.0"
array = "https://github.com/aviate-labs/array.mo#v0.2.0"
io = "https://github.com/aviate-labs/io.mo#v0.3.1"
encoding = "https://github.com/aviate-labs/encoding.mo#v0.3.2"
rand = "https://github.com/aviate-labs/rand.mo#v0.2.2"
ulid = "https://github.com/ByronBecker/ulid.mo#v0.1.2"
43 changes: 0 additions & 43 deletions examples/singleCanister/transactionsApp/package-set.dhall

This file was deleted.

13 changes: 7 additions & 6 deletions examples/singleCanister/transactionsApp/src/main.mo
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// Simple Example for keeping track of transactions

import CanDB "../../../src/SingleCanisterCanDB";
import Entity "../../../src/Entity";
import Array "mo:base/Array";
import Iter "mo:base/Iter";
import Debug "mo:base/Debug";
import Int "mo:base/Int";
import Iter "mo:base/Iter";
import Option "mo:base/Option";
import Text "mo:base/Text";
import Debug "mo:base/Debug";

import ULID "mo:ulid/ULID";
import Source "mo:ulid/Source";
import ULID "mo:ulid/ULID";
import XorShift "mo:rand/XorShift";

import CanDB "../../../../src/SingleCanisterCanDB";
import Entity "../../../../src/Entity";

/// Note: This is example is not meant to be used as is in a system handling assets of value. It does not include
/// access control or any security measures, and is purely meant to showcase example usage of CanDB

Expand Down Expand Up @@ -244,7 +245,7 @@ actor {
("transactionId", #text(transactionId)),
("receiverUserId", #text(receiverUserId)),
("senderUserId", #text(senderUserId)),
("transactionAmount", #int(Int.neq(transactionAmount))),
("transactionAmount", #int(Int.neg(transactionAmount))),
("previousBalance", #int(senderBalance)),
("currentBalance", #int(updatedSenderBalance)),
]
Expand Down
1 change: 0 additions & 1 deletion examples/singleCanister/transactionsApp/vessel.dhall

This file was deleted.

5 changes: 4 additions & 1 deletion mops.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ encoding = "https://github.com/aviate-labs/encoding.mo#v0.3.2"
stable-rbtree = "https://github.com/canscale/StableRBTree#v0.6.1"
stablebuffer = "https://github.com/skilesare/StableBuffer#v0.2.0"
map = "https://github.com/ZhenyaUsenko/motoko-hash-map#v7.0.0"
candy = "https://github.com/icdevs/candy_library#0.2.0"
candy = "https://github.com/icdevs/candy_library#0.2.0"

[dev-dependencies]
test = "1.0.1"
3 changes: 1 addition & 2 deletions src/CanDB.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import Bool "mo:base/Bool";
import Debug "mo:base/Debug";
import Error "mo:base/Error";
import Iter "mo:base/Iter";
import Text "mo:base/Text";

import Prim "mo:⛔";
import Text "mo:base/Text";

import E "Entity";
import RT "RangeTreeV2";
Expand Down
3 changes: 2 additions & 1 deletion src/CanisterActions.mo
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/// CanisterActions - High level asynchronous functions for interacting with the IC Management Canister

import InterfaceSpec "./InterfaceSpec";
import Cycles "mo:base/ExperimentalCycles";
import Debug "mo:base/Debug";
import Nat "mo:base/Nat";

import InterfaceSpec "./InterfaceSpec";

module {
let ic: InterfaceSpec.IC = actor "aaaaa-aa";

Expand Down
1 change: 1 addition & 0 deletions src/Entity.mo
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ module {
case (?#arrayBool(ab)) { debug_show(ab) };
case (?#arrayFloat(af)) { debug_show(af) };
case (?#tree(t)) { debug_show(t) };
case (?#candy(c)) { debug_show(c) };
};

attributeMapToText(l) # "(k=" # k # ", v=" # value # "), " # attributeMapToText(r) ;
Expand Down
12 changes: 7 additions & 5 deletions src/HashTree.mo
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
/// "HashTree" (single canister CanDB only) - the data structure underlying SingleCanisterCanDB. A HashTree is a stable HashMap, which contains a HashTable storing a mapping of an Partition Key to RangeTree,
/// where the RangeTree contains a mapping of an Entity's Sort Key to its Attributes

import HM "mo:stable-hash-map/FunctionalStableHashMap";
import RBT "mo:stable-rbtree/StableRBTree";
import A "mo:base/Array";
import Text "mo:base/Text";
import Nat32 "mo:base/Nat32";
import AssocList "mo:base/AssocList";
import List "mo:base/List";
import Nat32 "mo:base/Nat32";
import Text "mo:base/Text";

import HM "mo:stable-hash-map/FunctionalStableHashMap";
import RBT "mo:stable-rbtree/StableRBTree";

import E "./Entity";
import RT "./RangeTree";
import AssocList "mo:base/AssocList";

module {
type HTKVs = AssocList.AssocList<E.PK, RT.RangeTree>;
Expand Down
2 changes: 1 addition & 1 deletion src/InterfaceSpec.mo
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// InterfaceSpec - The IC Management Canister Interface Spec

import Principal "mo:base/Principal";
import Nat "mo:base/Nat";
import Nat8 "mo:base/Nat8";
import Principal "mo:base/Principal";

module {
// Types adapted from the interface spec https://github.com/dfinity/interface-spec/blob/master/spec/ic.did
Expand Down
10 changes: 6 additions & 4 deletions src/RangeTree.mo
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/// "RangeTree" - a stable Red-Black Tree for storing the relationship between an Entity's Sort Key and its Attributes

import RBT "mo:stable-rbtree/StableRBTree";
import E "./Entity";
import Buffer "mo:base/Buffer";
import Text "mo:base/Text";
import I "mo:base/Iter";
import Int "mo:base/Int";
import List "mo:base/List";
import Stack "mo:base/Stack";
import Option "mo:base/Option";
import Stack "mo:base/Stack";
import Text "mo:base/Text";

import RBT "mo:stable-rbtree/StableRBTree";

import E "./Entity";

module {

Expand Down
10 changes: 6 additions & 4 deletions src/RangeTreeV2.mo
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/// "RangeTreeV2" - a wrapper around a stable BTree that stores the relationship between an Entity's Sort Key and its Attributes

import BT "mo:btree/BTree";
import E "./Entity";
import Buffer "mo:base/Buffer";
import Text "mo:base/Text";
import I "mo:base/Iter";
import Int "mo:base/Int";
import List "mo:base/List";
import Stack "mo:base/Stack";
import Option "mo:base/Option";
import Stack "mo:base/Stack";
import Text "mo:base/Text";

import BT "mo:btree/BTree";

import E "./Entity";
import RangeTree "RangeTree";

module {
Expand Down
Loading

0 comments on commit 952125f

Please sign in to comment.