Type
CONTRACT
Validation date
2023-12-09 07:27:59 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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: 7.7766
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0234

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 7.7766,
    end_time: 1702114020,
    secret_hash: 0x6AECD038B2CADCD44D42B60CF505AF1B2CD7E968B72BB7F109C6F5E72370AE85,
    secret_hash_signature: [
      r: 0xBC196F4E0316FFD83580059247902216836E7051C32FDB33A9C565C4EDE12348,
      s: 0x2E400443F5687C32F4C332171B099162BACBA353E09F5A44729F6B04C2EB5AB0,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C645740BD9E20DCC767BCDB329916E1ED2A0745CEBE6AC6345A21F9F92D9CB49977D40A0834CCEF48A46F4F32D349FB8133A86B5CAEDD610D78378AE

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000142FE3FC536BABE910DFF0DD1A11F073FCDE61A03F098D17FDEB34843B981D3D2

Previous signature

1B6AC838CD4506F6A0A1C11E4324B38E5C347C66F955D6A5FB1D97AB3F5793E550DE9B14DD39609023437BADEA947C38BEA305DAFEE4ECD4B0097ABFD92C4007

Origin signature

3046022100B8BEFBB9E45D700FEF56AF5777F058F960201F3D40FBBC80E221891051203E6C022100E33B99AEA66E5B15B2FC7CBC24FF558B3D62AF3B23EC68C236442C67DA67D493

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00A01987FE0D64E0495E6561C4CA36BB89B2E652AD6B6EB895011D65BD829BB1D0

Coordinator signature

79A69DC0B26546A37ADCCCD4B7CA2B7E12FF389884B6D1AE0EA46290F0328E21230A4574E7B316C94D4D3E63E72881267E500A88BACD58176BFDF56CC6B2380A

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

4E137C91A0B144A59873AFE48565D7A4EF9BC75449F77896C8122D3376AA61B2917546214942D11106900A628CABFF6E6E46E2D0B132E1993560D911CEBC0D08

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

6E4F119D46CA8C4DCA1F1A63D13ACD5B46CBFC7F91D59C5D520F8AB8D826B87937F267CD7B6C4B1538F0FBC1D80EF9E2F01AB57E11FAC678F05F0B29B73F7E09