Type
CONTRACT
Validation date
2023-12-07 12:39:34 UTC
Fee
0 UCO

Code (934 B)

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

end

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

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

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.03461637, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.0416e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.03461637,
    end_time: 1701959940,
    secret_hash: 0xA6315FA9373015B928193B4156644E59156341AD79360B5537EC109E3BE88EFF,
    secret_hash_signature: [
      r: 0xA8AED2DCF561FC5E88615CAF65A68AE632A62F717C9AFBB59AE3E4688E500A60,
      s: 0x199C5CDAD7DCE07C721CDA87356BDC935796BAEB57409DE7FFD07DF2E3EC3572,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F36A9E09F09798BA737C6225773425EEFDE35167E9B11F93CF33BF102572D75DB7C620BB6FEC2114A34D933C244A7F3082E694E7CFE6BDB9620EE2CA

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001BD57A15FB6D5381DA029C2E108EB1FFABA26AA867298145C466C856D5FE5F4E6

Previous signature

67B6D489C79511C1C765C00C0AB6D4A3303B9737E4941B2AE253EEEC4BF38993723278D1DF77AC1EB52712B5ABE16D4DEC3DFE073D968C2F755C608268273709

Origin signature

3046022100A68341E65DFA27EC475D89B37E28F9C3A596E63FF20D5BAF5A5D58447A8D5B81022100A59DC78C909780022C864607B999D22DDE6B1E430801A079F39A5E39E1FAEB00

Proof of work

01010484B78F4110D8E9D6FBEC72759895CC9D4532177314FBAA8B07BC525FC1AF48F150EFBF104B1819106B8E3563CD0E1FAAE5325F8FCFE58FF744C35F47669D2704

Proof of integrity

008F344B9AD5DAD6357858F04BB1DB9BCD2E6C39397A4226F2FBEC702DE873E94D

Coordinator signature

C8D6DAD7D72661EC2E095393213A64CD1C3127C7A19582BF08FC89728E9F8061CBB52AA6C39D52599A98C330A5BC05914B7F3F9D79E8FD2A1C47CBEAF0547308

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

8720D5D4B537543DB2F607EF34C2FB22803031548E0ECF0ED3769871B0DDAE4C92F25A0D3A043A7F6797B4A21AEB63B94285E554242D3544A657E7B6E7F6130B

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

6623090FE2282C3DB207C9361D39620B8E98E4C190E284F5F7BD4CCB2B9CFECB5342ED6279FD64A46AFF61C82D67DF866B81EC855D232F48D10949D62D92B803