Type
CONTRACT
Validation date
2023-11-17 10:53:33 UTC
Fee
0 UCO

Code (927 B)

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

end

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

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.01, 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 < 1700225580,
  content: Crypto.hash(String.to_hex(secret)) == 0xBCFA5B3ED36A857A6E3EC9335DC760DC5F00EC91B62EFA51167DE304824DC26B
]

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.00997, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.00997,
    end_time: 1700225580,
    secret_hash: 0xBCFA5B3ED36A857A6E3EC9335DC760DC5F00EC91B62EFA51167DE304824DC26B,
    secret_hash_signature: [
      r: 0x636AF69422B8DE2DD586CC2E971CD107FDCDB8B191C7D18323E17C864AC1E232,
      s: 0x430B935CEE9B23612BFE528F2314267B83B4054156E154C6A959BE39810B3755,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    501D93F6AD7A1DD3349445A41FEBF2A9900C14A6E7E654039F13580E1AA92CB48F9C1160C6011AE0BDA85A606EDB6246697306194D09FC7431FFFD2F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00017AC84B6B4F1D00598EC6A633DC15B548CAA19CBFA652D07E96B9A0CD6784E309

Previous signature

288972C81A732246A55BE9D3B9A0A2FF2EBF68577838139906D502A8D823B1278B79DBFB0F1DFF1C00E40D2DEDDF49D09ECD996C0A4A6F511F0616F922204500

Origin signature

3045022100CAD9EB57039B9D3183189BDCF1D87327FC0CDBEA9F98FBC14BDA0AC387351D2202203B83DE2A6FA22BDFA23DB8E5AA4F07606BD4569EA1600673800B1A4A09F843C7

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00E3D026EDCAD8F6CE0694E9124CB35E8A363B802C77F478F9AB12FB82B2EB180A

Coordinator signature

8B0FA1B8F8426F7BBC35C7CF6A677CC5D29EF38EF06C3E5A0C83113D5B42A3BF641383F8E710320B66B14668ECE03A7966B41809A2D4D5C57A466BA0FDB7C503

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

3AFF4DE0FD791416827BC42E8776B1393007BFEFC5383F0AA08D0976E08E135A9F4AA7C734FC51E61DF1CC9F51E82B573B659EAD32E25616FB90ABDB84AE6601

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

6A2031F18553BFAC436B8EF8A3869F06E73F5F6986B99B6715EA8F33F58FE02837E3E778DFDB185D25B435E828534FAC4114C3D25D618FCF039E8A634155D802