Type
CONTRACT
Validation date
2023-12-06 10:25:29 UTC
Fee
0 UCO

Code (932 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.02967117,
    end_time: 1701865500,
    secret_hash: 0xED11E5CA9F890124D55794B58E7170FD21429149320680F088F35969463D2DD5,
    secret_hash_signature: [
      r: 0x034817E725A5AC84DAE542AE1DE8C30A95B155B62A17B0C07970A3EB3861C79E,
      s: 0x3072290BB5077CAF24FC1B14DA3A3EB8D01F77655E51F0F2C90C28DADF82F368,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    02BA0DB357786F4DA0F09BC33F8736D2ED4202C6A789D1180ECA1BE393689496223A143D4E00C66A53B5B278315E6943D8D5B19022D486DCA4644825

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00018357E0394CA27A48C7D40553A5DE5B8C1BEC17FE4B22BDB7B34B3629005DB653

Previous signature

751A2BE801E1CC920C3E8EF40C3B2BBC99D3CEBB6E90448679A2F7ABA5E88C79CEFAEC19B7CFBACDB94032DDE60B54504FF354F4E74C176859D118B6E6BB2503

Origin signature

3045022026B76E9BB27B6AAF38777373C94C3F71AE770B858F95F73DC9184D1C05426F71022100C736E8DE5B1CB5125089C52A90AB181EEFEAB2B57146851CA1E7CAD5A09548DA

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

007818A752A3CF4ABB6EB224ACDD7D30679A291C1AA99A2273F36B5E29D578FB24

Coordinator signature

9DA74DAB5C6AAA881F4166EF0E8C85C921EC5D4ED964843602FDB9BFB53349B62A8F0A594B4EDD1E447595097E1DADFB5A164323FA6CE0CD8E2BE75F80BD4E02

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

FC19AABB56BEDF308387F48E8F075247301E587C5DBCBB16C89722CFC7A0FADEE84FE049DFB7AA561A888C06FB26ACEF4E20D8195DD1813FED93E03921702207

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

A47FF0AE397A695594AE58BF464B1F27EBA7F7A40DA8523006F9533A1F5C78B371B9FFFF144073C7FC5F48B4F16250DEB7D2D0F9D3A02A69CA4896BD86827E05