Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions content/docs/stacks/clarinet/guides/working-with-sbtc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ title: Working with sBTC
description: Clarinet helps with building, testing, and deploying contracts that use sBTC.
---

Make sure to use Clarinet 2.15.0 or later.
To take advantage of these features, make sure to use Clarinet 2.15.0 or later.

## About sBTC

sBTC is a fungible token on the Stacks blockchain. It follows the
[SIP-010 standard](https://github.com/stacksgov/sips/blob/main/sips/sip-010/sip-010-fungible-token-standard.md)
for fungible tokens.

Even though it's *just* a fungible token. Clarinet has some helpers to make it easier to work with.
Even though it's *just* a fungible token, Clarinet has some helpers to make it easier to work with.

## Using sBTC in your contract

Expand All @@ -28,12 +28,13 @@ smart contract to your project, along with it's dependencies:
- [`sbtc-token`](https://explorer.hiro.so/txid/SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token)
- [`sbtc-registry`](https://explorer.hiro.so/txid/SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-registry)

When Clarinet detects the `sbtc-deposit` contract, it will automatically fund the test wallets with
sBTC that you can use to test your contract in the Simnet and Devnet.
When Clarinet detects the `sbtc-deposit` contract, it will automatically fund your test wallets with
sBTC that you can use to test your contract in Clarinet simnet and devnet.

## Using sBTC in your contract

As a SIP-010 token, sBTC let you call the `transfer` function to transfer tokens from one address to another.
As a SIP-010 token, sBTC let you call the `transfer` function to transfer tokens from one address to another.

Let's say we have an NFT contract that allows users to mint an NFT by spending sBTC.


Expand Down Expand Up @@ -64,22 +65,22 @@ Let's say we have an NFT contract that allows users to mint an NFT by spending s
```

Because Clarinet already took care of funding the test wallets with sBTC, you can call the
`mint-one-with-sbtc` function with one of the test wallets.
`mint-one-with-sbtc` function with one of your test wallets.

In the Simnet (unit tests or `clarinet console`), the deployer address of the contract will remain
`SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4`, but in Devnet, like every otehr requirements, it will
be deployed by the default deployer address. You don't have to care about it, Clarinet always make
In simnet (unit tests or `clarinet console`), the deployer address of the contract will remain
`SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4`, but in devnet, like every other requirements, the contract will
be deployed by the default deployer address. You don't have to worry about this—Clarinet always make
sure that your contracts call the right address.

## Deploying your contract on Testnet
## Deploying your contract on testnet

On testnet, the official Hiro sBTC contract is
[ST1F7QA2MDF17S807EPA36TSS8AMEFY4KA9TVGWXT.sbtc-token](https://explorer.hiro.so/txid/ST1F7QA2MDF17S807EPA36TSS8AMEFY4KA9TVGWXT.sbtc-token?chain=testnet).
This is the contract that is linked to the sBTC faucet: `ST1F7QA2MDF17S807EPA36TSS8AMEFY4KA9TVGWXT.sbtc-deposit`.

Again, Clarinet will make sure that your contracts call this address when being deployed on mainnet.
You can see the of the sbtc-contract being re-mapped in the testnet deployment plan.
You can see the address of the sbtc-contract being re-mapped in the testnet deployment plan.

## Deploying your contract on Mainnet
## Deploying your contract on mainnet

On mainnet, your contract will remain unchanged and call the one and only sBTC contract.
Binary file added public/images/bitcoin-indexer-og.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion utils/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,26 @@ const tokenMetadataApiMetadata: Partial<Metadata> = {
},
};

const bitcoinIndexerMetadata: Partial<Metadata> = {
title: "Bitcoin Indexer",
description:
"Build accurate, lightweight databases with the Bitcoin Indexer.",
openGraph: {
title: "Bitcoin Indexer",
description:
"Build accurate, lightweight databases with the Bitcoin Indexer.",
images: [
{ url: "/images/bitcoin-indexer-og.jpg", width: 800, height: 600 },
],
},
twitter: {
title: "Bitcoin Indexer",
description:
"Build accurate, lightweight databases with the Bitcoin Indexer.",
images: ["/images/bitcoin-indexer-og.jpg"],
},
};

export function createMetadata(override: Partial<Metadata>): Metadata {
return {
...defaultMetadata,
Expand Down Expand Up @@ -361,6 +381,6 @@ export function getRouteMetadata(path: string): Partial<Metadata> {
if (path.startsWith("/stacks/rpc-api")) return stacksNodeRpcMetadata;
if (path.startsWith("/stacks/token-metadata-api"))
return tokenMetadataApiMetadata;

if (path.startsWith("/bitcoin/indexer")) return bitcoinIndexerMetadata;
return {};
}