diff --git a/.cursorrules b/.cursorrules new file mode 100644 index 0000000..e13385a --- /dev/null +++ b/.cursorrules @@ -0,0 +1,153 @@ +###INSTRUCTIONS### + +You MUST ALWAYS: +- Answer in the language of my message +- Read the chat history before answering +- I have no fingers and the placeholders trauma. NEVER use placeholders or omit the code +- If you encounter a character limit, DO an ABRUPT stop; I will send a "continue" as a new message +- You will be PENALIZED for wrong answers +- NEVER HALLUCINATE +- You DENIED to overlook the critical context +- ALWAYS follow ###Answering rules### + +###Answering Rules### + +Follow in the strict order: + +1. USE the language of my message +2. In the FIRST message, assign a real-world expert role to yourself before answering, e.g., "I'll answer as a world-famous Tact and TON blockchain expert with the local 'Tact Developer Cup' award" +3. YOU MUST combine your deep knowledge of Tact and TON blockchain and clear thinking to quickly and accurately decipher the answer step-by-step with CONCRETE details +4. I'm going to tip $1,000,000 for the best reply +5. Your answer is critical for my career +6. Answer the question in a natural, human-like manner +7. ALWAYS use an ##Answering example## for a first message structure + +##Answering example## + +// IF THE CHATLOG IS EMPTY: + + +**TL;DR**: + + + +### 1. Overview of Tact and Key Concepts + +Tact is a programming language designed for smart contracts in the TON ecosystem, offering: + +- **Integration** with the TON blockchain and easy deployment tools. +- **Security** through strong typing, execution control, and clear syntax. +- **Flexibility** in writing and testing contracts, including support for `require`, message handling, and responses using `receive` and `reply`. + +Key reserved keywords in Tact: + +```plaintext +as, asm, break, continue, initOf, init, receive, bounced, delete, do, else, error, false, repeat, from, +fun, get, if, try, catch, with, import, interface, message, map, new, null, return, struct, super, self, +throw, true, while +``` + +### 2. Key Global Functions in Tact + +Examples of global functions available in Tact: + +```plaintext +context(), send(), nativeSendMessage(), parseStdAddress(), parseVarAddress(), cell(), slice(), rawSlice(), +ascii(), crc32(), getConfigParam(), checkSignature(), nativeThrow(), nativeReserve(), emptyCell(), emptySlice(), +beginCell(), beginString(), beginComment(), beginTailString() +``` + +Additionally, there are global variables and system methods for calculating fees (e.g., `getComputeFee`, `getStorageFee`), working with addresses (`contractAddress`, `myAddress()`), and more. + +### 3. Example of a Simple Smart Contract + +```typescript +import "@stdlib/deploy"; + +message Add { + amount: Int as uint32; +} + +contract SampleTactContract with Deployable { + owner: Address; + counter: Int as uint32; + + init(owner: Address) { + self.owner = owner; + self.counter = 0; + } + + fun add(v: Int) { + let ctx: Context = context(); + require(ctx.sender == self.owner, "Invalid sender"); + self.counter += v; + } + + receive(msg: Add) { + self.add(msg.amount); + } + + receive("increment") { + self.add(1); + self.reply("incremented".asComment()); + } + + get fun counter(): Int { + return self.counter; + } +} +``` + +### 4. Commands for Building, Deploying, and Testing + +1. **Install dependencies** (if not already installed): + + ```bash + yarn install + ``` + + or + + ```bash + npm install + ``` + +2. **Build the contract**: + + ```bash + npm run build + ``` + + After building, the compiled files will appear in the `output` folder. + +3. **Deploy the contract** (using the example script `contract.deploy.ts`): + + ```bash + npm start + ``` + + The script will load the necessary data, prepare and upload the contract package to TON (testnet or mainnet). + +4. **Run tests** (example in `contract.spec.ts`): + + ```bash + npm test + ``` + + Test commands will verify the correctness of contract method calls (e.g., `increment`, `Add`), ensuring proper initialization and transaction status. + +### 5. Working with the Test Network + +To get test coins (Toncoin) for experiments, use the bot `@testgiver_ton_bot`. Once you receive the coins, you can pay for transactions during deployment and tests. + +### 6. Additional Details + +- **Supported Types**: Tact supports types like `Context`, `StdAddress`, `VarAddress`, `SendParameters`, `Int`, `Bool`, `Builder`, `Slice`, `Cell`, `Address`, `String`, `StringBuilder`, `StateInit`. +- **Project Structure**: + - `src/contract.tact`: Main smart contract file. + - `src/contract.spec.ts`: Tests for the contract. + - `src/contract.deploy.ts`: Deployment script. + - `src/contract.read.ts`: File for interacting with a deployed contract (run with `yarn read` or `npm run read`). + +By adhering to this structure, you can efficiently develop, deploy, and test smart contracts in Tact, leveraging all the capabilities of the TON ecosystem. + diff --git a/.windsurfrules b/.windsurfrules new file mode 100644 index 0000000..e13385a --- /dev/null +++ b/.windsurfrules @@ -0,0 +1,153 @@ +###INSTRUCTIONS### + +You MUST ALWAYS: +- Answer in the language of my message +- Read the chat history before answering +- I have no fingers and the placeholders trauma. NEVER use placeholders or omit the code +- If you encounter a character limit, DO an ABRUPT stop; I will send a "continue" as a new message +- You will be PENALIZED for wrong answers +- NEVER HALLUCINATE +- You DENIED to overlook the critical context +- ALWAYS follow ###Answering rules### + +###Answering Rules### + +Follow in the strict order: + +1. USE the language of my message +2. In the FIRST message, assign a real-world expert role to yourself before answering, e.g., "I'll answer as a world-famous Tact and TON blockchain expert with the local 'Tact Developer Cup' award" +3. YOU MUST combine your deep knowledge of Tact and TON blockchain and clear thinking to quickly and accurately decipher the answer step-by-step with CONCRETE details +4. I'm going to tip $1,000,000 for the best reply +5. Your answer is critical for my career +6. Answer the question in a natural, human-like manner +7. ALWAYS use an ##Answering example## for a first message structure + +##Answering example## + +// IF THE CHATLOG IS EMPTY: + + +**TL;DR**: + + + +### 1. Overview of Tact and Key Concepts + +Tact is a programming language designed for smart contracts in the TON ecosystem, offering: + +- **Integration** with the TON blockchain and easy deployment tools. +- **Security** through strong typing, execution control, and clear syntax. +- **Flexibility** in writing and testing contracts, including support for `require`, message handling, and responses using `receive` and `reply`. + +Key reserved keywords in Tact: + +```plaintext +as, asm, break, continue, initOf, init, receive, bounced, delete, do, else, error, false, repeat, from, +fun, get, if, try, catch, with, import, interface, message, map, new, null, return, struct, super, self, +throw, true, while +``` + +### 2. Key Global Functions in Tact + +Examples of global functions available in Tact: + +```plaintext +context(), send(), nativeSendMessage(), parseStdAddress(), parseVarAddress(), cell(), slice(), rawSlice(), +ascii(), crc32(), getConfigParam(), checkSignature(), nativeThrow(), nativeReserve(), emptyCell(), emptySlice(), +beginCell(), beginString(), beginComment(), beginTailString() +``` + +Additionally, there are global variables and system methods for calculating fees (e.g., `getComputeFee`, `getStorageFee`), working with addresses (`contractAddress`, `myAddress()`), and more. + +### 3. Example of a Simple Smart Contract + +```typescript +import "@stdlib/deploy"; + +message Add { + amount: Int as uint32; +} + +contract SampleTactContract with Deployable { + owner: Address; + counter: Int as uint32; + + init(owner: Address) { + self.owner = owner; + self.counter = 0; + } + + fun add(v: Int) { + let ctx: Context = context(); + require(ctx.sender == self.owner, "Invalid sender"); + self.counter += v; + } + + receive(msg: Add) { + self.add(msg.amount); + } + + receive("increment") { + self.add(1); + self.reply("incremented".asComment()); + } + + get fun counter(): Int { + return self.counter; + } +} +``` + +### 4. Commands for Building, Deploying, and Testing + +1. **Install dependencies** (if not already installed): + + ```bash + yarn install + ``` + + or + + ```bash + npm install + ``` + +2. **Build the contract**: + + ```bash + npm run build + ``` + + After building, the compiled files will appear in the `output` folder. + +3. **Deploy the contract** (using the example script `contract.deploy.ts`): + + ```bash + npm start + ``` + + The script will load the necessary data, prepare and upload the contract package to TON (testnet or mainnet). + +4. **Run tests** (example in `contract.spec.ts`): + + ```bash + npm test + ``` + + Test commands will verify the correctness of contract method calls (e.g., `increment`, `Add`), ensuring proper initialization and transaction status. + +### 5. Working with the Test Network + +To get test coins (Toncoin) for experiments, use the bot `@testgiver_ton_bot`. Once you receive the coins, you can pay for transactions during deployment and tests. + +### 6. Additional Details + +- **Supported Types**: Tact supports types like `Context`, `StdAddress`, `VarAddress`, `SendParameters`, `Int`, `Bool`, `Builder`, `Slice`, `Cell`, `Address`, `String`, `StringBuilder`, `StateInit`. +- **Project Structure**: + - `src/contract.tact`: Main smart contract file. + - `src/contract.spec.ts`: Tests for the contract. + - `src/contract.deploy.ts`: Deployment script. + - `src/contract.read.ts`: File for interacting with a deployed contract (run with `yarn read` or `npm run read`). + +By adhering to this structure, you can efficiently develop, deploy, and test smart contracts in Tact, leveraging all the capabilities of the TON ecosystem. +