@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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
)
]
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_token_transfer to: 0x00001CB542FCAA33F7CD10830C54723B35B81731AD76BDFE41B2FD9BCFE677218A89, amount: 0.0396806, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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_token_transfer to: 0x00001CB542FCAA33F7CD10830C54723B35B81731AD76BDFE41B2FD9BCFE677218A89, amount: 0.0396806, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
),
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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.03956156, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.1904e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.03956156,
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
BE30439799BD78FDCD1F7BC2665C0752CB98686D05C5527885E391B44185457EF032E2B20756468F6B8B63736C632ADD7F1F0E04887B37ECE65C3C6D
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00001A36...D351At 2023-12-06 11:53:09 UTCAmount 0.44293084 UCO
Previous public key
0001671DB12E3E39049E8975F74D3971A91AB665E8F3D47E2A4B710B48C04C7A36C7
Previous signature
F29426F882A1EF082BDD698027FF41976638ACA87B6C074288D107C8FBB91663B7233443D8199D13CA7CBB86EE458ABC9CF57C61CF8554DA37936D7EAE328603
Origin signature
30440220020C985D3BD04BA326D777EBDBDF8DFB07DF64DA1F57B94B088B859F22DAD6ED02204473544A8EA09F61810380CCB353125AD6743385CADAF69A9DEEB9156A7DBCD0
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0009DFF7528882042F86711098FA455BF1425C40B0761289F6DA0752A46B9AA770
Coordinator signature
895EA86301BA87A1CC54F98E6FAA73D193E1500B9049D6A2A8F77804C4A8B46557E0F4CC64F186075E63DE93D91FBE117477C7BD8DCC0538E0F70D48E5CFED02
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
59C573C1D2C06177E9098C7057CE9BCC3D47904E3193CF1DA648E90DC4681B1DDAEE032A3B8CB1EF4F8171C8D6139E03452FB829DBE1363BC11A28BC4FFF560C
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
7A6F806350C4D5CDB44E60DD0F2C14556E90AF45EA6966D92BBA336EDF9BDF8D91A6B7DC9C285D888D7A36B3845DA600BFD6626EEB84D43E2B9CB29CDCC0C80A