修改market的验签方式

This commit is contained in:
cebgcontract 2022-02-18 14:16:58 +08:00
parent 980398375e
commit 252c487971
17 changed files with 19000 additions and 18958 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -10171,8 +10171,8 @@
} }
}, },
"links": {}, "links": {},
"address": "0xC8d87fdd2896E0a1cAb382322075FDAD7526c8D2", "address": "0xc01A8D9662D4C2A1ef5d7A828642038D274C3FC4",
"transactionHash": "0x7ea2b40f8ccb26f9dec9abec8a01f4ca21e8d5cc2621f00d788986c81085f8a2" "transactionHash": "0x35d4f2b78e8e22bb1e14067358edacc3f185da08d4291eac12e6cb05f2240be5"
}, },
"1338": { "1338": {
"events": { "events": {
@ -10359,7 +10359,7 @@
} }
}, },
"schemaVersion": "3.4.3", "schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T04:53:59.198Z", "updatedAt": "2022-02-18T05:49:14.148Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -24436,8 +24436,8 @@
} }
}, },
"links": {}, "links": {},
"address": "0xF2A5e388D9B65823609701690917140e878Ba145", "address": "0x4167745950c051e5fa3534fF4daaDa3FA99F306b",
"transactionHash": "0xed76db42da9a24070e7807c6e6e6da3498c1a1177a3abed0fea70f8bd5fb5f54" "transactionHash": "0xbb02e3426f8b84baff711c6cecf2f3b3ccfd1cadabf207522b4d6a6f52c37caa"
}, },
"1338": { "1338": {
"events": { "events": {
@ -24647,7 +24647,7 @@
} }
}, },
"schemaVersion": "3.4.3", "schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T04:53:59.154Z", "updatedAt": "2022-02-18T05:49:14.105Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3152,8 +3152,8 @@
"1337": { "1337": {
"events": {}, "events": {},
"links": {}, "links": {},
"address": "0x0DB24A927FFC3622884B7A3B6f1C694ED8092A01", "address": "0x2EcDBA9Eca792f5B6d620D9031D9C237cE480924",
"transactionHash": "0xd55fa70f0a3993c168eefad5ba7eabde2d17ceb196e768a860f4e6855601830f" "transactionHash": "0xb19aa37f7a8e19322362a3254eed609fa80ef8d0970b32947e9248118b69c09c"
}, },
"1338": { "1338": {
"events": {}, "events": {},
@ -3169,7 +3169,7 @@
} }
}, },
"schemaVersion": "3.4.3", "schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T04:53:59.302Z", "updatedAt": "2022-02-18T05:49:14.251Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

View File

@ -8904,8 +8904,8 @@
} }
}, },
"links": {}, "links": {},
"address": "0x47EF76991DD3C561BaB1504C48C0eB55a6e61025", "address": "0x7ffF11d9701d86D945B17E3bc329334bB70248a0",
"transactionHash": "0x2ad34fc738e5dd6fc78eaf168f70c0ad090fd97352856e90600ba9d52d272b68" "transactionHash": "0xb7e86aed2f5ce01c77cf0ca32b873868560a0ddf73b7f0682004dacc1930abf7"
}, },
"1338": { "1338": {
"events": { "events": {
@ -8966,7 +8966,7 @@
} }
}, },
"schemaVersion": "3.4.3", "schemaVersion": "3.4.3",
"updatedAt": "2022-02-18T04:53:59.287Z", "updatedAt": "2022-02-18T05:49:14.226Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

View File

@ -40,12 +40,13 @@ abstract contract BEBase is ERC721, AccessControlEnumerable, ERC721Enumerable, O
// can be burned (destroyed), so we need a separate counter. // can be burned (destroyed), so we need a separate counter.
_mint(to, tokenId); _mint(to, tokenId);
} }
/** /**
* @dev Allow operation to approval list. * @dev Allow operation to approval list.
*/ */
function addApprovalWhitelist(address proxy) external onlyOwner { function addApprovalWhitelist(address proxy) external onlyOwner {
require(!approvalWhitelists[proxy], "Invalid proxy address"); require(!approvalWhitelists[proxy], "Invalid proxy address");
setApprovalForAll(proxy, true);
approvalWhitelists[proxy] = true; approvalWhitelists[proxy] = true;
} }
@ -53,6 +54,7 @@ abstract contract BEBase is ERC721, AccessControlEnumerable, ERC721Enumerable, O
* @dev Remove operation from approval list. * @dev Remove operation from approval list.
*/ */
function removeApprovalWhitelist(address proxy) external onlyOwner { function removeApprovalWhitelist(address proxy) external onlyOwner {
setApprovalForAll(proxy, false);
approvalWhitelists[proxy] = false; approvalWhitelists[proxy] = false;
} }

View File

@ -111,7 +111,7 @@ contract BEBoxMall is Ownable, HasSignature, TimelockController{
return return
keccak256( keccak256(
abi.encode( abi.encode(
keccak256("set(uint256 item,address token,uint256 amount,uint256 salt)"), keccak256("set(uint256 item,address token,uint256 price,uint256 salt)"),
_boxType, _boxType,
_paymentErc20, _paymentErc20,
_price, _price,

View File

@ -126,7 +126,7 @@ contract MarketPlace is Ownable, HasSignature {
values[2] values[2]
); );
checkSigner(addresses[0], criteriaMessageHash, signature); checkSigner712(addresses[0], criteriaMessageHash, signature);
// check current ownership // check current ownership
IERC721 nft = IERC721(addresses[1]); IERC721 nft = IERC721(addresses[1]);
@ -189,7 +189,7 @@ contract MarketPlace is Ownable, HasSignature {
); );
} }
function getMessageHash( function getMessageHash(
address _nftAddress, address _nftAddress,
uint256 _tokenId, uint256 _tokenId,
address _paymentErc20, address _paymentErc20,
@ -198,13 +198,14 @@ contract MarketPlace is Ownable, HasSignature {
) public pure returns (bytes32) { ) public pure returns (bytes32) {
return return
keccak256( keccak256(
abi.encodePacked( abi.encode(
keccak256("set(address nft,uint256 tokenId,address payToken,uint256 price,uint256 salt)"),
_nftAddress, _nftAddress,
_tokenId, _tokenId,
_paymentErc20, _paymentErc20,
_price, _price,
_saltNonce _saltNonce
) )
); );
} }
} }

View File

@ -2,6 +2,7 @@ const MarketPlace = artifacts.require('MarketPlace');
const Hero = artifacts.require('BEHero'); const Hero = artifacts.require('BEHero');
const Equip = artifacts.require('BEEquipment'); const Equip = artifacts.require('BEEquipment');
const Chip = artifacts.require('BEChip'); const Chip = artifacts.require('BEChip');
const Coin = artifacts.require('BECoin');
const config = require("../config/config"); const config = require("../config/config");
module.exports = async function (deployer, network, accounts) { module.exports = async function (deployer, network, accounts) {
@ -12,6 +13,9 @@ module.exports = async function (deployer, network, accounts) {
} }
try { try {
marketInstance.setFeeToAddress(config.market.feeToAddress); marketInstance.setFeeToAddress(config.market.feeToAddress);
marketInstance.setTransactionFee(300);
const coinInstance = await Coin.deployed();
config.market.paymentTokens.push(coinInstance.address);
marketInstance.setPaymentTokens(config.market.paymentTokens); marketInstance.setPaymentTokens(config.market.paymentTokens);
} catch(err) { } catch(err) {
console.log("MarketPlace setFeeToAddress or setPaymentTokens with error", err); console.log("MarketPlace setFeeToAddress or setPaymentTokens with error", err);