@@ -16,6 +16,7 @@ describe('HIP904Batch1 AirdropContract Test Suite', function () {
1616 let nftTokenAddress ;
1717 let signers ;
1818 let owner ;
19+ let emptySender ;
1920 let accounts ;
2021 let contractAddresses ;
2122 let walletIHRC904AccountFacade ;
@@ -32,14 +33,27 @@ describe('HIP904Batch1 AirdropContract Test Suite', function () {
3233 erc721Contract = await utils . deployContract (
3334 Constants . Contract . ERC721Contract ,
3435 ) ;
35- owner = signers [ 0 ] . address ;
3636 accounts = signers . slice ( 1 , 3 ) . map ( ( s ) => s . address ) ;
3737
3838 contractAddresses = [
3939 await airdropContract . getAddress ( ) ,
4040 await tokenCreateContract . getAddress ( ) ,
4141 ] ;
42- await hapi . updateAccountKeys ( contractAddresses ) ;
42+
43+ // Relay model: no account re-keying. The Airdrop contract debits the sender
44+ // and leaves isApproval false, so the sender's key has to include the
45+ // contract — which a hardhat signer cannot have while it still sends
46+ // EthereumTransactions. The airdrop sender is therefore a contract-keyed
47+ // account that only ever acts as a subject (signers[0] still sends every
48+ // transaction), and it is the treasury of every token created below, so it
49+ // holds the supply without any seeding transfer.
50+ owner = ( await hapi . createAccountWithContractIdKey ( contractAddresses ) )
51+ . address ;
52+ // A second contract-keyed account, associated but holding nothing, so the
53+ // insufficient-balance test fails on the balance rather than on
54+ // authorization or a missing association.
55+ emptySender = ( await hapi . createAccountWithContractIdKey ( contractAddresses ) )
56+ . address ;
4357
4458 tokenAddress = await utils . setupToken (
4559 tokenCreateContract ,
@@ -53,6 +67,13 @@ describe('HIP904Batch1 AirdropContract Test Suite', function () {
5367 contractAddresses ,
5468 hapi ,
5569 ) ;
70+ await (
71+ await tokenCreateContract . associateTokenPublic (
72+ emptySender ,
73+ tokenAddress ,
74+ Constants . GAS_LIMIT_1_000_000 ,
75+ )
76+ ) . wait ( ) ;
5677 } ) ;
5778
5879 after ( function ( ) {
@@ -76,7 +97,7 @@ describe('HIP904Batch1 AirdropContract Test Suite', function () {
7697
7798 const tx = await airdropContract . tokenAirdrop (
7899 tokenAddress ,
79- signers [ 0 ] . address ,
100+ owner ,
80101 receiver ,
81102 ftAmount ,
82103 Constants . GAS_LIMIT_2_000_000 ,
@@ -303,7 +324,7 @@ describe('HIP904Batch1 AirdropContract Test Suite', function () {
303324
304325 const tx = await airdropContract . tokenAirdrop (
305326 tokenAddress ,
306- signers [ 2 ] . address ,
327+ emptySender ,
307328 receiver ,
308329 ftAmount ,
309330 Constants . GAS_LIMIT_2_000_000 ,
@@ -350,7 +371,7 @@ describe('HIP904Batch1 AirdropContract Test Suite', function () {
350371
351372 const tx = await airdropContract . tokenAirdrop (
352373 tokenAddress ,
353- signers [ 0 ] . address ,
374+ owner ,
354375 receiver ,
355376 invalidAmount ,
356377 Constants . GAS_LIMIT_2_000_000 ,
@@ -439,7 +460,7 @@ describe('HIP904Batch1 AirdropContract Test Suite', function () {
439460
440461 const tx = await airdropContract . tokenAirdrop (
441462 tokenAddress ,
442- signers [ 0 ] . address ,
463+ owner ,
443464 receiver . address ,
444465 ftAmount ,
445466 {
0 commit comments