Type
CONTRACT
Validation date
2024-01-25 16:33:41 UTC
Fee
0 UCO

Code (929 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000562D8F6FBFDA64DF561549EF53BBF667F87F43793CDB6F0A22C311316138925B, amount: 0.101, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
),
  timestamp: transaction.timestamp < 1706207580,
  content: Crypto.hash(String.to_hex(secret)) == 0x44A2D2A5471F88AF52E587996FA94E377898E5187DA910029E22A4B9E8004274
]

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.100697, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.03e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.100697,
    end_time: 1706207580,
    secret_hash: 0x44A2D2A5471F88AF52E587996FA94E377898E5187DA910029E22A4B9E8004274,
    secret_hash_signature: [
      r: 0x45F710B8775E5A50E32D3DCA2715CAD2CA7CDC30089EB0EA90A3C5777BDB10BA,
      s: 0x12BFAFCB97AE390CA27A641F60594B35BB4E15715134B39B6C44F87265922A5A,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    51F85CD3689A492E94DA63A23C74530106A15999C73B5C3C1399FEB0A57A82AA3479FD6C7C6A9E993358A1FBDD86274BC9D4F4616751224D57448E23

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000138744AB225BF895F6602FE44AE7DA9C8E023AAE328F03AD3382CFDE6ADA87CDA

Previous signature

ADBB92C2DE88B8C25B332A5B6DB672619EE855D1319787CD44AC83BA1A65B2DDE9D43ED6AC49AEFF726847B8C2C50FD615E2EF0B4C0BB021B6DE37C30F7C3604

Origin signature

3046022100D453F9F80AD5091E26CBFABC392677126284E0E6C0796E1190CF5EDEF7FDB716022100B612D377FED4A51EE72DCCD32FBB26295233428F74BF3349A38619783FC3398A

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00C57D2501448B044F69901869DC7620B890E2BB37D5FC3EF4093A3B24C09FE288

Coordinator signature

2B7038691409C3E637F53C409444E0457D77DD52230ECD7E70874523A734035A54F0A58F173B3891BFE0F8B620EEF0FE7EE7B235CF9926D2AFC5C76F12266E00

Validator #1 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #1 signature

CA803C8FEE7DCB85BE8E7FDCBD225AD80F96B28A66B720C04AD2966BB73D8361691DBE45963759C1A976ADBE5A5D6B1CDD3389852E8FBAC85F95692B749D8E04

Validator #2 public key

000134772A943DC0F7038B1BABA39E18841C12DD6682B1B6D1D15E08D7CAF5339AB0

Validator #2 signature

C083C17AE5E57752D57339B847B66772E90FD938F7E874BB2F5D4A9A62A5AF149A66B8E65E8D3F42447E2474B19C6B9B209AAF204A5913C1B2AD6EC8CBAD800C