Type
CONTRACT
Validation date
2023-11-22 02:23:00 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1700626920,
    secret_hash: 0xD24C431F1E2D05AA1E7FC64D7A842D3A0C70A91A3EAD8ECD9049CC3C83BD8FCB,
    secret_hash_signature: [
      r: 0x71C7BFF9D628B444EEFD6743067B40E640AF7756489ED2188B9D21004A5074A9,
      s: 0x7ADD46DC47444FBADBE00F6A62C9E3636062543187788E200D19B2D523051CFE,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    3955E870455CF961B1CCCA8D9D23511453BF662B8ED5493829C9648BE13070CAB1B5F62E65A206EB33FA8A7455760D6E0EC63BB9FB8CD4FA876E7131

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000149C3D8AB12BECE69F4E02C1B0A3C3DC86CDB5EA061FB08C5D35A3DBF3CD6013F

Previous signature

71C481052054818B6F53D04B5D799D037BE0AE8AB9EFD50DFF8FB7043D3F90B53C547ED34B54F4A9FD0EF19C5314930A362527F6C0058BAB4EE77331F3526005

Origin signature

3045022100CB6461361A69517366BDFE493CDE6B96AD53F325482137A60B1CE624B62F428C022067D9D2433275A2A88CD9F603A72E7077C9AE4CE3A5C8E97C5ACFD6E71CD27F9A

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

0060271ABEF431FC3B67606FDD5D2254319CD0A1AAA6F043AA8B0D75810DB6328D

Coordinator signature

4E57731FB7A6A72EEE8ADE76944F0D30B83623720DEF4322DC7E54AF2C25E0459DFA4A826B869391C37EF667A74D723533EABFF4C57E63DB3BEF21FDF7CB6607

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

75019A6196E37EF26BCF1F2BCD42A2BC6EE362FCB104A57BFE529AC2287B923A81E331938B3F2DBC2BE76139ACC38ED0EA29A9ADC74929C28D73E50894084201

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

ABA7DB466502C2FBB4FC39308984714814B84E0066604CE1F186D1481ECEF11B2A085362BCDD3CFAB686A68F22CFFC4321820F2EAE03CFFE3F4ED4EF5668C90B