Type
CONTRACT
Validation date
2023-11-10 16:41:23 UTC
Fee
0 UCO

Code (867 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699641660 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 >= 1699641660
]

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 < 1699641660,
  content: Crypto.hash(String.to_hex(secret)) == 0xB000C3E992A06B1EC0AAA7A473BC00179551CCB71BF4712236DD6D3D11A434E9
]

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: 1699641660,
    secret_hash: 0xB000C3E992A06B1EC0AAA7A473BC00179551CCB71BF4712236DD6D3D11A434E9,
    secret_hash_signature: [
      r: 0xB5B2A8B0381BE0285C4457190D0BEEF6F4B33963924DEE3BFD6C27D0224F8995,
      s: 0x6E6FE55FAB41BA0EBE7D3302F4EC0412ABD4AE94835C1C46A56B19C77C69237A,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    5FFFF4BB2CD8CD866B84ECA9A2374B58ED76F0DE116DFBF069DD8DA4CA02F54B044EB6B6E9431B25824A4F7883CA3C1B6B1DA048220DB56ADE779DFB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001C357B887A6C5FA19C58E1D6D9DA177B3C0301B84F0709C91F95B2B2E77140F70

Previous signature

D2A15388B2251C3897F543220BFEE3B2BFC6A12FCB4EB94CCB5E461A14E67A026B47D74A749E3632EC87FD2A063AE251BC4E91C6C41B5ACDC837A050DEEADD07

Origin signature

3045022100B9E5CA74700FBEB1C8A3D3C0630A71A74AD4673DB0B7C191457F73C6EF216A4C022029B68D65D3C87055F6BBA775381DDDC3DAAAF4AD04E5669E839838352BAD5501

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

000DDB63430D6F2DB1A44E946D976E7ED05F58C06E65CA9CAD4A6911C1C87D4DA0

Coordinator signature

2F8CCA8E3C456EBC6F0144C2D5CC3C08039ACC131AC1D36347389DA217674CCDD89CCB3C8F330DA16102162A810DB069A161252A79A4324ED74430E72AAC4F0C

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

AC6882ECE69A187843F56757AC0DDD89E3BE4F0A80860159879FE0FD2C59922B508104266C00837EE366E5A0AE805839CF0E999D9D8E19F6BB370AB40CDCC00F

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

363BE25EC9AFF31BFFB5B17E040DAD45DFEA5E42121E79FE451F4B4E3274057FCFEF1A578FA9F1AC62B0E64ED9E9DBD259FC51FDD7F59F875CD2349D1355000E