Type
CONTRACT
Validation date
2023-11-17 09:58:32 UTC
Fee
0 UCO

Code (926 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.04985,
    end_time: 1700222280,
    secret_hash: 0x45B25AF11AEAE89BDC78653AA549B9B624A72167238E52695FA9439837EC4631,
    secret_hash_signature: [
      r: 0x7C37539ADCC1E7A4D077373384C42BD643067DC2C5B797D4017E58C592BDD220,
      s: 0x524EA388ED0AB6B33C216053F0D2506CB721DABED46964D3D7872E2B0E8FFDE5,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    477351CB55475E5FD8F9EA65F6DEB586B0CD25E57D647410FB4FB0B781892A2F4DCFB2AC54F14BD59576868197F20C86E0CA2E4AD3FFBD74531E4026

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001B64C82F802E16BDFF4FDA1FFC7F6A15CC22C254181B92D4F73CE33760A7197F2

Previous signature

183EA20E691B7C198CDD3BA9919F39A953EE5CD94A15F9A569602A8DEEC780E209942439BF77E6C4D105A0AB272B65D020957866EC7718AA40E62ED68F127206

Origin signature

3046022100D8DD3BCA053FABD4B86035A29AE1958A69A5755CBDA4902A28DDC2205C564E70022100E63F460390D28560EC45444ABD9C8FA9922B9C2526B351ACCB1276975F8A4888

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

0016C2647E7A859A3DCFC9120C5C5812B2CC91161479E0AB7C83EDF0B3520DFE28

Coordinator signature

8C9F123B69A131CD074E4D0C98AB7D3421DE33B191ECF84E31DE22453ABB3AF0C9AB1D6AE496BEDA30862F70B2A2CC904D9377F2DC3E754EFCA81E95E6642B04

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

14ECEC7B4B314C2EB96E4A9EA94D8DBBA68DA8AE86D6D61E94677BE4F58C2BC0BEBB47589DE5B726A0A6435DCC498065200D55593A9C1910D6559306338F7203

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

40683B49BA5751D5B6AF9934FE7E36F0E5B83DADE2AA734B0E9F0CC47FE9C390FE8DCD21AB019BF4F42BF818DC737EFDA68D4607B87D2635C3D2AFDED41E740B