Type
CONTRACT
Validation date
2023-11-15 16:05:59 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 19.94,
    end_time: 1700071500,
    secret_hash: 0xA7142DE428C8B0A81012CEF53AB836E2BB990C9BE99FDF58ECB85D4D1894F621,
    secret_hash_signature: [
      r: 0x8188B3E50D41747056BD292405931C629B04DD4F070C95E8812C5CC2A8668068,
      s: 0x4A90CD3B1587C9607D7AC2D59A21482A380E0E924E3350A1EEFDF080D94F6F3B,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    9224811DB38BCAB535C473C548BBF55C4DE0D11CC677581639F58A5AE60DCF29AFD1AB4C33918CE30F3B2923C253F08776F31FB19417E1CFB0856A2E

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000148F7C91775A6354EA58B82E350469CF953224C36446BC0B89F446A9C24DE7073

Previous signature

7A7FEA345C6FA9EA2FE46F50EE0CCD05A6E2270F58AD09D44820A4D6AFA936B669FC9A0230A7C1C581D5CF597B4173910D73C356D6667FA590C230D97D2FFB07

Origin signature

3045022100E4DAC036DB578941BF8838D3954CCD4EF2870A887F4B760A9177EEFA129A9B55022043CC8E71636EA83D0ADA05F0B373B7D500FF0C02AF18508885B965BBCAF504CA

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

005185635E706C61B0A6AB37194B251FF632932A0B68C790C8F1AB6B3F10EC9338

Coordinator signature

478DBA4233B827F91A0F087110E055449D9E6D074D5984CDEA7BFB335FEEFB1D4C7842FEEC8245A28183AEE709166B2C014E8EA68539DC9A79D4BE9C1216FA0E

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

50DC00A727E44AB6FBA8F47F9BAAF947BA23F8FE1A98CBBE13F33E763B77ADB1A1C4387E4BD564000897D91EBF4D76BACF255A55E73E0B30B730E4D661DE8D00

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

2ADD1FD61F2DD718022838826D1E068A0E053305F906DECB5019D81E727D9EBAEC2E9077F8957614735B954291A51E02B217D9157F88AC01641EC4B365AD0501