This project is written using the Google App Engine IaaS (Infrastructure as a Service) framework.
The frontend is developed using the React web framework.
- Install requirements into the
lib
folderpip install -t lib -r requirements.txt
Note: Project settings are already configured in app.yaml
, and the environment is setup to serve the build files generated from React.
- To start the server, simply run the docker-compose command below:
docker-compose up
- The command will start and instance of the python server accessible at:
- The command will also start an instance of the google cloud datastore emulator at:
- To create an offer:
POST http://localhost:8080/offers
- curl example:
curl 'http://localhost:8080/offers' \ -H 'Content-Type: application/json;charset=UTF-8' \ -H 'Accept: application/json, text/plain, */*' \ --data-binary '{"lenderAddress":"0x23614cad46228c932caef635ca5279","loanTokenAddress":"0x73de023fc01ab","loanTokenAmount":"1000000000000000000000","loanCostTokenAddress":"0x023e1abfc073d","loanCostTokenAmount":"1000000000000000000","loanInterestTokenAddress":"0x023e1abfc073d","loanInterestTokenAmount":"1000000000000000000","ecSignature":"0xefa60b2ad38a0df94a0b7a2ec03563c0888d532ea3b22b8c00d0c711ceb01b9e55ac7eed2d03cf5465b443ad8b461f057c9dd17771d9ba93d70d8f451305e24f1c"}'
- To fetch all existing offers:
GET http://localhost:8080/offers
- curl example:
> GET /offers HTTP/1.1 > Host: localhost:8080 > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 200 OK < content-type: application/json < Server: Development/2.0 < { offers: [ { ecSignature: "0xefa60b2ad38a0df94a0b7a2ec03563c0888d532ea3b22b8c00d0c711ceb01b9e55ac7eed2d", lenderAddress: "0x23614cad46228c932caef635ca5279", loanCostTokenAddress: "0x023e1abfc073d", loanCostTokenAmount: "1000000000000000000", loanInterestTokenAddress: "0x023e1abfc073d", loanInterestTokenAmount: "1000000000000000000", loanTokenAddress: "0x73de023fc01ab", loanTokenAmount: "1000000000000000000000" }, { ecSignature: "0xf7d3998f7b859eea4f2a370afbfd4a42ba8af96695cd02efbab10aaabf38deb7267a86581f", lenderAddress: "0x23614cad46228c932caef635ca5279", loanCostTokenAddress: "0x023e1abfc073d", loanCostTokenAmount: "1000000000000000000", loanInterestTokenAddress: "0x023e1abfc073d", loanInterestTokenAmount: "1000000000000000000", loanTokenAddress: "0x73de023fc01ab", loanTokenAmount: "10000000000000000000000" } ] }
- To get market information:
GET http://localhost:8080/markets
- curl example:
> GET /markets HTTP/1.1
> Host: localhost:8080
>
< HTTP/1.1 200 OK
< content-type: application/json
<
{
"info": {
"markets": [
{
"baseTokenAddress": "0x73de023fc01ab",
"pair": "OMG/ETH",
"quoteTokenAddress": "0x023e1abfc073d"
},
{
"baseTokenAddress": "0x048e1a2d7803a",
"pair": "ZRX/ETH",
"quoteTokenAddress": "0x023e1abfc073d"
}
],
"tokens": {
"0x023e1abfc073d": {
"logo_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAKdUExURUxpcX9/fy4vL////wAAAKqqqj8/PwAAAFVVVX9/fzU2Ni0uLjQ1NS8wMC8wMDAxMYGCg4aHiC8wMBISEnx9foKDhP///zEyMi4uLi8vLy8wMC4wMCwzMzAxMS4wMC8vLzAwMAAAAE1NU4KDhH+CgoGCg4GCg4uLi2RkZIGBg4SFhisrK4WGhy4yMi0wMICBgi8vLzo7Ozg4OC4uLi4vL4CCg4KCgr+/vy8wMDAxMYaHiHd3eCoqKjIyMoCBgjAxMYKCgoSFhgBVVTMzMy8vLzQ1NVVVVYCBgo2NjXJzdIWGhzMzM4SEhRcXF3+BgSsrKwAAAD0+PoaGiYKEhnt8fS0uLmNjYzAxMX9/f3x9fiYmJhYXF6qqqn19fXiHhy8wMC8vLw0NDTQ1NWhpaS0vLy8vLy0tLS8wMC8wMImKi3R0dhQUFDE1NRMTExMTEy4vL0JCQhEREXt8fRQUFC8yMhMTEzExMTEyMhMTEzExMRMTE4iJioODhFVVqj9AQBMUFBISEhUVFYCBg4CAgzU1NS8wMAcHB4ODgzU2NiYmJoCAgzM0NDIzMzQ1NX9/fzc4ODAwMJGRkYCBgjExMYGBhYiIijY4OIK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sO7u409fpYU90jAxNe0RFuLj3m+BIlMyccTXVRUl8Fga4kjUrQ8TRSNdNurgzBiND8KHD2rhSPcivHObWhooc7HgyL4OGEgO+zMvADkbIAAARJJqN9Q/B/QAAAABJRU5ErkJggg==",
"name": "Ethereum",
"symbol": "ETH"
}
...
}
}
- Include all the files created by running
npm build
oryarn build
into thetemplates
folder. - Deploy the project in one of the following ways:
- Using gcloud:
gcloud app deploy --project [YOUR_PROJECT_ID] app.yaml index.yaml
(More reference available here.) - Using GAE Launcher: Hit the "Deploy" button available on the App Engine GUI.
Note: User should be provided App Engine Admin rights to deploy the project.