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

[Barz] Add TokenReceiverFacet support #3240

Merged
merged 4 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class TestBarz {
diamondCutFacet = "0x312382b3B302bDcC0711fe710314BE298426296f"
accountFacet = "0x84E684272903737d807375197f9a581FEa094Bc3"
verificationFacet = "0xDcfbDE24847FdF29E6d0311f4bAEb2b49ae8B5a3"
tokenReceiverFacet = "0x77E64E56966430a5B7A4F4A20C9fe039afb6ec21"
entryPoint = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
diamondLoupeFacet = "0x518834B7EE4461d703ED2de8bCdfC5eCf761bBCA"
diamondInit = "0x02a3C76D089c50615139B904c4dbD62F20e74a1b"
Expand All @@ -55,7 +56,7 @@ class TestBarz {
publicKey = "0xB5547FBdC56DCE45e1B8ef75569916D438e09c46"
}
val result = WCBarz.getCounterfactualAddress(input.build().toByteArray())
assertEquals(result, "0xb16Db98B365B1f89191996942612B14F1Da4Bd5f")
assertEquals(result, "0x42138448be17503df67546CEE92470BF130e5611")
}

@Test
Expand Down
3 changes: 2 additions & 1 deletion src/Ethereum/Barz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ std::string getCounterfactualAddress(const Proto::ContractAddressInput input) {
params.addParam(std::make_shared<Ethereum::ABI::ParamAddress>(parse_hex(input.diamond_cut_facet())));
params.addParam(std::make_shared<Ethereum::ABI::ParamAddress>(parse_hex(input.account_facet())));
params.addParam(std::make_shared<Ethereum::ABI::ParamAddress>(parse_hex(input.verification_facet())));
params.addParam(std::make_shared<Ethereum::ABI::ParamAddress>(parse_hex(input.entry_point())));
params.addParam(std::make_shared<Ethereum::ABI::ParamAddress>(parse_hex(input.token_receiver_facet())));
params.addParam(std::make_shared<Ethereum::ABI::ParamAddress>(parse_hex(input.diamond_loupe_facet())));
params.addParam(std::make_shared<Ethereum::ABI::ParamAddress>(parse_hex(input.entry_point())));
params.addParam(std::make_shared<Ethereum::ABI::ParamAddress>(parse_hex(input.diamond_init())));
params.addParam(std::make_shared<Ethereum::ABI::ParamAddress>(parse_hex(input.facet_registry())));
params.addParam(std::make_shared<Ethereum::ABI::ParamByteArray>(parse_hex(input.public_key())));
Expand Down
17 changes: 6 additions & 11 deletions src/proto/Barz.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,17 @@ message ContractAddressInput {
string diamond_cut_facet = 2;
string account_facet = 3;
string verification_facet = 4;

// ERC-4337 entry point
string entry_point = 5;

// Diamond Loupe from ERC-2535: Diamonds, Multi-Facet Proxy
string token_receiver_facet= 5;
string diamond_loupe_facet = 6;

// Diamond init from ERC-2535: Diamonds, Multi-Facet Proxy
string diamond_init = 7;

// Address of the contract that defines if a facet is secure
string facet_registry = 8;

// ERC-4337 entry point
string entry_point = 9;

// Bytecode of the smart contract to deploy
string bytecode = 9;
string bytecode = 10;

// PublicKey of the wallet
string public_key = 10;
string public_key = 11;
}
8 changes: 5 additions & 3 deletions swift/Tests/BarzTests.swift

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions tests/chains/Ethereum/BarzTests.cpp

Large diffs are not rendered by default.