Welcome to the TON Dev House Challenge! This repository contains 2 smart contract challenges designed to test your Tolk programming skills on the TON blockchain.
Compete for a share of the $1000 prize pool by successfully completing these challenges!
This repository contains two distinct challenges, each focusing on different aspects of TON smart contract development:
Task: Fix the errors in the EscrowSystem contract and make it work as expected.
Description: The EscrowSystem contract allows users to:
- Initialize an escrow
- Request funds
- Release funds
- Cancel escrow
Contract Storage (EscrowSystem struct):
owner: address- The owner of the escrowrecipient: address- The recipient of the escrow fundsamount: uint64- The amount held in escrowisReleased: bool- Whether the funds have been releasedisRequested: bool- Whether the recipient has requested the funds
Your Goal: Debug and fix all issues in the contract to ensure all test cases pass.
Task: Create a Simple DAO contract that allows users to vote yes or no.
Description: Build a voting contract from scratch with the following functionality:
- Record votes (yes/no)
- Reset all votes
- Track vote counts
Contract Storage (SimpleDao struct):
queryId: uint32- Query identifieryesVotes: uint32- Count of yes votesnoVotes: uint32- Count of no votestotalVotes: uint32- Total vote count
Required Message Structures:
RecordVote(queryId: uint32, vote: bool)- Opcode:0xF4A2B1C9ResetVotes(queryId: uint32)- Opcode:0xD4E7B328
Required Getter Function:
getVotes()- Returns(yesVotes, noVotes, totalVotes)
# Build all contracts
npx blueprint build
# Test EscrowSystem contract
npx blueprint test tests/EscrowSystem.spec.ts
# Test SimpleDAO contract
npx blueprint test tests/SimpleDao.spec.ts
# Test all contracts
npx blueprint test# Create a new contract
npx blueprint create ContractName
/
├── contracts/
│ ├── escrow_system.tolk # Challenge 1: Fix the escrow contract
│ └── simple_dao.tolk # Challenge 2: Implement DAO voting
├── tests/
│ ├── EscrowSystem.spec.ts # Test cases for escrow contract
│ └── SimpleDao.spec.ts # Test cases for DAO contract
├── scripts/
│ ├── deployEscrowSystem.ts # Deployment script for escrow
│ └── deploySimpleDao.ts # Deployment script for DAO
├── wrappers/
│ ├── EscrowSystem.ts # TypeScript wrapper for escrow
│ └── SimpleDao.ts # TypeScript wrapper for DAO
└── build/ # Compiled contract outputs
-
Fork this repository
-
Clone that repository
git clone <repository-url> cd Ton_Dev_house_challenges
-
Install dependencies
npm install
-
Start with Challenge 1
# Run tests to see what needs fixing npx blueprint test tests/EscrowSystem.spec.ts
-
Move to Challenge 2
# Implement the SimpleDAO contract # Then test your implementation npx blueprint test tests/SimpleDao.spec.ts
- All compilation errors fixed
- All test cases pass
- Contract functionality works as expected:
- Escrow initialization
- Fund requests by recipients
- Fund release by owners
- Escrow cancellation
- Contract compiles successfully
- All test cases pass
- Voting functionality implemented:
- Record yes/no votes
- Reset vote counts
- Accurate vote tracking
- Getter function returns correct vote counts
- Tolk Language: These contracts use Tolk 1.1, TON's new smart contract language
- Testing: Use the provided test files to validate your implementations
- Blueprint: Leverage Blueprint's tools for efficient development and deployment
- Documentation: Refer to TON Documentation for additional guidance
Ensure both challenges are completed and all tests pass before submission. Good luck! Make sure you have everything before submission:
- Github fork url of this repo
- Screenshot of test cases passed
- Name the image file as - FirstName_LastName_Tests
- TON wallet address of mainnet
- Telegram Username
To submit, fill the form given below TON Dev House Submission Form
Happy coding and may the best developer win! 🚀