Skip to content

Commit

Permalink
test: add tests that verifies LSP1 hook
Browse files Browse the repository at this point in the history
  • Loading branch information
b00ste committed Aug 9, 2023
1 parent 767675b commit 148d5fb
Showing 1 changed file with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ethers } from 'hardhat';
import { ethers, network } from 'hardhat';
import { expect } from 'chai';
import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers';

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 148d5fb

Please sign in to comment.