contracts
directory. Create a loyaltyProgram.sol
file in the directory.
join
joins the address with the programbalance
returns the loyalty program balance associated with the addressmsg.sender
is the address that calls the functioncontracts
directory create Migrations.sol
, which is a standard contract used in the Truffle framework for managing migration scripts.
2_deploy_contracts.js
in the migrations
directory, This will create the loyaltyProgram.sol
contract deployment instructions for Truffle.
1_initial_migration.js
in the migrations
directory, This will create Migrations.sol
contract deployment instructions for Truffle.
build/contracts
directory in the .json
format.
truffle-config.js
.
test
directory
loyaltyProgramTest.js
file:
Passing
.
HDWalletProvider
. HDWalletProvider is Truffle’s separate npm package used to sign transactions.
Run:
truffle-config.js
to add:
HDWalletProvider
compilers
— explicit Solidity version for Truffle to compile the contractquorum
— any network name that you will pass to the truffle migrate --network
command.HDWalletProvider
— Truffle’s custom provider to sign transactionsmnemonic
— your mnemonic that generates your accounts. You can also generate a mnemonic online with Mnemonic Code Converter. Make sure you generate a 15 word mnemonic.https://nd-123-456-789.p2pify.com/3c6e0b8a9c15224a8228b9a98ca1531d
. See View node access details.network_id
— your Quorum network ID. See Default network ID. You can set it to *
for any.gasPrice
— the setting must be 0
for the Quorum network.gas
— the setting must be the default 4500000
for the Quorum network.type
— the setting must be quorum
to instruct Truffle for the Quorum network deployment.2_deploy_contracts.js
and deploy the loyaltyProgram.sol
contract to your Quorum network as specified in truffle-config.js
.
You can view the deployed contract and the contract address on the Chainstack platform by navigating to your Quorum project > Explorer > Contracts.
https://nd-123-456-789.p2pify.com/3c6e0b8a9c15224a8228b9a98ca1531d
.
Example:
truffle compile
and saves it to your project’s /build/contracts
directory in .json
format. Navigate to the directory and get the ABI.
Run:
loyaltyProgram.sol
:
loyaltyProgram.sol
contract has the join
function, call join
: