Type
CONTRACT
Validation date
2023-12-14 05:27:39 UTC
Fee
0 UCO

Code (866 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 5.982,
    end_time: 1702538820,
    secret_hash: 0x75F05C2B58FBC1E9962939F6F5A27D96B1212E63A311B697982F74BF06EBF323,
    secret_hash_signature: [
      r: 0xB2CBCA04126F6C981D356BF10A4DE0F513D8E3EBF961DEDAEF181A9518F1BE5A,
      s: 0x2FBDA85842EACBC6DA474970A3BA0247C00D0B5AEC2B6163533924E8E3FACC8A,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F2F306D998E912EABAD3FC79CFA4E4D031E6A9C56BDB8A2B3DB6E9CAFB6961301FF8B57F75367B10FC5E762ADB7C42E55BAFFB15D2725E78BD95732C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001447BEE8D402A3A8B5BC2E4861A94B92C705BEA9F783A71DC3A73C60FF767F381

Previous signature

AF860EC99CDF8AF35AAE2479A762383C45BFFD67F1D4AE84E0136831F5E33401EB88FE2911A2FAFD996A1418CA41A1D2CAB925E76EB3693C43DA28430753C509

Origin signature

304502207472CF0BA7A5EED5E99B49304AD808FE43197224681E8B18839BB278D752F494022100BD8D273FCE89D6E87F3F3869AA293A249FB240A650F9AFA1D0196DB39BD2C047

Proof of work

01010484B78F4110D8E9D6FBEC72759895CC9D4532177314FBAA8B07BC525FC1AF48F150EFBF104B1819106B8E3563CD0E1FAAE5325F8FCFE58FF744C35F47669D2704

Proof of integrity

00F763A6B8C963956E397D7D1D4F8235BA166625C5BF0B4BBA1D11C304EFC1AAB0

Coordinator signature

609837EB4A8E693AB64E41E064E7A2C650B79923D6A5A9FBBB1494311A14AD37D0905DABF6E48A8680E91F5CB409987BB0B012DD201355A5073A79C94AC82D0F

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

360807C2A7BF2857694B683105E69A120230013308334241F0A8D559904709E98BEC8519706026BCECF7B6EEC069194BBF136D45ECB7A06E70316372462AF30F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

F4D53C53E02A2B57CB5E487099E5BBF882ADD4682D1F9C069D34B9067D08A4FA77CFE6FC688EF04E85D2AEDC12429B0BA237F6B838F92D55350701760B5BB40F