增加购买nft的合约

This commit is contained in:
cebgcontract 2022-10-19 16:46:51 +08:00
parent f16418557a
commit a84dbf61c0
29 changed files with 121595 additions and 46696 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -9688,10 +9688,34 @@
"links": {}, "links": {},
"address": "0xCfEB869F69431e42cdB54A4F4f105C19C080A601", "address": "0xCfEB869F69431e42cdB54A4F4f105C19C080A601",
"transactionHash": "0x2204250d687161b0ca7a13205946e84000a26e776b23eb5e859e510b524829f3" "transactionHash": "0x2204250d687161b0ca7a13205946e84000a26e776b23eb5e859e510b524829f3"
},
"1666000229659": {
"events": {},
"links": {},
"address": "0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7",
"transactionHash": "0x503ecb4288a102e30dbd56567a0e86cf34ff45f1b2cb0f8fa6b893844b31e486"
},
"1666158172944": {
"events": {},
"links": {},
"address": "0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7",
"transactionHash": "0x67311356895867581d493472ff62500b332cae575e072a1a031abd9164b86d4e"
},
"1666162776163": {
"events": {},
"links": {},
"address": "0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7",
"transactionHash": "0x1ec60d98dfee7841bbc11d769c33852c78d400eb6c9b863aef99441ee69aa6a1"
},
"1666167438998": {
"events": {},
"links": {},
"address": "0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7",
"transactionHash": "0x400b62e208d61ab31e85685fdf3ecc0b2e114d00fd475117cfafeef1af6f1328"
} }
}, },
"schemaVersion": "3.4.4", "schemaVersion": "3.4.4",
"updatedAt": "2022-08-18T03:05:16.061Z", "updatedAt": "2022-10-19T08:17:42.147Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

View File

@ -186,7 +186,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -199,7 +200,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -212,7 +214,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -225,7 +228,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -262,7 +266,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -299,7 +304,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -318,7 +324,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -386,7 +393,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -410,7 +418,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -429,7 +438,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -461,7 +471,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -492,7 +503,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -505,7 +517,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -524,7 +537,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -707,7 +721,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -720,7 +735,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -739,7 +755,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -763,7 +780,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -782,7 +800,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -795,7 +814,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -22278,10 +22298,35 @@
"links": {}, "links": {},
"address": "0x59d3631c86BbE35EF041872d502F218A39FBa150", "address": "0x59d3631c86BbE35EF041872d502F218A39FBa150",
"transactionHash": "0x345007f4ea30f5ecf100cccb0f1e3047a7fa89164931b2fcbe7f527ebe11d312" "transactionHash": "0x345007f4ea30f5ecf100cccb0f1e3047a7fa89164931b2fcbe7f527ebe11d312"
},
"1666000229659": {
"events": {},
"links": {},
"address": "0x2612Af3A521c2df9EAF28422Ca335b04AdF3ac66",
"transactionHash": "0x44e8196503811ca0f0c6fcb3a78d80e1b8c455759392bba36a51214717fd7d52"
},
"1666158172944": {
"events": {},
"links": {},
"address": "0x2612Af3A521c2df9EAF28422Ca335b04AdF3ac66",
"transactionHash": "0x86afc662f8e77cba853d3c214ba9f00b5cfe1fba74c03bcd629443ddb809ca9f"
},
"1666162776163": {
"events": {},
"links": {},
"address": "0x2612Af3A521c2df9EAF28422Ca335b04AdF3ac66",
"transactionHash": "0x3ae147959e645f5acb690bd3b7525513aef1bc17493a85729693123b929ccc3f"
},
"1666167438998": {
"events": {},
"links": {},
"address": "0x2612Af3A521c2df9EAF28422Ca335b04AdF3ac66",
"transactionHash": "0xf3a6ef59fbeb987b4ef4432b654e78345d5e7973fdcd5a525cd05f8e7db9138b"
} }
}, },
"schemaVersion": "3.4.4", "schemaVersion": "3.4.4",
"updatedAt": "2022-10-14T05:18:29.931Z", "updatedAt": "2022-10-19T08:17:49.869Z",
"networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",
"methods": { "methods": {

View File

@ -11736,10 +11736,34 @@
"links": {}, "links": {},
"address": "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550", "address": "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550",
"transactionHash": "0x6d2a8e99df9adb00dfa3fda55853cddf2f206987a4c80cb8f0062fa451cb8224" "transactionHash": "0x6d2a8e99df9adb00dfa3fda55853cddf2f206987a4c80cb8f0062fa451cb8224"
},
"1666000229659": {
"events": {},
"links": {},
"address": "0x59d3631c86BbE35EF041872d502F218A39FBa150",
"transactionHash": "0x3921de25d5e08eb6b2aafd23cdef7f44934f74f6a8a2a3d39e954292f02dfd1a"
},
"1666158172944": {
"events": {},
"links": {},
"address": "0x59d3631c86BbE35EF041872d502F218A39FBa150",
"transactionHash": "0x64cf0adfc64acad625ee376b95ade087f12c939a41d9c532af59f76489a5b8bc"
},
"1666162776163": {
"events": {},
"links": {},
"address": "0x59d3631c86BbE35EF041872d502F218A39FBa150",
"transactionHash": "0x994b997f6486e15966c57cdfb76791821851f8b3b7fc6f127e4e437a8f31606a"
},
"1666167438998": {
"events": {},
"links": {},
"address": "0x59d3631c86BbE35EF041872d502F218A39FBa150",
"transactionHash": "0xff7b55a20a44e9b2b3f0844fd4bfd293a0d1394f9359e6d1890baaa4181bf847"
} }
}, },
"schemaVersion": "3.4.4", "schemaVersion": "3.4.4",
"updatedAt": "2022-08-18T03:05:16.846Z", "updatedAt": "2022-10-19T08:17:44.731Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

