@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702060560 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009931C1D84FEA139BA009D084A661528A43F37321A5B7AF540050AAB5FA13123C, amount: 15
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702060560
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009931C1D84FEA139BA009D084A661528A43F37321A5B7AF540050AAB5FA13123C, amount: 15
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 < 1702060560,
content: Crypto.hash(String.to_hex(secret)) == 0x78575E83775D7FF71F71B83DE6933CB0383BB9EC55D6C56EEC77E6BF055DFF70
]
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: 14.955
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.045
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 14.955,
end_time: 1702060560,
secret_hash: 0x78575E83775D7FF71F71B83DE6933CB0383BB9EC55D6C56EEC77E6BF055DFF70,
secret_hash_signature: [
r: 0x0B4B0F0C756BC3DE50A6BFF591612F5AA9E58C0D932AF79995015757F66FFB74,
s: 0x09C69CDABA0A6EA6E96DE4024848552E9CFAC54C55D9367A7B7ED5875F157F08,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
99CBEA63E5951DCD4793BDA97F86B67BA214893911A737FFB7C336A6ACC638B273EC126239BB95845525740E67AF2694062C12F1E59ACAB6ECF14E6D
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00009BCA...DF39At 2023-12-08 16:37:14 UTCAmount 15.4272808 UCO
Previous public key
0001798D84185AB39DE092DF8AAEAEF81234F9F61BF85F7A59F840DA5DEC0F8799E4
Previous signature
0968F2CCB090DC7BF780915BA2DD5CF8E930C02DFDB009C1337F774B6FABFBBDED8676A44E2C9C8D3726E0D881B5069C8947D0256EA438EF067E62D61A7B5400
Origin signature
3044022064C6753D8D8779F177F4938F0224EECC715628494845615562929A0034BE500402201210934C28BC89C979CFA96A66C97EA7B5FF92EA1010BBC0AC2BD5DC0700311E
Proof of work
010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765
Proof of integrity
008E5D543D55143F1557BAE352747132520C29908733D44078786CE3BA3FCCCCAA
Coordinator signature
C5044F72A3824CED2901BAFDD340008A7932B737020E2F6767E6DACB13EDF0A2E462A52835A0FF7E306C235778AF95A2D6DDADE3233BD14AD726F6CD2823E908
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
596F93366A02708EA1B1F3D936A466FE11D7E04172921AB1BBF66AE5BA801AADA38D3C98CCAAC14F29BAEE6A16FF6544110A652D063D1B735CE87767FB8CFF01
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
73D28E710FB8ABFB3A26B2AA7D7592E7237E88BC543A5429509E6C4A9E2B9CA45527AE75763BCB42E86025F02E1A9476BF94601476B91512E623E8916EEDD504