Skip to content

Commit

Permalink
Website: Clarify spec and fix issues in associated assets
Browse files Browse the repository at this point in the history
Merged by EIP-Bot.
  • Loading branch information
JamesSmartCell authored Oct 23, 2024
1 parent ffb8f31 commit 60569a1
Show file tree
Hide file tree
Showing 13 changed files with 8,363 additions and 8,853 deletions.
26 changes: 23 additions & 3 deletions ERCS/erc-7738.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This EIP provides a means to create a standard registry for locating executable

## Motivation

[ERC-5169](./eip-5169.md) provides a client script lookup method for contracts. This requires the contract to have implemented the `ERC-5169` interface at the time of construction (or allow an upgrade path).
[ERC-5169](./eip-5169.md) provides a client script lookup method for contracts. This requires the contract to have implemented the [ERC-5169](./eip-5169.md) interface at the time of construction (or allow an upgrade path).

This proposal outlines a contract that can supply prototype and certified scripts. The contract would be a multichain singleton instance that would be deployed at identical addresses on supported chains.

Expand All @@ -32,7 +32,7 @@ The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL N

The contract MUST implement the `IERC7738` interface.
The contract MUST emit the `ScriptUpdate` event when the script is updated.
The contract SHOULD order the `scriptURI` returned so that the `ERC-173` `owner()` of the contract's script entries are returned first (in the case of simple implementations the wallet will pick the first `scriptURI` returned).
The contract SHOULD order the `scriptURI` returned so that the [ERC-173](./eip-173.md) `owner()` of the contract's script entries are returned first (in the case of simple implementations the wallet will pick the first `scriptURI` returned).
The contract SHOULD provide a means to page through entries if there are a large number of scriptURI entries.

```solidity
Expand All @@ -59,10 +59,30 @@ This method allows contracts written without the [ERC-5169](./eip-5169.md) inter

## Test Cases

Instructions for test harness and deployment can be found in the [Asset folder](../assets/eip-7738/tests.md).
Test cases are included in [NFTRegistryTest.test.ts](../assets/eip-7738/test/NFTRegistryTest.test.ts). Contracts, deployment scripts and registry script can be found alongside the test script.

Clone the repo and run:

```shell
cd ../assets/eip-7738
npm install --save-dev hardhat
npm install
npx hardhat test
```

## Reference Implementation

The live implementation of the script registry is at `0x0077380bCDb2717C9640e892B9d5Ee02Bb5e0682` on several mainnet, L2 and testnet chains. To deploy scripts for use you can directly call the ```setScriptURI``` function:

```solidity
function setScriptURI(address contractAddress, string[] memory newScriptURIs)
```

or use the bundled ethers script, ensuring to fill in the target contract address and scriptURI:

[Create Registry Entry](../assets/eip-7738/scripts/createRegistryEntry.ts)

### Simplified Implementation
```solidity
import "@openzeppelin/contracts/access/Ownable.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ contract DecentralisedRegistryPermissioned is IERC7738 {

mapping(address => ScriptEntry) private _scriptURIs;

<<<<<<< HEAD
uint256 ll = 0;

=======
>>>>>>> 4a582f5016fd4065b7a851531340835b2bad9bb6
event RegisterOwner(
address indexed contractAddress,
address indexed newOwner
Expand Down Expand Up @@ -62,10 +57,6 @@ contract DecentralisedRegistryPermissioned is IERC7738 {
);
emit RegisterOwner(contractAddress, sender);
existingEntry.owner = sender;
<<<<<<< HEAD
ll++;
=======
>>>>>>> 4a582f5016fd4065b7a851531340835b2bad9bb6
}

