@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: 0x0000C02B81FC7A0B0BA657DD178733BB2060D838FBA10F90401C1F226FD600D96D7A, amount: 20 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: 0x0000C02B81FC7A0B0BA657DD178733BB2060D838FBA10F90401C1F226FD600D96D7A, amount: 20 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: 19.94 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.06 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 19.94, 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
E9F4E0D16A32FEB82C2C095FC897B880BCF8A3FA9F006145029C94CE924987F423E28B98010DAD15AF594C21A355ABCBA52E89C8AE1E2B7A8498A059
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000BB2B...20A0At 2023-11-30 15:40:51 UTCAmount 0.4188004 UCO
Previous public key
00014AE8C8AF2F77571F3FCEEBE74DDB50FBDD14B26061ECB31221C5B51E047DB08C
Previous signature
E3AB4B6807FDC6057E3944C8C9D8C7F4B11B2138E525624031326A7F8F1BE2559D1A7E4CDE45F6633F1BB12CE7A7817B8250B6265DC93FB9D2819827334AC409
Origin signature
3045022100E395F40CDC3E1D3A0DE6A07271C0EEF36808791FC27E956D1937150A6A515EC10220638675B9FD1FF0112678C75D8D503FD449F38602F2D3C2F6D079379AAA322EA0
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
007F6055BFED601EAC55FFB62ADAF3F03EB5FB26C4BBF3D5358EB76BE651330E89
Coordinator signature
614C201B18C1C735FBB3F766A57D98FC3B1497BA640CADB8FD1D48E7A782BCCD37913C137519D7C4012A09C9D116AC7A23C3328CAA2BA840B0512179AEB5CC08
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
D26970859ED54728868AA011FFBE96579B879E0FA1CEF519BC919B10554111664853B1B22CA430F4C3E94E2609C304D3B3980155A189B8DE8A76BC41B7ADD50B
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
D6F9D873C829A15E6A69EEFBFED0B019CADA57E8F0E8F42ABED5E0C7571FB6F6C48B1CDC853E99E9F52F6AF00384E2C4EFF5DA92C8DE3E94E29F97750D45530D