Skip to content

Commit b1e9d4b

Browse files
committed
Rename Maker -> User
1 parent 1a4bf65 commit b1e9d4b

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

contracts/PionexContract.sol

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ contract PionexContract is IPionexContract, StrategyBase, BaseLibEIP712, Signatu
9696
/// @inheritdoc IPionexContract
9797
function fillLimitOrder(
9898
PionexContractLibEIP712.Order calldata _order,
99-
bytes calldata _orderMakerSig,
99+
bytes calldata _orderUserSig,
100100
TraderParams calldata _params,
101101
CoordinatorParams calldata _crdParams
102102
) external override onlyUserProxy nonReentrant returns (uint256, uint256) {
103103
bytes32 orderHash = getEIP712Hash(PionexContractLibEIP712._getOrderStructHash(_order));
104104

105-
_validateOrder(_order, orderHash, _orderMakerSig);
105+
_validateOrder(_order, orderHash, _orderUserSig);
106106
bytes32 allowFillHash = _validateFillPermission(orderHash, _params.pionexTokenAmount, _params.pionex, _crdParams);
107107
_validateOrderTaker(_order, _params.pionex);
108108

@@ -133,7 +133,7 @@ contract PionexContract is IPionexContract, StrategyBase, BaseLibEIP712, Signatu
133133
_validateTraderFill(fill, _params.pionexSig);
134134
}
135135

136-
(uint256 userTokenAmount, uint256 remainingUserTokenAmount) = _quoteOrderFromMakerToken(_order, orderHash, _params.userTokenAmount);
136+
(uint256 userTokenAmount, uint256 remainingUserTokenAmount) = _quoteOrderFromUserToken(_order, orderHash, _params.userTokenAmount);
137137
// Calculate pionexTokenAmount according to the provided pionexToken/userToken ratio
138138
uint256 pionexTokenAmount = userTokenAmount.mul(_params.pionexTokenAmount).div(_params.userTokenAmount);
139139

@@ -154,7 +154,7 @@ contract PionexContract is IPionexContract, StrategyBase, BaseLibEIP712, Signatu
154154
})
155155
);
156156

157-
_recordMakerTokenFilled(orderHash, userTokenAmount);
157+
_recordUserTokenFilled(orderHash, userTokenAmount);
158158

159159
return (pionexTokenAmount, userTokenOut);
160160
}
@@ -224,10 +224,10 @@ contract PionexContract is IPionexContract, StrategyBase, BaseLibEIP712, Signatu
224224
uint256 tokenlonFee = _mulFactor(_settlement.pionexTokenAmount, tokenlonFeeFactor);
225225
// 2. Fee for Pionex, including gas fee and strategy fee
226226
uint256 pionexFee = _mulFactor(_settlement.pionexTokenAmount, _settlement.gasFeeFactor + _settlement.pionexStrategyFeeFactor);
227-
uint256 pionexTokenForMaker = _settlement.pionexTokenAmount.sub(tokenlonFee).sub(pionexFee);
227+
uint256 pionexTokenForUser = _settlement.pionexTokenAmount.sub(tokenlonFee).sub(pionexFee);
228228

229229
// trader -> user
230-
_spender.spendFromUserTo(_settlement.trader, address(_settlement.pionexToken), _settlement.user, pionexTokenForMaker);
230+
_spender.spendFromUserTo(_settlement.trader, address(_settlement.pionexToken), _settlement.user, pionexTokenForUser);
231231

232232
// user -> recipient
233233
_spender.spendFromUserTo(_settlement.user, address(_settlement.userToken), _settlement.recipient, _settlement.userTokenAmount);
@@ -259,7 +259,7 @@ contract PionexContract is IPionexContract, StrategyBase, BaseLibEIP712, Signatu
259259
}
260260

