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

Code (869 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 149.55,
    end_time: 1701361800,
    secret_hash: 0xC85812254980884D7B5F426C13BDBBCC931FCD348F928F2358B067D645D14E98,
    secret_hash_signature: [
      r: 0x7645A63981DA0B371CC3F5813BFD278F6E3EA82657D8A4ECC3851388F7A7EA41,
      s: 0x2DC972E7EB843B32C86DA6AFC0A1465F69FF0FB85D5952ABCCB6C69D9280E0E7,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    849DD6C7D63794A958272D22A60C42E7D7E9092BD3F4712E1C83A4DD720D8E4B88A29BCF3E85AEC328D42C3E8AABD85BC045FBC6B09C1A4A543B872A

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00016FC6957452577F2405F1C62BAA4FD204D73955FD3CA6C46048FDA63BFE7B6C1C

Previous signature

77B56004A7B6237FBC24BA39B32D9FB791CE1B4B1F4681B3F5C2C7F638F5EE63BA710F4A88433723213AE6FC59CA5CD60590BB1CC169BB77A1378277007F2609

Origin signature

3045022010883C0BA86B7AEF357136452D21647B44CB314BCD3B9E7DA73BC9071A4F623D022100C62DFD1C3DD5A08C2A1B27E59B5406533D1C31EEF2E22209E3572B8B9DCEF1CD

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00075E9B83FB07A785452FC6A258A7A3E47BF0AFEC8F186E2DA93E2E09DB0C2FCA

Coordinator signature

1809420EB89DDB26AC952D68B31CAAEC3F8178E9B0D6C03CB1B38713CB656C4FBE3413BA4D8790ED865A35630D65A7CA905BD5797D99526D459FC9CF11913C06

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

1AD838C9A51B75CEE195100597E3DFC6ADDFC20A24CFA92584D23034565646BEC5AD5FE02A730B7620273F7FF41248C30F722B86086D65E11B623FE57D9E830F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

80FD648BD9413B5410E400A665FA15A8475AB5E3DF856F193AC0DD77D5DAAA6DA5E734A03EFBA220A9A07CE7BB86E03B3AC2883781E4EB8E2316D3463A44C70E