Type
CONTRACT
Validation date
2023-12-12 20:13:50 UTC
Fee
0.22546422 UCO

Code (834 B)

@version 1

condition triggered_by: transaction, on: set_secret_hash(_secret_hash, _secret_hash_signature, _end_time), 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
)
]

actions triggered_by: transaction, on: set_secret_hash(secret_hash, secret_hash_signature, end_time) do
  next_code = """
  @version 1
  # Automate the refunding after the given timestamp
  actions triggered_by: datetime, at: #{end_time} do
    Contract.set_type "transfer"
  # Send back the token to the user address
  Contract.add_uco_transfer to: 0x0000A60676622E63BA85AD07A5216C78BF3A95BD8BCEB5617642C3C0133A4611A745, amount: 46.24720938
  Contract.set_code ""

  end

  condition triggered_by: transaction, on: refund(), as: [
    timestamp: timestamp >= #{end_time}
  ]

  actions triggered_by: transaction, on: refund() do
    Contract.set_type "transfer"
  # Send back the token to the user address
  Contract.add_uco_transfer to: 0x0000A60676622E63BA85AD07A5216C78BF3A95BD8BCEB5617642C3C0133A4611A745, amount: 46.24720938
  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 < #{end_time},
    content: Crypto.hash(String.to_hex(secret)) == 0x#{secret_hash}
  ]

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

    Contract.set_code next_code
  end

  export fun get_htlc_data() do
    [
      amount: 46.10846776,
      end_time: #{end_time},
      secret_hash: 0x#{secret_hash},
      secret_hash_signature: [
        r: 0x#{secret_hash_signature.r},
        s: 0x#{secret_hash_signature.s},
        v: #{secret_hash_signature.v}
      ]
    ]
  end

  """

  Contract.set_code next_code
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    ACAF30968DDF0D9ECA8D909097E3E0566CB2B9276014D829670E481A9A6802947F32146A8AE045EB87B4C35413E87C588F4120BD3899563A8F760681

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001426230D93613119BF95E064661117D1BAC217335DDE7F2EBDB2160DFA201106C

Previous signature

FEBC3F62D01243180F34799021FDCC96D0790E65CC56B17B08A3C124E19FC5D7C0508C084C8EDAAF06DC4C268B7F8B9743E0CB809239BB00143F301C24A8CC0A

Origin signature

304402200189778A802F7453177999CF80993AE993121DABF711AE4A15335104686568C802200B8F91A255D95B06933CE64D0805D6588154BFB117787FA86FF87E38DB5E2BB4

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00E487DDCFFC385B39A6D30516E0DD4F6DFADB2E8ED78EAA4CF8B2BB1CE679F899

Coordinator signature

719EC44AE2F3A7B9E496CDB2E00C146F83400D1421F5DB47D34101671521393F88FB23EAD2494878023198777479097FB6721FA7E449EBF35FB193805DA96A01

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

B6830A9A4EF0DC9482E2FE327B5347C28619B7E21C1262B9E62989D248792F1D852B1B38D239386C46C7EBC742C1C012FA574DAAA0513ACB3C0E88BE03AD7905

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

651D71CDBFA44FADC41DB69B8EB17E76538F5276514C2C93C8D3DB68CBDE9230572227D736C563B09ED5B0596574C48D2955F6E277F3CA352BC4BF043263650F