@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: 0x0000AAE847768F278B0D458240DC4E5205C2CB307B81D81865338F2C6B831F6006B1, amount: 2
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: 0x0000AAE847768F278B0D458240DC4E5205C2CB307B81D81865338F2C6B831F6006B1, amount: 2
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: 1.994
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.006
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 1.994,
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
D2A87301BDB91B6A9E80FAA67F32BE755265BF31FEE73FD72397534488EA0946A7440D33E3F89C2853557612E531E3B4C07591650048125DC717FECA
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000089AC...FBE1At 2023-12-28 22:15:43 UTCAmount 0.40530442 UCO
Previous public key
0001601FA08C046FD634175E86A9B9E70333DAAD1EE80B743D7C1F0CEA129D7AEE2B
Previous signature
6771C829E33B921F370ED89A05384ACDB71CD332229B3C309DA8F9AB4EDA320E25F3B7D69F70BDD13235F602E064718B7E6DCD996DC5635BC183EFFFF29BE60E
Origin signature
3045022100F58D86519A239AEA7AA8162D9676AC6E6D63BE4966CA3382A612444D660BA1F402203E4A48CFCC484E5A82D88D1D54D072387C15D7B58CFE0EAE60EB4A813E3A27CA
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0091CF3B5BF975D6550A4B0B42565F5D59DDF2F092A46F9D305ADFD0931F24388A
Coordinator signature
944F21C93C755DC00A709DB6BC142C382D4367D661F78CF6F689F824AD3DCAF402C226BFDCECDF30D4997D429B52054ECB548FD9A8F73B790E2BC2267EA58E0F
Validator #1 public key
000134772A943DC0F7038B1BABA39E18841C12DD6682B1B6D1D15E08D7CAF5339AB0
Validator #1 signature
90273A40E6836B5A82A573C5D58FFC677F2C353C802A4E6DFD653CBD2BD3BDD3DB711447A7E520C05986709B0F6E7193B44923DFDD51FADCD685B0B5DC7FC500
Validator #2 public key
00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A
Validator #2 signature
4BE23CFCF15A4075221011E28E99FB69C90E53148A5DA5AB5841A98BD9D7760F8BDA2E3C938761FDD29A943B7478E9BB685965A394D3F4F5C6680A2E9AD8D008