@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700001120 do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.1, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1700001120
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.1, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
),
timestamp: transaction.timestamp < 1700001120,
content: Crypto.hash(String.to_hex(secret)) == 0x267DD1F751E36AE7FD652A73F0DA4FDBFD26913E87E43246FBA04BCF0A82521C
]
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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0997, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0003, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code next_code
end
export fun get_htlc_data() do
[
amount: 0.0997,
end_time: 1700001120,
secret_hash: 0x267DD1F751E36AE7FD652A73F0DA4FDBFD26913E87E43246FBA04BCF0A82521C,
secret_hash_signature: [
r: 0x6D6849F1BDA4E26F0535D4636DD26DDB982922BFEA35166D137CB6359E4ED50D,
s: 0x7D94439A6163D729CEF4A552C09CFB45D4A307E38B0A1802C72EC32F77D18685,
v: 28
]
]
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
050E29A47458C750D1373D0793165ABA838C3B7B1F2275F7F876047891F8F6ADBC103AA315BAB20733037CEF4F40B09954D338B23D37267E250ADFCF
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 0000BB65...1CE7At 2023-11-14 20:32:39 UTCAmount 0.35517614 UCO
-
From 0000C2BA...3DE6At 2023-11-14 20:32:28 UTCAmount 0.1 0000288B...B827
Previous public key
000118026AA4D23615F031FBBDC19F6E743F477D8245E339D3BF79B6336F9C9A27C9
Previous signature
59A86B7BE6136460B3629717554665F9161FECD10765DB7C78E0607AAFF2D497E4688959013301BA072E15CE8835F8902B078CD0F97967F1B969300847B44D0D
Origin signature
3044022008E2A518294DDC8ED3DF97347CC55D2074B3132D1B7585DB40A0AC8A68DBF1790220105F97C0230A822EF51D402DE304A335D6BB1C949243808FA8F789DE3CD5E3AE
Proof of work
010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61
Proof of integrity
00FA6305E588526AB923DAA1B25B458D52B9ADCDA0A1507A745DB6D3BEC5F71049
Coordinator signature
D5417E83C5A4070239C57F634A681579753E84A16B3AB80D88A55220A601521DC9AD8AB0EBE3E963BA8808BA3CAC912B691648978079D9A05F8BC61FF9D8D50D
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
B0BB1DC2E147262294417CF0EBACD44EF5D15DCF9F498F8FAF7776DDD8EBC02B37ABD320F4748AFBD64279689F98A5C587827AB3D61E187DAC469DF4B890CA0B
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
6887B5DF99A548D14AB8B142F31EC01E7BAA763F085ED39D9C181CCF2AB5E71082BBECCBDDE416DB82C1384CDED7CF1D4C67B563DCEDE39155D66E91B38ED80C