Type
CONTRACT
Validation date
2023-10-27 09:50:17 UTC
Fee
0 UCO

Code (861 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.997,
    end_time: 1698407400,
    secret_hash: 0x5D47D3840C5979D6B50CC041A675C97A737C8AF6229F5E9058295DF63252A9A7,
    secret_hash_signature: [
      r: 0x90C5C783F7E39E40F7B10A8F8B76DDDB2F2D837BCC05364DBC057A1C0F7504D6,
      s: 0x30606F3B6F6B26909F5E86E97DB6F6E9CA5B8D2885E1FE5D8DEAAA6967A254C8,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C0F8F0C8C00CF1065ACF76A1DE3F222554098887A955ED386B497B2E844DD31A94801AC7871C7E3C12438C67D2CD6981364499650CA95B9E41C711F7

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001F7129C3046687DB3DFDCCE05A3C6203B65DF31C9626254254096D0DD7B8B72C9

Previous signature

3B1AF34BBD0BF419E1781417A5CD71DFB5ADF931450E9315523F8432B066885F71C4CE0E6271157F09917EB58BFC480BA8A4B2F58AFC1AC0026FC04994B1920D

Origin signature

3046022100A27B15B460093243182881C88F98DB7B7B2BFCA8792127BA886AEE1A9C5560A5022100A8CDAFA58CFB87BB908839819FFADE4DB5D98C034A5096EED7CC337A9AC757C1

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00A79D31C11D40C85DC60AB5D2C6D45EA93AEDFF6F81E8769F8659C7B980A0B8B0

Coordinator signature

C632150ABC88FBC607D9A8579F1B15640CF3DFF05F69DD8222DFC1C31F345744E62B6834DAE436BC720828C8F7A34158F18E92C64CFC22E48071B9793C3E7D0C

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

4989BD25D969B0A4F35056FCED3911A3C0BCD5CBB8E84EA22E51194C53847D804EB2DAA0C023BFFF6F5131B3495E0DECB4B789B74F04F49F50BFFC1BACF1D903

Validator #2 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #2 signature

A56825B0263C632A83A06904E4D6621A01749A5DCD2B8CF20ED3D5D18F88ACC3B0565A2BDD97417314B6EEE97FE6BFDA1E2D6E59DE95E435AA08079D7CD0B20C