function isDelegateOrOwner(
Expand Down
4 changes: 0 additions & 4 deletions assets/erc-7738/contracts/IERC7738.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,5 @@ interface IERC7738 {

/// @notice Update the scriptURI
/// emits event ScriptUpdate(address indexed contractAddress, scriptURI memory newScriptURI);
<<<<<<< HEAD
function setScriptURI(address contractAddress, string[] calldata scriptURIList) external;
=======
function setScriptURI(address contractAddress, string[] memory scriptURIList) external;
>>>>>>> 4a582f5016fd4065b7a851531340835b2bad9bb6
}
59 changes: 34 additions & 25 deletions assets/erc-7738/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@ import "dotenv/config"
import { HardhatUserConfig } from "hardhat/config"
import "@nomicfoundation/hardhat-toolbox"
import "hardhat-gas-reporter"
import "@nomicfoundation/hardhat-verify";

<<<<<<< HEAD
require('@openzeppelin/hardhat-upgrades');

let { PRIVATE_KEY, INFURA_KEY, ETHERSCAN_API_KEY, PRIVATE_KEY2, POLYGONSCAN_API_KEY, BASESCAN_API_KEY } = process.env;
let { PRIVATE_KEY, INFURA_KEY, ETHERSCAN_API_KEY, PRIVATE_KEY2, POLYGONSCAN_API_KEY, BASESCAN_API_KEY, ARBITRUM_API_KEY, OPTIMISM_API_KEY } = process.env;

const config: HardhatUserConfig = {
solidity: { compilers: [{ version: "0.8.24" }, { version: "0.8.24" }], settings: { optimizer: { enabled: true, runs: 400} }},
=======
let { PRIVATE_KEY, INFURA_KEY, ETHERSCAN_API_KEY } = process.env;

const config: HardhatUserConfig = {
solidity: { compilers: [{ version: "0.8.24" }, { version: "0.8.24" }] },
>>>>>>> 4a582f5016fd4065b7a851531340835b2bad9bb6
networks: {
mainnet: {
url: `https://mainnet.infura.io/v3/${INFURA_KEY}`,
Expand All @@ -25,7 +19,6 @@ const config: HardhatUserConfig = {
url: `https://sepolia.infura.io/v3/${INFURA_KEY}`,
accounts: [`${PRIVATE_KEY}`],
},
<<<<<<< HEAD
holesky: {
url: `https://ethereum-holesky-rpc.publicnode.com`,
accounts: [`${PRIVATE_KEY}`],
Expand Down Expand Up @@ -63,34 +56,50 @@ const config: HardhatUserConfig = {
accounts: [`${PRIVATE_KEY}`]
},
arbitrum: {
url: `https://arbitrum-mainnet.infura.io/v3/${INFURA_KEY}`,
url: `https://rpc.ankr.com/arbitrum`,
accounts: [`${PRIVATE_KEY}`]
},
arbitrumsepolia: {
url: `https://arbitrum-sepolia.infura.io/v3/${INFURA_KEY}`,
=======
mumbai: {
url: `https://polygon-mumbai.infura.io/v3/${INFURA_KEY}`,
>>>>>>> 4a582f5016fd4065b7a851531340835b2bad9bb6
accounts: [`${PRIVATE_KEY}`]
},
hardhat: {
gasPrice: 100000000000,
<<<<<<< HEAD
allowUnlimitedContractSize: true,
},
mint: {
url: `https://global.rpc.mintchain.io`,
accounts: [`${PRIVATE_KEY}`]
},
mintsepolia: {
url: `https://sepolia-testnet-rpc.mintchain.io`,
accounts: [`${PRIVATE_KEY}`]
},
optimism: {
url: `https://mainnet.optimism.io`,
accounts: [`${PRIVATE_KEY}`]
}
},
etherscan: {
//apiKey: `${ETHERSCAN_API_KEY}` //for contract verify https://holesky.infura.io/v3/${INFURA_KEY}
//apiKey: `${POLYGONSCAN_API_KEY}` //for verifying on Polygonscan powered chains
apiKey: `${BASESCAN_API_KEY}`
=======
apiKey: {
mint: "empty",
optimisticEthereum: `${OPTIMISM_API_KEY}`,
arbitrumOne: `${ARBITRUM_API_KEY}`,
mainnet: `${ETHERSCAN_API_KEY}`,
holesky: `${ETHERSCAN_API_KEY}`,
polygon: `${POLYGONSCAN_API_KEY}`,
base: `${BASESCAN_API_KEY}`,
},
customChains: [
{
network: "mint",
chainId: 185,
urls: {
apiURL: "https://explorer.mintchain.io/api",
browserURL: "https://explorer.mintchain.io:443"
}
}
},
etherscan: {
apiKey: `${ETHERSCAN_API_KEY}` //for contract verify
>>>>>>> 4a582f5016fd4065b7a851531340835b2bad9bb6
}
}
]
}}

export default config
Loading

0 comments on commit 60569a1

Please sign in to comment.