@btc-vision/btc-runtime 1.10.8 → 1.10.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +258 -137
- package/SECURITY.md +226 -0
- package/docs/README.md +614 -0
- package/docs/advanced/bitcoin-scripts.md +939 -0
- package/docs/advanced/cross-contract-calls.md +579 -0
- package/docs/advanced/plugins.md +1006 -0
- package/docs/advanced/quantum-resistance.md +660 -0
- package/docs/advanced/signature-verification.md +715 -0
- package/docs/api-reference/blockchain.md +729 -0
- package/docs/api-reference/events.md +642 -0
- package/docs/api-reference/op20.md +902 -0
- package/docs/api-reference/op721.md +819 -0
- package/docs/api-reference/safe-math.md +510 -0
- package/docs/api-reference/storage.md +840 -0
- package/docs/contracts/op-net-base.md +786 -0
- package/docs/contracts/op20-token.md +687 -0
- package/docs/contracts/op20s-signatures.md +614 -0
- package/docs/contracts/op721-nft.md +785 -0
- package/docs/contracts/reentrancy-guard.md +787 -0
- package/docs/core-concepts/blockchain-environment.md +724 -0
- package/docs/core-concepts/decorators.md +466 -0
- package/docs/core-concepts/events.md +652 -0
- package/docs/core-concepts/pointers.md +391 -0
- package/docs/core-concepts/security.md +473 -0
- package/docs/core-concepts/storage-system.md +969 -0
- package/docs/examples/basic-token.md +745 -0
- package/docs/examples/nft-with-reservations.md +1440 -0
- package/docs/examples/oracle-integration.md +1212 -0
- package/docs/examples/stablecoin.md +1180 -0
- package/docs/getting-started/first-contract.md +575 -0
- package/docs/getting-started/installation.md +384 -0
- package/docs/getting-started/project-structure.md +630 -0
- package/docs/storage/memory-maps.md +764 -0
- package/docs/storage/stored-arrays.md +778 -0
- package/docs/storage/stored-maps.md +758 -0
- package/docs/storage/stored-primitives.md +655 -0
- package/docs/types/address.md +773 -0
- package/docs/types/bytes-writer-reader.md +938 -0
- package/docs/types/calldata.md +744 -0
- package/docs/types/safe-math.md +446 -0
- package/package.json +52 -27
- package/runtime/memory/MapOfMap.ts +1 -0
- package/LICENSE.md +0 -21
package/docs/README.md
ADDED
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
# Documentation
|
|
2
|
+
|
|
3
|
+
Welcome to the comprehensive documentation for **@btc-vision/btc-runtime**, the OPNet Smart Contract Runtime for Bitcoin L1.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/btc-vision/example-tokens.git
|
|
9
|
+
cd example-tokens
|
|
10
|
+
npm install
|
|
11
|
+
npm run build:token
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Complete Table of Contents
|
|
17
|
+
|
|
18
|
+
### Getting Started
|
|
19
|
+
|
|
20
|
+
#### [Installation](./getting-started/installation.md)
|
|
21
|
+
- [Quick Start - Clone Example Project](./getting-started/installation.md#quick-start---clone-example-project)
|
|
22
|
+
- [Prerequisites](./getting-started/installation.md#prerequisites)
|
|
23
|
+
- [Manual Setup](./getting-started/installation.md#manual-setup)
|
|
24
|
+
- [1. Create Project](./getting-started/installation.md#1-create-project)
|
|
25
|
+
- [2. Install Dependencies](./getting-started/installation.md#2-install-dependencies)
|
|
26
|
+
- [3. Create Configuration Files](./getting-started/installation.md#3-create-configuration-files)
|
|
27
|
+
- [4. Create Project Structure](./getting-started/installation.md#4-create-project-structure)
|
|
28
|
+
- [5. Build](./getting-started/installation.md#5-build)
|
|
29
|
+
- [Adding More Contracts](./getting-started/installation.md#adding-more-contracts)
|
|
30
|
+
- [Package Dependencies](./getting-started/installation.md#package-dependencies)
|
|
31
|
+
- [Troubleshooting](./getting-started/installation.md#troubleshooting)
|
|
32
|
+
|
|
33
|
+
#### [First Contract](./getting-started/first-contract.md)
|
|
34
|
+
- [What We're Building](./getting-started/first-contract.md#what-were-building)
|
|
35
|
+
- [Step 1: Create the Contract File](./getting-started/first-contract.md#step-1-create-the-contract-file)
|
|
36
|
+
- [Contract Lifecycle Overview](./getting-started/first-contract.md#contract-lifecycle-overview)
|
|
37
|
+
- [Step 2: Understanding the Code](./getting-started/first-contract.md#step-2-understanding-the-code)
|
|
38
|
+
- [Token Contract Architecture](./getting-started/first-contract.md#token-contract-architecture)
|
|
39
|
+
- [The Class Declaration](./getting-started/first-contract.md#the-class-declaration)
|
|
40
|
+
- [The Constructor](./getting-started/first-contract.md#the-constructor)
|
|
41
|
+
- [The Deployment Hook](./getting-started/first-contract.md#the-deployment-hook)
|
|
42
|
+
- [The Mint Function](./getting-started/first-contract.md#the-mint-function)
|
|
43
|
+
- [Mint Operation Data Flow](./getting-started/first-contract.md#mint-operation-data-flow)
|
|
44
|
+
- [Step 3: Understanding Types](./getting-started/first-contract.md#step-3-understanding-types)
|
|
45
|
+
- [u256 - Big Numbers](./getting-started/first-contract.md#u256---big-numbers)
|
|
46
|
+
- [Address](./getting-started/first-contract.md#address)
|
|
47
|
+
- [Calldata](./getting-started/first-contract.md#calldata)
|
|
48
|
+
- [Step 4: Inherited OP20 Methods](./getting-started/first-contract.md#step-4-inherited-op20-methods)
|
|
49
|
+
- [Step 5: Building the Contract](./getting-started/first-contract.md#step-5-building-the-contract)
|
|
50
|
+
- [Solidity Comparison](./getting-started/first-contract.md#solidity-comparison)
|
|
51
|
+
- [Common Patterns](./getting-started/first-contract.md#common-patterns)
|
|
52
|
+
- [Access Control](./getting-started/first-contract.md#access-control)
|
|
53
|
+
- [Error Handling](./getting-started/first-contract.md#error-handling)
|
|
54
|
+
- [Reading Storage](./getting-started/first-contract.md#reading-storage)
|
|
55
|
+
|
|
56
|
+
#### [Project Structure](./getting-started/project-structure.md)
|
|
57
|
+
- [Your Project Structure](./getting-started/project-structure.md#your-project-structure)
|
|
58
|
+
- [Project Directory Layout](./getting-started/project-structure.md#project-directory-layout)
|
|
59
|
+
- [Key Files](./getting-started/project-structure.md#key-files)
|
|
60
|
+
- [assembly/index.ts](./getting-started/project-structure.md#assemblyindexts)
|
|
61
|
+
- [asconfig.json](./getting-started/project-structure.md#asconfigjson)
|
|
62
|
+
- [package.json Scripts](./getting-started/project-structure.md#packagejson-scripts)
|
|
63
|
+
- [btc-runtime Library Structure](./getting-started/project-structure.md#btc-runtime-library-structure)
|
|
64
|
+
- [Runtime Library Architecture](./getting-started/project-structure.md#runtime-library-architecture)
|
|
65
|
+
- [Import Patterns](./getting-started/project-structure.md#import-patterns)
|
|
66
|
+
- [Basic Imports](./getting-started/project-structure.md#basic-imports)
|
|
67
|
+
- [Storage Types](./getting-started/project-structure.md#storage-types)
|
|
68
|
+
- [Events](./getting-started/project-structure.md#events)
|
|
69
|
+
- [Contract Initialization](./getting-started/project-structure.md#contract-initialization)
|
|
70
|
+
- [Storage Pointer System](./getting-started/project-structure.md#storage-pointer-system)
|
|
71
|
+
- [Contract Organization](./getting-started/project-structure.md#contract-organization)
|
|
72
|
+
- [Single Contract Project](./getting-started/project-structure.md#single-contract-project)
|
|
73
|
+
- [Multi-Contract Project](./getting-started/project-structure.md#multi-contract-project)
|
|
74
|
+
- [Shared Logic](./getting-started/project-structure.md#shared-logic)
|
|
75
|
+
- [Comparison with Solidity Projects](./getting-started/project-structure.md#comparison-with-solidity-projects)
|
|
76
|
+
- [Best Practices](./getting-started/project-structure.md#best-practices)
|
|
77
|
+
- [Testing Structure](./getting-started/project-structure.md#testing-structure)
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### Core Concepts
|
|
82
|
+
|
|
83
|
+
#### [Blockchain Environment](./core-concepts/blockchain-environment.md)
|
|
84
|
+
- [Overview](./core-concepts/blockchain-environment.md#overview)
|
|
85
|
+
- [Blockchain Singleton](./core-concepts/blockchain-environment.md#blockchain-singleton)
|
|
86
|
+
- [Transaction Context](./core-concepts/blockchain-environment.md#transaction-context)
|
|
87
|
+
- [Contract Context](./core-concepts/blockchain-environment.md#contract-context)
|
|
88
|
+
- [Network Information](./core-concepts/blockchain-environment.md#network-information)
|
|
89
|
+
- [Storage Operations](./core-concepts/blockchain-environment.md#storage-operations)
|
|
90
|
+
- [Event Emission](./core-concepts/blockchain-environment.md#event-emission)
|
|
91
|
+
- [Cross-Contract Calls](./core-concepts/blockchain-environment.md#cross-contract-calls)
|
|
92
|
+
- [Signature Verification](./core-concepts/blockchain-environment.md#signature-verification)
|
|
93
|
+
- [Solidity Comparison](./core-concepts/blockchain-environment.md#solidity-comparison)
|
|
94
|
+
|
|
95
|
+
#### [Storage System](./core-concepts/storage-system.md)
|
|
96
|
+
- [Overview](./core-concepts/storage-system.md#overview)
|
|
97
|
+
- [Storage Architecture](./core-concepts/storage-system.md#storage-architecture)
|
|
98
|
+
- [Pointer System](./core-concepts/storage-system.md#pointer-system)
|
|
99
|
+
- [Storage Types](./core-concepts/storage-system.md#storage-types)
|
|
100
|
+
- [Reading and Writing](./core-concepts/storage-system.md#reading-and-writing)
|
|
101
|
+
- [Solidity vs OPNet Comparison](./core-concepts/storage-system.md#solidity-vs-opnet-comparison)
|
|
102
|
+
- [Best Practices](./core-concepts/storage-system.md#best-practices)
|
|
103
|
+
|
|
104
|
+
#### [Pointers](./core-concepts/pointers.md)
|
|
105
|
+
- [Overview](./core-concepts/pointers.md#overview)
|
|
106
|
+
- [What is a Pointer?](./core-concepts/pointers.md#what-is-a-pointer)
|
|
107
|
+
- [Pointer Allocation](./core-concepts/pointers.md#pointer-allocation)
|
|
108
|
+
- [encodePointer](./core-concepts/pointers.md#encodepointer)
|
|
109
|
+
- [Sub-Pointers](./core-concepts/pointers.md#sub-pointers)
|
|
110
|
+
- [Best Practices](./core-concepts/pointers.md#best-practices)
|
|
111
|
+
|
|
112
|
+
#### [Events](./core-concepts/events.md)
|
|
113
|
+
- [Overview](./core-concepts/events.md#overview)
|
|
114
|
+
- [Event Architecture](./core-concepts/events.md#event-architecture)
|
|
115
|
+
- [Creating Events](./core-concepts/events.md#creating-events)
|
|
116
|
+
- [Emitting Events](./core-concepts/events.md#emitting-events)
|
|
117
|
+
- [Built-in Events](./core-concepts/events.md#built-in-events)
|
|
118
|
+
- [Best Practices](./core-concepts/events.md#best-practices)
|
|
119
|
+
|
|
120
|
+
#### [Decorators](./core-concepts/decorators.md)
|
|
121
|
+
- [Overview](./core-concepts/decorators.md#overview)
|
|
122
|
+
- [@method](./core-concepts/decorators.md#method)
|
|
123
|
+
- [@returns](./core-concepts/decorators.md#returns)
|
|
124
|
+
- [@emit](./core-concepts/decorators.md#emit)
|
|
125
|
+
- [ABIDataTypes](./core-concepts/decorators.md#abidatatypes)
|
|
126
|
+
- [Complete Example](./core-concepts/decorators.md#complete-example)
|
|
127
|
+
|
|
128
|
+
#### [Security](./core-concepts/security.md)
|
|
129
|
+
- [Overview](./core-concepts/security.md#overview)
|
|
130
|
+
- [Reentrancy Protection](./core-concepts/security.md#reentrancy-protection)
|
|
131
|
+
- [Access Control](./core-concepts/security.md#access-control)
|
|
132
|
+
- [Input Validation](./core-concepts/security.md#input-validation)
|
|
133
|
+
- [Overflow Protection](./core-concepts/security.md#overflow-protection)
|
|
134
|
+
- [Best Practices](./core-concepts/security.md#best-practices)
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### Contract Standards
|
|
139
|
+
|
|
140
|
+
#### [OP_NET Base Contract](./contracts/op-net-base.md)
|
|
141
|
+
- [Overview](./contracts/op-net-base.md#overview)
|
|
142
|
+
- [Contract Lifecycle](./contracts/op-net-base.md#contract-lifecycle)
|
|
143
|
+
- [Inheritance Hierarchy](./contracts/op-net-base.md#inheritance-hierarchy)
|
|
144
|
+
- [Deployment and Execution Flow](./contracts/op-net-base.md#deployment-and-execution-flow)
|
|
145
|
+
- [1. Construction](./contracts/op-net-base.md#1-construction)
|
|
146
|
+
- [2. Deployment (onDeployment)](./contracts/op-net-base.md#2-deployment-ondeployment)
|
|
147
|
+
- [3. Method Execution (execute)](./contracts/op-net-base.md#3-method-execution-execute)
|
|
148
|
+
- [Transaction Sequence](./contracts/op-net-base.md#transaction-sequence)
|
|
149
|
+
- [Method Selectors](./contracts/op-net-base.md#method-selectors)
|
|
150
|
+
- [Solidity Comparison](./contracts/op-net-base.md#solidity-comparison)
|
|
151
|
+
- [Access Control](./contracts/op-net-base.md#access-control)
|
|
152
|
+
- [onlyDeployer](./contracts/op-net-base.md#onlydeployer)
|
|
153
|
+
- [Custom Access Control](./contracts/op-net-base.md#custom-access-control)
|
|
154
|
+
- [Event Emission](./contracts/op-net-base.md#event-emission)
|
|
155
|
+
- [Storage Patterns](./contracts/op-net-base.md#storage-patterns)
|
|
156
|
+
- [Pointer Allocation](./contracts/op-net-base.md#pointer-allocation)
|
|
157
|
+
- [Storage Maps](./contracts/op-net-base.md#storage-maps)
|
|
158
|
+
- [Complete Example](./contracts/op-net-base.md#complete-example)
|
|
159
|
+
- [Inheritance](./contracts/op-net-base.md#inheritance)
|
|
160
|
+
- [Extending OP_NET](./contracts/op-net-base.md#extending-op_net)
|
|
161
|
+
- [Adding Functionality](./contracts/op-net-base.md#adding-functionality)
|
|
162
|
+
- [Best Practices](./contracts/op-net-base.md#best-practices)
|
|
163
|
+
|
|
164
|
+
#### [OP20 Token Standard](./contracts/op20-token.md)
|
|
165
|
+
- [Overview](./contracts/op20-token.md#overview)
|
|
166
|
+
- [ERC20 vs OP20 Comparison](./contracts/op20-token.md#erc20-vs-op20-comparison)
|
|
167
|
+
- [Initialization](./contracts/op20-token.md#initialization)
|
|
168
|
+
- [OP20InitParameters](./contracts/op20-token.md#op20initparameters)
|
|
169
|
+
- [Decimal Limit](./contracts/op20-token.md#decimal-limit)
|
|
170
|
+
- [Transfer Flow](./contracts/op20-token.md#transfer-flow)
|
|
171
|
+
- [Detailed Transfer Sequence](./contracts/op20-token.md#detailed-transfer-sequence)
|
|
172
|
+
- [Token Lifecycle](./contracts/op20-token.md#token-lifecycle)
|
|
173
|
+
- [Built-in Methods](./contracts/op20-token.md#built-in-methods)
|
|
174
|
+
- [Query Methods](./contracts/op20-token.md#query-methods)
|
|
175
|
+
- [Transfer Methods](./contracts/op20-token.md#transfer-methods)
|
|
176
|
+
- [Approval Methods](./contracts/op20-token.md#approval-methods)
|
|
177
|
+
- [Approval Flow](./contracts/op20-token.md#approval-flow)
|
|
178
|
+
- [Solidity Comparison](./contracts/op20-token.md#solidity-comparison)
|
|
179
|
+
- [Storage Layout](./contracts/op20-token.md#storage-layout)
|
|
180
|
+
- [Extending OP20](./contracts/op20-token.md#extending-op20)
|
|
181
|
+
- [Adding Custom Methods](./contracts/op20-token.md#adding-custom-methods)
|
|
182
|
+
- [Internal Methods](./contracts/op20-token.md#internal-methods)
|
|
183
|
+
- [Events](./contracts/op20-token.md#events)
|
|
184
|
+
- [TransferEvent](./contracts/op20-token.md#transferevent)
|
|
185
|
+
- [ApprovalEvent](./contracts/op20-token.md#approvalevent)
|
|
186
|
+
- [Approval Patterns](./contracts/op20-token.md#approval-patterns)
|
|
187
|
+
- [Standard Approval](./contracts/op20-token.md#standard-approval)
|
|
188
|
+
- [Unlimited Approval](./contracts/op20-token.md#unlimited-approval)
|
|
189
|
+
- [Increase/Decrease Pattern](./contracts/op20-token.md#increasedecrease-pattern)
|
|
190
|
+
- [Edge Cases](./contracts/op20-token.md#edge-cases)
|
|
191
|
+
- [Zero Address](./contracts/op20-token.md#zero-address)
|
|
192
|
+
- [Overflow Protection](./contracts/op20-token.md#overflow-protection)
|
|
193
|
+
- [Self-Approval](./contracts/op20-token.md#self-approval)
|
|
194
|
+
- [Complete Token Example](./contracts/op20-token.md#complete-token-example)
|
|
195
|
+
- [Best Practices](./contracts/op20-token.md#best-practices)
|
|
196
|
+
|
|
197
|
+
#### [OP20S - Signature-Based Approvals](./contracts/op20s-signatures.md)
|
|
198
|
+
- [Overview](./contracts/op20s-signatures.md#overview)
|
|
199
|
+
- [ERC20Permit vs OP20S Comparison](./contracts/op20s-signatures.md#erc20permit-vs-op20s-comparison)
|
|
200
|
+
- [Why Signature-Based Approvals?](./contracts/op20s-signatures.md#why-signature-based-approvals)
|
|
201
|
+
- [Traditional Approval Flow](./contracts/op20s-signatures.md#traditional-approval-flow)
|
|
202
|
+
- [Signature-Based Flow](./contracts/op20s-signatures.md#signature-based-flow)
|
|
203
|
+
- [Permit Flow](./contracts/op20s-signatures.md#permit-flow)
|
|
204
|
+
- [Detailed Permit Sequence](./contracts/op20s-signatures.md#detailed-permit-sequence)
|
|
205
|
+
- [Message Construction](./contracts/op20s-signatures.md#message-construction)
|
|
206
|
+
- [Nonce Management](./contracts/op20s-signatures.md#nonce-management)
|
|
207
|
+
- [Permit Method](./contracts/op20s-signatures.md#permit-method)
|
|
208
|
+
- [Usage](./contracts/op20s-signatures.md#usage)
|
|
209
|
+
- [Parameters](./contracts/op20s-signatures.md#parameters)
|
|
210
|
+
- [Signature Verification](./contracts/op20s-signatures.md#signature-verification)
|
|
211
|
+
- [Nonces](./contracts/op20s-signatures.md#nonces)
|
|
212
|
+
- [Replay Protection](./contracts/op20s-signatures.md#replay-protection)
|
|
213
|
+
- [Solidity Comparison (EIP-2612)](./contracts/op20s-signatures.md#solidity-comparison-eip-2612)
|
|
214
|
+
- [Domain Separator](./contracts/op20s-signatures.md#domain-separator)
|
|
215
|
+
- [Quantum Resistance](./contracts/op20s-signatures.md#quantum-resistance)
|
|
216
|
+
- [Extended Address](./contracts/op20s-signatures.md#extended-address)
|
|
217
|
+
- [Implementation Details](./contracts/op20s-signatures.md#implementation-details)
|
|
218
|
+
- [Permit Verification](./contracts/op20s-signatures.md#permit-verification)
|
|
219
|
+
- [Message Format](./contracts/op20s-signatures.md#message-format)
|
|
220
|
+
- [Additional Methods](./contracts/op20s-signatures.md#additional-methods)
|
|
221
|
+
- [Use Cases](./contracts/op20s-signatures.md#use-cases)
|
|
222
|
+
- [1. Off-Chain Approvals](./contracts/op20s-signatures.md#1-off-chain-approvals)
|
|
223
|
+
- [2. Single-Transaction Approve+Transfer](./contracts/op20s-signatures.md#2-single-transaction-approvetransfer)
|
|
224
|
+
- [3. Meta-Transactions](./contracts/op20s-signatures.md#3-meta-transactions)
|
|
225
|
+
- [Security Considerations](./contracts/op20s-signatures.md#security-considerations)
|
|
226
|
+
- [Deadline Selection](./contracts/op20s-signatures.md#deadline-selection)
|
|
227
|
+
- [Signature Storage](./contracts/op20s-signatures.md#signature-storage)
|
|
228
|
+
- [Front-Running Protection](./contracts/op20s-signatures.md#front-running-protection)
|
|
229
|
+
- [Best Practices](./contracts/op20s-signatures.md#best-practices)
|
|
230
|
+
|
|
231
|
+
#### [OP721 NFT Standard](./contracts/op721-nft.md)
|
|
232
|
+
- [Overview](./contracts/op721-nft.md#overview)
|
|
233
|
+
- [ERC721 vs OP721 Comparison](./contracts/op721-nft.md#erc721-vs-op721-comparison)
|
|
234
|
+
- [Initialization](./contracts/op721-nft.md#initialization)
|
|
235
|
+
- [OP721InitParameters](./contracts/op721-nft.md#op721initparameters)
|
|
236
|
+
- [Minting Flow](./contracts/op721-nft.md#minting-flow)
|
|
237
|
+
- [Transfer Sequence](./contracts/op721-nft.md#transfer-sequence)
|
|
238
|
+
- [Safe Transfer Pattern](./contracts/op721-nft.md#safe-transfer-pattern)
|
|
239
|
+
- [NFT Lifecycle](./contracts/op721-nft.md#nft-lifecycle)
|
|
240
|
+
- [Token Existence States](./contracts/op721-nft.md#token-existence-states)
|
|
241
|
+
- [Built-in Methods](./contracts/op721-nft.md#built-in-methods)
|
|
242
|
+
- [Query Methods](./contracts/op721-nft.md#query-methods)
|
|
243
|
+
- [Transfer Methods](./contracts/op721-nft.md#transfer-methods)
|
|
244
|
+
- [Approval Methods](./contracts/op721-nft.md#approval-methods)
|
|
245
|
+
- [Solidity Comparison](./contracts/op721-nft.md#solidity-comparison)
|
|
246
|
+
- [Storage Layout](./contracts/op721-nft.md#storage-layout)
|
|
247
|
+
- [Extending OP721](./contracts/op721-nft.md#extending-op721)
|
|
248
|
+
- [Adding Minting](./contracts/op721-nft.md#adding-minting)
|
|
249
|
+
- [Adding Token URIs](./contracts/op721-nft.md#adding-token-uris)
|
|
250
|
+
- [Collection Metadata](./contracts/op721-nft.md#collection-metadata)
|
|
251
|
+
- [Internal Methods](./contracts/op721-nft.md#internal-methods)
|
|
252
|
+
- [Enumeration](./contracts/op721-nft.md#enumeration)
|
|
253
|
+
- [Swap-Last Removal Pattern](./contracts/op721-nft.md#swap-last-removal-pattern)
|
|
254
|
+
- [Events](./contracts/op721-nft.md#events)
|
|
255
|
+
- [Edge Cases](./contracts/op721-nft.md#edge-cases)
|
|
256
|
+
- [Token ID Uniqueness](./contracts/op721-nft.md#token-id-uniqueness)
|
|
257
|
+
- [Zero Token ID](./contracts/op721-nft.md#zero-token-id)
|
|
258
|
+
- [Owner Truncation](./contracts/op721-nft.md#owner-truncation)
|
|
259
|
+
- [Complete NFT Example](./contracts/op721-nft.md#complete-nft-example)
|
|
260
|
+
- [Best Practices](./contracts/op721-nft.md#best-practices)
|
|
261
|
+
|
|
262
|
+
#### [ReentrancyGuard](./contracts/reentrancy-guard.md)
|
|
263
|
+
- [Overview](./contracts/reentrancy-guard.md#overview)
|
|
264
|
+
- [OpenZeppelin vs OPNet ReentrancyGuard](./contracts/reentrancy-guard.md#openzeppelin-vs-opnet-reentrancyguard)
|
|
265
|
+
- [What is Reentrancy?](./contracts/reentrancy-guard.md#what-is-reentrancy)
|
|
266
|
+
- [The Attack](./contracts/reentrancy-guard.md#the-attack)
|
|
267
|
+
- [The Defense](./contracts/reentrancy-guard.md#the-defense)
|
|
268
|
+
- [Guard Mechanism](./contracts/reentrancy-guard.md#guard-mechanism)
|
|
269
|
+
- [Vulnerable Contract Attack](./contracts/reentrancy-guard.md#vulnerable-contract-attack)
|
|
270
|
+
- [Protected Contract Defense](./contracts/reentrancy-guard.md#protected-contract-defense)
|
|
271
|
+
- [Choosing a Guard Mode](./contracts/reentrancy-guard.md#choosing-a-guard-mode)
|
|
272
|
+
- [Guard Modes](./contracts/reentrancy-guard.md#guard-modes)
|
|
273
|
+
- [STANDARD Mode](./contracts/reentrancy-guard.md#standard-mode)
|
|
274
|
+
- [CALLBACK Mode](./contracts/reentrancy-guard.md#callback-mode)
|
|
275
|
+
- [How It Works](./contracts/reentrancy-guard.md#how-it-works)
|
|
276
|
+
- [Internal State](./contracts/reentrancy-guard.md#internal-state)
|
|
277
|
+
- [STANDARD Mode Logic](./contracts/reentrancy-guard.md#standard-mode-logic)
|
|
278
|
+
- [CALLBACK Mode Logic](./contracts/reentrancy-guard.md#callback-mode-logic)
|
|
279
|
+
- [Usage Patterns](./contracts/reentrancy-guard.md#usage-patterns)
|
|
280
|
+
- [Basic Protection](./contracts/reentrancy-guard.md#basic-protection)
|
|
281
|
+
- [Combined with Other Bases](./contracts/reentrancy-guard.md#combined-with-other-bases)
|
|
282
|
+
- [Excluded Methods](./contracts/reentrancy-guard.md#excluded-methods)
|
|
283
|
+
- [Solidity Comparison](./contracts/reentrancy-guard.md#solidity-comparison)
|
|
284
|
+
- [Best Practices](./contracts/reentrancy-guard.md#best-practices)
|
|
285
|
+
- [Common Mistakes](./contracts/reentrancy-guard.md#common-mistakes)
|
|
286
|
+
- [Testing Reentrancy](./contracts/reentrancy-guard.md#testing-reentrancy)
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
### Types & Utilities
|
|
291
|
+
|
|
292
|
+
#### [Address](./types/address.md)
|
|
293
|
+
- [Overview](./types/address.md#overview)
|
|
294
|
+
- [Creating Addresses](./types/address.md#creating-addresses)
|
|
295
|
+
- [Address Comparison](./types/address.md#address-comparison)
|
|
296
|
+
- [Special Addresses](./types/address.md#special-addresses)
|
|
297
|
+
- [Address Methods](./types/address.md#address-methods)
|
|
298
|
+
- [Solidity vs OPNet Comparison](./types/address.md#solidity-vs-opnet-comparison)
|
|
299
|
+
- [Best Practices](./types/address.md#best-practices)
|
|
300
|
+
|
|
301
|
+
#### [SafeMath](./types/safe-math.md)
|
|
302
|
+
- [Overview](./types/safe-math.md#overview)
|
|
303
|
+
- [Basic Operations](./types/safe-math.md#basic-operations)
|
|
304
|
+
- [Modular Operations](./types/safe-math.md#modular-operations)
|
|
305
|
+
- [Comparison](./types/safe-math.md#comparison)
|
|
306
|
+
- [Best Practices](./types/safe-math.md#best-practices)
|
|
307
|
+
|
|
308
|
+
#### [Calldata](./types/calldata.md)
|
|
309
|
+
- [Overview](./types/calldata.md#overview)
|
|
310
|
+
- [Reading Values](./types/calldata.md#reading-values)
|
|
311
|
+
- [Reading Arrays](./types/calldata.md#reading-arrays)
|
|
312
|
+
- [Reading Complex Types](./types/calldata.md#reading-complex-types)
|
|
313
|
+
- [Solidity vs OPNet Comparison](./types/calldata.md#solidity-vs-opnet-comparison)
|
|
314
|
+
- [Best Practices](./types/calldata.md#best-practices)
|
|
315
|
+
|
|
316
|
+
#### [BytesWriter/Reader](./types/bytes-writer-reader.md)
|
|
317
|
+
- [Overview](./types/bytes-writer-reader.md#overview)
|
|
318
|
+
- [BytesWriter](./types/bytes-writer-reader.md#byteswriter)
|
|
319
|
+
- [BytesReader](./types/bytes-writer-reader.md#bytesreader)
|
|
320
|
+
- [Solidity vs OPNet Comparison](./types/bytes-writer-reader.md#solidity-vs-opnet-comparison)
|
|
321
|
+
- [Migration Patterns](./types/bytes-writer-reader.md#migration-patterns)
|
|
322
|
+
- [Best Practices](./types/bytes-writer-reader.md#best-practices)
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
### Storage Types
|
|
327
|
+
|
|
328
|
+
#### [Stored Primitives](./storage/stored-primitives.md)
|
|
329
|
+
- [Overview](./storage/stored-primitives.md#overview)
|
|
330
|
+
- [Class Hierarchy](./storage/stored-primitives.md#class-hierarchy)
|
|
331
|
+
- [Available Types](./storage/stored-primitives.md#available-types)
|
|
332
|
+
- [Storage Key Generation](./storage/stored-primitives.md#storage-key-generation)
|
|
333
|
+
- [Usage](./storage/stored-primitives.md#usage)
|
|
334
|
+
- [StoredU256](./storage/stored-primitives.md#storedu256)
|
|
335
|
+
- [StoredBoolean](./storage/stored-primitives.md#storedboolean)
|
|
336
|
+
- [StoredString](./storage/stored-primitives.md#storedstring)
|
|
337
|
+
- [StoredAddress](./storage/stored-primitives.md#storedaddress)
|
|
338
|
+
- [Storage Behavior](./storage/stored-primitives.md#storage-behavior)
|
|
339
|
+
- [Lazy Loading (Value Read Flow)](./storage/stored-primitives.md#lazy-loading-value-read-flow)
|
|
340
|
+
- [Automatic Commit (Value Write Flow)](./storage/stored-primitives.md#automatic-commit-value-write-flow)
|
|
341
|
+
- [Manual Commit Control](./storage/stored-primitives.md#manual-commit-control)
|
|
342
|
+
- [Initialization](./storage/stored-primitives.md#initialization)
|
|
343
|
+
- [Default Values](./storage/stored-primitives.md#default-values)
|
|
344
|
+
- [Setting Initial Values](./storage/stored-primitives.md#setting-initial-values)
|
|
345
|
+
- [Solidity vs OPNet Comparison](./storage/stored-primitives.md#solidity-vs-opnet-comparison)
|
|
346
|
+
- [Side-by-Side Code Examples](./storage/stored-primitives.md#side-by-side-code-examples)
|
|
347
|
+
- [Counter Contract](./storage/stored-primitives.md#counter-contract)
|
|
348
|
+
- [Ownable Contract](./storage/stored-primitives.md#ownable-contract)
|
|
349
|
+
- [Patterns](./storage/stored-primitives.md#patterns)
|
|
350
|
+
- [Read-Modify-Write](./storage/stored-primitives.md#read-modify-write)
|
|
351
|
+
- [Conditional Updates](./storage/stored-primitives.md#conditional-updates)
|
|
352
|
+
- [View Functions](./storage/stored-primitives.md#view-functions)
|
|
353
|
+
- [Best Practices](./storage/stored-primitives.md#best-practices)
|
|
354
|
+
|
|
355
|
+
#### [Stored Arrays](./storage/stored-arrays.md)
|
|
356
|
+
- [Overview](./storage/stored-arrays.md#overview)
|
|
357
|
+
- [Available Types](./storage/stored-arrays.md#available-types)
|
|
358
|
+
- [Storage Structure](./storage/stored-arrays.md#storage-structure)
|
|
359
|
+
- [Size Limits](./storage/stored-arrays.md#size-limits)
|
|
360
|
+
- [Operations](./storage/stored-arrays.md#operations)
|
|
361
|
+
- [Push](./storage/stored-arrays.md#push)
|
|
362
|
+
- [Pop](./storage/stored-arrays.md#pop)
|
|
363
|
+
- [Get](./storage/stored-arrays.md#get)
|
|
364
|
+
- [Set](./storage/stored-arrays.md#set)
|
|
365
|
+
- [Length](./storage/stored-arrays.md#length)
|
|
366
|
+
- [Solidity vs OPNet Comparison](./storage/stored-arrays.md#solidity-vs-opnet-comparison)
|
|
367
|
+
- [Side-by-Side Code Examples](./storage/stored-arrays.md#side-by-side-code-examples)
|
|
368
|
+
- [Simple Address List](./storage/stored-arrays.md#simple-address-list)
|
|
369
|
+
- [Value Queue (FIFO-like with array)](./storage/stored-arrays.md#value-queue-fifo-like-with-array)
|
|
370
|
+
- [Common Patterns](./storage/stored-arrays.md#common-patterns)
|
|
371
|
+
- [Iterating](./storage/stored-arrays.md#iterating)
|
|
372
|
+
- [Finding Elements](./storage/stored-arrays.md#finding-elements)
|
|
373
|
+
- [Removing Elements](./storage/stored-arrays.md#removing-elements)
|
|
374
|
+
- [Unique Elements Set](./storage/stored-arrays.md#unique-elements-set)
|
|
375
|
+
- [Use Cases](./storage/stored-arrays.md#use-cases)
|
|
376
|
+
- [Token Holder Tracking](./storage/stored-arrays.md#token-holder-tracking)
|
|
377
|
+
- [Order Queue](./storage/stored-arrays.md#order-queue)
|
|
378
|
+
- [Whitelist Management](./storage/stored-arrays.md#whitelist-management)
|
|
379
|
+
- [Best Practices](./storage/stored-arrays.md#best-practices)
|
|
380
|
+
|
|
381
|
+
#### [Stored Maps](./storage/stored-maps.md)
|
|
382
|
+
- [Overview](./storage/stored-maps.md#overview)
|
|
383
|
+
- [CRITICAL: Map Implementation Warning](./storage/stored-maps.md#critical-map-implementation-warning)
|
|
384
|
+
- [StoredMapU256](./storage/stored-maps.md#storedmapu256)
|
|
385
|
+
- [Storage Layout](./storage/stored-maps.md#storage-layout)
|
|
386
|
+
- [Using Address Keys](./storage/stored-maps.md#using-address-keys)
|
|
387
|
+
- [Nested Maps](./storage/stored-maps.md#nested-maps)
|
|
388
|
+
- [MapOfMap](./storage/stored-maps.md#mapofmap)
|
|
389
|
+
- [MapOfMap Get/Set Pattern](./storage/stored-maps.md#mapofmap-getset-pattern)
|
|
390
|
+
- [Solidity vs OPNet Comparison](./storage/stored-maps.md#solidity-vs-opnet-comparison)
|
|
391
|
+
- [Side-by-Side Code Examples](./storage/stored-maps.md#side-by-side-code-examples)
|
|
392
|
+
- [Simple Key-Value Store](./storage/stored-maps.md#simple-key-value-store)
|
|
393
|
+
- [Approval System with Nested Mapping](./storage/stored-maps.md#approval-system-with-nested-mapping)
|
|
394
|
+
- [Common Patterns](./storage/stored-maps.md#common-patterns)
|
|
395
|
+
- [Counter/Nonce Tracking](./storage/stored-maps.md#counternonce-tracking)
|
|
396
|
+
- [Role Management](./storage/stored-maps.md#role-management)
|
|
397
|
+
- [Token Metadata Storage](./storage/stored-maps.md#token-metadata-storage)
|
|
398
|
+
- [Snapshot/Checkpoint Pattern](./storage/stored-maps.md#snapshotcheckpoint-pattern)
|
|
399
|
+
- [Best Practices](./storage/stored-maps.md#best-practices)
|
|
400
|
+
|
|
401
|
+
#### [Memory Maps](./storage/memory-maps.md)
|
|
402
|
+
- [Overview](./storage/memory-maps.md#overview)
|
|
403
|
+
- [AddressMemoryMap](./storage/memory-maps.md#addressmemorymap)
|
|
404
|
+
- [Constructor Pattern](./storage/memory-maps.md#constructor-pattern)
|
|
405
|
+
- [Methods](./storage/memory-maps.md#methods)
|
|
406
|
+
- [Storage Flow](./storage/memory-maps.md#storage-flow)
|
|
407
|
+
- [Address to Storage Key](./storage/memory-maps.md#address-to-storage-key)
|
|
408
|
+
- [Solidity vs OPNet Comparison](./storage/memory-maps.md#solidity-vs-opnet-comparison)
|
|
409
|
+
- [Side-by-Side Code Examples](./storage/memory-maps.md#side-by-side-code-examples)
|
|
410
|
+
- [Basic Token Balance Tracking](./storage/memory-maps.md#basic-token-balance-tracking)
|
|
411
|
+
- [Staking Contract](./storage/memory-maps.md#staking-contract)
|
|
412
|
+
- [Usage Examples](./storage/memory-maps.md#usage-examples)
|
|
413
|
+
- [Basic Balance Tracking](./storage/memory-maps.md#basic-balance-tracking)
|
|
414
|
+
- [Approval Tracking](./storage/memory-maps.md#approval-tracking)
|
|
415
|
+
- [Staking with Multiple Values](./storage/memory-maps.md#staking-with-multiple-values)
|
|
416
|
+
- [Storage vs Memory](./storage/memory-maps.md#storage-vs-memory)
|
|
417
|
+
- [Storage (Persistent)](./storage/memory-maps.md#storage-persistent)
|
|
418
|
+
- [In-Memory Collections](./storage/memory-maps.md#in-memory-collections)
|
|
419
|
+
- [Warning: AssemblyScript Map vs btc-runtime Map](./storage/memory-maps.md#warning-assemblyscript-map-vs-btc-runtime-map)
|
|
420
|
+
- [Patterns](./storage/memory-maps.md#patterns)
|
|
421
|
+
- [Enumerable Map](./storage/memory-maps.md#enumerable-map)
|
|
422
|
+
- [Lazy Initialization](./storage/memory-maps.md#lazy-initialization)
|
|
423
|
+
- [Read-Modify-Write Pattern](./storage/memory-maps.md#read-modify-write-pattern)
|
|
424
|
+
- [Best Practices](./storage/memory-maps.md#best-practices)
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
### Advanced Topics
|
|
429
|
+
|
|
430
|
+
#### [Cross-Contract Calls](./advanced/cross-contract-calls.md)
|
|
431
|
+
- [Architecture Overview](./advanced/cross-contract-calls.md#architecture-overview)
|
|
432
|
+
- [Overview](./advanced/cross-contract-calls.md#overview)
|
|
433
|
+
- [Making Calls](./advanced/cross-contract-calls.md#making-calls)
|
|
434
|
+
- [Basic Call](./advanced/cross-contract-calls.md#basic-call)
|
|
435
|
+
- [Call Parameters](./advanced/cross-contract-calls.md#call-parameters)
|
|
436
|
+
- [stopOnFailure Behavior](./advanced/cross-contract-calls.md#stoponfailure-behavior)
|
|
437
|
+
- [Handling Results](./advanced/cross-contract-calls.md#handling-results)
|
|
438
|
+
- [CallResult Structure](./advanced/cross-contract-calls.md#callresult-structure)
|
|
439
|
+
- [Processing Return Data](./advanced/cross-contract-calls.md#processing-return-data)
|
|
440
|
+
- [Error Handling](./advanced/cross-contract-calls.md#error-handling)
|
|
441
|
+
- [Common Patterns](./advanced/cross-contract-calls.md#common-patterns)
|
|
442
|
+
- [Calling Token Transfers](./advanced/cross-contract-calls.md#calling-token-transfers)
|
|
443
|
+
- [Calling TransferFrom](./advanced/cross-contract-calls.md#calling-transferfrom)
|
|
444
|
+
- [Querying Another Contract](./advanced/cross-contract-calls.md#querying-another-contract)
|
|
445
|
+
- [Multi-Call Pattern](./advanced/cross-contract-calls.md#multi-call-pattern)
|
|
446
|
+
- [Solidity Comparison](./advanced/cross-contract-calls.md#solidity-comparison)
|
|
447
|
+
- [Security Considerations](./advanced/cross-contract-calls.md#security-considerations)
|
|
448
|
+
- [1. Reentrancy Risk](./advanced/cross-contract-calls.md#1-reentrancy-risk)
|
|
449
|
+
- [2. Return Value Validation](./advanced/cross-contract-calls.md#2-return-value-validation)
|
|
450
|
+
- [3. Trust Assumptions](./advanced/cross-contract-calls.md#3-trust-assumptions)
|
|
451
|
+
- [Advanced Patterns](./advanced/cross-contract-calls.md#advanced-patterns)
|
|
452
|
+
- [Interface Abstraction](./advanced/cross-contract-calls.md#interface-abstraction)
|
|
453
|
+
- [Callback Pattern](./advanced/cross-contract-calls.md#callback-pattern)
|
|
454
|
+
|
|
455
|
+
#### [Signature Verification](./advanced/signature-verification.md)
|
|
456
|
+
- [Overview](./advanced/signature-verification.md#overview)
|
|
457
|
+
- [Supported Signature Schemes](./advanced/signature-verification.md#supported-signature-schemes)
|
|
458
|
+
- [Schnorr Signatures](./advanced/signature-verification.md#schnorr-signatures)
|
|
459
|
+
- [ML-DSA Signatures](./advanced/signature-verification.md#ml-dsa-signatures)
|
|
460
|
+
- [Verification API](./advanced/signature-verification.md#verification-api)
|
|
461
|
+
- [Solidity vs OPNet Comparison](./advanced/signature-verification.md#solidity-vs-opnet-comparison)
|
|
462
|
+
- [Best Practices](./advanced/signature-verification.md#best-practices)
|
|
463
|
+
|
|
464
|
+
#### [Quantum Resistance](./advanced/quantum-resistance.md)
|
|
465
|
+
- [Overview](./advanced/quantum-resistance.md#overview)
|
|
466
|
+
- [ML-DSA (FIPS 204)](./advanced/quantum-resistance.md#ml-dsa-fips-204)
|
|
467
|
+
- [Security Levels](./advanced/quantum-resistance.md#security-levels)
|
|
468
|
+
- [The Address Class](./advanced/quantum-resistance.md#the-address-class)
|
|
469
|
+
- [Migration Path](./advanced/quantum-resistance.md#migration-path)
|
|
470
|
+
- [Solidity vs OPNet Comparison](./advanced/quantum-resistance.md#solidity-vs-opnet-comparison)
|
|
471
|
+
- [Best Practices](./advanced/quantum-resistance.md#best-practices)
|
|
472
|
+
|
|
473
|
+
#### [Bitcoin Scripts](./advanced/bitcoin-scripts.md)
|
|
474
|
+
- [Overview](./advanced/bitcoin-scripts.md#overview)
|
|
475
|
+
- [BitcoinOpcodes](./advanced/bitcoin-scripts.md#bitcoinopcodes)
|
|
476
|
+
- [Address Generation](./advanced/bitcoin-scripts.md#address-generation)
|
|
477
|
+
- [P2WPKH](./advanced/bitcoin-scripts.md#p2wpkh)
|
|
478
|
+
- [P2TR](./advanced/bitcoin-scripts.md#p2tr)
|
|
479
|
+
- [P2WSH](./advanced/bitcoin-scripts.md#p2wsh)
|
|
480
|
+
- [Script Building](./advanced/bitcoin-scripts.md#script-building)
|
|
481
|
+
- [P2PKH Script](./advanced/bitcoin-scripts.md#p2pkh-script)
|
|
482
|
+
- [Multisig Scripts](./advanced/bitcoin-scripts.md#multisig-scripts)
|
|
483
|
+
- [Timelocks](./advanced/bitcoin-scripts.md#timelocks)
|
|
484
|
+
- [CSV (CheckSequenceVerify)](./advanced/bitcoin-scripts.md#csv-checksequenceverify)
|
|
485
|
+
- [CLTV (CheckLockTimeVerify)](./advanced/bitcoin-scripts.md#cltv-checklockimeverify)
|
|
486
|
+
- [Script Analysis](./advanced/bitcoin-scripts.md#script-analysis)
|
|
487
|
+
- [Solidity vs OPNet Comparison](./advanced/bitcoin-scripts.md#solidity-vs-opnet-comparison)
|
|
488
|
+
- [Best Practices](./advanced/bitcoin-scripts.md#best-practices)
|
|
489
|
+
|
|
490
|
+
#### [Plugins](./advanced/plugins.md)
|
|
491
|
+
- [Overview](./advanced/plugins.md#overview)
|
|
492
|
+
- [Plugin Architecture](./advanced/plugins.md#plugin-architecture)
|
|
493
|
+
- [Creating Plugins](./advanced/plugins.md#creating-plugins)
|
|
494
|
+
- [Lifecycle Hooks](./advanced/plugins.md#lifecycle-hooks)
|
|
495
|
+
- [onDeployment](./advanced/plugins.md#ondeployment)
|
|
496
|
+
- [onExecutionStarted](./advanced/plugins.md#onexecutionstarted)
|
|
497
|
+
- [onExecutionCompleted](./advanced/plugins.md#onexecutioncompleted)
|
|
498
|
+
- [Built-in Plugins](./advanced/plugins.md#built-in-plugins)
|
|
499
|
+
- [Solidity vs OPNet Comparison](./advanced/plugins.md#solidity-vs-opnet-comparison)
|
|
500
|
+
- [Best Practices](./advanced/plugins.md#best-practices)
|
|
501
|
+
|
|
502
|
+
---
|
|
503
|
+
|
|
504
|
+
### Examples
|
|
505
|
+
|
|
506
|
+
#### [Basic Token](./examples/basic-token.md)
|
|
507
|
+
- [Overview](./examples/basic-token.md#overview)
|
|
508
|
+
- [Complete Code](./examples/basic-token.md#complete-code)
|
|
509
|
+
- [Code Walkthrough](./examples/basic-token.md#code-walkthrough)
|
|
510
|
+
- [Solidity Comparison](./examples/basic-token.md#solidity-comparison)
|
|
511
|
+
- [Deployment](./examples/basic-token.md#deployment)
|
|
512
|
+
- [Testing](./examples/basic-token.md#testing)
|
|
513
|
+
|
|
514
|
+
#### [Stablecoin](./examples/stablecoin.md)
|
|
515
|
+
- [Overview](./examples/stablecoin.md#overview)
|
|
516
|
+
- [Features](./examples/stablecoin.md#features)
|
|
517
|
+
- [Role System](./examples/stablecoin.md#role-system)
|
|
518
|
+
- [Pausability](./examples/stablecoin.md#pausability)
|
|
519
|
+
- [Blacklist](./examples/stablecoin.md#blacklist)
|
|
520
|
+
- [Minter Allowances](./examples/stablecoin.md#minter-allowances)
|
|
521
|
+
- [Complete Code](./examples/stablecoin.md#complete-code)
|
|
522
|
+
- [Solidity Comparison](./examples/stablecoin.md#solidity-comparison)
|
|
523
|
+
|
|
524
|
+
#### [Oracle Integration](./examples/oracle-integration.md)
|
|
525
|
+
- [Overview](./examples/oracle-integration.md#overview)
|
|
526
|
+
- [Multi-Oracle Architecture](./examples/oracle-integration.md#multi-oracle-architecture)
|
|
527
|
+
- [Price Aggregation](./examples/oracle-integration.md#price-aggregation)
|
|
528
|
+
- [Staleness Protection](./examples/oracle-integration.md#staleness-protection)
|
|
529
|
+
- [Deviation Checks](./examples/oracle-integration.md#deviation-checks)
|
|
530
|
+
- [Complete Code](./examples/oracle-integration.md#complete-code)
|
|
531
|
+
- [Solidity Comparison](./examples/oracle-integration.md#solidity-comparison)
|
|
532
|
+
|
|
533
|
+
#### [NFT with Reservations](./examples/nft-with-reservations.md)
|
|
534
|
+
- [Overview](./examples/nft-with-reservations.md#overview)
|
|
535
|
+
- [Sale Phases](./examples/nft-with-reservations.md#sale-phases)
|
|
536
|
+
- [Reservation System](./examples/nft-with-reservations.md#reservation-system)
|
|
537
|
+
- [Whitelist](./examples/nft-with-reservations.md#whitelist)
|
|
538
|
+
- [Reveal Mechanism](./examples/nft-with-reservations.md#reveal-mechanism)
|
|
539
|
+
- [Complete Code](./examples/nft-with-reservations.md#complete-code)
|
|
540
|
+
- [Solidity Comparison](./examples/nft-with-reservations.md#solidity-comparison)
|
|
541
|
+
|
|
542
|
+
---
|
|
543
|
+
|
|
544
|
+
### API Reference
|
|
545
|
+
|
|
546
|
+
#### [Blockchain](./api-reference/blockchain.md)
|
|
547
|
+
- [Overview](./api-reference/blockchain.md#overview)
|
|
548
|
+
- [Properties](./api-reference/blockchain.md#properties)
|
|
549
|
+
- [Transaction Context](./api-reference/blockchain.md#transaction-context)
|
|
550
|
+
- [Contract Context](./api-reference/blockchain.md#contract-context)
|
|
551
|
+
- [Network Context](./api-reference/blockchain.md#network-context)
|
|
552
|
+
- [Storage Architecture](./api-reference/blockchain.md#storage-architecture)
|
|
553
|
+
- [Storage Methods](./api-reference/blockchain.md#storage-methods)
|
|
554
|
+
- [Event Methods](./api-reference/blockchain.md#event-methods)
|
|
555
|
+
- [Cross-Contract Methods](./api-reference/blockchain.md#cross-contract-methods)
|
|
556
|
+
- [Signature Methods](./api-reference/blockchain.md#signature-methods)
|
|
557
|
+
|
|
558
|
+
#### [OP20](./api-reference/op20.md)
|
|
559
|
+
- [Overview](./api-reference/op20.md#overview)
|
|
560
|
+
- [Initialization](./api-reference/op20.md#initialization)
|
|
561
|
+
- [Query Methods](./api-reference/op20.md#query-methods)
|
|
562
|
+
- [Transfer Methods](./api-reference/op20.md#transfer-methods)
|
|
563
|
+
- [Approval Methods](./api-reference/op20.md#approval-methods)
|
|
564
|
+
- [Internal Methods](./api-reference/op20.md#internal-methods)
|
|
565
|
+
- [Events](./api-reference/op20.md#events)
|
|
566
|
+
|
|
567
|
+
#### [OP721](./api-reference/op721.md)
|
|
568
|
+
- [Overview](./api-reference/op721.md#overview)
|
|
569
|
+
- [Initialization](./api-reference/op721.md#initialization)
|
|
570
|
+
- [Query Methods](./api-reference/op721.md#query-methods)
|
|
571
|
+
- [Transfer Methods](./api-reference/op721.md#transfer-methods)
|
|
572
|
+
- [Approval Methods](./api-reference/op721.md#approval-methods)
|
|
573
|
+
- [Internal Methods](./api-reference/op721.md#internal-methods)
|
|
574
|
+
- [Events](./api-reference/op721.md#events)
|
|
575
|
+
|
|
576
|
+
#### [SafeMath](./api-reference/safe-math.md)
|
|
577
|
+
- [Overview](./api-reference/safe-math.md#overview)
|
|
578
|
+
- [Basic Operations](./api-reference/safe-math.md#basic-operations)
|
|
579
|
+
- [Modular Operations](./api-reference/safe-math.md#modular-operations)
|
|
580
|
+
- [Signed Operations](./api-reference/safe-math.md#signed-operations)
|
|
581
|
+
|
|
582
|
+
#### [Storage](./api-reference/storage.md)
|
|
583
|
+
- [Overview](./api-reference/storage.md#overview)
|
|
584
|
+
- [StoredU256](./api-reference/storage.md#storedu256)
|
|
585
|
+
- [StoredU64](./api-reference/storage.md#storedu64)
|
|
586
|
+
- [StoredBoolean](./api-reference/storage.md#storedboolean)
|
|
587
|
+
- [StoredString](./api-reference/storage.md#storedstring)
|
|
588
|
+
- [StoredAddress](./api-reference/storage.md#storedaddress)
|
|
589
|
+
- [StoredU256Array](./api-reference/storage.md#storedu256array)
|
|
590
|
+
- [StoredAddressArray](./api-reference/storage.md#storedaddressarray)
|
|
591
|
+
- [StoredMapU256](./api-reference/storage.md#storedmapu256)
|
|
592
|
+
- [AddressMemoryMap](./api-reference/storage.md#addressmemorymap)
|
|
593
|
+
|
|
594
|
+
#### [Events](./api-reference/events.md)
|
|
595
|
+
- [Overview](./api-reference/events.md#overview)
|
|
596
|
+
- [NetEvent Base Class](./api-reference/events.md#netevent-base-class)
|
|
597
|
+
- [Creating Custom Events](./api-reference/events.md#creating-custom-events)
|
|
598
|
+
- [Emitting Events](./api-reference/events.md#emitting-events)
|
|
599
|
+
- [Predefined Events](./api-reference/events.md#predefined-events)
|
|
600
|
+
|
|
601
|
+
---
|
|
602
|
+
|
|
603
|
+
## Quick Links
|
|
604
|
+
|
|
605
|
+
- [Example Tokens Repository](https://github.com/btc-vision/example-tokens)
|
|
606
|
+
- [btc-runtime Repository](https://github.com/btc-vision/btc-runtime)
|
|
607
|
+
- [OPNet Website](https://opnet.org)
|
|
608
|
+
|
|
609
|
+
## Solidity Developer?
|
|
610
|
+
|
|
611
|
+
Every documentation page includes **Solidity Comparison** sections with side-by-side code examples. Start with:
|
|
612
|
+
- [First Contract - Solidity Comparison](./getting-started/first-contract.md#solidity-comparison)
|
|
613
|
+
- [OP20 vs ERC20](./contracts/op20-token.md#erc20-vs-op20-comparison)
|
|
614
|
+
- [OP721 vs ERC721](./contracts/op721-nft.md#erc721-vs-op721-comparison)
|