@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702025160 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000D9E334C5E1F74367E9C814F6F6DBEE370AA53B2C5236143711A5922526BDAFB4, amount: 6.5
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702025160
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000D9E334C5E1F74367E9C814F6F6DBEE370AA53B2C5236143711A5922526BDAFB4, amount: 6.5
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 < 1702025160,
content: Crypto.hash(String.to_hex(secret)) == 0xC44AC9F6ED303CA20100B50D1BDA0BF576D7D88CA5C674BC82D75315C0021C3E
]
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: 6.4805
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0195
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 6.4805,
end_time: 1702025160,
secret_hash: 0xC44AC9F6ED303CA20100B50D1BDA0BF576D7D88CA5C674BC82D75315C0021C3E,
secret_hash_signature: [
r: 0x0CDAE568DD61D48AE989F7287E46E00D8B951EAE3D758F00890EF564EA578788,
s: 0x1EF1CEE349EC5A783527CA72616A3EBFEBDFAA026FF537E3C845F3959CEFD2BF,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
4D21B0788DA7D23E1450C423FFE11D60540E887736288D1A7719B48FD50765017BE88AC6FF965EF174E4B3A41ED1ECDE6949015973A2AEFD451E0E77
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000CB07...DC1BAt 2023-12-08 06:46:23 UTCAmount 6.89472702 UCO
Previous public key
0001943B5AD27BFB871C92303CC1EE6AE66F8781254794F58E2DC33C9137A264F023
Previous signature
B1CF8E4BF63426B53CC02B7F00A2FA683B4C2014BD068A480CB96FF42739F063B93E69EEB73B00CDDF7F405D8D2696F987EF60279CC7612F61B8302091F1C20E
Origin signature
3046022100CE95B6DA376796E8904F135B648B5F3D7A1E64838C2C252565ED9C143265B1E6022100CD07518A0BAF0FEB96B9D9E7A92BB8B624F552FE9B504F01CD870FC6A7847F9F
Proof of work
010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712
Proof of integrity
00E84B7AEE610F48236DED3737668B6DCF197941C58637FFF6A6BA1E5EB64FA94A
Coordinator signature
3495BF96FCA3781AB2A05B1235FEBA37B4BA980DA41C0B93DF84955F1C316EDE28F51CD023266F72FCBDCEE32B5EF2DAB95B953C3057E467F9BCD292F5781C0F
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
AC7B71AB406146EF76B91AD3D082431A784F659443737F542AE67C01358E13E083AA60D40855BD855EDDC1DC36F9547E9D6C91943236735DF27AFDF11C2D1209
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
7E24F987DDAE951D73FBC56F077588B855C500EBB83C826E68BB6333B20BE5B7F933A1BA753D86C358586132CB285C8431228F63E25E49CAC00A1955949ED009