From a6d7ec25365d049393ac73128768d3d2e21f9c50 Mon Sep 17 00:00:00 2001 From: Michal Iskierko Date: Wed, 16 Aug 2023 15:59:18 +0200 Subject: [PATCH] fix(@desktop/communities): Fix minting crash when community name length is <3 chars Fix #11906 --- src/app/modules/main/communities/tokens/module.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/modules/main/communities/tokens/module.nim b/src/app/modules/main/communities/tokens/module.nim index ca63b4a3b6..713b684ad7 100644 --- a/src/app/modules/main/communities/tokens/module.nim +++ b/src/app/modules/main/communities/tokens/module.nim @@ -185,8 +185,9 @@ method deployOwnerToken*(self: Module, communityId: string, fromAddress: string, self.tempChainId = chainId let communityDto = self.controller.getCommunityById(communityId) let commName = communityDto.name - self.tempOwnerDeploymentParams = DeploymentParameters(name: "Owner-" & commName, symbol: "OWN" & commName[0 .. 2].toUpper, supply: stint.u256("1"), infiniteSupply: false, transferable: true, remoteSelfDestruct: false, tokenUri: utl.changeCommunityKeyCompression(communityId) & "/") - self.tempMasterDeploymentParams = DeploymentParameters(name: "TMaster-" & commName, symbol: "TM" & commName[0 .. 2].toUpper, infiniteSupply: true, transferable: false, remoteSelfDestruct: true, tokenUri: utl.changeCommunityKeyCompression(communityId) & "/") + let commNameShort = try: commName[0 .. 2].toUpper except: commName.toUpper + self.tempOwnerDeploymentParams = DeploymentParameters(name: "Owner-" & commName, symbol: "OWN" & commNameShort, supply: stint.u256("1"), infiniteSupply: false, transferable: true, remoteSelfDestruct: false, tokenUri: utl.changeCommunityKeyCompression(communityId) & "/") + self.tempMasterDeploymentParams = DeploymentParameters(name: "TMaster-" & commName, symbol: "TM" & commNameShort, infiniteSupply: true, transferable: false, remoteSelfDestruct: true, tokenUri: utl.changeCommunityKeyCompression(communityId) & "/") self.tempOwnerTokenMetadata.description = ownerDescription self.tempOwnerTokenMetadata.tokenType = TokenType.ERC721 self.tempMasterTokenMetadata.description = masterDescription