View File

@ -186,7 +186,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -199,7 +200,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -212,7 +214,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -225,7 +228,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -262,7 +266,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -299,7 +304,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -318,7 +324,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -386,7 +393,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -410,7 +418,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -429,7 +438,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -461,7 +471,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -492,7 +503,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -505,7 +517,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -524,7 +537,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -707,7 +721,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -720,7 +735,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -739,7 +755,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -763,7 +780,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -782,7 +800,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -795,7 +814,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [ "inputs": [
@ -22278,10 +22298,35 @@
"links": {}, "links": {},
"address": "0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7", "address": "0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7",
"transactionHash": "0xcc3783c392f46b009f6e1d4caada678e39553ae1a878787d63f79f7324e9bd79" "transactionHash": "0xcc3783c392f46b009f6e1d4caada678e39553ae1a878787d63f79f7324e9bd79"
},
"1666000229659": {
"events": {},
"links": {},
"address": "0x9b1f7F645351AF3631a656421eD2e40f2802E6c0",
"transactionHash": "0x0155d233dd1b0d692c523dbced1803f3d50087253c18ad17b5492dcf5978be16"
},
"1666158172944": {
"events": {},
"links": {},
"address": "0x9b1f7F645351AF3631a656421eD2e40f2802E6c0",
"transactionHash": "0xa2cd21724281a6037d063508aceb86455a76f0e58ee27a8af34232a2d2b66f04"
},
"1666162776163": {
"events": {},
"links": {},
"address": "0x9b1f7F645351AF3631a656421eD2e40f2802E6c0",
"transactionHash": "0x2971aeb2670fbabf26ad1976ffbec45a979afd3b19865fda374241aef800fe87"
},
"1666167438998": {
"events": {},
"links": {},
"address": "0x9b1f7F645351AF3631a656421eD2e40f2802E6c0",
"transactionHash": "0x4d320bac4db524974fd8eb9f9ca1c015c72fdff915a6a7267d6c63bc5c020d91"
} }
}, },
"schemaVersion": "3.4.4", "schemaVersion": "3.4.4",
"updatedAt": "2022-10-14T05:18:29.944Z", "updatedAt": "2022-10-19T08:17:47.326Z",
"networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",
"methods": { "methods": {

45381
build/contracts/BENftMall.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -25039,6 +25039,182 @@
"version": "0.8.10+commit.fc410830.Emscripten.clang" "version": "0.8.10+commit.fc410830.Emscripten.clang"
}, },
"networks": { "networks": {
"80001": {
"events": {
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "approved",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
"0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
"0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "previousAdminRole",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newAdminRole",
"type": "bytes32"
}
],
"name": "RoleAdminChanged",
"type": "event"
},
"0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleGranted",
"type": "event"
},
"0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleRevoked",
"type": "event"
},
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
},
"links": {},
"address": "0x7c0a0674c6e8C82c8f35A14a4F08BA4390c13d83",
"transactionHash": "0x5098edadb418ab9df54f193f8d0ca9b48494d21e7fbc70955fca81c10cd59d08"
},
"1665724957326": { "1665724957326": {
"events": { "events": {
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": { "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": {
@ -25214,10 +25390,714 @@
"links": {}, "links": {},
"address": "0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7", "address": "0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7",
"transactionHash": "0xbef3222c4539b95a39734931b93267d72afc5b59316e9d6fa38639e1220a89d4" "transactionHash": "0xbef3222c4539b95a39734931b93267d72afc5b59316e9d6fa38639e1220a89d4"
},
"1666000229659": {
"events": {
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "approved",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
"0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
"0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "previousAdminRole",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newAdminRole",
"type": "bytes32"
}
],
"name": "RoleAdminChanged",
"type": "event"
},
"0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleGranted",
"type": "event"
},
"0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleRevoked",
"type": "event"
},
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
},
"links": {},
"address": "0xCfEB869F69431e42cdB54A4F4f105C19C080A601",
"transactionHash": "0xc39a5f0c295ac6f70600cbc6eb7ad16c514ece6968d732682870eee3b213dc51"
},
"1666158172944": {
"events": {
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "approved",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
"0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
"0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "previousAdminRole",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newAdminRole",
"type": "bytes32"
}
],
"name": "RoleAdminChanged",
"type": "event"
},
"0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleGranted",
"type": "event"
},
"0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleRevoked",
"type": "event"
},
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
},
"links": {},
"address": "0xCfEB869F69431e42cdB54A4F4f105C19C080A601",
"transactionHash": "0x6a9ff2b76bc76cfc4d2258a59081ec1b86abf027549c28f4849bedf8bfdc61c0"
},
"1666162776163": {
"events": {
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "approved",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
"0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
"0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "previousAdminRole",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newAdminRole",
"type": "bytes32"
}
],
"name": "RoleAdminChanged",
"type": "event"
},
"0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleGranted",
"type": "event"
},
"0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleRevoked",
"type": "event"
},
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
},
"links": {},
"address": "0xCfEB869F69431e42cdB54A4F4f105C19C080A601",
"transactionHash": "0x774588eacaa03afabc3988f8f7f7598344b532d5cc5e1ea749620dd959bed1fa"
},
"1666167438998": {
"events": {
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "approved",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
"0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
"0xbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "previousAdminRole",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newAdminRole",
"type": "bytes32"
}
],
"name": "RoleAdminChanged",
"type": "event"
},
"0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleGranted",
"type": "event"
},
"0xf6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleRevoked",
"type": "event"
},
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": {
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
}
},
"links": {},
"address": "0xCfEB869F69431e42cdB54A4F4f105C19C080A601",
"transactionHash": "0x08cf5e0ace5ed4208125d5aa2f42062b2ab45eadace3036c8072214b208392e9"
} }
}, },
"schemaVersion": "3.4.9", "schemaVersion": "3.4.4",
"updatedAt": "2022-10-14T05:33:23.493Z", "updatedAt": "2022-10-19T08:17:39.621Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

