@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701347700 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009593AABE5D416FF4944E6C4C7FC0646A1DB894C5B5DFC774418F093034410B0B, amount: 100
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701347700
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00009593AABE5D416FF4944E6C4C7FC0646A1DB894C5B5DFC774418F093034410B0B, amount: 100
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 < 1701347700,
content: Crypto.hash(String.to_hex(secret)) == 0xAF6E225288A19CB22148D8E51522F217100C461549769F9D15834926E3C2BA0C
]
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: 99.7
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.3
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 99.7,
end_time: 1701347700,
secret_hash: 0xAF6E225288A19CB22148D8E51522F217100C461549769F9D15834926E3C2BA0C,
secret_hash_signature: [
r: 0x83359B61DC8A0A48F53F8CB7BB97EDA134B5B336DBFD06CF06E77CCEEE0FCB15,
s: 0x7C17572923B995A6BB4B79ACADA7B3C8ABF8766426FEBE35261C9901CFD034AE,
v: 27
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
26CC56C30AC2798429B8703612AEA59843C205503641133E316B4A5F8B93787D8208B20355E3A364253CFFAB0E6E840D77BAEC4E0DAC639C4D23A661
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (1)
-
From 00009584...81C2At 2023-11-30 10:36:05 UTCAmount 100.42059746 UCO
Previous public key
0001AB0EE14EEDEABB55E871EFA79AA730678537689EFECB04722A92A444A4E2552F
Previous signature
860C9B0C929A2B7B02B3CBD31A1423DDFA1D6EFEFF06557EE0A8A41B8E02C1BC53E2498D776792C03A884CAA4C58A022D7C148642B48D3DFE77494DE2BCA7408
Origin signature
3046022100D339C67BBAC20EC9C612911B1DD076DE8224C5AC3CA832497D94CA5443BBA39702210093A629FB409800A72B4BDB4F930DE0D2F81B0870A39227FAACAC698878D632FF
Proof of work
010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381
Proof of integrity
00370DBD205A9C8BB9A9A921EB4A500D1FBE46DBCD454FB7B1D64C35D3BE4A595D
Coordinator signature
4C17A0B339520A314553BC3E5992CA16352149BBBF285289CD04993C71F1022D999465951134F44D893A2CE284CAECB1EC3970118123E4CCE1392BB1E197A20F
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
6ADF505D637F8BBD269C25334EABDA7CBF4038609370B77229AB4B2445E13E2B49AE80653671F8AA13A7C974F260499F641CC4CEB5638B449EB93B5DB795FD08
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
5AD17942BA2665DA3520532BEC5850DBFF1892BFC9671651439D0285C403E6C26B6DEDF5656C64EE9C20462B0545A8EE382015A7D9069200081E167421CDD80B