Type
CONTRACT
Validation date
2023-10-30 15:21:13 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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: 1698686460,
    secret_hash: 0xA0BF5BBAE9538D09AA2EC9907FE22FB68E2675A9015A8FB9F79F11EFDC2C933D,
    secret_hash_signature: [
      r: 0xEEE7A9244E649A824888CEF9D50FD7F636562E5B32F252326E1F5A8D45DC94C4,
      s: 0x6DF7C44BD42DFFF3591BFE77E63056708E6CFAC79304831163BDD694DC41512F,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    3A7F0E269A2E9F75F24B24AE9CBF21EE2AF135849C3B2740CC2C09F6852A90BFD8D1C25EDC8851ABFACE3079F6E1780080BB5045AA7922229242FF5B

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000196F9E383118A07EE9EC8E6426DC24BC531971BD904FF783EB6AE98D751DF727B

Previous signature

961F5797BD63DAF5926DB70D5D961AD85777A1030EA21F8FCDC4D81A8990CB44F842AD1E3BB445B372DAB040A3A734775AE5B47488B362D766CD3B7D8679B509

Origin signature

3044022036FF3F031C22443BD3721E243910677864EF4D1D27807435C9015FEDC63165B902204A4B4A7F94A40B45A103C1DCA94D68833D4B5ECADBDA8B9D599267EB56D263C1

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00868DD9454EE9497A589E8EDB10B4C738373F4BF24A09B37AF84BF6A0989A5E30

Coordinator signature

8143716484A2CF9990C8307442AD1316295A0B78C732905337C9716A39FE5A0AE5B2203ABE4E12F0F51CC46632502A0DF751A261E19D86251AC0ED2B9017D902

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

906F6376F5C05E6610EC1A761D33617357EB8D252320636EF5A7A985C9A3DFE78EEEDDAF6938DFB4BADDDDD336E065939E0BB95F6B64FECC1C8269D6A52F1E0E

Validator #2 public key

00011ED0B570D680BE5ECD58D2D121689DA73C46DCB38A01C6E10D06286040ADE30A

Validator #2 signature

D583617080E64C94BA2DD5770BD8EF39728A4B7C38423C6163C5F5DA4A3C9958DF5846F05B94863B83921F2CF568E65F27E353DA580DF93D6605CA659D4F4B03