Escrow Pallet
November 2, 2022 ยท View on GitHub
Escrow Pallet Setup and Testing Guide (Ubuntu)
Prerequisite Setup
Install Dependencies
sudo apt install build-essential
sudo apt install -y git clang curl libssl-dev llvm libudev-dev
Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env
rustup default stable
rustup update stable
rustup update nightly
rustup install nightly-2022-09-19
rustup override set nightly-2022-09-19
rustup target add wasm32-unknown-unknown
rustup target add wasm32-unknown-unknown --toolchain nightly
Deploy a Local Ventur Node
Fetch the code
The following command pulls the ventur-node code from our github repo:
git clone https://github.com/Popular-Coding/ventur.git
cd ventur
Run the node
The following command builds the node. (This may take some time):
cargo run --release -- --dev
Run Unit Tests
Unit tests can be run locally using the following command:
cargo test
Manual Test Guide
1. Start the node
cargo run --release -- --dev
| Running your local node |
|---|
![]() |
2. Access the Node through the polkadot.js.org interface
Once you have a ventur node running locally, follow this link: https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9944#/explorer
| Accessing your Development Node Endpoint in polkadot.js.org |
|---|
![]() |
Confirm that you can see the recent blocks listed. If you are not able to access the block explorer on polkadot.js.org, you should:
-
Confirm that your Ventur node is running
-
Check if your Ventur node is running the JSON-RPC WS server on an address and port other than
127.0.0.1:9944a. If your node is running on a different address and port, update the custom endpoint in polkadot.js.org to the address and port number your node is servingSetting your Development Node Endpoint in polkadot.js.org 
3. Test Creating an Escrow
| Create an Escrow |
|---|
![]() |
4. Test Funding an Escrow
First check your account to see the Transferable Balance listed for Alice
| Check Balance |
|---|
![]() |
Next, call the fundEscrow extrinsic with a balance of: |
1000000000000000000 |
| Fund Escrow |
| :--: |
![]() |
And back in accounts, confirm that the funded amount is now locked for Alice |
| Confirm Locked Funds |
| :--: |
![]() |
4.a. Test Open Contributions on an Escrow
4.a.i. Admin Contribution
Now that Alice has created an Escrow, we can confirm that by default the escrow only allows admin contributions.
Have AliceStash attempt to fund Alice's escrow. This should bring up an Unauthorized error message.
Attempt to Fund Alice's Escrow from AliceStash |
|---|
![]() |
Confirm in accounts that Alice and AliceStash's balances have not changed. |
| Confirm Account Balances After Funding |
| :--: |
![]() |
Next add AliceStash as an admin to Alice's Escrow. |
| Add AliceStash as Admin |
| :--: |
![]() |
And now attempt to fund escrow from AliceStash again, this time it should result in a success. |
Fund Alice's Escrow from AliceStash |
| :--: |
![]() |
Confirm the expected balance change for Alice and AliceStash. |
Confirm Balance of Alice and AliceStash |
| :--: |
![]() |
4.a.ii. Open Contribution
Next confirm the starting balance of Bob's account.
Confirm Balance of Bob |
|---|
![]() |
Next attempt to call fund escrow on Alice from Bob, this should fail as Bob is not an admin. |
Attempt to Fund with Bob |
| :--: |
![]() |
Next have Alice call the enableOpenContribution extrinsic |
Alice Enable Open Contribution |
| :--: |
![]() |
And now have Bob attempt to fund Alice again |
Fund with Bob |
| :--: |
![]() |
And confirm the balance changes for Bob and Alice |
Confirm Balance of Alice and AliceStash |
| :--: |
![]() |
5. Test Distributing from an Escrow
Take note of Charlie's balance.
Take note of Charlie's balance |
|---|
![]() |
Have Alice distribute to Charlie. |
Alice calls the payoutEscrow extrinsic to Charlie |
| :--: |
![]() |
Confirm Charlie and Alice's balance after distribution. |
Confirm Balance of Charlie |
| :--: |
![]() |
6. Test Freezing an Escrow
Using Alice call the freezeEscrow extrinsic.
Freeze Alice |
|---|
![]() |
Attempt to fund Alice with 10000000000000000 (less than the previous amounts, as Alice currently has less than the previously used 1MUNIT). This should fail with an escrow Frozen error. |
Attempt to Fund Alice |
| :--: |
![]() |
Next thaw Alice |
Thaw Alice |
| :--: |
![]() |
Attempt to fund Alice with 10000000000000000 again. |
Attempt to Fund Alice again |
| :--: |
![]() |
7. Test Closing an Escrow
Using Alice call the closeEscrow extrinsic.
Close Alice |
|---|
![]() |























