{"id":27429419,"url":"https://github.com/byteball/bonded-stablecoin-buffer","last_synced_at":"2025-07-02T09:05:13.202Z","repository":{"id":53169559,"uuid":"297490015","full_name":"byteball/bonded-stablecoin-buffer","owner":"byteball","description":"An Autonomous Agent that helps to buy T2 tokens of bonded stablecoins with minimum fee","archived":false,"fork":false,"pushed_at":"2024-06-24T12:50:02.000Z","size":52,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T14:17:47.399Z","etag":null,"topics":["autonomous-agents","defi","stablecoin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/byteball.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,"zenodo":null}},"created_at":"2020-09-22T00:06:45.000Z","updated_at":"2024-09-26T19:52:47.000Z","dependencies_parsed_at":"2024-05-18T08:21:29.337Z","dependency_job_id":"57fe0f71-0025-4c65-b114-59362e8c1371","html_url":"https://github.com/byteball/bonded-stablecoin-buffer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/byteball/bonded-stablecoin-buffer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteball%2Fbonded-stablecoin-buffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteball%2Fbonded-stablecoin-buffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteball%2Fbonded-stablecoin-buffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteball%2Fbonded-stablecoin-buffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/byteball","download_url":"https://codeload.github.com/byteball/bonded-stablecoin-buffer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteball%2Fbonded-stablecoin-buffer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263108810,"owners_count":23415005,"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":["autonomous-agents","defi","stablecoin"],"created_at":"2025-04-14T14:17:40.643Z","updated_at":"2025-07-02T09:05:13.182Z","avatar_url":"https://github.com/byteball.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Autonomous Agent for buying T2 tokens through a buffer\n\nThis AA helps to buy T2 tokens while keeping the fee below 1% (or another configured threshold). The funds in the reserve currency are sent to this AA, a bot checks the current state of the curve and triggers this AA to buy a specific number of T2 tokens from the curve. Several purchases might be required in order to convert the entire deposited amount into T2 as each purchase has to be small enough in order not to move the price too much and not to pay large fees. The purchased T2 tokens are sent directly to the user's address.\n\nA new AA is created for each user and manages the funds of this single user.\n\nThis buffer AA is used to allow users to buy T2 tokens in one step by paying in non-Obyte cryptocurrencies (BTC, ETH, USDT, etc) on the [Buy interest tokens](https://ostable.org/buy) page on ostable.org. A new buffer AA is created for the user, his input currency is converted to GBYTE using a swapping service such as simpleswap.io, the output GBYTE is sent to the buffer AA, then a bot triggers the AA (possibly, several times) to convert the deposited GBYTEs to T2 tokens and send them to the user.\n\nAnybody can trigger the AA to execute a purchase of T2 tokens. A companion bot is included here that watches the transactions happening on the curve, estimates their effects, calculates the amount of T2 tokens that can be bought without paying a fee that would exceed 1%, and triggers the AA.\n\nThe bot can also send some additional GBYTEs to the AA to compensate the user for the fees charged by the swapping service. These additional GBYTEs are also converted to T2.\n\n## Installing\n```bash\nyarn\n```\n\n## Testing the AA\n\nTests are written using the [AA Testkit](https://github.com/valyakin/aa-testkit).\n\n```bash\nyarn test\n```\n\n## Running the bot\n\n```bash\nnode run.js 2\u003eerrlog\n```\nIf it complains about missing tables, create them:\n```bash\nnode db_import.js\n```\n\nThe bot listens on port 8080 (8081 for testnet) and serves as backend for the [Buy interest tokens](https://ostable.org/buy) page on ostable.org.\n\nIt serves the following endpoints:\n* GET `/api/create_buffer`: create a new buffer AA for a user, parameters: `address` - user address where they want to receive T2 tokens, `curve_aa` - address of the curve AA they are buying from.\n* GET `/api/get_expected_compensation`: get an estimation of the compensation for a simpleswap exchange of amount `amount_in` in input currency `currency_in` to `amount_out` GBYTE.\n* POST `/api/create_order`: record a newly created exchange order. Parameters: `buffer_address` and the properties of the simpleswap order.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyteball%2Fbonded-stablecoin-buffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyteball%2Fbonded-stablecoin-buffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyteball%2Fbonded-stablecoin-buffer/lists"}