261261
/// @inheritdoc IPionexContract
262-
function cancelLimitOrder(PionexContractLibEIP712.Order calldata _order, bytes calldata _cancelOrderMakerSig) external override onlyUserProxy nonReentrant {
262+
function cancelLimitOrder(PionexContractLibEIP712.Order calldata _order, bytes calldata _cancelOrderUserSig) external override onlyUserProxy nonReentrant {
263263
require(_order.expiry > uint64(block.timestamp), "PionexContract: Order is expired");
264264
bytes32 orderHash = getEIP712Hash(PionexContractLibEIP712._getOrderStructHash(_order));
265265
bool isCancelled = LibPionexContractOrderStorage.getStorage().orderHashToCancelled[orderHash];
@@ -269,7 +269,7 @@ contract PionexContract is IPionexContract, StrategyBase, BaseLibEIP712, Signatu
269269
cancelledOrder.minPionexTokenAmount = 0;
270270

271271
bytes32 cancelledOrderHash = getEIP712Hash(PionexContractLibEIP712._getOrderStructHash(cancelledOrder));
272-
require(isValidSignature(_order.user, cancelledOrderHash, bytes(""), _cancelOrderMakerSig), "PionexContract: Cancel request is not signed by user");
272+
require(isValidSignature(_order.user, cancelledOrderHash, bytes(""), _cancelOrderUserSig), "PionexContract: Cancel request is not signed by user");
273273
}
274274

275275
// Set cancelled state to storage
@@ -282,13 +282,13 @@ contract PionexContract is IPionexContract, StrategyBase, BaseLibEIP712, Signatu
282282
function _validateOrder(
283283
PionexContractLibEIP712.Order memory _order,
284284
bytes32 _orderHash,
285-
bytes memory _orderMakerSig
285+
bytes memory _orderUserSig
286286
) internal view {
287287
require(_order.expiry > uint64(block.timestamp), "PionexContract: Order is expired");
288288
bool isCancelled = LibPionexContractOrderStorage.getStorage().orderHashToCancelled[_orderHash];
289289
require(!isCancelled, "PionexContract: Order is cancelled");
290290

291-
require(isValidSignature(_order.user, _orderHash, bytes(""), _orderMakerSig), "PionexContract: Order is not signed by user");
291+
require(isValidSignature(_order.user, _orderHash, bytes(""), _orderUserSig), "PionexContract: Order is not signed by user");
292292
}
293293

294294
function _validateOrderTaker(PionexContractLibEIP712.Order memory _order, address _pionex) internal pure {
@@ -297,12 +297,12 @@ contract PionexContract is IPionexContract, StrategyBase, BaseLibEIP712, Signatu
297297
}
298298
}
299299

300-
function _quoteOrderFromMakerToken(
300+
function _quoteOrderFromUserToken(
301301
PionexContractLibEIP712.Order memory _order,
302302
bytes32 _orderHash,
303303
uint256 _userTokenAmount
304304
) internal view returns (uint256, uint256) {
305-
uint256 userTokenFilledAmount = LibPionexContractOrderStorage.getStorage().orderHashToMakerTokenFilledAmount[_orderHash];
305+
uint256 userTokenFilledAmount = LibPionexContractOrderStorage.getStorage().orderHashToUserTokenFilledAmount[_orderHash];
306306

307307
require(userTokenFilledAmount < _order.userTokenAmount, "PionexContract: Order is filled");
308308

@@ -314,10 +314,10 @@ contract PionexContract is IPionexContract, StrategyBase, BaseLibEIP712, Signatu
314314
return (userTokenQuota, remainingAfterFill);
315315
}
316316

317-
function _recordMakerTokenFilled(bytes32 _orderHash, uint256 _userTokenAmount) internal {
317+
function _recordUserTokenFilled(bytes32 _orderHash, uint256 _userTokenAmount) internal {
318318
LibPionexContractOrderStorage.Storage storage stor = LibPionexContractOrderStorage.getStorage();
319-
uint256 userTokenFilledAmount = stor.orderHashToMakerTokenFilledAmount[_orderHash];
320-
stor.orderHashToMakerTokenFilledAmount[_orderHash] = userTokenFilledAmount.add(_userTokenAmount);
319+
uint256 userTokenFilledAmount = stor.orderHashToUserTokenFilledAmount[_orderHash];
320+
stor.orderHashToUserTokenFilledAmount[_orderHash] = userTokenFilledAmount.add(_userTokenAmount);
321321
}
322322

323323
/* math utils */

contracts/interfaces/IPionexContract.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,19 @@ interface IPionexContract is IStrategyBase {
7474
/// @notice Fill an order by a trader
7575
/// @notice Only user proxy can call
7676
/// @param _order The order that is going to be filled
77-
/// @param _orderMakerSig The signature of the order from user
77+
/// @param _orderUserSig The signature of the order from user
7878
/// @param _params Trader specific filling parameters
7979
/// @param _crdParams Contains details of the fill permit
8080
function fillLimitOrder(
8181
PionexContractLibEIP712.Order calldata _order,
82-
bytes calldata _orderMakerSig,
82+
bytes calldata _orderUserSig,
8383
TraderParams calldata _params,
8484
CoordinatorParams calldata _crdParams
8585
) external returns (uint256, uint256);
8686

8787
/// @notice Cancel an order
8888
/// @notice Only user proxy can call
8989
/// @param _order The order that is going to be cancelled
90-
/// @param _cancelMakerSig The cancelling signature signed by user
91-
function cancelLimitOrder(PionexContractLibEIP712.Order calldata _order, bytes calldata _cancelMakerSig) external;
90+
/// @param _cancelUserSig The cancelling signature signed by user
91+
function cancelLimitOrder(PionexContractLibEIP712.Order calldata _order, bytes calldata _cancelUserSig) external;
9292
}

contracts/utils/LibPionexContractOrderStorage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ library LibPionexContractOrderStorage {
66
/// @dev Storage bucket for this feature.
77
struct Storage {
88
// How much maker token has been filled in order.
9-
mapping(bytes32 => uint256) orderHashToMakerTokenFilledAmount;
9+
mapping(bytes32 => uint256) orderHashToUserTokenFilledAmount;
1010
// Whether order is cancelled or not.
1111
mapping(bytes32 => bool) orderHashToCancelled;
1212
}

0 commit comments

Comments
 (0)