Skip to content

Commit

Permalink
Merge pull request #1497 from thesandboxgame/feat/marketplace-bundle-…
Browse files Browse the repository at this point in the history
…type

feat: bundle as AssetClass
  • Loading branch information
wojciech-turek authored Dec 3, 2024
2 parents ea8f2c8 + 07cf5f3 commit 3d3d9d5
Show file tree
Hide file tree
Showing 86 changed files with 8,583 additions and 268 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
await deploy('RoyaltiesRegistry', {
from: deployer,
contract:
'@sandbox-smart-contracts/marketplace/contracts/RoyaltiesRegistry.sol:RoyaltiesRegistry',
'@sandbox-smart-contracts/marketplace@1.0.1/contracts/RoyaltiesRegistry.sol:RoyaltiesRegistry',
proxy: {
owner: upgradeAdmin,
proxyContract: 'OpenZeppelinTransparentProxy',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
await deploy('OrderValidator', {
from: deployer,
contract:
'@sandbox-smart-contracts/marketplace/contracts/OrderValidator.sol:OrderValidator',
'@sandbox-smart-contracts/marketplace@1.0.1/contracts/OrderValidator.sol:OrderValidator',
proxy: {
owner: upgradeAdmin,
proxyContract: 'OpenZeppelinTransparentProxy',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ const func: DeployFunction = async function (
const TSB_ROLE = await read('OrderValidator', 'TSB_ROLE');
const PARTNER_ROLE = await read('OrderValidator', 'PARTNER_ROLE');

const SandContract = await deployments.get('PolygonSand');
let SandContract;
if (hre.network.name === 'polygon') {
SandContract = await deployments.get('PolygonSand');
} else {
SandContract = await deployments.get('Sand');
}
const AssetContract = await deployments.get('Asset');

const addressesToGrant = [];
Expand Down Expand Up @@ -110,5 +115,6 @@ func.tags = [
func.dependencies = [
'OrderValidator_deploy',
'PolygonSand_deploy',
'Sand_deploy',
'Asset_deploy',
];
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

await deploy('Exchange', {
from: deployer,
contract: `@sandbox-smart-contracts/marketplace/contracts/Exchange.sol:Exchange`,
contract: `@sandbox-smart-contracts/marketplace@1.0.1/contracts/Exchange.sol:Exchange`,
proxy: {
owner: upgradeAdmin,
proxyContract: 'OpenZeppelinTransparentProxy',
Expand Down
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';
import {DEPLOY_TAGS} from '../../hardhat.config';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {deploy, catchUnknownSigner} = deployments;
const {deployer, upgradeAdmin} = await getNamedAccounts();
await catchUnknownSigner(
deploy('RoyaltiesRegistry', {
from: deployer,
contract:
'@sandbox-smart-contracts/marketplace/contracts/RoyaltiesRegistry.sol:RoyaltiesRegistry',
proxy: {
owner: upgradeAdmin,
proxyContract: 'OpenZeppelinTransparentProxy',
upgradeIndex: 1,
},
log: true,
})
);
};

export default func;
func.tags = [
'RoyaltiesRegistry',
'RoyaltiesRegistry',
'RoyaltiesRegistryV2_deploy',
DEPLOY_TAGS.L1,
DEPLOY_TAGS.L1_PROD,
DEPLOY_TAGS.L1_TEST,
DEPLOY_TAGS.L2,
DEPLOY_TAGS.L2_PROD,
DEPLOY_TAGS.L2_TEST,
];
func.dependencies = ['RoyaltiesRegistry_deploy'];
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';
import {DEPLOY_TAGS} from '../../hardhat.config';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {deploy, catchUnknownSigner} = deployments;
const {deployer, upgradeAdmin} = await getNamedAccounts();
await catchUnknownSigner(
deploy('OrderValidator', {
from: deployer,
contract:
'@sandbox-smart-contracts/marketplace/contracts/OrderValidator.sol:OrderValidator',
proxy: {
owner: upgradeAdmin,
proxyContract: 'OpenZeppelinTransparentProxy',
upgradeIndex: 1,
},
log: true,
})
);
};

export default func;
func.tags = [
'OrderValidator',
'OrderValidator',
'OrderValidatorV2_deploy',
DEPLOY_TAGS.L1,
DEPLOY_TAGS.L1_PROD,
DEPLOY_TAGS.L1_TEST,
DEPLOY_TAGS.L2,
DEPLOY_TAGS.L2_PROD,
DEPLOY_TAGS.L2_TEST,
];
func.dependencies = ['OrderValidator_deploy'];
35 changes: 35 additions & 0 deletions packages/deploy/deploy/500_marketplace/507_upgrade_exchange.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {DeployFunction} from 'hardhat-deploy/types';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {DEPLOY_TAGS} from '../../hardhat.config';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts} = hre;
const {deploy, catchUnknownSigner} = deployments;
const {deployer, upgradeAdmin} = await getNamedAccounts();
await catchUnknownSigner(
deploy('Exchange', {
from: deployer,
contract: `@sandbox-smart-contracts/marketplace/contracts/Exchange.sol:Exchange`,
proxy: {
owner: upgradeAdmin,
proxyContract: 'OpenZeppelinTransparentProxy',
upgradeIndex: 1,
},
log: true,
})
);
};

export default func;
func.tags = [
'Exchange',
'Exchange',
'ExchangeV2_deploy',
DEPLOY_TAGS.L1,
DEPLOY_TAGS.L1_PROD,
DEPLOY_TAGS.L1_TEST,
DEPLOY_TAGS.L2,
DEPLOY_TAGS.L2_PROD,
DEPLOY_TAGS.L2_TEST,
];
func.dependencies = ['Exchange_deploy'];
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@ const func: DeployFunction = async function (

const ERC1776_OPERATOR_ROLE = await read('Exchange', 'ERC1776_OPERATOR_ROLE');
const EXCHANGE_ADMIN_ROLE = await read('Exchange', 'EXCHANGE_ADMIN_ROLE');
const sandContract = await deployments.get('PolygonSand');

let sandContract;
let landContract;
if (hre.network.name === 'polygon') {
sandContract = await deployments.get('PolygonSand');
landContract = await deployments.get('PolygonLand');
} else {
sandContract = await deployments.get('Sand');
landContract = await deployments.get('Land');
}

const hasERC1776OperatorRole = await read(
'Exchange',
Expand Down Expand Up @@ -48,6 +57,18 @@ const func: DeployFunction = async function (
)
);
}

const currentLand = await read('Exchange', 'landContract');
if (currentLand != landContract.address) {
await catchUnknownSigner(
execute(
'Exchange',
{from: sandAdmin, log: true},
'setLandContract',
landContract.address
)
);
}
};

export default func;
Expand All @@ -61,4 +82,13 @@ func.tags = [
DEPLOY_TAGS.L2_PROD,
DEPLOY_TAGS.L2_TEST,
];
func.dependencies = ['Exchange_deploy', 'PolygonSand_deploy'];
func.dependencies = [
'Exchange_deploy',
'Sand_deploy',
'Land_deploy',
'PolygonSand_deploy',
'PolygonLand_deploy',
'PolygonLandV2_deploy',
'LandV4_deploy',
'ExchangeV2_deploy',
];
7 changes: 7 additions & 0 deletions packages/deploy/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@ const importedPackages = {
],
'@sandbox-smart-contracts/giveaway': 'contracts/SignedMultiGiveaway.sol',
'@sandbox-smart-contracts/faucets': 'contracts/FaucetsERC1155.sol',
'@sandbox-smart-contracts/[email protected]': [
'contracts/RoyaltiesRegistry.sol',
'contracts/OrderValidator.sol',
'contracts/Exchange.sol',
'contracts/TransferManager.sol',
],
'@sandbox-smart-contracts/marketplace': [
'contracts/RoyaltiesRegistry.sol',
'contracts/OrderValidator.sol',
'contracts/Exchange.sol',
'contracts/TransferManager.sol',
],
'@sandbox-smart-contracts/dependency-operator-filter': [
'contracts/OperatorFilterSubscription.sol',
Expand Down
26 changes: 26 additions & 0 deletions packages/deploy/integration_test/marketplace/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export const GRID_SIZE = 408;

//ERC20 to exchange for
export const erc20PriceForBundle = 10000000000;

// Configuration for ERC721 land tokens (array of [x,y] values)
export const erc721 = [
// Add (x, y) pairs as needed
];

// Configuration for quad land (array of [x, y, size] values)
export const quad = [
// Add (size,x, y) triples as needed
];

// Configuration for ERC1155 assets (array of [tokenId, supply] values)
export const erc1155 = [
// Add [tier, amount, metadataHash] as needed
];

// Price distribution setup
export const priceDistribution = {
erc721Prices: [[]],
erc1155Prices: [[]],
quadPrices: [],
};
Loading

1 comment on commit 3d3d9d5

@github-actions
Copy link

Choose a reason for hiding this comment

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

Coverage for this commit

98.26%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
packages/marketplace/contracts
   Exchange.sol94.67%93.33%94.74%96.15%131, 206, 77
   ExchangeCore.sol97.75%93.75%100%100%200, 82
   OrderValidator.sol98.48%96.15%100%100%37
   RoyaltiesRegistry.sol96.35%88.89%100%98.80%196, 218–219, 265, 66
   TransferManager.sol96.09%87.80%100%99.42%164, 226, 248, 315, 375, 413, 564, 569, 580, 602, 94
   Whitelist.sol76.19%60%85.71%82.76%106, 110–111, 125, 128, 144–145, 56, 68, 68–69, 73, 78
packages/marketplace/contracts/interfaces
   IOrderValidator.sol100%100%100%100%
   IRoyaltiesProvider.sol100%100%100%100%
   ITransferManager.sol100%100%100%100%
   IWhitelist.sol100%100%100%100%
packages/marketplace/contracts/libraries
   LibAsset.sol97.47%92.31%100%100%86, 88
   LibMath.sol100%100%100%100%
   LibOrder.sol100%100%100%100%

Please sign in to comment.