@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702603440 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000F3D9160C94DD20C903E2C7BBC4AA7C607F4DD93A52FBCAB186464F3D8AAEE1BE, amount: 50
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1702603440
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000F3D9160C94DD20C903E2C7BBC4AA7C607F4DD93A52FBCAB186464F3D8AAEE1BE, 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 < 1702603440,
content: Crypto.hash(String.to_hex(secret)) == 0x5990F5EBC73435642971410D802D5F36F6CA67DD5DC388092F7D2EBDE17EED55
]
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: 1702603440,
secret_hash: 0x5990F5EBC73435642971410D802D5F36F6CA67DD5DC388092F7D2EBDE17EED55,
secret_hash_signature: [
r: 0x368F268D7200E023094392D1EC5ACF823DBF53201B9FD8E98FE959B5F6435D2A,
s: 0x0F150E142F2A628E9376A6544CFF496FE87C886AE4B1718D8551A177F8132992,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
5930C38CC6FDDEF962CFD6810C27595BA7C061D9D5DD819B58F92F2CAE910A06546C649E29D0765D3C6109B69B492D2646BB94E83F26B9691A1DE43D
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 0000C087...FCEBAt 2023-12-14 23:25:01 UTCAmount 50.44550754 UCO
Previous public key
00011A66AF9A4DAA58364CA3714CB9FA2ACD60F5C217CF963EEABD07F3442656B44C
Previous signature
E398CE3E7F6AFD95AA4DD613E0B9EC93FAD897E2C3E7B03CA42CA10D9D892A9E0B495C1F335B4A2AD8085F91698210FC6E9EC2435E13620BA29D17A189CA4503
Origin signature
3046022100ED34D0DAB140CA6214813B6ED75D4B1F066A5505642E853B8D0608FD32170076022100F63A0874EA0D9B66971CF39C6B447D29C22DD7A4B59E558A167634FDC335B0EA
Proof of work
010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90
Proof of integrity
0089F9418A55E22DFCE349A6A7FD6CECFAA3C9DF8FB5220931F130320D1E12DA2B
Coordinator signature
FCBD358A4DD611199B30106FF164140529787E348BCD5FF5A8BAFB296C72E8354EEFEC02B0BA28906E584139483D3EA29F9A23C74120A76F7EDD5AA010F5B609
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
7CC2C6F2D8B8AF7C6E607DD7E147DC3327832D652964C86B242EEB46FA26D545AEFF4D3C8E06C6452DEBE213B9408F212ADF55DC9E33F5AB145D2B6116F59102
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
1028BB6CDB748DECF9C1E3DEF98283318EB4EF7236256284130B2D2205C7BDE38FEF3840E25B2E239A5958A2A9E3C13A307A36F8F853C724D5A237D0A39C260B