update abi
This commit is contained in:
parent
b307d91181
commit
bf299d01dc
@ -45792,8 +45792,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0xacB3075E4a4D73975ADe7bFb0ee073f9A65B9e71",
|
"address": "0x0149578B6d77fA67246045fCAF26e4B57eebb428",
|
||||||
"transactionHash": "0xfdc8db75424dac8814419cb31b0c8ab1aabbe5e052b18ae0d0999554b509cf95"
|
"transactionHash": "0xff80af7a37cb2088898d24e6e735147dc17869d6734e998c96a51ea237398dc6"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -45881,7 +45881,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:52:55.130Z",
|
"updatedAt": "2022-11-08T03:32:41.958Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -29441,8 +29441,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0x4224e050d750D73BBcB44dF150BeD20782D14517",
|
"address": "0xCC4D016aB77E28653bdce1098077bE5923077980",
|
||||||
"transactionHash": "0x79cb3fa7e130a9239883c40aaab2cbf6a5fbbfb17493aae886d8adc57eac4b9a"
|
"transactionHash": "0x5c00fc854dcf2020984635493bb4f6c55ef45a800a00d420a11387c2df49d4ed"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -29530,7 +29530,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:52:38.619Z",
|
"updatedAt": "2022-11-08T03:32:20.349Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -9689,8 +9689,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0x5b7049439A17118a799899648772322F1A1fDD82",
|
"address": "0x8cc94094329e2397f176b9a3415a9A6EB66F3746",
|
||||||
"transactionHash": "0xb74872d59451b3b4e7402ae4da9c579fed3054398f0ab449977dcfcd13d5643d"
|
"transactionHash": "0xe6ac1d7a6dbd4bdbc485e804f310e6ffb16ae93b982e8cc63f8fff29d625a230"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -9778,7 +9778,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:52:25.694Z",
|
"updatedAt": "2022-11-08T03:32:04.142Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -22482,8 +22482,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0x47d074d592F3012111341cD93eFaC625E0029508",
|
"address": "0x71E02441209d3dd9Ed064A4E4EafAf90D0263088",
|
||||||
"transactionHash": "0x3673bde62486015c6218130ac2303bbe3e33bb69efc3c0ded7c4036ba63d775c"
|
"transactionHash": "0xdab6e136f65f206b2ef43a26ffbad2fdd0dca0fdba808fe7fb7af38f77b9da90"
|
||||||
},
|
},
|
||||||
"1660724532588": {
|
"1660724532588": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -22565,7 +22565,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:52:35.953Z",
|
"updatedAt": "2022-11-08T03:32:16.802Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -11782,8 +11782,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0x9a88ad1751530C3719C05423be626950De700F57",
|
"address": "0x1E5Ead93c911450036a8312C25B5211b728F96D5",
|
||||||
"transactionHash": "0x4efd0ce94b6f1eea3f9edaae033891ea0cbda94ef5f4268e0a5243cbf277c2ae"
|
"transactionHash": "0xc2931018c9e416c7bba2d8d57d120ec13a47dea705d39d8aeee8cbced4525cd5"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -11871,7 +11871,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:52:29.311Z",
|
"updatedAt": "2022-11-08T03:32:08.442Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -22482,8 +22482,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0xEa3066bAA418c21586E64737F406C2bd3c672B13",
|
"address": "0xfeaD3d6e2fA0f92551375fa985006ffc6ac07E18",
|
||||||
"transactionHash": "0x0d0c94625622068e59393280fb5134b2793512a3ff00facd4e8f5a3ed0ab8b71"
|
"transactionHash": "0xca5a1d6695fa971b3124a4558040ba53155e91043060808ef5d49e38a2820b4f"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -22571,7 +22571,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:52:32.694Z",
|
"updatedAt": "2022-11-08T03:32:12.568Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -45866,8 +45866,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0xc25F2EaaD3e3619Cf9a4A1D32D71D3529fd66Fd3",
|
"address": "0xfd30B6e495CC375Bd98d01BD959F741Dd2772d64",
|
||||||
"transactionHash": "0xc592446a967ff61547e3c3c50fc1ab55cb5c1e092238b35e68932f988381c6eb"
|
"transactionHash": "0xe3574a4905a04c79fbcda5e4285c50552d8813daae073ce9d0940472a32f7602"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -46009,7 +46009,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:53:04.363Z",
|
"updatedAt": "2022-11-08T03:32:53.714Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -25276,8 +25276,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0x3e894E768303d2fbC624Bc64c4214878Ba9B26d4",
|
"address": "0x0433f2445F5F0Ef09a4Aeab19C6C8F80b4893671",
|
||||||
"transactionHash": "0x86aae359c3c60c7a57a2a3d275e8c45fda9c4f674ca30221f3163edadb664173"
|
"transactionHash": "0x246dd07aef021a864cb22a0651d2722f5a74a5dc80633cfd5000a9e493925fbb"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {
|
"events": {
|
||||||
@ -26337,7 +26337,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:52:22.594Z",
|
"updatedAt": "2022-11-08T03:32:00.203Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -28836,8 +28836,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0x96529E502f1cCf6Ae74BBD81236EB85F1d54Dc71",
|
"address": "0xFD3C3E25E7E30921Bf1B4D1D55fbb97Bc43Ac8B8",
|
||||||
"transactionHash": "0xee3bc7d90520e5539b9f6362544f322bce10450cc60533038c14198b1f54ed51"
|
"transactionHash": "0xa47aa2f728e002260f43e3aa98c08a3db5b2218a4ccc82aa8eb93ffec967b64c"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -28925,7 +28925,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:52:42.109Z",
|
"updatedAt": "2022-11-08T03:32:24.825Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -25354,8 +25354,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0x2A7B5fD271dd876f545d5c0b8E38f16e6aD25b95",
|
"address": "0xFE9550608e2acF01694524b1F94d937DfDe806C2",
|
||||||
"transactionHash": "0x2800aac6e490742d5f3ce283023107a651956b0b083edc6c5b5935fa18c8f6a5"
|
"transactionHash": "0x4ed158c9024710f650544cebc289c022fca2dad9710918436acb5a44b90392e8"
|
||||||
},
|
},
|
||||||
"1660724532588": {
|
"1660724532588": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -25437,7 +25437,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:53:11.594Z",
|
"updatedAt": "2022-11-08T03:33:01.941Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -33369,8 +33369,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0x720152c0ad3920fB6fF85D9e38AE13dB60031351",
|
"address": "0xb2287CA4A461A9bB73817Fdd38fD14b59b8Fb714",
|
||||||
"transactionHash": "0x9c0ec8a7f255182eecd6553665ccc79f9eedec97abd8f3e7ff13f2039df7d0a9"
|
"transactionHash": "0x8c6b85a8b70b98a4551f3a0807dcbed10b781eb02df591f11fbce5a137339ccf"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -33458,7 +33458,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:53:00.346Z",
|
"updatedAt": "2022-11-08T03:32:49.817Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -33780,8 +33780,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0x5023deB3F76D484102c9650933541a90B528CBFF",
|
"address": "0x0B6fc157C83a9A5a64776E2183959f75180eFF27",
|
||||||
"transactionHash": "0x515005fd56b32ac740fc982b76f43e7c7fa4489102595554f5e6a30ff8023221"
|
"transactionHash": "0x8de72ea3cf876ba02fe5653b85baa576944f7bf26205277507ce82c9ec3d6a3b"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -33869,7 +33869,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:52:50.954Z",
|
"updatedAt": "2022-11-08T03:32:35.716Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -3140,8 +3140,8 @@
|
|||||||
"1338": {
|
"1338": {
|
||||||
"events": {},
|
"events": {},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0x9790810BAF941AB05693BAF8282736Cd2f1A8dEe",
|
"address": "0x466cbd8c8EB83Cd86ec2eE624E76D928507FcA68",
|
||||||
"transactionHash": "0xd89d42967317cad016b2340c592d64fde4f700dd0f0bac1ca05e6ecfb5957004"
|
"transactionHash": "0x630e05f27c45b59e0d723082985e6d2cc86f2c73a6acf35c91b2dbdbc15bd4f4"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -3235,7 +3235,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:53:11.602Z",
|
"updatedAt": "2022-11-08T03:33:01.949Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -56879,8 +56879,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0x1aC5Cf9D277175E8350CF75d65bE8ADaf58B9394",
|
"address": "0xba5b7E64bae1f953816B9f3a7de6B5b5378F9Fb8",
|
||||||
"transactionHash": "0xa64491dcc3e0823c3c6c78ce1b04bdd6d6f80da00f8395c2e0e4c05d8b2daaac"
|
"transactionHash": "0x512337f84f0d107112cf6dd31ad4ce4981f7d9efe391b7a57917b9ed911a9b98"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -56968,7 +56968,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:52:47.399Z",
|
"updatedAt": "2022-11-08T03:32:31.110Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
File diff suppressed because one or more lines are too long
@ -14817,8 +14817,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0x8A0446aA91aadaF9EC89b5E664145f8bb2FF4d6B",
|
"address": "0x3Cc7B9a386410858B412B00B13264654F68364Ed",
|
||||||
"transactionHash": "0x0d97d3507ba6428700ca4b014c1120ce7756aaff50e60c59c96051bf9cd3f6e7"
|
"transactionHash": "0x8232bda48717cc2269a286f6f10733d7d6875c3d9a05401f4ec8065bd3df0229"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -14906,7 +14906,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:53:00.382Z",
|
"updatedAt": "2022-11-08T03:32:49.837Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -28553,8 +28553,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"links": {},
|
"links": {},
|
||||||
"address": "0xbe74Dd781E1A3fAb6554A4934132649A5b858541",
|
"address": "0x55Db01E043a48bc0d11037c51E3911A9Eb8dbe24",
|
||||||
"transactionHash": "0x273a4504a607cd705b1c77464bfe5fa575c90db2bf0573a77bbf5aebfebac70c"
|
"transactionHash": "0xd4cf3be4662df69cf16ef22dde26c6e7601bc87299d35d22bf1b0479e1d71cbd"
|
||||||
},
|
},
|
||||||
"80001": {
|
"80001": {
|
||||||
"events": {},
|
"events": {},
|
||||||
@ -28642,7 +28642,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schemaVersion": "3.4.9",
|
"schemaVersion": "3.4.9",
|
||||||
"updatedAt": "2022-11-04T06:52:47.423Z",
|
"updatedAt": "2022-11-08T03:32:31.130Z",
|
||||||
"networkType": "ethereum",
|
"networkType": "ethereum",
|
||||||
"devdoc": {
|
"devdoc": {
|
||||||
"kind": "dev",
|
"kind": "dev",
|
||||||
|
@ -6,33 +6,39 @@ import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
|
|||||||
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
|
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
|
||||||
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
|
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
|
||||||
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
||||||
|
import "../core/HasSignature.sol";
|
||||||
|
import "../utils/TimeChecker.sol";
|
||||||
import "../interfaces/IBEERC1155.sol";
|
import "../interfaces/IBEERC1155.sol";
|
||||||
import "../interfaces/IBEERC721.sol";
|
import "../interfaces/IBEERC721.sol";
|
||||||
|
|
||||||
contract NftChipLocker is Ownable, ERC1155Holder{
|
contract NftChipLocker is Ownable, ERC1155Holder, HasSignature, TimeChecker{
|
||||||
mapping(address => bool) public nftTokenSupported;
|
mapping(address => bool) public nftTokenSupported;
|
||||||
using EnumerableSet for EnumerableSet.UintSet;
|
using EnumerableSet for EnumerableSet.UintSet;
|
||||||
uint256 public constant MAX_CHIP_NUM = 4;
|
uint256 public constant MAX_CHIP_NUM = 4;
|
||||||
|
|
||||||
|
constructor() HasSignature("NftChipLocker", "1") {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nft address => chip address => nftid => chip tokenid
|
* nft address => chip address => nftid => slot => chip tokenid
|
||||||
*/
|
*/
|
||||||
mapping( address => mapping(address => mapping(uint256 => EnumerableSet.UintSet))) chipPlugined;
|
mapping( address => mapping(address => mapping(uint256 => mapping(uint256 => uint256)))) chipPlugined;
|
||||||
/**
|
/**
|
||||||
* nft address => chip address => chip tokenid => nftid
|
* nft address => chip address => chip tokenid => nftid
|
||||||
*/
|
*/
|
||||||
mapping( address => mapping(address => mapping(uint256 => uint256))) chipOwner;
|
mapping( address => mapping(address => mapping(uint256 => uint256))) chipOwner;
|
||||||
|
|
||||||
event ChipPlugin(
|
event ChipPlugin(
|
||||||
address nft,
|
address indexed nft,
|
||||||
uint256 nftId,
|
uint256 indexed nftId,
|
||||||
|
uint256 indexed nonce,
|
||||||
address chip,
|
address chip,
|
||||||
uint256[] ids
|
uint256[] ids
|
||||||
);
|
);
|
||||||
|
|
||||||
event ChipUnplug(
|
event ChipUnplug(
|
||||||
address nft,
|
address indexed nft,
|
||||||
uint256 nftId,
|
uint256 indexed nftId,
|
||||||
|
uint256 indexed nonce,
|
||||||
address chip,
|
address chip,
|
||||||
uint256[] ids
|
uint256[] ids
|
||||||
);
|
);
|
||||||
@ -45,55 +51,111 @@ contract NftChipLocker is Ownable, ERC1155Holder{
|
|||||||
nftTokenSupported[nftToken] = false;
|
nftTokenSupported[nftToken] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pluginChip(address nft, address chip, uint256 nftId, uint256[] memory chipIds)
|
function pluginChip(
|
||||||
external
|
address[3] calldata addresses,
|
||||||
|
uint256[3] calldata values,
|
||||||
|
uint256[] memory chipIds,
|
||||||
|
uint256[] memory chipSlot,
|
||||||
|
bytes calldata signature
|
||||||
|
)
|
||||||
|
external signatureValid(signature) timeValid(values[2])
|
||||||
{
|
{
|
||||||
require(nftTokenSupported[nft], "NftChipLocker: Unsupported NFT");
|
// addresses[2] [nft, chip, svr_address]
|
||||||
require(nftTokenSupported[chip], "NftChipLocker: Unsupported Chip");
|
// uint256[3] [token_id,salt_nonce,startTime]
|
||||||
require(!IBEERC721(nft).isLocked(nftId), "NftChipLocker: Can not pluin chip to locked token");
|
require(chipIds.length == chipSlot.length, "NftChipLocker: chip id and index mislength");
|
||||||
require(IERC721(nft).ownerOf(nftId) == msg.sender, "NftChipLocker: not owner of this nft now");
|
require(chipIds.length <= MAX_CHIP_NUM, "NftChipLocker: chip num reach max allow");
|
||||||
|
require(nftTokenSupported[addresses[0]], "NftChipLocker: Unsupported NFT");
|
||||||
|
require(nftTokenSupported[addresses[1]], "NftChipLocker: Unsupported Chip");
|
||||||
|
require(!IBEERC721(addresses[0]).isLocked(values[0]), "NftChipLocker: Can not pluin chip to locked token");
|
||||||
|
require(IERC721(addresses[0]).ownerOf(values[0]) == msg.sender, "NftChipLocker: not owner of this nft now");
|
||||||
|
|
||||||
uint256 len = chipIds.length;
|
uint256[] memory signArray = new uint256[](values.length + chipIds.length * 2);
|
||||||
uint256 currentNum = chipPlugined[nft][chip][nftId].length();
|
|
||||||
require(len + currentNum <= MAX_CHIP_NUM, "NftChipLocker: reach max chip num");
|
for (uint256 i = 0; i < values.length; ++i ) {
|
||||||
uint256[] memory amounts = new uint256[](len);
|
signArray[i] = values[i];
|
||||||
for (uint256 i = 0; i < len; ++i) {
|
}
|
||||||
|
|
||||||
|
uint256[] memory amounts = new uint256[](chipIds.length);
|
||||||
|
for (uint256 i = 0; i < chipIds.length; ++i) {
|
||||||
require(
|
require(
|
||||||
IERC1155(chip).balanceOf(msg.sender, chipIds[i]) > 0,
|
chipSlot[i] < MAX_CHIP_NUM,
|
||||||
|
"NftChipLocker: slot error"
|
||||||
|
);
|
||||||
|
require(
|
||||||
|
IERC1155(addresses[1]).balanceOf(msg.sender, chipIds[i]) > 0,
|
||||||
"NftChipLocker: not enough chip"
|
"NftChipLocker: not enough chip"
|
||||||
);
|
);
|
||||||
require(
|
require(
|
||||||
!IBEERC1155(chip).isLocked(chipIds[i]),
|
!IBEERC1155(addresses[1]).isLocked(chipIds[i]),
|
||||||
"NftChipLocker: chip is locked"
|
"NftChipLocker: chip is locked"
|
||||||
);
|
);
|
||||||
chipPlugined[nft][chip][nftId].add(chipIds[i]);
|
require(
|
||||||
chipOwner[nft][chip][chipIds[i]] = nftId;
|
chipPlugined[addresses[0]][addresses[1]][values[0]][chipSlot[i]] == 0,
|
||||||
|
"NftChipLocker: slot already plugined"
|
||||||
|
);
|
||||||
|
|
||||||
|
chipPlugined[addresses[0]][addresses[1]][values[0]][chipSlot[i]] = chipIds[i];
|
||||||
|
chipOwner[addresses[0]][addresses[1]][chipIds[i]] = values[0];
|
||||||
amounts[i] = 1;
|
amounts[i] = 1;
|
||||||
|
signArray[values.length + 2 * i] = chipIds[i];
|
||||||
|
signArray[values.length + 2 * i + 1] = chipSlot[i];
|
||||||
}
|
}
|
||||||
IERC1155(chip).safeBatchTransferFrom(msg.sender, address(this), chipIds, amounts, "");
|
bytes32 criteriaMessageHash = getMessageHash(
|
||||||
emit ChipPlugin(nft, nftId, chip, chipIds);
|
addresses[0],
|
||||||
|
addresses[1],
|
||||||
|
_msgSender(),
|
||||||
|
signArray
|
||||||
|
);
|
||||||
|
checkSigner(addresses[2], criteriaMessageHash, signature);
|
||||||
|
IERC1155(addresses[1]).safeBatchTransferFrom(msg.sender, address(this), chipIds, amounts, "");
|
||||||
|
_useSignature(signature);
|
||||||
|
emit ChipPlugin(addresses[0], values[0], values[1], addresses[1], chipIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
function unplugChip(address nft, address chip, uint256 nftId, uint256[] memory chipIds)
|
function unplugChip(
|
||||||
external
|
address[3] calldata addresses,
|
||||||
|
uint256[3] calldata values,
|
||||||
|
uint256[] memory chipIds,
|
||||||
|
uint256[] memory chipSlot,
|
||||||
|
bytes calldata signature
|
||||||
|
)
|
||||||
|
external signatureValid(signature) timeValid(values[2])
|
||||||
{
|
{
|
||||||
require(nftTokenSupported[nft], "NftChipLocker: Unsupported NFT");
|
// addresses[2] [nftId, chip]
|
||||||
require(nftTokenSupported[chip], "NftChipLocker: Unsupported Chip");
|
// uint256[3] [token_id,salt_nonce,startTime]
|
||||||
require(!IBEERC721(nft).isLocked(nftId), "NftChipLocker: Can not pluin chip to locked token");
|
require(chipIds.length == chipSlot.length, "NftChipLocker: chip id and index mislength");
|
||||||
require(IERC721(nft).ownerOf(nftId) == msg.sender, "NftChipLocker: not owner of this nft now");
|
require(chipIds.length <= MAX_CHIP_NUM, "NftChipLocker: chip num reach max allow");
|
||||||
uint256 len = chipIds.length;
|
require(nftTokenSupported[addresses[0]], "NftChipLocker: Unsupported NFT");
|
||||||
uint256[] memory amounts = new uint256[](len);
|
require(nftTokenSupported[addresses[1]], "NftChipLocker: Unsupported Chip");
|
||||||
for (uint256 i = 0; i < len; ++i) {
|
require(!IBEERC721(addresses[0]).isLocked(values[0]), "NftChipLocker: Can not pluin chip to locked token");
|
||||||
|
require(IERC721(addresses[0]).ownerOf(values[0]) == msg.sender, "NftChipLocker: not owner of this nft now");
|
||||||
|
|
||||||
|
uint256[] memory signArray = new uint256[](values.length + chipIds.length * 2);
|
||||||
|
for (uint256 i = 0; i < values.length; ++i ) {
|
||||||
|
signArray[i] = values[i];
|
||||||
|
}
|
||||||
|
uint256[] memory amounts = new uint256[](chipIds.length);
|
||||||
|
for (uint256 i = 0; i < chipIds.length; ++i) {
|
||||||
require(
|
require(
|
||||||
chipPlugined[nft][chip][nftId].contains(chipIds[i]),
|
chipPlugined[addresses[0]][addresses[1]][values[0]][chipSlot[i]] > 0,
|
||||||
"NftChipLocker: chip not exists"
|
"NftChipLocker: chip not exists"
|
||||||
);
|
);
|
||||||
chipPlugined[nft][chip][nftId].remove(chipIds[i]);
|
delete chipPlugined[addresses[0]][addresses[1]][values[0]][chipSlot[i]];
|
||||||
delete chipOwner[nft][chip][chipIds[i]];
|
delete chipOwner[addresses[0]][addresses[1]][chipIds[i]];
|
||||||
amounts[i] = 1;
|
amounts[i] = 1;
|
||||||
|
signArray[values.length + 2 * i] = chipIds[i];
|
||||||
|
signArray[values.length + 2 * i + 1] = chipSlot[i];
|
||||||
}
|
}
|
||||||
IERC1155(chip).safeBatchTransferFrom(address(this), msg.sender, chipIds, amounts, "");
|
bytes32 criteriaMessageHash = getMessageHash(
|
||||||
emit ChipUnplug(nft, nftId, chip, chipIds);
|
addresses[0],
|
||||||
|
addresses[1],
|
||||||
|
_msgSender(),
|
||||||
|
signArray
|
||||||
|
);
|
||||||
|
checkSigner(addresses[2], criteriaMessageHash, signature);
|
||||||
|
IERC1155(addresses[1]).safeBatchTransferFrom(address(this), msg.sender, chipIds, amounts, "");
|
||||||
|
_useSignature(signature);
|
||||||
|
emit ChipUnplug(addresses[0], values[0], values[1], addresses[1], chipIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
function chipOwnerTokenid(address nft, address chip, uint256 chipId)
|
function chipOwnerTokenid(address nft, address chip, uint256 chipId)
|
||||||
@ -109,7 +171,13 @@ contract NftChipLocker is Ownable, ERC1155Holder{
|
|||||||
view
|
view
|
||||||
returns(uint256)
|
returns(uint256)
|
||||||
{
|
{
|
||||||
return chipPlugined[nft][chip][tokenId].length();
|
uint256 len = 0;
|
||||||
|
for (uint256 i = 0; i < MAX_CHIP_NUM; ++i) {
|
||||||
|
if (chipPlugined[nft][chip][tokenId][i] > 0) {
|
||||||
|
len ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pluginedChips(address nft, address chip, uint256 tokenId)
|
function pluginedChips(address nft, address chip, uint256 tokenId)
|
||||||
@ -117,7 +185,28 @@ contract NftChipLocker is Ownable, ERC1155Holder{
|
|||||||
view
|
view
|
||||||
returns(uint256[] memory)
|
returns(uint256[] memory)
|
||||||
{
|
{
|
||||||
return chipPlugined[nft][chip][tokenId].values();
|
uint256[] memory result = new uint256[](MAX_CHIP_NUM);
|
||||||
|
for (uint256 i = 0; i < MAX_CHIP_NUM; ++i) {
|
||||||
|
result[i] = chipPlugined[nft][chip][tokenId][i];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMessageHash(
|
||||||
|
address _nftAddress,
|
||||||
|
address _chipAddress,
|
||||||
|
address _userAddress,
|
||||||
|
uint256[] memory _datas
|
||||||
|
) public pure returns (bytes32) {
|
||||||
|
bytes memory encoded = abi.encodePacked(
|
||||||
|
_nftAddress,
|
||||||
|
_chipAddress,
|
||||||
|
_userAddress
|
||||||
|
);
|
||||||
|
uint256 len = _datas.length;
|
||||||
|
for (uint256 i = 0; i < len; ++i) {
|
||||||
|
encoded = bytes.concat(encoded, abi.encodePacked(_datas[i]));
|
||||||
|
}
|
||||||
|
return keccak256(encoded);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
23370
package-lock.json
generated
23370
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,8 @@
|
|||||||
"deploy:kcctest": "truffle migrate --network kcc_testnet --compile-none",
|
"deploy:kcctest": "truffle migrate --network kcc_testnet --compile-none",
|
||||||
"deploy:polygon_testnet": "truffle migrate --network polygon_testnet --compile-none",
|
"deploy:polygon_testnet": "truffle migrate --network polygon_testnet --compile-none",
|
||||||
"update:nft_sample": "npx truffle exec --network lan20 ./init_scripts/update_nft_setting.js",
|
"update:nft_sample": "npx truffle exec --network lan20 ./init_scripts/update_nft_setting.js",
|
||||||
"mint_presale:dev": "npx truffle exec --network development ./init_scripts/generate_presalebox.js"
|
"mint_presale:dev": "npx truffle exec --network development ./init_scripts/generate_presalebox.js",
|
||||||
|
"size": "truffle run contract-size"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
@ -30,7 +30,7 @@ const mnemonic = fs.readFileSync(".secret").toString().trim();
|
|||||||
const kccTestnetKey =
|
const kccTestnetKey =
|
||||||
"d9ed33809372932059c1ba7b336a33f406b4c55e7430daef8297134c67429d60";
|
"d9ed33809372932059c1ba7b336a33f406b4c55e7430daef8297134c67429d60";
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: ["truffle-plugin-stdjsonin"],
|
plugins: ["truffle-plugin-stdjsonin", "truffle-contract-size"],
|
||||||
api_keys: {
|
api_keys: {
|
||||||
etherscan: "ZI9HI3VFZRD346JSRET35Y6AAVGYFGNZ85",
|
etherscan: "ZI9HI3VFZRD346JSRET35Y6AAVGYFGNZ85",
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user