Skip to content

Commit

Permalink
update mint doc
Browse files Browse the repository at this point in the history
  • Loading branch information
hashxtree committed Dec 19, 2024
1 parent 783d0b2 commit e23c0c8
Showing 1 changed file with 51 additions and 3 deletions.
54 changes: 51 additions & 3 deletions docs/mint.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ There are different methods to mint LBTC.

### Function: `mint(address to, uint256 amount)`
> **IMPORTANT**: Only allowed for whitelisted minters such as PMM modules.
>
Mint LBTC to the specified address without proof and payload.

**Example:**
Expand All @@ -39,6 +39,54 @@ await lbtc.mint[address,amount](toAddress, amount)
```

### Function: `batchMint(address[] calldata to,uint256[] calldata amount)`
> **IMPORTANT**: Only allowed for whitelisted minters such as PMM modules.
Batched `mint(address to, uint256 amount)`

### Function: `batchMint(bytes[] calldata payload, bytes[] calldata proof)`

Batched `mint(bytes calldata payload, bytes calldata proof)`

### Function: `mintWithFee(bytes calldata mintPayload, bytes calldata proof, bytes calldata feePayload, bytes calldata userSignature)`
> **IMPORTANT**: Only allowed for whitelisted claimers.
Grants ability to special `claimer` to mint `LBTC` using a notarized `DEPOSIT_BTC_ACTION` and charge fees for that.
The possible fee is set in two places (inside smart-contract and typed message), the smart-contract choose the lowest of them.

**Example:**

```typescript
const [fields, domainName, version, chainId, verifyingContract, salt, extensions] = await lbtc.eip712Domain();

export async function signFeeTypedMessage(
signer: HardhatEthersSigner,
fee: BigNumberish,
expiry: BigNumberish,
) {
const domain = {
name: domainName,
version: version,
chainId: chainId,
verifyingContract: verifyingContract,
};
const types = {
feeApproval: [
{ name: 'chainId', type: 'uint256' },
{ name: 'fee', type: 'uint256' },
{ name: 'expiry', type: 'uint256' },
],
};
const message = { chainId, fee, expiry };

return signer.signTypedData(domain, types, message);
};

await lbtc.mintWithFee(actionPayload, proof, feePayload,
await signFeeTypedMessage(
defaultArgs.mintRecipient(),
await lbtc.getAddress(),
snapshotTimestamp
)
);
```
### Function: `batchMintWithFee(bytes[] calldata mintPayload, bytes[] calldata proof, bytes[] calldata feePayload, bytes[] calldata userSignature)`

Mint LBTC to the specified address without proof and payload.
Batched `mintWithFee(bytes calldata mintPayload, bytes calldata proof, bytes calldata feePayload, bytes calldata userSignature)`

0 comments on commit e23c0c8

Please sign in to comment.