Skip to content
New issue

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

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

Already on GitHub? # to your account

Feat/enable evm chain extensions #216

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions monad-test
Submodule monad-test added at 694f29
11 changes: 7 additions & 4 deletions templates/base/packages/nextjs/scaffold.config.ts.template.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { withDefaults } from '../../../utils.js'

const contents = ({ chainName }) =>
const contents = ({ chainName, imports, customChain }) =>
`import * as chains from "viem/chains";
${imports.filter(Boolean).join("\n")}

export type ScaffoldConfig = {
targetNetworks: readonly chains.Chain[];
Expand All @@ -15,7 +16,7 @@ export const DEFAULT_ALCHEMY_API_KEY = "oKxs-03sij-U_N0iOlrSsZFr29-IqbuF";

const scaffoldConfig = {
// The networks on which your DApp is live
targetNetworks: [${chainName.map(chain => `chains.${chain}`).join(', ')}],
targetNetworks: [${chainName.map(chain => `chains.${chain}`).join(', ')} ${customChain.filter(Boolean) ? `, ${customChain}` : ''}],

// The interval at which your front-end polls the RPC servers for new data
// it has no effect if you only target the local network (default is 4000)
Expand All @@ -41,5 +42,7 @@ export default scaffoldConfig;
`

export default withDefaults(contents, {
chainName: 'mainnet'
})
chainName: 'mainnet',
customChain:"",
imports: ""
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
//SPDX-License-Identifier: MIT
import { withDefaults } from "../../../../../utils.js";

const content = ({ verifyContractArgs }) => {
// Split each argument into its own array element
const args = verifyContractArgs.join(',').split(',').map(arg => arg.trim()).filter(arg => arg !== '');
const formattedArgs = args
.map((arg, index) => ` inputs[${index + 9}] = "${arg}";`)
.join('\n');

return `//SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "forge-std/Script.sol";
Expand Down Expand Up @@ -55,7 +64,7 @@ contract VerifyAll is Script {
bytes memory constructorArgs =
BytesLib.slice(deployedBytecode, compiledBytecode.length, deployedBytecode.length - compiledBytecode.length);

string[] memory inputs = new string[](9);
string[] memory inputs = new string[](${9 + args.length});
inputs[0] = "forge";
inputs[1] = "verify-contract";
inputs[2] = vm.toString(contractAddr);
Expand All @@ -65,6 +74,7 @@ contract VerifyAll is Script {
inputs[6] = "--constructor-args";
inputs[7] = vm.toString(constructorArgs);
inputs[8] = "--watch";
${formattedArgs}

FfiResult memory f = tempVm(address(vm)).tryFfi(inputs);

Expand Down Expand Up @@ -98,4 +108,9 @@ contract VerifyAll is Script {
function searchStr(uint96 idx, string memory searchKey) internal pure returns (string memory) {
return string.concat(".transactions[", vm.toString(idx), "].", searchKey);
}
}
}`;
};

export default withDefaults(content, {
verifyContractArgs: []
});
Loading