Skip to content

[WIP] TON blockchain dApp for DAO management using governance tokens (jettons)

License

Notifications You must be signed in to change notification settings

supadupadao/skipper

Repository files navigation

Skipper 🐧

ℹ️ Fully decentralized application for DAO managing on TON blockchain using governance tokens (jettons).

⚠️ Warning! Work in progress! Development of this project is not done!

❤️ I'll be very grateful for any kind of contribution: code, docs, issues, bug reports, github stars or whatever

Development

This is default Tact blueprint project with default commands:

  • npm run build - build project and compile contracts
  • npm test - run contracts tests
  • npx blueprint run - execute script from /scripts directory

Docs

Exit codes

Standard Tact exit codes

Skipper uses custom exit codes for identifying non standard errors. It always 4 digit decimal code with following structure: 69XX where 69 is prefix for every error and XX is unique number for each error.

Code Description
Tact lang exit codes:
132 Invalid owner of contract.
Occurs when contract receives message not from owner address.
Custom exit codes:
6901 No enoght TON in message.
6902 Unlock date is not arrived.
Occurs on trying to unlock jettons before unlock date.
6903 No enough votes.
Occurs when trying to execute proposal that has no enough votes.
6904 Too many "no" votes.
Occurs when trying to execute proposal that has too many "no" votes.
6905 Not initialized.
Occurs when trying to interact with contract that has not been initialized.
6906 Already initialized.
Occurs when trying to initialize contract that has been already initialized (to avoid double initialization).
6907 Proposal expired.
Occurs when trying to vote in expired proposal.
6908 Proposal executed.
Occurs when trying to vote in executed proposal.
6909 Proxy opcode not found.
Occurs when trying to send unknown proxy body to Skipper contract.

Contracts interaction

Lock tokens

sequenceDiagram
    actor wallet as User TON wallet
    participant jetton as Governance token

    create participant lock as Jetton lock
    wallet ->> lock: Deploy
    wallet ->> jetton: 0x0f8a7ea5<br/>(JettonTransfer)
    activate jetton
    Note over jetton: Send tokens to lock address
    Note over jetton: Notify lock about transfer
    jetton ->> lock: 0x7362d09c<br/>(JettonTransferNotification)
    deactivate jetton
    activate lock
    Note over lock: Save transfered amount
    deactivate lock
Loading

Create new proposal

sequenceDiagram
    actor wallet as User TON wallet
    participant lock as Jetton lock
    participant dao as DAO

    wallet ->> lock: 0x690101<br/>(SendProxyMessage)<br/>with body<br/>0x690401<br/>(RequestNewProposal)
    activate lock
    Note over lock: Pass proxied body to DAO
    lock ->> dao: 0x690102<br/>(ProxyMessage)<br/>with body<br/>0x690401<br/>(RequestNewProposal)
    deactivate lock
    activate dao
    Note over dao: Deploy proposal contract with next proposal_id
    create participant proposal as Proposal
    dao ->> proposal: 0x690201<br/>(InitProposal)
    deactivate dao
    activate proposal
    Note over proposal: Deploy voter contract with user address
    create participant voter as Voter
    proposal ->> voter: 0x690301<br/>(InitVoter)
    deactivate proposal
    activate voter
    Note over voter: Save voted amount of tokens
    deactivate voter
Loading

Vote for existing proposal

sequenceDiagram
    actor wallet as User TON wallet
    participant lock as Jetton lock
    participant dao as DAO
    participant voter as Voter
    participant proposal as Proposal

    wallet ->> lock: 0x690101<br/>(SendProxyMessage)<br/>with body<br/>0x690402<br/>(VoteForProposal)
    activate lock
    Note over lock: Pass proxied body to DAO
    lock ->> dao: 0x690102<br/>(ProxyMessage)<br/>with body<br/>0x690402<br/>(VoteForProposal)
    deactivate lock
    activate dao
    Note over dao: Send actual votes amount to proposal's voter
    dao ->> voter: 0x690302<br/>(UpdateVoterBalance)
    deactivate dao
    activate voter
    Note over voter: Compute new tokens amount as (new - previous)
    Note over voter: Send new value to proposal
    voter ->> proposal: 0x690202<br/>(UpdateVotes)
    activate proposal
    deactivate voter
    Note over proposal: Update votes amount
    deactivate proposal
Loading