@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699911600 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000A487AD42A5AA666E2021057C89AB92C97513B31EE65DCA76132BEDE148B12843, amount: 2.0e-6
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1699911600
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000A487AD42A5AA666E2021057C89AB92C97513B31EE65DCA76132BEDE148B12843, amount: 2.0e-6
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 < 1699911600,
content: Crypto.hash(String.to_hex(secret)) == 0x40B8BCD579BB450760EA528CAA71173451E4DA470A90862BB7596C46E0D3FE5F
]
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: 2.0e-6
# Transfer fee is less than the minimum decimals
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 2.0e-6,
end_time: 1699911600,
secret_hash: 0x40B8BCD579BB450760EA528CAA71173451E4DA470A90862BB7596C46E0D3FE5F,
secret_hash_signature: [
r: 0x2778FDB8FF060536CAB70A19530AF6942B989F74AF8ADC9108756B48F455DCBF,
s: 0x6E210F866F0900C6AD7D394BEB208B9C5717D9E7B27C446358E8A024496A853D,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
B0E33E35987FFECCF07F135622F2DB8C19E1B8DCEEB1887A22B36A0BD52D36F31E655D880DF66E7052BE8C92415C74ED6C5B45D40F721DD2A2DB1F29
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000E56A...BAEBAt 2023-11-13 19:40:34 UTCAmount 0.34470116 UCO
Previous public key
0001EABD0F58EA7930EE8283DEDEF324A493CC23042E5674C0DA3404243B309E4C59
Previous signature
382FB9494DDE42A2711358B33C6EFEEAE303723F0E683F15B4BFE4AF7A431592C511321B92BC13D4E434352BB7FC0BCE81C33DD9D3B6631776AB00EB6CB99B0E
Origin signature
3044022074D4301032FE94D1899F66D3C741BB5F73EF2655D30DD0C06212FA19134164A9022037B3256D1E112F975CE33445B518441364226301DDE075DF6E828E86A121822C
Proof of work
010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712
Proof of integrity
0083378BFEFEC6A8E52872A01692115410FDB4DCFFCB0CB2BE7B49D2F183BFEB36
Coordinator signature
0C95889BA272E481BBD0ED9C9932F3350D590527F778FCBA166C65F1C196A6738ADC2F4130B0BC2C4DE20BF6484B82BA9356668585E61CCE6B34A217A6FCC90E
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
FECFE5C24E814518BB41B7596AB4787298C76483FF1C18946095F66398DDF75B8931665096431A1E1BB9552B44B08FCA390921F4115D1B96E0D5E636B20BF106
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
6DB8123EB217AABD1692822DFDD64D133BDE32A54CBEA474D0918464F7BD51CF1B0D50986828CE8FB4FB8C1E6DC363C3341B3DBCE5EC8E403A1D5853DA49210D