Type
CONTRACT
Validation date
2023-11-16 21:40:41 UTC
Fee
0 UCO

Code (869 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1700178000,
    secret_hash: 0x8DDB11F34C48C8C1CA3AE3EF651E949585B28AD69176D4EFDA0E76B0C931F3E3,
    secret_hash_signature: [
      r: 0xCADB6764E248EEE57B273C1E69320D191755A21A7D865A90508B58158E279D9B,
      s: 0x33CAD8E9E64A14B6350D781FC394BFA52301C089A234EFA7640A64643F580CED,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    A46929E61DF8BE8E43F3279DC9D214BD09C33DED4F82A2133B4360F2F947BF6AAD958334D9BC371B3407084EABEAA48CA0550D8318D6280C96352E1F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00010415DD97EB321E8F682DC4917339B5E842C6F41D5AAAF128D3E52593F213C277

Previous signature

CD90B4DC3DDC80112279CA3EDDC22FF4F86556B7FDBD2A7DEA8BDE4425C92AACD50C581A9137894995095754005CE5563850E8A40452EE72AE576292DDB76405

Origin signature

304502206008D408C4BF217CD11627419B1445E0A66C5D157F77617B2F5D778773EF23C2022100E35F9ABCC19A8622AAE7399B482C410A3B6FAF088E8F0D367A1285981A5D2521

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

000B37C7487F0549E1F5F1C517EB3AEC9D2A6EBCCAB55172F0E11D9B40D102E17B

Coordinator signature

85BB5F11D3D6FB6CEB24697062338779D334E226CAC42C0DB199891DDDD4E0E5E24B9F60EEAA350B894687D3EB03992E71A7CB375487C697A5BFF9B13E10640B

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

73653287BC5095A98560752C0CF943BB95349EDB674B17B8D25FEDF80A0CF9C3AB7FA6423319DF824298F782B5DE2C9E86D69C60861565F28140193D94FA2502

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

12AC8094546C50FB0BE85869FE563B67242EADD593ECFD805F43DB0DF8AC84BA37E5F51B70068C857CD1786788AA01A8BB9AC7CD98AC04A535631E6AF01DE308