@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702049640 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000BC3E968466B3ECB6B2E6750A561DB3A55B61DF0B6629AC85AE9040DD5927B389, amount: 150
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702049640
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000BC3E968466B3ECB6B2E6750A561DB3A55B61DF0B6629AC85AE9040DD5927B389, 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 < 1702049640,
content: Crypto.hash(String.to_hex(secret)) == 0x70982F36BECB035B43360ADF9F042804595A28F71CE497A600BE37F66167A17A
]
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: 1702049640,
secret_hash: 0x70982F36BECB035B43360ADF9F042804595A28F71CE497A600BE37F66167A17A,
secret_hash_signature: [
r: 0x880629CF0E4D2E87FB911425F0CC58AA27FD6D0C54B0E6B10CBD6A08C6C9BD94,
s: 0x577C6240BB6081855D1578586C3E48A78B95305EC00E94D79537D32E62026DD3,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
DF2C29A06BBE083914FA0A816D9FFDE605295A5EAC5094A08ADBDDC3BBFF088F5CA8538FA8A15F7F6986DD6F77168143DBF85E5559E661BF7BD11137
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00007222...25F6At 2023-12-08 13:34:52 UTCAmount 150.39532274 UCO
Previous public key
0001D02FA637F21A48D448F0AB059ACD3C2EE9F27693D4D3A8D231BFA614A0ABFF84
Previous signature
C5E4605B28B3E33E511643A0753D8A3F091084F5300DE7A79C5FBFE9FC05C7887B20ECE842E7C76EA6E761E2F90D30C1CC85FC6A85AC00176C1B8615C77C6509
Origin signature
30460221008E3471FD98E8FBEC566F19EDB60820DC26F9B6EE9FAA144794A63F932BCC1793022100DA12D4520D8E2026C43DC93ED012F353AC4C9B09624D83A5E7512EACA23F47D6
Proof of work
01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16
Proof of integrity
00D960B31AB104664C997C5CC0BB314C0A10448A675B849D39D1807FBF97071543
Coordinator signature
A16E8AEC31B358588DA2947DC944A3748B1309DFC80CCFC5D3E7E529096A5B65A8624109CE27AFC2798C7E42401EBEC4FDC1C8649111ADE5EC22BCAD22C8F60E
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
073FBD7FCA8F0B6CE0912A4179FB3ADBA953FE6DD071347507C2DBB6610A765EA8289E325CA0F520699CDA9E99473D37418FC4443CCD63BCACA1AC48F0D5A206
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
B0F907F056641CDD7F12F4B6F3F6376BB7611D7D1F7B7C06279BBA37F98CEB9EB9040F5DA54ACA20F5C742F51094EF6620C1A56F618F0191A7A80B9A043ED00E