Type
CONTRACT
Validation date
2023-12-09 11:21:20 UTC
Fee
0 UCO

Code (869 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 1.994,
    end_time: 1702128060,
    secret_hash: 0x1680093E2930FF9AC9FCFE0F2DF58CA284117DB752A2027A6A8AA0EC17208156,
    secret_hash_signature: [
      r: 0xE367FF7EE9862DF5C6F23ACCCD95763FD2520B78B5735CF0F7192E8D4AFACCBA,
      s: 0x1BE33C9EED9ADCF7F5213960BA905BAE65F34729A06FB5B9A9F826D583CBDFB9,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B4D568DEEB1BB90D1074CE18CF250FED19AB2B3F4D9780543B8779990BBFA95A974702105929B22DF30F3B643E57E0F832D35F86D2BB13CD381A2CC5

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000166FDEDAE30B1CB802BCDFF47F09E083AD7DAB937D67DD4F5F6DD5C119FB3CD54

Previous signature

75001B0231E07F3AB05E689652E2405EF1556DD411F79AEC082B8BF80822FD833DCB977962B5FEBBA5AA714382B20C6DE94F5B659B92D26952FCE2017A4BA30A

Origin signature

3045022100AB8C633EB221E90EB9E7FE7C9A9B96988DDE4E01F12F96D075A19B6CB96EB96002207E7FFDBEBBE086B5DB82CD7CE25FD9D9CBF34FABD2CD856C4151C5E37C97E0D2

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

005B1E1D7F97859AC1BA49DE460050D8D81BA2F1F2ED54A884880B5F950A9E8EE1

Coordinator signature

5C8B2C366B2A85789CE70474A20D4697F5FDD6A742BF806F7AAB7CF71B4EBB1F6252DD9C6DB7F237D0A7E949B5465D7B870E9EAF77037B2D7537EBFC0A26470B

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

A28FEFAD482C4875ED5D1999D9005488DA3AE7327149B11CF18757DFCF919C2609DCC578BC8E68B044968A3F369D319BFCFAAB89092DDEF6299C91809527830B

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

AE2BFF501820B987CE7F5580DDD0849493C6C9817C81F5D36BFA4807F82138634BA25A326014F6DE5835A13D65326AE8469C5E6D467151DD3591B7EB4AC1830B