Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connectors v1 #16

Merged
merged 46 commits into from
Feb 9, 2023
Merged

Connectors v1 #16

merged 46 commits into from
Feb 9, 2023

Conversation

ilinzweilin
Copy link
Contributor

@ilinzweilin ilinzweilin commented Jul 22, 2022

To Do

@ilinzweilin ilinzweilin changed the title WIP - add withdraw & deposit functions add withdraw & deposit functions Aug 19, 2022
Copy link
Contributor

@AStox AStox left a comment

Choose a reason for hiding this comment

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

Looks good, but some of the comments in the tests are misleading or inaccurate.

src/Connector.sol Outdated Show resolved Hide resolved
src/Connector.sol Outdated Show resolved Hide resolved
test/Connector.t.sol Outdated Show resolved Hide resolved
test/Connector.t.sol Outdated Show resolved Hide resolved
test/Connector.t.sol Outdated Show resolved Hide resolved
test/Connector.t.sol Outdated Show resolved Hide resolved
src/Connector.sol Outdated Show resolved Hide resolved
src/Connector.sol Outdated Show resolved Hide resolved
Copy link
Contributor

@hieronx hieronx left a comment

Choose a reason for hiding this comment

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

Really thorough testing, nice :)

src/Connector.sol Show resolved Hide resolved
src/Messages.sol Outdated Show resolved Hide resolved
src/routers/xcm/Router.sol Outdated Show resolved Hide resolved
src/Connector.sol Outdated Show resolved Hide resolved
@NunoAlexandre NunoAlexandre changed the title Support transferring tranche tokens Connectors v1 Jan 31, 2023
@NunoAlexandre NunoAlexandre self-assigned this Jan 31, 2023
NunoAlexandre and others added 4 commits January 31, 2023 19:39
Use a cent-chain generated message to test AddTranche encoding and
decoding functions.
* Use cent-chain generated UpdateMember for decoding

* Drop toBytes16
* wip: add transfer test

* move memberlist check from connectors to restricted token

* fix tests

* revert restricted.sol changes

* revert unwanted changes to erc20 and memberlist

* fix test
* remove domainLookup

* require destination domain to be cent chain

* fix tests

* clean up

* fix up

* rename Domains to Domain

* Add new domain lookup

* update domain enum

* move formatDomain to messages.sol

* fix tests

* update enum and domain encoding

* update domain encoding to output bytes9

* Update src/Connector.sol

* update domain encoding and add more tests

---------

Co-authored-by: Jeroen Offerijns <[email protected]>
AStox
AStox previously approved these changes Feb 7, 2023
* Fix transfer encoding / decoding

We need to encode address as 32 bytes and take in consideration when
decoding. Also, amount should be encoded as a u128.

* Fix transfer decoding

* Cover transfer to centrifuge

* Fix docs - thanks @AStox
AStox
AStox previously approved these changes Feb 8, 2023
src/Connector.sol Show resolved Hide resolved
src/Connector.sol Show resolved Hide resolved
uint64 poolId,
bytes16 trancheId,
address user,
uint256 amount
) public onlyRouter {
RestrictedTokenLike token = RestrictedTokenLike(tranches[poolId][trancheId].token);
require(address(token) != address(0), "CentrifugeConnector/unknown-token");
require(token.hasMember(user), "CentrifugeConnector/not-a-member");
Copy link
Contributor

Choose a reason for hiding this comment

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

Bumping this ^ @NunoAlexandre @AStox

test/Connector.t.sol Outdated Show resolved Hide resolved
uint64 poolId,
bytes16 trancheId,
address user,
uint256 amount
) public onlyRouter {
RestrictedTokenLike token = RestrictedTokenLike(tranches[poolId][trancheId].token);
require(address(token) != address(0), "CentrifugeConnector/unknown-token");
require(token.hasMember(user), "CentrifugeConnector/not-a-member");
Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha. I would keep it like this for now, to not change the existing restricted token implementation. But let's discuss this a bit more and we can still change it in V2 optionally.

Copy link
Contributor

@NunoAlexandre NunoAlexandre left a comment

Choose a reason for hiding this comment

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

It's happening 🌟 🚀

Copy link
Contributor

@hieronx hieronx left a comment

Choose a reason for hiding this comment

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

LGTM! 💯

@NunoAlexandre NunoAlexandre merged commit 2af2d5c into main Feb 9, 2023
@NunoAlexandre NunoAlexandre deleted the add-withdaw-deposit branch February 9, 2023 13:44
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.

None yet

4 participants