-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
feature/rinkeby-deployment
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
## `SFactory` | ||
|
||
|
||
|
||
|
||
|
||
|
||
### `constructor(address spoolTemplate)` (public) | ||
|
||
|
||
|
||
|
||
|
||
### `newSPool() β address spool` (public) | ||
|
||
|
||
|
||
|
||
|
||
### `getSPool() β address` (external) | ||
|
||
|
||
|
||
|
||
|
||
|
||
### `SPoolCreated(address newSPoolAddress, address spoolTemplateAddress)` | ||
|
||
|
||
|
||
|
||
|
||
### `SPoolRegistered(address spoolAddress, address registeredBy, uint256 registeredAt)` | ||
|
||
|
||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
## `BConst` | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
## `BMath` | ||
|
||
|
||
|
||
|
||
|
||
|
||
### `calcSpotPrice(uint256 tokenBalanceIn, uint256 tokenWeightIn, uint256 tokenBalanceOut, uint256 tokenWeightOut, uint256 swapFee) β uint256 spotPrice` (public) | ||
|
||
******************************************************************************************** | ||
// calcSpotPrice // | ||
// sP = spotPrice // | ||
// bI = tokenBalanceIn ( bI / wI ) 1 // | ||
// bO = tokenBalanceOut sP = ----------- * ---------- // | ||
// wI = tokenWeightIn ( bO / wO ) ( 1 - sF ) // | ||
// wO = tokenWeightOut // | ||
// sF = swapFee //********************************************************************************************* | ||
|
||
|
||
|
||
### `calcOutGivenIn(uint256 tokenBalanceIn, uint256 tokenWeightIn, uint256 tokenBalanceOut, uint256 tokenWeightOut, uint256 tokenAmountIn, uint256 swapFee) β uint256 tokenAmountOut` (public) | ||
|
||
******************************************************************************************** | ||
// calcOutGivenIn // | ||
// aO = tokenAmountOut // | ||
// bO = tokenBalanceOut // | ||
// bI = tokenBalanceIn / / bI \ (wI / wO) \ // | ||
// aI = tokenAmountIn aO = bO * | 1 - | -------------------------- | ^ | // | ||
// wI = tokenWeightIn \ \ ( bI + ( aI * ( 1 - sF )) / / // | ||
// wO = tokenWeightOut // | ||
// sF = swapFee //********************************************************************************************* | ||
|
||
|
||
|
||
### `calcInGivenOut(uint256 tokenBalanceIn, uint256 tokenWeightIn, uint256 tokenBalanceOut, uint256 tokenWeightOut, uint256 tokenAmountOut, uint256 swapFee) β uint256 tokenAmountIn` (public) | ||
|
||
******************************************************************************************** | ||
// calcInGivenOut // | ||
// aI = tokenAmountIn // | ||
// bO = tokenBalanceOut / / bO \ (wO / wI) \ // | ||
// bI = tokenBalanceIn bI * | | ------------ | ^ - 1 | // | ||
// aO = tokenAmountOut aI = \ \ ( bO - aO ) / / // | ||
// wI = tokenWeightIn -------------------------------------------- // | ||
// wO = tokenWeightOut ( 1 - sF ) // | ||
// sF = swapFee //********************************************************************************************* | ||
|
||
|
||
|
||
### `calcPoolOutGivenSingleIn(uint256 tokenBalanceIn, uint256 tokenWeightIn, uint256 poolSupply, uint256 totalWeight, uint256 tokenAmountIn, uint256 swapFee) β uint256 poolAmountOut` (public) | ||
|
||
******************************************************************************************** | ||
// calcPoolOutGivenSingleIn // | ||
// pAo = poolAmountOut / \ // | ||
// tAi = tokenAmountIn /// / // wI \ \\ \ wI \ // | ||
// wI = tokenWeightIn //| tAi *| 1 - || 1 - -- | * sF || + tBi \ -- \ // | ||
// tW = totalWeight pAo=|| \ \ \\ tW / // | ^ tW | * pS - pS // | ||
// tBi = tokenBalanceIn \\ ------------------------------------- / / // | ||
// pS = poolSupply \\ tBi / / // | ||
// sF = swapFee \ / //********************************************************************************************* | ||
|
||
|
||
|
||
### `calcSingleInGivenPoolOut(uint256 tokenBalanceIn, uint256 tokenWeightIn, uint256 poolSupply, uint256 totalWeight, uint256 poolAmountOut, uint256 swapFee) β uint256 tokenAmountIn` (public) | ||
|
||
******************************************************************************************** | ||
// calcSingleInGivenPoolOut // | ||
// tAi = tokenAmountIn //(pS + pAo)\ / 1 \\ // | ||
// pS = poolSupply || --------- | ^ | --------- || * bI - bI // | ||
// pAo = poolAmountOut \\ pS / \(wI / tW)// // | ||
// bI = balanceIn tAi = -------------------------------------------- // | ||
// wI = weightIn / wI \ // | ||
// tW = totalWeight | 1 - ---- | * sF // | ||
// sF = swapFee \ tW / //********************************************************************************************* | ||
|
||
|
||
|
||
### `calcSingleOutGivenPoolIn(uint256 tokenBalanceOut, uint256 tokenWeightOut, uint256 poolSupply, uint256 totalWeight, uint256 poolAmountIn, uint256 swapFee) β uint256 tokenAmountOut` (public) | ||
|
||
******************************************************************************************** | ||
// calcSingleOutGivenPoolIn // | ||
// tAo = tokenAmountOut / / \\ // | ||
// bO = tokenBalanceOut / // pS - (pAi * (1 - eF)) \ / 1 \ \\ // | ||
// pAi = poolAmountIn | bO - || ----------------------- | ^ | --------- | * b0 || // | ||
// ps = poolSupply \ \\ pS / \(wO / tW)/ // // | ||
// wI = tokenWeightIn tAo = \ \ // // | ||
// tW = totalWeight / / wO \ \ // | ||
// sF = swapFee * | 1 - | 1 - ---- | * sF | // | ||
// eF = exitFee \ \ tW / / //********************************************************************************************* | ||
|
||
|
||
|
||
### `calcPoolInGivenSingleOut(uint256 tokenBalanceOut, uint256 tokenWeightOut, uint256 poolSupply, uint256 totalWeight, uint256 tokenAmountOut, uint256 swapFee) β uint256 poolAmountIn` (public) | ||
|
||
******************************************************************************************** | ||
// calcPoolInGivenSingleOut // | ||
// pAi = poolAmountIn // / tAo \\ / wO \ \ // | ||
// bO = tokenBalanceOut // | bO - -------------------------- |\ | ---- | \ // | ||
// tAo = tokenAmountOut pS - || \ 1 - ((1 - (tO / tW)) * sF)/ | ^ \ tW / * pS | // | ||
// ps = poolSupply \\ -----------------------------------/ / // | ||
// wO = tokenWeightOut pAi = \\ bO / / // | ||
// tW = totalWeight ------------------------------------------------------------- // | ||
// sF = swapFee ( 1 - eF ) // | ||
// eF = exitFee //********************************************************************************************* | ||
|
||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
## `BNum` | ||
|
||
|
||
|
||
|
||
|
||
|
||
### `btoi(uint256 a) β uint256` (internal) | ||
|
||
|
||
|
||
|
||
|
||
### `bfloor(uint256 a) β uint256` (internal) | ||
|
||
|
||
|
||
|
||
|
||
### `badd(uint256 a, uint256 b) β uint256` (internal) | ||
|
||
|
||
|
||
|
||
|
||
### `bsub(uint256 a, uint256 b) β uint256` (internal) | ||
|
||
|
||
|
||
|
||
|
||
### `bsubSign(uint256 a, uint256 b) β uint256, bool` (internal) | ||
|
||
|
||
|
||
|
||
|
||
### `bmul(uint256 a, uint256 b) β uint256` (internal) | ||
|
||
|
||
|
||
|
||
|
||
### `bdiv(uint256 a, uint256 b) β uint256` (internal) | ||
|
||
|
||
|
||
|
||
|
||
### `bpowi(uint256 a, uint256 n) β uint256` (internal) | ||
|
||
|
||
|
||
|
||
|
||
### `bpow(uint256 base, uint256 exp) β uint256` (internal) | ||
|
||
|
||
|
||
|
||
|
||
### `bpowApprox(uint256 base, uint256 exp, uint256 precision) β uint256` (internal) | ||
|
||
|
||
|
||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
## `BToken` | ||
|
||
|
||
|
||
|
||
|
||
|
||
### `name() β string` (public) | ||
|
||
|
||
|
||
|
||
|
||
### `symbol() β string` (public) | ||
|
||
|
||
|
||
|
||
|
||
### `decimals() β uint8` (public) | ||
|
||
|
||
|
||
|
||
|
||
### `allowance(address src, address dst) β uint256` (external) | ||
|
||
|
||
|
||
|
||
|
||
### `balanceOf(address whom) β uint256` (external) | ||
|
||
|
||
|
||
|
||
|
||
### `totalSupply() β uint256` (public) | ||
|
||
|
||
|
||
|
||
|
||
### `approve(address dst, uint256 amt) β bool` (external) | ||
|
||
|
||
|
||
|
||
|
||
### `increaseApproval(address dst, uint256 amt) β bool` (external) | ||
|
||
|
||
|
||
|
||
|
||
### `decreaseApproval(address dst, uint256 amt) β bool` (external) | ||
|
||
|
||
|
||
|
||
|
||
### `transfer(address dst, uint256 amt) β bool` (external) | ||
|
||
|
||
|
||
|
||
|
||
### `transferFrom(address src, address dst, uint256 amt) β bool` (external) | ||
|
||
|
||
|
||
|
||
|
||
|