Skip to content

Commit

Permalink
Merge pull request #369 from calabara-hq/bugfix
Browse files Browse the repository at this point in the history
contest settings logic bugfix #patch
  • Loading branch information
ndodson authored Dec 2, 2024
2 parents 97fbfe1 + e30e179 commit b375abb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
18 changes: 12 additions & 6 deletions uplink-client/src/app/(space)/[name]/create-contest/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { ChainSelect } from "@/ui/ChannelSettings/ChainSelect";
import { ChainId } from "@/types/chains";
import { Info } from "@/ui/DesignKit/Info";
import { SectionWrapper } from "@/ui/ChannelSettings/Utils";
import { Address } from "viem";
import { Address, zeroAddress } from "viem";


const WaitForNewChannel = ({ spaceData, contractId }: { spaceData: Space, contractId: ContractID }) => {
Expand All @@ -52,7 +52,7 @@ const WaitForNewChannel = ({ spaceData, contractId }: { spaceData: Space, contra

}

export const TempCreateContestV2 = ({ space }: { space: Space }) => {
export const CreateContestV2 = ({ space }: { space: Space }) => {
const { createFiniteChannel, status, txHash, error, channelAddress } = useCreateFiniteChannel();
const { data: walletClient } = useWalletClient();
const { data: session } = useSession();
Expand Down Expand Up @@ -119,16 +119,20 @@ export const TempCreateContestV2 = ({ space }: { space: Space }) => {

const { data: deadlinesOutput } = validateDeadlines()

const hasCreatorLogic = submitterLogicOutput.logicContract !== zeroAddress;
const hasMinterLogic = voterLogicOutput.logicContract !== zeroAddress;
const hasLogic = hasCreatorLogic || hasMinterLogic;

const data: CreateFiniteChannelConfig = {
uri: metadataOutput.uri,
name: metadata.title,
defaultAdmin: walletClient.account.address,
managers: space.admins.map((admin) => admin.address),
setupActions: submitterLogicOutput.logicContract || voterLogicOutput.logicContract ?
setupActions: hasLogic ?
[{
logicContract: submitterLogicOutput.logicContract || voterLogicOutput.logicContract,
creatorLogic: submitterLogicOutput.logic,
minterLogic: voterLogicOutput.logic
logicContract: hasCreatorLogic ? submitterLogicOutput.logicContract : hasMinterLogic ? voterLogicOutput.logicContract : zeroAddress,
creatorLogic: submitterLogicOutput?.logic ?? [],
minterLogic: voterLogicOutput?.logic ?? []
}]
: [],
transportLayer: {
Expand All @@ -144,6 +148,8 @@ export const TempCreateContestV2 = ({ space }: { space: Space }) => {
}
}

console.log(data)

await createFiniteChannel(data);

} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions uplink-client/src/app/(space)/[name]/create-contest/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fetchSingleSpace from "@/lib/fetch/fetchSingleSpace";
import { Suspense } from "react";
import { TempCreateContestV2 } from "./client";
import { CreateContestV2 } from "./client";

const Skeleton = () => {
return (
Expand All @@ -21,7 +21,7 @@ export default async function Page({ params }: { params: { name: string } }) {
return (
<div className="flex gap-6 m-auto w-full lg:w-[90vw]">
<Suspense fallback={<Skeleton />} >
<TempCreateContestV2 space={space} />
<CreateContestV2 space={space} />
</Suspense>
</div>
)
Expand Down
2 changes: 0 additions & 2 deletions uplink-client/src/ui/ChannelSidebar/ContestDetailsV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import Link from "next/link";
import { ContractID, isNativeToken, splitContractID } from "@/types/channel";
import { IFiniteTransportConfig, ILogicConfig } from "@tx-kit/sdk/subgraph";
import { useTokenInfo } from "@/hooks/useTokenInfo";
import { NATIVE_TOKEN } from "@tx-kit/sdk";
import { Address, decodeAbiParameters, formatUnits, Hex } from "viem";
import { useFiniteTransportLayerState } from "@/hooks/useFiniteTransportLayerState";
import { ChannelStateLabel, RemainingTimeLabel, RenderTransportLayerState } from "./SidebarUtils";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../DesignKit/Tooltip";
import { Info } from "../DesignKit/Info";
Expand Down
2 changes: 1 addition & 1 deletion uplink-hub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"private": true,
"scripts": {
"env:test": "cp .env.test .env",
"env:dev": "cp .env.prod .env",
"env:dev": "cp .env.dev .env",
"env:staging": "cp .env.staging .env",
"env:prod": "cp .env.prod .env",
"test:unit-lib": "yarn run env:test && cross-env ENV_PATH=./.env dotenv -- yarn workspace lib test",
Expand Down

0 comments on commit b375abb

Please sign in to comment.