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

EIP-6551 compat #27

Merged
merged 43 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
23c3a86
upgrade to latest account-abstraction contracts
jfschwarz Apr 26, 2023
f76da22
fix package json
jfschwarz May 10, 2023
4170293
adjust tests
jfschwarz May 10, 2023
4e7cf06
trial to fix vercel routes
jfschwarz May 10, 2023
217223d
fix deploy script for gnosis chain
jfschwarz May 11, 2023
6e53bb0
implement IERC6551Account
jfschwarz May 30, 2023
3d6d79d
restructure contract inheritance hierarchy
jfschwarz Jun 7, 2023
203d1d2
add mech factory
jfschwarz Jun 7, 2023
1f67b0c
refactor contracts
jfschwarz Jun 12, 2023
de98dec
add erc20 threshold mech
jfschwarz Jun 12, 2023
c749149
cleanup
jfschwarz Jun 12, 2023
e264243
update docs
jfschwarz Jun 12, 2023
06d0971
adjust all deploy functions and migrate them to viem
jfschwarz Jun 14, 2023
b608faa
add hierarchy graph
jfschwarz Jun 20, 2023
139d356
adding exports
jfschwarz Jul 13, 2023
f8436f9
Merge branch 'main' into erc-6551
jfschwarz Aug 18, 2023
52484d9
fixes after merge
jfschwarz Aug 18, 2023
cdab142
upgrade deps
jfschwarz Aug 18, 2023
98c79c1
6551 updates and prevent ownership cycles
jfschwarz Aug 21, 2023
eb19c39
fine-tune execution interface
jfschwarz Aug 21, 2023
81dbd52
upgrade tooling
jfschwarz Aug 21, 2023
00304e4
ethers v5 -> v6 migration
jfschwarz Aug 21, 2023
8d249e6
erc165
jfschwarz Aug 21, 2023
a5a32fe
tokenbound deterministic deployment test green
jfschwarz Aug 25, 2023
cd7e95d
update 4337 entrypoint address
jfschwarz Aug 25, 2023
4167db5
fix 4337 tests
jfschwarz Aug 25, 2023
f399e1d
fix missing onlyOperator annotation
jfschwarz Aug 25, 2023
ee82d3f
improve test coverage
jfschwarz Aug 25, 2023
c2f8e3c
test fixes
jfschwarz Aug 28, 2023
a39dc16
front-end updates
jfschwarz Aug 28, 2023
5186a9c
fix deploy scripts
jfschwarz Aug 28, 2023
9fe7e05
migrate from n.xyz to sequencer
jfschwarz Sep 1, 2023
9f371eb
Merge pull request #28 from gnosis/sequencer
jfschwarz Sep 1, 2023
c57769b
deploy 6551 factory
jfschwarz Sep 4, 2023
3198123
more solid deploy script
jfschwarz Sep 4, 2023
1381bd4
fix wallet connect
jfschwarz Sep 4, 2023
63edc04
fix a JS error when switching chains
jfschwarz Oct 12, 2023
7354c08
work around issue of tokenID not being set by sequence api
jfschwarz Oct 12, 2023
0c7cc8c
fix walletconnect v2 issues
jfschwarz Oct 12, 2023
3ca7ec0
fix a ux issue
jfschwarz Oct 12, 2023
bf94f2e
upgrade to latest 6551 contract and adjust accordingly
jfschwarz Oct 13, 2023
11e9b4d
fix tests
jfschwarz Oct 13, 2023
39ef6c7
update eip6551 registry address
jfschwarz Oct 13, 2023
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
Prev Previous commit
Next Next commit
test fixes
  • Loading branch information
jfschwarz committed Aug 28, 2023
commit c2f8e3c6390d019eca95081edbef4e731d1db048
56 changes: 45 additions & 11 deletions test/signing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,61 @@ import { loadFixture } from "@nomicfoundation/hardhat-network-helpers"
import { expect } from "chai"
import { ethers } from "hardhat"

