TON Smart Challenge #1The contest for FunC developers aimed at optimization of smart contracts.
Contest for FunC developers with 22,022 TON total prize fund. The TON Smart Challenge winners are listed below.
Goal of the contest
Blockchain contracts development is an art because code optimisation can literally save money for the contract owners.
Contract execution literally costs money and this is a brilliant opportunity for the developers to exercise algorithms knowledge and software development skills to the fullest extent.
We are holding a contest aimed at optimisation of 5 smart contracts written in the FunC language native for The Open Network blockchain. Goal of the contest is to optimize contract execution cost preserving functionality and business logic.
There will be 5 simple concepts to implement. Concepts are chosen to be easy to understand even to people with no prior experience in programming.
Each task is scored from 0 to 10 points depending on number of passed tests. Each get method execution is limited by 100 000 000 (hundred millions) of gas units. The participant will be able to send solutions and receive the result after short evaluation delay any number of times, but not more than 5 times per hour. The best submitted solution (with highest total score over all 5 tasks) will be used to determine final rank. The organizers of the competition reserve the right to publish participants solutions with usernames (decided by participants themselves) after the contest. Gas-usage will not affect the ranking. Signatures of all functions described in the task conditions should not be changed.
Task 1: Counter
Let's start. This simple counter smart contract stores a total - 64-bit unsigned integer in its data (it is guaranteed that storage data contains total).
When receiving an internal incoming message, contract takes a 32-bit unsigned integer from message body, adds it to the total and saves the result in contract data.
Get-method get_total should returns actual total value stored in contract data.
If the body of the incoming message is less than 32 bits then it should throw ANY error.
Task 2: Proxy
The aim of proxy contract is to forward all messages to it's owner.
In particular for each message A (except messages from owner itself) such contract should send the message B to owner with body which contains address of A's sender followed by A's message body in reference (child cell).
The Toncoin value attached to the message should be equal A's value minus fees related to processing (computational and message forwarding fees). The owner address is stored in contract storage (it is guaranteed that storage contains owner address only).
Task 3: Address memorizer
The aim of address memorizer contract is to remember the address set by Manager and report it to anyone who request this information.
Task 4: Build a hashmap storage
Contract must add a new key/value entry to its data on receiving the message with the request.
Task 5: Shared wallet
The aim of two owner wallet is to create smart-contract which send messages then and only then both owners (represented by public keys) authorized it.
Prizes & honours
Winners of the contest will get prizes nominated in Toncoin — cryptocurrency native to TON blockchain which is also used as a resource for contract execution. Total prize fund of the contest is 22,022 TON.
- 1st place — 4,000 TON
- 2nd place — 2,000 TON
- 3rd place — 1,500 TON
- 4-6 place — 1,000 TON
- 7-10 place — 500 TON
- Other members — 5,777 TON.
Remaining 5,777 TON will be split among other participants, who solved at least one task. However if there will be less than 30 total participants, all the other N participants will get 100 TON each, and remaining 5,777 - N*100 TON will be split among top-10.
Update 14 April 2022: participants from 11th to 127th places will get prizes in accordance to formula INT(SCORE * 3 + 300*EXP(-(RANK-11/14.309)). There are also bonuses beyond basic prize pool, which are described in the official contest chat.
Join the Community
Join community of developers interested in building on TON, from general FunC programming language chat group to TON Contests channel.