@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: 0x00008A140026B9CA26355E22AC341F39F16EAC5A2B7B82BB468572937E04F2A65448, amount: 0.01 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: 0x00008A140026B9CA26355E22AC341F39F16EAC5A2B7B82BB468572937E04F2A65448, amount: 0.01 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: 0.00997 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5 Contract.set_code next_code end export fun get_htlc_data() do [ 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
8CA34D424A03E1555317E18B9BD196B78C8FE23C1AE90F227B43B72CEFC097085040E3846B2C11CD1219F89B195D501D405404752D350C73FD98F382
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000ADDF...2DE1At 2023-10-18 20:57:12 UTCAmount 0.50074292 UCO
Previous public key
000154BB46A87F330C942544F48F3A89D75360E3B9C6EA1E4A72AC0F0D130BE68B9A
Previous signature
90FF77911160A719EE897A3802B0480ECC7833145F22912C2040AC5D8F676F6A8CD428C8CCF79C030CA45B9846A1811DB63D57996854B83C58D672DA36152F02
Origin signature
304402206C94B9D1FE9EFB2EF9ACAB6EA2F5D16B389BB1C5C04F76BF6B2FC810AF88711102202D6B10DD4B0AF18256F84698873D0688A89383D28BE290D30A7A2C6006C58F66
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00B0FF70EFB9E5A4A460243DBEC1D974F1B50813D032D8C233E761C5873E40907B
Coordinator signature
D9428B0B30FD2070075369E0C3C67E044C4392B9EA3CB391140A1FFB694CC75033DC766A3E57F9559D2C31B2F69D945A82B25935F92943AD0D38BA788839A106
Validator #1 public key
00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC
Validator #1 signature
EFF9D05D4747949A0FCD5F445E09F3B2BDCBD1083182C1E1ED964B1745384C2A2A8615103B104E37DEFB1D6B315BCF1D4B850DFFEC7DB881F3B95B620EF5DD07