feat: add token specific deploy events in deployer contract

While the underlying factories emit a `CreateToken` event, there was a
request to have specific deployment events for each token emitted by the
deployer.
This commit is contained in:
r4bbit 2023-09-22 08:24:03 +02:00
parent 69e0e5eeaf
commit 1979698d4c
No known key found for this signature in database
GPG Key ID: E95F1E9447DC91A9
2 changed files with 22 additions and 15 deletions

View File

@ -16,15 +16,14 @@ CreateTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 16421)
CreateTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 16524) CreateTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 16524)
DeployContracts:test() (gas: 120) DeployContracts:test() (gas: 120)
DeployOwnerAndMasterToken:test() (gas: 120) DeployOwnerAndMasterToken:test() (gas: 120)
DeployTest:test_Deploy() (gas: 4776466) DeployTest:test_Deploy() (gas: 4778686)
DeployTest:test_Deployment() (gas: 14925) DeployTest:test_Deployment() (gas: 14947)
DeployTest:test_RevertWhen_AlreadyDeployed() (gas: 4772349) DeployTest:test_RevertWhen_AlreadyDeployed() (gas: 4774488)
DeployTest:test_RevertWhen_DeploymentSignatureExpired() (gas: 53642) DeployTest:test_RevertWhen_InvalidCommunityAddress() (gas: 51318)
DeployTest:test_RevertWhen_InvalidCommunityAddress() (gas: 51341) DeployTest:test_RevertWhen_InvalidDeployerAddress() (gas: 55205)
DeployTest:test_RevertWhen_InvalidDeployerAddress() (gas: 55329) DeployTest:test_RevertWhen_InvalidDeploymentSignature() (gas: 65550)
DeployTest:test_RevertWhen_InvalidDeploymentSignature() (gas: 65663) DeployTest:test_RevertWhen_InvalidSignerPublicKey() (gas: 53366)
DeployTest:test_RevertWhen_InvalidSignerPublicKey() (gas: 53435) DeployTest:test_RevertWhen_InvalidTokenMetadata() (gas: 2612983)
DeployTest:test_RevertWhen_InvalidTokenMetadata() (gas: 2612126)
DeploymentTest:test_Deployment() (gas: 14671) DeploymentTest:test_Deployment() (gas: 14671)
DeploymentTest:test_Deployment() (gas: 14671) DeploymentTest:test_Deployment() (gas: 14671)
DeploymentTest:test_Deployment() (gas: 17250) DeploymentTest:test_Deployment() (gas: 17250)
@ -52,9 +51,9 @@ SetDeploymentRegistryAddressTest:test_RevertWhen_InvalidDeploymentRegistryAddres
SetDeploymentRegistryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12508) SetDeploymentRegistryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12508)
SetDeploymentRegistryAddressTest:test_SetDeploymentRegistryAddress() (gas: 22903) SetDeploymentRegistryAddressTest:test_SetDeploymentRegistryAddress() (gas: 22903)
SetMasterTokenFactoryAddressTest:test_Deployment() (gas: 14805) SetMasterTokenFactoryAddressTest:test_Deployment() (gas: 14805)
SetMasterTokenFactoryAddressTest:test_RevertWhen_InvalidTokenFactoryAddress() (gas: 13014) SetMasterTokenFactoryAddressTest:test_RevertWhen_InvalidTokenFactoryAddress() (gas: 12992)
SetMasterTokenFactoryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12487) SetMasterTokenFactoryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12465)
SetMasterTokenFactoryAddressTest:test_SetOwnerTokenFactoryAddress() (gas: 22861) SetMasterTokenFactoryAddressTest:test_SetOwnerTokenFactoryAddress() (gas: 22839)
SetMaxSupplyTest:test_Deployment() (gas: 29720) SetMaxSupplyTest:test_Deployment() (gas: 29720)
SetMaxSupplyTest:test_Deployment() (gas: 85482) SetMaxSupplyTest:test_Deployment() (gas: 85482)
SetMaxSupplyTest:test_RevertWhen_CalledBecauseMaxSupplyIsLocked() (gas: 16533) SetMaxSupplyTest:test_RevertWhen_CalledBecauseMaxSupplyIsLocked() (gas: 16533)
@ -63,9 +62,9 @@ SetMaxSupplyTest:test_RevertWhen_SenderIsNotOwner() (gas: 12817)
SetMaxSupplyTest:test_RevertWhen_SenderIsNotOwner() (gas: 16939) SetMaxSupplyTest:test_RevertWhen_SenderIsNotOwner() (gas: 16939)
SetMaxSupplyTest:test_SetMaxSupply() (gas: 15597) SetMaxSupplyTest:test_SetMaxSupply() (gas: 15597)
SetOwnerTokenFactoryAddressTest:test_Deployment() (gas: 14805) SetOwnerTokenFactoryAddressTest:test_Deployment() (gas: 14805)
SetOwnerTokenFactoryAddressTest:test_RevertWhen_InvalidTokenFactoryAddress() (gas: 12992) SetOwnerTokenFactoryAddressTest:test_RevertWhen_InvalidTokenFactoryAddress() (gas: 12970)
SetOwnerTokenFactoryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12465) SetOwnerTokenFactoryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12443)
SetOwnerTokenFactoryAddressTest:test_SetOwnerTokenFactoryAddress() (gas: 22862) SetOwnerTokenFactoryAddressTest:test_SetOwnerTokenFactoryAddress() (gas: 22840)
SetSignerPublicKeyTest:test_Deployment() (gas: 85460) SetSignerPublicKeyTest:test_Deployment() (gas: 85460)
SetSignerPublicKeyTest:test_RevertWhen_SenderIsNotOwner() (gas: 17634) SetSignerPublicKeyTest:test_RevertWhen_SenderIsNotOwner() (gas: 17634)
SetSignerPublicKeyTest:test_SetSignerPublicKey() (gas: 26369) SetSignerPublicKeyTest:test_SetSignerPublicKey() (gas: 26369)

