Type
CONTRACT
Validation date
2023-11-21 13:45:05 UTC
Fee
0 UCO

Code (930 B)

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

end

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

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

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: 1700581440,
    secret_hash: 0x90902DDE44132CF8043D96B43729BDD31B393DB3A32713EC266724E5D0A4F343,
    secret_hash_signature: [
      r: 0x78E0CEAFB652A7EB9281D30A0247D49504A99183A9CEF281A4934FA3F55418C1,
      s: 0x44A50DB2EC351C7ADD720891128800B72FD187A464B5D231EE52A4950129CA05,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0E11843710C18C659ED71B686FF815F3F9FCB00CC544799D7480A9E9C224C41A316CD045B8272231FE3E8042207A7C18EE31542968A86DBA612A8F41

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000165946D0413A693162C73446E1BABC86027EE4383B7B9075CAAFA8161FCBF950C

Previous signature

02291D9661D88EBFDA0BF24087D59E519A4AD0EE27A6A366F79A7818E791ED9F150665BD68245DF6BCEFB26FA1AC50C04B62A06304CCC8272AFDA0ECDC16AA00

Origin signature

3045022023D89E16EE021E6BE519F15148A04831C919154021A83503EB2C0F5E51D46E9F022100E5DA93BEFA56BEA6199A6EA04AF5AB0FD982329C64C070341FA073DD78B504E7

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00ACB6F5C5408445C44504F675CEEAD7FDF1BDE7290B7FBBE10DC309721C920312

Coordinator signature

9DAC1841A6AEEAA0AF253BE56372F6451247A54B04F734BAF5C1A5058E77CE6C70A4271C434054E3217B75801DF8D26D73155F685D018381A76CC43FDEAEBE0A

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

C9C6EB0CCC9AF8A5AD6A222D09EBECC778FC85036A67151871DBF4AE301407F8508D795EBB56645436320A2D670F6A2F37785B05FBC78D79680BB31BE77A7B05

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

F7343BCA6055A7C8251F71FC3FE5324DED0D63524500CE675CF62872724739AEECB0C94879B2D6813245FAD27D71573E7EC24264B578C957E91D26E7B1E67807