@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701318780 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000052DBB0394202F5E1A0290DC1595870AC160515BE80781452FCB0A205644F801B, amount: 8.0e-5
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701318780
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000052DBB0394202F5E1A0290DC1595870AC160515BE80781452FCB0A205644F801B, amount: 8.0e-5
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 < 1701318780,
content: Crypto.hash(String.to_hex(secret)) == 0xDF02C317B489E2883E805B15009E2A4EC668D8E7CDF1C813904A4DE5DC0A4DFB
]
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: 7.976e-5
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.4e-7
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 7.976e-5,
end_time: 1701318780,
secret_hash: 0xDF02C317B489E2883E805B15009E2A4EC668D8E7CDF1C813904A4DE5DC0A4DFB,
secret_hash_signature: [
r: 0x9D90A15B2B90B49DF0FB5F3FC77648504AF8FBBCB2952B4D6B00475A785AC422,
s: 0x6DC4FFBFB9AC94C821568929B9B99FC5D03EA9B21D0BCE995B9F783DE89ABCE2,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
63715A3A77A8E92B4DB828F3134B1ADE5EE2A5F3D549321E43825488B98CB48AD4315EDB04A3F154C93B8C5361B539BFA390031ECCDC59AC7C8C885F
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000CBC3...728CAt 2023-11-30 02:33:33 UTCAmount 0.42220937 UCO
Previous public key
0001BFA34B7091CAC05B4951520C2C0D598FC2611678DB07D54C891D58C9BA0219AB
Previous signature
EBE370A68769A9E799A0BA00A65E55F0CB961B84109ADBBA5FA86F189B68C67F24CFF3B986A0B2B239E15BE810A271364DB3D60DF4750B950BE9AD7CD3D14306
Origin signature
3045022100F2DAB4215C45F948094EF5C345C5C92E37ECA1E2EAC87102B89742D294E9AE7D02201768485D0D5A2FD8231564600C4284CB7CCE7EFEAAF111791D433E6BFDD60086
Proof of work
010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90
Proof of integrity
00237EE882CE2D569194C4F62FDBC3245C26BD0BDC7787DA03A5BBCDEAA41C3D5D
Coordinator signature
5D5452DA94FFA621DAA30374B6B0A6BC366C59D1DEA7CF82B9D4C687ACED59862B6203C072152D74A73A01DB80861277CBA0C9F28FDC0C1759F800FC6CE3EE09
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
A06DE53702ACFF0956BC6BD8B490E49C5D64E2C94AA3C9E861F787BFDA620550B42E20266E17A64D638AAC8EE6C08D22192805994D0D11C13F0B584D4B79AC08
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
0005110BDD7E8DFF7132AE9EDBC157FCE65B8047498A2CB2FAF3C763D066F7205E59BA49D6D66C1AA80E7A362ADB070D8D5C7F1A3EE11341B696D0A5FC9DA70F