@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699822680 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 1
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1699822680
]
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
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 < 1699822680,
content: Crypto.hash(String.to_hex(secret)) == 0x7122E1AFD726B761092FD531D95FE7F0A9CCC5A6F4AD57DFCCDE5A61A61FCD66
]
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: 0.997
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.003
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.997,
end_time: 1699822680,
secret_hash: 0x7122E1AFD726B761092FD531D95FE7F0A9CCC5A6F4AD57DFCCDE5A61A61FCD66,
secret_hash_signature: [
r: 0x4C8AEAD7C5321BADF6487A7829130648D5AA8E047B3A1FF86A39583B2BFBCAB5,
s: 0x7427841E3E0565AE388EAD836690C2316061EDE63104237F0E77448EC37C13E7,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
E4B73F2C70D8DE24199DF75B19762BB828A94BECBA3026D4577CEFAEB1885C859548306BCD29BD1E9BBCE89D6BD109B47187508ECD92381CCF8B5AA5
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 000081E0...B0B8At 2023-11-12 18:58:13 UTCAmount 1.35241 UCO
Previous public key
00012A1E80E94816AEB848E3C8AB576157D9C368F3154CBCE6CCB257437E8F6D1ECB
Previous signature
89263333FB3A95060FE6B0364D8EAF154CA697FC02EE5D3609E907FD991D7D46254DE70DDDFD18B809404D68C4E04D77C082012B271127CAB7506EFEDE5BA403
Origin signature
3046022100CB91DCC731BB682114CC59CEC0737BF49B161C55C441FB6CF8D16C424805F876022100CA3C598609D06652A48B01B7DD73491F1649C972DD71C8F086E991211FB5EC3A
Proof of work
010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712
Proof of integrity
00F40C78F7735C97F6468F202723027C416568E5B871ADD58C3E08B0DE2AAE424B
Coordinator signature
2820C905EA2B76090C5D953CDA0A3170C2CDF484CCBEF642AB4CC39EF7AFFE4F3F1050A9E15F4F1D168724F2128A45403D0A714238FC87B96A5EE27E1E763700
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
AB52F4BA51CEBBC92E7D24D855DA5ACF7980923C020C121D4488E17AE3201DA3ADDAEA90101D83FB3EA160D3BD2B2F3C75AB3616D368990488BDF00C0C239A0A
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
46CD8F15FCE990E35F51A8266272B3518D34DF00C678C13472A3BEC04433E290736C82FBA045E650C142A04159250B0E2B688543E395C29962258C6EAA57ED0C