Type
CONTRACT
Validation date
2023-11-21 07:27:25 UTC
Fee
0 UCO

Code (876 B)

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

end

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

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

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.97e-4
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-6

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1700558820,
    secret_hash: 0xE2B09A56D2588665C5212F8D11B7E17603AA3F7093903806D9A0F54D02A08D47,
    secret_hash_signature: [
      r: 0x476B37D59A741918B61B96132328A8BBE9E1591CF6CDDF378F8282EAAFF1234E,
      s: 0x2B7644048B9A432111A3F19ABC7DF6E4D7A6736AC3BE316ED4DEB74A7091A5E5,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    6C44CA232C0419A256B8F8B251C95C520D214F749D5E8546AB7EAF1A857893B23AD5131BCB9577B035545AD2EF7EB04CB923F25416AB25BE939B5016

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001A8D47E0F476291117EF87D1E08802F5185B88B1771121EFB29C851C0F1DDF508

Previous signature

AED38EAC3F015440BDD2A67176987978060B928375C7621CFF6043F74472F0AA4A4DD414AD022E77F88AEC06295A9127B0A5BD9F8CBD270EE19CCCDE003F730C

Origin signature

304502203164DAE60F239BB2069357F400B02460AEF624AC1078C70BBCAD56336C9DCF5C02210096D7DD2DB1EB36191AC55192EEEA75B598B79583C00B96938F3F68A6D4E584C5

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

000FD47447D45D385082C7B0AF811D166526B95419BC40EB519896237AE195CE0A

Coordinator signature

81D37E046D5CE3BF29B97E3118AFE3543586AAC649A436947D2EDC6067C4C54BD866840E5BE8C63DA97BB3595080CC8171AFEB7D51A7A3414D3CB031FF18EE04

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

A60B8A3E3B061F674D3F204BF2D1C26EAD34834F9A002DC02DB9356F15A06C826D71AAC72462D50D8101BDB8CFEF4A4C3AD83A370F8B6317AD86786475A93A0A

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

9D4E1A9B05E624062C72BF17E7C7298FF3DEEC7C6CE983305A18E6A02F9FB42BE289B80E09C390827F20E030C9848D2599C5CD978873B08871FD60C250369509