Type
CONTRACT
Validation date
2023-11-19 08:21:58 UTC
Fee
0 UCO

Code (920 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.0997,
    end_time: 1700389260,
    secret_hash: 0xDF5C80BA7FE3F8D0D1EC34AA50400F56D728DEA049B3B51E4B80F46B99F57DFC,
    secret_hash_signature: [
      r: 0x8113AA39103055BA5BB74A1A04E0957BF7367DAA689642B748E083B60553ACBF,
      s: 0x0C279DA6BBD3D059118DCA189ED4FC78158258B54DFC448D874C6A4676941154,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    7FB3FFABEBFCB97E47405BBDA30DAEEE38E5314437B642189ED66329D143EF2A5B7ABCAF247E7AB85F0818319774F6F2728AA9163AFDAECB84EFDEA8

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000157BF1BCA65BDC3FCE807E158A328113FE95ED565B3ED889A4377F13F1AAF1653

Previous signature

B7BC28FD017B392A2508CB7679EAC8DF3AA218349F2FAA6D32A8EE9370EE47E0D85B38DA91F963564F98245E473A2317FA6F1186CFE96D10321338714BF0AD0D

Origin signature

3045022079195A772BA3503199FC4EA420EEF733D84C1B0393C3A0CC42F73AAFDBAE90E0022100AC4C9A615FFCEB2DBCEB0496FB0D593690B57F61854F43F87E5BE1EDACE17CDF

Proof of work

010204AA023E1E039788AD4B8F713C8871CA39A177414A99A0788993AD725B1FBB7AD5E4CAC86151A9E03451DCACB1EFC100B1E450FCEDAF5E5005F3A4C503D1D29712

Proof of integrity

00C32E3477313132B7A1E71789094ECD239C11580F58E7C93DEDE64FE4EF9B8284

Coordinator signature

A3E3769F504B3487BDCEAB6CFA90A1489353227AC8AE3AB7E438CF1649B7000FFFE3DFBD0D5CDEB2FCCEF3CAA10E11F314B01C586ADEBF672393EE3E5760190F

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

0AB8ECD3ED54B6A3E671563E0B5DADE56C574A538C95F7E659A9286165E00D33644AF966AAD16457C5E13D6DEF21A1CF5346ACDACFD6939BEBBB9E27CECE0B09

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

9E67D07A31CAB87570A234A6CF328F8990F4C0BEE8D56A9AB3F6FA4B84C67A5DA5FBACFB2021EB981984CECD0D5B7F06EE8014806460B695F2B0ED0933031907