Type
CONTRACT
Validation date
2023-12-09 15:43:32 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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: 1702143780,
    secret_hash: 0x92D51BF08E1FA9F0DE11BB63C2E3D00BCD846D6E9FD7A326BF4E68DB0B5E7797,
    secret_hash_signature: [
      r: 0xB72B6FC7C5B395754F35CB83C4EF193D8DC6DD0893BDB4F9B2260526C9A49E99,
      s: 0x27758A25E40962BFFC304B420B6B630A67E777E00CE84705F831356E0C9B11DE,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    6DE559CBEECF1D81A55F2EBD6858F8DB9CC091CFE348AD8C4A2EB267467AD35522D2FC38A88B009741E60A6104DA414C613967544160D444F5221DBD

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00019B86774022391A8BEED754D79646F2A5283542839576C2BED9A824612BE26339

Previous signature

4D6D13D2F18FBDF9A4165029FC5F8EC1F73788959DC6CEF8DE2566427862396E67CE85E7EFB671DF1C2A24470334A34236D6BE7CF22525BE01724C8E27B5090C

Origin signature

3046022100CF9B2D8DEBD0BC31AC6977BD678889D1A3C4EBE868471A97272B6609A2776D98022100CE20C60A84A5BDF4C8F389F1BD3F48EB4DEF08541179063BB87A674537A63F83

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

00A6CD1A815A0EB87F0BE4AF361D633ABAB92A58CC89FFE9FDBDCD5AEE8F45C450

Coordinator signature

407C1614F811BDDA753C36F57F4E316F25DE9A566FBCD9660A71CECC04D5F51AACD3091CB1C6B513EBEE2FA5EE10275C0B8C5636EE5715740F93EA7CA766320A

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

05BA93B58C592A6DE14A4D30B172638E95835E001B176EF6090C1E48C7020E38EB4693B2BB9569B8A84350D577E4D55003B0A57E915C43A8EE62E7DAEF42E60E

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

7CAC07D6D6CF7C5E688E0704A5A7F1513155C7F13A7B9CF1A6B094A03F07DF392CDB3762F02C6E458236F46A2EDD36E032A9DB088F49905204C223D95D87550F