fix(#desktop/communities): Remove temp minting and temp airdrop buttons
Improve logs in community tokens service. Issue #11250
This commit is contained in:
parent
6b8ef1411b
commit
0c78a648b5
|
@ -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)
|
|
@ -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
|
||||
|
|
|
@ -14,7 +14,7 @@ type
|
|||
type
|
||||
PrivilegesLevel* {.pure.} = enum
|
||||
Owner,
|
||||
Master,
|
||||
TokenMaster,
|
||||
Community
|
||||
|
||||
type
|
||||
|
|
|
@ -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
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue