Type
CONTRACT
Validation date
2023-11-16 16:42:18 UTC
Fee
0.17343915 UCO

Code (887 B)

@version 1

condition triggered_by: transaction, on: set_secret_hash(_secret_hash, _secret_hash_signature, _end_time), 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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
)
]

actions triggered_by: transaction, on: set_secret_hash(secret_hash, secret_hash_signature, end_time) do
  next_code = """
  @version 1
  # Automate the refunding after the given timestamp
  actions triggered_by: datetime, at: #{end_time} do
    Contract.set_type "transfer"
  # Send back the token to the user address
  Contract.add_token_transfer to: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 0.01, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  Contract.set_code ""

  end

  condition triggered_by: transaction, on: refund(), as: [
    timestamp: timestamp >= #{end_time}
  ]

  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.01, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
  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) == 0x00008DD22E7496E86901E9B276A1BE6F9512EB09980CC04C7B76495EF37D5666A709
  ),
    timestamp: transaction.timestamp < #{end_time},
    content: Crypto.hash(String.to_hex(secret)) == 0x#{secret_hash}
  ]

  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.00997, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
    Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 3.0e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

    Contract.set_code next_code
  end

  export fun get_htlc_data() do
    [
      amount: 0.00997,
      end_time: #{end_time},
      secret_hash: 0x#{secret_hash},
      secret_hash_signature: [
        r: 0x#{secret_hash_signature.r},
        s: 0x#{secret_hash_signature.s},
        v: #{secret_hash_signature.v}
      ]
    ]
  end

  """

  Contract.set_code next_code
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    40CC913D9DAD62266DAAC4B69CA9AADE98599E548A0C5C173E47DA147BB2F8B21B21470F1CEAB09EBFFBE271448893A5A918F0C7C0EF3058E4C743FD

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

000127FAB5F66D10EF2F5CFCAE2858B00537372EC0EF16DE1B2D4909A6DF6AD584D8

Previous signature

61AD0AC60880AF0C9D3855AC80B8C59ACD4BD07FC301DC420A1E87C67CA4B521FDE887B9A51F6BD72687C3697FED27903B37ACAB22F9EDAB966A911D8E8C7802

Origin signature

304402207453E69EBB4755B60C69AA63388B8996A103D5BF3B1A98E5A6B5A86BBF93A46C02206182699228A0FE14A021C386095C8E1AB05BBE7246390454CBE6480879F9EBCB

Proof of work

010104AB41291F847A601055AEDD1AF24FF76FA970D6441E2DCA3818A8319B004C96B27B8FEB1DA31A044BA0A4800B4353359735719EBB3A05F98393A9CC599C3FAFD6

Proof of integrity

0087D5E267F8FFD7D1A42E46980F879FD8B724EA1DA066C2447BF50195A93EC2B4

Coordinator signature

CC0EE783240EDC144FB1043222B60CDAC67CCEF1BB988B55BC0615CB16C66099049536A3F5667078B01A82020B663DD83DFD4863ED6D4DD4AA32C4F6BC94590E

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

8F02EE49FDAB55E1580B3F9047156A5A8AFFEDCBE9839D4625DD5F4CA3F30CB953AFCB041174CD6980081270D09742F2466E0C618E286405158589C344408002

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

D4D03473E74F0EF4903FBECCA2358AEBC7F2F28B2C7B357236A0215BEB851C32919FC5B7F83398C4260CE00163316874CB6E9C172DAF5FCC07D5D81AA690DD01