Type
CONTRACT
Validation date
2023-11-16 12:08:23 UTC
Fee
0 UCO

Code (871 B)

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

end

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

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

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.006979
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.1e-5

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.006979,
    end_time: 1700143680,
    secret_hash: 0x2F937E24065ABAF48D2293EBBCF60ECA733CC334F24FE5CCCA8C5F1073512AB5,
    secret_hash_signature: [
      r: 0x4E5FEC8E71D23028B2F8C3053F0F39002A4E1920128E180852A1D71A56E7D501,
      s: 0x2790B3009A9B2CCDB883FD89FB87311D12C13D11C5BA839725A792CCBF031E06,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    AE71C4E2C6A30733C545E778FB3D6949C270AF33C2A2583D64E49C2574A50E383656C89D3BBA0FAEDB2100625AAC202DD9724384DB53F8E85978F3E3

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00019B66159051957B971CF6261DD45347C8138239C7766D35EC0DC9F3746D536264

Previous signature

392F8F61EBC55747FF2380FA412BFC693B1D482D1BAD1AB5FBA257A234C3CFA0E03D32017B2EE59149CF7E459057B91D68F4DB1B0A970E0F801608E8E30F7F07

Origin signature

304502202F9D9262BF0BF2A7BC83E158FA8463313A441BE6E7E321E37A59EE9BFECA2F1D022100E4FC960B691C6864CDC13122128C1859979A43353DE653B66BCBB5B0D21F5795

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

001D2DD3314C5972D487E5F6D9196AF98451457192B140ED4335DC0557E1B12300

Coordinator signature

2C0F73B2A7B830E3330B1987D3B8A367AE2243482592A638DB2093736E67BAB4C06CB379DD27E0B6CFC9DA3805DCC9E74657DF7958848E45E1FA3FD026641E04

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

212407E02187DED953931FB4F6BE99986216F98EA977CEDDA980E3A441DEDDB696F8F91D56A40C1330B97758B8543782D44ACFA7C07FDB4E849AEE3A51880E0E

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

E023B9E775EDC31CE9E62BCDE425854410A827BDF3091AE3463BCC971210932C153FE9E42CF9A53F43F7768CEEC90033A387FCF5625FE2963BB89FC37B5C4307