@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701920520 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000095FFC09F7D5FE59BE1153D66FC51233FA9C1ECE801EA0D262A5F4C94B2031DE9, amount: 5
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701920520
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x000095FFC09F7D5FE59BE1153D66FC51233FA9C1ECE801EA0D262A5F4C94B2031DE9, amount: 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 < 1701920520,
content: Crypto.hash(String.to_hex(secret)) == 0xD847D256D5E280FBAEDCEE366C43C959C8DE4953CA955420685A454F9EA3EE74
]
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: 4.985
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.015
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 4.985,
end_time: 1701920520,
secret_hash: 0xD847D256D5E280FBAEDCEE366C43C959C8DE4953CA955420685A454F9EA3EE74,
secret_hash_signature: [
r: 0x50CC87CF4FFD36A9F2D99E2731B6B13975C1EAB006F5F488427C698C77D1D733,
s: 0x6758B03CD9CC1130BB43A0158B0C5331308753247AD21CB491AF91D852368122,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
9A712EA170B79D63D073ED03260898F58EC205CA25C757BF882C858F0637CB3E1C59E2D6E439AED44CD13CC6E7644D08687F7C92D1749BE8B1EE6D22
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00007DB3...87F8At 2023-12-07 01:42:22 UTCAmount 5.41013139 UCO
Previous public key
0001B735DBD98353304528C8D115BF5D7B506C14E7A0B5FF1630EC3FE241300B71B7
Previous signature
AE1D793CF1018833D071D8CE6FC3E04581212AA2E29690C42E681391FF3CD6110665B0527572519B638B7224F5E6443673D8A1F64DD9539B64A8279971A7DB0B
Origin signature
3045022100EC376D2AA8554E59443707AEB7E806BC94C1E77875171A029D4E1EDA648C257702207F4187F42463F02AC82ADE46B7D5420F832BE96B98596EE22C48A1F0408E5364
Proof of work
010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B
Proof of integrity
00916933A34B7CCB2F3AB9F41901B3A04971435AB33E620EF5B3C30906C02CD888
Coordinator signature
93B68EED1255D3678F3657D8905928C5851603040F14A85D8508FA9AFDFC529025BBEC6D59D553E2D907CACCDC82DA88924F2C6B0B036D32908EE6C445FE0D0E
Validator #1 public key
000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF
Validator #1 signature
CC83CCF271719E17E2D0A558C6CB2AE9BD181A7C89C153C8DDE0ACC35122580F11D46CCBBA5184DC64C19AA8A15B13BEE189B065586D2E2563562B5B7F7A8900
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
D10FA422C452EB8584B512D0D0BCF94D95D6E4E598BEB33BA18110B45E3690AD5E55019C521BD5D3B8F288E26A4728A5A7CAA1423C05CB62D0FC6570D2194E0E