@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701459240 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000F25C3DF408399FD5CC26D5A53C4081F6D6600B04B5EF4E41836D384F8B84C772, amount: 0.00541159, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701459240
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000F25C3DF408399FD5CC26D5A53C4081F6D6600B04B5EF4E41836D384F8B84C772, amount: 0.00541159, 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 < 1701459240,
content: Crypto.hash(String.to_hex(secret)) == 0x7D6030EA591132296FB805ECB9CECD5F40B18865B0A232C8B4824A305A62BAC3
]
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.00539536, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.623e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.00539536,
end_time: 1701459240,
secret_hash: 0x7D6030EA591132296FB805ECB9CECD5F40B18865B0A232C8B4824A305A62BAC3,
secret_hash_signature: [
r: 0x63D92642C941751996CE42057BB739106B63630F4C332CB9D5D134AA794AFB2A,
s: 0x1170F4A781DC3B4CAFAA6AEF28E596AF1D254AAA9E8F630594101E635142A04A,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
B796F15FCDDA4D6982B81636A7D1C326AFD2340CD977034C3959029BA1833483CFDD1DBC2975AF118386720B53E5790F2A1D0B77099F8AC5DB5F981A
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 00000016...3EB9At 2023-12-01 17:34:47 UTCAmount 0.42964506 UCO
-
From 00009790...4FA5At 2023-12-01 17:34:33 UTCAmount 0.00541159 0000288B...B827
Previous public key
0001A66EC4AD753C2CF0B91C2E1E4A4F6536729B5F4EC4C2DE100A83333FBCD1C715
Previous signature
BCED6BE4CC6345200CE59A6BE34CB7E1839AF21246C45AE140CBC2E37C1A85E74AC2B9140E0FDF6B41873A6A41D2AC30D0C0DD381FC213F56F3EB8B257EDCA0A
Origin signature
3046022100CA4593E742475BEF1DCDC599F7A252D21283E9D156A2CFF25EA5373999DF3FE0022100F213ACE5DCE9BFCD05EDAA95171CF7FC5A82573EB259994092933E10888D3E5B
Proof of work
010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712
Proof of integrity
00076EB4108E67DD33EA20721CA31D65C47652632719FA092DBC4D8D1CA5BC0568
Coordinator signature
380F248AFAE5E908BE7A30DE48AE134CB360E8AFD32033D900FF89D7DFD88E4C17FE8096CD48F3D5513C1D71A8100AC3CB919D2584DC22F86388ADF8A8D4A305
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
8D8531DDAB3FF88987749FB433FCC6B4B4FD0BA1C8FD23E99C1626099A7BDFDFC66CA447857182434AA480BA8F3A3A2D0D800F521633A0A9C05C08605C788608
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
3C24D36DB461B4FC0C8414ACA573AA3AF4F7545D5D9A49B063F261C241C3F57FDFF7F5CA2D916470D987190865ED3BB377F082F3C547BAA43B61B66F54FA000C