@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701458520 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000F25C3DF408399FD5CC26D5A53C4081F6D6600B04B5EF4E41836D384F8B84C772, amount: 1.0e-8
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701458520
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000F25C3DF408399FD5CC26D5A53C4081F6D6600B04B5EF4E41836D384F8B84C772, 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 < 1701458520,
content: Crypto.hash(String.to_hex(secret)) == 0x95D371D47DBFB9F8C9650CF867FC9494B03B01E8D8D58031C6F81A494E16130A
]
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: 1701458520,
secret_hash: 0x95D371D47DBFB9F8C9650CF867FC9494B03B01E8D8D58031C6F81A494E16130A,
secret_hash_signature: [
r: 0xE1623C015EDA476C989132A8AD906782BC4E858F634E9A1F1CFBDE29EACEC217,
s: 0x388184315539AAF8EDEF64FEBC55E1F8CFAB79E14DF371B3F5168CE5DF5F6A77,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
3804A295D981F7D41DF6DB5A17ABB588682990BE10A5DE9998963ED3568F5280AA71FA68E603D7DD0F5A45C934E314E37348565D224D1390F1FDBAD2
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000EFEF...0905At 2023-12-01 17:22:38 UTCAmount 0.42394415 UCO
Previous public key
000139FE9861C19E74BAFE739B7C754B86F1442EB8F3D94D373F76A580E54835418F
Previous signature
AA64C78E30F5F3AB9D4DAF73918527D8C7143334AE57AD5AF622785F35A73DA5A3A7435FCC0D490F6B76A079A2AAE6A494A64ABA51E9D3A982AC77F987418B09
Origin signature
3045022018690B0DAFB282D9681900C9B128A304E6D32B5FA015FD25E37D60CDF7F23E740221008A05496C3B29339E25FEC309F15433B12F938EF2ABAEBE06F77C687185D4D420
Proof of work
010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712
Proof of integrity
007CFC6D3212E5C94BC8A82F7F6E37E770C5C0DB3FDE56A165EFAA6C93D73E31B0
Coordinator signature
4D4EE5715D4B2AB81AB19DB8AECAB2F75188E2134612E53FC47EE777ADAC5860309F7FEE0B8401D0C0BC389FA999418F737CDA8781FD2C3917B5FA2EC051500E
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
6612BA2A9C24876F3C41274F9D4551D0B4CC35B0D062E3CFABFDFCF43FE6C899E846835B5B4A62E3082C8A4489E639E07CA376316543C7E3812B8B314200DE0D
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
DD0270D66A557EBAF8E1465739E7EA3703DAB527B94C4C0547C2B6767EB9A50A4A8590FA103CC2DD1D5F7EAC5B93C7AA9228BE9460352892B178242FDDE51607