Skip to content
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

Whitelist with nonexisting canonical domain #5935

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
fix: cleanup
prathmeshkhandelwal1 committed Mar 29, 2024
commit f9bc4187b267fe59693135188b013f4e075f7b85
40 changes: 0 additions & 40 deletions packages/deployments/contracts/src/cli/init/helpers/assets.ts
Original file line number Diff line number Diff line change
@@ -29,15 +29,6 @@ export const setupAsset = async (args: {
`\n\tVerifying asset setup for ${asset.name} (${asset.canonical.address}). Canonical ID: ${canonical.id}; Canonical Domain: ${canonical.domain}; Key: ${key}`,
);

// Set up the canonical asset on the canonical domain.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This setup script needs to be able to register xERC20s using the pseudo-canonical domain as well as maintain the ability to register other assets that are homed on Eth. I don't think we can just remove the home checks, we should still have those guards.

We need to separate logic based on whether 11111 is specifically set as the canonical domain for an asset. If not, then the original checks should still apply.

// const home = networks.find((n) => n.domain === asset.canonical.domain);
// if (!home) {
// throw new Error(
// `Could not find canonical domain network ${asset.canonical.domain} for asset ${asset.canonical.address} in` +
// "the configured list of networks!",
// );
// }

let canonicalDecimals = asset.canonical.decimals;
if (!canonicalDecimals) {
const record = getAssetEntryFromChaindata(asset.canonical.address, asset.canonical.domain, chainData);
@@ -53,33 +44,10 @@ export const setupAsset = async (args: {
const tokenName = asset.name.startsWith(`next`) ? asset.name : `next${asset.name.toUpperCase()}`;
const tokenSymbol = tokenName;

// if (+home.chain === 1 && BigNumber.from(asset.canonical.cap ?? "0").isZero()) {
// throw new Error(`Must have nonzero cap on prod canonical domains`);
// }

if (!canonicalDecimals) {
throw new Error(`Unable to find canonical decimals in config for ${asset.name}`);
}

// await updateIfNeeded({
// apply,
// deployment: home.deployments.Connext,
// desired: asset.canonical.address,
// read: { method: "canonicalToAdopted(bytes32)", args: [key] },
// write: {
// method: "setupAsset",
// args: [
// [canonical.domain, canonical.id],
// canonicalDecimals,
// tokenName,
// tokenSymbol,
// asset.canonical.address,
// constants.AddressZero,
// asset.canonical.cap ?? "0", // 0-cap allowed on testnet only
// ],
// },
// });

// Set up all the representational assets on their respective domains.
for (const [domain, representation] of Object.entries(asset.representations)) {
if (!representation) continue;
@@ -172,14 +140,6 @@ export const setupAsset = async (args: {
}
}

// NOTE: it is best practice to init + add liquidity in a single transaction to start the pool in a balanced state
// if (apply && +home.chain === 1) {
// // TODO: add liquidity with balance assertions; proper min to mint calculations; etc.
// // Fixing this is useful in testnet, but on mainnets youre using safes anyway.
// console.warn(`Must implement safe pool initialization. Skipping.`);
// continue;
// }

// After registering the asset, check pool status.
const [local, adopted] = apply
? await getValue<[string, string]>({