File diff suppressed because one or more lines are too long

View File

@ -25210,10 +25210,34 @@
"links": {}, "links": {},
"address": "0xD86C8F0327494034F60e25074420BcCF560D5610", "address": "0xD86C8F0327494034F60e25074420BcCF560D5610",
"transactionHash": "0x4041919e384d3cc1eafba4b30ac61ff6225c670e53d55fe5549b1c9d4b961045" "transactionHash": "0x4041919e384d3cc1eafba4b30ac61ff6225c670e53d55fe5549b1c9d4b961045"
},
"1666000229659": {
"events": {},
"links": {},
"address": "0x5017A545b09ab9a30499DE7F431DF0855bCb7275",
"transactionHash": "0xe35515b70781b144cb066c6902ac6c3531b410fcd180e3999a7c9bafbc1959d7"
},
"1666158172944": {
"events": {},
"links": {},
"address": "0xFF6049B87215476aBf744eaA3a476cBAd46fB1cA",
"transactionHash": "0x82b79f6f66e86c1b57c6a97d8f7e44a9dcb2627e2379f8b672155fc98b2b6115"
},
"1666162776163": {
"events": {},
"links": {},
"address": "0xFF6049B87215476aBf744eaA3a476cBAd46fB1cA",
"transactionHash": "0x781cf94ceb82099c3fc8c21627a0dfe0e6f42b46d7d1bf5f8f17502177fdf238"
},
"1666167438998": {
"events": {},
"links": {},
"address": "0xFF6049B87215476aBf744eaA3a476cBAd46fB1cA",
"transactionHash": "0x01c0cef2a0eb05f919d10aea894b80b95b5f25b9dc7239f401b845dc1c95b488"
} }
}, },
"schemaVersion": "3.4.4", "schemaVersion": "3.4.4",
"updatedAt": "2022-08-18T03:05:25.364Z", "updatedAt": "2022-10-19T08:18:12.969Z",
"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

View File

@ -3137,6 +3137,12 @@
"version": "0.8.10+commit.fc410830.Emscripten.clang" "version": "0.8.10+commit.fc410830.Emscripten.clang"
}, },
"networks": { "networks": {
"80001": {
"events": {},
"links": {},
"address": "0x5987D5e8b825e9900F9a8BeF5BC131Baa12AC9b2",
"transactionHash": "0xb4fb5a8da86e6099919b786f138251b25f29a0d7e35bede53206e56bb30973e5"
},
"1660724532588": { "1660724532588": {
"events": {}, "events": {},
"links": {}, "links": {},
@ -3196,10 +3202,34 @@
"links": {}, "links": {},
"address": "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550", "address": "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550",
"transactionHash": "0x30f24d0449ca8b6b4cc495fd40367310d34e2eff2128343e47edffbb7f8016fc" "transactionHash": "0x30f24d0449ca8b6b4cc495fd40367310d34e2eff2128343e47edffbb7f8016fc"
},
"1666000229659": {
"events": {},
"links": {},
"address": "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab",
"transactionHash": "0xb19d4c63ac0f239fa6fb374195429d5b6340ea7e332b98146124550a565998bc"
},
"1666158172944": {
"events": {},
"links": {},
"address": "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab",
"transactionHash": "0x667e8095c26b0657402c352fae2437e7f6c17a1bb89538ccb1fe6780357bb933"
},
"1666162776163": {
"events": {},
"links": {},
"address": "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab",
"transactionHash": "0xbe8d93d30cb3ecb356b69cc806ad24a70ced50c134c1e8c4b0ea2609e174879d"
},
"1666167438998": {
"events": {},
"links": {},
"address": "0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab",
"transactionHash": "0x3963c496ad636403fa000de1dd33d0c363f7f3104afa6f2140d13dedaccb56a6"
} }
}, },
"schemaVersion": "3.4.9", "schemaVersion": "3.4.4",
"updatedAt": "2022-10-14T05:33:23.501Z", "updatedAt": "2022-10-19T08:18:12.978Z",
"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

