Type
CONTRACT
Validation date
2023-12-11 05:04:53 UTC
Fee
0 UCO

Code (864 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 5.982,
    end_time: 1702278240,
    secret_hash: 0xDACA7365C215E0757253E99C9173FEA05639D668EB18262FD366C9C6A938D971,
    secret_hash_signature: [
      r: 0x8D42FADDE9CC16219F9B427ED25A62505398D3C66B787BD8221996E31BA416E6,
      s: 0x589DCE7D97035E640283BEF6F2E6793B882E00E60EEC137D81AEA2839A183DA2,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    35BF2190405D54C671530B1C3F1EE7EB52E1435BFA15ED894CA95207A34321B3B25CB9FA0D5170446286BDD83DFC10884FFC251BCCFCD6D2554BF93C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00014671B32C36694B595804D65E36F3181C65F0E8E0BF3902CEA86F8A19B5E58A3F

Previous signature

CF329D4ED8CAEB279B74F24B11923C871DF6B065C6EB38AE9F16BAAB910ECC80710FCBCAD65361484A73C55F10CA37E90544B4D34C931EBF47B2C5307AF0310C

Origin signature

3046022100A3DDB5F7726EAD9DB56BC0D3C4C6A088E7E643AAF6AA68B2CAC025F7DF31B206022100F94D96D50D487FCB220616CC921D56DE741F9A02D7747D5D4C92E803E0CE96C7

Proof of work

010104BB7216545F28C83467606EDA88968E19C436410AB446D1BC88FEBDE3506275F9B0B931CAAE420B96B2A158B7112F13795C878CCC346C76E04A96C59CCFC6FC39

Proof of integrity

0080865D84ABA3D0CC6D05F61734317583B6EDD917405D3E88740E3F2F254827E9

Coordinator signature

F9F555022BBECFBAFDAD32598D44B4D4AF67833C7A4B66EA5C65938E87534988A3E537588BD31C98722A8F63CF50780DA755DD5C2331BF2893F93F78C717D400

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

E3D0235AFDC6DABFEC400961A0B487FEC97CD5CCE227BD4F51DECCF514B3C2CC02C499BCC4B9D93D2BA9400822C0F27B492400388AE0B2E65AF0A27E3DC65905

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

A6A21814FA88BACD0342EF93B648BCA424A6B6CA20670C06316D23899FE44DD37038CA638DE48DF1A86184ED5E4BC085C70D506826CB51293E8765BE32384F04