Type
CONTRACT
Validation date
2023-11-15 09:17:56 UTC
Fee
0 UCO

Code (930 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.004985,
    end_time: 1700047020,
    secret_hash: 0x82671F1ABC715F97DD04E8EF6A99F4A733BED4F929052DC7B336C850C81483E8,
    secret_hash_signature: [
      r: 0xAF0141C23A0B94360C506D63AB8A3AA7E078AB148166BD52CAC94F8AC678555B,
      s: 0x7D1DFA54D7BE2D2BC1C464100C155308B36C8DB00ED18D5ED77B32F0F9C4DD47,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    33393F337E45DCB69E6D21E6D38E0F736B92AE859BC21D3C55D9D299157DF7E617E36B042B600B1A6BC0CB96AFA2185AA9847D4A21377C7048A47375

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001199233F9074047FC0D8EB2108E2D4F7C0A9589BABC92BB4A2E43F0F39D995C68

Previous signature

689618835830452FBFDA92CD50798C22F71942DB824AC5A98CC12F6D1583A0FF15C45452BBC278F97FF6570B190A9D99FCEC6C16976756AF2376880E7C15A90B

Origin signature

304402202A418CAE1822C080E22CBFA36B6FB8F66ACB94534C43B78422653495D1BC427F02207058C72B30490401B3523CC7B1843E1B4485AA1D524C1C77D7C2BB536650AFD5

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

00A3F71E2B4716B207F9EE4B26ACF66BB190A0259D496AF447DA4C592357F59D22

Coordinator signature

22C4C4525B4F7B6E19EFD2139739943C6F1529BA2ADCDEDE14F2F77241BA977E148FF1698733336CF10EE2825871BBAD7DE51C098D14D776867B1C3B0DC00601

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

FFD903F148B121F0D4FCCB727B5B5A0FCBB31DA564648690B44B74186AB4F87CE03DF98A101B7EC628ACB4E3738C6D3D24890BE20CAA2B9C141C7F75DB450007

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

4C26847F8D7FA994C59636FE56B14D40FD94863063E6A8C621F3C7742F4B576E558E0DDEF8E29735951AB1665ACD929790821DD9C172DCF6BF4579F43DF3BF03