Type
CONTRACT
Validation date
2023-12-08 06:54:54 UTC
Fee
0 UCO

Code (870 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 5.85239,
    end_time: 1702025640,
    secret_hash: 0x201D815EE4BA0A441CDF784BF894068E77AD7B2B3318CF5CB76100812BD969FE,
    secret_hash_signature: [
      r: 0xBF931D989045AF9D8E27FBE224023278150FFDE5DEB15808D719982C19001A9F,
      s: 0x08270B52DD79154D9DF101992938FC13C0875FE86BF5EDCAFB29AFDE15EB7107,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F06D5C68CC1B26088C84061E46D0D40E1AA2A94BE437696102AF3974B4212AC26AE51A8568064B10992EEB2FED4141BDCEB8A7573481D24C9A86D070

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001A2D800ABE159778914DA53B1E0DC084B26D590FFAD4F5416EF24E120A54C246C

Previous signature

F349B20D71B037C0867166C42660496F06FED4BEFBF06925FFD7D15D3F287D8CEB8CF617DE3680B52058CED83266D391DDAC7A96EF59AC4DDDD102853599D803

Origin signature

3045022100D7FF264E64028462BAAAC9F0BDFF5D865BDE39D29A96CA5F57E6C4CBE40174AF02204399DAB8FFE164C84AF877EE5C9EF6CFB52076BB5DACAB41C80188A7FF8A4D0D

Proof of work

01010484B78F4110D8E9D6FBEC72759895CC9D4532177314FBAA8B07BC525FC1AF48F150EFBF104B1819106B8E3563CD0E1FAAE5325F8FCFE58FF744C35F47669D2704

Proof of integrity

00A1123FEECCF58C0B9FA65631FB6AC2BA8217A731AE93786CA6D586FE09C56977

Coordinator signature

2C1A43D03765CBB80E25F329CC19CCCDD8512C6533F57FC3964DB9DAC8AA9FED7178B688172620C0839CCDC1E428C6DCC3F51E989A3959986F0CCBE716330D02

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

EE86215B16547979C49C7335AB67318BBD166369566EB1A932CC19659FB847D5B0FE082C7063C6CE9989E131E08A4C5F6265B2C6EE53E6932413588086515C09

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

36389A29FFFF13161CD3EFAB7A04A7690621919479F80EECBA8E4F46737E47C7EEA5A6F7DEB0C4494EE68B5979074C4711AD2B82526E252D73E5761844489D04