diff --git a/src/app/modules/main/communities/tokens/controller.nim b/src/app/modules/main/communities/tokens/controller.nim index 65052fb09f..e5c36af7c2 100644 --- a/src/app/modules/main/communities/tokens/controller.nim +++ b/src/app/modules/main/communities/tokens/controller.nim @@ -134,8 +134,8 @@ proc getNetwork*(self:Controller, chainId: int): NetworkDto = proc getOwnerToken*(self: Controller, communityId: string): CommunityTokenDto = return self.communityTokensService.getOwnerToken(communityId) -proc getMasterToken*(self: Controller, communityId: string): CommunityTokenDto = - return self.communityTokensService.getMasterToken(communityId) +proc getTokenMasterToken*(self: Controller, communityId: string): CommunityTokenDto = + return self.communityTokensService.getTokenMasterToken(communityId) proc getCommunityById*(self: Controller, communityId: string): CommunityDto = return self.communityService.getCommunityById(communityId) \ No newline at end of file diff --git a/src/app/modules/main/communities/tokens/module.nim b/src/app/modules/main/communities/tokens/module.nim index 6a6737f68a..4f991d5762 100644 --- a/src/app/modules/main/communities/tokens/module.nim +++ b/src/app/modules/main/communities/tokens/module.nim @@ -159,7 +159,7 @@ method burnTokens*(self: Module, communityId: string, contractUniqueKey: string, method deployCollectibles*(self: Module, communityId: string, fromAddress: string, name: string, symbol: string, description: string, supply: float64, infiniteSupply: bool, transferable: bool, selfDestruct: bool, chainId: int, imageCropInfoJson: string) = let ownerToken = self.controller.getOwnerToken(communityId) - let masterToken = self.controller.getMasterToken(communityId) + let masterToken = self.controller.getTokenMasterToken(communityId) if not (ownerToken.address != "" and ownerToken.deployState == DeployState.Deployed and masterToken.address != "" and masterToken.deployState == DeployState.Deployed): error "Owner token and master token not deployed" @@ -185,6 +185,13 @@ method deployCollectibles*(self: Module, communityId: string, fromAddress: strin method deployOwnerToken*(self: Module, communityId: string, fromAddress: string, ownerName: string, ownerSymbol: string, ownerDescription: string, masterName: string, masterSymbol: string, masterDescription: string, chainId: int, imageCropInfoJson: string) = + let ownerToken = self.controller.getOwnerToken(communityId) + let masterToken = self.controller.getTokenMasterToken(communityId) + + if ownerToken.address != "" and ownerToken.deployState != DeployState.Failed and masterToken.address != "" and masterToken.deployState == DeployState.Failed: + error "Owner token and master token are deployed or pending" + return + self.tempAddressFrom = fromAddress self.tempCommunityId = communityId self.tempChainId = chainId diff --git a/src/app_service/service/community_tokens/dto/community_token.nim b/src/app_service/service/community_tokens/dto/community_token.nim index 8ca4c55977..2b3dec4630 100644 --- a/src/app_service/service/community_tokens/dto/community_token.nim +++ b/src/app_service/service/community_tokens/dto/community_token.nim @@ -14,7 +14,7 @@ type type PrivilegesLevel* {.pure.} = enum Owner, - Master, + TokenMaster, Community type diff --git a/src/app_service/service/community_tokens/service.nim b/src/app_service/service/community_tokens/service.nim index f8bfee3be2..d8fe02a8f1 100644 --- a/src/app_service/service/community_tokens/service.nim +++ b/src/app_service/service/community_tokens/service.nim @@ -287,7 +287,7 @@ QtObject: let deployState = if receivedData.success: DeployState.Deployed else: DeployState.Failed let tokenDto = toCommunityTokenDto(parseJson(receivedData.data)) if not receivedData.success: - error "Collectible contract not deployed", chainId=tokenDto.chainId, address=tokenDto.address + error "Community contract not deployed", chainId=tokenDto.chainId, address=tokenDto.address try: discard updateCommunityTokenState(tokenDto.chainId, tokenDto.address, deployState) #update db state # now add community token to community and publish update @@ -296,13 +296,13 @@ QtObject: let error = Json.decode($response.error, RpcError) raise newException(RpcException, "error adding community token: " & error.message) except RpcException: - error "Error updating collectibles contract state", message = getCurrentExceptionMsg() + error "Error updating community contract state", message = getCurrentExceptionMsg() let data = CommunityTokenDeployedStatusArgs(communityId: tokenDto.communityId, contractAddress: tokenDto.address, deployState: deployState, chainId: tokenDto.chainId, transactionHash: receivedData.transactionHash) self.events.emit(SIGNAL_COMMUNITY_TOKEN_DEPLOY_STATUS, data) except Exception as e: - error "Error processing Collectible deployment pending transaction event", msg=e.msg, receivedData + error "Error processing community token deployment pending transaction event", msg=e.msg, receivedData self.events.on(PendingTransactionTypeDto.DeployOwnerToken.event) do(e: Args): var receivedData = TransactionMinedArgs(e) @@ -310,7 +310,7 @@ QtObject: let deployState = if receivedData.success: DeployState.Deployed else: DeployState.Failed let ownerTransactionDetails = toOwnerTokenDeploymentTransactionDetails(parseJson(receivedData.data)) if not receivedData.success: - error "Owner contracts not deployed", chainId=ownerTransactionDetails.ownerToken.chainId, address=ownerTransactionDetails.ownerToken.address + warn "Owner contracts not deployed", chainId=ownerTransactionDetails.ownerToken.chainId, address=ownerTransactionDetails.ownerToken.address var masterContractAddress = ownerTransactionDetails.masterToken.address try: @@ -347,7 +347,7 @@ QtObject: transactionHash: receivedData.transactionHash) self.events.emit(SIGNAL_OWNER_TOKEN_DEPLOY_STATUS, data) except Exception as e: - error "Error processing Collectible deployment pending transaction event", msg=e.msg, receivedData + error "Error processing Owner token deployment pending transaction event", msg=e.msg, receivedData self.events.on(PendingTransactionTypeDto.AirdropCommunityToken.event) do(e: Args): let receivedData = TransactionMinedArgs(e) @@ -466,7 +466,7 @@ QtObject: debug "Deployment transaction hash ", transactionHash=transactionHash var ownerToken = self.createCommunityToken(ownerDeploymentParams, ownerTokenMetadata, chainId, ownerContractAddress, communityId, addressFrom, PrivilegesLevel.Owner) - var masterToken = self.createCommunityToken(masterDeploymentParams, masterTokenMetadata, chainId, temporaryMasterContractAddress(ownerContractAddress), communityId, addressFrom, PrivilegesLevel.Master) + var masterToken = self.createCommunityToken(masterDeploymentParams, masterTokenMetadata, chainId, temporaryMasterContractAddress(ownerContractAddress), communityId, addressFrom, PrivilegesLevel.TokenMaster) var croppedImage = croppedImageJson.parseJson ownerToken.image = croppedImage{"imagePath"}.getStr @@ -1048,8 +1048,8 @@ QtObject: if token.privilegesLevel == PrivilegesLevel.Owner: return token - proc getMasterToken*(self: Service, communityId: string): CommunityTokenDto = + proc getTokenMasterToken*(self: Service, communityId: string): CommunityTokenDto = let communityTokens = self.getCommunityTokens(communityId) for token in communityTokens: - if token.privilegesLevel == PrivilegesLevel.Master: + if token.privilegesLevel == PrivilegesLevel.TokenMaster: return token \ No newline at end of file diff --git a/ui/app/AppLayouts/Communities/panels/AirdropsSettingsPanel.qml b/ui/app/AppLayouts/Communities/panels/AirdropsSettingsPanel.qml index 67f89f1cfb..49c075334a 100644 --- a/ui/app/AppLayouts/Communities/panels/AirdropsSettingsPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/AirdropsSettingsPanel.qml @@ -74,21 +74,6 @@ StackView { title: qsTr("Airdrops") buttons: [ - // TO BE REMOVED when Owner and TMaster backend is integrated. This is just to keep the airdrop flow available somehow - StatusButton { - - text: qsTr("TEMP Airdrop") - - onClicked: root.push(newAirdropView, StackView.Immediate) - - StatusToolTip { - visible: parent.hovered - text: "TO BE REMOVED when Owner and TMaster backend is integrated. This is just to keep the airdrop flow available somehow" - orientation: StatusToolTip.Orientation.Bottom - y: parent.height + 12 - maxWidth: 300 - } - }, StatusButton { objectName: "addNewItemButton" @@ -98,7 +83,6 @@ StackView { onClicked: root.push(newAirdropView, StackView.Immediate) } - ] contentItem: WelcomeSettingsView { diff --git a/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml b/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml index 77239daaed..d9d8ab4706 100644 --- a/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml @@ -143,21 +143,6 @@ StackView { title: qsTr("Tokens") buttons: [ - // TO BE REMOVED when Owner and TMaster backend is integrated. This is just to keep the minting flow available somehow - StatusButton { - - text: qsTr("TEMP Mint token") - - onClicked: root.push(newTokenViewComponent, StackView.Immediate) - - StatusToolTip { - visible: parent.hovered - text: "TO BE REMOVED when Owner and TMaster backend is integrated. This is just to keep the airdrop flow available somehow" - orientation: StatusToolTip.Orientation.Bottom - y: parent.height + 12 - maxWidth: 300 - } - }, DisabledTooltipButton { readonly property bool buttonEnabled: root.isPrivilegedTokenOwnerProfile && root.arePrivilegedTokensDeployed