@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702053540 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000C0E9772F25CCC5EE1F3D288B785CABCDA9114FA9EF9AB491F6CECAC0232DA15E, amount: 250
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702053540
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000C0E9772F25CCC5EE1F3D288B785CABCDA9114FA9EF9AB491F6CECAC0232DA15E, amount: 250
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret, secret_signature), as: [
previous_public_key: (
# Transaction is not yet validated so we need to use previous address
# to get the genesis address
previous_address = Chain.get_previous_address()
Chain.get_genesis_address(previous_address) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
),
timestamp: transaction.timestamp < 1702053540,
content: Crypto.hash(String.to_hex(secret)) == 0x06493AE450CABF4A5F2E0143CD9AD014754795BB6A0CEC08E12E724756C64D04
]
actions triggered_by: transaction, on: reveal_secret(secret, secret_signature) do
next_code = """
@version 1
export fun get_secret() do
[
secret: 0x#{secret},
secret_signature: [
r: 0x#{secret_signature.r},
s: 0x#{secret_signature.s},
v: #{secret_signature.v}
]
]
end
"""
Contract.set_type "transfer"
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 249.25
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.75
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 249.25,
end_time: 1702053540,
secret_hash: 0x06493AE450CABF4A5F2E0143CD9AD014754795BB6A0CEC08E12E724756C64D04,
secret_hash_signature: [
r: 0xC02B854A6C065C7EC9CA364B17FE750CE6778E1CBBB492A916808D5DD14F6C22,
s: 0x126FBCA83B2D76E57469A43D2AD07A4D5604B172A4E5F058B56653C94E4E3BA2,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
5C7194B047FFCB35A17BADD5B386A631E39488E5B0BF3010B4954C6D9801ECDA63308339A66D881CA79C466093C1BD52A484D4BBEE58E0F427D40C11
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00006DA7...E534At 2023-12-08 14:39:42 UTCAmount 250.39379683 UCO
Previous public key
00017B196D272DC4E7F73A5C1441644C6DDCC9F906CE7DC4C09466F3D896C7BF169D
Previous signature
82FD30DE58FE695249A39C960EA0211FC4FD6B3303F3FD92BA2530B208170A2139085C1068E8D4E1CE2B0D9C66566A36B87F8A328F6B1C10DFDCEE970990B402
Origin signature
3045022100E3BD2E7D5D12511E5E75937F3F8C9A25F65E080D8B839D7B226F0E268A2C978D022003F4AAF3DA9BC30D37B7F4B92A446004B02B596E43D8C70583101ABF2CEB75CC
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
002B90905189CB1EFD069B43D91551775B658D50A42E7F123D90337AE237BF3856
Coordinator signature
A54DC7276F16B69D3C3E498CF72651AB5B7FEB40312E1371701AA6724E630146F44B5B383DFA1A456696FE4392A1E5FDE80ACABDB6A6DC48A3385665C9AA0A05
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
AA82467941FE7D5DA8C611FB9646BBBB22C9617B5FC52AE2419E637893D49E8E7669AF96014FBDE6FC542C33DAA8B07B9D715BFF786E3F8AC546EB4F2AE06902
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
ED2AAC983851CFA27021D1F981D41E19BA949FC7F3D6F823D4AEABA246BF6FFEE0B625DE66A3F3843B56A4C7398EE4C69231EAE3FF2E2B7ECEFC422FE0926405