Type
CONTRACT
Validation date
2023-12-11 16:48:08 UTC
Fee
0.22419262 UCO

Code (835 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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 98.49782799
  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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 98.49782799
  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: 98.20233451
    Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.29549348

    Contract.set_code next_code
  end

  export fun get_htlc_data() do
    [
      amount: 98.20233451,
      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

    8B1250E73378BABADBBF13A95AA3AE123B76BDCB5E27842DC770320BCD5A592936AC42FD35E601C2501D9F3A08D05E6FAE06D88FC92ADC99CCD984E0

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001C7B22BB0380D70134FDEFBB7261C5CAA675420AE239C1F74E43368E17ED68139

Previous signature

A37EFD4610EE65A03EFD5B73BB4F8F26B8A0847EB16EF4C3B478B805CFDC693C4E15A8CC0ACD80A2FC4521E8C2D47B3451FEA979A7D3851E27675F84EF3C3C06

Origin signature

3045022100B914A6A17CAE81E696ED5234336AF06ABF79A3D0408DF397434379ED1DF025D302207C2D282CBDCED67C03BD78C429BD542E72BC6FEF75E380CD905ADFF0999CD345

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00A4FB3091BB7927554B4DEA025F785836677A499C5E4EB9A55A3D901F8B89CCEE

Coordinator signature

2B883272825FE6C3D322504FD002CD5F6D1FF4C1C106B6538E41541B0F0F0874B6FD997DBA1A811496F4C53B4F1B1C4F7CCF2BE16099E1C6DEE79569ED941B06

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

BA572F81A31FBA031FC04F83501A02AFF9E6D27C6979F195F1428E0848EA130CAA0F568B220240A4DEF0E9CFCAF85DCEB3AA1AFAD0F25C5791A3A4A7B444BD0D

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

AC573B571A82FBED5B9A11887C9FF2A331C09B7C1E3A8AB1B3616DE11CEB33D9ECFF7B8CCF4A015D15CFA8C6C18585DB40CA1DE41D25D9570BC22863F5751E01