import { signWithMech } from "../sdk"
import {
calculateERC721TokenboundMechAddress,
deployERC721TokenboundMech,
deployERC721TokenboundMechMastercopy,
signWithMech,
} from "../sdk/src"
import { ERC721TokenboundMech__factory } from "../typechain-types"

import { deployFactories } from "./utils"

describe("signing", () => {
// We define a fixture to reuse the same setup in every test. We use
// loadFixture to run this setup once, snapshot that state, and reset Hardhat
// Network to that snapshot in every test.
async function deployMech1() {
const TestToken = await ethers.getContractFactory("ERC721Token")
const ERC721TokenboundMech = await ethers.getContractFactory(
"ERC721TokenboundMech"
)
const [deployer, alice, bob, eve] = await ethers.getSigners()
const { deployerClient, erc6551Registry, alice, bob } =
await deployFactories()

await deployERC721TokenboundMechMastercopy(deployerClient)

const TestToken = await ethers.getContractFactory("ERC721Token")
const testToken = await TestToken.deploy()
const mech1 = await ERC721TokenboundMech.deploy(testToken.getAddress(), 1)
const testTokenAddress = (await testToken.getAddress()) as `0x${string}`

const chainId = deployerClient.chain.id
const registryAddress =
(await erc6551Registry.getAddress()) as `0x${string}`

await deployERC721TokenboundMech(deployerClient, {
token: testTokenAddress,
tokenId: 1n,
from: registryAddress,
})

const mech1 = ERC721TokenboundMech__factory.connect(
calculateERC721TokenboundMechAddress({
chainId,
token: testTokenAddress,
tokenId: 1n,
from: registryAddress,
}),
ethers.provider
)

await mech1.waitForDeployment()
await testToken.mintToken(alice.getAddress(), 1)
// make alice the operator of mech1
await testToken.mintToken(await alice.getAddress(), 1n)

// Fixtures can return anything you consider useful for your tests
return { ERC721TokenboundMech, testToken, mech1, alice, bob, eve }
return {
testToken,
mech1,
alice,
bob,
chainId,
}
}

describe("signWithMech()", () => {
Expand All @@ -39,7 +73,7 @@ describe("signing", () => {
)

const isValidSig = await verifyMessage({
signer: mech1.getAddress(),
signer: await mech1.getAddress(),
message,
signature: mechSignature,
provider: ethers.provider,
Expand Down
28 changes: 13 additions & 15 deletions test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import hre, { ethers } from "hardhat"
import { createWalletClient, custom as customTransport } from "viem"
import {
createTestClient,
custom as customTransport,
walletActions,
} from "viem"
import { hardhat } from "viem/chains"

import {
deployERC1155ThresholdMechMastercopy,
deployERC1155TokenboundMechMastercopy,
deployERC2470SingletonFactory,
deployERC721TokenboundMechMastercopy,
deployMechFactory,
deployZodiacMechMastercopy,
} from "../sdk"
import { deployERC2470SingletonFactory, deployMechFactory } from "../sdk/src"

/** deploy ERC2470 singleton factory, MechFactory, and ERC6551 registry */
export async function deployFactories() {
Expand All @@ -20,16 +17,17 @@ export async function deployFactories() {

const ERC6551Registry = await ethers.getContractFactory("ERC6551Registry")
const erc6551Registry = await ERC6551Registry.deploy()

const deployerClient = createWalletClient({
deployer.populateTransaction
const deployerClient = createTestClient({
account: deployer.address as `0x${string}`,
chain: hardhat,
account: (await signer.getAddress()) as `0x${string}`,
mode: "hardhat",
transport: customTransport({
request({ method, params }) {
return hre.ethers.provider.send(method, params)
async request({ method, params }) {
return deployer.provider.send(method, params)
},
}),
})
}).extend(walletActions)

await deployERC2470SingletonFactory(deployerClient)
await deployMechFactory(deployerClient)
Expand Down