Deployment & Interaction with contract
Last updated
Last updated
(Source code you can find here: )
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:
Then you will be able to deploy your contract by running:
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
Contract deployment
Transaction / Call without data
field
Transaction / Call with data
field
✅
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:
You can see how we interact with PERC20 contract in tests for PERC20Sample. You can find it here: