{"id":19460114,"url":"https://github.com/offchainlabs/stylus-workshop-counter","last_synced_at":"2025-10-05T03:24:37.507Z","repository":{"id":227249016,"uuid":"770493546","full_name":"OffchainLabs/stylus-workshop-counter","owner":"OffchainLabs","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-06T20:41:56.000Z","size":58,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-28T13:05:38.860Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/OffchainLabs.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-03-11T16:42:39.000Z","updated_at":"2025-01-26T15:50:13.000Z","dependencies_parsed_at":"2024-06-06T16:19:34.452Z","dependency_job_id":"469ed6e0-cef7-4dae-8d79-2bfe28ce49b8","html_url":"https://github.com/OffchainLabs/stylus-workshop-counter","commit_stats":null,"previous_names":["offchainlabs/stylus-workshop-counter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OffchainLabs%2Fstylus-workshop-counter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OffchainLabs%2Fstylus-workshop-counter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OffchainLabs%2Fstylus-workshop-counter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OffchainLabs%2Fstylus-workshop-counter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OffchainLabs","download_url":"https://codeload.github.com/OffchainLabs/stylus-workshop-counter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986312,"owners_count":21194025,"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":[],"created_at":"2024-11-10T17:35:38.892Z","updated_at":"2025-10-05T03:24:32.489Z","avatar_url":"https://github.com/OffchainLabs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stylus workshop: Counter contract\n\nSimple Counter contract written in Rust.\n\n## Getting started\n\nFollow the instructions in the [Stylus quickstart](https://docs.arbitrum.io/stylus/stylus-quickstart) to configure your development environment.\n\nYou'll also need [Foundry](https://github.com/foundry-rs/foundry) to interact with the contract.\n\n## Check and deploy\n\nYou can use [cargo stylus](https://github.com/OffchainLabs/cargo-stylus) to check that your contract is compatible with Stylus by running\n\n```shell\ncargo stylus check\n```\n\nWith the following command you can deploy it to an Arbitrum chain\n\n```shell\ncargo stylus deploy --endpoint $RPC_URL --private-key $PRIVATE_KEY\n```\n\nAlternatively, you can use the bash scripts available to build and deploy the contract:\n\n- [build.sh](/scripts/build.sh)\n- [deploy.sh](/scripts/deploy.sh): this script requires the environment variables `$RPC_URL` and `$PRIVATE_KEY`.\n\n## Tests\n\nFor unit testing, this example integrates the [motsu](https://github.com/OpenZeppelin/rust-contracts-stylus/tree/main/lib/motsu) library from OpenZeppelin. To run unit tests, you can simply use\n\n```shell\ncargo test --locked --lib\n```\n\nAlternatively, you can use the bash script available [test-unit.sh](/scripts/tests/test-unit.sh).\n\nFor integration tests, this example integrates a fork of the [e2e](https://github.com/OpenZeppelin/rust-contracts-stylus/tree/main/lib/e2e) library from OpenZeppelin available [here](https://github.com/TucksonDev/e2e-lib). To run the tests you need to run a [nitro-testnode](https://github.com/OffchainLabs/nitro-testnode). A script is available to clone and run the nitro-testnode, [nitro-testnode.sh](/scripts/tests/nitro-testnode.sh). Once the nitro-testnode is running, you can run the e2e tests using the script available [test-e2e.sh](/scripts/tests/test-e2e.sh).\n\n## Additional scripts\n\nThe `scripts` folder contains several other scripts that make individual calls to perform the most important actions:\n\n1. [./scripts/getCount.sh](./scripts/getCount.sh) to get the current counter\n2. [./scripts/increment.sh](./scripts/increment.sh) to increment the current counter\n3. [./scripts/setCount.sh](./scripts/setCount.sh) to set the current counter\n\nRemember to set the environment variables in an `.env` file.\n\n## How to run a local dev node\n\nInstructions to setup a local dev node can be found [here](https://docs.arbitrum.io/run-arbitrum-node/run-local-dev-node).\n\n## Useful resources\n\n- [Stylus quickstart](https://docs.arbitrum.io/stylus/stylus-quickstart)\n- [Stylus by example](https://stylus-by-example.org/)\n- [Counter contract](https://github.com/OffchainLabs/stylus-workshop-counter)\n- [Interactions between Rust and Solidity](https://github.com/OffchainLabs/stylus-workshop-rust-solidity/)\n- [Telegram group](https://t.me/arbitrum_stylus)\n- [Discord channel](https://discord.com/channels/585084330037084172/1146789176939909251)\n\n## Stylus reference links\n\n- [Stylus documentation](https://docs.arbitrum.io/stylus/stylus-gentle-introduction)\n- [Stylus SDK](https://github.com/OffchainLabs/stylus-sdk-rs)\n- [Cargo Stylus](https://github.com/OffchainLabs/cargo-stylus)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foffchainlabs%2Fstylus-workshop-counter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foffchainlabs%2Fstylus-workshop-counter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foffchainlabs%2Fstylus-workshop-counter/lists"}