Skip to content

Commit ef56ee9

Browse files
committed
Fix docs
1 parent 18fc949 commit ef56ee9

File tree

4 files changed

+27
-31
lines changed

4 files changed

+27
-31
lines changed

contracts/stableCoin/farming/IUnifiedStableFarming.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ interface IUnifiedStableFarming {
6969
* equilibrium.
7070
* @param stableCoinAddress Address of the $uSD stablecoin
7171
* @param pairIndex Index of the pair inside the whitelisted pairs array
72-
* @param pairAmount
72+
* @param pairAmount Amount of Uniswap liquidity tokens to send back to the pool
7373
* @param amountAMin The minimum amount of tokenA that must be received for the transaction not to revert
7474
* @param amountBMin The minimum amount of tokenB that must be received for the transaction not to revert
7575
* @param tokenAddress Address of the token to swap to get $uSD

contracts/stableCoin/farming/UnifiedStableFarming.sol

+23-29
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,23 @@ pragma solidity ^0.6.0;
44

55
import "./IUnifiedStableFarming.sol";
66

7-
/**
8-
* @inheritdoc IUnifiedStableFarming
9-
*/
107
contract UnifiedStableFarming is IUnifiedStableFarming {
118
address private constant UNISWAP_V2_ROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
129

1310
uint256[] private _percentage;
1411

15-
constructor(uint256[] memory percentage) {
12+
constructor(uint256[] memory percentage) public {
1613
assert(percentage.length == 2);
1714
_percentage = percentage;
1815
}
1916

20-
function percentage() public override view returns(uint256[] memory) {
17+
function percentage() public view returns (uint256[] memory) {
2118
return _percentage;
2219
}
2320

24-
//Earn pumping uSD - Means swap a chosen stableCoin for uSD, then burn the difference of uSD to obtain a greater uSD value in Uniswap Pool tokens
21+
/**
22+
* @inheritdoc IUnifiedStableFarming
23+
*/
2524
function earnByPump(
2625
address stableCoinAddress,
2726
uint256 pairIndex,
@@ -48,8 +47,8 @@ contract UnifiedStableFarming is IUnifiedStableFarming {
4847
(uint256 returnA, uint256 returnB) = IStableCoin(stableCoinAddress).burn(
4948
pairIndex,
5049
pairAmount,
51-
amountA,
52-
amountB
50+
amountAMin,
51+
amountBMin
5352
);
5453
(address tokenA, address tokenB, ) = _getPairData(stableCoinAddress, pairIndex);
5554
// Check that the pump was successful
@@ -81,18 +80,13 @@ contract UnifiedStableFarming is IUnifiedStableFarming {
8180
uint256 stableCoinAmount
8281
) private view returns (bool) {
8382
IStableCoin stableCoin = IStableCoin(stableCoinAddress);
84-
uint256 cumulative = stableCoin.fromTokenToStable(
85-
tokenAddress,
86-
tokenValue
87-
);
83+
uint256 cumulative = stableCoin.fromTokenToStable(tokenAddress, tokenValue);
8884
cumulative += stableCoin.fromTokenToStable(token0, return0);
8985
cumulative += stableCoin.fromTokenToStable(token1, return1);
9086
uint256 percentage = (cumulative * _percentage[0]) / _percentage[1];
9187
uint256 cumulativePlus = cumulative + percentage;
9288
uint256 cumulativeMinus = cumulative - percentage;
93-
return
94-
stableCoinAmount >= cumulativeMinus &&
95-
stableCoinAmount <= cumulativePlus;
89+
return stableCoinAmount >= cumulativeMinus && stableCoinAmount <= cumulativePlus;
9690
}
9791

9892
/**
@@ -124,29 +118,29 @@ contract UnifiedStableFarming is IUnifiedStableFarming {
124118
amountB
125119
);
126120
// Mint $uSD
127-
IStableCoin(stableCoinAddress).mint(pairIndex, amount0, amount1, amount0Min, amount1Min);
121+
IStableCoin(stableCoinAddress).mint(pairIndex, amountA, amountB, amountAMin, amountBMin);
128122
// For each of the chosen output pair swap $uSD to obtain the desired amount of stablecoin
129123
for (uint256 i = 0; i < tokenIndices.length; i++) {
130124
_swap(
131125
stableCoinAddress,
132-
tokenIndices[i] == 0 ? token0 : token1,
126+
tokenIndices[i] == 0 ? tokenA : tokenB,
133127
stableCoinAmounts[i],
134128
msg.sender
135129
);
136130
}
137131
// Send the tokens back to their owner
138-
_flushToSender(token0, token1, stableCoinAddress);
132+
_flushToSender(tokenA, tokenB, stableCoinAddress);
139133
}
140134

141135
function _transferTokens(
142136
address stableCoinAddress,
143137
uint256 pairIndex,
144-
uint256 amount0,
145-
uint256 amount1
138+
uint256 amountA,
139+
uint256 amountB
146140
) private {
147-
(address token0, address token1, ) = _getPairData(stableCoinAddress, pairIndex);
148-
IERC20(token0).transferFrom(msg.sender, address(this), amount0);
149-
IERC20(token1).transferFrom(msg.sender, address(this), amount1);
141+
(address tokenA, address tokenB, ) = _getPairData(stableCoinAddress, pairIndex);
142+
IERC20(tokenA).transferFrom(msg.sender, address(this), amountA);
143+
IERC20(tokenB).transferFrom(msg.sender, address(this), amountB);
150144
}
151145

152146
function _getPairData(address stableCoinAddress, uint256 pairIndex)
@@ -200,13 +194,13 @@ contract UnifiedStableFarming is IUnifiedStableFarming {
200194
}
201195

202196
function _flushToSender(
203-
address token0,
204-
address token1,
205-
address token2
197+
address tokenA,
198+
address tokenB,
199+
address tokenC
206200
) private {
207-
_flushToSender(token0);
208-
_flushToSender(token1);
209-
_flushToSender(token2);
201+
_flushToSender(tokenA);
202+
_flushToSender(tokenB);
203+
_flushToSender(tokenC);
210204
}
211205

212206
/**

docs/build

Submodule build updated from 4910af7 to 411f57a

docs/mkdocs.yml

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ nav:
1212
- IMVDProxy: stableCoin/standalone/IMVDProxy.md
1313
- IStateHolder: stableCoin/standalone/IStateHolder.md
1414
- IStableCoin: stableCoin/standalone/IStableCoin.md
15+
- Farming:
16+
- IUnifiedStableFarming: stableCoin/farming/IUnifiedStableFarming.md
1517
- Microservices:
1618
- MintNewVotingTokensForStableCoinFunctionality: stableCoin/microservices/MintNewVotingTokensForStableCoinFunctionality.md
1719

0 commit comments

Comments
 (0)