Type
CONTRACT
Validation date
2023-10-25 17:40:25 UTC
Fee
0 UCO

Code (871 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1698262800,
    secret_hash: 0xE903BBCE63D99D1D51E2CE25E1239446BC62908A18DCAC6ED12A5B52E2493816,
    secret_hash_signature: [
      r: 0x9F38CF741CCA8CF703B38509DFA96B1F10851C601E887A3850ADA8CF43005A4B,
      s: 0x1293AD60EF55ABC90A4011C885590355F65B24BD651AAE634EB7CBFB1CFA6861,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    1150379626DE5B3BF9A5348E63FDEF6D0016C162869661B50654C1AF62BE6137730D5C9D63BE36A25031E08E71CF8CE214002BF791EFAC3C53368269

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001A0DDC924D9A1150A102C04FC654458C73F935533D7620D6B24527D8660B8248C

Previous signature

BA71BBE7CDAEB0B657B532C85BFB0AAC941EE65A5D7FAFFD8AF981EBA3B5B782EA662EB436E85B0DD4E0FDBB3E35F7A1C4CE5E4B1EDDBF222E93E9622FD59709

Origin signature

30450221009DCD2F42E4F45952A8C936DFABD8686ADD1E8F6B801A92301BAC661A7DE430E8022012A5C8B3DD83EC7CEA0D771BEF8E692C93376ED5FD64E910AB175B0C3EC5F11A

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00EA4561B718BF9D11F0991461EF957DF2A46CCFA0118029F7AD10E1950D1588FC

Coordinator signature

AC57EA43B4BD5DA7CFFFA04A37AE33B32A84504B1F8D0CE8823AB6FA32E00707D6A8D2277795E59C572B134479B26C7C02C64EACA2D584A001172ABE5544260A

Validator #1 public key

0001500FBE298B79FFBDD5CCA1798F30FD88A53D26EC39DE5DDE1F4137B032A4BC34

Validator #1 signature

D3E00FE22415A08DE731DF929A85E3E2F9C3A84E6C870A7071F53049E858ABCD5CF019519B41EBDA117DC18748A6C9DBDFFF54E19A0FF794F521DE1DCC3D580C

Validator #2 public key

00018A312AFA617E98B343D09AD2E73F0AB661DB0A59FB986D5DB8CE7664E14C25FC

Validator #2 signature

94BC77BFFB06E336F5E714607BAB12BF633CEF611FCBEC127B3E76AC0C58C64C4E1697F854334A9E8605405621B90633D32C53FEE940A15B0B3C36B0813D920A