-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: validate contract and admin key in hollow account finalized as …
…contract Signed-off-by: Nadezhda Popova <[email protected]>
- Loading branch information
1 parent
31f983b
commit e7a23d2
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const { expect } = require('chai'); | ||
const { ethers } = require('hardhat'); | ||
const utils = require('../system-contracts/hedera-token-service/utils'); | ||
const Constants = require('../constants'); | ||
|
||
describe('Admin Key and Contract ID Validation', function () { | ||
let signers; | ||
let sdkClient; | ||
let hollowWallet; | ||
|
||
before(async function () { | ||
signers = await ethers.getSigners(); | ||
sdkClient = await utils.createSDKClient(); | ||
hollowWallet = ethers.Wallet.createRandom().connect(ethers.provider); | ||
|
||
await ( | ||
await signers[0].sendTransaction({ | ||
to: hollowWallet.address, | ||
value: ethers.parseEther('100'), | ||
gasLimit: 1_000_000, | ||
}) | ||
).wait(); | ||
}); | ||
|
||
it('should ensure that the admin key matches the contract ID after deploying the contract with the hollow account', async function () { | ||
const factory = await ethers.getContractFactory( | ||
Constants.Contract.Base, | ||
hollowWallet | ||
); | ||
const contract = await factory.deploy(); | ||
const info = await utils.getContractInfo(contract.target, sdkClient); | ||
|
||
const adminkey = info.adminKey.num; | ||
const contractId = info.contractId.num; | ||
|
||
expect(adminkey.equals(contractId)).to.be.true; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters