Want to know how to create a smart contract? In this video we’ll show you how you can perform the first part of creating a smart contract (on the Waves Platform): creating a smart asset. Thanks a lot Woutje from Bearwaves for supplying the code used in this example.
Script code
#A Smart Asset which checks for a data transaction to enable or disable token burning
#If EnableBurn is set to true burning of the token is allowed. Else it is not.
#Address defined for data transaction:
let AddressWithData = Address(base58'3P9joJaAYxoTR1oWr38bNrQSrnpqAZVzbm6')
let EnableBurn = extract(getBoolean(AddressWithData, "EnableBurn"))
if (EnableBurn) then
match (tx) {
case _ => true
}
else
match (tx) {
case b:BurnTransaction => false
case _ => true
}
Data transaction code
#A data transaction lets you send data to an account
{
"type": 12,
"version": 1,
"fee": 100000,
"data": [
{
"type": "boolean",
"key": "EnableBurn",
"value": true
}
]
}