Type
CONTRACT
Validation date
2023-12-07 13:31:08 UTC
Fee
0 UCO

Code (937 B)

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

end

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

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

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.02967117, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 8.928e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.02967117,
    end_time: 1701963000,
    secret_hash: 0x42E553AA401CECE6AA7C434B811ED6D4E69AFB091A7DDFFDA17B3A748CA71F1E,
    secret_hash_signature: [
      r: 0xA2960C25A21123DC8AADEBAB377B7E9AA3A0C8F0201F313338E1913DEED74616,
      s: 0x6B94E23F37AD134E399DB096E11320FA8B12D822E61B984785DFF3FF28CB9984,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    24F7CD54019A70B731C0140B92FB361FC3F0567B672733DA50D9F069AC7172EC6B884C53949AE96B50165FEDE4C08539581D2A373E08F664DC76E434

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00019B93D8BF306966EC1593E24AEEB953CB4A4258266CD62D91E5B012312C0E4CFE

Previous signature

8B8E23EF1AF1F9BBB4C156435F336A9E94B0EB7F349C1D102ACB0EC299E765C91FBD6D62CA0C25976051E5C7F808D0A87AC193467863A153F2481DDC9C105B08

Origin signature

3045022100C1D79F13116123E1C7ED8CF9CD7C8D00DBE40B3D8F70297BCD14100BBB2EABD9022056BFB381EBCCD9EE8ACC93EB4C90FC6ED27160F9A2ADA5A58A8E621452EF3B8E

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

000DDD8A9F23E2C4F8501858306477B54D70D094EE0324F3A4486188DC8CE6206F

Coordinator signature

5DF8FC16A0455A8B9DF78532F5B2EFE37C4DD6D6189DCC80F82F39BB3BEA7E903F4A9AF8F805E0C6A529C849A2458432F990B9B294F018945E1325842EE6C30B

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

0EC317D7258E37C979C140A9F008202DEC354B96CE455163642CCFFCE258D01864D63AD7F435F90B0701C69F71F61F52423087E047A582346D3B25E7D8DED00A

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

F1B71F7C768256C373F226CA75890C6573AD9C4DD9F64E45FB8941F4D907373CA3BFF32B47A359ADADC5406D5A0166F1F9F294973D6DC777B05FA54B5E51D200