@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: 0x00005A2A9F6A89A632B5E8E9F07D0BD4D2C6B054EE82EC98DFCEEC187B124147E354, amount: 9
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: 0x00005A2A9F6A89A632B5E8E9F07D0BD4D2C6B054EE82EC98DFCEEC187B124147E354, amount: 9
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: 8.973
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.027
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 8.973,
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
E442F389098687D403E18F59E167B2EF5ECD5C5BBBC72CD38E079546C580E2C9474F4C0F6EF6BE945BD1E28327BEDF53AE3D27AF8F58614D515B17FC
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000060F...0FD0At 2023-12-14 04:43:41 UTCAmount 0.43804154 UCO
Previous public key
0001132B4799E5B405089A86786B4ED5C7EC997FBA696808284150BDFB34162D4C7E
Previous signature
BFFD7BDF821BFD716BC234D7FBB0F52B2855A49667C8658122ECBB6BF3A73FF448C3C345FE51F24048EEDEB2E5BBB0BDF69AECDDCE5E7E1AF45B503E7C967E04
Origin signature
30440220145E8E19CED1650BE0671DF788034B657A90489D2785710EA98D38DFE6985C5D02200DB6953CE80A22105BB4167C0FCC8AA018B43B2F6C22087FBEB13684722394D6
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0038691E99444EDEE647E4A5287FAFDDA033D4023157ACBC6AE0E25D887BFFBC9F
Coordinator signature
44AC53A36CD2B76131600EE1296F80602EA617749AF39AEAD798D76DC53778F2E403D3FF6DE6B71DE512DDAB1DCAC4ED85115080DD4DEF74CE113E50E3CF3305
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
2FCFF615AEEAF173EA2ACD073D35EF7788C3D20C9258208A4D92EAF7375225FDC477ABF4E94F53A0582DAFB63B098F99CE5DB061DDD0911F4BA14C612863220D
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
C7776C93D6DAEE8197E7E0A14741F2A5E343C2B0520D59D9323241691AE1E1664C62A2F6B6E7A6A0BCCB7FA8E62E12A481691FF377DE091692D255B64212AD0A