2023-02-17 11:56:13 +00:00
|
|
|
import QtQuick 2.15
|
2023-04-11 08:09:01 +00:00
|
|
|
import utils 1.0
|
2022-08-23 08:46:37 +00:00
|
|
|
|
|
|
|
QtObject {
|
2022-11-25 17:35:30 +00:00
|
|
|
id: root
|
|
|
|
|
2023-03-09 10:03:17 +00:00
|
|
|
property var communityTokensModuleInst: communityTokensModule ?? null
|
2023-02-22 17:10:46 +00: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 11:12:49 +00:00
|
|
|
property var allNetworks: networksModule.all
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
|
|
// Token holders model: MOCKED DATA -> TODO: Update with real data
|
|
|
|
readonly property var holdersModel: ListModel {
|
|
|
|
|
|
|
|
readonly property string image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/
|
|
|
|
nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
|
|
|
|
|
|
|
|
Component.onCompleted:
|
|
|
|
append([
|
|
|
|
{
|
|
|
|
ensName: "carmen.eth",
|
|
|
|
walletAddress: "0xb794f5450ba39494ce839613fffba74279579268",
|
|
|
|
imageSource:image,
|
2023-03-31 10:20:23 +00:00
|
|
|
amount: 3,
|
|
|
|
selfDestructAmount: 0,
|
|
|
|
selfDestruct: false
|
2023-03-07 11:32:45 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ensName: "chris.eth",
|
|
|
|
walletAddress: "0xb794f5ea0ba39494ce839613fffba74279579268",
|
|
|
|
imageSource: image,
|
2023-03-31 10:20:23 +00:00
|
|
|
amount: 2,
|
|
|
|
selfDestructAmount: 0,
|
|
|
|
selfDestruct: false
|
2023-03-07 11:32:45 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ensName: "emily.eth",
|
|
|
|
walletAddress: "0xb794f5ea0ba39494ce839613fffba74279579268",
|
|
|
|
imageSource: image,
|
2023-03-31 10:20:23 +00:00
|
|
|
amount: 2,
|
|
|
|
selfDestructAmount: 0,
|
|
|
|
selfDestruct: false
|
2023-03-07 11:32:45 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
ensName: "",
|
|
|
|
walletAddress: "0xb794f5ea0ba39494ce839613fffba74279579268",
|
|
|
|
imageSource: "",
|
2023-03-31 10:20:23 +00:00
|
|
|
amount: 1,
|
|
|
|
selfDestructAmount: 0,
|
|
|
|
selfDestruct: false
|
2023-03-07 11:32:45 +00:00
|
|
|
}
|
|
|
|
])
|
|
|
|
}
|
2023-03-13 16:32:14 +00:00
|
|
|
|
2023-03-23 13:17:07 +00:00
|
|
|
// Minting tokens:
|
|
|
|
function deployCollectible(communityId, accountAddress, name, symbol, description, supply,
|
|
|
|
infiniteSupply, transferable, selfDestruct, chainId, artworkSource, accountName)
|
|
|
|
{
|
|
|
|
// TODO: Backend needs to create new role `accountName` and update this call accordingly
|
|
|
|
communityTokensModuleInst.deployCollectible(communityId, accountAddress, name, symbol, description, supply,
|
|
|
|
infiniteSupply, transferable, selfDestruct, chainId, artworkSource)
|
|
|
|
}
|
|
|
|
|
2023-04-11 08:09:01 +00:00
|
|
|
signal deployFeeUpdated(var ethCurrency, var fiatCurrency, int error)
|
|
|
|
signal deploymentStateChanged(int status, string url)
|
|
|
|
signal selfDestructFeeUpdated(string value) // TO BE REMOVED
|
|
|
|
|
2023-04-03 11:29:36 +00:00
|
|
|
readonly property Connections connections: Connections {
|
|
|
|
target: communityTokensModuleInst
|
|
|
|
function onDeployFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
|
|
|
root.deployFeeUpdated(ethCurrency, fiatCurrency, errorCode)
|
|
|
|
}
|
2023-04-11 08:09:01 +00:00
|
|
|
function onDeploymentStateChanged(status, url) {
|
|
|
|
root.deploymentStateChanged(status, url)
|
|
|
|
}
|
2023-04-03 11:29:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function computeDeployFee(chainId, accountAddress) {
|
|
|
|
communityTokensModuleInst.computeDeployFee(chainId, accountAddress)
|
2023-03-23 13:17:07 +00:00
|
|
|
}
|
|
|
|
|
2023-03-31 12:52:51 +00:00
|
|
|
function computeSelfDestructFee(chainId) {
|
|
|
|
// TODO BACKEND
|
|
|
|
root.selfDestructFeeUpdated("0,0005 ETH")
|
|
|
|
console.warn("TODO: Compute self-destruct fee backend")
|
|
|
|
}
|
|
|
|
|
|
|
|
function remoteSelfDestructCollectibles(holdersModel, chainId, accountName, accountAddress) {
|
|
|
|
// TODO BACKEND
|
|
|
|
console.warn("TODO: Remote self-destruct collectible backend")
|
|
|
|
}
|
|
|
|
|
2023-03-13 16:32:14 +00:00
|
|
|
// Airdrop tokens:
|
2023-03-13 10:16:08 +00:00
|
|
|
function airdrop(communityId, airdropTokens, addresses) {
|
|
|
|
const addrArray = []
|
|
|
|
for(var i = 0; i < addresses.length; i++) {
|
|
|
|
addrArray.push(addresses[i]["text"])
|
|
|
|
}
|
|
|
|
communityTokensModuleInst.airdropCollectibles(communityId, JSON.stringify(airdropTokens), JSON.stringify(addrArray))
|
2023-03-13 16:32:14 +00:00
|
|
|
}
|
2022-08-23 08:46:37 +00:00
|
|
|
}
|