@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702171860 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00003440BC8E123C7B9102936AE257978F775AA1DEC6D192ABCFE5F123FDA92018D1, amount: 75
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702171860
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00003440BC8E123C7B9102936AE257978F775AA1DEC6D192ABCFE5F123FDA92018D1, amount: 75
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 < 1702171860,
content: Crypto.hash(String.to_hex(secret)) == 0x6B405D24262D670D5E45F9C2D0B22D18E7CB896263AE8E5E8F732A4C0CCD3AE2
]
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: 74.775
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.225
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 74.775,
end_time: 1702171860,
secret_hash: 0x6B405D24262D670D5E45F9C2D0B22D18E7CB896263AE8E5E8F732A4C0CCD3AE2,
secret_hash_signature: [
r: 0x129851F635153A1ADA21B390BC9F5E53826F07F77E40216CBE6BBB49D32EA663,
s: 0x6DD83EF19E6205F41288FC2A4D32DEBD4234AD77EEF77F0EB94A1325B5D09689,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
E4AC5C212E7C4435F124CAAD8A1C6928FE5B2D30FDF4271513847DC13B035B68E64B54B288EDBC1E391830A77E35EF7A36DBC5B874D499819E8C81B9
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000F215...9BAAAt 2023-12-09 23:31:34 UTCAmount 75.40917252 UCO
Previous public key
0001A2D296C2B569333E3643CDA0D5876717E9685CE08AC47B4634AFAECE8409754F
Previous signature
10B1FE0EC5C659620C6AFB3480C3CAAFCF33E8591154DB5F2021AA85E2E37C6EE70C3D6DB504E25848AF632549F485240AC26E65F3268A578DD1B3F8EFE3100C
Origin signature
30450220756E3DAB5E587C0B4AFDEDA8746E951F4157026192C36C83534756FB4790AFFB022100DD40CDFD82C275D215889C54DE6F4C535E120C20DE7BE156C86021291BF931CC
Proof of work
0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45
Proof of integrity
002DB7F69861908875A3C64AF770DA1D76C2A52EF07FFF15E6148E4C625F7F5864
Coordinator signature
A98AC6842345E5EB777BF706F79011303658AD989318C92FD1FBE85082638576C12DDBC075588F5626A3078E81E0055993EAD0F97484210C9FA83A0A971DD101
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
08C8FFF38031A4BF4092DE4F2958C494D9B185ADE68DC7F1D955754FF2214DE8C44985BA3C94BDEA2C3BBCB3D77316A70FC96752D2A39AA70F4953584BD2F50D
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
9A37CAF8DD7327CC2B474F84B7A41D776D88A0BEA42EC9F81A4C3924D38601D0BA4A9457773F21D6BA5430EB0971968CBF64D82D9C55867C0E35FD0DBC08ED0A