Type
CONTRACT
Validation date
2023-12-01 03:31:58 UTC
Fee
0 UCO

Code (869 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 99.7,
    end_time: 1701408660,
    secret_hash: 0x38AB80D9E05D16F387F3756150F2D3079D243668111C596EE41E4E86B840BCED,
    secret_hash_signature: [
      r: 0x791E31D1CEBAA953CA254FCEA829229BEC7020CF03C9DFFE136C1174601E85F0,
      s: 0x59AA3BEBDF3D5DFD61EE406F585C01020A3E7B8E060C0DAD7712A4EA550CBC7B,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    6209665AEDC78FC67F9467CBA025D04DB03F4F8D7A2757FBB2ED3BAEE32E8703015AF5FFB1AD4DBF886B0AB719B3DCD7BD88E78E71E3B0ADACF4A849

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001DABB8C674B739160DE83AC2AF4485B79DD1A9B32749132DA232F90C6D5D6CE1F

Previous signature

E10BE99E7171392FF284981EDAADFB0DD2A1C39B5B8067BC332D0CAF59B8AF55485EB51F9A41A5096C3F7AF38CF089D361009D105CA6A3985EA05EF695EC6D0C

Origin signature

3045022100F917E7B2F162E3AF41F9739717A6698CF3516DA094084E4CB44C68790A3C2CF702200E151A472292B2D63B2C9139455CC3416B7E6E998F9C98C4C429288A60246A58

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

009DA44B18E008443503B25BB8C15617414AF161D9C5F462F2B471B093095F3D0D

Coordinator signature

60811F8E760E8B3A43DEE73A6853FC90941B8073269A7C2F8AAFEA8379288E2D2F8FA6610CB48E75DD76AF53E1C5E9B63E4DE5B6D368094A63DD8921C1B4760C

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

6B80EC18216C800ACBAFCD0857E53818C9BC4524B4B566F90CF5968AF2F058561B3BE494E25115627A71A29455AEFFD1FA346A33E47E93307A4716996E91130B

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

290FF22B06FA4E5684B2292E53E76B6CA39CCFA00B674221D5AC28651B92F0892ACE1AFFE6F7352C227B6ECF38EC0A64D8D39A80CBCBCDAA352AEF3E20BE0F0D