From 148d5fb5ff9877d90b9e6d9f3101829befc92852 Mon Sep 17 00:00:00 2001 From: b00ste Date: Wed, 9 Aug 2023 15:27:41 +0300 Subject: [PATCH] test: add tests that verifies LSP1 hook --- ...P1UniversalReceiverDelegateUP.behaviour.ts | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts index 4bf081b40..17f95b9ba 100644 --- a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts +++ b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts @@ -1,4 +1,4 @@ -import { ethers } from 'hardhat'; +import { ethers, network } from 'hardhat'; import { expect } from 'chai'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; @@ -2420,6 +2420,39 @@ export const shouldBehaveLikeLSP1Delegate = ( }); }); + describe('When renouncing Ownership of VaultC from UP2', () => { + before(async () => { + const renounceOwnershipCalldata = + lsp9VaultC.interface.encodeFunctionData('renounceOwnership'); + + // Call renounceOwnership for the first time + await context.universalProfile2 + .connect(context.accounts.owner2) + .execute(OPERATION_TYPES.CALL, lsp9VaultC.address, 0, renounceOwnershipCalldata); + + // Skip 199 block to reach the time where renouncing ownership can happen + await network.provider.send('hardhat_mine', [ethers.utils.hexValue(199)]); + + // Call renounceOwnership for the second time + await context.universalProfile2 + .connect(context.accounts.owner2) + .execute(OPERATION_TYPES.CALL, lsp9VaultC.address, 0, renounceOwnershipCalldata); + }); + + it('should remove all lsp10keys : arrayLength 0, no map, no VaultC address in UP2', async () => { + const [mapValue, arrayLength, elementAddress] = + await context.universalProfile2.getDataBatch([ + ERC725YDataKeys.LSP10.LSP10VaultsMap + lsp9VaultC.address.substring(2), + ERC725YDataKeys.LSP10['LSP10Vaults[]'].length, + ERC725YDataKeys.LSP10['LSP10Vaults[]'].index + '00000000000000000000000000000000', + ]); + + expect(mapValue).to.equal('0x'); + expect(arrayLength).to.equal(ARRAY_LENGTH.ZERO); + expect(elementAddress).to.equal('0x'); + }); + }); + describe('when deploying vault to a UP directly', () => { let lsp9VaultD: LSP9Vault;