Type
CONTRACT
Validation date
2023-12-09 15:31:22 UTC
Fee
0 UCO

Code (931 B)

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

end

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

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

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: 3.988e-4, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4
  Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.2e-6, token_address: 0x00003DF600E329199BF3EE8FBE2B8223413D70BCDD97E15089E6A74D94DE3F1173B4

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 3.988e-4,
    end_time: 1702143060,
    secret_hash: 0xA3CFD1AF86AE67CEB4FB2E103E521E6DE61B0F37D09530E8FC849DF12F5EAC63,
    secret_hash_signature: [
      r: 0x0D13A1940FD46012F66C637BA8595F6E15F438CA60468E0476F11FE2054745F4,
      s: 0x56BA83B7C4CEFAD3DB43214551DCED1257F0ED24E05B76A91E67C1756A7DD0F2,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B7150333F7F84057AA71C169ACDF78381F1CDA1165D87112F3115D60F0B0F5F45C1C1DD623B16C280F235CE45D4FB419353FCFC669E9D6D040E4FD20

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001398927E25FADA6D81D226B35F3EDE95BE333C93B3D65B7FC8B29FE7E6FA2F80C

Previous signature

2E4DE10C49B4A41489EC7089749F0166161DEAF8FC5A9382F8D18432DC2540CDA66C2216568EBD50E41AF141AEC45A2BA0AF19A2F830AC9C78D5E5A936F66408

Origin signature

304502204A5DD8D8951DDAEA418A5ED46F20C1F3DD8139A00CA8737EFA5B24E369106D8F022100DA2490D3047CBF03D1489875EDB911EA1FD08C37C0BF6E8A9CC378015D6F8379

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00E6C42D6EDFFD249ADA55D605B467DF69778D0F9A72A92378846081CD66594D00

Coordinator signature

8E9B8B33320F35E729D139F2D36A3CBBED4E943D98A7CAB1D02C0BBF2975AE41D49B76AD7F290E5EE340545F355076E05A0E5A37D0DFE7F4DC773EA1F123D709

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

8EC5DE308F97F9835DAE06734D842B72B0A19213E1E1CA534CF6F72198B44BE6A0081D59314CF6003C8ADD2AA3A27FCEB1BEF896F4C8C5D122BAA3E08FB73201

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

FF547E107F5098BAC4DCF00F03E5BF0D92480B08A142E0472B4E0935E81313225E809613081249E4BC5D8E8B69339F31FC38EA0B1795B736573E48001D8FF00C