Type
CONTRACT
Validation date
2023-12-06 10:43:19 UTC
Fee
0 UCO

Code (933 B)

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

end

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

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

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.01483559, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 4.464e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.01483559,
    end_time: 1701866580,
    secret_hash: 0x8A08A5E1BE1EA589150C4078CBF945841DC8D633BC90F5BA787A7759F81A288B,
    secret_hash_signature: [
      r: 0x396FA4E03F888DB97236906033DE2CCA7B1E615EB972771C19FFA709CF07DB7B,
      s: 0x415CAE5BCC884C443B80F5E95B09609D0C232E883EC60D2B88D997F082B7E1BD,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    ED73B213BC25564E9ED9CFC69D6F28E2A3C6CCE5DBC16DCA2D47BB2EDDC13FA2FF38AE0E05909478F5E32DCFB9BC9776B1B15C2750770D6F6AC1ECDC

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00012766537B77B831E54B0492B7F9EEB17D091592F4F559FA344A326C974053A2D0

Previous signature

3200F7F9A14F58726FE78D2491EAD384AB208BBD7C89A5D893F369166D826ABAE92F53BC849E69EEBB734D9FD41D2C213B8E9A66B5263CC37D2F992D04946505

Origin signature

304402207F6307E1A23D443A2614F79F89F626959282BBB9B1BF14CC227BBE216C3052F80220098EBC0ED0CC5B79746B649059452B7E8B64AFD57C61C1C3430650D87FC19806

Proof of work

01010484B78F4110D8E9D6FBEC72759895CC9D4532177314FBAA8B07BC525FC1AF48F150EFBF104B1819106B8E3563CD0E1FAAE5325F8FCFE58FF744C35F47669D2704

Proof of integrity

009F0B10E46DE86D1F62E0DCBCFF54D9C46922CEDC2649A1F77E750D7ADC8272A8

Coordinator signature

95B73F7E496E8F99BF594675EFF840B923F7D5825AF4C8B21E98B8B4F7CC8C9A3F8888AE51C473C9FC32E44FD053152FAD9998EA461C696CF43C552147AB900B

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

4165045BB6F6ED92EBAFB2DCCADC468D138B09478150CA65E441E033621501E6BF548A80F7336EB339A6077C76151BF1D205A000A4EECE226D9B73216BB22004

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

D490CA6B41ADDEEB7801271EEC5B56B6F716F444ACDCBE1CE17B2A62CF076A449748754CD9951021EB59531DCE76271D3C367ECF9EF252B5FCF12330FE8A3D06