Payment Pallet Testing Guide (Ubuntu)
November 8, 2022 ยท View on GitHub
Payment 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 With the Payments Pallet 
3. Test Out Functionality
Initialize A One-Time Payment
-
Select
paymentsin the dropdown undersubmit the following extrinsic -
Select the
initializePaymentextrinsic in the next dropdown -
Select the appropriate actor to be the payer id
-
Fill out the fields with the desired values (Note: if you'd like to test out claiming a payment, make sure the unixtime is soon enough to collect the payment within this testing session)
-
Submit the transaction
Initializing a One-Time Payment in polkadot.js.org 
Transaction Succeeded 
Claim a Payment
-
Select
paymentsin the dropdown undersubmit the following extrinsic -
Select the
claimextrinsic in the next dropdown -
Make sure the acting account matches the
payee_idfield from your payment initialization -
Make sure the
payer_idfield matches the acting account from your payment initialization -
Submit the transaction. You should see a successful transaction
Claiming Payment With the Payments Pallet 
Initialize Scheduled Payments
-
Follow the same steps lined out in the Initialize One-Time Payment Section
-
In Scheduled Payments, click on
Add Item -
Add as many payments as you'd like to test, choosing the scheduled unixtime for payment release
-
Submit the transaction
Scheduling Multiple Payments 
Claiming Unavailable Payments
-
Follow the same steps lined out in the Claim a Payment Section
-
Try to claim as many payments as you'd like
-
If you have scheduled a payment for a future time, the transaction should fail
Claiming A Payment That Isn't Due Yet 
Initialize a Payment from Escrow
-
Create an escrow
Create an Escrow 
-
Fund an Escrow Call the
fundEscrowextrinsic with a balance of:1000000000000000000Fund an Escrow 
-
Check Account Balances
Note Account Balances 
-
Initialize a payment contract
Initializing a Payment From Escrow 
-
Claim a payment
Claiming A Payment From Escrow 
-
Confirm Expected Changes to Account Balances
Confirm Payment has Come from the Payer's Escrow 

