@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1705223100 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00000728082646346C9BF3676ED7E29407BC1D2073286F694CB4E783ED9817552E80, amount: 0.001, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1705223100
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00000728082646346C9BF3676ED7E29407BC1D2073286F694CB4E783ED9817552E80, amount: 0.001, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
),
timestamp: transaction.timestamp < 1705223100,
content: Crypto.hash(String.to_hex(secret)) == 0xF562665FED56CD1B95F45337F7DA3226A5D76EDBE4C6D24BCD03CE74AB4631FE
]
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: 9.97e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 9.97e-4,
end_time: 1705223100,
secret_hash: 0xF562665FED56CD1B95F45337F7DA3226A5D76EDBE4C6D24BCD03CE74AB4631FE,
secret_hash_signature: [
r: 0xD3BCAB08802003B43429DF9358CFF12B28AB8A6AD31E626115C85E5A0B2C8E33,
s: 0x04777EE84AF80FAE0382F850C9F389440867CACB0E8BD86D23235A2617B05715,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
EF8B469EC5707BAA88A1ED28B6921E9041EF00559F4DE2CDDCF92202A674C9EA9BB662D424EE7AED4121CD9244A5AF6B7DE2CCC2F9576429044DB9F7
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 000042B3...4EEBAt 2024-01-14 07:05:49 UTCAmount 0.41555493 UCO
-
From 00002FEB...D639At 2024-01-14 07:05:27 UTCAmount 0.001 00003DF6...73B4
Previous public key
0001BB5BE863BB4FC392DF12500443A50BFA8EA946109FD8D50EBB7D70CC64A857EA
Previous signature
C6A59BCC73DE19CCC4B8FEABFC3A6BC3EA2F4B558126B5A88646863CF536348DE475C6C21597556F8C90A6E75477AC95A27D85D392CB0FA654EE4280692A1B05
Origin signature
3046022100D4F72C299D44D29264CC22EDE5E324816D2D028E65C11525CE1B7BB8DEEF8354022100B0175628162BD3B97D9DE2759007FBB3556C6B1D8CB0400415447B6826944615
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
000B7A805809F541FB4142218EA31CA8F09857DA2A1A15820E0AE65B18E0800838
Coordinator signature
F17F4003AC517A97DB48602DDCA751B50E0E57B3A2505B78BD23A78AF9F0F1DC691337ADBE2FC2D9DB6DFC577338A766116F8730E717F8E9C03DAE9D37A51500
Validator #1 public key
000162E6ADFF9FBBBC4BDBB3CD56A5A13A1E8576C3619ADC58A189F7E9A3A77FF95D
Validator #1 signature
1EB198967BDDF186E52957007F6317C2A97D9E64BA364E0CFBCCBF401FE448E435FED6E4E51C378BB7647D096C7A8B338D1BAE5BB41E812B9034E9DAB4E94909
Validator #2 public key
000103E30584AD8DE66F9E29419D5D0ABEE5A76722C9FD0D012BDDE3A6E2B149C48D
Validator #2 signature
335BF57ECCF4DFFC7151416583B49DEC18156D7DBEDA6E4C205688A8182620479BB1084FF1FDA3ED56A3AD1BFC72A4D54872AC108FAABA05E4FBADD5D02C4506