{"id":15407196,"url":"https://github.com/ltfschoen/dex","last_synced_at":"2025-04-18T03:18:44.405Z","repository":{"id":76619992,"uuid":"117412496","full_name":"ltfschoen/dex","owner":"ltfschoen","description":"Decentralised Exchange (DEX) for Ethereum","archived":false,"fork":false,"pushed_at":"2018-04-18T10:22:37.000Z","size":422,"stargazers_count":32,"open_issues_count":4,"forks_count":25,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T06:21:47.919Z","etag":null,"topics":["decentralised-exchange","dex","ethereum","exchange","ganache-cli","ico","solidity","tokens"],"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/ltfschoen.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":"2018-01-14T07:55:36.000Z","updated_at":"2025-02-03T19:54:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa9823ae-e75a-41f5-9f43-6672b3afcb02","html_url":"https://github.com/ltfschoen/dex","commit_stats":{"total_commits":58,"total_committers":2,"mean_commits":29.0,"dds":"0.017241379310344862","last_synced_commit":"ddc0f738a90e6971291cb34652596393de931f90"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Fdex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Fdex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Fdex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Fdex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ltfschoen","download_url":"https://codeload.github.com/ltfschoen/dex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249419560,"owners_count":21268659,"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":["decentralised-exchange","dex","ethereum","exchange","ganache-cli","ico","solidity","tokens"],"created_at":"2024-10-01T16:27:38.815Z","updated_at":"2025-04-18T03:18:44.373Z","avatar_url":"https://github.com/ltfschoen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Setup \n\n* Fork and clone the repository\n\n* [Install NVM](https://github.com/creationix/nvm)\n\n* Switch to Node version specified in .nvmrc\n\n```\nnvm install\n```\n\n* Terminal Tab 1 - Install Truffle\n  * Reference: http://truffleframework.com/\n\n```\nnpm install -g truffle\n```\n\n* Terminal Tab 2 - Install Test Framework with Ethereum TestRPC\n\n```\nnpm install -g ganache-cli\n```\n\n* Terminal Tab 2 - Start Ethereum Blockchain Protocol Node Simulation\n\n```\nganache-cli \\\n  --port=\"8500\" \\\n  --mnemonic \"copy obey episode awake damp vacant protect hold wish primary travel shy\" \\\n  --verbose \\\n  --networkId=3 \\\n  --gasLimit=7984452 \\\n  --gasPrice=2000000000;\n```\n\n* Optionally [Install Geth](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum) and run the Testnet using Geth in the project directory:\n\n  * Show installation directory of Geth and Go, and show Go path [Reference](https://github.com/ethereum/go-ethereum/wiki/Developers%27-Guide)\n\n```\nwhich geth\nwhich go\necho $GOPATH\ngeth version\n```\n\n  * Show where Geth Chain directories are stored:\n\n```\nfind ~ -type d -name 'chaindata'\n```\n\n  * [Install or Upgrade existing version of Geth](https://github.com/ethereum/go-ethereum/wiki/Installation-Instructions-for-Mac) (if not installed using Homebrew)\n\n```\nbrew tap ethereum/ethereum\nbrew install ethereum\nbrew upgrade ethereum\n```\n\n* Terminal Tab 1 - Compile and Deploy the FixedSupplyToken Contract\n\n```\ntruffle migrate --network development\n```\n\n* Terminal Tab 1 - Run Sample Unit Tests on the Truffle Contract. Truffle Re-Deploys the Contracts\n\n```\ntruffle test\n```\n\n# Debugging\n\n* Debug the Solidity Smart Contract in Remix IDE\n* Verify the Solidity Smart Contract compiles by pasting it in MIST using https://github.com/ltfschoen/geth-node\n* Verify the Solidity Smart Contract compiles by deploying it to Ethereum TestRPC using Truffle\n\n# TODO\n\n* [ ] - Incorporate Automated Market Maker (AMM) similar to that described in 0x Whitepaper\n\n# Initial Setup - Truffle, TestRPC, Unit Tests (FixedSupplyContract)\n\n* Install Truffle\n  * Reference: http://truffleframework.com/\n\n```\nnpm install -g truffle\n```\n\n* Setup Truffle to Manage Contracts (i.e. MetaCoin sample), Migrations and Unit Tests\n\n```\ntruffle init\n\ntruffle migrate --network development\n```\n\n* Initialise with Front-End\n  * Truffle Default\n    * https://github.com/trufflesuite/truffle-init-default\n  * Truffle Webpack\n    * https://github.com/trufflesuite/truffle-init-webpack\n    * https://github.com/truffle-box/webpack-box\n  * Truffle React\n    * http://truffleframework.com/boxes/\n\n* Truffle Configuration File Examples\n  * http://truffleframework.com/docs/advanced/configuration\n  * Note: Use `from` to specify the From Address for Truffle Contract Deployment.\n  * Use the Mnemonic to Restart TestRPC with the same Accounts.\n  * Note: Use `provider` to specify a Web3 Provider\n  * Note: Truffle Build `truffle build` script for say Webpack is usually in package.json\n\n* Truffle with Test Framework using Ethereum TestRPC (avoid delays in mining transactions with Geth Testnet)\n  * Ethereum TestRPC - In-Memory Blockchain Simulation\n\n```\nnpm install -g ganache-cli\n```\n\n  * Start Ethereum Blockchain Protocol Node Simulation with 10x Accounts on http://localhost:8500\n    * Creates 10x Private Keys and provides a Mnemonic. Assigns to each associated Address 100 Ether.\n    * Note: Private Keys may be imported into Metamask Client \n    * Note: Mnemonic may be used subsequently with Ethereum TestRPC to re-create the Accounts with `\n\n```\nganache-cli\n```\n\n  * Restart TestRPC with Same Accounts (i.e. `ganache-cli --mnemonic \"copy obey episode awake damp vacant protect hold wish primary travel shy\"`)\n\n```\nganache-cli --port 8500 --mnemonic \u003cINSERT_MNEMONIC\u003e \n```\n\n* Add FixedSupplyToken to Truffle Contracts folder\n* Remove MetaCoin from Truffle Contracts folder\n* Update 2nd Migration file to deploy FixedSupplyToken\n\n* Compile and Deploy the FixedSupplyToken Contract\n\n```\ntruffle migrate --network development\n```\n\n* Run Sample Unit Tests on the Truffle MetaCoin Contract. Truffle Re-Deploys the MetaCoin Contracts\n\n```\ntruffle test\n```\n\n# Troubleshooting\n\n* Try restarting Ganache TestRPC if you encounter error `sender doesn't have enough funds to send tx. The upfront cost is: x and the sender's account only has: y`\n\n* Fix error `Error: Error: Exceeds block gas limit` that may occur when sending Gas Limit say of `50000000` when truffle.js has `gas` property set as `gas: 4712388,`, by changing to a smaller value: `myExchangeInstance.buyToken(\"FIXED\", web3.toWei(4, \"finney\"), 5, {from: accounts[0], gas: 4000000});`\n\n* Fix `Error: VM Exception while processing transaction: out of gas`. In the `buyToken` function it always occurs after a certain line of code. Simply increase the Gas Limit to the Mainnet's limit (currently shown as `7984452` at https://ethstats.net/) in both Ganache CLI Flags and in truffle.js","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fltfschoen%2Fdex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fltfschoen%2Fdex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fltfschoen%2Fdex/lists"}