@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700065740 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00002E23104F83E325686794C2D1BDFD23CC04566258C9EFFF6F35A34231C558CD43, amount: 50
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1700065740
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00002E23104F83E325686794C2D1BDFD23CC04566258C9EFFF6F35A34231C558CD43, amount: 50
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 < 1700065740,
content: Crypto.hash(String.to_hex(secret)) == 0x078F27C6F61913E4F972F1FF4EC4AE55F5356C283BB9B46CC8500400AA108CE8
]
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: 49.85
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.15
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 49.85,
end_time: 1700065740,
secret_hash: 0x078F27C6F61913E4F972F1FF4EC4AE55F5356C283BB9B46CC8500400AA108CE8,
secret_hash_signature: [
r: 0xB90E7688D923F4BB08B00D866007C1643DE1B7640AD95579BBDA0C1D033ACD11,
s: 0x4D646CC5E2C4DD34A447A5C404E5DB5B1654156E2E79A73EF79E10D09D3B68EF,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
18D446372655588490117EBA183DD3572601BCE82431A00709D047C0F41E5BD4C7AA10ADA2BF8470A3D414E6E8A9F89FAFFFDDC434E89CA74DDC55CF
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00008577...D4C5At 2023-11-15 14:29:41 UTCAmount 50.3518698 UCO
Previous public key
00010B2BD2F435E7C6E094378AD420742893F3A6880AFF87D874D6DD78CED316085A
Previous signature
48C50F6A055AE09F7F9A23DAE6AA571BEF702C913D9A7BC5DDCBFA7010362C561BC3A01735989438B8657C25B9D0A853EEA250AEF63F193A74DD2753BFE38B08
Origin signature
3045022073AA369F99D870BAFF651E1BDA806F62A31099586D9E12D98CBB8069CF0AFDE9022100E158537F932F66999AA69737572BCBECB8E2324AF61A8698118F823A31673D7B
Proof of work
010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765
Proof of integrity
00C0F115E5A36E8A923F9B0B4F1C154823A1BD0D61B6E5BAEBF7B2A0D1EE62982E
Coordinator signature
12FB21C8C1D8CD8252DCFA8AE00A62A3EDE6C4D8CB352B10FD7FB637FCD3848C6B7B2D9482B6DAE27506240DC09829DAF64C6EC5EDCFB267C0B95897619C470C
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
8D0B53BB1DBACFBF3F29C9CA2DEAFDA0A68CD30AADDEED2E7FCBD708402B83F029D87FC4B106C15C6F14056E7F59384260CE6D010B5ED5F4BDE31AF06793810D
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
0BB34505FF86188958801F4736B33FC67B5C054CBAC80C0D74A872A58DAECE0A546C7696533F6BEDF60896D430F2D9540E465952C778D208CAD146F78D6DF106