Type
CONTRACT
Validation date
2023-12-07 13:47:33 UTC
Fee
0 UCO

Code (934 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.04055061,
    end_time: 1701964020,
    secret_hash: 0x7F8DDB8A82B271ED328877FDBC7E0523651944AAD26862F3FB56EE8351CF3788,
    secret_hash_signature: [
      r: 0x417497671CF0084B5BA3360F3109884F01943878EA9D9F2066BE13B0292637AF,
      s: 0x51A816321ABAF8EAE0E462F3ACCD1D1CC90A198604F4A8D1600A7AF765D8BC7D,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    4D7AFAD24577BB8EE8ACC2739AFA6F1C367A296C130CC6C338724CFC5CC55A9EE70E0EB1F38D6CE743C180CD1E2C16070C20E29EEFE1EED291AB0DC6

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00019376D1B1E02AD48CC612D89A07770177453F4A08A9BB4D6C390DEFE03BCFDE05

Previous signature

F342EF311D1DB4661786EB9A8C8D902BB843E26F60E4AB4480857A2A1102A66721F9103A7D25AC55B65E45AD720FFA1489E96CB47E195FE1EBC68EC100C90D0F

Origin signature

3045022100B930B0985143D93B80BEF4E1B59A259714E7CF5557F5A0C4E654A92C5A0C22C8022010C54D3A58C2407302D45A60E5E27AECEF3CFA366854DE12251E9447DD87331A

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00772B6203880959503369A423CC6F83BFEA8D11CCD595EDD6AE886FAF7FDEF775

Coordinator signature

5B3B2CA4F28A6CB0B77020BCAF907CE6D301AB785A35823C1A3A7536E22EB56F53B36F1D2BBA161DCCAC4FF20FB18316E87229205DB06515EABC1A5399E82501

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

480C7C64942E432246DFCF64D8CB88774EE8E9344A5CD869716C228661A586CB5C3A56688F697DCB778FC5B1372691F16319931DE2B8024A3C5B31AD19610003

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

07FE951C24AA0E61BFE579CF8ACF8F7BE845235AA2481870020360038472386BADC4FF9ECB101FCC5BF35A410F44439FFD03EF91D6F0498CAD7A54089A37AD0E