Type
CONTRACT
Validation date
2023-11-10 16:39:38 UTC
Fee
0 UCO

Code (863 B)

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

end

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

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

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: 1699641540,
    secret_hash: 0xDC8B83D12C78AD806912F82BB68B0ACD0DCC4291E4489E2D6F52FAF121A86ADC,
    secret_hash_signature: [
      r: 0x6A65FA9695699178D4D2F2DA38EC638E0D70BCD2E1A55BC121B6CFAA6019114B,
      s: 0x0E2855E41A0AA2512E63ADE8B31F652C905028D709AB22936FD7B319A28C50D4,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    1D7BDEE301F760D49DF7AB27DBC2BBE5DDFED79A501A87C2BA2C39F75F6FD9A8740E9BE5E0B98886E03B884295A264CA3B0F08EB14745811BA1D8A13

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001F449CE8DE29539ACE6908F8DAB39845B2A4B49ADA6F037D0FD31F1928AE64D61

Previous signature

6E0CF41668BF7B43211758DC72F0AFB7E8D0217DD2957CC74D2258A6D3A03B92C9EC079779BF777BF8B4F1289A030E18549437DD9056B3874623EABDFE838B08

Origin signature

304402201A2CBB857028E7C5C169A53B74400A9BE81D52662441B9699F9DC55EDE73D63E022040BBD3E0DE7DA709750587CA739CD3C44B3E7334F2908A57CA73C9E69A241232

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00D7655C5AB96C1E15036C0ADEBD52478CF15F48153A845FF156ECF6FC727E88F4

Coordinator signature

BF8149612D65F636A12B84BA4DA6077E622764EAC8A68F4236046D3E5E84305B4F240728D151DEC24E1E715494A07D2C47E319557B41230DE5F0F6C48589D90D

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

543F08D6CB60A5FB6CB17960483E4827B4D2C726E84FC369B7C7CB33290AA7EFCD1F37C73753C1261573964075217F168D768324A60F1219C88CCE4702E0010E

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

CF935EFD0AF380DE2F30433133CACC2BC2ABD56FC65B31517DC0F620A0B86AD5B2939F93D58DEF768D4F58F582534D00FFB9D455CE0417DBC75304701F6E5700