Type
CONTRACT
Validation date
2023-12-07 16:25:12 UTC
Fee
0 UCO

Code (869 B)

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

end

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

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

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: 1701973440,
    secret_hash: 0x793D180B7E3C77882FA4D884FAED5162521B1DD5BB49B732B5E2BF9220710F3A,
    secret_hash_signature: [
      r: 0x66A9F9B1683F47B791F9CCF13C8A30AA0FCDC6FFF532E7703FF764BDEE80474B,
      s: 0x06163A0431C76BB138380C0A1C83D59E1E300A7828544C3CEDDD6C8B515BD1CC,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    EB2AC5B39EC2BABB664F86C1EBA8424141EEA70FA6DE50B522F8F30E18500C5B0A1BFFFD9E061F8D15C8B83E4439C028C4867078BCF4DD49A3D7C801

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001A5DE696DC8B1308C4C6F2895A77D2B216B8EDD31CA0BF75A27F076B9C9746C8B

Previous signature

B0589E7D8D186E3FD6725C45FB9632115F904EEFA6B53063C77B9EFB2DE01ADC56B516332A61D2BFBC760F4F78C93A3862D7274978EA4EFE4B79E60D4964A20C

Origin signature

304502202BE4C97353588B66D9448F7E0A1DF1479879575DFBB5EE4B6357BDBF358D5E59022100DB49F161FF528C95A175E78CBF15F6A8182D352D0339E55B208C3E21BB5B4A57

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00314A8985A188F61507EE7DF31D683E41D5B652439D52FD68196795E09B205F7A

Coordinator signature

152FA6AB2FBD4C17E95214D3F923DB82D4308063E9478CF47583739DB6947A297C04E10C554BA57DCC9BA7A91C75299C80DBCB61402424FDC02902F96998590C

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

A2CC7F308032532D801F9B6B4351924B37AB3269F80E3D7C9F01756352A0190493331087B88D642C112EB8F7DD2E0C9DE6A54F5E06F46A291DD4F6BDA586E602

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

2DB29AFCD01A29CCD2E7B43368A66451C5D311A6B3E713798ECA79716A85880670688945B1E85C35EFC306B249027C746E5C4C702CD9C74432FC0B06EC9EF301