Type
CONTRACT
Validation date
2023-12-13 10:25:22 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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: 2
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 < 1702470300,
  content: Crypto.hash(String.to_hex(secret)) == 0x0F912B402CDBC8E8391471C222C921013C5546796B4660EF4CABA375BB025B8E
]

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 1.994,
    end_time: 1702470300,
    secret_hash: 0x0F912B402CDBC8E8391471C222C921013C5546796B4660EF4CABA375BB025B8E,
    secret_hash_signature: [
      r: 0x25F9F74BF769187EFD88512C02EEB827E85E25C4E147C41DF7000025D52E725B,
      s: 0x432EE16A54C03F394281FE0CFBB7E8D0EE72E258A1224603672659B5D0389E6F,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B3F49F923BB72EFD64C33509C71266CD46651DA8258E1CEA64326846D8B8E19954705604480EA9ABAC2C811836675B7930C15DA246BAA9DB585021CD

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001245253C6133C0645B078D813A532D789CBACFF8B3492275C4E27BDDC07CD39A7

Previous signature

FEDC2077E5AB98947CE0C12E63250EF7DBFEE64C80C9361CF2FD1696526B69D2F78950074755A925B6A5F273D52CB597707A0AC2066D69A5E9076DAD94C6480D

Origin signature

304502210099DD1A07ACF37880EDBF9010A8861BA27B2E3362B6B8391A2B58F5394094B1AC02200A5CF7DDCBE146D071E68DE77D163D29F035EAB7602346401E6987DCA73B0297

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

002BFE8BCA2473C97E6BE9991769D02344320E659E880F49200CEF2097B0E49C0A

Coordinator signature

BA103120F207131AA4BFBCE3AFECA94D17F5D1CE059820BFBA30A772593DD69494A979DD1F2EFE4B9615C19F0AD1EAAAD1507007505F75197C174B329571C40C

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

3126A07E155E2BDAB71BD22C109036618A089AE6A37CAECC6F3063088EDB2D75A5170ABAB3B592CD7A9A8F8868E6615FFF9142F765CB75E1D3C4555344563009

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

9E6824B71250B41D2B28766926EC00886CA5DC7EC814F5560D1E1677F8B2754DA03C3848DEEFB8443CC6DD939A77F1AB12C73690BAD9F2B0FC9B5CF1E179870E