11import { getRequiredEnvVar } from './utils/loadVariables' ;
2- import { task } from 'hardhat/config' ;
2+ import { task , types } from 'hardhat/config' ;
33import { HardhatRuntimeEnvironment } from 'hardhat/types' ;
44
55export const CONTRACT_NAME = 'ConfidentialWrapper' ;
@@ -64,6 +64,25 @@ async function deployConfidentialWrapper(
6464 await save ( getConfidentialWrapperImplName ( name ) , { address : implementationAddress , abi : artifact . abi } ) ;
6565}
6666
67+ // Deploy a confidential wrapper contract
68+ // Example usage:
69+ // npx hardhat task:deployConfidentialWrapper \
70+ // --name "ZAMA" \
71+ // --symbol "cZAMA" \
72+ // --contract-uri 'data:application/json;utf8,{"name":"Confidential ZAMA","symbol":"cZAMA","description":"Confidential wrapper of ZAMA shielding it into a confidential token"}' \
73+ // --underlying "0x1234567890123456789012345678901234567890" \
74+ // --owner "0x1234567890123456789012345678901234567890" \
75+ // --network testnet
76+ task ( 'task:deployConfidentialWrapper' )
77+ . addParam ( 'name' , 'The name of the confidential wrapper contract to deploy' , undefined , types . string )
78+ . addParam ( 'symbol' , 'The symbol of the confidential wrapper contract to deploy' , undefined , types . string )
79+ . addParam ( 'contractUri' , 'The contract URI of the confidential wrapper contract to deploy' , undefined , types . string )
80+ . addParam ( 'underlying' , 'The underlying token address of the confidential wrapper contract to deploy' , undefined , types . string )
81+ . addParam ( 'owner' , 'The owner address of the confidential wrapper contract to deploy' , undefined , types . string )
82+ . setAction ( async function ( { name, symbol, contractUri, underlying, owner } , hre ) {
83+ await deployConfidentialWrapper ( name , symbol , contractUri , underlying , owner , hre ) ;
84+ } ) ;
85+
6786// Deploy all confidential wrapper contracts
6887// Example usage:
6988// npx hardhat task:deployAllConfidentialWrappers --network testnet
@@ -81,7 +100,7 @@ task('task:deployAllConfidentialWrappers').setAction(async function (_, hre) {
81100 const underlying = getRequiredEnvVar ( `CONFIDENTIAL_WRAPPER_UNDERLYING_ADDRESS_${ i } ` ) ;
82101 const owner = getRequiredEnvVar ( `CONFIDENTIAL_WRAPPER_OWNER_ADDRESS_${ i } ` ) ;
83102
84- await deployConfidentialWrapper ( name , symbol , contractUri , underlying , owner , hre ) ;
103+ await hre . run ( 'task:deployConfidentialWrapper' , { name, symbol, contractUri, underlying, owner } ) ;
85104 }
86105
87106 console . log ( '✅ All confidential wrapper contracts deployed\n' ) ;
0 commit comments