diff --git a/contracts/implementations/tableland/DeviceDefinitionTable.sol b/contracts/implementations/tableland/DeviceDefinitionTable.sol index e6479113..ea7a3ea5 100644 --- a/contracts/implementations/tableland/DeviceDefinitionTable.sol +++ b/contracts/implementations/tableland/DeviceDefinitionTable.sol @@ -101,6 +101,7 @@ contract DeviceDefinitionTable is AccessControlInternal { dds.tables[manufacturerId] = tableId; emit DeviceDefinitionTableCreated(tableOwner, manufacturerId, tableId); + emit ManufacturerTableSet(manufacturerId, tableId); } /** @@ -163,6 +164,7 @@ contract DeviceDefinitionTable is AccessControlInternal { manufacturerIds[i], tableId ); + emit ManufacturerTableSet(manufacturerIds[i], tableId); } } diff --git a/test/tableland/DeviceDefinitionTable.test.ts b/test/tableland/DeviceDefinitionTable.test.ts index 5d512b5e..756c24e1 100644 --- a/test/tableland/DeviceDefinitionTable.test.ts +++ b/test/tableland/DeviceDefinitionTable.test.ts @@ -236,6 +236,15 @@ describe('DeviceDefinitionTable', async function () { .to.emit(ddTableInstance, 'DeviceDefinitionTableCreated') .withArgs(manufacturer1.address, 1, 2); }); + it('Should emit ManufacturerTableSet event with correct params', async () => { + await expect( + ddTableInstance + .connect(admin) + .createDeviceDefinitionTable(manufacturer1.address, 1) + ) + .to.emit(ddTableInstance, 'ManufacturerTableSet') + .withArgs(1, 2); + }); }); }); @@ -281,6 +290,15 @@ describe('DeviceDefinitionTable', async function () { .to.emit(ddTableInstance, 'DeviceDefinitionTableCreated') .withArgs(manufacturer1.address, 1, 2); }); + it('Should emit ManufacturerTableSet event with correct params', async () => { + await expect( + ddTableInstance + .connect(manufacturer1) + .createDeviceDefinitionTable(manufacturer1.address, 1) + ) + .to.emit(ddTableInstance, 'ManufacturerTableSet') + .withArgs(1, 2); + }); }); }); }); @@ -381,6 +399,19 @@ describe('DeviceDefinitionTable', async function () { .to.emit(ddTableInstance, 'DeviceDefinitionTableCreated') .withArgs(admin.address, 3, 4); }); + it('Should emit ManufacturerTableSet event with correct params', async () => { + await expect( + ddTableInstance + .connect(admin) + .createDeviceDefinitionTableBatch(admin.address, [1, 2, 3]) + ) + .to.emit(ddTableInstance, 'ManufacturerTableSet') + .withArgs(1, 2) + .to.emit(ddTableInstance, 'ManufacturerTableSet') + .withArgs(2, 3) + .to.emit(ddTableInstance, 'ManufacturerTableSet') + .withArgs(3, 4); + }); }); }); @@ -460,6 +491,19 @@ describe('DeviceDefinitionTable', async function () { .to.emit(ddTableInstance, 'DeviceDefinitionTableCreated') .withArgs(manufacturerAdmin.address, 6, 4); }); + it('Should emit ManufacturerTableSet event with correct params', async () => { + await expect( + ddTableInstance + .connect(manufacturerAdmin) + .createDeviceDefinitionTableBatch(manufacturerAdmin.address, [4, 5, 6]) + ) + .to.emit(ddTableInstance, 'ManufacturerTableSet') + .withArgs(4, 2) + .to.emit(ddTableInstance, 'ManufacturerTableSet') + .withArgs(5, 3) + .to.emit(ddTableInstance, 'ManufacturerTableSet') + .withArgs(6, 4); + }); }); }); });