Type
CONTRACT
Validation date
2023-11-14 10:50:52 UTC
Fee
0 UCO

Code (931 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000D9E7B4300CC29670CA80010FE23292BEE4AE28057328732A0FF4CF11C319D81A, amount: 0.492015, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
),
  timestamp: transaction.timestamp < 1699966200,
  content: Crypto.hash(String.to_hex(secret)) == 0xBCBCB656A0458B67B9D36094AFAB3BCC07A05813E3CC02E695E525B763D089C4
]

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.49053896, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.00147604, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.49053896,
    end_time: 1699966200,
    secret_hash: 0xBCBCB656A0458B67B9D36094AFAB3BCC07A05813E3CC02E695E525B763D089C4,
    secret_hash_signature: [
      r: 0x2EBAF0F53CAE8A29B61D047FFDCEEFA2987A3B8509A7A4217C49F9EF3FC174F2,
      s: 0x76D391AA0CB66F3B9F24A5851F076D52C42138339A809F5824C82EF7A0555B28,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    19967B56BAAFC69D11AE319377022E2351AD4AC6968D1098F07C3DB6EC77914F94FB97E1C5E3FEE34E8AF343C829C5EFFB1E572C10FE08CAD1A84648

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001A694986AC90123871114E927D07DA6C9107C69BD3B8218A205C4A9B092838899

Previous signature

EF35A739E783F6A29C874E28AB89F5FBDF0A3969A76B999D5E3836B4A49A08363B8DFF8AD32E2F678DA778F4CC105D2E35E53971ED05EC84C56490061ECE620B

Origin signature

304502206311E3A8FAB635D4447FDFF918F91F83E211479823605F0097F993EEAD74BC8D022100820B097F15915E067E078D5FA84C3310E2920624298FBEFB4715DB918126F451

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00915F1D3301AC983D169D74808436E9F9EDD46CF97F3F17EE80F7478937AEBE97

Coordinator signature

F5D1A8629EF0516045A87EBFC91A04B759CA09D53EA103C596195AB2816C53427B7B0B8D88AFB77318D53C0F996E54D3933ED07DBD4649A6BEF827C927F38808

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

64B912ECE0E3544D037F8C37BF1C9057BAFA273C918FD3A036DFE76376FD5E05BD2274B3C1F1BD641C0FE1393FCADDB1B7CEB0BCE6BD971D950D21C2DE785C0B

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

2B5C6F7678B16564B73DCE46DE2D81B71398A2E04970DDFE39C6135D67351856B2E1E7505021CE0131404CD690363B0A12C7CF0BD413E1335D46E870FFF9ED09