Type
CONTRACT
Validation date
2023-11-30 02:58:29 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 79.76,
    end_time: 1701320280,
    secret_hash: 0x1AFA72AC5AD0885157542F6DC6952DA464481B2F45903C11FC1E00A977FBDDBE,
    secret_hash_signature: [
      r: 0x6539F34DE054D4D2D5F642651F0734FCACA15F49E835BB377DCB45F986C024CD,
      s: 0x6C866799CAAE537DB5674A16C5EE38A095ED8F0B3094407426AB5B7C6728892D,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C5DB712CE591A3E0372BE0C68F7ED1D01FCAB8EE328FD977E5F7B41F5668C315B108041532AACAE57217A7453F010A05F9F41B9624E17D36B7365E09

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001907A7A8723E421602A87C827FBA22E40D60D834C5FBEDEEE483585CE3C99E821

Previous signature

1531583D97F3ACD4AD6D88E9DE7664FE8750B7AC7E06EB10AF25791AA25E504DE2C263A38050B5DC4975C7775153DF5E265DDE7BC6B2D4B98B0CB324FA496600

Origin signature

3045022100FC2326B13AC82DBA5D2B3F405469F3559E1E7F7900064C466C2B937669D8E05E02207CC4FBC2A31E2366AE8426A1ABA3F4DAA1AAE5EFCF766644C21E0717F28F14F2

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

0091F03C8CCE099076D30543A2234B3B40DEE33091ABF7EA7760AD7E223477A200

Coordinator signature

7CBFF625DCD552D127E11484BF2F44273C6E3C5465927B4270DE0D0F76DCF97A4462021A7991CCA2CABFF02CB0095F1E963FFAD2E67B0FAAEBB89E3CFDBFA105

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

81AF6B4A78472A549D19014F14F9B097306DB4CBECA24E1035A5BC714DA5336EF06C9B2A80B9C214906A89893B591148560512EC26C96DD0D877D7C5C6B7690E

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

55E3DDC77E81D23F59F40946EEDAFB279E9B1865ED5D99FFBA66A26C835DBE3FCEDAADC5B2A752DDA092BC88FE31EB3E51D989CAA6D6E411D92598D429C13307