@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702337040 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000C99B2298DDE254C8F6A200099BF936A79B86C294837E5A1E5589912BAB284FDD, amount: 100
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702337040
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000C99B2298DDE254C8F6A200099BF936A79B86C294837E5A1E5589912BAB284FDD, 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 < 1702337040,
content: Crypto.hash(String.to_hex(secret)) == 0xBC3A9F106D6CF77FF01192071546D560616839920A8E02CDA6FB892F7E198213
]
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: 1702337040,
secret_hash: 0xBC3A9F106D6CF77FF01192071546D560616839920A8E02CDA6FB892F7E198213,
secret_hash_signature: [
r: 0xCC06D5A60F7C0E96EF4888B1DA767280347D23DCD905928FC1EDC3511A1E7A07,
s: 0x47775420076F43FAAF567C8F5B2B4C8C65352890E59D4A01FBC112489A9DB7A8,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
A01C02D2735DBC611A013173B5BC80619E1912885B834EF17A2C93E4C0365E290A09D563F03CC6CD046A8453B9448075B8D310E744CD4927F0472A08
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000FF40...E0F3At 2023-12-11 21:24:42 UTCAmount 100.45045548 UCO
Previous public key
00011E8651BFF07752655F83289A8780CBC186176625081B6455AA914644609067AD
Previous signature
24F25743102139F78958FBB5D52BE132832E54D8F04D22A14C05E051D4925A3A44A5EC0F5C7F434081DEA49F932665BB4A0531A973A7BF1DB496E17D1075A90F
Origin signature
304502203759F0A0A03FFAE4C454804A43533BF1A843A684F4E7B36DB2B4C5A3956C7C9C022100A8CD41CD9F15C2FFB7BC0AA83581ED488A006895D0940545B57AA5D4BDA53B5D
Proof of work
01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16
Proof of integrity
00F3207E03BCEF38F84EC5B654AD9A1BFB069A96663BC7A03CE4167EF076D9668D
Coordinator signature
E1427DB4162DA4FFC94FA4DF84E353C3969F78DB36F4F74B510331C5C9DE7A78BC79A585E9956D02CA9E7EAEF2527CCEEC17EA90165CD7003078D00810886C0F
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
057E4FCC52C02BC10CA466D1492C54F7CFB5D75F08FEE878F83AD0C344D7C5D7B4F0B65BAB30683B9F126055D0253EC81FFD9235CB2E2B80D6F5FEEA11028D0B
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
400ABAFB043A397A0BF0368BF09DFB1AB0C10831AF288644DBF4F6D5388EB46598F0301FEE588A9A13579E07AA1E280D226D36B082F50FFBA6F715E163E50A0D