Type
CONTRACT
Validation date
2023-11-14 20:45:29 UTC
Fee
0 UCO

Code (926 B)

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

end

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

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

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.2991, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.0009, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.2991,
    end_time: 1700001900,
    secret_hash: 0xCED152EAB04B75A8494A28CD72E7FFD1ED02DD8D12FB7EB8C8C27C71C4BED3B6,
    secret_hash_signature: [
      r: 0x802114F97CEA25714BAB26E86859FD6EC05174531DB12BA05D1389729D9B32CC,
      s: 0x204989C5BF1AB83AC646A973585A77E06618680845479E392B1FBB554C40212E,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    4747988AC73E6FEBBEBA22BB28EC962F83A84276321B139005611FB8D6EC946A82AE4C186169B65D597E84B4942D832D208E291F24DB97D337B5F40C

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001275729D01567C5FFAF962F0DFDA1C8BEAB18F4692C5869539089D11D4EF7F83D

Previous signature

72A0EF57465E93A809C8E84D01116D7E09433E07D800B3F6309DE55604C82338C5E580775E6888B6F4C1E0930360880B09EAB933BAF175EA3C2C1695A676090E

Origin signature

304502210090D58A709CC2FDEA15BF117544808619EE236AD67BD119BAFCCCFA448260D2D002207528968C5041A5728BD23A418591D805E8AE4208DCF544285D83AA661C8E8799

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00CB7198668ABC1FA52EA6EAEEA62E42975ACD52FDD282D052F90E2EA09E2ADA12

Coordinator signature

AF2F72C0B445E32CC85FF511B0D14780C823DB078DC35E3F8FD6CEA79CEA87B24FEEFDD0B6D70E7C9C6E0270AE28E0D38DEC1DB17B946DFFBCD7F527C7E7DC08

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

D84CEE4FF560B085E0E5301E40B81BEAB8C8FC3F23DA05195BC81F07D2ADE62C00D757804159D3DBD680BE1DC27B53867DB9BC3162599ED2962FC9ADC7FE2208

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

BE14BCD395646C806FDCF4F5E982C254441A6C6DD9FE5704CEA0A63E36C6CD69D8B77FA3DA6996FD8A42B451C0C08AA852B421ECC70247D50D00C008C8746206