Type
CONTRACT
Validation date
2023-12-09 11:53:16 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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: 1702129980,
    secret_hash: 0x5A337D47A33F1B88DAF88F2AE696FC2EED65F0A3232ECE7AFE4CEE63683F88D1,
    secret_hash_signature: [
      r: 0x893F5C465AA497069F8A0F5471FE88E46027DB3CC1F2A0C22D4574A93DEF0911,
      s: 0x26480EC2CAAC163DEA30367F2166B7377747ED487553365F9B6060470A3CD165,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    07BBB2400F287125B0D9E0F28DD21D773C18EC197BFECBE501B98313818A8E8CFC5632DE3EA676E18A8265A657C84F93C504D072C0998D9EE6A5FDD1

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000106C4445EEE19C184BEEEC65A2E9761D5026D5BA6CF89B63EAA402F2AFEF7C4B5

Previous signature

A8CE14F4B731A623BEE1A3864952CA8AD7D67601F3AC5079EE683454D110D54BD7FA292F49108CC3E6536EC5801BB5DF14D63017B0F25F69D4DB2D401AF40F00

Origin signature

3045022100D3FAB27EB2249FD52239AE33CB0BDFFA94898780C4EA5C296A16165743188EAE02205AB1980159C485B7A9CF45FB9927A9C5BCB592895133609DEBD6FE49A9D109FB

Proof of work

010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39

Proof of integrity

002CF9C3CCE1506A9E7914068C168831784016A54F7A83995495B0BD69EF7DCEC0

Coordinator signature

9BAC38C989A8E160E08196ECE9A39ED2810C1A740978FF8B2DE2BF4F6234DDEFAB0A3F1B02A3AA8536639D33BE8D79B9CC001BF4DC896832A894847407A18602

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

05D1A874AE9E3D14E9B27E530449E988A25AB8C6AEA1DAD8D0C11289CC7A4C5EC53A494DB3840ABAB93F1BB2D1712E3C5C2A113B5749F6F598BC96156EDF1705

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

4F82834A0F374C72FB0DAC30E8C7178ABE615EEFF86870977D9C35BAC020F2A3F6D3FFA9D5669422A37064D01CF618219E156CDBA8474D2743715E4404139909