Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
759b38f
test file
cha0sg0d Sep 20, 2022
e37e962
Merge remote-tracking branch 'origin/main' into cha0s/dfd-216-use-erc…
Sep 23, 2022
5ed378d
feat: load SolidStateERC1155
Sep 23, 2022
9d240e7
temp: noodling around
Sep 23, 2022
832b27d
test: working mint and uri tests
Sep 24, 2022
00000fb
chore: comment
Sep 24, 2022
204c9ed
feat: sample bit pack
Sep 25, 2022
4341dfd
feat: not working artifact refactor
Sep 27, 2022
977ddd8
temp: working artifact activate and deactivate
Sep 27, 2022
e71fb66
test: some test starting to work:
Sep 27, 2022
070e4b7
feat: all artifact tests passing (no photoid or planetary shield)
Sep 28, 2022
61b99f0
move tests work almost but need to totally redo spaceships
Sep 28, 2022
cfeea70
feat: spaceships work
Sep 28, 2022
c543123
feat: all tests pass + photoid. Need crescent and planetary shield th…
Sep 28, 2022
ce8e2da
failing test :(
Sep 28, 2022
01203bb
feat: crescent test
Sep 29, 2022
7e16067
feat: shield test passes
Sep 29, 2022
ac286fe
fix: clean up tests a bit
Sep 29, 2022
0a0e101
feat: prevent spaceship transfer
Sep 29, 2022
79edaaf
feat: bye bye DFToken
Sep 29, 2022
b502961
feat: Readme
Sep 29, 2022
97035ee
clean
Sep 29, 2022
5a0b6a9
the nice nice cleanup
Sep 29, 2022
0ec6d6d
clean
Sep 29, 2022
6dabfc7
clean
Sep 29, 2022
2a4a02d
remove more data structures
Sep 29, 2022
239645f
feat: give artifacts unique ids for getter purposes
Sep 29, 2022
061a631
feat: encode / decode works, need to thread through
Sep 29, 2022
2ee6365
rename collection type
Sep 30, 2022
cf3e213
feat: tests pass with spaceships as separate entities
Sep 30, 2022
7f7edab
spaceship type
Sep 30, 2022
4f60b35
fix: photoid test
Sep 30, 2022
14bcaa9
update types and readme
Oct 1, 2022
14236ac
chore: move functions that can be internal into LibArtifact and LibSp…
Oct 1, 2022
fd18773
feat: working DFTokenFacet for silver mint
Oct 1, 2022
ac025dc
fix: silver token type
Oct 2, 2022
9413f19
chore: rename withdraw silver tests check silver balance
Oct 2, 2022
c78429d
chore: explain silver precision
Oct 2, 2022
3a44ae7
Apply tweaks from code reivew
cha0sg0d Oct 3, 2022
0485338
More tweaks
cha0sg0d Oct 3, 2022
f119e91
fix: return when found in getter
Oct 3, 2022
12d000b
README tweaks
cha0sg0d Oct 3, 2022
a2c9bce
feat: explain chunk properties in README
Oct 3, 2022
f2a8b73
fix: ordering of args for artifact events
Oct 3, 2022
6471c89
fix: split up getActiveArtifact into two checks
Oct 3, 2022
a3d9212
fix: remove @solidstate/spec
Oct 3, 2022
2abbff9
feat: create for Spaceship and Artifact
Oct 3, 2022
c8d33a1
feat: simply business logic bc of asserts in token create
Oct 3, 2022
8aaf3f1
Merge branch 'cha0s/dfd-216-use-erc1155-standard-for-spaceships-and' …
cha0sg0d Oct 3, 2022
0f0a61c
chore: Remove lodash from the BrowserChecks util (#19)
phated Sep 29, 2022
4e5708d
fix: Always indicate contract owner is whitelisted (#20)
phated Sep 29, 2022
535146f
chore: Update committed contract addresses (#23)
phated Sep 29, 2022
619277f
feat: Rework PersistentChunkStore to use Yjs (#22)
phated Oct 3, 2022
403e18c
Store artifact information on contract planets (#28)
phated Oct 3, 2022
f693834
first draft at simple artifacts
Oct 3, 2022
659f7df
feat: all tests pass
Oct 4, 2022
7e54c3f
simple artifact functionality works
Oct 4, 2022
54e3e9f
Merge branch 'main' into cha0s/dfd-262-simple-artifacts
cha0sg0d Oct 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions eth/contracts/DFDiamond.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {ERC165, IERC165, ERC165Storage} from "@solidstate/contracts/introspectio
import {DiamondBase, DiamondBaseStorage} from "@solidstate/contracts/proxy/diamond/base/DiamondBase.sol";
import {DiamondReadable, IDiamondReadable} from "@solidstate/contracts/proxy/diamond/readable/DiamondReadable.sol";
import {DiamondWritable, IDiamondWritable} from "@solidstate/contracts/proxy/diamond/writable/DiamondWritable.sol";
import {IERC721} from "@solidstate/contracts/token/ERC721/IERC721.sol";
import {IERC721Metadata} from "@solidstate/contracts/token/ERC721/metadata/IERC721Metadata.sol";
import {IERC721Enumerable} from "@solidstate/contracts/token/ERC721/enumerable/IERC721Enumerable.sol";
import {IERC1155} from "@solidstate/contracts/token/ERC1155/IERC1155.sol";
import {IERC1155Metadata} from "@solidstate/contracts/token/ERC1155/metadata/IERC1155Metadata.sol";
import {IERC1155Enumerable} from "@solidstate/contracts/token/ERC1155/enumerable/IERC1155Enumerable.sol";

/**
* @title SolidState "Diamond" proxy reference implementation
Expand Down Expand Up @@ -58,9 +58,9 @@ contract DFDiamond is DiamondBase, DiamondReadable, DiamondWritable, Ownable, ER
erc165.setSupportedInterface(type(IERC173).interfaceId, true);

// Store ERC721 interface
erc165.setSupportedInterface(type(IERC721).interfaceId, true);
erc165.setSupportedInterface(type(IERC721Metadata).interfaceId, true);
erc165.setSupportedInterface(type(IERC721Enumerable).interfaceId, true);
erc165.setSupportedInterface(type(IERC1155).interfaceId, true);
erc165.setSupportedInterface(type(IERC1155Metadata).interfaceId, true);
erc165.setSupportedInterface(type(IERC1155Enumerable).interfaceId, true);

// register Diamond

Expand Down
11 changes: 4 additions & 7 deletions eth/contracts/DFInitialize.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pragma solidity ^0.8.0;
// Interface imports

// Inherited storage
import {ERC721MetadataStorage} from "@solidstate/contracts/token/ERC721/metadata/ERC721MetadataStorage.sol";
import {ERC1155MetadataStorage} from "@solidstate/contracts/token/ERC1155/metadata/ERC1155MetadataStorage.sol";

// Library imports
import {WithStorage, SpaceshipConstants} from "./libraries/LibStorage.sol";
Expand Down Expand Up @@ -99,7 +99,7 @@ struct InitArgs {
}

contract DFInitialize is WithStorage {
using ERC721MetadataStorage for ERC721MetadataStorage.Layout;
using ERC1155MetadataStorage for ERC1155MetadataStorage.Layout;

// You can add parameters to this function in order to pass in
// data to set initialize state variables
Expand All @@ -108,11 +108,8 @@ contract DFInitialize is WithStorage {
string memory artifactBaseURI,
InitArgs memory initArgs
) external {
// Setup the ERC721 metadata
// TODO(#1925): Add name and symbol for the artifact tokens
ERC721MetadataStorage.layout().name = "";
ERC721MetadataStorage.layout().symbol = "";
ERC721MetadataStorage.layout().baseURI = artifactBaseURI;
// Setup the ERC1155 metadata
ERC1155MetadataStorage.layout().baseURI = artifactBaseURI;

gs().diamondAddress = address(this);

Expand Down
80 changes: 52 additions & 28 deletions eth/contracts/DFTypes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ struct Planet {
uint256 invadeStartBlock;
address capturer;
uint256 locationId;
// Token stuff
uint256[] artifacts;
uint256[] spaceships;
uint256 activeArtifact;
uint256 wormholeTo;
uint256 artifactActivationTime;
}

struct RevealedCoords {
Expand Down Expand Up @@ -205,7 +211,11 @@ enum ArtifactType {
PlanetaryShield,
PhotoidCannon,
BloomFilter,
BlackDomain,
BlackDomain
}

enum SpaceshipType {
Unknown,
ShipMothership,
ShipCrescent,
ShipWhale,
Expand All @@ -222,33 +232,6 @@ enum ArtifactRarity {
Mythic
}

// for NFTs
struct Artifact {
bool isInitialized;
uint256 id;
uint256 planetDiscoveredOn;
ArtifactRarity rarity;
Biome planetBiome;
uint256 mintedAtTimestamp;
address discoverer;
ArtifactType artifactType;
// an artifact is 'activated' iff lastActivated > lastDeactivated
uint256 activations;
uint256 lastActivated;
uint256 lastDeactivated;
uint256 wormholeTo; // location id
address controller; // space ships can be controlled regardless of which planet they're on
}

// for artifact getters
struct ArtifactWithMetadata {
Artifact artifact;
Upgrade upgrade;
Upgrade timeDelayedUpgrade; // for photoid canons specifically.
address owner;
uint256 locationId; // 0 if planet is not deposited into contract or is on a voyage
uint256 voyageId; // 0 is planet is not deposited into contract or is on a planet
}

enum Biome {
Unknown,
Expand All @@ -263,3 +246,44 @@ enum Biome {
Lava,
Corrupted
}

enum TokenType {
Unknown,
Artifact,
Spaceship,
Silver
}

enum ArtifactInfo {
Unknown,
TokenType,
ArtifactRarity,
ArtifactType,
Biome
}

struct Artifact {
uint256 id;
TokenType tokenType;
ArtifactRarity rarity;
ArtifactType artifactType;
Biome planetBiome;
}

// Used for accessing properties of spaceship tokenId
enum SpaceshipInfo {
Unknown,
TokenType,
SpaceshipType
}

struct Spaceship {
uint256 id;
TokenType tokenType;
SpaceshipType spaceshipType;
}

enum SilverInfo {
Unknown,
TokenType
}
Loading