Type
CONTRACT
Validation date
2023-11-18 12:23:12 UTC
Fee
0 UCO

Code (933 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1700317380,
    secret_hash: 0x01BD51D146B18F065D5AA41BD1F57C6B9BBD0DEAFAB65C08E323007E9AFFB015,
    secret_hash_signature: [
      r: 0xCED06791D273CB48FEEFBEE5AF86C205E805CE1985E7D8507A24BBE15705BE78,
      s: 0x76C43FFFE315C62B17C70C2CB5DF489B6CBAA52969E5D90B1C2FDE8BB9AB701C,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    F01B6A255C9D4C386A2A6D8CFBC0AC11C5EF709073197034619C885881DDB2484CA389CDA1C5577E891EA9FF95C90E86A4ADB3EA31E08B2B9F82E93D

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00011F09AE3C28011AE065CED5B0254539E4AF24BF6108796B18AC749BDF6DE9408C

Previous signature

A4F4DFAD1F632BC056E83F4FE33100348C1C8D211D8D2AE0D704861F00F3B161D61BCB18D96BF01A056A4EB04CF6D2F5DBE68A05A7F17D6D69D796B112A2B804

Origin signature

304502206FE6EDF9FA626C3D09E070C4C7732E77EF5639B3EA81450CB90293EA5B9A7611022100F18D09A0BBA2239C43F13EF3B20599D147D13EC84B93ABA34A65DB1A1B06BD65

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00ABA6A866236682F9DEF691551D06FE0F0A7F80D20A4CA5DC1F8021CA6AD8479A

Coordinator signature

50A7689168B0379DD99C9D7B783DAFB98BFAB51CE3DC81D517FB502D5ACCE3070839DD66DFBFB917CEAD77F8CC007CD3DEDFDAF238A1C4BEABB8257BFC90E301

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

D59DFF162ADF76AF92AEC94602D06F3CEEE8F04C4008217FE6C9EA201389980CE37B381584BD8B2A19BBE559D93FF51A9B87F09B7E36C45B2E0A8292B646AF08

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

DFE77872A970CDCD2805ECC253D49A6C1415CE53FD19E2DE65AFDD62012943B17D4FAE14EF0AC4E48BD107B4C48F8918A81F1A2B4B92564D0F186F6E1F0AB304