-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Christopher Maree <[email protected]>
- Loading branch information
1 parent
07da227
commit 582859a
Showing
59 changed files
with
15,471 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.sol linguist-language=Solidity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# Next.js build output | ||
.next | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and *not* Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
#Buidler files | ||
cache | ||
artifacts | ||
.secret | ||
|
||
.DS_Store | ||
coverage.json | ||
flats.sol | ||
.coverage_cache/ | ||
.coverage_contracts/ | ||
typechain/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"printWidth": 100 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
mocha: { | ||
grep: "@skip-on-coverage", // Find everything with this tag | ||
invert: true // Run the grep's inverse set. | ||
}, | ||
providerOptions: { | ||
gasLimit: 1000000000, | ||
allowUnlimitedContractSize: true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "solhint:default", | ||
"rules": { | ||
"max-line-length": ["error", 100] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,100 @@ | ||
# mindful.cash | ||
# Pie Smart Pools | ||
|
||
**Pie Smart Pools** are asset management agnostic(currently Balancer only) **D**ecentralised **T**raded **F**unds. They share a common interface to make them easy to integrate in other products. | ||
|
||
All Smart Pools are fully upgradeable to make it easy to add features and optimise gas usage at later stages. | ||
|
||
## Development | ||
|
||
### Setup the dev enviroment | ||
|
||
Clone this repo. And copy the contents of ``env.example`` to a new file called ``.env`` and edit the the relevant values inside. **DO NOT** share this file with anyone as it will contain sensitive data. | ||
|
||
Install all dependencies: | ||
``` | ||
yarn | ||
``` | ||
Build the project: | ||
``` | ||
yarn build | ||
``` | ||
Run the tests: | ||
``` | ||
yarn test | ||
``` | ||
Create coverage report: | ||
``` | ||
yarn coverage | ||
``` | ||
|
||
### Running mainnet/testnet test | ||
|
||
To test a new implementation in testnet conditions. Set the implementation of a test pool to the new version and run the following script. | ||
|
||
``` | ||
POOL=[POOL_ADDRESS] npx buidler test ./mainnet-test/test.ts --network [rinkeby|kovan|rinkeby] | ||
``` | ||
|
||
## Integration | ||
|
||
### Adding and removing liquidity | ||
|
||
To add liquidity approve the smart pool to pull the underlying tokens. And call: | ||
|
||
```solidity | ||
function joinPool(uint256 _amount) external; | ||
``` | ||
|
||
To remove liquidity: | ||
|
||
```solidity | ||
function exitPool(uint256 _amount) external; | ||
``` | ||
|
||
### Getting pool details | ||
|
||
To get the underlying tokens call: | ||
|
||
```solidity | ||
function getTokens() external view returns(address[] memory); | ||
``` | ||
|
||
To get the underlying tokens and amounts needed to mint a certain amount of pool shares call: | ||
|
||
```solidity | ||
function calcTokensForAmount(uint256 _amount) external view returns(address[] memory tokens, uint256[] memory amounts); | ||
``` | ||
|
||
#### Balancer smart pool specific | ||
Get the address of the underlying balancer pool: | ||
|
||
```solidity | ||
function getBPool() external view returns(address); | ||
``` | ||
|
||
Get the swap fee: | ||
|
||
```solidity | ||
function getSwapFee() external view returns (uint256); | ||
``` | ||
|
||
Get if trading is enabled on the underlying balancer pool: | ||
|
||
```solidity | ||
function isPublicSwap() external view returns (bool); | ||
``` | ||
|
||
|
||
#### Capped pool specific | ||
Some pools have a cap which limits the totalSupply of the pool shares token. To get the cap you call: | ||
|
||
```solidity | ||
function getCap() external view returns(uint256); | ||
``` | ||
|
||
## Deployed Pools | ||
|
||
| Name | Symbol | Address | Type | | ||
|--------------|--------|-------------------------------------------------------------------------------------------------------------------------------|-----------------| | ||
| PieDAO BTC++ | BTC++ | [0x0327112423f3a68efdf1fcf402f6c5cb9f7c33fd](https://etherscan.io/address/0x0327112423f3a68efdf1fcf402f6c5cb9f7c33fd) | Balancer Capped | | ||
| PieDAO USD++ | USD++ | [0x9a48bd0ec040ea4f1d3147c025cd4076a2e71e3e](https://etherscan.io/address/0x9a48bd0ec040ea4f1d3147c025cd4076a2e71e3e) | Balancer Capped | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "PieDAO BTC++", | ||
"symbol": "BTC++", | ||
"initialValue": "1", | ||
"initialSupply": "0.04", | ||
"cap": "10", | ||
"tokens": [ | ||
{ | ||
"name": "wBTC", | ||
"decimals": "8", | ||
"address": "0x69FfB2c1Bfe8dE999a81bcf7fd58328540db3D6e", | ||
"weight": "25", | ||
"value": "1" | ||
}, | ||
{ | ||
"name": "pBTC", | ||
"decimals": "18", | ||
"address": "0xAA2612E023ff753044baAfbA6abe98e37A341308", | ||
"weight": "25", | ||
"value": "1" | ||
}, | ||
{ | ||
"name": "imBTC", | ||
"decimals": "8", | ||
"address": "0x8bB95f2E07149C6de146928e00bf99c0fb0F7D29", | ||
"weight": "25", | ||
"value": "1" | ||
}, | ||
{ | ||
"name": "sBTC", | ||
"decimals": "18", | ||
"address": "0x958ad940f398D76B5Bc6923FcA12bD7f1F80f8B1", | ||
"weight": "25", | ||
"value": "1" | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "PieDAO BTC++", | ||
"symbol": "BTC++", | ||
"initialValue": "1", | ||
"initialSupply": "0.04", | ||
"cap": "10", | ||
"tokens": [ | ||
{ | ||
"name": "wBTC", | ||
"decimals": "8", | ||
"address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", | ||
"weight": "25", | ||
"value": "1" | ||
}, | ||
{ | ||
"name": "pBTC", | ||
"decimals": "18", | ||
"address": "0x5228a22e72ccc52d415ecfd199f99d0665e7733b", | ||
"weight": "25", | ||
"value": "1" | ||
}, | ||
{ | ||
"name": "imBTC", | ||
"decimals": "8", | ||
"address": "0x3212b29E33587A00FB1C83346f5dBFA69A458923", | ||
"weight": "25", | ||
"value": "1" | ||
}, | ||
{ | ||
"name": "sBTC", | ||
"decimals": "18", | ||
"address": "0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6", | ||
"weight": "25", | ||
"value": "1" | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "PieDAO Test USD Pool", | ||
"symbol": "TU", | ||
"initialValue": "1", | ||
"initialSupply": "100", | ||
"cap": "10", | ||
"tokens": [ | ||
{ | ||
"name": "USDC", | ||
"decimals": "6", | ||
"address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", | ||
"weight": "47.22", | ||
"value": "1" | ||
}, | ||
{ | ||
"name": "DAI", | ||
"decimals": "18", | ||
"address": "0x6B175474E89094C44Da98b954EedeAC495271d0F", | ||
"weight": "20.42", | ||
"value": "1" | ||
}, | ||
{ | ||
"name": "TUSD", | ||
"decimals": "18", | ||
"address": "0x0000000000085d4780B73119b644AE5ecd22b376", | ||
"weight": "28.58", | ||
"value": "1" | ||
}, | ||
{ | ||
"name": "sUSD", | ||
"decimals": "18", | ||
"address": "0x57ab1e02fee23774580c119740129eac7081e9d3", | ||
"weight": "3.78", | ||
"value": "1" | ||
} | ||
] | ||
} | ||
|
Oops, something went wrong.