Type
CONTRACT
Validation date
2023-12-11 05:39:50 UTC
Fee
0 UCO

Code (866 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702280340 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000593662D660F187B0A82D27FD227F38D3D3DF261008D2EB423B1806A7A85DC856, amount: 4
Contract.set_code ""

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000593662D660F187B0A82D27FD227F38D3D3DF261008D2EB423B1806A7A85DC856, amount: 4
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) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
),
  timestamp: transaction.timestamp < 1702280340,
  content: Crypto.hash(String.to_hex(secret)) == 0xCC8BD431F05AD336339F72DC77E15CD3695F70D0F04324FADFFCD35006D23464
]

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_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 3.988
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.012

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 3.988,
    end_time: 1702280340,
    secret_hash: 0xCC8BD431F05AD336339F72DC77E15CD3695F70D0F04324FADFFCD35006D23464,
    secret_hash_signature: [
      r: 0xC0A67BA27D89095D7C8A29D88E773976F7D222506A380272D49ECDB3B6DDA83B,
      s: 0x016559E2A3336A4A1512EC348FE17646C58ADB7DBF11EBBA569A9CFDAD4FBBEC,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    FD16720D30725289BDE1E12DA33C41A916A5D8866E698F8F77991A7FC7920EBED9C6D1EA9E20036620E9F6E4858D2E90AD180DB82D71FB63B5EA6C2E

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000118D6ABE98D00FA8E9DF618646609EF878C2544CF56DBC01C189CE1B03671F341

Previous signature

F4062EDD5370C5F9F2772B82185E99F8765C9C8E90C4E372963710A90638BDF9E227BCA9210540E9F09CE0560B34BC03846339547DB3DD58B33117DF83B49A05

Origin signature

3044022025E5137F8286C020F9B2909D0ABA11BAA4F3040CDA07B664D66AD0EF727E54B602202D7B5DDFA6FAA9A514D2B5B8A6A41DF31D4382EC265006013C4522BFC5219560

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

0045C420D3877CDA4389E9758D2CFAB1AA0EA5CB0A56FEC28D835B1053177C6651

Coordinator signature

D88090A4C4BD3593A6554E8B7E0C7BCEFF096290AF92D8C08D29D2FC4F7BA1E0DA9BA432233FA686AA40F5877294D1C76BEC102EA9BC79871D99327775FD5F0A

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

35A3159EC84D9C740D2D06D02433F0D05D03A3B94844B164AD0470378DC8DA98617FE2C27217A462A9EA8930479F12BE9647EEC86C234AB89D1CD40CDC3E0902

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

0D7656F4F033748274464B4BA68FFD5585D38A1B2A79CDFB3C2F93FCBAD80251DBD19F0849FB947342B93D683A6A1490A9043A54E325EA934AC5161DF2A9410A