Skip to content

Commit 32441f9

Browse files
committed
Improved comments. Removed unused constants
1 parent cffb6cc commit 32441f9

File tree

14 files changed

+2343
-43
lines changed

14 files changed

+2343
-43
lines changed

README.md

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,9 @@
22

33
## Contract Addresses
44

5-
Kovan:
6-
- Aavegotchi diamond: 0x16a2BA2F8d91f0D5e3B9dBAd7E716DaA428fBA85
7-
- Old Aavegotchi diamond: 0x243D0E444BCaE6BD0645b6Bf4960cc6a925167E0
8-
- Old Aavegotchi diamond: 0x10225cc1ea2435E53E7661E84D36Fb4E9e20a9DB
9-
- GHST diamond: 0xeDaA788Ee96a0749a2De48738f5dF0AA88E99ab5
5+
Aavegotchi diamond: 0x86935F11C86623deC8a25696E1C19a8659CbF95d
106

11-
The ABI files for the diamonds are in the artifacts directory:
127

13-
1. IAavegotchiDiamond.json
14-
1. IGHSTDiamond.json
15-
16-
To easily see what functions these ABI files provide check the corresponding files in the contracts/interfaces directory:
17-
18-
1. IAavegotchiDiamond.sol
19-
1. IGHSTDiamond.sol
20-
21-
Using a diamond ABI should look something like this:
22-
23-
```javascript
24-
let aavegotchiDiamond = new web3.eth.Contract(
25-
JSON.parse(jsonfromfile).abi,
26-
aavegotchiDiamondAddress
27-
);
28-
```
298

309
## Local Deployment
3110

contracts/Aavegotchi/facets/ERC721MarketplaceFacet.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ contract ERC721MarketplaceFacet is Modifiers {
134134

135135
function getERC721Category(address _erc721TokenAddress, uint256 _erc721TokenId) public view returns (uint256 category_) {
136136
require(_erc721TokenAddress == address(this), "ERC721Marketplace: ERC721 category does not exist");
137-
category_ = s.aavegotchis[_erc721TokenId].status; // 0 == portal, 1 == vrf pending, 1 == open portal, 2 == Aavegotchi
137+
category_ = s.aavegotchis[_erc721TokenId].status; // 0 == portal, 1 == vrf pending, 2 == open portal, 3 == Aavegotchi
138138
}
139139

140140
function addERC721Listing(

contracts/Aavegotchi/facets/SvgFacet.sol

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,6 @@ contract SvgFacet is Modifiers {
177177

178178
function getWearableClass(uint256 _slotPosition) internal pure returns (string memory className_) {
179179
//Wearables
180-
/*
181-
uint8 internal constant WEARABLE_SLOT_BODY = 0;
182-
uint8 internal constant WEARABLE_SLOT_FACE = 1;
183-
uint8 internal constant WEARABLE_SLOT_EYES = 2;
184-
uint8 internal constant WEARABLE_SLOT_HEAD = 3;
185-
uint8 internal constant WEARABLE_SLOT_HAND_LEFT = 4;
186-
uint8 internal constant WEARABLE_SLOT_HAND_RIGHT = 5;
187-
uint8 internal constant WEARABLE_SLOT_PET = 6;
188-
uint8 internal constant WEARABLE_SLOT_BG = 7;
189-
*/
190180

191181
if (_slotPosition == LibItems.WEARABLE_SLOT_BODY) className_ = "wearable-body";
192182
if (_slotPosition == LibItems.WEARABLE_SLOT_FACE) className_ = "wearable-face";
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.1;
3+
4+
import {AppStorage, Modifiers, ItemType} from "../libraries/LibAppStorage.sol";
5+
import {LibItems} from "../libraries/LibItems.sol";
6+
import {LibERC1155} from "../../shared/libraries/LibERC1155.sol";
7+
import {LibMeta} from "../../shared/libraries/LibMeta.sol";
8+
9+
contract VoucherMigrationFacet is Modifiers {
10+
event MigrateVouchers(address indexed _owner, uint256[] _ids, uint256[] _values);
11+
12+
struct VouchersOwner {
13+
address owner;
14+
uint256[] ids;
15+
uint256[] values;
16+
}
17+
18+
function migrateVouchers(VouchersOwner[] calldata _vouchersOwners) external onlyOwner {
19+
address sender = LibMeta.msgSender();
20+
for (uint256 i; i < _vouchersOwners.length; i++) {
21+
address owner = _vouchersOwners[i].owner;
22+
uint256[] calldata ids = _vouchersOwners[i].ids;
23+
uint256[] calldata values = _vouchersOwners[i].values;
24+
for (uint256 j; j < ids.length; j++) {
25+
uint256 id = ids[j];
26+
uint256 value = values[j];
27+
ItemType storage itemType = s.itemTypes[id];
28+
uint256 totalQuantity = itemType.totalQuantity + value;
29+
require(totalQuantity <= itemType.maxQuantity, "ShopFacet: Total item type quantity exceeds max quantity");
30+
itemType.totalQuantity = totalQuantity;
31+
LibItems.addToOwner(owner, id, value);
32+
}
33+
emit LibERC1155.TransferBatch(sender, address(0), owner, ids, values);
34+
emit MigrateVouchers(owner, ids, values);
35+
LibERC1155.onERC1155BatchReceived(sender, address(0), owner, ids, values, "");
36+
}
37+
}
38+
}

contracts/Aavegotchi/libraries/LibAppStorage.sol

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@ uint256 constant NUMERIC_TRAITS_NUM = 6;
1111
uint256 constant TRAIT_BONUSES_NUM = 5;
1212
uint256 constant PORTAL_AAVEGOTCHIS_NUM = 10;
1313

14+
// switch (traitType) {
15+
// case 0:
16+
// return energy(value);
17+
// case 1:
18+
// return aggressiveness(value);
19+
// case 2:
20+
// return spookiness(value);
21+
// case 3:
22+
// return brain(value);
23+
// case 4:
24+
// return eyeShape(value);
25+
// case 5:
26+
// return eyeColor(value);
27+
1428
struct Aavegotchi {
1529
uint16[EQUIPPED_WEARABLE_SLOTS] equippedWearables; //The currently equipped wearables of the Aavegotchi
1630
// [Experience, Rarity Score, Kinship, Eye Color, Eye Shape, Brain Size, Spookiness, Aggressiveness, Energy]

diamondABI/diamond.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)