@version 1
condition triggered_by: transaction, on: set_secret_hash(_secret_hash, _secret_hash_signature, _end_time), 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
)
]
actions triggered_by: transaction, on: set_secret_hash(secret_hash, secret_hash_signature, end_time) do
next_code = """
@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: #{end_time} do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00006205EC2CC3B763AE9890AAF29B505C7FB96395DF7E129924D72D0548A8E57436, amount: 5.8
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= #{end_time}
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00006205EC2CC3B763AE9890AAF29B505C7FB96395DF7E129924D72D0548A8E57436, amount: 5.8
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 < #{end_time},
content: Crypto.hash(String.to_hex(secret)) == 0x#{secret_hash}
]
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: 5.7826
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0174
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 5.7826,
end_time: #{end_time},
secret_hash: 0x#{secret_hash},
secret_hash_signature: [
r: 0x#{secret_hash_signature.r},
s: 0x#{secret_hash_signature.s},
v: #{secret_hash_signature.v}
]
]
end
"""
Contract.set_code next_code
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
1EBEC745762F10A6782986E186A72941DCD6B5581F9D4D87C63490766D7B5036755B4194C8D8E35F706B62A99DBE5442239DC0261588247B55853B87
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000E9CE...EFB7At 2023-12-09 06:16:20 UTCAmount 0.423095 UCO
Previous public key
000180E5BE436479F81C30489CC822B9F95A22893AD6200BE1663109ADD223AE9A05
Previous signature
D6A35FE9A9E5EB3B81F8325C41FADD433F1B7CC299F0ABD5D3B6C860A605F26797334EF0DA91CFD754C1C80C119B4AB6F6F54DEFAF30E295701E23FBB24C380F
Origin signature
304402205AD28687666A92424B75B15331A9B3CB2C5029210289AE5CDE18CC7E6AD979F002201EEEADFF1A92A72F2831C98963780651B331CE373005FD121F3B34F37BDF980A
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00FD02A03C340F1FFE8CB27D35E5D49EF637AE9E9EA7099411037FA75DCB7CF100
Coordinator signature
0A4B6A0FC4B09A1CC61F5FB137DB9E97B48AADD600EA1434ADCB1F1184D56E8CDAB098053DDD8CBAF888DDAB0D6C33A7DACD7C83CFB8E2C111A48B319358670A
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
80C1C56BFE08DF274531FA4BB311FAC388A21A6887D4CFCCFBC9FDDD37A794038859BC8F902D62143D49456A82123357F403850E596E1AC6DAB35B173FF3E60B
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
430A1DD7B24FA2794F6312974A738F899C1A47215C726BD7F8F4EC8DCF12BF3C3B8E5AD0B582E5C53EBB044D0D5FAA1FB6BC16B305D3A908A800169C6CC4A309