@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1706379180 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00009350ED646798BBEEB8191967710ABB018B1D7D0CA7E3DD4BFC025372E1923AD8, amount: 0.004, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1706379180
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00009350ED646798BBEEB8191967710ABB018B1D7D0CA7E3DD4BFC025372E1923AD8, amount: 0.004, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
),
timestamp: transaction.timestamp < 1706379180,
content: Crypto.hash(String.to_hex(secret)) == 0x57851D2A51DA19C29CC7700CD58C01E69A598F72A12D366D20930DAA0398FDBF
]
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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.003988, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.2e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.003988,
end_time: 1706379180,
secret_hash: 0x57851D2A51DA19C29CC7700CD58C01E69A598F72A12D366D20930DAA0398FDBF,
secret_hash_signature: [
r: 0xCED0D5FB305A18306301E702427ECE59B8A144E711B2CB178BBBF7A4805D6898,
s: 0x08A6175219A72BA2721DB36FC3A3B15030ACBFBE3D049D0A49E7F18EE08D87A4,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
E6B80015D3A9CDEF48510B5CEC5790C47F3467B2C4E51AA2E11307870CB1D537CD6A0A8638A7C3E4437D3B436B6D30B88638DA1F88CA85C51CC7FF39
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 00001AD9...163FAt 2024-01-27 16:13:41 UTCAmount 0.43472707 UCO
-
From 00002AE8...2175At 2024-01-27 16:13:20 UTCAmount 0.004 00003DF6...73B4
Previous public key
000183D2D98D94B95FB76EF34D225E65AE9CAACE961E8B2F506EFE54E1B3445787D1
Previous signature
E52AC9D334150F22D16DB1737CD286C049E8247D970198AF4A1120732D27BF7EF489C18F848213B77CA6B8FE433A6E5CFA740DCECE5A20800880EB39962BA005
Origin signature
3044022049ED09C198F4A30CB851E7BAD99E1F41B5A35435EB89AB708909A558ADF9605F0220624D2F44CCAE9EEB00E2D5BC7BF550EE7534AC976971C2EE1FF469EA5F0A5DDD
Proof of work
010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765
Proof of integrity
00D794AD940356CBBCD36E71AD18FB89A1E8C2F2E4120B734BE3D2381C599F40CD
Coordinator signature
D7B041983381C5FA055FD807B3C3BC1B5020B41E584A6DFEA00DC178CB0B8F0AD86A68483A6DCDE97303F878E02D1F2CE954EAD439FD0611B1BA3E3ACE8DDF06
Validator #1 public key
00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC
Validator #1 signature
C1224A259842102E40BA11C516062DD4D4D6BF73FF9BC97D57514D70BAED49FD107A1E44C7127D582DDA9BB93D5031CAB732360C938870D522E1056D92FBE002
Validator #2 public key
0001B01EEF96BA7E95FC844D456CE8868F18864519FC9532E1751C2035FD044DD5D0
Validator #2 signature
320392ECA5897347484495082069BA66A90362B9730AF79E808E49CB1D2216B171267CE515638CCDC5F44FCDDFE3338ED4D8D70DC0C014BF2C5D91ECF324200E