Type
CONTRACT
Validation date
2023-12-11 06:23:34 UTC
Fee
0 UCO

Code (870 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 5.4835,
    end_time: 1702282980,
    secret_hash: 0xAA144E45B270609C159B7310AE7F149F42B0E4B31310D384AC9129331FAE789D,
    secret_hash_signature: [
      r: 0x19A4CA095F7B3E05E962921DC0B23D8586B5A0D119DA4CFD2FC41DC13DFB1AE2,
      s: 0x68294D3CF0D2ECCD5C6ED569C4779BA84DEFF3FC52B6B3E1E6F46D552D5B8508,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    EEC0A784A28CFD59869D902FD4FC54ACBB9F15DE0EEEDE0C33663DD3443EF901EAA08C2A99176D671DB6E03A75473FD1D9753EA6C309156BCC1624EB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00019ECB467C4A37F83E9B0D9D013FCF1F9991C1413332748575895D1F43F2D7CD61

Previous signature

601244F4F2BE53D68267F77562A7A7AD39D25CA864FC41C0B870BA9CA37AE74F55843C3B84972A4805B963B5E2F4CB500C81FEDC8BF95D5B69F4306123B44601

Origin signature

304402200B63E288E08BC9F93E024133EA28B706C183A9EFDCEAA829A0F356EC19BDB91D02204B8E9ABDC6E845CC39FB05BB8707A08F9F706C2CB30911F5069F15C574A8355F

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

001EEA96E7CAD66B0FA1D49EF9A4DC5FCB00C0C884F664B81BB1FEC23EAC778559

Coordinator signature

E66ACC328EEB2C0EF5F40AE717C5F8BA170D2D98354ADBB37CEC27C4C2E54A6396890A80B9F2E250007BAF4477C4D88E45DF41B60938B8133F7350AC4269180D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

574E4E82E45ADC11D77E94E3A7D392833BDCDFB854214AD805907E4ABD95D8B97A602C28979938FFDD581D63E50634C7C1A654534D5720D935FAAE0011483905

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

FB585F87F15FAA98BD9A98191EF51EA08DA6F806968A2F0357FEF5E7FBAAF9D50DEE8F89F1B53C744CC59F2C3F4C67365FA826BD0CCC53D9179F4D8CFC39F404