Skip to content

Commit fbb4ab2

Browse files
committed
Merge branch 'master' into docs
2 parents 881049f + f20e84b commit fbb4ab2

File tree

9 files changed

+413
-249
lines changed

9 files changed

+413
-249
lines changed

assets/css/style.css

+15-3
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ footer p a, footer h5 a {color: #c7ac97; font-weight: bold;}
111111
.StableITBTN, .approveBTN {font-size: 15px; font-weight: bold; padding: 12px 18px; display: inline-block; color: #f1f1f1; text-decoration: none; border-radius: 6px; margin: 15px 5px;}
112112
.approveBTN {background-color: #5549c9; color: #f1f1f1;}
113113
.StableITBTN {background-color: #b030df; color: #f1f1f1;}
114-
.UniTierQuantity .Disabled {background-color: #444444;}
114+
.UniTierQuantity .Disabled, .UniActiveQuantityTier .Disabled {background-color: #444444;}
115115
.SideRebelanceBro {margin: 10px auto;}
116116
.SideRebelanceBro label {width: 100%;}
117117
.SideRebelanceBro label h5 {font-size: 14px; width: 100%; font-weight: normal;}
@@ -128,6 +128,7 @@ footer p a, footer h5 a {color: #c7ac97; font-weight: bold;}
128128
.Boh {position: fixed; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; z-index: 5;}
129129

130130
.UniTitle select, .UniTierQuantity label input {padding: 2px 5px; font-size: 15px; font-weight: bold; margin: 7px; vertical-align: middle;}
131+
.FARMSPECSELECT {padding: 2px 5px; font-size: 15px; font-weight: bold; margin: 7px; vertical-align: middle;}
131132
.UniTitle p {font-size: 17px;margin: 7px; font-weight: normal;}
132133
.UniTitle h6 {display: inline-block; width: 90%; text-align: center; font-size: 11px; margin: 5px auto;}
133134
.UniTitle label {display: inline-block; width: 100%;}
@@ -186,12 +187,23 @@ footer p a, footer h5 a {color: #c7ac97; font-weight: bold;}
186187
.coverMenu li:hover .menuArrow {width: 20px; height: 20px; position: absolute; left: -15px; top: 15px; display: block;}
187188
.coverMenu .menuArrow img {width: 20px; height: 20px;}
188189
.UniActiveQuantityTierBurn {text-align: center !important;}
190+
.UniSideBox .UniActiveQuantityTier {width: 100%;}
191+
.UniSideBox .UniActiveQuantityTier img {width: 20px; height: 20px; margin: 5px; vertical-align: middle;}
192+
.UniSideBox .UniDisactiveQuantityTier img {width: 20px; height: 20px;margin: 5px; vertical-align: middle;}
193+
.SideFarmMaxBTN {font-size: 10px; background-color: #000000; color: #ffffff; font-weight: bold; padding: 2px 4px;}
194+
.WOOOOOOOOOOOOW {font-size:16px !important; color: #128b03 !important;}
195+
.WOOOOOOOOOOOOW b {font-size: 21px;}
196+
.NOOOOOOOOOOOOO {font-size:16px !important; color: #a5012d !important;}
197+
.NOOOOOOOOOOOOO b {font-size: 21px;}
198+
.BOHBOH {margin: 10px auto; display: inline-block;}
199+
.StableCoinTitleALWAYS .StableCoinTitleIntern {display: inline-block !important;padding: 5%; border-radius: 23px;}
200+
.StableCoinTitleALWAYS {width: 90%; margin: 0 auto;}
189201

190202
.Boomer .UniBox, .Boomer .grimoireBox {position: initial;background: rgb(255, 255, 255); box-shadow: rgba(0, 0, 0, 0.01) 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 4px 8px, rgba(0, 0, 0, 0.04) 0px 16px 24px, rgba(0, 0, 0, 0.01) 0px 24px 32px; border-radius: 30px; color: #000000;}
191203
.Boomer .UniSideBox {border-radius: 20px; color: #000000; width: 100%; background-color: #bab9b9;box-shadow: rgba(0, 0, 0, 0.01) 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 4px 8px, rgba(0, 0, 0, 0.04) 0px 16px 24px, rgba(0, 0, 0, 0.01) 0px 24px 32px;}
192204
.Boomer {background: linear-gradient(29deg, rgba(255,255,255,1) 0%, rgba(228,228,228,1) 66%);font-family: "Inter var", sans-serif;}
193205
.Boomer > .explainer {background: linear-gradient(29deg, rgba(80,80,80,1) 0%, rgba(46,46,46,1) 66%);font-family: "Myriad Pro";}
194-
.Boomer .UniTitle select, .Boomer .UniActiveQuantityTier input, .Boomer .UniDisactiveQuantityTier input, .Boomer .RebalanceEmergency label input {background-color: #e7e7e7; color: #000000; border: 5px solid #e7e7e7; border-radius: 5px;}
206+
.Boomer .UniTitle select,.Boomer .FARMSPECSELECT, .Boomer .UniActiveQuantityTier input, .Boomer .UniDisactiveQuantityTier input, .Boomer .RebalanceEmergency label input {background-color: #e7e7e7; color: #000000; border: 5px solid #e7e7e7; border-radius: 5px;}
195207
.Boomer .UniTitle {color: #000000;}
196208
.Boomer .menuOpener, .Boomer .connectOpener {background-color: #bab9b9; color: #000000;box-shadow: rgba(0, 0, 0, 0.01) 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 4px 8px, rgba(0, 0, 0, 0.04) 0px 16px 24px, rgba(0, 0, 0, 0.01) 0px 24px 32px;}
197209
.Boomer .unifiDapp .MenuOpen .coverMenu {background-color: #bab9b9; border-color: #bab9b9;box-shadow: rgba(0, 0, 0, 0.01) 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 4px 8px, rgba(0, 0, 0, 0.04) 0px 16px 24px, rgba(0, 0, 0, 0.01) 0px 24px 32px;}
@@ -236,7 +248,7 @@ footer p a, footer h5 a {color: #c7ac97; font-weight: bold;}
236248
.RPG .UniBox, .RPG .grimoireBox {position: initial;background: rgb(33, 36, 41); border-radius: 20px; color: rgb(195, 197, 203);box-shadow: rgba(0, 0, 0, 0.01) 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 4px 8px, rgba(0, 0, 0, 0.04) 0px 16px 24px, rgba(0, 0, 0, 0.01) 0px 24px 32px;}
237249
.RPG .UniSideBox {border-radius: 20px; color: #bab9b9; width: 100%; background-color: #2b2622;box-shadow: rgba(0, 0, 0, 0.01) 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 4px 8px, rgba(0, 0, 0, 0.04) 0px 16px 24px, rgba(0, 0, 0, 0.01) 0px 24px 32px;}
238250
.RPG {background: linear-gradient(29deg, rgba(80,80,80,1) 0%, rgba(46,46,46,1) 66%);font-family: "Myriad Pro";}
239-
.RPG .UniTitle select, .RPG .UniActiveQuantityTier input, .RPG .UniDisactiveQuantityTier input, .RPG .RebalanceEmergency label input {background-color: #000000; color: #f1f1f1; border: 5px solid #000000; border-radius: 5px;}
251+
.RPG .UniTitle select, .RPG .FARMSPECSELECT, .RPG .UniActiveQuantityTier input, .RPG .UniDisactiveQuantityTier input, .RPG .RebalanceEmergency label input {background-color: #000000; color: #f1f1f1; border: 5px solid #000000; border-radius: 5px;}
240252
.RPG .UniTitle {color: #bab9b9;}
241253
.RPG .menuOpener, .RPG .connectOpener {background-color: #c7ac97; color: #444444;box-shadow: rgba(0, 0, 0, 0.01) 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 4px 8px, rgba(0, 0, 0, 0.04) 0px 16px 24px, rgba(0, 0, 0, 0.01) 0px 24px 32px;}
242254
.RPG .unifiDapp .MenuOpen .coverMenu {background-color: #2b2622; border-color: #2b2622;box-shadow: rgba(0, 0, 0, 0.01) 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 4px 8px, rgba(0, 0, 0, 0.04) 0px 16px 24px, rgba(0, 0, 0, 0.01) 0px 24px 32px;}

assets/scripts/script.js

+33-10
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ window.onEthereumUpdate = function onEthereumUpdate(millis) {
120120
$.publish('ethereum/ping');
121121
return ok(window.web3);
122122
} catch (e) {
123-
ko(e);
123+
if((e.message || e).toLowerCase().indexOf('daily request count') === -1) {
124+
ko(e);
125+
} else {
126+
ok();
127+
}
124128
}
125129
}, !isNaN(millis) ? millis : 550);
126130
});
@@ -135,7 +139,7 @@ window.loadEthereumStuff = async function loadEthereumStuff(oldStableCoin) {
135139
window.doubleProxy = window.newContract(window.context.DoubleProxyAbi, await window.blockchainCall(window.stableCoin.methods.doubleProxy))
136140
window.dfo = window.web3.eth.dfoHub.load(await window.blockchainCall(window.doubleProxy.methods.proxy));
137141
window.stableCoin = await window.loadTokenInfos(window.stableCoin.options.address, window.context.StableCoinAbi);
138-
window.stableCoin.logo = 'assets/img/stableLogo.png';
142+
window.stableCoin.logo = 'assets/img/StableLogo.png';
139143
window.votingToken = await window.loadTokenInfos((await (window.dfo = await window.dfo).votingToken).options.address);
140144
} catch(e) {
141145
}
@@ -242,24 +246,27 @@ window.consumeAddressBarParam = function consumeAddressBarParam(paramName) {
242246
return param;
243247
};
244248

245-
window.getSendingOptions = function getSendingOptions(transaction) {
249+
window.getSendingOptions = function getSendingOptions(transaction, value) {
246250
return new Promise(async function(ok, ko) {
247251
if (transaction) {
248252
var address = await window.getAddress();
249253
return window.bypassEstimation ? ok({
250254
from: address,
251-
gas: window.gasLimit || '7900000'
255+
gas: window.gasLimit || '7900000',
256+
value
252257
}) : transaction.estimateGas({
253258
from: address,
254-
gasPrice: window.web3.utils.toWei("13", "gwei")
259+
gasPrice: window.web3.utils.toWei("13", "gwei"),
260+
value
255261
},
256262
function(error, gas) {
257263
if (error) {
258264
return ko(error.message || error);
259265
}
260266
return ok({
261267
from: address,
262-
gas: gas || window.gasLimit || '7900000'
268+
gas: gas || window.gasLimit || '7900000',
269+
value
263270
});
264271
});
265272
}
@@ -459,7 +466,19 @@ window.toDecimals = function toDecimals(n, d) {
459466
var decimals = (typeof d).toLowerCase() === 'string' ? parseInt(d) : d;
460467
var symbol = window.toEthereumSymbol(decimals);
461468
if (symbol) {
462-
return window.web3.utils.toWei((typeof n).toLowerCase() === 'string' ? n : window.numberToString(n), symbol);
469+
var input = (typeof n).toLowerCase() === 'string' ? n : window.numberToString(n);
470+
var output = undefined;
471+
while(!output) {
472+
try {
473+
output = window.web3.utils.toWei(input, symbol);
474+
} catch(e) {
475+
if((e.message || e).indexOf('places') === -1) {
476+
throw e;
477+
}
478+
input = input.substring(0, input.length - 1);
479+
}
480+
}
481+
return output;
463482
}
464483
var number = (typeof n).toLowerCase() === 'string' ? parseInt(n) : n;
465484
if (!number || this.isNaN(number)) {
@@ -1246,6 +1265,9 @@ window.loadTokenInfos = async function loadTokenInfos(addresses, abi, noLogo) {
12461265
decimals: address === window.wethAddress ? '18' : await window.blockchainCall(token.methods.decimals),
12471266
logo: noLogo ? undefined : await window.loadLogo(address === window.wethAddress ? window.voidEthereumAddress : address)
12481267
});
1268+
if(!window.tokenInfosCache[address].logo && noLogo !== true) {
1269+
window.tokenInfosCache[address].logo = await window.loadLogo(address === window.wethAddress ? window.voidEthereumAddress : address);
1270+
}
12491271
}
12501272
return single ? tokens[0] : tokens;
12511273
};
@@ -1340,10 +1362,11 @@ window.loadUniswapPairs = async function loadUniswapPairs(token, indexes) {
13401362
var pairToken = await window.loadTokenInfos(pairTokenAddress, window.context.UniswapV2PairAbi, true);
13411363
var token0 = window.web3.utils.toChecksumAddress(await window.blockchainCall(pairToken.token.methods.token0));
13421364
var token1 = window.web3.utils.toChecksumAddress(await window.blockchainCall(pairToken.token.methods.token1));
1343-
pairToken.token0 = token0 === address ? token : await window.loadTokenInfos(token0, undefined, true);
1344-
pairToken.token1 = token1 === address ? token : await window.loadTokenInfos(token1, undefined, true);
1365+
pairToken.token0 = token0 === address ? token : await window.loadTokenInfos(token0, undefined, indexes ? true : false);
1366+
pairToken.token1 = token1 === address ? token : await window.loadTokenInfos(token1, undefined, indexes ? true : false);
13451367
pairToken.key = `${token0}_${token1}-${token1}_${token0}`;
1346-
uniswapPairs.push(indexes[pairToken.key] = pairToken);
1368+
indexes && (indexes[pairToken.key] = pairToken);
1369+
uniswapPairs.push(pairToken);
13471370
}
13481371
}
13491372
return uniswapPairs;

contracts/stableCoin/farming/IUnifiedStableFarming.sol

+60-51
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,56 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.6.0;
3+
pragma solidity >=0.7.0;
4+
5+
interface IUnifiedStableFarming {
6+
function percentage() external view returns (uint256[] memory);
7+
8+
/**
9+
* @dev Earn by pumping $uSD: Swap stablecoins for $uSD in their pools, then burn $uSD until
10+
* equilibrium.
11+
* @param stableCoinAddress Address of the $uSD stablecoin
12+
* @param pairIndex Index of the pair inside the whitelisted pairs array
13+
* @param pairAmount Amount of Uniswap liquidity tokens to send back to the pool
14+
* @param amountAMin The minimum amount of tokenA that must be received for the transaction not to revert
15+
* @param amountBMin The minimum amount of tokenB that must be received for the transaction not to revert
16+
* @param tokenAddress Address of the token to swap to get $uSD
17+
* @param tokenValue How much to swap for
18+
*/
19+
function earnByPump(
20+
address stableCoinAddress,
21+
uint256 pairIndex,
22+
uint256 pairAmount,
23+
uint256 amountAMin,
24+
uint256 amountBMin,
25+
address tokenAddress,
26+
uint256 tokenValue
27+
) external;
28+
29+
/**
30+
* @dev Earn by dumping $uSD: Mint stablecoins obtaining $usd then swap it back for caller choice of
31+
* stablecoins
32+
* @param stableCoinAddress Address of the uSD stablecoin
33+
* @param pairIndex Index of the pair inside the whitelisted pairs array
34+
* @param amountA Amount of tokenA
35+
* @param amountB Amount of tokenB
36+
* @param amountAMin The minimum amount of tokenA that must be received for the transaction not to revert
37+
* @param amountBMin The minimum amount of tokenB that must be received for the transaction not to revert
38+
* @param tokenIndices Array of indices identifying which stablecoins to obtain as result of the
39+
* arbitrage
40+
* @param stableCoinAmounts Array of containing the amounts of stablecoins to get as result of the
41+
* arbitrage
42+
*/
43+
function earnByDump(
44+
address stableCoinAddress,
45+
uint256 pairIndex,
46+
uint256 amountA,
47+
uint256 amountB,
48+
uint256 amountAMin,
49+
uint256 amountBMin,
50+
uint256[] calldata tokenIndices,
51+
uint256[] calldata stableCoinAmounts
52+
) external;
53+
}
454

555
interface IStableCoin {
656
function allowedPairs() external view returns (address[] memory);
@@ -33,6 +83,8 @@ interface IUniswapV2Pair {
3383
}
3484

3585
interface IUniswapV2Router {
86+
function WETH() external pure returns (address);
87+
3688
function getAmountsOut(uint256 amountIn, address[] calldata path)
3789
external
3890
view
@@ -45,6 +97,13 @@ interface IUniswapV2Router {
4597
address to,
4698
uint256 deadline
4799
) external returns (uint256[] memory amounts);
100+
101+
function swapExactETHForTokens(
102+
uint256 amountOutMin,
103+
address[] calldata path,
104+
address to,
105+
uint256 deadline
106+
) external payable returns (uint256[] memory amounts);
48107
}
49108

50109
interface IERC20 {
@@ -62,53 +121,3 @@ interface IERC20 {
62121
uint256 amount
63122
) external returns (bool);
64123
}
65-
66-
interface IUnifiedStableFarming {
67-
function percentage() external view returns (uint256[] memory);
68-
69-
/**
70-
* @dev Earn by pumping $uSD: Swap stablecoins for $uSD in their pools, then burn $uSD until
71-
* equilibrium.
72-
* @param stableCoinAddress Address of the $uSD stablecoin
73-
* @param pairIndex Index of the pair inside the whitelisted pairs array
74-
* @param pairAmount Amount of Uniswap liquidity tokens to send back to the pool
75-
* @param amountAMin The minimum amount of tokenA that must be received for the transaction not to revert
76-
* @param amountBMin The minimum amount of tokenB that must be received for the transaction not to revert
77-
* @param tokenAddress Address of the token to swap to get $uSD
78-
* @param tokenValue How much to swap for
79-
*/
80-
function earnByPump(
81-
address stableCoinAddress,
82-
uint256 pairIndex,
83-
uint256 pairAmount,
84-
uint256 amountAMin,
85-
uint256 amountBMin,
86-
address tokenAddress,
87-
uint256 tokenValue
88-
) external;
89-
90-
/**
91-
* @dev Earn by dumping $uSD: Mint stablecoins obtaining $usd then swap it back for caller choice of
92-
* stablecoins
93-
* @param stableCoinAddress Address of the uSD stablecoin
94-
* @param pairIndex Index of the pair inside the whitelisted pairs array
95-
* @param amountA Amount of tokenA
96-
* @param amountB Amount of tokenB
97-
* @param amountAMin The minimum amount of tokenA that must be received for the transaction not to revert
98-
* @param amountBMin The minimum amount of tokenB that must be received for the transaction not to revert
99-
* @param tokenIndices Array of indices identifying which stablecoins to obtain as result of the
100-
* arbitrage
101-
* @param stableCoinAmounts Array of containing the amounts of stablecoins to get as result of the
102-
* arbitrage
103-
*/
104-
function earnByDump(
105-
address stableCoinAddress,
106-
uint256 pairIndex,
107-
uint256 amountA,
108-
uint256 amountB,
109-
uint256 amountAMin,
110-
uint256 amountBMin,
111-
uint256[] calldata tokenIndices,
112-
uint256[] calldata stableCoinAmounts
113-
) external;
114-
}

0 commit comments

Comments
 (0)