Type
CONTRACT
Validation date
2023-12-11 05:50:59 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 5.982,
    end_time: 1702281000,
    secret_hash: 0x19BF42852BA49FCB1B3B4A15DFBCE98CF93EABAEF4BD7B6FCB29413C1B4FDDBA,
    secret_hash_signature: [
      r: 0x27C5150007CFDD556AA4FD6F2EA8F2CFEADC50AECCF5D42332A5130F347292A4,
      s: 0x5CE70877CFA26B4F1B0DEB31EF6D412E1AD355C4A35BBBAF511EC26715FE8E48,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    E33B0DFC970CEE6925CF70ED985E5AC7941067DD87F8F77FB66B4E57597BD02EAEE385E59AD31820556DD0C603F26887BC1354B94371C3AFC66920F4

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001A759E1DAB31997B330F9952C48D97B379BC89E4BFDEF4E81CE29A168214E03FB

Previous signature

5E3E59C9281E04225362CF15AEFD886B90652F0D84D23529404D9C3F080A950EEFEB6C7FC716544312B5E77374B055573DBC84DD17F453888C72B446335D3708

Origin signature

304402204BCEB2A2FEB3F6DE77982F7B37A38CB80A096784E205A522456F0A0D6CC28D1D02205E9BE7E15C102F35EBD056F587D2579DF14B24765DAE09EE51B92C4C7E9F4D75

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00CC94F8B18B4203F2CBDEB71921359B3672986FD1F9291FA50C52837FD7617112

Coordinator signature

F5DEAC0FA7E661F6DC6EC08F71843F5AE26B2F3291C6A751FA9B78CAF5F4FB6473370FA7947D99F96C533ABECF5847FE123A5563161B11051C36429AE624870F

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

50D9395EA887C77FBD03199C82BEBCCC3E7172AE62420A02CA27505A798D63014B2F9BD06E57E32CA34EC4BECB1D675218A7494B4B4ACFD9D06CA48E4F4B9A0E

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

2F244BE8B2D41501E2F05EB5474A661683483920737C7E6B24895FEB7CA676BB43657F02132362CDCEC0575C79881FE5FF1920761D39A9B86EC080AEED4BEE07