Skip to content

Commit

Permalink
update offchain resolver contracts, add sepolia support (#2)
Browse files Browse the repository at this point in the history
* update offchain resolver contracts, add sepolia support

* add sepolia factory address, refactor ui

* list all supported networks
  • Loading branch information
mdtanrikulu authored Jan 11, 2024
1 parent 4971fde commit 6d2ebb6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion contracts/OffchainResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ contract OffchainResolver is
urls,
callData,
OffchainResolver.resolveWithProof.selector,
callData
abi.encode(callData, address(this))
);
}

Expand Down
6 changes: 5 additions & 1 deletion contracts/SignatureVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ library SignatureVerifier {
response,
(bytes, uint64, bytes)
);
(bytes memory extraData, address sender) = abi.decode(
request,
(bytes, address)
);
address signer = ECDSA.recover(
makeSignatureHash(address(this), expires, request, result),
makeSignatureHash(sender, expires, extraData, result),
sig
);
require(
Expand Down
21 changes: 19 additions & 2 deletions web/components/organisms/deploy/DeployResolver.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ const signersToArray = (signers: string) => {
return n_signers;
};

const subdomainChainMap = {
1: '',
5: 'goerli.',
11155111: 'sepolia.'
}

const deployments: Record<number, {
factory?: Address,
resolver?: Address,
Expand All @@ -28,6 +34,9 @@ const deployments: Record<number, {
},
5: {
factory: '0x2F180aDBAAb3c57af31B7E96969999D4FB33faEE',
},
11155111: {
factory: '0x0Fde82e81270431F2B956E7ce7E8860B2F61bcF9'
}
}

Expand Down Expand Up @@ -138,7 +147,15 @@ export const DeployResolverCard: FC = () => {
{
error && (
<p className="text-red-500">
{chainId !== 5 ? 'Only Goerli is supported right now' : error.message}
{!Object.keys(subdomainChainMap).includes(
chainId.toString()
)
? `This network is not supported, supported networks: [${Object.values(
subdomainChainMap
)
.map((val) => (val === '' ? 'mainnet' : val))
.join(', ')}]`
: error.message}
</p>
)
}
Expand All @@ -165,7 +182,7 @@ export const DeployResolverCard: FC = () => {

if (receipt.isSuccess) return (
<Button colorStyle="greenPrimary" suffix={<OutlinkSVG />} as="a" target="_blank" href={
`https://${chainId === 5 ? "goerli." : ""}etherscan.io/tx/${receipt.data?.transactionHash}#internal`
`https://${subdomainChainMap[chainId] || ''}etherscan.io/tx/${receipt.data?.transactionHash}#internal`
}>View on Etherscan</Button>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ const explorer_urls: Record<number, {
transaction: 'https://goerli.etherscan.io/tx/:hash',
address: 'https://goerli.etherscan.io/address/:address'
},
11155111: {
transaction: 'https://sepolia.etherscan.io/tx/:hash',
address: 'https://sepolia.etherscan.io/address/:address'
},
};

export const DeployedResolver: FC<{ transaction: TransactionStateDeployed }> = ({ transaction }) => {
Expand Down
4 changes: 2 additions & 2 deletions web/pages/thing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { ConnectKitProvider, getDefaultClient } from 'connectkit';
import { FC, ReactNode } from 'react';
import { ThemeProvider } from 'styled-components';
import { createClient, mainnet, WagmiConfig } from 'wagmi';
import { goerli } from 'wagmi/chains';
import { goerli, sepolia } from 'wagmi/chains';

const client = createClient(getDefaultClient({ appName: 'CCIP Tools', chains: [goerli, mainnet] }));
const client = createClient(getDefaultClient({ appName: 'CCIP Tools', chains: [goerli, mainnet, sepolia] }));

export const Thing: FC<{ children: ReactNode }> = ({ children }) => {
return (
Expand Down

0 comments on commit 6d2ebb6

Please sign in to comment.