From 1085ee83089f44ce9c5492835f90359279302500 Mon Sep 17 00:00:00 2001 From: Cuteivist Date: Wed, 18 Oct 2023 12:12:29 +0200 Subject: [PATCH] feat: Add base url to community ERC20 (#21) --- .gas-snapshot | 24 ++++++++++++------------ contracts/tokens/CommunityERC20.sol | 4 ++++ test/CommunityERC20.t.sol | 3 +++ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 676e4df..5f54e93 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -3,15 +3,15 @@ AddEntryTest:test_RevertWhen_EntryAlreadyExists() (gas: 42644) AddEntryTest:test_RevertWhen_InvalidAddress() (gas: 25133) AddEntryTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 14827) CollectibleV1Test:test_Deployment() (gas: 36386) -CommunityERC20Test:test_Deployment() (gas: 27659) +CommunityERC20Test:test_Deployment() (gas: 35198) CommunityTokenDeployerTest:test_Deployment() (gas: 14805) CreateTest:test_Create() (gas: 2269916) CreateTest:test_Create() (gas: 2568994) CreateTest:test_RevertWhen_InvalidOwnerTokenAddress() (gas: 15523) CreateTest:test_RevertWhen_InvalidReceiverAddress() (gas: 15656) CreateTest:test_RevertWhen_InvalidSignerPublicKey() (gas: 17057) -CreateTest:test_RevertWhen_InvalidTokenMetadata() (gas: 27936) -CreateTest:test_RevertWhen_InvalidTokenMetadata() (gas: 28173) +CreateTest:test_RevertWhen_InvalidTokenMetadata() (gas: 29940) +CreateTest:test_RevertWhen_InvalidTokenMetadata() (gas: 30179) CreateTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 16421) CreateTest:test_RevertWhen_SenderIsNotTokenDeployer() (gas: 16524) DeployContracts:test() (gas: 120) @@ -23,20 +23,20 @@ DeployTest:test_RevertWhen_InvalidCommunityAddress() (gas: 51385) DeployTest:test_RevertWhen_InvalidDeployerAddress() (gas: 55272) DeployTest:test_RevertWhen_InvalidDeploymentSignature() (gas: 65617) DeployTest:test_RevertWhen_InvalidSignerPublicKey() (gas: 53433) -DeployTest:test_RevertWhen_InvalidTokenMetadata() (gas: 2692510) +DeployTest:test_RevertWhen_InvalidTokenMetadata() (gas: 2694728) DeploymentTest:test_Deployment() (gas: 14671) DeploymentTest:test_Deployment() (gas: 14671) DeploymentTest:test_Deployment() (gas: 17295) GetEntryTest:test_ReturnZeroAddressIfEntryDoesNotExist() (gas: 11906) -MintToTest:test_Deployment() (gas: 27681) +MintToTest:test_Deployment() (gas: 35220) MintToTest:test_Deployment() (gas: 36386) MintToTest:test_Deployment() (gas: 83220) -MintToTest:test_MintTo() (gas: 178173) +MintToTest:test_MintTo() (gas: 178063) MintToTest:test_MintTo() (gas: 526242) -MintToTest:test_RevertWhen_AddressesAndAmountsAreNotEqualLength() (gas: 29695) +MintToTest:test_RevertWhen_AddressesAndAmountsAreNotEqualLength() (gas: 29673) MintToTest:test_RevertWhen_MaxSupplyIsReached() (gas: 20653) MintToTest:test_RevertWhen_MaxSupplyIsReached() (gas: 511039) -MintToTest:test_RevertWhen_MaxSupplyReached() (gas: 134821) +MintToTest:test_RevertWhen_MaxSupplyReached() (gas: 134799) MintToTest:test_RevertWhen_SenderIsNotOwner() (gas: 31544) OwnerTokenTest:test_Deployment() (gas: 83220) RemoteBurnTest:test_Deployment() (gas: 36386) @@ -55,13 +55,13 @@ SetMasterTokenFactoryAddressTest:test_Deployment() (gas: 14805) SetMasterTokenFactoryAddressTest:test_RevertWhen_InvalidTokenFactoryAddress() (gas: 12992) SetMasterTokenFactoryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12465) SetMasterTokenFactoryAddressTest:test_SetOwnerTokenFactoryAddress() (gas: 22861) -SetMaxSupplyTest:test_Deployment() (gas: 27659) +SetMaxSupplyTest:test_Deployment() (gas: 35198) SetMaxSupplyTest:test_Deployment() (gas: 83242) SetMaxSupplyTest:test_RevertWhen_CalledBecauseMaxSupplyIsLocked() (gas: 14327) -SetMaxSupplyTest:test_RevertWhen_MaxSupplyLowerThanTotalSupply() (gas: 163620) +SetMaxSupplyTest:test_RevertWhen_MaxSupplyLowerThanTotalSupply() (gas: 163641) SetMaxSupplyTest:test_RevertWhen_SenderIsNotOwner() (gas: 12527) -SetMaxSupplyTest:test_RevertWhen_SenderIsNotOwner() (gas: 21402) -SetMaxSupplyTest:test_SetMaxSupply() (gas: 23955) +SetMaxSupplyTest:test_RevertWhen_SenderIsNotOwner() (gas: 21445) +SetMaxSupplyTest:test_SetMaxSupply() (gas: 23998) SetOwnerTokenFactoryAddressTest:test_Deployment() (gas: 14805) SetOwnerTokenFactoryAddressTest:test_RevertWhen_InvalidTokenFactoryAddress() (gas: 12970) SetOwnerTokenFactoryAddressTest:test_RevertWhen_SenderIsNotOwner() (gas: 12443) diff --git a/contracts/tokens/CommunityERC20.sol b/contracts/tokens/CommunityERC20.sol index a94cb26..a8d2630 100644 --- a/contracts/tokens/CommunityERC20.sol +++ b/contracts/tokens/CommunityERC20.sol @@ -27,11 +27,14 @@ contract CommunityERC20 is Context, Ownable, ERC20, CommunityOwnable { uint8 private immutable customDecimals; + string public baseTokenURI; + constructor( string memory _name, string memory _symbol, uint8 _decimals, uint256 _maxSupply, + string memory _baseTokenURI, address _ownerToken, address _masterToken ) @@ -40,6 +43,7 @@ contract CommunityERC20 is Context, Ownable, ERC20, CommunityOwnable { { maxSupply = _maxSupply; customDecimals = _decimals; + baseTokenURI = _baseTokenURI; } // Events diff --git a/test/CommunityERC20.t.sol b/test/CommunityERC20.t.sol index 7efd11a..f1cb7df 100644 --- a/test/CommunityERC20.t.sol +++ b/test/CommunityERC20.t.sol @@ -17,6 +17,7 @@ contract CommunityERC20Test is Test { string internal name = "Test"; string internal symbol = "TEST"; + string internal baseURI = "http://local.dev"; uint256 internal maxSupply = 100; uint8 internal decimals = 18; @@ -31,6 +32,7 @@ contract CommunityERC20Test is Test { symbol, decimals, maxSupply, + baseURI, address(ownerToken), address(masterToken) ); @@ -46,6 +48,7 @@ contract CommunityERC20Test is Test { assertEq(communityToken.symbol(), symbol); assertEq(communityToken.maxSupply(), maxSupply); assertEq(communityToken.decimals(), decimals); + assertEq(communityToken.baseTokenURI(), baseURI); } }