From bb739addd9acccfd594a111baa8bc683d70197ff Mon Sep 17 00:00:00 2001 From: Timidan Date: Sun, 21 May 2023 02:20:45 +0100 Subject: [PATCH] include XP event --- contracts/Aavegotchi/facets/VRFFacet.sol | 9 +--- .../Aavegotchi/libraries/LibAavegotchi.sol | 7 +++ hardhat.config.ts | 54 +++++++++---------- svgs/wearables-sides.ts | 36 ++++++------- svgs/wearables.ts | 12 ++--- 5 files changed, 60 insertions(+), 58 deletions(-) diff --git a/contracts/Aavegotchi/facets/VRFFacet.sol b/contracts/Aavegotchi/facets/VRFFacet.sol index 08b93c645..10a420446 100644 --- a/contracts/Aavegotchi/facets/VRFFacet.sol +++ b/contracts/Aavegotchi/facets/VRFFacet.sol @@ -83,7 +83,7 @@ import {ILink} from "../interfaces/ILink.sol"; * @dev until it calls fulfillRandomness(). */ -contract VrfFacet is Modifiers { +contract VRFFacet is Modifiers { event VrfRandomNumber(uint256 indexed tokenId, uint256 randomNumber, uint256 _vrfTimeSet); event OpenPortals(uint256[] _tokenIds); event PortalOpened(uint256 indexed tokenId); @@ -194,12 +194,7 @@ contract VrfFacet is Modifiers { //@param _keyHash New keyhash //@param _vrfCoordinator The new vrf coordinator address //@param _link New LINK token contract address - function changeVrf( - uint256 _newFee, - bytes32 _keyHash, - address _vrfCoordinator, - address _link - ) external onlyOwner { + function changeVrf(uint256 _newFee, bytes32 _keyHash, address _vrfCoordinator, address _link) external onlyOwner { if (_newFee != 0) { s.fee = uint96(_newFee); } diff --git a/contracts/Aavegotchi/libraries/LibAavegotchi.sol b/contracts/Aavegotchi/libraries/LibAavegotchi.sol index db9667efb..a2ccf206b 100644 --- a/contracts/Aavegotchi/libraries/LibAavegotchi.sol +++ b/contracts/Aavegotchi/libraries/LibAavegotchi.sol @@ -9,6 +9,8 @@ import {IERC721} from "../../shared/interfaces/IERC721.sol"; import {LibERC721} from "../../shared/libraries/LibERC721.sol"; import {LibItems, ItemTypeIO} from "../libraries/LibItems.sol"; +import {LibXPAllocation} from "./LibXPAllocation.sol"; + struct AavegotchiCollateralTypeIO { address collateralType; AavegotchiCollateralTypeInfo collateralTypeInfo; @@ -372,6 +374,11 @@ library LibAavegotchi { revert("Kinship too low to reduce"); } else { s.aavegotchis[_tokenId].interactionCount -= _amount; + uint256[] memory tokenIds = new uint256[](1); + uint256[] memory xpAmounts = new uint256[](1); + tokenIds[0] = _tokenId; + xpAmounts[0] = s.aavegotchis[_tokenId].interactionCount; + emit LibXPAllocation.GrantExperience(tokenIds, xpAmounts); } } } diff --git a/hardhat.config.ts b/hardhat.config.ts index f12b6f79f..ea649aa5a 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -17,17 +17,17 @@ dotenv.config({ path: __dirname + "/.env" }); // require("./tasks/verifyFacet.js"); require("./tasks/deployUpgrade.ts"); -require("./tasks/addBaadgeSvgs.ts"); -require("./tasks/mintBaadgeSvgs.ts"); -require("./tasks/baadgeAirdrop.ts"); -require("./tasks/updateItemDimensions.ts"); -require("./tasks/updateSvgs.ts"); -require("./tasks/updateItemSideDimensions.ts"); -require("./tasks/batchDeposit.ts"); -require("./tasks/rarityPayouts"); -require("./tasks/grantXP_snapshot"); -require("./tasks/grantXP_minigame"); -require("./tasks/grantXP"); +// require("./tasks/addBaadgeSvgs.ts"); +// require("./tasks/mintBaadgeSvgs.ts"); +// require("./tasks/baadgeAirdrop.ts"); +// require("./tasks/updateItemDimensions.ts"); +// require("./tasks/updateSvgs.ts"); +// require("./tasks/updateItemSideDimensions.ts"); +// require("./tasks/batchDeposit.ts"); +// require("./tasks/rarityPayouts"); +// require("./tasks/grantXP_snapshot"); +// require("./tasks/grantXP_minigame"); +// require("./tasks/grantXP"); require("./tasks/addItemTypes"); require("./tasks/addWearableSets"); require("./tasks/grantXP_customValues"); @@ -60,27 +60,27 @@ export default { matic: { url: process.env.MATIC_URL, // url: 'https://rpc-mainnet.maticvigil.com/', - accounts: [process.env.ITEM_MANAGER], + accounts: [process.env.SECRET], // blockGasLimit: 20000000, blockGasLimit: 20000000, gasPrice: 400000000000, timeout: 90000, }, - tenderly: { - url: process.env.TENDERLY_FORK, - chainId: Number(process.env.TENDERLY_NETWORK_ID), - accounts: [process.env.ITEM_MANAGER], - // blockGasLimit: 20000000, - blockGasLimit: 20000000, - gasPrice: 1000000000, - timeout: 90000, - }, - mumbai: { - url: process.env.MUMBAI_URL, - accounts: [process.env.SECRET], - blockGasLimit: 20000000, - gasPrice: 1000000000, - }, + // tenderly: { + // url: process.env.TENDERLY_FORK, + // chainId: Number(process.env.TENDERLY_NETWORK_ID), + // accounts: [process.env.ITEM_MANAGER], + // // blockGasLimit: 20000000, + // blockGasLimit: 20000000, + // gasPrice: 1000000000, + // timeout: 90000, + // }, + // mumbai: { + // url: process.env.MUMBAI_URL, + // accounts: [process.env.SECRET], + // blockGasLimit: 20000000, + // gasPrice: 1000000000, + // }, // gorli: { // url: process.env.GORLI, // accounts: [process.env.SECRET], diff --git a/svgs/wearables-sides.ts b/svgs/wearables-sides.ts index a1721827d..16db3b050 100644 --- a/svgs/wearables-sides.ts +++ b/svgs/wearables-sides.ts @@ -367,14 +367,14 @@ export const wearablesRightSvgs = [ wearable("359_ForgeGogglesRight"), wearable("360_GeodeSmasherRight"), wearable("361_GeoRight"), - bodyWearableRight("362_FAKEShirt"), - wearable("363_FAKEBeretRight"), + bodyWearableRight("362_FakeShirt"), + wearable("363_FakeBeretRight"), wearable("364_PaintBrushRight"), wearable("365_PaintPaletteRight"), bodyWearableRight("366_HeavenlyRobes"), - wearable("367_EyesofDevotionRight"), - wearable("368_BeardofDivinityRight"), - wearable("369_StaffofCreationRight"), + wearable("367_EyesOfDevotionRight"), + wearable("368_BeardOfDivinityRight"), + wearable("369_StaffOfCreationRight"), ]; export const wearablesBackSvgs = [ @@ -744,14 +744,14 @@ export const wearablesBackSvgs = [ wearable("359_ForgeGogglesBack"), wearable("360_GeodeSmasherBack"), wearable("361_GeoBack"), - bodyWearable("362_FAKEShirt"), - wearable("363_FAKEBeretBack"), + bodyWearable("362_FakeShirt"), + wearable("363_FakeBeretBack"), wearable("364_PaintBrushBack"), wearable("365_PaintPaletteBack"), bodyWearable("366_HeavenlyRobes"), - "367_EyesofDevotionBack", - "368_BeardofDivinityBack", - wearable("369_StaffofCreationBack"), + "367_EyesOfDevotionBack", + "368_BeardOfDivinityBack", + wearable("369_StaffOfCreationBack"), ]; export const wearablesLeftSvgs = [ @@ -1121,14 +1121,14 @@ export const wearablesLeftSvgs = [ wearable("359_ForgeGogglesLeft"), wearable("360_GeodeSmasherLeft"), wearable("361_GeoLeft"), - bodyWearableLeft("362_FAKEShirt"), - wearable("363_FAKEBeretLeft"), + bodyWearableLeft("362_FakeShirt"), + wearable("363_FakeBeretLeft"), wearable("364_PaintBrushLeft"), wearable("365_PaintPaletteLeft"), bodyWearableLeft("366_HeavenlyRobes"), - wearable("367_EyesofDevotionLeft"), - wearable("368_BeardofDivinityLeft"), - wearable("369_StaffofCreationLeft"), + wearable("367_EyesOfDevotionLeft"), + wearable("368_BeardOfDivinityLeft"), + wearable("369_StaffOfCreationLeft"), ]; export const wearablesLeftSleeveSvgs = [ @@ -1331,7 +1331,7 @@ export const wearablesLeftSleeveSvgs = [ sleeveWearableLeft("318_TrackSuit"), // forge wearables sleeveWearableLeft("350_PixelcraftTee"), - sleeveWearableLeft("362_FAKEShirt"), + sleeveWearableLeft("362_FakeShirt"), sleeveWearableLeft("366_HeavenlyRobes"), ]; @@ -1535,7 +1535,7 @@ export const wearablesRightSleeveSvgs = [ sleeveWearableRight("318_TrackSuit"), // forge wearables sleeveWearableRight("350_PixelcraftTee"), - sleeveWearableRight("362_FAKEShirt"), + sleeveWearableRight("362_FakeShirt"), sleeveWearableRight("366_HeavenlyRobes"), ]; @@ -1737,7 +1737,7 @@ export const wearablesBackSleeveSvgs = [ sleeveWearableRight("318_TrackSuit"), // forge wearables sleeveWearableRight("350_PixelcraftTee"), - sleeveWearableRight("362_FAKEShirt"), + sleeveWearableRight("362_FakeShirt"), sleeveWearableRight("366_HeavenlyRobes"), ]; diff --git a/svgs/wearables.ts b/svgs/wearables.ts index ac70263ec..72110662e 100644 --- a/svgs/wearables.ts +++ b/svgs/wearables.ts @@ -368,14 +368,14 @@ export const wearablesSvgs = [ wearable("359_ForgeGoggles"), wearable("360_GeodeSmasher"), wearable("361_Geo"), - bodyWearable("362_FAKEShirt"), - wearable("363_FAKEBeret"), + bodyWearable("362_FakeShirt"), + wearable("363_FakeBeret"), wearable("364_PaintBrush"), wearable("365_PaintPalette"), bodyWearable("366_HeavenlyRobes"), - wearable("367_EyesofDevotion"), - wearable("368_BeardofDivinity"), - wearable("369_StaffofCreation"), + wearable("367_EyesOfDevotion"), + wearable("368_BeardOfDivinity"), + wearable("369_StaffOfCreation"), ]; export const sleeveSvgs = [ @@ -577,7 +577,7 @@ export const sleeveSvgs = [ sleeves("318_TrackSuit"), // forge wearables sleeves("350_PixelcraftTee"), - sleeves("362_FAKEShirt"), + sleeves("362_FakeShirt"), sleeves("366_HeavenlyRobes"), ];