Type
CONTRACT
Validation date
2023-12-01 07:14:57 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 3.988,
    end_time: 1701422040,
    secret_hash: 0x37BDCB722F8A550357E4F243DCAF2210F2264D57A65B721B4B6136D22B3A30FC,
    secret_hash_signature: [
      r: 0x73976E436381A99DCE2D0D11F371FB4CD20B3AB4AB9AA7B2AC8D72A52FEDB064,
      s: 0x128869873B3C30D07E9766DF4DF8C30827D21B62C68C0B33635BFB45EC5DB296,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    E0A4F1750C57820BF8B183CD5F83EF95C7A3EDF64AAF4015D8B5920CA64B656D6CFA633A8D1BC766B2AA1AF0F0419DE93D7EC3CA19BA895C8BC40A04

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001CF4B5433C02E2FC276D85486BCCDBDAB4894C19E487DCEDFD37B01684E21C5CC

Previous signature

990452698E49D53166D8A986BD5D82E827903F64A8B82F170DB1610D2827EF1E1659A80F7D51EF47098D2C6D58AB24C24E48986891C50502CA9C27F65241B70B

Origin signature

3045022026F9321C538467F757B91252B3C349C39F03D4BDE9B18AF3C83F6A6BCC3F9CEE022100E370AD64804F9419D58D2D13B0E26CDF534F676915303256CD93DABF7D403774

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00E569999C87FF8628812B34C52B9C3B89D466E12D4DE7398203119311ABC74DDF

Coordinator signature

2349EFB520FE2EBC52A3B66C8C9C5C8EEC74593F6E2EBA85395547203874FE5FE4D91C7C65B31D6289810EE80DA094B0D63EC025D3FA90B91E5371A9F5DD440B

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

274CCC7F913C165C7BB4B8A0F04ADEEBB4E4E5D2961E35E63BA1CA4D70595AC6EECD939EE45008D5638974B6AB92F6632716AE470E423DE7C89C2B01AC1AFD0B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

AC32D08413A6FC5F421D39C1BDC287213F45950BD09AE3327C1DFBE224E92587F2D6E90CD174AAACB2AE0E8FD01A03AE71E487C15B62A112C6513AEA20E37703