Type
CONTRACT
Validation date
2023-12-14 10:59:24 UTC
Fee
0 UCO

Code (935 B)

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

end

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

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: 1.04081725, 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 < 1702558740,
  content: Crypto.hash(String.to_hex(secret)) == 0xA2C5FF45F8CB778B1989EDDC1412DB9CDA4F4622749EF132D06B9140F658179C
]

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 1.0376948,
    end_time: 1702558740,
    secret_hash: 0xA2C5FF45F8CB778B1989EDDC1412DB9CDA4F4622749EF132D06B9140F658179C,
    secret_hash_signature: [
      r: 0xE7180453F61C750C9CEDF573D0CA8E73A79327F2C267B22243D506B615EEFB19,
      s: 0x14FE0301B4A2EE755833322323029803CFE68D5EC2CF5ECDBA48B09BF4F0ECFB,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    651FA529E3CBA42DAA5B2BC1257E9C998ACADE169FE07C4924B1AE83AFFEC94740E17F49F1C94478B59A570BA6D6EAF44D3DB94AA3CBC320D4B48DA2

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001171B994CA0C77CC4068E42D455F341F37361BD2E8258E07E4EA291E37FBB6310

Previous signature

D890C11C3A0A0008BAB93C2D756E5EF0FBF9974C0D782CBA7E150DC9DA2D786F3149C14BC87BD3CFA4E348D8F5B6819AF6121207F7C58B4643F3CDE7931C0008

Origin signature

304602210080222BF6A254257B614928061EDAA1AC757D7EE93DE3198269022434E23FD18D022100DC5ED79ACF8179A53793C4699DDC2E584D4909AD26DEE0A54EBAE063910367D3

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00D22FD26A9071706324AF0FF610FA95683AC31A9B38D88DE53AE337D025869F04

Coordinator signature

664E943CB9F8FA7D6621CCE61B8AE5AD065A241BFD078B664AEBD793B3D96C597995AA8FEC4E0E658717C0322234A98B83BD597ED06A23719F8EF33D8C82E900

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

8634943067DBC21597D09F7EFD31FF6EDED58AE285F2197772E07A2064E457EBA8C6E8C4BFB0F6A0338926B0701159911E6A311D4151705938F47911A5DD6E00

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

436FF191130BAA99FB0C62F01FE52841F7CDE5138648EC70BD55D01CCA97BFCEA69F89D492781A1CB7F0E6CA1387D27D1B2395B447002E6D0A3A102440B49D00