Type
CONTRACT
Validation date
2023-12-28 20:30:13 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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: 1703802540,
    secret_hash: 0x56910D40747CA68E5BF9A40B78602FBFE8F7A7F17B14145CA4A5C510230FBAC5,
    secret_hash_signature: [
      r: 0x387A8709CA1C9D4359C3C12E25E77CE365A420B5FC621C43AAF033705BFA63B6,
      s: 0x114FA176716155846B8BB6306F568825580FC1FD614BDAB4003C23329C8FCFA7,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C7D280BA8B865C2297827C6FE60C9D372160DF53FC425C8073134DD222E301759D2ACC4016311B6BDB17A6B5ACFB30FA5B935DCA06ED8BB7394A83CB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001778C175F09A9852C82DA80FB7E83EC9897991FC2CA7B5F64B32D0BAC3D7D1B19

Previous signature

513267A00772386C6081902DEF7DFF6CC80A5E4DF92C5D4A4E59ABDBB8D3241D19EFF6C82978A0DFE9D314AE0A100190F79A7A2166624825932F6207CBA18909

Origin signature

30440220318FC531B33F5C627E9B42D3D9A5BA99FB2DCA2B7C9638ADEB9AF074FA53A0A202203A1792098396C06A85BB07F0710AEED13AAD670E318240CF79EC776C53C0503A

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00A96F345F216F72921309580B0C51DEB2C97FB1C91E3F5DC1B691D909098DEB94

Coordinator signature

711C840F5F1487EC07933E028D5655781F7DD060ECE0603A93D90C3950722DBECEB8D816AC622080781AC637DF25F8655C94DBF46C0AF32B1CAC8A968A36340A

Validator #1 public key

000162E6ADFF9FBBBC4BDBB3CD56A5A13A1E8576C3619ADC58A189F7E9A3A77FF95D

Validator #1 signature

4546A908524F7343DD846787390125F1B03B999ED1231AA5FC559871A486876BC719FA7ACAD40D5B865EBAE7F22BC786AE541AD91FC62C002851A463C420D503

Validator #2 public key

000177BA744AC778DC2D51A1B7C622E7AC4BD1E1AA8DA2D0FCE71BAAB7DAD0E020E0

Validator #2 signature

CEFC83EE46DFB6607B4D086883BA73EFD98320C21C5D347CACD835DC9161AE8BB2E3B8F55F6E958F1730800D4C9C8BFED5A6367317064A15D2939540F5BAA80A