Type
CONTRACT
Validation date
2023-12-11 07:14:16 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 4.7856,
    end_time: 1702286040,
    secret_hash: 0x8224C1F740652A9B1D16667EBA0FFC05FE951EF439C4BC38427C910C295C7BDF,
    secret_hash_signature: [
      r: 0x7F8688619652C517EB0CE81089CEF1743628212FD5D78377C1405AA744B55049,
      s: 0x4FBC3788CCE578889400550144588751D9F8E301D2A57078CE69F64416B030A2,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    07EA7C494DA44BAEEB81AC315FAE52067323D70094ABFEE6045BD06249FDC03CD85F8F0F71AB65D7382236ACF5EC5EF542BAF0B6E6F247385255C124

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001FE0596AA0CC94AA688186894F4FF29F393EC913C7A5BAF398324456548DEC001

Previous signature

DFFB5155F905265DE2282654F9A727CF4FEC43A13D1C7D92801D3B1343F25625B4136C90F357100E948DB468684813D475306D8C801797E29EA6BA45CDC9E006

Origin signature

30440220652423EC9951B6750B96356C4695B0F93DA8312904A54AD4F6E7078C96FE1D73022075D4A5B6DBB24B2A1D2DECD7A5AF3AFFC5E9A2B2D54CE6F3109395B42F3CDBF8

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

00750B02A447C36DF2064CA10EC487DACFA462F2D9E88951C0FB9AB9A7D39E8F6E

Coordinator signature

4558253D92976C90B8AA4CFE3D8961FA7C815A16CFB23E94C56ECCD5483A5D07FD6A742569744309C4EFAC88B4DCF9FAA4E3288E9F8EB2E4E026D0014EDD7000

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

5C2B1A7234E094DBFDEB01C1FF172490FF5C03BD7B78B89E8EE1A5D5A214DDCE5BBC6068CE3AA89EBF90C6C8EF84EDCB5A305D9A6B6C1B2058AE113F98FBA306

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

DD85C19B5F92B3B2803E0145BF5E4650628E346D7028B75615EEDD656D106BC7F6B26CE04B75CA9B3B21A538FFB4ED4AB5B44DA53AF8EAEC30E6B377F2432A0F