Skip to content

Commit

Permalink
feat(launchpad): Use DAO Proposal Single contract address in nft-laun…
Browse files Browse the repository at this point in the history
…chpad contract config (#1488)

Co-authored-by: hthieu1110 <[email protected]>
Co-authored-by: n0izn0iz <[email protected]>
  • Loading branch information
3 people authored Feb 22, 2025
1 parent c18215d commit fefe45d
Show file tree
Hide file tree
Showing 38 changed files with 4,173 additions and 628 deletions.
3,250 changes: 3,061 additions & 189 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions go/pkg/networks/features.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ func (nb *NetworkBase) GetFeatureCosmWasmNFTsBurner() (*FeatureCosmWasmNFTsBurne

type FeatureCosmWasmNFTLaunchpad struct {
*FeatureBase
LaunchpadContractAddress string `json:"launchpadContractAddress"`
DefaultMintDenom string `json:"defaultMintDenom"`
LaunchpadEndpoint string `json:"launchpadEndpoint"`
CodeId float64 `json:"codeId"`
NftTr721CodeId float64 `json:"nftTr721CodeId"`
LaunchpadContractAddress string `json:"launchpadContractAddress"`
DefaultMintDenom string `json:"defaultMintDenom"`
LaunchpadEndpoint string `json:"launchpadEndpoint"`
CodeId float64 `json:"codeId"`
NftTr721CodeId float64 `json:"nftTr721CodeId"`
DaoProposalSingleContractAddress string `json:"daoProposalSingleContractAddress"`
}

var _ Feature = &FeatureCosmWasmNFTLaunchpad{}
Expand Down
18 changes: 15 additions & 3 deletions networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -11649,6 +11649,17 @@
"RiotP2E",
"NFTMarketplaceLeaderboard"
],
"featureObjects": [
{
"type": "CosmWasmNFTLaunchpad",
"launchpadContractAddress": "tori1l07lh669x8wg2rh3pxzpatrr2npf5ql7y6kusaup53fu2xr68p5qglyy9t",
"launchpadEndpoint": "http://localhost:9090",
"nftTr721CodeId": 60,
"codeId": 95,
"defaultMintDenom": "utori",
"daoProposalSingleContractAddress": "tori1tj2uked2zfq958w6cugnm44qlllnrpaaxk09j39qqdqhhedjpljszjyhx6"
}
],
"currencies": [
{
"denom": "utori",
Expand Down Expand Up @@ -11746,11 +11757,12 @@
},
{
"type": "CosmWasmNFTLaunchpad",
"launchpadContractAddress": "tori1te7ku4de0k4rl8lhyuvpmhygaq7k7vy5zpsjq9y638efxsnx3aaqck2utf",
"launchpadContractAddress": "tori1f62uv8zght6vnnq6kh3pg69xca9s03ecwpal7gquupf9knctk25suzf7rq",
"launchpadEndpoint": "https://dapp-backend.testnet.teritori.com",
"nftTr721CodeId": 60,
"codeId": 71,
"defaultMintDenom": "utori"
"codeId": 96,
"defaultMintDenom": "utori",
"daoProposalSingleContractAddress": "tori1huu2ysuct2e9xnmxc28xdwfeflytw2samzp95a2devjqs0qfj6fqx47v57"
},
{
"type": "CosmWasmRakki",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/networks/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const zodCosmWasmNFTLaunchpad = z.object({
launchpadEndpoint: z.string(),
codeId: z.number(),
nftTr721CodeId: z.number(),
daoProposalSingleContractAddress: z.string(),
});

export type CosmWasmNFTLaunchpad = z.infer<typeof zodCosmWasmNFTLaunchpad>;
Expand Down
14 changes: 14 additions & 0 deletions packages/networks/teritori-localnet/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import { teritoriLocalnetCurrencies } from "./currencies";
import { CosmWasmNFTLaunchpad } from "../features";
import { NetworkFeature, NetworkInfo, NetworkKind } from "../types";

const nameServiceContractAddress = "";

const riotContractAddressGen1 = "";

const cosmwasmNftLaunchpadFeature: CosmWasmNFTLaunchpad = {
type: NetworkFeature.CosmWasmNFTLaunchpad,
launchpadContractAddress:
"tori1l07lh669x8wg2rh3pxzpatrr2npf5ql7y6kusaup53fu2xr68p5qglyy9t",
launchpadEndpoint: "http://localhost:9090",
nftTr721CodeId: 60,
codeId: 95,
defaultMintDenom: "utori",
daoProposalSingleContractAddress:
"tori1tj2uked2zfq958w6cugnm44qlllnrpaaxk09j39qqdqhhedjpljszjyhx6",
};

export const teritoriLocalnetNetwork: NetworkInfo = {
id: "teritori-localnet",
kind: NetworkKind.Cosmos,
Expand All @@ -23,6 +36,7 @@ export const teritoriLocalnetNetwork: NetworkInfo = {
NetworkFeature.RiotP2E,
NetworkFeature.NFTMarketplaceLeaderboard,
],
featureObjects: [cosmwasmNftLaunchpadFeature],
currencies: teritoriLocalnetCurrencies,
txExplorer: "",
accountExplorer: "",
Expand Down
6 changes: 4 additions & 2 deletions packages/networks/teritori-testnet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ const nftMarketplace: NFTMarketplace = {
const cosmwasmNftLaunchpadFeature: CosmWasmNFTLaunchpad = {
type: NetworkFeature.CosmWasmNFTLaunchpad,
launchpadContractAddress:
"tori1te7ku4de0k4rl8lhyuvpmhygaq7k7vy5zpsjq9y638efxsnx3aaqck2utf",
"tori1f62uv8zght6vnnq6kh3pg69xca9s03ecwpal7gquupf9knctk25suzf7rq",
launchpadEndpoint: "https://dapp-backend.testnet.teritori.com",
nftTr721CodeId: 60,
codeId: 71,
codeId: 96,
defaultMintDenom: "utori",
daoProposalSingleContractAddress:
"tori1huu2ysuct2e9xnmxc28xdwfeflytw2samzp95a2devjqs0qfj6fqx47v57",
};

const rakkiFeature: CosmWasmRakki = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { LaunchingOrganizationSection } from "../LaunchingOrganizationSection";

import { ConfigureVotingSection } from "@/components/dao/ConfigureVotingSection";
import { useFeedbacks } from "@/context/FeedbacksProvider";
import { TeritoriNameServiceClient } from "@/contracts-clients/teritori-name-service/TeritoriNameService.client";
import { nsNameInfoQueryKey } from "@/hooks/useNSNameInfo";
import useSelectedWallet from "@/hooks/useSelectedWallet";
import {
Expand All @@ -16,6 +17,7 @@ import {
mustGetCosmosNetwork,
NetworkKind,
} from "@/networks";
import { getKeplrSigningCosmWasmClient } from "@/networks/signer";
import { createDaoMemberBased, CreateDaoMemberBasedParams } from "@/utils/dao";
import { adenaDeployGnoDAO } from "@/utils/gnodao/deploy";
import { getDuration, getPercent } from "@/utils/gnodao/helpers";
Expand Down Expand Up @@ -100,8 +102,23 @@ export const MembershipDeployerSteps: React.FC<{
network.cwAdminFactoryContractAddress!;
const walletAddress = selectedWallet.address;

const signingCosmWasmClient =
await getKeplrSigningCosmWasmClient(networkId);

if (!network.nameServiceContractAddress) {
throw new Error("no name service contract address");
}

const nameServiceClient = new TeritoriNameServiceClient(
signingCosmWasmClient,
walletAddress,
network.nameServiceContractAddress,
);

if (!memberSettingsFormData) return false;
const params: CreateDaoMemberBasedParams = {
signingCosmWasmClient,
nameServiceClient,
networkId,
sender: walletAddress,
contractAddress: cwAdminFactoryContractAddress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { LaunchingOrganizationSection } from "../LaunchingOrganizationSection";

import { ConfigureVotingSection } from "@/components/dao/ConfigureVotingSection";
import { useFeedbacks } from "@/context/FeedbacksProvider";
import { TeritoriNameServiceClient } from "@/contracts-clients/teritori-name-service/TeritoriNameService.client";
import { nsNameInfoQueryKey } from "@/hooks/useNSNameInfo";
import useSelectedWallet from "@/hooks/useSelectedWallet";
import {
Expand All @@ -17,6 +18,7 @@ import {
mustGetCosmosNetwork,
NetworkKind,
} from "@/networks";
import { getKeplrSigningCosmWasmClient } from "@/networks/signer";
import { createDaoMemberBased, CreateDaoMemberBasedParams } from "@/utils/dao";
import { adenaDeployGnoDAO } from "@/utils/gnodao/deploy";
import { getDuration, getPercent } from "@/utils/gnodao/helpers";
Expand Down Expand Up @@ -113,8 +115,23 @@ export const RolesDeployerSteps: React.FC<{
network.cwAdminFactoryContractAddress!;
const walletAddress = selectedWallet.address;

const signingCosmWasmClient =
await getKeplrSigningCosmWasmClient(networkId);

if (!network.nameServiceContractAddress) {
throw new Error("no name service contract address");
}

const nameServiceClient = new TeritoriNameServiceClient(
signingCosmWasmClient,
walletAddress,
network.nameServiceContractAddress,
);

if (!memberSettingsFormData) return false;
const params: CreateDaoMemberBasedParams = {
signingCosmWasmClient,
nameServiceClient,
networkId,
sender: walletAddress,
contractAddress: cwAdminFactoryContractAddress,
Expand Down
13 changes: 6 additions & 7 deletions packages/scripts/integration-testing/da0da0Test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import fs from "fs/promises";

import { buildCosmos, startCosmosLocalnet } from "./cosmos";
import { teritoriLocalnetNetwork } from "../../networks/teritori-localnet";

import { deployDA0DA0 } from "@/scripts/network-setup/deployDA0DA0";
import { deployDA0DA0 } from "../network-setup/dao-dao/deployDA0DA0";

const main = async () => {
program.argument(
Expand All @@ -23,11 +22,11 @@ const main = async () => {

// test cosmwasm

await deployDA0DA0(
{ binaryPath: binary, home, signer: admSigner },
teritoriLocalnetNetwork.id,
"testnet-adm",
);
await deployDA0DA0({
opts: { binaryPath: binary, home, signer: admSigner },
networkId: teritoriLocalnetNetwork.id,
wallet: "testnet-adm",
});

// clean

Expand Down
6 changes: 0 additions & 6 deletions packages/scripts/integration-testing/simpleTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,12 @@ const main = async () => {
throw new Error("adm signer is undefined");
}

// test cosmwasm

await deployTeritoriEcosystem(
{ binaryPath: binary, home, signer: admSigner },
teritoriLocalnetNetwork.id,
"testnet-adm",
);

// clean

await kill();

await fs.rm(home, { recursive: true, force: true });
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { bech32 } from "bech32";
import { program } from "commander";
import { cloneDeep } from "lodash";
import os from "os";
import path from "path";

import {
Expand All @@ -16,7 +14,7 @@ import {
storeWASM,
} from "@/scripts/network-setup/deployLib";

const deployCwAddressList = async ({
export const deployCwAddressList = async ({
opts,
networkId,
wallet,
Expand Down Expand Up @@ -58,14 +56,14 @@ const deployCwAddressList = async ({
__dirname,
"cw_address_list.wasm",
);
network.cwAdminFactoryCodeId = await storeWASM(
network.cwAddressListCodeId = await storeWASM(
opts,
wallet,
network,
cwAddressListWasmFilePath,
);

console.log("Instantiating cw address list", network.cwAdminFactoryCodeId);
console.log("Instantiating cw address list", network.cwAddressListCodeId);
nftMarketplaceFeature.cwAddressListContractAddress =
await instantiateCwAddressList(opts, wallet, walletAddr, network);

Expand All @@ -83,7 +81,7 @@ const instantiateCwAddressList = async (
adminAddr: string,
network: CosmosNetworkInfo,
) => {
const codeId = network.cwAdminFactoryCodeId;
const codeId = network.cwAddressListCodeId;
if (!codeId) {
throw new Error("CW Address List code ID not found");
}
Expand All @@ -97,23 +95,3 @@ const instantiateCwAddressList = async (
{},
);
};

const main = async () => {
program.argument("<network-id>", "Network id to deploy to");
program.argument("<wallet>", "Wallet to deploy from");
program.option("--keyring-backend [keyring-backend]", "Keyring backend");
program.parse();
const [networkId, wallet] = program.args;
const { keyringBackend } = program.opts();

await deployCwAddressList({
opts: {
home: path.join(os.homedir(), ".teritorid"),
binaryPath: "teritorid",
keyringBackend,
},
networkId,
wallet,
});
};
main();
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { program } from "commander";
import os from "os";
import path from "path";

import { deployCwAddressList } from "./deployCwAddressList";

const main = async () => {
program.argument("<network-id>", "Network id to deploy to");
program.argument("<wallet>", "Wallet to deploy from");
program.option("--keyring-backend [keyring-backend]", "Keyring backend");
program.parse();
const [networkId, wallet] = program.args;
const { keyringBackend } = program.opts();

await deployCwAddressList({
opts: {
home: path.join(os.homedir(), ".teritorid"),
binaryPath: "teritorid",
keyringBackend,
},
networkId,
wallet,
});
};
main();
Loading

0 comments on commit fefe45d

Please sign in to comment.