@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: 0x000018881017851E4A8D2E11703839F5A99D35B818EA9FFFA8D4E502C28BAA77A9C1, amount: 222 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: 0x000018881017851E4A8D2E11703839F5A99D35B818EA9FFFA8D4E502C28BAA77A9C1, amount: 222 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: 221.334 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.666 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 221.334, 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
E867AF0589EADBC16301257B592C6D41D81FA3980A61EA000B9B0717F26F436B0299CAAF33EEA9C0462C1EA88717029BE1273C39BC201C39A215C255
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00002852...210FAt 2023-11-30 22:25:38 UTCAmount 0.41243564 UCO
Previous public key
00016E8A328DBF80E9EB46A6B7E83013F93E29673CDCCEF6E3D292C3AA5269F65B60
Previous signature
5197ECB14C4B017D82CEB7A955D3F6ADBD21F61A745A5048599916D1BDB703BB78C9528773C74302C38AF7C402CD5929705A5BA542943CBE0E26FC1A55307003
Origin signature
304402202618D02BEEEB465F7A36F0562958281E0734587DAA9138A99AFBD4E55106D642022017A967CCFE0AFE4BAE377A14A920A5C24BD1395C058F4EFC97DB89F23BC515A6
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00858413E02FBE730F1138F007D72894704EE2E938C36CE71094C5F745B68A233D
Coordinator signature
91BFFD8774BFC4D29898DB05131F2F9C37372DA7ADEDDEC879DAC248E4CBCBE917F0BB9DBEF07BBA24D570B8903627D76080F2049FCBBB648537A05C64531C02
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
DD99D6846EE8071CB843B43D72E411BC2BFE33DEB62D3F3CCBC541074208AC55956EAF112DC60BD24EE85337F01B7FA0C1BD0AD50BB19FC5873E9570E658DC02
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
A9B7A33A52AE60F57611F2203896B87EE12C01ACCB79C48CF1068CB70A49E7526B4AD5E581373F9B338C9142D09639BC18C8F4740C8910FA066406F81628DD0C