@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: 0x00002E23104F83E325686794C2D1BDFD23CC04566258C9EFFF6F35A34231C558CD43, amount: 50
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: 0x00002E23104F83E325686794C2D1BDFD23CC04566258C9EFFF6F35A34231C558CD43, amount: 50
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: 49.85
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.15
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 49.85,
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
F7B40DC207404E8194B088AF28A99411A191AAA5F83F123ABFC2C315FA8C6D294721AD077F5C438FC9E072FA2396D703CA8AD71D26685132FC888097
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000F04D...6434At 2023-11-15 14:29:26 UTCAmount 0.3518698 UCO
Previous public key
0001A49BEB76E9CEF8603B9079AA85A4679ADB975AB3F2BC64778865CA6A44FD5C64
Previous signature
42CD2331F809E70A740F668D8E32BF17F47EE58513FCD4F05B35A59BBE24B62448DBC4B576F1E90573C779F50D8B34B34B05C2890A391354090D6CC9A39F590C
Origin signature
3045022100EC3C93A150FA589EC0A8D27D0B897E8C4783FD22C1027D884FA88F71DE900FB6022047CC91FED5C64C36AE4B26DBA411EA68AC3B174706D137B141F187304751E2EC
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00F88F0D6B47A098BEA9594E7537DF6ECE897DD4042CC2055DCDCA8DC5EB75BD29
Coordinator signature
092CFD199CD7C280068B11D8567616B4C1176171DE9EA9B6BB5D37FB2FCD6DAC3BA5613D5FC12FF6B2B08793DB86B078D076D5CFEC7195B97F14F5B77EC02505
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
FCF3831AB9E9AEEA7D9933C6E57E743C7F12FD0233CAD601D12E83AEB68CA395B1977C40FA6CC91137605A62CFEC62B37A8CD0ADE1DA0899870C8EAA6879CB07
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
098A85513F37670C49B6337D91CB224D4CA54393E7DAC44A52BD226688F8A3C751611C389CE87823171958486FF75FCA2BB7A72C1951BE4650876271A643EC03