Type
CONTRACT
Validation date
2023-11-14 10:07:39 UTC
Fee
0 UCO

Code (865 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.997,
    end_time: 1699963620,
    secret_hash: 0x9F669ACEC06FFA63CAED7145A00C4D9C63EFB53475839A533B89FF33BA4C0755,
    secret_hash_signature: [
      r: 0x2B907DF3610E5FB1DF03E1A6265BF73028FB3988DC391BE83C649FEA1673C972,
      s: 0x7F0059C97CB17BC1530BDFE1F62F11C2458B8724FB683CB7A6BCB6C5F21C5F0C,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    71EFD9788F13E37BFC6D6F53890EB21A2BACF3A7FF9733B89BA0A3F6DF82BFD67D4A81CB2B7F5A6CB6573E07FDDF5733D9072A63C39C701F718F315C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001492B52EFCA82D252C051CD1D4A77C0479AC65949826FA2E1B6309766CDAF1CF6

Previous signature

44718079DF19170E88AD0BCDAA045D77A7605DB3645208699C0939AD6D836A4256494DCC1449F44BB5A12ADA0FDA1CC1A7D6DCF9DB11386F5034791ED16FF902

Origin signature

3045022100A62AFDB29D35C54A15E173127E8B896910F40900B0E489BE34F85825A0F65692022010A82EFC84065CCD6F7211B746EFFAB4393FFB844AF1694C061F805F5949173C

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00FC6C53B056FCE6D4F38D9B4EDF5D63B1425711E5D89CC8DAE48844550DEE4CC3

Coordinator signature

65684B0FC55AA975A0BC95EECCCCA0F8A3ABB567318C00CD131829F169805F97C2C4CE02C30F15A52A36E0E3E4F4BE9544FCA43073BC9EA8A8B256715754F809

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

E28E8A29E018493B1BA3FD4A1E784F9135480363DC6179A9912155B4810E4AC8DCE6B5998DA120003CA652D81630B882FBE780E848DDD87B8E4862272304C40C

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

1869D666024A302BF6E3786089FCDDE06390819E49D051C0EA75AC6F0B5EF7DE68DB30D0F9BBE31BC5CB68AA6BCB87760F38C14B04BDF9877F05FA8AE8478D02