Closed PierreJeanjacquot closed 2 months ago
actuellement, dans le fichier prepare-bellecour-fork-for-tests.js, nous avons : // prepare Voucher
await setBalance(TARGET_VOUCHER_MANAGER_WALLET, 1000000n * 10n ** 18n); await getVoucherManagementRoles(TARGET_VOUCHER_MANAGER_WALLET);
je propose de séparer ces actions comme suit :
const getVoucherRoles = async (targetWallet, role) => { const voucherHubContract = new Contract( VOUCHER_HUB_ADDRESS, [ { inputs: [], name: 'defaultAdmin', outputs: [ { internalType: 'address', name: '', type: 'address', }, ], stateMutability: 'view', type: 'function', }, { inputs: [ { internalType: 'bytes32', name: 'role', type: 'bytes32', }, { internalType: 'address', name: 'account', type: 'address', }, ], name: 'grantRole', outputs: [], stateMutability: 'nonpayable', type: 'function', }, { inputs: [ { internalType: 'bytes32', name: 'role', type: 'bytes32', }, { internalType: 'address', name: 'account', type: 'address', }, ], name: 'hasRole', outputs: [ { internalType: 'bool', name: '', type: 'bool', }, ], stateMutability: 'view', type: 'function', }, ], provider, ); const defaultAdmin = await voucherHubContract.defaultAdmin(); console.log('VoucherHub defaultAdmin:', defaultAdmin); await impersonate(defaultAdmin); const ROLE = keccak256(Buffer.from(role)); await voucherHubContract .connect(new JsonRpcSigner(provider, defaultAdmin)) .grantRole(ROLE, targetWallet, { gasPrice: 0 }) .then((tx) => tx.wait()); await stopImpersonate(defaultAdmin); console.log( `${targetWallet} has role ${role}: ${await voucherHubContract.hasRole( ROLE, targetWallet, )}`, ); };
// prepare Voucher
await setBalance(TARGET_VOUCHER_MANAGER_WALLET, 1000000n * 10n ** 18n); await getVoucherRoles(TARGET_VOUCHER_MANAGER_WALLET, 'MANAGER_ROLE'); await setBalance(TARGET_VOUCHER_MINTER_WALLET, 1000000n * 10n ** 18n); await getVoucherRoles(TARGET_VOUCHER_MINTER_WALLET, 'MINTER_ROLE');
actuellement, dans le fichier prepare-bellecour-fork-for-tests.js, nous avons : // prepare Voucher
je propose de séparer ces actions comme suit :
// prepare Voucher