Global Variables
class ExampleContract < Contract
constructor() {}
function :interact, {}, :public do
sender = msg.sender
origin = tx.origin
block_num = block.number
block_time = block.timestamp
# Log an event or do something with these variables
end
# Demonstrating the use of esc
function :findAnEthscription, { id: :ethscriptionId }, :public, returns: :string do
ethscriptionDetails = esc.getEthscriptionById(ethscriptionId: id)
# Here you can access individual fields
id = ethscriptionDetails.ethscriptionId
creator = ethscriptionDetails.creator
# Return current owner
return ethscriptionDetails.currentOwner
end
end
Last updated