Type
CONTRACT
Validation date
2023-11-12 16:01:37 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 4.985,
    end_time: 1699812060,
    secret_hash: 0x4CB0278B47723557C4E07786973DCEFB5DE1927AD646D8B32CFA1A5A77E7E704,
    secret_hash_signature: [
      r: 0xC393ACAC18F99F7F7CF6586E9C7F3959B78557D490E257C9AF520B8F11E1896E,
      s: 0x3883B1347E4F737439F170439CD9ECAD200B79DF4E5B9029735750B61DCAB3AB,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    FD8385DA5A28DEF81E00F4F52C350905CCD1F679F1891A04F6A1BC50D039C1F09BF07B442A4C244E5E6946763BDECCC0FED49CF7F32EA931CE8764B2

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001186DEB1D73C43ED015008FB83CE218FFB2199195630590EE8A25275F3057C1BA

Previous signature

7D44800237BF10EC9CEC3097D94844D226AFB931B7A7808E3586D27E7CCCFF13EC8AE71A00C6FAD9CF2850FA35097982191137D58BEBA07D43C45CFBA05FFD0A

Origin signature

30460221008E88A829E5540CFD73DCED509FCED3B3C6EA0C4A2F0A5AF4DD12F094FF95760D022100B7E353A31A3A9B4DC912C1E83127DE88377535C2866B2E81EB68B18AD701B43E

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

0002B67E754078094840B11EBF000C00B58635A3DDEF012FD22189E9D9F3ACE888

Coordinator signature

7FE08F15CECF64D388E5A33E9417A2CD59B50A8BA952D039E76EF718598E70E6539236BBB079D6CEB8B0D9712820EC09D54B3D8ECC538FB2963F119D3F456604

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

84F786A17B843001A193A5D6A657E28BCE3660F5C876BB69D58BB50B352CA7B648494C835CA3DE44FF800764BFB45E22D30E0F36A30D08EC91FAD1A5F4A88B0B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

1C8929A8630A3389BE31EF0FD9BF5DA11CFB7E06C3B5F8140AA87BA6213DEA0092FBFF4287F9CF6C4359133F2C6FACCEBBF9D8A8FCA09F37B87785E4464A7003