Type
CONTRACT
Validation date
2023-12-11 16:37:15 UTC
Fee
0.22385748 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: 198.04201153
  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: 198.04201153
  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: 197.4478855
    Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.59412603

    Contract.set_code next_code
  end

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

    AE788B2FD2D7F41FAF25ED516AF6B3CE22BB00EBFD77DF4E9E8388E0ED877A2F804E94EE5586015CB563E490773D4EBEE2EE9F9D0CDF1189259A2F65

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00013D76EA0CA9FBC899A44F668FA5604E5913C332DA834B77D9B17F632D91AB5A31

Previous signature

D0C5B2F3D91FF8A856331860E114A114E0CFD8DD439EF574EDBA7EBB62C98FBE94C9F4731DBABC707DE5D8066C6F91705DCFB6613FAE9FE19985107C52AF0507

Origin signature

3044022059473A38C97A825173AA9DA2C7EBE7513AA36B42D0D13A3B4E629DFE5BC6AD9F02204929460BB78925506F32D4BDD74B9D55D0DADBEF84D2852F4B242E7627E55138

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

004E3C841CBFC06695743227C54E1AC9300325B3B8E7F4B1438FE6301057AD78BA

Coordinator signature

B8B6D86DBDFA6802C313A0B81745C46749DB3B3A71D3884B8EB6A3671CBF4D9F7405012433D08BA83BBBE3E382542B7385446806ABA043894CB5E290DE294906

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

3B6BCA77D53E71F94B0F33A3F60A4025097176C04305EAE0DAE66623E2AEFB6A544D66674A3A9BC566275C25C0F62950A44FF0940BE86C4F7D782D2A7904F40E

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

955903EEF9A28CE2B84BF6FB271299895B6511CC7B7027B0F8D798D3DD634E28033D35304E0529906D5863B0A1F39FA9C39C54AE8F65C8BEFF87F12D99151708