@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: 0x0000521BC149B64A4128DF7AB9C179E20DC0DB2A5FC2F1B0E43EE817D9D9CDA03438, amount: 10 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: 0x0000521BC149B64A4128DF7AB9C179E20DC0DB2A5FC2F1B0E43EE817D9D9CDA03438, amount: 10 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: 9.97 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.03 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 9.97, 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
45C9841AF1BD90F227388AA61A38E09D8A7474C67F6D9C4B01EF09B6CBB374E55F0603D6A74AB456A00FDD40BFD48AAB5D0075CD81C5659E995FC22C
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000E5E1...9A57At 2023-11-30 18:48:21 UTCAmount 0.41198956 UCO
Previous public key
0001768FA40E08FF4E03C53AA2A37A4B5F1BFCCA2B16A0F5D6754F745EE91651464A
Previous signature
9DB2503F4290EBFCA7E657C9FB8BF803D3EDADB7A47B72FA051BD38B0B9AA42FF98471A1A601802836451F985BCF2FE8ACBB0FC4885591815E3E96F5BCEE4601
Origin signature
3045022100FDBBE089C97D402691A1E93DCD9F9671AA33BC1A7A6A0D6C371343042B7BB4380220549AB34F0126CB224EE8C04B7BB83D94D0C61768A3F1CF66D33BBAAA41F79767
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
001AAA5DECA4EDCEB2433A582B7AFE88E039C745D0DD77F548E7D067C85ABAF9AD
Coordinator signature
68A146F1779B044817B972940F5A1716E05B4027A79D5B44003943791EDB2FE5ADC993CEC92E6125A54165A24CE0471C8820456FF3DA9F776CEB52AECAD58105
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
B62E2D63CEFC55E591CF54E9F4888C0272928F9DB4B82C36E01721AF2B6ED60A6ACDC5DB019E094F03BF5B02EAE63F6E93718CFA65C10A62910DDE0104956901
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
7F35B7599FB9FCFDBE003E34BA8C6ABC9AD943B7C66C19A3421D9BBBD99FA3670D6EFAEC45A97829C69673F10D16E682CFEE0B19C9E46AD01DB0A31385506C0E