Skip to content

Commit

Permalink
fix: add implementation event (Open-Attestation#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
superical committed Nov 25, 2022
1 parent be9e1d0 commit ce9c8c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contracts/utils/TDocDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ contract TDocDeployer is OwnableUpgradeable, UUPSUpgradeable, TDocDeployerErrors
bytes params
);

event AddImplementation(address indexed implementation, address indexed titleEscrowFactory);

// mapping: implementation => title escrow factory
mapping(address => address) public implementations;

Expand Down Expand Up @@ -48,6 +50,8 @@ contract TDocDeployer is OwnableUpgradeable, UUPSUpgradeable, TDocDeployerErrors
revert ImplementationAlreadyAdded();
}
implementations[implementation] = titleEscrowFactory;

emit AddImplementation(implementation, titleEscrowFactory);
}

function removeImplementation(address implementation) external onlyOwner {
Expand Down
8 changes: 8 additions & 0 deletions test/TDocDeployer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ describe("TDocDeployer", async () => {
expect(res).to.equal(fakeTitleEscrowFactory);
});

it("should emit AddImplementation when add implementation", async () => {
const tx = await deployerContractAsNonOwner.implementations(implContract.address);

expect(tx)
.to.emit(deployerContract, "AddImplementation")
.withArgs(implContract.address, fakeTitleEscrowFactory);
});

it("should not allow adding an already added implementation", async () => {
const tx = deployerContractAsOwner.addImplementation(implContract.address, fakeTitleEscrowFactory);

Expand Down

0 comments on commit ce9c8c0

Please sign in to comment.