@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: 0x000052DBB0394202F5E1A0290DC1595870AC160515BE80781452FCB0A205644F801B, amount: 30
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: 0x000052DBB0394202F5E1A0290DC1595870AC160515BE80781452FCB0A205644F801B, amount: 30
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: 29.91
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.09
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 29.91,
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
BC21FB325B148E27A1CEB55D60D3B08E2155544D1F2732EC81AB6D2278E5C59FE233A15981E6EB6053F3AE2055237ADD06A82F544E6269D55BC1E96A
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000F177...05A9At 2023-11-30 02:36:26 UTCAmount 0.42137329 UCO
Previous public key
0001398BFAFA33FC60E9F1F8BB9FA7D1BC35DBD701C770E28092C534CB084D09B5EC
Previous signature
429BF1CE641A128CA99B7C472DC43487317D879B5543E369DB56EB6808D828D3F777DBDB35462888C8F1912A631966E0FC9576C357DECC7F33F5DFFB0DEBA70C
Origin signature
3045022100EFA81832E189F11BC388A4BA7C957BEFB6CEE7BC82E2858DBF768E90672045EE022015EBAA0596328F70325BE48780F1E02C83C5682D50BA0ADD928E80CB1FE404A8
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
007FAC9AD20AFD4E80DD0DF5E7FFF4D069FFCD13655C2645C190EE123C9988CCCD
Coordinator signature
78C15A1F3409A07CE7506A5768A13C66769F3CE69FCB4AAF54A57A6308033D7D797B339A776F54C4E69CE778D571E4AEE2CDBE961F7F78491859EC2A0DFD6A08
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
6879B46834802C18AF3BF5788BE87BC8F6F0B6E08DDCC417A1C14CEEF0150E1296BC111488F42EFFFEEC9BE105F0A229843DE019464F75E2B3E605BAA00C3102
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
177188A699D79467C48BA89FC4D64A555A6EFD87EF8F821C8911D7E0AB096DDA75E173512870D3E4ECF1BA323B3C8EA9BCEAC407D6CE3C18075605C261C8AD0A