MatrixETF-Solidity-Controllers is a controller used to manage the creation of funds, and their subscription, redemption, trading and other functions. All operations can be implemented through the controller.
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
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]
To add liquidity approve the smart pool to pull the underlying tokens. And call:
function joinPool(uint256 _amount) external;To remove liquidity:
function exitPool(uint256 _amount) external;To get the underlying tokens call:
function getTokens() external view returns(address[] memory);To get the underlying tokens and amounts needed to mint a certain amount of pool shares call:
function calcTokensForAmount(uint256 _amount) external view returns(address[] memory tokens, uint256[] memory amounts);Get the address of the underlying balancer pool:
function getBPool() external view returns(address);Get the swap fee:
function getSwapFee() external view returns (uint256);Get if trading is enabled on the underlying balancer pool:
function isPublicSwap() external view returns (bool);Some pools have a cap which limits the totalSupply of the pool shares token. To get the cap you call:
function getCap() external view returns(uint256);