@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702131360 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00007011C3312E6DD64C930A68B7B5F99AA6FC8FAC555DC1421BADB3091E3786B826, amount: 5
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702131360
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00007011C3312E6DD64C930A68B7B5F99AA6FC8FAC555DC1421BADB3091E3786B826, amount: 5
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 < 1702131360,
content: Crypto.hash(String.to_hex(secret)) == 0x745C2C4834ED0CEAEB9E16132AA90448406837448C893F5C5D518CC7FC92B904
]
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: 4.985
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.015
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 4.985,
end_time: 1702131360,
secret_hash: 0x745C2C4834ED0CEAEB9E16132AA90448406837448C893F5C5D518CC7FC92B904,
secret_hash_signature: [
r: 0xDA2D59A70B3F2338F86FD4EB95369BAB6B0DD435B07168C7E3068453A00185EB,
s: 0x338F73BAC8A79121720B2BE2A9FBEA8AF070053071C69B899ABD07C1570ADA66,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
8FEAC11E637340A42725491F63D2A06BB79A74AEA5CF01FE5FD41C378BD0F31D76F59928BA7562464C12B9D0FE910FC2FE2FCF3DCBF83FDD76F7E6AF
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000A674...9D8FAt 2023-12-09 12:16:20 UTCAmount 5.41357926 UCO
Previous public key
0001B4C6D9041B786FBADB1C06AF8A41CCBC65BBC205D89C2C3C1FD9DB6A5C7C67EF
Previous signature
FE804F071E742E35C2281DFCA675DF813EAAA7A393D048E9C104AF701703D18D87ACC3124A43D16AB29FB14EF3E19AAE4AA140D0F698E40DFC94C628AF5EB209
Origin signature
3044022023BE5580A440470FA2AE20B33999EA44F3ABB97E4BC2DD177580EC31A81AFDC802200851E7E99C4BF14D8446289E3B1EF94BFF5BBE3AF0337A8FDE397A242C9A7B29
Proof of work
010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61
Proof of integrity
005BDBD870A3AC6D0C00D76C3D994BC7DDC7F1DEDA1183385BE1CD2A0E3AAD7EC7
Coordinator signature
EEC655FE49C7FE37142656C4A571BF7B54E4EC444E099F7F34C575F1ACFD3600C030CCB3A9D514D886CD84C30515610000489B00C632E779A7ADC9F134A7EB0B
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
5E5057221ED3B4492F684ACF62A24454BFDF9C9D0A839E4D665AAEA9E8DD1E815C0DBFAB52FB8B323C41F0589BFDB77703B303D8E02E57531F48B69C08F1BC00
Validator #2 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #2 signature
4E2BC4FE9DC3E9EFE4C217B446E5366B9AEE43DD5674599A3BD947C9502B98DF1AF0C6DA12133D972154CADDEEFBAC40C402332A938F6B9DF4C90D1185889302