Type
CONTRACT
Validation date
2023-11-15 20:18:58 UTC
Fee
0 UCO

Code (931 B)

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

end

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

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

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

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 9.97e-4,
    end_time: 1700086680,
    secret_hash: 0x0D745567D6D706D38E6CA2EB6D531AB45643EF27F69406D4F2B8E821D55B9C19,
    secret_hash_signature: [
      r: 0xD681ED647F10640A54CE431BDA0AEA8A4C5C59B4B77305CD975C815B5451D2B6,
      s: 0x41B841902EC5D8DDFE2BD67ED46D726717186450C0470097BB83BF1F4E16BBB2,
      v: 27
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    29B0FB0DF62BDC1CAD534D51542CA01078D6E76EBB0C079FEA20106B9D16D149E7FC13604C2D66E376D263DF9CC3F182D3131CF0D2E7F91F51CB524B

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001A974E89166BC2C06E8EDCA7E21D954C83BD3CF9C3675D6FA7397D46D02D9FC56

Previous signature

E7007A5DC730864DAD04DA90D55687D4846A6C01DE29A57425BD29E840E46A2D4E54BC9FBEE8FD677E506D89B96739DEBC55C7A045C8DD4D30AA2763FD42EC03

Origin signature

3046022100F290B25F5CE3933C2045C64CAB43E21C390D5F3789CE4ADB3B422245E13C956202210097689FAB0DCB0BFEC4980FAEE83D8A2A50659DB393A9865054B8DB7E2A137082

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

009908630E0D4C65CBBCBDC5B797F9E2366CDD3D9EAD3458745D3BBAE1D80DA0D6

Coordinator signature

BBDB6944E8A727EBA4E42CC3C723F44A9A5A768F4C749480CE6CAFACE0AD845E6070BDF769AED62F0C2A34F7F67BB15E992413663EC527A3FD455B8FD32EB40E

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

240DB1F67CD445E9A715487053FEBA2B40E832760E9263F175DF170AF782E1A2B2E52660C5474986BF5E456C1B710EE1135DB0841AA2551AE0CD2E4E96BD970F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

EA43E7FE38460AED82AA33A720C81E1FF3F79C4151266D7CBDE4FACB110AA20629144F974EF3BC1D15740FCC5E0A39611A1B03ADCB9EFBBECB27078C3910ED04