Type
CONTRACT
Validation date
2023-12-14 04:23:46 UTC
Fee
0 UCO

Code (870 B)

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

end

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

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

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: 1702534980,
    secret_hash: 0x25B249E9117A8B65FD301D6F31D302C9F40E8AF887C27A3C764EFA24DCF0C5DA,
    secret_hash_signature: [
      r: 0x4D86579665BC928FEF0B7C503C549B883571478FBF8794E70DE850AAAFB18E95,
      s: 0x564D3C5F8D5ADE7B58089C825486CF473D23D57E9C8D74135BD4132B0C24263F,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    AB6F6F69B58C952B0E6A988AC2E057EBC2283906F91E811A92728C19AE7D83BB896CE20052778DEA9A6E4C9E02AAA5E45EA91A7D9D2E876AA5249725

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001132C30B885C9EA32751DB4E63693E7AB2737D01D3BD7569FB661EC58ABB660B2

Previous signature

06A8BA630C222AF34D6427D38D951A76B68B6E2090356E83E8B0E41EAB41057497B742E8D4F98B3018B56D8A5BC1515185B2248FB2180360E27F04A77760CC04

Origin signature

3044022058567D3C920BFB182874D3ADBBE95DB25AFD924FAA15D70DCE3EA03BCE700BA80220705AF7482EEA17D199928CA69C93C0A863CA5CDC8EB827BFA4B23BE83EFBD768

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00F8B51FFA3CB55F13354E8AD958D783476A810BDBFC677977B8945BA7E847E6E9

Coordinator signature

8E97983B3D8577894CC66FCB2D13AD4A7891A6DE88208A0A07C0C64D578F0882BBA49A8E8B8A9C50D1D98CD51C055564A30BF1E7607017EF0252E730CBB35508

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

AA85CC1474650587CC2703E35FE4CDA933299ED0322B94F522D690967EBFF532D4D778AB556D0950CAC9F7743BE2AD3B4E18BB0467D5C5873EBEC97778628D03

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

0C0DCED5357258639E1925FA9DC20FF1ADD7C658C2EBFF9243F78DA1EC28730BCE3BDF80F5C8C26ADC9248401CADC646DB9C599D63EFC6B0A898FA757A087A0E