Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
lufaque committed Dec 2, 2024
2 parents 55c8127 + 9bcdfac commit 543aef5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
13 changes: 5 additions & 8 deletions contracts/ConceroBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,13 @@ contract ConceroBridge is IConceroBridge, InfraCCIP {
uint256 batchedTxAmount,
uint64 dstChainSelector
) internal {
bytes32[] memory pendingCCIPTransactionsByDstChain = s_pendingSettlementIdsByDstChain[
dstChainSelector
];
bytes32[] memory pendingTxs = s_pendingSettlementIdsByDstChain[dstChainSelector];
uint256 pendingTxsLength = pendingTxs.length;

CcipSettlementTx[] memory ccipSettlementTxs = new CcipSettlementTx[](
pendingCCIPTransactionsByDstChain.length
);
CcipSettlementTx[] memory ccipSettlementTxs = new CcipSettlementTx[](pendingTxsLength);

for (uint256 i; i < pendingCCIPTransactionsByDstChain.length; ++i) {
bytes32 txId = pendingCCIPTransactionsByDstChain[i];
for (uint256 i; i < pendingTxsLength; ++i) {
bytes32 txId = pendingTxs[i];

ccipSettlementTxs[i] = CcipSettlementTx(
txId,
Expand Down
24 changes: 10 additions & 14 deletions contracts/ParentPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -796,25 +796,21 @@ contract ParentPool is IParentPool, CCIPReceiver, ParentPoolCommon, ParentPoolSt
s_loansInUse +
s_depositsOnTheWayAmount -
s_depositFeeAmount;
//todo: we must add withdrawalsOnTheWay
//TODO: add withdrawalsOnTheWay

uint256 totalCrossChainLiquidity = _childPoolsTotalBalance + parentPoolLiquidity;
uint256 crossChainBalanceConverted = _convertToLPTokenDecimals(totalCrossChainLiquidity);
uint256 amountDepositedConverted = _convertToLPTokenDecimals(_amountToDeposit);
uint256 _totalLPSupply = i_lpToken.totalSupply();

//N° lpTokens = (((Total USDC Liq + user deposit) * Total sToken) / Total USDC Liq) - Total sToken
uint256 lpTokensToMint;

if (_totalLPSupply != 0) {
lpTokensToMint =
(((crossChainBalanceConverted + amountDepositedConverted) * _totalLPSupply) /
crossChainBalanceConverted) -
_totalLPSupply;
} else {
lpTokensToMint = amountDepositedConverted;
if (_totalLPSupply == 0) {
return _convertToLPTokenDecimals(_amountToDeposit);
}
return lpTokensToMint;

uint256 crossChainBalanceConverted = _convertToLPTokenDecimals(totalCrossChainLiquidity);
uint256 amountDepositedConverted = _convertToLPTokenDecimals(_amountToDeposit);

return
(((crossChainBalanceConverted + amountDepositedConverted) * _totalLPSupply) /
crossChainBalanceConverted) - _totalLPSupply;
}

function _addDepositOnTheWay(
Expand Down

0 comments on commit 543aef5

Please sign in to comment.