Skip to content

Commit

Permalink
Reemiting PoolCreated event (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggviana committed Aug 26, 2021
1 parent 6145d25 commit 219ce08
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
25 changes: 25 additions & 0 deletions abi/OptionAMMFactory.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,31 @@
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "deployer",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "pool",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "option",
"type": "address"
}
],
"name": "PoolCreated",
"type": "event"
},
{
"inputs": [],
"name": "configurationManager",
Expand Down
3 changes: 3 additions & 0 deletions contracts/amm/OptionAMMFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ contract OptionAMMFactory is IOptionAMMFactory {
*/
IFeePoolBuilder public immutable feePoolBuilder;

event PoolCreated(address indexed deployer, address pool, address option);

constructor(IConfigurationManager _configurationManager, address _feePoolBuilder) public {
require(
Address.isContract(address(_configurationManager)),
Expand Down Expand Up @@ -62,6 +64,7 @@ contract OptionAMMFactory is IOptionAMMFactory {
);

address poolAddress = address(pool);
emit PoolCreated(msg.sender, poolAddress, _optionAddress);
registry.setPool(_optionAddress, poolAddress);

return poolAddress;
Expand Down
4 changes: 4 additions & 0 deletions test/amm/OptionAMMFactory.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ describe('OptionAMMFactory', () => {
const pool = await getPoolCreated(tx, option, configurationManager)
const registry = await ethers.getContractAt('OptionPoolRegistry', await configurationManager.getOptionPoolRegistry())

await expect(tx)
.to.emit(factory, 'PoolCreated')
.withArgs(caller.address, pool.address, option.address)

await expect(tx)
.to.emit(registry, 'PoolSet')
.withArgs(factory.address, option.address, pool.address)
Expand Down

0 comments on commit 219ce08

Please sign in to comment.