-
Notifications
You must be signed in to change notification settings - Fork 68
feat(svm): deploy solana adapter sepolia #899
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
Open
md0x
wants to merge
7
commits into
svm-dev
Choose a base branch
from
pablo/deploy-solana-adapter
base: svm-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cdae524
feat(svm): deploy solana adapter sepolia
md0x dc6f750
fix: skip if deployed
md0x 3e1fff2
feat: add address
md0x da75a69
Update deploy/063_deploy_solana_adapter.ts
md0x c2a233f
fix: fixes
md0x 1467679
Merge branch 'pablo/deploy-solana-adapter' of ssh://github.com/across…
md0x f464aa6
feat: verify
md0x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { getAssociatedTokenAddressSync } from "@solana/spl-token"; | ||
import { PublicKey } from "@solana/web3.js"; | ||
import { DeployFunction } from "hardhat-deploy/types"; | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { getDeployedAddress } from "../src/DeploymentUtils"; | ||
import { fromBase58ToBytes32 } from "../src/svm/web3-v1"; | ||
import { SOLANA_SPOKE_STATE_SEED } from "../src/svm/web3-v1/constants"; | ||
import { getSolanaChainId } from "../src/svm/web3-v1/helpers"; | ||
import { CHAIN_IDs } from "../utils"; | ||
import { L1_ADDRESS_MAP, USDC } from "./consts"; | ||
|
||
const SOLANA_USDC = { | ||
mainnet: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", | ||
devnet: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU", | ||
}; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { deployer } = await hre.getNamedAccounts(); | ||
const chainId = parseInt(await hre.getChainId()); | ||
const solanaTargetNetwork = chainId == CHAIN_IDs.MAINNET ? "mainnet" : "devnet"; | ||
|
||
const l1Usdc = USDC[chainId]; | ||
const cctpTokenMessenger = L1_ADDRESS_MAP[chainId].cctpTokenMessenger; | ||
const cctpMessageTransmitter = L1_ADDRESS_MAP[chainId].cctpMessageTransmitter; | ||
const solanaSpokePool = getDeployedAddress("SvmSpoke", getSolanaChainId(solanaTargetNetwork).toString()); | ||
if (!solanaSpokePool) { | ||
throw new Error("SvmSpoke not deployed"); | ||
} | ||
const solanaUsdc = fromBase58ToBytes32(SOLANA_USDC[solanaTargetNetwork]); | ||
const mint = new PublicKey(SOLANA_USDC[solanaTargetNetwork]); | ||
const seeds = [Buffer.from("state"), SOLANA_SPOKE_STATE_SEED.toArrayLike(Buffer, "le", 8)]; | ||
const [state] = PublicKey.findProgramAddressSync(seeds, new PublicKey(solanaSpokePool)); | ||
const vault = getAssociatedTokenAddressSync(mint, state, true); | ||
const solanaSpokePoolUsdcVault = fromBase58ToBytes32(vault.toBase58()); | ||
const solanaSpokePoolBytes32 = fromBase58ToBytes32(solanaSpokePool); | ||
const args = [ | ||
l1Usdc, | ||
cctpTokenMessenger, | ||
cctpMessageTransmitter, | ||
solanaSpokePoolBytes32, | ||
solanaUsdc, | ||
solanaSpokePoolUsdcVault, | ||
]; | ||
const instance = await hre.deployments.deploy("Solana_Adapter", { | ||
from: deployer, | ||
log: true, | ||
skipIfAlreadyDeployed: true, | ||
args, | ||
}); | ||
await hre.run("verify:verify", { address: instance.address, constructorArguments: args }); | ||
}; | ||
|
||
module.exports = func; | ||
func.tags = ["SolanaAdapter", "mainnet"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,7 +156,8 @@ | |
"Polygon_Adapter": { "address": "0x540029039E493b1B843653f93C3064A956931747", "blockNumber": 5984591 }, | ||
"Lisk_Adapter": { "address": "0x13a8B1D6443016424e2b8Bac40dD884Ee679AFc4", "blockNumber": 6226289 }, | ||
"Lens_Adapter": { "address": "0x8fac6F764ae0b4F632FE2E6c938ED5637E629ff2", "blockNumber": 7448085 }, | ||
"Blast_Adapter": { "address": "0x09500Ffd743e01B4146a4BA795231Ca7Ca37819f", "blockNumber": 6233857 } | ||
"Blast_Adapter": { "address": "0x09500Ffd743e01B4146a4BA795231Ca7Ca37819f", "blockNumber": 6233857 }, | ||
"Solana_Adapter": { "address": "0xB5B987b0b4838aE9E057912d91f5024E2416C559", "blockNumber": 7756052 } | ||
}, | ||
"37111": { | ||
"SpokePool": { "address": "0x6A0a7f39530923911832Dd60667CE5da5449967B", "blockNumber": 156275 }, | ||
|
@@ -178,5 +179,23 @@ | |
"130": { | ||
"SpokePool": { "address": "0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64", "blockNumber": 7915488 }, | ||
"MulticallHandler": { "address": "0x924a9f036260DdD5808007E1AA95f08eD08aA569", "blockNumber": 7930191 } | ||
}, | ||
"133268194659241": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems like its linted differently to the rest of this file |
||
"SvmSpoke": { | ||
"address": "JAZWcGrpSWNPTBj8QtJ9UyQqhJCDhG9GJkDeMf5NQBiq", | ||
"blockNumber": 356313770 | ||
}, | ||
"MulticallHandler": { | ||
"address": "Fk1RpqsfeWt8KnFCTW9NQVdVxYvxuqjGn6iPB9wrmM8h", | ||
"blockNumber": 356321050 | ||
}, | ||
"MessageTransmitter": { | ||
"address": "CCTPmbSD7gX1bxKPAmg77w8oFzNFpaQiQUWD43TKaecd", | ||
"blockNumber": 339604856 | ||
}, | ||
"TokenMessengerMinter": { | ||
"address": "CCTPiPYPc6AsJuwueEnWgSgucamXDZwBd53dQ11YiKX3", | ||
"blockNumber": 277864039 | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.