@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701361080 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00002E23104F83E325686794C2D1BDFD23CC04566258C9EFFF6F35A34231C558CD43, amount: 150
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701361080
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00002E23104F83E325686794C2D1BDFD23CC04566258C9EFFF6F35A34231C558CD43, amount: 150
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 < 1701361080,
content: Crypto.hash(String.to_hex(secret)) == 0xF1B3CB63B3956078E341ABD61585C61D94076E2D780FC4BDA2680E11C82C7E99
]
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: 149.55
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.45
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 149.55,
end_time: 1701361080,
secret_hash: 0xF1B3CB63B3956078E341ABD61585C61D94076E2D780FC4BDA2680E11C82C7E99,
secret_hash_signature: [
r: 0x902DE3DB77C1A3708BC27B42CC0B2C4520E57E220FDC02DD633C1BB6D891B65E,
s: 0x480A32D1B2B603065FEEE9F6005F4651C77E2C7DC98099CC57DC173F085EE703,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
F3A5AC262E96C6D67A8D0000FEB31A734132725D08259B5DDDA5A751E6BB2290F74FC8AF24E4DAC24FBB8FC2B91F3645D4E5CBEEE5D5BB6F518E5334
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000E52C...64C1At 2023-11-30 14:18:50 UTCAmount 150.41779296 UCO
Previous public key
0001F4C408DB31760FFD9E09291CF14F902ED7ED2D3BD167DF6259974FF4E779BD85
Previous signature
71B67190896F1C09ACEEE5B74B32DB6F2CD65F0D78BA87F4D9B23DD1B16A716FF456FB501B6ACA18A43E037BF50F4645A4148AA1C05B97C59182FAB1FC642C05
Origin signature
3045022100B6DF84BCA0E1A3F3AFD0A015EE45026A3EB48605B6B4BEC06EFAA349690688F702201D4A682852FEBA79E231EE1E6BF04F38048BA593D3E491DE63B04A527F6BDEFC
Proof of work
010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90
Proof of integrity
00485CE3AECFB6D57248D5DF0795A642EAF279254F5BFDAD851BAFA0735A876218
Coordinator signature
D042C694A9AE88F90D174A3066D573ACBAEA6474A4483F09C5BFA2199FFBDAAE2641E71E2797A87101F62C5D4D387854A1F30DE1E26D288FDD1CEE24F35A0F02
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
2E8057297AC82AC2993B82967BA4980DB2C7FBD50FCE6698507DBC5A1C1CEA4691A2811571B543D819AE0960E92A5FA35989FACD91E8B8293D8877479A06A40C
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
769D448BC7935CB4CC17AB4328FEEB1A6FAED6EA3BE09159EB6B031D4E41354D6EB2C58072C6871BF70F511CD93D9AA93E2B13760F5A3A893AE9E41952AA8D0C