修改evolveproxy的nft进化方法, 可由publicEvolveAllowed开关进行公开的升级

This commit is contained in:
zhl 2022-01-17 13:53:42 +08:00
parent 6e33fd8ddd
commit 43082c1e8a
11 changed files with 7414 additions and 7172 deletions

File diff suppressed because one or more lines are too long

View File

@ -23903,7 +23903,7 @@
} }
}, },
"schemaVersion": "3.4.4", "schemaVersion": "3.4.4",
"updatedAt": "2022-01-17T01:57:21.881Z", "updatedAt": "2022-01-17T05:52:19.051Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

View File

@ -18085,7 +18085,7 @@
} }
}, },
"schemaVersion": "3.4.4", "schemaVersion": "3.4.4",
"updatedAt": "2022-01-17T01:57:21.920Z", "updatedAt": "2022-01-17T05:52:19.081Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

View File

@ -23903,7 +23903,7 @@
} }
}, },
"schemaVersion": "3.4.4", "schemaVersion": "3.4.4",
"updatedAt": "2022-01-17T01:57:21.864Z", "updatedAt": "2022-01-17T05:52:19.037Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

View File

@ -23909,7 +23909,7 @@
} }
}, },
"schemaVersion": "3.4.4", "schemaVersion": "3.4.4",
"updatedAt": "2022-01-17T01:57:21.848Z", "updatedAt": "2022-01-17T05:52:19.025Z",
"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

@ -30656,7 +30656,7 @@
} }
}, },
"schemaVersion": "3.4.4", "schemaVersion": "3.4.4",
"updatedAt": "2022-01-17T01:57:21.904Z", "updatedAt": "2022-01-17T05:52:19.069Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

View File

@ -2328,7 +2328,7 @@
} }
}, },
"schemaVersion": "3.4.4", "schemaVersion": "3.4.4",
"updatedAt": "2022-01-17T01:57:21.945Z", "updatedAt": "2022-01-17T05:52:19.103Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

View File

@ -8958,7 +8958,7 @@
} }
}, },
"schemaVersion": "3.4.4", "schemaVersion": "3.4.4",
"updatedAt": "2022-01-17T01:57:21.894Z", "updatedAt": "2022-01-17T05:52:19.059Z",
"networkType": "ethereum", "networkType": "ethereum",
"devdoc": { "devdoc": {
"kind": "dev", "kind": "dev",

View File

@ -33,28 +33,26 @@ contract EvolveProxy is Ownable, Initializable {
* @dev evolve function to Blissful Elites Hero NFT * @dev evolve function to Blissful Elites Hero NFT
* tokenIds: [hero_to_evolve, hero_for_burn, chip] * tokenIds: [hero_to_evolve, hero_for_burn, chip]
*/ */
function evolveHero(address owner, uint256[3] calldata tokenIds) public onlyOwner returns (bool){ function evolveHero(address to, uint256[3] calldata tokenIds) external {
require(publicEvolveAllowed); require(publicEvolveAllowed || _msgSender() == owner());
hero.burn(owner, tokenIds[1]); hero.burn(to, tokenIds[1]);
if (tokenIds[2] > 0) { if (tokenIds[2] > 0) {
chip.burn(owner, tokenIds[2]); chip.burn(to, tokenIds[2]);
} }
emit TokenEvolved(address(hero), owner, tokenIds[0], tokenIds[1], tokenIds[2]); emit TokenEvolved(address(hero), to, tokenIds[0], tokenIds[1], tokenIds[2]);
return true;
} }
/** /**
* @dev evolve function to Blissful Elites Equip NFT * @dev evolve function to Blissful Elites Equip NFT
* tokenIds: [equip_to_evolve, equip_for_burn, chip] * tokenIds: [equip_to_evolve, equip_for_burn, chip]
*/ */
function evolveEquip(address owner, uint256[3] calldata tokenIds) public onlyOwner returns (bool){ function evolveEquip(address to, uint256[3] calldata tokenIds) external{
require(publicEvolveAllowed); require(publicEvolveAllowed || _msgSender() == owner());
equip.burn(owner, tokenIds[1]); equip.burn(to, tokenIds[1]);
if (tokenIds[2] > 0) { if (tokenIds[2] > 0) {
chip.burn(owner, tokenIds[2]); chip.burn(to, tokenIds[2]);
} }
emit TokenEvolved(address(equip), owner, tokenIds[0], tokenIds[1], tokenIds[2]); emit TokenEvolved(address(equip), to, tokenIds[0], tokenIds[1], tokenIds[2]);
return true;
} }