Type
CONTRACT
Validation date
2023-12-13 18:23:34 UTC
Fee
0.21979668 UCO

Code (831 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: 0x000024EFC168359BBE0ABF897270CBFABBFF5784622EA02A463BA2EAF7C5219EAFD7, amount: 7.47938109
  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: 0x000024EFC168359BBE0ABF897270CBFABBFF5784622EA02A463BA2EAF7C5219EAFD7, amount: 7.47938109
  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: 7.45694295
    Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.02243814

    Contract.set_code next_code
  end

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

    228DFA86AB0AC48130A31D74AE8AF90E32D46E58C2EEEDAB326E436BAF5273AF157CE57AC1EDA6125E574E8BCEFFB80D090EC47068B7057DAF136128

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001429D71AA414E448EB22B3B0F52F3010C0DFC8C7F82C7FDD0980C9CA00C338AA1

Previous signature

D41CDA5D2185EF98026936A53CE183E5167463BAEE34550CCCAC29E7AD9391B2A091A9C47F02CE23F3BD0CFACD14BBC64040AD28066A5DDE25B950674C6DD50E

Origin signature

3045022100A0B2837DE34DFF11974C3495C5C74C8A1408787CBF869C1C62ED95CB78C1C70102205BEBFD8DC76F810E893DB29497E533D9FB11AE14C0344B68CD2D30C7BD33AD90

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00969C0AC1EF73DA53EA52ED32F2D662DFAC34AB74FE944A440E690D9F26111A0E

Coordinator signature

ECF5F41A102DB201D1C024C615390B212A7D7693381F1EC9702325539F2F4710C6C7C694B14758D746350FE4AA0203F4E1A2E48EBBE785BDCA6E2FEA190AF008

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

2CC40EA7325B291C5DB26E5D671BBCA96BAE88F1257201AC54F55D0FD2CEE4436CD600C00B0FCD7ABDC0593CBC5EF1A97179BE0EE0934FECDF97E4F24C7B4906

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

F19FBBFB2E1EB3DE7D417FC47452202E55AEF9E1696B521201F25A2AF6E364EAB2F8C736B98E30CA24ADE57BF933D064169B3758B0C63A17153009B0142C530E