Skip to content

Commit

Permalink
test: fix failing tests for Foundry and LSP1
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Sep 18, 2023
1 parent 2c0630d commit e7cbffa
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
);
});

Expand Down Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -1151,18 +1157,21 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise<LSP1Tes
'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,
);
});

Expand Down Expand Up @@ -1745,6 +1754,7 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise<LSP1Tes
'MyToken',
'MTK',
context.lsp9Vault1.address,
LSP8_TOKENID_TYPES.NUMBER,
);
await LSP8.mint(context.lsp9Vault1.address, '0x' + '0'.repeat(64), false, '0x');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('LSP8IdentifiableDigitalAsset with constructor', () => {

const buildLSP4DigitalAssetMetadataTestContext =
async (): Promise<LS4DigitalAssetMetadataTestContext> => {
const { lsp8 } = await buildTestContext(0);
const { lsp8 } = await buildTestContext(LSP8_TOKENID_TYPES.NUMBER);
const accounts = await ethers.getSigners();

const deployParams = {
Expand Down Expand Up @@ -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');
});
Expand Down
6 changes: 5 additions & 1 deletion tests/foundry/GasTests/execute/RestrictedController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -438,7 +441,8 @@ contract ExecuteRestrictedController is UniversalProfileTestsHelper {
indentifiableDigitalAsset = new LSP8Tester(
"TestLSP8",
"TSTLSP8",
digitalAssetsOwner
digitalAssetsOwner,
_LSP8_TOKENIDTYPE_NUMBER
);

bytes32 tokenID = bytes32(uint256(1));
Expand Down
6 changes: 5 additions & 1 deletion tests/foundry/GasTests/execute/UnrestrictedController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -260,7 +263,8 @@ contract ExecuteUnrestrictedController is UniversalProfileTestsHelper {
indentifiableDigitalAsset = new LSP8Tester(
"TestLSP8",
"TSTLSP8",
digitalAssetsOwner
digitalAssetsOwner,
_LSP8_TOKENIDTYPE_NUMBER
);

bytes32 tokenID = bytes32(uint256(1));
Expand Down

0 comments on commit e7cbffa

Please sign in to comment.