Type
CONTRACT
Validation date
2023-11-22 02:26:47 UTC
Fee
0 UCO

Code (932 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700627160 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.01, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.01, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
),
  timestamp: transaction.timestamp < 1700627160,
  content: Crypto.hash(String.to_hex(secret)) == 0x8D338728E66BBFE591D465576E8D9150F7737EACD3A091A71530C03D33C38765
]

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_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.00997, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.00997,
    end_time: 1700627160,
    secret_hash: 0x8D338728E66BBFE591D465576E8D9150F7737EACD3A091A71530C03D33C38765,
    secret_hash_signature: [
      r: 0x22ACCE8F219938FBF1FDCFCB8ED6272C2D0B627BA6F4C22EC6A377F5FABF2E80,
      s: 0x416CD1029B6F964460831D20525244A33E62DD705DCCE103999FE3BF080B89FF,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    C0833D9D24519E73CE297AF35424E16328F31EA02401AE0F61132932D77A65485A037607C02D4F560AED436982C1A3607912EA72699E8504318C4353

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00018267E4E48E6B95F47DDB4FBFCE6A407F4476583C00F8ABFFE8B2A7415563FEBF

Previous signature

FC279D2A0394962967B87FC5F18910A4F3D7941C2B69455869D1FC5D1CDDD150C5D3FCE134F8DB24B0455AA293511421681338A4FD108971BAD103275A0B760B

Origin signature

304502204C902557A600036698247E494A4D23052A6AC816F5DB3F38C36E7801EF8DE38E022100C2FDB6D11C6752BF43F5E7D58880B5BF7F075C21EFF9557F68479ED1677895BA

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00692D51B9483DC41E78238A500C5360B1B20988E5C79362129D26CA27F9F94435

Coordinator signature

A742695E4F2C071C5D2F3C7BE088B6AB0B00038CE58CFE2F5653CB72F691CAC0FEF0CF75F7A46A01FFB09E5F20D134BEDA636A946432A2D2226E15DCF689470C

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

F9A9781749CF35B00BF570EBF880BFF2C07CC33CF007279303E07EC04A14A6F667CAFDD2790BF983B6168F0BF1AE8B57DF40944FA2708B0AEAFA321CC83DAD06

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

93BA0E26FBA991A2C094E9F11C541DD7E0A65B02B76DC8D77D7BA8CAAB5D0F94C71F72ECB80C1E4DDB0D1AFC7A08931B3D090C95A2CA64EA5D5532C5BA68530E