├── .github └── workflows │ └── node_test_runner.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── smart-contracts ├── .env.example ├── .solcover.js ├── PARENT_CHILDREN_NFTS.md ├── PRIMARY_AUCTION_FLOW.md ├── README.md ├── contracts │ ├── CCO.sol │ ├── DECO.sol │ ├── DigitalaxAccessControls.sol │ ├── DigitalaxAuction.sol │ ├── DigitalaxAuctionV2.sol │ ├── DigitalaxChildVerifiedMint.sol │ ├── DigitalaxGenesisNFT.sol │ ├── DigitalaxGenesisStaking.sol │ ├── DigitalaxGenesisV2.sol │ ├── DigitalaxIndex.sol │ ├── DigitalaxMarketplace.sol │ ├── DigitalaxMarketplaceV2.sol │ ├── DigitalaxMarketplaceV3.sol │ ├── DigitalaxPodeMaterials.sol │ ├── DigitalaxPodeNFT.sol │ ├── DigitalaxPodePortal.sol │ ├── DigitalaxSubscriptionMarketplace.sol │ ├── DigitalaxWhitelistedSales.sol │ ├── DripMarketplace.sol │ ├── EIP2771 │ │ ├── BaseRelayRecipient.sol │ │ └── IRelayRecipient.sol │ ├── ERC1155 │ │ ├── ERC1155.sol │ │ ├── ERC1155Burnable.sol │ │ └── ERC1155BurnableV2.sol │ ├── ERC20 │ │ ├── IWETH.sol │ │ ├── MONA.sol │ │ └── WethToken.sol │ ├── ERC721 │ │ ├── DigitalaxERC721.sol │ │ └── ERC721WithSameTokenURIForAllTokens.sol │ ├── ERC998 │ │ └── IERC998ERC1155TopDown.sol │ ├── ESPADEV.sol │ ├── GDN.sol │ ├── IDigitalaxAccessControls.sol │ ├── LOOK.sol │ ├── LOOKLib.sol │ ├── LOOKLogic.sol │ ├── LOOKSuffix.sol │ ├── ModelsIndex.sol │ ├── ModelsMarketplace.sol │ ├── ModelsWhitelistedSales.sol │ ├── Nix.sol │ ├── NounsAuctionHouse.sol │ ├── NounsToken.sol │ ├── PatronMarketplace.sol │ ├── PodeNFTv2.sol │ ├── RoyaltyOverride.sol │ ├── garment │ │ ├── DFBundle.sol │ │ ├── DFBundleMainnet.sol │ │ ├── DigitalaxBatchMint.sol │ │ ├── DigitalaxGarmentCollection.sol │ │ ├── DigitalaxGarmentCollectionV2.sol │ │ ├── DigitalaxGarmentFactory.sol │ │ ├── DigitalaxGarmentNFT.sol │ │ ├── DigitalaxGarmentNFTv2.sol │ │ ├── DigitalaxGarmentNFTv3.sol │ │ ├── DigitalaxGarmentUpgrader.sol │ │ ├── DigitalaxMaterials.sol │ │ ├── DigitalaxMaterialsV2.sol │ │ ├── DigitalaxMaterialsV2Attacher.sol │ │ ├── DigitalaxSubscriptionCollection.sol │ │ ├── DigitalaxSubscriptionFactory.sol │ │ ├── DigitalaxSubscriptionNFT.sol │ │ ├── DigitalaxSubscriptionNFTMainnet.sol │ │ ├── IDigitalaxGarmentNFT.sol │ │ ├── IDigitalaxMaterials.sol │ │ ├── IModelsNFT.sol │ │ ├── ModelsCollection.sol │ │ └── ModelsNFT.sol │ ├── governance │ │ ├── NounsDAOExecutor.sol │ │ ├── NounsDAOInterfaces.sol │ │ ├── NounsDAOLogicV1.sol │ │ └── NounsDAOProxy.sol │ ├── lib │ │ ├── Merkle.sol │ │ ├── MerklePatriciaProof.sol │ │ ├── RLPEncode.sol │ │ └── RLPReader.sol │ ├── mock │ │ ├── AlwaysRevertingEthReceiver.sol │ │ ├── BaseChildTunnelMock.sol │ │ ├── BaseRootTunnelMock.sol │ │ ├── BiddingContractMock.sol │ │ ├── DigitalaxAuctionMock.sol │ │ ├── DigitalaxGarmentNFTv2TunnelMock.sol │ │ ├── DigitalaxGenesisNFTMock.sol │ │ ├── DigitalaxMarketplaceMock.sol │ │ ├── DigitalaxMarketplaceV2Mock.sol │ │ ├── DigitalaxMarketplaceV3Mock.sol │ │ ├── DigitalaxMonaStakingMock.sol │ │ ├── DigitalaxNFTRewardsV2Mock.sol │ │ ├── DigitalaxNFTStakingMock.sol │ │ ├── DigitalaxPodeNFTMock.sol │ │ ├── DigitalaxRewardsV2Mock.sol │ │ ├── DigitalaxRootTunnelMock.sol │ │ ├── DigitalaxSubscriptionMarketplaceMock.sol │ │ ├── DigitalaxSubscriptionNFTTunnelMock.sol │ │ ├── DigitalaxSubscriptionRootTunnelMock.sol │ │ ├── DigitalaxWhitelistedSalesMock.sol │ │ ├── DripMarketplaceMock.sol │ │ ├── ERC1155Mock.sol │ │ ├── ERC1155ReceiverMock.sol │ │ ├── ERC165Mock.sol │ │ ├── ERC721ReceiverMock.sol │ │ ├── GuildNFTRewardsMock.sol │ │ ├── GuildNFTRewardsV2Mock.sol │ │ ├── GuildNFTRewardsV3Mock.sol │ │ ├── GuildNFTStakingMock.sol │ │ ├── GuildNFTStakingV3Mock.sol │ │ ├── GuildNFTStakingWeightMock.sol │ │ ├── GuildNFTStakingWeightV2Mock.sol │ │ ├── GuildNFTStakingWeightV2StorageMock.sol │ │ ├── GuildNFTStakingWeightV3Mock.sol │ │ ├── GuildNFTStakingWeightV4Mock.sol │ │ ├── GuildWhitelistedNFTStakingMock.sol │ │ ├── GuildWhitelistedNFTStakingV2Mock.sol │ │ ├── GuildWhitelistedNFTStakingV3Mock.sol │ │ ├── MarketplaceBuyingContractMock.sol │ │ ├── MockDECO.sol │ │ ├── MockERC20.sol │ │ ├── MockVault.sol │ │ └── ModelsMarketplaceMock.sol │ ├── oracle │ │ ├── DecoOracle.sol │ │ ├── DigitalaxMonaOracle.sol │ │ ├── DripOracle.sol │ │ ├── IDigitalaxMonaOracle.sol │ │ ├── IDripOracle.sol │ │ ├── IOracle.sol │ │ ├── UniswapOracleExample.sol │ │ └── UniswapPairOracle_MONA_WETH.sol │ ├── proxy │ │ └── DigitalaxProxy.sol │ ├── root │ │ ├── ICheckpointManager.sol │ │ └── StateSender │ │ │ └── IStateSender.sol │ ├── staking │ │ ├── DigitalaxMonaStaking.sol │ │ ├── DigitalaxMonaStakingMultiPoolTimelock.sol.backup │ │ ├── DigitalaxNFTRewardsV2.sol │ │ ├── DigitalaxNFTStaking.sol │ │ ├── DigitalaxRewardsV2.sol │ │ ├── GuildNFTRewards.sol │ │ ├── GuildNFTRewardsV2.sol │ │ ├── GuildNFTRewardsV3.sol │ │ ├── GuildNFTStaking.sol │ │ ├── GuildNFTStakingCalculator.sol │ │ ├── GuildNFTStakingV3.sol │ │ ├── GuildNFTStakingWeightV1.sol │ │ ├── GuildNFTStakingWeightV2.sol │ │ ├── GuildNFTStakingWeightV2Storage.sol │ │ ├── GuildNFTStakingWeightV3.sol │ │ ├── GuildNFTStakingWeightV4.sol │ │ ├── GuildWhitelistedNFTStaking.sol │ │ ├── GuildWhitelistedNFTStakingV2.sol │ │ ├── GuildWhitelistedNFTStakingV3.sol │ │ └── interfaces │ │ │ ├── IChild.sol │ │ │ ├── IDigitalaxNFT.sol │ │ │ ├── IDigitalaxNFTRewards.sol │ │ │ ├── IDigitalaxRewards.sol │ │ │ ├── IERC20.sol │ │ │ ├── IGuildNFTRewards.sol │ │ │ ├── IGuildNFTRewardsWhitelisted.sol │ │ │ ├── IGuildNFTStakingWeight.sol │ │ │ ├── IGuildNFTStakingWeightStorage.sol │ │ │ ├── IGuildNFTStakingWeightWhitelisted.sol │ │ │ ├── IGuildNFTTokenRewards.sol │ │ │ ├── IPodeNFTv2.sol │ │ │ ├── IUniswapV2Pair.sol │ │ │ ├── IWETH9.sol │ │ │ └── UniswapV2Library.sol │ ├── tunnel │ │ ├── BaseChildTunnel.sol │ │ ├── BaseRootTunnel.sol │ │ ├── DigitalaxRootTunnel.sol │ │ └── DigitalaxSubscriptionRootTunnel.sol │ ├── tunnelV2 │ │ ├── FxBaseChildTunnel.sol │ │ ├── FxBaseRootTunnel.sol │ │ ├── FxStateChildTunnel.sol │ │ └── FxStateRootTunnel.sol │ ├── uniswapv2 │ │ ├── UniswapOracleExample.sol │ │ ├── UniswapV2ERC20.sol │ │ ├── UniswapV2Factory.sol │ │ ├── UniswapV2OracleLibrary.sol │ │ ├── UniswapV2Pair.sol │ │ ├── UniswapV2Router02.sol │ │ ├── interfaces │ │ │ ├── IERC20.sol │ │ │ ├── IUniswapV2Callee.sol │ │ │ ├── IUniswapV2ERC20.sol │ │ │ ├── IUniswapV2Factory.sol │ │ │ ├── IUniswapV2Pair.sol │ │ │ ├── IUniswapV2Router01.sol │ │ │ ├── IUniswapV2Router02.sol │ │ │ └── IWETH.sol │ │ └── libraries │ │ │ ├── FixedPoint.sol │ │ │ ├── Math.sol │ │ │ ├── SafeMath.sol │ │ │ ├── TransferHelper.sol │ │ │ ├── UQ112x112.sol │ │ │ └── UniswapV2Library.sol │ └── utils │ │ ├── DigitalaxGarmentNFTV2Burner.sol │ │ ├── DigitalaxSubscriptionBurner.sol │ │ └── ModelsNFTBurner.sol ├── docs │ ├── CreateGarmentWithStrands.drawio │ ├── CreateGarmentWithStrands.png │ ├── DigitalaxAccessControls-input.json │ ├── DigitalaxGenesisNFT-input.json │ ├── contracts-flat │ │ ├── FLAT-DigitalaxAuction.sol │ │ ├── FLAT-DigitalaxGarmentFactory.sol │ │ ├── FLAT-DigitalaxGarmentNFT.sol │ │ └── FLAT-DigitalaxMaterials.sol │ └── gas-report.md ├── flattened-new │ ├── DigitalaxMarketplaceV3.sol │ ├── DigitalaxMaterialsV2Attacher.sol │ ├── DripOracle.sol │ ├── GuildNFTRewardsV3.sol │ ├── GuildNFTStakingWeightV2Storage.sol │ ├── GuildNFTStakingWeightV4.sol │ ├── GuildWhitelistedNFTStakingV3.sol │ ├── ModelsCollection.sol │ ├── ModelsMarketplace.sol │ ├── ModelsNFT.sol │ ├── NounsAuctionHouse.sol │ ├── NounsDAOExecutor.sol │ ├── NounsDAOLogicV1.sol │ ├── NounsDAOProxy.sol │ └── NounsToken.sol ├── flattened │ ├── GuildNFTRewards.sol │ ├── GuildNFTStaking.sol │ └── GuildNFTStakingWeightV1.sol ├── genesisMinting.json ├── hardhat.config.js ├── metadata_template │ ├── README.md │ ├── child_metadata_example.json │ └── parent_metadata_example.json ├── package.json ├── scripts │ ├── 10_more_tokens_and_auctions.js │ ├── 11_round_2_create_children.js │ ├── 12_round_2_create_parents.js │ ├── 13_round_2_create_auction.js │ ├── 14_round_3_minting.js │ ├── 15_deploy_pode_nft.js │ ├── 16_deploy_garment_collection.js │ ├── 17_deploy_marketplace.js │ ├── 18_deploy_uniswap_oracle.js │ ├── 19_deploy_podeportal.js │ ├── 1_deploy_access_controls.js │ ├── 20_deploy_podematerials.js │ ├── 21_deploy_digitalax_index.js │ ├── 22_deploy_mona_oralce.js │ ├── 23_deploy_digitalax_proxy.js │ ├── 24_deploy_garment_nft_v2.js │ ├── 25_deploy_subscription_collection.js │ ├── 2_deploy_genesis_nft.js │ ├── 3_deploy_materials.js │ ├── 4_deploy_garment_nft.js │ ├── 5_deploy_garment_factory.js │ ├── 6_deploy_auction.js │ ├── 7_create_children.js │ ├── 8_create_parents.js │ ├── 9_create_auctions.js │ ├── auction_marketplace_deployment │ │ ├── 10_round_7_minting_parents.js │ │ ├── 11_update_matic_metadata.js │ │ ├── 12_round_minting_childs.js │ │ ├── 13_round_8_create_subscription.js │ │ ├── 14_round_8_pode_airdrop.js │ │ ├── 15_round_9_minting_auction.js │ │ ├── 16_round_9_create_collections_on_marketplace.js │ │ ├── 17_round_minting_childs.js │ │ ├── 18_round_8_create_subscription.js │ │ ├── 19_round_8_burn_tokens.js │ │ ├── 1_round_minting_childs.js │ │ ├── 20_round_10_burn_tokens_v1.js │ │ ├── 21_round_10_create_collections_on_marketplace.js │ │ ├── 22_round_11_pode_v2_airdrop.js │ │ ├── 23_round_11_assign_designer_add_to_index.js │ │ ├── 24_round_12_minting_childs.js │ │ ├── 25_round_12_create_subscription.js │ │ ├── 26_round_13_mint_drip_childs_mumbai.js │ │ ├── 27_round_13_create_collections_on_drip.js │ │ ├── 28.js │ │ ├── 28_cancel_many_collections.js │ │ ├── 29_fix_metadata.js │ │ ├── 2_round_minting_auction_parents_start_auction.js │ │ ├── 30_fix_prices.js │ │ ├── 31_fix_max_amount.js │ │ ├── 32_remint_drip_collections.js │ │ ├── 32_setup_new_marketplace.js │ │ ├── 33_round_14_bancor_vote_airdrop.js │ │ ├── 34_round_15_create_subscription.js │ │ ├── 34_round_15_minting_childs.js │ │ ├── 35_round_15_minting_auction.js │ │ ├── 36_round_15_minting_auction.js │ │ ├── 37_round_15_create_collections_on_skins.js │ │ ├── 38_round_16_create_collections_on_skins.js │ │ ├── 39_fix_skins_times.js │ │ ├── 3_create_collections_on_marketplace.js │ │ ├── 40_round_16_burn_skins.js │ │ ├── 41_round_16_update_endtime.js │ │ ├── 42_designer_indexes.js │ │ ├── 43_attach_1155.js │ │ ├── 44_attach_1155.js │ │ ├── 45_round_16_pode_hero_airdrop.js │ │ ├── 46_burn_skins.js │ │ ├── 47_burn_skins_analysis.js │ │ ├── 48_thedlta_snapshot_reporting.js │ │ ├── 49_v2_deployment.js │ │ ├── 4_round_cancel_auction.js │ │ ├── 50_loot_claimer.js │ │ ├── 52_v3_upgrade.js │ │ ├── 53_v3_deployment.js │ │ ├── 54_total_weight.js │ │ ├── 55_total_whitelist_weight.js │ │ ├── 56_long_term_deployment.js │ │ ├── 57_longterm_upgrade.js │ │ ├── 58_nix_deployment.js │ │ ├── 59_nix_maker.js │ │ ├── 5_round_4_minting_auction_parents.js │ │ ├── 60_nix_taker.js │ │ ├── 61_royalty_deployment.js │ │ ├── 62_mona_nft_airdrop.js │ │ ├── 63_patronmarketplace_deployment.js │ │ ├── 64_skins_long_term_deployment.js │ │ ├── 65_genesis_v2_deployment.js │ │ ├── 66_genesis_v2_mint.js │ │ ├── 67_nix_upgrade.js │ │ ├── 68_genesis_long_term_deployment.js │ │ ├── 69_mona_staking_rewards_upgrade.js │ │ ├── 6_round_4_create_collections_on_marketplace.js │ │ ├── 70_lgt_airdrop.js │ │ ├── 71_royalty_override_deployment.js │ │ ├── 72_w3f_stake_deployment.js │ │ ├── 73_pode_guild_migration.js │ │ ├── 74_whitelisted_weight_migration.js │ │ ├── 75_pode_weight_set.js │ │ ├── 76_whitelist_weight_set.js │ │ ├── 77_gdn_long_term_deployment.js │ │ ├── 78_guild_staking_upgrade.js │ │ ├── 79_guild_staking_weight_upgrade.js │ │ ├── 7_round_5_minting_auction_parents.js │ │ ├── 80_models_marketplace_deployment.js │ │ ├── 81_long_term_skins_upgrade.js │ │ ├── 82_staking_prices_save.js │ │ ├── 82_staking_prices_update.js │ │ ├── 83_staking_upgrade.js │ │ ├── 84_verified_minter_deploy.js │ │ ├── 85_get_stake_value.js │ │ ├── 86_generate_bancor_metadata.js │ │ ├── 88_models_whitelister_deploy.js │ │ ├── 89_skins_whitelister_deploy.js │ │ ├── 8_round_6_minting_auction_parents.js │ │ ├── 90_burn_models.js │ │ ├── 90_nouns_deploy.js │ │ ├── 91_nouns_dao.js │ │ ├── 92_deploy_cco.js │ │ ├── 93_nouns_auction_upgrade.js │ │ ├── 9_round_6_create_collections_on_marketplace.js │ │ ├── bancor-airdrop.json │ │ ├── bancor-airdropV2.json │ │ ├── bancor_addresses.json │ │ ├── bancor_mp4s.json │ │ ├── bancor_uris.json │ │ ├── collections.json │ │ ├── dltapodeweights.json │ │ ├── dltawhitelistweights.json │ │ ├── genesisStakers.json │ │ ├── genesisTokens.json │ │ ├── genesisWallets.json │ │ ├── lgtm_airdrop.json │ │ ├── modelsburntokens.json │ │ ├── mona_staking_tokens.json │ │ ├── nft_staking_tokens.json │ │ ├── pode.json │ │ ├── pode_heroes.json │ │ ├── podeworksheet.json │ │ ├── swordart-airdrop.json │ │ ├── thedlta_snapshot_12_13_2021.json │ │ ├── thedlta_snapshot_9_21_2021.json │ │ ├── thedlta_snapshot_9_8_2021.json │ │ ├── thedlta_snapshot_whitelisted_tokens.json │ │ ├── timerss.js │ │ └── tokensmigrated.json │ ├── constants.js │ ├── digitalax_index │ │ └── 1_initial_map_indexes.js │ └── test_scripts │ │ ├── 10_test_bid.js │ │ ├── 11_test_result_auction.js │ │ ├── 12_test_get_balance_materials.js │ │ ├── 13_test_create_and_mint_child.js │ │ ├── 7_test_factory.js │ │ ├── 8_test_garment_burn.js │ │ └── 9_test_create_garment_and_list.js ├── test │ ├── DigitalaxAccessControls.test.js │ ├── DigitalaxAuction.scenario.tests.js │ ├── DigitalaxAuction.test.js │ ├── DigitalaxGarmentCollection.test.js │ ├── DigitalaxGarmentFactory.test.js │ ├── DigitalaxGarmentSale.test.js │ ├── DigitalaxGarmentUpgrader.test.js │ ├── DigitalaxMarketplace.test.js │ ├── DigitalaxMarketplaceV2.test.js │ ├── DigitalaxMarketplaceV3.test.js │ ├── DigitalaxRootTunnel.test.js │ ├── DigitalaxRootTunnelSubscriptionNFT.test.js │ ├── DigitalaxSubscriptionMarketplace.test.js │ ├── DigitalaxWhitelistedSales.test.js │ ├── DripMarketplace.test.js │ ├── GarmentNFT │ │ ├── DigitalaxGarmentERC721.test.js │ │ ├── DigitalaxGarmentNFT.test.js │ │ └── DigitalaxGarmentNFTv2.test.js │ ├── GenesisNFT │ │ ├── DigitalaxGenesisERC721.test.js │ │ └── DigitalaxGenesisNFT.test.js │ ├── Look.test.js │ ├── Materials │ │ ├── DigitalaxMaterials.js │ │ ├── DigitalaxMaterialsV2.js │ │ ├── ERC1155.behavior.js │ │ ├── ERC1155.test.js │ │ └── MockVault.test.js │ ├── ModelsMarketplace.test.js │ ├── Staking │ │ ├── DigitalaxGenesisV2Staking.test.js │ │ ├── DigitalaxMonaStaking.test.js │ │ ├── DigitalaxNFTRewardsV2.test.js │ │ ├── DigitalaxNFTStaking.test.js │ │ ├── DigitalaxRewardsV2.test.js │ │ ├── GuildNFTStaking.test.js │ │ ├── GuildNFTStakingV2.test.js │ │ ├── GuildNFTStakingV3.test.js │ │ └── GuildNFTStakingWeightV1.test.js │ └── SupportsInterface.behavior.js ├── tokensmigrated.json └── yarn.lock ├── subgraph-dlta ├── abis │ ├── ERC721.json │ ├── GDNMembership.json │ ├── GuildNFTStaking.json │ ├── GuildNFTStakingV3.json │ ├── GuildNFTStakingWeightV2.json │ ├── GuildNFTStakingWeightV4.json │ ├── GuildWhitelistedNFTStaking.json │ ├── GuildWhitelistedNFTStakingV3.json │ ├── LookGoldenTicket.json │ └── PodeNFTv2.json ├── networks │ ├── matic.json │ └── mumbai.json ├── package.json ├── schema.graphql ├── src │ ├── GDNDltaNFT.mapping.ts │ ├── GDNMembership.mapping.ts │ ├── GuildNFTStaking.mapping.ts │ ├── GuildNFTStakingWeightV2.mapping.ts │ ├── GuildWhitelistedNFTStaking.mapping.ts │ ├── LookGoldenTicket.mapping.ts │ ├── NewGDNGuildNFTStaking.mapping.ts │ ├── NewGDNGuildNFTStakingWeightV4.mapping.ts │ ├── NewGDNGuildWhitelistedNFTStaking.mapping.ts │ ├── NewLookGuildNFTStaking.mapping.ts │ ├── NewLookGuildNFTStakingWeightV4.mapping.ts │ ├── NewLookGuildWhitelistedNFTStaking.mapping.ts │ ├── NewPodeGuildNFTStaking.mapping.ts │ ├── NewPodeGuildNFTStakingWeightV4.mapping.ts │ ├── NewPodeGuildWhitelistedNFTStaking.mapping.ts │ ├── PodeNFTv2.mapping.ts │ ├── constants.ts │ └── factory │ │ ├── GDNCalculateWeights.factory.ts │ │ ├── GDNDltaNFTCollector.factory.ts │ │ ├── GDNMembershipCollector.factory.ts │ │ ├── LookCalculateWeights.factory.ts │ │ ├── LookGoldenTicketCollector.factory.ts │ │ ├── PodeCalculateWeights.factory.ts │ │ ├── PodeNFTv2Collector.factory.ts │ │ └── PodeNFTv2OGHolder.factory.ts ├── subgraph.template.yaml ├── subgraph.yaml └── yarn.lock ├── subgraph-matic ├── abis │ ├── AvatarElementals.json │ ├── DFBundle.json │ ├── DigitalaxAccessControls.json │ ├── DigitalaxAuction.json │ ├── DigitalaxAuctionV2.json │ ├── DigitalaxGarmentCollection.json │ ├── DigitalaxGarmentCollectionV2.json │ ├── DigitalaxGarmentNFT.json │ ├── DigitalaxGarmentNFTv2.json │ ├── DigitalaxGenesisV2.json │ ├── DigitalaxIndex.json │ ├── DigitalaxMarketplace.json │ ├── DigitalaxMarketplaceV2.json │ ├── DigitalaxMarketplaceV3.json │ ├── DigitalaxMaterials.json │ ├── DigitalaxMaterialsV2.json │ ├── DigitalaxModelCollection.json │ ├── DigitalaxModelIndex.json │ ├── DigitalaxModelMarketplace.json │ ├── DigitalaxModelNFT.json │ ├── DigitalaxMonaRewards.json │ ├── DigitalaxMonaStaking.json │ ├── DigitalaxNFTRewards.json │ ├── DigitalaxNFTStaking.json │ ├── DigitalaxOldNFTStaking.json │ ├── DigitalaxRewardsV2.json │ ├── DigitalaxSubscriptionCollection.json │ ├── DigitalaxSubscriptionMarketplace.json │ ├── DigitalaxSubscriptionNFT.json │ ├── DripMarketplace.json │ ├── DripOracle.json │ ├── ERC20.json │ ├── GDNMembershipNFT.json │ ├── LookGoldenTicket.json │ ├── PatronIndex.json │ └── PatronMarketplace.json ├── networks │ ├── matic.json │ └── mumbai.json ├── package-lock.json ├── package.json ├── schema.graphql ├── src │ ├── ArrayHelpers.ts │ ├── AvatarElementals.mapping.ts │ ├── DFBundle.mapping.ts │ ├── DateConverter.ts │ ├── DigitalaxAccessControls.mapping.ts │ ├── DigitalaxAuction.mapping.ts │ ├── DigitalaxAuctionV2.mapping.ts │ ├── DigitalaxGDNMembershipStaking.mapping.ts │ ├── DigitalaxGDNSpecialMembershipStaking.mapping.ts │ ├── DigitalaxGarmentCollection.mapping.ts │ ├── DigitalaxGarmentCollectionV2.mapping.ts │ ├── DigitalaxGarmentNFT.mapping.ts │ ├── DigitalaxGarmentNFTv2.mapping.ts │ ├── DigitalaxGenesisRewards.mapping.ts │ ├── DigitalaxGenesisV2.mapping.ts │ ├── DigitalaxGenesisV2Staking.mapping.ts │ ├── DigitalaxIndex.mapping.ts │ ├── DigitalaxMarketplace.mapping.ts │ ├── DigitalaxMarketplaceV2.mapping.ts │ ├── DigitalaxMarketplaceV3.mapping.ts │ ├── DigitalaxMaterials.mapping.ts │ ├── DigitalaxMaterialsV2.mapping.ts │ ├── DigitalaxModelCollection.mapping.ts │ ├── DigitalaxModelIndex.mapping.ts │ ├── DigitalaxModelMarketplace.mapping.ts │ ├── DigitalaxModelNFT.mapping.ts │ ├── DigitalaxMonaRewards.mapping.ts │ ├── DigitalaxMonaStaking.mapping.ts │ ├── DigitalaxNFTStaking.mapping.ts │ ├── DigitalaxOldNFTStaking.mapping.ts │ ├── DigitalaxRewardsV2.mapping.ts │ ├── DigitalaxSubscriptionCollection.mapping.ts │ ├── DigitalaxSubscriptionMarketplace.mapping.ts │ ├── DigitalaxSubscriptionNFT.mapping.ts │ ├── DripMarketplace.mapping.ts │ ├── DripOracle.mapping.ts │ ├── GDNMembershipNFT.mapping.ts │ ├── LookGoldenTicket.mapping.ts │ ├── PatronIndex.mapping.ts │ ├── PatronMarketplace.mapping.ts │ ├── TypeConverterUtils.ts │ ├── W3FStaking.mapping.ts │ ├── W3FStakingRewards.mapping.ts │ ├── constants.ts │ └── factory │ │ ├── Day.factory.ts │ │ ├── DigitalaxAccessControls.factory.ts │ │ ├── DigitalaxBundleOwner.factory.ts │ │ ├── DigitalaxChildOwner.factory.ts │ │ ├── DigitalaxChildV2Owner.factory.ts │ │ ├── DigitalaxCollector.factory.ts │ │ ├── DigitalaxCollectorV2.factory.ts │ │ ├── DigitalaxDesigner.factory.ts │ │ ├── DigitalaxDeveloper.factory.ts │ │ ├── DigitalaxGarmentChild.factory.ts │ │ ├── DigitalaxGarmentDesigner.factory.ts │ │ ├── DigitalaxGarmentNFTGlobalStats.factory.ts │ │ ├── DigitalaxGarmentNFTV2GlobalStats.factory.ts │ │ ├── DigitalaxGarmentV2Child.factory.ts │ │ ├── DigitalaxGarmentV2Designer.factory.ts │ │ ├── DigitalaxGenesisV2Collector.factory.ts │ │ ├── DigitalaxGenesisV2OGHolder.factory.ts │ │ ├── DigitalaxMarketplaceRevenue.factory.ts │ │ ├── DigitalaxMarketplaceV3PurchaseHistory.factory.ts │ │ ├── DigitalaxMarketplaceW3fRevenue.factory.ts │ │ ├── DigitalaxModel.factory.ts │ │ ├── DigitalaxModelChild.factory.ts │ │ ├── DigitalaxModelCollector.factory.ts │ │ ├── DigitalaxModelDesigner.factory.ts │ │ ├── DigitalaxModelGlobalStats.factory.ts │ │ ├── DigitalaxModelNFTDesigner.factory.ts │ │ ├── DigitalaxModelNFTModel.factory.ts │ │ ├── DigitalaxMonaStaking.factory.ts │ │ ├── DigitalaxSubscriptionChild.factory.ts │ │ ├── DigitalaxSubscriptionCollector.factory.ts │ │ ├── DigitalaxSubscriptionDesigner.factory.ts │ │ ├── DigitalaxSubscriptionNFTGlobalStats.factory.ts │ │ ├── DripDay.factory.ts │ │ ├── DripGlobalStats.factory.ts │ │ ├── GenesisContributor.factory.ts │ │ ├── PatronDay.factory.ts │ │ ├── PatronGlobalStats.factory.ts │ │ ├── SubscriptionDay.factory.ts │ │ ├── W3FRevenue.factory.ts │ │ └── W3FStaking.factory.ts ├── subgraph.template.mumbai.yaml ├── subgraph.template.yaml ├── subgraph.yaml ├── subgraph.yaml.mumbaiofficial ├── subgraphMODELS.yaml ├── subgraphgraft.yaml └── yarn.lock └── subgraph ├── .gitignore ├── README.md ├── abis ├── DigitalaxAccessControls.json ├── DigitalaxAuction.json ├── DigitalaxGarmentCollection.json ├── DigitalaxGarmentNFT.json ├── DigitalaxGenesisNFT.json ├── DigitalaxGenesisStaking.json ├── DigitalaxIndex.json ├── DigitalaxLookNFT.json ├── DigitalaxMarketplace.json ├── DigitalaxMaterials.json ├── DigitalaxNFTStaking.json ├── DigitalaxPodePortal.json └── DigitalaxSubscriptionCollection.json ├── networks ├── goerli.json ├── mainnet.json ├── rinkeby.json └── ropsten.json ├── package.json ├── schema.graphql ├── src ├── ArrayHelpers.ts ├── DateConverter.ts ├── DigitalaxAccessControls.mapping.ts ├── DigitalaxAuction.mapping.ts ├── DigitalaxGarmentCollection.mapping.ts ├── DigitalaxGarmentNFT.mapping.ts ├── DigitalaxGenesisNFT.mapping.ts ├── DigitalaxGenesisStaking.mapping.ts ├── DigitalaxIndex.mapping.ts ├── DigitalaxLookNFT.mapping.ts ├── DigitalaxMarketplace.mapping.ts ├── DigitalaxMaterials.mapping.ts ├── DigitalaxNFTStaking.mapping.ts ├── DigitalaxPodePortal.mapping.ts ├── TypeConverterUtils.ts ├── constants.ts └── factory │ ├── Day.factory.ts │ ├── DigitalaxAccessControls.factory.ts │ ├── DigitalaxChildOwner.factory.ts │ ├── DigitalaxCollector.factory.ts │ ├── DigitalaxGarmentChild.factory.ts │ ├── DigitalaxGarmentDesigner.factory.ts │ ├── DigitalaxGarmentNFTGlobalStats.factory.ts │ └── GenesisContributor.factory.ts ├── subgraph.template.yaml ├── subgraph.yaml └── yarn.lock /.github/workflows/node_test_runner.yml: -------------------------------------------------------------------------------- 1 | name: Test Runner 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | strategy: 11 | matrix: 12 | node-version: [10.x] 13 | 14 | steps: 15 | - uses: actions/checkout@v1 16 | - name: Use Node.js ${{ matrix.node-version }} 17 | uses: actions/setup-node@v1 18 | with: 19 | node-version: ${{ matrix.node-version }} 20 | - name: Install dependencies and run test 21 | run: | 22 | cd smart-contracts/ 23 | yarn 24 | yarn test 25 | env: 26 | CI: true 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 BlockRocket.tech 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Digitalax Monorepo 2 | 3 | ## Smart Contracts 4 | 5 | * Built using [buidler/hardhat](https://buidler.dev/) 6 | * Contracts based on [OpenZeppelin](https://github.com/OpenZeppelin/openzeppelin-contracts) 7 | 8 | ### Setup 9 | 10 | * Move to repo folder `cd smart-contracts` 11 | * Install dependencies `yarn` 12 | * Run tests `yarn test` 13 | 14 | #### Running GAS reports 15 | * in its own terminal tab run: `npx buidler node` 16 | * Run test with `GAS` profiling `yarn test-with-gas` 17 | 18 | ## Metadata 19 | 20 | * See project [nft-minting-scripts](https://github.com/DIGITALAX/nft-minting-scripts) 21 | 22 | ### Subgraph 23 | 24 | * Responsible for indexing events/data from the Digitalax contracts 25 | * Hosted subgraph details can be found [here](https://hackmd.io/RzmT0y91ReyRmrh084ShNA) 26 | 27 | -------------------------------------------------------------------------------- /smart-contracts/.env.example: -------------------------------------------------------------------------------- 1 | GENESIS_START= 2 | GENESIS_END= 3 | PRIVATE_KEY= 4 | INFURA_PROJECT_ID= 5 | ACCESS_CONTROLS_ADDRESS= 6 | ERC1155_MATERIALS_ADDRESS= 7 | ERC721_GARMENT_ADDRESS= 8 | AUCTION_ADDRESS= 9 | GARMENT_FACTORY_ADDRESS= 10 | -------------------------------------------------------------------------------- /smart-contracts/contracts/EIP2771/BaseRelayRecipient.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier:MIT 2 | pragma solidity 0.6.12; 3 | 4 | import "./IRelayRecipient.sol"; 5 | 6 | /** 7 | * A base contract to be inherited by any contract that want to receive relayed transactions 8 | * A subclass must use "_msgSender()" instead of "msg.sender" 9 | */ 10 | abstract contract BaseRelayRecipient is IRelayRecipient { 11 | 12 | /* 13 | * Forwarder singleton we accept calls from 14 | */ 15 | address public trustedForwarder; 16 | 17 | /* 18 | * require a function to be called through GSN only 19 | */ 20 | modifier trustedForwarderOnly() { 21 | require(msg.sender == address(trustedForwarder), "Function can only be called through the trusted Forwarder"); 22 | _; 23 | } 24 | 25 | function isTrustedForwarder(address forwarder) public override view returns(bool) { 26 | return forwarder == trustedForwarder; 27 | } 28 | 29 | /** 30 | * return the sender of this call. 31 | * if the call came through our trusted forwarder, return the original sender. 32 | * otherwise, return `msg.sender`. 33 | * should be used in the contract anywhere instead of msg.sender 34 | */ 35 | function msgSender() internal override view returns (address payable ret) { 36 | if (msg.data.length >= 24 && isTrustedForwarder(msg.sender)) { 37 | // At this point we know that the sender is a trusted forwarder, 38 | // so we trust that the last bytes of msg.data are the verified sender address. 39 | // extract sender address from the end of msg.data 40 | assembly { 41 | ret := shr(96,calldataload(sub(calldatasize(),20))) 42 | } 43 | } else { 44 | return msg.sender; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /smart-contracts/contracts/EIP2771/IRelayRecipient.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier:MIT 2 | pragma solidity 0.6.12; 3 | 4 | /** 5 | * a contract must implement this interface in order to support relayed transaction. 6 | * It is better to inherit the BaseRelayRecipient as its implementation. 7 | */ 8 | abstract contract IRelayRecipient { 9 | 10 | /** 11 | * return if the forwarder is trusted to forward relayed transactions to us. 12 | * the forwarder is required to verify the sender's signature, and verify 13 | * the call is not a replay. 14 | */ 15 | function isTrustedForwarder(address forwarder) public virtual view returns(bool); 16 | 17 | /** 18 | * return the sender of this call. 19 | * if the call came through our trusted forwarder, then the real sender is appended as the last 20 bytes 20 | * of the msg.data. 21 | * otherwise, return `msg.sender` 22 | * should be used in the contract anywhere instead of msg.sender 23 | */ 24 | function msgSender() internal virtual view returns (address payable); 25 | 26 | function versionRecipient() external virtual view returns (string memory); 27 | } -------------------------------------------------------------------------------- /smart-contracts/contracts/ERC1155/ERC1155Burnable.sol: -------------------------------------------------------------------------------- 1 | //imported from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/aaa5ef81cf75454d1c337dc3de03d12480849ad1/contracts/token/ERC1155/ERC1155Burnable.sol 2 | 3 | // SPDX-License-Identifier: MIT 4 | 5 | pragma solidity 0.6.12; 6 | 7 | import "./ERC1155.sol"; 8 | 9 | /** 10 | * @dev Extension of {ERC1155} that allows token holders to destroy both their 11 | * own tokens and those that they have been approved to use. 12 | * 13 | * _Available since v3.1._ 14 | */ 15 | abstract contract ERC1155Burnable is ERC1155 { 16 | function burn(address account, uint256 id, uint256 amount) public virtual { 17 | require( 18 | account == _msgSender() || isApprovedForAll(account, _msgSender()), 19 | "ERC1155: caller is not owner nor approved" 20 | ); 21 | 22 | _burn(account, id, amount); 23 | } 24 | 25 | function burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) public virtual { 26 | require( 27 | account == _msgSender() || isApprovedForAll(account, _msgSender()), 28 | "ERC1155: caller is not owner nor approved" 29 | ); 30 | 31 | _burnBatch(account, ids, amounts); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /smart-contracts/contracts/ERC1155/ERC1155BurnableV2.sol: -------------------------------------------------------------------------------- 1 | //imported from: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/aaa5ef81cf75454d1c337dc3de03d12480849ad1/contracts/token/ERC1155/ERC1155Burnable.sol 2 | 3 | // SPDX-License-Identifier: MIT 4 | 5 | pragma solidity 0.6.12; 6 | 7 | import "./ERC1155.sol"; 8 | 9 | /** 10 | * @dev Extension of {ERC1155} that allows token holders to destroy both their 11 | * own tokens and those that they have been approved to use. 12 | * 13 | * _Available since v3.1._ 14 | */ 15 | abstract contract ERC1155BurnableV2 is ERC1155 { 16 | 17 | // Set smart contract for garmentNft 18 | address public garmentNFTApproved; 19 | 20 | function burn(address account, uint256 id, uint256 amount) public virtual { 21 | require( 22 | account == _msgSender() || isApprovedForAll(account, _msgSender()), 23 | "ERC1155: caller is not owner nor approved" 24 | ); 25 | 26 | _burn(account, id, amount); 27 | } 28 | 29 | function burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) public virtual { 30 | require( 31 | account == _msgSender() || isApprovedForAll(account, _msgSender()) || _msgSender() == garmentNFTApproved, 32 | "ERC1155: caller is not owner nor approved" 33 | ); 34 | 35 | _burnBatch(account, ids, amounts); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /smart-contracts/contracts/ERC20/IWETH.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.5.0; 2 | 3 | interface IWETH { 4 | function deposit() external payable; 5 | function transfer(address to, uint value) external returns (bool); 6 | function withdraw(uint) external; 7 | } -------------------------------------------------------------------------------- /smart-contracts/contracts/ERC998/IERC998ERC1155TopDown.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; 6 | 7 | // Based on: https://github.com/rocksideio/ERC998-ERC1155-TopDown/blob/695963195606304374015c49d166ab2fbeb42ea9/contracts/IERC998ERC1155TopDown.sol 8 | interface IERC998ERC1155TopDown is IERC1155Receiver { 9 | 10 | event ReceivedChild(address indexed from, uint256 indexed toTokenId, address indexed childContract, uint256 childTokenId, uint256 amount); 11 | event TransferBatchChild(uint256 indexed fromTokenId, address indexed to, address indexed childContract, uint256[] childTokenIds, uint256[] amounts); 12 | 13 | function childContractsFor(uint256 tokenId) external view returns (address[] memory childContracts); 14 | function childIdsForOn(uint256 tokenId, address childContract) external view returns (uint256[] memory childIds); 15 | function childBalance(uint256 tokenId, address childContract, uint256 childTokenId) external view returns (uint256); 16 | } 17 | -------------------------------------------------------------------------------- /smart-contracts/contracts/IDigitalaxAccessControls.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | interface IDigitalaxAccessControls { 6 | /** 7 | * @notice Used to check whether an address has the admin role 8 | * @param _address EOA or contract being checked 9 | * @return bool True if the account has the role or false if it does not 10 | */ 11 | function hasAdminRole(address _address) external view returns (bool); 12 | 13 | function hasMinterRole(address _address) external view returns (bool); 14 | 15 | function hasVerifiedMinterRole(address _address) 16 | external 17 | view 18 | returns (bool); 19 | 20 | /** 21 | * @notice Used to check whether an address has the smart contract role 22 | * @param _address EOA or contract being checked 23 | * @return bool True if the account has the role or false if it does not 24 | */ 25 | function hasSmartContractRole(address _address) external view returns (bool); 26 | } 27 | -------------------------------------------------------------------------------- /smart-contracts/contracts/garment/IDigitalaxGarmentNFT.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; 6 | 7 | interface IDigitalaxGarmentNFT is IERC721 { 8 | function isApproved(uint256 _tokenId, address _operator) external view returns (bool); 9 | function setPrimarySalePrice(uint256 _tokenId, uint256 _salePrice) external; 10 | function garmentDesigners(uint256 _tokenId) external view returns (address); 11 | function mint(address _beneficiary, string calldata _tokenUri, address _designer) external returns (uint256); 12 | function burn(uint256 _tokenId) external; 13 | } 14 | -------------------------------------------------------------------------------- /smart-contracts/contracts/garment/IDigitalaxMaterials.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; 7 | 8 | interface IDigitalaxMaterials is IERC1155 { 9 | function createChild(string calldata _uri) external returns (uint256); 10 | function batchCreateChildren(string[] calldata _uris) external returns (uint256[] memory); 11 | function mintChild(uint256 _childTokenId, uint256 _amount, address _beneficiary, bytes calldata _data) external; 12 | function batchMintChildren(uint256[] calldata _childTokenIds, uint256[] calldata _amounts, address _beneficiary, bytes calldata _data) external; 13 | } 14 | -------------------------------------------------------------------------------- /smart-contracts/contracts/garment/IModelsNFT.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; 6 | 7 | interface IModelsNFT is IERC721 { 8 | function isApproved(uint256 _tokenId, address _operator) external view returns (bool); 9 | function setPrimarySalePrice(uint256 _tokenId, uint256 _salePrice) external; 10 | function garmentDesigners(uint256 _tokenId) external view returns (address); 11 | function garmentModels(uint256 _tokenId) external view returns (address); 12 | function mint(address _beneficiary, string calldata _tokenUri, address _designer, address _model) external returns (uint256); 13 | function burn(uint256 _tokenId) external; 14 | } 15 | -------------------------------------------------------------------------------- /smart-contracts/contracts/lib/Merkle.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.6.12; 2 | 3 | library Merkle { 4 | function checkMembership( 5 | bytes32 leaf, 6 | uint256 index, 7 | bytes32 rootHash, 8 | bytes memory proof 9 | ) internal pure returns (bool) { 10 | require(proof.length % 32 == 0, "Invalid proof length"); 11 | uint256 proofHeight = proof.length / 32; 12 | // Proof of size n means, height of the tree is n+1. 13 | // In a tree of height n+1, max #leafs possible is 2 ^ n 14 | require(index < 2 ** proofHeight, "Leaf index is too big"); 15 | 16 | bytes32 proofElement; 17 | bytes32 computedHash = leaf; 18 | for (uint256 i = 32; i <= proof.length; i += 32) { 19 | assembly { 20 | proofElement := mload(add(proof, i)) 21 | } 22 | 23 | if (index % 2 == 0) { 24 | computedHash = keccak256( 25 | abi.encodePacked(computedHash, proofElement) 26 | ); 27 | } else { 28 | computedHash = keccak256( 29 | abi.encodePacked(proofElement, computedHash) 30 | ); 31 | } 32 | 33 | index = index / 2; 34 | } 35 | return computedHash == rootHash; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/AlwaysRevertingEthReceiver.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | contract AlwaysRevertingEthReceiver { 6 | receive() external payable { 7 | revert("No thanks"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/BiddingContractMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../DigitalaxAuction.sol"; 6 | 7 | contract BiddingContractMock { 8 | DigitalaxAuction public auctionContract; 9 | 10 | constructor(DigitalaxAuction _auctionContract) public { 11 | auctionContract = _auctionContract; 12 | } 13 | 14 | function bid(uint256 _garmentTokenId, uint256 _monaAmount) external payable { 15 | auctionContract.placeBid{value: msg.value}(_garmentTokenId, _monaAmount); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/DigitalaxAuctionMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../DigitalaxAuction.sol"; 6 | 7 | contract DigitalaxAuctionMock is DigitalaxAuction { 8 | uint256 public nowOverride; 9 | 10 | constructor( 11 | DigitalaxAccessControls _accessControls, 12 | IDigitalaxGarmentNFT _garmentNft, 13 | IDigitalaxMonaOracle _oracle, 14 | IERC20 _monaToken, 15 | address payable _platformReserveAddress, 16 | address _trustedForwarder 17 | ) 18 | DigitalaxAuction(_accessControls, _garmentNft, _oracle, _monaToken, _platformReserveAddress, _trustedForwarder) 19 | public {} 20 | 21 | function setNowOverride(uint256 _now) external { 22 | nowOverride = _now; 23 | } 24 | 25 | function _getNow() internal override view returns (uint256) { 26 | return nowOverride; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/DigitalaxGenesisNFTMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../DigitalaxGenesisNFT.sol"; 6 | 7 | contract DigitalaxGenesisNFTMock is DigitalaxGenesisNFT { 8 | uint256 public nowOverride; 9 | uint256 public maxGenesisContributionTokensOverride; 10 | 11 | constructor( 12 | DigitalaxAccessControls _accessControls, 13 | address payable _fundsMultisig, 14 | uint256 _genesisStart, 15 | uint256 _genesisEnd, 16 | string memory _tokenURI 17 | ) 18 | DigitalaxGenesisNFT(_accessControls, _fundsMultisig, _genesisStart, _genesisEnd, _tokenURI) 19 | public {} 20 | 21 | function addContribution(uint256 _contributionAmount) external { 22 | contribution[_msgSender()] = _contributionAmount; 23 | totalContributions = totalContributions.add(_contributionAmount); 24 | } 25 | 26 | function setNowOverride(uint256 _now) external { 27 | nowOverride = _now; 28 | } 29 | 30 | function setMaxGenesisContributionTokensOverride(uint256 _maxGenesisContributionTokensOverride) external { 31 | maxGenesisContributionTokensOverride = _maxGenesisContributionTokensOverride; 32 | } 33 | 34 | function _getNow() internal override view returns (uint256) { 35 | return nowOverride; 36 | } 37 | 38 | function _getMaxGenesisContributionTokens() internal override view returns (uint256) { 39 | return maxGenesisContributionTokensOverride; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/DigitalaxMarketplaceMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../DigitalaxMarketplace.sol"; 6 | 7 | contract DigitalaxMarketplaceMock is DigitalaxMarketplace { 8 | uint256 public nowOverride; 9 | 10 | constructor( 11 | DigitalaxAccessControls _accessControls, 12 | IDigitalaxGarmentNFT _garmentNft, 13 | DigitalaxGarmentCollection _garmentCollection, 14 | IDigitalaxMonaOracle _oracle, 15 | address payable _platformReserveAddress, 16 | address _monaErc20Token, 17 | address _trustedForwarder 18 | ) 19 | DigitalaxMarketplace(_accessControls, _garmentNft, _garmentCollection, _oracle, _platformReserveAddress, _monaErc20Token, _trustedForwarder) 20 | public {} 21 | 22 | function setNowOverride(uint256 _now) external { 23 | nowOverride = _now; 24 | } 25 | 26 | function _getNow() internal override view returns (uint256) { 27 | return nowOverride; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/DigitalaxMarketplaceV2Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../DigitalaxMarketplaceV2.sol"; 6 | 7 | contract DigitalaxMarketplaceV2Mock is DigitalaxMarketplaceV2 { 8 | uint256 public nowOverride; 9 | 10 | // constructor( 11 | // DigitalaxAccessControls _accessControls, 12 | // IDigitalaxGarmentNFT _garmentNft, 13 | // DigitalaxSubscriptionCollection _garmentCollection, 14 | // IDigitalaxMonaOracle _oracle, 15 | // address payable _platformReserveAddress, 16 | // address _monaErc20Token, 17 | // address _trustedForwarder 18 | // ) 19 | // DigitalaxSubscriptionMarketplace(_accessControls, _garmentNft, _garmentCollection, _oracle, _platformReserveAddress, _monaErc20Token, _trustedForwarder) 20 | // public {} 21 | 22 | function setNowOverride(uint256 _now) external { 23 | nowOverride = _now; 24 | } 25 | 26 | function _getNow() internal override view returns (uint256) { 27 | return nowOverride; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/DigitalaxMarketplaceV3Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../DigitalaxMarketplaceV3.sol"; 6 | 7 | contract DigitalaxMarketplaceV3Mock is DigitalaxMarketplaceV3 { 8 | uint256 public nowOverride; 9 | 10 | function setNowOverride(uint256 _now) external { 11 | nowOverride = _now; 12 | } 13 | 14 | function _getNow() internal override view returns (uint256) { 15 | return nowOverride; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/DigitalaxMonaStakingMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../staking/DigitalaxMonaStaking.sol"; 6 | 7 | contract DigitalaxMonaStakingMock is DigitalaxMonaStaking { 8 | uint256 public nowOverride; 9 | 10 | function setNowOverride(uint256 _now) external { 11 | nowOverride = _now; 12 | } 13 | 14 | function _getNow() internal override view returns (uint256) { 15 | return nowOverride; 16 | } 17 | 18 | // Temporary to test 19 | function monaValue(uint256 lpQuantity) 20 | internal 21 | override 22 | view 23 | returns (uint256) 24 | { 25 | return lpQuantity; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/DigitalaxNFTRewardsV2Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../staking/DigitalaxNFTRewardsV2.sol"; 6 | import "../oracle/IDigitalaxMonaOracle.sol"; 7 | 8 | contract DigitalaxNFTRewardsV2Mock is DigitalaxNFTRewardsV2 { 9 | uint256 public nowOverride; 10 | 11 | function setNowOverride(uint256 _now) external { 12 | nowOverride = _now; 13 | } 14 | 15 | function _getNow() internal override view returns (uint256) { 16 | return nowOverride; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/DigitalaxNFTStakingMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../staking/DigitalaxNFTStaking.sol"; 6 | 7 | contract DigitalaxNFTStakingMock is DigitalaxNFTStaking { 8 | uint256 public nowOverride; 9 | 10 | constructor( 11 | ) 12 | DigitalaxNFTStaking() 13 | public {} 14 | 15 | function setNowOverride(uint256 _now) external { 16 | nowOverride = _now; 17 | } 18 | 19 | function _getNow() internal override view returns (uint256) { 20 | return nowOverride; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/DigitalaxPodeNFTMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../DigitalaxPodeNFT.sol"; 6 | 7 | contract DigitalaxPodeNFTMock is DigitalaxPodeNFT { 8 | uint256 public nowOverride; 9 | uint256 public maxPodeContributionTokensOverride; 10 | 11 | constructor( 12 | address payable _fundsMultisig, 13 | uint256 _podeStart, 14 | uint256 _podeEnd, 15 | uint256 _podeLockTime, 16 | string memory _tokenURI 17 | ) 18 | DigitalaxPodeNFT(_fundsMultisig, _podeStart, _podeEnd, _podeLockTime, _tokenURI) 19 | public {} 20 | 21 | function setNowOverride(uint256 _now) external { 22 | nowOverride = _now; 23 | } 24 | 25 | function setMaxPodeContributionTokensOverride(uint256 _maxPodeContributionTokensOverride) external { 26 | maxPodeContributionTokensOverride = _maxPodeContributionTokensOverride; 27 | } 28 | 29 | function _getNow() internal override view returns (uint256) { 30 | return nowOverride; 31 | } 32 | 33 | function _getMaxPodeContributionTokens() internal override view returns (uint256) { 34 | return maxPodeContributionTokensOverride; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/DigitalaxRewardsV2Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../staking/DigitalaxRewardsV2.sol"; 6 | import "../oracle/IDigitalaxMonaOracle.sol"; 7 | 8 | contract DigitalaxRewardsV2Mock is DigitalaxRewardsV2 { 9 | uint256 public nowOverride; 10 | 11 | function setNowOverride(uint256 _now) external { 12 | nowOverride = _now; 13 | } 14 | 15 | function _getNow() internal override view returns (uint256) { 16 | return nowOverride; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/DigitalaxSubscriptionMarketplaceMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../DigitalaxSubscriptionMarketplace.sol"; 6 | 7 | contract DigitalaxSubscriptionMarketplaceMock is DigitalaxSubscriptionMarketplace { 8 | uint256 public nowOverride; 9 | 10 | // constructor( 11 | // DigitalaxAccessControls _accessControls, 12 | // IDigitalaxGarmentNFT _garmentNft, 13 | // DigitalaxSubscriptionCollection _garmentCollection, 14 | // IDigitalaxMonaOracle _oracle, 15 | // address payable _platformReserveAddress, 16 | // address _monaErc20Token, 17 | // address _trustedForwarder 18 | // ) 19 | // DigitalaxSubscriptionMarketplace(_accessControls, _garmentNft, _garmentCollection, _oracle, _platformReserveAddress, _monaErc20Token, _trustedForwarder) 20 | // public {} 21 | 22 | function setNowOverride(uint256 _now) external { 23 | nowOverride = _now; 24 | } 25 | 26 | function _getNow() internal override view returns (uint256) { 27 | return nowOverride; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/DigitalaxWhitelistedSalesMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../DigitalaxWhitelistedSales.sol"; 6 | 7 | contract DigitalaxWhitelistedSalesMock is DigitalaxWhitelistedSales { 8 | uint256 public nowOverride; 9 | 10 | function setNowOverride(uint256 _now) external { 11 | nowOverride = _now; 12 | } 13 | 14 | function _getNow() internal override view returns (uint256) { 15 | return nowOverride; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/DripMarketplaceMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../DripMarketplace.sol"; 6 | 7 | contract DripMarketplaceMock is DripMarketplace { 8 | uint256 public nowOverride; 9 | 10 | function setNowOverride(uint256 _now) external { 11 | nowOverride = _now; 12 | } 13 | 14 | function _getNow() internal override view returns (uint256) { 15 | return nowOverride; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/ERC1155Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.6.0; 4 | 5 | import "../ERC1155/ERC1155.sol"; 6 | 7 | contract ERC1155Mock is ERC1155 { 8 | 9 | function mint(uint256 id, uint256 amount) external { 10 | _mint(msg.sender, id, amount, ""); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/ERC165Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.6.0; 4 | 5 | import "@openzeppelin/contracts/introspection/ERC165.sol"; 6 | 7 | contract ERC165Mock is ERC165 { 8 | function registerInterface(bytes4 interfaceId) public { 9 | _registerInterface(interfaceId); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/ERC721ReceiverMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.6.0; 4 | 5 | import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; 6 | 7 | contract ERC721ReceiverMock is IERC721Receiver { 8 | bytes4 private _retval; 9 | bool private _reverts; 10 | 11 | event Received(address operator, address from, uint256 tokenId, bytes data, uint256 gas); 12 | 13 | constructor (bytes4 retval, bool reverts) public { 14 | _retval = retval; 15 | _reverts = reverts; 16 | } 17 | 18 | function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) 19 | public override returns (bytes4) 20 | { 21 | require(!_reverts, "ERC721ReceiverMock: reverting"); 22 | emit Received(operator, from, tokenId, data, gasleft()); 23 | return _retval; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/GuildNFTRewardsMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../oracle/IDigitalaxMonaOracle.sol"; 6 | import "../staking/GuildNFTRewards.sol"; 7 | 8 | contract GuildNFTRewardsMock is GuildNFTRewards { 9 | uint256 public nowOverride; 10 | 11 | constructor( 12 | DECO _decoToken, 13 | DigitalaxAccessControls _accessControls, 14 | DigitalaxStaking _nftStaking, 15 | IOracle _oracle, 16 | address _trustedForwarder, 17 | uint256 _startTime, 18 | uint256 _decoRewardsPaidTotal 19 | ) 20 | GuildNFTRewards(_decoToken, _accessControls, _nftStaking, _oracle, _trustedForwarder, _startTime, _decoRewardsPaidTotal) 21 | public {} 22 | 23 | function setNowOverride(uint256 _now) external { 24 | nowOverride = _now; 25 | } 26 | 27 | function _getNow() internal override view returns (uint256) { 28 | return nowOverride; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/GuildNFTRewardsV2Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../oracle/IDigitalaxMonaOracle.sol"; 6 | import "../staking/GuildNFTRewardsV2.sol"; 7 | 8 | contract GuildNFTRewardsV2Mock is GuildNFTRewardsV2 { 9 | uint256 public nowOverride; 10 | 11 | constructor( 12 | ) 13 | GuildNFTRewardsV2() 14 | public {} 15 | 16 | function setNowOverride(uint256 _now) external { 17 | nowOverride = _now; 18 | } 19 | 20 | function _getNow() internal override view returns (uint256) { 21 | return nowOverride; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/GuildNFTRewardsV3Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../oracle/IDigitalaxMonaOracle.sol"; 6 | import "../staking/GuildNFTRewardsV3.sol"; 7 | 8 | contract GuildNFTRewardsV3Mock is GuildNFTRewardsV3 { 9 | uint256 public nowOverride; 10 | 11 | constructor( 12 | ) 13 | GuildNFTRewardsV3() 14 | public {} 15 | 16 | function setNowOverride(uint256 _now) external { 17 | nowOverride = _now; 18 | } 19 | 20 | function _getNow() internal override view returns (uint256) { 21 | return nowOverride; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/GuildNFTStakingMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../staking/GuildNFTStaking.sol"; 7 | 8 | contract GuildNFTStakingMock is GuildNFTStaking { 9 | uint256 public nowOverride; 10 | 11 | constructor( 12 | ) 13 | GuildNFTStaking() 14 | public {} 15 | 16 | function setNowOverride(uint256 _now) external { 17 | nowOverride = _now; 18 | } 19 | 20 | function _getNow() internal override view returns (uint256) { 21 | return nowOverride; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/GuildNFTStakingV3Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../staking/GuildNFTStakingV3.sol"; 7 | 8 | contract GuildNFTStakingV3Mock is GuildNFTStakingV3 { 9 | uint256 public nowOverride; 10 | 11 | constructor( 12 | ) 13 | GuildNFTStakingV3() 14 | public {} 15 | 16 | function setNowOverride(uint256 _now) external { 17 | nowOverride = _now; 18 | } 19 | 20 | function _getNow() internal override view returns (uint256) { 21 | return nowOverride; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/GuildNFTStakingWeightMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../staking/GuildNFTStakingWeightV1.sol"; 6 | 7 | contract GuildNFTStakingWeightMock is GuildNFTStakingWeightV1 { 8 | uint256 public nowOverride; 9 | 10 | constructor( 11 | ) 12 | GuildNFTStakingWeightV1() 13 | public {} 14 | 15 | function setNowOverride(uint256 _now) external { 16 | nowOverride = _now; 17 | } 18 | 19 | function _getNow() internal override view returns (uint256) { 20 | return nowOverride; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/GuildNFTStakingWeightV2Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../staking/GuildNFTStakingWeightV2.sol"; 7 | 8 | contract GuildNFTStakingWeightV2Mock is GuildNFTStakingWeightV2 { 9 | uint256 public nowOverride; 10 | 11 | function setNowOverride(uint256 _now) external { 12 | nowOverride = _now; 13 | } 14 | 15 | function _getNow() internal override view returns (uint256) { 16 | return nowOverride; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/GuildNFTStakingWeightV2StorageMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../staking/GuildNFTStakingWeightV2Storage.sol"; 7 | 8 | contract GuildNFTStakingWeightV2StorageMock is GuildNFTStakingWeightV2Storage { 9 | } 10 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/GuildNFTStakingWeightV3Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../staking/GuildNFTStakingWeightV3.sol"; 7 | 8 | contract GuildNFTStakingWeightV3Mock is GuildNFTStakingWeightV3 { 9 | uint256 public nowOverride; 10 | 11 | function setNowOverride(uint256 _now) external { 12 | nowOverride = _now; 13 | } 14 | 15 | function _getNow() internal override view returns (uint256) { 16 | return nowOverride; 17 | } 18 | 19 | // // STARTING HERE 20 | // // EXAMPLE NEW STORED VARIABLE 21 | // 22 | // function setTest() external { 23 | // testValue = uint256(666); 24 | // } 25 | // uint256 public testValue; 26 | } 27 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/GuildNFTStakingWeightV4Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../staking/GuildNFTStakingWeightV4.sol"; 7 | 8 | contract GuildNFTStakingWeightV4Mock is GuildNFTStakingWeightV4 { 9 | uint256 public nowOverride; 10 | 11 | function setNowOverride(uint256 _now) external { 12 | nowOverride = _now; 13 | } 14 | 15 | function _getNow() internal override view returns (uint256) { 16 | return nowOverride; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/GuildWhitelistedNFTStakingMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../staking/GuildWhitelistedNFTStaking.sol"; 7 | 8 | contract GuildWhitelistedNFTStakingMock is GuildWhitelistedNFTStaking { 9 | uint256 public nowOverride; 10 | 11 | constructor( 12 | ) 13 | GuildWhitelistedNFTStaking() 14 | public {} 15 | 16 | function setNowOverride(uint256 _now) external { 17 | nowOverride = _now; 18 | } 19 | 20 | function _getNow() internal override view returns (uint256) { 21 | return nowOverride; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/GuildWhitelistedNFTStakingV2Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../staking/GuildWhitelistedNFTStakingV2.sol"; 7 | 8 | contract GuildWhitelistedNFTStakingV2Mock is GuildWhitelistedNFTStakingV2 { 9 | uint256 public nowOverride; 10 | 11 | constructor( 12 | ) 13 | GuildWhitelistedNFTStakingV2() 14 | public {} 15 | 16 | function setNowOverride(uint256 _now) external { 17 | nowOverride = _now; 18 | } 19 | 20 | function _getNow() internal override view returns (uint256) { 21 | return nowOverride; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/GuildWhitelistedNFTStakingV3Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../staking/GuildWhitelistedNFTStakingV3.sol"; 7 | 8 | contract GuildWhitelistedNFTStakingV3Mock is GuildWhitelistedNFTStakingV3 { 9 | uint256 public nowOverride; 10 | 11 | constructor( 12 | ) 13 | GuildWhitelistedNFTStakingV3() 14 | public {} 15 | 16 | function setNowOverride(uint256 _now) external { 17 | nowOverride = _now; 18 | } 19 | 20 | function _getNow() internal override view returns (uint256) { 21 | return nowOverride; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/MarketplaceBuyingContractMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.6.12; 3 | import "../DigitalaxMarketplace.sol"; 4 | contract MarketplaceBuyingContractMock { 5 | DigitalaxMarketplace public marketplaceContract; 6 | constructor(DigitalaxMarketplace _marketplaceContract) public { 7 | marketplaceContract = _marketplaceContract; 8 | } 9 | function buyOfferWithEth(uint256 _garmentTokenId) external payable { 10 | marketplaceContract.buyOffer{value: msg.value}(_garmentTokenId, false); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/MockDECO.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../DECO.sol"; 6 | 7 | contract MockDECO is DECO { 8 | constructor( 9 | ) public { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/MockERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 6 | 7 | contract MockERC20 is ERC20 { 8 | constructor( 9 | string memory name, 10 | string memory symbol, 11 | uint256 supply 12 | ) public ERC20(name, symbol) { 13 | _mint(msg.sender, supply); 14 | } 15 | 16 | function mint(address _to, uint256 _amount) public { 17 | _mint(_to, _amount); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /smart-contracts/contracts/mock/ModelsMarketplaceMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | import "../ModelsMarketplace.sol"; 6 | 7 | contract ModelsMarketplaceMock is ModelsMarketplace { 8 | uint256 public nowOverride; 9 | 10 | function setNowOverride(uint256 _now) external { 11 | nowOverride = _now; 12 | } 13 | 14 | function _getNow() internal override view returns (uint256) { 15 | return nowOverride; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /smart-contracts/contracts/oracle/IDigitalaxMonaOracle.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | interface IDigitalaxMonaOracle { 6 | function getData() external returns (uint256, bool); 7 | } 8 | -------------------------------------------------------------------------------- /smart-contracts/contracts/oracle/IDripOracle.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | interface IDripOracle { 6 | function getData(address payableToken) external view returns (uint256, bool); 7 | function checkValidToken(address _payableToken) external view returns (bool isValid); 8 | } 9 | -------------------------------------------------------------------------------- /smart-contracts/contracts/oracle/IOracle.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.6.12; 4 | 5 | interface IOracle { 6 | function getData() external returns (uint256, bool); 7 | } 8 | -------------------------------------------------------------------------------- /smart-contracts/contracts/oracle/UniswapOracleExample.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.6.12; 2 | 3 | contract UniswapOracleExample { 4 | 5 | constructor(address factory, address tokenA, address tokenB) public { 6 | require(true, 'ExampleOracleSimple: NO_RESERVES'); // ensure that there's liquidity in the pair 7 | } 8 | 9 | function update() external { 10 | } 11 | 12 | // note this will always return 0 before update has been called successfully for the first time. 13 | function consult(address token, uint amountIn) external view returns (uint amountOut) { 14 | return 1000000000000000000; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /smart-contracts/contracts/oracle/UniswapPairOracle_MONA_WETH.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.6.12; 2 | 3 | import './UniswapOracleExample.sol'; 4 | 5 | contract UniswapPairOracle_MONA_WETH is UniswapOracleExample { 6 | constructor(address factory, address tokenA, address tokenB) 7 | UniswapOracleExample(factory, tokenA, tokenB) 8 | public {} 9 | } 10 | -------------------------------------------------------------------------------- /smart-contracts/contracts/root/ICheckpointManager.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.6.12; 2 | 3 | contract ICheckpointManager { 4 | struct HeaderBlock { 5 | bytes32 root; 6 | uint256 start; 7 | uint256 end; 8 | uint256 createdAt; 9 | address proposer; 10 | } 11 | 12 | /** 13 | * @notice mapping of checkpoint header numbers to block details 14 | * @dev These checkpoints are submited by plasma contracts 15 | */ 16 | mapping(uint256 => HeaderBlock) public headerBlocks; 17 | } 18 | -------------------------------------------------------------------------------- /smart-contracts/contracts/root/StateSender/IStateSender.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.6.12; 2 | 3 | interface IStateSender { 4 | function syncState(address receiver, bytes calldata data) external; 5 | } 6 | -------------------------------------------------------------------------------- /smart-contracts/contracts/staking/interfaces/IChild.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.6.12; 2 | pragma experimental ABIEncoderV2; 3 | 4 | interface IChild { 5 | function createChild(string calldata _uri) external returns (uint256); 6 | function batchCreateChildren(string[] calldata _uris) external returns (uint256[] memory tokenIds); 7 | function mintChild(uint256 _childTokenId, uint256 _amount, address _beneficiary, bytes calldata _data) external; 8 | function batchMintChildren( 9 | uint256[] calldata _childTokenIds, 10 | uint256[] calldata _amounts, 11 | address _beneficiary, 12 | bytes calldata _data 13 | ) external; 14 | } 15 | -------------------------------------------------------------------------------- /smart-contracts/contracts/staking/interfaces/IDigitalaxNFT.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPLv2 2 | 3 | pragma solidity 0.6.12; 4 | 5 | /// @dev an interface to interact with the Genesis MONA NFT that will 6 | interface IDigitalaxNFT { 7 | function primarySalePrice(uint256 tokenId) external view returns (uint256); 8 | function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); 9 | function balanceOf(address owner) external view returns (uint256); 10 | function safeTransferFrom(address from, address to, uint256 tokenId) external; 11 | } 12 | -------------------------------------------------------------------------------- /smart-contracts/contracts/staking/interfaces/IDigitalaxNFTRewards.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPLv2 2 | 3 | pragma solidity 0.6.12; 4 | 5 | /// @dev an interface to interact with the Genesis MONA NFT that will 6 | interface IDigitalaxNFTRewards { 7 | function updateRewards() external returns (bool); 8 | function MonaRewards(uint256 _from, uint256 _to) external view returns(uint256); 9 | function TokenRevenueRewards(address _rewardToken, uint256 _from, uint256 _to) external view returns(uint256); 10 | function lastRewardsTime() external view returns (uint256); 11 | function getMonaPerEth(uint256 _ethAmt) external view returns (uint256); 12 | function getExtraRewardTokens() external view returns (address[] memory returnRewardTokens); 13 | } 14 | -------------------------------------------------------------------------------- /smart-contracts/contracts/staking/interfaces/IDigitalaxRewards.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPLv2 2 | 3 | pragma solidity 0.6.12; 4 | 5 | /// @dev an interface to interact with the Genesis MONA NFT that will 6 | interface IDigitalaxRewards { 7 | function updateRewards() external returns (bool); 8 | function MonaRevenueRewards(uint256 _from, uint256 _to) external view returns(uint256); 9 | function BonusMonaRevenueRewards(uint256 _from, uint256 _to) external view returns(uint256); 10 | function TokenRevenueRewards(address _token, uint256 _from, uint256 _to) external view returns(uint256); 11 | function getLastRewardsTime() external view returns (uint256); 12 | function getMonaPerEth(uint256 _ethAmt) external view returns (uint256); 13 | function getExtraRewardTokens() external view returns (address[] memory returnRewardTokens); 14 | } 15 | -------------------------------------------------------------------------------- /smart-contracts/contracts/staking/interfaces/IERC20.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.6.2; 2 | // SPDX-License-Identifier: UNLICENSED 3 | 4 | 5 | interface IERC20 { 6 | function name() external view returns (string memory); 7 | function symbol() external view returns (string memory); 8 | function decimals() external view returns (uint8); 9 | function totalSupply() external view returns (uint256); 10 | function balanceOf(address owner) external view returns (uint256); 11 | function transfer(address to, uint256 amount) external returns (bool); 12 | function transferFrom(address from, address to, uint256 amount) external returns (bool); 13 | function approve(address spender, uint256 amount) external returns (bool); 14 | function allowance(address owner, address spender) external view returns (uint256); 15 | 16 | event Transfer(address indexed from, address indexed to, uint256 amount); 17 | event Approval(address indexed owner, address indexed spender, uint256 amount); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /smart-contracts/contracts/staking/interfaces/IGuildNFTRewards.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPLv2 2 | 3 | pragma solidity 0.6.12; 4 | 5 | /// @dev an interface to interact with PODE NFT that will 6 | interface IGuildNFTRewards { 7 | function updateRewards() external returns (bool); 8 | function totalDecoRewards() external view returns(uint256); 9 | function DecoRewards(uint256 _from, uint256 _to) external view returns(uint256); 10 | function lastRewardsTime() external view returns (uint256); 11 | } 12 | -------------------------------------------------------------------------------- /smart-contracts/contracts/staking/interfaces/IGuildNFTRewardsWhitelisted.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPLv2 2 | 3 | pragma solidity 0.6.12; 4 | 5 | /// @dev an interface to interact with Whitelisted NFT that will 6 | interface IGuildNFTRewardsWhitelisted { 7 | function totalNewWhitelistedNFTRewards() external view returns(uint256); 8 | function WhitelistedNFTRewards(uint256 _from, uint256 _to) external view returns(uint256); 9 | function whitelistedNFTLastRewardsTime() external view returns (uint256); 10 | } 11 | -------------------------------------------------------------------------------- /smart-contracts/contracts/staking/interfaces/IGuildNFTStakingWeight.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPLv2 2 | 3 | pragma solidity 0.6.12; 4 | 5 | /// @dev an interface to interact with the Guild Staking Weight that will 6 | interface IGuildNFTStakingWeight { 7 | function updateWeight() external returns (bool); 8 | function updateOwnerWeight(address _tokenOwner) external returns (bool); 9 | function appraise(uint256 _tokenId, address _appraiser, uint256 _limitAppraisalCount, string memory _reaction) external; 10 | function stake(uint256 _tokenId, address _tokenOwner, uint256 _primarySalePrice) external; 11 | function unstake(uint256 _tokenId, address _tokenOwner) external; 12 | 13 | function calcNewWeight() external view returns (uint256); 14 | function calcNewTotalWhitelistedNFTWeight() external view returns (uint256); 15 | function calcNewOwnerWeight(address _tokenOwner) external view returns (uint256); 16 | function calcNewWhitelistedNFTOwnerWeight(address _tokenOwner) external view returns (uint256); 17 | function getTotalWeight() external view returns (uint256); 18 | function getOwnerWeight(address _tokenOwner) external view returns (uint256); 19 | function getTokenPrice(uint256 _tokenId) external view returns (uint256); 20 | function balanceOf(address _owner) external view returns (uint256); 21 | 22 | function updateReactionPoint(string memory _reaction, uint256 _reactionPoint) external returns (bool); 23 | } 24 | -------------------------------------------------------------------------------- /smart-contracts/contracts/staking/interfaces/IGuildNFTStakingWeightStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.6.12; 2 | pragma experimental ABIEncoderV2; 3 | 4 | interface IGuildNFTStakingWeightStorage { 5 | function getDECAY_POINT_DEFAULT() external view returns (uint256); 6 | function getDECAY_POINT_WITH_APPRAISAL() external view returns (uint256); 7 | 8 | // // Overall variables 9 | 10 | function getClapMappingValue(uint256 _totalSupply, uint256 _balance) external view returns (uint256); 11 | function getDecoBonusMappingValue(uint256 _totalSupply, uint256 _balance) external view returns (uint256); 12 | function getAppraisedBonusMappingValue(uint256 _totalAppraised) external view returns (uint256); 13 | 14 | // // Mappings 15 | function getReactionPoint(string memory _type) external view returns (uint256); 16 | } 17 | -------------------------------------------------------------------------------- /smart-contracts/contracts/staking/interfaces/IGuildNFTStakingWeightWhitelisted.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPLv2 2 | 3 | pragma solidity 0.6.12; 4 | 5 | /// @dev an interface to interact with the Guild Staking Weight that will 6 | interface IGuildNFTStakingWeightWhitelisted { 7 | function appraiseWhitelistedNFT(address _whitelistedNFT, uint256 _tokenId, address _appraiser, string memory _reaction) external; 8 | function stakeWhitelistedNFT(address _whitelistedNFT, uint256 _tokenId, address _tokenOwner) external; 9 | function unstakeWhitelistedNFT(address _whitelistedNFT, uint256 _tokenId, address _tokenOwner) external; 10 | function getTotalWhitelistedNFTTokenWeight() external view returns (uint256); 11 | function getWhitelistedNFTOwnerWeight(address _tokenOwner) external view returns (uint256); 12 | function updateWhitelistedNFTOwnerWeight(address _tokenOwner) external returns (bool); 13 | } 14 | -------------------------------------------------------------------------------- /smart-contracts/contracts/staking/interfaces/IGuildNFTTokenRewards.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPLv2 2 | 3 | pragma solidity 0.6.12; 4 | 5 | /// @dev an interface to interact with Whitelisted NFT that will 6 | interface IGuildNFTTokenRewards { 7 | function totalNewRewardTokenMembershipRewards(address _rewardToken) external view returns(uint256); 8 | function totalNewRewardTokenWhitelistedRewards(address _rewardToken) external view returns(uint256); 9 | function MembershipTokenRevenueRewards(address _rewardToken, uint256 _from, uint256 _to) external view returns(uint256); 10 | function WhitelistedTokenRevenueRewards(address _rewardToken, uint256 _from, uint256 _to) external view returns(uint256); 11 | function getExtraRewardTokens() external view returns (address[] memory returnRewardTokens); 12 | } 13 | -------------------------------------------------------------------------------- /smart-contracts/contracts/staking/interfaces/IPodeNFTv2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPLv2 2 | 3 | pragma solidity 0.6.12; 4 | 5 | /// @dev an interface to interact with the PodeNFTv2 that will 6 | interface IPodeNFTv2 { 7 | function primarySalePrice(uint256 tokenId) external view returns (uint256); 8 | function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); 9 | function balanceOf(address owner) external view returns (uint256); 10 | function safeTransferFrom(address from, address to, uint256 tokenId) external; 11 | } 12 | -------------------------------------------------------------------------------- /smart-contracts/contracts/staking/interfaces/IWETH9.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.5.0; 2 | 3 | interface IWETH { 4 | function deposit() external payable; 5 | function transfer(address to, uint value) external returns (bool); 6 | function withdraw(uint) external; 7 | } -------------------------------------------------------------------------------- /smart-contracts/contracts/uniswapv2/UniswapV2OracleLibrary.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.5.0; 2 | 3 | import './interfaces/IUniswapV2Pair.sol'; 4 | import './libraries/FixedPoint.sol'; 5 | 6 | // library with helper methods for oracles that are concerned with computing average prices 7 | library UniswapV2OracleLibrary { 8 | using FixedPoint for *; 9 | 10 | // helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1] 11 | function currentBlockTimestamp() internal view returns (uint32) { 12 | return uint32(block.timestamp % 2 ** 32); 13 | } 14 | 15 | // produces the cumulative price using counterfactuals to save gas and avoid a call to sync. 16 | function currentCumulativePrices( 17 | address pair 18 | ) internal view returns (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) { 19 | blockTimestamp = currentBlockTimestamp(); 20 | price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast(); 21 | price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast(); 22 | 23 | // if time has elapsed since the last update on the pair, mock the accumulated price values 24 | (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IUniswapV2Pair(pair).getReserves(); 25 | if (blockTimestampLast != blockTimestamp) { 26 | // subtraction overflow is desired 27 | uint32 timeElapsed = blockTimestamp - blockTimestampLast; 28 | // addition overflow is desired 29 | // counterfactual 30 | price0Cumulative += uint(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed; 31 | // counterfactual 32 | price1Cumulative += uint(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /smart-contracts/contracts/uniswapv2/interfaces/IERC20.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.5.0; 2 | 3 | interface IERC20Uniswap { 4 | event Approval(address indexed owner, address indexed spender, uint value); 5 | event Transfer(address indexed from, address indexed to, uint value); 6 | 7 | function name() external view returns (string memory); 8 | function symbol() external view returns (string memory); 9 | function decimals() external view returns (uint8); 10 | function totalSupply() external view returns (uint); 11 | function balanceOf(address owner) external view returns (uint); 12 | function allowance(address owner, address spender) external view returns (uint); 13 | 14 | function approve(address spender, uint value) external returns (bool); 15 | function transfer(address to, uint value) external returns (bool); 16 | function transferFrom(address from, address to, uint value) external returns (bool); 17 | } 18 | -------------------------------------------------------------------------------- /smart-contracts/contracts/uniswapv2/interfaces/IUniswapV2Callee.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.5.0; 2 | 3 | interface IUniswapV2Callee { 4 | function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; 5 | } 6 | -------------------------------------------------------------------------------- /smart-contracts/contracts/uniswapv2/interfaces/IUniswapV2ERC20.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.5.0; 2 | 3 | interface IUniswapV2ERC20 { 4 | event Approval(address indexed owner, address indexed spender, uint value); 5 | event Transfer(address indexed from, address indexed to, uint value); 6 | 7 | function name() external pure returns (string memory); 8 | function symbol() external pure returns (string memory); 9 | function decimals() external pure returns (uint8); 10 | function totalSupply() external view returns (uint); 11 | function balanceOf(address owner) external view returns (uint); 12 | function allowance(address owner, address spender) external view returns (uint); 13 | 14 | function approve(address spender, uint value) external returns (bool); 15 | function transfer(address to, uint value) external returns (bool); 16 | function transferFrom(address from, address to, uint value) external returns (bool); 17 | 18 | function DOMAIN_SEPARATOR() external view returns (bytes32); 19 | function PERMIT_TYPEHASH() external pure returns (bytes32); 20 | function nonces(address owner) external view returns (uint); 21 | 22 | function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; 23 | } -------------------------------------------------------------------------------- /smart-contracts/contracts/uniswapv2/interfaces/IUniswapV2Factory.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.5.0; 2 | 3 | interface IUniswapV2Factory { 4 | event PairCreated(address indexed token0, address indexed token1, address pair, uint); 5 | 6 | function feeTo() external view returns (address); 7 | function feeToSetter() external view returns (address); 8 | function migrator() external view returns (address); 9 | 10 | function getPair(address tokenA, address tokenB) external view returns (address pair); 11 | function allPairs(uint) external view returns (address pair); 12 | function allPairsLength() external view returns (uint); 13 | 14 | function createPair(address tokenA, address tokenB) external returns (address pair); 15 | 16 | function setFeeTo(address) external; 17 | function setFeeToSetter(address) external; 18 | function setMigrator(address) external; 19 | } 20 | -------------------------------------------------------------------------------- /smart-contracts/contracts/uniswapv2/interfaces/IUniswapV2Router02.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.6.2; 2 | 3 | import './IUniswapV2Router01.sol'; 4 | 5 | interface IUniswapV2Router02 is IUniswapV2Router01 { 6 | function removeLiquidityETHSupportingFeeOnTransferTokens( 7 | address token, 8 | uint liquidity, 9 | uint amountTokenMin, 10 | uint amountETHMin, 11 | address to, 12 | uint deadline 13 | ) external returns (uint amountETH); 14 | function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( 15 | address token, 16 | uint liquidity, 17 | uint amountTokenMin, 18 | uint amountETHMin, 19 | address to, 20 | uint deadline, 21 | bool approveMax, uint8 v, bytes32 r, bytes32 s 22 | ) external returns (uint amountETH); 23 | 24 | function swapExactTokensForTokensSupportingFeeOnTransferTokens( 25 | uint amountIn, 26 | uint amountOutMin, 27 | address[] calldata path, 28 | address to, 29 | uint deadline 30 | ) external; 31 | function swapExactETHForTokensSupportingFeeOnTransferTokens( 32 | uint amountOutMin, 33 | address[] calldata path, 34 | address to, 35 | uint deadline 36 | ) external payable; 37 | function swapExactTokensForETHSupportingFeeOnTransferTokens( 38 | uint amountIn, 39 | uint amountOutMin, 40 | address[] calldata path, 41 | address to, 42 | uint deadline 43 | ) external; 44 | } -------------------------------------------------------------------------------- /smart-contracts/contracts/uniswapv2/interfaces/IWETH.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.5.0; 2 | 3 | interface IWETH { 4 | function deposit() external payable; 5 | function transfer(address to, uint value) external returns (bool); 6 | function withdraw(uint) external; 7 | } -------------------------------------------------------------------------------- /smart-contracts/contracts/uniswapv2/libraries/Math.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.6.12; 2 | 3 | // a library for performing various math operations 4 | 5 | library Math { 6 | function min(uint x, uint y) internal pure returns (uint z) { 7 | z = x < y ? x : y; 8 | } 9 | 10 | // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) 11 | function sqrt(uint y) internal pure returns (uint z) { 12 | if (y > 3) { 13 | z = y; 14 | uint x = y / 2 + 1; 15 | while (x < z) { 16 | z = x; 17 | x = (y / x + x) / 2; 18 | } 19 | } else if (y != 0) { 20 | z = 1; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /smart-contracts/contracts/uniswapv2/libraries/SafeMath.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.6.12; 2 | 3 | // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) 4 | 5 | library SafeMathUniswap { 6 | function add(uint x, uint y) internal pure returns (uint z) { 7 | require((z = x + y) >= x, 'ds-math-add-overflow'); 8 | } 9 | 10 | function sub(uint x, uint y) internal pure returns (uint z) { 11 | require((z = x - y) <= x, 'ds-math-sub-underflow'); 12 | } 13 | 14 | function mul(uint x, uint y) internal pure returns (uint z) { 15 | require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /smart-contracts/contracts/uniswapv2/libraries/TransferHelper.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0-or-later 2 | 3 | pragma solidity >=0.6.0; 4 | import "hardhat/console.sol"; 5 | // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false 6 | library TransferHelper { 7 | function safeApprove(address token, address to, uint value) internal { 8 | // bytes4(keccak256(bytes('approve(address,uint256)'))); 9 | (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); 10 | require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED'); 11 | } 12 | 13 | function safeTransfer(address token, address to, uint value) internal { 14 | // bytes4(keccak256(bytes('transfer(address,uint256)'))); 15 | (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); 16 | require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED'); 17 | } 18 | 19 | function safeTransferFrom(address token, address from, address to, uint value) internal { 20 | // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); 21 | (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); 22 | require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED'); 23 | } 24 | 25 | function safeTransferETH(address to, uint value) internal { 26 | console.log(address(this).balance); 27 | (bool success,) = to.call{value:value}(new bytes(0)); 28 | require(success, 'TransferHelper: ETH_TRANSFER_FAILED'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /smart-contracts/contracts/uniswapv2/libraries/UQ112x112.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.6.12; 2 | 3 | // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) 4 | 5 | // range: [0, 2**112 - 1] 6 | // resolution: 1 / 2**112 7 | 8 | library UQ112x112 { 9 | uint224 constant Q112 = 2**112; 10 | 11 | // encode a uint112 as a UQ112x112 12 | function encode(uint112 y) internal pure returns (uint224 z) { 13 | z = uint224(y) * Q112; // never overflows 14 | } 15 | 16 | // divide a UQ112x112 by a uint112, returning a UQ112x112 17 | function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { 18 | z = x / uint224(y); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /smart-contracts/docs/CreateGarmentWithStrands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DIGITALAX/digitalax-contracts/5069b9548314835e383bf5c9fa26b04a67876a53/smart-contracts/docs/CreateGarmentWithStrands.png -------------------------------------------------------------------------------- /smart-contracts/metadata_template/README.md: -------------------------------------------------------------------------------- 1 | ## Garment Parent and Child NFT Metadata 2 | 3 | This directory contains the metadata structure and examples for the DIGITALAX Parent and Child NFTS 4 | 5 | Metadata on IPFS is stored in JSON format and allows to define the characteristics of a given NFT, this can be consumed by the DIGITALAX website and others to build up the content value of a token. 6 | 7 | >The Parent NFT conforms with the ERC721 Protocol 8 | 9 | >The Child NFT conforms with the ER1155 Protocol 10 | 11 | This metadata is stored on IPFS and it's IPFS link is stored as the URI identifier of the NFTs. 12 | 13 | ### Parent ERC721 NFT Structure 14 | ``` 15 | { 16 | "name": "", 17 | "description": "", 18 | "external_url": "https://www.digitalax.xyz", 19 | "image": "https://gateway.pinata.cloud/ipfs/", 20 | "attributes": [ 21 | { 22 | "trait_type": "Designer", 23 | "value": "" 24 | }, 25 | { 26 | "trait_type": "Collection", 27 | "value": "" 28 | }, 29 | { 30 | "trait_type": "Auction", 31 | "value": "" 32 | }, 33 | { 34 | "trait_type": "Outfit", 35 | "value": "" 36 | }, 37 | { 38 | "trait_type": "Rarity", 39 | "value": "" 40 | } 41 | ] 42 | } 43 | ``` 44 | 45 | ### Child ERC1155 NFT Structure 46 | ``` 47 | { 48 | "Artist Name": " ", 49 | "Description": ", 50 | "attributes": [ 51 | { 52 | "trait_type": "Rarity", 53 | "value": " " 54 | }, 55 | { 56 | "trait_type": "Type", 57 | "value": " " 58 | }, 59 | { 60 | "trait_type": "Issue No.", 61 | "value": " " 62 | } 63 | ], 64 | "files": { 65 | "graphic": " " 66 | } 67 | } 68 | ``` -------------------------------------------------------------------------------- /smart-contracts/metadata_template/child_metadata_example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Emmatest1", 3 | "description": "Hello Hello test 123", 4 | "external_url": "https://www.digitalax.xyz", 5 | "image": "https://gateway.pinata.cloud/ipfs/QmPa4jMEZT5jZEX4xQkR8WLaj1CU2GHzE32MNud1TUXuDd", 6 | "attributes": [ 7 | { 8 | "trait_type": "Degrees of Exclusivity", 9 | "value": "Common" 10 | }, 11 | { 12 | "trait_type": "Type", 13 | "value": "P" 14 | }, 15 | { 16 | "trait_type": "Issue No.", 17 | "value": "4311" 18 | }, 19 | { 20 | "trait_type": "Artist", 21 | "value": "Emmatest" 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /smart-contracts/metadata_template/parent_metadata_example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Testing one", 3 | "description": "This metadata is uploaded for testing.", 4 | "external_url": "https://www.digitalax.xyz", 5 | "image": "https://gateway.pinata.cloud/ipfs/QmPXjsA3uVVymnGdFvuUTKstw8SjDie6qrJoNaYSi8fSR2", 6 | "attributes": [ 7 | { 8 | "trait_type": "Designer", 9 | "value": "ROBNESS" 10 | }, 11 | { 12 | "trait_type": "Collection", 13 | "value": "Dimensional Fabrics" 14 | }, 15 | { 16 | "trait_type": "Auction", 17 | "value": "03" 18 | }, 19 | { 20 | "trait_type": "Outfit", 21 | "value": "20/28" 22 | }, 23 | { 24 | "trait_type": "Degrees of Exclusivity", 25 | "value": "Common" 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /smart-contracts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "digital-fashion", 3 | "version": "1.0.0", 4 | "scripts": { 5 | "test": "npx hardhat test", 6 | "test-with-gas": "REPORT_GAS=true; npx hardhat test --network localhost", 7 | "coverage": "npx hardhat coverage", 8 | "compile": "npx hardhat compile", 9 | "build-contracts": "sol-merger \"./contracts/*.sol\" ./build", 10 | "merge-contract": "sol-merger -a _me" 11 | }, 12 | "author": "BlockRocket.tech", 13 | "license": "MIT", 14 | "dependencies": { 15 | "@nomiclabs/hardhat-ethers": "^2.0.2", 16 | "@nomiclabs/hardhat-solhint": "^2.0.0", 17 | "@nomiclabs/hardhat-truffle5": "^2.0.0", 18 | "@nomiclabs/hardhat-waffle": "^2.0.1", 19 | "@nomiclabs/hardhat-web3": "^2.0.0", 20 | "@openzeppelin/contracts": "^3.4.0", 21 | "@openzeppelin/contracts-upgradeable": "^4.3.1", 22 | "@openzeppelin/hardhat-upgrades": "^1.10.0", 23 | "@openzeppelin/test-helpers": "^0.5.6", 24 | "chai": "^4.2.0", 25 | "dotenv": "^8.2.0", 26 | "ethereum-waffle": "^3.1.1", 27 | "ethers": "^5.4.6", 28 | "fs": "^0.0.1-security", 29 | "ganache-cli": "^6.12.2", 30 | "hardhat": "2.0.2", 31 | "hardhat-contract-sizer": "^2.0.3", 32 | "hardhat-gas-reporter": "^1.0.4", 33 | "lodash": "^4.17.20", 34 | "mocha": "^8.1.3", 35 | "moment": "^2.29.1", 36 | "prompt-sync": "^4.2.0", 37 | "solidity-coverage": "^0.7.16", 38 | "web3": "^1.3.0" 39 | }, 40 | "devDependencies": { 41 | "sol-merger": "^3.1.0" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /smart-contracts/scripts/15_deploy_pode_nft.js: -------------------------------------------------------------------------------- 1 | const {FUND_MULTISIG_ADDRESS, PODE_TOKEN_URI} = require('./constants'); 2 | 3 | async function main() { 4 | 5 | const [deployer] = await ethers.getSigners(); 6 | const deployerAddress = await deployer.getAddress(); 7 | console.log('Deploying DigitalaxPodeNFT with the account:', deployerAddress); 8 | 9 | const { 10 | PODE_START, 11 | PODE_END, 12 | PODE_LOCK_TIME, 13 | } = process.env; 14 | 15 | console.log(`Deploying Pode NFT`, { 16 | PODE_START, 17 | PODE_END, 18 | PODE_LOCK_TIME, 19 | FUND_MULTISIG_ADDRESS, 20 | PODE_TOKEN_URI 21 | }); 22 | 23 | const DigitalaxPodeNFT = await ethers.getContractFactory('DigitalaxPodeNFT'); 24 | const pode = await DigitalaxPodeNFT.deploy( 25 | FUND_MULTISIG_ADDRESS, 26 | PODE_START, 27 | PODE_END, 28 | PODE_LOCK_TIME, 29 | PODE_TOKEN_URI, 30 | ); 31 | 32 | await pode.deployed(); 33 | 34 | console.log('DigitalaxPodeNFT deployed to:', pode.address); 35 | } 36 | 37 | // We recommend this pattern to be able to use async/await everywhere 38 | // and properly handle errors. 39 | main() 40 | .then(() => process.exit(0)) 41 | .catch(error => { 42 | console.error(error); 43 | process.exit(1); 44 | }); 45 | -------------------------------------------------------------------------------- /smart-contracts/scripts/16_deploy_garment_collection.js: -------------------------------------------------------------------------------- 1 | async function main() { 2 | 3 | const [deployer] = await ethers.getSigners(); 4 | const deployerAddress = await deployer.getAddress(); 5 | console.log('Deploying DigitalaxGarmentCollection with the account:', deployerAddress); 6 | 7 | const {ACCESS_CONTROLS_ADDRESS, ERC721_GARMENT_ADDRESS, ERC1155_MATERIALS_ADDRESS} = process.env; 8 | console.log(`ACCESS_CONTROLS_ADDRESS found [${ACCESS_CONTROLS_ADDRESS}]`); 9 | console.log(`ERC721_GARMENT_ADDRESS found [${ERC721_GARMENT_ADDRESS}]`); 10 | console.log(`ERC1155_MATERIALS_ADDRESS found [${ERC1155_MATERIALS_ADDRESS}]`); 11 | 12 | 13 | const DigitalaxGarmentCollection = await ethers.getContractFactory('DigitalaxGarmentCollection'); 14 | const contract = await DigitalaxGarmentCollection.deploy( 15 | ACCESS_CONTROLS_ADDRESS, 16 | ERC721_GARMENT_ADDRESS, 17 | ERC1155_MATERIALS_ADDRESS, 18 | ); 19 | 20 | await contract.deployed(); 21 | 22 | console.log('DigitalaxGarmentCollection deployed to:', contract.address); 23 | } 24 | 25 | // We recommend this pattern to be able to use async/await everywhere 26 | // and properly handle errors. 27 | main() 28 | .then(() => process.exit(0)) 29 | .catch(error => { 30 | console.error(error); 31 | process.exit(1); 32 | }); 33 | -------------------------------------------------------------------------------- /smart-contracts/scripts/18_deploy_uniswap_oracle.js: -------------------------------------------------------------------------------- 1 | async function main() { 2 | 3 | const [deployer] = await ethers.getSigners(); 4 | const deployerAddress = await deployer.getAddress(); 5 | console.log('Deploying UniswapOracle with the account:', deployerAddress); 6 | 7 | const {UNISWAP_FACTORY_ADDRESS, WETH_TOKEN_ADDRESS, MONA_TOKEN_ADDRESS} = process.env; 8 | console.log(`UNISWAP_FACTORY_ADDRESS found [${UNISWAP_FACTORY_ADDRESS}]`); 9 | console.log(`WETH_TOKEN_ADDRESS found [${WETH_TOKEN_ADDRESS}]`); 10 | console.log(`MONA_TOKEN_ADDRESS found [${MONA_TOKEN_ADDRESS}]`); 11 | 12 | 13 | const UniswapOracle = await ethers.getContractFactory('UniswapOracleExample'); 14 | const contract = await UniswapOracle.deploy( 15 | UNISWAP_FACTORY_ADDRESS, 16 | WETH_TOKEN_ADDRESS, 17 | MONA_TOKEN_ADDRESS 18 | ); 19 | 20 | await contract.deployed(); 21 | 22 | console.log('UniswapOracle deployed to:', contract.address); 23 | } 24 | 25 | // We recommend this pattern to be able to use async/await everywhere 26 | // and properly handle errors. 27 | main() 28 | .then(() => process.exit(0)) 29 | .catch(error => { 30 | console.error(error); 31 | process.exit(1); 32 | }); 33 | -------------------------------------------------------------------------------- /smart-contracts/scripts/21_deploy_digitalax_index.js: -------------------------------------------------------------------------------- 1 | async function main() { 2 | 3 | const [deployer] = await ethers.getSigners(); 4 | const deployerAddress = await deployer.getAddress(); 5 | console.log('Deploying DigitalaxIndex with the account:', deployerAddress); 6 | 7 | const { 8 | ACCESS_CONTROLS_ADDRESS, 9 | } = process.env; 10 | 11 | console.log(`Deploying DigitalaxIndex`, { 12 | ACCESS_CONTROLS_ADDRESS, 13 | }); 14 | 15 | const DigitalaxIndex = await ethers.getContractFactory('DigitalaxIndex'); 16 | const contract = await DigitalaxIndex.deploy(ACCESS_CONTROLS_ADDRESS); 17 | 18 | await contract.deployed(); 19 | 20 | console.log('DigitalaxIndex deployed to:', contract.address); 21 | 22 | } 23 | 24 | // We recommend this pattern to be able to use async/await everywhere 25 | // and properly handle errors. 26 | main() 27 | .then(() => process.exit(0)) 28 | .catch(error => { 29 | console.error(error); 30 | process.exit(1); 31 | }); 32 | -------------------------------------------------------------------------------- /smart-contracts/scripts/22_deploy_mona_oralce.js: -------------------------------------------------------------------------------- 1 | async function main() { 2 | 3 | const [deployer] = await ethers.getSigners(); 4 | const deployerAddress = await deployer.getAddress(); 5 | console.log('Deploying DigitalaxMonaOracle with the account:', deployerAddress); 6 | 7 | const { 8 | ACCESS_CONTROLS_ADDRESS, 9 | ORACLE_PROVIDER_ADDRESS, 10 | } = process.env; 11 | 12 | console.log(`Deploying DigitalaxMonaOracle`, { 13 | ACCESS_CONTROLS_ADDRESS, 14 | ORACLE_PROVIDER_ADDRESS, 15 | }); 16 | 17 | const DigitalaxMonaOracle = await ethers.getContractFactory('DigitalaxMonaOracle'); 18 | const contract = await DigitalaxMonaOracle.deploy( 19 | '86400', 20 | '120', 21 | '1', 22 | ACCESS_CONTROLS_ADDRESS 23 | ); 24 | 25 | await contract.deployed(); 26 | 27 | console.log('DigitalaxMonaOracle deployed to:', contract.address); 28 | 29 | // add provider to the oracle contract 30 | await contract.addProvider(ORACLE_PROVIDER_ADDRESS); 31 | 32 | } 33 | 34 | // We recommend this pattern to be able to use async/await everywhere 35 | // and properly handle errors. 36 | main() 37 | .then(() => process.exit(0)) 38 | .catch(error => { 39 | console.error(error); 40 | process.exit(1); 41 | }); 42 | -------------------------------------------------------------------------------- /smart-contracts/scripts/23_deploy_digitalax_proxy.js: -------------------------------------------------------------------------------- 1 | async function main() { 2 | 3 | const [deployer] = await ethers.getSigners(); 4 | const deployerAddress = await deployer.getAddress(); 5 | console.log('Deploying DigitalaxProxy with the account:', deployerAddress); 6 | 7 | const { 8 | ACCESS_CONTROLS_ADDRESS, 9 | } = process.env; 10 | 11 | console.log(`Deploying DigitalaxProxy`, { 12 | ACCESS_CONTROLS_ADDRESS, 13 | }); 14 | 15 | const DigitalaxProxy = await ethers.getContractFactory('DigitalaxProxy'); 16 | const contract = await DigitalaxProxy.deploy('0x8867D638862265F4CD4d48288E321525520b82C1', '0xf7580d46080e1ce832ac44cf7224b906d44110b4'); 17 | 18 | await contract.deployed(); 19 | 20 | console.log('DigitalaxProxy deployed to:', contract.address); 21 | 22 | } 23 | 24 | // We recommend this pattern to be able to use async/await everywhere 25 | // and properly handle errors. 26 | main() 27 | .then(() => process.exit(0)) 28 | .catch(error => { 29 | console.error(error); 30 | process.exit(1); 31 | }); 32 | -------------------------------------------------------------------------------- /smart-contracts/scripts/24_deploy_garment_nft_v2.js: -------------------------------------------------------------------------------- 1 | async function main() { 2 | const [deployer] = await ethers.getSigners(); 3 | const deployerAddress = await deployer.getAddress(); 4 | console.log( 5 | 'Deploying garment with address:', 6 | deployerAddress 7 | ); 8 | 9 | const {ACCESS_CONTROLS_ADDRESS, ERC1155_MATERIALS_ADDRESS} = process.env; 10 | console.log(`ACCESS_CONTROLS_ADDRESS found [${ACCESS_CONTROLS_ADDRESS}]`); 11 | console.log(`ERC1155_MATERIALS_ADDRESS found [${ERC1155_MATERIALS_ADDRESS}]`); 12 | 13 | const DigitalaxGarmentNFTV2 = await ethers.getContractFactory('DigitalaxGarmentNFTv2'); 14 | const garment = await DigitalaxGarmentNFTV2.deploy(); 15 | 16 | await garment.deployed(); 17 | await garment.initialize( 18 | ACCESS_CONTROLS_ADDRESS, 19 | ERC1155_MATERIALS_ADDRESS, 20 | '0xb5505a6d998549090530911180f38aC5130101c6', 21 | '0x9399BB24DBB5C4b782C70c2969F58716Ebbd6a3b' // Mumbai trusted forwarder 22 | ); 23 | 24 | console.log('Garment deployed at', garment.address); 25 | } 26 | 27 | // We recommend this pattern to be able to use async/await everywhere 28 | // and properly handle errors. 29 | main() 30 | .then(() => process.exit(0)) 31 | .catch(error => { 32 | console.error(error); 33 | process.exit(1); 34 | }); 35 | -------------------------------------------------------------------------------- /smart-contracts/scripts/25_deploy_subscription_collection.js: -------------------------------------------------------------------------------- 1 | async function main() { 2 | 3 | const [deployer] = await ethers.getSigners(); 4 | const deployerAddress = await deployer.getAddress(); 5 | console.log('Deploying DigitalaxSubscriptionCollection with the account:', deployerAddress); 6 | 7 | const {ACCESS_CONTROLS_ADDRESS, ERC721_GARMENT_ADDRESS, ERC1155_MATERIALS_ADDRESS} = process.env; 8 | console.log(`ACCESS_CONTROLS_ADDRESS found [${ACCESS_CONTROLS_ADDRESS}]`); 9 | console.log(`ERC721_GARMENT_ADDRESS found [${ERC721_GARMENT_ADDRESS}]`); 10 | console.log(`ERC1155_MATERIALS_ADDRESS found [${ERC1155_MATERIALS_ADDRESS}]`); 11 | 12 | 13 | const DigitalaxSubscriptionCollection = await ethers.getContractFactory('DigitalaxSubscriptionCollection'); 14 | const contract = await DigitalaxSubscriptionCollection.deploy( 15 | ACCESS_CONTROLS_ADDRESS, 16 | ERC721_GARMENT_ADDRESS, 17 | ERC1155_MATERIALS_ADDRESS, 18 | ); 19 | 20 | await contract.deployed(); 21 | 22 | console.log('DigitalaxSubscriptionCollection deployed to:', contract.address); 23 | } 24 | 25 | // We recommend this pattern to be able to use async/await everywhere 26 | // and properly handle errors. 27 | main() 28 | .then(() => process.exit(0)) 29 | .catch(error => { 30 | console.error(error); 31 | process.exit(1); 32 | }); 33 | -------------------------------------------------------------------------------- /smart-contracts/scripts/2_deploy_genesis_nft.js: -------------------------------------------------------------------------------- 1 | const {FUND_MULTISIG_ADDRESS, GENESIS_TOKEN_URI} = require('./constants'); 2 | 3 | async function main() { 4 | 5 | const [deployer] = await ethers.getSigners(); 6 | const deployerAddress = await deployer.getAddress(); 7 | console.log('Deploying DigitalaxGenesisNFT with the account:', deployerAddress); 8 | 9 | const { 10 | ACCESS_CONTROLS_ADDRESS, 11 | GENESIS_START, 12 | GENESIS_END, 13 | } = process.env; 14 | 15 | console.log(`Deploying Genesis NFT`, { 16 | ACCESS_CONTROLS_ADDRESS, 17 | GENESIS_START, 18 | GENESIS_END, 19 | FUND_MULTISIG_ADDRESS, 20 | GENESIS_TOKEN_URI 21 | }); 22 | 23 | const DigitalaxGenesisNFT = await ethers.getContractFactory('DigitalaxGenesisNFT'); 24 | const genesis = await DigitalaxGenesisNFT.deploy( 25 | ACCESS_CONTROLS_ADDRESS, 26 | FUND_MULTISIG_ADDRESS, 27 | GENESIS_START, 28 | GENESIS_END, 29 | GENESIS_TOKEN_URI, 30 | ); 31 | 32 | await genesis.deployed(); 33 | 34 | console.log('DigitalaxGenesisNFT deployed to:', genesis.address); 35 | } 36 | 37 | // We recommend this pattern to be able to use async/await everywhere 38 | // and properly handle errors. 39 | main() 40 | .then(() => process.exit(0)) 41 | .catch(error => { 42 | console.error(error); 43 | process.exit(1); 44 | }); 45 | -------------------------------------------------------------------------------- /smart-contracts/scripts/3_deploy_materials.js: -------------------------------------------------------------------------------- 1 | async function main() { 2 | const [deployer] = await ethers.getSigners(); 3 | const deployerAddress = await deployer.getAddress(); 4 | console.log( 5 | 'Deploying materials with address:', 6 | deployerAddress 7 | ); 8 | 9 | const {ACCESS_CONTROLS_ADDRESS} = process.env; 10 | console.log(`ACCESS_CONTROLS_ADDRESS found [${ACCESS_CONTROLS_ADDRESS}]`); 11 | 12 | const DigitalaxMaterials = await ethers.getContractFactory('DigitalaxMaterials'); 13 | const materials = await DigitalaxMaterials.deploy( 14 | 'DigitalaxMaterials', 15 | 'DXM', 16 | ACCESS_CONTROLS_ADDRESS, 17 | '0xb5505a6d998549090530911180f38aC5130101c6', // Mumbai child chain manager address 18 | '0x9399BB24DBB5C4b782C70c2969F58716Ebbd6a3b' // Mumbai trusted forwarder 19 | ); 20 | 21 | await materials.deployed(); 22 | 23 | console.log('Materials deployed at', materials.address); 24 | } 25 | 26 | // We recommend this pattern to be able to use async/await everywhere 27 | // and properly handle errors. 28 | main() 29 | .then(() => process.exit(0)) 30 | .catch(error => { 31 | console.error(error); 32 | process.exit(1); 33 | }); 34 | -------------------------------------------------------------------------------- /smart-contracts/scripts/4_deploy_garment_nft.js: -------------------------------------------------------------------------------- 1 | async function main() { 2 | const [deployer] = await ethers.getSigners(); 3 | const deployerAddress = await deployer.getAddress(); 4 | console.log( 5 | 'Deploying garment with address:', 6 | deployerAddress 7 | ); 8 | 9 | const {ACCESS_CONTROLS_ADDRESS, ERC1155_MATERIALS_ADDRESS} = process.env; 10 | console.log(`ACCESS_CONTROLS_ADDRESS found [${ACCESS_CONTROLS_ADDRESS}]`); 11 | console.log(`ERC1155_MATERIALS_ADDRESS found [${ERC1155_MATERIALS_ADDRESS}]`); 12 | 13 | const DigitalaxGarmentNFT = await ethers.getContractFactory('DigitalaxGarmentNFT'); 14 | const garment = await DigitalaxGarmentNFT.deploy( 15 | ACCESS_CONTROLS_ADDRESS, 16 | ERC1155_MATERIALS_ADDRESS, 17 | '0xb5505a6d998549090530911180f38aC5130101c6' 18 | ); 19 | 20 | await garment.deployed(); 21 | 22 | console.log('Garment deployed at', garment.address); 23 | } 24 | 25 | // We recommend this pattern to be able to use async/await everywhere 26 | // and properly handle errors. 27 | main() 28 | .then(() => process.exit(0)) 29 | .catch(error => { 30 | console.error(error); 31 | process.exit(1); 32 | }); 33 | -------------------------------------------------------------------------------- /smart-contracts/scripts/5_deploy_garment_factory.js: -------------------------------------------------------------------------------- 1 | const AccessControlsArtifact = require('../artifacts/DigitalaxAccessControls.json'); 2 | 3 | async function main() { 4 | const [deployer] = await ethers.getSigners(); 5 | const deployerAddress = await deployer.getAddress(); 6 | console.log( 7 | 'Deploying garment factory with address:', 8 | deployerAddress 9 | ); 10 | 11 | const { 12 | ACCESS_CONTROLS_ADDRESS, 13 | ERC1155_MATERIALS_ADDRESS, 14 | ERC721_GARMENT_ADDRESS 15 | } = process.env; 16 | console.log(`ACCESS_CONTROLS_ADDRESS found [${ACCESS_CONTROLS_ADDRESS}]`); 17 | console.log(`ERC1155_MATERIALS_ADDRESS found [${ERC1155_MATERIALS_ADDRESS}]`); 18 | console.log(`ERC721_GARMENT_ADDRESS found [${ERC721_GARMENT_ADDRESS}]`); 19 | 20 | const DigitalaxGarmentFactory = await ethers.getContractFactory('DigitalaxGarmentFactory'); 21 | const garmentFactory = await DigitalaxGarmentFactory.deploy( 22 | ERC721_GARMENT_ADDRESS, 23 | ERC1155_MATERIALS_ADDRESS, 24 | ACCESS_CONTROLS_ADDRESS, 25 | ); 26 | 27 | await garmentFactory.deployed(); 28 | 29 | console.log('Garment factory deployed at', garmentFactory.address); 30 | console.log('Granting garment factory smart contract role'); 31 | const accessControls = new ethers.Contract( 32 | ACCESS_CONTROLS_ADDRESS, 33 | AccessControlsArtifact.abi, 34 | deployer 35 | ); 36 | 37 | await accessControls.addSmartContractRole(garmentFactory.address); 38 | } 39 | 40 | // We recommend this pattern to be able to use async/await everywhere 41 | // and properly handle errors. 42 | main() 43 | .then(() => process.exit(0)) 44 | .catch(error => { 45 | console.error(error); 46 | process.exit(1); 47 | }); 48 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/22_round_11_pode_v2_airdrop.js: -------------------------------------------------------------------------------- 1 | const PodeV2Artifact = require('../../artifacts/PodeNFTv2.json'); 2 | const _ = require('lodash'); 3 | 4 | async function main() { 5 | const [deployer] = await ethers.getSigners(); 6 | const deployerAddress = await deployer.getAddress(); 7 | console.log( 8 | 'Airdropping pode v2 token with following address', 9 | deployerAddress 10 | ); 11 | 12 | MAX_NFT_SINGLE_TX = 20; 13 | 14 | const {PODE_V2_ADDRESS} = process.env; 15 | console.log(`PODE_V2_ADDRESS found [${PODE_V2_ADDRESS}]`); 16 | 17 | const garment = new ethers.Contract( 18 | PODE_V2_ADDRESS, 19 | PodeV2Artifact.abi, 20 | deployer 21 | ); 22 | 23 | 24 | 25 | console.log(`----------------------`); 26 | 27 | // Approve for all 28 | // const approveToken = await garment.setApprovalForAll(BURNER_ADDRESS, true); 29 | // await approveToken.wait(); 30 | const metadata = require('./pode.json'); 31 | // Data length 32 | console.log(metadata.data.length) 33 | const datas = metadata.data; 34 | 35 | const chunks = _.chunk(metadata.data, MAX_NFT_SINGLE_TX); 36 | 37 | for(let i = 0; i< chunks.length ; i++){ 38 | const x = chunks[i]; 39 | const tx = await garment.batchMint(x, x); 40 | await tx.wait(); 41 | 42 | console.log('Here is the minted receivers') 43 | console.log(x) 44 | } 45 | 46 | 47 | } 48 | 49 | // We recommend this pattern to be able to use async/await everywhere 50 | // and properly handle errors. 51 | main() 52 | .then(() => process.exit(0)) 53 | .catch(error => { 54 | console.error(error); 55 | process.exit(1); 56 | }); 57 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/30_fix_prices.js: -------------------------------------------------------------------------------- 1 | const MarketplaceArtifact = require('../../artifacts/DripMarketplace.json'); 2 | var utils = require('ethers').utils; 3 | 4 | async function main() { 5 | const [deployer] = await ethers.getSigners(); 6 | const deployerAddress = await deployer.getAddress(); 7 | console.log( 8 | 'Deploying and setting up collections on marketplace with the following address:', 9 | deployerAddress 10 | ); 11 | 12 | const {DRIP_MARKETPLACE_ADDRESS} = process.env; 13 | 14 | const marketplace = new ethers.Contract( 15 | DRIP_MARKETPLACE_ADDRESS, 16 | MarketplaceArtifact.abi, 17 | deployer 18 | ); 19 | 20 | const metadata = require('./collections.json'); 21 | // Data length 22 | console.log(metadata.data.length) 23 | 24 | const primarySalePrice = utils.parseEther('170'); 25 | 26 | for(let i = 0; i<= metadata.data.length ; i++){ 27 | const x = metadata.data[i]; 28 | const tx = await marketplace.updateOfferPrimarySalePrice(x, primarySalePrice); 29 | await tx.wait(); 30 | 31 | console.log('Here is the updated collections') 32 | console.log(x) 33 | console.log('For price') 34 | console.log(primarySalePrice) 35 | } 36 | } 37 | 38 | // We recommend this pattern to be able to use async/await everywhere 39 | // and properly handle errors. 40 | main() 41 | .then(() => process.exit(0)) 42 | .catch(error => { 43 | console.error(error); 44 | process.exit(1); 45 | }); 46 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/31_fix_max_amount.js: -------------------------------------------------------------------------------- 1 | const MarketplaceArtifact = require('../../artifacts/DripMarketplace.json'); 2 | 3 | async function main() { 4 | const [deployer] = await ethers.getSigners(); 5 | const deployerAddress = await deployer.getAddress(); 6 | console.log( 7 | 'Deploying and setting up collections on marketplace with the following address:', 8 | deployerAddress 9 | ); 10 | 11 | const {DRIP_MARKETPLACE_ADDRESS} = process.env; 12 | 13 | const marketplace = new ethers.Contract( 14 | DRIP_MARKETPLACE_ADDRESS, 15 | MarketplaceArtifact.abi, 16 | deployer 17 | ); 18 | 19 | const metadata = require('./collections.json'); 20 | // Data length 21 | console.log(metadata.data.length) 22 | 23 | const maxAmount = 201; 24 | 25 | for(let i = 0; i<= metadata.data.length ; i++){ 26 | const x = metadata.data[i]; 27 | const tx = await marketplace.updateOfferMaxAmount(x, maxAmount); 28 | await tx.wait(); 29 | 30 | console.log('Here is the updated collections') 31 | console.log(x) 32 | console.log('For amount') 33 | console.log(maxAmount) 34 | } 35 | } 36 | 37 | // We recommend this pattern to be able to use async/await everywhere 38 | // and properly handle errors. 39 | main() 40 | .then(() => process.exit(0)) 41 | .catch(error => { 42 | console.error(error); 43 | process.exit(1); 44 | }); 45 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/39_fix_skins_times.js: -------------------------------------------------------------------------------- 1 | const MarketplaceArtifact = require('../../artifacts/DigitalaxMarketplaceV2.json'); 2 | var utils = require('ethers').utils; 3 | 4 | async function main() { 5 | const [deployer] = await ethers.getSigners(); 6 | const deployerAddress = await deployer.getAddress(); 7 | console.log( 8 | 'Deploying and setting up collections on marketplace with the following address:', 9 | deployerAddress 10 | ); 11 | 12 | const {MARKETPLACE_ADDRESS} = process.env; 13 | 14 | const marketplace = new ethers.Contract( 15 | MARKETPLACE_ADDRESS, 16 | MarketplaceArtifact.abi, 17 | deployer 18 | ); 19 | 20 | 21 | // TODO ***** fill in the collection ids for today 22 | const metadata = { 23 | "data": [ 24 | 439, 25 | 440, 26 | ] 27 | } 28 | 29 | // Data length 30 | console.log(metadata.data.length) 31 | 32 | for(let i = 0; i< metadata.data.length ; i++){ 33 | const x = metadata.data[i]; 34 | const tx = await marketplace.updateOfferStartEndTime(x, 1629729900, 1655866036); 35 | await tx.wait(); 36 | 37 | console.log('Here is the updated collections') 38 | console.log(x) 39 | } 40 | } 41 | 42 | // We recommend this pattern to be able to use async/await everywhere 43 | // and properly handle errors. 44 | main() 45 | .then(() => process.exit(0)) 46 | .catch(error => { 47 | console.error(error); 48 | process.exit(1); 49 | }); 50 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/41_round_16_update_endtime.js: -------------------------------------------------------------------------------- 1 | const AuctionArtifact = require('../../artifacts/DigitalaxAuctionV2.json'); 2 | 3 | async function main() { 4 | const [deployer] = await ethers.getSigners(); 5 | const deployerAddress = await deployer.getAddress(); 6 | console.log( 7 | 'Deploying and setting up collections on auctions with the following address:', 8 | deployerAddress 9 | ); 10 | 11 | const {AUCTION_ADDRESS} = process.env; 12 | console.log(`AUCTION_ADDRESS found [${AUCTION_ADDRESS}]`); 13 | 14 | const auction = new ethers.Contract( 15 | AUCTION_ADDRESS, 16 | AuctionArtifact.abi, 17 | deployer 18 | ); 19 | 20 | const metadata = { 21 | "data": [ 22 | 133055,133054,133053, 23 | 133052,133051,133050,133049,133048,133047,133056,133057,133058,133059,133060,133061,133062,133063,133064,133065,133066,133067,133068,133069,133070,133071,133072,133073,133074,133075,133076,133077,133078, 24 | 133079,133080,133081, 25 | 133082,133083,133084,133085,133086,133087,133088,133089,133090,133091,133092,132733,132734,132735,132736,132737,132738,132739,132740 26 | ] 27 | } 28 | 29 | // Data length 30 | console.log(metadata.data.length) 31 | 32 | for(let i = 0; i< metadata.data.length ; i++){ 33 | const x = metadata.data[i]; 34 | const updateAuctionEndTime = await auction.updateAuctionEndTime(x, 1631289600); 35 | await updateAuctionEndTime.wait(); 36 | 37 | console.log('Here is the updated auction') 38 | console.log(x) 39 | } 40 | } 41 | 42 | // We recommend this pattern to be able to use async/await everywhere 43 | // and properly handle errors. 44 | main() 45 | .then(() => process.exit(0)) 46 | .catch(error => { 47 | console.error(error); 48 | process.exit(1); 49 | }); 50 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/47_burn_skins_analysis.js: -------------------------------------------------------------------------------- 1 | const GarmentArtifact = require('../../artifacts/contracts/garment/DigitalaxGarmentNFTv2.sol/DigitalaxGarmentNFTv2.json'); 2 | const BurnerArtifact = require('../../artifacts/contracts/utils/DigitalaxGarmentNFTV2Burner.sol/DigitalaxGarmentNFTv2Burner.json'); 3 | const _ = require('lodash'); 4 | 5 | async function main() { 6 | const [deployer] = await ethers.getSigners(); 7 | const deployerAddress = await deployer.getAddress(); 8 | console.log( 9 | 'Analyzing with following address', 10 | deployerAddress 11 | ); 12 | 13 | const {ERC721_GARMENT_ADDRESS, } = process.env; 14 | console.log(`ERC721_GARMENT_ADDRESS found [${ERC721_GARMENT_ADDRESS}]`); 15 | 16 | const garment = new ethers.Contract( 17 | ERC721_GARMENT_ADDRESS, 18 | GarmentArtifact.abi, 19 | deployer 20 | ); 21 | 22 | console.log(`----------------------`); 23 | 24 | const metadata = require('./allburntokens.json'); 25 | // Data length 26 | console.log("number of tokens to check:") 27 | console.log(metadata.data.length) 28 | const datas = metadata.data; 29 | 30 | 31 | for(let i = 0; i< datas.length ; i++){ 32 | const x = datas[i]; 33 | try { 34 | const tx2 = await garment.ownerOf( 35 | x 36 | ); 37 | console.log(`The owner of ${x} is: ${tx2}`); 38 | } catch(e){ 39 | console.log(`It seems ${x} has been burned already`) 40 | } 41 | } 42 | 43 | 44 | } 45 | 46 | // We recommend this pattern to be able to use async/await everywhere 47 | // and properly handle errors. 48 | main() 49 | .then(() => process.exit(0)) 50 | .catch(error => { 51 | console.error(error); 52 | process.exit(1); 53 | }); 54 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/4_round_cancel_auction.js: -------------------------------------------------------------------------------- 1 | const AuctionArtifact = require('../../artifacts/DigitalaxAuction.json'); 2 | 3 | async function main() { 4 | const [deployer] = await ethers.getSigners(); 5 | const deployerAddress = await deployer.getAddress(); 6 | console.log( 7 | 'Cancelling auction with the following address:', 8 | deployerAddress 9 | ); 10 | 11 | const {AUCTION_ADDRESS} = process.env; 12 | 13 | const auction = new ethers.Contract( 14 | AUCTION_ADDRESS, 15 | AuctionArtifact.abi, 16 | deployer 17 | ); 18 | 19 | const tx = await auction.cancelAuction('181'); 20 | await tx.wait(); 21 | } 22 | 23 | // We recommend this pattern to be able to use async/await everywhere 24 | // and properly handle errors. 25 | main() 26 | .then(() => process.exit(0)) 27 | .catch(error => { 28 | console.error(error); 29 | process.exit(1); 30 | }); 31 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/52_v3_upgrade.js: -------------------------------------------------------------------------------- 1 | // const GuildNftStakingArtifact = require('../../artifacts/contracts/staking/GuildNFTStakingWeightV2.sol/GuildNFTStakingWeightV2.json'); 2 | // const GuildNftStakingArtifact = require('../../artifacts/contracts/staking/GuildNFTStakingWeightV2.sol/GuildNFTStakingWeightV2.json'); 3 | const { ethers, upgrades } = require("hardhat"); 4 | 5 | const { 6 | ether, 7 | } = require('@openzeppelin/test-helpers'); 8 | 9 | const _ = require('lodash'); 10 | 11 | async function main() { 12 | const [deployer] = await ethers.getSigners(); 13 | const deployerAddress = await deployer.getAddress(); 14 | 15 | 16 | 17 | const StakingWeightV3ContractFactory = await ethers.getContractFactory("GuildNFTStakingWeightV3"); 18 | // const stakingWeightV3Contract = await upgrades.upgradeProxy("0xa6C4d291Aae3b1de46BCC13e34E57e1d52A032dB", StakingWeightV3ContractFactory); 19 | const stakingWeightV3Contract = await upgrades.upgradeProxy("0xE69E1eD04501b1bE9aEb24aa471F68303137a8eA", StakingWeightV3ContractFactory); 20 | await stakingWeightV3Contract.deployed(); 21 | console.log(stakingWeightV3Contract.address); 22 | 23 | } 24 | 25 | // We recommend this pattern to be able to use async/await everywhere 26 | // and properly handle errors. 27 | main() 28 | .then(() => process.exit(0)) 29 | .catch(error => { 30 | console.error(error); 31 | process.exit(1); 32 | }); 33 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/57_longterm_upgrade.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require("hardhat"); 2 | 3 | const { 4 | ether, 5 | } = require('@openzeppelin/test-helpers'); 6 | 7 | const _ = require('lodash'); 8 | 9 | async function main() { 10 | const [deployer] = await ethers.getSigners(); 11 | const deployerAddress = await deployer.getAddress(); 12 | 13 | 14 | const DigitalaxMonaStakingContractFactory = await ethers.getContractFactory("DigitalaxMonaStaking"); 15 | const digitalaxMonaStakingContract = await upgrades.upgradeProxy("0xA12e61a68D2CAe395942DcC46759da8944Eb0C02", DigitalaxMonaStakingContractFactory); 16 | await digitalaxMonaStakingContract.deployed(); 17 | console.log(digitalaxMonaStakingContract.address); 18 | 19 | } 20 | 21 | // We recommend this pattern to be able to use async/await everywhere 22 | // and properly handle errors. 23 | main() 24 | .then(() => process.exit(0)) 25 | .catch(error => { 26 | console.error(error); 27 | process.exit(1); 28 | }); 29 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/58_nix_deployment.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require("hardhat"); 2 | 3 | const { 4 | ether, 5 | } = require('@openzeppelin/test-helpers'); 6 | 7 | const _ = require('lodash'); 8 | 9 | async function main() { 10 | const [deployer] = await ethers.getSigners(); 11 | const deployerAddress = await deployer.getAddress(); 12 | console.log('Deploying Nix as upgradeable'); 13 | 14 | // Some constants setup 15 | // const monaAddress = "0xefd3d060ddcfed7903806503440db1089031af3a"; 16 | // const royaltyEngine = "0x0a01e11887f727d1b1cd81251eeee9bee4262d07"; 17 | const monaAddress = "0x6968105460f67c3BF751bE7C15f92F5286Fd0CE5"; 18 | const royaltyEngine = "0x28EdFcF0Be7E86b07493466e7631a213bDe8eEF2"; 19 | 20 | 21 | // const NFTArtifact = require('../../artifacts/contracts/garment/DigitalaxGarmentNFTv2.sol/DigitalaxGarmentNFTv2.json'); 22 | // const nft = new ethers.Contract( 23 | // nftAddress, 24 | // NFTArtifact.abi, 25 | // deployer 26 | // ); 27 | 28 | const nixContractFactory = await ethers.getContractFactory("Nix"); 29 | const nix = await upgrades.deployProxy(nixContractFactory, [monaAddress, royaltyEngine]); 30 | await nix.deployed(); 31 | 32 | console.log(`Nix contract at: ${nix.address} `); 33 | const ownership = await nix.transferOwnership('0xAA3e5ee4fdC831e5274FE7836c95D670dC2502e6'); 34 | await ownership.wait(); 35 | 36 | console.log(`Ownership set`); 37 | 38 | } 39 | 40 | // We recommend this pattern to be able to use async/await everywhere 41 | // and properly handle errors. 42 | main() 43 | .then(() => process.exit(0)) 44 | .catch(error => { 45 | console.error(error); 46 | process.exit(1); 47 | }); 48 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/61_royalty_deployment.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require("hardhat"); 2 | 3 | const { 4 | ether, 5 | } = require('@openzeppelin/test-helpers'); 6 | 7 | const _ = require('lodash'); 8 | 9 | async function main() { 10 | const [deployer] = await ethers.getSigners(); 11 | const deployerAddress = await deployer.getAddress(); 12 | console.log('Deploying overrideRoyalty as upgradeable'); 13 | 14 | const royaltyReceiver = "0x88BB4d01352C34dfd940Bd3f6f60B8EBd8e5C92b"; 15 | const bps = "250"; // 2.5% 16 | 17 | 18 | const overrideContractFactory = await ethers.getContractFactory("EIP2981RoyaltyOverrideCloneable"); 19 | const overrideRoyalty = await upgrades.deployProxy(overrideContractFactory, [royaltyReceiver, bps]); 20 | await overrideRoyalty.deployed(); 21 | 22 | console.log(`overrideRoyalty at: ${overrideRoyalty.address} `); 23 | 24 | } 25 | 26 | // We recommend this pattern to be able to use async/await everywhere 27 | // and properly handle errors. 28 | main() 29 | .then(() => process.exit(0)) 30 | .catch(error => { 31 | console.error(error); 32 | process.exit(1); 33 | }); 34 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/63_patronmarketplace_deployment.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require("hardhat"); 2 | 3 | const { 4 | ether, 5 | } = require('@openzeppelin/test-helpers'); 6 | 7 | const _ = require('lodash'); 8 | 9 | async function main() { 10 | const [deployer] = await ethers.getSigners(); 11 | const deployerAddress = await deployer.getAddress(); 12 | console.log('Deploying Patron Marketplace as upgradeable'); 13 | 14 | // Some constants setup 15 | const accessControls = "0xbe5c84e6b036cb41a7a6b5008b9427a5f4f1c9f5"; 16 | const nft = "0x7b2a989c4d1ad1b79a84ce2eb79da5d8d9c2b7a7"; 17 | const garmentCollection = "0x721f7c76e447174141a761ce3e80ad88e5e07047"; 18 | const dripOracle = "0x850068534c72317a762f0340500dee727ea85e29"; 19 | const platformFeeRecipient = "0xea41cd3f972db6237ffa2918df9199b547172420"; 20 | const wetherc20token = "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"; 21 | const trustedForwarder = "0x86c80a8aa58e0a4fa09a69624c31ab2a6cad56b8"; 22 | 23 | const patronContractFactory = await ethers.getContractFactory("PatronMarketplace"); 24 | const patron = await upgrades.deployProxy(patronContractFactory, 25 | [accessControls, nft, garmentCollection, dripOracle, platformFeeRecipient, wetherc20token, trustedForwarder]); 26 | await patron.deployed(); 27 | 28 | console.log(`patron contract at: ${patron.address} `); 29 | 30 | } 31 | 32 | // We recommend this pattern to be able to use async/await everywhere 33 | // and properly handle errors. 34 | main() 35 | .then(() => process.exit(0)) 36 | .catch(error => { 37 | console.error(error); 38 | process.exit(1); 39 | }); 40 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/67_nix_upgrade.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require("hardhat"); 2 | 3 | const { 4 | ether, 5 | } = require('@openzeppelin/test-helpers'); 6 | 7 | const _ = require('lodash'); 8 | 9 | async function main() { 10 | const [deployer] = await ethers.getSigners(); 11 | const deployerAddress = await deployer.getAddress(); 12 | 13 | 14 | const NixFactory = await ethers.getContractFactory("Nix"); 15 | const nix = await upgrades.upgradeProxy("0x8cc988c30c3959fc0e77ef7baa9c3ed6438b4325", NixFactory); 16 | await nix.deployed(); 17 | console.log(nix.address); 18 | 19 | } 20 | 21 | // We recommend this pattern to be able to use async/await everywhere 22 | // and properly handle errors. 23 | main() 24 | .then(() => process.exit(0)) 25 | .catch(error => { 26 | console.error(error); 27 | process.exit(1); 28 | }); 29 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/69_mona_staking_rewards_upgrade.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require("hardhat"); 2 | 3 | const { 4 | ether, 5 | } = require('@openzeppelin/test-helpers'); 6 | 7 | const _ = require('lodash'); 8 | 9 | async function main() { 10 | const [deployer] = await ethers.getSigners(); 11 | const deployerAddress = await deployer.getAddress(); 12 | 13 | 14 | const NixFactory = await ethers.getContractFactory("DigitalaxNFTRewardsV2"); 15 | const nix = await upgrades.upgradeProxy("0x0a23f877b546881defd1f2143cfa0ef50af2f46a", NixFactory); 16 | await nix.deployed(); 17 | const nix2 = await upgrades.upgradeProxy("0x0e100417c6052af71fae9e5cee2cc16ac8ed99ec", NixFactory); 18 | await nix2.deployed(); 19 | console.log(nix.address); 20 | console.log(nix2.address); 21 | 22 | const NixFactory2 = await ethers.getContractFactory("DigitalaxRewardsV2"); 23 | const nix3 = await upgrades.upgradeProxy("0x03a3b7f1a5ac493f7a179e84b5fec32650a11eb6", NixFactory2); 24 | await nix3.deployed(); 25 | console.log(nix3.address); 26 | 27 | 28 | } 29 | 30 | // We recommend this pattern to be able to use async/await everywhere 31 | // and properly handle errors. 32 | main() 33 | .then(() => process.exit(0)) 34 | .catch(error => { 35 | console.error(error); 36 | process.exit(1); 37 | }); 38 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/71_royalty_override_deployment.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require("hardhat"); 2 | 3 | const { 4 | ether, 5 | } = require('@openzeppelin/test-helpers'); 6 | 7 | const _ = require('lodash'); 8 | 9 | async function main() { 10 | const [deployer] = await ethers.getSigners(); 11 | const deployerAddress = await deployer.getAddress(); 12 | console.log('Deploying Royalty override as upgradeable'); 13 | 14 | const defaultReceiver = '0xAA3e5ee4fdC831e5274FE7836c95D670dC2502e6'; 15 | const bps = 300; 16 | const royaltyContractFactory = await ethers.getContractFactory("EIP2981RoyaltyOverrideCloneable"); 17 | const royalty = await upgrades.deployProxy(royaltyContractFactory, [defaultReceiver, bps]); 18 | await royalty.deployed(); 19 | 20 | console.log(`royalty contract at: ${royalty.address} `); 21 | 22 | } 23 | 24 | // We recommend this pattern to be able to use async/await everywhere 25 | // and properly handle errors. 26 | main() 27 | .then(() => process.exit(0)) 28 | .catch(error => { 29 | console.error(error); 30 | process.exit(1); 31 | }); 32 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/75_pode_weight_set.js: -------------------------------------------------------------------------------- 1 | const GuildNftWeightV4Artifact = require('../../artifacts/contracts/staking/GuildNFTStakingWeightV4.sol/GuildNFTStakingWeightV4.json'); 2 | 3 | const fs = require('fs'); 4 | const _ = require('lodash'); 5 | 6 | async function main() { 7 | const [deployer] = await ethers.getSigners(); 8 | const deployerAddress = await deployer.getAddress(); 9 | console.log( 10 | 'Analyzing with following address', 11 | deployerAddress 12 | ); 13 | 14 | const {GUILD_NFT_STAKING_WEIGHT_V4_ADDRESS} = process.env; 15 | 16 | console.log(`GUILD_NFT_STAKING_WEIGHT_V4 found [${GUILD_NFT_STAKING_WEIGHT_V4_ADDRESS}]`); 17 | 18 | const stakingWeight = new ethers.Contract( 19 | GUILD_NFT_STAKING_WEIGHT_V4_ADDRESS, 20 | GuildNftWeightV4Artifact.abi, 21 | deployer 22 | ); 23 | 24 | console.log(`----------------------`); 25 | 26 | const metadata = require('./dltapodeweights.json'); 27 | // Data length 28 | console.log("number of tokens to check:") 29 | console.log(metadata.length) 30 | const datas = metadata; 31 | const MAX_NFT_SINGLE_TX = 100; 32 | const chunks = _.chunk(datas, MAX_NFT_SINGLE_TX); 33 | 34 | for(let i = 0; i< chunks.length ; i++){ 35 | const x = chunks[i]; 36 | const migrate = await stakingWeight.migrateCurrentMembershipStake(x.map((x)=>{return x["id"]}), x.map((x)=>{return x["weight"]})); 37 | await migrate.wait(); 38 | console.log('migrated'); 39 | } 40 | } 41 | 42 | // We recommend this pattern to be able to use async/await everywhere 43 | // and properly handle errors. 44 | main() 45 | .then(() => process.exit(0)) 46 | .catch(error => { 47 | console.error(error); 48 | process.exit(1); 49 | }); 50 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/76_whitelist_weight_set.js: -------------------------------------------------------------------------------- 1 | const GuildNftWeightV4Artifact = require('../../artifacts/contracts/staking/GuildNFTStakingWeightV4.sol/GuildNFTStakingWeightV4.json'); 2 | 3 | const fs = require('fs'); 4 | const _ = require('lodash'); 5 | 6 | async function main() { 7 | const [deployer] = await ethers.getSigners(); 8 | const deployerAddress = await deployer.getAddress(); 9 | console.log( 10 | 'Analyzing with following address', 11 | deployerAddress 12 | ); 13 | 14 | const {GUILD_NFT_STAKING_WEIGHT_V4_ADDRESS} = process.env; 15 | 16 | console.log(`GUILD_NFT_STAKING_WEIGHT_V4 found [${GUILD_NFT_STAKING_WEIGHT_V4_ADDRESS}]`); 17 | 18 | const stakingWeight = new ethers.Contract( 19 | GUILD_NFT_STAKING_WEIGHT_V4_ADDRESS, 20 | GuildNftWeightV4Artifact.abi, 21 | deployer 22 | ); 23 | 24 | console.log(`----------------------`); 25 | 26 | const metadata = require('./dltawhitelistweights.json'); 27 | // Data length 28 | console.log("number of tokens to check:") 29 | console.log(metadata.length) 30 | const datas = metadata; 31 | const MAX_NFT_SINGLE_TX = 100; 32 | const chunks = _.chunk(datas, MAX_NFT_SINGLE_TX); 33 | 34 | for(let i = 0; i< chunks.length ; i++){ 35 | const x = chunks[i]; 36 | const migrate = await stakingWeight.migrateCurrentWhitelistStake(x.map((x)=>{return x["tokenId"]}), x.map((x)=>{return x["token"]}), x.map((x)=>{return x["weight"]})); 37 | await migrate.wait(); 38 | console.log('migrated'); 39 | } 40 | } 41 | 42 | // We recommend this pattern to be able to use async/await everywhere 43 | // and properly handle errors. 44 | main() 45 | .then(() => process.exit(0)) 46 | .catch(error => { 47 | console.error(error); 48 | process.exit(1); 49 | }); 50 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/78_guild_staking_upgrade.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require("hardhat"); 2 | 3 | const { 4 | ether, 5 | } = require('@openzeppelin/test-helpers'); 6 | 7 | const _ = require('lodash'); 8 | 9 | async function main() { 10 | const [deployer] = await ethers.getSigners(); 11 | const deployerAddress = await deployer.getAddress(); 12 | 13 | 14 | const NixFactory = await ethers.getContractFactory("GuildNFTStakingV3"); 15 | const nix = await upgrades.upgradeProxy("0xD750612b4C2653F938f4CA3edEa2a2182AD996f8", NixFactory); 16 | await nix.deployed(); 17 | console.log(nix.address); 18 | 19 | // const NixFactory2 = await ethers.getContractFactory("GuildWhitelistedNFTStakingV3"); 20 | // const nix2 = await upgrades.upgradeProxy("0xB08F4575D1Ab2FBa5463d13395279C134ACE6aF7", NixFactory2); 21 | // await nix2.deployed(); 22 | // console.log(nix2.address); 23 | 24 | } 25 | 26 | // We recommend this pattern to be able to use async/await everywhere 27 | // and properly handle errors. 28 | main() 29 | .then(() => process.exit(0)) 30 | .catch(error => { 31 | console.error(error); 32 | process.exit(1); 33 | }); 34 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/81_long_term_skins_upgrade.js: -------------------------------------------------------------------------------- 1 | // const GuildNftStakingArtifact = require('../../artifacts/contracts/staking/GuildNFTStakingWeightV2.sol/GuildNFTStakingWeightV2.json'); 2 | // const GuildNftStakingArtifact = require('../../artifacts/contracts/staking/GuildNFTStakingWeightV2.sol/GuildNFTStakingWeightV2.json'); 3 | const { ethers, upgrades } = require("hardhat"); 4 | 5 | const { 6 | ether, 7 | } = require('@openzeppelin/test-helpers'); 8 | const _ = require('lodash'); 9 | 10 | async function main() { 11 | const [deployer] = await ethers.getSigners(); 12 | const deployerAddress = await deployer.getAddress(); 13 | 14 | 15 | const NixFactory = await ethers.getContractFactory("DigitalaxNFTStaking"); 16 | const nix = await upgrades.upgradeProxy("0xd80eeB5aFfd3C419f2Cb05477372778862D26757", NixFactory); 17 | await nix.deployed(); 18 | console.log(nix.address); 19 | 20 | 21 | } 22 | 23 | // We recommend this pattern to be able to use async/await everywhere 24 | // and properly handle errors. 25 | main() 26 | .then(() => process.exit(0)) 27 | .catch(error => { 28 | console.error(error); 29 | process.exit(1); 30 | }); 31 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/82_staking_prices_update.js: -------------------------------------------------------------------------------- 1 | const NFTStakingArtifact = require('../../artifacts/contracts/staking/DigitalaxNFTStaking.sol/DigitalaxNFTStaking.json'); 2 | 3 | const fs = require('fs'); 4 | const _ = require('lodash'); 5 | 6 | async function main() { 7 | const [deployer] = await ethers.getSigners(); 8 | const deployerAddress = await deployer.getAddress(); 9 | console.log( 10 | 'Analyzing with following address', 11 | deployerAddress 12 | ); 13 | 14 | const DIGITALAX_STAKING_ADDRESS = "0xd80eeB5aFfd3C419f2Cb05477372778862D26757" 15 | // const DIGITALAX_STAKING_ADDRESS = "0x2E4ae1f8E1463f450e9B01F20cee1590Bff4E1fC" 16 | 17 | 18 | const stakingContract = new ethers.Contract( 19 | DIGITALAX_STAKING_ADDRESS, 20 | NFTStakingArtifact.abi, 21 | deployer 22 | ); 23 | 24 | 25 | const metadata = require('./tokensmigrated.json'); 26 | // Data length 27 | console.log("number of tokens to check:") 28 | console.log(metadata.length) 29 | const datas = metadata; 30 | const MAX_NFT_SINGLE_TX = 100; 31 | const chunks = _.chunk(datas, MAX_NFT_SINGLE_TX); 32 | 33 | for(let i = 1; i< chunks.length ; i++){ 34 | const x = chunks[i]; 35 | const y = x.map((z)=>{return z["id"]}); 36 | 37 | console.log(x); 38 | const update = await stakingContract.saveCurrentPrimarySalePrice(y); 39 | await update.wait(); 40 | } 41 | 42 | } 43 | 44 | // We recommend this pattern to be able to use async/await everywhere 45 | // and properly handle errors. 46 | main() 47 | .then(() => process.exit(0)) 48 | .catch(error => { 49 | console.error(error); 50 | process.exit(1); 51 | }); 52 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/83_staking_upgrade.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require("hardhat"); 2 | 3 | const { 4 | ether, 5 | } = require('@openzeppelin/test-helpers'); 6 | 7 | const _ = require('lodash'); 8 | 9 | async function main() { 10 | const [deployer] = await ethers.getSigners(); 11 | const deployerAddress = await deployer.getAddress(); 12 | 13 | // for the w3f gdn Important - backup at 0x0408d8442bdc1bff2d8338ad2d6536a131fba669 14 | // const NixFactory = await ethers.getContractFactory("DigitalaxNFTStaking"); 15 | // const nix = await upgrades.upgradeProxy("0x2E4ae1f8E1463f450e9B01F20cee1590Bff4E1fC", NixFactory); 16 | // await nix.deployed(); 17 | // console.log(nix.address); 18 | 19 | // Important back up at 0xe78fc90a90aa51cb6c89b89682521d719109dceb 20 | // backup at 0xe8fe11af9656792f0c0948dac2282b8d3cdc9029 21 | const NixFactory2 = await ethers.getContractFactory("DigitalaxNFTStaking"); 22 | const nix2 = await upgrades.upgradeProxy("0xd80eeb5affd3c419f2cb05477372778862d26757", NixFactory2); 23 | await nix2.deployed(); 24 | console.log(nix2.address); 25 | 26 | } 27 | 28 | // We recommend this pattern to be able to use async/await everywhere 29 | // and properly handle errors. 30 | main() 31 | .then(() => process.exit(0)) 32 | .catch(error => { 33 | console.error(error); 34 | process.exit(1); 35 | }); 36 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/84_verified_minter_deploy.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require("hardhat"); 2 | 3 | const { 4 | ether, 5 | } = require('@openzeppelin/test-helpers'); 6 | 7 | const _ = require('lodash'); 8 | 9 | async function main() { 10 | const [deployer] = await ethers.getSigners(); 11 | const deployerAddress = await deployer.getAddress(); 12 | console.log('Deploying verified minter as upgradeable'); 13 | 14 | const accessControls = "0xbe5c84e6b036cb41a7a6b5008b9427a5f4f1c9f5"; 15 | const childContract = "0x6c2a60333442aad9c34e7034fa1d04d7ad0a6f33"; 16 | 17 | 18 | const contractFactory = await ethers.getContractFactory("DigitalaxChildVerifiedMint"); 19 | const verifiedMinter = await upgrades.deployProxy(contractFactory, [accessControls, childContract]); 20 | await verifiedMinter.deployed(); 21 | 22 | console.log(`verifiedMinter at: ${verifiedMinter.address} `); 23 | 24 | } 25 | 26 | // We recommend this pattern to be able to use async/await everywhere 27 | // and properly handle errors. 28 | main() 29 | .then(() => process.exit(0)) 30 | .catch(error => { 31 | console.error(error); 32 | process.exit(1); 33 | }); 34 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/92_deploy_cco.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require("hardhat"); 2 | 3 | const { 4 | ether, 5 | } = require('@openzeppelin/test-helpers'); 6 | 7 | const _ = require('lodash'); 8 | 9 | async function main() { 10 | const [deployer] = await ethers.getSigners(); 11 | const deployerAddress = await deployer.getAddress(); 12 | console.log('Deploying cco nft'); 13 | 14 | const accessControls = "0xbe5c84e6b036cb41a7a6b5008b9427a5f4f1c9f5"; 15 | const childContract = "0x567c7b3364ba2903a80ecbad6c54ba8c0e1a069e"; 16 | const trustedForwarder = "0x567c7b3364ba2903a80ecbad6c54ba8c0e1a069e"; 17 | const childChain = "0xa6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa"; 18 | 19 | 20 | const contractFactory2 = await ethers.getContractFactory("CC0DAONFT"); 21 | const logic = await contractFactory2.deploy(); 22 | await logic.deployed(); 23 | await logic.initialize( 24 | accessControls, 25 | childContract, 26 | childChain, 27 | trustedForwarder, 28 | ); 29 | 30 | console.log(`logic at: ${logic.address} `); 31 | } 32 | 33 | // We recommend this pattern to be able to use async/await everywhere 34 | // and properly handle errors. 35 | main() 36 | .then(() => process.exit(0)) 37 | .catch(error => { 38 | console.error(error); 39 | process.exit(1); 40 | }); 41 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/93_nouns_auction_upgrade.js: -------------------------------------------------------------------------------- 1 | const { ethers, upgrades } = require("hardhat"); 2 | 3 | const { 4 | ether, 5 | } = require('@openzeppelin/test-helpers'); 6 | 7 | const _ = require('lodash'); 8 | 9 | async function main() { 10 | const [deployer] = await ethers.getSigners(); 11 | const deployerAddress = await deployer.getAddress(); 12 | 13 | 14 | const NixFactory = await ethers.getContractFactory("NounsAuctionHouse"); 15 | const nix = await upgrades.upgradeProxy("0x6AAA153b30E632fa02c496b0524Be81e0422b10b", NixFactory); 16 | await nix.deployed(); 17 | console.log(nix.address); 18 | 19 | } 20 | 21 | // We recommend this pattern to be able to use async/await everywhere 22 | // and properly handle errors. 23 | main() 24 | .then(() => process.exit(0)) 25 | .catch(error => { 26 | console.error(error); 27 | process.exit(1); 28 | }); 29 | -------------------------------------------------------------------------------- /smart-contracts/scripts/auction_marketplace_deployment/collections.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | 21, 4 | 22, 5 | 61, 6 | 62, 7 | 63, 8 | 64, 9 | 65, 10 | 66, 11 | 67, 12 | 68, 13 | 69, 14 | 70, 15 | 71, 16 | 72, 17 | 73, 18 | 74, 19 | 75, 20 | 76, 21 | 77, 22 | 78, 23 | 79, 24 | 80, 25 | 81, 26 | 82, 27 | 87, 28 | 88, 29 | 89, 30 | 93, 31 | 94, 32 | 95, 33 | 97, 34 | 98, 35 | 99, 36 | 100, 37 | 101, 38 | 102, 39 | 103, 40 | 104, 41 | 108, 42 | 109, 43 | 110, 44 | 111, 45 | 112, 46 | 113, 47 | 114, 48 | 115, 49 | 116, 50 | 117, 51 | 118, 52 | 119, 53 | 120, 54 | 121, 55 | 122, 56 | 123, 57 | 125, 58 | 126, 59 | 127, 60 | 128, 61 | 129, 62 | 130, 63 | 131, 64 | 132, 65 | 133, 66 | 134, 67 | 135, 68 | 136, 69 | 137, 70 | 138, 71 | 139, 72 | 140, 73 | 141, 74 | 142] 75 | } 76 | -------------------------------------------------------------------------------- /smart-contracts/scripts/digitalax_index/1_initial_map_indexes.js: -------------------------------------------------------------------------------- 1 | const DigitalaxIndexArtifact = require('../../artifacts/DigitalaxIndex.json'); 2 | const {FUND_MULTISIG_ADDRESS} = require('../constants'); 3 | 4 | async function main() { 5 | const [deployer] = await ethers.getSigners(); 6 | const deployerAddress = await deployer.getAddress(); 7 | 8 | const {DIGITALAX_INDEX_ADDRESS} = process.env; 9 | console.log(`DIGITALAX_INDEX_ADDRESS found [${DIGITALAX_INDEX_ADDRESS}]`); 10 | 11 | const digitalaxIndex = new ethers.Contract( 12 | DIGITALAX_INDEX_ADDRESS, 13 | DigitalaxIndexArtifact.abi, 14 | deployer 15 | ); 16 | 17 | let tx1 = await digitalaxIndex.addAuctionSet(['634', '635', '636', '637']); 18 | await tx1.wait(); 19 | 20 | let tx2 = await digitalaxIndex.addDesignerSet(['634', '635', '636', '637']); 21 | await tx2.wait(); 22 | 23 | let tx3 = await digitalaxIndex.updateDesignerInfo(0,'https://gateway.pinata.cloud/ipfs/QmYmsptRKxYCYDpvkxmQWNRw5wxquNVH6RW4cLJiL5bVCV'); 24 | await tx3.wait(); 25 | 26 | console.log(`Done`); 27 | } 28 | 29 | // We recommend this pattern to be able to use async/await everywhere 30 | // and properly handle errors. 31 | main() 32 | .then(() => process.exit(0)) 33 | .catch(error => { 34 | console.error(error); 35 | process.exit(1); 36 | }); 37 | -------------------------------------------------------------------------------- /smart-contracts/scripts/test_scripts/10_test_bid.js: -------------------------------------------------------------------------------- 1 | const prompt = require('prompt-sync')(); 2 | const AuctionArtifact = require('../../artifacts/DigitalaxAuction.json'); 3 | 4 | async function main() { 5 | const [deployer] = await ethers.getSigners(); 6 | const deployerAddress = await deployer.getAddress(); 7 | console.log( 8 | 'Placing a bid with signer address:', 9 | deployerAddress 10 | ); 11 | 12 | const auctionAddress = prompt('Auction address? '); 13 | const auction = new ethers.Contract( 14 | auctionAddress, 15 | AuctionArtifact.abi, 16 | deployer 17 | ); 18 | 19 | await auction.placeBid( 20 | '3', 21 | {value: '700000000000000000'} 22 | ); 23 | 24 | await auction.placeBid( 25 | '3', 26 | {value: '900000000000000000'} 27 | ); 28 | 29 | await auction.placeBid( 30 | '4', 31 | {value: '700000000000000000'} 32 | ); 33 | 34 | await auction.placeBid( 35 | '4', 36 | {value: '900000000000000000'} 37 | ); 38 | } 39 | 40 | // We recommend this pattern to be able to use async/await everywhere 41 | // and properly handle errors. 42 | main() 43 | .then(() => process.exit(0)) 44 | .catch(error => { 45 | console.error(error); 46 | process.exit(1); 47 | }); 48 | -------------------------------------------------------------------------------- /smart-contracts/scripts/test_scripts/11_test_result_auction.js: -------------------------------------------------------------------------------- 1 | const prompt = require('prompt-sync')(); 2 | const FactoryArtifact = require('../../artifacts/DigitalaxGarmentFactory.json'); 3 | const AuctionArtifact = require('../../artifacts/DigitalaxAuction.json'); 4 | const GarmentArtifact = require('../../artifacts/DigitalaxGarmentNFT.json'); 5 | const AccessControlsArtifact = require('../../artifacts/DigitalaxAccessControls.json'); 6 | 7 | async function main() { 8 | const [deployer] = await ethers.getSigners(); 9 | const deployerAddress = await deployer.getAddress(); 10 | console.log( 11 | 'Using signer address:', 12 | deployerAddress 13 | ); 14 | 15 | const auctionAddress = prompt('Auction address? '); 16 | // const accessControlsAddress = prompt('Access controls address? '); 17 | // const accessControls = new ethers.Contract( 18 | // accessControlsAddress, 19 | // AccessControlsArtifact.abi, 20 | // deployer 21 | // ); 22 | // 23 | // await accessControls.addSmartContractRole(auctionAddress); 24 | 25 | // const garmentAddress = prompt('Garment address? '); 26 | // const garment = new ethers.Contract( 27 | // garmentAddress, 28 | // GarmentArtifact.abi, 29 | // deployer 30 | // ); 31 | // 32 | // const tx = await garment.approve(auctionAddress, '1'); 33 | // await tx.wait(); 34 | 35 | const auction = new ethers.Contract( 36 | auctionAddress, 37 | AuctionArtifact.abi, 38 | deployer 39 | ); 40 | 41 | //1605534912 42 | 43 | await auction.resultAuction( 44 | '1' 45 | ); 46 | } 47 | 48 | // We recommend this pattern to be able to use async/await everywhere 49 | // and properly handle errors. 50 | main() 51 | .then(() => process.exit(0)) 52 | .catch(error => { 53 | console.error(error); 54 | process.exit(1); 55 | }); 56 | -------------------------------------------------------------------------------- /smart-contracts/scripts/test_scripts/12_test_get_balance_materials.js: -------------------------------------------------------------------------------- 1 | const prompt = require('prompt-sync')(); 2 | const MaterialsArtifact = require('../../artifacts/DigitalaxMaterials.json'); 3 | 4 | async function main() { 5 | const [deployer] = await ethers.getSigners(); 6 | const deployerAddress = await deployer.getAddress(); 7 | console.log( 8 | 'Query address:', 9 | deployerAddress 10 | ); 11 | 12 | const materialsAddress = prompt('Materials address? '); 13 | const materials = new ethers.Contract( 14 | materialsAddress, 15 | MaterialsArtifact.abi, 16 | deployer 17 | ); 18 | 19 | for (let i = 1; i <= 6; i++) { 20 | console.log( 21 | `Balance of strand [${i}]`, 22 | (await materials.balanceOf('0xd677aed0965ac9b54e709f01a99ceca205aebc4b', i)).toString() 23 | ); 24 | } 25 | } 26 | 27 | // We recommend this pattern to be able to use async/await everywhere 28 | // and properly handle errors. 29 | main() 30 | .then(() => process.exit(0)) 31 | .catch(error => { 32 | console.error(error); 33 | process.exit(1); 34 | }); 35 | -------------------------------------------------------------------------------- /smart-contracts/scripts/test_scripts/13_test_create_and_mint_child.js: -------------------------------------------------------------------------------- 1 | var prompt = require('prompt-sync')(); 2 | const web3 = require('web3'); 3 | const MaterialsArtifact = require('../artifacts/DigitalaxMaterials.json'); 4 | 5 | async function main() { 6 | const [deployer] = await ethers.getSigners(); 7 | const deployerAddress = await deployer.getAddress(); 8 | console.log( 9 | "Deploying materials with address:", 10 | deployerAddress 11 | ); 12 | 13 | const materialsAddress = prompt('Materials address? '); 14 | const materials = new ethers.Contract( 15 | materialsAddress, 16 | MaterialsArtifact.abi, 17 | deployer 18 | ); 19 | 20 | // const tx = await materials.createChild('https://gateway.pinata.cloud/ipfs/QmRTt56q6hvxnhPcCfXQjaUTJWG5r7cmngDaX14ProVFN8'); 21 | // await tx.wait(); 22 | const EMPTY_BYTES = web3.utils.encodePacked(''); 23 | 24 | await materials.mintChild( 25 | '1', 26 | '45', 27 | deployerAddress, 28 | EMPTY_BYTES 29 | ); 30 | } 31 | 32 | // We recommend this pattern to be able to use async/await everywhere 33 | // and properly handle errors. 34 | main() 35 | .then(() => process.exit(0)) 36 | .catch(error => { 37 | console.error(error); 38 | process.exit(1); 39 | }); 40 | -------------------------------------------------------------------------------- /smart-contracts/scripts/test_scripts/7_test_factory.js: -------------------------------------------------------------------------------- 1 | const prompt = require('prompt-sync')(); 2 | const FactoryArtifact = require('../../artifacts/DigitalaxGarmentFactory.json'); 3 | 4 | async function main() { 5 | const [deployer] = await ethers.getSigners(); 6 | const deployerAddress = await deployer.getAddress(); 7 | console.log( 8 | 'Creating a garment and wrapping using factory with address:', 9 | deployerAddress 10 | ); 11 | 12 | const factoryAddress = prompt('Factory address? '); 13 | const factory = new ethers.Contract( 14 | factoryAddress, 15 | FactoryArtifact.abi, 16 | deployer 17 | ); 18 | 19 | const tx = await factory.createNewChildren([ 20 | 'https://gateway.pinata.cloud/ipfs/Qmb3ZYpR2VeHR4s3CAUvnAGY1oZFfciLricN8JhCb68uQB', 21 | 'https://gateway.pinata.cloud/ipfs/QmRTt56q6hvxnhPcCfXQjaUTJWG5r7cmngDaX14ProVFN8' 22 | ]); 23 | 24 | await tx.wait(); 25 | 26 | await factory.mintParentWithChildren( 27 | 'https://gateway.pinata.cloud/ipfs/QmeF4uEJaW5JTcRCL58w5vKq4cbqMJ9VFDfhch8Zz1qypN', 28 | '0xA9d8b169783100639Bb137eC09f7277DC7948760', 29 | ['7', '8'], 30 | ['9', '4'], 31 | deployerAddress 32 | ); 33 | } 34 | 35 | // We recommend this pattern to be able to use async/await everywhere 36 | // and properly handle errors. 37 | main() 38 | .then(() => process.exit(0)) 39 | .catch(error => { 40 | console.error(error); 41 | process.exit(1); 42 | }); 43 | -------------------------------------------------------------------------------- /smart-contracts/scripts/test_scripts/8_test_garment_burn.js: -------------------------------------------------------------------------------- 1 | const prompt = require('prompt-sync')(); 2 | const GarmentArtifact = require('../../artifacts/DigitalaxGarmentNFT.json'); 3 | 4 | async function main() { 5 | const [deployer] = await ethers.getSigners(); 6 | const deployerAddress = await deployer.getAddress(); 7 | console.log( 8 | 'Burning a garment with signer address:', 9 | deployerAddress 10 | ); 11 | 12 | const garmentAddress = prompt('Garment address? '); 13 | const garment = new ethers.Contract( 14 | garmentAddress, 15 | GarmentArtifact.abi, 16 | deployer 17 | ); 18 | 19 | await garment.burn('2'); 20 | } 21 | 22 | // We recommend this pattern to be able to use async/await everywhere 23 | // and properly handle errors. 24 | main() 25 | .then(() => process.exit(0)) 26 | .catch(error => { 27 | console.error(error); 28 | process.exit(1); 29 | }); 30 | -------------------------------------------------------------------------------- /subgraph-dlta/networks/mumbai.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "mumbai", 3 | "GuildNFTStakingAddress": "0x665bF9Ea8E3036088a6C767b0184cA4A4f13AD67", 4 | "GuildNFTStakingStartBlock": 12000000, 5 | "GuildWhitelistedNFTStakingAddress": "0x21e042FACb0c8C55d3A33D15d4a8279a23d78BE9", 6 | "GuildWhitelistedNFTStakingStartBlock": 12000000, 7 | "PodeNFTv2Address": "0x2b319564aB130C8fd0e8C996ba806323fE3b7880", 8 | "PodeNFTv2StartBlock": 12000000, 9 | "GuildNFTStakingWeightV2Address": "0xb155B018be74119792dcbE4c9a81906b1809065B", 10 | "GuildNFTStakingWeightV2StartBlock": 12000000 11 | } 12 | -------------------------------------------------------------------------------- /subgraph-dlta/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "digitalax", 3 | "version": "0.1.0", 4 | "scripts": { 5 | "build": "graph build", 6 | "codegen": "graph codegen", 7 | "prep:matic": "mustache networks/matic.json subgraph.template.yaml > subgraph.yaml && yarn codegen", 8 | "prep:mumbai": "mustache networks/mumbai.json subgraph.template.yaml > subgraph.yaml && yarn codegen", 9 | "create": "graph create digitalax/digitalaxmatic --node https://api.thegraph.com/deploy/", 10 | "create-local": "graph create blockrockettech/digitalax --node http://127.0.0.1:8020", 11 | "deploy:mumbai": "yarn prep:mumbai; graph deploy --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ digitalax/digitalaxmumbai", 12 | "deploy:matic": "yarn prep:mainnet; graph deploy --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ digitalax/digitalaxmatic", 13 | "deploy-local": "graph deploy blockrockettech/digitalax --ipfs http://localhost:5001 --node http://127.0.0.1:8020" 14 | }, 15 | "devDependencies": { 16 | "@graphprotocol/graph-cli": "^0.18.0", 17 | "@graphprotocol/graph-ts": "^0.18.0", 18 | "mustache": "^4.0.1" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /subgraph-dlta/src/constants.ts: -------------------------------------------------------------------------------- 1 | import {BigDecimal, BigInt, Address, Bytes} from "@graphprotocol/graph-ts/index"; 2 | 3 | export const ZERO_ADDRESS = Address.fromString("0x0000000000000000000000000000000000000000") 4 | export const ZERO_BIG_DECIMAL = BigDecimal.fromString("0") 5 | export const ZERO = BigInt.fromI32(0) 6 | export const ONE = BigInt.fromI32(1) 7 | export const MAX_UINT_256 = BigInt.fromUnsignedBytes(Bytes.fromHexString("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff") as Bytes) 8 | 9 | export const ONE_ETH = new BigDecimal(BigInt.fromI32(1).times(BigInt.fromI32(10).pow(18))) 10 | export const SECONDS_IN_DAY = BigInt.fromI32(86400) 11 | -------------------------------------------------------------------------------- /subgraph-dlta/src/factory/GDNDltaNFTCollector.factory.ts: -------------------------------------------------------------------------------- 1 | import {GDNDltaNFTCollector} from "../../generated/schema"; 2 | import {Address} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateGDNDltaNFTCollector(collector: Address): GDNDltaNFTCollector { 5 | let gdnDltaNFTCollector: GDNDltaNFTCollector | null = GDNDltaNFTCollector.load(collector.toHexString()); 6 | if (gdnDltaNFTCollector == null) { 7 | gdnDltaNFTCollector = new GDNDltaNFTCollector(collector.toHexString()) 8 | gdnDltaNFTCollector.parentsOwned = new Array(); 9 | } 10 | gdnDltaNFTCollector.save() 11 | return gdnDltaNFTCollector as GDNDltaNFTCollector; 12 | } 13 | -------------------------------------------------------------------------------- /subgraph-dlta/src/factory/GDNMembershipCollector.factory.ts: -------------------------------------------------------------------------------- 1 | import {GDNMembershipCollector} from "../../generated/schema"; 2 | import {Address} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateGDNMembershipCollector(collector: Address): GDNMembershipCollector { 5 | let gdnMembershipCollector: GDNMembershipCollector | null = GDNMembershipCollector.load(collector.toHexString()); 6 | if (gdnMembershipCollector == null) { 7 | gdnMembershipCollector = new GDNMembershipCollector(collector.toHexString()) 8 | gdnMembershipCollector.parentsOwned = new Array(); 9 | } 10 | gdnMembershipCollector.save() 11 | return gdnMembershipCollector as GDNMembershipCollector; 12 | } 13 | -------------------------------------------------------------------------------- /subgraph-dlta/src/factory/LookGoldenTicketCollector.factory.ts: -------------------------------------------------------------------------------- 1 | import {LookGoldenTicketCollector} from "../../generated/schema"; 2 | import {Address} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateLookGoldenTicketCollector(collector: Address): LookGoldenTicketCollector { 5 | let lookGoldenTicketCollector: LookGoldenTicketCollector | null = LookGoldenTicketCollector.load(collector.toHexString()); 6 | if (lookGoldenTicketCollector == null) { 7 | lookGoldenTicketCollector = new LookGoldenTicketCollector(collector.toHexString()) 8 | lookGoldenTicketCollector.parentsOwned = new Array(); 9 | } 10 | lookGoldenTicketCollector.save() 11 | return lookGoldenTicketCollector as LookGoldenTicketCollector; 12 | } 13 | -------------------------------------------------------------------------------- /subgraph-dlta/src/factory/PodeNFTv2Collector.factory.ts: -------------------------------------------------------------------------------- 1 | import {PodeNFTv2Collector} from "../../generated/schema"; 2 | import {Address} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreatePodeNFTv2Collector(collector: Address): PodeNFTv2Collector { 5 | let podeNFTv2Collector: PodeNFTv2Collector | null = PodeNFTv2Collector.load(collector.toHexString()); 6 | if (podeNFTv2Collector == null) { 7 | podeNFTv2Collector = new PodeNFTv2Collector(collector.toHexString()) 8 | podeNFTv2Collector.parentsOwned = new Array(); 9 | } 10 | podeNFTv2Collector.save() 11 | return podeNFTv2Collector as PodeNFTv2Collector; 12 | } 13 | -------------------------------------------------------------------------------- /subgraph-dlta/src/factory/PodeNFTv2OGHolder.factory.ts: -------------------------------------------------------------------------------- 1 | import {PodeNFTv2OGHolder} from "../../generated/schema"; 2 | import {log} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreatePodeNFTv2OGHolder(tokenId: string): PodeNFTv2OGHolder { 5 | let PodeNFTv2DeveloperId = tokenId; 6 | let podeNFTv2Developer = PodeNFTv2OGHolder.load(PodeNFTv2DeveloperId); 7 | if (podeNFTv2Developer == null) { 8 | podeNFTv2Developer = new PodeNFTv2OGHolder(PodeNFTv2DeveloperId); 9 | podeNFTv2Developer.garments = new Array(); 10 | } 11 | podeNFTv2Developer.save() 12 | return podeNFTv2Developer as PodeNFTv2OGHolder 13 | } 14 | -------------------------------------------------------------------------------- /subgraph-matic/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "digitalax", 3 | "version": "0.1.0", 4 | "scripts": { 5 | "build": "graph build", 6 | "codegen": "graph codegen", 7 | "prep:matic": "mustache networks/matic.json subgraph.template.yaml > subgraph.yaml && yarn codegen", 8 | "prep:mumbai": "mustache networks/mumbai.json subgraph.template.mumbai.yaml > subgraph.yaml && yarn codegen", 9 | "create": "graph create digitalax/digitalaxmatic --node https://api.thegraph.com/deploy/", 10 | "create-local": "graph create blockrockettech/digitalax --node http://127.0.0.1:8020", 11 | "deploy:mumbai": "yarn prep:mumbai; graph deploy --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ digitalax/digitalaxmumbai", 12 | "deploy:matic": "yarn prep:mainnet; graph deploy --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ digitalax/digitalaxmatic", 13 | "deploy-local": "graph deploy blockrockettech/digitalax --ipfs http://localhost:5001 --node http://127.0.0.1:8020" 14 | }, 15 | "devDependencies": { 16 | "@graphprotocol/graph-cli": "^0.18.0", 17 | "@graphprotocol/graph-ts": "^0.18.0", 18 | "mustache": "^4.0.1" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /subgraph-matic/src/ArrayHelpers.ts: -------------------------------------------------------------------------------- 1 | export function isChildInList(childId: string, ids: Array): boolean { 2 | let totalIds = ids.length; 3 | for (let i = 0; i < totalIds; i++) { 4 | if (ids.pop() == childId) { 5 | return true; 6 | } 7 | } 8 | return false; 9 | } 10 | -------------------------------------------------------------------------------- /subgraph-matic/src/DigitalaxAccessControls.mapping.ts: -------------------------------------------------------------------------------- 1 | import { 2 | AdminRoleGranted, 3 | AdminRoleRemoved, 4 | MinterRoleGranted, 5 | MinterRoleRemoved, 6 | SmartContractRoleGranted, 7 | SmartContractRoleRemoved, 8 | VerifiedMinterRoleGranted, 9 | VerifiedMinterRoleRemoved, 10 | } from "../generated/DigitalaxAccessControls/DigitalaxAccessControls"; 11 | 12 | import {createAccessControlsHistory} from "./factory/DigitalaxAccessControls.factory"; 13 | 14 | 15 | export function handleAdminRoleGranted(event: AdminRoleGranted): void { 16 | createAccessControlsHistory(event, "AdminRoleGranted"); 17 | } 18 | 19 | export function handleAdminRoleRemoved(event: AdminRoleRemoved): void { 20 | createAccessControlsHistory(event, "AdminRoleRemoved"); 21 | } 22 | 23 | export function handleMinterRoleGranted(event: MinterRoleGranted): void { 24 | createAccessControlsHistory(event, "MinterRoleGranted"); 25 | } 26 | 27 | export function handleMinterRoleRemoved(event: MinterRoleRemoved): void { 28 | createAccessControlsHistory(event, "MinterRoleRemoved"); 29 | } 30 | 31 | export function handleSmartContractRoleGranted(event: SmartContractRoleGranted): void { 32 | createAccessControlsHistory(event, "SmartContractRoleGranted"); 33 | } 34 | 35 | export function handleSmartContractRoleRemoved(event: SmartContractRoleRemoved): void { 36 | createAccessControlsHistory(event, "SmartContractRoleRemoved"); 37 | } 38 | 39 | export function handleVerifiedMinterRoleGranted(event: VerifiedMinterRoleGranted): void { 40 | createAccessControlsHistory(event, "VerifiedMinterRoleGranted"); 41 | } 42 | 43 | export function handleVerifiedMinterRoleRemoved(event: VerifiedMinterRoleRemoved): void { 44 | createAccessControlsHistory(event, "VerifiedMinterRoleRemoved"); 45 | } 46 | -------------------------------------------------------------------------------- /subgraph-matic/src/DigitalaxGarmentCollection.mapping.ts: -------------------------------------------------------------------------------- 1 | import { log, ipfs, JSONValue, Value } from "@graphprotocol/graph-ts/index"; 2 | import { 3 | MintGarmentCollection, 4 | BurnGarmentCollection, 5 | DigitalaxGarmentCollection as DigitalaxGarmentCollectionContract 6 | } from "../generated/DigitalaxGarmentCollection/DigitalaxGarmentCollection"; 7 | 8 | import { 9 | DigitalaxGarmentCollection, 10 | DigitalaxGarment, 11 | } from "../generated/schema"; 12 | import {ZERO} from "./constants"; 13 | 14 | export function handleGarmentCollectionMinted(event: MintGarmentCollection): void { 15 | let contract = DigitalaxGarmentCollectionContract.bind(event.address); 16 | let collectionData = contract.getCollection(event.params.collectionId); 17 | let collection = new DigitalaxGarmentCollection(event.params.collectionId.toString()); 18 | 19 | let mintedGarments = new Array(); 20 | for(let i = 0; i < collectionData.value1.toI32(); i++) { 21 | let garmentToken = DigitalaxGarment.load(collectionData.value0[i].toString()); 22 | mintedGarments.push(garmentToken.id); 23 | } 24 | collection.garments = mintedGarments; 25 | collection.garmentAuctionID = event.params.auctionTokenId; 26 | collection.rarity = event.params.rarity; 27 | collection.valueSold = ZERO; 28 | collection.save(); 29 | } 30 | 31 | 32 | export function handleGarmentCollectionBurned(event: BurnGarmentCollection): void { 33 | let collection = DigitalaxGarmentCollection.load(event.params.collectionId.toString()); 34 | collection.garments = null; 35 | collection.garmentAuctionID = null; 36 | collection.rarity = null; 37 | collection.save(); 38 | } 39 | -------------------------------------------------------------------------------- /subgraph-matic/src/DigitalaxModelCollection.mapping.ts: -------------------------------------------------------------------------------- 1 | import { log, ipfs, JSONValue, Value } from "@graphprotocol/graph-ts/index"; 2 | import { 3 | MintGarmentCollection, 4 | BurnGarmentCollection, 5 | DigitalaxModelCollection as DigitalaxModelCollectionContract, 6 | } from "../generated/DigitalaxModelCollection/DigitalaxModelCollection"; 7 | 8 | import { DigitalaxModelCollection, DigitalaxModelNFT } from "../generated/schema"; 9 | import { ZERO } from "./constants"; 10 | 11 | export function handleGarmentCollectionMinted( 12 | event: MintGarmentCollection 13 | ): void { 14 | let contract = DigitalaxModelCollectionContract.bind(event.address); 15 | let collectionData = contract.getCollection(event.params.collectionId); 16 | let collection = new DigitalaxModelCollection( 17 | event.params.collectionId.toString() 18 | ); 19 | 20 | let mintedGarments = new Array(); 21 | for (let i = 0; i < collectionData.value1.toI32(); i++) { 22 | let garmentToken = DigitalaxModelNFT.load(collectionData.value0[i].toString()); 23 | mintedGarments.push(garmentToken.id); 24 | } 25 | collection.garments = mintedGarments; 26 | collection.garmentAuctionID = event.params.auctionTokenId; 27 | collection.rarity = event.params.rarity; 28 | collection.valueSold = ZERO; 29 | collection.save(); 30 | } 31 | 32 | export function handleGarmentCollectionBurned( 33 | event: BurnGarmentCollection 34 | ): void { 35 | let collection = DigitalaxModelCollection.load( 36 | event.params.collectionId.toString() 37 | ); 38 | collection.garments = null; 39 | collection.garmentAuctionID = null; 40 | collection.rarity = null; 41 | collection.save(); 42 | } 43 | -------------------------------------------------------------------------------- /subgraph-matic/src/DigitalaxMonaStaking.mapping.ts: -------------------------------------------------------------------------------- 1 | import { DigitalaxMonaStaking as DigitalaxMonaStakingContract, Staked, StakedLP, Unstaked, UnstakedLP } from "../generated/DigitalaxMonaStaking/DigitalaxMonaStaking"; 2 | import { loadOrCreateDigitalaxMonaStaking } from "./factory/DigitalaxMonaStaking.factory"; 3 | 4 | export function handleStaked(event: Staked): void { 5 | let monaStaking = loadOrCreateDigitalaxMonaStaking(); 6 | let contract = DigitalaxMonaStakingContract.bind(event.address); 7 | let staked = contract.try_stakedValueTotalForPool() 8 | if (!staked.reverted) { 9 | monaStaking.totalMonaStaked = staked.value; 10 | monaStaking.save(); 11 | } 12 | } 13 | 14 | export function handleUnstaked(event: Unstaked): void { 15 | let monaStaking = loadOrCreateDigitalaxMonaStaking(); 16 | let contract = DigitalaxMonaStakingContract.bind(event.address); 17 | let staked = contract.try_stakedValueTotalForPool() 18 | if (!staked.reverted) { 19 | monaStaking.totalMonaStaked = staked.value; 20 | monaStaking.save(); 21 | } 22 | } 23 | 24 | export function handleStakedLP(event: StakedLP): void { 25 | let monaStaking = loadOrCreateDigitalaxMonaStaking(); 26 | let contract = DigitalaxMonaStakingContract.bind(event.address); 27 | let staked = contract.try_stakedValueTotalForPool() 28 | if (!staked.reverted) { 29 | monaStaking.totalMonaStaked = staked.value; 30 | monaStaking.save(); 31 | } 32 | } 33 | 34 | export function handleUnstakedLP(event: UnstakedLP): void { 35 | let monaStaking = loadOrCreateDigitalaxMonaStaking(); 36 | let contract = DigitalaxMonaStakingContract.bind(event.address); 37 | let staked = contract.try_stakedValueTotalForPool() 38 | if (!staked.reverted) { 39 | monaStaking.totalMonaStaked = staked.value; 40 | monaStaking.save(); 41 | } 42 | } -------------------------------------------------------------------------------- /subgraph-matic/src/DigitalaxRewardsV2.mapping.ts: -------------------------------------------------------------------------------- 1 | import { store } from "@graphprotocol/graph-ts"; 2 | import { AddRewardTokens, RemoveRewardTokens } from "../generated/DigitalaxRewardsV2/DigitalaxRewardsV2"; 3 | import { ERC20 } from "../generated/DigitalaxRewardsV2/ERC20"; 4 | import { DigitalaxRewardV2Token } from "../generated/schema"; 5 | 6 | export function handleAddRewardTokens(event: AddRewardTokens): void { 7 | const tokens = event.params.rewardTokens; 8 | for (let i = 0; i < tokens.length; i += 1) { 9 | let rewardV2Token = DigitalaxRewardV2Token.load(tokens[i].toHexString()); 10 | if (!rewardV2Token) { 11 | rewardV2Token = new DigitalaxRewardV2Token(tokens[i].toHexString()); 12 | const contract = ERC20.bind(tokens[i]); 13 | rewardV2Token.name = contract.name(); 14 | rewardV2Token.symbol = contract.symbol(); 15 | rewardV2Token.save(); 16 | } 17 | } 18 | } 19 | 20 | export function handleRemoveRewardTokens(event: RemoveRewardTokens): void { 21 | const tokens = event.params.rewardTokens; 22 | for (let i = 0; i < tokens.length; i += 1) { 23 | let rewardV2Token = DigitalaxRewardV2Token.load(tokens[i].toHexString()); 24 | if (rewardV2Token) { 25 | store.remove('DigitalaxRewardV2Tokens', tokens[i].toHexString()); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /subgraph-matic/src/DigitalaxSubscriptionCollection.mapping.ts: -------------------------------------------------------------------------------- 1 | import { log, ipfs, JSONValue, Value } from "@graphprotocol/graph-ts/index"; 2 | import { 3 | MintSubscriptionCollection, 4 | BurnSubscriptionCollection, 5 | DigitalaxSubscriptionCollection as DigitalaxSubscriptionCollectionContract 6 | } from "../generated/DigitalaxSubscriptionCollection/DigitalaxSubscriptionCollection"; 7 | 8 | import { 9 | DigitalaxSubscriptionCollection, 10 | DigitalaxSubscription, 11 | } from "../generated/schema"; 12 | import {ZERO} from "./constants"; 13 | 14 | export function handleSubscriptionCollectionMinted(event: MintSubscriptionCollection): void { 15 | let contract = DigitalaxSubscriptionCollectionContract.bind(event.address); 16 | let collectionData = contract.getCollection(event.params.collectionId); 17 | let collection = new DigitalaxSubscriptionCollection(event.params.collectionId.toString()); 18 | 19 | let mintedGarments = new Array(); 20 | for(let i = 0; i < collectionData.value1.toI32(); i++) { 21 | let garmentToken = DigitalaxSubscription.load(collectionData.value0[i].toString()); 22 | mintedGarments.push(garmentToken.id); 23 | } 24 | collection.garments = mintedGarments; 25 | collection.rarity = event.params.rarity; 26 | collection.bundleID = event.params.collectionId; 27 | collection.valueSold = ZERO; 28 | collection.save(); 29 | } 30 | 31 | 32 | export function handleSubscriptionCollectionBurned(event: BurnSubscriptionCollection): void { 33 | let collection = DigitalaxSubscriptionCollection.load(event.params.collectionId.toString()); 34 | collection.garments = null; 35 | collection.rarity = null; 36 | collection.bundleID = null; 37 | collection.save(); 38 | } 39 | -------------------------------------------------------------------------------- /subgraph-matic/src/DripOracle.mapping.ts: -------------------------------------------------------------------------------- 1 | import { ProviderReportsPushed } from "../generated/DripOracle/DripOracle"; 2 | import { PayableTokenReport } from "../generated/schema"; 3 | 4 | export function handleProviderReportsPushed(event: ProviderReportsPushed): void { 5 | const tokens = event.params.payableTokens; 6 | const payloads = event.params.payloads; 7 | const timestamp = event.params.timestamp; 8 | 9 | for (let i = 0; i < tokens.length; i += 1) { 10 | const tokenReport = new PayableTokenReport(tokens[i].toHexString()); 11 | tokenReport.payload = payloads[i]; 12 | tokenReport.timestamp = timestamp; 13 | tokenReport.save(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /subgraph-matic/src/TypeConverterUtils.ts: -------------------------------------------------------------------------------- 1 | import {BigInt} from "@graphprotocol/graph-ts/index"; 2 | 3 | export function toBigInt(integer: i32): BigInt { 4 | return BigInt.fromI32(integer) 5 | } -------------------------------------------------------------------------------- /subgraph-matic/src/W3FStaking.mapping.ts: -------------------------------------------------------------------------------- 1 | import { 2 | DigitalaxMonaStaking as DigitalaxW3fStakingContract, 3 | Staked, 4 | StakedLP, 5 | Unstaked, 6 | UnstakedLP, 7 | } from '../generated/W3FStaking/DigitalaxMonaStaking'; 8 | import { loadOrCreateW3FStaking } from './factory/W3FStaking.factory'; 9 | 10 | export function handleStaked(event: Staked): void { 11 | let w3fStaking = loadOrCreateW3FStaking(); 12 | let contract = DigitalaxW3fStakingContract.bind(event.address); 13 | let staked = contract.try_stakedValueTotalForPool(); 14 | if (!staked.reverted) { 15 | w3fStaking.totalW3FStaked = staked.value; 16 | w3fStaking.save(); 17 | } 18 | } 19 | 20 | export function handleUnstaked(event: Unstaked): void { 21 | let w3fStaking = loadOrCreateW3FStaking(); 22 | let contract = DigitalaxW3fStakingContract.bind(event.address); 23 | let staked = contract.try_stakedValueTotalForPool(); 24 | if (!staked.reverted) { 25 | w3fStaking.totalW3FStaked = staked.value; 26 | w3fStaking.save(); 27 | } 28 | } 29 | 30 | export function handleStakedLP(event: StakedLP): void { 31 | let w3fStaking = loadOrCreateW3FStaking(); 32 | let contract = DigitalaxW3fStakingContract.bind(event.address); 33 | let staked = contract.try_stakedValueTotalForPool(); 34 | if (!staked.reverted) { 35 | w3fStaking.totalW3FStaked = staked.value; 36 | w3fStaking.save(); 37 | } 38 | } 39 | 40 | export function handleUnstakedLP(event: UnstakedLP): void { 41 | let w3fStaking = loadOrCreateW3FStaking(); 42 | let contract = DigitalaxW3fStakingContract.bind(event.address); 43 | let staked = contract.try_stakedValueTotalForPool(); 44 | if (!staked.reverted) { 45 | w3fStaking.totalW3FStaked = staked.value; 46 | w3fStaking.save(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /subgraph-matic/src/constants.ts: -------------------------------------------------------------------------------- 1 | import {BigDecimal, BigInt, Address, Bytes} from "@graphprotocol/graph-ts/index"; 2 | 3 | export const ZERO_ADDRESS = Address.fromString("0x0000000000000000000000000000000000000000") 4 | export const ZERO_BIG_DECIMAL = BigDecimal.fromString("0") 5 | export const ZERO = BigInt.fromI32(0) 6 | export const ONE = BigInt.fromI32(1) 7 | export const MAX_UINT_256 = BigInt.fromUnsignedBytes(Bytes.fromHexString("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff") as Bytes) 8 | 9 | export const ONE_ETH = new BigDecimal(BigInt.fromI32(1).times(BigInt.fromI32(10).pow(18))) 10 | export const SECONDS_IN_DAY = BigInt.fromI32(86400) 11 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/Day.factory.ts: -------------------------------------------------------------------------------- 1 | import { ethereum } from "@graphprotocol/graph-ts/index"; 2 | 3 | import { Day } from "../../generated/schema"; 4 | 5 | import { dayMonthYearFromEventTimestamp } from "../DateConverter"; 6 | import { ZERO } from "../constants"; 7 | 8 | export function loadOrCreateDay(date: string): Day | null { 9 | let dayEntity: Day | null = Day.load(date); 10 | 11 | if (dayEntity == null) { 12 | dayEntity = new Day(date); 13 | dayEntity.totalBidValue = ZERO; 14 | dayEntity.totalWithdrawalValue = ZERO; 15 | dayEntity.totalNetBidActivity = ZERO; 16 | dayEntity.totalMarketplaceVolumeInETH = ZERO; 17 | dayEntity.totalMarketplaceVolumeInMona = ZERO; 18 | dayEntity.save(); 19 | } 20 | 21 | return dayEntity; 22 | } 23 | 24 | export function loadDayFromEvent(event: ethereum.Event): Day | null { 25 | let dayMonthYear = dayMonthYearFromEventTimestamp(event); 26 | 27 | let month = dayMonthYear.month.toString(); 28 | let day = dayMonthYear.day.toString(); 29 | let paddedMonth = month.length == 1 ? "0".concat(month) : month; 30 | let paddedDay = day.length == 1 ? "0".concat(day) : day; 31 | 32 | let dayId = dayMonthYear.year 33 | .toString() 34 | .concat("-") 35 | .concat(paddedMonth) 36 | .concat("-") 37 | .concat(paddedDay); 38 | 39 | return loadOrCreateDay(dayId); 40 | } 41 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxAccessControls.factory.ts: -------------------------------------------------------------------------------- 1 | 2 | import { ethereum } from "@graphprotocol/graph-ts"; 3 | import { DigitalaxAccessControlsHistory } from "../../generated/schema"; 4 | 5 | export function createAccessControlsHistory(event: ethereum.Event, eventName: string): void { 6 | let entity = new DigitalaxAccessControlsHistory(event.logIndex.toString()); 7 | entity.transactionHash = event.transaction.hash; 8 | entity.eventName = eventName; 9 | entity.timestamp = event.block.timestamp; 10 | entity.beneficiary = event.parameters[0].value.toAddress(); 11 | entity.caller = event.parameters[1].value.toAddress(); 12 | entity.save(); 13 | } 14 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxBundleOwner.factory.ts: -------------------------------------------------------------------------------- 1 | import {BigInt, ethereum, Address} from "@graphprotocol/graph-ts/index"; 2 | import {ZERO} from "../constants"; 3 | 4 | import {DigitalaxBundle, DigitalaxBundleOwner} from "../../generated/schema"; 5 | import {DFBundle as DFBundleContract} from "../../generated/DFBundle/DFBundle"; 6 | 7 | export function loadOrCreateDigitalaxBundleOwner( 8 | event: ethereum.Event, 9 | parentTokenOwner: Address, 10 | childTokenId: BigInt 11 | ): DigitalaxBundleOwner { 12 | 13 | let childContract = DFBundleContract.bind(event.address); 14 | 15 | // {parent-token-id-holder}-{child-token-id} 16 | let childId = parentTokenOwner.toHexString() + '-' + childTokenId.toString(); 17 | 18 | let materialOwner = DigitalaxBundleOwner.load(childId); 19 | if (materialOwner == null) { 20 | materialOwner = new DigitalaxBundleOwner(childId); 21 | materialOwner.childId = childTokenId; 22 | materialOwner.owner = parentTokenOwner; 23 | materialOwner.contract = event.address; 24 | materialOwner.tokenUri = childContract.uri(childTokenId); 25 | materialOwner.amount = ZERO; 26 | materialOwner.token = DigitalaxBundle.load(childTokenId.toString()).id.toString(); 27 | } 28 | materialOwner.save(); 29 | 30 | return materialOwner as DigitalaxBundleOwner; 31 | } 32 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxChildOwner.factory.ts: -------------------------------------------------------------------------------- 1 | import {BigInt, ethereum, Address} from "@graphprotocol/graph-ts/index"; 2 | import {ZERO} from "../constants"; 3 | 4 | import {DigitalaxBundle, DigitalaxChildOwner, DigitalaxMaterial} from "../../generated/schema"; 5 | import {DigitalaxMaterials as DigitalaxMaterialsContract} from "../../generated/DigitalaxMaterials/DigitalaxMaterials"; 6 | 7 | export function loadOrCreateDigitalaxChildOwner( 8 | event: ethereum.Event, 9 | parentTokenOwner: Address, 10 | childTokenId: BigInt 11 | ): DigitalaxChildOwner { 12 | 13 | let childContract = DigitalaxMaterialsContract.bind(event.address); 14 | 15 | // {parent-token-id-holder}-{child-token-id} 16 | let childId = parentTokenOwner.toHexString() + '-' + childTokenId.toString(); 17 | 18 | let materialOwner = DigitalaxChildOwner.load(childId); 19 | if (materialOwner == null) { 20 | materialOwner = new DigitalaxChildOwner(childId); 21 | materialOwner.childId = childTokenId; 22 | materialOwner.owner = parentTokenOwner; 23 | materialOwner.contract = event.address; 24 | materialOwner.tokenUri = childContract.uri(childTokenId); 25 | materialOwner.amount = ZERO; 26 | materialOwner.token = DigitalaxMaterial.load(childTokenId.toString()).id.toString(); 27 | } 28 | materialOwner.save(); 29 | 30 | return materialOwner as DigitalaxChildOwner; 31 | } 32 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxChildV2Owner.factory.ts: -------------------------------------------------------------------------------- 1 | import {BigInt, ethereum, Address} from "@graphprotocol/graph-ts/index"; 2 | import {ZERO} from "../constants"; 3 | 4 | import {DigitalaxBundle, DigitalaxChildV2Owner, DigitalaxMaterial, DigitalaxMaterialV2} from "../../generated/schema"; 5 | import {DigitalaxMaterialsV2 as DigitalaxMaterialsV2Contract} from "../../generated/DigitalaxMaterialsV2/DigitalaxMaterialsV2"; 6 | 7 | export function loadOrCreateDigitalaxChildV2Owner( 8 | event: ethereum.Event, 9 | parentTokenOwner: Address, 10 | childTokenId: BigInt 11 | ): DigitalaxChildV2Owner { 12 | 13 | let childContract = DigitalaxMaterialsV2Contract.bind(event.address); 14 | 15 | // {parent-token-id-holder}-{child-token-id} 16 | let childId = parentTokenOwner.toHexString() + '-' + childTokenId.toString(); 17 | 18 | let materialOwner = DigitalaxChildV2Owner.load(childId); 19 | if (materialOwner == null) { 20 | materialOwner = new DigitalaxChildV2Owner(childId); 21 | materialOwner.childId = childTokenId; 22 | materialOwner.owner = parentTokenOwner; 23 | materialOwner.contract = event.address; 24 | materialOwner.tokenUri = childContract.uri(childTokenId); 25 | materialOwner.amount = ZERO; 26 | materialOwner.token = DigitalaxMaterialV2.load(childTokenId.toString()).id.toString(); 27 | } 28 | materialOwner.save(); 29 | 30 | return materialOwner as DigitalaxChildV2Owner; 31 | } 32 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxCollector.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxCollector} from "../../generated/schema"; 2 | import {Address} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateDigitalaxCollector(collector: Address): DigitalaxCollector { 5 | let digitalaxCollector: DigitalaxCollector | null = DigitalaxCollector.load(collector.toHexString()); 6 | if (digitalaxCollector == null) { 7 | digitalaxCollector = new DigitalaxCollector(collector.toHexString()) 8 | digitalaxCollector.parentsOwned = new Array(); 9 | digitalaxCollector.childrenOwned = new Array(); 10 | } 11 | digitalaxCollector.save() 12 | return digitalaxCollector as DigitalaxCollector; 13 | } 14 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxCollectorV2.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxCollectorV2} from "../../generated/schema"; 2 | import {Address} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateDigitalaxCollectorV2(collector: Address): DigitalaxCollectorV2 { 5 | let digitalaxCollector: DigitalaxCollectorV2 | null = DigitalaxCollectorV2.load(collector.toHexString()); 6 | if (digitalaxCollector == null) { 7 | digitalaxCollector = new DigitalaxCollectorV2(collector.toHexString()) 8 | digitalaxCollector.parentsOwned = new Array(); 9 | digitalaxCollector.childrenOwned = new Array(); 10 | } 11 | digitalaxCollector.save() 12 | return digitalaxCollector as DigitalaxCollectorV2; 13 | } 14 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxDesigner.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxDesigner} from "../../generated/schema"; 2 | import {Address} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateDigitalaxDesigner(address: Address): DigitalaxDesigner { 5 | let digitalaxDesigner: DigitalaxDesigner | null = DigitalaxDesigner.load(address.toHexString()); 6 | if (digitalaxDesigner == null) { 7 | digitalaxDesigner = new DigitalaxDesigner(address.toHexString()) 8 | digitalaxDesigner.name = ''; 9 | digitalaxDesigner.description = ''; 10 | digitalaxDesigner.image = ''; 11 | digitalaxDesigner.auctions = new Array(); 12 | digitalaxDesigner.collections = new Array(); 13 | } 14 | digitalaxDesigner.save() 15 | return digitalaxDesigner as DigitalaxDesigner; 16 | } 17 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxDeveloper.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxDeveloper} from "../../generated/schema"; 2 | import {Address} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateDigitalaxDeveloper(address: Address): DigitalaxDeveloper { 5 | let digitalaxDeveloper: DigitalaxDeveloper | null = DigitalaxDeveloper.load(address.toHexString()); 6 | if (digitalaxDeveloper == null) { 7 | digitalaxDeveloper = new DigitalaxDeveloper(address.toHexString()) 8 | digitalaxDeveloper.name = ''; 9 | digitalaxDeveloper.description = ''; 10 | digitalaxDeveloper.image = ''; 11 | digitalaxDeveloper.auctions = new Array(); 12 | digitalaxDeveloper.collections = new Array(); 13 | } 14 | digitalaxDeveloper.save() 15 | return digitalaxDeveloper as DigitalaxDeveloper; 16 | } 17 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxGarmentChild.factory.ts: -------------------------------------------------------------------------------- 1 | import {BigInt, ethereum, Address} from "@graphprotocol/graph-ts/index"; 2 | import {ZERO} from "../constants"; 3 | 4 | import {DigitalaxGarmentChild} from "../../generated/schema"; 5 | import {DigitalaxGarmentNFT as DigitalaxGarmentNFTContract} from "../../generated/DigitalaxGarmentNFT/DigitalaxGarmentNFT"; 6 | import {DigitalaxMaterials as DigitalaxMaterialsContract} from "../../generated/DigitalaxMaterials/DigitalaxMaterials"; 7 | 8 | export function loadOrCreateDigitalaxGarmentChild( 9 | event: ethereum.Event, 10 | parentTokenId: BigInt, 11 | childTokenId: BigInt 12 | ): DigitalaxGarmentChild { 13 | 14 | let contract = DigitalaxGarmentNFTContract.bind(event.address); 15 | 16 | let childContract = DigitalaxMaterialsContract.bind(contract.childContract()); 17 | 18 | // {parent-token-id}-{child-token-id} 19 | let childId = parentTokenId.toString() + '-' + childTokenId.toString(); 20 | 21 | let garmentChild = DigitalaxGarmentChild.load(childId); 22 | if (garmentChild == null) { 23 | garmentChild = new DigitalaxGarmentChild(childId); 24 | garmentChild.childId = childTokenId; 25 | garmentChild.parentId = parentTokenId; 26 | garmentChild.contract = contract.childContract(); 27 | garmentChild.tokenUri = childContract.uri(childTokenId); 28 | garmentChild.amount = ZERO; 29 | garmentChild.rarity = 'Common'; // This needs to be updated from the token uri or hardcoded 30 | } 31 | garmentChild.save(); 32 | 33 | return garmentChild as DigitalaxGarmentChild; 34 | } 35 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxGarmentDesigner.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxGarmentDesigner} from "../../generated/schema"; 2 | import {log} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateGarmentDesigner(tokenId: string): DigitalaxGarmentDesigner { 5 | // TODO: We need to re-architecture the current models. 6 | // We are mapping designer ids in force way now. 7 | let garmentDesignerId = tokenId; 8 | let garmentDesigner = DigitalaxGarmentDesigner.load(garmentDesignerId); 9 | if (garmentDesigner == null) { 10 | garmentDesigner = new DigitalaxGarmentDesigner(garmentDesignerId); 11 | garmentDesigner.garments = new Array(); 12 | garmentDesigner.listings = new Array(); 13 | } 14 | garmentDesigner.save() 15 | return garmentDesigner as DigitalaxGarmentDesigner 16 | } 17 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxGarmentNFTGlobalStats.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxGarmentNFTGlobalStat} from "../../generated/schema"; 2 | import {ZERO} from "../constants"; 3 | 4 | export function loadOrCreateGarmentNFTGlobalStats(): DigitalaxGarmentNFTGlobalStat | null { 5 | let globalStats = DigitalaxGarmentNFTGlobalStat.load('1'); 6 | 7 | if (globalStats == null) { 8 | globalStats = new DigitalaxGarmentNFTGlobalStat('1'); 9 | globalStats.totalSalesValue = ZERO; 10 | globalStats.totalActiveBidsValue = ZERO; 11 | globalStats.totalMarketplaceSalesInETH = ZERO; 12 | globalStats.totalMarketplaceSalesInMona = ZERO; 13 | globalStats.save(); 14 | } 15 | 16 | return globalStats; 17 | } 18 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxGarmentNFTV2GlobalStats.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxGarmentNFTV2GlobalStat} from "../../generated/schema"; 2 | import {ZERO} from "../constants"; 3 | 4 | export function loadOrCreateGarmentNFTV2GlobalStats(): DigitalaxGarmentNFTV2GlobalStat | null { 5 | let globalStats = DigitalaxGarmentNFTV2GlobalStat.load('1'); 6 | 7 | if (globalStats == null) { 8 | globalStats = new DigitalaxGarmentNFTV2GlobalStat('1'); 9 | globalStats.totalSalesValue = ZERO; 10 | globalStats.totalActiveBidsValue = ZERO; 11 | globalStats.totalMarketplaceSalesInETH = ZERO; 12 | globalStats.totalMarketplaceSalesInMona = ZERO; 13 | globalStats.monaPerEth = ZERO; 14 | globalStats.save(); 15 | } 16 | 17 | return globalStats; 18 | } 19 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxGarmentV2Child.factory.ts: -------------------------------------------------------------------------------- 1 | import {BigInt, ethereum, Address} from "@graphprotocol/graph-ts/index"; 2 | import {ZERO} from "../constants"; 3 | 4 | import {DigitalaxGarmentChildV2} from "../../generated/schema"; 5 | import {DigitalaxGarmentNFTv2 as DigitalaxGarmentNFTv2Contract} from "../../generated/DigitalaxGarmentNFTv2/DigitalaxGarmentNFTv2"; 6 | import {DigitalaxMaterialsV2 as DigitalaxMaterialsV2Contract} from "../../generated/DigitalaxMaterialsV2/DigitalaxMaterialsV2"; 7 | 8 | export function loadOrCreateDigitalaxGarmentChildV2( 9 | event: ethereum.Event, 10 | parentTokenId: BigInt, 11 | childTokenId: BigInt 12 | ): DigitalaxGarmentChildV2 { 13 | 14 | let contract = DigitalaxGarmentNFTv2Contract.bind(event.address); 15 | 16 | let childContract = DigitalaxMaterialsV2Contract.bind(contract.childContract()); 17 | 18 | // {parent-token-id}-{child-token-id} 19 | let childId = parentTokenId.toString() + '-' + childTokenId.toString(); 20 | 21 | let garmentChild = DigitalaxGarmentChildV2.load(childId); 22 | if (garmentChild == null) { 23 | garmentChild = new DigitalaxGarmentChildV2(childId); 24 | garmentChild.childId = childTokenId; 25 | garmentChild.parentId = parentTokenId; 26 | garmentChild.contract = contract.childContract(); 27 | garmentChild.tokenUri = childContract.uri(childTokenId); 28 | garmentChild.amount = ZERO; 29 | garmentChild.rarity = 'Common'; // This needs to be updated from the token uri or hardcoded 30 | } 31 | garmentChild.save(); 32 | 33 | return garmentChild as DigitalaxGarmentChildV2; 34 | } 35 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxGarmentV2Designer.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxGarmentV2Designer} from "../../generated/schema"; 2 | import {log} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateGarmentV2Designer(tokenId: string): DigitalaxGarmentV2Designer { 5 | // TODO: We need to re-architecture the current models. 6 | // We are mapping designer ids in force way now. 7 | let garmentDesignerId = tokenId; 8 | let garmentDesigner = DigitalaxGarmentV2Designer.load(garmentDesignerId); 9 | if (garmentDesigner == null) { 10 | garmentDesigner = new DigitalaxGarmentV2Designer(garmentDesignerId); 11 | garmentDesigner.garments = new Array(); 12 | garmentDesigner.listings = new Array(); 13 | } 14 | garmentDesigner.save() 15 | return garmentDesigner as DigitalaxGarmentV2Designer 16 | } 17 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxGenesisV2Collector.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxGenesisV2Collector} from "../../generated/schema"; 2 | import {Address} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateDigitalaxGenesisV2Collector(collector: Address): DigitalaxGenesisV2Collector { 5 | let digitalaxGenesisV2Collector: DigitalaxGenesisV2Collector | null = DigitalaxGenesisV2Collector.load(collector.toHexString()); 6 | if (digitalaxGenesisV2Collector == null) { 7 | digitalaxGenesisV2Collector = new DigitalaxGenesisV2Collector(collector.toHexString()) 8 | digitalaxGenesisV2Collector.parentsOwned = new Array(); 9 | } 10 | digitalaxGenesisV2Collector.save() 11 | return digitalaxGenesisV2Collector as DigitalaxGenesisV2Collector; 12 | } 13 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxGenesisV2OGHolder.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxGenesisV2OGHolder} from "../../generated/schema"; 2 | import {log} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateDigitalaxGenesisV2OGHolder(tokenId: string): DigitalaxGenesisV2OGHolder { 5 | let DigitalaxGenesisV2DeveloperId = tokenId; 6 | let digitalaxGenesisV2OGHolder = DigitalaxGenesisV2OGHolder.load(DigitalaxGenesisV2DeveloperId); 7 | if (digitalaxGenesisV2OGHolder == null) { 8 | digitalaxGenesisV2OGHolder = new DigitalaxGenesisV2OGHolder(DigitalaxGenesisV2DeveloperId); 9 | digitalaxGenesisV2OGHolder.garments = new Array(); 10 | } 11 | digitalaxGenesisV2OGHolder.save() 12 | return digitalaxGenesisV2OGHolder as DigitalaxGenesisV2OGHolder 13 | } 14 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxMarketplaceRevenue.factory.ts: -------------------------------------------------------------------------------- 1 | import { BigInt } from '@graphprotocol/graph-ts'; 2 | import { DigitalaxMonaMarketplaceRevenue } from '../../generated/schema'; 3 | import { ZERO } from '../constants'; 4 | 5 | export function loadOrCreateDigitalaxMarketplaceRevenue(): DigitalaxMonaMarketplaceRevenue | null { 6 | let marketplaceRevenue = DigitalaxMonaMarketplaceRevenue.load('1'); 7 | 8 | if (!marketplaceRevenue) { 9 | marketplaceRevenue = new DigitalaxMonaMarketplaceRevenue('1'); 10 | marketplaceRevenue.week = ZERO; 11 | marketplaceRevenue.totalMonaSharing = ZERO; 12 | marketplaceRevenue.weeklyMonaSharing = ZERO; 13 | marketplaceRevenue.save(); 14 | } 15 | 16 | return marketplaceRevenue; 17 | } 18 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxMarketplaceV3PurchaseHistory.factory.ts: -------------------------------------------------------------------------------- 1 | import { DigitalaxMarketplaceV3PurchaseHistory } from "../../generated/schema"; 2 | import { Address, Bytes } from "@graphprotocol/graph-ts/index"; 3 | import { ZERO, ZERO_ADDRESS } from "../constants"; 4 | 5 | export function loadOrCreateDigitalaxMarketplaceV3PurchaseHistory( 6 | bundleId: string 7 | ): DigitalaxMarketplaceV3PurchaseHistory { 8 | let purchaseHistory: DigitalaxMarketplaceV3PurchaseHistory | null = DigitalaxMarketplaceV3PurchaseHistory.load( 9 | bundleId 10 | ); 11 | if (purchaseHistory == null) { 12 | purchaseHistory = new DigitalaxMarketplaceV3PurchaseHistory(bundleId); 13 | purchaseHistory.eventName = ""; 14 | purchaseHistory.timestamp = ZERO; 15 | purchaseHistory.token = ''; 16 | purchaseHistory.transactionHash = ZERO_ADDRESS; 17 | purchaseHistory.token = ''; 18 | purchaseHistory.value = ZERO; 19 | purchaseHistory.buyer = ZERO_ADDRESS; 20 | purchaseHistory.paymentTokenTransferredAmount = ZERO; 21 | purchaseHistory.garmentCollectionId = ZERO; 22 | purchaseHistory.rarity = ''; 23 | purchaseHistory.usdEthExchange = ZERO; 24 | purchaseHistory.paymentToken = ZERO_ADDRESS; 25 | purchaseHistory.platformFee = ZERO; 26 | } 27 | purchaseHistory.save(); 28 | return purchaseHistory as DigitalaxMarketplaceV3PurchaseHistory; 29 | } 30 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxMarketplaceW3fRevenue.factory.ts: -------------------------------------------------------------------------------- 1 | import { BigInt } from '@graphprotocol/graph-ts'; 2 | import { W3FStakingMarketplaceRevenue } from '../../generated/schema'; 3 | import { ZERO } from '../constants'; 4 | 5 | export function loadOrCreateDigitalaxW3fMarketplaceRevenue(): W3FStakingMarketplaceRevenue | null { 6 | let marketplaceRevenue = W3FStakingMarketplaceRevenue.load('1'); 7 | 8 | if (!marketplaceRevenue) { 9 | marketplaceRevenue = new W3FStakingMarketplaceRevenue('1'); 10 | marketplaceRevenue.week = ZERO; 11 | marketplaceRevenue.totalW3FSharing = ZERO; 12 | marketplaceRevenue.weeklyW3FSharing = ZERO; 13 | marketplaceRevenue.save(); 14 | } 15 | 16 | return marketplaceRevenue; 17 | } 18 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxModel.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxModel} from "../../generated/schema"; 2 | import {Address} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateDigitalaxModel(address: Address): DigitalaxModel { 5 | let digitalaxModel: DigitalaxModel | null = DigitalaxModel.load(address.toHexString()); 6 | if (digitalaxModel == null) { 7 | digitalaxModel = new DigitalaxModel(address.toHexString()) 8 | digitalaxModel.name = ''; 9 | digitalaxModel.description = ''; 10 | digitalaxModel.image = ''; 11 | digitalaxModel.collections = new Array(); 12 | } 13 | digitalaxModel.save() 14 | return digitalaxModel as DigitalaxModel; 15 | } 16 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxModelChild.factory.ts: -------------------------------------------------------------------------------- 1 | import { BigInt, ethereum, Address } from "@graphprotocol/graph-ts/index"; 2 | import { ZERO } from "../constants"; 3 | 4 | import { DigitalaxGarmentModelChild } from "../../generated/schema"; 5 | import { DigitalaxModelNFT as DigitalaxModelContract } from "../../generated/DigitalaxModelNFT/DigitalaxModelNFT"; 6 | import { DigitalaxMaterialsV2 as DigitalaxMaterialsV2Contract } from "../../generated/DigitalaxMaterialsV2/DigitalaxMaterialsV2"; 7 | 8 | export function loadOrCreateDigitalaxModelChild( 9 | event: ethereum.Event, 10 | parentTokenId: BigInt, 11 | childTokenId: BigInt 12 | ): DigitalaxGarmentModelChild { 13 | let contract = DigitalaxModelContract.bind(event.address); 14 | 15 | let childContract = DigitalaxMaterialsV2Contract.bind( 16 | contract.childContract() 17 | ); 18 | 19 | // {parent-token-id}-{child-token-id} 20 | let childId = parentTokenId.toString() + "-" + childTokenId.toString(); 21 | 22 | let garmentChild = DigitalaxGarmentModelChild.load(childId); 23 | if (garmentChild == null) { 24 | garmentChild = new DigitalaxGarmentModelChild(childId); 25 | garmentChild.childId = childTokenId; 26 | garmentChild.parentId = parentTokenId; 27 | garmentChild.contract = contract.childContract(); 28 | garmentChild.tokenUri = childContract.uri(childTokenId); 29 | garmentChild.amount = ZERO; 30 | garmentChild.rarity = "Common"; // This needs to be updated from the token uri or hardcoded 31 | } 32 | garmentChild.save(); 33 | 34 | return garmentChild as DigitalaxGarmentModelChild; 35 | } 36 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxModelCollector.factory.ts: -------------------------------------------------------------------------------- 1 | import { DigitalaxModelCollector } from "../../generated/schema"; 2 | import { Address } from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateDigitalaxModelCollector( 5 | collector: Address 6 | ): DigitalaxModelCollector { 7 | let digitalaxCollector: DigitalaxModelCollector | null = DigitalaxModelCollector.load( 8 | collector.toHexString() 9 | ); 10 | if (digitalaxCollector == null) { 11 | digitalaxCollector = new DigitalaxModelCollector(collector.toHexString()); 12 | digitalaxCollector.parentsOwned = new Array(); 13 | digitalaxCollector.childrenOwned = new Array(); 14 | } 15 | digitalaxCollector.save(); 16 | return digitalaxCollector as DigitalaxModelCollector; 17 | } 18 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxModelDesigner.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxModelDesigner} from "../../generated/schema"; 2 | import {Address} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateDigitalaxModelDesigner(address: Address): DigitalaxModelDesigner { 5 | let digitalaxDesigner: DigitalaxModelDesigner | null = DigitalaxModelDesigner.load(address.toHexString()); 6 | if (digitalaxDesigner == null) { 7 | digitalaxDesigner = new DigitalaxModelDesigner(address.toHexString()) 8 | digitalaxDesigner.name = ''; 9 | digitalaxDesigner.description = ''; 10 | digitalaxDesigner.image = ''; 11 | digitalaxDesigner.collections = new Array(); 12 | } 13 | digitalaxDesigner.save() 14 | return digitalaxDesigner as DigitalaxModelDesigner; 15 | } 16 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxModelGlobalStats.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxModelGlobalStat} from "../../generated/schema"; 2 | import {ZERO} from "../constants"; 3 | 4 | export function loadOrCreateModelGlobalStats(): DigitalaxModelGlobalStat | null { 5 | let globalStats = DigitalaxModelGlobalStat.load('1'); 6 | 7 | if (globalStats == null) { 8 | globalStats = new DigitalaxModelGlobalStat('1'); 9 | globalStats.totalSalesValue = ZERO; 10 | globalStats.totalActiveBidsValue = ZERO; 11 | globalStats.totalMarketplaceSalesInETH = ZERO; 12 | globalStats.totalMarketplaceSalesInMona = ZERO; 13 | globalStats.monaPerEth = ZERO; 14 | globalStats.save(); 15 | } 16 | 17 | return globalStats; 18 | } 19 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxModelNFTDesigner.factory.ts: -------------------------------------------------------------------------------- 1 | import { DigitalaxModelNFTDesigner } from "../../generated/schema"; 2 | import { log } from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateModelNFTDesigner( 5 | tokenId: string 6 | ): DigitalaxModelNFTDesigner { 7 | // TODO: We need to re-architecture the current models. 8 | // We are mapping designer ids in force way now. 9 | let garmentDesignerId = tokenId; 10 | let garmentDesigner = DigitalaxModelNFTDesigner.load(garmentDesignerId); 11 | if (garmentDesigner == null) { 12 | garmentDesigner = new DigitalaxModelNFTDesigner(garmentDesignerId); 13 | garmentDesigner.garments = new Array(); 14 | } 15 | garmentDesigner.save(); 16 | return garmentDesigner as DigitalaxModelNFTDesigner; 17 | } 18 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxModelNFTModel.factory.ts: -------------------------------------------------------------------------------- 1 | import { DigitalaxModelNFTModel } from "../../generated/schema"; 2 | import { log } from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateModelNFTModel(tokenId: string): DigitalaxModelNFTModel { 5 | // TODO: We need to re-architecture the current models. 6 | // We are mapping designer ids in force way now. 7 | let garmentModelId = tokenId; 8 | let garmentModel = DigitalaxModelNFTModel.load(garmentModelId); 9 | if (garmentModel == null) { 10 | garmentModel = new DigitalaxModelNFTModel(garmentModelId); 11 | garmentModel.garments = new Array(); 12 | } 13 | garmentModel.save(); 14 | return garmentModel as DigitalaxModelNFTModel; 15 | } 16 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxMonaStaking.factory.ts: -------------------------------------------------------------------------------- 1 | import { DigitalaxMonaStaking } from "../../generated/schema"; 2 | import { ZERO } from "../constants"; 3 | 4 | export function loadOrCreateDigitalaxMonaStaking(): DigitalaxMonaStaking | null { 5 | let monaStaking = DigitalaxMonaStaking.load('1'); 6 | 7 | if (!monaStaking) { 8 | monaStaking = new DigitalaxMonaStaking('1'); 9 | monaStaking.totalMonaStaked = ZERO; 10 | monaStaking.save(); 11 | } 12 | 13 | return monaStaking; 14 | } -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxSubscriptionChild.factory.ts: -------------------------------------------------------------------------------- 1 | import {BigInt, ethereum, Address} from "@graphprotocol/graph-ts/index"; 2 | import {ZERO} from "../constants"; 3 | 4 | import {DigitalaxSubscriptionChild} from "../../generated/schema"; 5 | import {DigitalaxSubscriptionNFT as DigitalaxSubscriptionNFTContract} from "../../generated/DigitalaxSubscriptionNFT/DigitalaxSubscriptionNFT"; 6 | import {DFBundle as DFBundleContract} from "../../generated/DFBundle/DFBundle"; 7 | 8 | export function loadOrCreateDigitalaxSubscriptionChild( 9 | event: ethereum.Event, 10 | parentTokenId: BigInt, 11 | childTokenId: BigInt 12 | ): DigitalaxSubscriptionChild { 13 | 14 | let contract = DigitalaxSubscriptionNFTContract.bind(event.address); 15 | 16 | let childContract = DFBundleContract.bind(contract.childContract()); 17 | 18 | // {parent-token-id}-{child-token-id} 19 | let childId = parentTokenId.toString() + '-' + childTokenId.toString(); 20 | 21 | let garmentChild = DigitalaxSubscriptionChild.load(childId); 22 | if (garmentChild == null) { 23 | garmentChild = new DigitalaxSubscriptionChild(childId); 24 | garmentChild.childId = childTokenId; 25 | garmentChild.parentId = parentTokenId; 26 | garmentChild.contract = contract.childContract(); 27 | garmentChild.tokenUri = childContract.uri(childTokenId); 28 | garmentChild.amount = ZERO; 29 | garmentChild.rarity = 'Common'; // This needs to be updated from the token uri or hardcoded 30 | } 31 | garmentChild.save(); 32 | 33 | return garmentChild as DigitalaxSubscriptionChild; 34 | } 35 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxSubscriptionCollector.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxSubscriptionCollector} from "../../generated/schema"; 2 | import {Address} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateDigitalaxSubscriptionCollector(collector: Address): DigitalaxSubscriptionCollector { 5 | let digitalaxCollector: DigitalaxSubscriptionCollector | null = DigitalaxSubscriptionCollector.load(collector.toHexString()); 6 | if (digitalaxCollector == null) { 7 | digitalaxCollector = new DigitalaxSubscriptionCollector(collector.toHexString()) 8 | digitalaxCollector.parentsOwned = new Array(); 9 | digitalaxCollector.childrenOwned = new Array(); 10 | } 11 | digitalaxCollector.save() 12 | return digitalaxCollector as DigitalaxSubscriptionCollector; 13 | } 14 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxSubscriptionDesigner.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxSubscriptionDesigner} from "../../generated/schema"; 2 | import {log} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateSubscriptionDesigner(tokenId: string): DigitalaxSubscriptionDesigner { 5 | // TODO: We need to re-architecture the current models. 6 | // We are mapping designer ids in force way now. 7 | let subscriptionDesignerId = tokenId; 8 | let subscriptionDesigner = DigitalaxSubscriptionDesigner.load(subscriptionDesignerId); 9 | if (subscriptionDesigner == null) { 10 | subscriptionDesigner = new DigitalaxSubscriptionDesigner(subscriptionDesignerId); 11 | subscriptionDesigner.garments = new Array(); 12 | } 13 | subscriptionDesigner.save() 14 | return subscriptionDesigner as DigitalaxSubscriptionDesigner 15 | } 16 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DigitalaxSubscriptionNFTGlobalStats.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxSubscriptionNFTGlobalStat} from "../../generated/schema"; 2 | import {ZERO} from "../constants"; 3 | 4 | export function loadOrCreateSubscriptionNFTGlobalStats(): DigitalaxSubscriptionNFTGlobalStat | null { 5 | let globalStats = DigitalaxSubscriptionNFTGlobalStat.load('1'); 6 | 7 | if (globalStats == null) { 8 | globalStats = new DigitalaxSubscriptionNFTGlobalStat('1'); 9 | globalStats.totalSalesValue = ZERO; 10 | globalStats.totalMarketplaceSalesInMona = ZERO; 11 | globalStats.save(); 12 | } 13 | 14 | return globalStats; 15 | } 16 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DripDay.factory.ts: -------------------------------------------------------------------------------- 1 | import { ethereum } from "@graphprotocol/graph-ts/index"; 2 | 3 | import { DripDay } from "../../generated/schema"; 4 | 5 | import { dayMonthYearFromEventTimestamp } from "../DateConverter"; 6 | import { ZERO } from "../constants"; 7 | 8 | export function loadOrCreateDay(date: string): DripDay | null { 9 | let dayEntity: DripDay | null = DripDay.load(date); 10 | 11 | if (dayEntity == null) { 12 | dayEntity = new DripDay(date); 13 | dayEntity.totalMarketplaceVolumeInUSD = ZERO; 14 | dayEntity.save(); 15 | } 16 | 17 | return dayEntity; 18 | } 19 | 20 | export function loadDayFromEvent(event: ethereum.Event): DripDay | null { 21 | let dayMonthYear = dayMonthYearFromEventTimestamp(event); 22 | 23 | let month = dayMonthYear.month.toString(); 24 | let day = dayMonthYear.day.toString(); 25 | let paddedMonth = month.length == 1 ? "0".concat(month) : month; 26 | let paddedDay = day.length == 1 ? "0".concat(day) : day; 27 | 28 | let dayId = dayMonthYear.year 29 | .toString() 30 | .concat("-") 31 | .concat(paddedMonth) 32 | .concat("-") 33 | .concat(paddedDay); 34 | 35 | return loadOrCreateDay(dayId); 36 | } 37 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/DripGlobalStats.factory.ts: -------------------------------------------------------------------------------- 1 | import {DripGlobalStat} from "../../generated/schema"; 2 | import {ZERO} from "../constants"; 3 | 4 | export function loadOrCreateDripGlobalStats(): DripGlobalStat | null { 5 | let globalStats = DripGlobalStat.load('1'); 6 | 7 | if (globalStats == null) { 8 | globalStats = new DripGlobalStat('1'); 9 | globalStats.totalMarketplaceSalesInUSD = ZERO; 10 | globalStats.usdETHConversion = ZERO; 11 | globalStats.save(); 12 | } 13 | 14 | return globalStats; 15 | } 16 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/GenesisContributor.factory.ts: -------------------------------------------------------------------------------- 1 | import {GenesisContributor} from "../../generated/schema"; 2 | import {Address, BigInt, ethereum} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateGenesisContributor(buyer: Address, eventBlock: ethereum.Block, totalContributionInWei: BigInt): GenesisContributor { 5 | let contributor: GenesisContributor | null = GenesisContributor.load(buyer.toHexString()); 6 | if (contributor == null) { 7 | contributor = new GenesisContributor(buyer.toHexString()) 8 | contributor.contributor = buyer 9 | contributor.firstContributedTimestamp = eventBlock.timestamp 10 | contributor.totalContributionInWei = totalContributionInWei 11 | contributor.lastContributedTimestamp = eventBlock.timestamp 12 | } 13 | contributor.save() 14 | return contributor as GenesisContributor; 15 | } 16 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/PatronDay.factory.ts: -------------------------------------------------------------------------------- 1 | import { ethereum } from "@graphprotocol/graph-ts/index"; 2 | 3 | import { PatronDay } from "../../generated/schema"; 4 | 5 | import { dayMonthYearFromEventTimestamp } from "../DateConverter"; 6 | import { ZERO } from "../constants"; 7 | 8 | export function loadOrCreateDay(date: string): PatronDay | null { 9 | let dayEntity: PatronDay | null = PatronDay.load(date); 10 | 11 | if (dayEntity == null) { 12 | dayEntity = new PatronDay(date); 13 | dayEntity.totalMarketplaceVolumeInUSD = ZERO; 14 | dayEntity.save(); 15 | } 16 | 17 | return dayEntity; 18 | } 19 | 20 | export function loadDayFromEvent(event: ethereum.Event): PatronDay | null { 21 | let dayMonthYear = dayMonthYearFromEventTimestamp(event); 22 | 23 | let month = dayMonthYear.month.toString(); 24 | let day = dayMonthYear.day.toString(); 25 | let paddedMonth = month.length == 1 ? "0".concat(month) : month; 26 | let paddedDay = day.length == 1 ? "0".concat(day) : day; 27 | 28 | let dayId = dayMonthYear.year 29 | .toString() 30 | .concat("-") 31 | .concat(paddedMonth) 32 | .concat("-") 33 | .concat(paddedDay); 34 | 35 | return loadOrCreateDay(dayId); 36 | } 37 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/PatronGlobalStats.factory.ts: -------------------------------------------------------------------------------- 1 | import {PatronGlobalStat} from "../../generated/schema"; 2 | import {ZERO} from "../constants"; 3 | 4 | export function loadOrCreatePatronGlobalStats(): PatronGlobalStat | null { 5 | let globalStats = PatronGlobalStat.load('1'); 6 | 7 | if (globalStats == null) { 8 | globalStats = new PatronGlobalStat('1'); 9 | globalStats.totalMarketplaceSalesInUSD = ZERO; 10 | globalStats.usdETHConversion = ZERO; 11 | globalStats.save(); 12 | } 13 | 14 | return globalStats; 15 | } 16 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/SubscriptionDay.factory.ts: -------------------------------------------------------------------------------- 1 | import { ethereum } from "@graphprotocol/graph-ts/index"; 2 | 3 | import { SubscriptionDay } from "../../generated/schema"; 4 | 5 | import { dayMonthYearFromEventTimestamp } from "../DateConverter"; 6 | import { ZERO } from "../constants"; 7 | 8 | export function loadOrCreateDay(date: string): SubscriptionDay | null { 9 | let dayEntity: SubscriptionDay | null = SubscriptionDay.load(date); 10 | 11 | if (dayEntity == null) { 12 | dayEntity = new SubscriptionDay(date); 13 | dayEntity.totalMarketplaceVolumeInMona = ZERO; 14 | dayEntity.save(); 15 | } 16 | 17 | return dayEntity; 18 | } 19 | 20 | export function loadDayFromEvent( 21 | event: ethereum.Event 22 | ): SubscriptionDay | null { 23 | let dayMonthYear = dayMonthYearFromEventTimestamp(event); 24 | 25 | let month = dayMonthYear.month.toString(); 26 | let day = dayMonthYear.day.toString(); 27 | let paddedMonth = month.length == 1 ? "0".concat(month) : month; 28 | let paddedDay = day.length == 1 ? "0".concat(day) : day; 29 | 30 | let dayId = dayMonthYear.year 31 | .toString() 32 | .concat("-") 33 | .concat(paddedMonth) 34 | .concat("-") 35 | .concat(paddedDay); 36 | 37 | return loadOrCreateDay(dayId); 38 | } 39 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/W3FRevenue.factory.ts: -------------------------------------------------------------------------------- 1 | import { BigInt } from "@graphprotocol/graph-ts"; 2 | import { W3FStakingMarketplaceRevenue } from "../../generated/schema"; 3 | import { ZERO } from "../constants"; 4 | 5 | export function loadOrCreateDigitalaxMarketplaceRevenue(): W3FStakingMarketplaceRevenue | null { 6 | let marketplaceRevenue = W3FStakingMarketplaceRevenue.load('1'); 7 | 8 | if (!marketplaceRevenue) { 9 | marketplaceRevenue = new W3FStakingMarketplaceRevenue('1'); 10 | marketplaceRevenue.week = ZERO; 11 | marketplaceRevenue.totalW3FSharing = ZERO; 12 | marketplaceRevenue.weeklyW3FSharing = ZERO; 13 | marketplaceRevenue.bonusWeeklyW3FSharing = ZERO; 14 | marketplaceRevenue.totalBonusW3FSharing = ZERO; 15 | marketplaceRevenue.save(); 16 | } 17 | 18 | return marketplaceRevenue; 19 | } 20 | -------------------------------------------------------------------------------- /subgraph-matic/src/factory/W3FStaking.factory.ts: -------------------------------------------------------------------------------- 1 | import { W3FStaking } from "../../generated/schema"; 2 | import { ZERO } from "../constants"; 3 | 4 | export function loadOrCreateW3FStaking(): W3FStaking | null { 5 | let w3fStaking = W3FStaking.load('1'); 6 | 7 | if (!w3fStaking) { 8 | w3fStaking = new W3FStaking('1'); 9 | w3fStaking.totalW3FStaked = ZERO; 10 | w3fStaking.save(); 11 | } 12 | 13 | return w3fStaking; 14 | } 15 | -------------------------------------------------------------------------------- /subgraph/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | -------------------------------------------------------------------------------- /subgraph/README.md: -------------------------------------------------------------------------------- 1 | # Auth with subgraph 2 | 3 | `graph auth https://api.thegraph.com/deploy/ ` 4 | -------------------------------------------------------------------------------- /subgraph/networks/goerli.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "goerli", 3 | "DigitalaxGarmentNFTAddress": "0xc9c3704a65fe2d4f1f94a02480b25dbfa5764332", 4 | "DigitalaxGarmentNFTStartBlock": 1200000, 5 | "DigitalaxMaterialsAddress": "0x5a328200f26c94c8411f560c7053019674cdd2ef", 6 | "DigitalaxMaterialsStartBlock": 1200000, 7 | "DigitalaxAccessControlsAddress": "0x1dd28ce255080092327915e13dd61979abd220de", 8 | "DigitalaxAccessControlsStartBlock": 1200000 9 | } 10 | -------------------------------------------------------------------------------- /subgraph/networks/mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "mainnet", 3 | "DigitalaxGenesisNFTAddress": "0x89505d2a27b7e8ac56252081d721ecd525e4241e", 4 | "DigitalaxGenesisNFTStartBlock": 11157574, 5 | "DigitalaxGarmentNFTAddress": "0x0b509f4b044f713a91bb50535914f7ad160532fe", 6 | "DigitalaxGarmentNFTStartBlock": 11320285, 7 | "DigitalaxMaterialsAddress": "0xe6822e8b4d91b85f9ca00cca79bf92bab14bc221", 8 | "DigitalaxMaterialsStartBlock": 11320271, 9 | "DigitalaxAuctionAddress": "0xd84E216a4804A5e6BAa4f936838E4a3d1A0D3C53", 10 | "DigitalaxAuctionStartBlock": 11320386, 11 | "DigitalaxAccessControlsAddress": "0x980bC991b52240C6271F4fd607638e984c888621", 12 | "DigitalaxAccessControlsStartBlock": 11637101, 13 | "DigitalaxGarmentCollectionAddress": "0x569Ff451D7631917151b8C5b3F669156fdbeD251", 14 | "DigitalaxGarmentCollectionStartBlock": 11660023, 15 | "DigitalaxMarketplaceAddress": "0xCC48554581c17c2837C13B1685E0e784fADC1c3b", 16 | "DigitalaxMarketplaceStartBlock": 11660955, 17 | "DigitalaxPodePortalAddress": "0x87c3C6B9C917B1732f13d36d6938E4f8802f7c7E", 18 | "DigitalaxPodePortalStartBlock": 11740618, 19 | "DigitalaxIndexAddress": "0x93401DB6e0E17078f785019878063ce5baBA9d46", 20 | "DigitalaxIndexStartBlock": 11740618, 21 | "DigitalaxGenesisStakingAddress": "0xa202D5B0892f2981bA86C981884cebA49B8AE096", 22 | "DigitalaxGenesisStakingStartBlock": 11353711, 23 | "DigitalaxNFTStakingAddress": "0xc802912c379a1EF995a23c07346bD8373049fa39", 24 | "DigitalaxNFTStakingStartBlock": 11413300, 25 | "DigitalaxLookNFTAddress": "0xc97f4244839c13c6df4258228c60488fa05c8528", 26 | "DigitalaxLookNFTStartBlock": 13239600 27 | } 28 | -------------------------------------------------------------------------------- /subgraph/networks/rinkeby.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "rinkeby", 3 | "DigitalaxGenesisNFTAddress": "0x064A6151F99ba2610f2D6600Dcb2b2Ed3a276356", 4 | "DigitalaxGenesisNFTStartBlock": 7459382, 5 | "DigitalaxGarmentNFTAddress": "0xbA1b4438Eb1Ff572d467b820330AabeE9A241947", 6 | "DigitalaxGarmentNFTStartBlock": 7576230, 7 | "DigitalaxMaterialsAddress": "0x80E71735A8234Fb761B9Db16519D319B8628d6F4", 8 | "DigitalaxMaterialsStartBlock": 7576227, 9 | "DigitalaxAuctionAddress": "0x43cE588290F6990dA40bFBe837B753faF41a58A4", 10 | "DigitalaxAuctionStartBlock": 7895008, 11 | "DigitalaxAccessControlsAddress": "0xe6fff33bdef5e1894d898b24b366fbec6d74c073", 12 | "DigitalaxAccessControlsStartBlock": 7807928, 13 | "DigitalaxGarmentCollectionAddress": "0x9909E943255741356Aa2004C6f13CcfF56b96BE8", 14 | "DigitalaxGarmentCollectionStartBlock": 7871549, 15 | "DigitalaxMarketplaceAddress": "0xAcA4eaf530085B062dB530634DA637e266a823C9", 16 | "DigitalaxMarketplaceStartBlock": 7893813, 17 | "DigitalaxPodePortalAddress": "0xe69ad51F33Be2f216b74BaEfF1CEE84DB5E8E6D1", 18 | "DigitalaxPodePortalStartBlock": 7963905, 19 | "DigitalaxIndexAddress": "0x93401DB6e0E17078f785019878063ce5baBA9d46", 20 | "DigitalaxIndexStartBlock": 8177798 21 | } 22 | -------------------------------------------------------------------------------- /subgraph/networks/ropsten.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "ropsten", 3 | "DigitalaxGenesisNFTAddress": "0x42321F5443480cbAA0FE76187f73Bd06Db125111", 4 | "DigitalaxGenesisNFTStartBlock": 8951857 5 | } 6 | -------------------------------------------------------------------------------- /subgraph/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "digitalax", 3 | "version": "0.1.0", 4 | "scripts": { 5 | "build": "graph build", 6 | "codegen": "graph codegen", 7 | "prep:mainnet": "mustache networks/mainnet.json subgraph.template.yaml > subgraph.yaml && yarn codegen", 8 | "prep:rinkeby": "mustache networks/rinkeby.json subgraph.template.yaml > subgraph.yaml && yarn codegen", 9 | "prep:ropsten": "mustache networks/ropsten.json subgraph.template.yaml > subgraph.yaml && yarn codegen", 10 | "prep:goerli": "mustache networks/goerli.json subgraph.template.yaml > subgraph.yaml && yarn codegen", 11 | "create": "graph create digitalax/digitalaxropsten --node https://api.thegraph.com/deploy/", 12 | "create-local": "graph create blockrockettech/digitalax --node http://127.0.0.1:8020", 13 | "deploy:testnet": "yarn prep:rinkeby; graph deploy digitalax/digitalaxropsten --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/", 14 | "deploy:mainnet": "yarn prep:mainnet; graph deploy digitalax/digitalax --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/", 15 | "deploy:goerli": "graph deploy digitalax/digitalaxgoerli --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/", 16 | "deploy-local": "graph deploy blockrockettech/digitalax --ipfs http://localhost:5001 --node http://127.0.0.1:8020" 17 | }, 18 | "devDependencies": { 19 | "@graphprotocol/graph-cli": "^0.18.0", 20 | "@graphprotocol/graph-ts": "^0.18.0", 21 | "mustache": "^4.0.1" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /subgraph/src/ArrayHelpers.ts: -------------------------------------------------------------------------------- 1 | export function isChildInList(childId: string, ids: Array): boolean { 2 | let totalIds = ids.length; 3 | for (let i = 0; i < totalIds; i++) { 4 | if (ids.pop() === childId) { 5 | return true; 6 | } 7 | } 8 | return false; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /subgraph/src/DigitalaxAccessControls.mapping.ts: -------------------------------------------------------------------------------- 1 | import { 2 | AdminRoleGranted, 3 | AdminRoleRemoved, 4 | MinterRoleGranted, 5 | MinterRoleRemoved, 6 | SmartContractRoleGranted, 7 | SmartContractRoleRemoved, 8 | VerifiedMinterRoleGranted, 9 | VerifiedMinterRoleRemoved, 10 | } from "../generated/DigitalaxAccessControls/DigitalaxAccessControls"; 11 | 12 | import {createAccessControlsHistory} from "./factory/DigitalaxAccessControls.factory"; 13 | 14 | 15 | export function handleAdminRoleGranted(event: AdminRoleGranted): void { 16 | createAccessControlsHistory(event, "AdminRoleGranted"); 17 | } 18 | 19 | export function handleAdminRoleRemoved(event: AdminRoleRemoved): void { 20 | createAccessControlsHistory(event, "AdminRoleRemoved"); 21 | } 22 | 23 | export function handleMinterRoleGranted(event: MinterRoleGranted): void { 24 | createAccessControlsHistory(event, "MinterRoleGranted"); 25 | } 26 | 27 | export function handleMinterRoleRemoved(event: MinterRoleRemoved): void { 28 | createAccessControlsHistory(event, "MinterRoleRemoved"); 29 | } 30 | 31 | export function handleSmartContractRoleGranted(event: SmartContractRoleGranted): void { 32 | createAccessControlsHistory(event, "SmartContractRoleGranted"); 33 | } 34 | 35 | export function handleSmartContractRoleRemoved(event: SmartContractRoleRemoved): void { 36 | createAccessControlsHistory(event, "SmartContractRoleRemoved"); 37 | } 38 | 39 | export function handleVerifiedMinterRoleGranted(event: VerifiedMinterRoleGranted): void { 40 | createAccessControlsHistory(event, "VerifiedMinterRoleGranted"); 41 | } 42 | 43 | export function handleVerifiedMinterRoleRemoved(event: VerifiedMinterRoleRemoved): void { 44 | createAccessControlsHistory(event, "VerifiedMinterRoleRemoved"); 45 | } 46 | -------------------------------------------------------------------------------- /subgraph/src/DigitalaxGarmentCollection.mapping.ts: -------------------------------------------------------------------------------- 1 | import { log, ipfs, JSONValue, Value } from "@graphprotocol/graph-ts/index"; 2 | import { 3 | MintGarmentCollection, 4 | BurnGarmentCollection, 5 | DigitalaxGarmentCollection as DigitalaxGarmentCollectionContract 6 | } from "../generated/DigitalaxGarmentCollection/DigitalaxGarmentCollection"; 7 | 8 | import { 9 | DigitalaxGarmentCollection, 10 | DigitalaxGarment, 11 | } from "../generated/schema"; 12 | 13 | export function handleGarmentCollectionMinted(event: MintGarmentCollection): void { 14 | let contract = DigitalaxGarmentCollectionContract.bind(event.address); 15 | let collectionData = contract.getCollection(event.params.collectionId); 16 | let collection = new DigitalaxGarmentCollection(event.params.collectionId.toString()); 17 | 18 | let mintedGarments = new Array(); 19 | for(let i = 0; i < collectionData.value1.toI32(); i++) { 20 | let garmentToken = DigitalaxGarment.load(collectionData.value0[i].toString()); 21 | mintedGarments.push(garmentToken.id); 22 | } 23 | collection.garments = mintedGarments; 24 | collection.garmentAuctionID = event.params.auctionTokenId; 25 | collection.rarity = event.params.rarity; 26 | collection.save(); 27 | } 28 | 29 | 30 | export function handleGarmentCollectionBurned(event: BurnGarmentCollection): void { 31 | let collection = DigitalaxGarmentCollection.load(event.params.collectionId.toString()); 32 | collection.garments = null; 33 | collection.garmentAuctionID = null; 34 | collection.rarity = null; 35 | collection.save(); 36 | } -------------------------------------------------------------------------------- /subgraph/src/DigitalaxGenesisStaking.mapping.ts: -------------------------------------------------------------------------------- 1 | import {log, BigInt} from "@graphprotocol/graph-ts/index"; 2 | 3 | import { 4 | Staked, 5 | Unstaked, 6 | EmergencyUnstake 7 | } from "../generated/DigitalaxGenesisStaking/DigitalaxGenesisStaking"; 8 | 9 | import { 10 | DigitalaxGenesisStakedToken 11 | } from "../generated/schema"; 12 | 13 | export function handleStaked(event: Staked): void { 14 | let stakedToken = new DigitalaxGenesisStakedToken(event.params.amount.toString()) 15 | stakedToken.staker = event.params.owner; 16 | stakedToken.timestamp = event.block.timestamp; 17 | stakedToken.save(); 18 | } 19 | 20 | export function handleUnstaked(event: Unstaked): void { 21 | let token: DigitalaxGenesisStakedToken | null = DigitalaxGenesisStakedToken.load(event.params.amount.toHexString()); 22 | if (token != null) { 23 | token.staker = null; 24 | token.timestamp = null; 25 | token.save(); 26 | } 27 | } 28 | 29 | export function handleEmergencyUnstake(event: EmergencyUnstake): void { 30 | let token: DigitalaxGenesisStakedToken | null = DigitalaxGenesisStakedToken.load(event.params.tokenId.toHexString()); 31 | if (token != null) { 32 | token.staker = null; 33 | token.timestamp = null; 34 | token.save(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /subgraph/src/DigitalaxNFTStaking.mapping.ts: -------------------------------------------------------------------------------- 1 | import {log, BigInt} from "@graphprotocol/graph-ts/index"; 2 | 3 | import { 4 | Staked, 5 | Unstaked, 6 | EmergencyUnstake 7 | } from "../generated/DigitalaxNFTStaking/DigitalaxNFTStaking"; 8 | 9 | import { 10 | DigitalaxGarmentStakedToken 11 | } from "../generated/schema"; 12 | 13 | export function handleStaked(event: Staked): void { 14 | let stakedToken = new DigitalaxGarmentStakedToken(event.params.amount.toString()) 15 | stakedToken.staker = event.params.owner; 16 | stakedToken.timestamp = event.block.timestamp; 17 | stakedToken.save(); 18 | } 19 | 20 | export function handleUnstaked(event: Unstaked): void { 21 | let token: DigitalaxGarmentStakedToken | null = DigitalaxGarmentStakedToken.load(event.params.amount.toHexString()); 22 | if (token != null) { 23 | token.staker = null; 24 | token.timestamp = null; 25 | token.save(); 26 | } 27 | } 28 | 29 | export function handleEmergencyUnstake(event: EmergencyUnstake): void { 30 | let token: DigitalaxGarmentStakedToken | null = DigitalaxGarmentStakedToken.load(event.params.tokenId.toHexString()); 31 | if (token != null) { 32 | token.staker = null; 33 | token.timestamp = null; 34 | token.save(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /subgraph/src/DigitalaxPodePortal.mapping.ts: -------------------------------------------------------------------------------- 1 | 2 | import { 3 | DigitalaxPodePortalMetadataAdded 4 | } from "../generated/DigitalaxPodePortal/DigitalaxPodePortal"; 5 | 6 | import { DigitalaxPodePortalMetadata } from "../generated/schema"; 7 | 8 | 9 | export function handleMetadataAdded(event: DigitalaxPodePortalMetadataAdded): void { 10 | let metadata = new DigitalaxPodePortalMetadata(event.params.index.toString()); 11 | metadata.tokenUri = event.params.tokenUri; 12 | metadata.save(); 13 | } 14 | -------------------------------------------------------------------------------- /subgraph/src/TypeConverterUtils.ts: -------------------------------------------------------------------------------- 1 | import {BigInt} from "@graphprotocol/graph-ts/index"; 2 | 3 | export function toBigInt(integer: i32): BigInt { 4 | return BigInt.fromI32(integer) 5 | } -------------------------------------------------------------------------------- /subgraph/src/constants.ts: -------------------------------------------------------------------------------- 1 | import {BigDecimal, BigInt, Address, Bytes} from "@graphprotocol/graph-ts/index"; 2 | 3 | export const ZERO_ADDRESS = Address.fromString("0x0000000000000000000000000000000000000000") 4 | export const ZERO_BIG_DECIMAL = BigDecimal.fromString("0") 5 | export const ZERO = BigInt.fromI32(0) 6 | export const ONE = BigInt.fromI32(1) 7 | export const MAX_UINT_256 = BigInt.fromUnsignedBytes(Bytes.fromHexString("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff") as Bytes) 8 | 9 | export const ONE_ETH = new BigDecimal(BigInt.fromI32(1).times(BigInt.fromI32(10).pow(18))) 10 | export const SECONDS_IN_DAY = BigInt.fromI32(86400) 11 | -------------------------------------------------------------------------------- /subgraph/src/factory/Day.factory.ts: -------------------------------------------------------------------------------- 1 | import {ethereum} from "@graphprotocol/graph-ts/index"; 2 | 3 | import { 4 | Day 5 | } from "../../generated/schema" 6 | 7 | import {dayMonthYearFromEventTimestamp} from "../DateConverter"; 8 | import {ZERO} from '../constants'; 9 | 10 | export function loadOrCreateDay(date: string): Day | null { 11 | let dayEntity: Day | null = Day.load(date) 12 | 13 | if (dayEntity === null) { 14 | dayEntity = new Day(date) 15 | dayEntity.totalBidValue = ZERO; 16 | dayEntity.totalWithdrawalValue = ZERO; 17 | dayEntity.totalNetBidActivity = ZERO; 18 | dayEntity.totalMarketplaceVolumeInETH = ZERO; 19 | dayEntity.totalMarketplaceVolumeInMona = ZERO; 20 | dayEntity.save(); 21 | } 22 | 23 | return dayEntity; 24 | } 25 | 26 | export function loadDayFromEvent(event: ethereum.Event): Day | null { 27 | let dayMonthYear = dayMonthYearFromEventTimestamp(event) 28 | 29 | let month = dayMonthYear.month.toString(); 30 | let day = dayMonthYear.day.toString(); 31 | let paddedMonth = month.length === 1 ? "0".concat(month) : month; 32 | let paddedDay = day.length === 1 ? "0".concat(day) : day; 33 | 34 | let dayId = dayMonthYear.year.toString().concat("-").concat(paddedMonth).concat("-").concat(paddedDay); 35 | 36 | return loadOrCreateDay(dayId) 37 | } 38 | -------------------------------------------------------------------------------- /subgraph/src/factory/DigitalaxAccessControls.factory.ts: -------------------------------------------------------------------------------- 1 | 2 | import { ethereum } from "@graphprotocol/graph-ts"; 3 | import { DigitalaxAccessControlsHistory } from "../../generated/schema"; 4 | 5 | export function createAccessControlsHistory(event: ethereum.Event, eventName: string): void { 6 | let entity = new DigitalaxAccessControlsHistory(event.logIndex.toString()); 7 | entity.transactionHash = event.transaction.hash; 8 | entity.eventName = eventName; 9 | entity.timestamp = event.block.timestamp; 10 | entity.beneficiary = event.parameters[0].value.toAddress(); 11 | entity.caller = event.parameters[1].value.toAddress(); 12 | entity.save(); 13 | } 14 | -------------------------------------------------------------------------------- /subgraph/src/factory/DigitalaxChildOwner.factory.ts: -------------------------------------------------------------------------------- 1 | import {BigInt, ethereum, Address} from "@graphprotocol/graph-ts/index"; 2 | import {ZERO} from "../constants"; 3 | 4 | import {DigitalaxChildOwner} from "../../generated/schema"; 5 | import {DigitalaxMaterials as DigitalaxMaterialsContract} from "../../generated/DigitalaxMaterials/DigitalaxMaterials"; 6 | 7 | export function loadOrCreateDigitalaxChildOwner( 8 | event: ethereum.Event, 9 | parentTokenOwner: Address, 10 | childTokenId: BigInt 11 | ): DigitalaxChildOwner { 12 | 13 | let childContract = DigitalaxMaterialsContract.bind(event.address); 14 | 15 | // {parent-token-id-holder}-{child-token-id} 16 | let childId = parentTokenOwner.toHexString() + '-' + childTokenId.toString(); 17 | 18 | let materialOwner = DigitalaxChildOwner.load(childId); 19 | if (materialOwner == null) { 20 | materialOwner = new DigitalaxChildOwner(childId); 21 | materialOwner.childId = childTokenId; 22 | materialOwner.owner = parentTokenOwner; 23 | materialOwner.contract = event.address; 24 | materialOwner.tokenUri = childContract.uri(childTokenId); 25 | materialOwner.amount = ZERO 26 | } 27 | materialOwner.save(); 28 | 29 | return materialOwner as DigitalaxChildOwner; 30 | } 31 | -------------------------------------------------------------------------------- /subgraph/src/factory/DigitalaxCollector.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxCollector} from "../../generated/schema"; 2 | import {Address} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateDigitalaxCollector(collector: Address): DigitalaxCollector { 5 | let digitalaxCollector: DigitalaxCollector | null = DigitalaxCollector.load(collector.toHexString()); 6 | if (digitalaxCollector == null) { 7 | digitalaxCollector = new DigitalaxCollector(collector.toHexString()) 8 | digitalaxCollector.parentsOwned = new Array(); 9 | digitalaxCollector.childrenOwned = new Array(); 10 | } 11 | digitalaxCollector.save() 12 | return digitalaxCollector as DigitalaxCollector; 13 | } 14 | -------------------------------------------------------------------------------- /subgraph/src/factory/DigitalaxGarmentChild.factory.ts: -------------------------------------------------------------------------------- 1 | import {BigInt, ethereum, Address} from "@graphprotocol/graph-ts/index"; 2 | import {ZERO} from "../constants"; 3 | 4 | import {DigitalaxGarmentChild} from "../../generated/schema"; 5 | import {DigitalaxGarmentNFT as DigitalaxGarmentNFTContract} from "../../generated/DigitalaxGarmentNFT/DigitalaxGarmentNFT"; 6 | import {DigitalaxMaterials as DigitalaxMaterialsContract} from "../../generated/DigitalaxMaterials/DigitalaxMaterials"; 7 | 8 | export function loadOrCreateDigitalaxGarmentChild( 9 | event: ethereum.Event, 10 | parentTokenId: BigInt, 11 | childTokenId: BigInt 12 | ): DigitalaxGarmentChild { 13 | 14 | let contract = DigitalaxGarmentNFTContract.bind(event.address); 15 | 16 | let childContract = DigitalaxMaterialsContract.bind(contract.childContract()); 17 | 18 | // {parent-token-id}-{child-token-id} 19 | let childId = parentTokenId.toString() + '-' + childTokenId.toString(); 20 | 21 | let garmentChild = DigitalaxGarmentChild.load(childId); 22 | if (garmentChild == null) { 23 | garmentChild = new DigitalaxGarmentChild(childId); 24 | garmentChild.childId = childTokenId; 25 | garmentChild.parentId = parentTokenId; 26 | garmentChild.contract = contract.childContract(); 27 | garmentChild.tokenUri = childContract.uri(childTokenId); 28 | garmentChild.amount = ZERO; 29 | garmentChild.rarity = 'Common'; // This needs to be updated from the token uri or hardcoded 30 | } 31 | garmentChild.save(); 32 | 33 | return garmentChild as DigitalaxGarmentChild; 34 | } 35 | -------------------------------------------------------------------------------- /subgraph/src/factory/DigitalaxGarmentNFTGlobalStats.factory.ts: -------------------------------------------------------------------------------- 1 | import {DigitalaxGarmentNFTGlobalStat} from "../../generated/schema"; 2 | import {ZERO} from "../constants"; 3 | 4 | export function loadOrCreateGarmentNFTGlobalStats(): DigitalaxGarmentNFTGlobalStat | null { 5 | let globalStats = DigitalaxGarmentNFTGlobalStat.load('1'); 6 | 7 | if (globalStats == null) { 8 | globalStats = new DigitalaxGarmentNFTGlobalStat('1'); 9 | globalStats.totalSalesValue = ZERO; 10 | globalStats.totalActiveBidsValue = ZERO; 11 | globalStats.totalMarketplaceSalesInETH = ZERO; 12 | globalStats.totalMarketplaceSalesInMona = ZERO; 13 | globalStats.save(); 14 | } 15 | 16 | return globalStats; 17 | } 18 | -------------------------------------------------------------------------------- /subgraph/src/factory/GenesisContributor.factory.ts: -------------------------------------------------------------------------------- 1 | import {GenesisContributor} from "../../generated/schema"; 2 | import {Address, BigInt, ethereum} from "@graphprotocol/graph-ts/index"; 3 | 4 | export function loadOrCreateGenesisContributor(buyer: Address, eventBlock: ethereum.Block, totalContributionInWei: BigInt): GenesisContributor { 5 | let contributor: GenesisContributor | null = GenesisContributor.load(buyer.toHexString()); 6 | if (contributor == null) { 7 | contributor = new GenesisContributor(buyer.toHexString()) 8 | contributor.contributor = buyer 9 | contributor.firstContributedTimestamp = eventBlock.timestamp 10 | contributor.totalContributionInWei = totalContributionInWei 11 | contributor.lastContributedTimestamp = eventBlock.timestamp 12 | } 13 | contributor.save() 14 | return contributor as GenesisContributor; 15 | } 16 | --------------------------------------------------------------------------------