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

Intergration test for Land #1483

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {deploy, read, catchUnknownSigner, execute} = deployments;

const {deployer, sandAdmin} = await getNamedAccounts();

// Operator filter subscription
await deploy('OperatorFilterLandSubscription', {
from: deployer,
contract:
'@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFilterSubscription.sol:OperatorFilterSubscription',
log: true,
skipIfAlreadyDeployed: true,
});

const owner = await read('OperatorFilterLandSubscription', 'owner');
if (owner != sandAdmin) {
await catchUnknownSigner(
execute(
'OperatorFilterLandSubscription',
{from: owner, log: true},
'transferOwnership',
sandAdmin
)
);
}
};
export default func;
func.tags = [
'OperatorFilterLandSubscription',
'OperatorFilterLandSubscription_deploy',
'L2',
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {deploy} = deployments;

const {deployer, landAdmin} = await getNamedAccounts();

const operatorFilterRegistry = await deployments.getOrNull(
'PolygonOperatorFilterRegistry'
);

if (!operatorFilterRegistry) {
const mockMarketPlace1 = await deploy('MockMarketPlace1', {
from: deployer,
contract:
'@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockMarketPlace1.sol:MockERC1155MarketPlace1',
args: [],
log: true,
skipIfAlreadyDeployed: true,
});

const mockMarketPlace2 = await deploy('MockMarketPlace2', {
from: deployer,
contract:
'@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockMarketPlace2.sol:MockERC1155MarketPlace2',
args: [],
log: true,
skipIfAlreadyDeployed: true,
});

const mockMarketPlace3 = await deploy('MockMarketPlace3', {
from: deployer,
contract:
'@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockMarketPlace3.sol:MockERC1155MarketPlace3',
args: [],
log: true,
skipIfAlreadyDeployed: true,
});

const mockMarketPlace4 = await deploy('MockMarketPlace4', {
from: deployer,
contract:
'@sandbox-smart-contracts/dependency-operator-filter/contracts/mock/MockMarketPlace4.sol:MockERC1155MarketPlace4',
args: [],
log: true,
skipIfAlreadyDeployed: true,
});

const defaultSubscription = '0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6';
const OperatorFilterLandSubscription = await deployments.get(
'OperatorFilterLandSubscription'
);

await deploy('PolygonOperatorFilterRegistry', {
from: deployer,
contract: 'MockOperatorFilterRegistry',
args: [
defaultSubscription,
[mockMarketPlace1.address, mockMarketPlace2.address],
],
log: true,
skipIfAlreadyDeployed: true,
});

await deployments.execute(
'PolygonOperatorFilterRegistry',
{from: landAdmin, log: true},
'registerAndCopyEntries',
OperatorFilterLandSubscription.address,
defaultSubscription
);
}
};
export default func;
func.tags = ['PolygonOperatorFilterRegistry', 'L2'];
func.dependencies = ['OperatorFilterLandSubscription'];
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {deploy, execute} = deployments;
const {deployer, landAdmin, upgradeAdmin} = await getNamedAccounts();
const TRUSTED_FORWARDER = await deployments.get('TRUSTED_FORWARDER_V2');

await deploy('PolygonLand', {
from: deployer,
contract: 'PolygonLandV1',
proxy: {
owner: upgradeAdmin,
proxyContract: 'OpenZeppelinTransparentProxy',
execute: {
methodName: 'initialize',
args: [TRUSTED_FORWARDER.address],
},
upgradeIndex: 0,
},
log: true,
});

await execute(
'PolygonLand',
{from: deployer, log: true},
'changeAdmin',
landAdmin
);
};
export default func;
func.tags = ['PolygonLand', 'PolygonLand_deploy', 'L2'];
func.dependencies = ['TRUSTED_FORWARDER_V2'];
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {deploy} = deployments;

const {deployer, upgradeAdmin} = await getNamedAccounts();
await deploy('PolygonLand', {
from: deployer,
contract: 'PolygonLandV2',
proxy: {
owner: upgradeAdmin,
proxyContract: 'OpenZeppelinTransparentProxy',
upgradeIndex: 1,
},
log: true,
});
};
export default func;
func.tags = ['PolygonLand', 'PolygonLandV2', 'L2'];
func.dependencies = ['PolygonLand_deploy'];
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {deploy} = deployments;
const {deployer, upgradeAdmin} = await getNamedAccounts();
await deploy('PolygonLand', {
from: deployer,
contract: 'PolygonLand',
proxy: {
owner: upgradeAdmin,
proxyContract: 'OpenZeppelinTransparentProxy',
upgradeIndex: 2,
},
log: true,
});
};
export default func;
func.tags = ['PolygonLand', 'PolygonLandV3', 'L2'];
func.dependencies = ['PolygonLandV2', 'RoyaltyManager_deploy'];
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DeployFunction} from 'hardhat-deploy/types';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {execute} = deployments;
const {landAdmin} = await getNamedAccounts();

const RoyaltyManager = await deployments.get('RoyaltyManager');
const OperatorFilterLandSubscription = await deployments.get(
'OperatorFilterLandSubscription'
);
const PolygonOperatorFilterRegistry = await deployments.get(
'PolygonOperatorFilterRegistry'
);

await execute(
'PolygonLand',
{from: landAdmin, log: true},
'setRoyaltyManager',
RoyaltyManager.address
);

console.log(OperatorFilterLandSubscription.address);
console.log(PolygonOperatorFilterRegistry.address);

await deployments.execute(
'PolygonLand',
{from: landAdmin, log: true},
'setOperatorRegistry',
PolygonOperatorFilterRegistry.address
);

await deployments.execute(
'PolygonLand',
{from: landAdmin, log: true},
'register',
OperatorFilterLandSubscription.address,
true
);
};

export default func;

func.tags = ['PolygonLand', 'PolygonLand_setup'];
func.dependencies = [
'OperatorFilterLandSubscription_deploy',
'PolygonOperatorFilterRegistry',
'PolygonLand_deploy',
'PolygonLandV2',
'PolygonLandV3',
];
7 changes: 7 additions & 0 deletions packages/deploy/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ const importedPackages = {
'@sandbox-smart-contracts/core': [
'/src/solc_0.8/polygon/child/sand/PolygonSand.sol',
'/src/solc_0.8/test/FakeChildChainManager.sol',
'/src/solc_0.8/polygon/child/land/PolygonLandV1.sol',
'/src/solc_0.8/polygon/child/land/PolygonLandV2.sol',
],
'@sandbox-smart-contracts/land': [
'contracts/Land.sol',
'contracts/PolygonLand.sol',
],
};

Expand Down Expand Up @@ -327,6 +333,7 @@ const networks = {
};

const compilers = [
'0.8.23',
'0.8.21',
'0.8.19',
'0.8.18',
Expand Down
1 change: 1 addition & 0 deletions packages/deploy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@sandbox-smart-contracts/dependency-royalty-management": "1.0.2",
"@sandbox-smart-contracts/faucets": "0.0.1",
"@sandbox-smart-contracts/giveaway": "0.0.3",
"@sandbox-smart-contracts/land": "*",
"@sandbox-smart-contracts/marketplace": "1.0.1"
},
"files": [
Expand Down