Type
CONTRACT
Validation date
2023-12-09 15:19:53 UTC
Fee
0 UCO

Code (866 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1702142340 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00007011C3312E6DD64C930A68B7B5F99AA6FC8FAC555DC1421BADB3091E3786B826, amount: 10
Contract.set_code ""

end

condition triggered_by: transaction, on: refund(), as: [
  timestamp: timestamp >= 1702142340
]

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x00007011C3312E6DD64C930A68B7B5F99AA6FC8FAC555DC1421BADB3091E3786B826, amount: 10
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 < 1702142340,
  content: Crypto.hash(String.to_hex(secret)) == 0xF7C8E3AA84AD6059FECDB160A386A5F8080448EBA77315B869ECFA81C5F676C6
]

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1702142340,
    secret_hash: 0xF7C8E3AA84AD6059FECDB160A386A5F8080448EBA77315B869ECFA81C5F676C6,
    secret_hash_signature: [
      r: 0xA773B5D3412E8B86CB9FCC566E7FD1A7D83195FE60A94A7A48396D9EE55BBA2D,
      s: 0x0242A8B0F91D86394998BF067CDBD19B17DCB027E77898D0F6845EB3E8EE68E0,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    8B09C6E0FD413A0AC27D32152ACB18C2ADA01890C6BA031E8FFE56261F347EFD3385F3CBF7EAC76D66634D1C5B4713A75D9084F971D85D601661E4B9

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001C00BCFBB15C89DA48D3CFB003185BBFB1150771D66B8AA5D2B75E5D7625955C4

Previous signature

B7D9435A4F8EB80921C9AD61866005A4A5623E933C303E9623CD52CCB9395F4A3E80DEAE4A036D65418DDC4ECAE23CFF7ACAFD3DC6FA27326D2775DCD1529607

Origin signature

3045022100A5B2838719011C87C5F000106B15DF6E11047520F12180C5779842849DDEEA380220295355B1BE9B149F3045A732693832E81C937FD15F0EE8C0824E9D365569E612

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

008BC346B91D9EAA8E1AC3A0D5D1CB3FD2260BCB2D6422498CD53F3169A3B4DE34

Coordinator signature

8C26C8B2D766239E530A9267F84645B0059695CA455F59A1FDC00C5D28A947FAD5DD82060CBED4D824F8F03DAFC78BDB7E9D8EFA329FF97A88CC0861D6B0C102

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

2D1DE3C7A9B548F260FDAB50F6D72E17AEC18295696DB0A04DADE893EF572B125E7B927B578BD34789A1B3524CBCC81DD61A4F918628156CB7455D239101330A

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

D32A53AED51CB97C8FC34ECB3AAD4B47A30EAC6466F46961A4103BD15D1DF30702F19856D24535077FBBA7DE6CD75FF9E4C7900268102C0209849B3BC50ED402