Type
CONTRACT
Validation date
2023-12-16 18:43:44 UTC
Fee
0 UCO

Code (868 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 89.73,
    end_time: 1702759380,
    secret_hash: 0x502F53E00B15CEE409E6799403FA848152EB7BED73DD0D0AA9057F53133B192F,
    secret_hash_signature: [
      r: 0x29C0102D62300A0B7D244CE8DF68B9BBA46372CE1F7541F69F30B0E1D682CA08,
      s: 0x6709A53181D1C93CAC678C0024C5F87B88445D011DC4CE51C965C6AB3D8DAAF5,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    01384C896C3938695B7945548A2E543470EAC77CE62E3A05C7CA1DC6018F5EA0F791F357D482D66C29E1FB0CBD5A43C3B4F53617F419B857C402C011

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000177FFC0826F4EFB989388C4DA208802E7C22AA0AB9F53825188CAAC9632C34A74

Previous signature

38DA6271100CA98E782AB90BB499F241C50E598EC37FB8B69F6967ED47D4A5601682BC6C73A0A773C3FA579A9832682C5AB66BA9F6DBD9FD326D50942BE8EC08

Origin signature

3045022100A84E5AC162960C8FD5FAF90FC3E8F9F5897DDD4D3BA2B4EDF5547C9FA67ECF5E02203C02C7093E743B3FF321E6EAF05A32EAAC0D47B06957DF47E30157B58A6697AE

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

003A8B67234CF32AE4C6D6A4300DD05005443B447AE8BEED3159800D8447C4486E

Coordinator signature

6054E3137B51CA911E147455374AD31B927D46B45F831E64F3B21261C7D3ED5F550CB85B37DC4BC672A56B3B907636D25F194F353589CC58FF97D3410A6BDD06

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

D6086114461B52CF2CFF4B546D2FA77F7B3EFE94BD2D654DA8D9732BCD41E715303190B38F05FB73A8DEEECD66A34DF699B2BE2C1C1D2AEC3A81F41F8D97FF07

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

3CEA93BC0441FB744698172A2C19E4993C96E132A290E7D8562E6638E5555AD36D19DA08340CC07207A8B69A0FCEDD86BAF6212B45F2C48F71F6C7A6F13AC505