Type
CONTRACT
Validation date
2023-12-09 15:37:16 UTC
Fee
0 UCO

Code (932 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1702143360,
    secret_hash: 0x51A9564B16EF1E63CE28D0B90FD2F2F86212C51F6CA01F15EB9BF7F7A40CF222,
    secret_hash_signature: [
      r: 0x4CC97A8FDB07C5F76F31BEC3D03A83CB409E0ECFFA06912C5F3FC0DB8DAFE2AE,
      s: 0x63367F9264899E47E3EE57FEEC06B80161ECECB03E8502F48C704505EAF2BFBB,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B0897F31EF69804D15BCEEE737E1DDA52B15E8B9376D39FAAC7F3BA749A9D66E36DB04D0AA7E898C20B2001F7F79F1D87E92909C033F657A6EB9A1FB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00016CD7A74A488A3FE2F24E35AEB7D18E32ED484D2DD1599A5FB80909EEBDD0B9CB

Previous signature

41A53FBD32811237DE01CBABB57E9F796FAE2555522FCE53606B138BC44C4E594DFA453A1265C670FE6D46386CEFBA43B725434157CF481B7154C7ACECACEF02

Origin signature

3046022100C8E1FFC54D787EEB0076C79B6D76E0B17095E3C91C91F4F0A894747C2E5B0BEA022100D427168AB12EF90CF1982E06F946CB4FB8A771280408081999E9BC68071C4225

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

0044BC5A3DBC55F91F058F577BEC9F116C5F304B026DCA04C3700F56F718DCEB8B

Coordinator signature

4557241EBD4B9C4F51C2552A4348BE5FA0CB0E46C31C4D87FBB501BDD7B54ACD5EB5E8DC9E34E8E7163A4EB9405D1EA6A98CEA2D85DE9FB6BACB0AC4DCFEA508

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

54A50EB92981A18B291F2C82FA502D6C29928CF37C2A6E1AAB714023E29493ED29577B79F33410A1F0B582C27FBF6EB1808039E4891657DAAA9EAB188B102603

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

F58491529C9E8607E51CFDE2C37BFBBA55A6F21A4C70480B6CF19C7075B344FEE07182E3A4CA44328EFF878781A234BDE858E6E368FFFD687AA7095AA1A33D08