@version 1 # Automate the refunding after the given timestamp actions triggered_by: datetime, at: 1699998360 do Contract.set_type "transfer" # Send back the token to the user address Contract.add_uco_transfer to: 0x0000D9E7B4300CC29670CA80010FE23292BEE4AE28057328732A0FF4CF11C319D81A, amount: 100 Contract.set_code "" end condition triggered_by: transaction, on: refund(), as: [ timestamp: timestamp >= 1699998360 ] actions triggered_by: transaction, on: refund() do Contract.set_type "transfer" # Send back the token to the user address Contract.add_uco_transfer to: 0x0000D9E7B4300CC29670CA80010FE23292BEE4AE28057328732A0FF4CF11C319D81A, 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 < 1699998360, content: Crypto.hash(String.to_hex(secret)) == 0xE58FCCB82056CBEBC95A2ECFD871D00BA4F08EC2DE52E7EC9AFD748A6DCD30DD ] 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: 1699998360, secret_hash: 0xE58FCCB82056CBEBC95A2ECFD871D00BA4F08EC2DE52E7EC9AFD748A6DCD30DD, secret_hash_signature: [ r: 0xA4907C4436E15DBD20DF599FF076835121DC4C80BE38732E417EF6258D984988, s: 0x00C8BABDB59CB34E55597912B2DB444A7F83FCC44846CBE71CB9CEF151BED3AA, v: 28 ] ] end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
BED45BF075A625BFBDAA5BA223093F7C72F1D1F179E8C19F563D4077B1B1BA85D0909F5F4F4A9CE124EF48107A4C43F86BD62AE40C7A35F3F06D0DC2
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000B36D...DFEEAt 2023-11-14 19:46:52 UTCAmount 100.35429422 UCO
Previous public key
00012A8BEED270CC8411A644844AFE2C42BDA9E5C1BB2BD24B87AD9B09262097BF26
Previous signature
BD929D73180167D72FD73741E2457D688F47F882A61041EC42173F83A2F2118C76897CC7C556141B72119237E057A75658892167BB97A83CF67F1E8BA74E3902
Origin signature
30450220107661D4150B44E74E70B3FC9076CA58E084A7069D48DE6473F77900EB614D49022100BFE1C5F5FC0C3833632975E9C11C5CAE40634769EAC47A736203902F2142F521
Proof of work
01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16
Proof of integrity
00686D73446EB965B602A0E49E8EB364DF4C808DBD256FA629073B955E4051B6AC
Coordinator signature
77744C157A664906FB7D46F9A2BDAABD6DA348E1D0395434766BE260566F391AB7439D64CEA1365D3DD33E4CEE81A65AB0B4094FCA8DCAE78BFF46D913993508
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
A43387503AA6B5BE6086CD91E9B6EFA7A5DEEB4CC6F1F517796723FD3EA6A258C48563528CB1EF9CBF3AE147088ACC15CB0431A8782529C80542F8659983FC0E
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
4ED47F165DB475C9DD50819B8635EC1D08E3EDBEC0755A0505001A31AACFA1134628E215121F34DF217318CBE31BA5977FB359935E372B1C581888DB402E180A