Type
CONTRACT
Validation date
2023-11-30 22:48:18 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 49.85,
    end_time: 1701391680,
    secret_hash: 0x6158F2FB6890D584BD5703D9203955627EB86406EFD878E5C86E7622928FE1EB,
    secret_hash_signature: [
      r: 0x27C4961AAAA83417B2A94103BB5E96064299F32E9047929B049DD3085C8B58E1,
      s: 0x6D9BB30195227244653FF3DF9B5E546397FD076BE3018FD9386006E7488A8FC8,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    CFEC19518AF926293F2B4553B78A8ACAB46744DF0DF949A8F262A2F7C433C7DD35E26611958A08F3948413EDCFB104B0545D58C02633A0E60B4E01BE

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00019A0EF612CB95B86878BC70F10E3FEB76E5F872B6D6ED58B55D83433351D65034

Previous signature

63C534B575FCB9B765B9C8FEF190DE1E58966B2587C0692BE855B4E46D2F01C579C3A37D19954C781B7657CB42771B0D5C71D50ED0C500E02A61A1CEAA91B105

Origin signature

3044022019967961A5DF3D0D192697D66DB8C6FF4A8436CEDC4891C0ABCC5DABB344AFC8022049B9F97FEF452E9E33EF01B98AD1A6690A60B0495151B12813F7F50D1440D3CC

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00E2558D18ACAAC835B51D90C7975B57E7CC21DD7802F00CF6F744B2664CC2DB9B

Coordinator signature

70FC5321E33C16181C17F0F55DAFC29EC8D2B98BE1E0EF1B046A699E0228D781D55548A64E337B429659A3CCB6C5AC58ACFE479D1D537DAB2394B98D92FDC90D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

0440C226C6C08B02D88F671A1C04382C6BA2E35C0A1F6ADC2D19479384A6E0E6FE32B58127FEA57416B9742CBD55B4312D817BCDFD7F0E1D7F17844C47855605

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

2A390040E83C02FDEA7B33DC365770D8315DBEF3148CFA1D9B8995F3707EA7C96ABDC513A230C4ACE53E1AFE275F1C2C75C652BEE8C70FAFF1B389765208E90D