27663
build/contracts/NFT.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -62,7 +62,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -75,7 +76,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -88,7 +90,8 @@
} }
], ],
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function",
"constant": true
}, },
{ {
"inputs": [], "inputs": [],
@ -17993,10 +17996,35 @@
"links": {}, "links": {},
"address": "0x5f8e26fAcC23FA4cbd87b8d9Dbbd33D5047abDE1", "address": "0x5f8e26fAcC23FA4cbd87b8d9Dbbd33D5047abDE1",
"transactionHash": "0x7f7441779b5cddbc5ccab4a56dbb9cc146ed5450d323c3fb37112675839dedf0" "transactionHash": "0x7f7441779b5cddbc5ccab4a56dbb9cc146ed5450d323c3fb37112675839dedf0"
},
"1666000229659": {
"events": {},
"links": {},
"address": "0xaD888d0Ade988EbEe74B8D4F39BF29a8d0fe8A8D",
"transactionHash": "0xc18d82eda291381a6cb3ed436828a460f44aa58b3713ad52633663b6c54d2768"
},
"1666158172944": {
"events": {},
"links": {},
"address": "0xaD888d0Ade988EbEe74B8D4F39BF29a8d0fe8A8D",
"transactionHash": "0x1fc96f300dbd605b279941dbea30eebc46c9114a1617a2d50531e3cdf3f14f98"
},
"1666162776163": {
"events": {},
"links": {},
"address": "0xaD888d0Ade988EbEe74B8D4F39BF29a8d0fe8A8D",
"transactionHash": "0x562d482d2fe93629a1225774615686526dd3b3080d261923b6b7de41c0d32217"
},
"1666167438998": {
"events": {},
"links": {},
"address": "0xaD888d0Ade988EbEe74B8D4F39BF29a8d0fe8A8D",
"transactionHash": "0x4bd1ecc4326c62d4898dd0747b1a01314afed50039fea1b13407790f5936c2c4"
} }
}, },
"schemaVersion": "3.4.4", "schemaVersion": "3.4.4",
"updatedAt": "2022-10-14T05:18:29.794Z", "updatedAt": "2022-10-19T08:18:07.843Z",
"networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",
"methods": { "methods": {

File diff suppressed because one or more lines are too long

View File

@ -119,6 +119,10 @@ contract HasSignature is Ownable, Approval {
* @dev mark signature used * @dev mark signature used
*/ */
function useSignature(bytes calldata signature) public approvaled { function useSignature(bytes calldata signature) public approvaled {
_useSignature(signature);
}
function _useSignature(bytes calldata signature) internal {
if (!_usedSignatures[signature]) { if (!_usedSignatures[signature]) {
_usedSignatures[signature] = true; _usedSignatures[signature] = true;
} }

View File

@ -84,7 +84,7 @@ contract EvolveFactory is Ownable, TimeChecker, Initializable, HasSignature {
amount.asSingletonArray() amount.asSingletonArray()
); );
} }
useSignature(signature); _useSignature(signature);
emit TokenEvolved(to, signArray); emit TokenEvolved(to, signArray);
} }
@ -117,7 +117,7 @@ contract EvolveFactory is Ownable, TimeChecker, Initializable, HasSignature {
); );
checkSigner(executor, criteriaMessageHash, signature); checkSigner(executor, criteriaMessageHash, signature);
chip.burnBatch(to, idsForBurn, amounts); chip.burnBatch(to, idsForBurn, amounts);
useSignature(signature); _useSignature(signature);
emit TokenEvolved(to, tokenIds); emit TokenEvolved(to, tokenIds);
} }

View File

