@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701435900 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000F74EE60CE89C9227127F41A4DCD1946F11721BF74D07C812591D48611D3601F7, amount: 0.02, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701435900
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000F74EE60CE89C9227127F41A4DCD1946F11721BF74D07C812591D48611D3601F7, amount: 0.02, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
),
timestamp: transaction.timestamp < 1701435900,
content: Crypto.hash(String.to_hex(secret)) == 0x0AEB393ECE5F8173493282DA8E7C8A0179E5997049D6FB571DA58ED96977843B
]
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.01994, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 6.0e-5, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.01994,
end_time: 1701435900,
secret_hash: 0x0AEB393ECE5F8173493282DA8E7C8A0179E5997049D6FB571DA58ED96977843B,
secret_hash_signature: [
r: 0xE93682608111FDBB15DAE7B99C8FCB357231989601C6A3C79CCD9AA36AB2A7E6,
s: 0x4A417DED606BD994F3AB05FE4C3312EA934F0DC3BAA832C30BD36DED15C6C760,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
B7BF5322868DB08F5E75C353994000AD19CB753DF4DD39DCDB0FF9C9A13657424755C1B1500EC38C116516C39449918344B8C4625BD7BE57BE280FFF
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 0000DE1B...6D99At 2023-12-01 11:05:40 UTCAmount 0.42406317 UCO
-
From 000041F1...5CDEAt 2023-12-01 11:05:21 UTCAmount 0.02 00001A4A...01F1
Previous public key
0001618535FC35C48F145AAD678241619043DAC8B4AB379838538C2297723F62AD82
Previous signature
98F78C3ED4663FB8A29A5582845873DFB0144BF764ABAAC70F6F91D30EF386F5B54D454BD4F028B030047E20C8232DA42866A0FA4F7E8B91464C64C77A25390B
Origin signature
304502204A51E122F2AD1F2483BCC5407015CFDE40811E913E90DBDF3A6D82F4A25F34F6022100B84D0B47DDAB0E1A9F5EDD5CEAD9E2287BB332F6FCD5A66533B396E86368D3DE
Proof of work
010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765
Proof of integrity
00D173A77491718759B5307CD3F53AF1D3E7E93DB186E7CF2382A5E61DAF5989C2
Coordinator signature
7AA5CAA9575D4FE00E150735A887939AAA0D09BA69DAD84C233C2B86D87B5D43E0EA078C3A30E2557BDC5D720FC875FFE29347A62D186C054C3C760C91578D0D
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
D1FD6EDDBA212FCFA73AEA5BBF9F1FF228CFA8D5C26C413F11B6C365673D6FA44E069355C30752458609F4B97E61A751F4C3B0C5222CA32A6E4F5AB61DE96B07
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
772E697F76278173DA6F23C2D0338C1CB6D08CACDC352F47771E4AD9C6450D9DD820BCBD97E74847AB8D27862F3DF9C7D8005C483C9E225F38D774C608F71D07