@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701429720 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000D05315238AD9754F13F7AAB883721AFA17F02E9D6EAFFA759E502AB50596B4C4, amount: 20
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701429720
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000D05315238AD9754F13F7AAB883721AFA17F02E9D6EAFFA759E502AB50596B4C4, amount: 20
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 < 1701429720,
content: Crypto.hash(String.to_hex(secret)) == 0x76385B7FA6D0F7AF361A9C1B9E7C87A6F4113916CE0DCDFCBD884EC58E605B06
]
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: 19.94
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.06
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 19.94,
end_time: 1701429720,
secret_hash: 0x76385B7FA6D0F7AF361A9C1B9E7C87A6F4113916CE0DCDFCBD884EC58E605B06,
secret_hash_signature: [
r: 0x85E9649562473B6A80AB3D7EB20F114FD282BC90393001D0930ECE63952A5691,
s: 0x63EE42AB081A2E7A9BC509DB4EC191A31B6A2484F85348DAC5AFEEA0943B9773,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
ECD2F3B1E1FC6A5094A9C0585A88628DD2D45A2709B2626A746808A2AE595E0B932C93852D22549D1CBC7BC54333B09112FEADB0EE82CE331CCC08A5
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00001357...501BAt 2023-12-01 09:22:49 UTCAmount 40.40622451 UCO
Previous public key
0001743C45F5120788488CAE8A41BEA424B539F843A0DAF8C907E85EE6C01281B5E6
Previous signature
7C07F664B8654D810035602F9E9D13EEB651BDA354F6A35E84D9E8B65887FE0D3C99DAF48DA1FB155172FF76E3B1E37C6A099EFEF580A701C88D79BD162ABC04
Origin signature
3046022100CA791FC72990F07E7DA50DE80B722B83CD2D45580F05F8A5FE89DEFCB1356894022100BFC2D44BF26E72787330DAA35280FF26853E3C7EC187F98CD3E99E186AB88B8D
Proof of work
01010484B78F4110D8E9D6FBEC72759895CC9D4532177314FBAA8B07BC525FC1AF48F150EFBF104B1819106B8E3563CD0E1FAAE5325F8FCFE58FF744C35F47669D2704
Proof of integrity
004B6E9DF80EF9BC471BA770A704F736AD303C5AAED58D5AB3039EBAF071EE4DC5
Coordinator signature
10037AFBDAC9676578339AFC5727796DDF4E99E9CCD8AED65FD72114CB777E80B88AC3ACD90B0ED524B0BC1B2287367E8A8D611C5360104B78F4F2B060E09208
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
0883E68A9245A302912F320265DA65BA3CD71E6D70866B51DCD9A2450031F853682DE22736B26EC6119FE0D1506BB44EBE2EBE47D91D4B75C6E604AA0862A306
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
6E07A31A254260CA0CDF101F9F262CD544F32A2A0E29174F338108C6F32ECAF61711540B0F94938A10D8A7F6C5B75E8BC2FF466D6B9946D89E52908343043E0E