Skip to content

Commit

Permalink
amoy migration -- rename step only
Browse files Browse the repository at this point in the history
  • Loading branch information
amiecorso committed Apr 15, 2024
1 parent 3373c00 commit 747b974
Show file tree
Hide file tree
Showing 23 changed files with 64 additions and 70 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ yarn add -D @nori-dot-com/contracts
Then, in your solidity code, you can import the contracts you need:

```solidity
import "@nori-dot-com/contracts/dist/solidity/Market.sol";
import '@nori-dot-com/contracts/dist/solidity/Market.sol';
```

### Solidity
Expand All @@ -38,7 +38,7 @@ yarn add -D @nori-dot-com/contracts @openzeppelin/[email protected] er
Then, in your solidity code, you can import the contracts you need:

```solidity
import "@nori-dot-com/contracts/dist/solidity/Market.sol";
import '@nori-dot-com/contracts/dist/solidity/Market.sol';
```

## :notebook_with_decorative_cover: Documentation
Expand Down Expand Up @@ -152,14 +152,14 @@ hardhat NORI \

<details>

<summary><b>Example: Deposit 100 bpNORI on mumbai</b></summary>
<summary><b>Example: Deposit 100 bpNORI on amoy</b></summary>

```bash
hardhat BridgedPolygonNORI \
--func deposit \
0x6dc772f80495f47d8000530a59ee975b67b7c646 \
"0x0000000000000000000000000000000000000000000000056bc75e2d63100000" \
--network mumbai
--network amoy
```

