@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: 0x000004BE34D15FF077A60B1FCE897083D215A3C392BF49CFF15030A774FA8FDEEBD4, amount: 100 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: 0x000004BE34D15FF077A60B1FCE897083D215A3C392BF49CFF15030A774FA8FDEEBD4, amount: 100 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: 99.7 Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.3 Contract.set_code next_code end export fun get_htlc_data() do [ amount: 99.7, 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
1B85B4D6799E40F036B6CA84301E1D2B917E159F549CDBF13F129D4A8080E98FF25A0F15D2BBC01B28FBAAAB80E8A492865B055362E3974F39800408
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000A7EF...C289At 2023-11-15 15:14:01 UTCAmount 0.35377463 UCO
Previous public key
00018142063603E916AE73F1D5A4E57CF5207E0846AFE0D230BAF83AFCD997A62F6F
Previous signature
B788ECE2F8CBECFB1D82B7D970F0F20C9816F1E7CD3B7DA01A464C12A7FD513C84A59386DEFE956D8BE629913409C595E0420A2E1F7F6E195D9EF2A5EC9E5F0E
Origin signature
3045022100BF2D855DCA34FF22E7D5990382D2312969CBD09B1637772A7AC534A65D98F4B402207A36358EA1EE22EEE471B65B11B321011F68A4B85CB7362D4D59E56B0C8B30C8
Proof of work
010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6
Proof of integrity
00E5A917406109CF80DEE2EDCCDDDE1FE690287809BD041E9698E23BED39BCE31D
Coordinator signature
32E43BA191B9E97DF28F6C16DC1414E447A31E4A08F208D4C4300E9EF5BB3D77D7A6D0F216304E313CC0C5AD1A48E2904B4BDA4B775B8F09600DE5C54C3EBC08
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
456192D3F151B240AA4E16FC71EECA947C77A76AB72C1CF5003F52605A5F2EEC6B2D3F71671AB38ED644B94AEEE889AB286099A97A50BBEEFE74E989A6EA810B
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
0F5254E131E79EAEB19396B9A6A0A9EDDF6956C2C09C2512E83911001DB2BCF7C6FF7D1423820431029B1BE298C559FDEE7DAF639CB2AD5EC0CFB53BDAA4A40C