Type
CONTRACT
Validation date
2023-11-22 02:24:51 UTC
Fee
0 UCO

Code (873 B)

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

end

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

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

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: 7.976e-4
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.4e-6

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 7.976e-4,
    end_time: 1700627040,
    secret_hash: 0x9183FEB29EA76662C4C41ADB1D1531A464E765589C36B57F3CE6563758B604C8,
    secret_hash_signature: [
      r: 0xE34D97E6EF916559B1F42537B9CD16E8FAC6F4E897874D00F214114D815106BB,
      s: 0x0129A387C73E270ABB83E6D21DC21C0E4BD1A989CC0EA58660D1237004AC5A76,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    302D324F7035F3D232CA501F8B6D676DA856588DF9AAEAD17E7EB6280FFF7E9EE79DA40A40BB591043C5497EEF55CAB70A66B910B7C87FB4A18E07D4

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001A738F611650B4A08C37EBB6F9937800D47468A92E7089CAAE6EEECDE3D094609

Previous signature

A5F1C7A2CB9E76C6826C53901FDB2835752A542F5D342B75469929D992BA4C42164577F13A46CB721A012FB3BA92C98CF11F139F9E76942D1E3D23958ACAA208

Origin signature

304502201A0DA098974E8337F703129B552F233B4CA0BFC187F3D2E14B7BAC3B4DBED07602210091C80FF2CBB1B78D1D3F2BE8D4CD3E28DC662B3636CF2E3F9DA552FF5DB57815

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

008A2D087A7BDFF364D8B53B22016EA38F84AE2925B4A8CE8E0530473AD9289778

Coordinator signature

1BC391EF35C0243F61B1CC09150C79A0EA537AD631AFECDB211ACB03BBC366C880EE7CF277E8348FE3D3D3A930B081A674D0DBE5F2E85A6D0EF9C35615C49D0E

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

DD7A6BF592D2F9044BB36FDAD6FD2EC18957BDC9AAA3A6E306276EBD900DBA1670BAEC7FDE7EF802679E58320092D6108EC786E8475BDB24B5457F95610BF606

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

657EABECF19109613AAE2DD58D6A15234F5795522B59FF170395299FD8C7E866D3AFA35981B34C1837371E4777FC88676301F180EF2C3BA653CFFB7EEE946503