Type
CONTRACT
Validation date
2023-12-14 04:48:06 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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: 1702536420,
    secret_hash: 0xC698551AC26AF91DC57D2CBCEDCFEA60C59087CBD35C63B578DABB6C0BCF306D,
    secret_hash_signature: [
      r: 0x04D78E4F9B0FF65D0C8150A01018F29A4298CB3AA3129BF1D4D3CBA4E69C6C6C,
      s: 0x1DEBEC413999C5464C5A1EF76F52D96B166A94798ECBBF11E65D8807FBBEB062,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    4231CBAC6FD53A0EFE4DA5016E506D5AA558AA39A7347C062F332C1F8391E328E8DB6BC1294BD43E6CDBE60E6E5D2D8D2C42047F73064669E8EF4DE3

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001AA5E09422CC94D5CC63AE9910F2AFA260915D29750C02AE49EF75F6FCB026A2A

Previous signature

8495E3A503198985E66AD1DB7FDBC8B544C1AE3B5A6B4A07E370F76F560E283E66A1FE180F5D258043939977BDFE08DDE56851D3395DBC16AC8BC38D7F88000D

Origin signature

3046022100AB3169DBC8E45DD7244E9A8739D9936E4A44B3A8191FD272C05196BF83A89D3F0221009AE9EF324C43CA63CC62B5E29F64FE224661469955081C7DA8D9E19AD5E833DE

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00AD3C2439D30F0277A98A5A49606978AE0F124F90DB04FCBE6B136CFC35AF130B

Coordinator signature

9EB1F8CDC284FBC118EA67833D4C41EA767EF19A6C2329A228F524C55609B7870596E76DA1DB8D0CF0685FF1C2342783B7F06157AE3856A3DE24039AE5EA3D0D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

83EDFCF2709DA56450D62F456DD7FBA0EF252CBEA2D12763CA61B23776AE86469F57EAC5D33FBBDB020DF60018B8DC7DBAFAE044CDA41B43C9B5CC6862FEA802

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

462C812DB733D380F27023073A31D7DC4533A916D2C28FBCB1F16D798511E7F8CB0452F0BE6E3E8B349281A6F4322113B1051B9B3EB9067D1F894B441208EB03