Type
CONTRACT
Validation date
2023-12-11 10:19:43 UTC
Fee
0 UCO

Code (863 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97,
    end_time: 1702297140,
    secret_hash: 0x3960CE664AD4552E5927059BA952560062A4702140D36B4C09E4810F5FE6A3ED,
    secret_hash_signature: [
      r: 0x68E8D11591F2D254D6203302675FE2EFC659849F88C754B8784370DBDDDF13E6,
      s: 0x67D676DE863EDD64B6910D23540C99789E5BBCE10B491E0571D9AC31745C8FB8,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    129B09A19343EED5E6E2969276D93E0E5297DE98D7EE358C6913E560AB4AC58E86AC24F77237744CCED70C9801DF725FE3D660E32E240187D9BBD28D

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001A10541FEDF791E7F224C562EFEE2539050CFB3EADD55EF11C44E899377502443

Previous signature

5BDC7A3F5875FF500EEE108C3B8CB8F393F57AD283B39CEE3C5118766C35FF69C5BB2D4F5757E2AA3E62426FD26C7A0CBCC05FFCF9C4DF49BD2B7CA8F9BE9F01

Origin signature

3045022100D0A22AABA97C5FF595FD7B61AC17A5703F868849EB1A542E0C42FE5517AD8D8B0220397E4F6C82584BFB60F8B121D1AF8A26606E7FA2A606475CC1FB9485C91A6BA1

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

000C3AD2002A9439ED2F78FA94DAC507D5CE9260FDA59823FB17DD707443849B83

Coordinator signature

608118C232E11A50D8E830663E36FA86F1FFB367A366BE6CA8DCBD9F3ED61291E16E4CACA91B87A158C1EA6C4F20586EF31A5F5D7B0422667B05DCCA83AB960E

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

FF338C1D012E5B0098F00E45B96365E67208D298A231BF52E46324BECE7FEDC9EFAC2A26130D4E763CC8B688A6F0568ECF50FB5EAC4CFEC50B436A544D5F4500

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

6DAE17930642CA49765357878A7B8E10A910DE233C0868FF3097D9283028E400BE67DEBCFC3776EAC9FFBAC10AC0474A35AB705B16A623E5DFF8F6AD9CCB8E0E