View File

@ -54,6 +54,8 @@ contract CommunityTokenDeployer is EIP712("CommunityTokenDeployer", "1"), Ownabl
event OwnerTokenFactoryAddressChange(address indexed); event OwnerTokenFactoryAddressChange(address indexed);
event MasterTokenFactoryAddressChange(address indexed); event MasterTokenFactoryAddressChange(address indexed);
event DeploymentRegistryAddressChange(address indexed); event DeploymentRegistryAddressChange(address indexed);
event DeployOwnerToken(address indexed);
event DeployMasterToken(address indexed);
/// @dev Needed to avoid "Stack too deep" error. /// @dev Needed to avoid "Stack too deep" error.
struct TokenConfig { struct TokenConfig {
@ -107,6 +109,8 @@ contract CommunityTokenDeployer is EIP712("CommunityTokenDeployer", "1"), Ownabl
* @dev Anyone can call this function but a valid EIP712 hash signature has to be * @dev Anyone can call this function but a valid EIP712 hash signature has to be
* provided for a successful deployment. * provided for a successful deployment.
* @dev Emits {CreateToken} events via underlying token factories. * @dev Emits {CreateToken} events via underlying token factories.
* @dev Emits {DeployOwnerToken} event.
* @dev Emits {DeployMasterToken} event.
* *
* @param _ownerToken A `TokenConfig` containing ERC721 metadata for `OwnerToken` * @param _ownerToken A `TokenConfig` containing ERC721 metadata for `OwnerToken`
* @param _masterToken A `TokenConfig` containing ERC721 metadata for `MasterToken` * @param _masterToken A `TokenConfig` containing ERC721 metadata for `MasterToken`
@ -144,10 +148,14 @@ contract CommunityTokenDeployer is EIP712("CommunityTokenDeployer", "1"), Ownabl
_ownerToken.name, _ownerToken.symbol, _ownerToken.baseURI, msg.sender, _signerPublicKey _ownerToken.name, _ownerToken.symbol, _ownerToken.baseURI, msg.sender, _signerPublicKey
); );
emit DeployOwnerToken(ownerToken);
address masterToken = ITokenFactory(masterTokenFactory).create( address masterToken = ITokenFactory(masterTokenFactory).create(
_masterToken.name, _masterToken.symbol, _masterToken.baseURI, ownerToken, bytes("") _masterToken.name, _masterToken.symbol, _masterToken.baseURI, ownerToken, bytes("")
); );
emit DeployMasterToken(masterToken);
IAddressRegistry(deploymentRegistry).addEntry(_signature.signer, ownerToken); IAddressRegistry(deploymentRegistry).addEntry(_signature.signer, ownerToken);
return (ownerToken, masterToken); return (ownerToken, masterToken);
} }