@ -152,7 +152,7 @@ contract MinterFactory is
); );
checkSigner(executor, criteriaMessageHash, signature); checkSigner(executor, criteriaMessageHash, signature);
mint721NFT(to, id, nft); mint721NFT(to, id, nft);
useSignature(signature); _useSignature(signature);
} }
function mint1155BatchByUser( function mint1155BatchByUser(
@ -188,7 +188,7 @@ contract MinterFactory is
); );
checkSigner(executor, criteriaMessageHash, signature); checkSigner(executor, criteriaMessageHash, signature);
mint1155NFTBatch(to, ids, amounts, nft); mint1155NFTBatch(to, ids, amounts, nft);
useSignature(signature); _useSignature(signature);
} }
function shardMixByUser( function shardMixByUser(
@ -233,7 +233,7 @@ contract MinterFactory is
paymentContract.safeTransferFrom(param.to, feeToAddress, param.payAmount); paymentContract.safeTransferFrom(param.to, feeToAddress, param.payAmount);
shard.burnBatch(param.to, ids, amounts); shard.burnBatch(param.to, ids, amounts);
mint721NFT(param.to, param.nftId, nft); mint721NFT(param.to, param.nftId, nft);
useSignature(signature); _useSignature(signature);
} }
function mint721NFT( function mint721NFT(

View File

@ -91,7 +91,7 @@ contract BEBoxMall is Ownable, HasSignature, TimelockController {
require(allowToPayAmount >= price, "BEBoxPayment: Invalid token allowance"); require(allowToPayAmount >= price, "BEBoxPayment: Invalid token allowance");
// Transfer payment // Transfer payment
paymentToken.safeTransferFrom(userAddress, paymentReceivedAddress, price); paymentToken.safeTransferFrom(userAddress, paymentReceivedAddress, price);
useSignature(signature); _useSignature(signature);
// Emit payment event // Emit payment event
emit BEBoxPaid(boxId, userAddress, _type, price, paymentErc20); emit BEBoxPaid(boxId, userAddress, _type, price, paymentErc20);
} }

View File

@ -0,0 +1,216 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/governance/TimelockController.sol";
import "../core/HasSignature.sol";
import "../interfaces/IBEERC721.sol";
import "../interfaces/IBEERC1155.sol";
import "../utils/TimeChecker.sol";
contract BENftMall is Ownable, HasSignature, TimeChecker {
using SafeERC20 for IERC20;
constructor() HasSignature("NftMall", "1") {}
// Supported payment token WETH & list of authorized ERC20
mapping(address => bool) public paymentTokens;
mapping(bytes => bool) public usedSignatures;
mapping(address => bool) public nftTokenSupported;
// Address to receive transaction fee
address public feeToAddress;
// Events
event BuyTransactionBatch(
address indexed buyer,
address[3] addresses,
uint256 price,
uint256[] ids,
uint256[] amounts
);
event BuyTransaction(
address indexed buyer,
uint256 tokenId,
address[3] addresses,
uint256 price
);
event AddNFTSuppout(address nftToken);
event RemoveNFTSuppout(address nftToken);
function setFeeToAddress(address _feeToAddress) external onlyOwner {
require(
_feeToAddress != address(0),
"fee received address can not be zero"
);
feeToAddress = _feeToAddress;
}
function setPaymentTokens(address[] calldata _paymentTokens)
external
onlyOwner
{
for (uint256 i = 0; i < _paymentTokens.length; i++) {
if (paymentTokens[_paymentTokens[i]]) {
continue;
}
paymentTokens[_paymentTokens[i]] = true;
}
}
function removePaymentTokens(address[] calldata _removedPaymentTokens)
external
onlyOwner
{
for (uint256 i = 0; i < _removedPaymentTokens.length; i++) {
paymentTokens[_removedPaymentTokens[i]] = false;
}
}
function addNFTTokenSupport(address nftToken) external onlyOwner {
nftTokenSupported[nftToken] = true;
emit AddNFTSuppout(nftToken);
}
function removeNFTTokenSupport(address nftToken) external onlyOwner {
nftTokenSupported[nftToken] = false;
emit RemoveNFTSuppout(nftToken);
}
function ignoreSignature(
address[3] calldata addresses,
uint256[] calldata signArray,
bytes calldata signature
) external signatureValid(signature) {
bytes32 criteriaMessageHash = getMessageHash(
addresses[1],
addresses[2],
signArray
);
checkSigner(_msgSender(), criteriaMessageHash, signature);
_useSignature(signature);
}
/**
* @dev Function matched transaction with user signatures
*/
function buy721NFT(
address[3] calldata addresses,
uint256[4] calldata values,
bytes calldata signature
) external signatureValid(signature) timeValid(values[3]) {
// address[3] [seller_address,nft_address,payment_token_address]
// uint256[4] [token_id,price,salt_nonce,startTime]
// bytes seller_signature
require(nftTokenSupported[addresses[1]], "BENftMall: Unsupported NFT");
require(paymentTokens[addresses[2]], "BENftMall: invalid payment method");
uint256[] memory signArray = new uint256[](values.length);
address to = _msgSender();
for (uint256 i = 0; i < values.length; ++i) {
signArray[i] = values[i];
}
bytes32 criteriaMessageHash = getMessageHash(
addresses[1],
addresses[2],
signArray
);
checkSigner(addresses[0], criteriaMessageHash, signature);
// Check payment approval and buyer balance
IERC20 paymentContract = IERC20(addresses[2]);
require(
paymentContract.balanceOf(to) >= values[1],
"BENftMall: buyer doesn't have enough token to buy this item"
);
require(
paymentContract.allowance(to, address(this)) >= values[1],
"BENftMall: buyer doesn't approve marketplace to spend payment amount"
);
paymentContract.safeTransferFrom(to, feeToAddress, values[1]);
// mint item to user
IBEERC721 nft = IBEERC721(addresses[1]);
nft.mint(to, values[0]);
_useSignature(signature);
// emit sale event
emit BuyTransaction(to, values[0], addresses, values[1]);
}
function buy1155NFT(
address[3] calldata addresses,
uint256[3] calldata values,
uint256[] memory ids,
uint256[] memory amounts,
bytes calldata signature
) external signatureValid(signature) timeValid(values[2]) {
// address[3] [seller_address,nft_address,payment_token_address]
// uint256[3] [price,salt_nonce,startTime]
require(nftTokenSupported[addresses[1]], "BENftMall: Unsupported NFT");
require(paymentTokens[addresses[2]], "BENftMall: invalid payment method");
require(ids.length > 0, "BENftMall: ids cannot be empty");
require(
ids.length == amounts.length,
"BENftMall: ids and amounts length mismatch"
);
IBEERC1155 nft = IBEERC1155(addresses[1]);
uint256[] memory signArray = new uint256[](ids.length * 2 + values.length);
for (uint256 i = 0; i < ids.length; ++i) {
require(
nft.canMint(ids[i]),
"BENftMall: can not mint for current nft rule setting"
);
signArray[i * 2] = ids[i];
signArray[i * 2 + 1] = amounts[i];
}
for (uint256 i = 0; i < values.length; ++i) {
signArray[ids.length * 2 + i] = values[i];
}
address to = _msgSender();
bytes32 criteriaMessageHash = getMessageHash(
addresses[1],
addresses[2],
signArray
);
checkSigner(addresses[0], criteriaMessageHash, signature);
// Check payment approval and buyer balance
IERC20 paymentContract = IERC20(addresses[2]);
require(
paymentContract.balanceOf(to) >= values[0],
"BENftMall: buyer doesn't have enough token to buy this item"
);
require(
paymentContract.allowance(to, address(this)) >= values[0],
"BENftMall: buyer doesn't approve marketplace to spend payment amount"
);
paymentContract.safeTransferFrom(to, feeToAddress, values[0]);
nft.mintBatch(to, ids, amounts, "");
_useSignature(signature);
emit BuyTransactionBatch(to, addresses, values[0], ids, amounts);
}
function getMessageHash(
address _nftAddress,
address _tokenAddress,
uint256[] memory _datas
) public pure returns (bytes32) {
bytes memory encoded = abi.encodePacked(
_nftAddress,
_tokenAddress
);
uint256 len = _datas.length;
for (uint256 i = 0; i < len; ++i) {
encoded = bytes.concat(encoded, abi.encodePacked(_datas[i]));
}
return keccak256(encoded);
}
}

View File

@ -93,7 +93,7 @@ contract MarketPlace is Ownable, HasSignature {
); );
checkSigner(_msgSender(), criteriaMessageHash, signature); checkSigner(_msgSender(), criteriaMessageHash, signature);
useSignature(signature); _useSignature(signature);
} }
/** /**
@ -156,7 +156,7 @@ contract MarketPlace is Ownable, HasSignature {
// transfer item to buyer // transfer item to buyer
nft.safeTransferFrom(addresses[0], _msgSender(), values[0]); nft.safeTransferFrom(addresses[0], _msgSender(), values[0]);
useSignature(signature); _useSignature(signature);
// emit sale event // emit sale event
emitEvent(addresses, values); emitEvent(addresses, values);
return true; return true;

View File

@ -10,6 +10,7 @@ const MinterFactory = artifacts.require("logic/MinterFactory");
const UserMinterFactory = artifacts.require("logic/UserMinterFactory"); const UserMinterFactory = artifacts.require("logic/UserMinterFactory");
const EvolveFactory = artifacts.require("logic/EvolveFactory"); const EvolveFactory = artifacts.require("logic/EvolveFactory");
const UserEvolveFactory = artifacts.require("logic/UserEvolveFactory"); const UserEvolveFactory = artifacts.require("logic/UserEvolveFactory");
const NftMall = artifacts.require("market/BENftMall");
// const BETimelockController = artifacts.require('core/BETimelockController') // const BETimelockController = artifacts.require('core/BETimelockController')
module.exports = async function main(callback) { module.exports = async function main(callback) {
@ -28,6 +29,7 @@ module.exports = async function main(callback) {
const userProxyInstance = await UserEvolveFactory.deployed(); const userProxyInstance = await UserEvolveFactory.deployed();
const coinInstance = await BECoin.deployed(); const coinInstance = await BECoin.deployed();
const goldInstance = await BEGold.deployed(); const goldInstance = await BEGold.deployed();
const nftMallInstance = await NftMall.deployed();
let jsons = []; let jsons = [];
jsons.push({ jsons.push({
name: "coin", name: "coin",
@ -86,6 +88,11 @@ module.exports = async function main(callback) {
json: "assets/contracts/BEShard.json", json: "assets/contracts/BEShard.json",
address: shardInstance.address, address: shardInstance.address,
}); });
jsons.push({
name: "nftMall",
json: "assets/contracts/BENftMall.json",
address: nftMallInstance.address,
});
console.log(JSON.stringify(jsons)); console.log(JSON.stringify(jsons));
console.log(`export const userAddress = '${accounts[0]}';`); console.log(`export const userAddress = '${accounts[0]}';`);
console.log(`export const privateKey = '';`); console.log(`export const privateKey = '';`);

View File

@ -1,96 +1,99 @@
const BEHero = artifacts.require('tokens/erc721/BEHero') const BEHero = artifacts.require("tokens/erc721/BEHero");
const BEEquipment = artifacts.require('tokens/erc721/BEEquipment') const BEEquipment = artifacts.require("tokens/erc721/BEEquipment");
const BECoin = artifacts.require('tokens/erc20/BECoin') const BECoin = artifacts.require("tokens/erc20/BECoin");
const BEGold = artifacts.require('tokens/erc20/BEGold') const BEGold = artifacts.require("tokens/erc20/BEGold");
const BEChip1155 = artifacts.require('tokens/erc1155/BEChip1155') const BEChip1155 = artifacts.require("tokens/erc1155/BEChip1155");
const BEShard = artifacts.require('tokens/erc1155/BEShard') const BEShard = artifacts.require("tokens/erc1155/BEShard");
const MarketPlace = artifacts.require('market/MarketPlace') const MarketPlace = artifacts.require("market/MarketPlace");
// const BEBoxMall = artifacts.require('market/BEBoxMall') // const BEBoxMall = artifacts.require('market/BEBoxMall')
const MinterFactory = artifacts.require('logic/MinterFactory') const MinterFactory = artifacts.require("logic/MinterFactory");
const UserMinterFactory = artifacts.require('logic/UserMinterFactory') const UserMinterFactory = artifacts.require("logic/UserMinterFactory");
const EvolveFactory = artifacts.require('logic/EvolveFactory') const EvolveFactory = artifacts.require("logic/EvolveFactory");
const UserEvolveFactory = artifacts.require('logic/UserEvolveFactory') const UserEvolveFactory = artifacts.require("logic/UserEvolveFactory");
const NftMall = artifacts.require("market/BENftMall");
const config = require('../config/config') const config = require("../config/config");
module.exports = async function main(callback) { module.exports = async function main(callback) {
try { try {
// Our code will go here // Our code will go here
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts();
console.log(accounts) console.log(accounts);
const heroInstance = await BEHero.deployed() const heroInstance = await BEHero.deployed();
const equipInstance = await BEEquipment.deployed() const equipInstance = await BEEquipment.deployed();
const chipInstance = await BEChip1155.deployed() const chipInstance = await BEChip1155.deployed();
const shardInstance = await BEShard.deployed() const shardInstance = await BEShard.deployed();
const coinInstance = await BECoin.deployed();
config.market.paymentTokens.push(coinInstance.address);
await heroInstance.updateBaseURI(config.token.baseTokenURI) await heroInstance.updateBaseURI(config.token.baseTokenURI);
console.log("BEHero baseURI update success.") console.log("BEHero baseURI update success.");
await equipInstance.updateBaseURI(config.token.baseTokenURI) await equipInstance.updateBaseURI(config.token.baseTokenURI);
console.log("Equip baseURI update success.") console.log("Equip baseURI update success.");
const marketInstance = await MarketPlace.deployed();
const marketInstance = await MarketPlace.deployed()
const coinInstance = await BECoin.deployed()
if (marketInstance) { if (marketInstance) {
await marketInstance.setFeeToAddress(config.market.feeToAddress) await marketInstance.setFeeToAddress(config.market.feeToAddress);
await marketInstance.setTransactionFee(400) await marketInstance.setTransactionFee(400);
config.market.paymentTokens.push(coinInstance.address) await marketInstance.setPaymentTokens(config.market.paymentTokens);
await marketInstance.setPaymentTokens(config.market.paymentTokens) console.log(`finish update market config`);
console.log(`finish update market config`)
await heroInstance.grantLockRole(marketInstance.address) await heroInstance.grantLockRole(marketInstance.address);
await heroInstance.setApprovalForAll(marketInstance.address, true) await heroInstance.setApprovalForAll(marketInstance.address, true);
console.log('finish heroInstance.addApprovalWhitelist') console.log("finish heroInstance.addApprovalWhitelist");
await equipInstance.grantLockRole(marketInstance.address) await equipInstance.grantLockRole(marketInstance.address);
await equipInstance.setApprovalForAll(marketInstance.address, true) await equipInstance.setApprovalForAll(marketInstance.address, true);
console.log('finish equipInstance.addApprovalWhitelist') console.log("finish equipInstance.addApprovalWhitelist");
await chipInstance.grantLockRole(marketInstance.address) await chipInstance.grantLockRole(marketInstance.address);
await chipInstance.setApprovalForAll(marketInstance.address, true) await chipInstance.setApprovalForAll(marketInstance.address, true);
console.log('finish chipInstance.addApprovalWhitelist') console.log("finish chipInstance.addApprovalWhitelist");
await heroInstance.grantLockRole(config.admins.admin) await heroInstance.grantLockRole(config.admins.admin);
await equipInstance.grantLockRole(config.admins.admin) await equipInstance.grantLockRole(config.admins.admin);
await chipInstance.grantLockRole(config.admins.admin) await chipInstance.grantLockRole(config.admins.admin);
await shardInstance.grantLockRole(config.admins.admin) await shardInstance.grantLockRole(config.admins.admin);
console.log(`Allow operation ${marketInstance.address} to reduce gas fee`) console.log(
`Allow operation ${marketInstance.address} to reduce gas fee`
);
} }
const factoryInstance = await MinterFactory.deployed() const factoryInstance = await MinterFactory.deployed();
if (!factoryInstance) { if (!factoryInstance) {
console.error('no factoryInstance') console.error("no factoryInstance");
return return;
} }
await factoryInstance.init([ await factoryInstance.init([
heroInstance.address, heroInstance.address,
equipInstance.address, equipInstance.address,
chipInstance.address, chipInstance.address,
shardInstance.address shardInstance.address,
]) ]);
await factoryInstance.setFeeToAddress(config.market.feeToAddress) await factoryInstance.setFeeToAddress(config.market.feeToAddress);
await factoryInstance.updateExecutor(config.admins.admin) await factoryInstance.updateExecutor(config.admins.admin);
await heroInstance.setMintFactory(factoryInstance.address) await heroInstance.setMintFactory(factoryInstance.address);
await equipInstance.setMintFactory(factoryInstance.address) await equipInstance.setMintFactory(factoryInstance.address);
await chipInstance.setMintFactory(factoryInstance.address) await chipInstance.setMintFactory(factoryInstance.address);
await shardInstance.setMintFactory(factoryInstance.address) await shardInstance.setMintFactory(factoryInstance.address);
console.log( console.log(
`Allow factory ${factoryInstance.address} to mint contract \n hero: ${heroInstance.address}, \n equip: ${equipInstance.address}, \n chip: ${chipInstance.address}`, `Allow factory ${factoryInstance.address} to mint contract \n hero: ${heroInstance.address}, \n equip: ${equipInstance.address}, \n chip: ${chipInstance.address}`
) );
await heroInstance.grantBurnRole(factoryInstance.address) await heroInstance.grantBurnRole(factoryInstance.address);
await equipInstance.grantBurnRole(factoryInstance.address) await equipInstance.grantBurnRole(factoryInstance.address);
await chipInstance.grantBurnRole(factoryInstance.address) await chipInstance.grantBurnRole(factoryInstance.address);
await shardInstance.grantBurnRole(factoryInstance.address) await shardInstance.grantBurnRole(factoryInstance.address);
console.log( console.log(
`Allow factory ${factoryInstance.address} to burn contract \n hero: ${heroInstance.address}, \n equip: ${equipInstance.address}, \n chip: ${chipInstance.address}`, `Allow factory ${factoryInstance.address} to burn contract \n hero: ${heroInstance.address}, \n equip: ${equipInstance.address}, \n chip: ${chipInstance.address}`
) );
const userFactoryInstance = await UserMinterFactory.deployed() const userFactoryInstance = await UserMinterFactory.deployed();
if (!userFactoryInstance) { if (!userFactoryInstance) {
console.error('no userFactoryInstance') console.error("no userFactoryInstance");
return return;
} }
await factoryInstance.addApprovalList(userFactoryInstance.address); await factoryInstance.addApprovalList(userFactoryInstance.address);
await userFactoryInstance.init([ await userFactoryInstance.init([
@ -98,48 +101,57 @@ module.exports = async function main(callback) {
equipInstance.address, equipInstance.address,
chipInstance.address, chipInstance.address,
shardInstance.address, shardInstance.address,
factoryInstance.address factoryInstance.address,
]) ]);
const proxyInstance = await EvolveFactory.deployed() const proxyInstance = await EvolveFactory.deployed();
if (!proxyInstance) { if (!proxyInstance) {
console.error('no proxyInstance') console.error("no proxyInstance");
return return;
} }
await proxyInstance.init( await proxyInstance.init(chipInstance.address);
chipInstance.address, await proxyInstance.updateExecutor(config.admins.admin);
) await heroInstance.grantBurnRole(proxyInstance.address);
await proxyInstance.updateExecutor(config.admins.admin) await equipInstance.grantBurnRole(proxyInstance.address);
await heroInstance.grantBurnRole(proxyInstance.address) await chipInstance.grantBurnRole(proxyInstance.address);
await equipInstance.grantBurnRole(proxyInstance.address)
await chipInstance.grantBurnRole(proxyInstance.address)
console.log( console.log(
`Allow proxy ${proxyInstance.address} to burn contract \n hero: ${heroInstance.address}, \n equip: ${equipInstance.address}, \n chip: ${chipInstance.address}`, `Allow proxy ${proxyInstance.address} to burn contract \n hero: ${heroInstance.address}, \n equip: ${equipInstance.address}, \n chip: ${chipInstance.address}`
) );
const userProxyInstance = await UserEvolveFactory.deployed() const userProxyInstance = await UserEvolveFactory.deployed();
if (!userProxyInstance) { if (!userProxyInstance) {
console.error('no userProxyInstance') console.error("no userProxyInstance");
return return;
} }
await proxyInstance.addApprovalList(userProxyInstance.address); await proxyInstance.addApprovalList(userProxyInstance.address);
await userProxyInstance.init([ await userProxyInstance.init([
heroInstance.address, heroInstance.address,
equipInstance.address, equipInstance.address,
proxyInstance.address proxyInstance.address,
]) ]);
// const boxInstance = await BEBoxMall.deployed() // const boxInstance = await BEBoxMall.deployed();
// if (!boxInstance) { // if (!boxInstance) {
// console.error('no boxInstance') // console.error("no boxInstance");
// return // return;
// } // }
// await boxInstance.setPaymentReceivedAddress(config.market.mallFeeAddress) // await boxInstance.setPaymentReceivedAddress(config.market.mallFeeAddress);
// console.log( // console.log(
// `update payment received address: ${config.market.mallFeeAddress}`, // `update payment received address: ${config.market.mallFeeAddress}`
// ) // );
callback(0) const nftMallInstance = await NftMall.deployed();
if (nftMallInstance) {
await nftMallInstance.setFeeToAddress(config.market.feeToAddress);
await nftMallInstance.setPaymentTokens(config.market.paymentTokens);
await nftMallInstance.addNFTTokenSupport(heroInstance.address);
await nftMallInstance.addNFTTokenSupport(equipInstance.address);
await nftMallInstance.addNFTTokenSupport(chipInstance.address);
await heroInstance.setMintFactory(nftMallInstance.address);
await equipInstance.setMintFactory(nftMallInstance.address);
await chipInstance.setMintFactory(nftMallInstance.address);
}
callback(0);
} catch (error) { } catch (error) {
console.error(error) console.error(error);
callback(1) callback(1);
} }
} };

View File

@ -0,0 +1,9 @@
const NftMall = artifacts.require("market/BENftMall");
module.exports = async function (deployer, network, accounts) {
await deployer.deploy(NftMall);
const mallInstance = await NftMall.deployed();
if (mallInstance) {
console.log("BENftMall successfully deployed.");
}
};