Type
CONTRACT
Validation date
2023-11-15 00:21:58 UTC
Fee
0 UCO

Code (924 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700014860 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00008D5D4054C44E2D545884BD557D7E1CEA9B3669EB223C11CDADD6D99A1334F9F8, amount: 0.1, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""

end

condition triggered_by: transaction, on: refund(), as: [
  timestamp: timestamp >= 1700014860
]

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00008D5D4054C44E2D545884BD557D7E1CEA9B3669EB223C11CDADD6D99A1334F9F8, 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 < 1700014860,
  content: Crypto.hash(String.to_hex(secret)) == 0x27163D2B49018CF48F25132E00EAAB3EE72B8D01DD4F1D8817C71F035BFE8D5A
]

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: 1700014860,
    secret_hash: 0x27163D2B49018CF48F25132E00EAAB3EE72B8D01DD4F1D8817C71F035BFE8D5A,
    secret_hash_signature: [
      r: 0x595DAEA97AA21E85EF39C904D49DBA84DD2A2926A3592A58D0E56861DB869DCB,
      s: 0x7E6C2D7F340CA94FF26E595DCD346A0F5798253774F3866BB4C18239C7F0DC02,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    5B1480E864F04875CE1988DA99FB8372D73F4AAEAF3989FCBAF6E1B64B6AAB8DBAE9A92684F323F923B80062660FDE1888B7203BB59DD40B81B9C458

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00013DBFE49367DCF1EA8511B717FD4954CA61588082B3BF3375A85CD80888F5D636

Previous signature

173F5B3E42C0F8136FFEC480DB8AFDDCA55082AF3E5186CD03C0469A45DACBCBEADBB572E439FB1FF5214A59221D32D358F4C5D2D239E5925388BA4C6540F10D

Origin signature

3046022100C2FE58145AD4B46A5C02E2E3ED99D6BDA2EC5A477A7F63CBE3AB213F365EC9D1022100B6B54D9C853605150775D4D4510CD0DD429C9BD8394C1ED78B5CA574756F0914

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00D311E7F7370E83F89111E53490DF1174CA6E18A7182C49F5BD37B716FC333FF1

Coordinator signature

CC0DB7D5F3468976136277C3CDA19C141C0886D2C26BCB486A118D9B7E7E31A8D3A8153F3D4ACCED58FD09C9207BC919303A78E28BCBCA41AC029E4A8B638601

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

F65678F4F51FE9EBE00B0AFD8DC4C33594D225A8D1AD1CF9351EAFEF9CC5BF5EDF95893E5F5AA77BC1ACA23D2F3813E8B75217777BAF7FEE969EE042D506960B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

A3F7E449CA1F060BC99144F7B555BB482D8712AA2104230CB9C021A850FB45C2BD8F168D68D089B075F8E7653B4126F18105745765E72BA83F3D617243338A03