{"id":13410090,"url":"https://github.com/BibliothecaDAO/InstaSwap","last_synced_at":"2025-03-14T15:31:53.404Z","repository":{"id":154052707,"uuid":"620127068","full_name":"BibliothecaDAO/InstaSwap","owner":"BibliothecaDAO","description":"InstaSwap - decentralized token swap protocol for ERC-1155 tokens on Starknet.","archived":false,"fork":false,"pushed_at":"2024-01-09T13:48:49.000Z","size":800,"stargazers_count":22,"open_issues_count":0,"forks_count":10,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-07-31T20:40:41.888Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/BibliothecaDAO.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}},"created_at":"2023-03-28T04:40:20.000Z","updated_at":"2024-07-18T10:52:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"826d273e-0438-46f0-9517-0c96f09d6e43","html_url":"https://github.com/BibliothecaDAO/InstaSwap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"auditless/cairo-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BibliothecaDAO%2FInstaSwap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BibliothecaDAO%2FInstaSwap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BibliothecaDAO%2FInstaSwap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BibliothecaDAO%2FInstaSwap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BibliothecaDAO","download_url":"https://codeload.github.com/BibliothecaDAO/InstaSwap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221481989,"owners_count":16829979,"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-07-30T20:01:04.910Z","updated_at":"2024-10-26T01:30:32.290Z","avatar_url":"https://github.com/BibliothecaDAO.png","language":"TypeScript","funding_links":[],"categories":["Projects"],"sub_categories":[],"readme":"# InstaSwap\n\n### initialize sdk\n\nTo initialize sdk,fill the config first\n\n```js\n\nimport { Provider, constants } from \"starknet\";\nimport { useAccount } from \"@starknet-react/core\";\n....\n\nconst provider = new Provider({\n    sequencer: { network: constants.NetworkName.SN_GOERLI },\n  });\n\nconst config = {\n    erc1155Address: \"0x03467674358c444d5868e40b4de2c8b08f0146cbdb4f77242bd7619efcf3c0a6\",\n    werc20Address: \"0x06b09e4c92a08076222b392c77e7eab4af5d127188082713aeecbe9013003bf4\",\n    erc20Address: \"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7\",\n    ekuboPositionAddress: \"0x73fa8432bf59f8ed535f29acfd89a7020758bda7be509e00dfed8a9fde12ddc\",\n    ekuboCoreAddress: \"0x031e8a7ab6a6a556548ac85cbb8b5f56e8905696e9f13e9a858142b8ee0cc221\",\n    quoterAddress: \"0x042aa743335663ed9c7b52b331ab7f81cc8d65280d311506653f9b5cc22be7cb\",\n    provider: provider,\n    account: useAccount(),\n};\n\nconst wrap = new Wrap(config);\n...\n```\n\n### Initialize pool\n\n```js\nconst initialize_tick = { mag: 0n, sign: false };\n\nconst { transaction_hash } = await wrap.mayInitializePool(\n  FeeAmount.LOWEST,\n  initialize_tick,\n);\n```\n\n### Add liquidity\n\n```js\nconst params = {\n      erc1155Amount: [erc1155 amount],\n      erc20Amount: [erc20 amount],\n      fee: [fee],\n      lowerPrice: [lowerBound],\n      upperPrice: [upperBound],\n    };\n\nwrap.addLiquidity(params);\n\n```\n\n\n\n### Withdraw Liquidity\n\n```js\nwrap.withdrawLiquidity(positionId,liquidity);\n```\n\n\n\n\n### Simple wrap\n\n- from erc115 to erc20\n\n```js\n\nconst params = {\n  amountIn: [erc1155 amount for swap],\n  minERC20AmountOut: [min amount],\n  simpleSwapperAddress: [simple swapper address],\n  userAddress:[user address],\n  fee: [fee],\n  slippage: [slippage],\n};\n\nwrap.swapSimple(\n  SwapDirection.ERC1155_TO_ERC20,\n  params,\n);\n\n\n```\n\n- from erc20 to erc1155\n\n```js\n const params = {\n  amountIn: [erc20 amount for swap],\n  minERC20AmountOut: [min amount],\n  simpleSwapperAddress: [simple swapper address],\n  userAddress:[user address],\n  fee: [fee],\n  slippage: [slippage],\n};\n\nwrap.swapSimple(\n  SwapDirection.ERC20_TO_ERC1155,\n  params,\n);\n\n```\n\n### Withdraw erc1155\n\n```js\nwrap.withdraw(erc1155Num);\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBibliothecaDAO%2FInstaSwap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBibliothecaDAO%2FInstaSwap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBibliothecaDAO%2FInstaSwap/lists"}