2023-02-17 12:56:13 +01:00
|
|
|
import QtQuick 2.15
|
2023-04-11 10:09:01 +02:00
|
|
|
import utils 1.0
|
2022-08-23 10:46:37 +02:00
|
|
|
|
|
|
|
QtObject {
|
2022-11-25 18:35:30 +01:00
|
|
|
id: root
|
|
|
|
|
2023-03-09 11:03:17 +01:00
|
|
|
property var communityTokensModuleInst: communityTokensModule ?? null
|
2023-02-22 18:10:46 +01:00
|
|
|
|
|
|
|
// Network selection properties:
|
|
|
|
property var layer1Networks: networksModule.layer1
|
|
|
|
property var layer2Networks: networksModule.layer2
|
|
|
|
property var testNetworks: networksModule.test
|
|
|
|
property var enabledNetworks: networksModule.enabled
|
2023-03-09 12:12:49 +01:00
|
|
|
property var allNetworks: networksModule.all
|
2023-03-07 12:32:45 +01:00
|
|
|
|
2023-04-13 10:09:06 +02:00
|
|
|
signal deployFeeUpdated(var ethCurrency, var fiatCurrency, int error)
|
2023-05-05 13:03:59 +02:00
|
|
|
signal selfDestructFeeUpdated(var ethCurrency, var fiatCurrency, int error)
|
|
|
|
|
2023-04-13 10:09:06 +02:00
|
|
|
signal deploymentStateChanged(string communityId, int status, string url)
|
2023-05-05 13:03:59 +02:00
|
|
|
|
2023-05-18 17:01:48 +02:00
|
|
|
signal burnFeeUpdated(string value) // TO BE REMOVED
|
2023-03-13 17:32:14 +01:00
|
|
|
|
2023-05-05 13:03:59 +02:00
|
|
|
signal remoteDestructStateChanged(string communityId, string tokenName, int status, string url)
|
|
|
|
|
2023-03-23 14:17:07 +01:00
|
|
|
// Minting tokens:
|
|
|
|
function deployCollectible(communityId, accountAddress, name, symbol, description, supply,
|
2023-05-08 13:33:49 +02:00
|
|
|
infiniteSupply, transferable, selfDestruct, chainId, artworkSource, accountName, artworkCropRect)
|
2023-03-23 14:17:07 +01:00
|
|
|
{
|
|
|
|
// TODO: Backend needs to create new role `accountName` and update this call accordingly
|
2023-05-08 13:33:49 +02:00
|
|
|
// TODO: Backend needs to modify the call to expect an image JSON file with cropped artwork information:
|
|
|
|
const jsonArtworkFile = Utils.getImageAndCropInfoJson(artworkSource, artworkCropRect)
|
2023-03-23 14:17:07 +01:00
|
|
|
communityTokensModuleInst.deployCollectible(communityId, accountAddress, name, symbol, description, supply,
|
2023-05-08 13:33:49 +02:00
|
|
|
infiniteSupply, transferable, selfDestruct, chainId, artworkSource/*instead: jsonArtworkFile*/)
|
2023-03-23 14:17:07 +01:00
|
|
|
}
|
|
|
|
|
2023-05-25 12:46:53 +02:00
|
|
|
function deployAsset(communityId, accountAddress, name, symbol, description, supply,
|
|
|
|
infiniteSupply, decimals, chainId, artworkSource, accountName, artworkCropRect)
|
|
|
|
{
|
|
|
|
// TODO: Backend needs to create new role `accountName` and update this call accordingly
|
|
|
|
// TODO: Backend needs to modify the call to expect an image JSON file with cropped artwork information:
|
|
|
|
const jsonArtworkFile = Utils.getImageAndCropInfoJson(artworkSource, artworkCropRect)
|
|
|
|
console.log("TODO: Deploy Asset backend!")
|
|
|
|
}
|
|
|
|
|
2023-05-30 17:18:45 +02:00
|
|
|
function deleteToken(communityId, contractUniqueKey) {
|
|
|
|
console.log("TODO: Delete token bakend!")
|
|
|
|
}
|
|
|
|
|
|
|
|
function retryMintToken(communityId, contractUniqueKey) {
|
|
|
|
console.log("TODO: Retry mint token bakend!")
|
|
|
|
}
|
|
|
|
|
2023-04-03 13:29:36 +02:00
|
|
|
readonly property Connections connections: Connections {
|
|
|
|
target: communityTokensModuleInst
|
|
|
|
function onDeployFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
|
|
|
root.deployFeeUpdated(ethCurrency, fiatCurrency, errorCode)
|
|
|
|
}
|
2023-05-05 13:03:59 +02:00
|
|
|
function onSelfDestructFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
|
|
|
root.selfDestructFeeUpdated(ethCurrency, fiatCurrency, errorCode)
|
|
|
|
}
|
2023-04-28 20:48:20 +02:00
|
|
|
function onDeploymentStateChanged(communityId, status, url) {
|
|
|
|
root.deploymentStateChanged(communityId, status, url)
|
2023-04-11 10:09:01 +02:00
|
|
|
}
|
2023-05-05 13:03:59 +02:00
|
|
|
function onRemoteDestructStateChanged(communityId, tokenName, status, url) {
|
|
|
|
root.remoteDestructStateChanged(communityId, tokenName, status, url)
|
|
|
|
}
|
2023-04-03 13:29:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function computeDeployFee(chainId, accountAddress) {
|
|
|
|
communityTokensModuleInst.computeDeployFee(chainId, accountAddress)
|
2023-03-23 14:17:07 +01:00
|
|
|
}
|
|
|
|
|
2023-05-26 17:00:51 +02:00
|
|
|
function computeSelfDestructFee(selfDestructTokensList, tokenKey) {
|
|
|
|
communityTokensModuleInst.computeSelfDestructFee(JSON.stringify(selfDestructTokensList), tokenKey)
|
2023-03-31 14:52:51 +02:00
|
|
|
}
|
|
|
|
|
2023-05-26 17:00:51 +02:00
|
|
|
function remoteSelfDestructCollectibles(communityId, selfDestructTokensList, tokenKey) {
|
|
|
|
communityTokensModuleInst.selfDestructCollectibles(communityId, JSON.stringify(selfDestructTokensList), tokenKey)
|
2023-03-31 14:52:51 +02:00
|
|
|
}
|
|
|
|
|
2023-05-18 17:01:48 +02:00
|
|
|
// Burn:
|
|
|
|
function computeBurnFee(chainId) {
|
|
|
|
// TODO BACKEND
|
|
|
|
root.burnFeeUpdated("0,0010 ETH")
|
|
|
|
console.warn("TODO: Compute burn fee backend")
|
|
|
|
}
|
|
|
|
|
2023-05-26 17:00:51 +02:00
|
|
|
function burnCollectibles(tokenKey, burnAmount) {
|
2023-05-18 17:01:48 +02:00
|
|
|
// TODO BACKEND
|
|
|
|
console.warn("TODO: Burn collectible backend")
|
|
|
|
}
|
|
|
|
|
2023-03-13 17:32:14 +01:00
|
|
|
// Airdrop tokens:
|
2023-03-13 11:16:08 +01:00
|
|
|
function airdrop(communityId, airdropTokens, addresses) {
|
2023-04-25 23:24:04 +02:00
|
|
|
communityTokensModuleInst.airdropCollectibles(communityId, JSON.stringify(airdropTokens), JSON.stringify(addresses))
|
2023-03-13 17:32:14 +01:00
|
|
|
}
|
2022-08-23 10:46:37 +02:00
|
|
|
}
|