Deployment & Interaction with contract
(Source code you can find here: https://github.com/SigmaGmbH/swisstronik-tutorials/blob/main/PERC20_interaction)
In this guide, we will use the PERC20 contract, which we have seen in the previous step. Also, we will use hardhat for example of deployment script. Since Swisstronik has almost the same JSON-RPC as Ethereum, you can use any library/tool you like
You can deploy the PrivateSWTR
contract from the sample hardhat-basic
project with a deployment script like this:
Before running this script, make sure to modify your hardhat.config.js
file by adding the node address and your private key account. Here you can read more about the configuration of hardhat: https://hardhat.org/hardhat-runner/docs/config
Then you will be able to deploy your contract by running:
Interact with contract
You can see how we interact with PERC20 contract in tests for PERC20Sample. You can find it here: https://github.com/SigmaGmbH/swisstronik-tutorials/blob/main/PERC20_interaction/test/test.js
As you can see there, to interact with a deployed contract you need a few helper functions which will do encryption/decryption of query and encrypt transaction data
field. Every method which contains data
requires encryption, except contract deployment. In the table below you can find which methods require encrypted payload
Last updated