> :information_source: Note that the final argument (`0x0000000000000000000000000000000000000000000000056bc75e2d63100000`) is a `uint256` bytes-encoded representation of 100 bpNORI.
Expand Down Expand Up @@ -226,22 +226,22 @@ For an overview, checkout the official tutorial [here](https://book.getfoundry.s
For these scripts to work, the following environment variables must be set in your environment:

```
MUMBAI_RPC_URL # The RPC URL for the mumbai network
AMOY_RPC_URL # The RPC URL for the amoy network
MNEMONIC # The mnemonic you want to use to sign your transaction with
```

> :information_source: The first index of the `$MNEMONIC` HD path needs to be funded with MATIC, have the correct permissions to make the contract calls, etc.
> :information_source: Our on-chain market on mumbai was deployed with a fireblocks signer, so we have been using the fireblocks signer from the command line with hardhat tasks to grant necessary permissions to other addresses that we may want to use.
> :information_source: Our on-chain market on amoy was deployed with a fireblocks signer, so we have been using the fireblocks signer from the command line with hardhat tasks to grant necessary permissions to other addresses that we may want to use.
Here is the hardhat command for granting the `CONSIGNOR_ROLE` to an address (hardhat is currently required to use a fireblocks signer):

```bash
hardhat \
--network mumbai \
--network amoy \
Removal \
--func grantRole \
`cast call 0xa051E9EeaC803d2fCA1DbF415b78AD9BfEB723b0 "CONSIGNOR_ROLE()" --rpc-url mumbai` `# The bytes32 representation of the CONSIGNOR_ROLE` \
`cast call 0xa051E9EeaC803d2fCA1DbF415b78AD9BfEB723b0 "CONSIGNOR_ROLE()" --rpc-url amoy` `# The bytes32 representation of the CONSIGNOR_ROLE` \
0x465d5a3fFeA4CD109043499Fa576c3E16f918463
```

Expand All @@ -253,18 +253,18 @@ A description of how to run some example scripts can be found in the examples be

<details>

<summary><b>Example: Minting and listing new removals on mumbai</b></summary>
<summary><b>Example: Minting and listing new removals on amoy</b></summary>

```bash
forge script \
script/MintAndListRemovals.s.sol:MintAndListRemovals \
--rpc-url mumbai \
--rpc-url amoy \
--mnemonics=$MNEMONIC \
--broadcast \
-vvvvv
```

> :information_source: Transactions for minting removals have at times seemed really slow on mumbai (taking almost 15 minutes to get included).
> :information_source: Transactions for minting removals have at times seemed really slow on amoy (taking almost 15 minutes to get included).
</details>

Expand All @@ -275,7 +275,7 @@ forge script \
```bash
forge script \
script/MintBPNori.s.sol:MintBPNori.sol \
--rpc-url mumbai \
--rpc-url amoy \
--mnemonics=$MNEMONIC \
--broadcast \
-vvvv
Expand All @@ -293,12 +293,12 @@ You can use `cast send` to send transactions and interact with deployed contract

<summary><b>Example: Deposit/mint bpNORI</b></summary>

The following deposits 100 bpNORI to `$TO_ADDRESS` on mumbai (the first account of the `$MNEMONIC` **must** have the `DEPOSITOR_ROLE` role).
The following deposits 100 bpNORI to `$TO_ADDRESS` on amoy (the first account of the `$MNEMONIC` **must** have the `DEPOSITOR_ROLE` role).

```bash
cast send \
--mnemonic=$MNEMONIC
--rpc-url mumbai \
--rpc-url amoy \
$TO_ADDRESS \
"deposit(address,bytes)" \
$BP_NORI_ADDRESS \
Expand Down
10 changes: 5 additions & 5 deletions config/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type SupportedNetworks = keyof typeof networks;
const {
ETHEREUM_RPC_URL,
GOERLI_RPC_URL,
MUMBAI_RPC_URL,
AMOY_RPC_URL,
POLYGON_RPC_URL,
MNEMONIC,
LOG_HARDHAT_NETWORK,
Expand Down Expand Up @@ -60,9 +60,9 @@ const goerli: NetworkUserConfig = {
fireblocks,
};

const mumbai: NetworkUserConfig = {
const amoy: NetworkUserConfig = {
chainId: 80_001,
url: MUMBAI_RPC_URL,
url: AMOY_RPC_URL,
gasPrice: 35_000_000_000,
live: true,
tags: ['polygon', 'staging'],
Expand All @@ -87,14 +87,14 @@ const mainnet: NetworkUserConfig = {
gasPrice: 50_000_000_000,
live: true,
tags: ['mainnet', 'prod'],
fireblocks
fireblocks,
};

export const networks = {
hardhat,
...(Boolean(MNEMONIC) && { localhost }),
...(Boolean(GOERLI_RPC_URL) && { goerli }),
...(Boolean(MUMBAI_RPC_URL) && { mumbai }),
...(Boolean(AMOY_RPC_URL) && { amoy }),
...(Boolean(ETHEREUM_RPC_URL) && { mainnet }),
...(Boolean(POLYGON_RPC_URL) && { polygon }),
} as const;
2 changes: 1 addition & 1 deletion constants/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const PROD_DEPLOYMENT_ADDRESS =
'0x582a885C03A0104Dc3053FAA8486c178e51E48Db';
export const STAGING_DEPLOYMENT_ADDRESS =
'0x677c15A51fbeA299679e6D824eb5c3dA0923b4ae';
export const MUMBAI_CHILD_CHAIN_MANAGER_PROXY =
export const AMOY_CHILD_CHAIN_MANAGER_PROXY =
'0xb5505a6d998549090530911180f38aC5130101c6';
export const POLYGON_CHILD_CHAIN_MANAGER_PROXY =
'0xA6FA4fB5f76172d178d61B04b0ecd319C5d1C0aa';
Expand Down
4 changes: 2 additions & 2 deletions deploy/configure-assets-after-deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const deploy: DeployFunction = async (environment) => {
purchaseTokenAddress: PROD_USDC_TOKEN_ADDRESS,
feeWalletAddress: PROD_NORI_FEE_WALLET_ADDRESS,
},
mumbai: {
amoy: {
priceMultiple: 2000,
feePercentage: 25,
purchaseTokenAddress: STAGING_USDC_TOKEN_ADDRESS,
Expand Down Expand Up @@ -142,5 +142,5 @@ deploy.tags = ['configure'];
deploy.dependencies = ['Market', 'Removal', 'market'];
deploy.skip = async (hre) =>
Promise.resolve(
!['polygon', 'mumbai', 'localhost', 'hardhat'].includes(hre.network.name)
!['polygon', 'amoy', 'localhost', 'hardhat'].includes(hre.network.name)
);
6 changes: 3 additions & 3 deletions deploy/deploy-bridged-polygon-nori.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@/utils/deploy';
import {
POLYGON_CHILD_CHAIN_MANAGER_PROXY,
MUMBAI_CHILD_CHAIN_MANAGER_PROXY,
AMOY_CHILD_CHAIN_MANAGER_PROXY,
} from '@/constants/addresses';

export const deploy: DeployFunction = async (environment) => {
Expand All @@ -17,7 +17,7 @@ export const deploy: DeployFunction = async (environment) => {
const childChainManagerProxyAddress =
hre.network.name === 'polygon'
? POLYGON_CHILD_CHAIN_MANAGER_PROXY
: MUMBAI_CHILD_CHAIN_MANAGER_PROXY;
: AMOY_CHILD_CHAIN_MANAGER_PROXY;
const contract = await deployBridgedPolygonNORIContract({
hre,
childChainManagerProxyAddress,
Expand All @@ -33,5 +33,5 @@ deploy.tags = ['BridgedPolygonNORI', 'assets'];
deploy.dependencies = ['preconditions'];
deploy.skip = async (hre) =>
Promise.resolve(
!['polygon', 'mumbai', 'localhost', 'hardhat'].includes(hre.network.name)
!['polygon', 'amoy', 'localhost', 'hardhat'].includes(hre.network.name)
);
2 changes: 1 addition & 1 deletion deploy/deploy-certificate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ deploy.tags = ['Certificate', 'market'];
deploy.dependencies = ['preconditions'];
deploy.skip = async (hre) =>
Promise.resolve(
!['polygon', 'mumbai', 'localhost', 'hardhat'].includes(hre.network.name)
!['polygon', 'amoy', 'localhost', 'hardhat'].includes(hre.network.name)
);
2 changes: 1 addition & 1 deletion deploy/deploy-locked-nori.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ deploy.tags = ['LockedNORI'];
deploy.dependencies = ['preconditions', 'BridgedPolygonNORI'];
deploy.skip = async (hre) =>
Promise.resolve(
!['polygon', 'mumbai', 'localhost', 'hardhat'].includes(hre.network.name)
!['polygon', 'amoy', 'localhost', 'hardhat'].includes(hre.network.name)
);
2 changes: 1 addition & 1 deletion deploy/deploy-market.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ if (hre.network.name !== 'polygon') {
}
deploy.skip = async (hre) =>
Promise.resolve(
!['polygon', 'mumbai', 'localhost', 'hardhat'].includes(hre.network.name)
!['polygon', 'amoy', 'localhost', 'hardhat'].includes(hre.network.name)
);
2 changes: 1 addition & 1 deletion deploy/deploy-removal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ deploy.tags = ['Removal', 'market'];
deploy.dependencies = ['preconditions'];
deploy.skip = async (hre) =>
Promise.resolve(
!['polygon', 'mumbai', 'localhost', 'hardhat'].includes(hre.network.name)
!['polygon', 'amoy', 'localhost', 'hardhat'].includes(hre.network.name)
);
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ optimizer = false
sparse_mode = true

[rpc_endpoints]
mumbai = "${MUMBAI_RPC_URL}"
amoy = "${AMOY_RPC_URL}"
mainnet = "${ETHEREUM_RPC_URL}"
goerli = "${GOERLI_RPC_URL}"
polygon = "${POLYGON_RPC_URL}"
Expand Down
8 changes: 4 additions & 4 deletions script/BuyNRT.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import "@/contracts/Market.sol";
/**
* @notice Example script demonstrating a purchase interaction with Nori's Market contract.
*
* Contextual information is bound in using environment variables, i.e. for Mumbai:
* Contextual information is bound in using environment variables, i.e. for Amoy:
*
* export PURCHASING_TOKEN_ADDRESS="0x9999f7Fea5938fD3b1E26A12c3f2fb024e194f97" # USDC
* export NRTS=1
* export MNEMONIC="..."
* export RECIPIENT_ADDRESS="<0x00>"
* export MUMBAI_RPC_URL="https://..."
* export NETWORK_NAME="mumbai"
* export AMOY_RPC_URL="https://..."
* export NETWORK_NAME="amoy"
*
* forge script script/BuyNRT.s.sol:BuyNRT --rpc-url="$NETWORK_NAME" --mnemonics="$MNEMONIC" --broadcast -vvvv
*/
Expand All @@ -27,7 +27,7 @@ contract BuyNRT is Script {
Market(
vm.parseJsonAddress(
vm.readFile(string.concat(vm.projectRoot(), "/contracts.json")),
".mumbai.Market.proxyAddress"
".amoy.Market.proxyAddress"
)
);

Expand Down
2 changes: 1 addition & 1 deletion tasks/bridged-polygon-nori.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const TASK = {
!(
network === 'polygon' ||
network === 'hardhat' ||
network === 'mumbai' ||
network === 'amoy' ||
network === 'localhost'
)
) {
Expand Down
2 changes: 1 addition & 1 deletion tasks/certificate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const TASK = {
const network = hre.network.name;
if (
!(
network === 'mumbai' ||
network === 'amoy' ||
network === 'hardhat' ||
network === 'polygon' ||
network === 'localhost'
Expand Down
2 changes: 1 addition & 1 deletion tasks/defender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const isDefenderNetwork = (network: string): network is Network => {
'fantomtest',
'moonbase',
'matic',
'mumbai',
'amoy',
].includes(network);
};

Expand Down
8 changes: 4 additions & 4 deletions tasks/list-remaining-migrated-removals.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readFileSync, writeFileSync } from 'fs';
import { readFileSync, writeFileSync } from 'node:fs';

import { task, types } from 'hardhat/config';
import chalk from 'chalk';
Expand Down Expand Up @@ -35,9 +35,9 @@ export const GET_LIST_MIGRATED_REMOVALS_TASK = () =>
dryRun,
} = options as ParsedListMigratedRemovalsTaskOptions;
const network = await hre.network.name;
if (![`localhost`, `mumbai`, `polygon`].includes(network)) {
if (![`localhost`, `amoy`, `polygon`].includes(network)) {
throw new Error(
`Network ${network} is not supported. Please use localhost, mumbai, or polygon.`
`Network ${network} is not supported. Please use localhost, amoy, or polygon.`
);
}

Expand Down Expand Up @@ -188,7 +188,7 @@ export const GET_LIST_MIGRATED_REMOVALS_TASK = () =>
if (maybePendingTx === undefined) {
throw new Error(`No pending transaction returned`);
} else {
pendingTx = maybePendingTx as ContractTransaction;
pendingTx = maybePendingTx;
}
hre.log(`txHash: ${chalk.green(pendingTx.hash)}`);
hre.log(chalk.white('\n👷 Waiting for transaction to finalize...'));
Expand Down
2 changes: 1 addition & 1 deletion tasks/locked-nori.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const TASK = {
!(
network === 'polygon' ||
network === 'hardhat' ||
network === 'mumbai' ||
network === 'amoy' ||
network === 'localhost'
)
) {
Expand Down
2 changes: 1 addition & 1 deletion tasks/market.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const TASK = {
const network = hre.network.name;
if (
!(
network === 'mumbai' ||
network === 'amoy' ||
network === 'hardhat' ||
network === 'polygon' ||
network === 'localhost'
Expand Down
6 changes: 3 additions & 3 deletions tasks/migrate-certificates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,9 @@ export const GET_MIGRATE_CERTIFICATES_TASK = () =>
const outputFileName =
dryRun === true ? `dryRun-${outputFile}` : outputFile;
const network = await hre.network.name;
if (![`localhost`, `mumbai`, `polygon`].includes(network)) {
if (![`localhost`, `amoy`, `polygon`].includes(network)) {
throw new Error(
`Network ${network} is not supported. Please use localhost, mumbai, or polygon.`
`Network ${network} is not supported. Please use localhost, amoy, or polygon.`
);
}
const originalInputData: MigratedCertificates = readJsonSync(file);
Expand Down Expand Up @@ -616,7 +616,7 @@ export const GET_MIGRATE_CERTIFICATES_TASK = () =>
transactionHash: txReceipt?.transactionHash,
status: txReceipt?.status,
},
tokenId: tokenIds![certificateIndex],
tokenId: tokenIds[certificateIndex],
});
certificateIndex += 1;
}
Expand Down
4 changes: 2 additions & 2 deletions tasks/migrate-removals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ export const GET_MIGRATE_REMOVALS_TASK = () =>
const outputFileName =
dryRun === true ? `dryRun-${outputFile}` : outputFile;
const network = hre.network.name;
if (![`localhost`, `mumbai`, `polygon`].includes(network)) {
if (![`localhost`, `amoy`, `polygon`].includes(network)) {
throw new Error(
`Network ${network} is not supported. Please use localhost, mumbai, or polygon.`
`Network ${network} is not supported. Please use localhost, amoy, or polygon.`
);
}
const fullInputData: InputData[] = readJsonSync(file);
Expand Down
2 changes: 1 addition & 1 deletion tasks/removal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const TASK = {
if (
!(
network === 'localhost' ||
network === 'mumbai' ||
network === 'amoy' ||
network === 'hardhat' ||
network === 'polygon'
)
Expand Down
Loading

0 comments on commit 747b974

Please sign in to comment.