Type
CONTRACT
Validation date
2023-11-22 00:31:18 UTC
Fee
0 UCO

Code (867 B)

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

end

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

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

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: 1700620260,
    secret_hash: 0x0DBB5B129AE396EA92D90C6B8A1BC93D96C9873086481000817B93AF1AA01125,
    secret_hash_signature: [
      r: 0x82555C0468881169454412616CF72F0BA3172007CA8BE5536F6A168AA7DB0F32,
      s: 0x18D7C2A05F89E7C47420FE45DBE44A4CC1019C71B89DF573D2EAF308DDB40922,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    7AE9456A7E5DE702B89D2B47F0E0515A582B1FB05D1E758215EC6B967558A0345DC526F393AA92AF3024A819BFB1448535C0A9F8C05EC288630366B4

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00017DEC5B9790A5DB6F1F1B918676D9312D0ABE8E697C75487AD92FC9D3F9D68F63

Previous signature

A90056A80EFC6840D09C7B63B6ADCCBDBACD4265BD8478609B8B169878DEE840F2ECDAB1BFC61618D975094A907B071D1FF204F65502EAABC81D95C406D3C109

Origin signature

3045022028F74EA08C81007E7A7F0CEEA33D05E2A22CB0B8086CC96B8FBF1821C60DC2DF0221008542E720189D4D7D4A14DDAA0B64133B524FCC0684B2EDA787AB4A17298431B9

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00AE0FA948DEBA37F1C524FD31E04DF89D08CB259B2DA7C603CCD16986190DBE62

Coordinator signature

7FFB87E28F5600EF16EEDE93EBE44F360D2F092E26B3CA6B339C51044F892D0AB1887DBE1A1056C4F680315D280B3B2D6675BB2BD488CF62D93E9046C7CA9806

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

27E9E3CD4BB51C8EBBAE1646813E488C599C6ADD075CE36DEA1B3A32609FD6F17BEF2B39D79095FB1E433DDA6B516F8748449EB1A2FC8A7C838A128F476C3705

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

E2014615460B57B5DCFD648EAAB9685AFF293DCDD18009C4E5B1D41AF685306733CE8A14091F49458C137522E535E5290791C1D854BE3101DA1D77D8AAD5A10D