Skip to content

Commit

Permalink
deployment artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
amiecorso committed Mar 14, 2024
1 parent 61a042c commit fc99837
Show file tree
Hide file tree
Showing 8 changed files with 1,218 additions and 247 deletions.
1,079 changes: 1,059 additions & 20 deletions .openzeppelin/polygon-mumbai.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/Market.sol
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ contract Market is
* @notice Deprecated. Previously the address of the RestrictedNORI contract.
* This storage gap remains to maintain the storage layout of the contract.
*/
address private _storageGap;
address private _restrictedNORI;

/**
* @notice The number of base tokens required to purchase one NRT.
Expand Down
8 changes: 4 additions & 4 deletions contracts/Removal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ contract Removal is
ICertificate private _certificate;

/**
* @dev Maps from a removal ID to the project ID it belongs to.
* @dev Deprecated. This storage gap remains to maintain the storage layout of the contract.
*/
mapping(uint256 => uint256) private _removalIdToProjectId;
mapping(uint256 => uint8) private _projectIdToHoldbackPercentage;

/**
* @dev Deprecated. This storage gap remains to maintain the storage layout of the contract.
* @dev Maps from a removal ID to the project ID it belongs to.
*/
mapping(uint256 => uint8) private _storageGap;
mapping(uint256 => uint256) private _removalIdToProjectId;

/**
* @notice Maps from an address to an EnumerableSet of the token IDs for which that address has a non-zero balance.
Expand Down
64 changes: 44 additions & 20 deletions deploy/configure-assets-after-deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ import {
getRemoval,
} from '@/utils/contracts';

interface NetworkMarketConfig {
priceMultiple: number;
feePercentage: number;
purchaseTokenAddress: string;
feeWalletAddress: string;
}

export const deploy: DeployFunction = async (environment) => {
const hre = environment as unknown as CustomHardHatRuntimeEnvironment;
const CONFIRMATIONS =
Expand Down Expand Up @@ -44,23 +51,41 @@ export const deploy: DeployFunction = async (environment) => {
const removal = await getRemoval({ hre, signer });

Check warning on line 51 in deploy/configure-assets-after-deployment.ts

View workflow job for this annotation

GitHub Actions / lint

Unsafe assignment of an `any` value
const bpNori = await getBridgedPolygonNori({ hre, signer });

Check warning on line 52 in deploy/configure-assets-after-deployment.ts

View workflow job for this annotation

GitHub Actions / lint

Unsafe assignment of an `any` value

const networkMarketConfig: Record<string, NetworkMarketConfig> = {
polygon: {
priceMultiple: 0,
feePercentage: 0,
purchaseTokenAddress: PROD_USDC_TOKEN_ADDRESS,
feeWalletAddress: PROD_NORI_FEE_WALLET_ADDRESS,
},
mumbai: {
priceMultiple: 0,
feePercentage: 0,
purchaseTokenAddress: STAGING_USDC_TOKEN_ADDRESS,
feeWalletAddress: STAGING_NORI_FEE_WALLET_ADDRESS,
},
localhost: {
priceMultiple: 100,
feePercentage: 25,
purchaseTokenAddress: bpNori.address,

Check warning on line 70 in deploy/configure-assets-after-deployment.ts

View workflow job for this annotation

GitHub Actions / lint

Unsafe assignment of an `any` value

Check warning on line 70 in deploy/configure-assets-after-deployment.ts

View workflow job for this annotation

GitHub Actions / lint

Unsafe member access .address on an `any` value
feeWalletAddress: hre.namedAccounts.noriWallet,
},
hardhat: {
priceMultiple: 100,
feePercentage: 25,
purchaseTokenAddress: bpNori.address,

Check warning on line 76 in deploy/configure-assets-after-deployment.ts

View workflow job for this annotation

GitHub Actions / lint

Unsafe assignment of an `any` value

Check warning on line 76 in deploy/configure-assets-after-deployment.ts

View workflow job for this annotation

GitHub Actions / lint

Unsafe member access .address on an `any` value
feeWalletAddress: hre.namedAccounts.noriWallet,
},
};

// SW: Leaving the default local configuration as bridged polygon NORI
// for the purchase token to minimize test breakage.
let purchaseTokenAddress = bpNori.address;
let priceMultiple = BigNumber.from(100);
if (hre.network.name === 'polygon') {
purchaseTokenAddress = PROD_USDC_TOKEN_ADDRESS;
priceMultiple = BigNumber.from(2000);
} else if (hre.network.name === 'mumbai') {
purchaseTokenAddress = STAGING_USDC_TOKEN_ADDRESS;
priceMultiple = BigNumber.from(2000);
}
const restrictionScheduleDuration = 315_569_520; // seconds in 10 years
const feeWalletAddress = ['hardhat', 'localhost'].includes(hre.network.name)
? hre.namedAccounts.noriWallet
: hre.network.name === 'polygon'
? PROD_NORI_FEE_WALLET_ADDRESS
: STAGING_NORI_FEE_WALLET_ADDRESS;
const purchaseTokenAddress =
networkMarketConfig[hre.network.name].purchaseTokenAddress;
const priceMultiple = networkMarketConfig[hre.network.name].priceMultiple;
const feePercentage = networkMarketConfig[hre.network.name].feePercentage;
const feeWalletAddress =
networkMarketConfig[hre.network.name].feeWalletAddress;
let txn: ContractTransaction;
if ((await certificate.getRemovalAddress()) !== removal.address) {

Check warning on line 90 in deploy/configure-assets-after-deployment.ts

View workflow job for this annotation

GitHub Actions / lint

Unsafe member access .getRemovalAddress on an `any` value

Check warning on line 90 in deploy/configure-assets-after-deployment.ts

View workflow job for this annotation

GitHub Actions / lint

Unsafe call of an `any` typed value
hre.trace('Setting removal address in Certificate contract...');
Expand All @@ -85,7 +110,7 @@ export const deploy: DeployFunction = async (environment) => {

if (
(await market.getPurchasingTokenAddress()) !== purchaseTokenAddress ||
(await market.getPriceMultiple()) !== priceMultiple
(await market.getPriceMultiple()) !== BigNumber.from(priceMultiple)
) {
txn = await market.setPurchasingTokenAndPriceMultiple(
purchaseTokenAddress,
Expand All @@ -98,11 +123,10 @@ export const deploy: DeployFunction = async (environment) => {
} as purchase token with price multiple of ${priceMultiple}`
);
}
// TODO: Configure the purchasing token and fee percentage somewhere more global
if ((await market.getNoriFeePercentage()) !== BigNumber.from(25)) {
txn = await market.setNoriFeePercentage(25);
if ((await market.getNoriFeePercentage()) !== BigNumber.from(feePercentage)) {
txn = await market.setNoriFeePercentage(feePercentage);
await txn.wait(CONFIRMATIONS);
hre.trace('Set fee percentage to 25');
hre.trace(`Set fee percentage to ${feePercentage}`);
}

if ((await market.getNoriFeeWallet()) !== feeWalletAddress) {
Expand Down
6 changes: 3 additions & 3 deletions deployments/mumbai/BridgedPolygonNORI.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions deployments/mumbai/Certificate.json

Large diffs are not rendered by default.

96 changes: 8 additions & 88 deletions deployments/mumbai/Market.json

Large diffs are not rendered by default.

204 changes: 96 additions & 108 deletions deployments/mumbai/Removal.json

Large diffs are not rendered by default.

0 comments on commit fc99837

Please sign in to comment.