Type
CONTRACT
Validation date
2023-11-21 21:49:22 UTC
Fee
0 UCO

Code (868 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700610540 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 >= 1700610540
]

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 < 1700610540,
  content: Crypto.hash(String.to_hex(secret)) == 0xD35AA151654B73BBE14693225D81E0A301051846290BEB6FC887757CB249CECA
]

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: 1700610540,
    secret_hash: 0xD35AA151654B73BBE14693225D81E0A301051846290BEB6FC887757CB249CECA,
    secret_hash_signature: [
      r: 0xA4282213527276626F04DAB442EC5417FCB80AE814AD94FACFF925988A07B254,
      s: 0x7F5B9758C8CB1DD98CB39DBFC57C453672FE1C3BFB964CA8A8EEC1B369C3499F,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    38825FE2831C8F860CD143F3F5F5A1FD929C373A59B8018FCEA62D535B210BCF7553CEC761E5DB488AE9514735DA83FA6E904FACED64C95DCA6AE52F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001CC0EC877869BA342929155232D67D038184B5E1BF86B226504CCBFB34CBB0C29

Previous signature

5CC13F8DDCB4A4096F9A48218FA9F7200AB9E4152DC3EB3C5F53CA5F690DE99201E6AAAC6C3AEF8089B559F9C131FAC298620800154F5F5634F3AAFCA14E4406

Origin signature

3046022100FA1581DB0C03D47CD5B0C128CEDDE8CDA6B6D4A91F3BE896717A59F627B59AAD022100EB1C0F0F033C2F0FF83E0C659572303B6A2083D83484057E3AE135D3A1F8D160

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

007E5C981E369658E0883E49DF13C9C55F29823A5046B3B69D42A97682B1CD1814

Coordinator signature

8C2122B6773582599D5F0AC26D3B3FB7D8910AA5A660248CFB416BF8D5E928E1FE310E6ED2E6F52A386A823F80E10D49B83DB38EBEC3A3ED8D8F1499BBDB9904

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

D0DF1CF458C6B0201660C944560898C61EF28C61A2C891531D700E8691EDE086CAAA26AF86C9191811DFAD721FEEAB8EF96F00825C924F4086A2E0C5D8A4B907

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

D79735FA7A1219C1F422626F6801890F8B1B6AA57838D29DE9C1287CEA2D9632DCBF18A30B2F61C67750CD7C837556137396E0762FF36B16DB345A322FF63900