{"id":22814687,"url":"https://github.com/ic-alloy/ic-alloy-dca","last_synced_at":"2025-04-22T18:42:11.023Z","repository":{"id":262236077,"uuid":"880299089","full_name":"ic-alloy/ic-alloy-dca","owner":"ic-alloy","description":"A semi-autonomous agent, swapping ERC-20 tokens on Uniswap for you. ","archived":false,"fork":false,"pushed_at":"2024-11-28T10:55:52.000Z","size":619,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-28T11:38:37.219Z","etag":null,"topics":["dca","erc-20","internet-computer","react","rust","uniswap","vite"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ic-alloy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-10-29T13:31:51.000Z","updated_at":"2024-11-28T10:55:56.000Z","dependencies_parsed_at":"2024-11-11T11:20:29.841Z","dependency_job_id":"4b54a039-055b-4f6e-9ba4-b6570e187bb4","html_url":"https://github.com/ic-alloy/ic-alloy-dca","commit_stats":null,"previous_names":["ic-alloy/ic-alloy-dca"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ic-alloy%2Fic-alloy-dca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ic-alloy%2Fic-alloy-dca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ic-alloy%2Fic-alloy-dca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ic-alloy%2Fic-alloy-dca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ic-alloy","download_url":"https://codeload.github.com/ic-alloy/ic-alloy-dca/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229388354,"owners_count":18065252,"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":["dca","erc-20","internet-computer","react","rust","uniswap","vite"],"created_at":"2024-12-12T13:09:43.110Z","updated_at":"2024-12-12T13:09:43.523Z","avatar_url":"https://github.com/ic-alloy.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DCA Agent example\n\nThis Dollar Cost Average agent runs on an timer and swaps a fixed amount of in tokens to a variable amount of out tokens every X seconds. The agent runs as a smart contract on the [Internet Computer](https://internetcomputer.org) and swaps ERC-20 tokens using [Uniswap](https://app.uniswap.org/).\n\nThe backend consists of a Rust canister that uses the [ic-alloy](https://github.com/ic-alloy) library to interact with the Ethereum blockchain. The frontend is built with React and Vite.\n\n[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url] [![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url] [![MIT License][license-shield]](LICENSE)\n\n\u003e [!TIP] \n\u003e This is an example app. Use this repository as a starting point for building your own timer based Ethereum agents on the Internet Computer.\n\n![](./media/screenshot.png)\n\n## Setup\n\nThere are two main ways to set up the dev environment:\n\n### 1. Using a VS Code Dev Container\n\nThe dev containers extension lets you use a Docker container as a full-featured\ndevelopment environment. This repository includes a dev container configuration\nthat you can use to open the project with all the necessary tools and\ndependencies pre-installed.\n\nPre-requisites:\n\n- [Docker](https://www.docker.com/products/docker-desktop)\n- [Visual Studio Code](https://code.visualstudio.com/)\n- [Dev Containers Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)\n\nOnce Docker, Visual Studio Code and the Dev Containers Extension are installed,\nyou can open the project in a container by clicking the button below:\n\n[![Open locally in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers\u0026message=Open\u0026color=blue\u0026logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/ic-alloy/ic-alloy-dca)\n\n### 2. Setup manually\n\nPre-requisites:\n\n- [Local Internet Computer dev environment](https://internetcomputer.org/docs/current/developer-docs/backend/rust/dev-env)\n- [pnpm](https://pnpm.io/installation)\n\nOnce you have the prerequisites installed, you can clone this repository and run\nthe project.\n\n## Running the project\n\n### 1. Start the Internet Computer\n\n```bash\ndfx start --background\n```\n\n### 2. Deploy the evm-rpc canister\n\n```\ndfx deploy evm_rpc\n```\n\n### 3. Deploy the DCA agent canister\n\nThe agent canister is deployed using a script. Edit the deploy script to\nchange the default values.\n\n```\nbash scripts/deploy-agent.sh\n```\n\nDefault values:\n\n#### `owner`\n\nThe principal ID of the agent owner. You can get the principal ID by running:\n\nDefault value: `$(dfx identity get-principal)`\n\n#### `token_in_address`\n\nThe Ethereum address of the token to swap from. You can get the address from Etherscan.\n\nDefault value: `0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238`\n\n#### `token_in_name`\n\nThe name of the token to swap from.\n\nDefault value: `USDC`\n\n#### `token_out_address`\n\nThe Ethereum address of the token to swap to. You can get the address from Etherscan.\n\nDefault value: `0xfff9976782d46cc05630d1f6ebab18b2324d6b14`\n\n#### `token_out_name` \n\nThe name of the token to swap to.\n\nDefault value: `WETH`\n\n#### `fee`\n\nThe fee tier of the Uniswap pool, used to determine the correct pool contract in which to execute the swap. Uniswap v3 protocol has the 1%, 0.3%, 0.05%, and 0.01% fee tiers. \n\nAllowed values: `10000`, `3000`, `500`, `100`\n\n#### `amount_in`\n\nThe amount of tokens to swap from. For the USDC token, the default amount represents 0.1 USDC. USDC uses fewer decimals than most tokens, so the amount is lower than for other tokens.\n\nDefault value: `100000`\n\n#### `slippage`\n\nThe maximum slippage percentage allowed for the swap. If the slippage is higher than the allowed percentage, the swap is reverted.\n\nDefault value: `5` (5%)\n\n#### `interval`\n\nThe interval in seconds between each swap.\n\nDefault value: `3600` (1 hour)\n\n### 4. Deploy the frontend\n\n```\npnpm install\ndfx deploy frontend\n```\n\n## Usage\n\n### Transfer tokens to the agent\n\nBefore you start the agent, you need to transfer some tokens to the agent canister, both the \"in\" token and some of the base chain token to pay for the gas fees. The agent Ethereum address is displayed in the frontend.\n\n### Start the agent\n\n```bash\nbash scripts/start.sh\n```\n\n### Stop the agent\n\n```bash\nbash scripts/stop.sh\n```\n### Check the agent status\n\nAccess the agent status by visiting the frontend canister URL.\n\n### Transfer tokens from the agent\n\nAt any point, you can transfer the remaining tokens from the agent canister back to your wallet.\n\n```bash\nbash scripts/transfer-in-token.sh\nbash scripts/transfer-out-token.sh\nbash scripts/transfer-base-token.sh\n```\n\n## Develop\n\nDuring development, you can run the frontend with hot reloading using Vite.\n\n```bash\npnpm run dev\n```\n\n## Contributors\n\n\u003c!-- readme: collaborators,contributors -start --\u003e\n\u003ctable\u003e\n \u003ctbody\u003e\n  \u003ctr\u003e\n            \u003ctd align=\"center\"\u003e\n                \u003ca href=\"https://github.com/kristoferlund\"\u003e\n                    \u003cimg src=\"https://avatars.githubusercontent.com/u/9698363?v=4\" width=\"100;\" alt=\"kristoferlund\"/\u003e\n                    \u003cbr /\u003e\n                    \u003csub\u003e\u003cb\u003eKristofer\u003c/b\u003e\u003c/sub\u003e\n                \u003c/a\u003e\n            \u003c/td\u003e\n  \u003c/tr\u003e\n \u003ctbody\u003e\n\u003c/table\u003e\n\u003c!-- readme: collaborators,contributors -end --\u003e\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for more\ndetails.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request if you\nhave any suggestions or improvements.\n\n[contributors-shield]:\n  https://img.shields.io/github/contributors/ic-alloy/ic-alloy-dca.svg?style=for-the-badge\n[contributors-url]: https://github.com/ic-alloy/ic-alloy-dca/graphs/contributors\n[forks-shield]:\n  https://img.shields.io/github/forks/ic-alloy/ic-alloy-dca.svg?style=for-the-badge\n[forks-url]: https://github.com/ic-alloy/ic-alloy-dca/network/members\n[stars-shield]:\n  https://img.shields.io/github/stars/ic-alloy/ic-alloy-dca?style=for-the-badge\n[stars-url]: https://github.com/ic-alloy/ic-alloy-dca/stargazers\n[issues-shield]:\n  https://img.shields.io/github/issues/ic-alloy/ic-alloy-dca.svg?style=for-the-badge\n[issues-url]: https://github.com/ic-alloy/ic-alloy-dca/issues\n[license-shield]:\n  https://img.shields.io/github/license/ic-alloy/ic-alloy-dca.svg?style=for-the-badge\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fic-alloy%2Fic-alloy-dca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fic-alloy%2Fic-alloy-dca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fic-alloy%2Fic-alloy-dca/lists"}