Type
CONTRACT
Validation date
2023-11-21 21:51:34 UTC
Fee
0 UCO

Code (929 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.004985,
    end_time: 1700610660,
    secret_hash: 0xA51CD10EF0FACDFD0FC3C1E33C4937DD9B1A8445AEEF5E5ABEF22F2EC9B624FB,
    secret_hash_signature: [
      r: 0x8A1B7B7F7E7B6F84B0E595F8ED455D07F239EF43930FC1759DA658CDF87B70D9,
      s: 0x6C3D9BD838DE9F5907F7EFEA2B236B456CD203C2C72801CE0F634ED9CFC53907,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    55A19044B62E80AE07D0773801CFA8A207C645A66A69E54A03D6966000B0CB9C4CD559FE8BF29A466D67767A652C6392C00216D81BF2C6ECEC0F2559

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

00016692853D48BF496A78172B70F657C5F0B8A269F7C7565241E867706D8E6126E8

Previous signature

5AA9C94C1BBE912AFA4A8C687A16987DA14813797EFAD302FCBE541832F72F90ECA5B731D390B622DD8A25A33200A88E45820226DA59D5F00F3ADD106A8BEE08

Origin signature

304402201E1BAA41D834AB50D36A738F2ECA4E9D5A2C37DCC6D4C07DFC0578695B9B33CA02205C16A02857FAF7C3602DA472B0132920BAB4DF1E62CD0ED575DB5A9B2F50297F

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

009753D476FD452699CED77DA29C12BAA68C34114A6A42AA10C7235CFE7F9A605B

Coordinator signature

54CFC2E63EA66E5A091CAEE42B0972FA2690157E7EBFE042BF7B30327EE8E3C772C52A47CF74EBA8F6CB9F702A821DF878111186EC70277AB4F3FBBE4AA47300

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

5DF9B1B48E03F8750D9773BDC9CADB7014B2125248DDF58BD992298C6D39E5459C52C4837F53D6D876D46479A63446988C7517D98121F115883BAADFEE79F008

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

480897965F5D7690B9672263158873D6D41B346FF1F4859DE77FE6B3C10C71AB099751120FBB475F327DFF2B267DF044992978A60528011ED940C8A35A54A907