Type
CONTRACT
Validation date
2023-12-09 15:05:45 UTC
Fee
0 UCO

Code (870 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 1.6949,
    end_time: 1702141500,
    secret_hash: 0x853AF0348D37024327EF839F25304560B5D4F32F2905136EC791DBBDE03A59EF,
    secret_hash_signature: [
      r: 0x823367C9E7CCED6D72DA67C71C6D7DCE8F3706CC279AAAF378EF7B8B0FA512EC,
      s: 0x2678110282480ADEB789E0F38D4BDB960AD4F907D71FB9D7582500DB9FE8743B,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    17FF04C230C03CE6923499CA7D0DFF09536E364541AD67E352E36186DBCB3E679170D8930D631DD0F85191A909614D2C669659834A8A07A4F2572C44

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001E29E01D766C2ADE86CFC3D0D6E07DC37B526BFAD8FA6EE287C7F14321C72A601

Previous signature

A8F7A53F0540A8A501962A6ADF654C4E8610AB1C1C29B6CCB469F4FC6070D1A2B18913F04CC5D4141C3679DE74CFFF74493AD7235B00BE4058CC8D9B581A650D

Origin signature

3045022023F6ECC8E9BD1E8636033F5C95EB0375E53CF572DFAC63ABFC7D1FBEE82664DA022100C66790490CE14399F0E7E584A751FDD938648F26BCC8FAEEF2EBDE33B5E1FDAC

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

00DD891F13F6A8CFAA907DBCF4B085AE22DBEFD4952556535AC6361A601B3C5A5D

Coordinator signature

DBE8C0E09F8BD239330E9F176F6E90D26F171BED9778C1D20E3E11DBC7837ADF30805A297F881CACBCEB22613AEE6CA281A4000CBADDB3DFF8983E283B61A906

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

749B92C00F038FC54EF659D81F5305027CA854E8B60B5D8CBC1D321805245FA9343F1EA4914507957FECFDE71B53882AD5A348AF964CA9B231D8812446FC8B0C

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

7B2B66D52C65817FDFFCE0D74EBFD4EE49997D09CE03DBD47D224CC511CAA86B03487830BF3E2D42DC4BD38ECB3566AFBF934A0C9B15D8DC799BEAD2EE620B03