Response: {
"error": "formula
if (NOT exists(trigger.data["amount"]))
bounce("amount field is mandatory. Set it to 0 for unlimited");
if ((NOT is_valid_amount(trigger.data["amount"])) AND trigger.data["amount"] != 0) //amount=0 => uncapped
bounce("The amount of NFT copies to mint is not valid");
$price = trigger.data["priceUSD"] OTHERWISE trigger.data["price"];
$isTrusted = trigger.data["trusted_" || trigger.address];
if (NOT $price OR $price < 0) //Check that priceUSD is > 0
bounce("price or priceUSD field must be filled and it must be a positive number");
if (NOT exists(trigger.data["priceUSD"])){ //It is priced in bytes
if ($price < 20000) //It not worth to sell for under 20KB
bounce("The minium price is 20000 bytes");
if (NOT is_valid_amount($price))
bounce("price is not valid");
}
if (exists(trigger.data["maxPeriods"])){ //Periods are discrete to better represent how licenses currently work
if (NOT is_integer(trigger.data["maxPeriods"]))
bounce("maxPeriods must be an integer");
if (trigger.data["maxPeriods"] <= 0)
bounce("maxPeriods must be positive");
if (NOT exists(trigger.data["validity"]))
bounce("If you set maxPeriods you have to set validity too");
}
if (exists(trigger.data["validity"])){
if (NOT is_integer(trigger.data["validity"]))
bounce("validity must be an integer");
if (trigger.data["validity"] <= 0)
bounce("You cannot make a license valid for 0s or less");
}
if (trigger.address == $owner OR $isTrusted){ //These NFTs will be listed for sale so we need metadata about them
if (NOT exists(trigger.data["ipfs"])) //meta.json IPFS CID
bounce("ipfs field is mandatory");
if (NOT exists(trigger.data["title"]))
bounce("title field is mandatory");
if (length(trigger.data["title"]) > 512) //Prevent draining AA funds by sending max length titles
bounce("The license title must be at most 512 characters long");
if (exists(trigger.data["name"])){
if (length(trigger.data["name"] < 128)) //Prevent draining AA funds by sending max length names
bounce("The length of the license ticker must be at most 128 characters long");
}
if (trigger.address == $owner){ //Only the owner can set a third party as the seller to prevent approved sellers to troll another sellers by creating licensed on their name
if (NOT exists(trigger.data["seller"]))
bounce("seller field is mandatory");
if (NOT is_valid_address(trigger.data["seller"]))
bounce("The seller address is not valid");
}
$pendingNaming = var["NFT_" || var["pendingNaming"]]; //Previosly issued NFT
}
if (exists(trigger.data["soldAt"])){
if (NOT is_integer(trigger.data["soldAt"]))
bounce("soldAt must be an integer");
if (trigger.data["soldAt"] <= timestamp)
bounce("soldAt cannot be set in the past");
}
$isTransferrable = exists(trigger.data["validity"]) //Timed licenses are NOT transferrable
? false
: trigger.data["transferrable"] == "true" ? true : false;
failed: booleans cannot be compared with other types"
}