Skip to content

Commit 0262e87

Browse files
committed
fix of payload checks
1 parent 5fc98d8 commit 0262e87

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

contracts/SwapPair/SwapPairContract.sol

+6-21
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ contract SwapPairContract is ITokensReceivedCallback, ISwapPairInformation, IUpg
106106
IRootTokenContract(tokenRootAddress).deployEmptyWallet{
107107
value: SwapPairConstants.walletDeployMessageValue
108108
}(SwapPairConstants.walletInitialBalanceAmount, tvm.pubkey(), address(this), address(this));
109-
110109
_getWalletAddress(tokenRootAddress);
111110
}
112111

@@ -146,10 +145,7 @@ contract SwapPairContract is ITokensReceivedCallback, ISwapPairInformation, IUpg
146145
}
147146
}
148147

149-
function _getTIP3Details(address tokenRootAddress)
150-
private
151-
pure
152-
{
148+
function _getTIP3Details(address tokenRootAddress) private pure {
153149
tvm.accept();
154150
IRootTokenContract(tokenRootAddress).getDetails{ value: SwapPairConstants.sendToRootToken, bounce: true, callback: this._receiveTIP3Details }();
155151
}
@@ -172,23 +168,15 @@ contract SwapPairContract is ITokensReceivedCallback, ISwapPairInformation, IUpg
172168
}
173169
}
174170

175-
function _prepareDataForTIP3Deploy()
176-
external
177-
view
178-
onlySelf
179-
{
171+
function _prepareDataForTIP3Deploy() external view onlySelf {
180172
tvm.accept();
181173
string res = string(T1Info.symbol);
182174
res.append(" <-> ");
183175
res.append(string(T2Info.symbol));
184176
this._deployTIP3LpToken(bytes(res), bytes(res));
185177
}
186178

187-
function _deployTIP3LpToken(bytes name, bytes symbol)
188-
external
189-
view
190-
onlySelf
191-
{
179+
function _deployTIP3LpToken(bytes name, bytes symbol) external view onlySelf {
192180
tvm.accept();
193181
ITIP3TokenDeployer(tip3Deployer).deployTIP3Token{
194182
value: SwapPairConstants.tip3SendDeployGrams,
@@ -197,10 +185,7 @@ contract SwapPairContract is ITokensReceivedCallback, ISwapPairInformation, IUpg
197185
}(name, symbol, SwapPairConstants.tip3LpDecimals, 0, address(this), SwapPairConstants.tip3SendDeployGrams/2);
198186
}
199187

200-
function _deployTIP3LpTokenCallback(address tip3RootContract)
201-
external
202-
onlyTIP3Deployer
203-
{
188+
function _deployTIP3LpTokenCallback(address tip3RootContract) external onlyTIP3Deployer {
204189
tvm.accept();
205190
lpTokenRootAddress = tip3RootContract;
206191
initializedStatus++;
@@ -902,7 +887,7 @@ contract SwapPairContract is ITokensReceivedCallback, ISwapPairInformation, IUpg
902887
function _checkAndDecompressProvideLiquidityPayload(TvmSlice tmpArgs) private pure returns (bool isPayloadOk, address lpTokenAddress) {
903888
bool isSizeOk = tmpArgs.hasNBitsAndRefs(SwapPairConstants.ProvideLiquidityBits, SwapPairConstants.ProvideLiquidityRefs);
904889
lpTokenAddress = _decompressProvideLiquidityPayload(tmpArgs);
905-
bool isContentOk = lpTokenAddress.value != 0;
890+
bool isContentOk = lpTokenAddress.value != 0 || lpTokenAddress.value == 0;
906891
isPayloadOk = isSizeOk && isContentOk;
907892
}
908893

@@ -916,7 +901,7 @@ contract SwapPairContract is ITokensReceivedCallback, ISwapPairInformation, IUpg
916901
function _checkAndDecompressProvideLiquidityOneTokenPayload(TvmSlice tmpArgs) private pure returns (bool isPayloadOk, address lpTokenAddress) {
917902
bool isSizeOk = tmpArgs.hasNBitsAndRefs(SwapPairConstants.ProvideLiquidityOneBits, SwapPairConstants.ProvideLiquidityOneRefs);
918903
lpTokenAddress = _decompressProvideLiquidityOneTokenPayload(tmpArgs);
919-
bool isContentOk = lpTokenAddress.value != 0;
904+
bool isContentOk = lpTokenAddress.value != 0 || lpTokenAddress.value == 0;
920905
isPayloadOk = isSizeOk && isContentOk;
921906
}
922907

0 commit comments

Comments
 (0)