Skip to content

Commit

Permalink
test: update tests with the new behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
b00ste committed Sep 5, 2023
1 parent c2698ab commit 7faedec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ contract UniversalReceiverDelegateTokenReentrant is ERC165Storage {
typeId == _TYPEID_LSP8_TOKENSRECIPIENT
) {
// if the optional data field when minting/transferring is existing, re-execute the data on token contract
if (data.length > 72) {
bytes memory tokenPayload = BytesLib.slice(
if (data.length > 160) {
(, , , bytes memory tokenPayload) = abi.decode(
data,
72,
data.length - 72
(address, address, uint256, bytes)
);

bytes memory executePayload = abi.encodeWithSelector(
IERC725X.execute.selector,
0, // OPERATION CALL
Expand Down
8 changes: 5 additions & 3 deletions tests/LSP7DigitalAsset/LSP7DigitalAsset.behaviour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
// constants
import { ERC725YDataKeys, INTERFACE_IDS, LSP1_TYPE_IDS, SupportedStandards } from '../../constants';

import { abiCoder } from '../utils/helpers';

export type LSP7TestAccounts = {
owner: SignerWithAddress;

Expand Down Expand Up @@ -812,7 +814,7 @@ export const shouldBehaveLikeLSP7 = (buildContext: () => Promise<LSP7TestContext
const tx = await transferSuccessScenario(txParams, operator);

const typeId = LSP1_TYPE_IDS.LSP7Tokens_RecipientNotification;
const packedData = ethers.utils.solidityPack(
const packedData = abiCoder.encode(
['address', 'address', 'uint256', 'bytes'],
[txParams.from, txParams.to, txParams.amount, txParams.data],
);
Expand Down Expand Up @@ -885,7 +887,7 @@ export const shouldBehaveLikeLSP7 = (buildContext: () => Promise<LSP7TestContext
const tx = await transferSuccessScenario(txParams, operator);

const typeId = LSP1_TYPE_IDS.LSP7Tokens_RecipientNotification;
const packedData = ethers.utils.solidityPack(
const packedData = abiCoder.encode(
['address', 'address', 'uint256', 'bytes'],
[txParams.from, txParams.to, txParams.amount, txParams.data],
);
Expand Down Expand Up @@ -1306,7 +1308,7 @@ export const shouldBehaveLikeLSP7 = (buildContext: () => Promise<LSP7TestContext
txParams.amount.map((_, index) => async () => {
const typeId =
'0x29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe895';
const packedData = ethers.utils.solidityPack(
const packedData = abiCoder.encode(
['address', 'address', 'uint256', 'bytes'],
[
txParams.from[index],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {

// helpers
import { tokenIdAsBytes32 } from '../utils/tokens';
import { abiCoder } from '../utils/helpers';

// constants
import { ERC725YDataKeys, INTERFACE_IDS, LSP1_TYPE_IDS, SupportedStandards } from '../../constants';
Expand Down Expand Up @@ -633,7 +634,7 @@ export const shouldBehaveLikeLSP8 = (buildContext: () => Promise<LSP8TestContext
const tx = await transferSuccessScenario(txParams, operator);

const typeId = LSP1_TYPE_IDS.LSP8Tokens_RecipientNotification;
const packedData = ethers.utils.solidityPack(
const packedData = abiCoder.encode(
['address', 'address', 'bytes32', 'bytes'],
[txParams.from, txParams.to, txParams.tokenId, txParams.data],
);
Expand Down Expand Up @@ -732,7 +733,7 @@ export const shouldBehaveLikeLSP8 = (buildContext: () => Promise<LSP8TestContext
const tx = await transferSuccessScenario(txParams, operator);

const typeId = LSP1_TYPE_IDS.LSP8Tokens_RecipientNotification;
const packedData = ethers.utils.solidityPack(
const packedData = abiCoder.encode(
['address', 'address', 'bytes32', 'bytes'],
[txParams.from, txParams.to, txParams.tokenId, txParams.data],
);
Expand Down Expand Up @@ -1076,7 +1077,7 @@ export const shouldBehaveLikeLSP8 = (buildContext: () => Promise<LSP8TestContext
txParams.tokenId.map((_, index) => async () => {
const typeId =
'0x29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe895';
const packedData = ethers.utils.solidityPack(
const packedData = abiCoder.encode(
['address', 'address', 'bytes32', 'bytes'],
[
txParams.from[index],
Expand Down

0 comments on commit 7faedec

Please sign in to comment.