From e7cbffa3b14875ebd335ea2529254747c53a6e92 Mon Sep 17 00:00:00 2001 From: CJ42 Date: Mon, 18 Sep 2023 10:45:25 +0100 Subject: [PATCH] test: fix failing tests for Foundry and LSP1 --- .../LSP1UniversalReceiverDelegateUP.behaviour.ts | 12 +++++++++++- .../LSP1UniversalReceiverDelegateVault.behaviour.ts | 12 +++++++++++- .../standard/LSP8IdentifiableDigitalAsset.test.ts | 4 ++-- .../GasTests/execute/RestrictedController.sol | 6 +++++- .../GasTests/execute/UnrestrictedController.sol | 6 +++++- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts index adf8bc19c..65f775ff4 100644 --- a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts +++ b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts @@ -30,7 +30,13 @@ import { import { ARRAY_LENGTH, LSP1_HOOK_PLACEHOLDER, abiCoder } from '../utils/helpers'; // constants -import { ERC725YDataKeys, INTERFACE_IDS, OPERATION_TYPES, LSP1_TYPE_IDS } from '../../constants'; +import { + ERC725YDataKeys, + INTERFACE_IDS, + OPERATION_TYPES, + LSP1_TYPE_IDS, + LSP8_TOKENID_TYPES, +} from '../../constants'; // fixtures import { callPayload, getLSP5MapAndArrayKeysValue, setupKeyManager } from '../utils/fixtures'; @@ -1743,18 +1749,21 @@ export const shouldBehaveLikeLSP1Delegate = ( 'TokenAlpha', 'TA', context.accounts.random.address, + LSP8_TOKENID_TYPES.UNIQUE_ID, ); lsp8TokenB = await new LSP8Tester__factory(context.accounts.random).deploy( 'TokenBeta', 'TB', context.accounts.random.address, + LSP8_TOKENID_TYPES.UNIQUE_ID, ); lsp8TokenC = await new LSP8Tester__factory(context.accounts.random).deploy( 'TokenGamma', 'TA', context.accounts.random.address, + LSP8_TOKENID_TYPES.UNIQUE_ID, ); }); @@ -3069,6 +3078,7 @@ export const shouldBehaveLikeLSP1Delegate = ( 'MyToken', 'MTK', context.universalProfile1.address, + LSP8_TOKENID_TYPES.NUMBER, ); // Mint token for UP1 await LSP8.mint(context.universalProfile1.address, '0x' + '0'.repeat(64), true, '0x'); diff --git a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.behaviour.ts b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.behaviour.ts index 866dab1d6..cfd9bf72c 100644 --- a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.behaviour.ts +++ b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.behaviour.ts @@ -19,7 +19,13 @@ import { import { ARRAY_LENGTH, LSP1_HOOK_PLACEHOLDER, abiCoder } from '../utils/helpers'; // constants -import { ERC725YDataKeys, INTERFACE_IDS, OPERATION_TYPES, LSP1_TYPE_IDS } from '../../constants'; +import { + ERC725YDataKeys, + INTERFACE_IDS, + OPERATION_TYPES, + LSP1_TYPE_IDS, + LSP8_TOKENID_TYPES, +} from '../../constants'; import { callPayload, getLSP5MapAndArrayKeysValue } from '../utils/fixtures'; import { BigNumber, BytesLike, Transaction } from 'ethers'; @@ -1151,18 +1157,21 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise Promise { const buildLSP4DigitalAssetMetadataTestContext = async (): Promise => { - const { lsp8 } = await buildTestContext(0); + const { lsp8 } = await buildTestContext(LSP8_TOKENID_TYPES.NUMBER); const accounts = await ethers.getSigners(); const deployParams = { @@ -90,7 +90,7 @@ describe('LSP8IdentifiableDigitalAsset with constructor', () => { deployParams.name, deployParams.symbol, ethers.constants.AddressZero, - 0, + LSP8_TOKENID_TYPES.NUMBER, ), ).to.be.revertedWith('Ownable: new owner is the zero address'); }); diff --git a/tests/foundry/GasTests/execute/RestrictedController.sol b/tests/foundry/GasTests/execute/RestrictedController.sol index a8c0afbcf..58336d7cc 100644 --- a/tests/foundry/GasTests/execute/RestrictedController.sol +++ b/tests/foundry/GasTests/execute/RestrictedController.sol @@ -19,6 +19,9 @@ import { _PERMISSION_CALL, _PERMISSION_TRANSFERVALUE } from "../../../../contracts/LSP6KeyManager/LSP6Constants.sol"; +import { + _LSP8_TOKENIDTYPE_NUMBER +} from "../../../../contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol"; import "../UniversalProfileTestsHelper.sol"; contract ExecuteRestrictedController is UniversalProfileTestsHelper { @@ -438,7 +441,8 @@ contract ExecuteRestrictedController is UniversalProfileTestsHelper { indentifiableDigitalAsset = new LSP8Tester( "TestLSP8", "TSTLSP8", - digitalAssetsOwner + digitalAssetsOwner, + _LSP8_TOKENIDTYPE_NUMBER ); bytes32 tokenID = bytes32(uint256(1)); diff --git a/tests/foundry/GasTests/execute/UnrestrictedController.sol b/tests/foundry/GasTests/execute/UnrestrictedController.sol index 29f9874ab..dac99c359 100644 --- a/tests/foundry/GasTests/execute/UnrestrictedController.sol +++ b/tests/foundry/GasTests/execute/UnrestrictedController.sol @@ -17,6 +17,9 @@ import { _PERMISSION_REENTRANCY, _PERMISSION_SUPER_TRANSFERVALUE } from "../../../../contracts/LSP6KeyManager/LSP6Constants.sol"; +import { + _LSP8_TOKENIDTYPE_NUMBER +} from "../../../../contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol"; import "../UniversalProfileTestsHelper.sol"; contract ExecuteUnrestrictedController is UniversalProfileTestsHelper { @@ -260,7 +263,8 @@ contract ExecuteUnrestrictedController is UniversalProfileTestsHelper { indentifiableDigitalAsset = new LSP8Tester( "TestLSP8", "TSTLSP8", - digitalAssetsOwner + digitalAssetsOwner, + _LSP8_TOKENIDTYPE_NUMBER ); bytes32 tokenID = bytes32(uint256(1));