@version 1 # Automate the refunding after the given timestamp actions triggered_by: datetime, at: 1698662340 do Contract.set_type "transfer" # Send back the token to the user address Contract.add_uco_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 1.0e-8 Contract.set_code "" end condition triggered_by: transaction, on: refund(), as: [ timestamp: timestamp >= 1698662340 ] actions triggered_by: transaction, on: refund() do Contract.set_type "transfer" # Send back the token to the user address Contract.add_uco_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 1.0e-8 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 < 1698662340, content: Crypto.hash(String.to_hex(secret)) == 0x45557E639C2161D36D4AA9F039300CCBFC4925BA0F857F2C1134BB652B5D9029 ] 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: 1.0e-8 # Transfer fee is less than the minimum decimals Contract.set_code next_code end export fun get_htlc_data() do [ amount: 1.0e-8, end_time: 1698662340, secret_hash: 0x45557E639C2161D36D4AA9F039300CCBFC4925BA0F857F2C1134BB652B5D9029, secret_hash_signature: [ r: 0x7A4889624F93B41AEA344F4B97107B4E3433D055FC8626C98C12CF5D3C5C24CB, s: 0x6CCF40BA06FC5D9421691D713AFE9D8EDBEABE599F55B86C664B4650D9427312, v: 27 ] ] end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
871DA3C9B26070E40C1A053CBCABE1F0FCF127C2B0D1B953F84FA56A11D0A77B63C513C09B2B867A5D0B93544AF9103EB26C600E70CCD9AE973713C5
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000058F8...BEB0At 2023-10-30 08:39:40 UTCAmount 0.56542275 UCO
Previous public key
0001F8910F4B2A2B0AFE41EE85E13AEF73DB84CCDECC9522B95970D2E43879378583
Previous signature
A9D23BD7A7D00F1911EF8A2BE06AFC8A5084ED7A73E728A88410BF9CF648BB059F1156E523BE4EE243E09CB5725DE94A389B425EF6CF2698606714BF268E1505
Origin signature
3046022100B32BE833C038A3E68BF0D20B28B0E0378BC9F69FCEC99A43C153014C5151AB33022100C27D686276245173514B8CA7084CE71C4258C0F4F12B25A8244C39D4DCA6034F
Proof of work
010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347
Proof of integrity
0055F3C14AB4D5283373425A7D74B1BBFF386D2B1F39215619C6BEEC3B31A77A4C
Coordinator signature
51682D181E5BB44AF12B97CAFFB9F170CF005F2BB830DB42184BF94A978DFED329D5FA5EF608166DB84EBDDF81C543EFC0CEE5C9884F07FD8E11E7CF6B8B4404
Validator #1 public key
00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A
Validator #1 signature
FDECCEF172A7C6B82567DD08E1F65D2A50769CE768DCE9B7C97DF1FDB588A2C8AD828B267AE941BA4B4B756C2133F3F0B114C496C79D8999DE847D36C3071400
Validator #2 public key
0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34
Validator #2 signature
8B4A8E2485E7CC87E240125E97D5D089A318DBBFEE7DC1D00F3D462A93C31D33C8B36232AFEB0528247C413C03026FC0A5B8C3F6781DF6730E78C97A6A57BA01