{"id":22399904,"url":"https://github.com/laugharne/ato","last_synced_at":"2026-04-09T21:55:13.397Z","repository":{"id":249022911,"uuid":"827753370","full_name":"Laugharne/ato","owner":"Laugharne","description":"The purpose of this project is to create a DAO on the Solana blockchain where administrators can propose and members can propose and vote on different proposals. The voting can be triggered based on a time duration or a threshold value obtained from an oracle.","archived":false,"fork":false,"pushed_at":"2024-07-22T15:55:50.000Z","size":390,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T00:16:59.910Z","etag":null,"topics":["alyra","anchor","anchor-lang","rust","rust-lang","solana","solana-program"],"latest_commit_sha":null,"homepage":"https://github.com/AutonomousTradingOrganization/ato","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Laugharne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-12T09:51:55.000Z","updated_at":"2025-02-25T17:53:37.000Z","dependencies_parsed_at":"2024-12-05T08:10:34.265Z","dependency_job_id":"a945da5d-129b-43c6-bb71-b0dde70dbed6","html_url":"https://github.com/Laugharne/ato","commit_stats":null,"previous_names":["laugharne/ato"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Laugharne/ato","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laugharne%2Fato","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laugharne%2Fato/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laugharne%2Fato/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laugharne%2Fato/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Laugharne","download_url":"https://codeload.github.com/Laugharne/ato/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Laugharne%2Fato/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263919739,"owners_count":23530056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alyra","anchor","anchor-lang","rust","rust-lang","solana","solana-program"],"created_at":"2024-12-05T08:10:28.858Z","updated_at":"2025-10-04T13:10:36.296Z","avatar_url":"https://github.com/Laugharne.png","language":"TypeScript","readme":"![](logoAto.png)\n\n--------\n\n# ATO : Autonomous Trading Organization\n\n## Overview\n\n![](ATOschémaSC(v1).png)\n\n### Components\n\n1. Program \u0026 instructions\n    - **DAO Initialization**: Initialize the DAO with the necessary configuration.\n    - **Setting scheduler key**: Set the scheduler public key (used for vote checking).\n    - **Pausable mode**: Pausable mode, to \"freeze\" the DAO.\n    - **Create Proposal**: Create a new proposal for voting.\n    - **Voter registration**: Register members as eligible voters.\n    - **Change proposal status**: Update the status of proposals.\n    - **Vote on Proposal**: Allow members to vote on the proposals.\n    \n2. Accounts\n    - **DAO Base Account**: Stores the overall state of the DAO including indexes of voters and proposals.\n    - **Proposal Account**: Represents an individual proposal.\n    - **Voter Account**: Represents an individual voter in the DAO.\n    - **Vote Account**: Represents an individual vote by a voter on a proposal.\n\n3. Structures, associated to accounts\n\n    **Proposal**\n    ```rust\n    pub struct AtoProposal {\n      pub signer         : Pubkey,\n      pub deadline       : u64,\n      pub threshold      : u64,\n      pub amount         : u64,\n      pub vote_yes       : u16,\n      pub vote_no        : u16,\n      pub vote_index_tail: u16,\n      pub index          : u16,\n      pub title          : [u8; STR_SIZE_TITLE],\n      pub description    : [u8; STR_SIZE_DESCR],\n      pub mode           : u8,\n      pub status         : u8,\n      pub trade          : u8,\n    }\n    ```\n\n    **Voter**\n    ```rust\n    pub struct AtoVoter {\n      pub voter: Pubkey,\n      pub index: u16,\n      pub name : [u8; STR_SIZE_NAME],\n      pub email: [u8; STR_SIZE_EMAIL],\n    }\n    ```\n\n    **Vote**\n    ```rust\n    pub struct AtoVote {\n      pub voter         : Pubkey,\n      pub amount        : u64,\n      pub timestamp     : u64,\n      \n      pub proposal_index: u16,\n      pub voter_index:    u16,\n      pub vote_index:     u16,\n    \n      pub vote          : bool,\n      // false = no\n      // true  = yes\n    \n    }\n    ```\n\n4. Macros\n\n    **compute_fn!**\n    ```rust\n    macro_rules! compute_fn {\n      ($msg:expr=\u003e $($tt:tt)*) =\u003e {\n        anchor_lang::solana_program::msg!(concat!($msg, \" {\"));\n        anchor_lang::solana_program::log::sol_log_compute_units();\n        let res = { $($tt)* };\n        anchor_lang::solana_program::log::sol_log_compute_units();\n        anchor_lang::solana_program::msg!(concat!(\" } // \", $msg));\n        res\n      };\n    }\n    ```\n    It allows you to measure and log the compute units consumed before and after the execution of a block of code.\n\n    **admin_only!**\n    ```rust\n    macro_rules! admin_only {\n      ($ctx:expr) =\u003e {{\n        let ato_data = \u0026mut $ctx.accounts.ato_data;\n        let signer = \u0026$ctx.accounts.signer;\n        require_eq!(ato_data.admin, signer.key(), AtoError::AdminOnly);\n      }};\n    }\n    ```\n    It allow to check the rule for administrator role.\n\n    **scheduler_only!**\n    ```rust\n    macro_rules! scheduler_only {\n      ($ctx:expr) =\u003e {{\n        let ato_data = \u0026mut $ctx.accounts.ato_data;\n        let signer = \u0026$ctx.accounts.signer;\n        require_eq!(ato_data.scheduler, signer.key(), AtoError::SchedulerOnly);\n      }};\n    }\n    ```\n    It allow to check the rule for scheduler role.\n\n    **pausable!**\n    ```rust\n    macro_rules! pausable {\n      ($ctx:expr) =\u003e {{\n        let ato_data = \u0026mut $ctx.accounts.ato_data;\n        require_eq!(ato_data.paused, false, AtoError::ProgramPaused);\n      }};\n    }\n    ```\n    It allow to check if program is on \"pause\" mode.\n\n    **string_to_u8!**\n    ```rust\n    macro_rules! string_to_u8 {\n      ($string:expr, $storage_title:expr) =\u003e {{\n        let bytes: \u0026[u8] = $string.as_bytes();\n        let len = bytes.len().min($storage_title.len());\n        $storage_title[..len].copy_from_slice(\u0026bytes[..len]);\n        //$storage_title\n      }};\n    }\n    ```\n    The macro is useful when you need to store string data in a fixed-size array or of `u8` values. This is often required in environments like **Solana smart contracts** where fixed-size buffers are used for efficiency and compatibility with on-chain data structures.\n\n    **check_index!**\n    ```rust\n    macro_rules! check_index {\n      ($index:expr) =\u003e {{\n        require_gt!(ATO_INDEX_MAX, $index, AtoError::OutOfBoundIndex);\n      }};\n    }\n    ```\n    Essentially, this macro is a shorthand to check that a given index is within acceptable bounds, specifically less than **ATO_INDEX_MAX**, and to handle the error case cleanly if it is not.\n\n### Purpose\nThe purpose of this project is to create a DAO on the Solana blockchain where administrators can propose and members can propose and vote on different proposals. The voting can be triggered based on a time duration or a threshold value obtained from an oracle.\n\n### Testing the DAO\nThe project includes tests using `web3.js` and `chai` to ensure the functionalities work as expected. Example test scenarios include initializing the DAO, adding voters, creating and voting on proposals (and checking the results).\n\n\n## Code structure\n\n```bash\n.\n├── app\n├── migrations\n│   └── deploy.ts\n├── programs\n│   └── ato\n│       ├── src\n│       │   ├── instructions\n│       │   │   ├── initialize.rs\n│       │   │   ├── mod.rs\n│       │   │   ├── proposal_check.rs\n│       │   │   ├── proposal_create.rs\n│       │   │   ├── proposal_set_status.rs\n│       │   │   ├── set_pause.rs\n│       │   │   ├── set_scheduler.rs\n│       │   │   ├── voter_registration.rs\n│       │   │   └── vote.rs\n│       │   ├── constants.rs\n│       │   ├── errors.rs\n│       │   ├── lib.rs\n│       │   ├── macros.rs\n│       │   └── states.rs\n│       ├── Cargo.toml\n│       └── Xargo.toml\n├── tests\n│   └── ato.ts\n├── Anchor.toml\n├── Cargo.lock\n├── Cargo.toml\n├── package.json\n├── README.md\n├── tests_local_deploy.png\n├── tsconfig.json\n└── yarn.lock\n\n7 directories, 26 files\n```\n\n\n## Launch\n\n### Local validator\n\n`solana-test-validator --reset`\n\n⚠️ Beware it creates local files and directories at the current working directory.\n\n\n### Real-time logs display\n\n`solana logs`\n\n\n### Local deploy and launch tests\n\n`anchor test --skip-local-validator`\n\n![](tests_local_deploy.png)\n\n\n## Versions\n\n``` \nrustc 1.79.0 (129f3b996 2024-06-10)\ncargo 1.79.0 (ffa9cf99a 2024-06-03)\nsolana-cli 1.18.17 (src:b685182a; feat:4215500110, client:SolanaLabs)\nanchor-cli 0.29.0\nyarn 1.22.19\nnode v18.16.0\nnpm 9.6.7\n``` \n\n`cargo build-sbf -V`\n```\nsolana-cargo-build-sbf 1.18.17\nplatform-tools v1.41\nrustc 1.75.0\n```\n\n## Resources\n\n- **GitHub**:\n  - [AutonomousTradingOrganization · GitHub](https://github.com/AutonomousTradingOrganization)\n  - [Laugharne (Laugharne) · GitHub](https://github.com/Laugharne)\n  - [Boyquotes · GitHub](https://github.com/Boyquotes)\n- **Documentation**: [GitHub - AutonomousTradingOrganization/Documentation](https://github.com/AutonomousTradingOrganization/documentation)\n- **Miro**: [Miro | The Visual Workspace for Innovation](https://miro.com/app/board/uXjVK0d8Its=/)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaugharne%2Fato","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaugharne%2Fato","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaugharne%2Fato/lists"}