Type
CONTRACT
Validation date
2023-11-29 21:03:13 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 99.7,
    end_time: 1701298980,
    secret_hash: 0xC370B9E9DE863D49A4613D3831CE1D40DFA2F051E5905321A443C9A5FB6DD33F,
    secret_hash_signature: [
      r: 0xEA7E2706E71DF27F0960A0F644398D2EB60F921635AC280E9AEA52CD9C94CE56,
      s: 0x74612C900B591AA359A0BE777199AD726E66D77F32E6A0BCD8C88AC36B6E4947,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    DA08C491552FC5F36F9BF94B4CEEAEDB9FA280CD4097F7EBCE4F4C27D5CF645C81C7C6A752396B332A8A690EB763963E2D4D06056A181E1D662FAD92

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00019B4F5A9638A1FF4205FD5641F9262F542C765B96DFB0E7EF5ED17E82D7AEEBAF

Previous signature

CF82C47051DC557CC51D5E624DB75286DDCD8D82C489AEDA2AF40B41940371215E1C66B768475536F52CBC13A2DD32223FA8FB2D036063257569A98729A8F902

Origin signature

3046022100AD9F581D43059ACBCECA15C94BE575B5436181D8BF0677D5BDCCB826C2DA99B4022100F9806CA9F9843D3E1953E734DB8A11AA9EA11335B584ADA30FDFEF0C5FC669B8

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00B1ABC11192467EDF84108598EE47EC8F18861975B6EC63D61FB2F0014EC446EB

Coordinator signature

CD5052E5D2F306F942F7DF5E2FC88AB32458BBA449E7FECC2D73C4DAF52AB7D74586D03C085F00372BCDF55CA943D515393FD26D285E8F95FC39176DC6A26005

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

4DBE9EE3F5EEBC261577EEC8AE86E4FDBA353582FCE27A0CD82F3C51E06BF708AA2C1004D0610C8AEAFF0A78150A330E2C314FDA46BCC54AE7EAE0714746720A

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

960F27B926CB9377264492E525D1126273DAD6757FFA68A7D251EFF9D516402838C010F6D4406A9C21ECD267F779615584DE8D4A62548A72902B7D2286DEA10F