Skip to content

Commit df41630

Browse files
committed
Improve README, add deploy_script
1 parent 813aae2 commit df41630

3 files changed

Lines changed: 65 additions & 42 deletions

File tree

README.md

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,33 @@
33
## 🚀 Features
44

55
- **Contract Creation**
6-
Create and manage legally binding contracts with vendors.
6+
Create and manage legally binding vendor agreements.
77

88
- **Participant Invitation**
9-
Invite all stakeholders to collaborate on the contract.
9+
Invite all stakeholders to collaborate on the contract (Buyer, Supplier, Third-Party)
1010

1111
- **E-signing of Contracts**
1212
Sign contracts electronically, eliminating the need for physical paperwork.
1313

1414
- **Delivery Note Generation**
1515
Automatically generate delivery notes as proof of delivery.
1616

17-
- **Invoice Generation**
18-
Create invoices directly from contract or delivery data.
17+
- **Invoices**
18+
Create invoices and pay invoices directly from contract or delivery data.
1919

2020
- **Locking of Assets in Escrow**
21-
Secure payment and asset exchange through escrow integration.
21+
Secure payments through escrow integration.
2222

2323
- **Flexible Payment Terms**
2424
Supports various payment configurations:
2525
1. On Delivery
26-
2. Standard payment periods: 7, 14, 30 Day, Net 60/90
27-
3. Custom payment periods
26+
2. Custom payment periods
2827

2928
- **Discounts and Penalties**
3029
Configure dynamic pricing based on early payment or late delivery.
3130

3231
- **Automatic Asset Transfer**
33-
Transfer funds automatically on contract fulfillment.
32+
Transfer funds automatically on contract fulfillment. (On Delivery payment term)
3433

3534
- **Dispute Resolution**
3635
Built-in mechanisms to manage and resolve disputes efficiently.
@@ -39,42 +38,19 @@
3938
Connection to crypto wallet
4039

4140

42-
43-
## Running the project locally
44-
45-
If you want to test your project locally, you can use the following commands:
46-
47-
```bash
48-
# Starts the replica, running in the background
49-
dfx start --background
50-
51-
# Deploys your canisters to the replica and generates your candid interface
52-
dfx deploy
53-
```
54-
55-
Once the job completes, your application will be available at `http://localhost:4943?canisterId={asset_canister_id}`.
56-
57-
If you have made changes to your backend canister, you can generate a new candid interface with
58-
59-
```bash
60-
npm run generate
61-
```
62-
63-
at any time. This is recommended before starting the frontend development server, and will be run automatically any time you run `dfx deploy`.
64-
65-
If you are making frontend changes, you can start a development server with
66-
41+
## 🚀 Running locally
42+
1. **Clone the repository**
6743
```bash
68-
npm start
44+
git clone <repo-url>
45+
cd <repo-url>
6946
```
47+
2. **Deploy**
48+
Run local_deploy.sh script. This will create identities and deploy all canisters.
7049

71-
Which will start a server at `http://localhost:8080`, proxying API requests to the replica at port 4943.
50+
In the CLM_backend candid interface:
7251

73-
### Note on frontend environment variables
52+
1. Fund escrow canister. Transfer dummy tokens to escrow canister using ```transfer``` function. These will be used to cover transfer fees for operations.
7453

75-
If you are hosting frontend code somewhere without using DFX, you may need to make one of the following adjustments to ensure your project does not fetch the root key in production:
54+
2. Once users are created in the frontend, use the ```transferToUsers``` function to allocate dummy tokens to user accounts.
7655

77-
- set`DFX_NETWORK` to `ic` if you are using Webpack
78-
- use your own preferred method to replace `process.env.DFX_NETWORK` in the autogenerated declarations
79-
- Setting `canisters -> {asset_canister_id} -> declarations -> env_override to a string` in `dfx.json` will replace `process.env.DFX_NETWORK` with the string in the autogenerated declarations
80-
- Write your own `createActor` constructor
56+
This enables users to participate in transactions.

local_deploy.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Set principal variables
2+
DEFAULT=$(dfx identity get-principal --identity default)
3+
MINTER=$(dfx identity get-principal --identity minter)
4+
CONTROLLER=$(dfx identity get-principal --identity archive_controller)
5+
6+
dfx stop
7+
dfx start --clean --background
8+
# Set principal variables
9+
DEFAULT=$(dfx identity get-principal --identity default)
10+
MINTER=$(dfx identity get-principal --identity minter)
11+
CONTROLLER=$(dfx identity get-principal --identity archive_controller)
12+
13+
dfx deploy CLM_backend
14+
BACKEND=$(dfx canister id CLM_backend)
15+
16+
# Deploy the ICRC-1 ledger canister
17+
dfx deploy icrc1_ledger_canister --argument "(variant { Init = record {
18+
token_symbol = \"KEST\";
19+
token_name = \"Tether KE\";
20+
minting_account = record { owner = principal \"$MINTER\" };
21+
transfer_fee = 10_000;
22+
metadata = vec {};
23+
feature_flags = opt record { icrc2 = true };
24+
initial_balances = vec {
25+
record { record { owner = principal \"$DEFAULT\"; }; 10_000_000_000; };
26+
record { record { owner = principal \"$BACKEND\"; }; 50_000_000_000; };
27+
};
28+
archive_options = record {
29+
num_blocks_to_archive = 1000;
30+
trigger_threshold = 2000;
31+
controller_id = principal \"$CONTROLLER\";
32+
cycles_for_archive_creation = opt 10000000000000;
33+
};
34+
}})"
35+
36+
# Get the deployed ledger canister ID
37+
LEDGER=$(dfx canister id icrc1_ledger_canister)
38+
39+
# Deploy the index canister, referencing the ledger canister principal
40+
#index canister is used to query ledger transactions
41+
dfx deploy icrc1_index_canister --argument "(opt variant { Init = record { ledger_id = principal \"$LEDGER\"; retrieve_blocks_from_ledger_interval_seconds = opt 10; } })"
42+
43+
# Deploy other canisters
44+
dfx deploy escrow
45+
dfx deploy internet_identity
46+
dfx deploy CLM_frontend

src/CLM_backend/main.mo

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ actor class CLM() = {
2424
{ hash = Principal.hash p; key = p };
2525
};
2626

27-
//🚩 For testing purposes only
27+
//🚩Functions or testing purposes only
2828
//transfer tokens to all users
2929
public shared ({ caller }) func transferToUsers(amount : Nat) : async Result.Result<Text, Text> {
3030
let usersArray = Trie.toArray<Principal, T.User, Principal>(
@@ -99,6 +99,7 @@ actor class CLM() = {
9999
};
100100
};
101101
};
102+
//end of testing functions
102103

103104
// Adjacency list for user-user connections: principal -> list of connected principals
104105
stable var connections : Trie.Trie<Principal, Trie.Trie<Principal, T.ConnectionStatus>> = Trie.empty();

0 commit comments

Comments
 (0)