@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701387960 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000064F114419DD1BA0B495E4B596513A180BCC4F58643496F0919DCC3B6313BEA1, amount: 0.1, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701387960
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000064F114419DD1BA0B495E4B596513A180BCC4F58643496F0919DCC3B6313BEA1, amount: 0.1, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
),
timestamp: transaction.timestamp < 1701387960,
content: Crypto.hash(String.to_hex(secret)) == 0x9E57CD3B73F5C7689BE2A4C7949F916D71DF4BC631CD7F5196C0D30D13E1AFE6
]
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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0997, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0003, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.0997,
end_time: 1701387960,
secret_hash: 0x9E57CD3B73F5C7689BE2A4C7949F916D71DF4BC631CD7F5196C0D30D13E1AFE6,
secret_hash_signature: [
r: 0x1979A859F89B90CED22BBC6000B77BA41529B88BCFEA1927E2C7DD3E628E2AF7,
s: 0x2450A2CA048D49C4AC317D22FCD2FB69EC23862117FDC630076BC19A8AFBFD5E,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
198CD81AA2CB423AE841273A162370887F6DE9AAD72A073604A515E19BD6C78E3A226266BDD08B304025775D3D302FE9A3EF690DF394C04003A791FD
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 0000B63D...3AA1At 2023-11-30 21:47:16 UTCAmount 0.41247638 UCO
-
From 0000976F...ACD6At 2023-11-30 21:46:55 UTCAmount 0.1 0000288B...B827
Previous public key
00019E875FCEC4377C6EA8C80AE4F3149AFF55BECE73BF65C23CF21EE805F5E647B8
Previous signature
E5EF7EA8997B7096B7C2186A5B2F8CAB1367C502615F749169D1FF82FE93ACA3B368D3B237069B120E1431A695C9BAA743ACA9EDB7C0548797F01D8B101A2609
Origin signature
30450220571B51E84A4CC146F6B0C8B3BC27E0CB5648C81AEDF321A53510E4D197EC0870022100B255E38538511935C0C1156F6442310780832B1D600F663B08C12038FC17B824
Proof of work
010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347
Proof of integrity
006D8DA90F7755EBCC6825E87FC953E834A6FB3BC840B219493B3FC9C9AF5FAABA
Coordinator signature
915AF12839642C48D9013518C92D788D17430082E2C4EF170ABFDDEA5EED0B27178A82B3B725088C0E2532A0DD66F5DC985C7E66E41A9723A8FFC4B17C0D1706
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
58425100BEC786F3C351239EF66585AE7632CFDF10AC4060D1E53B5429ADBA379B7698E2DF8B7154DC97C0E6C3699EB2CC4AB04294488D6DE92696C60E09450C
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
28503FDA0BBB191D78474676AB537A9E096D4B17D712E1C4768592E874086FB7CF335BA556BC7A10B18E38038AB7C96A2EC5209A241B51FF31AB637D82C0320C