Type
CONTRACT
Validation date
2023-12-08 15:55:27 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1702058100,
    secret_hash: 0x1364352BF8A7B593A1673910FB0C6F71B0AA2B9FB5B858957776A13B9A4C7002,
    secret_hash_signature: [
      r: 0x11CD228DC9DFB52BC629FE67C9D429FBE4BC3B1D9ABD348136669B77FD5614EE,
      s: 0x784D31A34525E776C7B7F7A1EB1BC27A300FED1CBF804B52528612C5E367D2FF,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    FE6154097E6397498121F4C9947C2F14149E702B7A478CBD2F8B016B2B01E8F0862289EA9008275E7591E6C11CB6AEF5B41F19F92C31B28B2D81ED26

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001E851D1EF529385C3009EDACA344C750D76F3DD29BCD7491E758D85A7B6B38046

Previous signature

4916A7FCF01AD6BF00DD136265B75C5560F83A691DCB383F15074BE9A56C96AAC62E5EF9ECE0B22C4C478172168912BDE137D8157BB3C2F02323DFFD23726A0B

Origin signature

304602210099A9EFCEAD0AE148D021E8BC4F19E9952BC34A527F95195B61C66FDBFCC5C59E022100ED46064DAA10D9E25E982576F291439D863086D570B3C14A4BE290A01CB52322

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

0078A057C2CCDAF93CF122050E0FC2540B8A1A0EE8376CA7C10CB07ECCE252B7B2

Coordinator signature

C9924691C1CB40EC80CABA6E601D4A01065AF908A8401E2C68B82E7CD405EDDE41931814F71839839EE037FB8A7C953AC9A7939BFE4CFC0EB7BFF764AD71A80A

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

756D0A8676BEF1F8F8F290DE4F92E5EF178770423BE377B0E480DFD68FBFDB91A31A28A589AA02ACB8902E0DDF7C4BA9354AA0AB09BCBDF8D56C5C0269BED205

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

1810A5EE72D0B5D8473F46572832EB8A2CDE8DB0D5BB189F784A423169EE4A0FE94B7B574E0949D88387E25BABC68845B6B440B8B140B7E41ECB0083882DF306