Type
CONTRACT
Validation date
2023-11-21 20:24:43 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1700605440,
    secret_hash: 0xBC55205C626023F94F08FB484A8A42B386EC991151EAC17252F5F5D4BFBEDEC8,
    secret_hash_signature: [
      r: 0x332195103915C0B635B26ADFEE1829D89E5D732179D41BD21CE6E9622CCB7BE2,
      s: 0x0227794323D2DBD1F485348A229AEA31722F163259C313B522F32F7EA8853C68,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    61B01782955DEE8539EF1E11111292BC206EED2707425A6041837AC0E6B5081198D400ACA541370A683F96C419750AFD553BF264BED272D207903DD2

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00018F26AEF583B019D36C1A056F1058164F54A681CF23FAE1B40C8FFCE08E4192B8

Previous signature

88B9995CF197F91AEBE1EFF05F2D97B9D8854D8AFE38950120F30AFB2EADC6B0F493358AC3EC7F905158FB6B1C8261D33B5EB57CF2E8F830742D0E3B2F656603

Origin signature

304502207E5D0307151CDF74776359B30DB392FA461C6131512721599EA924D68F554226022100ECB63B3CD8BF9DB5C1045CB7179602D0C57E813B540F9F84C502E848227C6D00

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

009F773BAE074E0A511BB325A89B0864CF71C802C9ABBAD096622279D111210247

Coordinator signature

202EA851C8CABE8149D246A7035C6A8D1ADA1A1F5D607210632B1A9E0A314A213E30597CD2EF64B91B312A47EAFA76C42E03725FE3B3AA756D1A0DFC480B0209

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

83B6315F9B8741D394E6C9424F4E5C6E3E39930DFC9BC512CE04ED383243DDDBC95384F59A3ABCC5108ED292B55010EE553D991B62817C0615D131B6FA456A0F

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

D73A980C91F075883AD5CC7B8F2E90C91DA3C8DA2E18CF70D58987581908F40649F89FA1DF42F550A55059933CAC4046BD042B1A878672E0E572DA0C6009AA05