修改market购买中心化物品的方法
This commit is contained in:
parent
b0eea9601b
commit
f37fc2f087
File diff suppressed because one or more lines are too long
@ -65,18 +65,17 @@ contract GameItemMarket is
|
|||||||
orderId,
|
orderId,
|
||||||
currency,
|
currency,
|
||||||
price,
|
price,
|
||||||
feeToAddress,
|
|
||||||
startTime,
|
startTime,
|
||||||
saltNonce
|
saltNonce
|
||||||
);
|
);
|
||||||
checkSigner(executor, criteriaMessageHash, signature);
|
checkSigner(executor, criteriaMessageHash, signature);
|
||||||
require(
|
require(
|
||||||
IERC20(currency).balanceOf(_msgSender()) >= price,
|
IERC20(currency).balanceOf(_msgSender()) >= price,
|
||||||
"GameItemMall: buyer doesn't have enough token to buy this item"
|
"GameItemMarket: buyer doesn't have enough token to buy this item"
|
||||||
);
|
);
|
||||||
require(
|
require(
|
||||||
IERC20(currency).allowance(_msgSender(), address(this)) >= price,
|
IERC20(currency).allowance(_msgSender(), address(this)) >= price,
|
||||||
"GameItemMall: buyer doesn't approve marketplace to spend payment amount"
|
"GameItemMarket: buyer doesn't approve marketplace to spend payment amount"
|
||||||
);
|
);
|
||||||
uint256 _transactionFee = (price * transactionFee) / ROUND;
|
uint256 _transactionFee = (price * transactionFee) / ROUND;
|
||||||
if (_transactionFee > 0) {
|
if (_transactionFee > 0) {
|
||||||
@ -112,7 +111,6 @@ contract GameItemMarket is
|
|||||||
uint256 _orderId,
|
uint256 _orderId,
|
||||||
address _currency,
|
address _currency,
|
||||||
uint256 _price,
|
uint256 _price,
|
||||||
address _feeToAddress,
|
|
||||||
uint256 _startTime,
|
uint256 _startTime,
|
||||||
uint256 _saltNonce
|
uint256 _saltNonce
|
||||||
) public pure returns (bytes32) {
|
) public pure returns (bytes32) {
|
||||||
@ -122,7 +120,6 @@ contract GameItemMarket is
|
|||||||
_orderId,
|
_orderId,
|
||||||
_currency,
|
_currency,
|
||||||
_price,
|
_price,
|
||||||
_feeToAddress,
|
|
||||||
_startTime,
|
_startTime,
|
||||||
_saltNonce
|
_saltNonce
|
||||||
);
|
);
|
||||||
|
@ -36,54 +36,72 @@ module.exports = async function main(callback) {
|
|||||||
config.market.paymentTokens.push(coinInstance.address);
|
config.market.paymentTokens.push(coinInstance.address);
|
||||||
config.market.paymentTokens.push(goldInstance.address);
|
config.market.paymentTokens.push(goldInstance.address);
|
||||||
|
|
||||||
const marketInstance = await BENftMarket.at(
|
// const marketInstance = await BENftMarket.at(
|
||||||
cfgs.find((c) => c.name === "BENftMarket").address
|
// cfgs.find((c) => c.name === "BENftMarket").address
|
||||||
);
|
// );
|
||||||
const ROUND = 1000000;
|
// const ROUND = 1000000;
|
||||||
const DECIMALS = 1000000000000000000;
|
// const DECIMALS = 1000000000000000000;
|
||||||
if (marketInstance) {
|
// if (marketInstance) {
|
||||||
await marketInstance.setFeeToAddress(config.market.feeToAddress);
|
// await marketInstance.setFeeToAddress(config.market.feeToAddress);
|
||||||
console.log(
|
// console.log(
|
||||||
`market receive fee address set to : ${config.market.feeToAddress}`
|
// `market receive fee address set to : ${config.market.feeToAddress}`
|
||||||
);
|
// );
|
||||||
await marketInstance.setTaxToAddress(config.market.feeToAddress);
|
// await marketInstance.setTaxToAddress(config.market.feeToAddress);
|
||||||
console.log(
|
// console.log(
|
||||||
`market receive tax address set to : ${config.market.feeToAddress}`
|
// `market receive tax address set to : ${config.market.feeToAddress}`
|
||||||
);
|
// );
|
||||||
await marketInstance.setTransactionFee((3 * ROUND) / 100);
|
// await marketInstance.setTransactionFee((3 * ROUND) / 100);
|
||||||
await marketInstance.setTransactionTax((1 * ROUND) / 100);
|
// await marketInstance.setTransactionTax((1 * ROUND) / 100);
|
||||||
await marketInstance.addERC721Support(heroInstance.address);
|
// await marketInstance.addERC721Support(heroInstance.address);
|
||||||
await marketInstance.addERC721Support(equipInstance.address);
|
// await marketInstance.addERC721Support(equipInstance.address);
|
||||||
await marketInstance.addERC721Support(chipInstance.address);
|
// await marketInstance.addERC721Support(chipInstance.address);
|
||||||
|
|
||||||
const maxPrice = web3.utils.toWei("99990000");
|
// const maxPrice = web3.utils.toWei("99990000");
|
||||||
const minPrice = web3.utils.toWei("0.01");
|
// const minPrice = web3.utils.toWei("0.01");
|
||||||
await marketInstance.setNFTPriceMaxLimit(heroInstance.address, maxPrice);
|
// await marketInstance.setNFTPriceMaxLimit(heroInstance.address, maxPrice);
|
||||||
await marketInstance.setNFTPriceMinLimit(heroInstance.address, minPrice);
|
// await marketInstance.setNFTPriceMinLimit(heroInstance.address, minPrice);
|
||||||
await marketInstance.setNFTPriceMaxLimit(equipInstance.address, maxPrice);
|
// await marketInstance.setNFTPriceMaxLimit(equipInstance.address, maxPrice);
|
||||||
await marketInstance.setNFTPriceMinLimit(equipInstance.address, minPrice);
|
// await marketInstance.setNFTPriceMinLimit(equipInstance.address, minPrice);
|
||||||
await marketInstance.setNFTPriceMaxLimit(chipInstance.address, maxPrice);
|
// await marketInstance.setNFTPriceMaxLimit(chipInstance.address, maxPrice);
|
||||||
await marketInstance.setNFTPriceMinLimit(chipInstance.address, minPrice);
|
// await marketInstance.setNFTPriceMinLimit(chipInstance.address, minPrice);
|
||||||
for (let token of config.market.paymentTokens) {
|
// for (let token of config.market.paymentTokens) {
|
||||||
await marketInstance.addERC20Support(token);
|
// await marketInstance.addERC20Support(token);
|
||||||
console.log(`add token for market payment: ${token}`);
|
// console.log(`add token for market payment: ${token}`);
|
||||||
}
|
// }
|
||||||
console.log(`finish update market config`);
|
// console.log(`finish update market config`);
|
||||||
}
|
// }
|
||||||
const gameMallInstance = await GameItemMall.at(
|
// const gameMallInstance = await GameItemMall.at(
|
||||||
cfgs.find((c) => c.name === "GameItemMall").address
|
// cfgs.find((c) => c.name === "GameItemMall").address
|
||||||
|
// );
|
||||||
|
// if (gameMallInstance) {
|
||||||
|
// await gameMallInstance.setFeeToAddress(config.market.feeToAddress);
|
||||||
|
// console.log(
|
||||||
|
// `mall receive fee address set to : ${config.market.feeToAddress}`
|
||||||
|
// );
|
||||||
|
|
||||||
|
// await gameMallInstance.updateExecutor(config.admins.admin);
|
||||||
|
// console.log(`mall executor set to : ${config.admins.admin}`);
|
||||||
|
|
||||||
|
// for (let token of config.market.paymentTokens) {
|
||||||
|
// await gameMallInstance.addERC20Support(token);
|
||||||
|
// console.log(`add token for mall payment: ${token}`);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
const gameMarketInstance = await GameItemMarket.at(
|
||||||
|
cfgs.find((c) => c.name === "GameItemMarket").address
|
||||||
);
|
);
|
||||||
if (gameMallInstance) {
|
if (gameMarketInstance) {
|
||||||
await gameMallInstance.setFeeToAddress(config.market.feeToAddress);
|
await gameMarketInstance.setFeeToAddress(config.market.feeToAddress);
|
||||||
console.log(
|
console.log(
|
||||||
`mall receive fee address set to : ${config.market.feeToAddress}`
|
`mall receive fee address set to : ${config.market.feeToAddress}`
|
||||||
);
|
);
|
||||||
|
|
||||||
await gameMallInstance.updateExecutor(config.admins.admin);
|
await gameMarketInstance.updateExecutor(config.admins.admin);
|
||||||
console.log(`mall executor set to : ${config.admins.admin}`);
|
console.log(`mall executor set to : ${config.admins.admin}`);
|
||||||
|
|
||||||
for (let token of config.market.paymentTokens) {
|
for (let token of config.market.paymentTokens) {
|
||||||
await gameMallInstance.addERC20Support(token);
|
await gameMarketInstance.addERC20Support(token);
|
||||||
console.log(`add token for mall payment: ${token}`);
|
console.log(`add token for mall payment: ${token}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,29 +31,29 @@ module.exports = async function (deployer, network, accounts) {
|
|||||||
// network,
|
// network,
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// await deployer.deploy(GameItemMarket);
|
await deployer.deploy(GameItemMarket);
|
||||||
// const gameMarketInstance = await GameItemMarket.deployed();
|
const gameMarketInstance = await GameItemMarket.deployed();
|
||||||
// if (gameMarketInstance) {
|
if (gameMarketInstance) {
|
||||||
// console.log("GameItemMarket successfully deployed.");
|
console.log("GameItemMarket successfully deployed.");
|
||||||
// }
|
|
||||||
// base.updateArray({
|
|
||||||
// name: "GameItemMarket",
|
|
||||||
// type: "logic",
|
|
||||||
// json: "assets/contracts/GameItemMarket.json",
|
|
||||||
// address: gameMarketInstance.address,
|
|
||||||
// network,
|
|
||||||
// });
|
|
||||||
|
|
||||||
await deployer.deploy(GameItemMall);
|
|
||||||
const gameMallInstance = await GameItemMall.deployed();
|
|
||||||
if (gameMallInstance) {
|
|
||||||
console.log("GameItemMall successfully deployed.");
|
|
||||||
}
|
}
|
||||||
base.updateArray({
|
base.updateArray({
|
||||||
name: "GameItemMall",
|
name: "GameItemMarket",
|
||||||
type: "logic",
|
type: "logic",
|
||||||
json: "assets/contracts/GameItemMall.json",
|
json: "assets/contracts/GameItemMarket.json",
|
||||||
address: gameMallInstance.address,
|
address: gameMarketInstance.address,
|
||||||
network,
|
network,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// await deployer.deploy(GameItemMall);
|
||||||
|
// const gameMallInstance = await GameItemMall.deployed();
|
||||||
|
// if (gameMallInstance) {
|
||||||
|
// console.log("GameItemMall successfully deployed.");
|
||||||
|
// }
|
||||||
|
// base.updateArray({
|
||||||
|
// name: "GameItemMall",
|
||||||
|
// type: "logic",
|
||||||
|
// json: "assets/contracts/GameItemMall.json",
|
||||||
|
// address: gameMallInstance.address,
|
||||||
|
// network,
|
||||||
|
// });
|
||||||
};
|
};
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
"name": "GameItemMarket",
|
"name": "GameItemMarket",
|
||||||
"type": "logic",
|
"type": "logic",
|
||||||
"json": "assets/contracts/GameItemMarket.json",
|
"json": "assets/contracts/GameItemMarket.json",
|
||||||
"address": "0x19a13Da2E7EB33210c98B589888EA68267ee61d6"
|
"address": "0x46e2C612756b702b3d68d89F97c88FFa725F6fab"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "GameItemMall",
|
"name": "GameItemMall",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user