# HashMinCommitment

The `HashMinCommitment` circuit is designed for generating hashed commitments and ensuring a certain amount is greater than or equal to a specified minimum amount.

### Input Signals

This circuit accepts the following input signals:

1. **amount**: This represents the amount under consideration.
2. **minAmount**: The minimum amount threshold.
3. **oracle\_owner**: Identifier for the owner of the oracle.
4. **oracle\_key**: Key for data retrieval in the oracle.
5. **oracle\_value**: The associated value with the oracle\_key.
6. **unlock\_sender**: Identifier for the sender in the unlock operation.
7. **unlock\_receiver**: Identifier for the receiver in the unlock operation.

```typescript
signal input amount;
signal input minAmount;
signal input oracle_owner;
signal input oracle_key;
signal input oracle_value;
signal input unlock_sender;
signal input unlock_receiver;
```

### Output Signals

This circuit outputs the following signals:

1. **amountHash**: Hash of the input amount.
2. **minAmountHash**: Hash of the minimum amount.
3. **idHash**: A complex hash, generated from all the input signals.

```circom
signal output amountHash;
signal output minAmountHash;
signal output idHash;
```

### Components

The circuit has several components:

* **comp1**: A comparator that checks if the `amount` is greater than or equal to the `minAmount`.

```circom
component comp1 = GreaterEqThan(252);
comp1.in[0] <== amount;
comp1.in[1] <== minAmount;
comp1.out === 1;
```

* **hashAmount**: A `Poseidon` hash function to hash the `amount`.

```circom
component hashAmount = Poseidon(1);
hashAmount.inputs[0] <== amount;
amountHash <== hashAmount.out;
```

* **hashMinAmount**: A `Poseidon` hash function to hash the `minAmount`.

```circom
component hashMinAmount = Poseidon(1);
hashMinAmount.inputs[0] <== minAmount;
minAmountHash <== hashMinAmount.out;
```

* **hashId**: A `Poseidon` hash function to hash all input signals to generate the `idHash`.

```circom
component hashId = Poseidon(6);
hashId.inputs[0] <== amount;
hashId.inputs[1] <== oracle_owner;
hashId.inputs[2] <== oracle_key;
hashId.inputs[3] <== oracle_value;
hashId.inputs[4] <== unlock_sender;
hashId.inputs[5] <== unlock_receiver;
idHash <== hashId.out;
```

### Inclusion of External Circuits

The circuit includes `poseidon` and `comparators` circuits from the `circomlib` library.

```circom
include "../../node_modules/circomlib/circuits/poseidon.circom";
include "../../node_modules/circomlib/circuits/comparators.circom";
```

### Main Component

The main component of this circuit file is the `HashMinCommitment` template.

```circom
component main = HashMinCommitment();
```

The `HashMinCommitment` circuit is used primarily for creating hashed commitments for amounts while enforcing that the amount is greater than or equal to the minimum threshold. The hashed outputs can be used for comparison and verification processes in other parts of your application.
