Type
CONTRACT
Validation date
2023-10-21 13:07:00 UTC
Fee
0.26477955 UCO

Code (886 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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
)
]

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_token_transfer to: 0x00007D1163F2AEA7B80362450AB96D837F5A698980E2FCC0ABE1CDB01D9B7F0D2273, amount: 0.01, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  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_token_transfer to: 0x00007D1163F2AEA7B80362450AB96D837F5A698980E2FCC0ABE1CDB01D9B7F0D2273, amount: 0.01, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
  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) == 0x0000072E418B60C6DABD272BC2728B17B352B8104F068D11365D50134F96A4199609
  ),
    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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.00997, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
    Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

    Contract.set_code next_code
  end

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

    52EC1FAF23AFE59399F2382214F91D74FD40185FE0E4F29E1C646DB3E801B23D9CDE8F681F50E40FC1E63A84CD9C6D90AA34B9296C7FE955DB471ADC

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001F24D99124663412732EE7E3745527638E064C3D8DF6BCC0B8F7B7D9D64F5B229

Previous signature

2862DE66CF8B253DBDA17D87AF886883F338F9E9541C29F98E19E2E29268A75E69C79930C98EA9F4A298A5017127563C71C1EC0288BEE1761371F3319254A803

Origin signature

3045022100EF5B84652DF8DE8C7E838C9703F48724C4FF229DD1603A3275A2EE90422D8FF5022019D8C5D68FBDAB54605C83243FAF65581C8E73CF40261DB1481F64F147D8A967

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

00A45E4DE6C8C97BD24674431B8DF654B611FB24CE56C452DF1CAC7638F9352F08

Coordinator signature

15DF9FA1CA1E791E5A213A5353CE5554D6C34E48828F1D83B60FD4975CA15F958C531890386C529ACC428649A4B468B55A08141F647448905F3AAAACBD326403

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

34ABD8D83CD7FE2538AEFD4BDB4ADAC8C42E9CE63CD57FE8421A2C57B9404EAB397C2F1FEB175FB826BA0F1535CB91869D1DB668549C017E2CE2238D1DCB2C08

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

7394D9D1F16995EEEDF997C96705BBB0CD23BE5FFB264DBBC4108E8D9C0CEA32A5652BA0E1F7CE0CF41C7FFCC9F08D57EF15BE2AB5BBE79E0C6A129B1B8F220D