@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: 0x000025CCCCEAAB3591F6896381EAF786582A45682F552E841B2AB9B4C9FC54769FB1, 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: 0x000025CCCCEAAB3591F6896381EAF786582A45682F552E841B2AB9B4C9FC54769FB1, 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
485F69383F518C6C133109F532EC4AA3FE483FAEF183A57DB4B51A08B8D3A1389FBBEFE5C584E17520F718F8F2FA5C5C638C2C88E0C1E7D9582D36FE
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00006AE0...776CAt 2023-12-14 05:06:18 UTCAmount 0.43835298 UCO
Previous public key
00012E2E031C62D8DB51F5B3B1C8DB2BECA20C94CFB3610B7E1CFFC252E6FC5F0434
Previous signature
FF08E2A758D70A80F1D5E7A975D4F9CE0CA3032FCDE014D4668BC20C4CD8AC8F5C3FADB032972A90AB203C3D162A88A53EB8BC2646FA476A108853C536520B09
Origin signature
3045022100A2A4AE5EE15DEE925389BEBA77BA4A9EF210A7861B49FABC3CB32C785AFB4175022065233E6F26FFEB12B5668DED445FC3423FE3A9148FEBBB12FC06DB1C652660FF
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
005F884D0BD9FFDD2BC652FDADBD81555340CFC29539642D2B92E9C2C104DA32EB
Coordinator signature
8837B2DADB5C0BEC47EE1BA4154FEB7C90DC917F97A5461246FB39CD000F2E01E0A4911B64E52EDE52DA4A8C6AFFF6DE2CC8FD877965A92B22AF2A8387950D0D
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
3B529F4F9D0A8251ADBBE69E4F011C3E8B0AD8B3C3CB356935F124F4FEA04B16D800EA9FB633902DB55FAA76CA0AFBAD0D87C23382669DB517BBCCC58D97530A
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
372D5727EFF6A285DE2349D3F75A79DC09A26F96D37DD36E154646092FAEC226DC58330E8C9C6377D29C01DB8F1834A92F3802249FC9E09D18DC3BFD84FBB60B