Deploy and Test the Stablecoin Contract
You can deploy the contract by using the CLI or by using the Microsoft Visual Studio Code extension for Blockchain App Builder.
Deploy from Visual Studio Code
To deploy the contract by using the Visual Studio Code extension for Blockchain App Builder, complete the following steps.
- Extract the
Stablecoin.ziparchive file. - Import the
Stablecoincontract into the Blockchain App Builder extension in Visual Studio Code. - Select the imported project and then select the Deploy tab.
For more information, see Using the Blockchain App Builder Extension for Visual Studio Code.
Deploy from the Command Line
To deploy the contract from the command line, complete the following steps.
- Extract the
Stablecoin.ziparchive file. - Run the following command to install dependencies.
npm install - Run the following commands to compile the contract.
npx hardhat clean npx hardhat compile - Configure the following network variables.
The following text shows an example of variable configuration.npx hardhat vars set BESU_CHAIN_ID <chain-id> npx hardhat vars set BESU_RPC_URL <rpc-url> npx hardhat vars set BESU_RPX_PROXY_AUTH_TOKEN "Bearer {auth-token}" npx hardhat vars set WALLET_SERVICE_BASE_URL <wallet-svc-url> npx hardhat vars set WALLET_SERVICE_ENABLED true npx hardhat vars set WALLET_SERVICE_ACCOUNTS <wallet-svc-accounts> npx hardhat vars set WALLET_SERVICE_AUTH_TOKEN "Bearer {auth-token}"npx hardhat vars set BESU_CHAIN_ID 1500 npx hardhat vars set BESU_RPC_URL https://rpcproxy.example.com/v1/besu/proxy npx hardhat vars set BESU_RPX_PROXY_AUTH_TOKEN "Bearer ej1q..." npx hardhat vars set WALLET_SERVICE_BASE_URL https://rpcproxy.example.com/v1/besu/transaction npx hardhat vars set WALLET_SERVICE_ENABLED true npx hardhat vars set WALLET_SERVICE_ACCOUNTS '[{"address":"0xFf93749DEFa27077d055581642E077E94426A89C","walletId":"031cab07-ca25-422f-84a0-4a78d89982cc"}]' npx hardhat vars set WALLET_SERVICE_AUTH_TOKEN "Bearer ej1q..." - Deploy the contract. Every deployment requires the following variables:
DEPLOYMENT_ID,GOVERNANCE_ADDRESS, andGOVERNANCE_UUID.- If a deployment fails, run it again with the same
DEPLOYMENT_IDvalue to resume. After deployment succeeds, the resume cache is deleted. If you run a successful deployment again with the sameDEPLOYMENT_IDvalue, it is treated as a new deployment. - The
GOVERNANCE_ADDRESSvalue is the predeployed governance contract address for the instance. - Contact the
DA_ADMINrole for theGOVERNANCE_UUIDvalue.
.obp-da/.erc7201registry entry for the token proxy only. Run the following commands to deploy the contract.
TheDEPLOYMENT_ID=<deployment-id> \ GOVERNANCE_ADDRESS=<ida-contract-governance-address> \ GOVERNANCE_UUID=<customer-governance-uuid> \ TOKEN_NAME="Stablecoin" \ TOKEN_SYMBOL="STBL" \ TOKEN_DESCRIPTION="Stablecoin token proxy contract" \ ADMIN_USER_ID="platformadmin1" \ ADMIN_ORG_ID="org1" \ CONTRACT_METADATA_SMART_CONTRACT_ID="stablecoin" \ CONTRACT_METADATA_VERSION="1.0.0" \ CONTRACT_METADATA_DESCRIPTION="Stablecoin token proxy contract" \ CONTRACT_METADATA_AUTHOR="Oracle" \ CONTRACT_METADATA_TAGS='{"assetType":"stablecoin token"}' \ npx hardhat run scripts/deploy/stablecoin/deploy-stablecoin-erc-5982.ts --network obp-besuCONTRACT_METADATA_*variables apply to the token proxy that is deployed by the script. Tags must be a JSON object with string values.This command deploys the contract in
INACTIVEmode. After you submit deployment intent and the intent is approved based on the policy attached to theGOVERNANCE_UUIDvalue, the deployment is marked asACTIVEautomatically. - If a deployment fails, run it again with the same
- Propose a deployment intent for governed proxies. For upgrades, governance approval is tied to the existing proxy and the exact new implementation that was reviewed. After the required approvals, the proxy can move to the approved version while retaining its address and accumulated business state. A different implementation, an expired intent, or a rejected proposal requires a new governance decision.
After deployment has set the governance context, submit one intent for every governed proxy. Run the following command to propose the deployment intent.
GOVERNANCE_INTENT_MODE=obp-besu \ GOVERNANCE_ADDRESS=<governance-address> \ GOVERNANCE_UUID=<customer-uuid> \ DEPLOY_TARGETS_JSON='["<stablecoin-proxy>"]' \ DEPLOY_INTENT_MANIFEST=.obp-da/governance/deploy-intent.json \ npx hardhat run scripts/deploy/governance/propose-deploy-intent.ts --network obp-besuUse
GOVERNANCE_INTENT_MODE = json-rpcfor direct contract submission. If you useGOVERNANCE_INTENT_MODE = obp-besu, the proposal is submitted to the UWaaS endpoint via the RPC proxy.After depoyment completes, you can use the provided Postman collection to invoke the contract methods via the RPC proxy.