diff --git a/README.md b/README.md index 75f0ba6..02bc564 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ +# address +base: 0xd15Ce723Dd04C5e6E245E44e60c545a563A124bB +sepolia: 0xE0B870ffbA7f73d5F757552F3a428DFE73431944 + +sign base: https://scan.sign.global/schema/onchain_evm_8453_0x15 +sign sepolia: https://testnet-scan.sign.global/schema/onchain_evm_11155111_0x7 # deploy @@ -6,7 +12,3 @@ npx hardhat run scripts/01-deploy.ts --network sepolia ``` - -- a 发起 对 b 的求婚。a 可以发起多个求婚,但是同时只能有一个生效,第二次发起会把第一次发起的记录给清掉。 -- b 可以看到所有对他发起的求婚的地址和信息,并选择其中一个地址进行确认。 -- a 和 b 会创建一个 Attestation,之后 a 和 b 都不能再发起求婚或者确认求婚。 \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index 4029bba..c729703 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -92,6 +92,11 @@ const config: HardhatUserConfig = { accounts: [process.env.PRIVATE_KEY!, process.env.PRIVATE_KEY2!], saveDeployments: true, zksync: false + }, + base: { + chainId: 8453, + url: 'https://base.llamarpc.com', + accounts: [process.env.PRIVATE_KEY!, process.env.PRIVATE_KEY2!], } }, etherscan: { diff --git a/package.json b/package.json index 246c322..81dda41 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "prettier:write": "prettier --write **/*.{json,md,yml,ts} --ignore-path=.prettierignore", "test": "forge test", "test:coverage": "forge coverage", - "test:gas": "forge test --gas-report" + "test:gas": "forge test --gas-report", + "deploy": "npx hardhat run scripts/01-deploy.ts --network base" }, "author": "", "license": "ISC", @@ -61,4 +62,4 @@ "typechain": "^8.3.2", "typescript": "~5.0.4" } -} +} \ No newline at end of file diff --git a/scripts/01-deploy.ts b/scripts/01-deploy.ts index c7ee1b8..f3c6cd1 100644 --- a/scripts/01-deploy.ts +++ b/scripts/01-deploy.ts @@ -5,54 +5,58 @@ async function main() { const [deployer, deployer2] = await ethers.getSigners() + + + console.log('addressA:', deployer.getAddress()) + console.log('addressB:', deployer2.getAddress()) + const Factory = await ethers.getContractFactory('MarryMe') const instance = await Factory.deploy() const contract = await instance.waitForDeployment() console.log(await contract.getAddress()) - console.log('addressA:', deployer.getAddress()) - console.log('addressB:', deployer2.getAddress()) - const addressA = await deployer.getAddress(); - const addressB = await deployer2.getAddress(); + // const addressB = await deployer2.getAddress(); - await contract.setSPInstance('0x878c92FD89d8E0B93Dc0a3c907A2adc7577e39c5') + // await contract.setSPInstance('0x878c92FD89d8E0B93Dc0a3c907A2adc7577e39c5') //sepolia + await contract.setSPInstance('0x2b3224D080452276a76690341e5Cfa81A945a985') //base console.log('setSPInstance done') - await contract.setSchemaID('0x7') + // await contract.setSchemaID('0x7') // sepolia + await contract.setSchemaID('0x15') // base console.log('setSchemaID done') - // submitProposal - await (await contract.submitProposal(addressB, 'hello world B')).wait() + // // submitProposal + // await (await contract.submitProposal(addressB, 'hello world B')).wait() - console.log('submitProposal done') + // console.log('submitProposal done') - // 查询某个地址发送的所有求婚信息 - const proposalSubmitted = await contract.getProposalsSentBy(addressA) - console.log('proposal submit by addressA:', JSON.stringify(proposalSubmitted, null, 2)) + // // 查询某个地址发送的所有求婚信息 + // const proposalSubmitted = await contract.getProposalsSentBy(addressA) + // console.log('proposal submit by addressA:', JSON.stringify(proposalSubmitted, null, 2)) - // 查询某个地址收到的所有求婚信息 - const info = await contract.getProposalsReceivedBy(addressB); - console.log('proposal received by addressB:', JSON.stringify(info, null, 2)) + // // 查询某个地址收到的所有求婚信息 + // const info = await contract.getProposalsReceivedBy(addressB); + // console.log('proposal received by addressB:', JSON.stringify(info, null, 2)) - // switch to addressB to accept the proposal - const confirm = await contract.connect(deployer2).confirmProposal(addressA, 'hello world A') - await confirm.wait() - console.log('acceptProposal done:') + // // switch to addressB to accept the proposal + // const confirm = await contract.connect(deployer2).confirmProposal(addressA, 'hello world A') + // await confirm.wait() + // console.log('acceptProposal done:') - // 查询某个地址的婚姻状态,返回 attestationId - const attestationId = await contract.getMarryAttestationId(addressA) - console.log('attestationID:', attestationId); + // // 查询某个地址的婚姻状态,返回 attestationId + // const attestationId = await contract.getMarryAttestationId(addressA) + // console.log('attestationID:', attestationId); - // 查询某个地址的婚姻状态,返回 attestation 详细信息 - const attestation = await contract.getMarryAttestation(addressA); - console.log('attestation:', attestation) + // // 查询某个地址的婚姻状态,返回 attestation 详细信息 + // const attestation = await contract.getMarryAttestation(addressA); + // console.log('attestation:', attestation) - // 查询某个地址的婚姻状态,返回 true/false - const isMarried = await contract.checkMarried(addressA) - console.log('isMarried:', isMarried) + // // 查询某个地址的婚姻状态,返回 true/false + // const isMarried = await contract.checkMarried(addressA) + // console.log('isMarried:', isMarried) /** * output example: