You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/guides/adversarial.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ If DEXes don't cleverly aggregate their prices across blocks, then it can be eco
61
61
Because having a more advantageous (older) price state or ratio might be very profitable, it is worth it for the adversarial actor to pay the high fee "miner bribe" to attempt this double spend transaction.
62
62
63
63
:::tip
64
-
We list some possible mitigations which smart contract systems can implement in the section on ['Avoiding MEV'](#avoiding-mev)
64
+
We list some possible mitigations which smart contract systems can implement in the section on ['Avoiding MEV'](#mev-avoidance-strategies)
Copy file name to clipboardExpand all lines: website/docs/guides/cashtokens.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ While CashTokens might seem overwhelming at first, realize that in contracts you
56
56
57
57
and their equivalent for outputs:
58
58
59
-
-**`bytes tx.outputs[i].tokenCategory`** - `tokenCategory` + `tokenCapability` of a specific output. (see [below](#1-tokencategory-contains-the-nft-capability)).
59
+
-**`bytes tx.outputs[i].tokenCategory`** - `tokenCategory` + `tokenCapability` of a specific output. (see [below](#tokencategory-contains-the-nft-capability)).
60
60
-**`bytes tx.outputs[i].nftCommitment`** - NFT commitment data of a specific output
61
61
-**`int tx.outputs[i].tokenAmount`** - Amount of fungible tokens of a specific output.
62
62
@@ -70,7 +70,7 @@ The [Jedex demo](https://github.com/bitjson/jedex) also introduces very advanced
70
70
71
71
Below we'll create a short list of the use cases which will be the most important to know about:
72
72
73
-
-**Covenant tracking tokens** - this is what enables unique authentication of contract deployments
73
+
-**Covenant tracking tokens** - this is what enables unique authentication of contract deployments
74
74
-**Commitment-based state management** - this is what `mutable` nfts are extremely useful for
75
75
-**Depository covenants/token pools** - which we would call token sidecars
76
76
-**Role tokens** - these are authentication tokens for admins
Most end-user CashTokens wallets expect CashTokens UTXOs to only hold a tiny amount of BCH like 1000 sats. Deviating from the expectation might cause unforeseen problems with user's wallets.
172
172
173
173
:::tip
174
-
You can hard code in your contract that any user token output should have exactly `1000` sats, this avoids possible complicating freedom during transaction building.
174
+
You can hard code in your contract that any user token output should have exactly `1000` sats, this avoids possible complicating freedom during transaction building.
175
175
:::
176
176
177
177
However when constructing a transaction with user owned UTXOs, you should always make sure to check whether you handle the edge case of users with combined BCH + CashTokens UTXOs correctly in change output handling both for BCH and the tokens.
Copy file name to clipboardExpand all lines: website/docs/guides/covenants.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -325,6 +325,6 @@ With contracts holding minting NFTs, all outputs need to be carefully controlled
325
325
## Conclusion
326
326
We have discussed the main uses for covenants as they exist on Bitcoin Cash today. We've seen how we can achieve different use cases by combining transaction output restrictions to `P2SH` and `P2PKH` outputs. We also touched on more advanced subjects such as keeping local state in NFTs. Covenants and CashTokens are the **main differentiating factor** for BCH smart contracts when compared to BTC, while keeping the same **efficient, atomic verification**.
327
327
328
-
Keeping local state in NFTs and issuing NFTs as receipts are two strategies which can be used to create much more sophisticated decentralized applications. You can read more of these advanced CashTokens use cases in our [dedicated guide](/docs/guides/cashtokens#cashtokens-usecases)!
328
+
Keeping local state in NFTs and issuing NFTs as receipts are two strategies which can be used to create much more sophisticated decentralized applications. You can read more of these advanced CashTokens use cases in our [dedicated guide](/docs/guides/cashtokens#cashtokens-use-cases)!
Copy file name to clipboardExpand all lines: website/docs/language/types.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,6 +182,16 @@ See the following table for information on which types can be cast to other whic
182
182
| sig | bytes | bytes |
183
183
| datasig | bytes | bytes |
184
184
185
+
:::caution
186
+
Casting from `int` to `bool` does not currently change the value of the integer. This can have unexpected consequences in boolean comparisons.
187
+
188
+
```solidity
189
+
if (bool(7)) { ...} // This works as expected
190
+
if (bool(7) == true) { ... } // This does not work as expected
191
+
```
192
+
193
+
:::
194
+
185
195
### Int to Byte Casting
186
196
187
197
When casting integer types to bytes of a certain size, the integer value is padded with zeros, e.g. `bytes4(0) == 0x00000000`. It is also possible to pad with a variable number of zeros by passing in a `size` parameter, which indicates the size of the output, e.g. `bytes(0, 4 - 2) == 0x0000`.
- A contract is now instantiated by providing a compiled artifact, constructor arguments and an optional network provider.
389
-
- Anyone can implement the NetworkProvider interface to create a custom provider. The CashScript SDK offers three providers out of the box: one based on electrum-cash (default), one based on FullStack.cash' infrastructure, and one based on BITBOX. See the [NetworkProvider docs](/docs/sdk/instantiation#networkprovider) for details.
389
+
- Anyone can implement the NetworkProvider interface to create a custom provider. The CashScript SDK offers three providers out of the box: one based on electrum-cash (default), one based on FullStack.cash' infrastructure, and one based on BITBOX. See the [NetworkProvider docs](/docs/sdk/network-provider) for details.
390
390
- See the [migration notes](/docs/releases/migration-notes#v04-to-v05) for details on migrating from the old contract instantiation flow.
391
391
-:boom:**BREAKING**: Remove the artifacts `'networks'` field and `.deployed()` functionality, This proved to be confusing and is better suited to be handled outside of the CashScript SDK.
392
392
-:boom:**BREAKING**: `.send()` now returns a libauth Transaction instead of a BITBOX Transaction object. Alternatively a `raw` flag can be passed into the function to return a raw hex string.
Copy file name to clipboardExpand all lines: website/docs/sdk/instantiation.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@ contract.address: string
64
64
A contract's regular address (without token-support) can be retrieved through the `address` member field.
65
65
66
66
:::note
67
-
Wallets will not allow you to send CashTokens to this address. For that you must use the [tokenAddress](#tokenAddress) below. Wallets which have not upgraded might not recognize this new address type.
67
+
Wallets will not allow you to send CashTokens to this address. For that you must use the [tokenAddress](#tokenaddress) below. Wallets which have not upgraded might not recognize this new address type.
0 commit comments