Skip to content

Commit 3455a2b

Browse files
committed
Merge branch 'ilan/updateStepSetterContract' of github.com:KyberNetwork/smart-contracts into ilan/deployEnhancedStepFunctionsRate
2 parents fe700ad + 630e219 commit 3455a2b

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

contracts/wrappers/SetStepFunctionWrapper.sol

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ pragma solidity ^0.4.18;
33
import "../ERC20Interface.sol";
44
import "../Withdrawable.sol";
55

6+
67
interface SetStepFunctionInterface {
7-
function setImbalanceStepFunction(
8-
ERC20 token,
9-
int[] xBuy,
10-
int[] yBuy,
11-
int[] xSell,
12-
int[] ySell
13-
) public;
8+
function setImbalanceStepFunction(
9+
ERC20 token,
10+
int[] xBuy,
11+
int[] yBuy,
12+
int[] xSell,
13+
int[] ySell
14+
) public;
1415
}
1516

16-
contract SetStepFunctionWrapper is Withdrawable {
17+
contract SetStepFunctionWrapper2 is Withdrawable {
1718
SetStepFunctionInterface public rateContract;
1819
function SetStepFunctionWrapper(address admin, address operator) public {
1920
addOperator(operator);
@@ -25,22 +26,32 @@ contract SetStepFunctionWrapper is Withdrawable {
2526
}
2627

2728
function setImbalanceStepFunction(ERC20 token,
28-
int[] xBuy,
29-
int[] yBuy,
30-
int[] xSell,
31-
int[] ySell) public onlyOperator {
29+
int[] xBuy,
30+
int[] yBuy,
31+
int[] xSell,
32+
int[] ySell)
33+
public onlyOperator
34+
{
3235
uint i;
3336

34-
// check all x for buy are positive and y are negative
37+
// check all x for buy are positiv
3538
for( i = 0 ; i < xBuy.length ; i++ ) {
36-
require(xBuy[i] >= 0 );
37-
require(yBuy[i] <= 0 );
39+
require(xBuy[i] >= 0 );
40+
}
41+
42+
// check all y for buy are negative
43+
for( i = 0 ; i < yBuy.length ; i++ ) {
44+
require(yBuy[i] <= 0 );
3845
}
3946

40-
// check all x for sell are negative and y are negative
47+
// check all x for sell are negative
4148
for( i = 0 ; i < xSell.length ; i++ ) {
42-
require(xSell[i] <= 0 );
43-
require(ySell[i] <= 0 );
49+
require(xSell[i] <= 0 );
50+
}
51+
52+
// check all y for sell are negative
53+
for( i = 0 ; i < ySell.length ; i++ ) {
54+
require(ySell[i] <= 0 );
4455
}
4556

4657
rateContract.setImbalanceStepFunction(token,xBuy,yBuy,xSell,ySell);

web3deployment/compileContracts.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const input = {
4444
"WrapFeeBurner.sol" : fs.readFileSync(contractPath + 'wrappers/WrapFeeBurner.sol', 'utf8'),
4545
"KyberUniswapReserve.sol" : fs.readFileSync(contractPath + 'reserves/bridgeReserves/uniswap/KyberUniswapReserve.sol', 'utf8'),
4646
"WrapperBase.sol" : fs.readFileSync(contractPath + 'wrappers/WrapperBase.sol', 'utf8'),
47+
"SetStepFunctionWrapper.sol" : fs.readFileSync(contractPath + 'wrappers/SetStepFunctionWrapper.sol', 'utf8')
4748
"WrapConversionRate.sol" : fs.readFileSync(contractPath + 'wrappers/WrapConversionRate.sol', 'utf8'),
4849
"WrapReadTokenData.sol" : fs.readFileSync(contractPath + 'wrappers/WrapReadTokenData.sol', 'utf8')
4950
};

0 commit comments

Comments
 (0)