@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: 0x00001E1E48F6AB5F8EB097562D0ABCF19A61E920DB0ADC62F31B62F34C3EC7481015, amount: 30
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: 0x00001E1E48F6AB5F8EB097562D0ABCF19A61E920DB0ADC62F31B62F34C3EC7481015, amount: 30
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: 29.91
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.09
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 29.91,
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
F497767DFA55CCD91048A9A3A5C7C5C3D71DA259EB227EA742EC075033D4DD4EC518FC96056B228C0B3FA247F5ADA342425C24241BB04E6A9579E596
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000E8D7...C16FAt 2023-12-10 12:22:42 UTCAmount 0.42762086 UCO
Previous public key
0001CDF3ADD3255894C3F6BC3625B46A0A920CFF1021D8E29C413C885B6C1352E3C1
Previous signature
83718575DE3EFC354C92280FB89D21B70C0C5DF3A543D15DF454B7FFA7ED594FC0C8A19DD460FFCAF6C5D4E6D9CE40D7D48F497935E69321BB5759B33995DD0C
Origin signature
304502210089303390C8E6953574BB95CF6A27321AF010B748610D22BF14CECA6E47AD9383022040D1F5C5A2E0540F90CB1A5AC31A3713C65A9E0A1934FA78011E7E6FBD5DD182
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00DFA3BB5809ACDD43A76B66777AF8B39497F88E610EE10F14E0C72E25486AA24E
Coordinator signature
0577F43BC8165BA1BC976DD858FAFCED66DAB4A73E457D9310F8CB2E0FB784AEDC79B58E90EE1618FABA4B25BDA3A57579AFAAE6E12AEB38FEB52BF249E6FF01
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
6C9B8A3A28D9B71CA5C6495A6EAEFF21E78BCB711B57F9710ECB26057614624B4BD844EF816F6E3F0BC480A0BC43C79588E0337A85F4639C0485D57FD5ED4902
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
DC04E6D1E56BA359FC8C846B1791642A68779175E0665157A8F1A437F3D5018003529DBD2638DA99911FF50691E7E6FCCAA3F67E14D443A42DFB784A1B945903