@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: 0x00007011C3312E6DD64C930A68B7B5F99AA6FC8FAC555DC1421BADB3091E3786B826, 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: 0x00007011C3312E6DD64C930A68B7B5F99AA6FC8FAC555DC1421BADB3091E3786B826, 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
9EE60F555FE8E29FFA7459E90D997F9E98897414ACAD0FD9C4FE3670AD60E379A7E38E655798E61715602177DE4B93E71C425781BF111D634B1F178B
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000B07F...64D5At 2023-12-09 11:20:43 UTCAmount 0.41649204 UCO
Previous public key
00010B3F54CC221C6328F93C54C42F52577C6161EFF9BD01D4BD9F322115BB0736D3
Previous signature
E1A1900FB25B8A0B2A0BBCEDF396F8BDBD75C821079919D21CB1F211C50D8E05F97958BE5587C74043B3E6CC573E89400A5BDB6EC002800F77F0BCD709E7B606
Origin signature
304402203C6258797C722B0EEF78454221AEE5E6CBBA4AFB22907BB1EF292AB908D67B4202202D9F4DF9705E9A7DE6F0C28FAB1149A73AD91E64BDF20F92C5AC39208B8BFC31
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0088C9F19D829D5157F3A4BB781A27FC3F6CA4090008A47F0A009970CDAAB98A24
Coordinator signature
93B6F12356AEA62C5C1190FCF851E498A8A05B1897C52E6A01C083E93C2D95D249887747888B3D5D7093D6C14517F4EEB2DE8B90A1D9D647B838E1804C560000
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
C534B2E72F45296AB1D736146C3865853977245481F918D88E18477E7079B42C5AF8F6E475BF827B4B170F0AB7676B74CECB6F5D7DA0DF3AD8079B63E90D130A
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
1A3629541E73D1341FD3DA9182BD0137F6E96A174DCB0A8C7C3381DDE48C91F022CCED7A54486C738B8083C2A9F48AA34D4B593BD2CC7167E3CB51E552D77E08