Type
CONTRACT
Validation date
2023-11-21 08:52:48 UTC
Fee
0 UCO

Code (932 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1700563920 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 >= 1700563920
]

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 < 1700563920,
  content: Crypto.hash(String.to_hex(secret)) == 0x7886FC0262DE8A6F142A856059E64EC8067F5D83491BDAE19FB859549F13E579
]

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: 1700563920,
    secret_hash: 0x7886FC0262DE8A6F142A856059E64EC8067F5D83491BDAE19FB859549F13E579,
    secret_hash_signature: [
      r: 0x214109C01944AA2CF12BEA999BCD44973635671F74E9D78E6061F60F17996160,
      s: 0x0CEB9602C80DFC9BACE04190CD4383A7EA17D7C2A85E736EBDFB4838EFCF2C57,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    3F623AB46E9184FC736CC24781DFA15ED8AE21F2CA0B342363F79348E1538283D58045B57204CFBE6F95FE112CBA11F4C76259D4989718A855C9A3DB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001F76CD2AF5897CD6A011FF99A4C2FAE5ED87FC3CC37F3755C3AF1721E7B2422E5

Previous signature

92B07812075E8AC368827BCEA790F4CA92676DC80EA8ACB94D09E8883BA6000022A6B56A5746CD37EA9D887BE424FBC6FA411CC514D7CCF81532AEABE590300B

Origin signature

3045022100CA1AF3F4DB3CF40CEB7ACDCA74D0B5E3FB8CD0A0712A823E9A2598490EE8AAA90220711CCB067182C2550D45BC1B8226391496F5FB44A98D56EB32D3EED11DECD45D

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00ABA1242393673C7F5E844A7FB9D602F57BFBCDB9042A3FBCF6265F63AFE422B5

Coordinator signature

36DE757F6254CC0227D6BED3135F6AA371E38D00C804BFCB5663F0E2AA01C23DAEFF72D4E12190801C0FEF5FF306040C07A331B86F90955878ECF48C43BAE802

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

BBB059BA38FA89F03F4CC62DA5C13D406E51732EA479A0469C36F8C077BF5CCB74EF4FA97133F55A3E890934FCB2B5A58B9C32A5208E050BDBE525224E022B0D

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

F9FF1E8D5E91AEAA5E676C63BA049568A17C01956F0CF36B51C17BB32EBE509C1550137B51789D4718DD8155652686B9BFC333C798F2ECAC40E898BD041ED201