Type
CONTRACT
Validation date
2024-01-27 17:13:38 UTC
Fee
0 UCO

Code (925 B)

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

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_token_transfer to: 0x0000C182FB6506E0E7B62490B17538B6BD873C2C76413C29B2D1F24A47349FB518D3, amount: 0.01, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
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) == 0x000066706D704329CA8C2A4153991E2DDACC968622CA10217CA14952EB7ABB966C30
),
  timestamp: transaction.timestamp < 1706382780,
  content: Crypto.hash(String.to_hex(secret)) == 0x2B0D14EB186EBD2168685A50A9B50889046151BB20B27936FCCE9B9A2B68520C
]

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.00997, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.00997,
    end_time: 1706382780,
    secret_hash: 0x2B0D14EB186EBD2168685A50A9B50889046151BB20B27936FCCE9B9A2B68520C,
    secret_hash_signature: [
      r: 0xD9F1B8211F9146E4078D57F8388AE250F25CF5AF1D09A1E82CFAC1F44409500D,
      s: 0x2550A5B23876AA0CEA35C685CE39D769935E164A0889F5EE66EB487A84282B69,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    CC5C3358C0EAAF0FB36DC011B8AFE6DAFC8C04E8546E515EA9B20ACCC40389CF2B342F96AEE20CE8250103A049BC037FEF62BCD9172D08FCB44ED6B0

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00010352A5E38CFE93A7ECDF7BF893CF368F2B48FF6F3C918EEA3A7D2DC6CEC7C6DB

Previous signature

3C7D7D589DD97EB37FC59BB1E7682007231568BCBF4C8B05FC25014E581BEA35264C3C0C7D392C06E094B011363F192A300747E37442DE403FD4F826E5ED2B09

Origin signature

304602210082E34524C4052CF97BEC6EB57A1F313E90696D20AA09CE4018730F6F44E96822022100BE8B63386E3EBE07BEB6DECA93191434C67877A5A464368B1C1072FC11C92F6A

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

0044F8B4CF790F75AE439FA4CD26FFA40BB20DBE3EF277C3CE1095B4DFB5CBFE81

Coordinator signature

B1E9242A65BCA97AB9CCAE90100ECD7EDBBA4AC0E76195013FA0740F4AD8E830F942652C6618E79908175679F428E9F7B87160FEFC6AF5A050471B2CF0AA6703

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

70205AA61EF5482FE60653A62F221CA674ECC470C5EEC5C01464FF3E590E39F2553045D1C66289601981B4AC3EB844A8FEF2A4039841C7C3AC244757273CEA05

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

4C08BC8296CBB2ABF7E5DBE52EC943B248F18EEC2311C7022D7A404D617DC9E6456187821D968C93758BF4E814324925CE293F1585ACF176495F0496A090DB0F