@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: 0x00009E3423F132E4B11DF35B68D4FE14BE9169D828AEC8EA8EDE71F5BDB1A5D64FDF, amount: 50 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: 0x00009E3423F132E4B11DF35B68D4FE14BE9169D828AEC8EA8EDE71F5BDB1A5D64FDF, amount: 50 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: 49.85 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.15 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 49.85, 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
F29EAAA0971A2D76F147BBD133995AD9E2BA19C2BB1904AFE54E2316256D5E2B0AB00521975399E8B9AFEAFBE260B7F91EF2BD6F11181A131638D777
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000B295...ABCCAt 2023-11-15 16:12:43 UTCAmount 0.35066848 UCO
Previous public key
00017A9C2AF436EEBB8B4BD3B15381F84156DF43B669F2CA84CD4FE2D8A595FC8FB4
Previous signature
DE998F146D2F06BE5E2219FBF868D1A8F7E1D18F122F51427498ADCE3B37E938F55D3C728D9B7FB6789061264ED6348C348874680BE176953466A727DB6A260D
Origin signature
3045022100E6F54A9F17B5DF421436DBA0927D878CBC0FE9EAFEFC63B9B5D1172A97B599D0022001CD88179D71420C503D7796FB11EEAD3747DE16F2FD846B29D3D2A57F6FC9B3
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
0065D6F14F5AAC54084FE32769089BF9257183DA9AD15FE64406F5AAA3891D0A46
Coordinator signature
C0EE01C6E9E7FBEC22E61D55C669680C96B41DEB41F3AF36BBB7AC7141AF28F3C8DDE44E820E332F527B0E58703CFCBCD7B37811B97FFC7CB5C0EE85796E350E
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
F252D32A1909DF9BE3FE733FC8BB9D36760A7D71617A1087673873FCE58489AACFFEA8AF274550C518C0FA7DF8C6C8BE028E4F0CC51D43D05FA8046A91EF970E
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
9008C72AC704C447688901F8C5E6C6C7F680B8056BED25D31A8C42FB18B265D5543C15D6CB8D6C3E8E60EF4A53DF515FACD9F912A3191E3FE2BABF9BC9FEC604