Skip to content

Conversation

@chrismaree
Copy link
Member

  • nit
  • nit
  • nit
  • Update contracts/HubPool.sol
  • review nit
  • review nit
  • feat(hubpool): Refactor hub pool to use 1D bitmap integer
  • nit
  • WIP
  • review nit
  • review nit
  • nit
  • nit
  • nit
  • nit
  • nit
  • nit
  • WIP
  • nit
  • nit
  • nit
  • nit
  • nit
  • nit
  • nit
  • nit
  • nit
  • nit
  • nit
  • WIP
  • nit
  • nit
  • WIP
  • nit
  • nit
  • nit
  • nit
  • nit
  • nit
  • nit
  • nit
  • feat(slack-config): Add sync method and liquidity utilization

chrismaree and others added 30 commits January 28, 2022 14:04
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Co-authored-by: Matt Rice <matthewcrice32@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
@chrismaree chrismaree changed the title chrismaree/fee tracking 2 feat(hubPool): Add sync method and liquidity utilization Feb 8, 2022
@chrismaree chrismaree marked this pull request as draft February 8, 2022 01:00
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
struct PooledToken {
address lpToken;
bool isEnabled;
uint256 liquidReserves;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-order for better packing.

}

// Added to enable the BridgePool to receive ETH. used when unwrapping Weth.
function _sync(address l1Token) internal {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is numerically identical to v1.

@chrismaree chrismaree marked this pull request as ready for review February 8, 2022 19:30

emit WhitelistRoute(destinationChainId, originToken, destinationToken);

// TODO: Should relay message to L2 for destinationChainId and call setEnableRoute(originToken, destinationChainId, true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove comment? is this TODO resolved?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mistake in merging. added back.


ExpandedIERC20(pooledTokens[l1Token].lpToken).burnFrom(msg.sender, lpTokenAmount);
// Note this method does not make any liquidity utilization checks before letting the LP redeem their LP tokens.
// If they try access more funds that available (i.e l1TokensToReturn > liquidReserves) this will underflow.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this underflow is expected + fine in this case right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup! solidity 8 protects against underflows so this simply reverts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for this to underflow, but the contract to have enough tokens to transfer out?

return _liquidityUtilizationPostRelay(l1Token, 0);
}

function liquidityUtilizationPostRelay(address l1Token, uint256 relayedAmount) public returns (uint256) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit make this nonReentrant also

Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Copy link
Member

@nicholaspai nicholaspai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chrismaree chrismaree requested a review from mrice32 February 9, 2022 18:54
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Copy link
Contributor

@mrice32 mrice32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!


ExpandedIERC20(pooledTokens[l1Token].lpToken).burnFrom(msg.sender, lpTokenAmount);
// Note this method does not make any liquidity utilization checks before letting the LP redeem their LP tokens.
// If they try access more funds that available (i.e l1TokensToReturn > liquidReserves) this will underflow.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for this to underflow, but the contract to have enough tokens to transfer out?

@chrismaree chrismaree merged commit 8bb8538 into master Feb 9, 2022
@chrismaree chrismaree deleted the chrismaree/fee-tracking-2 branch February 9, 2022 23:00
pxrl added a commit that referenced this pull request Feb 8, 2024
This is another case of a variable being missed when the naming was 
changed. The data availability layer isn't bound to IPFS and will
probably be something else anyway. This is within the scope of the UMIP,
the contracts don't need to be specific about the underlying technology
that is used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants