@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702050540 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000F95EA99BB551F530C7C2D6F18E67432A89FFEF32A30EFFF1CF936226411FB8A9, amount: 10
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702050540
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000F95EA99BB551F530C7C2D6F18E67432A89FFEF32A30EFFF1CF936226411FB8A9, amount: 10
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 < 1702050540,
content: Crypto.hash(String.to_hex(secret)) == 0x9F4F28DB3A970DF63BCF91ABCCB6A7896617289706C311E03C3CBDE4E8DFCFAC
]
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: 9.97
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.03
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 9.97,
end_time: 1702050540,
secret_hash: 0x9F4F28DB3A970DF63BCF91ABCCB6A7896617289706C311E03C3CBDE4E8DFCFAC,
secret_hash_signature: [
r: 0x8331FB845F7BEF63C1188937109CF9DE90441916FD37A1FFD8BB9127EE55C655,
s: 0x6BECA9B0FACF5F4CCF19F9F6BB4F018C08F372C2A805FDA7A450AE830E445059,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
517BE595949CD2359B1FFF6A7D43CD898B6955F9442210DCEF5D3CD3A61353BAF5AC64A11509807983A92843E6702FBC7C57BBD4FAC5F038AEEDA600
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000025A4...71FBAt 2023-12-08 13:50:14 UTCAmount 10.39651122 UCO
Previous public key
0001BB38952B438D859B2C39D20946ABE87DFC895AE6D814C1B9DC9BC9CF9105E46E
Previous signature
CE61406DC2625A118170E2FACC661FAB5D3EAA4101987510832E7FA306C49D7B6BE757E513A4BC21354537C0EFB86DCCABCF3AF4393858CB06C4329165BFB303
Origin signature
3045022100AB9B13D00EE04821B5916C09D9B103B6FF2EF2CCDEC04963806CA83BC9A7C1C5022060205890AAA998B69D84CCF79559E0AF6CCF1E6986D30EB919591E81C7496A5A
Proof of work
010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39
Proof of integrity
00DB5385EDEAAF87329A4122FAFFCE315EB66570604F892D666B6B477B4507A6CA
Coordinator signature
5C016E9850D54C405CD9DCC0C6F56755CD0E7358B131D66D3D74F71165E185C14BA7B72824E13318606108A8E59C39912F53ADCE16C3DB87020E843B25653306
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
432C7F84DBAA33E6866341C94C25E34FED498CCB3A984FF96C8C22279F5169D2FDFE3595EBB3F506C084670EDE4AF8F2027AB0C5B932D6FE7D0654AB5DCB660F
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
4D99F7D0166E623C1397A58C190CC7D3C25EBB71C358DAECD572B56CF90B5141C16FAA154AB310C82B08F235754138C511792BE87C96D2BB4C639D6C3C866000